From 84aa98c774ead9b388d5cbc46035248af7f12db8 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Fri, 15 Aug 2025 06:56:48 +1000 Subject: [PATCH 001/343] bugfix(input): No longer require two clicks to deselect worker after cancelling building placement in alternate mouse mode (#1453) --- .../GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp | 1 + .../GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp index bf6d3b4bbea..d147a0932eb 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp @@ -962,6 +962,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa if (TheInGameUI->getPendingPlaceSourceObjectID() != INVALID_ID) { TheInGameUI->placeBuildAvailable(NULL, NULL); + TheInGameUI->setPreventLeftClickDeselectionInAlternateMouseModeForOneClick(FALSE); disp = DESTROY_MESSAGE; TheInGameUI->setScrolling(FALSE); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp index c27645e1cb4..cdb40bede4c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp @@ -1038,6 +1038,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa if (TheInGameUI->getPendingPlaceSourceObjectID() != INVALID_ID) { TheInGameUI->placeBuildAvailable(NULL, NULL); + TheInGameUI->setPreventLeftClickDeselectionInAlternateMouseModeForOneClick(FALSE); disp = DESTROY_MESSAGE; TheInGameUI->setScrolling(FALSE); } From 620460dad3d7113d97e85bf2731b1ff934bbdfeb Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Fri, 15 Aug 2025 02:29:49 +1000 Subject: [PATCH 002/343] unify(object): Merge the condition switch for the unit veterancy effect from Zero Hour (#1455) --- .../Include/GameLogic/ExperienceTracker.h | 4 +-- .../Include/GameLogic/Module/ActiveBody.h | 2 +- .../Include/GameLogic/Module/BodyModule.h | 4 +-- .../Include/GameLogic/Module/InactiveBody.h | 2 +- .../GameEngine/Include/GameLogic/Object.h | 2 +- .../GameLogic/Object/Body/ActiveBody.cpp | 33 ++++++++++--------- .../GameLogic/Object/ExperienceTracker.cpp | 10 +++--- .../Source/GameLogic/Object/Object.cpp | 6 ++-- 8 files changed, 33 insertions(+), 30 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameLogic/ExperienceTracker.h b/Generals/Code/GameEngine/Include/GameLogic/ExperienceTracker.h index 0ef67c95b75..af397f3c0ea 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/ExperienceTracker.h +++ b/Generals/Code/GameEngine/Include/GameLogic/ExperienceTracker.h @@ -51,12 +51,12 @@ class ExperienceTracker : public MemoryPoolObject, public Snapshot Bool isTrainable() const; ///< Can I gain experience? Bool isAcceptingExperiencePoints() const; ///< Either I am trainable, or I have a Sink set up - void setVeterancyLevel( VeterancyLevel newLevel ); ///< Set Level to this + void setVeterancyLevel( VeterancyLevel newLevel, Bool provideFeedback = TRUE ); ///< Set Level to this void setMinVeterancyLevel( VeterancyLevel newLevel ); ///< Set Level to AT LEAST this... if we are already >= this level, do nothing. void addExperiencePoints( Int experienceGain, Bool canScaleForBonus = TRUE ); ///< Gain this many exp. Bool gainExpForLevel(Int levelsToGain, Bool canScaleForBonus = TRUE ); ///< Gain enough exp to gain a level. return false if can't gain a level. Bool canGainExpForLevel(Int levelsToGain) const; ///< return same value as gainExpForLevel, but don't change anything - void setExperienceAndLevel(Int experienceIn); + void setExperienceAndLevel(Int experienceIn, Bool provideFeedback = TRUE ); void setExperienceSink( ObjectID sink ); ///< My experience actually goes to this person (loose couple) Real getExperienceScalar() const { return m_experienceScalar; } diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/ActiveBody.h b/Generals/Code/GameEngine/Include/GameLogic/Module/ActiveBody.h index 215b1300cdd..1566395ba20 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/ActiveBody.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/ActiveBody.h @@ -87,7 +87,7 @@ class ActiveBody : public BodyModule virtual ObjectID getClearableLastAttacker() const { return (m_lastDamageCleared ? INVALID_ID : m_lastDamageInfo.in.m_sourceID); } virtual void clearLastAttacker() { m_lastDamageCleared = true; } - void onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel ); + void onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel, Bool provideFeedback = TRUE ); virtual void setArmorSetFlag(ArmorSetType ast) { m_curArmorSetFlags.set(ast, 1); } virtual void clearArmorSetFlag(ArmorSetType ast) { m_curArmorSetFlags.set(ast, 0); } diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/BodyModule.h b/Generals/Code/GameEngine/Include/GameLogic/Module/BodyModule.h index 1bda55c2620..392c5a95bfa 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/BodyModule.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/BodyModule.h @@ -150,7 +150,7 @@ class BodyModuleInterface virtual void setDamageState( BodyDamageType newState ) = 0; ///< control damage state directly. Will adjust hitpoints. virtual void setAflame( Bool setting ) = 0;///< This is a major change like a damage state. - virtual void onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel ) = 0; ///< I just achieved this level right this moment + virtual void onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel, Bool provideFeedback ) = 0; ///< I just achieved this level right this moment virtual void setArmorSetFlag(ArmorSetType ast) = 0; virtual void clearArmorSetFlag(ArmorSetType ast) = 0; @@ -237,7 +237,7 @@ class BodyModule : public BehaviorModule, public BodyModuleInterface virtual void setDamageState( BodyDamageType newState ) = 0; ///< control damage state directly. Will adjust hitpoints. virtual void setAflame( Bool setting ) = 0;///< This is a major change like a damage state. - virtual void onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel ) = 0; ///< I just achieved this level right this moment + virtual void onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel, Bool provideFeedback = FALSE ) = 0; ///< I just achieved this level right this moment virtual void setArmorSetFlag(ArmorSetType ast) = 0; virtual void clearArmorSetFlag(ArmorSetType ast) = 0; diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/InactiveBody.h b/Generals/Code/GameEngine/Include/GameLogic/Module/InactiveBody.h index 96d7c725bcb..6b8cb43a0c6 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/InactiveBody.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/InactiveBody.h @@ -58,7 +58,7 @@ class InactiveBody : public BodyModule virtual void setDamageState( BodyDamageType newState ); ///< control damage state directly. Will adjust hitpoints. virtual void setAflame( Bool setting ){}///< This is a major change like a damage state. - void onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel ) { /* nothing */ } + void onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel, Bool provideFeedback ) { /* nothing */ } virtual void setArmorSetFlag(ArmorSetType ast) { /* nothing */ } virtual void clearArmorSetFlag(ArmorSetType ast) { /* nothing */ } diff --git a/Generals/Code/GameEngine/Include/GameLogic/Object.h b/Generals/Code/GameEngine/Include/GameLogic/Object.h index 0f8da3bf134..41e074b04d4 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Object.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Object.h @@ -217,7 +217,7 @@ class Object : public Thing, public Snapshot void healCompletely(); ///< Restore max health to this Object void scoreTheKill( const Object *victim ); ///< I just killed this object. - void onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel ); ///< I just achieved this level right this moment + void onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel, Bool provideFeedback = TRUE ); ///< I just achieved this level right this moment ExperienceTracker* getExperienceTracker() {return m_experienceTracker;} const ExperienceTracker* getExperienceTracker() const {return m_experienceTracker;} VeterancyLevel getVeterancyLevel() const; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp index e8c2cf5aec9..5f7598233a6 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp @@ -1070,29 +1070,32 @@ void ActiveBody::setIndestructible( Bool indestructible ) //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- -void ActiveBody::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel ) +void ActiveBody::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel, Bool provideFeedback ) { if (oldLevel == newLevel) return; if (oldLevel < newLevel) { - AudioEventRTS veterancyChanged; - switch (newLevel) + if (provideFeedback) { - case LEVEL_VETERAN: - veterancyChanged = *getObject()->getTemplate()->getSoundPromotedVeteran(); - break; - case LEVEL_ELITE: - veterancyChanged = *getObject()->getTemplate()->getSoundPromotedElite(); - break; - case LEVEL_HEROIC: - veterancyChanged = *getObject()->getTemplate()->getSoundPromotedHero(); - break; - } + AudioEventRTS veterancyChanged; + switch (newLevel) + { + case LEVEL_VETERAN: + veterancyChanged = *getObject()->getTemplate()->getSoundPromotedVeteran(); + break; + case LEVEL_ELITE: + veterancyChanged = *getObject()->getTemplate()->getSoundPromotedElite(); + break; + case LEVEL_HEROIC: + veterancyChanged = *getObject()->getTemplate()->getSoundPromotedHero(); + break; + } - veterancyChanged.setObjectID(getObject()->getID()); - TheAudio->addAudioEvent(&veterancyChanged); + veterancyChanged.setObjectID(getObject()->getID()); + TheAudio->addAudioEvent(&veterancyChanged); + } //Also mark the UI dirty -- incase the object is selected or contained. Object *obj = getObject(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp index f8f58f04452..bf68f084d66 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp @@ -98,7 +98,7 @@ void ExperienceTracker::setMinVeterancyLevel( VeterancyLevel newLevel ) } //------------------------------------------------------------------------------------------------- -void ExperienceTracker::setVeterancyLevel( VeterancyLevel newLevel ) +void ExperienceTracker::setVeterancyLevel( VeterancyLevel newLevel, Bool provideFeedback ) { // This does not check for IsTrainable, because this function is for explicit setting, // so the setter is assumed to know what they are doing. The game function @@ -109,7 +109,7 @@ void ExperienceTracker::setVeterancyLevel( VeterancyLevel newLevel ) m_currentLevel = newLevel; m_currentExperience = m_parent->getTemplate()->getExperienceRequired(m_currentLevel); //Minimum for this level if (m_parent) - m_parent->onVeterancyLevelChanged( oldLevel, newLevel ); + m_parent->onVeterancyLevelChanged( oldLevel, newLevel, provideFeedback ); } } @@ -185,7 +185,7 @@ void ExperienceTracker::addExperiencePoints( Int experienceGain, Bool canScaleFo } //------------------------------------------------------------------------------------------------- -void ExperienceTracker::setExperienceAndLevel( Int experienceIn ) +void ExperienceTracker::setExperienceAndLevel( Int experienceIn, Bool provideFeedback ) { if( m_experienceSink != INVALID_ID ) { @@ -194,7 +194,7 @@ void ExperienceTracker::setExperienceAndLevel( Int experienceIn ) if( sinkPointer ) { // Not a fatal failure if not valid, he died when I was in the air. - sinkPointer->getExperienceTracker()->setExperienceAndLevel( experienceIn ); + sinkPointer->getExperienceTracker()->setExperienceAndLevel( experienceIn, provideFeedback ); return; } } @@ -220,7 +220,7 @@ void ExperienceTracker::setExperienceAndLevel( Int experienceIn ) if( oldLevel != m_currentLevel ) { // Edge trigger special level gain effects. - m_parent->onVeterancyLevelChanged( oldLevel, m_currentLevel ); //<<== paradox! this may be a level lost! + m_parent->onVeterancyLevelChanged( oldLevel, m_currentLevel, provideFeedback ); //<<== paradox! this may be a level lost! } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp index aac616322f0..14da239e131 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -2763,7 +2763,7 @@ Bool Object::hasSpecialPower( SpecialPowerType type ) const } //------------------------------------------------------------------------------------------------- -void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel ) +void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel, Bool provideFeedback ) { updateUpgradeModules(); @@ -2773,7 +2773,7 @@ void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel ne BodyModuleInterface* body = getBodyModule(); if (body) - body->onVeterancyLevelChanged(oldLevel, newLevel); + body->onVeterancyLevelChanged(oldLevel, newLevel, provideFeedback); Bool hideAnimationForStealth = ( ! isLocallyControlled() && testStatus(OBJECT_STATUS_STEALTHED)); @@ -2819,7 +2819,7 @@ void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel ne break; } - if( doAnimation && TheGameLogic->getDrawIconUI() ) + if( doAnimation && TheGameLogic->getDrawIconUI() && provideFeedback ) { if( TheAnim2DCollection && TheGlobalData->m_levelGainAnimationName.isEmpty() == FALSE ) { From 9e4d4a2ee10cef7b2045e18ac4ba51cb134b861c Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Thu, 14 Aug 2025 11:53:34 +1000 Subject: [PATCH 003/343] unify(object): Merge the missing veterancy effect fix for detected stealth units from Zero Hour (#1455) --- .../Code/GameEngine/Source/GameLogic/Object/Object.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp index 14da239e131..59428d04968 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -2775,8 +2775,13 @@ void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel ne if (body) body->onVeterancyLevelChanged(oldLevel, newLevel, provideFeedback); - - Bool hideAnimationForStealth = ( ! isLocallyControlled() && testStatus(OBJECT_STATUS_STEALTHED)); + Bool hideAnimationForStealth = FALSE; + if( !isLocallyControlled() && + testStatus( OBJECT_STATUS_STEALTHED ) && + !testStatus( OBJECT_STATUS_DETECTED ) ) + { + hideAnimationForStealth = TRUE; + } Bool doAnimation = ( ! hideAnimationForStealth && (newLevel > oldLevel) From db3416baba93f6262b2141f71afe3f43105590c3 Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Fri, 15 Aug 2025 18:05:21 +0200 Subject: [PATCH 004/343] tweak(behavior): Make aircraft takeoff order deterministic (#1297) --- .../GameLogic/Module/ParkingPlaceBehavior.h | 21 ++++++----- .../Object/Behavior/ParkingPlaceBehavior.cpp | 36 +++++++++++++++++-- .../GameLogic/Module/ParkingPlaceBehavior.h | 21 ++++++----- .../Object/Behavior/ParkingPlaceBehavior.cpp | 36 +++++++++++++++++-- 4 files changed, 90 insertions(+), 24 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h b/Generals/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h index a3e8a446198..df445a10bdd 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h @@ -130,6 +130,7 @@ class ParkingPlaceBehavior : public UpdateModule, Bool reserveSpace(ObjectID id, Real parkingOffset, PPInfo* info); void releaseSpace(ObjectID id); Bool reserveRunway(ObjectID id, Bool forLanding); + Bool postponeRunwayReservation(UnsignedInt spaceIndex, Bool forLanding); void releaseRunway(ObjectID id); Int getRunwayCount() const { return m_runways.size(); } ObjectID getRunwayReservation(Int r); @@ -143,15 +144,16 @@ class ParkingPlaceBehavior : public UpdateModule, struct ParkingPlaceInfo { - Coord3D m_hangarStart; - Real m_hangarStartOrient; - Coord3D m_location; - Coord3D m_prep; - Real m_orientation; - Int m_runway; - ExitDoorType m_door; - ObjectID m_objectInSpace; - Bool m_reservedForExit; + Coord3D m_hangarStart; + Real m_hangarStartOrient; + Coord3D m_location; + Coord3D m_prep; + Real m_orientation; + Int m_runway; + ExitDoorType m_door; + ObjectID m_objectInSpace; + Bool m_reservedForExit; + Bool m_postponedRunwayReservationForTakeoff; ParkingPlaceInfo() { @@ -164,6 +166,7 @@ class ParkingPlaceBehavior : public UpdateModule, m_door = DOOR_NONE_AVAILABLE; m_objectInSpace = INVALID_ID; m_reservedForExit = false; + m_postponedRunwayReservationForTakeoff = false; } }; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp index a4b32dc52ca..3bdbdf6c612 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp @@ -159,6 +159,7 @@ void ParkingPlaceBehavior::purgeDead() { it->m_objectInSpace = INVALID_ID; it->m_reservedForExit = false; + it->m_postponedRunwayReservationForTakeoff = false; if (pu) pu->setHoldDoorOpen(it->m_door, false); } @@ -379,6 +380,7 @@ void ParkingPlaceBehavior::releaseSpace(ObjectID id) { it->m_objectInSpace = INVALID_ID; it->m_reservedForExit = false; + it->m_postponedRunwayReservationForTakeoff = false; if (pu) pu->setHoldDoorOpen(it->m_door, false); } @@ -409,6 +411,29 @@ void ParkingPlaceBehavior::transferRunwayReservationToNextInLineForTakeoff(Objec } } +//------------------------------------------------------------------------------------------------- +Bool ParkingPlaceBehavior::postponeRunwayReservation(UnsignedInt spaceIndex, Bool forLanding) +{ + // TheSuperHackers @tweak Block the first attempt to reserve a runway for 'upper' space indices. + // This allows 'lower' space indices to reserve a runway first to ensure deterministic takeoff ordering. + + if (m_spaces.size() > m_runways.size() && spaceIndex >= m_runways.size()) + { + Bool& postponed = m_spaces[spaceIndex].m_postponedRunwayReservationForTakeoff; + if (forLanding) + { + postponed = false; + } + else if (!postponed) + { + postponed = true; + return true; + } + } + + return false; +} + //------------------------------------------------------------------------------------------------- Bool ParkingPlaceBehavior::reserveRunway(ObjectID id, Bool forLanding) { @@ -416,11 +441,16 @@ Bool ParkingPlaceBehavior::reserveRunway(ObjectID id, Bool forLanding) purgeDead(); Int runway = -1; - for (std::vector::iterator it = m_spaces.begin(); it != m_spaces.end(); ++it) + for (UnsignedInt i = 0; i < m_spaces.size(); ++i) { - if (it->m_objectInSpace == id) + if (m_spaces[i].m_objectInSpace == id) { - runway = it->m_runway; +#if !RETAIL_COMPATIBLE_CRC + if (postponeRunwayReservation(i, forLanding)) + return false; +#endif + + runway = m_spaces[i].m_runway; break; } } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h index 7b30d6010c9..8e0c2d1988a 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h @@ -140,6 +140,7 @@ class ParkingPlaceBehavior : public UpdateModule, virtual Bool reserveSpace(ObjectID id, Real parkingOffset, PPInfo* info); virtual void releaseSpace(ObjectID id); virtual Bool reserveRunway(ObjectID id, Bool forLanding); + Bool postponeRunwayReservation(UnsignedInt spaceIndex, Bool forLanding); virtual void releaseRunway(ObjectID id); virtual void calcPPInfo( ObjectID id, PPInfo *info ); virtual Int getRunwayCount() const { return m_runways.size(); } @@ -158,15 +159,16 @@ class ParkingPlaceBehavior : public UpdateModule, struct ParkingPlaceInfo { - Coord3D m_hangarStart; - Real m_hangarStartOrient; - Coord3D m_location; - Coord3D m_prep; - Real m_orientation; - Int m_runway; - ExitDoorType m_door; - ObjectID m_objectInSpace; - Bool m_reservedForExit; + Coord3D m_hangarStart; + Real m_hangarStartOrient; + Coord3D m_location; + Coord3D m_prep; + Real m_orientation; + Int m_runway; + ExitDoorType m_door; + ObjectID m_objectInSpace; + Bool m_reservedForExit; + Bool m_postponedRunwayReservationForTakeoff; ParkingPlaceInfo() { @@ -179,6 +181,7 @@ class ParkingPlaceBehavior : public UpdateModule, m_door = DOOR_NONE_AVAILABLE; m_objectInSpace = INVALID_ID; m_reservedForExit = false; + m_postponedRunwayReservationForTakeoff = false; } }; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp index 74959f0b356..ffaa1f3bcca 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp @@ -159,6 +159,7 @@ void ParkingPlaceBehavior::purgeDead() { it->m_objectInSpace = INVALID_ID; it->m_reservedForExit = false; + it->m_postponedRunwayReservationForTakeoff = false; if (pu) pu->setHoldDoorOpen(it->m_door, false); } @@ -430,6 +431,7 @@ void ParkingPlaceBehavior::releaseSpace(ObjectID id) { it->m_objectInSpace = INVALID_ID; it->m_reservedForExit = false; + it->m_postponedRunwayReservationForTakeoff = false; if (pu) pu->setHoldDoorOpen(it->m_door, false); } @@ -468,6 +470,29 @@ void ParkingPlaceBehavior::transferRunwayReservationToNextInLineForTakeoff(Objec } } +//------------------------------------------------------------------------------------------------- +Bool ParkingPlaceBehavior::postponeRunwayReservation(UnsignedInt spaceIndex, Bool forLanding) +{ + // TheSuperHackers @tweak Block the first attempt to reserve a runway for 'upper' space indices. + // This allows 'lower' space indices to reserve a runway first to ensure deterministic takeoff ordering. + + if (m_spaces.size() > m_runways.size() && spaceIndex >= m_runways.size()) + { + Bool& postponed = m_spaces[spaceIndex].m_postponedRunwayReservationForTakeoff; + if (forLanding) + { + postponed = false; + } + else if (!postponed) + { + postponed = true; + return true; + } + } + + return false; +} + //------------------------------------------------------------------------------------------------- Bool ParkingPlaceBehavior::reserveRunway(ObjectID id, Bool forLanding) { @@ -475,11 +500,16 @@ Bool ParkingPlaceBehavior::reserveRunway(ObjectID id, Bool forLanding) purgeDead(); Int runway = -1; - for (std::vector::iterator it = m_spaces.begin(); it != m_spaces.end(); ++it) + for (UnsignedInt i = 0; i < m_spaces.size(); ++i) { - if (it->m_objectInSpace == id) + if (m_spaces[i].m_objectInSpace == id) { - runway = it->m_runway; +#if !RETAIL_COMPATIBLE_CRC + if (postponeRunwayReservation(i, forLanding)) + return false; +#endif + + runway = m_spaces[i].m_runway; break; } } From f099e4d58fb927aa78a1f272d4d2594a303de6c1 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Sat, 16 Aug 2025 07:31:25 +1000 Subject: [PATCH 005/343] bugfix(object): Fix veterancy effect spawning at the map origin when a veteran unit is produced (#1458) --- .../Code/GameEngine/Include/GameLogic/ExperienceTracker.h | 2 +- .../Source/GameLogic/Object/Create/VeterancyGainCreate.cpp | 2 +- .../GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp | 4 ++-- .../Code/GameEngine/Include/GameLogic/ExperienceTracker.h | 2 +- .../Source/GameLogic/Object/Create/VeterancyGainCreate.cpp | 2 +- .../GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameLogic/ExperienceTracker.h b/Generals/Code/GameEngine/Include/GameLogic/ExperienceTracker.h index af397f3c0ea..a237b0209fb 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/ExperienceTracker.h +++ b/Generals/Code/GameEngine/Include/GameLogic/ExperienceTracker.h @@ -52,7 +52,7 @@ class ExperienceTracker : public MemoryPoolObject, public Snapshot Bool isAcceptingExperiencePoints() const; ///< Either I am trainable, or I have a Sink set up void setVeterancyLevel( VeterancyLevel newLevel, Bool provideFeedback = TRUE ); ///< Set Level to this - void setMinVeterancyLevel( VeterancyLevel newLevel ); ///< Set Level to AT LEAST this... if we are already >= this level, do nothing. + void setMinVeterancyLevel( VeterancyLevel newLevel, Bool provideFeedback = TRUE ); ///< Set Level to AT LEAST this... if we are already >= this level, do nothing. void addExperiencePoints( Int experienceGain, Bool canScaleForBonus = TRUE ); ///< Gain this many exp. Bool gainExpForLevel(Int levelsToGain, Bool canScaleForBonus = TRUE ); ///< Gain enough exp to gain a level. return false if can't gain a level. Bool canGainExpForLevel(Int levelsToGain) const; ///< return same value as gainExpForLevel, but don't change anything diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp index 4a12e5537e5..bcad27cb6b7 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp @@ -92,7 +92,7 @@ void VeterancyGainCreate::onCreate( void ) if( myExp && myExp->isTrainable() ) { // srj sez: use "setMin" here so that we never lose levels - myExp->setMinVeterancyLevel( md->m_startingLevel );// sVL can override isTrainable, but this module should not. + myExp->setMinVeterancyLevel( md->m_startingLevel, false );// sVL can override isTrainable, but this module should not. } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp index bf68f084d66..b2c2ab6ab0b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp @@ -82,7 +82,7 @@ void ExperienceTracker::setExperienceSink( ObjectID sink ) //------------------------------------------------------------------------------------------------- // Set Level to AT LEAST this... if we are already >= this level, do nothing. -void ExperienceTracker::setMinVeterancyLevel( VeterancyLevel newLevel ) +void ExperienceTracker::setMinVeterancyLevel( VeterancyLevel newLevel, Bool provideFeedback ) { // This does not check for IsTrainable, because this function is for explicit setting, // so the setter is assumed to know what they are doing. The game function @@ -93,7 +93,7 @@ void ExperienceTracker::setMinVeterancyLevel( VeterancyLevel newLevel ) m_currentLevel = newLevel; m_currentExperience = m_parent->getTemplate()->getExperienceRequired(m_currentLevel); //Minimum for this level if (m_parent) - m_parent->onVeterancyLevelChanged( oldLevel, newLevel ); + m_parent->onVeterancyLevelChanged( oldLevel, newLevel, provideFeedback ); } } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/ExperienceTracker.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/ExperienceTracker.h index d4fa987cb1b..31b30a03b4a 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/ExperienceTracker.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/ExperienceTracker.h @@ -52,7 +52,7 @@ class ExperienceTracker : public MemoryPoolObject, public Snapshot Bool isAcceptingExperiencePoints() const; ///< Either I am trainable, or I have a Sink set up void setVeterancyLevel( VeterancyLevel newLevel, Bool provideFeedback = TRUE ); ///< Set Level to this - void setMinVeterancyLevel( VeterancyLevel newLevel ); ///< Set Level to AT LEAST this... if we are already >= this level, do nothing. + void setMinVeterancyLevel( VeterancyLevel newLevel, Bool provideFeedback = TRUE ); ///< Set Level to AT LEAST this... if we are already >= this level, do nothing. void addExperiencePoints( Int experienceGain, Bool canScaleForBonus = TRUE ); ///< Gain this many exp. Bool gainExpForLevel(Int levelsToGain, Bool canScaleForBonus = TRUE ); ///< Gain enough exp to gain a level. return false if can't gain a level. Bool canGainExpForLevel(Int levelsToGain) const; ///< return same value as gainExpForLevel, but don't change anything diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp index af70d0ed397..10095d8a285 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp @@ -92,7 +92,7 @@ void VeterancyGainCreate::onCreate( void ) if( myExp && myExp->isTrainable() ) { // srj sez: use "setMin" here so that we never lose levels - myExp->setMinVeterancyLevel( md->m_startingLevel );// sVL can override isTrainable, but this module should not. + myExp->setMinVeterancyLevel( md->m_startingLevel, false );// sVL can override isTrainable, but this module should not. } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp index 9c1206cd517..c3a69c5aaf0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp @@ -82,7 +82,7 @@ void ExperienceTracker::setExperienceSink( ObjectID sink ) //------------------------------------------------------------------------------------------------- // Set Level to AT LEAST this... if we are already >= this level, do nothing. -void ExperienceTracker::setMinVeterancyLevel( VeterancyLevel newLevel ) +void ExperienceTracker::setMinVeterancyLevel( VeterancyLevel newLevel, Bool provideFeedback ) { // This does not check for IsTrainable, because this function is for explicit setting, // so the setter is assumed to know what they are doing. The game function @@ -93,7 +93,7 @@ void ExperienceTracker::setMinVeterancyLevel( VeterancyLevel newLevel ) m_currentLevel = newLevel; m_currentExperience = m_parent->getTemplate()->getExperienceRequired(m_currentLevel); //Minimum for this level if (m_parent) - m_parent->onVeterancyLevelChanged( oldLevel, newLevel ); + m_parent->onVeterancyLevelChanged( oldLevel, newLevel, provideFeedback ); } } From 0c2375eebe090c321157ba51ff52536f4bcd88b6 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Tue, 19 Aug 2025 02:46:22 +1000 Subject: [PATCH 006/343] bugfix(input): Prevent invalid interaction feedback for sabotage attempts against sold or under construction buildings (#1459) --- .../CrateCollide/SabotageCommandCenterCrateCollide.cpp | 6 ++++++ .../Object/Collide/CrateCollide/SabotageFakeBuilding.cpp | 6 ++++++ .../CrateCollide/SabotageInternetCenterCrateCollide.cpp | 6 ++++++ .../CrateCollide/SabotageMilitaryFactoryCrateCollide.cpp | 6 ++++++ .../Collide/CrateCollide/SabotagePowerPlantCrateCollide.cpp | 6 ++++++ .../CrateCollide/SabotageSuperweaponCrateCollide.cpp | 6 ++++++ .../CrateCollide/SabotageSupplyCenterCrateCollide.cpp | 6 ++++++ .../CrateCollide/SabotageSupplyDropzoneCrateCollide.cpp | 6 ++++++ 8 files changed, 48 insertions(+) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageCommandCenterCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageCommandCenterCrateCollide.cpp index 4784dcd2ba3..2fc703da7ac 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageCommandCenterCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageCommandCenterCrateCollide.cpp @@ -97,6 +97,12 @@ Bool SabotageCommandCenterCrateCollide::isValidToExecute( const Object *other ) return FALSE; } + if (other->getStatusBits().testForAny(MAKE_OBJECT_STATUS_MASK2(OBJECT_STATUS_UNDER_CONSTRUCTION, OBJECT_STATUS_SOLD))) + { + // TheSuperHackers @bugfix Stubbjax 03/08/2025 Can't enter something being sold or under construction. + return FALSE; + } + Relationship r = getObject()->getRelationship( other ); if( r != ENEMIES ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageFakeBuilding.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageFakeBuilding.cpp index 4537c9e620a..21bf2364013 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageFakeBuilding.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageFakeBuilding.cpp @@ -92,6 +92,12 @@ Bool SabotageFakeBuildingCrateCollide::isValidToExecute( const Object *other ) c return FALSE; } + if (other->getStatusBits().testForAny(MAKE_OBJECT_STATUS_MASK2(OBJECT_STATUS_UNDER_CONSTRUCTION, OBJECT_STATUS_SOLD))) + { + // TheSuperHackers @bugfix Stubbjax 03/08/2025 Can't enter something being sold or under construction. + return FALSE; + } + Relationship r = getObject()->getRelationship( other ); if( r != ENEMIES ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageInternetCenterCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageInternetCenterCrateCollide.cpp index 1e3097a31b7..df18ecc399a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageInternetCenterCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageInternetCenterCrateCollide.cpp @@ -98,6 +98,12 @@ Bool SabotageInternetCenterCrateCollide::isValidToExecute( const Object *other ) return FALSE; } + if (other->getStatusBits().testForAny(MAKE_OBJECT_STATUS_MASK2(OBJECT_STATUS_UNDER_CONSTRUCTION, OBJECT_STATUS_SOLD))) + { + // TheSuperHackers @bugfix Stubbjax 03/08/2025 Can't enter something being sold or under construction. + return FALSE; + } + Relationship r = getObject()->getRelationship( other ); if( r != ENEMIES ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageMilitaryFactoryCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageMilitaryFactoryCrateCollide.cpp index 1f164cc801a..87f92e413ea 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageMilitaryFactoryCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageMilitaryFactoryCrateCollide.cpp @@ -102,6 +102,12 @@ Bool SabotageMilitaryFactoryCrateCollide::isValidToExecute( const Object *other return FALSE; } + if (other->getStatusBits().testForAny(MAKE_OBJECT_STATUS_MASK2(OBJECT_STATUS_UNDER_CONSTRUCTION, OBJECT_STATUS_SOLD))) + { + // TheSuperHackers @bugfix Stubbjax 03/08/2025 Can't enter something being sold or under construction. + return FALSE; + } + Relationship r = getObject()->getRelationship( other ); if( r != ENEMIES ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotagePowerPlantCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotagePowerPlantCrateCollide.cpp index 0da8ac5048d..40536c1c5b0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotagePowerPlantCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotagePowerPlantCrateCollide.cpp @@ -92,6 +92,12 @@ Bool SabotagePowerPlantCrateCollide::isValidToExecute( const Object *other ) con return FALSE; } + if (other->getStatusBits().testForAny(MAKE_OBJECT_STATUS_MASK2(OBJECT_STATUS_UNDER_CONSTRUCTION, OBJECT_STATUS_SOLD))) + { + // TheSuperHackers @bugfix Stubbjax 03/08/2025 Can't enter something being sold or under construction. + return FALSE; + } + Relationship r = getObject()->getRelationship( other ); if( r != ENEMIES ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSuperweaponCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSuperweaponCrateCollide.cpp index b2550568c7c..c22f36463f2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSuperweaponCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSuperweaponCrateCollide.cpp @@ -97,6 +97,12 @@ Bool SabotageSuperweaponCrateCollide::isValidToExecute( const Object *other ) co return FALSE; } + if (other->getStatusBits().testForAny(MAKE_OBJECT_STATUS_MASK2(OBJECT_STATUS_UNDER_CONSTRUCTION, OBJECT_STATUS_SOLD))) + { + // TheSuperHackers @bugfix Stubbjax 03/08/2025 Can't enter something being sold or under construction. + return FALSE; + } + Relationship r = getObject()->getRelationship( other ); if( r != ENEMIES ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyCenterCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyCenterCrateCollide.cpp index cd566c632ba..6f3e9be2f6a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyCenterCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyCenterCrateCollide.cpp @@ -96,6 +96,12 @@ Bool SabotageSupplyCenterCrateCollide::isValidToExecute( const Object *other ) c return FALSE; } + if (other->getStatusBits().testForAny(MAKE_OBJECT_STATUS_MASK2(OBJECT_STATUS_UNDER_CONSTRUCTION, OBJECT_STATUS_SOLD))) + { + // TheSuperHackers @bugfix Stubbjax 03/08/2025 Can't enter something being sold or under construction. + return FALSE; + } + Relationship r = getObject()->getRelationship( other ); if( r != ENEMIES ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyDropzoneCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyDropzoneCrateCollide.cpp index e73f7f1ab12..85ad2e9cb35 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyDropzoneCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyDropzoneCrateCollide.cpp @@ -96,6 +96,12 @@ Bool SabotageSupplyDropzoneCrateCollide::isValidToExecute( const Object *other ) return FALSE; } + if (other->getStatusBits().testForAny(MAKE_OBJECT_STATUS_MASK2(OBJECT_STATUS_UNDER_CONSTRUCTION, OBJECT_STATUS_SOLD))) + { + // TheSuperHackers @bugfix Stubbjax 03/08/2025 Can't enter something being sold or under construction. + return FALSE; + } + Relationship r = getObject()->getRelationship( other ); if( r != ENEMIES ) { From 6044ba1417b68afbd13a887b181e33000212f42c Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Tue, 19 Aug 2025 07:13:42 +1000 Subject: [PATCH 007/343] refactor(object): Simplify veterancy effect conditions (#1464) --- .../Source/GameLogic/Object/Object.cpp | 22 +++++++---------- .../Source/GameLogic/Object/Object.cpp | 24 +++++++------------ 2 files changed, 17 insertions(+), 29 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp index 59428d04968..cfe98a91254 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -2775,18 +2775,6 @@ void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel ne if (body) body->onVeterancyLevelChanged(oldLevel, newLevel, provideFeedback); - Bool hideAnimationForStealth = FALSE; - if( !isLocallyControlled() && - testStatus( OBJECT_STATUS_STEALTHED ) && - !testStatus( OBJECT_STATUS_DETECTED ) ) - { - hideAnimationForStealth = TRUE; - } - - Bool doAnimation = ( ! hideAnimationForStealth - && (newLevel > oldLevel) - && ( ! isKindOf(KINDOF_IGNORED_IN_GUI))); //First, we plan to do the animation if the level went up - switch (newLevel) { case LEVEL_REGULAR: @@ -2796,7 +2784,6 @@ void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel ne clearWeaponBonusCondition(WEAPONBONUSCONDITION_VETERAN); clearWeaponBonusCondition(WEAPONBONUSCONDITION_ELITE); clearWeaponBonusCondition(WEAPONBONUSCONDITION_HERO); - doAnimation = FALSE;//... but not if somehow up to Regular break; case LEVEL_VETERAN: setWeaponSetFlag(WEAPONSET_VETERAN); @@ -2824,7 +2811,14 @@ void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel ne break; } - if( doAnimation && TheGameLogic->getDrawIconUI() && provideFeedback ) + Bool doAnimation = provideFeedback + && newLevel > oldLevel + && !isKindOf(KINDOF_IGNORED_IN_GUI) + && (isLocallyControlled() + || !testStatus(OBJECT_STATUS_STEALTHED) + || testStatus(OBJECT_STATUS_DETECTED)); + + if( doAnimation && TheGameLogic->getDrawIconUI() ) { if( TheAnim2DCollection && TheGlobalData->m_levelGainAnimationName.isEmpty() == FALSE ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp index 02ca7220d28..89d74a5fe8a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -3090,19 +3090,6 @@ void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel ne if (body) body->onVeterancyLevelChanged( oldLevel, newLevel, provideFeedback ); - Bool hideAnimationForStealth = FALSE; - if( !isLocallyControlled() && - testStatus( OBJECT_STATUS_STEALTHED ) && - !testStatus( OBJECT_STATUS_DETECTED ) && - !testStatus( OBJECT_STATUS_DISGUISED ) ) - { - hideAnimationForStealth = TRUE; - } - - Bool doAnimation = ( ! hideAnimationForStealth - && (newLevel > oldLevel) - && ( ! isKindOf(KINDOF_IGNORED_IN_GUI))); //First, we plan to do the animation if the level went up - switch (newLevel) { case LEVEL_REGULAR: @@ -3112,7 +3099,6 @@ void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel ne clearWeaponBonusCondition(WEAPONBONUSCONDITION_VETERAN); clearWeaponBonusCondition(WEAPONBONUSCONDITION_ELITE); clearWeaponBonusCondition(WEAPONBONUSCONDITION_HERO); - doAnimation = FALSE;//... but not if somehow up to Regular break; case LEVEL_VETERAN: setWeaponSetFlag(WEAPONSET_VETERAN); @@ -3140,7 +3126,15 @@ void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel ne break; } - if( doAnimation && TheGameLogic->getDrawIconUI() && provideFeedback ) + Bool doAnimation = provideFeedback + && newLevel > oldLevel + && !isKindOf(KINDOF_IGNORED_IN_GUI) + && (isLocallyControlled() + || !testStatus(OBJECT_STATUS_STEALTHED) + || testStatus(OBJECT_STATUS_DETECTED) + || testStatus(OBJECT_STATUS_DISGUISED)); + + if( doAnimation && TheGameLogic->getDrawIconUI() ) { if( TheAnim2DCollection && TheGlobalData->m_levelGainAnimationName.isEmpty() == FALSE ) { From 822633155b879a4a03e315afc04f1654ead679be Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Tue, 19 Aug 2025 07:16:50 +1000 Subject: [PATCH 008/343] refactor(controlbar): Simplify code for acquiring the currently viewed player (#1473) --- .../Include/GameClient/ControlBar.h | 3 +++ .../GameClient/GUI/ControlBar/ControlBar.cpp | 7 +++++ .../ControlBarPopupDescription.cpp | 6 +---- .../GameEngine/Source/GameClient/InGameUI.cpp | 6 +---- .../GUI/GUICallbacks/W3DControlBar.cpp | 27 +++---------------- .../Include/GameClient/ControlBar.h | 3 +++ .../GameClient/GUI/ControlBar/ControlBar.cpp | 7 +++++ .../ControlBarPopupDescription.cpp | 6 +---- .../GameEngine/Source/GameClient/InGameUI.cpp | 6 +---- .../GUI/GUICallbacks/W3DControlBar.cpp | 27 +++---------------- 10 files changed, 30 insertions(+), 68 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/ControlBar.h b/Generals/Code/GameEngine/Include/GameClient/ControlBar.h index c2778057c39..4a570a7f9eb 100644 --- a/Generals/Code/GameEngine/Include/GameClient/ControlBar.h +++ b/Generals/Code/GameEngine/Include/GameClient/ControlBar.h @@ -731,6 +731,9 @@ class ControlBar : public SubsystemInterface void populateObserverList( void ); Bool isObserverControlBarOn( void ) { return m_isObserverCommandBar;} + /// Returns the currently viewed player. May return NULL if no player is selected while observing. + Player* getCurrentlyViewedPlayer(); + // ControlBarResizer *getControlBarResizer( void ) {return m_controlBarResizer;} // Functions for repositioning/resizing the control bar diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index f35fd1a8fd7..32d62e260ff 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -157,6 +157,13 @@ void ControlBar::markUIDirty( void ) #endif } +Player* ControlBar::getCurrentlyViewedPlayer() +{ + if (TheControlBar->isObserverControlBarOn()) + return TheControlBar->getObserverLookAtPlayer(); + + return ThePlayerList->getLocalPlayer(); +} void ControlBar::populatePurchaseScience( Player* player ) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp index eabac8067ab..21563d4c454 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp @@ -518,11 +518,7 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton, name = TheGameText->fetch("CONTROLBAR:Power"); descrip = TheGameText->fetch("CONTROLBAR:PowerDescription"); - Player *playerToDisplay = NULL; - if(TheControlBar->isObserverControlBarOn()) - playerToDisplay = TheControlBar->getObserverLookAtPlayer(); - else - playerToDisplay = ThePlayerList->getLocalPlayer(); + Player* playerToDisplay = TheControlBar->getCurrentlyViewedPlayer(); if( playerToDisplay && playerToDisplay->getEnergy() ) { diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index ce4b96074db..51fea1899cd 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -1786,11 +1786,7 @@ void InGameUI::update( void ) // moneyWin = TheWindowManager->winGetWindowFromId( NULL, moneyWindowKey ); // // } // end if - Player *moneyPlayer = NULL; - if( TheControlBar->isObserverControlBarOn()) - moneyPlayer = TheControlBar->getObserverLookAtPlayer(); - else - moneyPlayer = ThePlayerList->getLocalPlayer(); + Player* moneyPlayer = TheControlBar->getCurrentlyViewedPlayer(); if( moneyPlayer) { Int currentMoney = moneyPlayer->getMoney()->countMoney(); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp index 40f49249b4d..35784684a9b 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp @@ -125,15 +125,7 @@ void W3DPowerDraw( GameWindow *window, WinInstanceData *instData ) //const Image *beginBar = NULL; const Image *centerBar = NULL; static const Image *slider = TheMappedImageCollection->findImageByName("PowerBarSlider"); - Player *player = NULL; - if(TheControlBar->isObserverControlBarOn()) - { - player = TheControlBar->getObserverLookAtPlayer(); - } - else - player = ThePlayerList->getLocalPlayer(); - - + Player* player = TheControlBar->getCurrentlyViewedPlayer(); if(!player || !TheGlobalData) return; @@ -292,15 +284,7 @@ void W3DPowerDrawA( GameWindow *window, WinInstanceData *instData ) const Image *beginBar = NULL; const Image *centerBar = NULL; static const Image *slider = TheMappedImageCollection->findImageByName("PowerBarSlider"); - Player *player = NULL; - if(TheControlBar->isObserverControlBarOn()) - { - player = TheControlBar->getObserverLookAtPlayer(); - } - else - player = ThePlayerList->getLocalPlayer(); - - + Player* player = TheControlBar->getCurrentlyViewedPlayer(); if(!player || !TheGlobalData) return; @@ -486,13 +470,8 @@ void W3DCommandBarGridDraw( GameWindow *window, WinInstanceData *instData ) void W3DCommandBarGenExpDraw( GameWindow *window, WinInstanceData *instData ) { - Player* player = NULL; - // TheSuperHackers @bugfix Stubbjax 08/08/2025 Show the experience bar for observers - if (TheControlBar->isObserverControlBarOn()) - player = TheControlBar->getObserverLookAtPlayer(); - else - player = ThePlayerList->getLocalPlayer(); + Player* player = TheControlBar->getCurrentlyViewedPlayer(); if (!player) return; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h index c6b550996de..4f95f8d4650 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h @@ -745,6 +745,9 @@ class ControlBar : public SubsystemInterface void populateObserverList( void ); Bool isObserverControlBarOn( void ) { return m_isObserverCommandBar;} + /// Returns the currently viewed player. May return NULL if no player is selected while observing. + Player* getCurrentlyViewedPlayer(); + // ControlBarResizer *getControlBarResizer( void ) {return m_controlBarResizer;} // Functions for repositioning/resizing the control bar diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 01daea2caf0..45848059671 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -158,6 +158,13 @@ void ControlBar::markUIDirty( void ) #endif } +Player* ControlBar::getCurrentlyViewedPlayer() +{ + if (TheControlBar->isObserverControlBarOn()) + return TheControlBar->getObserverLookAtPlayer(); + + return ThePlayerList->getLocalPlayer(); +} void ControlBar::populatePurchaseScience( Player* player ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp index 8dd93d2f50d..e2c5f9caf3f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp @@ -567,11 +567,7 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton, name = TheGameText->fetch("CONTROLBAR:Power"); descrip = TheGameText->fetch("CONTROLBAR:PowerDescription"); - Player *playerToDisplay = NULL; - if(TheControlBar->isObserverControlBarOn()) - playerToDisplay = TheControlBar->getObserverLookAtPlayer(); - else - playerToDisplay = ThePlayerList->getLocalPlayer(); + Player* playerToDisplay = TheControlBar->getCurrentlyViewedPlayer(); if( playerToDisplay && playerToDisplay->getEnergy() ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index e841924b503..46b45ab5c59 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -1842,11 +1842,7 @@ void InGameUI::update( void ) // moneyWin = TheWindowManager->winGetWindowFromId( NULL, moneyWindowKey ); // // } // end if - Player *moneyPlayer = NULL; - if( TheControlBar->isObserverControlBarOn()) - moneyPlayer = TheControlBar->getObserverLookAtPlayer(); - else - moneyPlayer = ThePlayerList->getLocalPlayer(); + Player* moneyPlayer = TheControlBar->getCurrentlyViewedPlayer(); if( moneyPlayer) { Int currentMoney = moneyPlayer->getMoney()->countMoney(); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp index d1528da16a8..4f66682e87f 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp @@ -125,15 +125,7 @@ void W3DPowerDraw( GameWindow *window, WinInstanceData *instData ) //const Image *beginBar = NULL; const Image *centerBar = NULL; static const Image *slider = TheMappedImageCollection->findImageByName("PowerBarSlider"); - Player *player = NULL; - if(TheControlBar->isObserverControlBarOn()) - { - player = TheControlBar->getObserverLookAtPlayer(); - } - else - player = ThePlayerList->getLocalPlayer(); - - + Player* player = TheControlBar->getCurrentlyViewedPlayer(); if(!player || !TheGlobalData) return; @@ -292,15 +284,7 @@ void W3DPowerDrawA( GameWindow *window, WinInstanceData *instData ) const Image *beginBar = NULL; const Image *centerBar = NULL; static const Image *slider = TheMappedImageCollection->findImageByName("PowerBarSlider"); - Player *player = NULL; - if(TheControlBar->isObserverControlBarOn()) - { - player = TheControlBar->getObserverLookAtPlayer(); - } - else - player = ThePlayerList->getLocalPlayer(); - - + Player* player = TheControlBar->getCurrentlyViewedPlayer(); if(!player || !TheGlobalData) return; @@ -486,13 +470,8 @@ void W3DCommandBarGridDraw( GameWindow *window, WinInstanceData *instData ) void W3DCommandBarGenExpDraw( GameWindow *window, WinInstanceData *instData ) { - Player* player = NULL; - // TheSuperHackers @bugfix Stubbjax 08/08/2025 Show the experience bar for observers - if (TheControlBar->isObserverControlBarOn()) - player = TheControlBar->getObserverLookAtPlayer(); - else - player = ThePlayerList->getLocalPlayer(); + Player* player = TheControlBar->getCurrentlyViewedPlayer(); if (!player) return; From f4783606a12b0ea99a2b8f64948effc0e908084d Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Wed, 20 Aug 2025 01:58:50 +1000 Subject: [PATCH 009/343] bugfix(input): Prevent mouse wheel from stopping camera scrolling (#1467) --- .../GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp | 2 ++ .../GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index e594d0fac29..e0f4971e06b 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -377,6 +377,8 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage for ( ;spin < 0; spin++ ) TheTacticalView->zoomOut(); } + + break; } //----------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index 2dbfdf474d4..e3e5aed2a0c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -376,6 +376,8 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage for ( ;spin < 0; spin++ ) TheTacticalView->zoomOut(); } + + break; } //----------------------------------------------------------------------------- From 0228421a576c87eaf165dd1942a1e0865594a5cb Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Wed, 20 Aug 2025 02:06:26 +1000 Subject: [PATCH 010/343] feat(input): Add ability to snap building rotation to 45 degree angles (#1472) Is accessible while holding the force-attack modifier key (CTRL) --- Core/Libraries/Source/WWVegas/WWMath/wwmath.h | 1 + Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp | 7 +++++++ GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp | 7 +++++++ 3 files changed, 15 insertions(+) diff --git a/Core/Libraries/Source/WWVegas/WWMath/wwmath.h b/Core/Libraries/Source/WWVegas/WWMath/wwmath.h index bd90746b89b..338426b9b6a 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/wwmath.h +++ b/Core/Libraries/Source/WWVegas/WWMath/wwmath.h @@ -143,6 +143,7 @@ static WWINLINE float Atan2(float y,float x) { return static_cast(atan2( static WWINLINE float Sign(float val); static WWINLINE float Ceil(float val) { return ceilf(val); } static WWINLINE float Floor(float val) { return floorf(val); } +static WWINLINE float Round(float val) { return floorf(val + 0.5f); } static WWINLINE bool Fast_Is_Float_Positive(const float & val); static WWINLINE bool Is_Power_Of_2(const unsigned int val); diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index 51fea1899cd..645956549d6 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -1415,6 +1415,13 @@ void InGameUI::handleBuildPlacements( void ) v.y = worldEnd.y - worldStart.y; angle = v.toAngle(); + // TheSuperHackers @tweak Stubbjax 04/08/2025 Snap angle to nearest 45 degrees + // while using force attack mode for convenience. + if (isInForceAttackMode()) + { + const Real snapRadians = DEG_TO_RADF(45); + angle = WWMath::Round(angle / snapRadians) * snapRadians; + } } // end if } // end if diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index 46b45ab5c59..d0e2d9e4ff6 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -1470,6 +1470,13 @@ void InGameUI::handleBuildPlacements( void ) v.y = worldEnd.y - worldStart.y; angle = v.toAngle(); + // TheSuperHackers @tweak Stubbjax 04/08/2025 Snap angle to nearest 45 degrees + // while using force attack mode for convenience. + if (isInForceAttackMode()) + { + const Real snapRadians = DEG_TO_RADF(45); + angle = WWMath::Round(angle / snapRadians) * snapRadians; + } } // end if } // end if From a4a57a252458195014864ca043f15a891e4d61da Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 19 Aug 2025 18:15:54 +0200 Subject: [PATCH 011/343] refactor(client): Use constants for default display width and height values (#1465) --- Core/GameEngine/Include/Common/GameDefines.h | 5 +++++ .../Code/GameEngine/Source/Common/GlobalData.cpp | 4 ++-- .../GameClient/GUI/ControlBar/ControlBarResizer.cpp | 4 ++-- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 9 ++++++--- .../GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp | 4 ++-- .../GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp | 2 +- .../GameEngine/Source/GameClient/GlobalLanguage.cpp | 2 +- .../Code/GameEngine/Source/GameClient/InGameUI.cpp | 4 ++-- .../GameClient/GUI/GUICallbacks/W3DMainMenu.cpp | 2 +- .../GameClient/GUI/Gadget/W3DHorizontalSlider.cpp | 6 +++--- .../Source/W3DDevice/GameClient/W3DDisplay.cpp | 12 ++++-------- Generals/Code/Main/WinMain.cpp | 13 +++++-------- .../Code/GameEngine/Source/Common/GlobalData.cpp | 4 ++-- .../GameClient/GUI/ControlBar/ControlBarResizer.cpp | 4 ++-- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 9 ++++++--- .../GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp | 4 ++-- .../GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp | 2 +- .../GameEngine/Source/GameClient/GlobalLanguage.cpp | 2 +- .../Code/GameEngine/Source/GameClient/InGameUI.cpp | 4 ++-- .../GameClient/GUI/GUICallbacks/W3DMainMenu.cpp | 2 +- .../GameClient/GUI/Gadget/W3DHorizontalSlider.cpp | 6 +++--- .../Source/W3DDevice/GameClient/W3DDisplay.cpp | 12 ++++-------- GeneralsMD/Code/Main/WinMain.cpp | 13 +++++-------- 23 files changed, 63 insertions(+), 66 deletions(-) diff --git a/Core/GameEngine/Include/Common/GameDefines.h b/Core/GameEngine/Include/Common/GameDefines.h index 3df8fb30903..6f90600630b 100644 --- a/Core/GameEngine/Include/Common/GameDefines.h +++ b/Core/GameEngine/Include/Common/GameDefines.h @@ -67,3 +67,8 @@ #define USE_OBSOLETE_GENERALS_CODE (1) #endif #endif + +#define MIN_DISPLAY_BIT_DEPTH 16 +#define DEFAULT_DISPLAY_BIT_DEPTH 32 +#define DEFAULT_DISPLAY_WIDTH 800 // The standard resolution this game was designed for +#define DEFAULT_DISPLAY_HEIGHT 600 // The standard resolution this game was designed for diff --git a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp index 8c07362066f..24f9e0e342d 100644 --- a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp @@ -614,8 +614,8 @@ GlobalData::GlobalData() m_chipSetType = 0; m_headless = FALSE; m_windowed = 0; - m_xResolution = 800; - m_yResolution = 600; + m_xResolution = DEFAULT_DISPLAY_WIDTH; + m_yResolution = DEFAULT_DISPLAY_HEIGHT; m_maxShellScreens = 0; m_useCloudMap = FALSE; m_use3WayTerrainBlends = 1; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp index 749af7a749b..d9604767f3d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp @@ -180,8 +180,8 @@ void ControlBarResizer::sizeWindowsAlt( void ) { ResizerWindowList::iterator it = m_resizerWindowsList.begin(); GameWindow *win = NULL; - Real x = (Real)TheDisplay->getWidth() / 800; - Real y = (Real)TheDisplay->getHeight() / 600; + Real x = (Real)TheDisplay->getWidth() / DEFAULT_DISPLAY_WIDTH; + Real y = (Real)TheDisplay->getHeight() / DEFAULT_DISPLAY_HEIGHT; while (it != m_resizerWindowsList.end()) { ResizerWindow *rWin = *it; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index d4c8f7a8705..47f8c34a922 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -836,7 +836,7 @@ static void setDefaults( void ) for( Int i = 0; i < numResolutions; ++i ) { Int xres,yres,bitDepth; TheDisplay->getDisplayModeDescription(i,&xres,&yres,&bitDepth); - if (xres == 800 && yres == 600) //keep track of default mode in case we need it. + if (xres == DEFAULT_DISPLAY_WIDTH && yres == DEFAULT_DISPLAY_HEIGHT) //keep track of default mode in case we need it. { defaultResIndex=i; break; } @@ -1648,12 +1648,15 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) // get resolution from saved preferences file AsciiString selectedResolution = (*pref) ["Resolution"]; - Int selectedXRes=800,selectedYRes=600; + Int selectedXRes=DEFAULT_DISPLAY_WIDTH; + Int selectedYRes=DEFAULT_DISPLAY_HEIGHT; Int selectedResIndex=-1; if (!selectedResolution.isEmpty()) { //try to parse 2 integers out of string if (sscanf(selectedResolution.str(),"%d%d", &selectedXRes, &selectedYRes) != 2) - { selectedXRes=800; selectedYRes=600; + { + selectedXRes=DEFAULT_DISPLAY_WIDTH; + selectedYRes=DEFAULT_DISPLAY_HEIGHT; } } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp index 832bb8d1281..4c0f2ba862e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp @@ -456,8 +456,8 @@ void ResetBattleHonorInsertion(void) } void InsertBattleHonor(GameWindow *list, const Image *image, Bool enabled, Int itemData, Int& row, Int& column, UnicodeString text = UnicodeString::TheEmptyString) { - Int width = MAX_BATTLE_HONOR_IMAGE_WIDTH * (TheDisplay->getWidth() / 800.0f); - Int height = MAX_BATTLE_HONOR_IMAGE_HEIGHT * (TheDisplay->getHeight() / 600.0f); + Int width = MAX_BATTLE_HONOR_IMAGE_WIDTH * (TheDisplay->getWidth() / (Real)DEFAULT_DISPLAY_WIDTH); + Int height = MAX_BATTLE_HONOR_IMAGE_HEIGHT * (TheDisplay->getHeight() / (Real)DEFAULT_DISPLAY_HEIGHT); static Int enabledColor = 0xFFFFFFFF; static Int disabledColor = GameMakeColor(80, 80, 80, 255); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp index 4e7a823b834..55d3e677ffa 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp @@ -812,7 +812,7 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, else if (controlID == buttonQuickMatchID) { GameSpyMiscPreferences mPref; - if ((TheDisplay->getWidth() != 800 || TheDisplay->getHeight() != 600) && mPref.getQuickMatchResLocked()) + if ((TheDisplay->getWidth() != DEFAULT_DISPLAY_WIDTH || TheDisplay->getHeight() != DEFAULT_DISPLAY_HEIGHT) && mPref.getQuickMatchResLocked()) { GSMessageBoxOk(TheGameText->fetch("GUI:GSErrorTitle"), TheGameText->fetch("GUI:QuickMatch800x600")); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp b/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp index 8ff34f43ef5..ccc41f9eec7 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp @@ -187,7 +187,7 @@ void GlobalLanguage::parseFontFileName( INI *ini, void * instance, void *store, Int GlobalLanguage::adjustFontSize(Int theFontSize) { - Real adjustFactor = TheGlobalData->m_xResolution/800.0f; + Real adjustFactor = TheGlobalData->m_xResolution / (Real)DEFAULT_DISPLAY_WIDTH; adjustFactor = 1.0f + (adjustFactor-1.0f) * m_resolutionFontSizeAdjustment; if (adjustFactor<1.0f) adjustFactor = 1.0f; if (adjustFactor>2.0f) adjustFactor = 2.0f; diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index 645956549d6..a689b18e086 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -4032,8 +4032,8 @@ void InGameUI::militarySubtitle( const AsciiString& label, Int duration ) // calculate where this screen position should be since the position being passed in is based off 8x6 Coord2D multiplyer; - multiplyer.x = TheDisplay->getWidth() / 800; - multiplyer.y = TheDisplay->getHeight() / 600; + multiplyer.x = TheDisplay->getWidth() / (Real)DEFAULT_DISPLAY_WIDTH; + multiplyer.y = TheDisplay->getHeight() / (Real)DEFAULT_DISPLAY_HEIGHT; // lets bring out the data structure! m_militarySubtitle = NEW MilitarySubtitleData; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp index 27efffe2711..ab36bebd4ca 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp @@ -108,7 +108,7 @@ static void advancePosition(GameWindow *window, const Image *image, UnsignedInt } static Int Width = size.x + image->getImageWidth(); - static Int x = -800; + static Int x = -DEFAULT_DISPLAY_WIDTH; static Int y = pos.y - (image->getImageHeight()/2); static UnsignedInt m_startTime = timeGetTime(); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp index 52d50b30e15..a7411a238fb 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp @@ -150,7 +150,7 @@ void W3DGadgetHorizontalSliderImageDraw( GameWindow *window, SliderData *s = (SliderData *)window->winGetUserData(); - Real xMulti = INT_TO_REAL(TheDisplay->getWidth()) / 800; + Real xMulti = INT_TO_REAL(TheDisplay->getWidth()) / DEFAULT_DISPLAY_WIDTH; // figure out how many boxes we draw for this slider Int numBoxes = 0; @@ -229,8 +229,8 @@ void W3DGadgetHorizontalSliderImageDrawB( GameWindow *window, SliderData *s = (SliderData *)window->winGetUserData(); - Real xMulti = INT_TO_REAL(TheDisplay->getWidth()) / 800; - Real yMulti = INT_TO_REAL(TheDisplay->getHeight())/ 600; + Real xMulti = INT_TO_REAL(TheDisplay->getWidth()) / DEFAULT_DISPLAY_WIDTH; + Real yMulti = INT_TO_REAL(TheDisplay->getHeight()) / DEFAULT_DISPLAY_HEIGHT; // get image offset xOffset = instData->m_imageOffset.x; yOffset = instData->m_imageOffset.y; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index f3beace8612..64652df3d53 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -110,10 +110,6 @@ static void drawFramerateBar(void); // DEFINE AND ENUMS /////////////////////////////////////////////////////////// -#define DEFAULT_DISPLAY_BIT_DEPTH 32 -#define MIN_DISPLAY_BIT_DEPTH 16 -#define MIN_DISPLAY_RESOLUTION_X 800 -#define MIN_DISPLAY_RESOLUTION_Y 600 #define no_SAMPLE_DYNAMIC_LIGHT 1 #ifdef SAMPLE_DYNAMIC_LIGHT @@ -432,7 +428,7 @@ inline Bool isResolutionSupported(const ResolutionDescClass &res) { static const Int minBitDepth = 24; - return res.Width >= MIN_DISPLAY_RESOLUTION_X && res.BitDepth >= minBitDepth; + return res.Width >= DEFAULT_DISPLAY_WIDTH && res.BitDepth >= minBitDepth; } /*Return number of screen modes supported by the current device*/ @@ -701,15 +697,15 @@ void W3DDisplay::init( void ) // if the custom resolution did not succeed. This is unlikely to happen but is possible // if the user writes an unsupported resolution in the Option Preferences or if the // graphics adapter does not support the minimum display resolution to begin with. - Int xres = MIN_DISPLAY_RESOLUTION_X; - Int yres = MIN_DISPLAY_RESOLUTION_Y; + Int xres = DEFAULT_DISPLAY_WIDTH; + Int yres = DEFAULT_DISPLAY_HEIGHT; Int bitDepth = DEFAULT_DISPLAY_BIT_DEPTH; Int displayModeCount = getDisplayModeCount(); Int displayModeIndex = 0; for (; displayModeIndex < displayModeCount; ++displayModeIndex) { getDisplayModeDescription(displayModeIndex, &xres, &yres, &bitDepth); - if (xres * yres >= MIN_DISPLAY_RESOLUTION_X * MIN_DISPLAY_RESOLUTION_Y) + if (xres * yres >= DEFAULT_DISPLAY_WIDTH * DEFAULT_DISPLAY_HEIGHT) break; // Is good enough. Use it. } TheWritableGlobalData->m_xResolution = xres; diff --git a/Generals/Code/Main/WinMain.cpp b/Generals/Code/Main/WinMain.cpp index 15f0c7ec232..777467536fb 100644 --- a/Generals/Code/Main/WinMain.cpp +++ b/Generals/Code/Main/WinMain.cpp @@ -76,9 +76,6 @@ const Char *g_strFile = "data\\Generals.str"; const Char *g_csfFile = "data\\%s\\Generals.csf"; const char *gAppPrefix = ""; /// So WB can have a different debug log file name. -#define DEFAULT_XRESOLUTION 800 -#define DEFAULT_YRESOLUTION 600 - static Bool gInitializing = false; static Bool gDoPaint = true; static Bool isWinMainActive = false; @@ -579,7 +576,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, Int savContext = ::SaveDC(dc); HDC tmpDC = ::CreateCompatibleDC(dc); HBITMAP savBitmap = (HBITMAP)::SelectObject(tmpDC, gLoadScreenBitmap); - ::BitBlt(dc, 0, 0, DEFAULT_XRESOLUTION, DEFAULT_YRESOLUTION, tmpDC, 0, 0, SRCCOPY); + ::BitBlt(dc, 0, 0, DEFAULT_DISPLAY_WIDTH, DEFAULT_DISPLAY_HEIGHT, tmpDC, 0, 0, SRCCOPY); ::SelectObject(tmpDC, savBitmap); ::DeleteDC(tmpDC); ::RestoreDC(dc, savContext); @@ -661,8 +658,8 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, static Bool initializeAppWindows( HINSTANCE hInstance, Int nCmdShow, Bool runWindowed ) { DWORD windowStyle; - Int startWidth = DEFAULT_XRESOLUTION, - startHeight = DEFAULT_YRESOLUTION; + Int startWidth = DEFAULT_DISPLAY_WIDTH, + startHeight = DEFAULT_DISPLAY_HEIGHT; // register the window class @@ -688,8 +685,8 @@ static Bool initializeAppWindows( HINSTANCE hInstance, Int nCmdShow, Bool runWin AdjustWindowRect (&rect, windowStyle, FALSE); if (runWindowed) { // Makes the normal debug 800x600 window center in the screen. - startWidth = DEFAULT_XRESOLUTION; - startHeight= DEFAULT_YRESOLUTION; + startWidth = DEFAULT_DISPLAY_WIDTH; + startHeight= DEFAULT_DISPLAY_HEIGHT; } gInitializing = true; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp index ed0d16e4781..be4b8962e27 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp @@ -619,8 +619,8 @@ GlobalData::GlobalData() m_chipSetType = 0; m_headless = FALSE; m_windowed = 0; - m_xResolution = 800; - m_yResolution = 600; + m_xResolution = DEFAULT_DISPLAY_WIDTH; + m_yResolution = DEFAULT_DISPLAY_HEIGHT; m_maxShellScreens = 0; m_useCloudMap = FALSE; m_use3WayTerrainBlends = 1; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp index 97d3d60008b..dac78ae7b83 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp @@ -180,8 +180,8 @@ void ControlBarResizer::sizeWindowsAlt( void ) { ResizerWindowList::iterator it = m_resizerWindowsList.begin(); GameWindow *win = NULL; - Real x = (Real)TheDisplay->getWidth() / 800; - Real y = (Real)TheDisplay->getHeight() / 600; + Real x = (Real)TheDisplay->getWidth() / DEFAULT_DISPLAY_WIDTH; + Real y = (Real)TheDisplay->getHeight() / DEFAULT_DISPLAY_HEIGHT; while (it != m_resizerWindowsList.end()) { ResizerWindow *rWin = *it; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index 598c97d23b2..2f4a306071e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -880,7 +880,7 @@ static void setDefaults( void ) for( Int i = 0; i < numResolutions; ++i ) { Int xres,yres,bitDepth; TheDisplay->getDisplayModeDescription(i,&xres,&yres,&bitDepth); - if (xres == 800 && yres == 600) //keep track of default mode in case we need it. + if (xres == DEFAULT_DISPLAY_WIDTH && yres == DEFAULT_DISPLAY_HEIGHT) //keep track of default mode in case we need it. { defaultResIndex=i; break; } @@ -1715,12 +1715,15 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) // get resolution from saved preferences file AsciiString selectedResolution = (*pref) ["Resolution"]; - Int selectedXRes=800,selectedYRes=600; + Int selectedXRes=DEFAULT_DISPLAY_WIDTH; + Int selectedYRes=DEFAULT_DISPLAY_HEIGHT; Int selectedResIndex=-1; if (!selectedResolution.isEmpty()) { //try to parse 2 integers out of string if (sscanf(selectedResolution.str(),"%d%d", &selectedXRes, &selectedYRes) != 2) - { selectedXRes=800; selectedYRes=600; + { + selectedXRes=DEFAULT_DISPLAY_WIDTH; + selectedYRes=DEFAULT_DISPLAY_HEIGHT; } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp index 8636b21aa5d..c712371c0d4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp @@ -468,8 +468,8 @@ void ResetBattleHonorInsertion(void) } void InsertBattleHonor(GameWindow *list, const Image *image, Bool enabled, Int itemData, Int& row, Int& column, UnicodeString text = UnicodeString::TheEmptyString, Int extra = 0) { - Int width = MAX_BATTLE_HONOR_IMAGE_WIDTH * (TheDisplay->getWidth() / 800.0f); - Int height = MAX_BATTLE_HONOR_IMAGE_HEIGHT * (TheDisplay->getHeight() / 600.0f); + Int width = MAX_BATTLE_HONOR_IMAGE_WIDTH * (TheDisplay->getWidth() / (Real)DEFAULT_DISPLAY_WIDTH); + Int height = MAX_BATTLE_HONOR_IMAGE_HEIGHT * (TheDisplay->getHeight() / (Real)DEFAULT_DISPLAY_HEIGHT); static Int enabledColor = 0xFFFFFFFF; static Int disabledColor = GameMakeColor(80, 80, 80, 255); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp index ebc97fc14db..05c84eba2cf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp @@ -829,7 +829,7 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, else if (controlID == buttonQuickMatchID) { GameSpyMiscPreferences mPref; - if ((TheDisplay->getWidth() != 800 || TheDisplay->getHeight() != 600) && mPref.getQuickMatchResLocked()) + if ((TheDisplay->getWidth() != DEFAULT_DISPLAY_WIDTH || TheDisplay->getHeight() != DEFAULT_DISPLAY_HEIGHT) && mPref.getQuickMatchResLocked()) { GSMessageBoxOk(TheGameText->fetch("GUI:GSErrorTitle"), TheGameText->fetch("GUI:QuickMatch800x600")); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp index 6a8f6f7fec1..6ab0a30fe6e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp @@ -191,7 +191,7 @@ void GlobalLanguage::parseFontFileName( INI *ini, void * instance, void *store, Int GlobalLanguage::adjustFontSize(Int theFontSize) { - Real adjustFactor = TheGlobalData->m_xResolution/800.0f; + Real adjustFactor = TheGlobalData->m_xResolution / (Real)DEFAULT_DISPLAY_WIDTH; adjustFactor = 1.0f + (adjustFactor-1.0f) * m_resolutionFontSizeAdjustment; if (adjustFactor<1.0f) adjustFactor = 1.0f; if (adjustFactor>2.0f) adjustFactor = 2.0f; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index d0e2d9e4ff6..2573860144b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -4186,8 +4186,8 @@ void InGameUI::militarySubtitle( const AsciiString& label, Int duration ) // calculate where this screen position should be since the position being passed in is based off 8x6 Coord2D multiplier; - multiplier.x = (float)TheDisplay->getWidth() / 800.0f; - multiplier.y = (float)TheDisplay->getHeight() / 600.0f; + multiplier.x = (Real)TheDisplay->getWidth() / (Real)DEFAULT_DISPLAY_WIDTH; + multiplier.y = (Real)TheDisplay->getHeight() / (Real)DEFAULT_DISPLAY_HEIGHT; // lets bring out the data structure! m_militarySubtitle = NEW MilitarySubtitleData; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp index 6614498dd45..346bc44faca 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp @@ -108,7 +108,7 @@ static void advancePosition(GameWindow *window, const Image *image, UnsignedInt } static Int Width = size.x + image->getImageWidth(); - static Int x = -800; + static Int x = -DEFAULT_DISPLAY_WIDTH; static Int y = pos.y - (image->getImageHeight()/2); static UnsignedInt m_startTime = timeGetTime(); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp index 680cd8d7059..292166ccb7c 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp @@ -150,7 +150,7 @@ void W3DGadgetHorizontalSliderImageDraw( GameWindow *window, SliderData *s = (SliderData *)window->winGetUserData(); - Real xMulti = INT_TO_REAL(TheDisplay->getWidth()) / 800; + Real xMulti = INT_TO_REAL(TheDisplay->getWidth()) / DEFAULT_DISPLAY_WIDTH; // figure out how many boxes we draw for this slider Int numBoxes = 0; @@ -229,8 +229,8 @@ void W3DGadgetHorizontalSliderImageDrawB( GameWindow *window, SliderData *s = (SliderData *)window->winGetUserData(); - Real xMulti = INT_TO_REAL(TheDisplay->getWidth()) / 800; - Real yMulti = INT_TO_REAL(TheDisplay->getHeight())/ 600; + Real xMulti = INT_TO_REAL(TheDisplay->getWidth()) / DEFAULT_DISPLAY_WIDTH; + Real yMulti = INT_TO_REAL(TheDisplay->getHeight()) / DEFAULT_DISPLAY_HEIGHT; // get image offset xOffset = instData->m_imageOffset.x; yOffset = instData->m_imageOffset.y; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 889ccd8c92b..7185abb8dad 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -111,10 +111,6 @@ static void drawFramerateBar(void); // DEFINE AND ENUMS /////////////////////////////////////////////////////////// -#define DEFAULT_DISPLAY_BIT_DEPTH 32 -#define MIN_DISPLAY_BIT_DEPTH 16 -#define MIN_DISPLAY_RESOLUTION_X 800 -#define MIN_DISPLAY_RESOLUTION_Y 600 #define no_SAMPLE_DYNAMIC_LIGHT 1 #ifdef SAMPLE_DYNAMIC_LIGHT @@ -481,7 +477,7 @@ inline Bool isResolutionSupported(const ResolutionDescClass &res) { static const Int minBitDepth = 24; - return res.Width >= MIN_DISPLAY_RESOLUTION_X && res.BitDepth >= minBitDepth; + return res.Width >= DEFAULT_DISPLAY_WIDTH && res.BitDepth >= minBitDepth; } /*Return number of screen modes supported by the current device*/ @@ -751,15 +747,15 @@ void W3DDisplay::init( void ) // if the custom resolution did not succeed. This is unlikely to happen but is possible // if the user writes an unsupported resolution in the Option Preferences or if the // graphics adapter does not support the minimum display resolution to begin with. - Int xres = MIN_DISPLAY_RESOLUTION_X; - Int yres = MIN_DISPLAY_RESOLUTION_Y; + Int xres = DEFAULT_DISPLAY_WIDTH; + Int yres = DEFAULT_DISPLAY_HEIGHT; Int bitDepth = DEFAULT_DISPLAY_BIT_DEPTH; Int displayModeCount = getDisplayModeCount(); Int displayModeIndex = 0; for (; displayModeIndex < displayModeCount; ++displayModeIndex) { getDisplayModeDescription(displayModeIndex, &xres, &yres, &bitDepth); - if (xres * yres >= MIN_DISPLAY_RESOLUTION_X * MIN_DISPLAY_RESOLUTION_Y) + if (xres * yres >= DEFAULT_DISPLAY_WIDTH * DEFAULT_DISPLAY_HEIGHT) break; // Is good enough. Use it. } TheWritableGlobalData->m_xResolution = xres; diff --git a/GeneralsMD/Code/Main/WinMain.cpp b/GeneralsMD/Code/Main/WinMain.cpp index 2ce8ca4c699..320e1e071dc 100644 --- a/GeneralsMD/Code/Main/WinMain.cpp +++ b/GeneralsMD/Code/Main/WinMain.cpp @@ -79,9 +79,6 @@ const Char *g_strFile = "data\\Generals.str"; const Char *g_csfFile = "data\\%s\\Generals.csf"; const char *gAppPrefix = ""; /// So WB can have a different debug log file name. -#define DEFAULT_XRESOLUTION 800 -#define DEFAULT_YRESOLUTION 600 - static Bool gInitializing = false; static Bool gDoPaint = true; static Bool isWinMainActive = false; @@ -601,7 +598,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, Int savContext = ::SaveDC(dc); HDC tmpDC = ::CreateCompatibleDC(dc); HBITMAP savBitmap = (HBITMAP)::SelectObject(tmpDC, gLoadScreenBitmap); - ::BitBlt(dc, 0, 0, DEFAULT_XRESOLUTION, DEFAULT_YRESOLUTION, tmpDC, 0, 0, SRCCOPY); + ::BitBlt(dc, 0, 0, DEFAULT_DISPLAY_WIDTH, DEFAULT_DISPLAY_HEIGHT, tmpDC, 0, 0, SRCCOPY); ::SelectObject(tmpDC, savBitmap); ::DeleteDC(tmpDC); ::RestoreDC(dc, savContext); @@ -683,8 +680,8 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, static Bool initializeAppWindows( HINSTANCE hInstance, Int nCmdShow, Bool runWindowed ) { DWORD windowStyle; - Int startWidth = DEFAULT_XRESOLUTION, - startHeight = DEFAULT_YRESOLUTION; + Int startWidth = DEFAULT_DISPLAY_WIDTH, + startHeight = DEFAULT_DISPLAY_HEIGHT; // register the window class @@ -710,8 +707,8 @@ static Bool initializeAppWindows( HINSTANCE hInstance, Int nCmdShow, Bool runWin AdjustWindowRect (&rect, windowStyle, FALSE); if (runWindowed) { // Makes the normal debug 800x600 window center in the screen. - startWidth = DEFAULT_XRESOLUTION; - startHeight= DEFAULT_YRESOLUTION; + startWidth = DEFAULT_DISPLAY_WIDTH; + startHeight= DEFAULT_DISPLAY_HEIGHT; } gInitializing = true; From fbe3ba575282faad82e08411af24a098b6c4dc7d Mon Sep 17 00:00:00 2001 From: Bart Roossien | SkyAero Date: Fri, 22 Aug 2025 23:57:46 +0200 Subject: [PATCH 012/343] tweak(menu): Show mouse and menu immediately when shellmap is disabled (#1480) --- .../Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp | 4 +++- .../Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp index a0cd4949a0a..83a42e24272 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp @@ -950,7 +950,9 @@ WindowMsgHandledType MainMenuInput( GameWindow *window, UnsignedInt msg, ICoord2D mouse; mouse.x = mData1 & 0xFFFF; mouse.y = mData1 >> 16; - if( mouse.x == 0 && mouse.y == 0) + + // TheSuperHackers @tweak 20/08/2025 Show mouse and menu immediately when shellmap is disabled. + if (TheGlobalData->m_shellMapOn && mouse.x == 0 && mouse.y == 0) break; static Int mousePosX = mouse.x; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp index d8fed5b4288..a42675511e1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp @@ -987,7 +987,9 @@ WindowMsgHandledType MainMenuInput( GameWindow *window, UnsignedInt msg, ICoord2D mouse; mouse.x = mData1 & 0xFFFF; mouse.y = mData1 >> 16; - if( mouse.x == 0 && mouse.y == 0) + + // TheSuperHackers @tweak 20/08/2025 Show mouse and menu immediately when shellmap is disabled. + if (TheGlobalData->m_shellMapOn && mouse.x == 0 && mouse.y == 0) break; static Int mousePosX = mouse.x; From e1555bcd84f4e96ab8c3a4f50c61426d24605e97 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 23 Aug 2025 20:47:34 +0200 Subject: [PATCH 013/343] tweak(scrolling): Disable edge scrolling when the mouse cursor is not captured (#1462) --- .../GameEngine/Include/GameClient/Mouse.h | 13 ++++++++----- .../Source/GameClient/Input/Mouse.cpp | 13 +++++++++++++ .../GameClient/MessageStream/LookAtXlat.cpp | 19 +++++++++++-------- .../Win32Device/GameClient/Win32Mouse.cpp | 10 ++++++++-- .../GameEngine/Include/GameClient/Mouse.h | 13 ++++++++----- .../Source/GameClient/Input/Mouse.cpp | 13 +++++++++++++ .../GameClient/MessageStream/LookAtXlat.cpp | 19 +++++++++++-------- .../Win32Device/GameClient/Win32Mouse.cpp | 10 ++++++++-- 8 files changed, 80 insertions(+), 30 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/Mouse.h b/Generals/Code/GameEngine/Include/GameClient/Mouse.h index 2541f6d5042..b3e044bd1d1 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Mouse.h +++ b/Generals/Code/GameEngine/Include/GameClient/Mouse.h @@ -291,6 +291,7 @@ class Mouse : public SubsystemInterface void setCursorCaptureMode(CursorCaptureMode mode); ///< set the rules for the mouse capture void refreshCursorCapture(); ///< refresh the mouse capture + Bool isCursorCaptured(); ///< true if the mouse is captured in the game window // access methods for the mouse data const MouseIO *getMouseStatus( void ) { return &m_currMouse; } ///< get current mouse status @@ -348,12 +349,13 @@ class Mouse : public SubsystemInterface protected: void initCapture(); - Bool canCapture() const; - void unblockCapture(CursorCaptureBlockReason reason); - void blockCapture(CursorCaptureBlockReason reason); + Bool canCapture() const; ///< true if the mouse can be captured + void unblockCapture(CursorCaptureBlockReason reason); // unset a reason to block mouse capture + void blockCapture(CursorCaptureBlockReason reason); // set a reason to block mouse capture + void onCursorCaptured(Bool captured); ///< called when the mouse was successfully captured or released - virtual void capture( void ) = 0; ///< capture the mouse - virtual void releaseCapture( void ) = 0; ///< release mouse capture + virtual void capture( void ) = 0; ///< capture the mouse in the game window + virtual void releaseCapture( void ) = 0; ///< release the mouse capture /// you must implement getting a buffered mouse event from you device here virtual UnsignedByte getMouseEvent( MouseIO *result, Bool flush ) = 0; @@ -398,6 +400,7 @@ class Mouse : public SubsystemInterface relative coordinate changes */ Bool m_visible; // visibility status + Bool m_isCursorCaptured; MouseCursor m_currentCursor; ///< current mouse cursor diff --git a/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp b/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp index 21e35449b0a..cf3e226d2d8 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp @@ -500,6 +500,7 @@ Mouse::Mouse( void ) else m_currentRedrawMode = RM_W3D;//RM_WINDOWS; m_visible = FALSE; + m_isCursorCaptured = FALSE; m_tooltipFontName = "Times New Roman"; m_tooltipFontSize = 12; m_tooltipFontIsBold = FALSE; @@ -1039,6 +1040,12 @@ void Mouse::refreshCursorCapture() } } +// ------------------------------------------------------------------------------------------------ +Bool Mouse::isCursorCaptured() +{ + return m_isCursorCaptured; +} + // ------------------------------------------------------------------------------------------------ void Mouse::loseFocus() { @@ -1118,6 +1125,12 @@ void Mouse::blockCapture(CursorCaptureBlockReason reason) CursorCaptureBlockReasonNames[reason], m_captureBlockReasonBits, (Int)canCapture())); } +// ------------------------------------------------------------------------------------------------ +void Mouse::onCursorCaptured( Bool captured ) +{ + m_isCursorCaptured = captured; +} + //------------------------------------------------------------------------------------------------- /** Draw the mouse */ //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index e0f4971e06b..92984eec2c9 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -308,18 +308,21 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage } // TheSuperHackers @tweak Ayumi/xezon 26/07/2025 Enables edge scrolling in windowed mode. - if (m_isScrolling) + if (TheMouse->isCursorCaptured()) { - if ( m_scrollType == SCROLL_SCREENEDGE && (m_currentPos.x >= edgeScrollSize && m_currentPos.y >= edgeScrollSize && m_currentPos.y < height-edgeScrollSize && m_currentPos.x < width-edgeScrollSize) ) + if (m_isScrolling) { - stopScrolling(); + if ( m_scrollType == SCROLL_SCREENEDGE && (m_currentPos.x >= edgeScrollSize && m_currentPos.y >= edgeScrollSize && m_currentPos.y < height-edgeScrollSize && m_currentPos.x < width-edgeScrollSize) ) + { + stopScrolling(); + } } - } - else - { - if ( m_currentPos.x < edgeScrollSize || m_currentPos.y < edgeScrollSize || m_currentPos.y >= height-edgeScrollSize || m_currentPos.x >= width-edgeScrollSize ) + else { - setScrolling(SCROLL_SCREENEDGE); + if ( m_currentPos.x < edgeScrollSize || m_currentPos.y < edgeScrollSize || m_currentPos.y >= height-edgeScrollSize || m_currentPos.x >= width-edgeScrollSize ) + { + setScrolling(SCROLL_SCREENEDGE); + } } } diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp index b4fb0fff085..c5f60c4c45e 100644 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp +++ b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp @@ -472,7 +472,10 @@ void Win32Mouse::capture( void ) rect.right = rightBottom.x; rect.bottom = rightBottom.y; - ::ClipCursor(&rect); + if (::ClipCursor(&rect)) + { + onCursorCaptured(true); + } } // end capture @@ -482,6 +485,9 @@ void Win32Mouse::capture( void ) void Win32Mouse::releaseCapture( void ) { - ::ClipCursor(NULL); + if (::ClipCursor(NULL)) + { + onCursorCaptured(false); + } } // end releaseCapture diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h index fd36f8f7944..46f71a553b7 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h @@ -291,6 +291,7 @@ class Mouse : public SubsystemInterface void setCursorCaptureMode(CursorCaptureMode mode); ///< set the rules for the mouse capture void refreshCursorCapture(); ///< refresh the mouse capture + Bool isCursorCaptured(); ///< true if the mouse is captured in the game window // access methods for the mouse data const MouseIO *getMouseStatus( void ) { return &m_currMouse; } ///< get current mouse status @@ -349,12 +350,13 @@ class Mouse : public SubsystemInterface protected: void initCapture(); - Bool canCapture() const; - void unblockCapture(CursorCaptureBlockReason reason); - void blockCapture(CursorCaptureBlockReason reason); + Bool canCapture() const; ///< true if the mouse can be captured + void unblockCapture(CursorCaptureBlockReason reason); // unset a reason to block mouse capture + void blockCapture(CursorCaptureBlockReason reason); // set a reason to block mouse capture + void onCursorCaptured(Bool captured); ///< called when the mouse was successfully captured or released - virtual void capture( void ) = 0; ///< capture the mouse - virtual void releaseCapture( void ) = 0; ///< release mouse capture + virtual void capture( void ) = 0; ///< capture the mouse in the game window + virtual void releaseCapture( void ) = 0; ///< release the mouse capture /// you must implement getting a buffered mouse event from you device here virtual UnsignedByte getMouseEvent( MouseIO *result, Bool flush ) = 0; @@ -399,6 +401,7 @@ class Mouse : public SubsystemInterface relative coordinate changes */ Bool m_visible; // visibility status + Bool m_isCursorCaptured; MouseCursor m_currentCursor; ///< current mouse cursor diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp index b3991e6fe50..9e7b8aeac77 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp @@ -500,6 +500,7 @@ Mouse::Mouse( void ) else m_currentRedrawMode = RM_W3D;//RM_WINDOWS; m_visible = FALSE; + m_isCursorCaptured = FALSE; m_tooltipFontName = "Times New Roman"; m_tooltipFontSize = 12; m_tooltipFontIsBold = FALSE; @@ -1039,6 +1040,12 @@ void Mouse::refreshCursorCapture() } } +// ------------------------------------------------------------------------------------------------ +Bool Mouse::isCursorCaptured() +{ + return m_isCursorCaptured; +} + // ------------------------------------------------------------------------------------------------ void Mouse::loseFocus() { @@ -1118,6 +1125,12 @@ void Mouse::blockCapture(CursorCaptureBlockReason reason) CursorCaptureBlockReasonNames[reason], m_captureBlockReasonBits, (Int)canCapture())); } +// ------------------------------------------------------------------------------------------------ +void Mouse::onCursorCaptured( Bool captured ) +{ + m_isCursorCaptured = captured; +} + //------------------------------------------------------------------------------------------------- /** Draw the mouse */ //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index e3e5aed2a0c..4114c7373a0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -307,18 +307,21 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage } // TheSuperHackers @tweak Ayumi/xezon 26/07/2025 Enables edge scrolling in windowed mode. - if (m_isScrolling) + if (TheMouse->isCursorCaptured()) { - if ( m_scrollType == SCROLL_SCREENEDGE && (m_currentPos.x >= edgeScrollSize && m_currentPos.y >= edgeScrollSize && m_currentPos.y < height-edgeScrollSize && m_currentPos.x < width-edgeScrollSize) ) + if (m_isScrolling) { - stopScrolling(); + if ( m_scrollType == SCROLL_SCREENEDGE && (m_currentPos.x >= edgeScrollSize && m_currentPos.y >= edgeScrollSize && m_currentPos.y < height-edgeScrollSize && m_currentPos.x < width-edgeScrollSize) ) + { + stopScrolling(); + } } - } - else - { - if ( m_currentPos.x < edgeScrollSize || m_currentPos.y < edgeScrollSize || m_currentPos.y >= height-edgeScrollSize || m_currentPos.x >= width-edgeScrollSize ) + else { - setScrolling(SCROLL_SCREENEDGE); + if ( m_currentPos.x < edgeScrollSize || m_currentPos.y < edgeScrollSize || m_currentPos.y >= height-edgeScrollSize || m_currentPos.x >= width-edgeScrollSize ) + { + setScrolling(SCROLL_SCREENEDGE); + } } } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp index f7f5883ce21..97f7840770e 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp @@ -472,7 +472,10 @@ void Win32Mouse::capture( void ) rect.right = rightBottom.x; rect.bottom = rightBottom.y; - ::ClipCursor(&rect); + if (::ClipCursor(&rect)) + { + onCursorCaptured(true); + } } // end capture @@ -482,6 +485,9 @@ void Win32Mouse::capture( void ) void Win32Mouse::releaseCapture( void ) { - ::ClipCursor(NULL); + if (::ClipCursor(NULL)) + { + onCursorCaptured(false); + } } // end releaseCapture From 67f50d17b5f90a6499f62c2dfdb6a0e5973b98da Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Sun, 24 Aug 2025 17:43:52 +1000 Subject: [PATCH 014/343] tweak(input): Remove input latency for group creation in multiplayer games (#1471) --- .../Code/GameEngine/Include/Common/Player.h | 2 +- .../GameEngine/Source/Common/RTS/Player.cpp | 2 +- .../GameClient/MessageStream/CommandXlat.cpp | 20 +++++++++++++++++++ .../GameLogic/System/GameLogicDispatch.cpp | 8 +++----- .../Code/GameEngine/Include/Common/Player.h | 2 +- .../GameEngine/Source/Common/RTS/Player.cpp | 2 +- .../GameClient/MessageStream/CommandXlat.cpp | 20 +++++++++++++++++++ .../GameLogic/System/GameLogicDispatch.cpp | 8 +++----- 8 files changed, 50 insertions(+), 14 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/Player.h b/Generals/Code/GameEngine/Include/Common/Player.h index 5fc1b8e850d..380520ed359 100644 --- a/Generals/Code/GameEngine/Include/Common/Player.h +++ b/Generals/Code/GameEngine/Include/Common/Player.h @@ -603,7 +603,7 @@ class Player : public Snapshot ScoreKeeper* getScoreKeeper( void ) { return &m_scoreKeeper; } /// time to create a hotkey team based on this GameMessage - void processCreateTeamGameMessage(Int hotkeyNum, GameMessage *msg); + void processCreateTeamGameMessage(Int hotkeyNum, const GameMessage *msg); /// time to select a hotkey team based on this GameMessage void processSelectTeamGameMessage(Int hotkeyNum, GameMessage *msg); diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp index 6c3571d0955..18822e59318 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp @@ -3181,7 +3181,7 @@ void Player::applyBattlePlanBonusesForPlayerObjects( const BattlePlanBonuses *bo //------------------------------------------------------------------------------------------------- /** Create a hotkey team based on this GameMessage */ //------------------------------------------------------------------------------------------------- -void Player::processCreateTeamGameMessage(Int hotkeyNum, GameMessage *msg) { +void Player::processCreateTeamGameMessage(Int hotkeyNum, const GameMessage *msg) { // GameMessage arguments are the object ID's of the objects that are to be in this team. if ((hotkeyNum < 0) || (hotkeyNum >= NUM_HOTKEY_SQUADS)) { diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 34b2376c62d..26d685497b8 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -3269,6 +3269,26 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage break; } + // -------------------------------------------------------------------------------------------- + case GameMessage::MSG_CREATE_TEAM0: + case GameMessage::MSG_CREATE_TEAM1: + case GameMessage::MSG_CREATE_TEAM2: + case GameMessage::MSG_CREATE_TEAM3: + case GameMessage::MSG_CREATE_TEAM4: + case GameMessage::MSG_CREATE_TEAM5: + case GameMessage::MSG_CREATE_TEAM6: + case GameMessage::MSG_CREATE_TEAM7: + case GameMessage::MSG_CREATE_TEAM8: + case GameMessage::MSG_CREATE_TEAM9: + { + Int playerIndex = msg->getPlayerIndex(); + Player* player = ThePlayerList->getNthPlayer(playerIndex); + if (player && player->isLocalPlayer()) + player->processCreateTeamGameMessage(t - GameMessage::MSG_CREATE_TEAM0, msg); + + break; + } + // -------------------------------------------------------------------------------------------- case GameMessage::MSG_CREATE_SELECTED_GROUP: case GameMessage::MSG_SELECT_TEAM0: diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index 0d9f8dcd8d8..59b11397df7 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -1901,12 +1901,10 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Player *player = ThePlayerList->getNthPlayer(playerIndex); DEBUG_ASSERTCRASH(player != NULL, ("Could not find player for create team message")); - if (player == NULL) - { - break; - } + // TheSuperHackers @tweak Stubbjax 17/08/2025 The local player processes this message in CommandXlat for immediate assignment. + if (player && !player->isLocalPlayer()) + player->processCreateTeamGameMessage(msg->getType() - GameMessage::MSG_CREATE_TEAM0, msg); - player->processCreateTeamGameMessage(msg->getType() - GameMessage::MSG_CREATE_TEAM0, msg); break; } // end create team command diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Player.h b/GeneralsMD/Code/GameEngine/Include/Common/Player.h index 0227fa07571..25d0e8daaec 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Player.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Player.h @@ -629,7 +629,7 @@ class Player : public Snapshot ScoreKeeper* getScoreKeeper( void ) { return &m_scoreKeeper; } /// time to create a hotkey team based on this GameMessage - void processCreateTeamGameMessage(Int hotkeyNum, GameMessage *msg); + void processCreateTeamGameMessage(Int hotkeyNum, const GameMessage *msg); /// time to select a hotkey team based on this GameMessage void processSelectTeamGameMessage(Int hotkeyNum, GameMessage *msg); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp index 891adf3050f..9d8ef74c227 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp @@ -3682,7 +3682,7 @@ void Player::applyBattlePlanBonusesForPlayerObjects( const BattlePlanBonuses *bo //------------------------------------------------------------------------------------------------- /** Create a hotkey team based on this GameMessage */ //------------------------------------------------------------------------------------------------- -void Player::processCreateTeamGameMessage(Int hotkeyNum, GameMessage *msg) { +void Player::processCreateTeamGameMessage(Int hotkeyNum, const GameMessage *msg) { // GameMessage arguments are the object ID's of the objects that are to be in this team. if ((hotkeyNum < 0) || (hotkeyNum >= NUM_HOTKEY_SQUADS)) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 23e1f893444..5feb8e0c449 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -3610,6 +3610,26 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage break; } + // -------------------------------------------------------------------------------------------- + case GameMessage::MSG_CREATE_TEAM0: + case GameMessage::MSG_CREATE_TEAM1: + case GameMessage::MSG_CREATE_TEAM2: + case GameMessage::MSG_CREATE_TEAM3: + case GameMessage::MSG_CREATE_TEAM4: + case GameMessage::MSG_CREATE_TEAM5: + case GameMessage::MSG_CREATE_TEAM6: + case GameMessage::MSG_CREATE_TEAM7: + case GameMessage::MSG_CREATE_TEAM8: + case GameMessage::MSG_CREATE_TEAM9: + { + Int playerIndex = msg->getPlayerIndex(); + Player* player = ThePlayerList->getNthPlayer(playerIndex); + if (player && player->isLocalPlayer()) + player->processCreateTeamGameMessage(t - GameMessage::MSG_CREATE_TEAM0, msg); + + break; + } + // -------------------------------------------------------------------------------------------- case GameMessage::MSG_CREATE_SELECTED_GROUP: case GameMessage::MSG_SELECT_TEAM0: diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index a98cb50533d..cb534d5914d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -1929,12 +1929,10 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Player *player = ThePlayerList->getNthPlayer(playerIndex); DEBUG_ASSERTCRASH(player != NULL, ("Could not find player for create team message")); - if (player == NULL) - { - break; - } + // TheSuperHackers @tweak Stubbjax 17/08/2025 The local player processes this message in CommandXlat for immediate assignment. + if (player && !player->isLocalPlayer()) + player->processCreateTeamGameMessage(msg->getType() - GameMessage::MSG_CREATE_TEAM0, msg); - player->processCreateTeamGameMessage(msg->getType() - GameMessage::MSG_CREATE_TEAM0, msg); break; } // end create team command From ca8e5563c29a3d131026c86baefa5afbc2cc706d Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Wed, 6 Aug 2025 18:51:41 +0200 Subject: [PATCH 015/343] bugfix(fps): Fix inaccurate frame rate cap (#1451) --- Core/GameEngine/CMakeLists.txt | 2 + .../Include/Common/FrameRateLimit.h | 31 +++++++++++ .../Source/Common/FrameRateLimit.cpp | 54 +++++++++++++++++++ .../GameEngine/Source/Common/GameEngine.cpp | 39 ++++++-------- .../W3DDevice/GameClient/W3DDisplay.cpp | 13 ----- .../Code/Tools/GUIEdit/Source/GUIEdit.cpp | 2 - .../GameEngine/Source/Common/GameEngine.cpp | 39 ++++++-------- .../W3DDevice/GameClient/W3DDisplay.cpp | 13 ----- .../Code/Tools/GUIEdit/Source/GUIEdit.cpp | 2 - 9 files changed, 121 insertions(+), 74 deletions(-) create mode 100644 Core/GameEngine/Include/Common/FrameRateLimit.h create mode 100644 Core/GameEngine/Source/Common/FrameRateLimit.cpp diff --git a/Core/GameEngine/CMakeLists.txt b/Core/GameEngine/CMakeLists.txt index 494d544f73d..ceb87625573 100644 --- a/Core/GameEngine/CMakeLists.txt +++ b/Core/GameEngine/CMakeLists.txt @@ -39,6 +39,7 @@ set(GAMEENGINE_SRC # Include/Common/Errors.h Include/Common/file.h Include/Common/FileSystem.h + Include/Common/FrameRateLimit.h # Include/Common/FunctionLexicon.h Include/Common/GameAudio.h # Include/Common/GameCommon.h @@ -569,6 +570,7 @@ set(GAMEENGINE_SRC # Source/Common/DamageFX.cpp # Source/Common/Dict.cpp # Source/Common/DiscreteCircle.cpp + Source/Common/FrameRateLimit.cpp # Source/Common/GameEngine.cpp # Source/Common/GameLOD.cpp # Source/Common/GameMain.cpp diff --git a/Core/GameEngine/Include/Common/FrameRateLimit.h b/Core/GameEngine/Include/Common/FrameRateLimit.h new file mode 100644 index 00000000000..1696065eacd --- /dev/null +++ b/Core/GameEngine/Include/Common/FrameRateLimit.h @@ -0,0 +1,31 @@ +/* +** Command & Conquer Generals Zero Hour(tm) +** Copyright 2025 TheSuperHackers +** +** This program is free software: you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation, either version 3 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program. If not, see . +*/ + +#pragma once + +class FrameRateLimit +{ +public: + FrameRateLimit(); + + Real wait(UnsignedInt maxFps); + +private: + LARGE_INTEGER m_freq; + LARGE_INTEGER m_start; +}; diff --git a/Core/GameEngine/Source/Common/FrameRateLimit.cpp b/Core/GameEngine/Source/Common/FrameRateLimit.cpp new file mode 100644 index 00000000000..403ab00c734 --- /dev/null +++ b/Core/GameEngine/Source/Common/FrameRateLimit.cpp @@ -0,0 +1,54 @@ +/* +** Command & Conquer Generals Zero Hour(tm) +** Copyright 2025 TheSuperHackers +** +** This program is free software: you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation, either version 3 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program. If not, see . +*/ + +#include "PreRTS.h" +#include "Common/FrameRateLimit.h" + + +FrameRateLimit::FrameRateLimit() +{ + QueryPerformanceFrequency(&m_freq); + QueryPerformanceCounter(&m_start); +} + +Real FrameRateLimit::wait(UnsignedInt maxFps) +{ + LARGE_INTEGER tick; + QueryPerformanceCounter(&tick); + double elapsedSeconds = static_cast(tick.QuadPart - m_start.QuadPart) / m_freq.QuadPart; + const double targetSeconds = 1.0 / maxFps; + const double sleepSeconds = targetSeconds - elapsedSeconds - 0.002; // leave ~2ms for spin wait + + if (sleepSeconds > 0.0) + { + // Non busy wait with Munkee sleep + DWORD dwMilliseconds = static_cast(sleepSeconds * 1000); + Sleep(dwMilliseconds); + } + + // Busy wait for remaining time + do + { + QueryPerformanceCounter(&tick); + elapsedSeconds = static_cast(tick.QuadPart - m_start.QuadPart) / m_freq.QuadPart; + } + while (elapsedSeconds < targetSeconds); + + m_start = tick; + return (Real)elapsedSeconds; +} diff --git a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp index d4a63572d35..77aab193983 100644 --- a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp @@ -44,6 +44,7 @@ #include "Common/ThingFactory.h" #include "Common/file.h" #include "Common/FileSystem.h" +#include "Common/FrameRateLimit.h" #include "Common/ArchiveFileSystem.h" #include "Common/LocalFileSystem.h" #include "Common/CDManager.h" @@ -668,8 +669,8 @@ extern HWND ApplicationHWnd; */ void GameEngine::execute( void ) { + FrameRateLimit* frameRateLimit = new FrameRateLimit(); - DWORD prevTime = timeGetTime(); #if defined(RTS_DEBUG) DWORD startTime = timeGetTime() / 1000; #endif @@ -743,7 +744,7 @@ void GameEngine::execute( void ) if (TheTacticalView->getTimeMultiplier()<=1 && !TheScriptEngine->isTimeFast()) { - // I'm disabling this in internal because many people need alt-tab capability. If you happen to be + // I'm disabling this in debug because many people need alt-tab capability. If you happen to be // doing performance tuning, please just change this on your local system. -MDC #if defined(RTS_DEBUG) ::Sleep(1); // give everyone else a tiny time slice. @@ -751,27 +752,20 @@ void GameEngine::execute( void ) #if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) - if ( ! TheGlobalData->m_TiVOFastMode ) - #else //always allow this cheatkey if we're in a replaygame. - if ( ! (TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame())) + if ( ! TheGlobalData->m_TiVOFastMode ) + #else //always allow this cheat key if we're in a replay game. + if ( ! (TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame())) #endif - { - // limit the framerate - DWORD now = timeGetTime(); - DWORD limit = (1000.0f/m_maxFPS)-1; - while (TheGlobalData->m_useFpsLimit && (now - prevTime) < limit) - { - ::Sleep(0); - now = timeGetTime(); - } - //Int slept = now - prevTime; - //DEBUG_LOG(("delayed %d",slept)); - - prevTime = now; - - } - - } + { + // TheSuperHackers @bugfix xezon 05/08/2025 Re-implements the frame rate limiter + // with higher resolution counters to cap the frame rate more accurately to the desired limit. + if (TheGlobalData->m_useFpsLimit) + { + frameRateLimit->wait(m_maxFPS); + } + } + + } } } // perfgather for execute_loop @@ -787,6 +781,7 @@ void GameEngine::execute( void ) } + delete frameRateLimit; } /** ----------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 64652df3d53..3d3d237e060 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -1766,19 +1766,6 @@ void W3DDisplay::draw( void ) do { - { - if(TheGlobalData->m_loadScreenRender != TRUE) - { - - // limit the framerate - while(TheGlobalData->m_useFpsLimit && (now - prevTime) < minTime-1) - { - now = timeGetTime(); - } - prevTime = now; - } - } - // update all views of the world - recomputes data which will affect drawing if (DX8Wrapper::_Get_D3D_Device8() && (DX8Wrapper::_Get_D3D_Device8()->TestCooperativeLevel()) == D3D_OK) { //Checking if we have the device before updating views because the heightmap crashes otherwise while diff --git a/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp b/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp index fe4e438c113..b91eee83317 100644 --- a/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp @@ -77,8 +77,6 @@ #include "W3DDevice/Common/W3DFunctionLexicon.h" #include "W3DDevice/GameClient/W3DGameWindowManager.h" -#include "W3DDevice/GameClient/W3DDisplay.h" -#include "W3DDevice/GameClient/W3DGameWindowManager.h" #include "W3DDevice/GameClient/W3DGameFont.h" #include "W3DDevice/GameClient/W3DDisplayStringManager.h" #include "GameClient/Keyboard.h" diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp index f15842701dc..2dfbc32ff13 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp @@ -44,6 +44,7 @@ #include "Common/ThingFactory.h" #include "Common/file.h" #include "Common/FileSystem.h" +#include "Common/FrameRateLimit.h" #include "Common/ArchiveFileSystem.h" #include "Common/LocalFileSystem.h" #include "Common/CDManager.h" @@ -842,8 +843,8 @@ extern HWND ApplicationHWnd; */ void GameEngine::execute( void ) { + FrameRateLimit* frameRateLimit = new FrameRateLimit(); - DWORD prevTime = timeGetTime(); #if defined(RTS_DEBUG) DWORD startTime = timeGetTime() / 1000; #endif @@ -917,7 +918,7 @@ void GameEngine::execute( void ) if (TheTacticalView->getTimeMultiplier()<=1 && !TheScriptEngine->isTimeFast()) { - // I'm disabling this in internal because many people need alt-tab capability. If you happen to be + // I'm disabling this in debug because many people need alt-tab capability. If you happen to be // doing performance tuning, please just change this on your local system. -MDC #if defined(RTS_DEBUG) ::Sleep(1); // give everyone else a tiny time slice. @@ -925,27 +926,20 @@ void GameEngine::execute( void ) #if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) - if ( ! TheGlobalData->m_TiVOFastMode ) - #else //always allow this cheatkey if we're in a replaygame. - if ( ! (TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame())) + if ( ! TheGlobalData->m_TiVOFastMode ) + #else //always allow this cheat key if we're in a replay game. + if ( ! (TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame())) #endif - { - // limit the framerate - DWORD now = timeGetTime(); - DWORD limit = (1000.0f/m_maxFPS)-1; - while (TheGlobalData->m_useFpsLimit && (now - prevTime) < limit) - { - ::Sleep(0); - now = timeGetTime(); - } - //Int slept = now - prevTime; - //DEBUG_LOG(("delayed %d",slept)); - - prevTime = now; - - } - - } + { + // TheSuperHackers @bugfix xezon 05/08/2025 Re-implements the frame rate limiter + // with higher resolution counters to cap the frame rate more accurately to the desired limit. + if (TheGlobalData->m_useFpsLimit) + { + frameRateLimit->wait(m_maxFPS); + } + } + + } } } // perfgather for execute_loop @@ -961,6 +955,7 @@ void GameEngine::execute( void ) } + delete frameRateLimit; } /** ----------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 7185abb8dad..4846c419fed 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -1851,19 +1851,6 @@ void W3DDisplay::draw( void ) do { - { - if(TheGlobalData->m_loadScreenRender != TRUE) - { - - // limit the framerate - while(TheGlobalData->m_useFpsLimit && (now - prevTime) < minTime-1) - { - now = timeGetTime(); - } - prevTime = now; - } - } - // update all views of the world - recomputes data which will affect drawing if (DX8Wrapper::_Get_D3D_Device8() && (DX8Wrapper::_Get_D3D_Device8()->TestCooperativeLevel()) == D3D_OK) { //Checking if we have the device before updating views because the heightmap crashes otherwise while diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp index 44d0353accc..65ba591a26e 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp @@ -77,8 +77,6 @@ #include "W3DDevice/Common/W3DFunctionLexicon.h" #include "W3DDevice/GameClient/W3DGameWindowManager.h" -#include "W3DDevice/GameClient/W3DDisplay.h" -#include "W3DDevice/GameClient/W3DGameWindowManager.h" #include "W3DDevice/GameClient/W3DGameFont.h" #include "W3DDevice/GameClient/W3DDisplayStringManager.h" #include "GameClient/Keyboard.h" From 4c14ada4765ed9bc2ecfd2330fc7a109907f28d7 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 12 Aug 2025 19:44:06 +0200 Subject: [PATCH 016/343] tweak(fps): Decouple non-network logic update from render update (#1451) --- .../Include/Common/FrameRateLimit.h | 39 +++++ .../Source/Common/FrameRateLimit.cpp | 72 +++++++++ .../GameEngine/Include/Common/GameCommon.h | 1 + .../GameEngine/Include/Common/GameEngine.h | 26 ++- .../GameEngine/Include/Common/MessageStream.h | 4 + .../GameEngine/Include/GameClient/MetaEvent.h | 62 ++++--- .../GameEngine/Source/Common/GameEngine.cpp | 153 +++++++++++++++--- .../Source/Common/MessageStream.cpp | 4 + .../GameClient/MessageStream/CommandXlat.cpp | 126 +++++++++++++++ .../GameClient/MessageStream/MetaEvent.cpp | 48 ++++++ .../GameEngine/Include/Common/GameCommon.h | 1 + .../GameEngine/Include/Common/GameEngine.h | 26 ++- .../GameEngine/Include/Common/MessageStream.h | 4 + .../GameEngine/Include/GameClient/MetaEvent.h | 62 ++++--- .../GameEngine/Source/Common/GameEngine.cpp | 152 ++++++++++++++--- .../Source/Common/MessageStream.cpp | 4 + .../GameClient/MessageStream/CommandXlat.cpp | 126 +++++++++++++++ .../GameClient/MessageStream/MetaEvent.cpp | 48 ++++++ 18 files changed, 863 insertions(+), 95 deletions(-) diff --git a/Core/GameEngine/Include/Common/FrameRateLimit.h b/Core/GameEngine/Include/Common/FrameRateLimit.h index 1696065eacd..31779e2aebe 100644 --- a/Core/GameEngine/Include/Common/FrameRateLimit.h +++ b/Core/GameEngine/Include/Common/FrameRateLimit.h @@ -29,3 +29,42 @@ class FrameRateLimit LARGE_INTEGER m_freq; LARGE_INTEGER m_start; }; + + +enum FpsValueChange +{ + FpsValueChange_Increase, + FpsValueChange_Decrease, +}; + + +class RenderFpsPreset +{ +public: + enum CPP_11(: UnsignedInt) + { + UncappedFpsValue = 1000000, + }; + + static UnsignedInt getNextFpsValue(UnsignedInt value); + static UnsignedInt getPrevFpsValue(UnsignedInt value); + static UnsignedInt changeFpsValue(UnsignedInt value, FpsValueChange change); + +private: + static const UnsignedInt s_fpsValues[]; +}; + + +class LogicTimeScaleFpsPreset +{ +public: + enum CPP_11(: UnsignedInt) + { + StepFpsValue = 5, + }; + + static UnsignedInt getNextFpsValue(UnsignedInt value); + static UnsignedInt getPrevFpsValue(UnsignedInt value); + static UnsignedInt changeFpsValue(UnsignedInt value, FpsValueChange change); +}; + diff --git a/Core/GameEngine/Source/Common/FrameRateLimit.cpp b/Core/GameEngine/Source/Common/FrameRateLimit.cpp index 403ab00c734..71fb213d65d 100644 --- a/Core/GameEngine/Source/Common/FrameRateLimit.cpp +++ b/Core/GameEngine/Source/Common/FrameRateLimit.cpp @@ -52,3 +52,75 @@ Real FrameRateLimit::wait(UnsignedInt maxFps) m_start = tick; return (Real)elapsedSeconds; } + + +const UnsignedInt RenderFpsPreset::s_fpsValues[] = { + 30, 50, 56, 60, 65, 70, 72, 75, 80, 85, 90, 100, 110, 120, 144, 240, 480, UncappedFpsValue }; + +static_assert(LOGICFRAMES_PER_SECOND <= 30, "Min FPS values need to be revisited!"); + +UnsignedInt RenderFpsPreset::getNextFpsValue(UnsignedInt value) +{ + const Int first = 0; + const Int last = ARRAY_SIZE(s_fpsValues) - 1; + for (Int i = first; i < last; ++i) + { + if (value >= s_fpsValues[i] && value < s_fpsValues[i + 1]) + { + return s_fpsValues[i + 1]; + } + } + return s_fpsValues[last]; +} + +UnsignedInt RenderFpsPreset::getPrevFpsValue(UnsignedInt value) +{ + const Int first = 0; + const Int last = ARRAY_SIZE(s_fpsValues) - 1; + for (Int i = last; i > first; --i) + { + if (value <= s_fpsValues[i] && value > s_fpsValues[i - 1]) + { + return s_fpsValues[i - 1]; + } + } + return s_fpsValues[first]; +} + +UnsignedInt RenderFpsPreset::changeFpsValue(UnsignedInt value, FpsValueChange change) +{ + switch (change) + { + default: + case FpsValueChange_Increase: return getNextFpsValue(value); + case FpsValueChange_Decrease: return getPrevFpsValue(value); + } +} + + +UnsignedInt LogicTimeScaleFpsPreset::getNextFpsValue(UnsignedInt value) +{ + return value + StepFpsValue; +} + +UnsignedInt LogicTimeScaleFpsPreset::getPrevFpsValue(UnsignedInt value) +{ + if (value - StepFpsValue < LOGICFRAMES_PER_SECOND) + { + return LOGICFRAMES_PER_SECOND; + } + else + { + return value - StepFpsValue; + } +} + +UnsignedInt LogicTimeScaleFpsPreset::changeFpsValue(UnsignedInt value, FpsValueChange change) +{ + switch (change) + { + default: + case FpsValueChange_Increase: return getNextFpsValue(value); + case FpsValueChange_Decrease: return getPrevFpsValue(value); + } +} diff --git a/Generals/Code/GameEngine/Include/Common/GameCommon.h b/Generals/Code/GameEngine/Include/Common/GameCommon.h index 40b36775574..60867cb2080 100644 --- a/Generals/Code/GameEngine/Include/Common/GameCommon.h +++ b/Generals/Code/GameEngine/Include/Common/GameCommon.h @@ -65,6 +65,7 @@ // ---------------------------------------------------------------------------------------------- enum { + BaseFps = 30, // The historic base frame rate for this game. This value must never change. LOGICFRAMES_PER_SECOND = 30, MSEC_PER_SECOND = 1000 }; diff --git a/Generals/Code/GameEngine/Include/Common/GameEngine.h b/Generals/Code/GameEngine/Include/Common/GameEngine.h index 174274ecb36..7f0dc1757a0 100644 --- a/Generals/Code/GameEngine/Include/Common/GameEngine.h +++ b/Generals/Code/GameEngine/Include/Common/GameEngine.h @@ -34,8 +34,6 @@ #include "Common/SubsystemInterface.h" #include "Common/GameType.h" -#define DEFAULT_MAX_FPS 45 - // forward declarations class AudioManager; class GameLogic; @@ -72,8 +70,20 @@ class GameEngine : public SubsystemInterface virtual void execute( void ); /**< The "main loop" of the game engine. It will not return until the game exits. */ - virtual void setFramesPerSecondLimit( Int fps ); ///< Set the maximum rate engine updates are allowed to occur - virtual Int getFramesPerSecondLimit( void ); ///< Get maxFPS. Not inline since it is called from another lib. + + virtual void setFramesPerSecondLimit( Int fps ); ///< Set the max render and engine update fps. + virtual Int getFramesPerSecondLimit( void ); ///< Get the max render and engine update fps. + Real getUpdateTime(); ///< Get the last engine update delta time. + Real getUpdateFps(); ///< Get the last engine update fps. + + virtual void setLogicTimeScaleFps( Int fps ); ///< Set the logic time scale fps and therefore scale the simulation time. Is capped by the max render fps and does not apply to network matches. + virtual Int getLogicTimeScaleFps(); ///< Get the raw logic time scale fps value. + virtual void enableLogicTimeScale( Bool enable ); ///< Enable the logic time scale setup. If disabled, the simulation time scale is bound to the render frame time or network update time. + virtual Bool isLogicTimeScaleEnabled(); ///< Check whether the logic time scale setup is enabled. + Int getActualLogicTimeScaleFps(); ///< Get the real logic time scale fps, depending on the max render fps, network state and enabled state. + Real getActualLogicTimeScaleRatio(); ///< Get the real logic time scale ratio, depending on the max render fps, network state and enabled state. + Real getActualLogicTimeScaleOverFpsRatio(); ///< Get the real logic time scale over render fps ratio, used to scale down steps in render updates to match logic updates. + virtual void setQuitting( Bool quitting ); ///< set quitting status virtual Bool getQuitting(void); ///< is app getting ready to quit. @@ -101,9 +111,15 @@ class GameEngine : public SubsystemInterface virtual ParticleSystemManager* createParticleSystemManager( void ) = 0; virtual AudioManager *createAudioManager( void ) = 0; ///< Factory for Audio Manager - Int m_maxFPS; ///< Maximum frames per second allowed + Int m_maxFPS; ///< Maximum frames per second for rendering + Int m_logicTimeScaleFPS; ///< Maximum frames per second for logic time scale + + Real m_updateTime; ///< Last engine update delta time + Real m_logicTimeAccumulator; ///< Frame time accumulated towards submitting a new logic frame + Bool m_quitting; ///< true when we need to quit the game Bool m_isActive; ///< app has OS focus. + Bool m_enableLogicTimeScale; }; inline void GameEngine::setQuitting( Bool quitting ) { m_quitting = quitting; } diff --git a/Generals/Code/GameEngine/Include/Common/MessageStream.h b/Generals/Code/GameEngine/Include/Common/MessageStream.h index c0148958201..31bb277da9f 100644 --- a/Generals/Code/GameEngine/Include/Common/MessageStream.h +++ b/Generals/Code/GameEngine/Include/Common/MessageStream.h @@ -241,6 +241,10 @@ class GameMessage : public MemoryPoolObject MSG_META_HELP, ///< bring up help screen #endif + MSG_META_INCREASE_MAX_RENDER_FPS, ///< TheSuperHackers @feature Increase the max render fps + MSG_META_DECREASE_MAX_RENDER_FPS, ///< TheSuperHackers @feature Decrease the max render fps + MSG_META_INCREASE_LOGIC_TIME_SCALE, ///< TheSuperHackers @feature Increase the logic time scale + MSG_META_DECREASE_LOGIC_TIME_SCALE, ///< TheSuperHackers @feature Decrease the logic time scale MSG_META_TOGGLE_LOWER_DETAILS, ///< toggles graphics options to crappy mode instantly MSG_META_TOGGLE_CONTROL_BAR, ///< show/hide controlbar diff --git a/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h b/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h index 518c6a3d6da..a1c77fa8b53 100644 --- a/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h +++ b/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h @@ -69,6 +69,24 @@ static const LookupListRec CategoryListName[] = // KeyDefType; this is extremely important to maintain! enum MappableKeyType CPP_11(: Int) { + // keypad keys ---------------------------------------------------------------- + MK_KP0 = KEY_KP0, + MK_KP1 = KEY_KP1, + MK_KP2 = KEY_KP2, + MK_KP3 = KEY_KP3, + MK_KP4 = KEY_KP4, + MK_KP5 = KEY_KP5, + MK_KP6 = KEY_KP6, + MK_KP7 = KEY_KP7, + MK_KP8 = KEY_KP8, + MK_KP9 = KEY_KP9, + MK_KPDEL = KEY_KPDEL, + MK_KPSTAR = KEY_KPSTAR, + MK_KPMINUS = KEY_KPMINUS, + MK_KPPLUS = KEY_KPPLUS, + MK_KPENTER = KEY_KPENTER, + MK_KPSLASH = KEY_KPSLASH, + MK_ESC = KEY_ESC, MK_BACKSPACE = KEY_BACKSPACE, MK_ENTER = KEY_ENTER, @@ -122,16 +140,6 @@ enum MappableKeyType CPP_11(: Int) MK_8 = KEY_8, MK_9 = KEY_9, MK_0 = KEY_0, - MK_KP1 = KEY_KP1, - MK_KP2 = KEY_KP2, - MK_KP3 = KEY_KP3, - MK_KP4 = KEY_KP4, - MK_KP5 = KEY_KP5, - MK_KP6 = KEY_KP6, - MK_KP7 = KEY_KP7, - MK_KP8 = KEY_KP8, - MK_KP9 = KEY_KP9, - MK_KP0 = KEY_KP0, MK_MINUS = KEY_MINUS, MK_EQUAL = KEY_EQUAL, MK_LBRACKET = KEY_LBRACKET, @@ -153,13 +161,30 @@ enum MappableKeyType CPP_11(: Int) MK_PGDN = KEY_PGDN, MK_INS = KEY_INS, MK_DEL = KEY_DEL, - MK_KPSLASH = KEY_KPSLASH, MK_NONE = KEY_NONE }; static const LookupListRec KeyNames[] = { + // keypad keys ---------------------------------------------------------------- + { "KEY_KP0", MK_KP0 }, + { "KEY_KP1", MK_KP1 }, + { "KEY_KP2", MK_KP2 }, + { "KEY_KP3", MK_KP3 }, + { "KEY_KP4", MK_KP4 }, + { "KEY_KP5", MK_KP5 }, + { "KEY_KP6", MK_KP6 }, + { "KEY_KP7", MK_KP7 }, + { "KEY_KP8", MK_KP8 }, + { "KEY_KP9", MK_KP9 }, + { "KEY_KPDEL", MK_KPDEL }, + { "KEY_KPSTAR", MK_KPSTAR }, + { "KEY_KPMINUS", MK_KPMINUS }, + { "KEY_KPPLUS", MK_KPPLUS }, + { "KEY_KPENTER", MK_KPENTER }, + { "KEY_KPSLASH", MK_KPSLASH }, + { "KEY_ESC", MK_ESC }, { "KEY_BACKSPACE", MK_BACKSPACE }, { "KEY_ENTER", MK_ENTER }, @@ -213,16 +238,6 @@ static const LookupListRec KeyNames[] = { "KEY_8", MK_8 }, { "KEY_9", MK_9 }, { "KEY_0", MK_0 }, - { "KEY_KP1", MK_KP1 }, - { "KEY_KP2", MK_KP2 }, - { "KEY_KP3", MK_KP3 }, - { "KEY_KP4", MK_KP4 }, - { "KEY_KP5", MK_KP5 }, - { "KEY_KP6", MK_KP6 }, - { "KEY_KP7", MK_KP7 }, - { "KEY_KP8", MK_KP8 }, - { "KEY_KP9", MK_KP9 }, - { "KEY_KP0", MK_KP0 }, { "KEY_MINUS", MK_MINUS }, { "KEY_EQUAL", MK_EQUAL }, { "KEY_LBRACKET", MK_LBRACKET }, @@ -244,7 +259,6 @@ static const LookupListRec KeyNames[] = { "KEY_PGDN", MK_PGDN }, { "KEY_INS", MK_INS }, { "KEY_DEL", MK_DEL }, - { "KEY_KPSLASH", MK_KPSLASH }, { "KEY_NONE", MK_NONE }, { NULL, 0 } // keep this last! }; @@ -301,7 +315,9 @@ enum CommandUsableInType CPP_11(: Int) COMMANDUSABLE_NONE = 0, COMMANDUSABLE_SHELL = (1 << 0), - COMMANDUSABLE_GAME = (1 << 1) + COMMANDUSABLE_GAME = (1 << 1), + + COMMANDUSABLE_EVERYWHERE = COMMANDUSABLE_SHELL | COMMANDUSABLE_GAME, }; static const char* TheCommandUsableInNames[] = diff --git a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp index 77aab193983..f083ec016dd 100644 --- a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp @@ -242,12 +242,6 @@ static void updateWindowTitle() } } -//------------------------------------------------------------------------------------------------- -Int GameEngine::getFramesPerSecondLimit( void ) -{ - return m_maxFPS; -} - //------------------------------------------------------------------------------------------------- GameEngine::GameEngine( void ) { @@ -255,9 +249,13 @@ GameEngine::GameEngine( void ) timeBeginPeriod(1); // initialize to non garbage values - m_maxFPS = 0; + m_maxFPS = BaseFps; + m_logicTimeScaleFPS = LOGICFRAMES_PER_SECOND; + m_updateTime = 0.0f; + m_logicTimeAccumulator = 0.0f; m_quitting = FALSE; m_isActive = FALSE; + m_enableLogicTimeScale = FALSE; _Module.Init(NULL, ApplicationHInstance, NULL); } @@ -308,12 +306,93 @@ GameEngine::~GameEngine() timeEndPeriod(1); } +//------------------------------------------------------------------------------------------------- void GameEngine::setFramesPerSecondLimit( Int fps ) { DEBUG_LOG(("GameEngine::setFramesPerSecondLimit() - setting max fps to %d (TheGlobalData->m_useFpsLimit == %d)", fps, TheGlobalData->m_useFpsLimit)); m_maxFPS = fps; } +//------------------------------------------------------------------------------------------------- +Int GameEngine::getFramesPerSecondLimit( void ) +{ + return m_maxFPS; +} + +//------------------------------------------------------------------------------------------------- +Real GameEngine::getUpdateTime() +{ + return m_updateTime; +} + +//------------------------------------------------------------------------------------------------- +Real GameEngine::getUpdateFps() +{ + return 1.0f / m_updateTime; +} + +//------------------------------------------------------------------------------------------------- +void GameEngine::setLogicTimeScaleFps( Int fps ) +{ + m_logicTimeScaleFPS = fps; +} + +//------------------------------------------------------------------------------------------------- +Int GameEngine::getLogicTimeScaleFps() +{ + return m_logicTimeScaleFPS; +} + +//------------------------------------------------------------------------------------------------- +void GameEngine::enableLogicTimeScale( Bool enable ) +{ + m_enableLogicTimeScale = enable; +} + +//------------------------------------------------------------------------------------------------- +Bool GameEngine::isLogicTimeScaleEnabled() +{ + return m_enableLogicTimeScale; +} + +//------------------------------------------------------------------------------------------------- +Int GameEngine::getActualLogicTimeScaleFps( void ) +{ + if (TheNetwork != NULL) + { + return TheNetwork->getFrameRate(); + } + else + { + const Bool enabled = isLogicTimeScaleEnabled(); + const Int logicTimeScaleFps = getLogicTimeScaleFps(); + const Int maxFps = getFramesPerSecondLimit(); + + if (!enabled || logicTimeScaleFps >= maxFps) + { + return getFramesPerSecondLimit(); + } + else + { + return logicTimeScaleFps; + } + } +} + +//------------------------------------------------------------------------------------------------- +Real GameEngine::getActualLogicTimeScaleRatio() +{ + return (Real)getActualLogicTimeScaleFps() / LOGICFRAMES_PER_SECONDS_REAL; +} + +//------------------------------------------------------------------------------------------------- +Real GameEngine::getActualLogicTimeScaleOverFpsRatio() +{ + // TheSuperHackers @info Clamps ratio to min 1, because the logic + // frame rate is (typically) capped by the render frame rate. + return min(1.0f, (Real)getActualLogicTimeScaleFps() / getUpdateFps()); +} + /** ----------------------------------------------------------------------------------------------- * Initialize the game engine by initializing the GameLogic and GameClient. */ @@ -337,8 +416,6 @@ void GameEngine::init() DEBUG_LOG(("================================================================================")); } - m_maxFPS = DEFAULT_MAX_FPS; - TheSubsystemList = MSGNEW("GameEngineSubsystem") SubsystemInterfaceList; TheSubsystemList->addSubsystem(this); @@ -651,9 +728,46 @@ void GameEngine::update( void ) TheGameLogic->preUpdate(); - if ((TheNetwork == NULL && !TheGameLogic->isGamePaused()) || (TheNetwork && TheNetwork->isFrameDataReady())) + if (TheNetwork != NULL) { - TheGameLogic->UPDATE(); + if (TheNetwork->isFrameDataReady()) + { + TheGameLogic->UPDATE(); + } + } + else + { + if (!TheGameLogic->isGamePaused()) + { + const Bool enabled = isLogicTimeScaleEnabled(); + const Int logicTimeScaleFps = getLogicTimeScaleFps(); + const Int maxRenderFps = getFramesPerSecondLimit(); + +#if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) + Bool useFastMode = TheGlobalData->m_TiVOFastMode; +#else //always allow this cheat key if we're in a replay game. + Bool useFastMode = TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame(); +#endif + + if (useFastMode || !enabled || logicTimeScaleFps >= maxRenderFps) + { + // Logic time scale is uncapped or larger equal Render FPS. Update straight away. + TheGameLogic->UPDATE(); + } + else + { + // TheSuperHackers @tweak xezon 06/08/2025 + // The logic time step is now decoupled from the render update. + const Real targetFrameTime = 1.0f / logicTimeScaleFps; + m_logicTimeAccumulator += min(m_updateTime, targetFrameTime); + + if (m_logicTimeAccumulator >= targetFrameTime) + { + m_logicTimeAccumulator -= targetFrameTime; + TheGameLogic->UPDATE(); + } + } + } } } // end perfGather @@ -740,29 +854,28 @@ void GameEngine::execute( void ) } // perf { - - if (TheTacticalView->getTimeMultiplier()<=1 && !TheScriptEngine->isTimeFast()) { + Bool allowFpsLimit = TheTacticalView->getTimeMultiplier()<=1 && !TheScriptEngine->isTimeFast(); // I'm disabling this in debug because many people need alt-tab capability. If you happen to be // doing performance tuning, please just change this on your local system. -MDC #if defined(RTS_DEBUG) - ::Sleep(1); // give everyone else a tiny time slice. + if (allowFpsLimit) + ::Sleep(1); // give everyone else a tiny time slice. #endif #if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) - if ( ! TheGlobalData->m_TiVOFastMode ) + allowFpsLimit &= !(!TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode); #else //always allow this cheat key if we're in a replay game. - if ( ! (TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame())) + allowFpsLimit &= !(!TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame()); #endif { // TheSuperHackers @bugfix xezon 05/08/2025 Re-implements the frame rate limiter // with higher resolution counters to cap the frame rate more accurately to the desired limit. - if (TheGlobalData->m_useFpsLimit) - { - frameRateLimit->wait(m_maxFPS); - } + allowFpsLimit &= TheGlobalData->m_useFpsLimit; + const UnsignedInt maxFps = allowFpsLimit ? getFramesPerSecondLimit() : RenderFpsPreset::UncappedFpsValue; + m_updateTime = frameRateLimit->wait(maxFps); } } diff --git a/Generals/Code/GameEngine/Source/Common/MessageStream.cpp b/Generals/Code/GameEngine/Source/Common/MessageStream.cpp index d46619fd0dc..2c19ec353d2 100644 --- a/Generals/Code/GameEngine/Source/Common/MessageStream.cpp +++ b/Generals/Code/GameEngine/Source/Common/MessageStream.cpp @@ -346,6 +346,10 @@ const char *GameMessage::getCommandTypeAsString(GameMessage::Type t) CASE_LABEL(MSG_META_HELP) #endif + CASE_LABEL(MSG_META_INCREASE_MAX_RENDER_FPS) + CASE_LABEL(MSG_META_DECREASE_MAX_RENDER_FPS) + CASE_LABEL(MSG_META_INCREASE_LOGIC_TIME_SCALE) + CASE_LABEL(MSG_META_DECREASE_LOGIC_TIME_SCALE) CASE_LABEL(MSG_META_TOGGLE_LOWER_DETAILS) CASE_LABEL(MSG_META_TOGGLE_CONTROL_BAR) CASE_LABEL(MSG_META_BEGIN_PATH_BUILD) diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 26d685497b8..f7246fe90e0 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -32,6 +32,7 @@ #include "Common/AudioAffect.h" #include "Common/ActionManager.h" +#include "Common/FrameRateLimit.h" #include "Common/GameAudio.h" #include "Common/GameEngine.h" #include "Common/GameType.h" @@ -183,6 +184,91 @@ Bool hasThingsInProduction(PlayerType playerType) #endif // defined(RTS_DEBUG) || defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) +bool changeMaxRenderFps(FpsValueChange change) +{ + UnsignedInt maxRenderFps = TheGameEngine->getFramesPerSecondLimit(); + maxRenderFps = RenderFpsPreset::changeFpsValue(maxRenderFps, change); + + TheGameEngine->setFramesPerSecondLimit(maxRenderFps); + TheWritableGlobalData->m_useFpsLimit = (maxRenderFps != RenderFpsPreset::UncappedFpsValue); + + UnicodeString message; + + if (TheWritableGlobalData->m_useFpsLimit) + { + message = TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:SetMaxRenderFps", L"Max Render FPS is %u", maxRenderFps); + } + else + { + message = TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:SetUncappedRenderFps", L"Max Render FPS is uncapped"); + } + + TheInGameUI->messageNoFormat(message); + + return true; +} + +bool changeLogicTimeScale(FpsValueChange change) +{ + if (TheNetwork != NULL) + return false; + + const UnsignedInt maxRenderFps = TheGameEngine->getFramesPerSecondLimit(); + UnsignedInt maxRenderRemainder = LogicTimeScaleFpsPreset::StepFpsValue; + maxRenderRemainder -= maxRenderFps % LogicTimeScaleFpsPreset::StepFpsValue; + maxRenderRemainder %= LogicTimeScaleFpsPreset::StepFpsValue; + + UnsignedInt logicTimeScaleFps = TheGameEngine->getLogicTimeScaleFps(); + // Set the value to the max render fps value plus a bit when time scale is + // disabled. This ensures that the time scale does not re-enable with a + // 'surprise' value. + if (!TheGameEngine->isLogicTimeScaleEnabled()) + { + logicTimeScaleFps = maxRenderFps + maxRenderRemainder; + } + // Ceil the value at the max render fps value plus a bit so that the next fps + // value decrease would undercut the max render fps at the correct step value. + // Example: render fps 72 -> logic value ceiled to 75 -> decreased to 70. + logicTimeScaleFps = min(logicTimeScaleFps, maxRenderFps + maxRenderRemainder); + logicTimeScaleFps = LogicTimeScaleFpsPreset::changeFpsValue(logicTimeScaleFps, change); + + // Set value before potentially disabling it. + if (TheGameEngine->isLogicTimeScaleEnabled()) + { + TheGameEngine->setLogicTimeScaleFps(logicTimeScaleFps); + } + + TheGameEngine->enableLogicTimeScale(logicTimeScaleFps < maxRenderFps); + + // Set value after potentially enabling it. + if (TheGameEngine->isLogicTimeScaleEnabled()) + { + TheGameEngine->setLogicTimeScaleFps(logicTimeScaleFps); + } + + logicTimeScaleFps = TheGameEngine->getLogicTimeScaleFps(); + const UnsignedInt actualLogicTimeScaleFps = TheGameEngine->getActualLogicTimeScaleFps(); + const Real actualLogicTimeScaleRatio = TheGameEngine->getActualLogicTimeScaleRatio(); + + UnicodeString message; + + if (TheGameEngine->isLogicTimeScaleEnabled()) + { + message = TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:SetLogicTimeScaleFps", L"Logic Time Scale FPS is %u (actual %u, ratio %.02f)", + logicTimeScaleFps, actualLogicTimeScaleFps, actualLogicTimeScaleRatio); + } + else + { + message = TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:SetUncappedLogicTimeScaleFps", L"Logic Time Scale FPS is uncapped (actual %u, ratio %.02f)", + actualLogicTimeScaleFps, actualLogicTimeScaleRatio); + } + + TheInGameUI->messageNoFormat(message); + + return true; +} + + static Bool isSystemMessage( const GameMessage *msg ); enum{ DROPPED_MAX_PARTICLE_COUNT = 1000}; @@ -3039,6 +3125,46 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage disp = DESTROY_MESSAGE; break; + //----------------------------------------------------------------------------------------- + case GameMessage::MSG_META_INCREASE_MAX_RENDER_FPS: + { + if (changeMaxRenderFps(FpsValueChange_Increase)) + { + disp = DESTROY_MESSAGE; + } + break; + } + + //----------------------------------------------------------------------------------------- + case GameMessage::MSG_META_DECREASE_MAX_RENDER_FPS: + { + if (changeMaxRenderFps(FpsValueChange_Decrease)) + { + disp = DESTROY_MESSAGE; + } + break; + } + + //----------------------------------------------------------------------------------------- + case GameMessage::MSG_META_INCREASE_LOGIC_TIME_SCALE: + { + if (changeLogicTimeScale(FpsValueChange_Increase)) + { + disp = DESTROY_MESSAGE; + } + break; + } + + //----------------------------------------------------------------------------------------- + case GameMessage::MSG_META_DECREASE_LOGIC_TIME_SCALE: + { + if (changeLogicTimeScale(FpsValueChange_Decrease)) + { + disp = DESTROY_MESSAGE; + } + break; + } + //----------------------------------------------------------------------------------------- case GameMessage::MSG_META_TOGGLE_LOWER_DETAILS: { diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp index e028816c1f5..e83b031cd62 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp @@ -143,6 +143,10 @@ static const LookupListRec GameMessageMetaTypeNames[] = { "PLACE_BEACON", GameMessage::MSG_META_PLACE_BEACON }, { "DELETE_BEACON", GameMessage::MSG_META_REMOVE_BEACON }, { "OPTIONS", GameMessage::MSG_META_OPTIONS }, + { "INCREASE_MAX_RENDER_FPS", GameMessage::MSG_META_INCREASE_MAX_RENDER_FPS }, + { "DECREASE_MAX_RENDER_FPS", GameMessage::MSG_META_DECREASE_MAX_RENDER_FPS }, + { "INCREASE_LOGIC_TIME_SCALE", GameMessage::MSG_META_INCREASE_LOGIC_TIME_SCALE }, + { "DECREASE_LOGIC_TIME_SCALE", GameMessage::MSG_META_DECREASE_LOGIC_TIME_SCALE }, { "TOGGLE_LOWER_DETAILS", GameMessage::MSG_META_TOGGLE_LOWER_DETAILS }, { "TOGGLE_CONTROL_BAR", GameMessage::MSG_META_TOGGLE_CONTROL_BAR }, { "BEGIN_PATH_BUILD", GameMessage::MSG_META_BEGIN_PATH_BUILD }, @@ -660,6 +664,50 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t) // TheSuperHackers @info A default mapping for MSG_META_SELECT_ALL_AIRCRAFT would be useful for Generals // but is not recommended, because it will cause key mapping conflicts with original game languages. + { + // Is useful for Generals and Zero Hour. + MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_INCREASE_MAX_RENDER_FPS); + if (map->m_key == MK_NONE) + { + map->m_key = MK_KPPLUS; + map->m_transition = DOWN; + map->m_modState = CTRL; + map->m_usableIn = COMMANDUSABLE_EVERYWHERE; + } + } + { + // Is useful for Generals and Zero Hour. + MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_DECREASE_MAX_RENDER_FPS); + if (map->m_key == MK_NONE) + { + map->m_key = MK_KPMINUS; + map->m_transition = DOWN; + map->m_modState = CTRL; + map->m_usableIn = COMMANDUSABLE_EVERYWHERE; + } + } + { + // Is useful for Generals and Zero Hour. + MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_INCREASE_LOGIC_TIME_SCALE); + if (map->m_key == MK_NONE) + { + map->m_key = MK_KPPLUS; + map->m_transition = DOWN; + map->m_modState = SHIFT_CTRL; + map->m_usableIn = COMMANDUSABLE_EVERYWHERE; + } + } + { + // Is useful for Generals and Zero Hour. + MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_DECREASE_LOGIC_TIME_SCALE); + if (map->m_key == MK_NONE) + { + map->m_key = MK_KPMINUS; + map->m_transition = DOWN; + map->m_modState = SHIFT_CTRL; + map->m_usableIn = COMMANDUSABLE_EVERYWHERE; + } + } { // Is mostly useful for Generals. MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_TOGGLE_FAST_FORWARD_REPLAY); diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h b/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h index f40732282ac..925126d7a66 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h @@ -71,6 +71,7 @@ // ---------------------------------------------------------------------------------------------- enum { + BaseFps = 30, // The historic base frame rate for this game. This value must never change. LOGICFRAMES_PER_SECOND = 30, MSEC_PER_SECOND = 1000 }; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h b/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h index 02e9c39e4e5..86f524551e1 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h @@ -34,8 +34,6 @@ #include "Common/SubsystemInterface.h" #include "Common/GameType.h" -#define DEFAULT_MAX_FPS 45 - // forward declarations class AudioManager; class GameLogic; @@ -72,8 +70,20 @@ class GameEngine : public SubsystemInterface virtual void execute( void ); /**< The "main loop" of the game engine. It will not return until the game exits. */ - virtual void setFramesPerSecondLimit( Int fps ); ///< Set the maximum rate engine updates are allowed to occur - virtual Int getFramesPerSecondLimit( void ); ///< Get maxFPS. Not inline since it is called from another lib. + + virtual void setFramesPerSecondLimit( Int fps ); ///< Set the max render and engine update fps. + virtual Int getFramesPerSecondLimit( void ); ///< Get the max render and engine update fps. + Real getUpdateTime(); ///< Get the last engine update delta time. + Real getUpdateFps(); ///< Get the last engine update fps. + + virtual void setLogicTimeScaleFps( Int fps ); ///< Set the logic time scale fps and therefore scale the simulation time. Is capped by the max render fps and does not apply to network matches. + virtual Int getLogicTimeScaleFps(); ///< Get the raw logic time scale fps value. + virtual void enableLogicTimeScale( Bool enable ); ///< Enable the logic time scale setup. If disabled, the simulation time scale is bound to the render frame time or network update time. + virtual Bool isLogicTimeScaleEnabled(); ///< Check whether the logic time scale setup is enabled. + Int getActualLogicTimeScaleFps(); ///< Get the real logic time scale fps, depending on the max render fps, network state and enabled state. + Real getActualLogicTimeScaleRatio(); ///< Get the real logic time scale ratio, depending on the max render fps, network state and enabled state. + Real getActualLogicTimeScaleOverFpsRatio(); ///< Get the real logic time scale over render fps ratio, used to scale down steps in render updates to match logic updates. + virtual void setQuitting( Bool quitting ); ///< set quitting status virtual Bool getQuitting(void); ///< is app getting ready to quit. @@ -100,9 +110,15 @@ class GameEngine : public SubsystemInterface virtual ParticleSystemManager* createParticleSystemManager( void ) = 0; virtual AudioManager *createAudioManager( void ) = 0; ///< Factory for Audio Manager - Int m_maxFPS; ///< Maximum frames per second allowed + Int m_maxFPS; ///< Maximum frames per second for rendering + Int m_logicTimeScaleFPS; ///< Maximum frames per second for logic time scale + + Real m_updateTime; ///< Last engine update delta time + Real m_logicTimeAccumulator; ///< Frame time accumulated towards submitting a new logic frame + Bool m_quitting; ///< true when we need to quit the game Bool m_isActive; ///< app has OS focus. + Bool m_enableLogicTimeScale; }; inline void GameEngine::setQuitting( Bool quitting ) { m_quitting = quitting; } diff --git a/GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h b/GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h index e34faf16d20..9bfeee47b3e 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h @@ -241,6 +241,10 @@ class GameMessage : public MemoryPoolObject MSG_META_HELP, ///< bring up help screen #endif + MSG_META_INCREASE_MAX_RENDER_FPS, ///< TheSuperHackers @feature Increase the max render fps + MSG_META_DECREASE_MAX_RENDER_FPS, ///< TheSuperHackers @feature Decrease the max render fps + MSG_META_INCREASE_LOGIC_TIME_SCALE, ///< TheSuperHackers @feature Increase the logic time scale + MSG_META_DECREASE_LOGIC_TIME_SCALE, ///< TheSuperHackers @feature Decrease the logic time scale MSG_META_TOGGLE_LOWER_DETAILS, ///< toggles graphics options to crappy mode instantly MSG_META_TOGGLE_CONTROL_BAR, ///< show/hide controlbar diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h b/GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h index 1d1a19dea34..cb358886ccf 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h @@ -69,6 +69,24 @@ static const LookupListRec CategoryListName[] = // KeyDefType; this is extremely important to maintain! enum MappableKeyType CPP_11(: Int) { + // keypad keys ---------------------------------------------------------------- + MK_KP0 = KEY_KP0, + MK_KP1 = KEY_KP1, + MK_KP2 = KEY_KP2, + MK_KP3 = KEY_KP3, + MK_KP4 = KEY_KP4, + MK_KP5 = KEY_KP5, + MK_KP6 = KEY_KP6, + MK_KP7 = KEY_KP7, + MK_KP8 = KEY_KP8, + MK_KP9 = KEY_KP9, + MK_KPDEL = KEY_KPDEL, + MK_KPSTAR = KEY_KPSTAR, + MK_KPMINUS = KEY_KPMINUS, + MK_KPPLUS = KEY_KPPLUS, + MK_KPENTER = KEY_KPENTER, + MK_KPSLASH = KEY_KPSLASH, + MK_ESC = KEY_ESC, MK_BACKSPACE = KEY_BACKSPACE, MK_ENTER = KEY_ENTER, @@ -122,16 +140,6 @@ enum MappableKeyType CPP_11(: Int) MK_8 = KEY_8, MK_9 = KEY_9, MK_0 = KEY_0, - MK_KP1 = KEY_KP1, - MK_KP2 = KEY_KP2, - MK_KP3 = KEY_KP3, - MK_KP4 = KEY_KP4, - MK_KP5 = KEY_KP5, - MK_KP6 = KEY_KP6, - MK_KP7 = KEY_KP7, - MK_KP8 = KEY_KP8, - MK_KP9 = KEY_KP9, - MK_KP0 = KEY_KP0, MK_MINUS = KEY_MINUS, MK_EQUAL = KEY_EQUAL, MK_LBRACKET = KEY_LBRACKET, @@ -153,13 +161,30 @@ enum MappableKeyType CPP_11(: Int) MK_PGDN = KEY_PGDN, MK_INS = KEY_INS, MK_DEL = KEY_DEL, - MK_KPSLASH = KEY_KPSLASH, MK_NONE = KEY_NONE }; static const LookupListRec KeyNames[] = { + // keypad keys ---------------------------------------------------------------- + { "KEY_KP0", MK_KP0 }, + { "KEY_KP1", MK_KP1 }, + { "KEY_KP2", MK_KP2 }, + { "KEY_KP3", MK_KP3 }, + { "KEY_KP4", MK_KP4 }, + { "KEY_KP5", MK_KP5 }, + { "KEY_KP6", MK_KP6 }, + { "KEY_KP7", MK_KP7 }, + { "KEY_KP8", MK_KP8 }, + { "KEY_KP9", MK_KP9 }, + { "KEY_KPDEL", MK_KPDEL }, + { "KEY_KPSTAR", MK_KPSTAR }, + { "KEY_KPMINUS", MK_KPMINUS }, + { "KEY_KPPLUS", MK_KPPLUS }, + { "KEY_KPENTER", MK_KPENTER }, + { "KEY_KPSLASH", MK_KPSLASH }, + { "KEY_ESC", MK_ESC }, { "KEY_BACKSPACE", MK_BACKSPACE }, { "KEY_ENTER", MK_ENTER }, @@ -213,16 +238,6 @@ static const LookupListRec KeyNames[] = { "KEY_8", MK_8 }, { "KEY_9", MK_9 }, { "KEY_0", MK_0 }, - { "KEY_KP1", MK_KP1 }, - { "KEY_KP2", MK_KP2 }, - { "KEY_KP3", MK_KP3 }, - { "KEY_KP4", MK_KP4 }, - { "KEY_KP5", MK_KP5 }, - { "KEY_KP6", MK_KP6 }, - { "KEY_KP7", MK_KP7 }, - { "KEY_KP8", MK_KP8 }, - { "KEY_KP9", MK_KP9 }, - { "KEY_KP0", MK_KP0 }, { "KEY_MINUS", MK_MINUS }, { "KEY_EQUAL", MK_EQUAL }, { "KEY_LBRACKET", MK_LBRACKET }, @@ -244,7 +259,6 @@ static const LookupListRec KeyNames[] = { "KEY_PGDN", MK_PGDN }, { "KEY_INS", MK_INS }, { "KEY_DEL", MK_DEL }, - { "KEY_KPSLASH", MK_KPSLASH }, { "KEY_NONE", MK_NONE }, { NULL, 0 } // keep this last! }; @@ -301,7 +315,9 @@ enum CommandUsableInType CPP_11(: Int) COMMANDUSABLE_NONE = 0, COMMANDUSABLE_SHELL = (1 << 0), - COMMANDUSABLE_GAME = (1 << 1) + COMMANDUSABLE_GAME = (1 << 1), + + COMMANDUSABLE_EVERYWHERE = COMMANDUSABLE_SHELL | COMMANDUSABLE_GAME, }; static const char* TheCommandUsableInNames[] = diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp index 2dfbc32ff13..96957a10964 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp @@ -240,12 +240,6 @@ static void updateWindowTitle() } } -//------------------------------------------------------------------------------------------------- -Int GameEngine::getFramesPerSecondLimit( void ) -{ - return m_maxFPS; -} - //------------------------------------------------------------------------------------------------- GameEngine::GameEngine( void ) { @@ -253,9 +247,13 @@ GameEngine::GameEngine( void ) timeBeginPeriod(1); // initialize to non garbage values - m_maxFPS = 0; + m_maxFPS = BaseFps; + m_logicTimeScaleFPS = LOGICFRAMES_PER_SECOND; + m_updateTime = 0.0f; + m_logicTimeAccumulator = 0.0f; m_quitting = FALSE; m_isActive = FALSE; + m_enableLogicTimeScale = FALSE; _Module.Init(NULL, ApplicationHInstance, NULL); } @@ -309,12 +307,93 @@ GameEngine::~GameEngine() timeEndPeriod(1); } +//------------------------------------------------------------------------------------------------- void GameEngine::setFramesPerSecondLimit( Int fps ) { DEBUG_LOG(("GameEngine::setFramesPerSecondLimit() - setting max fps to %d (TheGlobalData->m_useFpsLimit == %d)", fps, TheGlobalData->m_useFpsLimit)); m_maxFPS = fps; } +//------------------------------------------------------------------------------------------------- +Int GameEngine::getFramesPerSecondLimit( void ) +{ + return m_maxFPS; +} + +//------------------------------------------------------------------------------------------------- +Real GameEngine::getUpdateTime() +{ + return m_updateTime; +} + +//------------------------------------------------------------------------------------------------- +Real GameEngine::getUpdateFps() +{ + return 1.0f / m_updateTime; +} + +//------------------------------------------------------------------------------------------------- +void GameEngine::setLogicTimeScaleFps( Int fps ) +{ + m_logicTimeScaleFPS = fps; +} + +//------------------------------------------------------------------------------------------------- +Int GameEngine::getLogicTimeScaleFps() +{ + return m_logicTimeScaleFPS; +} + +//------------------------------------------------------------------------------------------------- +void GameEngine::enableLogicTimeScale( Bool enable ) +{ + m_enableLogicTimeScale = enable; +} + +//------------------------------------------------------------------------------------------------- +Bool GameEngine::isLogicTimeScaleEnabled() +{ + return m_enableLogicTimeScale; +} + +//------------------------------------------------------------------------------------------------- +Int GameEngine::getActualLogicTimeScaleFps( void ) +{ + if (TheNetwork != NULL) + { + return TheNetwork->getFrameRate(); + } + else + { + const Bool enabled = isLogicTimeScaleEnabled(); + const Int logicTimeScaleFps = getLogicTimeScaleFps(); + const Int maxFps = getFramesPerSecondLimit(); + + if (!enabled || logicTimeScaleFps >= maxFps) + { + return getFramesPerSecondLimit(); + } + else + { + return logicTimeScaleFps; + } + } +} + +//------------------------------------------------------------------------------------------------- +Real GameEngine::getActualLogicTimeScaleRatio() +{ + return (Real)getActualLogicTimeScaleFps() / LOGICFRAMES_PER_SECONDS_REAL; +} + +//------------------------------------------------------------------------------------------------- +Real GameEngine::getActualLogicTimeScaleOverFpsRatio() +{ + // TheSuperHackers @info Clamps ratio to min 1, because the logic + // frame rate is (typically) capped by the render frame rate. + return min(1.0f, (Real)getActualLogicTimeScaleFps() / getUpdateFps()); +} + /** ----------------------------------------------------------------------------------------------- * Initialize the game engine by initializing the GameLogic and GameClient. */ @@ -359,7 +438,6 @@ void GameEngine::init() char Buf[256];////////////////////////////////////////////////////////////////////// #endif////////////////////////////////////////////////////////////////////////////// - m_maxFPS = DEFAULT_MAX_FPS; TheSubsystemList = MSGNEW("GameEngineSubsystem") SubsystemInterfaceList; @@ -825,9 +903,46 @@ void GameEngine::update( void ) TheGameLogic->preUpdate(); - if ((TheNetwork == NULL && !TheGameLogic->isGamePaused()) || (TheNetwork && TheNetwork->isFrameDataReady())) + if (TheNetwork != NULL) + { + if (TheNetwork->isFrameDataReady()) + { + TheGameLogic->UPDATE(); + } + } + else { - TheGameLogic->UPDATE(); + if (!TheGameLogic->isGamePaused()) + { + const Bool enabled = isLogicTimeScaleEnabled(); + const Int logicTimeScaleFps = getLogicTimeScaleFps(); + const Int maxRenderFps = getFramesPerSecondLimit(); + +#if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) + Bool useFastMode = TheGlobalData->m_TiVOFastMode; +#else //always allow this cheat key if we're in a replay game. + Bool useFastMode = TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame(); +#endif + + if (useFastMode || !enabled || logicTimeScaleFps >= maxRenderFps) + { + // Logic time scale is uncapped or larger equal Render FPS. Update straight away. + TheGameLogic->UPDATE(); + } + else + { + // TheSuperHackers @tweak xezon 06/08/2025 + // The logic time step is now decoupled from the render update. + const Real targetFrameTime = 1.0f / logicTimeScaleFps; + m_logicTimeAccumulator += min(m_updateTime, targetFrameTime); + + if (m_logicTimeAccumulator >= targetFrameTime) + { + m_logicTimeAccumulator -= targetFrameTime; + TheGameLogic->UPDATE(); + } + } + } } } // end perfGather @@ -914,29 +1029,28 @@ void GameEngine::execute( void ) } // perf { - - if (TheTacticalView->getTimeMultiplier()<=1 && !TheScriptEngine->isTimeFast()) { + Bool allowFpsLimit = TheTacticalView->getTimeMultiplier()<=1 && !TheScriptEngine->isTimeFast(); // I'm disabling this in debug because many people need alt-tab capability. If you happen to be // doing performance tuning, please just change this on your local system. -MDC #if defined(RTS_DEBUG) - ::Sleep(1); // give everyone else a tiny time slice. + if (allowFpsLimit) + ::Sleep(1); // give everyone else a tiny time slice. #endif #if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) - if ( ! TheGlobalData->m_TiVOFastMode ) + allowFpsLimit &= !(!TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode); #else //always allow this cheat key if we're in a replay game. - if ( ! (TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame())) + allowFpsLimit &= !(!TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame()); #endif { // TheSuperHackers @bugfix xezon 05/08/2025 Re-implements the frame rate limiter // with higher resolution counters to cap the frame rate more accurately to the desired limit. - if (TheGlobalData->m_useFpsLimit) - { - frameRateLimit->wait(m_maxFPS); - } + allowFpsLimit &= TheGlobalData->m_useFpsLimit; + const UnsignedInt maxFps = allowFpsLimit ? getFramesPerSecondLimit() : RenderFpsPreset::UncappedFpsValue; + m_updateTime = frameRateLimit->wait(maxFps); } } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp b/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp index 3c1f04476f3..d7b59709587 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp @@ -346,6 +346,10 @@ const char *GameMessage::getCommandTypeAsString(GameMessage::Type t) CASE_LABEL(MSG_META_HELP) #endif + CASE_LABEL(MSG_META_INCREASE_MAX_RENDER_FPS) + CASE_LABEL(MSG_META_DECREASE_MAX_RENDER_FPS) + CASE_LABEL(MSG_META_INCREASE_LOGIC_TIME_SCALE) + CASE_LABEL(MSG_META_DECREASE_LOGIC_TIME_SCALE) CASE_LABEL(MSG_META_TOGGLE_LOWER_DETAILS) CASE_LABEL(MSG_META_TOGGLE_CONTROL_BAR) CASE_LABEL(MSG_META_BEGIN_PATH_BUILD) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 5feb8e0c449..70aaeabe0ed 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -32,6 +32,7 @@ #include "Common/AudioAffect.h" #include "Common/ActionManager.h" +#include "Common/FrameRateLimit.h" #include "Common/GameAudio.h" #include "Common/GameEngine.h" #include "Common/GameType.h" @@ -187,6 +188,91 @@ Bool hasThingsInProduction(PlayerType playerType) #endif // defined(RTS_DEBUG) || defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) +bool changeMaxRenderFps(FpsValueChange change) +{ + UnsignedInt maxRenderFps = TheGameEngine->getFramesPerSecondLimit(); + maxRenderFps = RenderFpsPreset::changeFpsValue(maxRenderFps, change); + + TheGameEngine->setFramesPerSecondLimit(maxRenderFps); + TheWritableGlobalData->m_useFpsLimit = (maxRenderFps != RenderFpsPreset::UncappedFpsValue); + + UnicodeString message; + + if (TheWritableGlobalData->m_useFpsLimit) + { + message = TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:SetMaxRenderFps", L"Max Render FPS is %u", maxRenderFps); + } + else + { + message = TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:SetUncappedRenderFps", L"Max Render FPS is uncapped"); + } + + TheInGameUI->messageNoFormat(message); + + return true; +} + +bool changeLogicTimeScale(FpsValueChange change) +{ + if (TheNetwork != NULL) + return false; + + const UnsignedInt maxRenderFps = TheGameEngine->getFramesPerSecondLimit(); + UnsignedInt maxRenderRemainder = LogicTimeScaleFpsPreset::StepFpsValue; + maxRenderRemainder -= maxRenderFps % LogicTimeScaleFpsPreset::StepFpsValue; + maxRenderRemainder %= LogicTimeScaleFpsPreset::StepFpsValue; + + UnsignedInt logicTimeScaleFps = TheGameEngine->getLogicTimeScaleFps(); + // Set the value to the max render fps value plus a bit when time scale is + // disabled. This ensures that the time scale does not re-enable with a + // 'surprise' value. + if (!TheGameEngine->isLogicTimeScaleEnabled()) + { + logicTimeScaleFps = maxRenderFps + maxRenderRemainder; + } + // Ceil the value at the max render fps value plus a bit so that the next fps + // value decrease would undercut the max render fps at the correct step value. + // Example: render fps 72 -> logic value ceiled to 75 -> decreased to 70. + logicTimeScaleFps = min(logicTimeScaleFps, maxRenderFps + maxRenderRemainder); + logicTimeScaleFps = LogicTimeScaleFpsPreset::changeFpsValue(logicTimeScaleFps, change); + + // Set value before potentially disabling it. + if (TheGameEngine->isLogicTimeScaleEnabled()) + { + TheGameEngine->setLogicTimeScaleFps(logicTimeScaleFps); + } + + TheGameEngine->enableLogicTimeScale(logicTimeScaleFps < maxRenderFps); + + // Set value after potentially enabling it. + if (TheGameEngine->isLogicTimeScaleEnabled()) + { + TheGameEngine->setLogicTimeScaleFps(logicTimeScaleFps); + } + + logicTimeScaleFps = TheGameEngine->getLogicTimeScaleFps(); + const UnsignedInt actualLogicTimeScaleFps = TheGameEngine->getActualLogicTimeScaleFps(); + const Real actualLogicTimeScaleRatio = TheGameEngine->getActualLogicTimeScaleRatio(); + + UnicodeString message; + + if (TheGameEngine->isLogicTimeScaleEnabled()) + { + message = TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:SetLogicTimeScaleFps", L"Logic Time Scale FPS is %u (actual %u, ratio %.02f)", + logicTimeScaleFps, actualLogicTimeScaleFps, actualLogicTimeScaleRatio); + } + else + { + message = TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:SetUncappedLogicTimeScaleFps", L"Logic Time Scale FPS is uncapped (actual %u, ratio %.02f)", + actualLogicTimeScaleFps, actualLogicTimeScaleRatio); + } + + TheInGameUI->messageNoFormat(message); + + return true; +} + + static Bool isSystemMessage( const GameMessage *msg ); enum{ DROPPED_MAX_PARTICLE_COUNT = 1000}; @@ -3185,6 +3271,46 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage disp = DESTROY_MESSAGE; break; + //----------------------------------------------------------------------------------------- + case GameMessage::MSG_META_INCREASE_MAX_RENDER_FPS: + { + if (changeMaxRenderFps(FpsValueChange_Increase)) + { + disp = DESTROY_MESSAGE; + } + break; + } + + //----------------------------------------------------------------------------------------- + case GameMessage::MSG_META_DECREASE_MAX_RENDER_FPS: + { + if (changeMaxRenderFps(FpsValueChange_Decrease)) + { + disp = DESTROY_MESSAGE; + } + break; + } + + //----------------------------------------------------------------------------------------- + case GameMessage::MSG_META_INCREASE_LOGIC_TIME_SCALE: + { + if (changeLogicTimeScale(FpsValueChange_Increase)) + { + disp = DESTROY_MESSAGE; + } + break; + } + + //----------------------------------------------------------------------------------------- + case GameMessage::MSG_META_DECREASE_LOGIC_TIME_SCALE: + { + if (changeLogicTimeScale(FpsValueChange_Decrease)) + { + disp = DESTROY_MESSAGE; + } + break; + } + //----------------------------------------------------------------------------------------- case GameMessage::MSG_META_TOGGLE_LOWER_DETAILS: { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp index e8d15503a62..7b854dece5a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp @@ -151,6 +151,10 @@ static const LookupListRec GameMessageMetaTypeNames[] = { "PLACE_BEACON", GameMessage::MSG_META_PLACE_BEACON }, { "DELETE_BEACON", GameMessage::MSG_META_REMOVE_BEACON }, { "OPTIONS", GameMessage::MSG_META_OPTIONS }, + { "INCREASE_MAX_RENDER_FPS", GameMessage::MSG_META_INCREASE_MAX_RENDER_FPS }, + { "DECREASE_MAX_RENDER_FPS", GameMessage::MSG_META_DECREASE_MAX_RENDER_FPS }, + { "INCREASE_LOGIC_TIME_SCALE", GameMessage::MSG_META_INCREASE_LOGIC_TIME_SCALE }, + { "DECREASE_LOGIC_TIME_SCALE", GameMessage::MSG_META_DECREASE_LOGIC_TIME_SCALE }, { "TOGGLE_LOWER_DETAILS", GameMessage::MSG_META_TOGGLE_LOWER_DETAILS }, { "TOGGLE_CONTROL_BAR", GameMessage::MSG_META_TOGGLE_CONTROL_BAR }, { "BEGIN_PATH_BUILD", GameMessage::MSG_META_BEGIN_PATH_BUILD }, @@ -722,6 +726,50 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t) // TheSuperHackers @info A default mapping for MSG_META_SELECT_ALL_AIRCRAFT would be useful for Generals // but is not recommended, because it will cause key mapping conflicts with original game languages. + { + // Is useful for Generals and Zero Hour. + MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_INCREASE_MAX_RENDER_FPS); + if (map->m_key == MK_NONE) + { + map->m_key = MK_KPPLUS; + map->m_transition = DOWN; + map->m_modState = CTRL; + map->m_usableIn = COMMANDUSABLE_EVERYWHERE; + } + } + { + // Is useful for Generals and Zero Hour. + MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_DECREASE_MAX_RENDER_FPS); + if (map->m_key == MK_NONE) + { + map->m_key = MK_KPMINUS; + map->m_transition = DOWN; + map->m_modState = CTRL; + map->m_usableIn = COMMANDUSABLE_EVERYWHERE; + } + } + { + // Is useful for Generals and Zero Hour. + MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_INCREASE_LOGIC_TIME_SCALE); + if (map->m_key == MK_NONE) + { + map->m_key = MK_KPPLUS; + map->m_transition = DOWN; + map->m_modState = SHIFT_CTRL; + map->m_usableIn = COMMANDUSABLE_EVERYWHERE; + } + } + { + // Is useful for Generals and Zero Hour. + MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_DECREASE_LOGIC_TIME_SCALE); + if (map->m_key == MK_NONE) + { + map->m_key = MK_KPMINUS; + map->m_transition = DOWN; + map->m_modState = SHIFT_CTRL; + map->m_usableIn = COMMANDUSABLE_EVERYWHERE; + } + } { // Is mostly useful for Generals. MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_TOGGLE_FAST_FORWARD_REPLAY); From 2d9093aaecc93d3cbfd159baceec496443562e4b Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 12 Aug 2025 20:19:32 +0200 Subject: [PATCH 017/343] tweak(fps): Decouple WW3D::Sync from render update (#1451) --- .../GameEngine/Include/GameClient/Display.h | 1 + .../Include/GameClient/GameClient.h | 2 + .../GameEngine/Source/Common/GameEngine.cpp | 4 +- .../Source/GameClient/GameClient.cpp | 5 ++ .../Include/W3DDevice/GameClient/W3DDisplay.h | 2 + .../W3DDevice/GameClient/W3DDisplay.cpp | 78 ++++++++++++------ .../GameEngine/Include/GameClient/Display.h | 1 + .../Include/GameClient/GameClient.h | 2 + .../GameEngine/Source/Common/GameEngine.cpp | 4 +- .../Source/GameClient/GameClient.cpp | 5 ++ .../Include/W3DDevice/GameClient/W3DDisplay.h | 2 + .../W3DDevice/GameClient/W3DDisplay.cpp | 82 ++++++++++++------- 12 files changed, 130 insertions(+), 58 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/Display.h b/Generals/Code/GameEngine/Include/GameClient/Display.h index 93f82c48558..3e93f74df46 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Display.h +++ b/Generals/Code/GameEngine/Include/GameClient/Display.h @@ -118,6 +118,7 @@ class Display : public SubsystemInterface virtual Bool isClippingEnabled( void ) = 0; virtual void enableClipping( Bool onoff ) = 0; + virtual void step() {}; ///< Do one fixed time step virtual void draw( void ); ///< Redraw the entire display virtual void setTimeOfDay( TimeOfDay tod ) = 0; ///< Set the time of day for this display virtual void createLightPulse( const Coord3D *pos, const RGBColor *color, Real innerRadius,Real attenuationWidth, diff --git a/Generals/Code/GameEngine/Include/GameClient/GameClient.h b/Generals/Code/GameEngine/Include/GameClient/GameClient.h index 159d1ec18fa..c6ae2ae8396 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GameClient.h +++ b/Generals/Code/GameEngine/Include/GameClient/GameClient.h @@ -95,6 +95,8 @@ class GameClient : public SubsystemInterface, virtual void setFrame( UnsignedInt frame ) { m_frame = frame; } ///< Set the GameClient's internal frame number virtual void registerDrawable( Drawable *draw ); ///< Given a drawable, register it with the GameClient and give it a unique ID + void step(); ///< Do one fixed time step + void updateHeadless(); void addDrawableToLookupTable( Drawable *draw ); ///< add drawable ID to hash lookup table diff --git a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp index f083ec016dd..68e07ee8076 100644 --- a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp @@ -85,7 +85,6 @@ #include "GameLogic/SidesList.h" #include "GameClient/ClientInstance.h" -#include "GameClient/Display.h" #include "GameClient/FXList.h" #include "GameClient/GameClient.h" #include "GameClient/Keyboard.h" @@ -732,6 +731,7 @@ void GameEngine::update( void ) { if (TheNetwork->isFrameDataReady()) { + TheGameClient->step(); TheGameLogic->UPDATE(); } } @@ -752,6 +752,7 @@ void GameEngine::update( void ) if (useFastMode || !enabled || logicTimeScaleFps >= maxRenderFps) { // Logic time scale is uncapped or larger equal Render FPS. Update straight away. + TheGameClient->step(); TheGameLogic->UPDATE(); } else @@ -764,6 +765,7 @@ void GameEngine::update( void ) if (m_logicTimeAccumulator >= targetFrameTime) { m_logicTimeAccumulator -= targetFrameTime; + TheGameClient->step(); TheGameLogic->UPDATE(); } } diff --git a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp index 28071893e02..27c6e63c331 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -735,6 +735,11 @@ void GameClient::update( void ) } } // end update +void GameClient::step() +{ + TheDisplay->step(); +} + void GameClient::updateHeadless() { // TheSuperHackers @info helmutbuhler 03/05/2025 diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h index 4f63ff2c258..3e8ff91d767 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h @@ -81,6 +81,7 @@ class W3DDisplay : public Display virtual Bool isClippingEnabled( void ) { return m_isClippedEnabled; } virtual void enableClipping( Bool onoff ) { m_isClippedEnabled = onoff; } + virtual void step(); ///< Do one fixed time step virtual void draw( void ); ///< redraw the entire display /// @todo Replace these light management routines with a LightManager singleton @@ -161,6 +162,7 @@ class W3DDisplay : public Display void calculateTerrainLOD(void); ///< Calculate terrain LOD. void renderLetterBox(UnsignedInt time); ///< draw letter box border void updateAverageFPS(void); ///< figure out the average fps over the last 30 frames. + static Bool isTimeFrozen(); Byte m_initialized; ///< TRUE when system is initialized LightClass *m_myLight[LightEnvironmentClass::MAX_LIGHTS]; ///< light hack for now diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 3d3d237e060..c1c0c7edc76 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -1606,6 +1606,53 @@ Int W3DDisplay::getLastFrameDrawCalls() return Debug_Statistics::Get_Draw_Calls(); } +Bool W3DDisplay::isTimeFrozen() +{ + if (TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished()) + return true; + + if (TheScriptEngine->isTimeFrozenDebug()) + return true; + + if (TheScriptEngine->isTimeFrozenScript()) + return true; + + if (TheGameLogic->isGamePaused()) + return true; + + return false; +} + +// TheSuperHackers @tweak xezon 12/08/2025 The WW3D Sync is no longer tied +// to the render update, but is advanced separately for every fixed time step. +void W3DDisplay::step() +{ + // TheSuperHackers @info This will wrap in 1205 hours at 30 fps logic step. + static UnsignedInt syncTime = 0; + + extern HWND ApplicationHWnd; + if (ApplicationHWnd && ::IsIconic(ApplicationHWnd)) { + return; + } + + if (TheGlobalData->m_headless) + return; + + Bool freezeTime = isTimeFrozen(); + + if (!freezeTime) + { + syncTime += (UnsignedInt)TheW3DFrameLengthInMsec; + + if (TheScriptEngine->isTimeFast()) + { + return; + } + } + + WW3D::Sync( syncTime ); +} + //DECLARE_PERF_TIMER(BigAssRenderLoop) // W3DDisplay::draw =========================================================== @@ -1615,7 +1662,6 @@ Int W3DDisplay::getLastFrameDrawCalls() void W3DDisplay::draw( void ) { //USE_PERF_TIMER(W3DDisplay_draw) - static UnsignedInt syncTime = 0; extern HWND ApplicationHWnd; if (ApplicationHWnd && ::IsIconic(ApplicationHWnd)) { @@ -1690,21 +1736,19 @@ void W3DDisplay::draw( void ) // //PredictiveLODOptimizerClass::Optimize_LODs( 5000 ); - Bool freezeTime = TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished(); - freezeTime = freezeTime || TheScriptEngine->isTimeFrozenDebug() || TheScriptEngine->isTimeFrozenScript(); - freezeTime = freezeTime || TheGameLogic->isGamePaused(); + Bool freezeTime = isTimeFrozen(); // hack to let client spin fast in network games but still do effects at the same pace. -MDC static UnsignedInt lastFrame = ~0; - freezeTime = freezeTime || (lastFrame == TheGameClient->getFrame()); + freezeTime = freezeTime || (TheNetwork != NULL && lastFrame == TheGameClient->getFrame()); lastFrame = TheGameClient->getFrame(); /// @todo: I'm assuming the first view is our main 3D view. W3DView *primaryW3DView=(W3DView *)getFirstView(); + if (!freezeTime && TheScriptEngine->isTimeFast()) { primaryW3DView->updateCameraMovements(); // Update camera motion effects. - syncTime += TheW3DFrameLengthInMsec; return; } @@ -1733,21 +1777,9 @@ void W3DDisplay::draw( void ) } } - if (!freezeTime) - { - /// @todo Decouple framerate from timestep - // for now, use constant time steps to avoid animations running independent of framerate - syncTime += TheW3DFrameLengthInMsec; - // allow W3D to update its internals - // WW3D::Sync( GetTickCount() ); - } - WW3D::Sync( syncTime ); - - // Fast & Frozen time limits the time to 33 fps. - Int minTime = 30; - static Int prevTime = timeGetTime(), now; - + static Int now; now=timeGetTime(); + if (TheTacticalView->getTimeMultiplier()>1) { static Int timeMultiplierCounter = 1; @@ -1757,12 +1789,6 @@ void W3DDisplay::draw( void ) timeMultiplierCounter = TheTacticalView->getTimeMultiplier(); // limit the framerate, because while fast time is on, the game logic is running as fast as it can. } - else - { - now = timeGetTime(); - prevTime = now - minTime; // do the first frame immediately. - } - do { diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h index 3fcc01a0780..a4f09bdc07b 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h @@ -118,6 +118,7 @@ class Display : public SubsystemInterface virtual Bool isClippingEnabled( void ) = 0; virtual void enableClipping( Bool onoff ) = 0; + virtual void step() {}; ///< Do one fixed time step virtual void draw( void ); ///< Redraw the entire display virtual void setTimeOfDay( TimeOfDay tod ) = 0; ///< Set the time of day for this display virtual void createLightPulse( const Coord3D *pos, const RGBColor *color, Real innerRadius,Real attenuationWidth, diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h index 72248a9e04f..634b78545a3 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h @@ -99,6 +99,8 @@ class GameClient : public SubsystemInterface, virtual void setFrame( UnsignedInt frame ) { m_frame = frame; } ///< Set the GameClient's internal frame number virtual void registerDrawable( Drawable *draw ); ///< Given a drawable, register it with the GameClient and give it a unique ID + void step(); ///< Do one fixed time step + void updateHeadless(); void addDrawableToLookupTable( Drawable *draw ); ///< add drawable ID to hash lookup table diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp index 96957a10964..912fd8beebd 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp @@ -87,7 +87,6 @@ #include "GameLogic/SidesList.h" #include "GameClient/ClientInstance.h" -#include "GameClient/Display.h" #include "GameClient/FXList.h" #include "GameClient/GameClient.h" #include "GameClient/Keyboard.h" @@ -907,6 +906,7 @@ void GameEngine::update( void ) { if (TheNetwork->isFrameDataReady()) { + TheGameClient->step(); TheGameLogic->UPDATE(); } } @@ -927,6 +927,7 @@ void GameEngine::update( void ) if (useFastMode || !enabled || logicTimeScaleFps >= maxRenderFps) { // Logic time scale is uncapped or larger equal Render FPS. Update straight away. + TheGameClient->step(); TheGameLogic->UPDATE(); } else @@ -939,6 +940,7 @@ void GameEngine::update( void ) if (m_logicTimeAccumulator >= targetFrameTime) { m_logicTimeAccumulator -= targetFrameTime; + TheGameClient->step(); TheGameLogic->UPDATE(); } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp index 0448be6d799..76228beb566 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -773,6 +773,11 @@ void GameClient::update( void ) } } // end update +void GameClient::step() +{ + TheDisplay->step(); +} + void GameClient::updateHeadless() { // TheSuperHackers @info helmutbuhler 03/05/2025 diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h index 18539a53e2f..80c07119dae 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h @@ -81,6 +81,7 @@ class W3DDisplay : public Display virtual Bool isClippingEnabled( void ) { return m_isClippedEnabled; } virtual void enableClipping( Bool onoff ) { m_isClippedEnabled = onoff; } + virtual void step(); ///< Do one fixed time step virtual void draw( void ); ///< redraw the entire display /// @todo Replace these light management routines with a LightManager singleton @@ -162,6 +163,7 @@ class W3DDisplay : public Display void calculateTerrainLOD(void); ///< Calculate terrain LOD. void renderLetterBox(UnsignedInt time); ///< draw letter box border void updateAverageFPS(void); ///< figure out the average fps over the last 30 frames. + static Bool isTimeFrozen(); Byte m_initialized; ///< TRUE when system is initialized LightClass *m_myLight[LightEnvironmentClass::MAX_LIGHTS]; ///< light hack for now diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 4846c419fed..0a9ea52fadb 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -1677,6 +1677,53 @@ Int W3DDisplay::getLastFrameDrawCalls() return Debug_Statistics::Get_Draw_Calls(); } +Bool W3DDisplay::isTimeFrozen() +{ + if (TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished()) + return true; + + if (TheScriptEngine->isTimeFrozenDebug()) + return true; + + if (TheScriptEngine->isTimeFrozenScript()) + return true; + + if (TheGameLogic->isGamePaused()) + return true; + + return false; +} + +// TheSuperHackers @tweak xezon 12/08/2025 The WW3D Sync is no longer tied +// to the render update, but is advanced separately for every fixed time step. +void W3DDisplay::step() +{ + // TheSuperHackers @info This will wrap in 1205 hours at 30 fps logic step. + static UnsignedInt syncTime = 0; + + extern HWND ApplicationHWnd; + if (ApplicationHWnd && ::IsIconic(ApplicationHWnd)) { + return; + } + + if (TheGlobalData->m_headless) + return; + + Bool freezeTime = isTimeFrozen(); + + if (!freezeTime) + { + syncTime += (UnsignedInt)TheW3DFrameLengthInMsec; + + if (TheScriptEngine->isTimeFast()) + { + return; + } + } + + WW3D::Sync( syncTime ); +} + //DECLARE_PERF_TIMER(BigAssRenderLoop) // W3DDisplay::draw =========================================================== @@ -1686,7 +1733,6 @@ Int W3DDisplay::getLastFrameDrawCalls() void W3DDisplay::draw( void ) { //USE_PERF_TIMER(W3DDisplay_draw) - static UnsignedInt syncTime = 0; extern HWND ApplicationHWnd; if (ApplicationHWnd && ::IsIconic(ApplicationHWnd)) { @@ -1731,10 +1777,6 @@ void W3DDisplay::draw( void ) TheInGameUI->message( UnicodeString( L"-stats is running, at interval: %d." ), TheGlobalData->m_statsInterval ); } } - - - - #endif // compute debug statistics for display later @@ -1775,21 +1817,19 @@ void W3DDisplay::draw( void ) // //PredictiveLODOptimizerClass::Optimize_LODs( 5000 ); - Bool freezeTime = TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished(); - freezeTime = freezeTime || TheScriptEngine->isTimeFrozenDebug() || TheScriptEngine->isTimeFrozenScript(); - freezeTime = freezeTime || TheGameLogic->isGamePaused(); + Bool freezeTime = isTimeFrozen(); // hack to let client spin fast in network games but still do effects at the same pace. -MDC static UnsignedInt lastFrame = ~0; - freezeTime = freezeTime || (lastFrame == TheGameClient->getFrame()); + freezeTime = freezeTime || (TheNetwork != NULL && lastFrame == TheGameClient->getFrame()); lastFrame = TheGameClient->getFrame(); /// @todo: I'm assuming the first view is our main 3D view. W3DView *primaryW3DView=(W3DView *)getFirstView(); + if (!freezeTime && TheScriptEngine->isTimeFast()) { primaryW3DView->updateCameraMovements(); // Update camera motion effects. - syncTime += TheW3DFrameLengthInMsec; return; } @@ -1818,21 +1858,9 @@ void W3DDisplay::draw( void ) } } - if (!freezeTime) - { - /// @todo Decouple framerate from timestep - // for now, use constant time steps to avoid animations running independent of framerate - syncTime += TheW3DFrameLengthInMsec; - // allow W3D to update its internals - // WW3D::Sync( GetTickCount() ); - } - WW3D::Sync( syncTime ); - - // Fast & Frozen time limits the time to 33 fps. - Int minTime = 30; - static Int prevTime = timeGetTime(), now; - + static Int now; now=timeGetTime(); + if (TheTacticalView->getTimeMultiplier()>1) { static Int timeMultiplierCounter = 1; @@ -1842,12 +1870,6 @@ void W3DDisplay::draw( void ) timeMultiplierCounter = TheTacticalView->getTimeMultiplier(); // limit the framerate, because while fast time is on, the game logic is running as fast as it can. } - else - { - now = timeGetTime(); - prevTime = now - minTime; // do the first frame immediately. - } - do { From 0eb08e2d45572e598d57d8581c4eb607a6700d2a Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 12 Aug 2025 22:01:37 +0200 Subject: [PATCH 018/343] tweak(fps): Decouple scripted camera movement time step from render update (#1451) --- .../Include/W3DDevice/GameClient/W3DView.h | 8 ++++---- .../Source/W3DDevice/GameClient/W3DView.cpp | 9 ++++++--- .../Include/W3DDevice/GameClient/W3DView.h | 8 ++++---- .../Source/W3DDevice/GameClient/W3DView.cpp | 9 ++++++--- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h index 5cf7d184744..9c1219fecd2 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h @@ -62,8 +62,8 @@ typedef struct Real cameraZoom[MAX_WAYPOINTS+2]; // Camera Zoom; Int timeMultiplier[MAX_WAYPOINTS+2]; // Time speedup factor. Real groundHeight[MAX_WAYPOINTS+1]; // Ground height. - Int totalTimeMilliseconds; // Num of ms to do this movement. - Int elapsedTimeMilliseconds; // Time since start. + Real totalTimeMilliseconds; // Num of ms to do this movement. + Real elapsedTimeMilliseconds; // Time since start. Real totalDistance; // Total length of paths. Real curSegDistance; // How far we are along the current seg. Int shutter; @@ -267,7 +267,7 @@ class W3DView : public View, public SubsystemInterface void setCameraTransform( void ); ///< set the transform matrix of m_3DCamera, based on m_pos & m_angle void buildCameraTransform( Matrix3D *transform ) ; ///< calculate (but do not set) the transform matrix of m_3DCamera, based on m_pos & m_angle void calcCameraConstraints() ; ///< recalc m_cameraConstraint - void moveAlongWaypointPath(Int milliseconds); ///< Move camera along path. + void moveAlongWaypointPath(Real milliseconds); ///< Move camera along path. void getPickRay(const ICoord2D *screen, Vector3 *rayStart, Vector3 *rayEnd); ///getActualLogicTimeScaleOverFpsRatio(); + moveAlongWaypointPath(TheW3DFrameLengthInMsec * logicTimeScaleOverFpsRatio); didUpdate = true; } if (m_doingScriptedCameraLock) @@ -2908,7 +2911,7 @@ void W3DView::pitchCameraOneFrame(void) // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ -void W3DView::moveAlongWaypointPath(Int milliseconds) +void W3DView::moveAlongWaypointPath(Real milliseconds) { m_mcwpInfo.elapsedTimeMilliseconds += milliseconds; if (TheGlobalData->m_disableCameraMovement) { diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h index 76eaa651d21..8f3f1e48ddd 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h @@ -61,8 +61,8 @@ typedef struct Real cameraAngle[MAX_WAYPOINTS+2]; // Camera Angle; Int timeMultiplier[MAX_WAYPOINTS+2]; // Time speedup factor. Real groundHeight[MAX_WAYPOINTS+1]; // Ground height. - Int totalTimeMilliseconds; // Num of ms to do this movement. - Int elapsedTimeMilliseconds; // Time since start. + Real totalTimeMilliseconds; // Num of ms to do this movement. + Real elapsedTimeMilliseconds; // Time since start. Real totalDistance; // Total length of paths. Real curSegDistance; // How far we are along the current seg. Int shutter; @@ -284,7 +284,7 @@ class W3DView : public View, public SubsystemInterface void setCameraTransform( void ); ///< set the transform matrix of m_3DCamera, based on m_pos & m_angle void buildCameraTransform( Matrix3D *transform ) ; ///< calculate (but do not set) the transform matrix of m_3DCamera, based on m_pos & m_angle void calcCameraConstraints() ; ///< recalc m_cameraConstraint - void moveAlongWaypointPath(Int milliseconds); ///< Move camera along path. + void moveAlongWaypointPath(Real milliseconds); ///< Move camera along path. void getPickRay(const ICoord2D *screen, Vector3 *rayStart, Vector3 *rayEnd); ///getActualLogicTimeScaleOverFpsRatio(); + moveAlongWaypointPath(TheW3DFrameLengthInMsec * logicTimeScaleOverFpsRatio); didUpdate = true; } if (m_doingScriptedCameraLock) @@ -3092,7 +3095,7 @@ void W3DView::pitchCameraOneFrame(void) // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ -void W3DView::moveAlongWaypointPath(Int milliseconds) +void W3DView::moveAlongWaypointPath(Real milliseconds) { m_mcwpInfo.elapsedTimeMilliseconds += milliseconds; if (TheGlobalData->m_disableCameraMovement) { From f7c7c4ae1868fa20aef8498d1c96d7613624d499 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 12 Aug 2025 22:20:09 +0200 Subject: [PATCH 019/343] tweak(fps): Decouple drawable time step from render update (#1451) --- .../GameEngine/Include/GameClient/Display.h | 1 + .../Code/GameEngine/Include/GameClient/View.h | 1 + .../GameEngine/Source/GameClient/Display.cpp | 8 ++++++ .../Include/W3DDevice/GameClient/W3DView.h | 1 + .../W3DDevice/GameClient/W3DDisplay.cpp | 2 ++ .../Source/W3DDevice/GameClient/W3DView.cpp | 26 +++++++++++++------ .../Code/Tools/WorldBuilder/src/wbview3d.cpp | 1 + .../GameEngine/Include/GameClient/Display.h | 1 + .../Code/GameEngine/Include/GameClient/View.h | 1 + .../GameEngine/Source/GameClient/Display.cpp | 8 ++++++ .../Include/W3DDevice/GameClient/W3DView.h | 1 + .../W3DDevice/GameClient/W3DDisplay.cpp | 2 ++ .../Source/W3DDevice/GameClient/W3DView.cpp | 26 +++++++++++++------ .../Code/Tools/WorldBuilder/src/wbview3d.cpp | 1 + 14 files changed, 64 insertions(+), 16 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/Display.h b/Generals/Code/GameEngine/Include/GameClient/Display.h index 3e93f74df46..b7878dcda35 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Display.h +++ b/Generals/Code/GameEngine/Include/GameClient/Display.h @@ -109,6 +109,7 @@ class Display : public SubsystemInterface virtual void drawViews( void ); ///< Render all views of the world virtual void updateViews ( void ); ///< Updates state of world views + virtual void stepViews(); ///< Update views for every fixed time step virtual VideoBuffer* createVideoBuffer( void ) = 0; ///< Create a video buffer that can be used for this display diff --git a/Generals/Code/GameEngine/Include/GameClient/View.h b/Generals/Code/GameEngine/Include/GameClient/View.h index 1cd745bb1a7..41afb177e00 100644 --- a/Generals/Code/GameEngine/Include/GameClient/View.h +++ b/Generals/Code/GameEngine/Include/GameClient/View.h @@ -207,6 +207,7 @@ class View : public Snapshot virtual void drawView( void ) = 0; ///< Render the world visible in this view. virtual void updateView(void) = 0; ///getNextView() ) + v->stepView(); + +} + /// Redraw the entire display void Display::draw( void ) { diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h index 9c1219fecd2..5dda35e0192 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h @@ -132,6 +132,7 @@ class W3DView : public View, public SubsystemInterface virtual void reset( void ); virtual void drawView( void ); ///< draw this view virtual void updateView(void); ///isTimeFast()) { + return; // don't draw - makes it faster :) jba. + } + + Region3D axisAlignedRegion; + getAxisAlignedViewRegion(axisAlignedRegion); + + // render all of the visible Drawables + /// @todo this needs to use a real region partition or something + TheGameClient->iterateDrawablesInRegion( &axisAlignedRegion, drawDrawable, this ); +} + //DECLARE_PERF_TIMER(W3DView_updateView) void W3DView::update(void) { @@ -1222,14 +1240,6 @@ void W3DView::update(void) } if (recalcCamera) setCameraTransform(); - - Region3D axisAlignedRegion; - getAxisAlignedViewRegion(axisAlignedRegion); - - // render all of the visible Drawables - /// @todo this needs to use a real region partition or something - if (WW3D::Get_Frame_Time()) //make sure some time actually elapsed - TheGameClient->iterateDrawablesInRegion( &axisAlignedRegion, drawDrawable, this ); } //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp b/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp index aa704c9f4b3..a5a019fb5c5 100644 --- a/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -183,6 +183,7 @@ class PlaceholderView : public View virtual void drawView( void ) {}; ///< Render the world visible in this view. virtual void updateView( void ) {}; ///< Render the world visible in this view. + virtual void stepView() {}; ///< Update view for every fixed time step virtual void setZoomLimited( Bool limit ) {} ///< limit the zoom height virtual Bool isZoomLimited( void ) { return TRUE; } ///< get status of zoom limit diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h index a4f09bdc07b..7b889b9c0b1 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h @@ -109,6 +109,7 @@ class Display : public SubsystemInterface virtual void drawViews( void ); ///< Render all views of the world virtual void updateViews ( void ); ///< Updates state of world views + virtual void stepViews(); ///< Update views for every fixed time step virtual VideoBuffer* createVideoBuffer( void ) = 0; ///< Create a video buffer that can be used for this display diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/View.h b/GeneralsMD/Code/GameEngine/Include/GameClient/View.h index 8afbd829a07..2ea58b6c4f1 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/View.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/View.h @@ -211,6 +211,7 @@ class View : public Snapshot virtual void drawView( void ) = 0; ///< Render the world visible in this view. virtual void updateView(void) = 0; ///getNextView() ) + v->stepView(); + +} + /// Redraw the entire display void Display::draw( void ) { diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h index 8f3f1e48ddd..b9242dda214 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h @@ -140,6 +140,7 @@ class W3DView : public View, public SubsystemInterface virtual void reset( void ); virtual void drawView( void ); ///< draw this view virtual void updateView(void); ///isTimeFast()) { + return; // don't draw - makes it faster :) jba. + } + + Region3D axisAlignedRegion; + getAxisAlignedViewRegion(axisAlignedRegion); + + // render all of the visible Drawables + /// @todo this needs to use a real region partition or something + TheGameClient->iterateDrawablesInRegion( &axisAlignedRegion, drawDrawable, this ); +} + //DECLARE_PERF_TIMER(W3DView_updateView) void W3DView::update(void) { @@ -1383,14 +1401,6 @@ void W3DView::update(void) // Give the terrain a chance to refresh animaing (Seismic) regions, if any. TheTerrainVisual->updateSeismicSimulations(); #endif - - Region3D axisAlignedRegion; - getAxisAlignedViewRegion(axisAlignedRegion); - - // render all of the visible Drawables - /// @todo this needs to use a real region partition or something - if (WW3D::Get_Frame_Time()) //make sure some time actually elapsed - TheGameClient->iterateDrawablesInRegion( &axisAlignedRegion, drawDrawable, this ); } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp index 04ae90a4997..4efb18e36a6 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -183,6 +183,7 @@ class PlaceholderView : public View virtual void drawView( void ) {}; ///< Render the world visible in this view. virtual void updateView( void ) {}; ///< Render the world visible in this view. + virtual void stepView() {}; ///< Update view for every fixed time step virtual void setZoomLimited( Bool limit ) {} ///< limit the zoom height virtual Bool isZoomLimited( void ) { return TRUE; } ///< get status of zoom limit From bb53980601f773b6b87ff9376b0e2fa58e739161 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 12 Aug 2025 22:24:51 +0200 Subject: [PATCH 020/343] bugfix(fps): Decouple camera shaker time step from render update (#1451) --- .../Source/W3DDevice/GameClient/W3DView.cpp | 44 ++++++++++------- .../Source/W3DDevice/GameClient/W3DView.cpp | 48 +++++++++++-------- 2 files changed, 55 insertions(+), 37 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index f68a5cd1138..765e6656f5b 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -940,8 +940,34 @@ void W3DView::updateView(void) // render update, but it advanced separately for every fixed time step. This ensures that // things like vehicle wheels no longer spin too fast on high frame rates or keep spinning // on game pause. +// The camera shaker is also no longer tied to the render update. The shake does sharp shakes +// on every fixed time step, and is not intended to have linear interpolation during the +// render update. void W3DView::stepView() { + // + // Process camera shake + // + if (m_shakeIntensity > 0.01f) + { + m_shakeOffset.x = m_shakeIntensity * m_shakeAngleCos; + m_shakeOffset.y = m_shakeIntensity * m_shakeAngleSin; + + // fake a stiff spring/damper + const Real dampingCoeff = 0.75f; + m_shakeIntensity *= dampingCoeff; + + // spring is so "stiff", it pulls 180 degrees opposite each frame + m_shakeAngleCos = -m_shakeAngleCos; + m_shakeAngleSin = -m_shakeAngleSin; + } + else + { + m_shakeIntensity = 0.0f; + m_shakeOffset.x = 0.0f; + m_shakeOffset.y = 0.0f; + } + if (TheScriptEngine->isTimeFast()) { return; // don't draw - makes it faster :) jba. } @@ -1164,29 +1190,11 @@ void W3DView::update(void) } // // Process camera shake - /// @todo Make this framerate-independent // if (m_shakeIntensity > 0.01f) { - m_shakeOffset.x = m_shakeIntensity * m_shakeAngleCos; - m_shakeOffset.y = m_shakeIntensity * m_shakeAngleSin; - - // fake a stiff spring/damper - const Real dampingCoeff = 0.75f; - m_shakeIntensity *= dampingCoeff; - - // spring is so "stiff", it pulls 180 degrees opposite each frame - m_shakeAngleCos = -m_shakeAngleCos; - m_shakeAngleSin = -m_shakeAngleSin; - recalcCamera = true; } - else - { - m_shakeIntensity = 0.0f; - m_shakeOffset.x = 0.0f; - m_shakeOffset.y = 0.0f; - } /* * In order to have the camera follow the terrain in a non-dizzying way, we will have a diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 6057ce1978b..6629fb9c640 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -409,7 +409,9 @@ void W3DView::buildCameraTransform( Matrix3D *transform ) transform->Look_At( sourcePos, targetPos, 0 ); //WST 11/12/2002 New camera shaker system - CameraShakerSystem.Timestep(1.0f/30.0f); + // TheSuperHackers @tweak The camera shaker is now decoupled from the render update. + const Real logicTimeScaleOverFpsRatio = TheGameEngine->getActualLogicTimeScaleOverFpsRatio(); + CameraShakerSystem.Timestep(TheW3DFrameLengthInMsec * logicTimeScaleOverFpsRatio); CameraShakerSystem.Update_Camera_Shaker(sourcePos, &m_shakerAngles); transform->Rotate_X(m_shakerAngles.X); transform->Rotate_Y(m_shakerAngles.Y); @@ -1084,8 +1086,34 @@ void W3DView::updateView(void) // render update, but it advanced separately for every fixed time step. This ensures that // things like vehicle wheels no longer spin too fast on high frame rates or keep spinning // on game pause. +// The camera shaker is also no longer tied to the render update. The shake does sharp shakes +// on every fixed time step, and is not intended to have linear interpolation during the +// render update. void W3DView::stepView() { + // + // Process camera shake + // + if (m_shakeIntensity > 0.01f) + { + m_shakeOffset.x = m_shakeIntensity * m_shakeAngleCos; + m_shakeOffset.y = m_shakeIntensity * m_shakeAngleSin; + + // fake a stiff spring/damper + const Real dampingCoeff = 0.75f; + m_shakeIntensity *= dampingCoeff; + + // spring is so "stiff", it pulls 180 degrees opposite each frame + m_shakeAngleCos = -m_shakeAngleCos; + m_shakeAngleSin = -m_shakeAngleSin; + } + else + { + m_shakeIntensity = 0.0f; + m_shakeOffset.x = 0.0f; + m_shakeOffset.y = 0.0f; + } + if (TheScriptEngine->isTimeFast()) { return; // don't draw - makes it faster :) jba. } @@ -1310,29 +1338,11 @@ void W3DView::update(void) } // // Process camera shake - /// @todo Make this framerate-independent // if (m_shakeIntensity > 0.01f) { - m_shakeOffset.x = m_shakeIntensity * m_shakeAngleCos; - m_shakeOffset.y = m_shakeIntensity * m_shakeAngleSin; - - // fake a stiff spring/damper - const Real dampingCoeff = 0.75f; - m_shakeIntensity *= dampingCoeff; - - // spring is so "stiff", it pulls 180 degrees opposite each frame - m_shakeAngleCos = -m_shakeAngleCos; - m_shakeAngleSin = -m_shakeAngleSin; - recalcCamera = true; } - else - { - m_shakeIntensity = 0.0f; - m_shakeOffset.x = 0.0f; - m_shakeOffset.y = 0.0f; - } //Process New C3 Camera Shaker system if (CameraShakerSystem.IsCameraShaking()) From cfb0667d19b1b7162f98718d71e1c2665207dcc8 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 12 Aug 2025 22:36:17 +0200 Subject: [PATCH 021/343] bugfix(fps): Decouple camera zoom and rotation time step from render update (#1451) --- .../Code/GameEngine/Include/GameClient/View.h | 8 +++- .../GameEngine/Source/GameClient/InGameUI.cpp | 44 ++++++++++--------- .../GameClient/MessageStream/LookAtXlat.cpp | 36 ++++++++------- .../GameEngine/Source/GameClient/View.cpp | 9 +--- .../Code/GameEngine/Include/GameClient/View.h | 8 +++- .../GameEngine/Source/GameClient/InGameUI.cpp | 44 ++++++++++--------- .../GameClient/MessageStream/LookAtXlat.cpp | 36 ++++++++------- .../GameEngine/Source/GameClient/View.cpp | 9 +--- 8 files changed, 100 insertions(+), 94 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/View.h b/Generals/Code/GameEngine/Include/GameClient/View.h index 41afb177e00..41b6aac91a5 100644 --- a/Generals/Code/GameEngine/Include/GameClient/View.h +++ b/Generals/Code/GameEngine/Include/GameClient/View.h @@ -73,6 +73,11 @@ class View : public Snapshot public: + enum + { + ZoomHeightPerSecond = 10, + }; + /// Add an impulse force to shake the camera enum CameraShakeType { @@ -180,8 +185,7 @@ class View : public Snapshot virtual void setZoom(Real z) { } virtual Real getHeightAboveGround() { return m_heightAboveGround; } virtual void setHeightAboveGround(Real z) { m_heightAboveGround = z; } - virtual void zoomIn( void ); ///< Zoom in, closer to the ground, limit to min - virtual void zoomOut( void ); ///< Zoom out, farther away from the ground, limit to max + virtual void zoom( Real height ); ///< Zoom in/out, closer to the ground, limit to min, or farther away from the ground, limit to max virtual void setZoomToDefault( void ) { } ///< Set zoom to default value virtual Real getMaxZoom( void ) { return m_maxZoom; } ///< return max zoom value virtual void setOkToAdjustHeight( Bool val ) { m_okToAdjustHeight = val; } ///< Set this to adjust camera height diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index a689b18e086..40dd7183ad6 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -45,7 +45,6 @@ #include "Common/ThingTemplate.h" #include "Common/BuildAssistant.h" #include "Common/Recorder.h" -#include "Common/BuildAssistant.h" #include "Common/SpecialPower.h" #include "GameClient/Anim2D.h" @@ -66,7 +65,6 @@ #include "GameClient/GadgetStaticText.h" #include "GameClient/View.h" #include "GameClient/TerrainVisual.h" -#include "GameClient/ControlBar.h" #include "GameClient/Display.h" #include "GameClient/WindowLayout.h" #include "GameClient/LookAtXlat.h" @@ -1830,26 +1828,30 @@ void InGameUI::update( void ) layout->runUpdate(); } - //Handle keyboard camera rotations - if( m_cameraRotatingLeft && !m_cameraRotatingRight ) + if (m_cameraRotatingLeft || m_cameraRotatingRight || m_cameraZoomingIn || m_cameraZoomingOut) { - //Keyboard rotate left - TheTacticalView->setAngle( TheTacticalView->getAngle() - TheGlobalData->m_keyboardCameraRotateSpeed ); - } - if( m_cameraRotatingRight && !m_cameraRotatingLeft ) - { - //Keyboard rotate right - TheTacticalView->setAngle( TheTacticalView->getAngle() + TheGlobalData->m_keyboardCameraRotateSpeed ); - } - if( m_cameraZoomingIn && !m_cameraZoomingOut ) - { - //Keyboard zoom in - TheTacticalView->zoomIn(); - } - if( m_cameraZoomingOut && !m_cameraZoomingIn ) - { - //Keyboard zoom out - TheTacticalView->zoomOut(); + // TheSuperHackers @tweak The camera rotation and zoom are now decoupled from the render update. + const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); + const Real rotateAngle = TheGlobalData->m_keyboardCameraRotateSpeed * fpsRatio; + const Real zoomHeight = (Real)View::ZoomHeightPerSecond * fpsRatio; + + if( m_cameraRotatingLeft && !m_cameraRotatingRight ) + { + TheTacticalView->setAngle( TheTacticalView->getAngle() - rotateAngle ); + } + else if( m_cameraRotatingRight && !m_cameraRotatingLeft ) + { + TheTacticalView->setAngle( TheTacticalView->getAngle() + rotateAngle ); + } + + if( m_cameraZoomingIn && !m_cameraZoomingOut ) + { + TheTacticalView->zoom( -zoomHeight ); + } + else if( m_cameraZoomingOut && !m_cameraZoomingIn ) + { + TheTacticalView->zoom( +zoomHeight ); + } } diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index 92984eec2c9..6a7235583fb 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -29,6 +29,7 @@ #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine #include "Common/GameType.h" +#include "Common/GameEngine.h" #include "Common/MessageStream.h" #include "Common/Player.h" #include "Common/PlayerList.h" @@ -370,15 +371,19 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage Int spin = msg->getArgument( 1 )->integer; + // TheSuperHackers @tweak The camera zoom is now decoupled from the render update. + const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); + const Real zoomHeight = (Real)View::ZoomHeightPerSecond * fpsRatio; + if (spin > 0) { for ( ; spin > 0; spin--) - TheTacticalView->zoomIn(); + TheTacticalView->zoom( -zoomHeight ); } else { for ( ;spin < 0; spin++ ) - TheTacticalView->zoomOut(); + TheTacticalView->zoom( +zoomHeight ); } break; @@ -410,11 +415,8 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage if (m_isScrolling) { - // TheSuperHackers @bugfix Mauller 07/06/2025 Adjust the viewport scrolling so it is independent of GameClient FPS - // The scaling is based on the current logic rate, this provides a consistent scroll speed at all GameClient FPS - // This also fixes scrolling within replays when fast forwarding due to the uncapped FPS - // When the FPS is in excess of the expected frame rate, the ratio will reduce the offset of the cameras movement - const Real logicToFpsRatio = TheGlobalData->m_framesPerSecondLimit / TheDisplay->getCurrentFPS(); + // TheSuperHackers @bugfix Mauller 07/06/2025 The camera scrolling is now decoupled from the render update. + const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); switch (m_scrollType) { @@ -443,27 +445,27 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage // TheSuperHackers @info calculate the length of the vector to obtain the movement speed before the vector is normalized float vecLength = vec.length(); vec.normalize(); - offset.x = TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.x * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor; - offset.y = TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.y * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor; + offset.x = TheGlobalData->m_horizontalScrollSpeedFactor * fpsRatio * vecLength * vec.x * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor; + offset.y = TheGlobalData->m_verticalScrollSpeedFactor * fpsRatio * vecLength * vec.y * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor; } break; case SCROLL_KEY: { if (scrollDir[DIR_UP]) { - offset.y -= TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; + offset.y -= TheGlobalData->m_verticalScrollSpeedFactor * fpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; } if (scrollDir[DIR_DOWN]) { - offset.y += TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; + offset.y += TheGlobalData->m_verticalScrollSpeedFactor * fpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; } if (scrollDir[DIR_LEFT]) { - offset.x -= TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; + offset.x -= TheGlobalData->m_horizontalScrollSpeedFactor * fpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; } if (scrollDir[DIR_RIGHT]) { - offset.x += TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; + offset.x += TheGlobalData->m_horizontalScrollSpeedFactor * fpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; } } break; @@ -473,19 +475,19 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage UnsignedInt width = TheDisplay->getWidth(); if (m_currentPos.y < edgeScrollSize) { - offset.y -= TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; + offset.y -= TheGlobalData->m_verticalScrollSpeedFactor * fpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; } if (m_currentPos.y >= height-edgeScrollSize) { - offset.y += TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; + offset.y += TheGlobalData->m_verticalScrollSpeedFactor * fpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; } if (m_currentPos.x < edgeScrollSize) { - offset.x -= TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; + offset.x -= TheGlobalData->m_horizontalScrollSpeedFactor * fpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; } if (m_currentPos.x >= width-edgeScrollSize) { - offset.x += TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; + offset.x += TheGlobalData->m_horizontalScrollSpeedFactor * fpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; } } break; diff --git a/Generals/Code/GameEngine/Source/GameClient/View.cpp b/Generals/Code/GameEngine/Source/GameClient/View.cpp index c0310dc6428..34283c797b0 100644 --- a/Generals/Code/GameEngine/Source/GameClient/View.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/View.cpp @@ -125,14 +125,9 @@ View *View::prependViewToList( View *list ) return this; } -void View::zoomIn( void ) +void View::zoom( Real height ) { - setHeightAboveGround(getHeightAboveGround() - 10.0f); -} - -void View::zoomOut( void ) -{ - setHeightAboveGround(getHeightAboveGround() + 10.0f); + setHeightAboveGround(getHeightAboveGround() + height); } /** diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/View.h b/GeneralsMD/Code/GameEngine/Include/GameClient/View.h index 2ea58b6c4f1..59a6d50f452 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/View.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/View.h @@ -73,6 +73,11 @@ class View : public Snapshot public: + enum + { + ZoomHeightPerSecond = 10, + }; + /// Add an impulse force to shake the camera enum CameraShakeType { @@ -184,8 +189,7 @@ class View : public Snapshot virtual void setZoom(Real z) { } virtual Real getHeightAboveGround() { return m_heightAboveGround; } virtual void setHeightAboveGround(Real z) { m_heightAboveGround = z; } - virtual void zoomIn( void ); ///< Zoom in, closer to the ground, limit to min - virtual void zoomOut( void ); ///< Zoom out, farther away from the ground, limit to max + virtual void zoom( Real height ); ///< Zoom in/out, closer to the ground, limit to min, or farther away from the ground, limit to max virtual void setZoomToDefault( void ) { } ///< Set zoom to default value virtual Real getMaxZoom( void ) { return m_maxZoom; } ///< return max zoom value virtual void setOkToAdjustHeight( Bool val ) { m_okToAdjustHeight = val; } ///< Set this to adjust camera height diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index 2573860144b..7d3cabbb85d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -45,7 +45,6 @@ #include "Common/ThingTemplate.h" #include "Common/BuildAssistant.h" #include "Common/Recorder.h" -#include "Common/BuildAssistant.h" #include "Common/SpecialPower.h" #include "GameClient/Anim2D.h" @@ -67,7 +66,6 @@ #include "GameClient/GadgetStaticText.h" #include "GameClient/View.h" #include "GameClient/TerrainVisual.h" -#include "GameClient/ControlBar.h" #include "GameClient/Display.h" #include "GameClient/WindowLayout.h" #include "GameClient/LookAtXlat.h" @@ -1886,26 +1884,30 @@ void InGameUI::update( void ) layout->runUpdate(); } - //Handle keyboard camera rotations - if( m_cameraRotatingLeft && !m_cameraRotatingRight ) + if (m_cameraRotatingLeft || m_cameraRotatingRight || m_cameraZoomingIn || m_cameraZoomingOut) { - //Keyboard rotate left - TheTacticalView->setAngle( TheTacticalView->getAngle() - TheGlobalData->m_keyboardCameraRotateSpeed ); - } - if( m_cameraRotatingRight && !m_cameraRotatingLeft ) - { - //Keyboard rotate right - TheTacticalView->setAngle( TheTacticalView->getAngle() + TheGlobalData->m_keyboardCameraRotateSpeed ); - } - if( m_cameraZoomingIn && !m_cameraZoomingOut ) - { - //Keyboard zoom in - TheTacticalView->zoomIn(); - } - if( m_cameraZoomingOut && !m_cameraZoomingIn ) - { - //Keyboard zoom out - TheTacticalView->zoomOut(); + // TheSuperHackers @tweak The camera rotation and zoom are now decoupled from the render update. + const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); + const Real rotateAngle = TheGlobalData->m_keyboardCameraRotateSpeed * fpsRatio; + const Real zoomHeight = (Real)View::ZoomHeightPerSecond * fpsRatio; + + if( m_cameraRotatingLeft && !m_cameraRotatingRight ) + { + TheTacticalView->setAngle( TheTacticalView->getAngle() - rotateAngle ); + } + else if( m_cameraRotatingRight && !m_cameraRotatingLeft ) + { + TheTacticalView->setAngle( TheTacticalView->getAngle() + rotateAngle ); + } + + if( m_cameraZoomingIn && !m_cameraZoomingOut ) + { + TheTacticalView->zoom( -zoomHeight ); + } + else if( m_cameraZoomingOut && !m_cameraZoomingIn ) + { + TheTacticalView->zoom( +zoomHeight ); + } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index 4114c7373a0..762d617e914 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -29,6 +29,7 @@ #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine #include "Common/GameType.h" +#include "Common/GameEngine.h" #include "Common/MessageStream.h" #include "Common/Player.h" #include "Common/PlayerList.h" @@ -369,15 +370,19 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage Int spin = msg->getArgument( 1 )->integer; + // TheSuperHackers @tweak The camera zoom is now decoupled from the render update. + const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); + const Real zoomHeight = (Real)View::ZoomHeightPerSecond * fpsRatio; + if (spin > 0) { for ( ; spin > 0; spin--) - TheTacticalView->zoomIn(); + TheTacticalView->zoom( -zoomHeight ); } else { for ( ;spin < 0; spin++ ) - TheTacticalView->zoomOut(); + TheTacticalView->zoom( +zoomHeight ); } break; @@ -409,11 +414,8 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage if (m_isScrolling) { - // TheSuperHackers @bugfix Mauller 07/06/2025 Adjust the viewport scrolling so it is independent of GameClient FPS - // The scaling is based on the current logic rate, this provides a consistent scroll speed at all GameClient FPS - // This also fixes scrolling within replays when fast forwarding due to the uncapped FPS - // When the FPS is in excess of the expected frame rate, the ratio will reduce the offset of the cameras movement - const Real logicToFpsRatio = TheGlobalData->m_framesPerSecondLimit / TheDisplay->getCurrentFPS(); + // TheSuperHackers @bugfix Mauller 07/06/2025 The camera scrolling is now decoupled from the render update. + const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); switch (m_scrollType) { @@ -442,27 +444,27 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage // TheSuperHackers @info calculate the length of the vector to obtain the movement speed before the vector is normalized float vecLength = vec.length(); vec.normalize(); - offset.x = TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.x * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor; - offset.y = TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.y * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor; + offset.x = TheGlobalData->m_horizontalScrollSpeedFactor * fpsRatio * vecLength * vec.x * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor; + offset.y = TheGlobalData->m_verticalScrollSpeedFactor * fpsRatio * vecLength * vec.y * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor; } break; case SCROLL_KEY: { if (scrollDir[DIR_UP]) { - offset.y -= TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; + offset.y -= TheGlobalData->m_verticalScrollSpeedFactor * fpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; } if (scrollDir[DIR_DOWN]) { - offset.y += TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; + offset.y += TheGlobalData->m_verticalScrollSpeedFactor * fpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; } if (scrollDir[DIR_LEFT]) { - offset.x -= TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; + offset.x -= TheGlobalData->m_horizontalScrollSpeedFactor * fpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; } if (scrollDir[DIR_RIGHT]) { - offset.x += TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; + offset.x += TheGlobalData->m_horizontalScrollSpeedFactor * fpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; } } break; @@ -472,19 +474,19 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage UnsignedInt width = TheDisplay->getWidth(); if (m_currentPos.y < edgeScrollSize) { - offset.y -= TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; + offset.y -= TheGlobalData->m_verticalScrollSpeedFactor * fpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; } if (m_currentPos.y >= height-edgeScrollSize) { - offset.y += TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; + offset.y += TheGlobalData->m_verticalScrollSpeedFactor * fpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; } if (m_currentPos.x < edgeScrollSize) { - offset.x -= TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; + offset.x -= TheGlobalData->m_horizontalScrollSpeedFactor * fpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; } if (m_currentPos.x >= width-edgeScrollSize) { - offset.x += TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; + offset.x += TheGlobalData->m_horizontalScrollSpeedFactor * fpsRatio * SCROLL_AMT * TheGlobalData->m_keyboardScrollFactor; } } break; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp index e9ca5dbbf6c..58b615b06b8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp @@ -125,14 +125,9 @@ View *View::prependViewToList( View *list ) return this; } -void View::zoomIn( void ) +void View::zoom( Real height ) { - setHeightAboveGround(getHeightAboveGround() - 10.0f); -} - -void View::zoomOut( void ) -{ - setHeightAboveGround(getHeightAboveGround() + 10.0f); + setHeightAboveGround(getHeightAboveGround() + height); } /** From 1dac726980d3559b25e69e01821a388d74d2e379 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Wed, 27 Aug 2025 05:16:15 +1000 Subject: [PATCH 022/343] tweak(client): Show additional information for selected objects while observing (#1479) Now shows visuals for assigned group, loaded ammo, contain status, bomb status and rally point of selected objects for the observed player --- .../GameEngine/Source/GameClient/Drawable.cpp | 9 ++- .../GameClient/GUI/ControlBar/ControlBar.cpp | 79 ++++++++++--------- .../GameClient/W3dWaypointBuffer.cpp | 3 +- .../GameEngine/Source/GameClient/Drawable.cpp | 9 ++- .../GameClient/GUI/ControlBar/ControlBar.cpp | 79 ++++++++++--------- .../GameClient/W3dWaypointBuffer.cpp | 3 +- 6 files changed, 94 insertions(+), 88 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index 07ca14420ed..fcb8ae281de 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -63,6 +63,7 @@ #include "GameLogic/Weapon.h" #include "GameClient/Anim2D.h" +#include "GameClient/ControlBar.h" #include "GameClient/Display.h" #include "GameClient/DisplayStringManager.h" #include "GameClient/Drawable.h" @@ -2285,7 +2286,7 @@ Bool Drawable::drawsAnyUIText( void ) return FALSE; const Object *obj = getObject(); - if ( !obj || !obj->isLocallyControlled() ) + if ( !obj || obj->getControllingPlayer() != TheControlBar->getCurrentlyViewedPlayer()) return FALSE; Player *owner = obj->getControllingPlayer(); @@ -2434,7 +2435,7 @@ void Drawable::drawAmmo( const IRegion2D *healthBarRegion ) if (!( TheGlobalData->m_showObjectHealth && (isSelected() || (TheInGameUI && (TheInGameUI->getMousedOverDrawableID() == getID()))) && - obj->getControllingPlayer() == ThePlayerList->getLocalPlayer() + obj->getControllingPlayer() == TheControlBar->getCurrentlyViewedPlayer() )) return; @@ -2492,7 +2493,7 @@ void Drawable::drawContained( const IRegion2D *healthBarRegion ) if (!( TheGlobalData->m_showObjectHealth && (isSelected() || (TheInGameUI && (TheInGameUI->getMousedOverDrawableID() == getID()))) && - obj->getControllingPlayer() == ThePlayerList->getLocalPlayer() + obj->getControllingPlayer() == TheControlBar->getCurrentlyViewedPlayer() )) return; @@ -2965,7 +2966,7 @@ void Drawable::drawBombed(const IRegion2D* healthBarRegion) UnsignedInt now = TheGameLogic->getFrame(); if( obj->testWeaponSetFlag( WEAPONSET_CARBOMB ) && - obj->getControllingPlayer() == ThePlayerList->getLocalPlayer()) + obj->getControllingPlayer() == TheControlBar->getCurrentlyViewedPlayer()) { if( !getIconInfo()->m_icon[ ICON_CARBOMB ] ) getIconInfo()->m_icon[ ICON_CARBOMB ] = newInstance(Anim2D)( s_animationTemplates[ ICON_CARBOMB ], TheAnim2DCollection ); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 32d62e260ff..cffdb8b5d4a 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -1438,6 +1438,12 @@ void ControlBar::update( void ) Object* obj = drawToEvaluateFor ? drawToEvaluateFor->getObject() : NULL; setPortraitByObject(obj); + + const Coord3D* exitPosition = NULL; + if (obj && obj->getControllingPlayer() == getCurrentlyViewedPlayer() && obj->getObjectExitInterface()) + exitPosition = obj->getObjectExitInterface()->getRallyPoint(); + + showRallyPoint(exitPosition); return; } @@ -2674,58 +2680,53 @@ void ControlBar::setPortraitByObject( Object *obj ) /** Show a rally point marker at the world location specified. If no location is specified * any marker that we might have visible is hidden */ // ------------------------------------------------------------------------------------------------ -void ControlBar::showRallyPoint( const Coord3D *loc ) +void ControlBar::showRallyPoint(const Coord3D* loc) { - // if loc is NULL, destroy any rally point drawble we have shown - if( loc == NULL ) + if (loc == NULL) { - // destroy rally point drawable if present - if( m_rallyPointDrawableID != INVALID_DRAWABLE_ID ) - TheGameClient->destroyDrawable( TheGameClient->findDrawableByID( m_rallyPointDrawableID ) ); + if (m_rallyPointDrawableID != INVALID_DRAWABLE_ID) + TheGameClient->destroyDrawable(TheGameClient->findDrawableByID(m_rallyPointDrawableID)); + m_rallyPointDrawableID = INVALID_DRAWABLE_ID; + return; + } - } // end if - else - { - Drawable *marker = NULL; + Drawable* marker = NULL; - // create a rally point drawble if necessary - if( m_rallyPointDrawableID == INVALID_DRAWABLE_ID ) + // create a rally point drawble if necessary + if (m_rallyPointDrawableID == INVALID_DRAWABLE_ID) + { + const ThingTemplate* ttn = TheThingFactory->findTemplate("RallyPointMarker"); + marker = TheThingFactory->newDrawable(ttn); + DEBUG_ASSERTCRASH(marker, ("showRallyPoint: Unable to create rally point drawable")); + if (marker) { + marker->setDrawableStatus(DRAWABLE_STATUS_NO_SAVE); + m_rallyPointDrawableID = marker->getID(); + } + } + else + marker = TheGameClient->findDrawableByID(m_rallyPointDrawableID); - const ThingTemplate* ttn = TheThingFactory->findTemplate("RallyPointMarker"); - marker = TheThingFactory->newDrawable( ttn ); - DEBUG_ASSERTCRASH( marker, ("showRallyPoint: Unable to create rally point drawable") ); - if (marker) - { - marker->setDrawableStatus(DRAWABLE_STATUS_NO_SAVE); - m_rallyPointDrawableID = marker->getID(); - } - - } // end if - else - marker = TheGameClient->findDrawableByID( m_rallyPointDrawableID ); - - // sanity - DEBUG_ASSERTCRASH( marker, ("showRallyPoint: No rally point marker found" ) ); - - // set the position of the rally point drawble to the position passed in - marker->setPosition( loc ); - marker->setOrientation( TheGlobalData->m_downwindAngle );//To blow down wind -- ML + // sanity + DEBUG_ASSERTCRASH(marker, ("showRallyPoint: No rally point marker found")); - // set the marker colors to that of the local player - Player *player = ThePlayerList->getLocalPlayer(); + // set the position of the rally point drawble to the position passed in + marker->setPosition(loc); + marker->setOrientation(TheGlobalData->m_downwindAngle); // To blow down wind -- ML + // set the marker colors to that of the local player + Player* player = TheControlBar->getCurrentlyViewedPlayer(); + if (player) + { if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT) - marker->setIndicatorColor( player->getPlayerNightColor() ); + marker->setIndicatorColor(player->getPlayerNightColor()); else - marker->setIndicatorColor( player->getPlayerColor() ); - - } // end else - -} // end showRallyPoint + marker->setIndicatorColor(player->getPlayerColor()); + } +} // ------------------------------------------------------------------------------------------------ /** Show a rally point marker at the world location specified. If no location is specified diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp index 5d18c3558d8..05710d7efde 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp @@ -63,6 +63,7 @@ #include "Common/ThingFactory.h" #include "Common/ThingTemplate.h" +#include "GameClient/ControlBar.h" #include "GameClient/Drawable.h" #include "GameClient/GameClient.h" #include "GameClient/InGameUI.h" @@ -224,7 +225,7 @@ void W3DWaypointBuffer::drawWaypoints(RenderInfoClass &rinfo) Int numPoints = 0; if( obj ) { - if ( ! obj->isLocallyControlled()) + if ( obj->getControllingPlayer() != TheControlBar->getCurrentlyViewedPlayer()) continue; ExitInterface *exitInterface = obj->getObjectExitInterface(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index 0b8ac289dda..d314e7c4dee 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -64,6 +64,7 @@ #include "GameLogic/Weapon.h" #include "GameClient/Anim2D.h" +#include "GameClient/ControlBar.h" #include "GameClient/Display.h" #include "GameClient/DisplayStringManager.h" #include "GameClient/Drawable.h" @@ -2731,7 +2732,7 @@ Bool Drawable::drawsAnyUIText( void ) return FALSE; const Object *obj = getObject(); - if ( !obj || !obj->isLocallyControlled() ) + if ( !obj || obj->getControllingPlayer() != TheControlBar->getCurrentlyViewedPlayer()) return FALSE; Player *owner = obj->getControllingPlayer(); @@ -2884,7 +2885,7 @@ void Drawable::drawAmmo( const IRegion2D *healthBarRegion ) if (!( TheGlobalData->m_showObjectHealth && (isSelected() || (TheInGameUI && (TheInGameUI->getMousedOverDrawableID() == getID()))) && - obj->getControllingPlayer() == ThePlayerList->getLocalPlayer() + obj->getControllingPlayer() == TheControlBar->getCurrentlyViewedPlayer() )) return; @@ -2942,7 +2943,7 @@ void Drawable::drawContained( const IRegion2D *healthBarRegion ) if (!( TheGlobalData->m_showObjectHealth && (isSelected() || (TheInGameUI && (TheInGameUI->getMousedOverDrawableID() == getID()))) && - obj->getControllingPlayer() == ThePlayerList->getLocalPlayer() + obj->getControllingPlayer() == TheControlBar->getCurrentlyViewedPlayer() )) return; @@ -3460,7 +3461,7 @@ void Drawable::drawBombed(const IRegion2D* healthBarRegion) UnsignedInt now = TheGameLogic->getFrame(); if( obj->testWeaponSetFlag( WEAPONSET_CARBOMB ) && - obj->getControllingPlayer() == ThePlayerList->getLocalPlayer()) + obj->getControllingPlayer() == TheControlBar->getCurrentlyViewedPlayer()) { if( !getIconInfo()->m_icon[ ICON_CARBOMB ] ) getIconInfo()->m_icon[ ICON_CARBOMB ] = newInstance(Anim2D)( s_animationTemplates[ ICON_CARBOMB ], TheAnim2DCollection ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 45848059671..8e3582ee829 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -1461,6 +1461,12 @@ void ControlBar::update( void ) Object* obj = drawToEvaluateFor ? drawToEvaluateFor->getObject() : NULL; setPortraitByObject(obj); + + const Coord3D* exitPosition = NULL; + if (obj && obj->getControllingPlayer() == getCurrentlyViewedPlayer() && obj->getObjectExitInterface()) + exitPosition = obj->getObjectExitInterface()->getRallyPoint(); + + showRallyPoint(exitPosition); return; } @@ -2697,58 +2703,53 @@ void ControlBar::setPortraitByObject( Object *obj ) /** Show a rally point marker at the world location specified. If no location is specified * any marker that we might have visible is hidden */ // ------------------------------------------------------------------------------------------------ -void ControlBar::showRallyPoint( const Coord3D *loc ) +void ControlBar::showRallyPoint(const Coord3D* loc) { - // if loc is NULL, destroy any rally point drawble we have shown - if( loc == NULL ) + if (loc == NULL) { - // destroy rally point drawable if present - if( m_rallyPointDrawableID != INVALID_DRAWABLE_ID ) - TheGameClient->destroyDrawable( TheGameClient->findDrawableByID( m_rallyPointDrawableID ) ); + if (m_rallyPointDrawableID != INVALID_DRAWABLE_ID) + TheGameClient->destroyDrawable(TheGameClient->findDrawableByID(m_rallyPointDrawableID)); + m_rallyPointDrawableID = INVALID_DRAWABLE_ID; + return; + } - } // end if - else - { - Drawable *marker = NULL; + Drawable* marker = NULL; - // create a rally point drawble if necessary - if( m_rallyPointDrawableID == INVALID_DRAWABLE_ID ) + // create a rally point drawble if necessary + if (m_rallyPointDrawableID == INVALID_DRAWABLE_ID) + { + const ThingTemplate* ttn = TheThingFactory->findTemplate("RallyPointMarker"); + marker = TheThingFactory->newDrawable(ttn); + DEBUG_ASSERTCRASH(marker, ("showRallyPoint: Unable to create rally point drawable")); + if (marker) { + marker->setDrawableStatus(DRAWABLE_STATUS_NO_SAVE); + m_rallyPointDrawableID = marker->getID(); + } + } + else + marker = TheGameClient->findDrawableByID(m_rallyPointDrawableID); - const ThingTemplate* ttn = TheThingFactory->findTemplate("RallyPointMarker"); - marker = TheThingFactory->newDrawable( ttn ); - DEBUG_ASSERTCRASH( marker, ("showRallyPoint: Unable to create rally point drawable") ); - if (marker) - { - marker->setDrawableStatus(DRAWABLE_STATUS_NO_SAVE); - m_rallyPointDrawableID = marker->getID(); - } - - } // end if - else - marker = TheGameClient->findDrawableByID( m_rallyPointDrawableID ); - - // sanity - DEBUG_ASSERTCRASH( marker, ("showRallyPoint: No rally point marker found" ) ); - - // set the position of the rally point drawble to the position passed in - marker->setPosition( loc ); - marker->setOrientation( TheGlobalData->m_downwindAngle );//To blow down wind -- ML + // sanity + DEBUG_ASSERTCRASH(marker, ("showRallyPoint: No rally point marker found")); - // set the marker colors to that of the local player - Player *player = ThePlayerList->getLocalPlayer(); + // set the position of the rally point drawble to the position passed in + marker->setPosition(loc); + marker->setOrientation(TheGlobalData->m_downwindAngle); // To blow down wind -- ML + // set the marker colors to that of the local player + Player* player = TheControlBar->getCurrentlyViewedPlayer(); + if (player) + { if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT) - marker->setIndicatorColor( player->getPlayerNightColor() ); + marker->setIndicatorColor(player->getPlayerNightColor()); else - marker->setIndicatorColor( player->getPlayerColor() ); - - } // end else - -} // end showRallyPoint + marker->setIndicatorColor(player->getPlayerColor()); + } +} // ------------------------------------------------------------------------------------------------ /** Show a rally point marker at the world location specified. If no location is specified diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp index d98a80a0a6d..b68fa4c0c4c 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp @@ -63,6 +63,7 @@ #include "Common/ThingFactory.h" #include "Common/ThingTemplate.h" +#include "GameClient/ControlBar.h" #include "GameClient/Drawable.h" #include "GameClient/GameClient.h" #include "GameClient/InGameUI.h" @@ -231,7 +232,7 @@ void W3DWaypointBuffer::drawWaypoints(RenderInfoClass &rinfo) Int numPoints = 0; if( obj ) { - if ( ! obj->isLocallyControlled()) + if ( obj->getControllingPlayer() != TheControlBar->getCurrentlyViewedPlayer()) continue; From a34fd1624e080b31693a0e8f60be17bdaae364e9 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 26 Aug 2025 21:18:33 +0200 Subject: [PATCH 023/343] tweak: Disable test asset loading in release builds (#1485) --- Core/GameEngine/Include/Common/FileSystem.h | 12 +++++++----- .../GameClient/Drawable/Draw/W3DDefaultDraw.cpp | 4 ++-- Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp | 15 ++++++++++----- .../GameClient/Drawable/Draw/W3DDefaultDraw.cpp | 4 ++-- .../Code/Tools/WorldBuilder/src/wbview3d.cpp | 15 ++++++++++----- 5 files changed, 31 insertions(+), 19 deletions(-) diff --git a/Core/GameEngine/Include/Common/FileSystem.h b/Core/GameEngine/Include/Common/FileSystem.h index 5c8b3a57f8d..0d9dd7ff3cd 100644 --- a/Core/GameEngine/Include/Common/FileSystem.h +++ b/Core/GameEngine/Include/Common/FileSystem.h @@ -87,15 +87,17 @@ typedef FilenameList::iterator FilenameListIter; // LOAD_TEST_ASSETS automatically loads w3d assets from the TEST_W3D_DIR_PATH // without having to add an INI entry. -///@todo this allows us to use the test art directory, it should be removed for FINAL release +#if defined(RTS_DEBUG) #define LOAD_TEST_ASSETS 1 +#endif + #ifdef LOAD_TEST_ASSETS #define ROAD_DIRECTORY "../TestArt/TestRoad/" #define TEST_STRING "***TESTING" -// the following directories will be used to look for test art -#define LOOK_FOR_TEST_ART -#define TEST_W3D_DIR_PATH "../TestArt/" ///< .w3d files live here -#define TEST_TGA_DIR_PATH "../TestArt/" ///< .tga texture files live here + // the following directories will be used to look for test art + #define LOOK_FOR_TEST_ART + #define TEST_W3D_DIR_PATH "../TestArt/" ///< .w3d files live here + #define TEST_TGA_DIR_PATH "../TestArt/" ///< .tga texture files live here #endif struct FileInfo { diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp index b5acbda5338..5d52f8d6d07 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp @@ -94,10 +94,10 @@ void W3DDefaultDraw::reactToTransformChange( const Matrix3D *oldMtx, const Coord3D *oldPos, Real oldAngle ) { - +#ifdef LOAD_TEST_ASSETS if( m_renderObject ) m_renderObject->Set_Transform( *getDrawable()->getTransformMatrix() ); - +#endif } //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp b/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp index a5a019fb5c5..7151cfd6bb2 100644 --- a/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -1251,15 +1251,18 @@ AsciiString WbView3d::getModelNameAndScale(MapObject *pMapObj, Real *scale, Body break; } - AsciiString modelName("No Model Name"); + AsciiString modelName; *scale = 1.0f; - Int i; + +#ifdef LOAD_TEST_ASSETS char buffer[ _MAX_PATH ]; + if (strncmp(TEST_STRING, pMapObj->getName().str(), strlen(TEST_STRING)) == 0) { /* Handle test art models here */ strcpy(buffer, pMapObj->getName().str()); + Int i; for (i=0; buffer[i]; i++) { if (buffer[i] == '/') { i++; @@ -1268,7 +1271,9 @@ AsciiString WbView3d::getModelNameAndScale(MapObject *pMapObj, Real *scale, Body } modelName = buffer+i; } - else +#endif + + if (modelName.isEmpty()) { modelName = "No Model Name"; // must be this while GDF exists (it's the default) const ThingTemplate *tTemplate; @@ -1281,8 +1286,8 @@ AsciiString WbView3d::getModelNameAndScale(MapObject *pMapObj, Real *scale, Body modelName = getBestModelName(tTemplate, state); *scale = tTemplate->getAssetScale(); - } // end if - } // end else + } + } return modelName; } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp index 4ca69a399ef..5b13ead8c30 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp @@ -94,10 +94,10 @@ void W3DDefaultDraw::reactToTransformChange( const Matrix3D *oldMtx, const Coord3D *oldPos, Real oldAngle ) { - +#ifdef LOAD_TEST_ASSETS if( m_renderObject ) m_renderObject->Set_Transform( *getDrawable()->getTransformMatrix() ); - +#endif } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp index 4efb18e36a6..76e462da885 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -1308,15 +1308,18 @@ AsciiString WbView3d::getModelNameAndScale(MapObject *pMapObj, Real *scale, Body break; } - AsciiString modelName("No Model Name"); + AsciiString modelName; *scale = 1.0f; - Int i; + +#ifdef LOAD_TEST_ASSETS char buffer[ _MAX_PATH ]; + if (strncmp(TEST_STRING, pMapObj->getName().str(), strlen(TEST_STRING)) == 0) { /* Handle test art models here */ strcpy(buffer, pMapObj->getName().str()); + Int i; for (i=0; buffer[i]; i++) { if (buffer[i] == '/') { i++; @@ -1325,7 +1328,9 @@ AsciiString WbView3d::getModelNameAndScale(MapObject *pMapObj, Real *scale, Body } modelName = buffer+i; } - else +#endif + + if (modelName.isEmpty()) { modelName = "No Model Name"; // must be this while GDF exists (it's the default) const ThingTemplate *tTemplate; @@ -1338,8 +1343,8 @@ AsciiString WbView3d::getModelNameAndScale(MapObject *pMapObj, Real *scale, Body modelName = getBestModelName(tTemplate, state); *scale = tTemplate->getAssetScale(); - } // end if - } // end else + } + } return modelName; } From 8f0a388dea10bec96a218565c4412059a58c4809 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 26 Aug 2025 22:47:50 +0200 Subject: [PATCH 024/343] refactor(string): Remove explicit UnicodeString constructor (#1495) --- Core/GameEngine/Include/Common/UnicodeString.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/GameEngine/Include/Common/UnicodeString.h b/Core/GameEngine/Include/Common/UnicodeString.h index 70940aca9cf..1a3c9698671 100644 --- a/Core/GameEngine/Include/Common/UnicodeString.h +++ b/Core/GameEngine/Include/Common/UnicodeString.h @@ -142,11 +142,11 @@ class UnicodeString /** Constructor -- from a literal string. Constructs an UnicodeString with the given string. Note that a copy of the string is made; - the input ptr is not saved. Note also that this is declared - 'explicit' to avoid implicit conversions from const-WideChar-* - (e.g., as input arguments). + the input ptr is not saved. + Note that this is no longer explicit, as the conversion is almost + always wanted, anyhow. */ - explicit UnicodeString(const WideChar* s); + UnicodeString(const WideChar* s); /** Destructor. Not too exciting... clean up the works and such. From 806ebab8fdad05679bcad3f161c6240c019847c1 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Wed, 27 Aug 2025 06:48:50 +1000 Subject: [PATCH 025/343] tweak(ini): No longer terminate application if an INI data field is not found (#1497) --- Generals/Code/GameEngine/Source/Common/INI/INI.cpp | 1 - GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp index 7cd04184274..239c6cbb828 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp @@ -1528,7 +1528,6 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList { DEBUG_ASSERTCRASH( 0, ("[LINE: %d - FILE: '%s'] Unknown field '%s' in block '%s'", INI::getLineNum(), INI::getFilename().str(), field, m_curBlockStart) ); - throw INI_UNKNOWN_TOKEN; } } // end else diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp index 6f511ca0d11..5fa4053c478 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp @@ -1530,7 +1530,6 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList { DEBUG_ASSERTCRASH( 0, ("[LINE: %d - FILE: '%s'] Unknown field '%s' in block '%s'", INI::getLineNum(), INI::getFilename().str(), field, m_curBlockStart) ); - throw INI_UNKNOWN_TOKEN; } } // end else From e477aa7eddcf998f66548bdfbf432a6131c1ee79 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Wed, 27 Aug 2025 06:49:46 +1000 Subject: [PATCH 026/343] refactor(input): Simplify click conditions for MSG_RAW_MOUSE_RIGHT_BUTTON_UP (#1499) --- .../MessageStream/SelectionXlat.cpp | 22 +++---------------- .../MessageStream/SelectionXlat.cpp | 22 +++---------------- 2 files changed, 6 insertions(+), 38 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp index d147a0932eb..3c80c251caf 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp @@ -910,30 +910,14 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa //----------------------------------------------------------------------------- case GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_UP: { - ICoord2D delta, pixel; - UnsignedInt currentTime; Coord3D cameraPos; - TheTacticalView->getPosition(&cameraPos); cameraPos.sub(&m_deselectDownCameraPosition); - pixel = msg->getArgument( 0 )->pixel; - currentTime = (UnsignedInt) msg->getArgument( 2 )->integer; - - delta.x = m_deselectFeedbackAnchor.x - pixel.x; - delta.y = m_deselectFeedbackAnchor.y - pixel.y; + ICoord2D pixel = msg->getArgument( 0 )->pixel; + UnsignedInt currentTime = (UnsignedInt) msg->getArgument( 2 )->integer; - Bool isClick = TRUE; - if (abs(delta.x) > TheMouse->m_dragTolerance || abs(delta.y) > TheMouse->m_dragTolerance) - { - isClick = FALSE; - } - - if (isClick && - currentTime - m_lastClick > TheMouse->m_dragToleranceMS) - { - isClick = FALSE; - } + Bool isClick = TheMouse->isClick(&m_deselectFeedbackAnchor, &pixel, m_lastClick, currentTime); if (isClick && cameraPos.length() > TheMouse->m_dragTolerance3D) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp index cdb40bede4c..aa7831567b0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp @@ -986,30 +986,14 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa //----------------------------------------------------------------------------- case GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_UP: { - ICoord2D delta, pixel; - UnsignedInt currentTime; Coord3D cameraPos; - TheTacticalView->getPosition(&cameraPos); cameraPos.sub(&m_deselectDownCameraPosition); - pixel = msg->getArgument( 0 )->pixel; - currentTime = (UnsignedInt) msg->getArgument( 2 )->integer; - - delta.x = m_deselectFeedbackAnchor.x - pixel.x; - delta.y = m_deselectFeedbackAnchor.y - pixel.y; + ICoord2D pixel = msg->getArgument( 0 )->pixel; + UnsignedInt currentTime = (UnsignedInt) msg->getArgument( 2 )->integer; - Bool isClick = TRUE; - if (abs(delta.x) > TheMouse->m_dragTolerance || abs(delta.y) > TheMouse->m_dragTolerance) - { - isClick = FALSE; - } - - if (isClick && - currentTime - m_lastClick > TheMouse->m_dragToleranceMS) - { - isClick = FALSE; - } + Bool isClick = TheMouse->isClick(&m_deselectFeedbackAnchor, &pixel, m_lastClick, currentTime); if (isClick && cameraPos.length() > TheMouse->m_dragTolerance3D) From 63bfe154bbe882c5ae655ab036cb954000f50836 Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Fri, 29 Aug 2025 16:41:25 +0100 Subject: [PATCH 027/343] tweak(network): Reduce the minimum runahead latency limit from 10 to 4 (#1489) --- Generals/Code/GameEngine/Source/GameNetwork/NetworkUtil.cpp | 4 +++- GeneralsMD/Code/GameEngine/Source/GameNetwork/NetworkUtil.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameNetwork/NetworkUtil.cpp b/Generals/Code/GameEngine/Source/GameNetwork/NetworkUtil.cpp index 50be2b69fae..03465874a83 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/NetworkUtil.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/NetworkUtil.cpp @@ -27,8 +27,10 @@ #include "GameNetwork/networkutil.h" +// TheSuperHackers @tweak Mauller 26/08/2025 reduce the minimum runahead from 10 +// This lets network games run at latencies down to 133ms when the network conditions allow Int MAX_FRAMES_AHEAD = 128; -Int MIN_RUNAHEAD = 10; +Int MIN_RUNAHEAD = 4; Int FRAME_DATA_LENGTH = (MAX_FRAMES_AHEAD+1)*2; Int FRAMES_TO_KEEP = (MAX_FRAMES_AHEAD/2) + 1; diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetworkUtil.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetworkUtil.cpp index 0b4a6bc7076..21daa5b7b1b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetworkUtil.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetworkUtil.cpp @@ -27,8 +27,10 @@ #include "GameNetwork/networkutil.h" +// TheSuperHackers @tweak Mauller 26/08/2025 reduce the minimum runahead from 10 +// This lets network games run at latencies down to 133ms when the network conditions allow Int MAX_FRAMES_AHEAD = 128; -Int MIN_RUNAHEAD = 10; +Int MIN_RUNAHEAD = 4; Int FRAME_DATA_LENGTH = (MAX_FRAMES_AHEAD+1)*2; Int FRAMES_TO_KEEP = (MAX_FRAMES_AHEAD/2) + 1; From 0a771802e7e57a3c4e5cb392c3092219ac2c3750 Mon Sep 17 00:00:00 2001 From: Bart Roossien | SkyAero Date: Sat, 30 Aug 2025 11:58:10 +0200 Subject: [PATCH 028/343] bugfix(selection): Prevent exploits from grouping structures and units (#1347) --- .../Source/GameClient/MessageStream/SelectionXlat.cpp | 7 +++++++ .../Source/GameClient/MessageStream/SelectionXlat.cpp | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp index 3c80c251caf..0e1342de29c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp @@ -1142,6 +1142,13 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa { VecObjectPtr objlist = selectedSquad->getLiveObjects(); Int numObjs = objlist.size(); + + // TheSuperHackers @bugfix skyaero 22/07/2025 Can't select other units if you have a structure selected. So deselect the structure to prevent group force attack exploit. + if (numObjs > 0 && objlist[0]->getDrawable()->isKindOf(KINDOF_STRUCTURE)) + { + TheInGameUI->deselectAllDrawables(); + } + for (Int i = 0; i < numObjs; ++i) { TheInGameUI->selectDrawable(objlist[i]->getDrawable()); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp index aa7831567b0..d447bf0bf22 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp @@ -1217,6 +1217,13 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa { VecObjectPtr objlist = selectedSquad->getLiveObjects(); Int numObjs = objlist.size(); + + // TheSuperHackers @bugfix skyaero 22/07/2025 Can't select other units if you have a structure selected. So deselect the structure to prevent group force attack exploit. + if (numObjs > 0 && objlist[0]->getDrawable()->isKindOf(KINDOF_STRUCTURE)) + { + TheInGameUI->deselectAllDrawables(); + } + for (Int i = 0; i < numObjs; ++i) { TheInGameUI->selectDrawable(objlist[i]->getDrawable()); From a69c91285b0f7fc4419d7e114b27466a1a457bfa Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Sat, 30 Aug 2025 21:38:51 +1000 Subject: [PATCH 029/343] perf(ini): Decrease cost of INI::isDeclarationOfType by around 10% (#1498) --- .../Code/GameEngine/Source/Common/INI/INI.cpp | 64 ++++++------------- .../Code/GameEngine/Source/Common/INI/INI.cpp | 64 ++++++------------- 2 files changed, 42 insertions(+), 86 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp index 239c6cbb828..e8274f9ec15 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp @@ -1867,61 +1867,39 @@ void INI::parseDeathTypeFlags(INI* ini, void* /*instance*/, void* store, const v // both blockType and blockName are case insensitive Bool INI::isDeclarationOfType( AsciiString blockType, AsciiString blockName, char *bufferToCheck ) { - Bool retVal = true; - if (!bufferToCheck || blockType.isEmpty() || blockName.isEmpty()) { + if (!bufferToCheck || blockType.isEmpty() || blockName.isEmpty()) return false; - } - // DO NOT RETURN EARLY FROM THIS FUNCTION. (beyond this point) - // we have to restore the bufferToCheck to its previous state before returning, so - // it is important to get through all the checks. - char restoreChar; - char *tempBuff = bufferToCheck; - int blockTypeLength = blockType.getLength(); - int blockNameLength = blockName.getLength(); + const char* tempBuff = bufferToCheck; - while (isspace(*tempBuff)) { + while (isspace(*tempBuff)) ++tempBuff; - } - if (strlen(tempBuff) > blockTypeLength) { - restoreChar = tempBuff[blockTypeLength]; - tempBuff[blockTypeLength] = 0; + const int blockTypeLength = blockType.getLength(); + if (strnicmp(tempBuff, blockType.str(), blockTypeLength) != 0) + return false; - if (stricmp(blockType.str(), tempBuff) != 0) { - retVal = false; - } + tempBuff += blockTypeLength; - tempBuff[blockTypeLength] = restoreChar; - tempBuff = tempBuff + blockTypeLength; - } else { - retVal = false; - } + if (!isspace(*tempBuff++)) + return false; - while (isspace(*tempBuff)) { + while (isspace(*tempBuff)) ++tempBuff; - } - - if (strlen(tempBuff) > blockNameLength) { - restoreChar = tempBuff[blockNameLength]; - tempBuff[blockNameLength] = 0; - if (stricmp(blockName.str(), tempBuff) != 0) { - retVal = false; - } + const int blockNameLength = blockName.getLength(); + if (strnicmp(tempBuff, blockName.str(), blockNameLength) != 0) + return false; - tempBuff[blockNameLength] = restoreChar; - tempBuff = tempBuff + blockNameLength; - } else { - retVal = false; - } + tempBuff += blockNameLength; - while (strlen(tempBuff)) { - retVal = retVal && isspace(tempBuff[0]); + while (isspace(*tempBuff)) ++tempBuff; - } - return retVal; + if (*tempBuff != '\0') + return false; + + return true; } //------------------------------------------------------------------------------------------------- @@ -1962,8 +1940,8 @@ Bool INI::isEndOfBlock( char *bufferToCheck ) retVal = false; } - while (strlen(tempBuff)) { - retVal = retVal && isspace(tempBuff[0]); + while (*tempBuff && retVal) { + retVal = isspace(*tempBuff); ++tempBuff; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp index 5fa4053c478..9d00c42996e 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp @@ -1872,61 +1872,39 @@ void INI::parseDeathTypeFlags(INI* ini, void* /*instance*/, void* store, const v // both blockType and blockName are case insensitive Bool INI::isDeclarationOfType( AsciiString blockType, AsciiString blockName, char *bufferToCheck ) { - Bool retVal = true; - if (!bufferToCheck || blockType.isEmpty() || blockName.isEmpty()) { + if (!bufferToCheck || blockType.isEmpty() || blockName.isEmpty()) return false; - } - // DO NOT RETURN EARLY FROM THIS FUNCTION. (beyond this point) - // we have to restore the bufferToCheck to its previous state before returning, so - // it is important to get through all the checks. - char restoreChar; - char *tempBuff = bufferToCheck; - int blockTypeLength = blockType.getLength(); - int blockNameLength = blockName.getLength(); + const char* tempBuff = bufferToCheck; - while (isspace(*tempBuff)) { + while (isspace(*tempBuff)) ++tempBuff; - } - if (strlen(tempBuff) > blockTypeLength) { - restoreChar = tempBuff[blockTypeLength]; - tempBuff[blockTypeLength] = 0; + const int blockTypeLength = blockType.getLength(); + if (strnicmp(tempBuff, blockType.str(), blockTypeLength) != 0) + return false; - if (stricmp(blockType.str(), tempBuff) != 0) { - retVal = false; - } + tempBuff += blockTypeLength; - tempBuff[blockTypeLength] = restoreChar; - tempBuff = tempBuff + blockTypeLength; - } else { - retVal = false; - } + if (!isspace(*tempBuff++)) + return false; - while (isspace(*tempBuff)) { + while (isspace(*tempBuff)) ++tempBuff; - } - - if (strlen(tempBuff) > blockNameLength) { - restoreChar = tempBuff[blockNameLength]; - tempBuff[blockNameLength] = 0; - if (stricmp(blockName.str(), tempBuff) != 0) { - retVal = false; - } + const int blockNameLength = blockName.getLength(); + if (strnicmp(tempBuff, blockName.str(), blockNameLength) != 0) + return false; - tempBuff[blockNameLength] = restoreChar; - tempBuff = tempBuff + blockNameLength; - } else { - retVal = false; - } + tempBuff += blockNameLength; - while (strlen(tempBuff)) { - retVal = retVal && isspace(tempBuff[0]); + while (isspace(*tempBuff)) ++tempBuff; - } - return retVal; + if (*tempBuff != '\0') + return false; + + return true; } //------------------------------------------------------------------------------------------------- @@ -1967,8 +1945,8 @@ Bool INI::isEndOfBlock( char *bufferToCheck ) retVal = false; } - while (strlen(tempBuff)) { - retVal = retVal && isspace(tempBuff[0]); + while (*tempBuff && retVal) { + retVal = isspace(*tempBuff); ++tempBuff; } From 9c87f927150d757962ec825fc3057fd174ef805a Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 31 Aug 2025 08:56:43 +0200 Subject: [PATCH 030/343] feat(string): Implement functions for AsciiString, UnicodeString that build a new string with a fixed length (#1494) --- Core/GameEngine/Include/Common/AsciiString.h | 14 +++++++ .../GameEngine/Include/Common/UnicodeString.h | 14 +++++++ .../Source/Common/System/AsciiString.cpp | 42 +++++++++++++++---- .../Source/Common/System/UnicodeString.cpp | 42 +++++++++++++++---- 4 files changed, 96 insertions(+), 16 deletions(-) diff --git a/Core/GameEngine/Include/Common/AsciiString.h b/Core/GameEngine/Include/Common/AsciiString.h index 54773bdf6d6..7c867bb1128 100644 --- a/Core/GameEngine/Include/Common/AsciiString.h +++ b/Core/GameEngine/Include/Common/AsciiString.h @@ -148,6 +148,12 @@ class AsciiString */ AsciiString(const char* s); + /** + Constructs an AsciiString with the given string and length. + The length must not be larger than the actual string length. + */ + AsciiString(const char* s, int len); + /** Destructor. Not too exciting... clean up the works and such. */ @@ -200,12 +206,20 @@ class AsciiString refcount.) */ void set(const AsciiString& stringSrc); + /** Replace the contents of self with the given string. Note that a copy of the string is made; the input ptr is not saved. */ void set(const char* s); + /** + Replace the contents of self with the given string and length. + Note that a copy of the string is made; the input ptr is not saved. + The length must not be larger than the actual string length. + */ + void set(const char* s, int len); + /** replace contents of self with the given string. Note the nomenclature is translate rather than set; this is because diff --git a/Core/GameEngine/Include/Common/UnicodeString.h b/Core/GameEngine/Include/Common/UnicodeString.h index 1a3c9698671..1df7953d6c8 100644 --- a/Core/GameEngine/Include/Common/UnicodeString.h +++ b/Core/GameEngine/Include/Common/UnicodeString.h @@ -148,6 +148,12 @@ class UnicodeString */ UnicodeString(const WideChar* s); + /** + Constructs an UnicodeString with the given string and length. + The length must not be larger than the actual string length. + */ + UnicodeString(const WideChar* s, int len); + /** Destructor. Not too exciting... clean up the works and such. */ @@ -200,12 +206,20 @@ class UnicodeString refcount.) */ void set(const UnicodeString& stringSrc); + /** Replace the contents of self with the given string. Note that a copy of the string is made; the input ptr is not saved. */ void set(const WideChar* s); + /** + Replace the contents of self with the given string and length. + Note that a copy of the string is made; the input ptr is not saved. + The length must not be larger than the actual string length. + */ + void set(const WideChar* s, int len); + /** replace contents of self with the given string. Note the nomenclature is translate rather than set; this is because diff --git a/Core/GameEngine/Source/Common/System/AsciiString.cpp b/Core/GameEngine/Source/Common/System/AsciiString.cpp index 06e9ec8849d..45e3b1ac49a 100644 --- a/Core/GameEngine/Source/Common/System/AsciiString.cpp +++ b/Core/GameEngine/Source/Common/System/AsciiString.cpp @@ -125,14 +125,20 @@ void AsciiString::ensureUniqueBufferOfSize(int numCharsNeeded, Bool preserveData { validate(); + const int usableNumChars = numCharsNeeded - 1; + if (m_data && m_data->m_refCount == 1 && m_data->m_numCharsAllocated >= numCharsNeeded) { // no buffer manhandling is needed (it's already large enough, and unique to us) if (strToCopy) + { // TheSuperHackers @fix Mauller 04/04/2025 Replace strcpy with safer memmove as memory regions can overlap when part of string is copied to itself - memmove(m_data->peek(), strToCopy, strlen(strToCopy) + 1); + DEBUG_ASSERTCRASH(usableNumChars <= strlen(strToCopy), ("strToCopy is too small")); + memmove(m_data->peek(), strToCopy, usableNumChars); + m_data->peek()[usableNumChars] = 0; + } if (strToCat) strcat(m_data->peek(), strToCat); return; @@ -157,7 +163,11 @@ void AsciiString::ensureUniqueBufferOfSize(int numCharsNeeded, Bool preserveData // do these BEFORE releasing the old buffer, so that self-copies // or self-cats will work correctly. if (strToCopy) - strcpy(newData->peek(), strToCopy); + { + DEBUG_ASSERTCRASH(usableNumChars <= strlen(strToCopy), ("strToCopy is too small")); + strncpy(newData->peek(), strToCopy, usableNumChars); + newData->peek()[usableNumChars] = 0; + } if (strToCat) strcat(newData->peek(), strToCat); @@ -186,11 +196,21 @@ void AsciiString::releaseBuffer() } // ----------------------------------------------------- -AsciiString::AsciiString(const char* s) : m_data(0) +AsciiString::AsciiString(const char* s) : m_data(NULL) { //DEBUG_ASSERTCRASH(isMemoryManagerOfficiallyInited(), ("Initializing AsciiStrings prior to main (ie, as static vars) can cause memory leak reporting problems. Are you sure you want to do this?")); - int len = (s)?strlen(s):0; - if (len) + int len = s ? (int)strlen(s) : 0; + if (len > 0) + { + ensureUniqueBufferOfSize(len + 1, false, s, NULL); + } + validate(); +} + +// ----------------------------------------------------- +AsciiString::AsciiString(const char* s, int len) : m_data(NULL) +{ + if (len > 0) { ensureUniqueBufferOfSize(len + 1, false, s, NULL); } @@ -215,12 +235,18 @@ void AsciiString::set(const AsciiString& stringSrc) // ----------------------------------------------------- void AsciiString::set(const char* s) +{ + int len = s ? strlen(s) : 0; + set(s, len); +} + +// ----------------------------------------------------- +void AsciiString::set(const char* s, int len) { validate(); if (!m_data || s != peek()) { - int len = s ? strlen(s) : 0; - if (len) + if (len > 0) { ensureUniqueBufferOfSize(len + 1, false, s, NULL); } @@ -375,7 +401,7 @@ void AsciiString::truncateBy(const Int charCount) const size_t len = strlen(peek()); if (len > 0) { - ensureUniqueBufferOfSize(len+1, true, NULL, NULL); + ensureUniqueBufferOfSize(len + 1, true, NULL, NULL); size_t count = charCount; if (charCount > len) { diff --git a/Core/GameEngine/Source/Common/System/UnicodeString.cpp b/Core/GameEngine/Source/Common/System/UnicodeString.cpp index 83857f216bd..8c384cd8998 100644 --- a/Core/GameEngine/Source/Common/System/UnicodeString.cpp +++ b/Core/GameEngine/Source/Common/System/UnicodeString.cpp @@ -76,14 +76,20 @@ void UnicodeString::ensureUniqueBufferOfSize(int numCharsNeeded, Bool preserveDa { validate(); + const int usableNumChars = numCharsNeeded - 1; + if (m_data && m_data->m_refCount == 1 && m_data->m_numCharsAllocated >= numCharsNeeded) { // no buffer manhandling is needed (it's already large enough, and unique to us) if (strToCopy) + { // TheSuperHackers @fix Mauller 04/04/2025 Replace wcscpy with safer memmove as memory regions can overlap when part of string is copied to itself - memmove(m_data->peek(), strToCopy, (wcslen(strToCopy) + 1) * sizeof(WideChar)); + DEBUG_ASSERTCRASH(usableNumChars <= wcslen(strToCopy), ("strToCopy is too small")); + memmove(m_data->peek(), strToCopy, usableNumChars * sizeof(WideChar)); + m_data->peek()[usableNumChars] = 0; + } if (strToCat) wcscat(m_data->peek(), strToCat); return; @@ -108,7 +114,11 @@ void UnicodeString::ensureUniqueBufferOfSize(int numCharsNeeded, Bool preserveDa // do these BEFORE releasing the old buffer, so that self-copies // or self-cats will work correctly. if (strToCopy) - wcscpy(newData->peek(), strToCopy); + { + DEBUG_ASSERTCRASH(usableNumChars <= wcslen(strToCopy), ("strToCopy is too small")); + wcsncpy(newData->peek(), strToCopy, usableNumChars); + newData->peek()[usableNumChars] = 0; + } if (strToCat) wcscat(newData->peek(), strToCat); @@ -136,10 +146,20 @@ void UnicodeString::releaseBuffer() } // ----------------------------------------------------- -UnicodeString::UnicodeString(const WideChar* s) : m_data(0) +UnicodeString::UnicodeString(const WideChar* s) : m_data(NULL) { - int len = wcslen(s); - if (len) + int len = s ? (int)wcslen(s) : 0; + if (len > 0) + { + ensureUniqueBufferOfSize(len + 1, false, s, NULL); + } + validate(); +} + +// ----------------------------------------------------- +UnicodeString::UnicodeString(const WideChar* s, int len) : m_data(NULL) +{ + if (len > 0) { ensureUniqueBufferOfSize(len + 1, false, s, NULL); } @@ -164,12 +184,18 @@ void UnicodeString::set(const UnicodeString& stringSrc) // ----------------------------------------------------- void UnicodeString::set(const WideChar* s) +{ + int len = s ? wcslen(s) : 0; + set(s, len); +} + +// ----------------------------------------------------- +void UnicodeString::set(const WideChar* s, int len) { validate(); if (!m_data || s != peek()) { - int len = s ? wcslen(s) : 0; - if (len) + if (len > 0) { ensureUniqueBufferOfSize(len + 1, false, s, NULL); } @@ -307,7 +333,7 @@ void UnicodeString::truncateBy(const Int charCount) const size_t len = wcslen(peek()); if (len > 0) { - ensureUniqueBufferOfSize(len+1, true, NULL, NULL); + ensureUniqueBufferOfSize(len + 1, true, NULL, NULL); size_t count = charCount; if (charCount > len) { From 77feed8c30f6562ea0d035912af43809d5e8a411 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 31 Aug 2025 09:15:47 +0200 Subject: [PATCH 031/343] chore(string): Add strlcpy, strlcat family functions (#1477) Use them instead of strcpy and strncpy functions --- .../Source/WWVegas/WWLib/CMakeLists.txt | 1 + .../Libraries/Source/WWVegas/WWLib/WWCommon.h | 2 + Core/Libraries/Source/WWVegas/WWLib/bittype.h | 7 + .../Libraries/Source/WWVegas/WWLib/stringex.h | 184 ++++++++++++++++++ 4 files changed, 194 insertions(+) create mode 100644 Core/Libraries/Source/WWVegas/WWLib/stringex.h diff --git a/Core/Libraries/Source/WWVegas/WWLib/CMakeLists.txt b/Core/Libraries/Source/WWVegas/WWLib/CMakeLists.txt index 4198e37e324..62d95116929 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/CMakeLists.txt +++ b/Core/Libraries/Source/WWVegas/WWLib/CMakeLists.txt @@ -108,6 +108,7 @@ set(WWLIB_SRC stimer.h straw.cpp STRAW.H + stringex.h strtok_r.cpp strtok_r.h #swap.h diff --git a/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h b/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h index a4ed490128f..77218a12e2a 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h +++ b/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h @@ -18,6 +18,8 @@ #pragma once +#include + #if defined(_MSC_VER) && _MSC_VER < 1300 typedef unsigned MemValueType; #else diff --git a/Core/Libraries/Source/WWVegas/WWLib/bittype.h b/Core/Libraries/Source/WWVegas/WWLib/bittype.h index 4a6d73cfd36..365cd05fa28 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/bittype.h +++ b/Core/Libraries/Source/WWVegas/WWLib/bittype.h @@ -63,4 +63,11 @@ typedef const char * LPCSTR; typedef unsigned int UINT; typedef unsigned long ULONG; +#if defined(_MSC_VER) && _MSC_VER < 1300 +#ifndef _WCHAR_T_DEFINED +typedef unsigned short wchar_t; +#define _WCHAR_T_DEFINED +#endif +#endif + #endif //BITTYPE_H diff --git a/Core/Libraries/Source/WWVegas/WWLib/stringex.h b/Core/Libraries/Source/WWVegas/WWLib/stringex.h new file mode 100644 index 00000000000..fe452ac2182 --- /dev/null +++ b/Core/Libraries/Source/WWVegas/WWLib/stringex.h @@ -0,0 +1,184 @@ +/* +** Command & Conquer Generals Zero Hour(tm) +** Copyright 2025 TheSuperHackers +** +** This program is free software: you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation, either version 3 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program. If not, see . +*/ + +#pragma once + +#include "bittype.h" +#include + + +// Declaration + +template size_t strlen_t(const T *str); +template size_t strnlen_t(const T *str, size_t maxlen); + +#if defined(_MSC_VER) && _MSC_VER < 1300 +size_t strnlen(const char *str, size_t maxlen); +size_t wcsnlen(const wchar_t *str, size_t maxlen); +#endif + +template size_t strlcpy_t(T *dst, const T *src, size_t dstsize); +template size_t strlcat_t(T *dst, const T *src, size_t dstsize); + +size_t strlcpy(char *dst, const char *src, size_t dstsize); +size_t strlcat(char *dst, const char *src, size_t dstsize); +size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t dstsize); +size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t dstsize); + +template size_t strlmove_t(T *dst, const T *src, size_t dstsize); +template size_t strlmcat_t(T *dst, const T *src, size_t dstsize); + +size_t strlmove(char *dst, const char *src, size_t dstsize); +size_t strlmcat(char *dst, const char *src, size_t dstsize); +size_t wcslmove(wchar_t *dst, const wchar_t *src, size_t dstsize); +size_t wcslmcat(wchar_t *dst, const wchar_t *src, size_t dstsize); + +#if !(defined(_MSC_VER) && _MSC_VER < 1300) +template size_t strlcpy_t(char (&dst)[Size], const char *src); +template size_t strlcat_t(char (&dst)[Size], const char *src); +template size_t strlmove_t(char (&dst)[Size], const char *src); +template size_t strlmcat_t(char (&dst)[Size], const char *src); +#endif + + +// Implementation + +// Templated strlen. +// Returns the number of characters until the first zero character. +template size_t strlen_t(const T *str) +{ + const T* begin = str; + while (*str) + ++str; + return static_cast(str - begin); +} + +// Templated strlen. +// Returns the number of characters until the first zero character or when maxlen is reached. +template size_t strnlen_t(const T *str, size_t maxlen) +{ + const T* begin = str; + const T* end = str + maxlen; + while (str < end && *str) + ++str; + return static_cast(str - begin); +} + +#if defined(_MSC_VER) && _MSC_VER < 1300 +inline size_t strnlen(const char *str, size_t maxlen) { return strnlen_t(str, maxlen); } +inline size_t wcsnlen(const wchar_t *str, size_t maxlen) { return strnlen_t(str, maxlen); } +#endif + +// Templated strlcpy. Prefer using this over strncpy. +// Copies src into dst until dstsize minus one. Always null terminates. +// Returns the length of src, excluding the null terminator. +template size_t strlcpy_t(T *dst, const T *src, size_t dstsize) +{ + const size_t srclen = strlen_t(src); + if (dstsize != 0) + { + size_t copylen = (srclen >= dstsize) ? dstsize - 1 : srclen; + memcpy(dst, src, copylen * sizeof(T)); + dst[copylen] = T(0); + } + return srclen; // length tried to create +} + +// Templated strlcat. Prefer using this over strncpy. +// Appends src into dst until dstsize minus one. Always null terminates. +// Returns the length of dst + src, excluding the null terminator. +template size_t strlcat_t(T *dst, const T *src, size_t dstsize) +{ + const size_t dstlen = strnlen_t(dst, dstsize); + const size_t srclen = strlen_t(src); + if (dstlen == dstsize) + { + return dstsize + srclen; // no space to append + } + size_t copylen = dstsize - dstlen - 1; + if (copylen > srclen) + { + copylen = srclen; + } + if (copylen > 0) + { + memcpy(dst + dstlen, src, copylen * sizeof(T)); + dst[dstlen + copylen] = T(0); + } + return dstlen + srclen; // length tried to create +} + +#ifndef HAVE_STRLCPY +inline size_t strlcpy(char *dst, const char *src, size_t dstsize) { return strlcpy_t(dst, src, dstsize); } +#endif +#ifndef HAVE_STRLCAT +inline size_t strlcat(char *dst, const char *src, size_t dstsize) { return strlcat_t(dst, src, dstsize); } +#endif +inline size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t dstsize) { return strlcpy_t(dst, src, dstsize); } +inline size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t dstsize) { return strlcat_t(dst, src, dstsize); } + +// Templated strlmove. Prefer using this over strlcpy if dst and src overlap. +// Moves src into dst until dstsize minus one. Always null terminates. +// Returns the length of src, excluding the null terminator. +template size_t strlmove_t(T *dst, const T *src, size_t dstsize) +{ + const size_t srclen = strlen_t(src); + if (dstsize > 0) + { + size_t copylen = (srclen >= dstsize) ? dstsize - 1 : srclen; + memmove(dst, src, copylen * sizeof(T)); + dst[copylen] = T(0); + } + return srclen; // length tried to create +} + +// Templated strlmcat. Prefer using this over strlcat if dst and src overlap. +// Appends src into dst until dstsize minus one. Always null terminates. +// Returns the length of dst + src, excluding the null terminator. +template size_t strlmcat_t(T *dst, const T *src, size_t dstsize) +{ + const size_t dstlen = strnlen_t(dst, dstsize); + const size_t srclen = strlen_t(src); + if (dstlen == dstsize) + { + return dstsize + srclen; // no space to append + } + size_t copylen = dstsize - dstlen - 1; + if (copylen > srclen) + { + copylen = srclen; + } + if (copylen > 0) + { + memmove(dst + dstlen, src, copylen * sizeof(T)); + dst[dstlen + copylen] = T(0); + } + return dstlen + srclen; // length tried to create +} + +inline size_t strlmove(char *dst, const char *src, size_t dstsize) { return strlmove_t(dst, src, dstsize); } +inline size_t strlmcat(char *dst, const char *src, size_t dstsize) { return strlmcat_t(dst, src, dstsize); } +inline size_t wcslmove(wchar_t *dst, const wchar_t *src, size_t dstsize) { return strlmove_t(dst, src, dstsize); } +inline size_t wcslmcat(wchar_t *dst, const wchar_t *src, size_t dstsize) { return strlmcat_t(dst, src, dstsize); } + +#if !(defined(_MSC_VER) && _MSC_VER < 1300) +template size_t strlcpy_t(char (&dst)[Size], const char *src) { return strlcpy_t(dst, src, Size); } +template size_t strlcat_t(char (&dst)[Size], const char *src) { return strlcat_t(dst, src, Size); } +template size_t strlmove_t(char (&dst)[Size], const char *src) { return strlmove_t(dst, src, Size); } +template size_t strlmcat_t(char (&dst)[Size], const char *src) { return strlmcat_t(dst, src, Size); } +#endif From 841f603084b82a0559f206cfcb8fce61da88f8e0 Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Mon, 1 Sep 2025 14:33:47 +0100 Subject: [PATCH 032/343] perf: Simplify type conversion macros to reduce cost of game simulation by around 15% (#1512) --- .../Code/Libraries/Include/Lib/BaseType.h | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/GeneralsMD/Code/Libraries/Include/Lib/BaseType.h b/GeneralsMD/Code/Libraries/Include/Lib/BaseType.h index bcf178eb5be..7d8ec0176f1 100644 --- a/GeneralsMD/Code/Libraries/Include/Lib/BaseType.h +++ b/GeneralsMD/Code/Libraries/Include/Lib/BaseType.h @@ -142,16 +142,16 @@ __forceinline float fast_float_ceil(float f) } //------------------------------------------------------------------------------------------------- -#define REAL_TO_INT(x) ((Int)(fast_float2long_round(fast_float_trunc(x)))) -#define REAL_TO_UNSIGNEDINT(x) ((UnsignedInt)(fast_float2long_round(fast_float_trunc(x)))) -#define REAL_TO_SHORT(x) ((Short)(fast_float2long_round(fast_float_trunc(x)))) -#define REAL_TO_UNSIGNEDSHORT(x) ((UnsignedShort)(fast_float2long_round(fast_float_trunc(x)))) -#define REAL_TO_BYTE(x) ((Byte)(fast_float2long_round(fast_float_trunc(x)))) -#define REAL_TO_UNSIGNEDBYTE(x) ((UnsignedByte)(fast_float2long_round(fast_float_trunc(x)))) -#define REAL_TO_CHAR(x) ((Char)(fast_float2long_round(fast_float_trunc(x)))) -#define DOUBLE_TO_REAL(x) ((Real) (x)) -#define DOUBLE_TO_INT(x) ((Int) (fast_float2long_round(fast_float_trunc(x)))) -#define INT_TO_REAL(x) ((Real) (x)) +#define REAL_TO_INT(x) ((Int)(x)) +#define REAL_TO_UNSIGNEDINT(x) ((UnsignedInt)(x)) +#define REAL_TO_SHORT(x) ((Short)(x)) +#define REAL_TO_UNSIGNEDSHORT(x) ((UnsignedShort)(x)) +#define REAL_TO_BYTE(x) ((Byte)(x)) +#define REAL_TO_UNSIGNEDBYTE(x) ((UnsignedByte)(x)) +#define REAL_TO_CHAR(x) ((Char)(x)) +#define DOUBLE_TO_REAL(x) ((Real)(x)) +#define DOUBLE_TO_INT(x) ((Int)(x)) +#define INT_TO_REAL(x) ((Real)(x)) // once we've ceiled/floored, trunc and round are identical, and currently, round is faster... (srj) #define REAL_TO_INT_CEIL(x) (fast_float2long_round(fast_float_ceil(x))) From 5f3c02994df9ae7d28f52ec78fc29dfd942ea788 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Mon, 1 Sep 2025 23:35:10 +1000 Subject: [PATCH 033/343] tweak(controlbar): Show stealthed radar objects to observers (#1487) --- Generals/Code/GameEngine/Include/GameClient/ControlBar.h | 2 ++ .../Source/GameClient/GUI/ControlBar/ControlBar.cpp | 8 ++++++++ .../Source/W3DDevice/Common/System/W3DRadar.cpp | 3 ++- .../Code/GameEngine/Include/GameClient/ControlBar.h | 2 ++ .../Source/GameClient/GUI/ControlBar/ControlBar.cpp | 8 ++++++++ .../Source/W3DDevice/Common/System/W3DRadar.cpp | 3 ++- 6 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/ControlBar.h b/Generals/Code/GameEngine/Include/GameClient/ControlBar.h index 4a570a7f9eb..e5dbe966aed 100644 --- a/Generals/Code/GameEngine/Include/GameClient/ControlBar.h +++ b/Generals/Code/GameEngine/Include/GameClient/ControlBar.h @@ -733,6 +733,8 @@ class ControlBar : public SubsystemInterface /// Returns the currently viewed player. May return NULL if no player is selected while observing. Player* getCurrentlyViewedPlayer(); + /// Returns the relationship with the currently viewed player. May return NEUTRAL if no player is selected while observing. + Relationship getCurrentlyViewedPlayerRelationship(const Team* team); // ControlBarResizer *getControlBarResizer( void ) {return m_controlBarResizer;} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index cffdb8b5d4a..e8dfa02a847 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -165,6 +165,14 @@ Player* ControlBar::getCurrentlyViewedPlayer() return ThePlayerList->getLocalPlayer(); } +Relationship ControlBar::getCurrentlyViewedPlayerRelationship(const Team* team) +{ + if (Player* player = getCurrentlyViewedPlayer()) + return player->getRelationship(team); + + return NEUTRAL; +} + void ControlBar::populatePurchaseScience( Player* player ) { // TheInGameUI->deselectAllDrawables(); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp index a8764a7964f..b11703a516f 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp @@ -42,6 +42,7 @@ #include "GameLogic/Module/StealthUpdate.h" #include "GameClient/Color.h" +#include "GameClient/ControlBar.h" #include "GameClient/Display.h" #include "GameClient/GameClient.h" #include "GameClient/GameWindow.h" @@ -696,7 +697,7 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text if( !stealth ) continue; - if ( ThePlayerList->getLocalPlayer()->getRelationship(obj->getTeam()) == ENEMIES ) + if ( TheControlBar->getCurrentlyViewedPlayerRelationship(obj->getTeam()) == ENEMIES ) if( !obj->testStatus( OBJECT_STATUS_DETECTED ) && !stealth->isDisguised() ) skip = TRUE; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h index 4f95f8d4650..2cb95f51a0c 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h @@ -747,6 +747,8 @@ class ControlBar : public SubsystemInterface /// Returns the currently viewed player. May return NULL if no player is selected while observing. Player* getCurrentlyViewedPlayer(); + /// Returns the relationship with the currently viewed player. May return NEUTRAL if no player is selected while observing. + Relationship getCurrentlyViewedPlayerRelationship(const Team* team); // ControlBarResizer *getControlBarResizer( void ) {return m_controlBarResizer;} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 8e3582ee829..3c64691cec7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -166,6 +166,14 @@ Player* ControlBar::getCurrentlyViewedPlayer() return ThePlayerList->getLocalPlayer(); } +Relationship ControlBar::getCurrentlyViewedPlayerRelationship(const Team* team) +{ + if (Player* player = getCurrentlyViewedPlayer()) + return player->getRelationship(team); + + return NEUTRAL; +} + void ControlBar::populatePurchaseScience( Player* player ) { // TheInGameUI->deselectAllDrawables(); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp index 3e351de54af..83407118f43 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp @@ -40,6 +40,7 @@ #include "GameLogic/Object.h" #include "GameClient/Color.h" +#include "GameClient/ControlBar.h" #include "GameClient/Display.h" #include "GameClient/GameClient.h" #include "GameClient/GameWindow.h" @@ -690,7 +691,7 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text // Now it twinkles for any stealthed object, whether locally controlled or neutral-observier-viewed if( obj->testStatus( OBJECT_STATUS_STEALTHED ) ) { - if ( ThePlayerList->getLocalPlayer()->getRelationship(obj->getTeam()) == ENEMIES ) + if ( TheControlBar->getCurrentlyViewedPlayerRelationship(obj->getTeam()) == ENEMIES ) if( !obj->testStatus( OBJECT_STATUS_DETECTED ) && !obj->testStatus( OBJECT_STATUS_DISGUISED ) ) skip = TRUE; From 91a8dcaa94bed5ff2f582d2807fe723cf4b1b410 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Tue, 2 Sep 2025 16:34:32 +1000 Subject: [PATCH 034/343] fix(partition): Fix circle fill algorithm in PartitionManager (#1426) This reduces its cost by around 10% --- .../Source/GameLogic/Object/PartitionManager.cpp | 12 +++++++++++- .../Source/GameLogic/Object/PartitionManager.cpp | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index 322a35cd960..707ae611d22 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -1838,6 +1838,8 @@ void PartitionData::hLineCircle(Int x1, Int x2, Int y) } // ----------------------------------------------------------------------------- +// Marks all partition cells that intersect a circle of the given center and radius +// as covered by this object using a variation of the midpoint circle algorithm. void PartitionData::doCircleFill( Real centerX, Real centerY, @@ -1855,7 +1857,15 @@ void PartitionData::doCircleFill( Int y = cellRadius - 1; Int dec = 3 - 2*cellRadius; - for (Int x = 0; x < cellRadius; x++) + +#if RETAIL_COMPATIBLE_CRC + // Cell coverage diverges at radii >= 240 between algorithms. + Int end = cellRadius - 1; + Int& endRef = (cellRadius < 240) ? y : end; + for (Int x = 0; x <= endRef; ++x) +#else + for (Int x = 0; x <= y; ++x) +#endif { hLineCircle(cellCenterX - x, cellCenterX + x, cellCenterY + y); hLineCircle(cellCenterX - x, cellCenterX + x, cellCenterY - y); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index 8df97eb0c84..ff9b23dbee7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -1842,6 +1842,8 @@ void PartitionData::hLineCircle(Int x1, Int x2, Int y) } // ----------------------------------------------------------------------------- +// Marks all partition cells that intersect a circle of the given center and radius +// as covered by this object using a variation of the midpoint circle algorithm. void PartitionData::doCircleFill( Real centerX, Real centerY, @@ -1859,7 +1861,15 @@ void PartitionData::doCircleFill( Int y = cellRadius - 1; Int dec = 3 - 2*cellRadius; - for (Int x = 0; x < cellRadius; x++) + +#if RETAIL_COMPATIBLE_CRC + // Cell coverage diverges at radii >= 240 between algorithms. + Int end = cellRadius - 1; + Int& endRef = (cellRadius < 240) ? y : end; + for (Int x = 0; x <= endRef; ++x) +#else + for (Int x = 0; x <= y; ++x) +#endif { hLineCircle(cellCenterX - x, cellCenterX + x, cellCenterY + y); hLineCircle(cellCenterX - x, cellCenterX + x, cellCenterY - y); From 78a9efa9aa980413f9d38b1bf4a00c378dbe93fb Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Tue, 2 Sep 2025 16:42:04 +1000 Subject: [PATCH 035/343] bugfix(object): Healing no longer prevents stealthed objects from revealing when taking damage (#1508) Healing no longer ignores the STEALTH_WHILE_NOT_TAKING_DAMAGE object status --- Core/GameEngine/Include/Common/GameDefines.h | 4 ++++ .../GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp | 2 ++ .../GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp | 2 ++ .../Source/GameLogic/Object/Update/StealthUpdate.cpp | 2 ++ 4 files changed, 10 insertions(+) diff --git a/Core/GameEngine/Include/Common/GameDefines.h b/Core/GameEngine/Include/Common/GameDefines.h index 6f90600630b..0034feabdca 100644 --- a/Core/GameEngine/Include/Common/GameDefines.h +++ b/Core/GameEngine/Include/Common/GameDefines.h @@ -21,6 +21,10 @@ // Note: Retail compatibility must not be broken before this project officially does. // Use RETAIL_COMPATIBLE_CRC and RETAIL_COMPATIBLE_XFER_SAVE to guard breaking changes. +#ifndef RETAIL_COMPATIBLE_BUG +#define RETAIL_COMPATIBLE_BUG (1) // Retain bugs present in retail Generals 1.08 and Zero Hour 1.04 +#endif + #ifndef RETAIL_COMPATIBLE_CRC #define RETAIL_COMPATIBLE_CRC (1) // Game is expected to be CRC compatible with retail Generals 1.08, Zero Hour 1.04 #endif diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp index 5f7598233a6..03cf4f1c627 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp @@ -593,7 +593,9 @@ void ActiveBody::attemptHealing( DamageInfo *damageInfo ) //(object pointer loses scope as soon as atteptdamage's caller ends) m_lastDamageInfo = *damageInfo; m_lastDamageCleared = false; +#if RETAIL_COMPATIBLE_BUG m_lastDamageTimestamp = TheGameLogic->getFrame(); +#endif m_lastHealingTimestamp = TheGameLogic->getFrame(); // if our health has gone UP then do run the damage module callback diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp index a019ebf2edb..2f9a62f1398 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp @@ -835,7 +835,9 @@ void ActiveBody::attemptHealing( DamageInfo *damageInfo ) //(object pointer loses scope as soon as atteptdamage's caller ends) m_lastDamageInfo = *damageInfo; m_lastDamageCleared = false; +#if RETAIL_COMPATIBLE_BUG m_lastDamageTimestamp = TheGameLogic->getFrame(); +#endif m_lastHealingTimestamp = TheGameLogic->getFrame(); // if our health has gone UP then do run the damage module callback diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp index fdf36d31792..f4c3feae1e1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp @@ -317,8 +317,10 @@ Bool StealthUpdate::allowedToStealth( Object *stealthOwner ) const if( flags & STEALTH_NOT_WHILE_TAKING_DAMAGE && self->getBodyModule()->getLastDamageTimestamp() >= now - 1 ) { +#if RETAIL_COMPATIBLE_BUG //Only if it's not healing damage. if( self->getBodyModule()->getLastDamageInfo()->in.m_damageType != DAMAGE_HEALING ) +#endif { //Can't stealth if we just took damage in the last frame or two. if( self->getBodyModule()->getLastDamageTimestamp() != 0xffffffff ) From 9debceedd975fdc6308ef971961e2c323f9b5a76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mat=C3=ADa=20Rodr=C3=ADguez?= Date: Tue, 2 Sep 2025 07:46:42 +0100 Subject: [PATCH 036/343] fix(compress): Fix a few memory leaks on fail conditions in Compression code (#1509) --- .../Source/Compression/EAC/btreeencode.cpp | 11 +++++++-- .../Source/Compression/EAC/refencode.cpp | 5 +++- .../Compression/LZHCompress/NoxCompress.cpp | 24 +++++++++++-------- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/Core/Libraries/Source/Compression/EAC/btreeencode.cpp b/Core/Libraries/Source/Compression/EAC/btreeencode.cpp index 0ffbe0bae1a..0afc2cfa57f 100644 --- a/Core/Libraries/Source/Compression/EAC/btreeencode.cpp +++ b/Core/Libraries/Source/Compression/EAC/btreeencode.cpp @@ -367,11 +367,18 @@ static void BTREE_treepack(struct BTreeEncodeContext *EC, EC->buf1 = (unsigned char *) galloc(buf1size); if (!EC->buf1) - return; /* failure Insufficient memory for work buffer */ + { + gfree(treebuf); + return; /* failure Insufficient memory for work buffer */ + } EC->buf2 = (unsigned char *) galloc(buf2size); if (!EC->buf2) - return; /* failure Insufficient memory for work buffer */ + { + gfree(treebuf); + gfree(EC->buf1); + return; /* failure Insufficient memory for work buffer */ + } memcpy(EC->buf1, EC->buffer, EC->ulen); /* copy to scratch buffer */ diff --git a/Core/Libraries/Source/Compression/EAC/refencode.cpp b/Core/Libraries/Source/Compression/EAC/refencode.cpp index f88414d7891..2f12606d5c6 100644 --- a/Core/Libraries/Source/Compression/EAC/refencode.cpp +++ b/Core/Libraries/Source/Compression/EAC/refencode.cpp @@ -79,7 +79,10 @@ static int refcompress(unsigned char *from, int len, unsigned char *dest, int ma return(0); link = (int *) galloc(131072L*sizeof(int)); if (!link) - return(0); + { + gfree(hashtbl); + return(0); + } memset(hashtbl,-1,65536L*sizeof(int)); diff --git a/Core/Libraries/Source/Compression/LZHCompress/NoxCompress.cpp b/Core/Libraries/Source/Compression/LZHCompress/NoxCompress.cpp index 771000eecf0..45aa2b7dc8a 100644 --- a/Core/Libraries/Source/Compression/LZHCompress/NoxCompress.cpp +++ b/Core/Libraries/Source/Compression/LZHCompress/NoxCompress.cpp @@ -69,7 +69,11 @@ Bool DecompressFile (char *infile, char *outfile) outBlock= (char *) DbgMalloc( rawSize ); if (( inBlock == NULL ) || ( outBlock == NULL )) + { + if (inBlock) DbgFree(inBlock); + if (outBlock) DbgFree(outBlock); return FALSE; + } // Read in a big chunk o file NoxRead(inBlock, 1, compressedSize, inFilePtr); @@ -97,21 +101,19 @@ Bool DecompressFile (char *infile, char *outfile) DEBUG_LOG(("Decompressed %s to %s, output size = %d", infile, outfile, rawSize)); + Bool success = FALSE; LZHLDestroyDecompressor(decompress); outFilePtr = fopen(outfile, "wb"); if (outFilePtr) { fwrite (outBlock, rawSize, 1, outFilePtr); fclose(outFilePtr); + success = TRUE; } - else - return FALSE; - // Clean up this mess DbgFree(inBlock); DbgFree(outBlock); - return TRUE; - + return success; } // End of if fileptr return FALSE; @@ -148,7 +150,11 @@ Bool CompressFile (char *infile, char *outfile) outBlock= (char *) DbgMalloc( LZHLCompressorCalcMaxBuf( rawSize )); if (( inBlock == NULL ) || ( outBlock == NULL )) + { + DbgFree(inBlock); + DbgFree(outBlock); return FALSE; + } // Read in a big chunk o file NoxRead(inBlock, 1, rawSize, inFilePtr); @@ -164,8 +170,8 @@ Bool CompressFile (char *infile, char *outfile) compressedSize += compressed; } + Bool success = FALSE; LZHLDestroyCompressor(compressor); - outFilePtr = fopen(outfile, "wb"); if (outFilePtr) { @@ -173,14 +179,12 @@ Bool CompressFile (char *infile, char *outfile) fwrite(&rawSize, sizeof(UnsignedInt), 1, outFilePtr); fwrite(outBlock, compressedSize, 1, outFilePtr); fclose(outFilePtr); + success = TRUE; } - else - return FALSE; - // Clean up DbgFree(inBlock); DbgFree(outBlock); - return TRUE; + return success; } return FALSE; From 4de89c35f55689d3615f506132f7e177e9e11a4e Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Wed, 3 Sep 2025 04:46:16 +1000 Subject: [PATCH 037/343] bugfix(input): Prevent drag-selecting enemy beacons and enable selecting stealthed units while observing (#1460) --- .../Source/GameClient/SelectionInfo.cpp | 12 ++++++ .../Source/GameClient/SelectionInfo.cpp | 39 ++++++++----------- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/SelectionInfo.cpp b/Generals/Code/GameEngine/Source/GameClient/SelectionInfo.cpp index 23dbf62aba3..40ef45b6e9a 100644 --- a/Generals/Code/GameEngine/Source/GameClient/SelectionInfo.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/SelectionInfo.cpp @@ -347,6 +347,18 @@ Bool addDrawableToList( Drawable *draw, void *userData ) if (!pds->drawableListToFill) return FALSE; +#if !RTS_GENERALS || !RETAIL_COMPATIBLE_BUG + // TheSuperHackers @info + // In retail, drag-selecting allows the player to select stealthed objects and objects through the + // fog. Some players exploit this bug to determine where an opponent's units are and consider this + // an important feature and an advanced skill to pull off, so we must leave the exploit. + if (draw->getFullyObscuredByShroud()) + return FALSE; + + if (draw->isDrawableEffectivelyHidden()) + return FALSE; +#endif + if (!draw->getTemplate()->isAnyKindOf(pds->kindofsToMatch)) return FALSE; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp index 58127512802..0ae9f087d96 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp @@ -349,6 +349,14 @@ Bool addDrawableToList( Drawable *draw, void *userData ) if (!pds->drawableListToFill) return FALSE; +#if !RTS_GENERALS || !RETAIL_COMPATIBLE_BUG + if (draw->getFullyObscuredByShroud()) + return FALSE; + + if (draw->isDrawableEffectivelyHidden()) + return FALSE; +#endif + if (!draw->getTemplate()->isAnyKindOf(pds->kindofsToMatch)) return FALSE; @@ -368,28 +376,15 @@ Bool addDrawableToList( Drawable *draw, void *userData ) return FALSE; } - //Kris: Aug 9, 2003!!! Wow, this bug has been around a LONG time!! - //Basically, it was possible to drag select a single enemy/neutral unit even if you couldn't see it - //including stealthed units. - const Object *obj = draw->getObject(); - if( obj ) - { - const Player *player = ThePlayerList->getLocalPlayer(); - Relationship rel = player->getRelationship( obj->getTeam() ); - if( rel == NEUTRAL || rel == ENEMIES ) - { - if( obj->getShroudedStatus( player->getPlayerIndex() ) >= OBJECTSHROUD_FOGGED ) - { - return FALSE; - } - - //If stealthed, no way! - if( obj->testStatus( OBJECT_STATUS_STEALTHED ) && !obj->testStatus( OBJECT_STATUS_DETECTED ) ) - { - return FALSE; - } - } - } +#if !RTS_GENERALS && RETAIL_COMPATIBLE_BUG + // TheSuperHackers @info + // In retail, hidden objects such as passengers are included here when drag-selected, which causes + // enemy selection logic to exit early (only 1 enemy unit can be selected at a time). Some players + // exploit this bug to determine if a transport contains passengers and consider this an important + // feature and an advanced skill to pull off, so we must leave the exploit. + if (draw->getObject() && draw->getObject()->getContain() && draw->getObject()->getContain()->getContainCount() > 0) + pds->drawableListToFill->push_back(draw); // Just add the unit twice to prevent enemy selections +#endif pds->drawableListToFill->push_back(draw); return TRUE; From 7c2ff2ab2cbffc46b8e9857f749b0d09aea6e89a Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Wed, 3 Sep 2025 16:56:25 +1000 Subject: [PATCH 038/343] refactor(gui): Simplify find window under mouse logic (#1520) --- .../Include/GameClient/GameWindowManager.h | 4 + .../GameClient/GUI/GameWindowManager.cpp | 137 +++++------------- .../Include/GameClient/GameWindowManager.h | 4 + .../GameClient/GUI/GameWindowManager.cpp | 137 +++++------------- 4 files changed, 84 insertions(+), 198 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h b/Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h index 97546c9f1ab..b0e3771e685 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h +++ b/Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h @@ -256,6 +256,10 @@ friend class GameWindow; virtual GameWindow *winGetGrabWindow( void ); ///< who is currently 'held' by mouse virtual void winSetLoneWindow( GameWindow *window ); ///< set the open window + // Finds the top-level window at the mouse position that matches the required and forbidden status masks. + virtual GameWindow* findWindowUnderMouse(GameWindow*& toolTipWindow, const ICoord2D* mousePos, unsigned int requiredStatusMask, unsigned int forbiddenStatusMask); + static bool isMouseWithinWindow(GameWindow* window, const ICoord2D* mousePos, unsigned int requiredStatusMask, unsigned int forbiddenStatusMask); + virtual Bool isEnabled( GameWindow *win ); ///< is window or parents enabled virtual Bool isHidden( GameWindow *win ); ///< is parent or parents hidden virtual void addWindowToParent( GameWindow *window, GameWindow *parent ); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp index fd9fd4289ee..3d87c3abd2c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp @@ -837,7 +837,6 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms UnsignedInt packedMouseCoords; GameWindow *window = NULL; GameWindow *toolTipWindow = NULL; - GameWindow *childWindow; Int dx, dy; Bool clearGrabWindow = FALSE; @@ -1006,111 +1005,16 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms } else { - - /**@todo Colin, there are 3 cases here that are nearly identical code, - break them up into functions with parameters */ - // search for top-level window which contains pointer - for( window = m_windowList; window; window = window->m_next ) - { - - if( BitIsSet( window->m_status, WIN_STATUS_ABOVE ) && - !BitIsSet( window->m_status, WIN_STATUS_HIDDEN ) && - mousePos->x >= window->m_region.lo.x && - mousePos->x <= window->m_region.hi.x && - mousePos->y >= window->m_region.lo.y && - mousePos->y <= window->m_region.hi.y) - { - - childWindow = window->winPointInAnyChild( mousePos->x, mousePos->y, TRUE, TRUE ); - if( toolTipWindow == NULL ) - { - if( childWindow->m_tooltip || - childWindow->m_instData.getTooltipTextLength() ) - { - toolTipWindow = childWindow; - } - } - if( BitIsSet( window->m_status, WIN_STATUS_ENABLED ) ) - { - // determine which child window the mouse is in - window = window->winPointInChild( mousePos->x, mousePos->y ); - break; // exit for - } - - } // end if - - } // end for window + window = findWindowUnderMouse(toolTipWindow, mousePos, WIN_STATUS_ABOVE, WIN_STATUS_HIDDEN); // check !above, below and hidden if( window == NULL ) - { - - for( window = m_windowList; window; window = window->m_next ) - { - - if( !BitIsSet( window->m_status, WIN_STATUS_ABOVE | - WIN_STATUS_BELOW | - WIN_STATUS_HIDDEN ) && - mousePos->x >= window->m_region.lo.x && - mousePos->x <= window->m_region.hi.x && - mousePos->y >= window->m_region.lo.y && - mousePos->y <= window->m_region.hi.y) - { - - childWindow = window->winPointInAnyChild( mousePos->x, mousePos->y, TRUE, TRUE ); - if( toolTipWindow == NULL ) - { - if( childWindow->m_tooltip || - childWindow->m_instData.getTooltipTextLength() ) - { - toolTipWindow = childWindow; - } - } - if( BitIsSet( window->m_status, WIN_STATUS_ENABLED )) - { - // determine which child window the mouse is in - window = window->winPointInChild( mousePos->x, mousePos->y ); - break; // exit for - } - } - } - } // end if, window == NULL + window = findWindowUnderMouse(toolTipWindow, mousePos, WIN_STATUS_NONE, WIN_STATUS_ABOVE | WIN_STATUS_BELOW | WIN_STATUS_HIDDEN); // check below and !hidden if( window == NULL ) - { - - for( window = m_windowList; window; window = window->m_next ) - { - - if( BitIsSet( window->m_status, WIN_STATUS_BELOW ) && - !BitIsSet( window->m_status, WIN_STATUS_HIDDEN ) && - mousePos->x >= window->m_region.lo.x && - mousePos->x <= window->m_region.hi.x && - mousePos->y >= window->m_region.lo.y && - mousePos->y <= window->m_region.hi.y) - { - - childWindow = window->winPointInAnyChild( mousePos->x, mousePos->y, TRUE, TRUE ); - if( toolTipWindow == NULL ) - { - if( childWindow->m_tooltip || - childWindow->m_instData.getTooltipTextLength() ) - { - toolTipWindow = childWindow; - } - } - if( BitIsSet( window->m_status, WIN_STATUS_ENABLED )) - { - // determine which child window the mouse is in - window = window->winPointInChild( mousePos->x, mousePos->y ); - break; // exit for - } - } - } - } // end if - + window = findWindowUnderMouse(toolTipWindow, mousePos, WIN_STATUS_BELOW, WIN_STATUS_HIDDEN); } // end else, no modal head if( window ) @@ -1273,6 +1177,41 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms } // end winProcessMouseEvent +bool GameWindowManager::isMouseWithinWindow(GameWindow* window, const ICoord2D* mousePos, unsigned int requiredStatusMask, unsigned int forbiddenStatusMask) +{ + return ((BitIsSet(window->m_status, requiredStatusMask) || requiredStatusMask == 0) && + !BitIsSet(window->m_status, forbiddenStatusMask) && + mousePos->x >= window->m_region.lo.x && + mousePos->x <= window->m_region.hi.x && + mousePos->y >= window->m_region.lo.y && + mousePos->y <= window->m_region.hi.y); +} + +GameWindow* GameWindowManager::findWindowUnderMouse(GameWindow*& toolTipWindow, const ICoord2D* mousePos, unsigned int requiredStatusMask, unsigned int forbiddenStatusMask) +{ + for (GameWindow* window = m_windowList; window; window = window->m_next) + { + if (!isMouseWithinWindow(window, mousePos, requiredStatusMask, forbiddenStatusMask)) + continue; + + if (toolTipWindow == NULL) + { + GameWindow* childWindow = window->winPointInAnyChild(mousePos->x, mousePos->y, TRUE, TRUE); + + if (childWindow->m_tooltip || childWindow->m_instData.getTooltipTextLength()) + toolTipWindow = childWindow; + } + + if (BitIsSet(window->m_status, WIN_STATUS_ENABLED)) + { + // determine which child window the mouse is in + return window->winPointInChild(mousePos->x, mousePos->y); + } + } + + return NULL; +} + //------------------------------------------------------------------------------------------------- /** Draw a window and its children, in parent-first order. * Children's coordinates are relative to their parents. diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowManager.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowManager.h index 6e263627d99..f523011bcd6 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowManager.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowManager.h @@ -256,6 +256,10 @@ friend class GameWindow; virtual GameWindow *winGetGrabWindow( void ); ///< who is currently 'held' by mouse virtual void winSetLoneWindow( GameWindow *window ); ///< set the open window + // Finds the top-level window at the mouse position that matches the required and forbidden status masks. + virtual GameWindow* findWindowUnderMouse(GameWindow*& toolTipWindow, const ICoord2D* mousePos, unsigned int requiredStatusMask, unsigned int forbiddenStatusMask); + static bool isMouseWithinWindow(GameWindow* window, const ICoord2D* mousePos, unsigned int requiredStatusMask, unsigned int forbiddenStatusMask); + virtual Bool isEnabled( GameWindow *win ); ///< is window or parents enabled virtual Bool isHidden( GameWindow *win ); ///< is parent or parents hidden virtual void addWindowToParent( GameWindow *window, GameWindow *parent ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp index c6576a26a5b..bd94164389f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp @@ -837,7 +837,6 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms UnsignedInt packedMouseCoords; GameWindow *window = NULL; GameWindow *toolTipWindow = NULL; - GameWindow *childWindow; Int dx, dy; Bool clearGrabWindow = FALSE; @@ -1006,111 +1005,16 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms } else { - - /**@todo Colin, there are 3 cases here that are nearly identical code, - break them up into functions with parameters */ - // search for top-level window which contains pointer - for( window = m_windowList; window; window = window->m_next ) - { - - if( BitIsSet( window->m_status, WIN_STATUS_ABOVE ) && - !BitIsSet( window->m_status, WIN_STATUS_HIDDEN ) && - mousePos->x >= window->m_region.lo.x && - mousePos->x <= window->m_region.hi.x && - mousePos->y >= window->m_region.lo.y && - mousePos->y <= window->m_region.hi.y) - { - - childWindow = window->winPointInAnyChild( mousePos->x, mousePos->y, TRUE, TRUE ); - if( toolTipWindow == NULL ) - { - if( childWindow->m_tooltip || - childWindow->m_instData.getTooltipTextLength() ) - { - toolTipWindow = childWindow; - } - } - if( BitIsSet( window->m_status, WIN_STATUS_ENABLED ) ) - { - // determine which child window the mouse is in - window = window->winPointInChild( mousePos->x, mousePos->y ); - break; // exit for - } - - } // end if - - } // end for window + window = findWindowUnderMouse(toolTipWindow, mousePos, WIN_STATUS_ABOVE, WIN_STATUS_HIDDEN); // check !above, below and hidden if( window == NULL ) - { - - for( window = m_windowList; window; window = window->m_next ) - { - - if( !BitIsSet( window->m_status, WIN_STATUS_ABOVE | - WIN_STATUS_BELOW | - WIN_STATUS_HIDDEN ) && - mousePos->x >= window->m_region.lo.x && - mousePos->x <= window->m_region.hi.x && - mousePos->y >= window->m_region.lo.y && - mousePos->y <= window->m_region.hi.y) - { - - childWindow = window->winPointInAnyChild( mousePos->x, mousePos->y, TRUE, TRUE ); - if( toolTipWindow == NULL ) - { - if( childWindow->m_tooltip || - childWindow->m_instData.getTooltipTextLength() ) - { - toolTipWindow = childWindow; - } - } - if( BitIsSet( window->m_status, WIN_STATUS_ENABLED )) - { - // determine which child window the mouse is in - window = window->winPointInChild( mousePos->x, mousePos->y ); - break; // exit for - } - } - } - } // end if, window == NULL + window = findWindowUnderMouse(toolTipWindow, mousePos, WIN_STATUS_NONE, WIN_STATUS_ABOVE | WIN_STATUS_BELOW | WIN_STATUS_HIDDEN); // check below and !hidden if( window == NULL ) - { - - for( window = m_windowList; window; window = window->m_next ) - { - - if( BitIsSet( window->m_status, WIN_STATUS_BELOW ) && - !BitIsSet( window->m_status, WIN_STATUS_HIDDEN ) && - mousePos->x >= window->m_region.lo.x && - mousePos->x <= window->m_region.hi.x && - mousePos->y >= window->m_region.lo.y && - mousePos->y <= window->m_region.hi.y) - { - - childWindow = window->winPointInAnyChild( mousePos->x, mousePos->y, TRUE, TRUE ); - if( toolTipWindow == NULL ) - { - if( childWindow->m_tooltip || - childWindow->m_instData.getTooltipTextLength() ) - { - toolTipWindow = childWindow; - } - } - if( BitIsSet( window->m_status, WIN_STATUS_ENABLED )) - { - // determine which child window the mouse is in - window = window->winPointInChild( mousePos->x, mousePos->y ); - break; // exit for - } - } - } - } // end if - + window = findWindowUnderMouse(toolTipWindow, mousePos, WIN_STATUS_BELOW, WIN_STATUS_HIDDEN); } // end else, no modal head if( window ) @@ -1273,6 +1177,41 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms } // end winProcessMouseEvent +bool GameWindowManager::isMouseWithinWindow(GameWindow* window, const ICoord2D* mousePos, unsigned int requiredStatusMask, unsigned int forbiddenStatusMask) +{ + return ((BitIsSet(window->m_status, requiredStatusMask) || requiredStatusMask == 0) && + !BitIsSet(window->m_status, forbiddenStatusMask) && + mousePos->x >= window->m_region.lo.x && + mousePos->x <= window->m_region.hi.x && + mousePos->y >= window->m_region.lo.y && + mousePos->y <= window->m_region.hi.y); +} + +GameWindow* GameWindowManager::findWindowUnderMouse(GameWindow*& toolTipWindow, const ICoord2D* mousePos, unsigned int requiredStatusMask, unsigned int forbiddenStatusMask) +{ + for (GameWindow* window = m_windowList; window; window = window->m_next) + { + if (!isMouseWithinWindow(window, mousePos, requiredStatusMask, forbiddenStatusMask)) + continue; + + if (toolTipWindow == NULL) + { + GameWindow* childWindow = window->winPointInAnyChild(mousePos->x, mousePos->y, TRUE, TRUE); + + if (childWindow->m_tooltip || childWindow->m_instData.getTooltipTextLength()) + toolTipWindow = childWindow; + } + + if (BitIsSet(window->m_status, WIN_STATUS_ENABLED)) + { + // determine which child window the mouse is in + return window->winPointInChild(mousePos->x, mousePos->y); + } + } + + return NULL; +} + //------------------------------------------------------------------------------------------------- /** Draw a window and its children, in parent-first order. * Children's coordinates are relative to their parents. From 362de7da5f8b0dd94b47e40fd3b0c8cb7b3b9d13 Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Wed, 3 Sep 2025 08:01:51 +0100 Subject: [PATCH 039/343] bugfix(team): Demote throw to assert in TeamFactory::createInactiveTeam for when a team prototype does not exist (#1515) --- .../Code/GameEngine/Source/Common/RTS/Team.cpp | 14 +++++++++----- .../Code/GameEngine/Source/Common/RTS/Team.cpp | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp index 31c48a041a6..f0ecec64af7 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp @@ -330,8 +330,10 @@ Call team->setActive() when all members are added. */ Team *TeamFactory::createInactiveTeam(const AsciiString& name) { TeamPrototype *tp = findTeamPrototype(name); - if (!tp) - throw ERROR_BAD_ARG; + if (!tp) { + DEBUG_CRASH(( "Team prototype '%s' does not exist", name.str() )); + return NULL; + } Team *t = NULL; if (tp->getIsSingleton()) @@ -362,9 +364,11 @@ Team *TeamFactory::createInactiveTeam(const AsciiString& name) // ------------------------------------------------------------------------ Team *TeamFactory::createTeam(const AsciiString& name) { - Team *t = NULL; - t = createInactiveTeam(name); - t->setActive(); + Team *t = createInactiveTeam(name); + + if (t) + t->setActive(); + return t; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp index 50f6f1076b0..6154f8d5514 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp @@ -330,8 +330,10 @@ Call team->setActive() when all members are added. */ Team *TeamFactory::createInactiveTeam(const AsciiString& name) { TeamPrototype *tp = findTeamPrototype(name); - if (!tp) - throw ERROR_BAD_ARG; + if (!tp) { + DEBUG_CRASH(( "Team prototype '%s' does not exist", name.str() )); + return NULL; + } Team *t = NULL; if (tp->getIsSingleton()) @@ -362,9 +364,11 @@ Team *TeamFactory::createInactiveTeam(const AsciiString& name) // ------------------------------------------------------------------------ Team *TeamFactory::createTeam(const AsciiString& name) { - Team *t = NULL; - t = createInactiveTeam(name); - t->setActive(); + Team *t = createInactiveTeam(name); + + if (t) + t->setActive(); + return t; } From 7e87594492aeb237fe4085d457f9c62defc7e488 Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Wed, 3 Sep 2025 08:44:54 +0100 Subject: [PATCH 040/343] feat(options): Add user configuration options for the Scroll Anchor feature (#1500) The Options.ini now offers new options DrawScrollAnchor=yes, MoveScrollAnchor=yes --- .../GameEngine/Include/Common/GlobalData.h | 2 + .../Include/Common/UserPreferences.h | 2 + .../GameEngine/Source/Common/GlobalData.cpp | 4 ++ .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 56 +++++++++++++++++-- .../GameEngine/Source/GameClient/InGameUI.cpp | 2 + .../GameEngine/Include/Common/GlobalData.h | 2 + .../Include/Common/UserPreferences.h | 2 + .../GameEngine/Source/Common/GlobalData.cpp | 4 ++ .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 56 +++++++++++++++++-- .../GameEngine/Source/GameClient/InGameUI.cpp | 2 + 10 files changed, 120 insertions(+), 12 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/GlobalData.h b/Generals/Code/GameEngine/Include/Common/GlobalData.h index 4b0314497c7..b904cd96d9d 100644 --- a/Generals/Code/GameEngine/Include/Common/GlobalData.h +++ b/Generals/Code/GameEngine/Include/Common/GlobalData.h @@ -364,6 +364,8 @@ class GlobalData : public SubsystemInterface Real m_keyboardScrollFactor; ///< Factor applied to game scrolling speed via keyboard scrolling Real m_keyboardDefaultScrollFactor; ///< Factor applied to game scrolling speed via keyboard scrolling + Bool m_drawScrollAnchor; ///< Set that the scroll anchor should be enabled + Bool m_moveScrollAnchor; ///< set that the scroll anchor should move Bool m_animateWindows; ///< Should we animate window transitions? diff --git a/Generals/Code/GameEngine/Include/Common/UserPreferences.h b/Generals/Code/GameEngine/Include/Common/UserPreferences.h index 85030853e06..22c6cdbc35f 100644 --- a/Generals/Code/GameEngine/Include/Common/UserPreferences.h +++ b/Generals/Code/GameEngine/Include/Common/UserPreferences.h @@ -92,6 +92,8 @@ class OptionPreferences : public UserPreferences void setOnlineIPAddress(UnsignedInt IP); // convenience function Bool getAlternateMouseModeEnabled(void); // convenience function Real getScrollFactor(void); // convenience function + Bool getDrawScrollAnchor(void); + Bool getMoveScrollAnchor(void); CursorCaptureMode getCursorCaptureMode() const; Bool getSendDelay(void); // convenience function Int getFirewallBehavior(void); // convenience function diff --git a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp index 24f9e0e342d..0ea488d11dc 100644 --- a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp @@ -982,6 +982,8 @@ GlobalData::GlobalData() m_loadScreenRender = FALSE; m_keyboardDefaultScrollFactor = m_keyboardScrollFactor = 0.5f; + m_drawScrollAnchor = FALSE; + m_moveScrollAnchor = FALSE; m_scrollAmountCutoff = 10.0f; m_cameraAdjustSpeed = 0.1f; m_enforceMaxCameraHeight = TRUE; @@ -1164,6 +1166,8 @@ void GlobalData::parseGameDataDefinition( INI* ini ) OptionPreferences optionPref; TheWritableGlobalData->m_useAlternateMouse = optionPref.getAlternateMouseModeEnabled(); TheWritableGlobalData->m_keyboardScrollFactor = optionPref.getScrollFactor(); + TheWritableGlobalData->m_drawScrollAnchor = optionPref.getDrawScrollAnchor(); + TheWritableGlobalData->m_moveScrollAnchor = optionPref.getMoveScrollAnchor(); TheWritableGlobalData->m_defaultIP = optionPref.getLANIPAddress(); TheWritableGlobalData->m_firewallSendDelay = optionPref.getSendDelay(); TheWritableGlobalData->m_firewallBehavior = optionPref.getFirewallBehavior(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index 47f8c34a922..b6d74b6f24e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -346,6 +346,32 @@ Real OptionPreferences::getScrollFactor(void) return factor/100.0f; } +Bool OptionPreferences::getDrawScrollAnchor(void) +{ + OptionPreferences::const_iterator it = find("DrawScrollAnchor"); + // TheSuperHackers @info this default is based on the same variable within InGameUi.ini + if (it == end()) + return FALSE; + + if (stricmp(it->second.str(), "yes") == 0) { + return TRUE; + } + return FALSE; +} + +Bool OptionPreferences::getMoveScrollAnchor(void) +{ + OptionPreferences::const_iterator it = find("MoveScrollAnchor"); + // TheSuperHackers @info this default is based on the same variable within InGameUi.ini + if (it == end()) + return TRUE; + + if (stricmp(it->second.str(), "yes") == 0) { + return TRUE; + } + return FALSE; +} + CursorCaptureMode OptionPreferences::getCursorCaptureMode() const { CursorCaptureMode mode = CursorCaptureMode_Default; @@ -1177,6 +1203,24 @@ static void saveOptions( void ) (*pref)["ScrollFactor"] = prefString; } + //------------------------------------------------------------------------------------------------- + // draw scroll anchor + { + if( TheInGameUI->getDrawRMBScrollAnchor() ) + (*pref)["DrawScrollAnchor"] = "yes"; + else + (*pref)["DrawScrollAnchor"] = "no"; + } + + //------------------------------------------------------------------------------------------------- + // move scroll anchor + { + if( TheInGameUI->getMoveRMBScrollAnchor() ) + (*pref)["MoveScrollAnchor"] = "yes"; + else + (*pref)["MoveScrollAnchor"] = "no"; + } + //------------------------------------------------------------------------------------------------- // slider music volume val = GadgetSliderGetPosition(sliderMusicVolume); @@ -1785,7 +1829,7 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) //set scroll options AsciiString test = (*pref)["DrawScrollAnchor"]; DEBUG_LOG(("DrawScrollAnchor == [%s]", test.str())); - if (test == "Yes" || (test.isEmpty() && TheInGameUI->getDrawRMBScrollAnchor())) + if (test == "yes" || (test.isEmpty() && TheInGameUI->getDrawRMBScrollAnchor())) { GadgetCheckBoxSetChecked( checkDrawAnchor, true); TheInGameUI->setDrawRMBScrollAnchor(true); @@ -1797,7 +1841,7 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) } test = (*pref)["MoveScrollAnchor"]; DEBUG_LOG(("MoveScrollAnchor == [%s]", test.str())); - if (test == "Yes" || (test.isEmpty() && TheInGameUI->getMoveRMBScrollAnchor())) + if (test == "yes" || (test.isEmpty() && TheInGameUI->getMoveRMBScrollAnchor())) { GadgetCheckBoxSetChecked( checkMoveAnchor, true); TheInGameUI->setMoveRMBScrollAnchor(true); @@ -2126,12 +2170,12 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, if( GadgetCheckBoxIsChecked( control ) ) { TheInGameUI->setDrawRMBScrollAnchor(true); - (*pref)["DrawScrollAnchor"] = "Yes"; + (*pref)["DrawScrollAnchor"] = "yes"; } else { TheInGameUI->setDrawRMBScrollAnchor(false); - (*pref)["DrawScrollAnchor"] = "No"; + (*pref)["DrawScrollAnchor"] = "no"; } } else if(controlID == checkMoveAnchorID ) @@ -2139,12 +2183,12 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, if( GadgetCheckBoxIsChecked( control ) ) { TheInGameUI->setMoveRMBScrollAnchor(true); - (*pref)["MoveScrollAnchor"] = "Yes"; + (*pref)["MoveScrollAnchor"] = "yes"; } else { TheInGameUI->setMoveRMBScrollAnchor(false); - (*pref)["MoveScrollAnchor"] = "No"; + (*pref)["MoveScrollAnchor"] = "no"; } } else if(controlID == checkSaveCameraID ) diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index 40dd7183ad6..a5c62d2b0bc 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -1186,6 +1186,8 @@ void InGameUI::init( void ) m_soloNexusSelectedDrawableID = INVALID_DRAWABLE_ID; + setDrawRMBScrollAnchor(TheGlobalData->m_drawScrollAnchor); + setMoveRMBScrollAnchor(TheGlobalData->m_moveScrollAnchor); } // end init diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h index ed3bbcc1d1d..aafc7316acb 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h @@ -372,6 +372,8 @@ class GlobalData : public SubsystemInterface Real m_keyboardScrollFactor; ///< Factor applied to game scrolling speed via keyboard scrolling Real m_keyboardDefaultScrollFactor; ///< Factor applied to game scrolling speed via keyboard scrolling + Bool m_drawScrollAnchor; ///< Set that the scroll anchor should be enabled + Bool m_moveScrollAnchor; ///< set that the scroll anchor should move Bool m_animateWindows; ///< Should we animate window transitions? diff --git a/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h b/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h index 9e4d83a4bf3..ac2c7e8cbaf 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h @@ -95,6 +95,8 @@ class OptionPreferences : public UserPreferences Bool getRetaliationModeEnabled(); // convenience function Bool getDoubleClickAttackMoveEnabled(void); // convenience function Real getScrollFactor(void); // convenience function + Bool getDrawScrollAnchor(void); + Bool getMoveScrollAnchor(void); CursorCaptureMode getCursorCaptureMode() const; Bool getSendDelay(void); // convenience function Int getFirewallBehavior(void); // convenience function diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp index be4b8962e27..a6b2303b83c 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp @@ -991,6 +991,8 @@ GlobalData::GlobalData() m_loadScreenRender = FALSE; m_keyboardDefaultScrollFactor = m_keyboardScrollFactor = 0.5f; + m_drawScrollAnchor = FALSE; + m_moveScrollAnchor = FALSE; m_scrollAmountCutoff = 10.0f; m_cameraAdjustSpeed = 0.1f; m_enforceMaxCameraHeight = TRUE; @@ -1192,6 +1194,8 @@ void GlobalData::parseGameDataDefinition( INI* ini ) TheWritableGlobalData->m_clientRetaliationModeEnabled = optionPref.getRetaliationModeEnabled(); TheWritableGlobalData->m_doubleClickAttackMove = optionPref.getDoubleClickAttackMoveEnabled(); TheWritableGlobalData->m_keyboardScrollFactor = optionPref.getScrollFactor(); + TheWritableGlobalData->m_drawScrollAnchor = optionPref.getDrawScrollAnchor(); + TheWritableGlobalData->m_moveScrollAnchor = optionPref.getMoveScrollAnchor(); TheWritableGlobalData->m_defaultIP = optionPref.getLANIPAddress(); TheWritableGlobalData->m_firewallSendDelay = optionPref.getSendDelay(); TheWritableGlobalData->m_firewallBehavior = optionPref.getFirewallBehavior(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index 2f4a306071e..b671e5c5fea 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -378,6 +378,32 @@ Real OptionPreferences::getScrollFactor(void) return factor/100.0f; } +Bool OptionPreferences::getDrawScrollAnchor(void) +{ + OptionPreferences::const_iterator it = find("DrawScrollAnchor"); + // TheSuperHackers @info this default is based on the same variable within InGameUi.ini + if (it == end()) + return FALSE; + + if (stricmp(it->second.str(), "yes") == 0) { + return TRUE; + } + return FALSE; +} + +Bool OptionPreferences::getMoveScrollAnchor(void) +{ + OptionPreferences::const_iterator it = find("MoveScrollAnchor"); + // TheSuperHackers @info this default is based on the same variable within InGameUi.ini + if (it == end()) + return TRUE; + + if (stricmp(it->second.str(), "yes") == 0) { + return TRUE; + } + return FALSE; +} + CursorCaptureMode OptionPreferences::getCursorCaptureMode() const { CursorCaptureMode mode = CursorCaptureMode_Default; @@ -1237,6 +1263,24 @@ static void saveOptions( void ) (*pref)["ScrollFactor"] = prefString; } + //------------------------------------------------------------------------------------------------- + // draw scroll anchor + { + if( TheInGameUI->getDrawRMBScrollAnchor() ) + (*pref)["DrawScrollAnchor"] = "yes"; + else + (*pref)["DrawScrollAnchor"] = "no"; + } + + //------------------------------------------------------------------------------------------------- + // move scroll anchor + { + if( TheInGameUI->getMoveRMBScrollAnchor() ) + (*pref)["MoveScrollAnchor"] = "yes"; + else + (*pref)["MoveScrollAnchor"] = "no"; + } + //------------------------------------------------------------------------------------------------- // slider music volume val = GadgetSliderGetPosition(sliderMusicVolume); @@ -1854,7 +1898,7 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) //set scroll options AsciiString test = (*pref)["DrawScrollAnchor"]; DEBUG_LOG(("DrawScrollAnchor == [%s]", test.str())); - if (test == "Yes" || (test.isEmpty() && TheInGameUI->getDrawRMBScrollAnchor())) + if (test == "yes" || (test.isEmpty() && TheInGameUI->getDrawRMBScrollAnchor())) { GadgetCheckBoxSetChecked( checkDrawAnchor, true); TheInGameUI->setDrawRMBScrollAnchor(true); @@ -1866,7 +1910,7 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) } test = (*pref)["MoveScrollAnchor"]; DEBUG_LOG(("MoveScrollAnchor == [%s]", test.str())); - if (test == "Yes" || (test.isEmpty() && TheInGameUI->getMoveRMBScrollAnchor())) + if (test == "yes" || (test.isEmpty() && TheInGameUI->getMoveRMBScrollAnchor())) { GadgetCheckBoxSetChecked( checkMoveAnchor, true); TheInGameUI->setMoveRMBScrollAnchor(true); @@ -2197,12 +2241,12 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, if( GadgetCheckBoxIsChecked( control ) ) { TheInGameUI->setDrawRMBScrollAnchor(true); - (*pref)["DrawScrollAnchor"] = "Yes"; + (*pref)["DrawScrollAnchor"] = "yes"; } else { TheInGameUI->setDrawRMBScrollAnchor(false); - (*pref)["DrawScrollAnchor"] = "No"; + (*pref)["DrawScrollAnchor"] = "no"; } } else if(controlID == checkMoveAnchorID ) @@ -2210,12 +2254,12 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, if( GadgetCheckBoxIsChecked( control ) ) { TheInGameUI->setMoveRMBScrollAnchor(true); - (*pref)["MoveScrollAnchor"] = "Yes"; + (*pref)["MoveScrollAnchor"] = "yes"; } else { TheInGameUI->setMoveRMBScrollAnchor(false); - (*pref)["MoveScrollAnchor"] = "No"; + (*pref)["MoveScrollAnchor"] = "no"; } } else if(controlID == checkSaveCameraID ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index 7d3cabbb85d..a297e567305 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -1216,6 +1216,8 @@ void InGameUI::init( void ) m_soloNexusSelectedDrawableID = INVALID_DRAWABLE_ID; + setDrawRMBScrollAnchor(TheGlobalData->m_drawScrollAnchor); + setMoveRMBScrollAnchor(TheGlobalData->m_moveScrollAnchor); } // end init From 06091295e481d6c2fd03b4ebf62cba0a35cbc77b Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Wed, 3 Sep 2025 23:09:10 +1000 Subject: [PATCH 041/343] tweak(command): Allow observer to view the Command Center of the currently observed player with a button press (#1524) The command to view the Command Center is bound to key H by default --- .../GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp | 2 +- .../GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index f7246fe90e0..4b122127281 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -884,7 +884,7 @@ void findCommandCenterOrMostExpensiveBuilding(Object* obj, void* vccl) static void viewCommandCenter( void ) { - Player* localPlayer = ThePlayerList->getLocalPlayer(); + Player* localPlayer = TheControlBar->getCurrentlyViewedPlayer(); if (!localPlayer) return; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 70aaeabe0ed..994d62e95f8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -943,7 +943,7 @@ void findCommandCenterOrMostExpensiveBuilding(Object* obj, void* vccl) static void viewCommandCenter( void ) { - Player* localPlayer = ThePlayerList->getLocalPlayer(); + Player* localPlayer = TheControlBar->getCurrentlyViewedPlayer(); if (!localPlayer) return; From 85fdc800168960b3ff06d9770a9515e542cf65a6 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 4 Sep 2025 09:43:44 +0200 Subject: [PATCH 042/343] fix(filesystem): Decouple File System from NameKeyGenerator and its CRC influence (#1516) --- Core/GameEngine/Include/Common/AsciiString.h | 4 + Core/GameEngine/Include/Common/FileSystem.h | 9 ++- .../GameEngine/Include/Common/UnicodeString.h | 4 + .../Source/Common/System/FileSystem.cpp | 18 ++--- .../Include/Common/NameKeyGenerator.h | 7 ++ .../GameEngine/Include/Common/STLTypedefs.h | 74 ++++++++++++++++++- .../Source/Common/NameKeyGenerator.cpp | 45 ++++++++++- .../Include/Common/NameKeyGenerator.h | 7 ++ .../GameEngine/Include/Common/STLTypedefs.h | 74 ++++++++++++++++++- .../Source/Common/NameKeyGenerator.cpp | 45 ++++++++++- 10 files changed, 268 insertions(+), 19 deletions(-) diff --git a/Core/GameEngine/Include/Common/AsciiString.h b/Core/GameEngine/Include/Common/AsciiString.h index 7c867bb1128..c024d549b98 100644 --- a/Core/GameEngine/Include/Common/AsciiString.h +++ b/Core/GameEngine/Include/Common/AsciiString.h @@ -114,6 +114,10 @@ class AsciiString public: + typedef Char value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + enum { MAX_FORMAT_BUF_LEN = 2048, ///< max total len of string created by format/format_va diff --git a/Core/GameEngine/Include/Common/FileSystem.h b/Core/GameEngine/Include/Common/FileSystem.h index 0d9dd7ff3cd..122a15526d3 100644 --- a/Core/GameEngine/Include/Common/FileSystem.h +++ b/Core/GameEngine/Include/Common/FileSystem.h @@ -54,6 +54,8 @@ #include "Common/STLTypedefs.h" #include "Common/SubsystemInterface.h" +#include + //---------------------------------------------------------------------------- // Forward References //---------------------------------------------------------------------------- @@ -117,7 +119,6 @@ struct FileInfo { * created when FileSystem::Open() gets called. */ //=============================== -#include class FileSystem : public SubsystemInterface { @@ -147,7 +148,11 @@ class FileSystem : public SubsystemInterface protected: #if ENABLE_FILESYSTEM_EXISTENCE_CACHE - mutable std::map m_fileExist; + typedef std::hash_map< + rts::string_key, bool, + rts::string_key_hash, + rts::string_key_equal > FileExistMap; + mutable FileExistMap m_fileExist; #endif }; diff --git a/Core/GameEngine/Include/Common/UnicodeString.h b/Core/GameEngine/Include/Common/UnicodeString.h index 1df7953d6c8..151e5d4a206 100644 --- a/Core/GameEngine/Include/Common/UnicodeString.h +++ b/Core/GameEngine/Include/Common/UnicodeString.h @@ -114,6 +114,10 @@ class UnicodeString public: + typedef WideChar value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + enum { MAX_FORMAT_BUF_LEN = 2048, ///< max total len of string created by format/format_va diff --git a/Core/GameEngine/Source/Common/System/FileSystem.cpp b/Core/GameEngine/Source/Common/System/FileSystem.cpp index a7fc8d2e904..7ce22ab9522 100644 --- a/Core/GameEngine/Source/Common/System/FileSystem.cpp +++ b/Core/GameEngine/Source/Common/System/FileSystem.cpp @@ -183,8 +183,7 @@ File* FileSystem::openFile( const Char *filename, Int access, size_t bufferSize #if ENABLE_FILESYSTEM_EXISTENCE_CACHE if (file != NULL && (file->getAccess() & File::CREATE)) { - unsigned key = TheNameKeyGenerator->nameToLowercaseKey(filename); - m_fileExist[key] = true; + m_fileExist[filename]=true; } #endif } @@ -206,29 +205,30 @@ Bool FileSystem::doesFileExist(const Char *filename) const USE_PERF_TIMER(FileSystem) #if ENABLE_FILESYSTEM_EXISTENCE_CACHE - unsigned key=TheNameKeyGenerator->nameToLowercaseKey(filename); - std::map::iterator i=m_fileExist.find(key); - if (i!=m_fileExist.end()) - return i->second; + { + FileExistMap::iterator i = m_fileExist.find(FileExistMap::key_type::temporary(filename)); + if (i!=m_fileExist.end()) + return i->second; + } #endif if (TheLocalFileSystem->doesFileExist(filename)) { #if ENABLE_FILESYSTEM_EXISTENCE_CACHE - m_fileExist[key]=true; + m_fileExist[filename]=true; #endif return TRUE; } if (TheArchiveFileSystem->doesFileExist(filename)) { #if ENABLE_FILESYSTEM_EXISTENCE_CACHE - m_fileExist[key]=true; + m_fileExist[filename]=true; #endif return TRUE; } #if ENABLE_FILESYSTEM_EXISTENCE_CACHE - m_fileExist[key]=false; + m_fileExist[filename]=false; #endif return FALSE; } diff --git a/Generals/Code/GameEngine/Include/Common/NameKeyGenerator.h b/Generals/Code/GameEngine/Include/Common/NameKeyGenerator.h index 7f2beb971a0..22ad72650c6 100644 --- a/Generals/Code/GameEngine/Include/Common/NameKeyGenerator.h +++ b/Generals/Code/GameEngine/Include/Common/NameKeyGenerator.h @@ -123,6 +123,13 @@ class NameKeyGenerator : public SubsystemInterface SOCKET_COUNT = 6473 }; +#if RTS_ZEROHOUR && RETAIL_COMPATIBLE_CRC + Bool addReservedKey(); +#endif + + NameKeyType nameToKeyImpl(const char* name); + NameKeyType nameToLowercaseKeyImpl(const char *name); + void freeSockets(); Bucket* m_sockets[SOCKET_COUNT]; ///< Catalog of all Buckets already generated diff --git a/Generals/Code/GameEngine/Include/Common/STLTypedefs.h b/Generals/Code/GameEngine/Include/Common/STLTypedefs.h index 8c14a14973c..28d42fe5127 100644 --- a/Generals/Code/GameEngine/Include/Common/STLTypedefs.h +++ b/Generals/Code/GameEngine/Include/Common/STLTypedefs.h @@ -177,10 +177,24 @@ namespace rts } }; + template<> struct hash + { + size_t operator()(const Char* s) const + { +#ifdef USING_STLPORT + std::hash hasher; + return hasher(s); +#else + std::hash hasher; + return hasher(s); +#endif + } + }; + // This is the equal_to overload for char* comparisons. We compare the // strings to determine whether they are equal or not. // Other overloads should go into specific header files, not here (unless - // they are ot be used in lots of places.) + // they are to be used in lots of places.) template<> struct equal_to { Bool operator()(const char* s1, const char* s2) const @@ -227,6 +241,62 @@ namespace rts return (__t1.compareNoCase(__t2) < 0); } }; -} + + // TheSuperHackers @info Structs to help create maps that can use C strings for + // lookups without the need to allocate a string. + template + struct string_key + { + typedef typename String::const_pointer const_pointer; + + static string_key temporary(const_pointer s) + { + string_key key; + key.cstr = s; + return key; + } + + string_key(const_pointer s) + : storage(s) + , cstr(storage.str()) + {} + + string_key(const String& s) + : storage(s) + , cstr(storage.str()) + {} + + const_pointer c_str() const + { + return cstr; + } + + private: + string_key() {} + + String storage; + const_pointer cstr; + }; + + template + struct string_key_hash + { + typedef typename String::const_pointer const_pointer; + size_t operator()(const string_key& key) const + { + return hash()(key.c_str()); + } + }; + + template + struct string_key_equal + { + bool operator()(const string_key& a, const string_key& b) const + { + return strcmp(a.c_str(), b.c_str()) == 0; + } + }; + +} // namespace rts #endif /* __STLTYPEDEFS_H__ */ diff --git a/Generals/Code/GameEngine/Source/Common/NameKeyGenerator.cpp b/Generals/Code/GameEngine/Source/Common/NameKeyGenerator.cpp index f87d9bd5465..4e7cde7d50d 100644 --- a/Generals/Code/GameEngine/Source/Common/NameKeyGenerator.cpp +++ b/Generals/Code/GameEngine/Source/Common/NameKeyGenerator.cpp @@ -123,7 +123,48 @@ AsciiString NameKeyGenerator::keyToName(NameKeyType key) } //------------------------------------------------------------------------------------------------- -NameKeyType NameKeyGenerator::nameToKey(const char* nameString) +#if RTS_ZEROHOUR && RETAIL_COMPATIBLE_CRC +// TheSuperHackers @info xezon 04/09/2025 This key reservation is required for CRC compatibility, +// because the name keys are somehow CRC relevant. It was originally used by the file exist cache +// of the file system in Zero Hour. +Bool NameKeyGenerator::addReservedKey() +{ + switch (m_nextID) + { + case 97: nameToLowercaseKeyImpl("Data\\English\\Language9x.ini"); return true; + case 98: nameToLowercaseKeyImpl("Data\\Audio\\Tracks\\English\\GLA_02.mp3"); return true; + case 99: nameToLowercaseKeyImpl("Data\\Audio\\Tracks\\GLA_02.mp3"); return true; + } + return false; +} +#endif + +//------------------------------------------------------------------------------------------------- +NameKeyType NameKeyGenerator::nameToKey(const char* name) +{ + const NameKeyType key = nameToKeyImpl(name); + +#if RTS_ZEROHOUR && RETAIL_COMPATIBLE_CRC + while (addReservedKey()); +#endif + + return key; +} + +//------------------------------------------------------------------------------------------------- +NameKeyType NameKeyGenerator::nameToLowercaseKey(const char *name) +{ + const NameKeyType key = nameToLowercaseKeyImpl(name); + +#if RTS_ZEROHOUR && RETAIL_COMPATIBLE_CRC + while (addReservedKey()); +#endif + + return key; +} + +//------------------------------------------------------------------------------------------------- +NameKeyType NameKeyGenerator::nameToKeyImpl(const char* nameString) { Bucket *b; @@ -171,7 +212,7 @@ NameKeyType NameKeyGenerator::nameToKey(const char* nameString) } // end nameToKey //------------------------------------------------------------------------------------------------- -NameKeyType NameKeyGenerator::nameToLowercaseKey(const char* nameString) +NameKeyType NameKeyGenerator::nameToLowercaseKeyImpl(const char* nameString) { Bucket *b; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/NameKeyGenerator.h b/GeneralsMD/Code/GameEngine/Include/Common/NameKeyGenerator.h index a9b01193ecd..394b41c59bf 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/NameKeyGenerator.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/NameKeyGenerator.h @@ -121,6 +121,13 @@ class NameKeyGenerator : public SubsystemInterface SOCKET_COUNT = 45007 }; +#if RTS_ZEROHOUR && RETAIL_COMPATIBLE_CRC + Bool addReservedKey(); +#endif + + NameKeyType nameToKeyImpl(const char* name); + NameKeyType nameToLowercaseKeyImpl(const char *name); + void freeSockets(); Bucket* m_sockets[SOCKET_COUNT]; ///< Catalog of all Buckets already generated diff --git a/GeneralsMD/Code/GameEngine/Include/Common/STLTypedefs.h b/GeneralsMD/Code/GameEngine/Include/Common/STLTypedefs.h index 47ca06e7bd1..d3ed133b238 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/STLTypedefs.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/STLTypedefs.h @@ -177,10 +177,24 @@ namespace rts } }; + template<> struct hash + { + size_t operator()(const Char* s) const + { +#ifdef USING_STLPORT + std::hash hasher; + return hasher(s); +#else + std::hash hasher; + return hasher(s); +#endif + } + }; + // This is the equal_to overload for char* comparisons. We compare the // strings to determine whether they are equal or not. // Other overloads should go into specific header files, not here (unless - // they are ot be used in lots of places.) + // they are to be used in lots of places.) template<> struct equal_to { Bool operator()(const char* s1, const char* s2) const @@ -227,6 +241,62 @@ namespace rts return (__t1.compareNoCase(__t2) < 0); } }; -} + + // TheSuperHackers @info Structs to help create maps that can use C strings for + // lookups without the need to allocate a string. + template + struct string_key + { + typedef typename String::const_pointer const_pointer; + + static string_key temporary(const_pointer s) + { + string_key key; + key.cstr = s; + return key; + } + + string_key(const_pointer s) + : storage(s) + , cstr(storage.str()) + {} + + string_key(const String& s) + : storage(s) + , cstr(storage.str()) + {} + + const_pointer c_str() const + { + return cstr; + } + + private: + string_key() {} + + String storage; + const_pointer cstr; + }; + + template + struct string_key_hash + { + typedef typename String::const_pointer const_pointer; + size_t operator()(const string_key& key) const + { + return hash()(key.c_str()); + } + }; + + template + struct string_key_equal + { + bool operator()(const string_key& a, const string_key& b) const + { + return strcmp(a.c_str(), b.c_str()) == 0; + } + }; + +} // namespace rts #endif /* __STLTYPEDEFS_H__ */ diff --git a/GeneralsMD/Code/GameEngine/Source/Common/NameKeyGenerator.cpp b/GeneralsMD/Code/GameEngine/Source/Common/NameKeyGenerator.cpp index 8f78dd69d5b..9d800933f55 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/NameKeyGenerator.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/NameKeyGenerator.cpp @@ -123,7 +123,48 @@ AsciiString NameKeyGenerator::keyToName(NameKeyType key) } //------------------------------------------------------------------------------------------------- -NameKeyType NameKeyGenerator::nameToKey(const char* nameString) +#if RTS_ZEROHOUR && RETAIL_COMPATIBLE_CRC +// TheSuperHackers @info xezon 04/09/2025 This key reservation is required for CRC compatibility, +// because the name keys are somehow CRC relevant. It was originally used by the file exist cache +// of the file system in Zero Hour. +Bool NameKeyGenerator::addReservedKey() +{ + switch (m_nextID) + { + case 97: nameToLowercaseKeyImpl("Data\\English\\Language9x.ini"); return true; + case 98: nameToLowercaseKeyImpl("Data\\Audio\\Tracks\\English\\GLA_02.mp3"); return true; + case 99: nameToLowercaseKeyImpl("Data\\Audio\\Tracks\\GLA_02.mp3"); return true; + } + return false; +} +#endif + +//------------------------------------------------------------------------------------------------- +NameKeyType NameKeyGenerator::nameToKey(const char* name) +{ + const NameKeyType key = nameToKeyImpl(name); + +#if RTS_ZEROHOUR && RETAIL_COMPATIBLE_CRC + while (addReservedKey()); +#endif + + return key; +} + +//------------------------------------------------------------------------------------------------- +NameKeyType NameKeyGenerator::nameToLowercaseKey(const char *name) +{ + const NameKeyType key = nameToLowercaseKeyImpl(name); + +#if RTS_ZEROHOUR && RETAIL_COMPATIBLE_CRC + while (addReservedKey()); +#endif + + return key; +} + +//------------------------------------------------------------------------------------------------- +NameKeyType NameKeyGenerator::nameToKeyImpl(const char* nameString) { Bucket *b; @@ -171,7 +212,7 @@ NameKeyType NameKeyGenerator::nameToKey(const char* nameString) } // end nameToKey //------------------------------------------------------------------------------------------------- -NameKeyType NameKeyGenerator::nameToLowercaseKey(const char* nameString) +NameKeyType NameKeyGenerator::nameToLowercaseKeyImpl(const char* nameString) { Bucket *b; From bd2699aad507fa2522e05e2c44412b27cd241525 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 4 Sep 2025 11:12:08 +0200 Subject: [PATCH 043/343] feat(ini): Implement optional INI lookup folders for all common game systems (#1476) For example the game will now not only load Data\INI\Armor.ini but also all *.ini files in Data\INI\Armor --- .../Source/Common/Audio/GameAudio.cpp | 22 +++--- .../Source/GameClient/VideoPlayer.cpp | 4 +- Core/Tools/MapCacheBuilder/Source/WinMain.cpp | 38 +++++----- Generals/Code/GameEngine/Include/Common/INI.h | 15 +++- .../Include/Common/SubsystemInterface.h | 2 +- .../GameEngine/Source/Common/GameEngine.cpp | 67 +++++++++-------- .../Code/GameEngine/Source/Common/GameLOD.cpp | 4 +- .../Code/GameEngine/Source/Common/INI/INI.cpp | 59 ++++++++++++--- .../Common/System/SubsystemInterface.cpp | 8 +- .../GameEngine/Source/GameClient/Credits.cpp | 2 +- .../Code/GameEngine/Source/GameClient/Eva.cpp | 2 +- .../GameClient/GUI/ControlBar/ControlBar.cpp | 6 +- .../GUI/ControlBar/ControlBarResizer.cpp | 2 +- .../GUI/ControlBar/ControlBarScheme.cpp | 8 +- .../GameClient/GUI/GameWindowTransitions.cpp | 2 +- .../Source/GameClient/GUI/HeaderTemplate.cpp | 4 +- .../Source/GameClient/GUI/Shell/Shell.cpp | 4 +- .../GameClient/GUI/Shell/ShellMenuScheme.cpp | 4 +- .../Source/GameClient/GameClient.cpp | 2 +- .../Source/GameClient/GlobalLanguage.cpp | 4 +- .../GameEngine/Source/GameClient/InGameUI.cpp | 2 +- .../Source/GameClient/Input/Mouse.cpp | 2 +- .../Source/GameClient/System/Anim2D.cpp | 2 +- .../GameClient/System/CampaignManager.cpp | 2 +- .../Source/GameClient/System/Image.cpp | 6 +- .../Source/GameClient/System/ParticleSys.cpp | 2 +- .../Source/GameLogic/System/GameLogic.cpp | 3 + .../GameNetwork/WOLBrowser/WebBrowser.cpp | 2 +- .../Tools/WorldBuilder/src/WorldBuilder.cpp | 44 +++++------ .../Code/GameEngine/Include/Common/INI.h | 15 +++- .../Include/Common/SubsystemInterface.h | 2 +- .../GameEngine/Source/Common/GameEngine.cpp | 73 ++++++++++--------- .../Code/GameEngine/Source/Common/GameLOD.cpp | 4 +- .../Code/GameEngine/Source/Common/INI/INI.cpp | 59 ++++++++++++--- .../Common/System/SubsystemInterface.cpp | 8 +- .../GameEngine/Source/GameClient/Credits.cpp | 2 +- .../Code/GameEngine/Source/GameClient/Eva.cpp | 2 +- .../GameClient/GUI/ChallengeGenerals.cpp | 2 +- .../GameClient/GUI/ControlBar/ControlBar.cpp | 6 +- .../GUI/ControlBar/ControlBarResizer.cpp | 2 +- .../GUI/ControlBar/ControlBarScheme.cpp | 8 +- .../GameClient/GUI/GameWindowTransitions.cpp | 2 +- .../Source/GameClient/GUI/HeaderTemplate.cpp | 4 +- .../Source/GameClient/GUI/Shell/Shell.cpp | 4 +- .../GameClient/GUI/Shell/ShellMenuScheme.cpp | 4 +- .../Source/GameClient/GameClient.cpp | 2 +- .../Source/GameClient/GlobalLanguage.cpp | 4 +- .../GameEngine/Source/GameClient/InGameUI.cpp | 2 +- .../Source/GameClient/Input/Mouse.cpp | 2 +- .../Source/GameClient/System/Anim2D.cpp | 2 +- .../GameClient/System/CampaignManager.cpp | 2 +- .../Source/GameClient/System/Image.cpp | 6 +- .../Source/GameClient/System/ParticleSys.cpp | 2 +- .../Source/GameLogic/System/GameLogic.cpp | 3 + .../GameNetwork/WOLBrowser/WebBrowser.cpp | 2 +- .../Tools/WorldBuilder/src/WorldBuilder.cpp | 46 ++++++------ 56 files changed, 355 insertions(+), 239 deletions(-) diff --git a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp index fd9a146fa24..a015cee7d0e 100644 --- a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp +++ b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp @@ -213,22 +213,22 @@ AudioManager::~AudioManager() void AudioManager::init() { INI ini; - ini.load( AsciiString( "Data\\INI\\AudioSettings.ini" ), INI_LOAD_OVERWRITE, NULL); + ini.loadFileDirectory( AsciiString( "Data\\INI\\AudioSettings" ), INI_LOAD_OVERWRITE, NULL); - ini.load( AsciiString( "Data\\INI\\Default\\Music.ini" ), INI_LOAD_OVERWRITE, NULL ); - ini.load( AsciiString( "Data\\INI\\Music.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Default\\Music" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Music" ), INI_LOAD_OVERWRITE, NULL ); - ini.load( AsciiString( "Data\\INI\\Default\\SoundEffects.ini" ), INI_LOAD_OVERWRITE, NULL ); - ini.load( AsciiString( "Data\\INI\\SoundEffects.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Default\\SoundEffects" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\SoundEffects" ), INI_LOAD_OVERWRITE, NULL ); - ini.load( AsciiString( "Data\\INI\\Default\\Speech.ini" ), INI_LOAD_OVERWRITE, NULL ); - ini.load( AsciiString( "Data\\INI\\Speech.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Default\\Speech" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Speech" ), INI_LOAD_OVERWRITE, NULL ); - ini.load( AsciiString( "Data\\INI\\Default\\Voice.ini" ), INI_LOAD_OVERWRITE, NULL ); - ini.load( AsciiString( "Data\\INI\\Voice.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Default\\Voice" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Voice" ), INI_LOAD_OVERWRITE, NULL ); - // do the miscellaneous sound files last so that we find the audioeventrts associated with the events. - ini.load( AsciiString( "Data\\INI\\MiscAudio.ini" ), INI_LOAD_OVERWRITE, NULL); + // do the miscellaneous sound files last so that we find the AudioEventRTS associated with the events. + ini.loadFileDirectory( AsciiString( "Data\\INI\\MiscAudio" ), INI_LOAD_OVERWRITE, NULL); // determine if one of the music tracks exists. Since their now BIGd, one implies all. // If they don't exist, then attempt to load them from the CD. diff --git a/Core/GameEngine/Source/GameClient/VideoPlayer.cpp b/Core/GameEngine/Source/GameClient/VideoPlayer.cpp index 1045618d5bf..e4b2eacf531 100644 --- a/Core/GameEngine/Source/GameClient/VideoPlayer.cpp +++ b/Core/GameEngine/Source/GameClient/VideoPlayer.cpp @@ -182,8 +182,8 @@ void VideoPlayer::init( void ) // Load this here so that WB doesn't have to link to BinkLib, costing us (potentially) // an extra license. INI ini; - ini.load( AsciiString( "Data\\INI\\Default\\Video.ini" ), INI_LOAD_OVERWRITE, NULL ); - ini.load( AsciiString( "Data\\INI\\Video.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Default\\Video" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Video" ), INI_LOAD_OVERWRITE, NULL ); } //============================================================================ diff --git a/Core/Tools/MapCacheBuilder/Source/WinMain.cpp b/Core/Tools/MapCacheBuilder/Source/WinMain.cpp index b052612a945..1367d33e747 100644 --- a/Core/Tools/MapCacheBuilder/Source/WinMain.cpp +++ b/Core/Tools/MapCacheBuilder/Source/WinMain.cpp @@ -116,10 +116,10 @@ static SubsystemInterfaceList _TheSubsystemList; template -void initSubsystem(SUBSYSTEM*& sysref, SUBSYSTEM* sys, const char* path1 = NULL, const char* path2 = NULL, const char* dirpath = NULL) +void initSubsystem(SUBSYSTEM*& sysref, SUBSYSTEM* sys, const char* path1 = NULL, const char* path2 = NULL) { sysref = sys; - _TheSubsystemList.initSubsystem(sys, path1, path2, dirpath, NULL); + _TheSubsystemList.initSubsystem(sys, path1, path2, NULL); } /////////////////////////////////////////////////////////////////////////////// @@ -257,31 +257,31 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, initSubsystem(TheLocalFileSystem, (LocalFileSystem*)new Win32LocalFileSystem); initSubsystem(TheArchiveFileSystem, (ArchiveFileSystem*)new Win32BIGFileSystem); INI ini; - initSubsystem(TheWritableGlobalData, new GlobalData(), "Data\\INI\\Default\\GameData.ini", "Data\\INI\\GameData.ini"); + initSubsystem(TheWritableGlobalData, new GlobalData(), "Data\\INI\\Default\\GameData", "Data\\INI\\GameData"); initSubsystem(TheGameText, CreateGameTextInterface()); - initSubsystem(TheScienceStore, new ScienceStore(), "Data\\INI\\Default\\Science.ini", "Data\\INI\\Science.ini"); - initSubsystem(TheMultiplayerSettings, new MultiplayerSettings(), "Data\\INI\\Default\\Multiplayer.ini", "Data\\INI\\Multiplayer.ini"); - initSubsystem(TheTerrainTypes, new TerrainTypeCollection(), "Data\\INI\\Default\\Terrain.ini", "Data\\INI\\Terrain.ini"); - initSubsystem(TheTerrainRoads, new TerrainRoadCollection(), "Data\\INI\\Default\\Roads.ini", "Data\\INI\\Roads.ini"); + initSubsystem(TheScienceStore, new ScienceStore(), "Data\\INI\\Default\\Science", "Data\\INI\\Science"); + initSubsystem(TheMultiplayerSettings, new MultiplayerSettings(), "Data\\INI\\Default\\Multiplayer", "Data\\INI\\Multiplayer"); + initSubsystem(TheTerrainTypes, new TerrainTypeCollection(), "Data\\INI\\Default\\Terrain", "Data\\INI\\Terrain"); + initSubsystem(TheTerrainRoads, new TerrainRoadCollection(), "Data\\INI\\Default\\Roads", "Data\\INI\\Roads"); initSubsystem(TheScriptEngine, (ScriptEngine*)(new ScriptEngine())); initSubsystem(TheAudio, (AudioManager*)new MilesAudioManager()); initSubsystem(TheVideoPlayer, (VideoPlayerInterface*)(new VideoPlayer())); initSubsystem(TheModuleFactory, (ModuleFactory*)(new W3DModuleFactory())); initSubsystem(TheSidesList, new SidesList()); initSubsystem(TheCaveSystem, new CaveSystem()); - initSubsystem(TheRankInfoStore, new RankInfoStore(), NULL, "Data\\INI\\Rank.ini"); - initSubsystem(ThePlayerTemplateStore, new PlayerTemplateStore(), "Data\\INI\\Default\\PlayerTemplate.ini", "Data\\INI\\PlayerTemplate.ini"); - initSubsystem(TheSpecialPowerStore, new SpecialPowerStore(), "Data\\INI\\Default\\SpecialPower.ini", "Data\\INI\\SpecialPower.ini" ); + initSubsystem(TheRankInfoStore, new RankInfoStore(), NULL, "Data\\INI\\Rank"); + initSubsystem(ThePlayerTemplateStore, new PlayerTemplateStore(), "Data\\INI\\Default\\PlayerTemplate", "Data\\INI\\PlayerTemplate"); + initSubsystem(TheSpecialPowerStore, new SpecialPowerStore(), "Data\\INI\\Default\\SpecialPower", "Data\\INI\\SpecialPower" ); initSubsystem(TheParticleSystemManager, (ParticleSystemManager*)(new W3DParticleSystemManager())); - initSubsystem(TheFXListStore, new FXListStore(), "Data\\INI\\Default\\FXList.ini", "Data\\INI\\FXList.ini"); - initSubsystem(TheWeaponStore, new WeaponStore(), NULL, "Data\\INI\\Weapon.ini"); - initSubsystem(TheObjectCreationListStore, new ObjectCreationListStore(), "Data\\INI\\Default\\ObjectCreationList.ini", "Data\\INI\\ObjectCreationList.ini"); - initSubsystem(TheLocomotorStore, new LocomotorStore(), NULL, "Data\\INI\\Locomotor.ini"); - initSubsystem(TheDamageFXStore, new DamageFXStore(), NULL, "Data\\INI\\DamageFX.ini"); - initSubsystem(TheArmorStore, new ArmorStore(), NULL, "Data\\INI\\Armor.ini"); - initSubsystem(TheThingFactory, new ThingFactory(), "Data\\INI\\Default\\Object.ini", NULL, "Data\\INI\\Object"); - initSubsystem(TheCrateSystem, new CrateSystem(), "Data\\INI\\Default\\Crate.ini", "Data\\INI\\Crate.ini"); - initSubsystem(TheUpgradeCenter, new UpgradeCenter, "Data\\INI\\Default\\Upgrade.ini", "Data\\INI\\Upgrade.ini"); + initSubsystem(TheFXListStore, new FXListStore(), "Data\\INI\\Default\\FXList", "Data\\INI\\FXList"); + initSubsystem(TheWeaponStore, new WeaponStore(), NULL, "Data\\INI\\Weapon"); + initSubsystem(TheObjectCreationListStore, new ObjectCreationListStore(), "Data\\INI\\Default\\ObjectCreationList", "Data\\INI\\ObjectCreationList"); + initSubsystem(TheLocomotorStore, new LocomotorStore(), NULL, "Data\\INI\\Locomotor"); + initSubsystem(TheDamageFXStore, new DamageFXStore(), NULL, "Data\\INI\\DamageFX"); + initSubsystem(TheArmorStore, new ArmorStore(), NULL, "Data\\INI\\Armor"); + initSubsystem(TheThingFactory, new ThingFactory(), "Data\\INI\\Default\\Object", "Data\\INI\\Object"); + initSubsystem(TheCrateSystem, new CrateSystem(), "Data\\INI\\Default\\Crate", "Data\\INI\\Crate"); + initSubsystem(TheUpgradeCenter, new UpgradeCenter, "Data\\INI\\Default\\Upgrade", "Data\\INI\\Upgrade"); initSubsystem(TheAnim2DCollection, new Anim2DCollection ); //Init's itself. _TheSubsystemList.postProcessLoadAll(); diff --git a/Generals/Code/GameEngine/Include/Common/INI.h b/Generals/Code/GameEngine/Include/Common/INI.h index ff2762c9ecd..02ba66aa046 100644 --- a/Generals/Code/GameEngine/Include/Common/INI.h +++ b/Generals/Code/GameEngine/Include/Common/INI.h @@ -173,8 +173,19 @@ class INI INI(); ~INI(); - void loadDirectory( AsciiString dirName, Bool subdirs, INILoadType loadType, Xfer *pXfer ); ///< load directory of INI files - void load( AsciiString filename, INILoadType loadType, Xfer *pXfer ); ///< load INI file + // TheSuperHackers @feature xezon 19/08/2025 + // Load a specific INI file by name and/or INI files from a directory (and its subdirectories). + // For example "Data\INI\Armor" loads "Data\INI\Armor.ini" and all *.ini files in "Data\INI\Armor". + // Throws if not a single INI file is found or one is not read correctly. + UnsignedInt loadFileDirectory( AsciiString fileDirName, INILoadType loadType, Xfer *pXfer, Bool subdirs = TRUE ); + + // Load INI files from a directory (and its subdirectories). + // Throws if one INI file is not read correctly. + UnsignedInt loadDirectory( AsciiString dirName, INILoadType loadType, Xfer *pXfer, Bool subdirs = TRUE ); + + // Load one specific INI file by name. + // Throws if the INI file is not found or is not read correctly. + UnsignedInt load( AsciiString filename, INILoadType loadType, Xfer *pXfer ); static Bool isDeclarationOfType( AsciiString blockType, AsciiString blockName, char *bufferToCheck ); static Bool isEndOfBlock( char *bufferToCheck ); diff --git a/Generals/Code/GameEngine/Include/Common/SubsystemInterface.h b/Generals/Code/GameEngine/Include/Common/SubsystemInterface.h index b996e7d46e7..7f966730155 100644 --- a/Generals/Code/GameEngine/Include/Common/SubsystemInterface.h +++ b/Generals/Code/GameEngine/Include/Common/SubsystemInterface.h @@ -146,7 +146,7 @@ class SubsystemInterfaceList SubsystemInterfaceList(); ~SubsystemInterfaceList(); - void initSubsystem(SubsystemInterface* sys, const char* path1, const char* path2, const char* dirpath, Xfer *pXfer, AsciiString name=""); + void initSubsystem(SubsystemInterface* sys, const char* path1, const char* path2, Xfer *pXfer, AsciiString name=""); void addSubsystem(SubsystemInterface* sys); void removeSubsystem(SubsystemInterface* sys); void postProcessLoadAll(); diff --git a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp index 68e07ee8076..8f3d23e0b35 100644 --- a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp @@ -158,11 +158,16 @@ SubsystemInterfaceList* TheSubsystemList = NULL; //------------------------------------------------------------------------------------------------- template -void initSubsystem(SUBSYSTEM*& sysref, AsciiString name, SUBSYSTEM* sys, Xfer *pXfer, const char* path1 = NULL, - const char* path2 = NULL, const char* dirpath = NULL) +void initSubsystem( + SUBSYSTEM*& sysref, + AsciiString name, + SUBSYSTEM* sys, + Xfer *pXfer, + const char* path1 = NULL, + const char* path2 = NULL) { sysref = sys; - TheSubsystemList->initSubsystem(sys, path1, path2, dirpath, pXfer, name); + TheSubsystemList->initSubsystem(sys, path1, path2, pXfer, name); } //------------------------------------------------------------------------------------------------- @@ -440,14 +445,14 @@ void GameEngine::init() initSubsystem(TheArchiveFileSystem, "TheArchiveFileSystem", createArchiveFileSystem(), NULL); // this MUST come after TheLocalFileSystem creation DEBUG_ASSERTCRASH(TheWritableGlobalData,("TheWritableGlobalData expected to be created")); - initSubsystem(TheWritableGlobalData, "TheWritableGlobalData", TheWritableGlobalData, &xferCRC, "Data\\INI\\Default\\GameData.ini", "Data\\INI\\GameData.ini"); + initSubsystem(TheWritableGlobalData, "TheWritableGlobalData", TheWritableGlobalData, &xferCRC, "Data\\INI\\Default\\GameData", "Data\\INI\\GameData"); TheWritableGlobalData->parseCustomDefinition(); #if defined(RTS_DEBUG) // If we're in Debug, load the Debug settings as well. - ini.load( AsciiString( "Data\\INI\\GameDataDebug.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\GameDataDebug" ), INI_LOAD_OVERWRITE, NULL ); #endif // special-case: parse command-line parameters after loading global data @@ -474,18 +479,18 @@ void GameEngine::init() #endif // read the water settings from INI (must do prior to initing GameClient, apparently) - ini.load( AsciiString( "Data\\INI\\Default\\Water.ini" ), INI_LOAD_OVERWRITE, &xferCRC ); - ini.load( AsciiString( "Data\\INI\\Water.ini" ), INI_LOAD_OVERWRITE, &xferCRC ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Default\\Water" ), INI_LOAD_OVERWRITE, &xferCRC ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Water" ), INI_LOAD_OVERWRITE, &xferCRC ); #ifdef DEBUG_CRC - initSubsystem(TheDeepCRCSanityCheck, "TheDeepCRCSanityCheck", MSGNEW("GameEngineSubystem") DeepCRCSanityCheck, NULL, NULL, NULL, NULL); + initSubsystem(TheDeepCRCSanityCheck, "TheDeepCRCSanityCheck", MSGNEW("GameEngineSubystem") DeepCRCSanityCheck, NULL); #endif // DEBUG_CRC initSubsystem(TheGameText, "TheGameText", CreateGameTextInterface(), NULL); updateWindowTitle(); - initSubsystem(TheScienceStore,"TheScienceStore", MSGNEW("GameEngineSubsystem") ScienceStore(), &xferCRC, "Data\\INI\\Default\\Science.ini", "Data\\INI\\Science.ini"); - initSubsystem(TheMultiplayerSettings,"TheMultiplayerSettings", MSGNEW("GameEngineSubsystem") MultiplayerSettings(), &xferCRC, "Data\\INI\\Default\\Multiplayer.ini", "Data\\INI\\Multiplayer.ini"); - initSubsystem(TheTerrainTypes,"TheTerrainTypes", MSGNEW("GameEngineSubsystem") TerrainTypeCollection(), &xferCRC, "Data\\INI\\Default\\Terrain.ini", "Data\\INI\\Terrain.ini"); - initSubsystem(TheTerrainRoads,"TheTerrainRoads", MSGNEW("GameEngineSubsystem") TerrainRoadCollection(), &xferCRC, "Data\\INI\\Default\\Roads.ini", "Data\\INI\\Roads.ini"); + initSubsystem(TheScienceStore,"TheScienceStore", MSGNEW("GameEngineSubsystem") ScienceStore(), &xferCRC, "Data\\INI\\Default\\Science", "Data\\INI\\Science"); + initSubsystem(TheMultiplayerSettings,"TheMultiplayerSettings", MSGNEW("GameEngineSubsystem") MultiplayerSettings(), &xferCRC, "Data\\INI\\Default\\Multiplayer", "Data\\INI\\Multiplayer"); + initSubsystem(TheTerrainTypes,"TheTerrainTypes", MSGNEW("GameEngineSubsystem") TerrainTypeCollection(), &xferCRC, "Data\\INI\\Default\\Terrain", "Data\\INI\\Terrain"); + initSubsystem(TheTerrainRoads,"TheTerrainRoads", MSGNEW("GameEngineSubsystem") TerrainRoadCollection(), &xferCRC, "Data\\INI\\Default\\Roads", "Data\\INI\\Roads"); initSubsystem(TheGlobalLanguageData,"TheGlobalLanguageData",MSGNEW("GameEngineSubsystem") GlobalLanguage, NULL); // must be before the game text initSubsystem(TheCDManager,"TheCDManager", CreateCDManager(), NULL); initSubsystem(TheAudio,"TheAudio", TheGlobalData->m_headless ? NEW AudioManagerDummy : createAudioManager(), NULL); @@ -496,46 +501,46 @@ void GameEngine::init() initSubsystem(TheMessageStream,"TheMessageStream", createMessageStream(), NULL); initSubsystem(TheSidesList,"TheSidesList", MSGNEW("GameEngineSubsystem") SidesList(), NULL); initSubsystem(TheCaveSystem,"TheCaveSystem", MSGNEW("GameEngineSubsystem") CaveSystem(), NULL); - initSubsystem(TheRankInfoStore,"TheRankInfoStore", MSGNEW("GameEngineSubsystem") RankInfoStore(), &xferCRC, NULL, "Data\\INI\\Rank.ini"); - initSubsystem(ThePlayerTemplateStore,"ThePlayerTemplateStore", MSGNEW("GameEngineSubsystem") PlayerTemplateStore(), &xferCRC, "Data\\INI\\Default\\PlayerTemplate.ini", "Data\\INI\\PlayerTemplate.ini"); + initSubsystem(TheRankInfoStore,"TheRankInfoStore", MSGNEW("GameEngineSubsystem") RankInfoStore(), &xferCRC, NULL, "Data\\INI\\Rank"); + initSubsystem(ThePlayerTemplateStore,"ThePlayerTemplateStore", MSGNEW("GameEngineSubsystem") PlayerTemplateStore(), &xferCRC, "Data\\INI\\Default\\PlayerTemplate", "Data\\INI\\PlayerTemplate"); initSubsystem(TheParticleSystemManager,"TheParticleSystemManager", createParticleSystemManager(), NULL); - initSubsystem(TheFXListStore,"TheFXListStore", MSGNEW("GameEngineSubsystem") FXListStore(), &xferCRC, "Data\\INI\\Default\\FXList.ini", "Data\\INI\\FXList.ini"); - initSubsystem(TheWeaponStore,"TheWeaponStore", MSGNEW("GameEngineSubsystem") WeaponStore(), &xferCRC, NULL, "Data\\INI\\Weapon.ini"); - initSubsystem(TheObjectCreationListStore,"TheObjectCreationListStore", MSGNEW("GameEngineSubsystem") ObjectCreationListStore(), &xferCRC, "Data\\INI\\Default\\ObjectCreationList.ini", "Data\\INI\\ObjectCreationList.ini"); - initSubsystem(TheLocomotorStore,"TheLocomotorStore", MSGNEW("GameEngineSubsystem") LocomotorStore(), &xferCRC, NULL, "Data\\INI\\Locomotor.ini"); - initSubsystem(TheSpecialPowerStore,"TheSpecialPowerStore", MSGNEW("GameEngineSubsystem") SpecialPowerStore(), &xferCRC, "Data\\INI\\Default\\SpecialPower.ini", "Data\\INI\\SpecialPower.ini"); - initSubsystem(TheDamageFXStore,"TheDamageFXStore", MSGNEW("GameEngineSubsystem") DamageFXStore(), &xferCRC, NULL, "Data\\INI\\DamageFX.ini"); - initSubsystem(TheArmorStore,"TheArmorStore", MSGNEW("GameEngineSubsystem") ArmorStore(), &xferCRC, NULL, "Data\\INI\\Armor.ini"); + initSubsystem(TheFXListStore,"TheFXListStore", MSGNEW("GameEngineSubsystem") FXListStore(), &xferCRC, "Data\\INI\\Default\\FXList", "Data\\INI\\FXList"); + initSubsystem(TheWeaponStore,"TheWeaponStore", MSGNEW("GameEngineSubsystem") WeaponStore(), &xferCRC, NULL, "Data\\INI\\Weapon"); + initSubsystem(TheObjectCreationListStore,"TheObjectCreationListStore", MSGNEW("GameEngineSubsystem") ObjectCreationListStore(), &xferCRC, "Data\\INI\\Default\\ObjectCreationList", "Data\\INI\\ObjectCreationList"); + initSubsystem(TheLocomotorStore,"TheLocomotorStore", MSGNEW("GameEngineSubsystem") LocomotorStore(), &xferCRC, NULL, "Data\\INI\\Locomotor"); + initSubsystem(TheSpecialPowerStore,"TheSpecialPowerStore", MSGNEW("GameEngineSubsystem") SpecialPowerStore(), &xferCRC, "Data\\INI\\Default\\SpecialPower", "Data\\INI\\SpecialPower"); + initSubsystem(TheDamageFXStore,"TheDamageFXStore", MSGNEW("GameEngineSubsystem") DamageFXStore(), &xferCRC, NULL, "Data\\INI\\DamageFX"); + initSubsystem(TheArmorStore,"TheArmorStore", MSGNEW("GameEngineSubsystem") ArmorStore(), &xferCRC, NULL, "Data\\INI\\Armor"); initSubsystem(TheBuildAssistant,"TheBuildAssistant", MSGNEW("GameEngineSubsystem") BuildAssistant, NULL); - initSubsystem(TheThingFactory,"TheThingFactory", createThingFactory(), &xferCRC, "Data\\INI\\Default\\Object.ini", NULL, "Data\\INI\\Object"); - initSubsystem(TheUpgradeCenter,"TheUpgradeCenter", MSGNEW("GameEngineSubsystem") UpgradeCenter, &xferCRC, "Data\\INI\\Default\\Upgrade.ini", "Data\\INI\\Upgrade.ini"); + initSubsystem(TheThingFactory,"TheThingFactory", createThingFactory(), &xferCRC, "Data\\INI\\Default\\Object", "Data\\INI\\Object"); + initSubsystem(TheUpgradeCenter,"TheUpgradeCenter", MSGNEW("GameEngineSubsystem") UpgradeCenter, &xferCRC, "Data\\INI\\Default\\Upgrade", "Data\\INI\\Upgrade"); initSubsystem(TheGameClient,"TheGameClient", createGameClient(), NULL); - initSubsystem(TheAI,"TheAI", MSGNEW("GameEngineSubsystem") AI(), &xferCRC, "Data\\INI\\Default\\AIData.ini", "Data\\INI\\AIData.ini"); + initSubsystem(TheAI,"TheAI", MSGNEW("GameEngineSubsystem") AI(), &xferCRC, "Data\\INI\\Default\\AIData", "Data\\INI\\AIData"); initSubsystem(TheGameLogic,"TheGameLogic", createGameLogic(), NULL); initSubsystem(TheTeamFactory,"TheTeamFactory", MSGNEW("GameEngineSubsystem") TeamFactory(), NULL); - initSubsystem(TheCrateSystem,"TheCrateSystem", MSGNEW("GameEngineSubsystem") CrateSystem(), &xferCRC, "Data\\INI\\Default\\Crate.ini", "Data\\INI\\Crate.ini"); + initSubsystem(TheCrateSystem,"TheCrateSystem", MSGNEW("GameEngineSubsystem") CrateSystem(), &xferCRC, "Data\\INI\\Default\\Crate", "Data\\INI\\Crate"); initSubsystem(ThePlayerList,"ThePlayerList", MSGNEW("GameEngineSubsystem") PlayerList(), NULL); initSubsystem(TheRecorder,"TheRecorder", createRecorder(), NULL); initSubsystem(TheRadar,"TheRadar", TheGlobalData->m_headless ? NEW RadarDummy : createRadar(), NULL); initSubsystem(TheVictoryConditions,"TheVictoryConditions", createVictoryConditions(), NULL); AsciiString fname; - fname.format("Data\\%s\\CommandMap.ini", GetRegistryLanguage().str()); - initSubsystem(TheMetaMap,"TheMetaMap", MSGNEW("GameEngineSubsystem") MetaMap(), NULL, fname.str(), "Data\\INI\\CommandMap.ini"); + fname.format("Data\\%s\\CommandMap", GetRegistryLanguage().str()); + initSubsystem(TheMetaMap,"TheMetaMap", MSGNEW("GameEngineSubsystem") MetaMap(), NULL, fname.str(), "Data\\INI\\CommandMap"); TheMetaMap->generateMetaMap(); #if defined(RTS_DEBUG) - ini.load("Data\\INI\\CommandMapDebug.ini", INI_LOAD_MULTIFILE, NULL); + ini.loadFileDirectory("Data\\INI\\CommandMapDebug", INI_LOAD_MULTIFILE, NULL); #endif initSubsystem(TheActionManager,"TheActionManager", MSGNEW("GameEngineSubsystem") ActionManager(), NULL); //initSubsystem((CComObject *)TheWebBrowser,"(CComObject *)TheWebBrowser", (CComObject *)createWebBrowser(), NULL); - initSubsystem(TheGameStateMap,"TheGameStateMap", MSGNEW("GameEngineSubsystem") GameStateMap, NULL, NULL, NULL ); - initSubsystem(TheGameState,"TheGameState", MSGNEW("GameEngineSubsystem") GameState, NULL, NULL, NULL ); + initSubsystem(TheGameStateMap,"TheGameStateMap", MSGNEW("GameEngineSubsystem") GameStateMap, NULL ); + initSubsystem(TheGameState,"TheGameState", MSGNEW("GameEngineSubsystem") GameState, NULL ); // Create the interface for sending game results - initSubsystem(TheGameResultsQueue,"TheGameResultsQueue", GameResultsInterface::createNewGameResultsInterface(), NULL, NULL, NULL, NULL); + initSubsystem(TheGameResultsQueue,"TheGameResultsQueue", GameResultsInterface::createNewGameResultsInterface(), NULL); xferCRC.close(); TheWritableGlobalData->m_iniCRC = xferCRC.getCRC(); diff --git a/Generals/Code/GameEngine/Source/Common/GameLOD.cpp b/Generals/Code/GameEngine/Source/Common/GameLOD.cpp index 49b656644d8..2be8b54adab 100644 --- a/Generals/Code/GameEngine/Source/Common/GameLOD.cpp +++ b/Generals/Code/GameEngine/Source/Common/GameLOD.cpp @@ -266,10 +266,10 @@ void GameLODManager::init(void) { INI ini; //Get Presets for each LOD level. - ini.load( AsciiString( "Data\\INI\\GameLOD.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\GameLOD" ), INI_LOAD_OVERWRITE, NULL ); //Get presets for each known hardware configuration - ini.load( AsciiString( "Data\\INI\\GameLODPresets.ini"), INI_LOAD_OVERWRITE, NULL); + ini.loadFileDirectory( AsciiString( "Data\\INI\\GameLODPresets"), INI_LOAD_OVERWRITE, NULL); //Get Presets for custom LOD level by pulling them out of initial globaldata (which should //have all settings already applied). diff --git a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp index e8274f9ec15..c98194d98b8 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp @@ -198,13 +198,52 @@ INI::~INI( void ) } // end ~INI +//------------------------------------------------------------------------------------------------- +UnsignedInt INI::loadFileDirectory( AsciiString fileDirName, INILoadType loadType, Xfer *pXfer, Bool subdirs ) +{ + UnsignedInt filesRead = 0; + + AsciiString iniDir = fileDirName; + AsciiString iniFile = fileDirName; + + char ext[] = ".ini"; + + if (iniDir.endsWithNoCase(ext)) + { + iniDir.truncateBy(ARRAY_SIZE(ext)-1); + } + + if (!iniFile.endsWithNoCase(ext)) + { + iniFile.concat(ext); + } + + if (TheFileSystem->doesFileExist(iniFile.str())) + { + filesRead += load(iniFile, loadType, pXfer); + } + + // Load any additional ini files from a "filename" directory and its subdirectories. + filesRead += loadDirectory(iniDir, loadType, pXfer, subdirs); + + // Expect to open and load at least one file. + if (filesRead == 0) + { + throw INI_CANT_OPEN_FILE; + } + + return filesRead; +} + //------------------------------------------------------------------------------------------------- /** Load all INI files in the specified directory (and subdirectories if indicated). * If we are to load subdirectories, we will load them *after* we load all the * files in the current directory */ //------------------------------------------------------------------------------------------------- -void INI::loadDirectory( AsciiString dirName, Bool subdirs, INILoadType loadType, Xfer *pXfer ) +UnsignedInt INI::loadDirectory( AsciiString dirName, INILoadType loadType, Xfer *pXfer, Bool subdirs ) { + UnsignedInt filesRead = 0; + // sanity if( dirName.isEmpty() ) throw INI_INVALID_DIRECTORY; @@ -213,7 +252,7 @@ void INI::loadDirectory( AsciiString dirName, Bool subdirs, INILoadType loadType { FilenameList filenameList; dirName.concat('\\'); - TheFileSystem->getFileListInDirectory(dirName, "*.ini", filenameList, TRUE); + TheFileSystem->getFileListInDirectory(dirName, "*.ini", filenameList, subdirs); // Load the INI files in the dir now, in a sorted order. This keeps things the same between machines // in a network game. FilenameList::const_iterator it = filenameList.begin(); @@ -224,7 +263,7 @@ void INI::loadDirectory( AsciiString dirName, Bool subdirs, INILoadType loadType if ((tempname.find('\\') == NULL) && (tempname.find('/') == NULL)) { // this file doesn't reside in a subdirectory, load it first. - load( *it, loadType, pXfer ); + filesRead += load( *it, loadType, pXfer ); } ++it; } @@ -236,7 +275,7 @@ void INI::loadDirectory( AsciiString dirName, Bool subdirs, INILoadType loadType tempname = (*it).str() + dirName.getLength(); if ((tempname.find('\\') != NULL) || (tempname.find('/') != NULL)) { - load( *it, loadType, pXfer ); + filesRead += load( *it, loadType, pXfer ); } ++it; } @@ -247,7 +286,8 @@ void INI::loadDirectory( AsciiString dirName, Bool subdirs, INILoadType loadType throw; } -} // end loadDirectory + return filesRead; +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -277,7 +317,7 @@ void INI::prepFile( AsciiString filename, INILoadType loadType ) // save our filename m_filename = filename; - // save our load time + // save our load type m_loadType = loadType; } @@ -337,7 +377,7 @@ static INIFieldParseProc findFieldParse(const FieldParse* parseTable, const char //------------------------------------------------------------------------------------------------- /** Load and parse an INI file */ //------------------------------------------------------------------------------------------------- -void INI::load( AsciiString filename, INILoadType loadType, Xfer *pXfer ) +UnsignedInt INI::load( AsciiString filename, INILoadType loadType, Xfer *pXfer ) { setFPMode(); // so we have consistent Real values for GameLogic -MDC @@ -401,10 +441,11 @@ void INI::load( AsciiString filename, INILoadType loadType, Xfer *pXfer ) unPrepFile(); -} // end load + return 1; +} //------------------------------------------------------------------------------------------------- -/** Read a line from the already open file. Any comments will be remved and +/** Read a line from the already open file. Any comments will be removed and * therefore ignored from any given line */ //------------------------------------------------------------------------------------------------- void INI::readLine( void ) diff --git a/Generals/Code/GameEngine/Source/Common/System/SubsystemInterface.cpp b/Generals/Code/GameEngine/Source/Common/System/SubsystemInterface.cpp index 5a33a0dfb4c..74dcdf4bb96 100644 --- a/Generals/Code/GameEngine/Source/Common/System/SubsystemInterface.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/SubsystemInterface.cpp @@ -142,18 +142,16 @@ void SubsystemInterfaceList::removeSubsystem(SubsystemInterface* sys) #endif } //----------------------------------------------------------------------------- -void SubsystemInterfaceList::initSubsystem(SubsystemInterface* sys, const char* path1, const char* path2, const char* dirpath, Xfer *pXfer, AsciiString name) +void SubsystemInterfaceList::initSubsystem(SubsystemInterface* sys, const char* path1, const char* path2, Xfer *pXfer, AsciiString name) { sys->setName(name); sys->init(); INI ini; if (path1) - ini.load(path1, INI_LOAD_OVERWRITE, pXfer ); + ini.loadFileDirectory(path1, INI_LOAD_OVERWRITE, pXfer ); if (path2) - ini.load(path2, INI_LOAD_OVERWRITE, pXfer ); - if (dirpath) - ini.loadDirectory(dirpath, TRUE, INI_LOAD_OVERWRITE, pXfer ); + ini.loadFileDirectory(path2, INI_LOAD_OVERWRITE, pXfer ); m_subsystems.push_back(sys); } diff --git a/Generals/Code/GameEngine/Source/GameClient/Credits.cpp b/Generals/Code/GameEngine/Source/GameClient/Credits.cpp index 0f1f7895a4a..0a2e0b678eb 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Credits.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Credits.cpp @@ -155,7 +155,7 @@ void CreditsManager::load(void ) { INI ini; // Read from INI all the ControlBarSchemes - ini.load( AsciiString( "Data\\INI\\Credits.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Credits" ), INI_LOAD_OVERWRITE, NULL ); if(m_scrollRatePerFrames <=0) m_scrollRatePerFrames = 1; diff --git a/Generals/Code/GameEngine/Source/GameClient/Eva.cpp b/Generals/Code/GameEngine/Source/GameClient/Eva.cpp index 10f100c2cbd..d7c71edaaae 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Eva.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Eva.cpp @@ -182,7 +182,7 @@ void Eva::init() { // parse the INI here, etc. INI ini; - ini.load( AsciiString( "Data\\INI\\Eva.ini" ), INI_LOAD_OVERWRITE, NULL); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Eva" ), INI_LOAD_OVERWRITE, NULL); } //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index e8dfa02a847..8b5267a567f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -1042,11 +1042,11 @@ void ControlBar::init( void ) INI ini; m_sideSelectAnimateDown = FALSE; // load the command buttons - ini.load( AsciiString( "Data\\INI\\Default\\CommandButton.ini" ), INI_LOAD_OVERWRITE, NULL ); - ini.load( AsciiString( "Data\\INI\\CommandButton.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Default\\CommandButton" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\CommandButton" ), INI_LOAD_OVERWRITE, NULL ); // load the command sets - ini.load( AsciiString( "Data\\INI\\CommandSet.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\CommandSet" ), INI_LOAD_OVERWRITE, NULL ); // post process step after loading the command buttons and command sets postProcessCommands(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp index d9604767f3d..c644f129bb8 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp @@ -103,7 +103,7 @@ void ControlBarResizer::init( void ) { INI ini; // Read from INI all the ControlBarSchemes - ini.load( AsciiString( "Data\\INI\\ControlBarResizer.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\ControlBarResizer" ), INI_LOAD_OVERWRITE, NULL ); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp index 3ac20d052e0..fce5b964819 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp @@ -1015,17 +1015,17 @@ void ControlBarSchemeManager::init( void ) INI ini; // Read from INI all the ControlBarSchemes - ini.load( AsciiString( "Data\\INI\\Default\\ControlBarScheme.ini" ), INI_LOAD_OVERWRITE, NULL ); - ini.load( AsciiString( "Data\\INI\\ControlBarScheme.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Default\\ControlBarScheme" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\ControlBarScheme" ), INI_LOAD_OVERWRITE, NULL ); // //Load the user modified control bar schemes // WIN32_FIND_DATA findData; // AsciiString userDataPath; // if(TheGlobalData) // { -// userDataPath.format("%sINI\\ControlBarScheme.ini",TheGlobalData->getPath_UserData().str()); +// userDataPath.format("%sINI\\ControlBarScheme",TheGlobalData->getPath_UserData().str()); // if (FindFirstFile(userDataPath.str(), &findData) !=INVALID_HANDLE_VALUE) -// ini.load(userDataPath, INI_LOAD_OVERWRITE, NULL ); +// ini.loadFileDirectory(userDataPath, INI_LOAD_OVERWRITE, NULL ); // } if( m_schemeList.size() <= 0 ) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp index 7d982f0c95a..723224bd3db 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp @@ -398,7 +398,7 @@ void GameWindowTransitionsHandler::load(void ) { INI ini; // Read from INI all the ControlBarSchemes - ini.load( AsciiString( "Data\\INI\\WindowTransitions.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\WindowTransitions" ), INI_LOAD_OVERWRITE, NULL ); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp index 80da36461b4..6536637be99 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp @@ -138,7 +138,7 @@ void HeaderTemplateManager::init( void ) { INI ini; AsciiString fname; - fname.format("Data\\%s\\HeaderTemplate.ini", GetRegistryLanguage().str()); + fname.format("Data\\%s\\HeaderTemplate", GetRegistryLanguage().str()); OSVERSIONINFO osvi; osvi.dwOSVersionInfoSize=sizeof(OSVERSIONINFO); if (GetVersionEx(&osvi)) @@ -151,7 +151,7 @@ void HeaderTemplateManager::init( void ) fname = tempName; } } - ini.load( fname, INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( fname, INI_LOAD_OVERWRITE, NULL ); populateGameFonts(); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp index 9feb41dc70e..594a5c7bbe3 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp @@ -148,8 +148,8 @@ void Shell::init( void ) { INI ini; // Read from INI all the ShellMenuScheme - ini.load( AsciiString( "Data\\INI\\Default\\ShellMenuScheme.ini" ), INI_LOAD_OVERWRITE, NULL ); - ini.load( AsciiString( "Data\\INI\\ShellMenuScheme.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Default\\ShellMenuScheme" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\ShellMenuScheme" ), INI_LOAD_OVERWRITE, NULL ); if( m_schemeManager ) m_schemeManager->init(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp index 1f0c2cd2e60..6ee52a1f5e4 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp @@ -282,8 +282,8 @@ void ShellMenuSchemeManager::init( void ) { INI ini; // Read from INI all the ControlBarSchemes - ini.load( AsciiString( "Data\\INI\\Default\\ShellMenuScheme.ini" ), INI_LOAD_OVERWRITE, NULL ); - ini.load( AsciiString( "Data\\INI\\ShellMenuScheme.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Default\\ShellMenuScheme" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\ShellMenuScheme" ), INI_LOAD_OVERWRITE, NULL ); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp index 27c6e63c331..543ba769e1a 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -241,7 +241,7 @@ void GameClient::init( void ) INI ini; // Load the DrawGroupInfo here, before the Display Manager is loaded. - ini.load("Data\\INI\\DrawGroupInfo.ini", INI_LOAD_OVERWRITE, NULL); + ini.loadFileDirectory("Data\\INI\\DrawGroupInfo", INI_LOAD_OVERWRITE, NULL); // Override the ini values with localized versions: if (TheGlobalLanguageData && TheGlobalLanguageData->m_drawGroupInfoFont.name.isNotEmpty()) diff --git a/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp b/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp index ccc41f9eec7..38637de3b64 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp @@ -136,7 +136,7 @@ void GlobalLanguage::init( void ) INI ini; AsciiString fname; - fname.format("Data\\%s\\Language.ini", GetRegistryLanguage().str()); + fname.format("Data\\%s\\Language", GetRegistryLanguage().str()); OSVERSIONINFO osvi; osvi.dwOSVersionInfoSize=sizeof(OSVERSIONINFO); @@ -149,7 +149,7 @@ void GlobalLanguage::init( void ) fname = tempName; } - ini.load( fname, INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( fname, INI_LOAD_OVERWRITE, NULL ); StringListIt it = m_localFonts.begin(); while( it != m_localFonts.end()) { diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index a5c62d2b0bc..b55ec556ab0 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -1099,7 +1099,7 @@ InGameUI::~InGameUI() void InGameUI::init( void ) { INI ini; - ini.load( AsciiString( "Data\\INI\\InGameUI.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\InGameUI" ), INI_LOAD_OVERWRITE, NULL ); //override INI values with language localized values: if (TheGlobalLanguageData) diff --git a/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp b/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp index cf3e226d2d8..ad455a32333 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp @@ -576,7 +576,7 @@ the Win32 version of the mouse (by preloading resources before D3D device is cre void Mouse::parseIni(void) { INI ini; - ini.load( AsciiString( "Data\\INI\\Mouse.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Mouse" ), INI_LOAD_OVERWRITE, NULL ); } //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp b/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp index 6941ce23138..0d5001c2f6e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp @@ -755,7 +755,7 @@ void Anim2DCollection::init( void ) { INI ini; - ini.load( "Data\\INI\\Animation2D.ini", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Animation2D", INI_LOAD_OVERWRITE, NULL ); } // end init diff --git a/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp b/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp index bb9bf20d195..5bdbdb6784a 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp @@ -238,7 +238,7 @@ void CampaignManager::init( void ) { INI ini; // Read from INI all the CampaignManager - ini.load( AsciiString( "Data\\INI\\Campaign.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Campaign" ), INI_LOAD_OVERWRITE, NULL ); } //----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp b/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp index ad459e67d9c..0a5354bff36 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp @@ -325,7 +325,7 @@ void ImageCollection::load( Int textureSize ) if(FindFirstFile(userDataPath.str(), &findData) !=INVALID_HANDLE_VALUE) { userDataPath.format("%sINI\\MappedImages",TheGlobalData->getPath_UserData().str()); - ini.loadDirectory(userDataPath, TRUE, INI_LOAD_OVERWRITE, NULL ); + ini.loadDirectory(userDataPath, INI_LOAD_OVERWRITE, NULL ); } } @@ -334,9 +334,9 @@ void ImageCollection::load( Int textureSize ) // load all the ine files in that directory - ini.loadDirectory( AsciiString( buffer ), TRUE, INI_LOAD_OVERWRITE, NULL ); + ini.loadDirectory( AsciiString( buffer ), INI_LOAD_OVERWRITE, NULL ); - ini.loadDirectory("Data\\INI\\MappedImages\\HandCreated", TRUE, INI_LOAD_OVERWRITE, NULL ); + ini.loadDirectory("Data\\INI\\MappedImages\\HandCreated", INI_LOAD_OVERWRITE, NULL ); } // end load diff --git a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp index 121532bd61d..ccdfe58361f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -2963,7 +2963,7 @@ void ParticleSystemManager::init( void ) { /// Read INI data and build templates INI ini; - ini.load( AsciiString( "Data\\INI\\ParticleSystem.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\ParticleSystem" ), INI_LOAD_OVERWRITE, NULL ); // sanity, our lists must be empty!! for( Int i = 0; i < NUM_PARTICLE_PRIORITIES; ++i ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 10d2f4a92ac..dc4fc1a8d4f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -2160,6 +2160,9 @@ void GameLogic::loadMapINI( AsciiString mapName ) ini.load( AsciiString(fullFledgeFilename), INI_LOAD_CREATE_OVERRIDES, NULL ); } + // TheSuperHackers @todo Implement ini load directory for map folder. + // Requires adjustments in map transfer. + sprintf(fullFledgeFilename, "%s\\solo.ini", filename); if (TheFileSystem->doesFileExist(fullFledgeFilename)) { DEBUG_LOG(("Loading solo.ini")); diff --git a/Generals/Code/GameEngine/Source/GameNetwork/WOLBrowser/WebBrowser.cpp b/Generals/Code/GameEngine/Source/GameNetwork/WOLBrowser/WebBrowser.cpp index d58edb6751b..fccb8399827 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/WOLBrowser/WebBrowser.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/WOLBrowser/WebBrowser.cpp @@ -167,7 +167,7 @@ void WebBrowser::init() { m_urlList = NULL; INI ini; - ini.load( AsciiString( "Data\\INI\\Webpages.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Webpages" ), INI_LOAD_OVERWRITE, NULL ); } /****************************************************************************** diff --git a/Generals/Code/Tools/WorldBuilder/src/WorldBuilder.cpp b/Generals/Code/Tools/WorldBuilder/src/WorldBuilder.cpp index 1690b9bea5e..bf4afd9aa64 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WorldBuilder.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WorldBuilder.cpp @@ -86,10 +86,10 @@ static SubsystemInterfaceList TheSubsystemListRecord; template -void initSubsystem(SUBSYSTEM*& sysref, SUBSYSTEM* sys, const char* path1 = NULL, const char* path2 = NULL, const char* dirpath = NULL) +void initSubsystem(SUBSYSTEM*& sysref, SUBSYSTEM* sys, const char* path1 = NULL, const char* path2 = NULL) { sysref = sys; - TheSubsystemListRecord.initSubsystem(sys, path1, path2, dirpath, NULL); + TheSubsystemListRecord.initSubsystem(sys, path1, path2, NULL); } @@ -336,10 +336,10 @@ BOOL CWorldBuilderApp::InitInstance() INI ini; - initSubsystem(TheWritableGlobalData, new GlobalData(), "Data\\INI\\Default\\GameData.ini", "Data\\INI\\GameData.ini"); + initSubsystem(TheWritableGlobalData, new GlobalData(), "Data\\INI\\Default\\GameData", "Data\\INI\\GameData"); #if defined(RTS_DEBUG) - ini.load( AsciiString( "Data\\INI\\GameDataDebug.ini" ), INI_LOAD_MULTIFILE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\GameDataDebug" ), INI_LOAD_MULTIFILE, NULL ); #endif #ifdef DEBUG_CRASHING @@ -364,14 +364,14 @@ BOOL CWorldBuilderApp::InitInstance() CreateDirectory(buf, NULL); // read the water settings from INI (must do prior to initing GameClient, apparently) - ini.load( AsciiString( "Data\\INI\\Default\\Water.ini" ), INI_LOAD_OVERWRITE, NULL ); - ini.load( AsciiString( "Data\\INI\\Water.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Default\\Water" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Water" ), INI_LOAD_OVERWRITE, NULL ); initSubsystem(TheGameText, CreateGameTextInterface()); - initSubsystem(TheScienceStore, new ScienceStore(), "Data\\INI\\Default\\Science.ini", "Data\\INI\\Science.ini"); - initSubsystem(TheMultiplayerSettings, new MultiplayerSettings(), "Data\\INI\\Default\\Multiplayer.ini", "Data\\INI\\Multiplayer.ini"); - initSubsystem(TheTerrainTypes, new TerrainTypeCollection(), "Data\\INI\\Default\\Terrain.ini", "Data\\INI\\Terrain.ini"); - initSubsystem(TheTerrainRoads, new TerrainRoadCollection(), "Data\\INI\\Default\\Roads.ini", "Data\\INI\\Roads.ini"); + initSubsystem(TheScienceStore, new ScienceStore(), "Data\\INI\\Default\\Science", "Data\\INI\\Science"); + initSubsystem(TheMultiplayerSettings, new MultiplayerSettings(), "Data\\INI\\Default\\Multiplayer", "Data\\INI\\Multiplayer"); + initSubsystem(TheTerrainTypes, new TerrainTypeCollection(), "Data\\INI\\Default\\Terrain", "Data\\INI\\Terrain"); + initSubsystem(TheTerrainRoads, new TerrainRoadCollection(), "Data\\INI\\Default\\Roads", "Data\\INI\\Roads"); WorldHeightMapEdit::init(); @@ -387,19 +387,19 @@ BOOL CWorldBuilderApp::InitInstance() initSubsystem(TheModuleFactory, (ModuleFactory*)(new W3DModuleFactory())); initSubsystem(TheSidesList, new SidesList()); initSubsystem(TheCaveSystem, new CaveSystem()); - initSubsystem(TheRankInfoStore, new RankInfoStore(), NULL, "Data\\INI\\Rank.ini"); - initSubsystem(ThePlayerTemplateStore, new PlayerTemplateStore(), "Data\\INI\\Default\\PlayerTemplate.ini", "Data\\INI\\PlayerTemplate.ini"); - initSubsystem(TheSpecialPowerStore, new SpecialPowerStore(), "Data\\INI\\Default\\SpecialPower.ini", "Data\\INI\\SpecialPower.ini" ); + initSubsystem(TheRankInfoStore, new RankInfoStore(), NULL, "Data\\INI\\Rank"); + initSubsystem(ThePlayerTemplateStore, new PlayerTemplateStore(), "Data\\INI\\Default\\PlayerTemplate", "Data\\INI\\PlayerTemplate"); + initSubsystem(TheSpecialPowerStore, new SpecialPowerStore(), "Data\\INI\\Default\\SpecialPower", "Data\\INI\\SpecialPower" ); initSubsystem(TheParticleSystemManager, (ParticleSystemManager*)(new W3DParticleSystemManager())); - initSubsystem(TheFXListStore, new FXListStore(), "Data\\INI\\Default\\FXList.ini", "Data\\INI\\FXList.ini"); - initSubsystem(TheWeaponStore, new WeaponStore(), NULL, "Data\\INI\\Weapon.ini"); - initSubsystem(TheObjectCreationListStore, new ObjectCreationListStore(), "Data\\INI\\Default\\ObjectCreationList.ini", "Data\\INI\\ObjectCreationList.ini"); - initSubsystem(TheLocomotorStore, new LocomotorStore(), NULL, "Data\\INI\\Locomotor.ini"); - initSubsystem(TheDamageFXStore, new DamageFXStore(), NULL, "Data\\INI\\DamageFX.ini"); - initSubsystem(TheArmorStore, new ArmorStore(), NULL, "Data\\INI\\Armor.ini"); - initSubsystem(TheThingFactory, new ThingFactory(), "Data\\INI\\Default\\Object.ini", NULL, "Data\\INI\\Object"); - initSubsystem(TheCrateSystem, new CrateSystem(), "Data\\INI\\Default\\Crate.ini", "Data\\INI\\Crate.ini"); - initSubsystem(TheUpgradeCenter, new UpgradeCenter, "Data\\INI\\Default\\Upgrade.ini", "Data\\INI\\Upgrade.ini"); + initSubsystem(TheFXListStore, new FXListStore(), "Data\\INI\\Default\\FXList", "Data\\INI\\FXList"); + initSubsystem(TheWeaponStore, new WeaponStore(), NULL, "Data\\INI\\Weapon"); + initSubsystem(TheObjectCreationListStore, new ObjectCreationListStore(), "Data\\INI\\Default\\ObjectCreationList", "Data\\INI\\ObjectCreationList"); + initSubsystem(TheLocomotorStore, new LocomotorStore(), NULL, "Data\\INI\\Locomotor"); + initSubsystem(TheDamageFXStore, new DamageFXStore(), NULL, "Data\\INI\\DamageFX"); + initSubsystem(TheArmorStore, new ArmorStore(), NULL, "Data\\INI\\Armor"); + initSubsystem(TheThingFactory, new ThingFactory(), "Data\\INI\\Default\\Object", "Data\\INI\\Object"); + initSubsystem(TheCrateSystem, new CrateSystem(), "Data\\INI\\Default\\Crate", "Data\\INI\\Crate"); + initSubsystem(TheUpgradeCenter, new UpgradeCenter, "Data\\INI\\Default\\Upgrade", "Data\\INI\\Upgrade"); initSubsystem(TheAnim2DCollection, new Anim2DCollection ); //Init's itself. TheSubsystemListRecord.postProcessLoadAll(); diff --git a/GeneralsMD/Code/GameEngine/Include/Common/INI.h b/GeneralsMD/Code/GameEngine/Include/Common/INI.h index 2dd1ad71acd..75f7ec6845b 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/INI.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/INI.h @@ -175,8 +175,19 @@ class INI INI(); ~INI(); - void loadDirectory( AsciiString dirName, Bool subdirs, INILoadType loadType, Xfer *pXfer ); ///< load directory of INI files - void load( AsciiString filename, INILoadType loadType, Xfer *pXfer ); ///< load INI file + // TheSuperHackers @feature xezon 19/08/2025 + // Load a specific INI file by name and/or INI files from a directory (and its subdirectories). + // For example "Data\INI\Armor" loads "Data\INI\Armor.ini" and all *.ini files in "Data\INI\Armor". + // Throws if not a single INI file is found or one is not read correctly. + UnsignedInt loadFileDirectory( AsciiString fileDirName, INILoadType loadType, Xfer *pXfer, Bool subdirs = TRUE ); + + // Load INI files from a directory (and its subdirectories). + // Throws if one INI file is not read correctly. + UnsignedInt loadDirectory( AsciiString dirName, INILoadType loadType, Xfer *pXfer, Bool subdirs = TRUE ); + + // Load one specific INI file by name. + // Throws if the INI file is not found or is not read correctly. + UnsignedInt load( AsciiString filename, INILoadType loadType, Xfer *pXfer ); static Bool isDeclarationOfType( AsciiString blockType, AsciiString blockName, char *bufferToCheck ); static Bool isEndOfBlock( char *bufferToCheck ); diff --git a/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h b/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h index e85672d2fee..4b767dc77f9 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h @@ -150,7 +150,7 @@ class SubsystemInterfaceList SubsystemInterfaceList(); ~SubsystemInterfaceList(); - void initSubsystem(SubsystemInterface* sys, const char* path1, const char* path2, const char* dirpath, Xfer *pXfer, AsciiString name=""); + void initSubsystem(SubsystemInterface* sys, const char* path1, const char* path2, Xfer *pXfer, AsciiString name=""); void addSubsystem(SubsystemInterface* sys); void removeSubsystem(SubsystemInterface* sys); void postProcessLoadAll(); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp index 912fd8beebd..2b4f8ea7ba7 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp @@ -156,11 +156,16 @@ SubsystemInterfaceList* TheSubsystemList = NULL; //------------------------------------------------------------------------------------------------- template -void initSubsystem(SUBSYSTEM*& sysref, AsciiString name, SUBSYSTEM* sys, Xfer *pXfer, const char* path1 = NULL, - const char* path2 = NULL, const char* dirpath = NULL) +void initSubsystem( + SUBSYSTEM*& sysref, + AsciiString name, + SUBSYSTEM* sys, + Xfer *pXfer, + const char* path1 = NULL, + const char* path2 = NULL) { sysref = sys; - TheSubsystemList->initSubsystem(sys, path1, path2, dirpath, pXfer, name); + TheSubsystemList->initSubsystem(sys, path1, path2, pXfer, name); } //------------------------------------------------------------------------------------------------- @@ -505,7 +510,7 @@ void GameEngine::init() DEBUG_ASSERTCRASH(TheWritableGlobalData,("TheWritableGlobalData expected to be created")); - initSubsystem(TheWritableGlobalData, "TheWritableGlobalData", TheWritableGlobalData, &xferCRC, "Data\\INI\\Default\\GameData.ini", "Data\\INI\\GameData.ini"); + initSubsystem(TheWritableGlobalData, "TheWritableGlobalData", TheWritableGlobalData, &xferCRC, "Data\\INI\\Default\\GameData", "Data\\INI\\GameData"); TheWritableGlobalData->parseCustomDefinition(); @@ -520,7 +525,7 @@ void GameEngine::init() #if defined(RTS_DEBUG) // If we're in Debug, load the Debug settings as well. - ini.load( AsciiString( "Data\\INI\\GameDataDebug.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\GameDataDebug" ), INI_LOAD_OVERWRITE, NULL ); #endif // special-case: parse command-line parameters after loading global data @@ -539,10 +544,10 @@ void GameEngine::init() } // read the water settings from INI (must do prior to initing GameClient, apparently) - ini.load( AsciiString( "Data\\INI\\Default\\Water.ini" ), INI_LOAD_OVERWRITE, &xferCRC ); - ini.load( AsciiString( "Data\\INI\\Water.ini" ), INI_LOAD_OVERWRITE, &xferCRC ); - ini.load( AsciiString( "Data\\INI\\Default\\Weather.ini" ), INI_LOAD_OVERWRITE, &xferCRC ); - ini.load( AsciiString( "Data\\INI\\Weather.ini" ), INI_LOAD_OVERWRITE, &xferCRC ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Default\\Water" ), INI_LOAD_OVERWRITE, &xferCRC ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Water" ), INI_LOAD_OVERWRITE, &xferCRC ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Default\\Weather" ), INI_LOAD_OVERWRITE, &xferCRC ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Weather" ), INI_LOAD_OVERWRITE, &xferCRC ); @@ -555,7 +560,7 @@ void GameEngine::init() #ifdef DEBUG_CRC - initSubsystem(TheDeepCRCSanityCheck, "TheDeepCRCSanityCheck", MSGNEW("GameEngineSubystem") DeepCRCSanityCheck, NULL, NULL, NULL, NULL); + initSubsystem(TheDeepCRCSanityCheck, "TheDeepCRCSanityCheck", MSGNEW("GameEngineSubystem") DeepCRCSanityCheck, NULL); #endif // DEBUG_CRC initSubsystem(TheGameText, "TheGameText", CreateGameTextInterface(), NULL); updateWindowTitle(); @@ -568,10 +573,10 @@ void GameEngine::init() #endif///////////////////////////////////////////////////////////////////////////////////////////// - initSubsystem(TheScienceStore,"TheScienceStore", MSGNEW("GameEngineSubsystem") ScienceStore(), &xferCRC, "Data\\INI\\Default\\Science.ini", "Data\\INI\\Science.ini"); - initSubsystem(TheMultiplayerSettings,"TheMultiplayerSettings", MSGNEW("GameEngineSubsystem") MultiplayerSettings(), &xferCRC, "Data\\INI\\Default\\Multiplayer.ini", "Data\\INI\\Multiplayer.ini"); - initSubsystem(TheTerrainTypes,"TheTerrainTypes", MSGNEW("GameEngineSubsystem") TerrainTypeCollection(), &xferCRC, "Data\\INI\\Default\\Terrain.ini", "Data\\INI\\Terrain.ini"); - initSubsystem(TheTerrainRoads,"TheTerrainRoads", MSGNEW("GameEngineSubsystem") TerrainRoadCollection(), &xferCRC, "Data\\INI\\Default\\Roads.ini", "Data\\INI\\Roads.ini"); + initSubsystem(TheScienceStore,"TheScienceStore", MSGNEW("GameEngineSubsystem") ScienceStore(), &xferCRC, "Data\\INI\\Default\\Science", "Data\\INI\\Science"); + initSubsystem(TheMultiplayerSettings,"TheMultiplayerSettings", MSGNEW("GameEngineSubsystem") MultiplayerSettings(), &xferCRC, "Data\\INI\\Default\\Multiplayer", "Data\\INI\\Multiplayer"); + initSubsystem(TheTerrainTypes,"TheTerrainTypes", MSGNEW("GameEngineSubsystem") TerrainTypeCollection(), &xferCRC, "Data\\INI\\Default\\Terrain", "Data\\INI\\Terrain"); + initSubsystem(TheTerrainRoads,"TheTerrainRoads", MSGNEW("GameEngineSubsystem") TerrainRoadCollection(), &xferCRC, "Data\\INI\\Default\\Roads", "Data\\INI\\Roads"); initSubsystem(TheGlobalLanguageData,"TheGlobalLanguageData",MSGNEW("GameEngineSubsystem") GlobalLanguage, NULL); // must be before the game text initSubsystem(TheCDManager,"TheCDManager", CreateCDManager(), NULL); #ifdef DUMP_PERF_STATS/////////////////////////////////////////////////////////////////////////// @@ -597,8 +602,8 @@ void GameEngine::init() initSubsystem(TheMessageStream,"TheMessageStream", createMessageStream(), NULL); initSubsystem(TheSidesList,"TheSidesList", MSGNEW("GameEngineSubsystem") SidesList(), NULL); initSubsystem(TheCaveSystem,"TheCaveSystem", MSGNEW("GameEngineSubsystem") CaveSystem(), NULL); - initSubsystem(TheRankInfoStore,"TheRankInfoStore", MSGNEW("GameEngineSubsystem") RankInfoStore(), &xferCRC, NULL, "Data\\INI\\Rank.ini"); - initSubsystem(ThePlayerTemplateStore,"ThePlayerTemplateStore", MSGNEW("GameEngineSubsystem") PlayerTemplateStore(), &xferCRC, "Data\\INI\\Default\\PlayerTemplate.ini", "Data\\INI\\PlayerTemplate.ini"); + initSubsystem(TheRankInfoStore,"TheRankInfoStore", MSGNEW("GameEngineSubsystem") RankInfoStore(), &xferCRC, NULL, "Data\\INI\\Rank"); + initSubsystem(ThePlayerTemplateStore,"ThePlayerTemplateStore", MSGNEW("GameEngineSubsystem") PlayerTemplateStore(), &xferCRC, "Data\\INI\\Default\\PlayerTemplate", "Data\\INI\\PlayerTemplate"); initSubsystem(TheParticleSystemManager,"TheParticleSystemManager", createParticleSystemManager(), NULL); #ifdef DUMP_PERF_STATS/////////////////////////////////////////////////////////////////////////// @@ -609,13 +614,13 @@ void GameEngine::init() #endif///////////////////////////////////////////////////////////////////////////////////////////// - initSubsystem(TheFXListStore,"TheFXListStore", MSGNEW("GameEngineSubsystem") FXListStore(), &xferCRC, "Data\\INI\\Default\\FXList.ini", "Data\\INI\\FXList.ini"); - initSubsystem(TheWeaponStore,"TheWeaponStore", MSGNEW("GameEngineSubsystem") WeaponStore(), &xferCRC, NULL, "Data\\INI\\Weapon.ini"); - initSubsystem(TheObjectCreationListStore,"TheObjectCreationListStore", MSGNEW("GameEngineSubsystem") ObjectCreationListStore(), &xferCRC, "Data\\INI\\Default\\ObjectCreationList.ini", "Data\\INI\\ObjectCreationList.ini"); - initSubsystem(TheLocomotorStore,"TheLocomotorStore", MSGNEW("GameEngineSubsystem") LocomotorStore(), &xferCRC, NULL, "Data\\INI\\Locomotor.ini"); - initSubsystem(TheSpecialPowerStore,"TheSpecialPowerStore", MSGNEW("GameEngineSubsystem") SpecialPowerStore(), &xferCRC, "Data\\INI\\Default\\SpecialPower.ini", "Data\\INI\\SpecialPower.ini"); - initSubsystem(TheDamageFXStore,"TheDamageFXStore", MSGNEW("GameEngineSubsystem") DamageFXStore(), &xferCRC, NULL, "Data\\INI\\DamageFX.ini"); - initSubsystem(TheArmorStore,"TheArmorStore", MSGNEW("GameEngineSubsystem") ArmorStore(), &xferCRC, NULL, "Data\\INI\\Armor.ini"); + initSubsystem(TheFXListStore,"TheFXListStore", MSGNEW("GameEngineSubsystem") FXListStore(), &xferCRC, "Data\\INI\\Default\\FXList", "Data\\INI\\FXList"); + initSubsystem(TheWeaponStore,"TheWeaponStore", MSGNEW("GameEngineSubsystem") WeaponStore(), &xferCRC, NULL, "Data\\INI\\Weapon"); + initSubsystem(TheObjectCreationListStore,"TheObjectCreationListStore", MSGNEW("GameEngineSubsystem") ObjectCreationListStore(), &xferCRC, "Data\\INI\\Default\\ObjectCreationList", "Data\\INI\\ObjectCreationList"); + initSubsystem(TheLocomotorStore,"TheLocomotorStore", MSGNEW("GameEngineSubsystem") LocomotorStore(), &xferCRC, NULL, "Data\\INI\\Locomotor"); + initSubsystem(TheSpecialPowerStore,"TheSpecialPowerStore", MSGNEW("GameEngineSubsystem") SpecialPowerStore(), &xferCRC, "Data\\INI\\Default\\SpecialPower", "Data\\INI\\SpecialPower"); + initSubsystem(TheDamageFXStore,"TheDamageFXStore", MSGNEW("GameEngineSubsystem") DamageFXStore(), &xferCRC, NULL, "Data\\INI\\DamageFX"); + initSubsystem(TheArmorStore,"TheArmorStore", MSGNEW("GameEngineSubsystem") ArmorStore(), &xferCRC, NULL, "Data\\INI\\Armor"); initSubsystem(TheBuildAssistant,"TheBuildAssistant", MSGNEW("GameEngineSubsystem") BuildAssistant, NULL); @@ -628,7 +633,7 @@ void GameEngine::init() - initSubsystem(TheThingFactory,"TheThingFactory", createThingFactory(), &xferCRC, "Data\\INI\\Default\\Object.ini", NULL, "Data\\INI\\Object"); + initSubsystem(TheThingFactory,"TheThingFactory", createThingFactory(), &xferCRC, "Data\\INI\\Default\\Object", "Data\\INI\\Object"); #ifdef DUMP_PERF_STATS/////////////////////////////////////////////////////////////////////////// GetPrecisionTimer(&endTime64);////////////////////////////////////////////////////////////////// @@ -638,7 +643,7 @@ void GameEngine::init() #endif///////////////////////////////////////////////////////////////////////////////////////////// - initSubsystem(TheUpgradeCenter,"TheUpgradeCenter", MSGNEW("GameEngineSubsystem") UpgradeCenter, &xferCRC, "Data\\INI\\Default\\Upgrade.ini", "Data\\INI\\Upgrade.ini"); + initSubsystem(TheUpgradeCenter,"TheUpgradeCenter", MSGNEW("GameEngineSubsystem") UpgradeCenter, &xferCRC, "Data\\INI\\Default\\Upgrade", "Data\\INI\\Upgrade"); initSubsystem(TheGameClient,"TheGameClient", createGameClient(), NULL); @@ -650,10 +655,10 @@ void GameEngine::init() #endif///////////////////////////////////////////////////////////////////////////////////////////// - initSubsystem(TheAI,"TheAI", MSGNEW("GameEngineSubsystem") AI(), &xferCRC, "Data\\INI\\Default\\AIData.ini", "Data\\INI\\AIData.ini"); + initSubsystem(TheAI,"TheAI", MSGNEW("GameEngineSubsystem") AI(), &xferCRC, "Data\\INI\\Default\\AIData", "Data\\INI\\AIData"); initSubsystem(TheGameLogic,"TheGameLogic", createGameLogic(), NULL); initSubsystem(TheTeamFactory,"TheTeamFactory", MSGNEW("GameEngineSubsystem") TeamFactory(), NULL); - initSubsystem(TheCrateSystem,"TheCrateSystem", MSGNEW("GameEngineSubsystem") CrateSystem(), &xferCRC, "Data\\INI\\Default\\Crate.ini", "Data\\INI\\Crate.ini"); + initSubsystem(TheCrateSystem,"TheCrateSystem", MSGNEW("GameEngineSubsystem") CrateSystem(), &xferCRC, "Data\\INI\\Default\\Crate", "Data\\INI\\Crate"); initSubsystem(ThePlayerList,"ThePlayerList", MSGNEW("GameEngineSubsystem") PlayerList(), NULL); initSubsystem(TheRecorder,"TheRecorder", createRecorder(), NULL); initSubsystem(TheRadar,"TheRadar", TheGlobalData->m_headless ? NEW RadarDummy : createRadar(), NULL); @@ -670,27 +675,27 @@ void GameEngine::init() AsciiString fname; - fname.format("Data\\%s\\CommandMap.ini", GetRegistryLanguage().str()); - initSubsystem(TheMetaMap,"TheMetaMap", MSGNEW("GameEngineSubsystem") MetaMap(), NULL, fname.str(), "Data\\INI\\CommandMap.ini"); + fname.format("Data\\%s\\CommandMap", GetRegistryLanguage().str()); + initSubsystem(TheMetaMap,"TheMetaMap", MSGNEW("GameEngineSubsystem") MetaMap(), NULL, fname.str(), "Data\\INI\\CommandMap"); TheMetaMap->generateMetaMap(); #if defined(RTS_DEBUG) - ini.load("Data\\INI\\CommandMapDebug.ini", INI_LOAD_MULTIFILE, NULL); + ini.loadFileDirectory("Data\\INI\\CommandMapDebug", INI_LOAD_MULTIFILE, NULL); #endif #if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) - ini.load("Data\\INI\\CommandMapDemo.ini", INI_LOAD_MULTIFILE, NULL); + ini.loadFileDirectory("Data\\INI\\CommandMapDemo", INI_LOAD_MULTIFILE, NULL); #endif initSubsystem(TheActionManager,"TheActionManager", MSGNEW("GameEngineSubsystem") ActionManager(), NULL); //initSubsystem((CComObject *)TheWebBrowser,"(CComObject *)TheWebBrowser", (CComObject *)createWebBrowser(), NULL); - initSubsystem(TheGameStateMap,"TheGameStateMap", MSGNEW("GameEngineSubsystem") GameStateMap, NULL, NULL, NULL ); - initSubsystem(TheGameState,"TheGameState", MSGNEW("GameEngineSubsystem") GameState, NULL, NULL, NULL ); + initSubsystem(TheGameStateMap,"TheGameStateMap", MSGNEW("GameEngineSubsystem") GameStateMap, NULL ); + initSubsystem(TheGameState,"TheGameState", MSGNEW("GameEngineSubsystem") GameState, NULL ); // Create the interface for sending game results - initSubsystem(TheGameResultsQueue,"TheGameResultsQueue", GameResultsInterface::createNewGameResultsInterface(), NULL, NULL, NULL, NULL); + initSubsystem(TheGameResultsQueue,"TheGameResultsQueue", GameResultsInterface::createNewGameResultsInterface(), NULL); #ifdef DUMP_PERF_STATS/////////////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp index 0ca611cc5b9..f60ced63106 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp @@ -268,10 +268,10 @@ void GameLODManager::init(void) { INI ini; //Get Presets for each LOD level. - ini.load( AsciiString( "Data\\INI\\GameLOD.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\GameLOD" ), INI_LOAD_OVERWRITE, NULL ); //Get presets for each known hardware configuration - ini.load( AsciiString( "Data\\INI\\GameLODPresets.ini"), INI_LOAD_OVERWRITE, NULL); + ini.loadFileDirectory( AsciiString( "Data\\INI\\GameLODPresets"), INI_LOAD_OVERWRITE, NULL); //Get Presets for custom LOD level by pulling them out of initial globaldata (which should //have all settings already applied). diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp index 9d00c42996e..dcea928848b 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp @@ -204,13 +204,52 @@ INI::~INI( void ) } // end ~INI +//------------------------------------------------------------------------------------------------- +UnsignedInt INI::loadFileDirectory( AsciiString fileDirName, INILoadType loadType, Xfer *pXfer, Bool subdirs ) +{ + UnsignedInt filesRead = 0; + + AsciiString iniDir = fileDirName; + AsciiString iniFile = fileDirName; + + char ext[] = ".ini"; + + if (iniDir.endsWithNoCase(ext)) + { + iniDir.truncateBy(ARRAY_SIZE(ext)-1); + } + + if (!iniFile.endsWithNoCase(ext)) + { + iniFile.concat(ext); + } + + if (TheFileSystem->doesFileExist(iniFile.str())) + { + filesRead += load(iniFile, loadType, pXfer); + } + + // Load any additional ini files from a "filename" directory and its subdirectories. + filesRead += loadDirectory(iniDir, loadType, pXfer, subdirs); + + // Expect to open and load at least one file. + if (filesRead == 0) + { + throw INI_CANT_OPEN_FILE; + } + + return filesRead; +} + //------------------------------------------------------------------------------------------------- /** Load all INI files in the specified directory (and subdirectories if indicated). * If we are to load subdirectories, we will load them *after* we load all the * files in the current directory */ //------------------------------------------------------------------------------------------------- -void INI::loadDirectory( AsciiString dirName, Bool subdirs, INILoadType loadType, Xfer *pXfer ) +UnsignedInt INI::loadDirectory( AsciiString dirName, INILoadType loadType, Xfer *pXfer, Bool subdirs ) { + UnsignedInt filesRead = 0; + // sanity if( dirName.isEmpty() ) throw INI_INVALID_DIRECTORY; @@ -219,7 +258,7 @@ void INI::loadDirectory( AsciiString dirName, Bool subdirs, INILoadType loadType { FilenameList filenameList; dirName.concat('\\'); - TheFileSystem->getFileListInDirectory(dirName, "*.ini", filenameList, TRUE); + TheFileSystem->getFileListInDirectory(dirName, "*.ini", filenameList, subdirs); // Load the INI files in the dir now, in a sorted order. This keeps things the same between machines // in a network game. FilenameList::const_iterator it = filenameList.begin(); @@ -230,7 +269,7 @@ void INI::loadDirectory( AsciiString dirName, Bool subdirs, INILoadType loadType if ((tempname.find('\\') == NULL) && (tempname.find('/') == NULL)) { // this file doesn't reside in a subdirectory, load it first. - load( *it, loadType, pXfer ); + filesRead += load( *it, loadType, pXfer ); } ++it; } @@ -242,7 +281,7 @@ void INI::loadDirectory( AsciiString dirName, Bool subdirs, INILoadType loadType tempname = (*it).str() + dirName.getLength(); if ((tempname.find('\\') != NULL) || (tempname.find('/') != NULL)) { - load( *it, loadType, pXfer ); + filesRead += load( *it, loadType, pXfer ); } ++it; } @@ -253,7 +292,8 @@ void INI::loadDirectory( AsciiString dirName, Bool subdirs, INILoadType loadType throw; } -} // end loadDirectory + return filesRead; +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -283,7 +323,7 @@ void INI::prepFile( AsciiString filename, INILoadType loadType ) // save our filename m_filename = filename; - // save our load time + // save our load type m_loadType = loadType; } @@ -344,7 +384,7 @@ static INIFieldParseProc findFieldParse(const FieldParse* parseTable, const char //------------------------------------------------------------------------------------------------- /** Load and parse an INI file */ //------------------------------------------------------------------------------------------------- -void INI::load( AsciiString filename, INILoadType loadType, Xfer *pXfer ) +UnsignedInt INI::load( AsciiString filename, INILoadType loadType, Xfer *pXfer ) { setFPMode(); // so we have consistent Real values for GameLogic -MDC @@ -408,10 +448,11 @@ void INI::load( AsciiString filename, INILoadType loadType, Xfer *pXfer ) unPrepFile(); -} // end load + return 1; +} //------------------------------------------------------------------------------------------------- -/** Read a line from the already open file. Any comments will be remved and +/** Read a line from the already open file. Any comments will be removed and * therefore ignored from any given line */ //------------------------------------------------------------------------------------------------- void INI::readLine( void ) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/SubsystemInterface.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/SubsystemInterface.cpp index 23c3bd2bea4..dcece26b3f8 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/SubsystemInterface.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/SubsystemInterface.cpp @@ -151,18 +151,16 @@ void SubsystemInterfaceList::removeSubsystem(SubsystemInterface* sys) #endif } //----------------------------------------------------------------------------- -void SubsystemInterfaceList::initSubsystem(SubsystemInterface* sys, const char* path1, const char* path2, const char* dirpath, Xfer *pXfer, AsciiString name) +void SubsystemInterfaceList::initSubsystem(SubsystemInterface* sys, const char* path1, const char* path2, Xfer *pXfer, AsciiString name) { sys->setName(name); sys->init(); INI ini; if (path1) - ini.load(path1, INI_LOAD_OVERWRITE, pXfer ); + ini.loadFileDirectory(path1, INI_LOAD_OVERWRITE, pXfer ); if (path2) - ini.load(path2, INI_LOAD_OVERWRITE, pXfer ); - if (dirpath) - ini.loadDirectory(dirpath, TRUE, INI_LOAD_OVERWRITE, pXfer ); + ini.loadFileDirectory(path2, INI_LOAD_OVERWRITE, pXfer ); m_subsystems.push_back(sys); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp index 54bb9823769..604c6b1e8e3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp @@ -155,7 +155,7 @@ void CreditsManager::load(void ) { INI ini; // Read from INI all the ControlBarSchemes - ini.load( AsciiString( "Data\\INI\\Credits.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Credits" ), INI_LOAD_OVERWRITE, NULL ); if(m_scrollRatePerFrames <=0) m_scrollRatePerFrames = 1; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp index 446ea162342..042c072a7e6 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp @@ -255,7 +255,7 @@ void Eva::init() { // parse the INI here, etc. INI ini; - ini.load( AsciiString( "Data\\INI\\Eva.ini" ), INI_LOAD_OVERWRITE, NULL); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Eva" ), INI_LOAD_OVERWRITE, NULL); } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp index 708836b377c..74e7d3f3751 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp @@ -55,7 +55,7 @@ ChallengeGenerals::~ChallengeGenerals() void ChallengeGenerals::init( void ) { INI ini; - ini.load( AsciiString( "Data\\INI\\ChallengeMode.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\ChallengeMode" ), INI_LOAD_OVERWRITE, NULL ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 3c64691cec7..7fb6bd1307a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -1065,11 +1065,11 @@ void ControlBar::init( void ) INI ini; m_sideSelectAnimateDown = FALSE; // load the command buttons - ini.load( AsciiString( "Data\\INI\\Default\\CommandButton.ini" ), INI_LOAD_OVERWRITE, NULL ); - ini.load( AsciiString( "Data\\INI\\CommandButton.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Default\\CommandButton" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\CommandButton" ), INI_LOAD_OVERWRITE, NULL ); // load the command sets - ini.load( AsciiString( "Data\\INI\\CommandSet.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\CommandSet" ), INI_LOAD_OVERWRITE, NULL ); // post process step after loading the command buttons and command sets postProcessCommands(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp index dac78ae7b83..85c537bb419 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp @@ -103,7 +103,7 @@ void ControlBarResizer::init( void ) { INI ini; // Read from INI all the ControlBarSchemes - ini.load( AsciiString( "Data\\INI\\ControlBarResizer.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\ControlBarResizer" ), INI_LOAD_OVERWRITE, NULL ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp index b28b6a2a869..4dd7770dc1e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp @@ -1028,17 +1028,17 @@ void ControlBarSchemeManager::init( void ) INI ini; // Read from INI all the ControlBarSchemes - ini.load( AsciiString( "Data\\INI\\Default\\ControlBarScheme.ini" ), INI_LOAD_OVERWRITE, NULL ); - ini.load( AsciiString( "Data\\INI\\ControlBarScheme.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Default\\ControlBarScheme" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\ControlBarScheme" ), INI_LOAD_OVERWRITE, NULL ); // //Load the user modified control bar schemes // WIN32_FIND_DATA findData; // AsciiString userDataPath; // if(TheGlobalData) // { -// userDataPath.format("%sINI\\ControlBarScheme.ini",TheGlobalData->getPath_UserData().str()); +// userDataPath.format("%sINI\\ControlBarScheme",TheGlobalData->getPath_UserData().str()); // if (FindFirstFile(userDataPath.str(), &findData) !=INVALID_HANDLE_VALUE) -// ini.load(userDataPath, INI_LOAD_OVERWRITE, NULL ); +// ini.loadFileDirectory(userDataPath, INI_LOAD_OVERWRITE, NULL ); // } if( m_schemeList.size() <= 0 ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp index 95c110f6b77..c93d882371d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp @@ -398,7 +398,7 @@ void GameWindowTransitionsHandler::load(void ) { INI ini; // Read from INI all the ControlBarSchemes - ini.load( AsciiString( "Data\\INI\\WindowTransitions.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\WindowTransitions" ), INI_LOAD_OVERWRITE, NULL ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp index 6a15c9d4625..510ea68d42e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp @@ -138,7 +138,7 @@ void HeaderTemplateManager::init( void ) { INI ini; AsciiString fname; - fname.format("Data\\%s\\HeaderTemplate.ini", GetRegistryLanguage().str()); + fname.format("Data\\%s\\HeaderTemplate", GetRegistryLanguage().str()); OSVERSIONINFO osvi; osvi.dwOSVersionInfoSize=sizeof(OSVERSIONINFO); if (GetVersionEx(&osvi)) @@ -151,7 +151,7 @@ void HeaderTemplateManager::init( void ) fname = tempName; } } - ini.load( fname, INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( fname, INI_LOAD_OVERWRITE, NULL ); populateGameFonts(); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp index b7b94f62d08..178c90049e0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp @@ -150,8 +150,8 @@ void Shell::init( void ) { INI ini; // Read from INI all the ShellMenuScheme - ini.load( AsciiString( "Data\\INI\\Default\\ShellMenuScheme.ini" ), INI_LOAD_OVERWRITE, NULL ); - ini.load( AsciiString( "Data\\INI\\ShellMenuScheme.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Default\\ShellMenuScheme" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\ShellMenuScheme" ), INI_LOAD_OVERWRITE, NULL ); if( m_schemeManager ) m_schemeManager->init(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp index 11f9aa7ce14..bde8ca62deb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp @@ -282,8 +282,8 @@ void ShellMenuSchemeManager::init( void ) { INI ini; // Read from INI all the ControlBarSchemes - ini.load( AsciiString( "Data\\INI\\Default\\ShellMenuScheme.ini" ), INI_LOAD_OVERWRITE, NULL ); - ini.load( AsciiString( "Data\\INI\\ShellMenuScheme.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Default\\ShellMenuScheme" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\ShellMenuScheme" ), INI_LOAD_OVERWRITE, NULL ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp index 76228beb566..a39542afa02 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -249,7 +249,7 @@ void GameClient::init( void ) INI ini; // Load the DrawGroupInfo here, before the Display Manager is loaded. - ini.load("Data\\INI\\DrawGroupInfo.ini", INI_LOAD_OVERWRITE, NULL); + ini.loadFileDirectory("Data\\INI\\DrawGroupInfo", INI_LOAD_OVERWRITE, NULL); // Override the ini values with localized versions: if (TheGlobalLanguageData && TheGlobalLanguageData->m_drawGroupInfoFont.name.isNotEmpty()) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp index 6ab0a30fe6e..885ac52f705 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp @@ -138,7 +138,7 @@ void GlobalLanguage::init( void ) INI ini; AsciiString fname; - fname.format("Data\\%s\\Language.ini", GetRegistryLanguage().str()); + fname.format("Data\\%s\\Language", GetRegistryLanguage().str()); OSVERSIONINFO osvi; osvi.dwOSVersionInfoSize=sizeof(OSVERSIONINFO); @@ -153,7 +153,7 @@ void GlobalLanguage::init( void ) } - ini.load( fname, INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( fname, INI_LOAD_OVERWRITE, NULL ); StringListIt it = m_localFonts.begin(); while( it != m_localFonts.end()) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index a297e567305..0c6365c8e88 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -1129,7 +1129,7 @@ InGameUI::~InGameUI() void InGameUI::init( void ) { INI ini; - ini.load( AsciiString( "Data\\INI\\InGameUI.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\InGameUI" ), INI_LOAD_OVERWRITE, NULL ); //override INI values with language localized values: if (TheGlobalLanguageData) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp index 9e7b8aeac77..ed1631f449f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp @@ -576,7 +576,7 @@ the Win32 version of the mouse (by preloading resources before D3D device is cre void Mouse::parseIni(void) { INI ini; - ini.load( AsciiString( "Data\\INI\\Mouse.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Mouse" ), INI_LOAD_OVERWRITE, NULL ); } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp index 3415586d814..413340cb4f5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp @@ -755,7 +755,7 @@ void Anim2DCollection::init( void ) { INI ini; - ini.load( "Data\\INI\\Animation2D.ini", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Animation2D", INI_LOAD_OVERWRITE, NULL ); } // end init diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp index 136613f018a..f76225f0c4f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp @@ -246,7 +246,7 @@ void CampaignManager::init( void ) { INI ini; // Read from INI all the CampaignManager - ini.load( AsciiString( "Data\\INI\\Campaign.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Campaign" ), INI_LOAD_OVERWRITE, NULL ); } //----------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp index 891ac6d1f0f..df13d4e7a6d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp @@ -242,7 +242,7 @@ void ImageCollection::load( Int textureSize ) if(FindFirstFile(userDataPath.str(), &findData) !=INVALID_HANDLE_VALUE) { userDataPath.format("%sINI\\MappedImages",TheGlobalData->getPath_UserData().str()); - ini.loadDirectory(userDataPath, TRUE, INI_LOAD_OVERWRITE, NULL ); + ini.loadDirectory(userDataPath, INI_LOAD_OVERWRITE, NULL ); } } @@ -251,9 +251,9 @@ void ImageCollection::load( Int textureSize ) // load all the ine files in that directory - ini.loadDirectory( AsciiString( buffer ), TRUE, INI_LOAD_OVERWRITE, NULL ); + ini.loadDirectory( AsciiString( buffer ), INI_LOAD_OVERWRITE, NULL ); - ini.loadDirectory("Data\\INI\\MappedImages\\HandCreated", TRUE, INI_LOAD_OVERWRITE, NULL ); + ini.loadDirectory("Data\\INI\\MappedImages\\HandCreated", INI_LOAD_OVERWRITE, NULL ); } // end load diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp index f5089ce1dd0..cca49907287 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -2865,7 +2865,7 @@ void ParticleSystemManager::init( void ) { /// Read INI data and build templates INI ini; - ini.load( AsciiString( "Data\\INI\\ParticleSystem.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\ParticleSystem" ), INI_LOAD_OVERWRITE, NULL ); // sanity, our lists must be empty!! for( Int i = 0; i < NUM_PARTICLE_PRIORITIES; ++i ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 921b00416bd..95ae898914d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -2484,6 +2484,9 @@ void GameLogic::loadMapINI( AsciiString mapName ) ini.load( AsciiString(fullFledgeFilename), INI_LOAD_CREATE_OVERRIDES, NULL ); } + // TheSuperHackers @todo Implement ini load directory for map folder. + // Requires adjustments in map transfer. + sprintf(fullFledgeFilename, "%s\\solo.ini", filename); if (TheFileSystem->doesFileExist(fullFledgeFilename)) { DEBUG_LOG(("Loading solo.ini")); diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/WOLBrowser/WebBrowser.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/WOLBrowser/WebBrowser.cpp index 42a28dc146d..970ed83d00c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/WOLBrowser/WebBrowser.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/WOLBrowser/WebBrowser.cpp @@ -167,7 +167,7 @@ void WebBrowser::init() { m_urlList = NULL; INI ini; - ini.load( AsciiString( "Data\\INI\\Webpages.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Webpages" ), INI_LOAD_OVERWRITE, NULL ); } /****************************************************************************** diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilder.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilder.cpp index 5e77fd3272e..2225c6f9a24 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilder.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilder.cpp @@ -86,10 +86,10 @@ static SubsystemInterfaceList TheSubsystemListRecord; template -void initSubsystem(SUBSYSTEM*& sysref, SUBSYSTEM* sys, const char* path1 = NULL, const char* path2 = NULL, const char* dirpath = NULL) +void initSubsystem(SUBSYSTEM*& sysref, SUBSYSTEM* sys, const char* path1 = NULL, const char* path2 = NULL) { sysref = sys; - TheSubsystemListRecord.initSubsystem(sys, path1, path2, dirpath, NULL); + TheSubsystemListRecord.initSubsystem(sys, path1, path2, NULL); } @@ -348,10 +348,10 @@ BOOL CWorldBuilderApp::InitInstance() INI ini; - initSubsystem(TheWritableGlobalData, new GlobalData(), "Data\\INI\\Default\\GameData.ini", "Data\\INI\\GameData.ini"); + initSubsystem(TheWritableGlobalData, new GlobalData(), "Data\\INI\\Default\\GameData", "Data\\INI\\GameData"); #if defined(RTS_DEBUG) - ini.load( AsciiString( "Data\\INI\\GameDataDebug.ini" ), INI_LOAD_MULTIFILE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\GameDataDebug" ), INI_LOAD_MULTIFILE, NULL ); #endif #ifdef DEBUG_CRASHING @@ -377,14 +377,14 @@ BOOL CWorldBuilderApp::InitInstance() CreateDirectory(buf, NULL); // read the water settings from INI (must do prior to initing GameClient, apparently) - ini.load( AsciiString( "Data\\INI\\Default\\Water.ini" ), INI_LOAD_OVERWRITE, NULL ); - ini.load( AsciiString( "Data\\INI\\Water.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Default\\Water" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\INI\\Water" ), INI_LOAD_OVERWRITE, NULL ); initSubsystem(TheGameText, CreateGameTextInterface()); - initSubsystem(TheScienceStore, new ScienceStore(), "Data\\INI\\Default\\Science.ini", "Data\\INI\\Science.ini"); - initSubsystem(TheMultiplayerSettings, new MultiplayerSettings(), "Data\\INI\\Default\\Multiplayer.ini", "Data\\INI\\Multiplayer.ini"); - initSubsystem(TheTerrainTypes, new TerrainTypeCollection(), "Data\\INI\\Default\\Terrain.ini", "Data\\INI\\Terrain.ini"); - initSubsystem(TheTerrainRoads, new TerrainRoadCollection(), "Data\\INI\\Default\\Roads.ini", "Data\\INI\\Roads.ini"); + initSubsystem(TheScienceStore, new ScienceStore(), "Data\\INI\\Default\\Science", "Data\\INI\\Science"); + initSubsystem(TheMultiplayerSettings, new MultiplayerSettings(), "Data\\INI\\Default\\Multiplayer", "Data\\INI\\Multiplayer"); + initSubsystem(TheTerrainTypes, new TerrainTypeCollection(), "Data\\INI\\Default\\Terrain", "Data\\INI\\Terrain"); + initSubsystem(TheTerrainRoads, new TerrainRoadCollection(), "Data\\INI\\Default\\Roads", "Data\\INI\\Roads"); WorldHeightMapEdit::init(); @@ -393,7 +393,7 @@ BOOL CWorldBuilderApp::InitInstance() TheScriptEngine->turnBreezeOff(); // stop the tree sway. // [2/11/2003] - ini.load( AsciiString( "Data\\Scripts\\Scripts.ini" ), INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( AsciiString( "Data\\Scripts\\Scripts" ), INI_LOAD_OVERWRITE, NULL ); // need this before TheAudio in case we're running off of CD - TheAudio can try to open Music.big on the CD... initSubsystem(TheCDManager, CreateCDManager(), NULL); @@ -405,19 +405,19 @@ BOOL CWorldBuilderApp::InitInstance() initSubsystem(TheModuleFactory, (ModuleFactory*)(new W3DModuleFactory())); initSubsystem(TheSidesList, new SidesList()); initSubsystem(TheCaveSystem, new CaveSystem()); - initSubsystem(TheRankInfoStore, new RankInfoStore(), NULL, "Data\\INI\\Rank.ini"); - initSubsystem(ThePlayerTemplateStore, new PlayerTemplateStore(), "Data\\INI\\Default\\PlayerTemplate.ini", "Data\\INI\\PlayerTemplate.ini"); - initSubsystem(TheSpecialPowerStore, new SpecialPowerStore(), "Data\\INI\\Default\\SpecialPower.ini", "Data\\INI\\SpecialPower.ini" ); + initSubsystem(TheRankInfoStore, new RankInfoStore(), NULL, "Data\\INI\\Rank"); + initSubsystem(ThePlayerTemplateStore, new PlayerTemplateStore(), "Data\\INI\\Default\\PlayerTemplate", "Data\\INI\\PlayerTemplate"); + initSubsystem(TheSpecialPowerStore, new SpecialPowerStore(), "Data\\INI\\Default\\SpecialPower", "Data\\INI\\SpecialPower" ); initSubsystem(TheParticleSystemManager, (ParticleSystemManager*)(new W3DParticleSystemManager())); - initSubsystem(TheFXListStore, new FXListStore(), "Data\\INI\\Default\\FXList.ini", "Data\\INI\\FXList.ini"); - initSubsystem(TheWeaponStore, new WeaponStore(), NULL, "Data\\INI\\Weapon.ini"); - initSubsystem(TheObjectCreationListStore, new ObjectCreationListStore(), "Data\\INI\\Default\\ObjectCreationList.ini", "Data\\INI\\ObjectCreationList.ini"); - initSubsystem(TheLocomotorStore, new LocomotorStore(), NULL, "Data\\INI\\Locomotor.ini"); - initSubsystem(TheDamageFXStore, new DamageFXStore(), NULL, "Data\\INI\\DamageFX.ini"); - initSubsystem(TheArmorStore, new ArmorStore(), NULL, "Data\\INI\\Armor.ini"); - initSubsystem(TheThingFactory, new ThingFactory(), "Data\\INI\\Default\\Object.ini", NULL, "Data\\INI\\Object"); - initSubsystem(TheCrateSystem, new CrateSystem(), "Data\\INI\\Default\\Crate.ini", "Data\\INI\\Crate.ini"); - initSubsystem(TheUpgradeCenter, new UpgradeCenter, "Data\\INI\\Default\\Upgrade.ini", "Data\\INI\\Upgrade.ini"); + initSubsystem(TheFXListStore, new FXListStore(), "Data\\INI\\Default\\FXList", "Data\\INI\\FXList"); + initSubsystem(TheWeaponStore, new WeaponStore(), NULL, "Data\\INI\\Weapon"); + initSubsystem(TheObjectCreationListStore, new ObjectCreationListStore(), "Data\\INI\\Default\\ObjectCreationList", "Data\\INI\\ObjectCreationList"); + initSubsystem(TheLocomotorStore, new LocomotorStore(), NULL, "Data\\INI\\Locomotor"); + initSubsystem(TheDamageFXStore, new DamageFXStore(), NULL, "Data\\INI\\DamageFX"); + initSubsystem(TheArmorStore, new ArmorStore(), NULL, "Data\\INI\\Armor"); + initSubsystem(TheThingFactory, new ThingFactory(), "Data\\INI\\Default\\Object", "Data\\INI\\Object"); + initSubsystem(TheCrateSystem, new CrateSystem(), "Data\\INI\\Default\\Crate", "Data\\INI\\Crate"); + initSubsystem(TheUpgradeCenter, new UpgradeCenter, "Data\\INI\\Default\\Upgrade", "Data\\INI\\Upgrade"); initSubsystem(TheAnim2DCollection, new Anim2DCollection ); //Init's itself. TheSubsystemListRecord.postProcessLoadAll(); From 87de0a0d41e793ebd7acdded5fc371582d36c8f4 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 4 Sep 2025 11:45:57 +0200 Subject: [PATCH 044/343] bugfix(scrolling): Fix vertical scroll speed bugs (#1492) --- .../Source/W3DDevice/GameClient/W3DView.cpp | 26 +++++++++++-------- .../Source/W3DDevice/GameClient/W3DView.cpp | 26 +++++++++++-------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 765e6656f5b..5b4fa013718 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -1653,32 +1653,36 @@ void W3DView::setSnapMode( CameraLockType lockType, Real lockDist ) } //------------------------------------------------------------------------------------------------- -/** Scroll the view by the given delta in SCREEN COORDINATES, this interface - * assumes we will be scrolling along the X,Y plane */ +// Scroll the view by the given delta in SCREEN COORDINATES, this interface +// assumes we will be scrolling along the X,Y plane +// +// TheSuperHackers @bugfix Now rotates the view plane on the Z axis only to properly discard the +// camera pitch. The aspect ratio also no longer modifies the vertical scroll speed. //------------------------------------------------------------------------------------------------- void W3DView::scrollBy( Coord2D *delta ) { // if we haven't moved, ignore if( delta && (delta->x != 0 || delta->y != 0) ) { - const Real SCROLL_RESOLUTION = 250.0f; + CONSTEXPR const Real SCROLL_RESOLUTION = 250.0f; Vector3 world, worldStart, worldEnd; - Vector2 screen, start, end; + Vector2 start, end; m_scrollAmount = *delta; - screen.X = delta->x; - screen.Y = delta->y; - start.X = getWidth(); start.Y = getHeight(); - Real aspect = getHeight() == 0 ? 1 : getWidth()/getHeight(); + end.X = start.X + delta->x * SCROLL_RESOLUTION; - end.Y = start.Y + delta->y * SCROLL_RESOLUTION*aspect; + end.Y = start.Y + delta->y * SCROLL_RESOLUTION; + + m_3DCamera->Device_To_View_Space( start, &worldStart ); + m_3DCamera->Device_To_View_Space( end, &worldEnd ); - m_3DCamera->Device_To_World_Space( start, &worldStart ); - m_3DCamera->Device_To_World_Space( end, &worldEnd ); + const Real zRotation = m_3DCamera->Get_Transform().Get_Z_Rotation(); + worldStart.Rotate_Z(zRotation); + worldEnd.Rotate_Z(zRotation); world.X = worldEnd.X - worldStart.X; world.Y = worldEnd.Y - worldStart.Y; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 6629fb9c640..41dce19ad42 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -1818,32 +1818,36 @@ void W3DView::setSnapMode( CameraLockType lockType, Real lockDist ) } //------------------------------------------------------------------------------------------------- -/** Scroll the view by the given delta in SCREEN COORDINATES, this interface - * assumes we will be scrolling along the X,Y plane */ +// Scroll the view by the given delta in SCREEN COORDINATES, this interface +// assumes we will be scrolling along the X,Y plane +// +// TheSuperHackers @bugfix Now rotates the view plane on the Z axis only to properly discard the +// camera pitch. The aspect ratio also no longer modifies the vertical scroll speed. //------------------------------------------------------------------------------------------------- void W3DView::scrollBy( Coord2D *delta ) { // if we haven't moved, ignore if( delta && (delta->x != 0 || delta->y != 0) ) { - const Real SCROLL_RESOLUTION = 250.0f; + CONSTEXPR const Real SCROLL_RESOLUTION = 250.0f; Vector3 world, worldStart, worldEnd; - Vector2 screen, start, end; + Vector2 start, end; m_scrollAmount = *delta; - screen.X = delta->x; - screen.Y = delta->y; - start.X = getWidth(); start.Y = getHeight(); - Real aspect = getHeight() == 0 ? 1 : getWidth()/getHeight(); + end.X = start.X + delta->x * SCROLL_RESOLUTION; - end.Y = start.Y + delta->y * SCROLL_RESOLUTION*aspect; + end.Y = start.Y + delta->y * SCROLL_RESOLUTION; + + m_3DCamera->Device_To_View_Space( start, &worldStart ); + m_3DCamera->Device_To_View_Space( end, &worldEnd ); - m_3DCamera->Device_To_World_Space( start, &worldStart ); - m_3DCamera->Device_To_World_Space( end, &worldEnd ); + const Real zRotation = m_3DCamera->Get_Transform().Get_Z_Rotation(); + worldStart.Rotate_Z(zRotation); + worldEnd.Rotate_Z(zRotation); world.X = worldEnd.X - worldStart.X; world.Y = worldEnd.Y - worldStart.Y; From 8012ea0557283fc9723ce6c60ffdfc384856121b Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Fri, 5 Sep 2025 16:26:00 +1000 Subject: [PATCH 045/343] tweak(eva): Enable EVA events for the observed player (#1519) --- Generals/Code/GameEngine/Include/GameClient/ControlBar.h | 2 ++ Generals/Code/GameEngine/Source/GameClient/Eva.cpp | 5 +++-- .../Source/GameClient/GUI/ControlBar/ControlBar.cpp | 8 ++++++++ .../Code/GameEngine/Include/GameClient/ControlBar.h | 2 ++ GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp | 5 +++-- .../Source/GameClient/GUI/ControlBar/ControlBar.cpp | 8 ++++++++ 6 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/ControlBar.h b/Generals/Code/GameEngine/Include/GameClient/ControlBar.h index e5dbe966aed..e8a8b072604 100644 --- a/Generals/Code/GameEngine/Include/GameClient/ControlBar.h +++ b/Generals/Code/GameEngine/Include/GameClient/ControlBar.h @@ -735,6 +735,8 @@ class ControlBar : public SubsystemInterface Player* getCurrentlyViewedPlayer(); /// Returns the relationship with the currently viewed player. May return NEUTRAL if no player is selected while observing. Relationship getCurrentlyViewedPlayerRelationship(const Team* team); + /// Returns the currently viewed player. Returns "Observer" if no player is selected while observing. + AsciiString getCurrentlyViewedPlayerSide(); // ControlBarResizer *getControlBarResizer( void ) {return m_controlBarResizer;} diff --git a/Generals/Code/GameEngine/Source/GameClient/Eva.cpp b/Generals/Code/GameEngine/Source/GameClient/Eva.cpp index d7c71edaaae..d43f4218571 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Eva.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Eva.cpp @@ -25,6 +25,7 @@ // GameClient/Eva.cpp ///////////////////////////////////////////////////////////////////////////// #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine +#include "GameClient/ControlBar.h" #include "GameClient/Eva.h" #include "Common/Player.h" @@ -213,7 +214,7 @@ void Eva::update() return; } - m_localPlayer = ThePlayerList->getLocalPlayer(); + m_localPlayer = TheControlBar->getCurrentlyViewedPlayer(); UnsignedInt frame = TheGameLogic->getFrame(); // Don't update for the first few frames. This way, we don't have to deal with our initial power @@ -428,7 +429,7 @@ void Eva::processPlayingMessages(UnsignedInt currentFrame) } // We've got a winner! - AsciiString side = ThePlayerList->getLocalPlayer()->getSide(); + AsciiString side = TheControlBar->getCurrentlyViewedPlayerSide(); Int numSides = storedIt->m_evaInfo->m_evaSideSounds.size(); for (Int i = 0; i < numSides; ++i) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 8b5267a567f..af70f52f62e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -173,6 +173,14 @@ Relationship ControlBar::getCurrentlyViewedPlayerRelationship(const Team* team) return NEUTRAL; } +AsciiString ControlBar::getCurrentlyViewedPlayerSide() +{ + if (Player* player = getCurrentlyViewedPlayer()) + player->getSide(); + + return ThePlayerList->getLocalPlayer()->getSide(); +} + void ControlBar::populatePurchaseScience( Player* player ) { // TheInGameUI->deselectAllDrawables(); diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h index 2cb95f51a0c..59087b2ef9d 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h @@ -749,6 +749,8 @@ class ControlBar : public SubsystemInterface Player* getCurrentlyViewedPlayer(); /// Returns the relationship with the currently viewed player. May return NEUTRAL if no player is selected while observing. Relationship getCurrentlyViewedPlayerRelationship(const Team* team); + /// Returns the currently viewed player. Returns "Observer" if no player is selected while observing. + AsciiString getCurrentlyViewedPlayerSide(); // ControlBarResizer *getControlBarResizer( void ) {return m_controlBarResizer;} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp index 042c072a7e6..6bdbc655b04 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp @@ -25,6 +25,7 @@ // GameClient/Eva.cpp ///////////////////////////////////////////////////////////////////////////// #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine +#include "GameClient/ControlBar.h" #include "GameClient/Eva.h" #include "Common/Player.h" @@ -286,7 +287,7 @@ void Eva::update() return; } - m_localPlayer = ThePlayerList->getLocalPlayer(); + m_localPlayer = TheControlBar->getCurrentlyViewedPlayer(); UnsignedInt frame = TheGameLogic->getFrame(); // Don't update for the first few frames. This way, we don't have to deal with our initial power @@ -515,7 +516,7 @@ void Eva::processPlayingMessages(UnsignedInt currentFrame) } // We've got a winner! - AsciiString side = ThePlayerList->getLocalPlayer()->getSide(); + AsciiString side = TheControlBar->getCurrentlyViewedPlayerSide(); Int numSides = storedIt->m_evaInfo->m_evaSideSounds.size(); // clear it. If we can't find the side we want, don't play anything diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 7fb6bd1307a..42b35f3d5b2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -174,6 +174,14 @@ Relationship ControlBar::getCurrentlyViewedPlayerRelationship(const Team* team) return NEUTRAL; } +AsciiString ControlBar::getCurrentlyViewedPlayerSide() +{ + if (Player* player = getCurrentlyViewedPlayer()) + return player->getSide(); + + return ThePlayerList->getLocalPlayer()->getSide(); +} + void ControlBar::populatePurchaseScience( Player* player ) { // TheInGameUI->deselectAllDrawables(); From 4c3dd2e82e2f9821c2b99d6fd6ac5b587a11cc6d Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Fri, 5 Sep 2025 16:30:16 +1000 Subject: [PATCH 046/343] bugfix(upgrade): Fix fake GLA structures losing their selection and grouping when upgraded to real structures (#1521) --- .../Object/Upgrade/ReplaceObjectUpgrade.cpp | 59 ++++++++++++++----- 1 file changed, 45 insertions(+), 14 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ReplaceObjectUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ReplaceObjectUpgrade.cpp index 989d6214f8d..9f56af1d0e5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ReplaceObjectUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ReplaceObjectUpgrade.cpp @@ -38,6 +38,7 @@ #include "GameLogic/GameLogic.h" #include "GameLogic/Module/CreateModule.h" #include "GameLogic/Object.h" +#include "GameClient/InGameUI.h" // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -70,23 +71,34 @@ ReplaceObjectUpgrade::~ReplaceObjectUpgrade( void ) void ReplaceObjectUpgrade::upgradeImplementation( ) { const ReplaceObjectUpgradeModuleData *data = getReplaceObjectUpgradeModuleData(); + const ThingTemplate* replacementTemplate = TheThingFactory->findTemplate(data->m_replaceObjectName); - Object *me = getObject(); + Bool oldObjectSelected; + Int oldObjectSquadNumber; + Matrix3D myMatrix; + Team* myTeam; - Matrix3D myMatrix = *me->getTransformMatrix(); - Team *myTeam = me->getTeam();// Team implies player. It is a subset. - - const ThingTemplate *replacementTemplate = TheThingFactory->findTemplate(data->m_replaceObjectName); - if( replacementTemplate == NULL ) { - DEBUG_ASSERTCRASH(replacementTemplate != NULL, ("No such object '%s' in ReplaceObjectUpgrade.", data->m_replaceObjectName.str() ) ); - return; - } + Object* me = getObject(); + + myMatrix = *me->getTransformMatrix(); + myTeam = me->getTeam();// Team implies player. It is a subset. - // Remove us first since occupation of cells is apparently not a refcount, but a flag. If I don't remove, then the new - // thing will be placed, and then on deletion I will remove "his" marks. - TheAI->pathfinder()->removeObjectFromPathfindMap( me ); - TheGameLogic->destroyObject(me); + if (replacementTemplate == NULL) + { + DEBUG_ASSERTCRASH(replacementTemplate != NULL, ("No such object '%s' in ReplaceObjectUpgrade.", data->m_replaceObjectName.str())); + return; + } + + Drawable* selectedDrawable = TheInGameUI->getFirstSelectedDrawable(); + oldObjectSelected = selectedDrawable && selectedDrawable->getID() == me->getDrawable()->getID(); + oldObjectSquadNumber = me->getControllingPlayer()->getSquadNumberForObject(me); + + // Remove us first since occupation of cells is apparently not a refcount, but a flag. If I don't remove, then the new + // thing will be placed, and then on deletion I will remove "his" marks. + TheAI->pathfinder()->removeObjectFromPathfindMap(me); + TheGameLogic->destroyObject(me); + } Object *replacementObject = TheThingFactory->newObject(replacementTemplate, myTeam); replacementObject->setTransformMatrix(&myMatrix); @@ -104,7 +116,26 @@ void ReplaceObjectUpgrade::upgradeImplementation( ) if( replacementObject->getControllingPlayer() ) { - replacementObject->getControllingPlayer()->onStructureConstructionComplete(me, replacementObject, FALSE); + replacementObject->getControllingPlayer()->onStructureConstructionComplete(NULL, replacementObject, FALSE); + + // TheSuperHackers @bugfix Stubbjax 26/05/2025 If the old object was selected, select the new one. + if (oldObjectSelected) + { + GameMessage* msg = TheMessageStream->appendMessage(GameMessage::MSG_CREATE_SELECTED_GROUP_NO_SOUND); + msg->appendBooleanArgument(TRUE); + msg->appendObjectIDArgument(replacementObject->getID()); + TheInGameUI->selectDrawable(replacementObject->getDrawable()); + } + + // TheSuperHackers @bugfix Stubbjax 26/05/2025 If the old object was grouped, group the new one. + if (oldObjectSquadNumber != NO_HOTKEY_SQUAD) + { + if (replacementObject->isLocallyControlled()) + { + GameMessage* msg = TheMessageStream->appendMessage((GameMessage::Type)(GameMessage::MSG_CREATE_TEAM0 + oldObjectSquadNumber)); + msg->appendObjectIDArgument(replacementObject->getID()); + } + } } } From 32c8b0c8bc02d9175b7300923ae3b3c07e69535c Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 4 Sep 2025 10:06:32 +0200 Subject: [PATCH 047/343] unify(text): Backport fast forward instructions text from Zero Hour (#1535) --- .../Code/GameEngine/Source/GameLogic/System/GameLogic.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index dc4fc1a8d4f..cda3634f71c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -2095,6 +2095,13 @@ void GameLogic::startNewGame( Bool saveGame ) if (TheGameSpyInfo) TheGameSpyInfo->updateAdditionalGameSpyDisconnections(1); + + if ( isInReplayGame() && TheInGameUI && TheGameText ) + { + TheInGameUI->message( TheGameText->fetch( "GUI:FastForwardInstructions" ) ); + } + + } // end startNewGame //----------------------------------------------------------------------------------------- From f2f9acd776134bd2701682c6f46a1f7dfd36ab56 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 4 Sep 2025 10:09:01 +0200 Subject: [PATCH 048/343] tweak(text): Add English substitute text for Fast Forward messages (#1535) --- .../Source/GameClient/MessageStream/CommandXlat.cpp | 5 ++++- .../GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp | 5 ++++- .../Code/GameEngine/Source/GameLogic/System/GameLogic.cpp | 2 +- .../Source/GameClient/MessageStream/CommandXlat.cpp | 5 ++++- .../GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp | 5 ++++- .../Code/GameEngine/Source/GameLogic/System/GameLogic.cpp | 2 +- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 4b122127281..694a75254d7 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -3290,7 +3290,10 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage #endif { TheWritableGlobalData->m_TiVOFastMode = 1 - TheGlobalData->m_TiVOFastMode; - TheInGameUI->messageNoFormat( TheGlobalData->m_TiVOFastMode ? TheGameText->fetch("GUI:FF_ON") : TheGameText->fetch("GUI:FF_OFF") ); + TheInGameUI->messageNoFormat( TheGlobalData->m_TiVOFastMode + ? TheGameText->FETCH_OR_SUBSTITUTE("GUI:FF_ON", L"Fast Forward is on") + : TheGameText->FETCH_OR_SUBSTITUTE("GUI:FF_OFF", L"Fast Forward is off") + ); } } // end if diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp index e83b031cd62..9eb6e1f18ec 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp @@ -466,7 +466,10 @@ GameMessageDisposition MetaEventTranslator::translateGameMessage(const GameMessa TheWritableGlobalData->m_TiVOFastMode = 1 - TheGlobalData->m_TiVOFastMode; if ( TheInGameUI ) - TheInGameUI->message( TheGlobalData->m_TiVOFastMode ? TheGameText->fetch("GUI:FF_ON") : TheGameText->fetch("GUI:FF_OFF") ); + TheInGameUI->messageNoFormat( TheGlobalData->m_TiVOFastMode + ? TheGameText->FETCH_OR_SUBSTITUTE("GUI:FF_ON", L"Fast Forward is on") + : TheGameText->FETCH_OR_SUBSTITUTE("GUI:FF_OFF", L"Fast Forward is off") + ); } disp = KEEP_MESSAGE; // cause for goodness sake, this key gets used a lot by non-replay hotkeys break; diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index cda3634f71c..7aceaef728e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -2098,7 +2098,7 @@ void GameLogic::startNewGame( Bool saveGame ) if ( isInReplayGame() && TheInGameUI && TheGameText ) { - TheInGameUI->message( TheGameText->fetch( "GUI:FastForwardInstructions" ) ); + TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE( "GUI:FastForwardInstructions", L"Press F to toggle Fast Forward" ) ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 994d62e95f8..ac36fb46f93 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -3440,7 +3440,10 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage #endif { TheWritableGlobalData->m_TiVOFastMode = 1 - TheGlobalData->m_TiVOFastMode; - TheInGameUI->messageNoFormat( TheGlobalData->m_TiVOFastMode ? TheGameText->fetch("GUI:FF_ON") : TheGameText->fetch("GUI:FF_OFF") ); + TheInGameUI->messageNoFormat( TheGlobalData->m_TiVOFastMode + ? TheGameText->FETCH_OR_SUBSTITUTE("GUI:FF_ON", L"Fast Forward is on") + : TheGameText->FETCH_OR_SUBSTITUTE("GUI:FF_OFF", L"Fast Forward is off") + ); } } // end if diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp index 7b854dece5a..90484e191e8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp @@ -509,7 +509,10 @@ GameMessageDisposition MetaEventTranslator::translateGameMessage(const GameMessa TheWritableGlobalData->m_TiVOFastMode = 1 - TheGlobalData->m_TiVOFastMode; if ( TheInGameUI ) - TheInGameUI->message( TheGlobalData->m_TiVOFastMode ? TheGameText->fetch("GUI:FF_ON") : TheGameText->fetch("GUI:FF_OFF") ); + TheInGameUI->messageNoFormat( TheGlobalData->m_TiVOFastMode + ? TheGameText->FETCH_OR_SUBSTITUTE("GUI:FF_ON", L"Fast Forward is on") + : TheGameText->FETCH_OR_SUBSTITUTE("GUI:FF_OFF", L"Fast Forward is off") + ); } disp = KEEP_MESSAGE; // cause for goodness sake, this key gets used a lot by non-replay hotkeys break; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 95ae898914d..9cf79663e6d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -2415,7 +2415,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) if ( isInReplayGame() && TheInGameUI && TheGameText ) { - TheInGameUI->message( TheGameText->fetch( "GUI:FastForwardInstructions" ) ); + TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE( "GUI:FastForwardInstructions", L"Press F to toggle Fast Forward" ) ); } From 22623dbaba2b451aeeca20af0f70ca49e15541ce Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 5 Sep 2025 09:00:38 +0200 Subject: [PATCH 049/343] refactor(language): Remove legacy code for loading Language9x.ini, HeaderTemplate9x.ini (#1534) --- .../Source/GameClient/GUI/HeaderTemplate.cpp | 22 ++++++------------- .../Source/GameClient/GlobalLanguage.cpp | 21 +++++------------- .../Source/GameClient/GUI/HeaderTemplate.cpp | 22 ++++++------------- .../Source/GameClient/GlobalLanguage.cpp | 21 +++++------------- 4 files changed, 25 insertions(+), 61 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp index 6536637be99..df92b513500 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp @@ -136,22 +136,14 @@ HeaderTemplateManager::~HeaderTemplateManager( void ) void HeaderTemplateManager::init( void ) { - INI ini; - AsciiString fname; - fname.format("Data\\%s\\HeaderTemplate", GetRegistryLanguage().str()); - OSVERSIONINFO osvi; - osvi.dwOSVersionInfoSize=sizeof(OSVERSIONINFO); - if (GetVersionEx(&osvi)) - { //check if we're running Win9x variant since they may need different fonts - if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) - { AsciiString tempName; - - tempName.format("Data\\%s\\HeaderTemplate9x.ini", GetRegistryLanguage().str()); - if (TheFileSystem->doesFileExist(tempName.str())) - fname = tempName; - } + { + AsciiString fname; + fname.format("Data\\%s\\HeaderTemplate", GetRegistryLanguage().str()); + + INI ini; + ini.loadFileDirectory( fname, INI_LOAD_OVERWRITE, NULL ); } - ini.loadFileDirectory( fname, INI_LOAD_OVERWRITE, NULL ); + populateGameFonts(); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp b/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp index 38637de3b64..4d6a665c1c3 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp @@ -133,23 +133,14 @@ GlobalLanguage::~GlobalLanguage() void GlobalLanguage::init( void ) { + { + AsciiString fname; + fname.format("Data\\%s\\Language", GetRegistryLanguage().str()); - INI ini; - AsciiString fname; - fname.format("Data\\%s\\Language", GetRegistryLanguage().str()); - - OSVERSIONINFO osvi; - osvi.dwOSVersionInfoSize=sizeof(OSVERSIONINFO); - //GS NOTE: Must call doesFileExist in either case so that NameKeyGenerator will stay in sync - AsciiString tempName; - tempName.format("Data\\%s\\Language9x.ini", GetRegistryLanguage().str()); - bool isExist = TheFileSystem->doesFileExist(tempName.str()); - if (GetVersionEx(&osvi) && osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS && isExist) - { //check if we're running Win9x variant since they may need different fonts - fname = tempName; - } + INI ini; + ini.loadFileDirectory( fname, INI_LOAD_OVERWRITE, NULL ); + } - ini.loadFileDirectory( fname, INI_LOAD_OVERWRITE, NULL ); StringListIt it = m_localFonts.begin(); while( it != m_localFonts.end()) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp index 510ea68d42e..ad7947f766a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp @@ -136,22 +136,14 @@ HeaderTemplateManager::~HeaderTemplateManager( void ) void HeaderTemplateManager::init( void ) { - INI ini; - AsciiString fname; - fname.format("Data\\%s\\HeaderTemplate", GetRegistryLanguage().str()); - OSVERSIONINFO osvi; - osvi.dwOSVersionInfoSize=sizeof(OSVERSIONINFO); - if (GetVersionEx(&osvi)) - { //check if we're running Win9x variant since they may need different fonts - if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) - { AsciiString tempName; - - tempName.format("Data\\%s\\HeaderTemplate9x.ini", GetRegistryLanguage().str()); - if (TheFileSystem->doesFileExist(tempName.str())) - fname = tempName; - } + { + AsciiString fname; + fname.format("Data\\%s\\HeaderTemplate", GetRegistryLanguage().str()); + + INI ini; + ini.loadFileDirectory( fname, INI_LOAD_OVERWRITE, NULL ); } - ini.loadFileDirectory( fname, INI_LOAD_OVERWRITE, NULL ); + populateGameFonts(); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp index 885ac52f705..a1a24bd4e2c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp @@ -135,25 +135,14 @@ GlobalLanguage::~GlobalLanguage() void GlobalLanguage::init( void ) { + { + AsciiString fname; + fname.format("Data\\%s\\Language", GetRegistryLanguage().str()); - INI ini; - AsciiString fname; - fname.format("Data\\%s\\Language", GetRegistryLanguage().str()); - - OSVERSIONINFO osvi; - osvi.dwOSVersionInfoSize=sizeof(OSVERSIONINFO); - - //GS NOTE: Must call doesFileExist in either case so that NameKeyGenerator will stay in sync - AsciiString tempName; - tempName.format("Data\\%s\\Language9x.ini", GetRegistryLanguage().str()); - bool isExist = TheFileSystem->doesFileExist(tempName.str()); - if (GetVersionEx(&osvi) && osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS && isExist) - { //check if we're running Win9x variant since they may need different fonts - fname = tempName; + INI ini; + ini.loadFileDirectory( fname, INI_LOAD_OVERWRITE, NULL ); } - - ini.loadFileDirectory( fname, INI_LOAD_OVERWRITE, NULL ); StringListIt it = m_localFonts.begin(); while( it != m_localFonts.end()) { From 636c40f07c3e979d4fd579f3b172735036d54350 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Fri, 5 Sep 2025 17:08:50 +1000 Subject: [PATCH 050/343] tweak(command): Allow observer to view the Hero unit of the currently observed player with a button press (#1525) The command to view the Hero unit is bound to key CTRL+H by default --- .../GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp | 2 +- .../GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 694a75254d7..ee6d794f70a 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -926,7 +926,7 @@ void amIAHero(Object* obj, void* heroHolder) static Object *iNeedAHero( void ) { - Player* localPlayer = ThePlayerList->getLocalPlayer(); + Player* localPlayer = TheControlBar->getCurrentlyViewedPlayer(); if (!localPlayer) return NULL; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index ac36fb46f93..3f994adb3c4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -985,7 +985,7 @@ void amIAHero(Object* obj, void* heroHolder) static Object *iNeedAHero( void ) { - Player* localPlayer = ThePlayerList->getLocalPlayer(); + Player* localPlayer = TheControlBar->getCurrentlyViewedPlayer(); if (!localPlayer) return NULL; From 0cd2963a70189562c439a86e82a18bc76cc3493b Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Tue, 9 Sep 2025 16:13:12 +1000 Subject: [PATCH 051/343] bugfix(aiupdate): Chinooks no longer get stuck when performing Combat Drops into buildings above terrain height (#1542) --- .../GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp | 4 ++++ .../GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index b74c2beb969..2e100ab2fad 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -360,7 +360,11 @@ class ChinookCombatDropState : public State for (std::list::iterator oit = it->rappellerIDs.begin(); oit != it->rappellerIDs.end(); ) { Object* rappeller = TheGameLogic->findObjectByID(*oit); +#if RETAIL_COMPATIBLE_CRC if (rappeller == NULL || rappeller->isEffectivelyDead() || !rappeller->isAboveTerrain()) +#else + if (rappeller == NULL || rappeller->isEffectivelyDead() || !rappeller->isAboveTerrain() || rappeller->isContained()) +#endif { oit = it->rappellerIDs.erase(oit); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index 420025cb111..0fbc8e82953 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -361,7 +361,11 @@ class ChinookCombatDropState : public State for (std::list::iterator oit = it->rappellerIDs.begin(); oit != it->rappellerIDs.end(); ) { Object* rappeller = TheGameLogic->findObjectByID(*oit); +#if RETAIL_COMPATIBLE_CRC if (rappeller == NULL || rappeller->isEffectivelyDead() || !rappeller->isAboveTerrain()) +#else + if (rappeller == NULL || rappeller->isEffectivelyDead() || !rappeller->isAboveTerrain() || rappeller->isContained()) +#endif { oit = it->rappellerIDs.erase(oit); } From 481f473911464b337ce2e22f7a25c704cbd2612e Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Tue, 9 Sep 2025 16:15:20 +1000 Subject: [PATCH 052/343] bugfix(input): Prevent command execution when attempting to exit command context while moving the camera (#1501) --- .../Source/GameClient/MessageStream/SelectionXlat.cpp | 10 +--------- .../Source/GameClient/MessageStream/SelectionXlat.cpp | 10 +--------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp index 0e1342de29c..82d27310a5b 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp @@ -917,16 +917,8 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa ICoord2D pixel = msg->getArgument( 0 )->pixel; UnsignedInt currentTime = (UnsignedInt) msg->getArgument( 2 )->integer; - Bool isClick = TheMouse->isClick(&m_deselectFeedbackAnchor, &pixel, m_lastClick, currentTime); - - if (isClick && - cameraPos.length() > TheMouse->m_dragTolerance3D) - { - isClick = FALSE; - } - // right click behavior (not right drag) - if (isClick) + if (TheMouse->isClick(&m_deselectFeedbackAnchor, &pixel, m_lastClick, currentTime)) { //Added support to cancel the GUI command without deselecting the unit(s) involved //when you right click. diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp index d447bf0bf22..18442b79c37 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp @@ -993,16 +993,8 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa ICoord2D pixel = msg->getArgument( 0 )->pixel; UnsignedInt currentTime = (UnsignedInt) msg->getArgument( 2 )->integer; - Bool isClick = TheMouse->isClick(&m_deselectFeedbackAnchor, &pixel, m_lastClick, currentTime); - - if (isClick && - cameraPos.length() > TheMouse->m_dragTolerance3D) - { - isClick = FALSE; - } - // right click behavior (not right drag) - if (isClick) + if (TheMouse->isClick(&m_deselectFeedbackAnchor, &pixel, m_lastClick, currentTime)) { //Added support to cancel the GUI command without deselecting the unit(s) involved //when you right click. From 8723184b8443dff4a8f24659bac1d27fb903906c Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Tue, 9 Sep 2025 07:39:51 +0100 Subject: [PATCH 053/343] bugfix(network): Fix runahead logic update to better follow the maximum network latency and avoid stutters and slow downs (#1482) --- .../Include/GameNetwork/ConnectionManager.h | 2 +- .../Include/GameNetwork/NetworkDefs.h | 1 + .../Source/GameNetwork/ConnectionManager.cpp | 43 +++++++------------ .../Source/GameNetwork/NetworkUtil.cpp | 1 + .../Include/GameNetwork/ConnectionManager.h | 2 +- .../Include/GameNetwork/NetworkDefs.h | 1 + .../Source/GameNetwork/ConnectionManager.cpp | 43 +++++++------------ .../Source/GameNetwork/NetworkUtil.cpp | 1 + 8 files changed, 38 insertions(+), 56 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameNetwork/ConnectionManager.h b/Generals/Code/GameEngine/Include/GameNetwork/ConnectionManager.h index 8ed430b04f8..d871e2be9d5 100644 --- a/Generals/Code/GameEngine/Include/GameNetwork/ConnectionManager.h +++ b/Generals/Code/GameEngine/Include/GameNetwork/ConnectionManager.h @@ -174,7 +174,7 @@ class ConnectionManager // void doPerFrameMetrics(UnsignedInt frame); void getMinimumFps(Int &minFps, Int &minFpsPlayer); ///< Returns the smallest FPS in the m_fpsAverages list. - Real getMaximumLatency(); ///< This actually sums the two biggest latencies in the m_latencyAverages list. + Real getMaximumLatency(); ///< Returns the highest average latency between players. void requestFrameDataResend(Int playerID, UnsignedInt frame); ///< request of this player that he send the specified frame's data. diff --git a/Generals/Code/GameEngine/Include/GameNetwork/NetworkDefs.h b/Generals/Code/GameEngine/Include/GameNetwork/NetworkDefs.h index bec66357c3e..f26530ec162 100644 --- a/Generals/Code/GameEngine/Include/GameNetwork/NetworkDefs.h +++ b/Generals/Code/GameEngine/Include/GameNetwork/NetworkDefs.h @@ -36,6 +36,7 @@ static const Int WOL_NAME_LEN = 64; /// Max number of commands per frame static const Int MAX_COMMANDS = 256; +extern Int MIN_LOGIC_FRAMES; extern Int MAX_FRAMES_AHEAD; extern Int MIN_RUNAHEAD; diff --git a/Generals/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/Generals/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp index b78a6f1dfa0..18c199a900e 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp @@ -1246,22 +1246,20 @@ void ConnectionManager::updateRunAhead(Int oldRunAhead, Int frameRate, Bool didS // if the minimum fps is within 10% of the desired framerate, then keep the current minimum fps. minFps = frameRate; } - if (minFps < 5) { - minFps = 5; // Absolutely do not run below 5 fps. - } - if (minFps > TheGlobalData->m_framesPerSecondLimit) { - minFps = TheGlobalData->m_framesPerSecondLimit; // Cap to 30 FPS. - } + + // TheSuperHackers @info this clamps the logic time scale fps in network games + minFps = clamp(MIN_LOGIC_FRAMES, minFps, TheGlobalData->m_framesPerSecondLimit); DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("ConnectionManager::updateRunAhead - minFps after adjustment is %d", minFps)); - Int newRunAhead = (Int)((getMaximumLatency() / 2.0) * (Real)minFps); - newRunAhead += (newRunAhead * TheGlobalData->m_networkRunAheadSlack) / 100; // Add in 10% of slack to the run ahead in case of network hiccups. - if (newRunAhead < MIN_RUNAHEAD) { - newRunAhead = MIN_RUNAHEAD; // make sure its at least MIN_RUNAHEAD. - } - if (newRunAhead > (MAX_FRAMES_AHEAD / 2)) { - newRunAhead = MAX_FRAMES_AHEAD / 2; // dont let run ahead get out of hand. - } + // TheSuperHackers @bugfix Mauller 21/08/2025 calculate the runahead so it always follows the latency + // The runahead should always be rounded up to the next integer value to prevent variations in latency from causing stutter + // The network slack pushes the runahead up to the next value when the latency is within the slack percentage of the current runahead + const Real runAheadSlackScale = 1.0f + ( (Real)TheGlobalData->m_networkRunAheadSlack / 100.0f ); + Int newRunAhead = ceilf( getMaximumLatency() * runAheadSlackScale * (Real)minFps ); + + // TheSuperHackers @info if the runahead goes below 3 logic frames it can start to introduce stutter + // We also limit the upper range of the runahead to prevent it getting out of hand + newRunAhead = clamp(MIN_RUNAHEAD, newRunAhead, MAX_FRAMES_AHEAD / 2); NetRunAheadCommandMsg *msg = newInstance(NetRunAheadCommandMsg); msg->setPlayerID(m_localSlot); @@ -1361,24 +1359,15 @@ void ConnectionManager::updateRunAhead(Int oldRunAhead, Int frameRate, Bool didS } Real ConnectionManager::getMaximumLatency() { - // This works for 2 player games because the latency for the packet router is always 0. - Real lat1 = 0.0; - Real lat2 = 0.0; + Real maxLatency = 0.0f; for (Int i = 0; i < MAX_SLOTS; ++i) { - if (isPlayerConnected(i)) { - if (m_latencyAverages[i] != 0.0) { - if (m_latencyAverages[i] > lat1) { - lat2 = lat1; - lat1 = m_latencyAverages[i]; - } else if (m_latencyAverages[i] > lat2) { - lat2 = m_latencyAverages[i]; - } - } + if (isPlayerConnected(i) && m_latencyAverages[i] > maxLatency) { + maxLatency = m_latencyAverages[i]; } } - return (lat1 + lat2); + return maxLatency; } void ConnectionManager::getMinimumFps(Int &minFps, Int &minFpsPlayer) { diff --git a/Generals/Code/GameEngine/Source/GameNetwork/NetworkUtil.cpp b/Generals/Code/GameEngine/Source/GameNetwork/NetworkUtil.cpp index 03465874a83..4e3d7f18995 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/NetworkUtil.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/NetworkUtil.cpp @@ -29,6 +29,7 @@ // TheSuperHackers @tweak Mauller 26/08/2025 reduce the minimum runahead from 10 // This lets network games run at latencies down to 133ms when the network conditions allow +Int MIN_LOGIC_FRAMES = 5; Int MAX_FRAMES_AHEAD = 128; Int MIN_RUNAHEAD = 4; Int FRAME_DATA_LENGTH = (MAX_FRAMES_AHEAD+1)*2; diff --git a/GeneralsMD/Code/GameEngine/Include/GameNetwork/ConnectionManager.h b/GeneralsMD/Code/GameEngine/Include/GameNetwork/ConnectionManager.h index 0a9629f59c2..da26083c991 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameNetwork/ConnectionManager.h +++ b/GeneralsMD/Code/GameEngine/Include/GameNetwork/ConnectionManager.h @@ -174,7 +174,7 @@ class ConnectionManager // void doPerFrameMetrics(UnsignedInt frame); void getMinimumFps(Int &minFps, Int &minFpsPlayer); ///< Returns the smallest FPS in the m_fpsAverages list. - Real getMaximumLatency(); ///< This actually sums the two biggest latencies in the m_latencyAverages list. + Real getMaximumLatency(); ///< Returns the highest average latency between players. void requestFrameDataResend(Int playerID, UnsignedInt frame); ///< request of this player that he send the specified frame's data. diff --git a/GeneralsMD/Code/GameEngine/Include/GameNetwork/NetworkDefs.h b/GeneralsMD/Code/GameEngine/Include/GameNetwork/NetworkDefs.h index 20e65b3bbab..4c9595dba2f 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameNetwork/NetworkDefs.h +++ b/GeneralsMD/Code/GameEngine/Include/GameNetwork/NetworkDefs.h @@ -36,6 +36,7 @@ static const Int WOL_NAME_LEN = 64; /// Max number of commands per frame static const Int MAX_COMMANDS = 256; +extern Int MIN_LOGIC_FRAMES; extern Int MAX_FRAMES_AHEAD; extern Int MIN_RUNAHEAD; diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp index 26a19a93555..b256cd61143 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp @@ -1246,22 +1246,20 @@ void ConnectionManager::updateRunAhead(Int oldRunAhead, Int frameRate, Bool didS // if the minimum fps is within 10% of the desired framerate, then keep the current minimum fps. minFps = frameRate; } - if (minFps < 5) { - minFps = 5; // Absolutely do not run below 5 fps. - } - if (minFps > TheGlobalData->m_framesPerSecondLimit) { - minFps = TheGlobalData->m_framesPerSecondLimit; // Cap to 30 FPS. - } + + // TheSuperHackers @info this clamps the logic time scale fps in network games + minFps = clamp(MIN_LOGIC_FRAMES, minFps, TheGlobalData->m_framesPerSecondLimit); DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("ConnectionManager::updateRunAhead - minFps after adjustment is %d", minFps)); - Int newRunAhead = (Int)((getMaximumLatency() / 2.0) * (Real)minFps); - newRunAhead += (newRunAhead * TheGlobalData->m_networkRunAheadSlack) / 100; // Add in 10% of slack to the run ahead in case of network hiccups. - if (newRunAhead < MIN_RUNAHEAD) { - newRunAhead = MIN_RUNAHEAD; // make sure its at least MIN_RUNAHEAD. - } - if (newRunAhead > (MAX_FRAMES_AHEAD / 2)) { - newRunAhead = MAX_FRAMES_AHEAD / 2; // dont let run ahead get out of hand. - } + // TheSuperHackers @bugfix Mauller 21/08/2025 calculate the runahead so it always follows the latency + // The runahead should always be rounded up to the next integer value to prevent variations in latency from causing stutter + // The network slack pushes the runahead up to the next value when the latency is within the slack percentage of the current runahead + const Real runAheadSlackScale = 1.0f + ( (Real)TheGlobalData->m_networkRunAheadSlack / 100.0f ); + Int newRunAhead = ceilf( getMaximumLatency() * runAheadSlackScale * (Real)minFps ); + + // TheSuperHackers @info if the runahead goes below 3 logic frames it can start to introduce stutter + // We also limit the upper range of the runahead to prevent it getting out of hand + newRunAhead = clamp(MIN_RUNAHEAD, newRunAhead, MAX_FRAMES_AHEAD / 2); NetRunAheadCommandMsg *msg = newInstance(NetRunAheadCommandMsg); msg->setPlayerID(m_localSlot); @@ -1361,24 +1359,15 @@ void ConnectionManager::updateRunAhead(Int oldRunAhead, Int frameRate, Bool didS } Real ConnectionManager::getMaximumLatency() { - // This works for 2 player games because the latency for the packet router is always 0. - Real lat1 = 0.0; - Real lat2 = 0.0; + Real maxLatency = 0.0f; for (Int i = 0; i < MAX_SLOTS; ++i) { - if (isPlayerConnected(i)) { - if (m_latencyAverages[i] != 0.0) { - if (m_latencyAverages[i] > lat1) { - lat2 = lat1; - lat1 = m_latencyAverages[i]; - } else if (m_latencyAverages[i] > lat2) { - lat2 = m_latencyAverages[i]; - } - } + if (isPlayerConnected(i) && m_latencyAverages[i] > maxLatency) { + maxLatency = m_latencyAverages[i]; } } - return (lat1 + lat2); + return maxLatency; } void ConnectionManager::getMinimumFps(Int &minFps, Int &minFpsPlayer) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetworkUtil.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetworkUtil.cpp index 21daa5b7b1b..bd63851cb44 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetworkUtil.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetworkUtil.cpp @@ -29,6 +29,7 @@ // TheSuperHackers @tweak Mauller 26/08/2025 reduce the minimum runahead from 10 // This lets network games run at latencies down to 133ms when the network conditions allow +Int MIN_LOGIC_FRAMES = 5; Int MAX_FRAMES_AHEAD = 128; Int MIN_RUNAHEAD = 4; Int FRAME_DATA_LENGTH = (MAX_FRAMES_AHEAD+1)*2; From 5eaa6aa39609fa0f9f0c761e5e230b85dc6058e7 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 9 Sep 2025 17:41:24 +0200 Subject: [PATCH 054/343] refactor: Remove superfluous null tests before calls to deleteInstance() (#1529) --- .../Source/Common/Audio/GameAudio.cpp | 10 +- .../GameEngine/Include/Common/Overridable.h | 3 +- .../GameEngine/Include/Common/StateMachine.h | 3 +- .../GameEngine/Include/Common/ThingTemplate.h | 3 +- .../GameEngine/Source/Common/GlobalData.cpp | 3 +- .../Code/GameEngine/Source/Common/INI/INI.cpp | 7 +- .../GameEngine/Source/Common/RTS/Player.cpp | 140 +++++--------- .../GameEngine/Source/Common/RTS/Science.cpp | 4 +- .../GameEngine/Source/Common/RTS/Team.cpp | 12 +- .../GameEngine/Source/Common/StateMachine.cpp | 3 +- .../GameEngine/Source/GameClient/Display.cpp | 3 +- .../GameEngine/Source/GameClient/Drawable.cpp | 30 ++- .../Code/GameEngine/Source/GameClient/Eva.cpp | 3 +- .../GameEngine/Source/GameClient/FXList.cpp | 3 +- .../GameClient/GUI/AnimateWindowManager.cpp | 7 +- .../GameClient/GUI/GameWindowManager.cpp | 3 +- .../GameEngine/Source/GameClient/InGameUI.cpp | 3 +- .../GameClient/System/CampaignManager.cpp | 6 +- .../GameEngine/Source/GameLogic/AI/AI.cpp | 7 +- .../Source/GameLogic/AI/AIGroup.cpp | 13 +- .../Source/GameLogic/AI/AIPathfind.cpp | 17 +- .../Source/GameLogic/AI/AIStates.cpp | 21 +- .../Source/GameLogic/AI/TurretAI.cpp | 3 +- .../Source/GameLogic/Map/SidesList.cpp | 14 +- .../FireWeaponWhenDamagedBehavior.cpp | 26 +-- .../Object/Collide/FireWeaponCollide.cpp | 3 +- .../Source/GameLogic/Object/Locomotor.cpp | 3 +- .../Source/GameLogic/Object/Object.cpp | 4 +- .../GameLogic/Object/ObjectCreationList.cpp | 3 +- .../GameLogic/Object/Update/AIUpdate.cpp | 11 +- .../AIUpdate/DeliverPayloadAIUpdate.cpp | 6 +- .../Object/Update/AIUpdate/DozerAIUpdate.cpp | 5 +- .../Object/Update/AIUpdate/WorkerAIUpdate.cpp | 11 +- .../Object/Update/FireWeaponUpdate.cpp | 3 +- .../GameLogic/Object/Update/PhysicsUpdate.cpp | 14 +- .../Source/GameLogic/Object/Weapon.cpp | 10 +- .../Source/GameLogic/Object/WeaponSet.cpp | 10 +- .../ScriptEngine/ScriptConditions.cpp | 6 +- .../Source/GameLogic/ScriptEngine/Scripts.cpp | 84 +++----- .../Source/GameLogic/System/CaveSystem.cpp | 7 +- .../Source/GameLogic/System/CrateSystem.cpp | 5 +- .../Source/GameLogic/System/RankInfo.cpp | 5 +- .../Source/GameNetwork/Connection.cpp | 28 +-- .../Source/GameNetwork/ConnectionManager.cpp | 76 +++----- .../Source/GameNetwork/FrameData.cpp | 6 +- .../Source/GameNetwork/NetPacket.cpp | 183 ++++++------------ .../W3DDevice/Common/System/W3DRadar.cpp | 12 +- .../Tools/WorldBuilder/include/WorldBuilder.h | 3 +- .../Code/Tools/WorldBuilder/src/CUndoable.cpp | 4 +- .../Tools/WorldBuilder/src/FenceOptions.cpp | 4 +- .../Code/Tools/WorldBuilder/src/FenceTool.cpp | 12 +- .../Code/Tools/WorldBuilder/src/GroveTool.cpp | 4 +- .../Tools/WorldBuilder/src/ObjectOptions.cpp | 4 +- .../Tools/WorldBuilder/src/PickUnitDialog.cpp | 4 +- .../GameEngine/Include/Common/Overridable.h | 3 +- .../GameEngine/Include/Common/StateMachine.h | 3 +- .../GameEngine/Include/Common/ThingTemplate.h | 3 +- .../GameEngine/Source/Common/GlobalData.cpp | 3 +- .../Code/GameEngine/Source/Common/INI/INI.cpp | 7 +- .../GameEngine/Source/Common/RTS/Player.cpp | 140 +++++--------- .../GameEngine/Source/Common/RTS/Science.cpp | 4 +- .../GameEngine/Source/Common/RTS/Team.cpp | 12 +- .../GameEngine/Source/Common/StateMachine.cpp | 3 +- .../GameEngine/Source/GameClient/Display.cpp | 3 +- .../GameEngine/Source/GameClient/Drawable.cpp | 33 ++-- .../Code/GameEngine/Source/GameClient/Eva.cpp | 3 +- .../GameEngine/Source/GameClient/FXList.cpp | 3 +- .../GameClient/GUI/AnimateWindowManager.cpp | 7 +- .../GameClient/GUI/GameWindowManager.cpp | 3 +- .../GameEngine/Source/GameClient/InGameUI.cpp | 3 +- .../GameEngine/Source/GameClient/Snow.cpp | 7 +- .../GameClient/System/CampaignManager.cpp | 6 +- .../GameEngine/Source/GameLogic/AI/AI.cpp | 7 +- .../Source/GameLogic/AI/AIGroup.cpp | 13 +- .../Source/GameLogic/AI/AIPathfind.cpp | 17 +- .../Source/GameLogic/AI/AIStates.cpp | 21 +- .../Source/GameLogic/AI/TurretAI.cpp | 3 +- .../Source/GameLogic/Map/SidesList.cpp | 14 +- .../FireWeaponWhenDamagedBehavior.cpp | 26 +-- .../Object/Collide/FireWeaponCollide.cpp | 3 +- .../Source/GameLogic/Object/Locomotor.cpp | 3 +- .../Source/GameLogic/Object/Object.cpp | 11 +- .../GameLogic/Object/ObjectCreationList.cpp | 3 +- .../GameLogic/Object/Update/AIUpdate.cpp | 11 +- .../AIUpdate/DeliverPayloadAIUpdate.cpp | 6 +- .../Object/Update/AIUpdate/DozerAIUpdate.cpp | 5 +- .../Object/Update/AIUpdate/WorkerAIUpdate.cpp | 11 +- .../Object/Update/FireWeaponUpdate.cpp | 3 +- .../GameLogic/Object/Update/PhysicsUpdate.cpp | 14 +- .../Source/GameLogic/Object/Weapon.cpp | 10 +- .../Source/GameLogic/Object/WeaponSet.cpp | 10 +- .../ScriptEngine/ScriptConditions.cpp | 6 +- .../Source/GameLogic/ScriptEngine/Scripts.cpp | 84 +++----- .../Source/GameLogic/System/CaveSystem.cpp | 7 +- .../Source/GameLogic/System/CrateSystem.cpp | 5 +- .../Source/GameLogic/System/RankInfo.cpp | 5 +- .../Source/GameNetwork/Connection.cpp | 28 +-- .../Source/GameNetwork/ConnectionManager.cpp | 76 +++----- .../Source/GameNetwork/FrameData.cpp | 6 +- .../Source/GameNetwork/NetPacket.cpp | 183 ++++++------------ .../W3DDevice/Common/System/W3DRadar.cpp | 12 +- .../Tools/WorldBuilder/include/WorldBuilder.h | 3 +- .../Code/Tools/WorldBuilder/src/CUndoable.cpp | 4 +- .../Tools/WorldBuilder/src/FenceOptions.cpp | 4 +- .../Code/Tools/WorldBuilder/src/FenceTool.cpp | 12 +- .../Code/Tools/WorldBuilder/src/GroveTool.cpp | 4 +- .../Tools/WorldBuilder/src/ObjectOptions.cpp | 4 +- .../Tools/WorldBuilder/src/PickUnitDialog.cpp | 4 +- 108 files changed, 582 insertions(+), 1179 deletions(-) diff --git a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp index a015cee7d0e..ba1b90c8203 100644 --- a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp +++ b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp @@ -184,11 +184,9 @@ AudioManager::~AudioManager() AudioEventInfoHashIt it; for (it = m_allAudioEventInfo.begin(); it != m_allAudioEventInfo.end(); ++it) { AudioEventInfo *eventInfo = (*it).second; - if (eventInfo) { - deleteInstance(eventInfo); - eventInfo = NULL; - } + deleteInstance(eventInfo); } + m_allAudioEventInfo.clear(); delete m_silentAudioEvent; m_silentAudioEvent = NULL; @@ -807,9 +805,7 @@ AudioRequest *AudioManager::allocateAudioRequest( Bool useAudioEvent ) //------------------------------------------------------------------------------------------------- void AudioManager::releaseAudioRequest( AudioRequest *requestToRelease ) { - if (requestToRelease) { - deleteInstance(requestToRelease); - } + deleteInstance(requestToRelease); } //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/Common/Overridable.h b/Generals/Code/GameEngine/Include/Common/Overridable.h index 68c91bb38d1..3aed1815efc 100644 --- a/Generals/Code/GameEngine/Include/Common/Overridable.h +++ b/Generals/Code/GameEngine/Include/Common/Overridable.h @@ -122,8 +122,7 @@ class Overridable : public MemoryPoolObject // cleans up and dangling overrides. __inline Overridable::~Overridable() { - if (m_nextOverride) - deleteInstance(m_nextOverride); + deleteInstance(m_nextOverride); } diff --git a/Generals/Code/GameEngine/Include/Common/StateMachine.h b/Generals/Code/GameEngine/Include/Common/StateMachine.h index 39cbddce62b..e99df25c17c 100644 --- a/Generals/Code/GameEngine/Include/Common/StateMachine.h +++ b/Generals/Code/GameEngine/Include/Common/StateMachine.h @@ -483,7 +483,8 @@ EMPTY_DTOR(SleepState) // @todo Replace calls to deleteInstance with RefCountPtr when so appropriate. inline void deleteInstance(StateMachine* machine) { - machine->Release_Ref(); + if (machine != NULL) + machine->Release_Ref(); } diff --git a/Generals/Code/GameEngine/Include/Common/ThingTemplate.h b/Generals/Code/GameEngine/Include/Common/ThingTemplate.h index 4637af55c74..d8b95d0a9c3 100644 --- a/Generals/Code/GameEngine/Include/Common/ThingTemplate.h +++ b/Generals/Code/GameEngine/Include/Common/ThingTemplate.h @@ -158,8 +158,7 @@ class AudioArray ~AudioArray() { for (Int i = 0; i < TTAUDIO_COUNT; ++i) - if (m_audio[i]) - deleteInstance(m_audio[i]); + deleteInstance(m_audio[i]); } AudioArray(const AudioArray& that) diff --git a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp index 0ea488d11dc..e0b0abd720c 100644 --- a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp @@ -1022,8 +1022,7 @@ GlobalData::~GlobalData( void ) { DEBUG_ASSERTCRASH( TheWritableGlobalData->m_next == NULL, ("~GlobalData: theOriginal is not original") ); - if (m_weaponBonusSet) - deleteInstance(m_weaponBonusSet); + deleteInstance(m_weaponBonusSet); if( m_theOriginal == this ) { m_theOriginal = NULL; diff --git a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp index c98194d98b8..1ee16934940 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp @@ -1186,11 +1186,8 @@ void INI::parseDynamicAudioEventRTS( INI *ini, void * /*instance*/, void *store, // translate the string into a sound if (stricmp(token, "NoSound") == 0) { - if (*theSound) - { - deleteInstance(*theSound); - *theSound = NULL; - } + deleteInstance(*theSound); + *theSound = NULL; } else { diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp index 18822e59318..bfdb88c4d60 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp @@ -368,54 +368,36 @@ void Player::init(const PlayerTemplate* pt) m_bombardBattlePlans = 0; m_holdTheLineBattlePlans = 0; m_searchAndDestroyBattlePlans = 0; - if( m_battlePlanBonuses ) - { - deleteInstance(m_battlePlanBonuses); - m_battlePlanBonuses = NULL; - } + + deleteInstance(m_battlePlanBonuses); + m_battlePlanBonuses = NULL; deleteUpgradeList(); m_energy.init(this); m_stats.init(); - if (m_pBuildList != NULL) - { - deleteInstance(m_pBuildList); - m_pBuildList = NULL; - } + + deleteInstance(m_pBuildList); + m_pBuildList = NULL; + m_defaultTeam = NULL; - if (m_ai) - { - deleteInstance(m_ai); - } + deleteInstance(m_ai); m_ai = NULL; - if( m_resourceGatheringManager ) - { - deleteInstance(m_resourceGatheringManager); - m_resourceGatheringManager = NULL; - } + deleteInstance(m_resourceGatheringManager); + m_resourceGatheringManager = NULL; for (Int i = 0; i < NUM_HOTKEY_SQUADS; ++i) { - if (m_squads[i] != NULL) { - deleteInstance(m_squads[i]); - m_squads[i] = NULL; - } + deleteInstance(m_squads[i]); m_squads[i] = newInstance(Squad); } - if (m_currentSelection != NULL) { - deleteInstance(m_currentSelection) ; - m_currentSelection = NULL; - } + deleteInstance(m_currentSelection); m_currentSelection = newInstance(Squad); - if( m_tunnelSystem ) - { - deleteInstance(m_tunnelSystem); - m_tunnelSystem = NULL; - } + deleteInstance(m_tunnelSystem); + m_tunnelSystem = NULL; m_canBuildBase = true; m_canBuildUnits = true; @@ -494,8 +476,7 @@ void Player::init(const PlayerTemplate* pt) { KindOfPercentProductionChange *tof = *it; it = m_kindOfPercentProductionChangeList.erase( it ); - if(tof) - deleteInstance(tof); + deleteInstance(tof); } } @@ -515,25 +496,21 @@ Player::~Player() // delete the relation maps (the destructor clears the actual map if any data is present) deleteInstance(m_teamRelations); + m_teamRelations = NULL; + deleteInstance(m_playerRelations); + m_playerRelations = NULL; for (Int i = 0; i < NUM_HOTKEY_SQUADS; ++i) { - if (m_squads[i] != NULL) { - deleteInstance(m_squads[i]); - m_squads[i] = NULL; - } + deleteInstance(m_squads[i]); + m_squads[i] = NULL; } - if (m_currentSelection != NULL) { - deleteInstance(m_currentSelection); - m_currentSelection = NULL; - } + deleteInstance(m_currentSelection); + m_currentSelection = NULL; - if( m_battlePlanBonuses ) - { - deleteInstance(m_battlePlanBonuses); - m_battlePlanBonuses = NULL; - } + deleteInstance(m_battlePlanBonuses); + m_battlePlanBonuses = NULL; } //============================================================================= @@ -640,10 +617,7 @@ Bool Player::removeTeamRelationship(const Team *that) void Player::setBuildList(BuildListInfo *pBuildList) { - if (m_pBuildList != NULL) - { - deleteInstance(m_pBuildList); - } + deleteInstance(m_pBuildList); m_pBuildList = pBuildList; } @@ -706,10 +680,7 @@ void Player::setPlayerType(PlayerType t, Bool skirmish) { m_playerType = t; - if (m_ai) - { - deleteInstance(m_ai); - } + deleteInstance(m_ai); m_ai = NULL; if (t == PLAYER_COMPUTER) @@ -742,11 +713,8 @@ void Player::setDefaultTeam(void) { //============================================================================= void Player::deletePlayerAI() { - if (m_ai) - { - deleteInstance(m_ai); - m_ai = NULL; - } + deleteInstance(m_ai); + m_ai = NULL; } //============================================================================= @@ -820,10 +788,10 @@ void Player::initFromDict(const Dict* d) ScriptList *scripts = TheSidesList->getSkirmishSideInfo(i)->getScriptList()->duplicateAndQualify( qualifier, qualTemplatePlayerName, pname); - if (TheSidesList->getSideInfo(getPlayerIndex())->getScriptList()) { - deleteInstance(TheSidesList->getSideInfo(getPlayerIndex())->getScriptList()); - } + + deleteInstance(TheSidesList->getSideInfo(getPlayerIndex())->getScriptList()); TheSidesList->getSideInfo(getPlayerIndex())->setScriptList(scripts); + deleteInstance(TheSidesList->getSkirmishSideInfo(i)->getScriptList()); TheSidesList->getSkirmishSideInfo(i)->setScriptList(NULL); } @@ -869,12 +837,10 @@ void Player::initFromDict(const Dict* d) qualifier.format("%d", m_mpStartIndex); ScriptList *scripts = TheSidesList->getSkirmishSideInfo(skirmishNdx)->getScriptList()->duplicateAndQualify( qualifier, qualTemplatePlayerName, pname); - ScriptList* slist = TheSidesList->getSideInfo(getPlayerIndex())->getScriptList(); - if (slist) - { - deleteInstance(slist); - } + + deleteInstance(TheSidesList->getSideInfo(getPlayerIndex())->getScriptList()); TheSidesList->getSideInfo(getPlayerIndex())->setScriptList(scripts); + for (i=0; igetNumTeams(); i++) { if (TheSidesList->getTeamInfo(i)->getDict()->getAsciiString(TheKey_teamOwner) == pname) { @@ -941,18 +907,11 @@ void Player::initFromDict(const Dict* d) } } } - if( m_resourceGatheringManager ) - { - deleteInstance(m_resourceGatheringManager); - m_resourceGatheringManager = NULL; - } + + deleteInstance(m_resourceGatheringManager); m_resourceGatheringManager = newInstance(ResourceGatheringManager); - if( m_tunnelSystem ) - { - deleteInstance(m_tunnelSystem); - m_tunnelSystem = NULL; - } + deleteInstance(m_tunnelSystem); m_tunnelSystem = newInstance(TunnelTracker); m_handicap.readFromDict(d); @@ -987,18 +946,11 @@ void Player::initFromDict(const Dict* d) m_money.deposit(m); for ( i = 0; i < NUM_HOTKEY_SQUADS; ++i ) { - if (m_squads[i] != NULL) - { - deleteInstance(m_squads[i]); - m_squads[i] = NULL; - } + deleteInstance(m_squads[i]); m_squads[i] = newInstance( Squad ); } - if (m_currentSelection != NULL) { - deleteInstance(m_currentSelection); - m_currentSelection = NULL; - } + deleteInstance(m_currentSelection); m_currentSelection = newInstance( Squad ); } @@ -3376,8 +3328,7 @@ void Player::removeKindOfProductionCostChange( KindOfMaskType kindOf, Real perce if(tof->m_ref == 0) { m_kindOfPercentProductionChangeList.erase( it ); - if(tof) - deleteInstance(tof); + deleteInstance(tof); } return; } @@ -3714,8 +3665,7 @@ void Player::xfer( Xfer *xfer ) // destroy any build list that we got from loading the bare bones map, note that deleting // the head of these structures automatically deletes any links attached // - if( m_pBuildList) - deleteInstance(m_pBuildList); + deleteInstance(m_pBuildList); m_pBuildList = NULL; // read each build list info @@ -4065,11 +4015,9 @@ void Player::xfer( Xfer *xfer ) xfer->xferBool( &battlePlanBonus ); //If we're loading, it just replaces the bool if( xfer->getXferMode() == XFER_LOAD ) { - if (m_battlePlanBonuses) - { - deleteInstance(m_battlePlanBonuses); - m_battlePlanBonuses = NULL; - } + deleteInstance(m_battlePlanBonuses); + m_battlePlanBonuses = NULL; + if ( battlePlanBonus ) { m_battlePlanBonuses = newInstance( BattlePlanBonuses ); diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Science.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Science.cpp index e0ceb6111b4..e92c3ffd340 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Science.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Science.cpp @@ -54,9 +54,7 @@ ScienceStore::~ScienceStore() { ScienceInfo* si = *it; ++it; - if (si) { - deleteInstance(si); - } + deleteInstance(si); } } diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp index f0ecec64af7..03b8ab97a51 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp @@ -849,19 +849,13 @@ TeamPrototype::~TeamPrototype() if (m_factory) m_factory->removeTeamPrototypeFromList(this); - if (m_productionConditionScript) - { - deleteInstance(m_productionConditionScript); - } + deleteInstance(m_productionConditionScript); m_productionConditionScript = NULL; for (Int i = 0; i < MAX_GENERIC_SCRIPTS; ++i) { - if (m_genericScriptsToRun[i]) - { - deleteInstance(m_genericScriptsToRun[i]); - m_genericScriptsToRun[i] = NULL; - } + deleteInstance(m_genericScriptsToRun[i]); + m_genericScriptsToRun[i] = NULL; } } diff --git a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp index a38de8a17c7..f228aea0c1f 100644 --- a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp @@ -292,8 +292,7 @@ StateMachine::~StateMachine() // delete all states in the mapping for( i = m_stateMap.begin(); i != m_stateMap.end(); ++i ) { - if ((*i).second) - deleteInstance((*i).second); + deleteInstance((*i).second); } } diff --git a/Generals/Code/GameEngine/Source/GameClient/Display.cpp b/Generals/Code/GameEngine/Source/GameClient/Display.cpp index 580fbf4025b..4f36f624752 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Display.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Display.cpp @@ -316,8 +316,7 @@ void Display::update( void ) if( m_elapsedCopywriteTime == 0 && m_elapsedCopywriteTime >= 0) { //display the copyrighttext; - if(m_copyrightDisplayString) - deleteInstance(m_copyrightDisplayString); + deleteInstance(m_copyrightDisplayString); m_copyrightDisplayString = TheDisplayStringManager->newDisplayString(); m_copyrightDisplayString->setText(TheGameText->fetch("GUI:EACopyright")); if (TheGlobalLanguageData && TheGlobalLanguageData->m_copyrightFont.name.isNotEmpty()) diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index fcb8ae281de..a05829feef6 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -131,8 +131,7 @@ void DrawableIconInfo::clear() { for (int i = 0; i < MAX_ICONS; ++i) { - if (m_icon[i]) - deleteInstance(m_icon[i]); + deleteInstance(m_icon[i]); m_icon[i] = NULL; m_keepTillFrame[i] = 0; } @@ -504,11 +503,9 @@ Drawable::~Drawable() } stopAmbientSound(); - if (m_ambientSound) - { - deleteInstance(m_ambientSound); - m_ambientSound = NULL; - } + + deleteInstance(m_ambientSound); + m_ambientSound = NULL; /// @todo this is nasty, we need a real general effects system // remove any entries that might be present from the ray effect system @@ -519,20 +516,17 @@ Drawable::~Drawable() m_particle = NULL; // delete any icons present - if (m_iconInfo) - deleteInstance(m_iconInfo); + deleteInstance(m_iconInfo); + m_iconInfo = NULL; - if (m_selectionFlashEnvelope) - deleteInstance(m_selectionFlashEnvelope); + deleteInstance(m_selectionFlashEnvelope); + m_selectionFlashEnvelope = NULL; - if (m_colorTintEnvelope) - deleteInstance(m_colorTintEnvelope); + deleteInstance(m_colorTintEnvelope); + m_colorTintEnvelope = NULL; - if (m_locoInfo) - { - deleteInstance(m_locoInfo); - m_locoInfo = NULL; - } + deleteInstance(m_locoInfo); + m_locoInfo = NULL; } //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/Eva.cpp b/Generals/Code/GameEngine/Source/GameClient/Eva.cpp index d43f4218571..3f2dd08bd51 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Eva.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Eva.cpp @@ -173,8 +173,7 @@ Eva::~Eva() { EvaCheckInfoPtrVecIt it; for (it = m_allCheckInfos.begin(); it != m_allCheckInfos.end(); ++it) { - if (*it) - deleteInstance(*it); + deleteInstance(*it); } } diff --git a/Generals/Code/GameEngine/Source/GameClient/FXList.cpp b/Generals/Code/GameEngine/Source/GameClient/FXList.cpp index b2d26e6df74..ea92f18ca16 100644 --- a/Generals/Code/GameEngine/Source/GameClient/FXList.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/FXList.cpp @@ -791,8 +791,7 @@ void FXList::clear() { for (FXNuggetList::iterator it = m_nuggets.begin(); it != m_nuggets.end(); ++it) { - if (*it) - deleteInstance(*it); + deleteInstance(*it); } m_nuggets.clear(); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp index f481b40b587..ffdc44e8904 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp @@ -111,14 +111,11 @@ void AnimateWindow::setAnimData( ICoord2D startPos, ICoord2D endPos, static void clearWinList(AnimateWindowList &winList) { - wnd::AnimateWindow *win = NULL; while (!winList.empty()) { - win = *(winList.begin()); + wnd::AnimateWindow *win = *(winList.begin()); winList.pop_front(); - if (win) - deleteInstance(win); - win = NULL; + deleteInstance(win); } } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp index 3d87c3abd2c..9f3b4cf4049 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp @@ -118,8 +118,7 @@ void GameWindowManager::processDestroyList( void ) DEBUG_ASSERTCRASH(doDestroy->winGetUserData() == NULL, ("Win user data is expected to be deleted now")); // free the memory - if (doDestroy) - deleteInstance(doDestroy); + deleteInstance(doDestroy); } // end for diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index b55ec556ab0..0418a888215 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -5581,8 +5581,7 @@ void InGameUI::resetIdleWorker( void ) void InGameUI::recreateControlBar( void ) { GameWindow *win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(AsciiString("ControlBar.wnd"))); - if(win) - deleteInstance(win); + deleteInstance(win); m_idleWorkerWin = NULL; diff --git a/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp b/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp index 5bdbdb6784a..e3e968dbf94 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp @@ -123,8 +123,7 @@ Campaign::~Campaign( void ) { Mission *mission = *it; it = m_missions.erase( it ); - if(mission) - deleteInstance(mission); + deleteInstance(mission); } } @@ -228,8 +227,7 @@ CampaignManager::~CampaignManager( void ) { Campaign *campaign = *it; it = m_campaignList.erase( it ); - if(campaign) - deleteInstance(campaign); + deleteInstance(campaign); } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp index ec87ff041b0..e2aca57781d 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp @@ -63,8 +63,7 @@ void TAiData::addFactionBuildList(AISideBuildList *buildList) AISideBuildList *info = m_sideBuildLists; while (info) { if (buildList->m_side == info->m_side) { - if (info->m_buildList) - deleteInstance(info->m_buildList); + deleteInstance(info->m_buildList); info->m_buildList = buildList->m_buildList; buildList->m_buildList = NULL; buildList->m_next = NULL; @@ -109,9 +108,7 @@ AISideBuildList::AISideBuildList( AsciiString side ) : AISideBuildList::~AISideBuildList() { - if (m_buildList) { - deleteInstance(m_buildList); // note - deletes all in the list. - } + deleteInstance(m_buildList); // note - deletes all in the list. m_buildList = NULL; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp index 0e3dbcf24e2..eff90c4a9bd 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp @@ -111,10 +111,9 @@ AIGroup::~AIGroup() #endif - if (m_groundPath) { - deleteInstance(m_groundPath); - m_groundPath = NULL; - } + deleteInstance(m_groundPath); + m_groundPath = NULL; + //DEBUG_LOG(( "AIGroup #%d destroyed", m_id )); } @@ -445,10 +444,8 @@ void AIGroup::recompute( void ) getCenter( ¢er ); - if (m_groundPath) { - deleteInstance(m_groundPath); - m_groundPath = NULL; - } + deleteInstance(m_groundPath); + m_groundPath = NULL; m_speed = 9999999999.9f; diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 3340932b5ad..92842873b01 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -3429,10 +3429,9 @@ void Pathfinder::reset( void ) debugPathPos.y = 0.0f; debugPathPos.z = 0.0f; - if (debugPath) - deleteInstance(debugPath); - + deleteInstance(debugPath); debugPath = NULL; + m_frameToShowObstacles = 0; for (m_queuePRHead=0; m_queuePRHeadm_debugAI) { // copy the path for debugging - if (debugPath) - deleteInstance(debugPath); - + deleteInstance(debugPath); debugPath = newInstance(Path); for( PathNode *copyNode = newDebugpath->getFirstNode(); copyNode; copyNode = copyNode->getNextOptimized() ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 0ee61003609..88649001810 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -726,10 +726,7 @@ AIStateMachine::AIStateMachine( Object *obj, AsciiString name ) : StateMachine( //---------------------------------------------------------------------------------------------------------- AIStateMachine::~AIStateMachine() { - if (m_goalSquad) - { - deleteInstance(m_goalSquad); - } + deleteInstance(m_goalSquad); } @@ -5491,11 +5488,8 @@ void AIAttackState::onExit( StateExitType status ) //addSelfAsTargeter(false); // destroy the attack machine - if (m_attackMachine) - { - deleteInstance(m_attackMachine); - m_attackMachine = NULL; - } + deleteInstance(m_attackMachine); + m_attackMachine = NULL; Object *obj = getMachineOwner(); obj->clearStatus( MAKE_OBJECT_STATUS_MASK4( OBJECT_STATUS_IS_FIRING_WEAPON, @@ -5709,12 +5703,9 @@ StateReturnType AIAttackSquadState::update( void ) //---------------------------------------------------------------------------------------------------------- void AIAttackSquadState::onExit( StateExitType status ) { - if( m_attackSquadMachine ) - { - // destroy the attack machine - deleteInstance(m_attackSquadMachine); - m_attackSquadMachine = NULL; - } + // destroy the attack machine + deleteInstance(m_attackSquadMachine); + m_attackSquadMachine = NULL; } //---------------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp index 39f21332f57..5a76dc69e06 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp @@ -321,8 +321,7 @@ TurretAI::~TurretAI() { stopRotOrPitchSound(); - if (m_turretStateMachine) - deleteInstance(m_turretStateMachine); + deleteInstance(m_turretStateMachine); } // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp b/Generals/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp index f053f01d45f..eaf5bd54268 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp @@ -87,10 +87,12 @@ void SidesInfo::init(const Dict* d) { deleteInstance(m_pBuildList); m_pBuildList = NULL; + m_dict.clear(); - if (m_scripts) - deleteInstance(m_scripts); + + deleteInstance(m_scripts); m_scripts = NULL; + if (d) m_dict = *d; } @@ -302,8 +304,7 @@ Bool SidesList::ParseSidesDataChunk(DataChunkInput &file, DataChunkInfo *info, v count = ScriptList::getReadScripts(scripts); for (i=0; igetNumSides()) { - ScriptList *pSL = TheSidesList->getSideInfo(i)->getScriptList(); - deleteInstance(pSL); + deleteInstance(TheSidesList->getSideInfo(i)->getScriptList()); TheSidesList->getSideInfo(i)->setScriptList(scripts[i]); scripts[i] = NULL; } else { @@ -535,12 +536,9 @@ void SidesList::prepareForMP_or_Skirmish(void) } if (curSide == -1) continue; - ScriptList *pSL = getSkirmishSideInfo(curSide)->getScriptList(); + deleteInstance(getSkirmishSideInfo(curSide)->getScriptList()); getSkirmishSideInfo(curSide)->setScriptList(scripts[i]); scripts[i] = NULL; - if (pSL) - deleteInstance(pSL); - scripts[i] = NULL; } for (i=0; i(m_turretData[i]); - if (td) - deleteInstance(td); + deleteInstance(td); } } } @@ -638,8 +637,7 @@ AIUpdateInterface::~AIUpdateInterface( void ) for (int i = 0; i < MAX_TURRETS; i++) { - if (m_turretAI[i]) - deleteInstance(m_turretAI[i]); + deleteInstance(m_turretAI[i]); m_turretAI[i] = NULL; } m_stateMachine = NULL; @@ -1978,10 +1976,9 @@ Bool AIUpdateInterface::computeAttackPath( PathfindServicesInterface *pathServic void AIUpdateInterface::destroyPath( void ) { // destroy previous path - if (m_path) - deleteInstance(m_path); - + deleteInstance(m_path); m_path = NULL; + m_waitingForPath = FALSE; // we no longer need it. //CRCDEBUG_LOG(("AIUpdateInterface::destroyPath() - m_isAttackPath = FALSE for object %d", getObject()->getID())); m_isAttackPath = FALSE; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp index f370b6d2c50..9a2070ee5e8 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp @@ -132,8 +132,7 @@ DeliverPayloadAIUpdate::~DeliverPayloadAIUpdate( void ) { m_deliveryDecal.clear(); - if (m_deliverPayloadStateMachine) - deleteInstance(m_deliverPayloadStateMachine); + deleteInstance(m_deliverPayloadStateMachine); } //------------------------------------------------------------------------------------------------- @@ -255,8 +254,7 @@ void DeliverPayloadAIUpdate::deliverPayload( //THIS GETS CALLED VIA OBJECT CREATION LISTS ONLY!!! //**************************************************** - if (m_deliverPayloadStateMachine) - deleteInstance(m_deliverPayloadStateMachine); + deleteInstance(m_deliverPayloadStateMachine); m_deliverPayloadStateMachine = NULL; m_moveToPos = *moveToPos; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp index 45cc2f197df..5e833a1f6a0 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp @@ -1173,7 +1173,7 @@ class DozerActionState : public State StateMachine *m_actionMachine; }; -inline DozerActionState::~DozerActionState( void ) { if (m_actionMachine) deleteInstance(m_actionMachine); } +inline DozerActionState::~DozerActionState( void ) { deleteInstance(m_actionMachine); } // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -1472,8 +1472,7 @@ DozerAIUpdate::~DozerAIUpdate( void ) { // delete our behavior state machine - if( m_dozerMachine ) - deleteInstance(m_dozerMachine); + deleteInstance(m_dozerMachine); // no orders for( Int i = 0; i < DOZER_NUM_TASKS; i++ ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp index b218bb22999..ddba3bbfc3b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp @@ -126,14 +126,9 @@ WorkerAIUpdate::~WorkerAIUpdate( void ) { // delete our behavior state machine - if( m_dozerMachine ) - deleteInstance(m_dozerMachine); - - if( m_supplyTruckStateMachine ) - deleteInstance(m_supplyTruckStateMachine); - - if( m_workerMachine ) - deleteInstance(m_workerMachine); + deleteInstance(m_dozerMachine); + deleteInstance(m_supplyTruckStateMachine); + deleteInstance(m_workerMachine); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp index 590cdf12a5e..d4461349cc7 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp @@ -73,8 +73,7 @@ FireWeaponUpdate::FireWeaponUpdate( Thing *thing, const ModuleData* moduleData ) //------------------------------------------------------------------------------------------------- FireWeaponUpdate::~FireWeaponUpdate( void ) { - if (m_weapon) - deleteInstance(m_weapon); + deleteInstance(m_weapon); } //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp index 90912ebb6fa..6f27f4f95a9 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp @@ -237,11 +237,8 @@ void PhysicsBehavior::onObjectCreated() //------------------------------------------------------------------------------------------------- PhysicsBehavior::~PhysicsBehavior() { - if (m_bounceSound) - { - deleteInstance(m_bounceSound); - m_bounceSound = NULL; - } + deleteInstance(m_bounceSound); + m_bounceSound = NULL; } //------------------------------------------------------------------------------------------------- @@ -524,11 +521,8 @@ void PhysicsBehavior::setBounceSound(const AudioEventRTS* bounceSound) } else { - if (m_bounceSound) - { - deleteInstance(m_bounceSound); - m_bounceSound = NULL; - } + deleteInstance(m_bounceSound); + m_bounceSound = NULL; } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index 98b1a2c7bea..74c71a6f939 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -314,13 +314,10 @@ WeaponTemplate::WeaponTemplate() : m_nextTemplate(NULL) //------------------------------------------------------------------------------------------------- WeaponTemplate::~WeaponTemplate() { - if (m_nextTemplate) { - deleteInstance(m_nextTemplate); - } + deleteInstance(m_nextTemplate); // delete any extra-bonus that's present - if (m_extraBonus) - deleteInstance(m_extraBonus); + deleteInstance(m_extraBonus); } // ------------------------------------------------------------------------------------------------ @@ -1356,8 +1353,7 @@ WeaponStore::~WeaponStore() for (size_t i = 0; i < m_weaponTemplateVector.size(); i++) { WeaponTemplate* wt = m_weaponTemplateVector[i]; - if (wt) - deleteInstance(wt); + deleteInstance(wt); } m_weaponTemplateVector.clear(); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp index e8bb6f34b7e..c9cf5019933 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp @@ -183,8 +183,7 @@ WeaponSet::WeaponSet() WeaponSet::~WeaponSet() { for (Int i = 0; i < WEAPONSLOT_COUNT; ++i) - if (m_weapons[i]) - deleteInstance(m_weapons[i]); + deleteInstance(m_weapons[i]); } // ------------------------------------------------------------------------------------------------ @@ -303,11 +302,8 @@ void WeaponSet::updateWeaponSet(const Object* obj) m_hasDamageWeapon = false; for (Int i = WEAPONSLOT_COUNT - 1; i >= PRIMARY_WEAPON ; --i) { - if (m_weapons[i] != NULL) - { - deleteInstance(m_weapons[i]); - m_weapons[i] = NULL; - } + deleteInstance(m_weapons[i]); + m_weapons[i] = NULL; if (set->getNth((WeaponSlotType)i)) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp index b099d0972b5..76c4f4f8e76 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp @@ -74,8 +74,7 @@ class ObjectTypesTemp ~ObjectTypesTemp() { - if (m_types) - deleteInstance(m_types); + deleteInstance(m_types); } }; @@ -114,8 +113,7 @@ class TransportStatus : public MemoryPoolObject //------------------------------------------------------------------------------------------------- TransportStatus::~TransportStatus() { - if (m_nextStatus) - deleteInstance(m_nextStatus); + deleteInstance(m_nextStatus); } //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp index 7ff126544af..cbb5d5fb7dc 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp @@ -215,14 +215,11 @@ m_firstScript(NULL) */ ScriptList::~ScriptList(void) { - if (m_firstGroup) { - deleteInstance(m_firstGroup); - m_firstGroup = NULL; - } - if (m_firstScript) { - deleteInstance(m_firstScript); - m_firstScript = NULL; - } + deleteInstance(m_firstGroup); + m_firstGroup = NULL; + + deleteInstance(m_firstScript); + m_firstScript = NULL; } // ------------------------------------------------------------------------------------------------ @@ -526,10 +523,8 @@ Bool ScriptList::ParseScriptsDataChunk(DataChunkInput &file, DataChunkInfo *info file.registerParser( AsciiString("ScriptList"), info->label, ScriptList::ParseScriptListDataChunk ); DEBUG_ASSERTCRASH(s_numInReadList==0, ("Leftover scripts floating aroung.")); for (i=0; im_condition) { - deleteInstance(pNew->m_condition); - } - if (pNew->m_action) { - deleteInstance(pNew->m_action); - } + pNew->m_scriptName = m_scriptName; pNew->m_comment = m_comment; pNew->m_conditionComment = m_conditionComment; @@ -1007,6 +990,7 @@ Script *Script::duplicate(void) const pNew->m_normal = m_normal; pNew->m_hard = m_hard; pNew->m_delayEvaluationSeconds = m_delayEvaluationSeconds; + if (m_condition) { pNew->m_condition = m_condition->duplicate(); } @@ -1029,12 +1013,7 @@ Script *Script::duplicateAndQualify(const AsciiString& qualifier, const AsciiString& playerTemplateName, const AsciiString& newPlayerName) const { Script *pNew = newInstance(Script); - if (pNew->m_condition) { - deleteInstance(pNew->m_condition); - } - if (pNew->m_action) { - deleteInstance(pNew->m_action); - } + pNew->m_scriptName = m_scriptName; pNew->m_scriptName.concat(qualifier); pNew->m_comment = m_comment; @@ -1047,6 +1026,7 @@ Script *Script::duplicateAndQualify(const AsciiString& qualifier, pNew->m_normal = m_normal; pNew->m_hard = m_hard; pNew->m_delayEvaluationSeconds = m_delayEvaluationSeconds; + if (m_condition) { pNew->m_condition = m_condition->duplicateAndQualify(qualifier, playerTemplateName, newPlayerName); } @@ -1078,19 +1058,16 @@ void Script::updateFrom(Script *pSrc) this->m_easy = pSrc->m_easy; this->m_normal = pSrc->m_normal; this->m_hard = pSrc->m_hard; - if (this->m_condition) { - deleteInstance(this->m_condition); - } + + deleteInstance(this->m_condition); this->m_condition = pSrc->m_condition; pSrc->m_condition = NULL; - if (this->m_action) { - deleteInstance(this->m_action); - } + + deleteInstance(this->m_action); this->m_action = pSrc->m_action; pSrc->m_action = NULL; - if (this->m_actionFalse) { - deleteInstance(this->m_actionFalse); - } + + deleteInstance(this->m_actionFalse); this->m_actionFalse = pSrc->m_actionFalse; pSrc->m_actionFalse = NULL; } @@ -1338,10 +1315,9 @@ OrCondition *Script::findPreviousOrCondition( OrCondition *curOr ) //------------------------------------------------------------------------------------------------- OrCondition::~OrCondition(void) { - if (m_firstAnd) { - deleteInstance(m_firstAnd); - m_firstAnd = NULL; - } + deleteInstance(m_firstAnd); + m_firstAnd = NULL; + if (m_nextOr) { OrCondition *cur = m_nextOr; OrCondition *next; @@ -1526,8 +1502,7 @@ void Condition::setConditionType(enum ConditionType type) { Int i; for (i=0; i::iterator iter = m_tunnelTrackerVector.begin(); iter != m_tunnelTrackerVector.end(); iter++ ) { - TunnelTracker *currentTracker = *iter; - if( currentTracker )// could be NULL, since we don't slide back to fill deleted entries so offsets don't shift - { - deleteInstance(currentTracker); - } + TunnelTracker *currentTracker = *iter; // could be NULL, since we don't slide back to fill deleted entries so offsets don't shift + deleteInstance(currentTracker); } m_tunnelTrackerVector.clear(); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp index ecc92db6ba0..b89fe781912 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp @@ -47,10 +47,7 @@ CrateSystem::~CrateSystem() for( Int templateIndex = 0; templateIndex < count; templateIndex ++ ) { CrateTemplate *currentTemplate = m_crateTemplateVector[templateIndex]; - if( currentTemplate ) - { - deleteInstance(currentTemplate); - } + deleteInstance(currentTemplate); } m_crateTemplateVector.clear(); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/RankInfo.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/RankInfo.cpp index 76061534a7d..756ec720c0f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/RankInfo.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/RankInfo.cpp @@ -49,10 +49,7 @@ RankInfoStore::~RankInfoStore() for (level =0; level < getRankLevelCount(); level++) { RankInfo* ri = m_rankInfos[level]; - if (ri) - { - deleteInstance(ri); - } + deleteInstance(ri); } m_rankInfos.clear(); } diff --git a/Generals/Code/GameEngine/Source/GameNetwork/Connection.cpp b/Generals/Code/GameEngine/Source/GameNetwork/Connection.cpp index f28d485ba79..b699d081d4e 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/Connection.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/Connection.cpp @@ -58,15 +58,11 @@ Connection::Connection() { * The destructor. */ Connection::~Connection() { - if (m_user != NULL) { - deleteInstance(m_user); - m_user = NULL; - } + deleteInstance(m_user); + m_user = NULL; - if (m_netCommandList != NULL) { - deleteInstance(m_netCommandList); - m_netCommandList = NULL; - } + deleteInstance(m_netCommandList); + m_netCommandList = NULL; } /** @@ -75,10 +71,8 @@ Connection::~Connection() { void Connection::init() { m_transport = NULL; - if (m_user != NULL) { - deleteInstance(m_user); - m_user = NULL; - } + deleteInstance(m_user); + m_user = NULL; if (m_netCommandList == NULL) { m_netCommandList = newInstance(NetCommandList); @@ -123,10 +117,7 @@ void Connection::attachTransport(Transport *transport) { * Assign this connection a user. This is the user to whome we send all our packetized goodies. */ void Connection::setUser(User *user) { - if (m_user != NULL) { - deleteInstance(m_user); - } - + deleteInstance(m_user); m_user = user; } @@ -325,9 +316,8 @@ UnsignedInt Connection::doSend() { couldQueue = m_transport->queueSend(packet->getAddr(), packet->getPort(), packet->getData(), packet->getLength()); m_lastTimeSent = curtime; } - if (packet != NULL) { - deleteInstance(packet); // delete the packet now that we're done with it. - } + + deleteInstance(packet); // delete the packet now that we're done with it. } return numpackets; diff --git a/Generals/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/Generals/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp index 18c199a900e..696664a4e4b 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp @@ -59,57 +59,39 @@ */ ConnectionManager::~ConnectionManager(void) { - if (m_localUser != NULL) { - deleteInstance(m_localUser); - m_localUser = NULL; - } + deleteInstance(m_localUser); + m_localUser = NULL; -// m_transport = NULL; // Network will delete transports; we just forget them - if (m_transport != NULL) { - delete m_transport; - m_transport = NULL; - } + // Network will delete transports; we just forget them + delete m_transport; + m_transport = NULL; Int i = 0; for (; i < MAX_SLOTS; ++i) { - if (m_frameData[i] != NULL) { - deleteInstance(m_frameData[i]); - m_frameData[i] = NULL; - } + deleteInstance(m_frameData[i]); + m_frameData[i] = NULL; } for (i = 0; i < NUM_CONNECTIONS; ++i) { - if (m_connections[i] != NULL) { - deleteInstance(m_connections[i]); - m_connections[i] = NULL; - } + deleteInstance(m_connections[i]); + m_connections[i] = NULL; } - if (TheDisconnectMenu != NULL) { - // This is done here since TheDisconnectMenu should only be there if we are in a network game. - delete TheDisconnectMenu; - TheDisconnectMenu = NULL; - } + // This is done here since TheDisconnectMenu should only be there if we are in a network game. + delete TheDisconnectMenu; + TheDisconnectMenu = NULL; - if (m_disconnectManager != NULL) { - delete m_disconnectManager; - m_disconnectManager = NULL; - } + delete m_disconnectManager; + m_disconnectManager = NULL; - if (m_pendingCommands != NULL) { - deleteInstance(m_pendingCommands); - m_pendingCommands = NULL; - } + deleteInstance(m_pendingCommands); + m_pendingCommands = NULL; - if (m_relayedCommands != NULL) { - deleteInstance(m_relayedCommands); - m_relayedCommands = NULL; - } + deleteInstance(m_relayedCommands); + m_relayedCommands = NULL; - if (m_netCommandWrapperList != NULL) { - deleteInstance(m_netCommandWrapperList); - m_netCommandWrapperList = NULL; - } + deleteInstance(m_netCommandWrapperList); + m_netCommandWrapperList = NULL; s_fileCommandMap.clear(); s_fileRecipientMaskMap.clear(); @@ -174,10 +156,8 @@ void ConnectionManager::init() } for (i = 0; i < MAX_SLOTS; ++i) { - if (m_frameData[i] != NULL) { - deleteInstance(m_frameData[i]); - m_frameData[i] = NULL; - } + deleteInstance(m_frameData[i]); + m_frameData[i] = NULL; } // m_averageFps = 30; // since 30 fps is the desired rate, we'll start off at that. @@ -228,18 +208,14 @@ void ConnectionManager::reset() UnsignedInt i = 0; for (; i < (UnsignedInt)NUM_CONNECTIONS; ++i) { - if (m_connections[i] != NULL) { - deleteInstance(m_connections[i]); - m_connections[i] = NULL; - } + deleteInstance(m_connections[i]); + m_connections[i] = NULL; } for (i=0; i<(UnsignedInt)MAX_SLOTS; ++i) { - if (m_frameData[i] != NULL) { - deleteInstance(m_frameData[i]); - m_frameData[i] = NULL; - } + deleteInstance(m_frameData[i]); + m_frameData[i] = NULL; } if (m_pendingCommands == NULL) { diff --git a/Generals/Code/GameEngine/Source/GameNetwork/FrameData.cpp b/Generals/Code/GameEngine/Source/GameNetwork/FrameData.cpp index 15d67e37423..f9dd01beaab 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/FrameData.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/FrameData.cpp @@ -49,10 +49,8 @@ FrameData::FrameData() */ FrameData::~FrameData() { - if (m_commandList != NULL) { - deleteInstance(m_commandList); - m_commandList = NULL; - } + deleteInstance(m_commandList); + m_commandList = NULL; } /** diff --git a/Generals/Code/GameEngine/Source/GameNetwork/NetPacket.cpp b/Generals/Code/GameEngine/Source/GameNetwork/NetPacket.cpp index 14bda0032b9..6ce456ff9e8 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/NetPacket.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/NetPacket.cpp @@ -1005,8 +1005,7 @@ void NetPacket::FillBufferWithGameCommand(UnsignedByte *buffer, NetCommandRef *m // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addGameMessage - added game message, frame %d, player %d, command ID %d", m_lastFrame, m_lastPlayerID, m_lastCommandID)); - if (gmsg) - deleteInstance(gmsg); + deleteInstance(gmsg); gmsg = NULL; } @@ -2002,10 +2001,8 @@ NetPacket::NetPacket(TransportMessage *msg) { * Destructor */ NetPacket::~NetPacket() { - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + deleteInstance(m_lastCommand); + m_lastCommand = NULL; } /** @@ -2028,10 +2025,9 @@ void NetPacket::init() { } void NetPacket::reset() { - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + deleteInstance(m_lastCommand); + m_lastCommand = NULL; + init(); } @@ -2197,10 +2193,8 @@ Bool NetPacket::addFrameResendRequestCommand(NetCommandRef *msg) { DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addFrameResendRequest - added frame resend request command from player %d for frame %d, command id = %d", m_lastPlayerID, frameToResend, m_lastCommandID)); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -2308,10 +2302,8 @@ Bool NetPacket::addDisconnectScreenOffCommand(NetCommandRef *msg) { DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addDisconnectScreenOff - added disconnect screen off command from player %d for frame %d, command id = %d", m_lastPlayerID, newFrame, m_lastCommandID)); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -2417,10 +2409,8 @@ Bool NetPacket::addDisconnectFrameCommand(NetCommandRef *msg) { m_packetLen += sizeof(disconnectFrame); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -2525,10 +2515,8 @@ Bool NetPacket::addFileCommand(NetCommandRef *msg) { m_packetLen += fileLength; ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); return TRUE; @@ -2630,10 +2618,8 @@ Bool NetPacket::addFileAnnounceCommand(NetCommandRef *msg) { m_packetLen += sizeof(playerMask); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -2735,10 +2721,8 @@ Bool NetPacket::addFileProgressCommand(NetCommandRef *msg) { m_packetLen += sizeof(progress); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -2867,10 +2851,8 @@ Bool NetPacket::addWrapperCommand(NetCommandRef *msg) { m_packetLen += dataLength; ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -2966,10 +2948,8 @@ Bool NetPacket::addTimeOutGameStartMessage(NetCommandRef *msg) { ++m_packetLen; ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -3060,10 +3040,8 @@ Bool NetPacket::addLoadCompleteMessage(NetCommandRef *msg) { ++m_packetLen; ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -3146,10 +3124,8 @@ Bool NetPacket::addProgressMessage(NetCommandRef *msg) { ++m_packetLen; ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -3257,10 +3233,8 @@ Bool NetPacket::addDisconnectVoteCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addDisconnectVoteCommand - added disconnect vote command, player id %d command id %d, voted slot %d", m_lastPlayerID, m_lastCommandID, slot)); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); return TRUE; @@ -3356,10 +3330,8 @@ Bool NetPacket::addDisconnectChatCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket - added disconnect chat command")); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); return TRUE; @@ -3473,10 +3445,8 @@ Bool NetPacket::addChatCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket - added chat command")); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); return TRUE; @@ -3564,10 +3534,8 @@ Bool NetPacket::addPacketRouterAckCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket - added packet router ack command, player id %d", m_lastPlayerID)); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); return TRUE; @@ -3646,10 +3614,8 @@ Bool NetPacket::addPacketRouterQueryCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket - added packet router query command, player id %d", m_lastPlayerID)); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); return TRUE; @@ -3751,10 +3717,8 @@ Bool NetPacket::addDisconnectPlayerCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addDisconnectPlayerCommand - added disconnect player command, player id %d command id %d, disconnecting slot %d", m_lastPlayerID, m_lastCommandID, slot)); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); return TRUE; @@ -3836,10 +3800,8 @@ Bool NetPacket::addDisconnectKeepAliveCommand(NetCommandRef *msg) { ++m_packetLen; ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -3916,10 +3878,8 @@ Bool NetPacket::addKeepAliveCommand(NetCommandRef *msg) { ++m_packetLen; ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -4035,10 +3995,8 @@ Bool NetPacket::addRunAheadCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket - added run ahead command, frame %d, player id %d command id %d", m_lastFrame, m_lastPlayerID, m_lastCommandID)); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); return TRUE; @@ -4156,10 +4114,8 @@ Bool NetPacket::addDestroyPlayerCommand(NetCommandRef *msg) { //DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket - added CRC:0x%8.8X info command, frame %d, player id %d command id %d", newCRC, m_lastFrame, m_lastPlayerID, m_lastCommandID)); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); return TRUE; @@ -4268,10 +4224,7 @@ Bool NetPacket::addRunAheadMetricsCommand(NetCommandRef *msg) { memcpy(m_packet + m_packetLen, &averageFps, sizeof(averageFps)); m_packetLen += sizeof(averageFps); - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -4387,10 +4340,7 @@ Bool NetPacket::addPlayerLeaveCommand(NetCommandRef *msg) { memcpy(m_packet + m_packetLen, &leavingPlayerID, sizeof(UnsignedByte)); m_packetLen += sizeof(UnsignedByte); - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -4526,10 +4476,7 @@ Bool NetPacket::addFrameCommand(NetCommandRef *msg) { // frameinfodebug // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("outgoing - added frame %d, player %d, command count = %d, command id = %d", cmdMsg->getExecutionFrame(), cmdMsg->getPlayerID(), cmdMsg->getCommandCount(), cmdMsg->getID())); - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -4632,9 +4579,8 @@ Bool NetPacket::addAckCommand(NetCommandRef *msg, UnsignedShort commandID, Unsig m_packet[m_packetLen] = 'Z'; ++m_packetLen; ++m_numCommands; - deleteInstance(m_lastCommand); - m_lastCommand = NULL; + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); return TRUE; @@ -4669,10 +4615,7 @@ Bool NetPacket::addAckCommand(NetCommandRef *msg, UnsignedShort commandID, Unsig memcpy(m_packet + m_packetLen, &originalPlayerID, sizeof(UnsignedByte)); m_packetLen += sizeof(UnsignedByte); - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -4882,20 +4825,15 @@ Bool NetPacket::addGameCommand(NetCommandRef *msg) { ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); retval = TRUE; } - if (gmsg) { - deleteInstance(gmsg); - gmsg = NULL; - } + deleteInstance(gmsg); + gmsg = NULL; return retval; } @@ -5233,10 +5171,7 @@ NetCommandList * NetPacket::getCommandList() { DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::getCommandList - failed to set relay for message %d", msg->getID())); } - if (lastCommand != NULL) { - deleteInstance(lastCommand); - lastCommand = NULL; - } + deleteInstance(lastCommand); lastCommand = newInstance(NetCommandRef)(msg); msg->detach(); // Need to detach from new NetCommandMsg created by the "readXMessage" above. @@ -5311,7 +5246,6 @@ NetCommandList * NetPacket::getCommandList() { } deleteInstance(lastCommand); - lastCommand = NULL; // lastCommand = newInstance(NetCommandRef)(msg); lastCommand = NEW_NETCOMMANDREF(msg); @@ -5334,10 +5268,9 @@ NetCommandList * NetPacket::getCommandList() { } - if (lastCommand != NULL) { - deleteInstance(lastCommand); - lastCommand = NULL; - } + deleteInstance(lastCommand); + lastCommand = NULL; + return retval; } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp index b11703a516f..4b11ce162ef 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp @@ -144,8 +144,8 @@ void W3DRadar::deleteResources( void ) if( m_terrainTexture ) m_terrainTexture->Release_Ref(); m_terrainTexture = NULL; - if( m_terrainImage ) - deleteInstance(m_terrainImage); + + deleteInstance(m_terrainImage); m_terrainImage = NULL; // @@ -154,8 +154,8 @@ void W3DRadar::deleteResources( void ) if( m_overlayTexture ) m_overlayTexture->Release_Ref(); m_overlayTexture = NULL; - if( m_overlayImage ) - deleteInstance(m_overlayImage); + + deleteInstance(m_overlayImage); m_overlayImage = NULL; // @@ -164,8 +164,8 @@ void W3DRadar::deleteResources( void ) if( m_shroudTexture ) m_shroudTexture->Release_Ref(); m_shroudTexture = NULL; - if( m_shroudImage ) - deleteInstance(m_shroudImage); + + deleteInstance(m_shroudImage); m_shroudImage = NULL; } // end deleteResources diff --git a/Generals/Code/Tools/WorldBuilder/include/WorldBuilder.h b/Generals/Code/Tools/WorldBuilder/include/WorldBuilder.h index 7c70d72efef..7d91979babf 100644 --- a/Generals/Code/Tools/WorldBuilder/include/WorldBuilder.h +++ b/Generals/Code/Tools/WorldBuilder/include/WorldBuilder.h @@ -139,8 +139,7 @@ class CWorldBuilderApp : public CWinApp protected: void deletePasteObjList(void) { - if (m_pasteMapObjList) - deleteInstance(m_pasteMapObjList); + deleteInstance(m_pasteMapObjList); m_pasteMapObjList = NULL; }; diff --git a/Generals/Code/Tools/WorldBuilder/src/CUndoable.cpp b/Generals/Code/Tools/WorldBuilder/src/CUndoable.cpp index 33e77d21e37..d1bd1be2340 100644 --- a/Generals/Code/Tools/WorldBuilder/src/CUndoable.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/CUndoable.cpp @@ -207,7 +207,7 @@ void WBDocUndoable::Undo(void) AddObjectUndoable::~AddObjectUndoable(void) { m_pDoc = NULL; // not ref counted. - if (m_objectToAdd && !m_addedToList) { + if (!m_addedToList) { deleteInstance(m_objectToAdd); m_objectToAdd=NULL; } @@ -857,7 +857,7 @@ void DictItemUndoable::Undo(void) ***************************************************************************/ DeleteInfo::~DeleteInfo(void) { - if (m_didDelete && m_objectToDelete) { + if (m_didDelete) { deleteInstance(m_objectToDelete); } DeleteInfo *pCur = m_next; diff --git a/Generals/Code/Tools/WorldBuilder/src/FenceOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/FenceOptions.cpp index 5ea0908a6df..d46782fd0a4 100644 --- a/Generals/Code/Tools/WorldBuilder/src/FenceOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/FenceOptions.cpp @@ -68,9 +68,7 @@ FenceOptions::FenceOptions(CWnd* pParent /*=NULL*/) FenceOptions::~FenceOptions(void) { - if (m_objectsList) { - deleteInstance(m_objectsList); - } + deleteInstance(m_objectsList); m_objectsList = NULL; } diff --git a/Generals/Code/Tools/WorldBuilder/src/FenceTool.cpp b/Generals/Code/Tools/WorldBuilder/src/FenceTool.cpp index 7b0a3f5e91c..c7d89109b8a 100644 --- a/Generals/Code/Tools/WorldBuilder/src/FenceTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/FenceTool.cpp @@ -49,9 +49,7 @@ FenceTool::FenceTool(void) : /// Destructor FenceTool::~FenceTool(void) { - if (m_mapObjectList) { - deleteInstance(m_mapObjectList); - } + deleteInstance(m_mapObjectList); m_mapObjectList = NULL; } @@ -154,10 +152,10 @@ void FenceTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldB pView->snapPoint(&cpt); m_downPt2d = viewPt; m_downPt3d = cpt; - if (m_mapObjectList) { - deleteInstance(m_mapObjectList); - m_mapObjectList = NULL; - } + + deleteInstance(m_mapObjectList); + m_mapObjectList = NULL; + if (FenceOptions::hasSelectedObject()) { FenceOptions::update(); m_curObjectWidth = FenceOptions::getFenceSpacing(); diff --git a/Generals/Code/Tools/WorldBuilder/src/GroveTool.cpp b/Generals/Code/Tools/WorldBuilder/src/GroveTool.cpp index 636ef9b426b..f83132b42a3 100644 --- a/Generals/Code/Tools/WorldBuilder/src/GroveTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/GroveTool.cpp @@ -244,9 +244,7 @@ GroveTool::GroveTool(void) : /// Destructor GroveTool::~GroveTool(void) { - if (m_headMapObj) { - deleteInstance(m_headMapObj); - } + deleteInstance(m_headMapObj); } /** Execute the tool on mouse down - Place an object. */ diff --git a/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp index cb7312f2c76..ed8f9c24e14 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp @@ -64,9 +64,7 @@ ObjectOptions::ObjectOptions(CWnd* pParent /*=NULL*/) ObjectOptions::~ObjectOptions(void) { - if (m_objectsList) { - deleteInstance(m_objectsList); - } + deleteInstance(m_objectsList); m_objectsList = NULL; } diff --git a/Generals/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp b/Generals/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp index 4b669957118..816f1363793 100644 --- a/Generals/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp @@ -94,9 +94,7 @@ PickUnitDialog::PickUnitDialog(UINT id, CWnd* pParent /*=NULL*/) PickUnitDialog::~PickUnitDialog() { - if (m_objectsList) { - deleteInstance(m_objectsList); - } + deleteInstance(m_objectsList); m_objectsList = NULL; } diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Overridable.h b/GeneralsMD/Code/GameEngine/Include/Common/Overridable.h index 2b2de21e0bf..6fda0ac4e52 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Overridable.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Overridable.h @@ -122,8 +122,7 @@ class Overridable : public MemoryPoolObject // cleans up and dangling overrides. __inline Overridable::~Overridable() { - if (m_nextOverride) - deleteInstance(m_nextOverride); + deleteInstance(m_nextOverride); } diff --git a/GeneralsMD/Code/GameEngine/Include/Common/StateMachine.h b/GeneralsMD/Code/GameEngine/Include/Common/StateMachine.h index 39b175d925f..1c1802b8fdf 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/StateMachine.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/StateMachine.h @@ -485,7 +485,8 @@ EMPTY_DTOR(SleepState) // @todo Replace calls to deleteInstance with RefCountPtr when so appropriate. inline void deleteInstance(StateMachine* machine) { - machine->Release_Ref(); + if (machine != NULL) + machine->Release_Ref(); } diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h b/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h index c38214f6dc5..27d5af94a2e 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h @@ -154,8 +154,7 @@ class AudioArray ~AudioArray() { for (Int i = 0; i < TTAUDIO_COUNT; ++i) - if (m_audio[i]) - deleteInstance(m_audio[i]); + deleteInstance(m_audio[i]); } AudioArray(const AudioArray& that) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp index a6b2303b83c..f5395312b0f 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp @@ -1060,8 +1060,7 @@ GlobalData::~GlobalData( void ) { DEBUG_ASSERTCRASH( TheWritableGlobalData->m_next == NULL, ("~GlobalData: theOriginal is not original") ); - if (m_weaponBonusSet) - deleteInstance(m_weaponBonusSet); + deleteInstance(m_weaponBonusSet); if( m_theOriginal == this ) { m_theOriginal = NULL; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp index dcea928848b..9433932ef36 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp @@ -1185,11 +1185,8 @@ void INI::parseDynamicAudioEventRTS( INI *ini, void * /*instance*/, void *store, // translate the string into a sound if (stricmp(token, "NoSound") == 0) { - if (*theSound) - { - deleteInstance(*theSound); - *theSound = NULL; - } + deleteInstance(*theSound); + *theSound = NULL; } else { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp index 9d8ef74c227..802eab0066d 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp @@ -369,54 +369,36 @@ void Player::init(const PlayerTemplate* pt) m_bombardBattlePlans = 0; m_holdTheLineBattlePlans = 0; m_searchAndDestroyBattlePlans = 0; - if( m_battlePlanBonuses ) - { - deleteInstance(m_battlePlanBonuses); - m_battlePlanBonuses = NULL; - } + + deleteInstance(m_battlePlanBonuses); + m_battlePlanBonuses = NULL; deleteUpgradeList(); m_energy.init(this); m_stats.init(); - if (m_pBuildList != NULL) - { - deleteInstance(m_pBuildList); - m_pBuildList = NULL; - } + + deleteInstance(m_pBuildList); + m_pBuildList = NULL; + m_defaultTeam = NULL; - if (m_ai) - { - deleteInstance(m_ai); - } + deleteInstance(m_ai); m_ai = NULL; - if( m_resourceGatheringManager ) - { - deleteInstance(m_resourceGatheringManager); - m_resourceGatheringManager = NULL; - } + deleteInstance(m_resourceGatheringManager); + m_resourceGatheringManager = NULL; for (Int i = 0; i < NUM_HOTKEY_SQUADS; ++i) { - if (m_squads[i] != NULL) { - deleteInstance(m_squads[i]); - m_squads[i] = NULL; - } + deleteInstance(m_squads[i]); m_squads[i] = newInstance(Squad); } - if (m_currentSelection != NULL) { - deleteInstance(m_currentSelection) ; - m_currentSelection = NULL; - } + deleteInstance(m_currentSelection); m_currentSelection = newInstance(Squad); - if( m_tunnelSystem ) - { - deleteInstance(m_tunnelSystem); - m_tunnelSystem = NULL; - } + deleteInstance(m_tunnelSystem); + m_tunnelSystem = NULL; m_canBuildBase = true; m_canBuildUnits = true; @@ -509,8 +491,7 @@ void Player::init(const PlayerTemplate* pt) { KindOfPercentProductionChange *tof = *it; it = m_kindOfPercentProductionChangeList.erase( it ); - if(tof) - deleteInstance(tof); + deleteInstance(tof); } getAcademyStats()->init( this ); @@ -535,25 +516,21 @@ Player::~Player() // delete the relation maps (the destructor clears the actual map if any data is present) deleteInstance(m_teamRelations); + m_teamRelations = NULL; + deleteInstance(m_playerRelations); + m_playerRelations = NULL; for (Int i = 0; i < NUM_HOTKEY_SQUADS; ++i) { - if (m_squads[i] != NULL) { - deleteInstance(m_squads[i]); - m_squads[i] = NULL; - } + deleteInstance(m_squads[i]); + m_squads[i] = NULL; } - if (m_currentSelection != NULL) { - deleteInstance(m_currentSelection); - m_currentSelection = NULL; - } + deleteInstance(m_currentSelection); + m_currentSelection = NULL; - if( m_battlePlanBonuses ) - { - deleteInstance(m_battlePlanBonuses); - m_battlePlanBonuses = NULL; - } + deleteInstance(m_battlePlanBonuses); + m_battlePlanBonuses = NULL; } //============================================================================= @@ -660,10 +637,7 @@ Bool Player::removeTeamRelationship(const Team *that) void Player::setBuildList(BuildListInfo *pBuildList) { - if (m_pBuildList != NULL) - { - deleteInstance(m_pBuildList); - } + deleteInstance(m_pBuildList); m_pBuildList = pBuildList; } @@ -756,10 +730,7 @@ void Player::setPlayerType(PlayerType t, Bool skirmish) { m_playerType = t; - if (m_ai) - { - deleteInstance(m_ai); - } + deleteInstance(m_ai); m_ai = NULL; if (t == PLAYER_COMPUTER) @@ -792,11 +763,8 @@ void Player::setDefaultTeam(void) { //============================================================================= void Player::deletePlayerAI() { - if (m_ai) - { - deleteInstance(m_ai); - m_ai = NULL; - } + deleteInstance(m_ai); + m_ai = NULL; } //============================================================================= @@ -870,10 +838,10 @@ void Player::initFromDict(const Dict* d) ScriptList *scripts = TheSidesList->getSkirmishSideInfo(i)->getScriptList()->duplicateAndQualify( qualifier, qualTemplatePlayerName, pname); - if (TheSidesList->getSideInfo(getPlayerIndex())->getScriptList()) { - deleteInstance(TheSidesList->getSideInfo(getPlayerIndex())->getScriptList()); - } + + deleteInstance(TheSidesList->getSideInfo(getPlayerIndex())->getScriptList()); TheSidesList->getSideInfo(getPlayerIndex())->setScriptList(scripts); + deleteInstance(TheSidesList->getSkirmishSideInfo(i)->getScriptList()); TheSidesList->getSkirmishSideInfo(i)->setScriptList(NULL); } @@ -922,12 +890,10 @@ void Player::initFromDict(const Dict* d) qualifier.format("%d", m_mpStartIndex); ScriptList *scripts = TheSidesList->getSkirmishSideInfo(skirmishNdx)->getScriptList()->duplicateAndQualify( qualifier, qualTemplatePlayerName, pname); - ScriptList* slist = TheSidesList->getSideInfo(getPlayerIndex())->getScriptList(); - if (slist) - { - deleteInstance(slist); - } + + deleteInstance(TheSidesList->getSideInfo(getPlayerIndex())->getScriptList()); TheSidesList->getSideInfo(getPlayerIndex())->setScriptList(scripts); + for (i=0; igetNumTeams(); i++) { if (TheSidesList->getTeamInfo(i)->getDict()->getAsciiString(TheKey_teamOwner) == pname) { @@ -994,18 +960,11 @@ void Player::initFromDict(const Dict* d) } } } - if( m_resourceGatheringManager ) - { - deleteInstance(m_resourceGatheringManager); - m_resourceGatheringManager = NULL; - } + + deleteInstance(m_resourceGatheringManager); m_resourceGatheringManager = newInstance(ResourceGatheringManager); - if( m_tunnelSystem ) - { - deleteInstance(m_tunnelSystem); - m_tunnelSystem = NULL; - } + deleteInstance(m_tunnelSystem); m_tunnelSystem = newInstance(TunnelTracker); m_handicap.readFromDict(d); @@ -1038,18 +997,11 @@ void Player::initFromDict(const Dict* d) m_money.deposit(m); for ( i = 0; i < NUM_HOTKEY_SQUADS; ++i ) { - if (m_squads[i] != NULL) - { - deleteInstance(m_squads[i]); - m_squads[i] = NULL; - } + deleteInstance(m_squads[i]); m_squads[i] = newInstance( Squad ); } - if (m_currentSelection != NULL) { - deleteInstance(m_currentSelection); - m_currentSelection = NULL; - } + deleteInstance(m_currentSelection); m_currentSelection = newInstance( Squad ); } @@ -3884,8 +3836,7 @@ void Player::removeKindOfProductionCostChange( KindOfMaskType kindOf, Real perce if(tof->m_ref == 0) { m_kindOfPercentProductionChangeList.erase( it ); - if(tof) - deleteInstance(tof); + deleteInstance(tof); } return; } @@ -4198,8 +4149,7 @@ void Player::xfer( Xfer *xfer ) // destroy any build list that we got from loading the bare bones map, note that deleting // the head of these structures automatically deletes any links attached // - if( m_pBuildList) - deleteInstance(m_pBuildList); + deleteInstance(m_pBuildList); m_pBuildList = NULL; // read each build list info @@ -4538,11 +4488,9 @@ void Player::xfer( Xfer *xfer ) xfer->xferBool( &battlePlanBonus ); //If we're loading, it just replaces the bool if( xfer->getXferMode() == XFER_LOAD ) { - if (m_battlePlanBonuses) - { - deleteInstance(m_battlePlanBonuses); - m_battlePlanBonuses = NULL; - } + deleteInstance(m_battlePlanBonuses); + m_battlePlanBonuses = NULL; + if ( battlePlanBonus ) { m_battlePlanBonuses = newInstance( BattlePlanBonuses ); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp index bf018c27bcc..5a24eca630f 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp @@ -54,9 +54,7 @@ ScienceStore::~ScienceStore() { ScienceInfo* si = *it; ++it; - if (si) { - deleteInstance(si); - } + deleteInstance(si); } } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp index 6154f8d5514..42e9214f3ee 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp @@ -849,19 +849,13 @@ TeamPrototype::~TeamPrototype() if (m_factory) m_factory->removeTeamPrototypeFromList(this); - if (m_productionConditionScript) - { - deleteInstance(m_productionConditionScript); - } + deleteInstance(m_productionConditionScript); m_productionConditionScript = NULL; for (Int i = 0; i < MAX_GENERIC_SCRIPTS; ++i) { - if (m_genericScriptsToRun[i]) - { - deleteInstance(m_genericScriptsToRun[i]); - m_genericScriptsToRun[i] = NULL; - } + deleteInstance(m_genericScriptsToRun[i]); + m_genericScriptsToRun[i] = NULL; } } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp index 154a7a393b7..f65ecafd783 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp @@ -292,8 +292,7 @@ StateMachine::~StateMachine() // delete all states in the mapping for( i = m_stateMap.begin(); i != m_stateMap.end(); ++i ) { - if ((*i).second) - deleteInstance((*i).second); + deleteInstance((*i).second); } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp index c319db509dd..ddcf06e95bc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp @@ -316,8 +316,7 @@ void Display::update( void ) if( m_elapsedCopywriteTime == 0 && m_elapsedCopywriteTime >= 0) { //display the copyrighttext; - if(m_copyrightDisplayString) - deleteInstance(m_copyrightDisplayString); + deleteInstance(m_copyrightDisplayString); m_copyrightDisplayString = TheDisplayStringManager->newDisplayString(); m_copyrightDisplayString->setText(TheGameText->fetch("GUI:EACopyright")); if (TheGlobalLanguageData && TheGlobalLanguageData->m_copyrightFont.name.isNotEmpty()) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index d314e7c4dee..0ad661c609a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -157,8 +157,7 @@ void DrawableIconInfo::clear() { for (int i = 0; i < MAX_ICONS; ++i) { - if (m_icon[i]) - deleteInstance(m_icon[i]); + deleteInstance(m_icon[i]); m_icon[i] = NULL; m_keepTillFrame[i] = 0; } @@ -553,11 +552,9 @@ Drawable::~Drawable() } stopAmbientSound(); - if (m_ambientSound) - { - deleteInstance(m_ambientSound); - m_ambientSound = NULL; - } + + deleteInstance(m_ambientSound); + m_ambientSound = NULL; clearCustomSoundAmbient( false ); @@ -569,20 +566,17 @@ Drawable::~Drawable() m_object = NULL; // delete any icons present - if (m_iconInfo) - deleteInstance(m_iconInfo); + deleteInstance(m_iconInfo); + m_iconInfo = NULL; - if (m_selectionFlashEnvelope) - deleteInstance(m_selectionFlashEnvelope); + deleteInstance(m_selectionFlashEnvelope); + m_selectionFlashEnvelope = NULL; - if (m_colorTintEnvelope) - deleteInstance(m_colorTintEnvelope); + deleteInstance(m_colorTintEnvelope); + m_colorTintEnvelope = NULL; - if (m_locoInfo) - { - deleteInstance(m_locoInfo); - m_locoInfo = NULL; - } + deleteInstance(m_locoInfo); + m_locoInfo = NULL; } //------------------------------------------------------------------------------------------------- @@ -5390,8 +5384,7 @@ void Drawable::xfer( Xfer *xfer ) catch( ... ) { // since Xfer can throw exceptions -- don't leak memory! - if ( customizedInfo != NULL ) - deleteInstance(customizedInfo); + deleteInstance(customizedInfo); throw; //rethrow } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp index 6bdbc655b04..bd7af01e708 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp @@ -246,8 +246,7 @@ Eva::~Eva() { EvaCheckInfoPtrVecIt it; for (it = m_allCheckInfos.begin(); it != m_allCheckInfos.end(); ++it) { - if (*it) - deleteInstance(*it); + deleteInstance(*it); } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp index b8c551ad6cf..164ba0786bb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp @@ -791,8 +791,7 @@ void FXList::clear() { for (FXNuggetList::iterator it = m_nuggets.begin(); it != m_nuggets.end(); ++it) { - if (*it) - deleteInstance(*it); + deleteInstance(*it); } m_nuggets.clear(); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp index a3d49866d62..9cd69272f37 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp @@ -111,14 +111,11 @@ void AnimateWindow::setAnimData( ICoord2D startPos, ICoord2D endPos, static void clearWinList(AnimateWindowList &winList) { - wnd::AnimateWindow *win = NULL; while (!winList.empty()) { - win = *(winList.begin()); + wnd::AnimateWindow *win = *(winList.begin()); winList.pop_front(); - if (win) - deleteInstance(win); - win = NULL; + deleteInstance(win); } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp index bd94164389f..ddc1dbaf726 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp @@ -118,8 +118,7 @@ void GameWindowManager::processDestroyList( void ) DEBUG_ASSERTCRASH(doDestroy->winGetUserData() == NULL, ("Win user data is expected to be deleted now")); // free the memory - if (doDestroy) - deleteInstance(doDestroy); + deleteInstance(doDestroy); } // end for diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index 0c6365c8e88..f831974df7c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -5753,8 +5753,7 @@ void InGameUI::resetIdleWorker( void ) void InGameUI::recreateControlBar( void ) { GameWindow *win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(AsciiString("ControlBar.wnd"))); - if(win) - deleteInstance(win); + deleteInstance(win); m_idleWorkerWin = NULL; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Snow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Snow.cpp index 92f08908337..a999ab5695a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Snow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Snow.cpp @@ -96,11 +96,8 @@ SnowManager::~SnowManager() m_startingHeights=NULL; // TheSuperHackers @fix Mauller 13/04/2025 Delete the instance of the weather settings - if (TheWeatherSetting) - { - deleteInstance((WeatherSetting*)TheWeatherSetting.getNonOverloadedPointer()); - TheWeatherSetting=NULL; - } + deleteInstance((WeatherSetting*)TheWeatherSetting.getNonOverloadedPointer()); + TheWeatherSetting=NULL; } OVERRIDE TheWeatherSetting = NULL; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp index f76225f0c4f..c9b6790ee38 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp @@ -130,8 +130,7 @@ Campaign::~Campaign( void ) { Mission *mission = *it; it = m_missions.erase( it ); - if(mission) - deleteInstance(mission); + deleteInstance(mission); } } @@ -236,8 +235,7 @@ CampaignManager::~CampaignManager( void ) { Campaign *campaign = *it; it = m_campaignList.erase( it ); - if(campaign) - deleteInstance(campaign); + deleteInstance(campaign); } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp index 18bd5f9fcc5..d6770eef4c2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp @@ -63,8 +63,7 @@ void TAiData::addFactionBuildList(AISideBuildList *buildList) AISideBuildList *info = m_sideBuildLists; while (info) { if (buildList->m_side == info->m_side) { - if (info->m_buildList) - deleteInstance(info->m_buildList); + deleteInstance(info->m_buildList); info->m_buildList = buildList->m_buildList; buildList->m_buildList = NULL; buildList->m_next = NULL; @@ -109,9 +108,7 @@ AISideBuildList::AISideBuildList( AsciiString side ) : AISideBuildList::~AISideBuildList() { - if (m_buildList) { - deleteInstance(m_buildList); // note - deletes all in the list. - } + deleteInstance(m_buildList); // note - deletes all in the list. m_buildList = NULL; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp index 27eaa17ad6f..88c205969e0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp @@ -111,10 +111,9 @@ AIGroup::~AIGroup() #endif - if (m_groundPath) { - deleteInstance(m_groundPath); - m_groundPath = NULL; - } + deleteInstance(m_groundPath); + m_groundPath = NULL; + //DEBUG_LOG(( "AIGroup #%d destroyed", m_id )); } @@ -445,10 +444,8 @@ void AIGroup::recompute( void ) getCenter( ¢er ); - if (m_groundPath) { - deleteInstance(m_groundPath); - m_groundPath = NULL; - } + deleteInstance(m_groundPath); + m_groundPath = NULL; m_speed = 9999999999.9f; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index ab3a25c5fa7..91bceb08347 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -3871,10 +3871,9 @@ void Pathfinder::reset( void ) debugPathPos.y = 0.0f; debugPathPos.z = 0.0f; - if (debugPath) - deleteInstance(debugPath); - + deleteInstance(debugPath); debugPath = NULL; + m_frameToShowObstacles = 0; for (m_queuePRHead=0; m_queuePRHeadm_debugAI) { // copy the path for debugging - if (debugPath) - deleteInstance(debugPath); - + deleteInstance(debugPath); debugPath = newInstance(Path); for( PathNode *copyNode = newDebugpath->getFirstNode(); copyNode; copyNode = copyNode->getNextOptimized() ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index fc03e162c7b..8c30b6ae81c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -731,10 +731,7 @@ AIStateMachine::AIStateMachine( Object *obj, AsciiString name ) : StateMachine( //---------------------------------------------------------------------------------------------------------- AIStateMachine::~AIStateMachine() { - if (m_goalSquad) - { - deleteInstance(m_goalSquad); - } + deleteInstance(m_goalSquad); } @@ -5703,11 +5700,8 @@ void AIAttackState::onExit( StateExitType status ) //addSelfAsTargeter(false); // destroy the attack machine - if (m_attackMachine) - { - deleteInstance(m_attackMachine); - m_attackMachine = NULL; - } + deleteInstance(m_attackMachine); + m_attackMachine = NULL; Object *obj = getMachineOwner(); obj->clearStatus( MAKE_OBJECT_STATUS_MASK4( OBJECT_STATUS_IS_FIRING_WEAPON, @@ -5921,12 +5915,9 @@ StateReturnType AIAttackSquadState::update( void ) //---------------------------------------------------------------------------------------------------------- void AIAttackSquadState::onExit( StateExitType status ) { - if( m_attackSquadMachine ) - { - // destroy the attack machine - deleteInstance(m_attackSquadMachine); - m_attackSquadMachine = NULL; - } + // destroy the attack machine + deleteInstance(m_attackSquadMachine); + m_attackSquadMachine = NULL; } //---------------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp index fdddaab0fac..fa146d3c73e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp @@ -321,8 +321,7 @@ TurretAI::~TurretAI() { stopRotOrPitchSound(); - if (m_turretStateMachine) - deleteInstance(m_turretStateMachine); + deleteInstance(m_turretStateMachine); } // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp index e1227cf0106..a0a9f243ddd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp @@ -87,10 +87,12 @@ void SidesInfo::init(const Dict* d) { deleteInstance(m_pBuildList); m_pBuildList = NULL; + m_dict.clear(); - if (m_scripts) - deleteInstance(m_scripts); + + deleteInstance(m_scripts); m_scripts = NULL; + if (d) m_dict = *d; } @@ -302,8 +304,7 @@ Bool SidesList::ParseSidesDataChunk(DataChunkInput &file, DataChunkInfo *info, v count = ScriptList::getReadScripts(scripts); for (i=0; igetNumSides()) { - ScriptList *pSL = TheSidesList->getSideInfo(i)->getScriptList(); - deleteInstance(pSL); + deleteInstance(TheSidesList->getSideInfo(i)->getScriptList()); TheSidesList->getSideInfo(i)->setScriptList(scripts[i]); scripts[i] = NULL; } else { @@ -545,12 +546,9 @@ void SidesList::prepareForMP_or_Skirmish(void) } if (curSide == -1) continue; - ScriptList *pSL = getSkirmishSideInfo(curSide)->getScriptList(); + deleteInstance(getSkirmishSideInfo(curSide)->getScriptList()); getSkirmishSideInfo(curSide)->setScriptList(scripts[i]); scripts[i] = NULL; - if (pSL) - deleteInstance(pSL); - scripts[i] = NULL; } for (i=0; i(m_turretData[i]); - if (td) - deleteInstance(td); + deleteInstance(td); } } } @@ -644,8 +643,7 @@ AIUpdateInterface::~AIUpdateInterface( void ) for (int i = 0; i < MAX_TURRETS; i++) { - if (m_turretAI[i]) - deleteInstance(m_turretAI[i]); + deleteInstance(m_turretAI[i]); m_turretAI[i] = NULL; } m_stateMachine = NULL; @@ -2020,10 +2018,9 @@ Bool AIUpdateInterface::computeAttackPath( PathfindServicesInterface *pathServic void AIUpdateInterface::destroyPath( void ) { // destroy previous path - if (m_path) - deleteInstance(m_path); - + deleteInstance(m_path); m_path = NULL; + m_waitingForPath = FALSE; // we no longer need it. //CRCDEBUG_LOG(("AIUpdateInterface::destroyPath() - m_isAttackPath = FALSE for object %d", getObject()->getID())); m_isAttackPath = FALSE; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp index ddd60b6c8bd..0c223545976 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp @@ -133,8 +133,7 @@ DeliverPayloadAIUpdate::~DeliverPayloadAIUpdate( void ) { m_deliveryDecal.clear(); - if (m_deliverPayloadStateMachine) - deleteInstance(m_deliverPayloadStateMachine); + deleteInstance(m_deliverPayloadStateMachine); } //------------------------------------------------------------------------------------------------- @@ -256,8 +255,7 @@ void DeliverPayloadAIUpdate::deliverPayload( //THIS GETS CALLED VIA OBJECT CREATION LISTS ONLY!!! //**************************************************** - if (m_deliverPayloadStateMachine) - deleteInstance(m_deliverPayloadStateMachine); + deleteInstance(m_deliverPayloadStateMachine); m_deliverPayloadStateMachine = NULL; m_moveToPos = *moveToPos; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp index 08089106bbd..6b6dd3f85dd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp @@ -1178,7 +1178,7 @@ class DozerActionState : public State StateMachine *m_actionMachine; }; -inline DozerActionState::~DozerActionState( void ) { if (m_actionMachine) deleteInstance(m_actionMachine); } +inline DozerActionState::~DozerActionState( void ) { deleteInstance(m_actionMachine); } // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -1477,8 +1477,7 @@ DozerAIUpdate::~DozerAIUpdate( void ) { // delete our behavior state machine - if( m_dozerMachine ) - deleteInstance(m_dozerMachine); + deleteInstance(m_dozerMachine); // no orders for( Int i = 0; i < DOZER_NUM_TASKS; i++ ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp index 5bbae94d4c5..851678b76cb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp @@ -126,14 +126,9 @@ WorkerAIUpdate::~WorkerAIUpdate( void ) { // delete our behavior state machine - if( m_dozerMachine ) - deleteInstance(m_dozerMachine); - - if( m_supplyTruckStateMachine ) - deleteInstance(m_supplyTruckStateMachine); - - if( m_workerMachine ) - deleteInstance(m_workerMachine); + deleteInstance(m_dozerMachine); + deleteInstance(m_supplyTruckStateMachine); + deleteInstance(m_workerMachine); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp index 01ef3646e13..cce8ab80f95 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp @@ -83,8 +83,7 @@ FireWeaponUpdate::FireWeaponUpdate( Thing *thing, const ModuleData* moduleData ) //------------------------------------------------------------------------------------------------- FireWeaponUpdate::~FireWeaponUpdate( void ) { - if (m_weapon) - deleteInstance(m_weapon); + deleteInstance(m_weapon); } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp index b1bdf880d14..b126820f9c9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp @@ -255,11 +255,8 @@ void PhysicsBehavior::onObjectCreated() //------------------------------------------------------------------------------------------------- PhysicsBehavior::~PhysicsBehavior() { - if (m_bounceSound) - { - deleteInstance(m_bounceSound); - m_bounceSound = NULL; - } + deleteInstance(m_bounceSound); + m_bounceSound = NULL; } //------------------------------------------------------------------------------------------------- @@ -607,11 +604,8 @@ void PhysicsBehavior::setBounceSound(const AudioEventRTS* bounceSound) } else { - if (m_bounceSound) - { - deleteInstance(m_bounceSound); - m_bounceSound = NULL; - } + deleteInstance(m_bounceSound); + m_bounceSound = NULL; } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index a02400822c9..7e5d78dacee 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -327,13 +327,10 @@ WeaponTemplate::WeaponTemplate() : m_nextTemplate(NULL) //------------------------------------------------------------------------------------------------- WeaponTemplate::~WeaponTemplate() { - if (m_nextTemplate) { - deleteInstance(m_nextTemplate); - } + deleteInstance(m_nextTemplate); // delete any extra-bonus that's present - if (m_extraBonus) - deleteInstance(m_extraBonus); + deleteInstance(m_extraBonus); } // ------------------------------------------------------------------------------------------------ @@ -1502,8 +1499,7 @@ WeaponStore::~WeaponStore() for (size_t i = 0; i < m_weaponTemplateVector.size(); i++) { WeaponTemplate* wt = m_weaponTemplateVector[i]; - if (wt) - deleteInstance(wt); + deleteInstance(wt); } m_weaponTemplateVector.clear(); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp index 1b31e75719c..957c2cb5447 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp @@ -190,8 +190,7 @@ WeaponSet::WeaponSet() WeaponSet::~WeaponSet() { for (Int i = 0; i < WEAPONSLOT_COUNT; ++i) - if (m_weapons[i]) - deleteInstance(m_weapons[i]); + deleteInstance(m_weapons[i]); } // ------------------------------------------------------------------------------------------------ @@ -311,11 +310,8 @@ void WeaponSet::updateWeaponSet(const Object* obj) m_hasDamageWeapon = false; for (Int i = WEAPONSLOT_COUNT - 1; i >= PRIMARY_WEAPON ; --i) { - if (m_weapons[i] != NULL) - { - deleteInstance(m_weapons[i]); - m_weapons[i] = NULL; - } + deleteInstance(m_weapons[i]); + m_weapons[i] = NULL; if (set->getNth((WeaponSlotType)i)) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp index 37a2ec3bf8b..c19249fd9b2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp @@ -74,8 +74,7 @@ class ObjectTypesTemp ~ObjectTypesTemp() { - if (m_types) - deleteInstance(m_types); + deleteInstance(m_types); } }; @@ -114,8 +113,7 @@ class TransportStatus : public MemoryPoolObject //------------------------------------------------------------------------------------------------- TransportStatus::~TransportStatus() { - if (m_nextStatus) - deleteInstance(m_nextStatus); + deleteInstance(m_nextStatus); } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp index 5a360d477e2..e5967963f3f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp @@ -218,14 +218,11 @@ m_firstScript(NULL) */ ScriptList::~ScriptList(void) { - if (m_firstGroup) { - deleteInstance(m_firstGroup); - m_firstGroup = NULL; - } - if (m_firstScript) { - deleteInstance(m_firstScript); - m_firstScript = NULL; - } + deleteInstance(m_firstGroup); + m_firstGroup = NULL; + + deleteInstance(m_firstScript); + m_firstScript = NULL; } // ------------------------------------------------------------------------------------------------ @@ -529,10 +526,8 @@ Bool ScriptList::ParseScriptsDataChunk(DataChunkInput &file, DataChunkInfo *info file.registerParser( AsciiString("ScriptList"), info->label, ScriptList::ParseScriptListDataChunk ); DEBUG_ASSERTCRASH(s_numInReadList==0, ("Leftover scripts floating aroung.")); for (i=0; im_condition) { - deleteInstance(pNew->m_condition); - } - if (pNew->m_action) { - deleteInstance(pNew->m_action); - } + pNew->m_scriptName = m_scriptName; pNew->m_comment = m_comment; pNew->m_conditionComment = m_conditionComment; @@ -1015,6 +998,7 @@ Script *Script::duplicate(void) const pNew->m_normal = m_normal; pNew->m_hard = m_hard; pNew->m_delayEvaluationSeconds = m_delayEvaluationSeconds; + if (m_condition) { pNew->m_condition = m_condition->duplicate(); } @@ -1037,12 +1021,7 @@ Script *Script::duplicateAndQualify(const AsciiString& qualifier, const AsciiString& playerTemplateName, const AsciiString& newPlayerName) const { Script *pNew = newInstance(Script); - if (pNew->m_condition) { - deleteInstance(pNew->m_condition); - } - if (pNew->m_action) { - deleteInstance(pNew->m_action); - } + pNew->m_scriptName = m_scriptName; pNew->m_scriptName.concat(qualifier); pNew->m_comment = m_comment; @@ -1055,6 +1034,7 @@ Script *Script::duplicateAndQualify(const AsciiString& qualifier, pNew->m_normal = m_normal; pNew->m_hard = m_hard; pNew->m_delayEvaluationSeconds = m_delayEvaluationSeconds; + if (m_condition) { pNew->m_condition = m_condition->duplicateAndQualify(qualifier, playerTemplateName, newPlayerName); } @@ -1086,19 +1066,16 @@ void Script::updateFrom(Script *pSrc) this->m_easy = pSrc->m_easy; this->m_normal = pSrc->m_normal; this->m_hard = pSrc->m_hard; - if (this->m_condition) { - deleteInstance(this->m_condition); - } + + deleteInstance(this->m_condition); this->m_condition = pSrc->m_condition; pSrc->m_condition = NULL; - if (this->m_action) { - deleteInstance(this->m_action); - } + + deleteInstance(this->m_action); this->m_action = pSrc->m_action; pSrc->m_action = NULL; - if (this->m_actionFalse) { - deleteInstance(this->m_actionFalse); - } + + deleteInstance(this->m_actionFalse); this->m_actionFalse = pSrc->m_actionFalse; pSrc->m_actionFalse = NULL; } @@ -1346,10 +1323,9 @@ OrCondition *Script::findPreviousOrCondition( OrCondition *curOr ) //------------------------------------------------------------------------------------------------- OrCondition::~OrCondition(void) { - if (m_firstAnd) { - deleteInstance(m_firstAnd); - m_firstAnd = NULL; - } + deleteInstance(m_firstAnd); + m_firstAnd = NULL; + if (m_nextOr) { OrCondition *cur = m_nextOr; OrCondition *next; @@ -1539,8 +1515,7 @@ void Condition::setConditionType(enum ConditionType type) { Int i; for (i=0; i::iterator iter = m_tunnelTrackerVector.begin(); iter != m_tunnelTrackerVector.end(); iter++ ) { - TunnelTracker *currentTracker = *iter; - if( currentTracker )// could be NULL, since we don't slide back to fill deleted entries so offsets don't shift - { - deleteInstance(currentTracker); - } + TunnelTracker *currentTracker = *iter; // could be NULL, since we don't slide back to fill deleted entries so offsets don't shift + deleteInstance(currentTracker); } m_tunnelTrackerVector.clear(); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp index 227dd9a88f4..d588056d96b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp @@ -47,10 +47,7 @@ CrateSystem::~CrateSystem() for( Int templateIndex = 0; templateIndex < count; templateIndex ++ ) { CrateTemplate *currentTemplate = m_crateTemplateVector[templateIndex]; - if( currentTemplate ) - { - deleteInstance(currentTemplate); - } + deleteInstance(currentTemplate); } m_crateTemplateVector.clear(); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/RankInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/RankInfo.cpp index 5a0756d2cf5..47f55ea2fd7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/RankInfo.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/RankInfo.cpp @@ -49,10 +49,7 @@ RankInfoStore::~RankInfoStore() for (level =0; level < getRankLevelCount(); level++) { RankInfo* ri = m_rankInfos[level]; - if (ri) - { - deleteInstance(ri); - } + deleteInstance(ri); } m_rankInfos.clear(); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/Connection.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/Connection.cpp index ebeaef79fa1..d0b5e377a6e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/Connection.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/Connection.cpp @@ -58,15 +58,11 @@ Connection::Connection() { * The destructor. */ Connection::~Connection() { - if (m_user != NULL) { - deleteInstance(m_user); - m_user = NULL; - } + deleteInstance(m_user); + m_user = NULL; - if (m_netCommandList != NULL) { - deleteInstance(m_netCommandList); - m_netCommandList = NULL; - } + deleteInstance(m_netCommandList); + m_netCommandList = NULL; } /** @@ -75,10 +71,8 @@ Connection::~Connection() { void Connection::init() { m_transport = NULL; - if (m_user != NULL) { - deleteInstance(m_user); - m_user = NULL; - } + deleteInstance(m_user); + m_user = NULL; if (m_netCommandList == NULL) { m_netCommandList = newInstance(NetCommandList); @@ -123,10 +117,7 @@ void Connection::attachTransport(Transport *transport) { * Assign this connection a user. This is the user to whome we send all our packetized goodies. */ void Connection::setUser(User *user) { - if (m_user != NULL) { - deleteInstance(m_user); - } - + deleteInstance(m_user); m_user = user; } @@ -325,9 +316,8 @@ UnsignedInt Connection::doSend() { couldQueue = m_transport->queueSend(packet->getAddr(), packet->getPort(), packet->getData(), packet->getLength()); m_lastTimeSent = curtime; } - if (packet != NULL) { - deleteInstance(packet); // delete the packet now that we're done with it. - } + + deleteInstance(packet); // delete the packet now that we're done with it. } return numpackets; diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp index b256cd61143..407af5e4411 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp @@ -59,57 +59,39 @@ */ ConnectionManager::~ConnectionManager(void) { - if (m_localUser != NULL) { - deleteInstance(m_localUser); - m_localUser = NULL; - } + deleteInstance(m_localUser); + m_localUser = NULL; -// m_transport = NULL; // Network will delete transports; we just forget them - if (m_transport != NULL) { - delete m_transport; - m_transport = NULL; - } + // Network will delete transports; we just forget them + delete m_transport; + m_transport = NULL; Int i = 0; for (; i < MAX_SLOTS; ++i) { - if (m_frameData[i] != NULL) { - deleteInstance(m_frameData[i]); - m_frameData[i] = NULL; - } + deleteInstance(m_frameData[i]); + m_frameData[i] = NULL; } for (i = 0; i < NUM_CONNECTIONS; ++i) { - if (m_connections[i] != NULL) { - deleteInstance(m_connections[i]); - m_connections[i] = NULL; - } + deleteInstance(m_connections[i]); + m_connections[i] = NULL; } - if (TheDisconnectMenu != NULL) { - // This is done here since TheDisconnectMenu should only be there if we are in a network game. - delete TheDisconnectMenu; - TheDisconnectMenu = NULL; - } + // This is done here since TheDisconnectMenu should only be there if we are in a network game. + delete TheDisconnectMenu; + TheDisconnectMenu = NULL; - if (m_disconnectManager != NULL) { - delete m_disconnectManager; - m_disconnectManager = NULL; - } + delete m_disconnectManager; + m_disconnectManager = NULL; - if (m_pendingCommands != NULL) { - deleteInstance(m_pendingCommands); - m_pendingCommands = NULL; - } + deleteInstance(m_pendingCommands); + m_pendingCommands = NULL; - if (m_relayedCommands != NULL) { - deleteInstance(m_relayedCommands); - m_relayedCommands = NULL; - } + deleteInstance(m_relayedCommands); + m_relayedCommands = NULL; - if (m_netCommandWrapperList != NULL) { - deleteInstance(m_netCommandWrapperList); - m_netCommandWrapperList = NULL; - } + deleteInstance(m_netCommandWrapperList); + m_netCommandWrapperList = NULL; s_fileCommandMap.clear(); s_fileRecipientMaskMap.clear(); @@ -174,10 +156,8 @@ void ConnectionManager::init() } for (i = 0; i < MAX_SLOTS; ++i) { - if (m_frameData[i] != NULL) { - deleteInstance(m_frameData[i]); - m_frameData[i] = NULL; - } + deleteInstance(m_frameData[i]); + m_frameData[i] = NULL; } // m_averageFps = 30; // since 30 fps is the desired rate, we'll start off at that. @@ -228,18 +208,14 @@ void ConnectionManager::reset() UnsignedInt i = 0; for (; i < (UnsignedInt)NUM_CONNECTIONS; ++i) { - if (m_connections[i] != NULL) { - deleteInstance(m_connections[i]); - m_connections[i] = NULL; - } + deleteInstance(m_connections[i]); + m_connections[i] = NULL; } for (i=0; i<(UnsignedInt)MAX_SLOTS; ++i) { - if (m_frameData[i] != NULL) { - deleteInstance(m_frameData[i]); - m_frameData[i] = NULL; - } + deleteInstance(m_frameData[i]); + m_frameData[i] = NULL; } if (m_pendingCommands == NULL) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/FrameData.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/FrameData.cpp index c03ea05e7e8..1dc1907ea6a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/FrameData.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/FrameData.cpp @@ -49,10 +49,8 @@ FrameData::FrameData() */ FrameData::~FrameData() { - if (m_commandList != NULL) { - deleteInstance(m_commandList); - m_commandList = NULL; - } + deleteInstance(m_commandList); + m_commandList = NULL; } /** diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetPacket.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetPacket.cpp index 8ae95e235af..60d71ab5e82 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetPacket.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetPacket.cpp @@ -1005,8 +1005,7 @@ void NetPacket::FillBufferWithGameCommand(UnsignedByte *buffer, NetCommandRef *m // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addGameMessage - added game message, frame %d, player %d, command ID %d", m_lastFrame, m_lastPlayerID, m_lastCommandID)); - if (gmsg) - deleteInstance(gmsg); + deleteInstance(gmsg); gmsg = NULL; } @@ -2002,10 +2001,8 @@ NetPacket::NetPacket(TransportMessage *msg) { * Destructor */ NetPacket::~NetPacket() { - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + deleteInstance(m_lastCommand); + m_lastCommand = NULL; } /** @@ -2028,10 +2025,9 @@ void NetPacket::init() { } void NetPacket::reset() { - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + deleteInstance(m_lastCommand); + m_lastCommand = NULL; + init(); } @@ -2197,10 +2193,8 @@ Bool NetPacket::addFrameResendRequestCommand(NetCommandRef *msg) { DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addFrameResendRequest - added frame resend request command from player %d for frame %d, command id = %d", m_lastPlayerID, frameToResend, m_lastCommandID)); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -2308,10 +2302,8 @@ Bool NetPacket::addDisconnectScreenOffCommand(NetCommandRef *msg) { DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addDisconnectScreenOff - added disconnect screen off command from player %d for frame %d, command id = %d", m_lastPlayerID, newFrame, m_lastCommandID)); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -2417,10 +2409,8 @@ Bool NetPacket::addDisconnectFrameCommand(NetCommandRef *msg) { m_packetLen += sizeof(disconnectFrame); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -2525,10 +2515,8 @@ Bool NetPacket::addFileCommand(NetCommandRef *msg) { m_packetLen += fileLength; ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); return TRUE; @@ -2630,10 +2618,8 @@ Bool NetPacket::addFileAnnounceCommand(NetCommandRef *msg) { m_packetLen += sizeof(playerMask); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -2735,10 +2721,8 @@ Bool NetPacket::addFileProgressCommand(NetCommandRef *msg) { m_packetLen += sizeof(progress); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -2867,10 +2851,8 @@ Bool NetPacket::addWrapperCommand(NetCommandRef *msg) { m_packetLen += dataLength; ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -2966,10 +2948,8 @@ Bool NetPacket::addTimeOutGameStartMessage(NetCommandRef *msg) { ++m_packetLen; ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -3060,10 +3040,8 @@ Bool NetPacket::addLoadCompleteMessage(NetCommandRef *msg) { ++m_packetLen; ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -3146,10 +3124,8 @@ Bool NetPacket::addProgressMessage(NetCommandRef *msg) { ++m_packetLen; ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -3257,10 +3233,8 @@ Bool NetPacket::addDisconnectVoteCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addDisconnectVoteCommand - added disconnect vote command, player id %d command id %d, voted slot %d", m_lastPlayerID, m_lastCommandID, slot)); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); return TRUE; @@ -3356,10 +3330,8 @@ Bool NetPacket::addDisconnectChatCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket - added disconnect chat command")); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); return TRUE; @@ -3473,10 +3445,8 @@ Bool NetPacket::addChatCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket - added chat command")); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); return TRUE; @@ -3564,10 +3534,8 @@ Bool NetPacket::addPacketRouterAckCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket - added packet router ack command, player id %d", m_lastPlayerID)); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); return TRUE; @@ -3646,10 +3614,8 @@ Bool NetPacket::addPacketRouterQueryCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket - added packet router query command, player id %d", m_lastPlayerID)); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); return TRUE; @@ -3751,10 +3717,8 @@ Bool NetPacket::addDisconnectPlayerCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addDisconnectPlayerCommand - added disconnect player command, player id %d command id %d, disconnecting slot %d", m_lastPlayerID, m_lastCommandID, slot)); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); return TRUE; @@ -3836,10 +3800,8 @@ Bool NetPacket::addDisconnectKeepAliveCommand(NetCommandRef *msg) { ++m_packetLen; ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -3916,10 +3878,8 @@ Bool NetPacket::addKeepAliveCommand(NetCommandRef *msg) { ++m_packetLen; ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -4035,10 +3995,8 @@ Bool NetPacket::addRunAheadCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket - added run ahead command, frame %d, player id %d command id %d", m_lastFrame, m_lastPlayerID, m_lastCommandID)); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); return TRUE; @@ -4156,10 +4114,8 @@ Bool NetPacket::addDestroyPlayerCommand(NetCommandRef *msg) { //DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket - added CRC:0x%8.8X info command, frame %d, player id %d command id %d", newCRC, m_lastFrame, m_lastPlayerID, m_lastCommandID)); ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); return TRUE; @@ -4268,10 +4224,7 @@ Bool NetPacket::addRunAheadMetricsCommand(NetCommandRef *msg) { memcpy(m_packet + m_packetLen, &averageFps, sizeof(averageFps)); m_packetLen += sizeof(averageFps); - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -4387,10 +4340,7 @@ Bool NetPacket::addPlayerLeaveCommand(NetCommandRef *msg) { memcpy(m_packet + m_packetLen, &leavingPlayerID, sizeof(UnsignedByte)); m_packetLen += sizeof(UnsignedByte); - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -4526,10 +4476,7 @@ Bool NetPacket::addFrameCommand(NetCommandRef *msg) { // frameinfodebug // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("outgoing - added frame %d, player %d, command count = %d, command id = %d", cmdMsg->getExecutionFrame(), cmdMsg->getPlayerID(), cmdMsg->getCommandCount(), cmdMsg->getID())); - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -4632,9 +4579,8 @@ Bool NetPacket::addAckCommand(NetCommandRef *msg, UnsignedShort commandID, Unsig m_packet[m_packetLen] = 'Z'; ++m_packetLen; ++m_numCommands; - deleteInstance(m_lastCommand); - m_lastCommand = NULL; + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); return TRUE; @@ -4669,10 +4615,7 @@ Bool NetPacket::addAckCommand(NetCommandRef *msg, UnsignedShort commandID, Unsig memcpy(m_packet + m_packetLen, &originalPlayerID, sizeof(UnsignedByte)); m_packetLen += sizeof(UnsignedByte); - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); @@ -4882,20 +4825,15 @@ Bool NetPacket::addGameCommand(NetCommandRef *msg) { ++m_numCommands; - if (m_lastCommand != NULL) { - deleteInstance(m_lastCommand); - m_lastCommand = NULL; - } + deleteInstance(m_lastCommand); m_lastCommand = NEW_NETCOMMANDREF(msg->getCommand()); m_lastCommand->setRelay(msg->getRelay()); retval = TRUE; } - if (gmsg) { - deleteInstance(gmsg); - gmsg = NULL; - } + deleteInstance(gmsg); + gmsg = NULL; return retval; } @@ -5233,10 +5171,7 @@ NetCommandList * NetPacket::getCommandList() { DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::getCommandList - failed to set relay for message %d", msg->getID())); } - if (lastCommand != NULL) { - deleteInstance(lastCommand); - lastCommand = NULL; - } + deleteInstance(lastCommand); lastCommand = newInstance(NetCommandRef)(msg); msg->detach(); // Need to detach from new NetCommandMsg created by the "readXMessage" above. @@ -5311,7 +5246,6 @@ NetCommandList * NetPacket::getCommandList() { } deleteInstance(lastCommand); - lastCommand = NULL; // lastCommand = newInstance(NetCommandRef)(msg); lastCommand = NEW_NETCOMMANDREF(msg); @@ -5334,10 +5268,9 @@ NetCommandList * NetPacket::getCommandList() { } - if (lastCommand != NULL) { - deleteInstance(lastCommand); - lastCommand = NULL; - } + deleteInstance(lastCommand); + lastCommand = NULL; + return retval; } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp index 83407118f43..9c937d947e5 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp @@ -142,8 +142,8 @@ void W3DRadar::deleteResources( void ) if( m_terrainTexture ) m_terrainTexture->Release_Ref(); m_terrainTexture = NULL; - if( m_terrainImage ) - deleteInstance(m_terrainImage); + + deleteInstance(m_terrainImage); m_terrainImage = NULL; // @@ -152,8 +152,8 @@ void W3DRadar::deleteResources( void ) if( m_overlayTexture ) m_overlayTexture->Release_Ref(); m_overlayTexture = NULL; - if( m_overlayImage ) - deleteInstance(m_overlayImage); + + deleteInstance(m_overlayImage); m_overlayImage = NULL; // @@ -162,8 +162,8 @@ void W3DRadar::deleteResources( void ) if( m_shroudTexture ) m_shroudTexture->Release_Ref(); m_shroudTexture = NULL; - if( m_shroudImage ) - deleteInstance(m_shroudImage); + + deleteInstance(m_shroudImage); m_shroudImage = NULL; } // end deleteResources diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/WorldBuilder.h b/GeneralsMD/Code/Tools/WorldBuilder/include/WorldBuilder.h index 3accefbbebe..eb9ccc7b85c 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/WorldBuilder.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/WorldBuilder.h @@ -141,8 +141,7 @@ class CWorldBuilderApp : public CWinApp protected: void deletePasteObjList(void) { - if (m_pasteMapObjList) - deleteInstance(m_pasteMapObjList); + deleteInstance(m_pasteMapObjList); m_pasteMapObjList = NULL; }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp index a7c80797976..6e8934efbe1 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp @@ -207,7 +207,7 @@ void WBDocUndoable::Undo(void) AddObjectUndoable::~AddObjectUndoable(void) { m_pDoc = NULL; // not ref counted. - if (m_objectToAdd && !m_addedToList) { + if (!m_addedToList) { deleteInstance(m_objectToAdd); m_objectToAdd=NULL; } @@ -857,7 +857,7 @@ void DictItemUndoable::Undo(void) ***************************************************************************/ DeleteInfo::~DeleteInfo(void) { - if (m_didDelete && m_objectToDelete) { + if (m_didDelete) { deleteInstance(m_objectToDelete); } DeleteInfo *pCur = m_next; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/FenceOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/FenceOptions.cpp index c2ca48e933f..e90c14c4b1d 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/FenceOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/FenceOptions.cpp @@ -68,9 +68,7 @@ FenceOptions::FenceOptions(CWnd* pParent /*=NULL*/) FenceOptions::~FenceOptions(void) { - if (m_objectsList) { - deleteInstance(m_objectsList); - } + deleteInstance(m_objectsList); m_objectsList = NULL; } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/FenceTool.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/FenceTool.cpp index d760982892e..339dd71c606 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/FenceTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/FenceTool.cpp @@ -49,9 +49,7 @@ FenceTool::FenceTool(void) : /// Destructor FenceTool::~FenceTool(void) { - if (m_mapObjectList) { - deleteInstance(m_mapObjectList); - } + deleteInstance(m_mapObjectList); m_mapObjectList = NULL; } @@ -154,10 +152,10 @@ void FenceTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldB pView->snapPoint(&cpt); m_downPt2d = viewPt; m_downPt3d = cpt; - if (m_mapObjectList) { - deleteInstance(m_mapObjectList); - m_mapObjectList = NULL; - } + + deleteInstance(m_mapObjectList); + m_mapObjectList = NULL; + if (FenceOptions::hasSelectedObject()) { FenceOptions::update(); m_curObjectWidth = FenceOptions::getFenceSpacing(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/GroveTool.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/GroveTool.cpp index 95cc49ff8b2..6c989d09fd7 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/GroveTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/GroveTool.cpp @@ -244,9 +244,7 @@ GroveTool::GroveTool(void) : /// Destructor GroveTool::~GroveTool(void) { - if (m_headMapObj) { - deleteInstance(m_headMapObj); - } + deleteInstance(m_headMapObj); } /** Execute the tool on mouse down - Place an object. */ diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp index fae47c4f7fe..be797e2540d 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp @@ -64,9 +64,7 @@ ObjectOptions::ObjectOptions(CWnd* pParent /*=NULL*/) ObjectOptions::~ObjectOptions(void) { - if (m_objectsList) { - deleteInstance(m_objectsList); - } + deleteInstance(m_objectsList); m_objectsList = NULL; } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp index 0e421ebfdee..b0002583ed7 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp @@ -94,9 +94,7 @@ PickUnitDialog::PickUnitDialog(UINT id, CWnd* pParent /*=NULL*/) PickUnitDialog::~PickUnitDialog() { - if (m_objectsList) { - deleteInstance(m_objectsList); - } + deleteInstance(m_objectsList); m_objectsList = NULL; } From e022dc5b12d64fcc997d9d64f599acb4c50285ac Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Wed, 10 Sep 2025 11:32:54 +0200 Subject: [PATCH 055/343] bugfix(fps): Fix and improve logic time step and render update decoupling (#1528) --- Core/GameEngine/Include/Common/GameDefines.h | 2 + .../Source/WWVegas/WWLib/CMakeLists.txt | 1 + .../Libraries/Source/WWVegas/WWLib/WWCommon.h | 2 +- .../Source/WWVegas/WWLib/WWDefines.h | 25 ++ Core/Libraries/Source/WWVegas/WWLib/always.h | 1 + .../GameEngine/Include/Common/GameEngine.h | 33 ++- .../GameEngine/Include/GameClient/Drawable.h | 6 +- .../GameEngine/Include/GameLogic/GameLogic.h | 4 +- .../Include/GameNetwork/NetworkInterface.h | 1 + .../GameEngine/Source/Common/GameEngine.cpp | 216 ++++++++++++------ .../GameEngine/Source/Common/Recorder.cpp | 2 +- .../GameEngine/Source/GameClient/Drawable.cpp | 104 +++++---- .../GUI/GUICallbacks/Menus/DownloadMenu.cpp | 2 +- .../GUI/GUICallbacks/Menus/MainMenu.cpp | 2 +- .../GUI/GUICallbacks/Menus/QuitMenu.cpp | 4 +- .../Source/GameClient/GUI/Shell/Shell.cpp | 4 +- .../Source/GameClient/GameClient.cpp | 10 +- .../GameClient/MessageStream/CommandXlat.cpp | 2 +- .../GameLogic/ScriptEngine/ScriptEngine.cpp | 3 +- .../Source/GameLogic/System/GameLogic.cpp | 47 ++-- .../GameEngine/Source/GameNetwork/Network.cpp | 12 +- .../Include/W3DDevice/GameClient/W3DDisplay.h | 1 - .../Drawable/Draw/W3DOverlordTankDraw.cpp | 2 +- .../GameClient/Drawable/Draw/W3DTankDraw.cpp | 9 +- .../Drawable/Draw/W3DTankTruckDraw.cpp | 6 +- .../GameClient/Drawable/Draw/W3DTruckDraw.cpp | 10 +- .../W3DDevice/GameClient/W3DDisplay.cpp | 54 +---- .../Source/W3DDevice/GameClient/W3DView.cpp | 34 ++- .../Libraries/Source/WWVegas/WW3D2/ww3d.cpp | 18 ++ .../Libraries/Source/WWVegas/WW3D2/ww3d.h | 6 +- .../Source/WWVegas/WWLib/WWDefines.h | 25 ++ .../GameEngine/Include/Common/GameEngine.h | 33 ++- .../GameEngine/Include/GameClient/Drawable.h | 6 +- .../GameEngine/Include/GameLogic/GameLogic.h | 4 +- .../Include/GameNetwork/NetworkInterface.h | 1 + .../GameEngine/Source/Common/GameEngine.cpp | 216 ++++++++++++------ .../GameEngine/Source/Common/Recorder.cpp | 2 +- .../GameEngine/Source/GameClient/Drawable.cpp | 115 ++++++---- .../GUI/GUICallbacks/Menus/DownloadMenu.cpp | 2 +- .../GUI/GUICallbacks/Menus/MainMenu.cpp | 2 +- .../GUI/GUICallbacks/Menus/QuitMenu.cpp | 4 +- .../Source/GameClient/GUI/Shell/Shell.cpp | 4 +- .../Source/GameClient/GameClient.cpp | 10 +- .../GameClient/MessageStream/CommandXlat.cpp | 2 +- .../GameLogic/ScriptEngine/ScriptEngine.cpp | 3 +- .../Source/GameLogic/System/GameLogic.cpp | 47 ++-- .../GameEngine/Source/GameNetwork/Network.cpp | 12 +- .../Include/W3DDevice/GameClient/W3DDisplay.h | 1 - .../Drawable/Draw/W3DOverlordAircraftDraw.cpp | 2 +- .../Drawable/Draw/W3DOverlordTankDraw.cpp | 2 +- .../Drawable/Draw/W3DOverlordTruckDraw.cpp | 2 +- .../GameClient/Drawable/Draw/W3DTankDraw.cpp | 9 +- .../Drawable/Draw/W3DTankTruckDraw.cpp | 6 +- .../GameClient/Drawable/Draw/W3DTruckDraw.cpp | 10 +- .../W3DDevice/GameClient/W3DDisplay.cpp | 54 +---- .../Source/W3DDevice/GameClient/W3DView.cpp | 39 ++-- .../Libraries/Source/WWVegas/WW3D2/ww3d.cpp | 18 ++ .../Libraries/Source/WWVegas/WW3D2/ww3d.h | 6 +- 58 files changed, 760 insertions(+), 500 deletions(-) create mode 100644 Core/Libraries/Source/WWVegas/WWLib/WWDefines.h create mode 100644 Generals/Libraries/Source/WWVegas/WWLib/WWDefines.h diff --git a/Core/GameEngine/Include/Common/GameDefines.h b/Core/GameEngine/Include/Common/GameDefines.h index 0034feabdca..2736ad0ff4f 100644 --- a/Core/GameEngine/Include/Common/GameDefines.h +++ b/Core/GameEngine/Include/Common/GameDefines.h @@ -18,6 +18,8 @@ #pragma once +#include "WWDefines.h" + // Note: Retail compatibility must not be broken before this project officially does. // Use RETAIL_COMPATIBLE_CRC and RETAIL_COMPATIBLE_XFER_SAVE to guard breaking changes. diff --git a/Core/Libraries/Source/WWVegas/WWLib/CMakeLists.txt b/Core/Libraries/Source/WWVegas/WWLib/CMakeLists.txt index 62d95116929..b81bac059b7 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/CMakeLists.txt +++ b/Core/Libraries/Source/WWVegas/WWLib/CMakeLists.txt @@ -133,6 +133,7 @@ set(WWLIB_SRC widestring.h win.h WWCommon.h + WWDefines.h wwfile.cpp WWFILE.H wwstring.cpp diff --git a/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h b/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h index 77218a12e2a..859eb54496e 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h +++ b/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h @@ -18,7 +18,7 @@ #pragma once -#include +#include "stringex.h" #if defined(_MSC_VER) && _MSC_VER < 1300 typedef unsigned MemValueType; diff --git a/Core/Libraries/Source/WWVegas/WWLib/WWDefines.h b/Core/Libraries/Source/WWVegas/WWLib/WWDefines.h new file mode 100644 index 00000000000..d7acdd7b4ed --- /dev/null +++ b/Core/Libraries/Source/WWVegas/WWLib/WWDefines.h @@ -0,0 +1,25 @@ +/* +** Command & Conquer Generals Zero Hour(tm) +** Copyright 2025 TheSuperHackers +** +** This program is free software: you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation, either version 3 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program. If not, see . +*/ + +#pragma once + +// The WW3D Sync time. This was originally 33 ms, ~30 fps, integer. +// Changing or removing this will require tweaking all Drawable code that concerns logic time step, including locomotion physics. +#ifndef MSEC_PER_WWSYNC_FRAME +#define MSEC_PER_WWSYNC_FRAME (33) +#endif diff --git a/Core/Libraries/Source/WWVegas/WWLib/always.h b/Core/Libraries/Source/WWVegas/WWLib/always.h index 3ce54d3d9f6..d9c912b462e 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/always.h +++ b/Core/Libraries/Source/WWVegas/WWLib/always.h @@ -41,6 +41,7 @@ #define ALWAYS_H #include "WWCommon.h" +#include "WWDefines.h" #include #include diff --git a/Generals/Code/GameEngine/Include/Common/GameEngine.h b/Generals/Code/GameEngine/Include/Common/GameEngine.h index 7f0dc1757a0..57852123860 100644 --- a/Generals/Code/GameEngine/Include/Common/GameEngine.h +++ b/Generals/Code/GameEngine/Include/Common/GameEngine.h @@ -53,11 +53,16 @@ class Radar; class WebBrowser; class ParticleSystemManager; -/** - * The implementation of the game engine - */ class GameEngine : public SubsystemInterface { +public: + + typedef UnsignedInt LogicTimeQueryFlags; + enum LogicTimeQueryFlags_ CPP_11(: LogicTimeQueryFlags) + { + IgnoreFrozenTime = 1<<0, // Ignore frozen time for the query + IgnoreHaltedGame = 1<<1, // Ignore halted game for the query + }; public: @@ -76,13 +81,18 @@ class GameEngine : public SubsystemInterface Real getUpdateTime(); ///< Get the last engine update delta time. Real getUpdateFps(); ///< Get the last engine update fps. + static Bool isTimeFrozen(); ///< Returns true if a script has frozen time. + static Bool isGameHalted(); ///< Returns true if the game is paused or the network is stalling. + virtual void setLogicTimeScaleFps( Int fps ); ///< Set the logic time scale fps and therefore scale the simulation time. Is capped by the max render fps and does not apply to network matches. virtual Int getLogicTimeScaleFps(); ///< Get the raw logic time scale fps value. virtual void enableLogicTimeScale( Bool enable ); ///< Enable the logic time scale setup. If disabled, the simulation time scale is bound to the render frame time or network update time. virtual Bool isLogicTimeScaleEnabled(); ///< Check whether the logic time scale setup is enabled. - Int getActualLogicTimeScaleFps(); ///< Get the real logic time scale fps, depending on the max render fps, network state and enabled state. - Real getActualLogicTimeScaleRatio(); ///< Get the real logic time scale ratio, depending on the max render fps, network state and enabled state. - Real getActualLogicTimeScaleOverFpsRatio(); ///< Get the real logic time scale over render fps ratio, used to scale down steps in render updates to match logic updates. + Int getActualLogicTimeScaleFps(LogicTimeQueryFlags flags = 0); ///< Get the real logic time scale fps, depending on the max render fps, network state and enabled state. + Real getActualLogicTimeScaleRatio(LogicTimeQueryFlags flags = 0); ///< Get the real logic time scale ratio, depending on the max render fps, network state and enabled state. + Real getActualLogicTimeScaleOverFpsRatio(LogicTimeQueryFlags flags = 0); ///< Get the real logic time scale over render fps ratio, used to scale down steps in render updates to match logic updates. + Real getLogicTimeStepSeconds(LogicTimeQueryFlags flags = 0); ///< Get the logic time step in seconds + Real getLogicTimeStepMilliseconds(LogicTimeQueryFlags flags = 0); ///< Get the logic time step in milliseconds virtual void setQuitting( Bool quitting ); ///< set quitting status virtual Bool getQuitting(void); ///< is app getting ready to quit. @@ -97,6 +107,10 @@ class GameEngine : public SubsystemInterface virtual void resetSubsystems( void ); + Bool canUpdateGameLogic(); + Bool canUpdateNetworkGameLogic(); + Bool canUpdateRegularGameLogic(); + virtual FileSystem *createFileSystem( void ); ///< Factory for FileSystem classes virtual LocalFileSystem *createLocalFileSystem( void ) = 0; ///< Factory for LocalFileSystem classes virtual ArchiveFileSystem *createArchiveFileSystem( void ) = 0; ///< Factory for ArchiveFileSystem classes @@ -117,11 +131,14 @@ class GameEngine : public SubsystemInterface Real m_updateTime; ///< Last engine update delta time Real m_logicTimeAccumulator; ///< Frame time accumulated towards submitting a new logic frame - Bool m_quitting; ///< true when we need to quit the game - Bool m_isActive; ///< app has OS focus. + Bool m_quitting; ///< true when we need to quit the game + Bool m_isActive; ///< app has OS focus. Bool m_enableLogicTimeScale; + Bool m_isTimeFrozen; + Bool m_isGameHalted; }; + inline void GameEngine::setQuitting( Bool quitting ) { m_quitting = quitting; } inline Bool GameEngine::getQuitting(void) { return m_quitting; } diff --git a/Generals/Code/GameEngine/Include/GameClient/Drawable.h b/Generals/Code/GameEngine/Include/GameClient/Drawable.h index d9c52dd4d0d..557c7cf000c 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Drawable.h +++ b/Generals/Code/GameEngine/Include/GameClient/Drawable.h @@ -390,7 +390,7 @@ class Drawable : public Thing, const Matrix3D *getTransformMatrix( void ) const; ///< return the world transform - void draw( View *view ); ///< render the drawable to the given view + void draw(); ///< render the drawable to the given view void updateDrawable(); ///< update the drawable void drawIconUI( void ); ///< draw "icon"(s) needed on drawable (health bars, veterency, etc) @@ -600,6 +600,8 @@ class Drawable : public Thing, private: + const Locomotor* getLocomotor() const; + // note, these are lazily allocated! TintEnvelope* m_selectionFlashEnvelope; ///< used for selection flash, works WITH m_colorTintEnvelope TintEnvelope* m_colorTintEnvelope; ///< house color flashing, etc... works WITH m_selectionFlashEnvelope @@ -644,6 +646,8 @@ class Drawable : public Thing, DrawableLocoInfo* m_locoInfo; // lazily allocated + PhysicsXformInfo* m_physicsXform; + DynamicAudioEventRTS* m_ambientSound; ///< sound module for ambient sound (lazily allocated) Bool m_ambientSoundEnabled; diff --git a/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h b/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h index 70a4d836497..9879667a4fc 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h +++ b/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h @@ -197,6 +197,7 @@ class GameLogic : public SubsystemInterface, public Snapshot void updateObjectsChangedTriggerAreas(void) {m_frameObjectsChangedTriggerAreas = m_frame;} UnsignedInt getFrameObjectsChangedTriggerAreas(void) {return m_frameObjectsChangedTriggerAreas;} + void exitGame(); void clearGameData(Bool showScoreScreen = TRUE); ///< Clear the game data void closeWindows( void ); @@ -205,7 +206,7 @@ class GameLogic : public SubsystemInterface, public Snapshot void bindObjectAndDrawable(Object* obj, Drawable* draw); - void setGamePausedInFrame( UnsignedInt frame ); + void setGamePausedInFrame( UnsignedInt frame, Bool disableLogicTimeScale ); UnsignedInt getGamePauseFrame() const { return m_pauseFrame; } void setGamePaused( Bool paused, Bool pauseMusic = TRUE, Bool pauseInput = TRUE ); Bool isGamePaused( void ); @@ -352,6 +353,7 @@ class GameLogic : public SubsystemInterface, public Snapshot Bool m_pauseInput; Bool m_inputEnabledMemory;// Latches used to remember what to restore to after we unpause Bool m_mouseVisibleMemory; + Bool m_logicTimeScaleEnabledMemory; Bool m_progressComplete[MAX_SLOTS]; enum { PROGRESS_COMPLETE_TIMEOUT = 60000 }; ///< Timeout we wait for when we've completed our Load diff --git a/Generals/Code/GameEngine/Include/GameNetwork/NetworkInterface.h b/Generals/Code/GameEngine/Include/GameNetwork/NetworkInterface.h index 5cf9db18706..d1b58ad019e 100644 --- a/Generals/Code/GameEngine/Include/GameNetwork/NetworkInterface.h +++ b/Generals/Code/GameEngine/Include/GameNetwork/NetworkInterface.h @@ -68,6 +68,7 @@ class NetworkInterface : public SubsystemInterface virtual void setLocalAddress(UnsignedInt ip, UnsignedInt port) = 0; ///< Tell the network what local ip and port to bind to. virtual Bool isFrameDataReady( void ) = 0; ///< Are the commands for the next frame available? + virtual Bool isStalling() = 0; virtual void parseUserList( const GameInfo *game ) = 0; ///< Parse a userlist, creating connections virtual void startGame(void) = 0; ///< Sets the network game frame counter to -1 virtual UnsignedInt getRunAhead(void) = 0; ///< Get the current RunAhead value diff --git a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp index 8f3d23e0b35..999dc3c517c 100644 --- a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp @@ -260,6 +260,8 @@ GameEngine::GameEngine( void ) m_quitting = FALSE; m_isActive = FALSE; m_enableLogicTimeScale = FALSE; + m_isTimeFrozen = FALSE; + m_isGameHalted = FALSE; _Module.Init(NULL, ApplicationHInstance, NULL); } @@ -335,6 +337,45 @@ Real GameEngine::getUpdateFps() return 1.0f / m_updateTime; } +//------------------------------------------------------------------------------------------------- +Bool GameEngine::isTimeFrozen() +{ + // TheSuperHackers @fix The time can no longer be frozen in Network games. It would disconnect the player. + if (TheNetwork != NULL) + return false; + + if (TheTacticalView != NULL) + { + if (TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished()) + return true; + } + + if (TheScriptEngine != NULL) + { + if (TheScriptEngine->isTimeFrozenDebug() || TheScriptEngine->isTimeFrozenScript()) + return true; + } + + return false; +} + +//------------------------------------------------------------------------------------------------- +Bool GameEngine::isGameHalted() +{ + if (TheNetwork != NULL) + { + if (TheNetwork->isStalling()) + return true; + } + else + { + if (TheGameLogic != NULL && TheGameLogic->isGamePaused()) + return true; + } + + return false; +} + //------------------------------------------------------------------------------------------------- void GameEngine::setLogicTimeScaleFps( Int fps ) { @@ -360,41 +401,53 @@ Bool GameEngine::isLogicTimeScaleEnabled() } //------------------------------------------------------------------------------------------------- -Int GameEngine::getActualLogicTimeScaleFps( void ) +Int GameEngine::getActualLogicTimeScaleFps(LogicTimeQueryFlags flags) { + if (m_isTimeFrozen && (flags & IgnoreFrozenTime) == 0) + { + return 0; + } + + if (m_isGameHalted && (flags & IgnoreHaltedGame) == 0) + { + return 0; + } + if (TheNetwork != NULL) { return TheNetwork->getFrameRate(); } - else - { - const Bool enabled = isLogicTimeScaleEnabled(); - const Int logicTimeScaleFps = getLogicTimeScaleFps(); - const Int maxFps = getFramesPerSecondLimit(); - if (!enabled || logicTimeScaleFps >= maxFps) - { - return getFramesPerSecondLimit(); - } - else - { - return logicTimeScaleFps; - } + if (isLogicTimeScaleEnabled()) + { + return min(getLogicTimeScaleFps(), getFramesPerSecondLimit()); } + + return getFramesPerSecondLimit(); } //------------------------------------------------------------------------------------------------- -Real GameEngine::getActualLogicTimeScaleRatio() +Real GameEngine::getActualLogicTimeScaleRatio(LogicTimeQueryFlags flags) { - return (Real)getActualLogicTimeScaleFps() / LOGICFRAMES_PER_SECONDS_REAL; + return (Real)getActualLogicTimeScaleFps(flags) / LOGICFRAMES_PER_SECONDS_REAL; } //------------------------------------------------------------------------------------------------- -Real GameEngine::getActualLogicTimeScaleOverFpsRatio() +Real GameEngine::getActualLogicTimeScaleOverFpsRatio(LogicTimeQueryFlags flags) { // TheSuperHackers @info Clamps ratio to min 1, because the logic - // frame rate is (typically) capped by the render frame rate. - return min(1.0f, (Real)getActualLogicTimeScaleFps() / getUpdateFps()); + // frame rate is currently capped by the render frame rate. + return min(1.0f, (Real)getActualLogicTimeScaleFps(flags) / getUpdateFps()); +} + +Real GameEngine::getLogicTimeStepSeconds(LogicTimeQueryFlags flags) +{ + return SECONDS_PER_LOGICFRAME_REAL * getActualLogicTimeScaleOverFpsRatio(flags); +} + +Real GameEngine::getLogicTimeStepMilliseconds(LogicTimeQueryFlags flags) +{ + return MSEC_PER_LOGICFRAME_REAL * getActualLogicTimeScaleOverFpsRatio(flags); } /** ----------------------------------------------------------------------------------------------- @@ -696,21 +749,85 @@ void GameEngine::resetSubsystems( void ) TheSubsystemList->resetAll(); } +/// ----------------------------------------------------------------------------------------------- +Bool GameEngine::canUpdateGameLogic() +{ + // Must be first. + TheGameLogic->preUpdate(); + + m_isTimeFrozen = isTimeFrozen(); + m_isGameHalted = isGameHalted(); + + if (TheNetwork != NULL) + { + return canUpdateNetworkGameLogic(); + } + else + { + return canUpdateRegularGameLogic(); + } +} + +Bool GameEngine::canUpdateNetworkGameLogic() +{ + DEBUG_ASSERTCRASH(TheNetwork != NULL, ("TheNetwork is NULL")); + + if (TheNetwork->isFrameDataReady()) + { + // Important: The Network is definitely no longer stalling. + m_isGameHalted = false; + + return true; + } + + return false; +} + +Bool GameEngine::canUpdateRegularGameLogic() +{ + const Bool enabled = isLogicTimeScaleEnabled(); + const Int logicTimeScaleFps = getLogicTimeScaleFps(); + const Int maxRenderFps = getFramesPerSecondLimit(); + +#if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) + const Bool useFastMode = TheGlobalData->m_TiVOFastMode; +#else //always allow this cheat key if we're in a replay game. + const Bool useFastMode = TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame(); +#endif + + if (useFastMode || !enabled || logicTimeScaleFps >= maxRenderFps) + { + // Logic time scale is uncapped or larger equal Render FPS. Update straight away. + return true; + } + else + { + // TheSuperHackers @tweak xezon 06/08/2025 + // The logic time step is now decoupled from the render update. + const Real targetFrameTime = 1.0f / logicTimeScaleFps; + m_logicTimeAccumulator += min(m_updateTime, targetFrameTime); + + if (m_logicTimeAccumulator >= targetFrameTime) + { + m_logicTimeAccumulator -= targetFrameTime; + return true; + } + } + + return false; +} + /// ----------------------------------------------------------------------------------------------- DECLARE_PERF_TIMER(GameEngine_update) /** ----------------------------------------------------------------------------------------------- * Update the game engine by updating the GameClient and GameLogic singletons. - * @todo Allow the client to run as fast as possible, but limit the execution - * of TheNetwork and TheGameLogic to a fixed framerate. */ void GameEngine::update( void ) { USE_PERF_TIMER(GameEngine_update) { - { - // VERIFY CRC needs to be in this code block. Please to not pull TheGameLogic->update() inside this block. VERIFY_CRC @@ -730,55 +847,22 @@ void GameEngine::update( void ) TheCDManager->UPDATE(); } - TheGameLogic->preUpdate(); + const Bool canUpdate = canUpdateGameLogic(); + const Bool canUpdateLogic = canUpdate && !m_isGameHalted && !m_isTimeFrozen; + const Bool canUpdateScript = canUpdate && !m_isGameHalted; - if (TheNetwork != NULL) + if (canUpdateLogic) { - if (TheNetwork->isFrameDataReady()) - { - TheGameClient->step(); - TheGameLogic->UPDATE(); - } + TheGameClient->step(); + TheGameLogic->UPDATE(); } - else + else if (canUpdateScript) { - if (!TheGameLogic->isGamePaused()) - { - const Bool enabled = isLogicTimeScaleEnabled(); - const Int logicTimeScaleFps = getLogicTimeScaleFps(); - const Int maxRenderFps = getFramesPerSecondLimit(); - -#if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) - Bool useFastMode = TheGlobalData->m_TiVOFastMode; -#else //always allow this cheat key if we're in a replay game. - Bool useFastMode = TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame(); -#endif - - if (useFastMode || !enabled || logicTimeScaleFps >= maxRenderFps) - { - // Logic time scale is uncapped or larger equal Render FPS. Update straight away. - TheGameClient->step(); - TheGameLogic->UPDATE(); - } - else - { - // TheSuperHackers @tweak xezon 06/08/2025 - // The logic time step is now decoupled from the render update. - const Real targetFrameTime = 1.0f / logicTimeScaleFps; - m_logicTimeAccumulator += min(m_updateTime, targetFrameTime); - - if (m_logicTimeAccumulator >= targetFrameTime) - { - m_logicTimeAccumulator -= targetFrameTime; - TheGameClient->step(); - TheGameLogic->UPDATE(); - } - } - } + // TheSuperHackers @info Still update the Script Engine to allow + // for scripted camera movements while the time is frozen. + TheScriptEngine->UPDATE(); } - } // end perfGather - } // Horrible reference, but we really, really need to know if we are windowed. diff --git a/Generals/Code/GameEngine/Source/Common/Recorder.cpp b/Generals/Code/GameEngine/Source/Common/Recorder.cpp index 2bd0e64a548..492dcc972c9 100644 --- a/Generals/Code/GameEngine/Source/Common/Recorder.cpp +++ b/Generals/Code/GameEngine/Source/Common/Recorder.cpp @@ -477,7 +477,7 @@ void RecorderClass::stopPlayback() { if (!m_doingAnalysis) { - TheMessageStream->appendMessage(GameMessage::MSG_CLEAR_GAME_DATA); + TheGameLogic->exitGame(); } } diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index a05829feef6..5721ef9f855 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -77,6 +77,7 @@ #include "GameClient/Shadow.h" #include "GameClient/GameText.h" +#include "ww3d.h" #define VERY_TRANSPARENT_HEATVISION (0.001f) #define HEATVISION_FADE_SCALAR (0.8f) @@ -372,6 +373,7 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatus statusBit m_flashCount = 0; m_locoInfo = NULL; + m_physicsXform = NULL; // sanity if( TheGameClient == NULL || thingTemplate == NULL ) @@ -527,6 +529,8 @@ Drawable::~Drawable() deleteInstance(m_locoInfo); m_locoInfo = NULL; + + delete m_physicsXform; } //------------------------------------------------------------------------------------------------- @@ -1250,24 +1254,19 @@ void Drawable::flashAsSelected( const RGBColor *color ) ///< drawable takes care //------------------------------------------------------------------------------------------------- void Drawable::applyPhysicsXform(Matrix3D* mtx) { - const Object *obj = getObject(); - - if( !obj || obj->isDisabledByType( DISABLED_HELD ) || !TheGlobalData->m_showClientPhysics ) + if (m_physicsXform != NULL) { - return; - } + // TheSuperHackers @tweak Update the physics transform on every WW Sync only. + // All calculations are originally catered to a 30 fps logic step. + if (WW3D::Get_Frame_Time() != 0) + { + calcPhysicsXform(*m_physicsXform); + } - Bool frozen = TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished(); - frozen = frozen || TheScriptEngine->isTimeFrozenDebug() || TheScriptEngine->isTimeFrozenScript(); - if (frozen) - return; - PhysicsXformInfo info; - if (calcPhysicsXform(info)) - { - mtx->Translate(0.0f, 0.0f, info.m_totalZ); - mtx->Rotate_Y( info.m_totalPitch ); - mtx->Rotate_X( -info.m_totalRoll ); - mtx->Rotate_Z( info.m_totalYaw ); + mtx->Translate(0.0f, 0.0f, m_physicsXform->m_totalZ); + mtx->Rotate_Y( m_physicsXform->m_totalPitch ); + mtx->Rotate_X( -m_physicsXform->m_totalRoll ); + mtx->Rotate_Z( m_physicsXform->m_totalYaw ); } } @@ -1275,34 +1274,29 @@ void Drawable::applyPhysicsXform(Matrix3D* mtx) //------------------------------------------------------------------------------------------------- Bool Drawable::calcPhysicsXform(PhysicsXformInfo& info) { - const Object* obj = getObject(); - const AIUpdateInterface *ai = obj ? obj->getAIUpdateInterface() : NULL; Bool hasPhysicsXform = false; - if (ai) + + if (const Locomotor *locomotor = getLocomotor()) { - const Locomotor *locomotor = ai->getCurLocomotor(); - if (locomotor) + switch (locomotor->getAppearance()) { - switch (locomotor->getAppearance()) - { - case LOCO_WHEELS_FOUR: - calcPhysicsXformWheels(locomotor, info); - hasPhysicsXform = true; - break; - case LOCO_TREADS: - calcPhysicsXformTreads(locomotor, info); - hasPhysicsXform = true; - break; - case LOCO_HOVER: - case LOCO_WINGS: - calcPhysicsXformHoverOrWings(locomotor, info); - hasPhysicsXform = true; - break; - case LOCO_THRUST: - calcPhysicsXformThrust(locomotor, info); - hasPhysicsXform = true; - break; - } + case LOCO_WHEELS_FOUR: + calcPhysicsXformWheels(locomotor, info); + hasPhysicsXform = true; + break; + case LOCO_TREADS: + calcPhysicsXformTreads(locomotor, info); + hasPhysicsXform = true; + break; + case LOCO_HOVER: + case LOCO_WINGS: + calcPhysicsXformHoverOrWings(locomotor, info); + hasPhysicsXform = true; + break; + case LOCO_THRUST: + calcPhysicsXformThrust(locomotor, info); + hasPhysicsXform = true; + break; } } @@ -2179,7 +2173,7 @@ void Drawable::setStealthLook(StealthLookType look) //------------------------------------------------------------------------------------------------- /** default draw is to just call the database defined draw */ //------------------------------------------------------------------------------------------------- -void Drawable::draw( View *view ) +void Drawable::draw() { if ( getObject() && getObject()->isEffectivelyDead() ) @@ -2214,7 +2208,10 @@ void Drawable::draw( View *view ) #endif } - applyPhysicsXform(&transformMtx); + if (TheGlobalData->m_showClientPhysics && getObject() && !getObject()->isDisabledByType( DISABLED_HELD )) + { + applyPhysicsXform(&transformMtx); + } for (DrawModule** dm = getDrawModules(); *dm; ++dm) { @@ -3658,6 +3655,14 @@ void Drawable::friend_bindToObject( Object *obj ) ///< bind this drawable to an { (*dm)->onDrawableBoundToObject(); } + + PhysicsXformInfo physicsXform; + if (calcPhysicsXform(physicsXform)) + { + DEBUG_ASSERTCRASH(m_physicsXform == NULL, ("m_physicsXform is not NULL")); + m_physicsXform = new PhysicsXformInfo; + *m_physicsXform = physicsXform; + } } //------------------------------------------------------------------------------------------------- // when our Object changes teams, it calls us to let us know, so @@ -4676,6 +4681,19 @@ void Drawable::loadPostProcess( void ) } // end loadPostProcess +//------------------------------------------------------------------------------------------------- +const Locomotor* Drawable::getLocomotor() const +{ + if (const Object* obj = getObject()) + { + if (const AIUpdateInterface *ai = obj->getAIUpdateInterface()) + { + return ai->getCurLocomotor(); + } + } + return NULL; +} + //================================================================================================= //================================================================================================= #ifdef DIRTY_CONDITION_FLAGS diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp index 442c5513fd4..3d6311318fd 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp @@ -109,7 +109,7 @@ static void successQuitCallback( void ) // Clean up game data. No crashy-crash for you! if (TheGameLogic->isInGame()) - TheMessageStream->appendMessage( GameMessage::MSG_CLEAR_GAME_DATA ); + TheGameLogic->exitGame(); } static void successNoQuitCallback( void ) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp index 83a42e24272..6c4362bdd52 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp @@ -243,7 +243,7 @@ static void quitCallback( void ) TheGameEngine->setQuitting( TRUE ); if (TheGameLogic->isInGame()) - TheMessageStream->appendMessage( GameMessage::MSG_CLEAR_GAME_DATA ); + TheGameLogic->exitGame(); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp index 31374a6aaa2..6d631038551 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp @@ -145,9 +145,7 @@ static void exitQuitMenu() GameMessage *msg = TheMessageStream->appendMessage(GameMessage::MSG_SELF_DESTRUCT); msg->appendBooleanArgument(TRUE); } - /*GameMessage *msg =*/ TheMessageStream->appendMessage( GameMessage::MSG_CLEAR_GAME_DATA ); - if ( !TheGameLogic->isInMultiplayerGame() ) - TheGameLogic->setGamePaused(FALSE); + TheGameLogic->exitGame(); // TheGameLogic->clearGameData(); // display the menu on top of the shell stack // TheShell->showShell(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp index 594a5c7bbe3..3d79cc90509 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp @@ -535,7 +535,7 @@ void Shell::showShellMap(Bool useShellMap ) return; // we're in some other kind of game, clear it out foo! if(TheGameLogic->isInGame()) - TheMessageStream->appendMessage( GameMessage::MSG_CLEAR_GAME_DATA ); + TheGameLogic->exitGame(); TheWritableGlobalData->m_pendingFile = TheGlobalData->m_shellMapName; InitGameLogicRandom(0); @@ -547,7 +547,7 @@ void Shell::showShellMap(Bool useShellMap ) { // we're in a shell game, stop it! if(TheGameLogic->isInGame() && TheGameLogic->getGameMode() == GAME_SHELL) - TheMessageStream->appendMessage( GameMessage::MSG_CLEAR_GAME_DATA ); + TheGameLogic->exitGame(); // if the shell is active,we need a background if(!m_isShellActive) diff --git a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp index 543ba769e1a..b1d1e6d0433 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -602,17 +602,9 @@ void GameClient::update( void ) TheVideoPlayer->UPDATE(); } - Bool freezeTime = TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished(); - freezeTime = freezeTime || TheScriptEngine->isTimeFrozenDebug(); - freezeTime = freezeTime || TheScriptEngine->isTimeFrozenScript(); - freezeTime = freezeTime || TheGameLogic->isGamePaused(); + const Bool freezeTime = TheGameEngine->isTimeFrozen() || TheGameEngine->isGameHalted(); Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0; - // hack to let client spin fast in network games but still do effects at the same pace. -MDC - static UnsignedInt lastFrame = ~0; - freezeTime = freezeTime || (lastFrame == m_frame); - lastFrame = m_frame; - if (!freezeTime) { #if ENABLE_CONFIGURABLE_SHROUD diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index ee6d794f70a..978e76218df 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -3328,7 +3328,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage #endif { TheGameLogic->setGamePaused(FALSE); - TheGameLogic->setGamePausedInFrame(TheGameLogic->getFrame() + 1); + TheGameLogic->setGamePausedInFrame(TheGameLogic->getFrame() + 1, TRUE); } break; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index fe282f7bc11..71833af2242 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -4807,8 +4807,7 @@ void ScriptEngine::update( void ) if (m_endGameTimer>0) { m_endGameTimer--; if (m_endGameTimer < 1) { - // clear out all the game data - /*GameMessage *msg =*/ TheMessageStream->appendMessage( GameMessage::MSG_CLEAR_GAME_DATA ); + TheGameLogic->exitGame(); //TheScriptActions->closeWindows(FALSE); // Close victory or defeat windows. } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 7aceaef728e..483f86677e9 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -241,6 +241,7 @@ GameLogic::GameLogic( void ) m_pauseInput = FALSE; m_inputEnabledMemory = TRUE; m_mouseVisibleMemory = TRUE; + m_logicTimeScaleEnabledMemory = FALSE; m_loadScreen = NULL; m_forceGameStartByTimeOut = FALSE; #ifdef DUMP_PERF_STATS @@ -406,6 +407,8 @@ void GameLogic::init( void ) m_pauseInput = FALSE; m_inputEnabledMemory = TRUE; m_mouseVisibleMemory = TRUE; + m_logicTimeScaleEnabledMemory = FALSE; + for(Int i = 0; i < MAX_SLOTS; ++i) { m_progressComplete[i] = FALSE; @@ -447,6 +450,8 @@ void GameLogic::reset( void ) m_pauseInput = FALSE; m_inputEnabledMemory = TRUE; m_mouseVisibleMemory = TRUE; + m_logicTimeScaleEnabledMemory = FALSE; + setFPMode(); // destroy all objects @@ -3153,7 +3158,6 @@ void GameLogic::update( void ) } // send the current time to the GameClient - DEBUG_ASSERTCRASH(TheGameLogic == this, ("hmm, TheGameLogic is not right")); UnsignedInt now = TheGameLogic->getFrame(); TheGameClient->setFrame(now); @@ -3162,22 +3166,6 @@ void GameLogic::update( void ) TheScriptEngine->UPDATE(); } - Bool freezeTime = TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished(); - freezeTime = freezeTime || TheScriptEngine->isTimeFrozenDebug() || TheScriptEngine->isTimeFrozenScript(); - - if (freezeTime) - { - if (TheCommandList->containsMessageOfType(GameMessage::MSG_CLEAR_GAME_DATA)) - { - TheScriptEngine->forceUnfreezeTime(); - } - else - { - /// @todo - make sure this never happens during a network game. jba. - return; - } - } - // Note - TerrainLogic update needs to happen after ScriptEngine update, but before object updates. jba. // This way changes in bridges are noted in the script engine before being cleared in TerrainLogic->update { @@ -3657,6 +3645,17 @@ UnsignedInt GameLogic::getCRC( Int mode, AsciiString deepCRCFileName ) return theCRC; } +// ------------------------------------------------------------------------------------------------ +void GameLogic::exitGame() +{ + // TheSuperHackers @fix The logic update must not be halted to process the game exit message. + setGamePaused(FALSE); + TheScriptEngine->forceUnfreezeTime(); + TheScriptEngine->doUnfreezeTime(); + + TheMessageStream->appendMessage(GameMessage::MSG_CLEAR_GAME_DATA); +} + // ------------------------------------------------------------------------------------------------ /** A new GameLogic object has been constructed, therefore create * a corresponding drawable and bind them together. */ @@ -3712,11 +3711,17 @@ Bool GameLogic::isGamePaused( void ) // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ -void GameLogic::setGamePausedInFrame( UnsignedInt frame ) +void GameLogic::setGamePausedInFrame( UnsignedInt frame, Bool disableLogicTimeScale ) { if (frame >= m_frame) { m_pauseFrame = frame; + + if (disableLogicTimeScale) + { + m_logicTimeScaleEnabledMemory = TheGameEngine->isLogicTimeScaleEnabled(); + TheGameEngine->enableLogicTimeScale(FALSE); + } } } @@ -3748,6 +3753,12 @@ void GameLogic::setGamePaused( Bool paused, Bool pauseMusic, Bool pauseInput ) void GameLogic::pauseGameLogic(Bool paused) { m_gamePaused = paused; + + if (!paused && m_logicTimeScaleEnabledMemory) + { + m_logicTimeScaleEnabledMemory = FALSE; + TheGameEngine->enableLogicTimeScale(TRUE); + } } // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Source/GameNetwork/Network.cpp b/Generals/Code/GameEngine/Source/GameNetwork/Network.cpp index e38ad87f5d1..a9fd9dcd926 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/Network.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/Network.cpp @@ -116,6 +116,7 @@ class Network : public NetworkInterface inline UnsignedInt getFrameRate(void) { return m_frameRate; } UnsignedInt getPacketArrivalCushion(void); ///< Returns the smallest packet arrival cushion since this was last called. Bool isFrameDataReady( void ); + virtual Bool isStalling(); void parseUserList( const GameInfo *game ); void startGame(void); ///< Sets the network game frame counter to -1 @@ -740,7 +741,7 @@ void Network::endOfGameCheck() { if (m_conMgr != NULL) { if (m_conMgr->canILeave()) { m_conMgr->disconnectLocalPlayer(); - TheMessageStream->appendMessage(GameMessage::MSG_CLEAR_GAME_DATA); + TheGameLogic->exitGame(); m_localStatus = NETLOCALSTATUS_POSTGAME; DEBUG_LOG(("Network::endOfGameCheck - about to show the shell")); @@ -804,6 +805,13 @@ Bool Network::isFrameDataReady() { return (m_frameDataReady || (m_localStatus == NETLOCALSTATUS_LEFT)); } +Bool Network::isStalling() +{ + __int64 curTime; + QueryPerformanceCounter((LARGE_INTEGER *)&curTime); + return curTime >= m_nextFrameTime; +} + /** * returns the number of incoming bytes per second averaged over the last 30 sec. */ @@ -926,7 +934,7 @@ void Network::quitGame() { m_conMgr->quitGame(); } - TheMessageStream->appendMessage(GameMessage::MSG_CLEAR_GAME_DATA); + TheGameLogic->exitGame(); m_localStatus = NETLOCALSTATUS_POSTGAME; DEBUG_LOG(("Network::quitGame - quitting game...")); } diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h index 3e8ff91d767..972dfa7ca79 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h @@ -162,7 +162,6 @@ class W3DDisplay : public Display void calculateTerrainLOD(void); ///< Calculate terrain LOD. void renderLetterBox(UnsignedInt time); ///< draw letter box border void updateAverageFPS(void); ///< figure out the average fps over the last 30 frames. - static Bool isTimeFrozen(); Byte m_initialized; ///< TRUE when system is initialized LightClass *m_myLight[LightEnvironmentClass::MAX_LIGHTS]; ///< light hack for now diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp index f40b68fe306..f35f1977c23 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp @@ -88,7 +88,7 @@ void W3DOverlordTankDraw::doDrawModule(const Matrix3D* transformMtx) riderDraw->setColorTintEnvelope( *getDrawable()->getColorTintEnvelope() ); riderDraw->notifyDrawableDependencyCleared(); - riderDraw->draw( NULL );// What the hell? This param isn't used for anything + riderDraw->draw(); } } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp index 5a115cdf22b..71962a979f1 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp @@ -310,12 +310,13 @@ void W3DTankDraw::onRenderObjRecreated(void) //------------------------------------------------------------------------------------------------- void W3DTankDraw::doDrawModule(const Matrix3D* transformMtx) { + // TheSuperHackers @tweak Update the draw on every WW Sync only. + // All calculations are originally catered to a 30 fps logic step. + if (WW3D::Get_Frame_Time() == 0) + return; + const Real DEBRIS_THRESHOLD = 0.00001f; - Bool frozen = TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished(); - frozen = frozen || TheScriptEngine->isTimeFrozenDebug() || TheScriptEngine->isTimeFrozenScript(); - if (frozen) - return; if (getRenderObject()==NULL) return; if (getRenderObject() != m_prevRenderObj) { updateTreadObjects(); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp index 9baea57304c..ee7f97e1b11 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp @@ -515,9 +515,9 @@ void W3DTankTruckDraw::doDrawModule(const Matrix3D* transformMtx) if (!TheGlobalData->m_showClientPhysics) return; - Bool frozen = TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished(); - frozen = frozen || TheScriptEngine->isTimeFrozenDebug() || TheScriptEngine->isTimeFrozenScript(); - if (frozen) + // TheSuperHackers @tweak Update the draw on every WW Sync only. + // All calculations are originally catered to a 30 fps logic step. + if (WW3D::Get_Frame_Time() == 0) return; const Real ACCEL_THRESHOLD = 0.01f; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp index 38dcf25f24e..4807c3b93a3 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp @@ -388,12 +388,14 @@ void W3DTruckDraw::doDrawModule(const Matrix3D* transformMtx) if (!TheGlobalData->m_showClientPhysics) return; + const W3DTruckDrawModuleData *moduleData = getW3DTruckDrawModuleData(); - if (moduleData==NULL) return; // shouldn't ever happen. + if (moduleData==NULL) + return; // shouldn't ever happen. - Bool frozen = TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished(); - frozen = frozen || TheScriptEngine->isTimeFrozenDebug() || TheScriptEngine->isTimeFrozenScript(); - if (frozen) + // TheSuperHackers @tweak Update the draw on every WW Sync only. + // All calculations are originally catered to a 30 fps logic step. + if (WW3D::Get_Frame_Time() == 0) return; const Real ACCEL_THRESHOLD = 0.01f; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 720a9c4ee65..b6d19b675be 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -1606,52 +1606,9 @@ Int W3DDisplay::getLastFrameDrawCalls() return Debug_Statistics::Get_Draw_Calls(); } -Bool W3DDisplay::isTimeFrozen() -{ - if (TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished()) - return true; - - if (TheScriptEngine->isTimeFrozenDebug()) - return true; - - if (TheScriptEngine->isTimeFrozenScript()) - return true; - - if (TheGameLogic->isGamePaused()) - return true; - - return false; -} - -// TheSuperHackers @tweak xezon 12/08/2025 The WW3D Sync is no longer tied -// to the render update, but is advanced separately for every fixed time step. +//============================================================================= void W3DDisplay::step() { - // TheSuperHackers @info This will wrap in 1205 hours at 30 fps logic step. - static UnsignedInt syncTime = 0; - - extern HWND ApplicationHWnd; - if (ApplicationHWnd && ::IsIconic(ApplicationHWnd)) { - return; - } - - if (TheGlobalData->m_headless) - return; - - Bool freezeTime = isTimeFrozen(); - - if (!freezeTime) - { - syncTime += (UnsignedInt)TheW3DFrameLengthInMsec; - - if (TheScriptEngine->isTimeFast()) - { - return; - } - } - - WW3D::Sync( syncTime ); - stepViews(); } @@ -1738,12 +1695,7 @@ void W3DDisplay::draw( void ) // //PredictiveLODOptimizerClass::Optimize_LODs( 5000 ); - Bool freezeTime = isTimeFrozen(); - - // hack to let client spin fast in network games but still do effects at the same pace. -MDC - static UnsignedInt lastFrame = ~0; - freezeTime = freezeTime || (TheNetwork != NULL && lastFrame == TheGameClient->getFrame()); - lastFrame = TheGameClient->getFrame(); + Bool freezeTime = TheGameEngine->isTimeFrozen() || TheGameEngine->isGameHalted(); /// @todo: I'm assuming the first view is our main 3D view. W3DView *primaryW3DView=(W3DView *)getFirstView(); @@ -1779,6 +1731,8 @@ void W3DDisplay::draw( void ) } } + WW3D::Add_Frame_Time(TheGameEngine->getLogicTimeStepMilliseconds()); + static Int now; now=timeGetTime(); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 5b4fa013718..c6c2806017e 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -555,7 +555,7 @@ void W3DView::reset( void ) static void drawDrawable( Drawable *draw, void *userData ) { - draw->draw( (View *)userData ); + draw->draw(); } // end drawDrawable @@ -911,8 +911,8 @@ Bool W3DView::updateCameraMovements() } else if (m_doingMoveCameraOnWaypointPath) { m_previousLookAtPosition = *getPosition(); // TheSuperHackers @tweak The scripted camera movement is now decoupled from the render update. - const Real logicTimeScaleOverFpsRatio = TheGameEngine->getActualLogicTimeScaleOverFpsRatio(); - moveAlongWaypointPath(TheW3DFrameLengthInMsec * logicTimeScaleOverFpsRatio); + // The scripted camera will still move when the time is frozen, but not when the game is halted. + moveAlongWaypointPath(TheGameEngine->getLogicTimeStepMilliseconds(GameEngine::IgnoreFrozenTime)); didUpdate = true; } if (m_doingScriptedCameraLock) @@ -936,13 +936,9 @@ void W3DView::updateView(void) UPDATE(); } -// TheSuperHackers @tweak xezon 12/08/2025 The drawable update is no longer tied to the -// render update, but it advanced separately for every fixed time step. This ensures that -// things like vehicle wheels no longer spin too fast on high frame rates or keep spinning -// on game pause. -// The camera shaker is also no longer tied to the render update. The shake does sharp shakes -// on every fixed time step, and is not intended to have linear interpolation during the -// render update. +// TheSuperHackers @tweak xezon 12/08/2025 The camera shaker is no longer tied to the render +// update. The shake does sharp shakes on every fixed time step, and is not intended to have +// linear interpolation during the render update. void W3DView::stepView() { // @@ -967,17 +963,6 @@ void W3DView::stepView() m_shakeOffset.x = 0.0f; m_shakeOffset.y = 0.0f; } - - if (TheScriptEngine->isTimeFast()) { - return; // don't draw - makes it faster :) jba. - } - - Region3D axisAlignedRegion; - getAxisAlignedViewRegion(axisAlignedRegion); - - // render all of the visible Drawables - /// @todo this needs to use a real region partition or something - TheGameClient->iterateDrawablesInRegion( &axisAlignedRegion, drawDrawable, this ); } //DECLARE_PERF_TIMER(W3DView_updateView) @@ -1248,6 +1233,13 @@ void W3DView::update(void) } if (recalcCamera) setCameraTransform(); + + Region3D axisAlignedRegion; + getAxisAlignedViewRegion(axisAlignedRegion); + + // render all of the visible Drawables + /// @todo this needs to use a real region partition or something + TheGameClient->iterateDrawablesInRegion( &axisAlignedRegion, drawDrawable, NULL ); } //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp index 507e92ebf24..cadd4fb4bfd 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp @@ -165,6 +165,7 @@ const char* DAZZLE_INI_FILENAME="DAZZLE.INI"; ** ***********************************************************************************/ +float WW3D::FractionalSyncMs = 0.0f; unsigned int WW3D::SyncTime = 0; unsigned int WW3D::PreviousSyncTime = 0; bool WW3D::IsSortingEnabled = true; @@ -1167,6 +1168,23 @@ unsigned int WW3D::Get_Last_Frame_Vertex_Count(void) return Debug_Statistics::Get_DX8_Vertices(); } +void WW3D::Add_Frame_Time(float milliseconds) +{ + FractionalSyncMs += milliseconds; + unsigned int integralSyncMs = (unsigned int)FractionalSyncMs; + +#if MSEC_PER_WWSYNC_FRAME + if (integralSyncMs < MSEC_PER_WWSYNC_FRAME) + { + Sync(SyncTime); + return; + } +#endif + + FractionalSyncMs -= integralSyncMs; + Sync(SyncTime + integralSyncMs); +} + /*********************************************************************************************** * WW3D::Sync -- Time sychronization * diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h index 4f5544f19ea..9c544db8163 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h @@ -162,7 +162,9 @@ class WW3D static void Flip_To_Primary(void); - + // TheSuperHackers @info Call this function to accumulate fractional render time. + // It will then call Sync with a new time on its own once an appropriate amount of time has passed. + static void Add_Frame_Time(float milliseconds); /* ** Timing ** By calling the Sync function, the application can move the ww3d library time forward. This @@ -321,6 +323,8 @@ class WW3D static void Allocate_Debug_Resources(void); static void Release_Debug_Resources(void); + static float FractionalSyncMs; + // Timing info: // The absolute synchronized frame time (in milliseconds) supplied by the // application at the start of every frame. Note that wraparound cases diff --git a/Generals/Libraries/Source/WWVegas/WWLib/WWDefines.h b/Generals/Libraries/Source/WWVegas/WWLib/WWDefines.h new file mode 100644 index 00000000000..d7acdd7b4ed --- /dev/null +++ b/Generals/Libraries/Source/WWVegas/WWLib/WWDefines.h @@ -0,0 +1,25 @@ +/* +** Command & Conquer Generals Zero Hour(tm) +** Copyright 2025 TheSuperHackers +** +** This program is free software: you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation, either version 3 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program. If not, see . +*/ + +#pragma once + +// The WW3D Sync time. This was originally 33 ms, ~30 fps, integer. +// Changing or removing this will require tweaking all Drawable code that concerns logic time step, including locomotion physics. +#ifndef MSEC_PER_WWSYNC_FRAME +#define MSEC_PER_WWSYNC_FRAME (33) +#endif diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h b/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h index 86f524551e1..f354df5f8d4 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h @@ -53,11 +53,16 @@ class Radar; class WebBrowser; class ParticleSystemManager; -/** - * The implementation of the game engine - */ class GameEngine : public SubsystemInterface { +public: + + typedef UnsignedInt LogicTimeQueryFlags; + enum LogicTimeQueryFlags_ CPP_11(: LogicTimeQueryFlags) + { + IgnoreFrozenTime = 1<<0, // Ignore frozen time for the query + IgnoreHaltedGame = 1<<1, // Ignore halted game for the query + }; public: @@ -76,13 +81,18 @@ class GameEngine : public SubsystemInterface Real getUpdateTime(); ///< Get the last engine update delta time. Real getUpdateFps(); ///< Get the last engine update fps. + static Bool isTimeFrozen(); ///< Returns true if a script has frozen time. + static Bool isGameHalted(); ///< Returns true if the game is paused or the network is stalling. + virtual void setLogicTimeScaleFps( Int fps ); ///< Set the logic time scale fps and therefore scale the simulation time. Is capped by the max render fps and does not apply to network matches. virtual Int getLogicTimeScaleFps(); ///< Get the raw logic time scale fps value. virtual void enableLogicTimeScale( Bool enable ); ///< Enable the logic time scale setup. If disabled, the simulation time scale is bound to the render frame time or network update time. virtual Bool isLogicTimeScaleEnabled(); ///< Check whether the logic time scale setup is enabled. - Int getActualLogicTimeScaleFps(); ///< Get the real logic time scale fps, depending on the max render fps, network state and enabled state. - Real getActualLogicTimeScaleRatio(); ///< Get the real logic time scale ratio, depending on the max render fps, network state and enabled state. - Real getActualLogicTimeScaleOverFpsRatio(); ///< Get the real logic time scale over render fps ratio, used to scale down steps in render updates to match logic updates. + Int getActualLogicTimeScaleFps(LogicTimeQueryFlags flags = 0); ///< Get the real logic time scale fps, depending on the max render fps, network state and enabled state. + Real getActualLogicTimeScaleRatio(LogicTimeQueryFlags flags = 0); ///< Get the real logic time scale ratio, depending on the max render fps, network state and enabled state. + Real getActualLogicTimeScaleOverFpsRatio(LogicTimeQueryFlags flags = 0); ///< Get the real logic time scale over render fps ratio, used to scale down steps in render updates to match logic updates. + Real getLogicTimeStepSeconds(LogicTimeQueryFlags flags = 0); ///< Get the logic time step in seconds + Real getLogicTimeStepMilliseconds(LogicTimeQueryFlags flags = 0); ///< Get the logic time step in milliseconds virtual void setQuitting( Bool quitting ); ///< set quitting status virtual Bool getQuitting(void); ///< is app getting ready to quit. @@ -96,6 +106,10 @@ class GameEngine : public SubsystemInterface virtual void resetSubsystems( void ); + Bool canUpdateGameLogic(); + Bool canUpdateNetworkGameLogic(); + Bool canUpdateRegularGameLogic(); + virtual FileSystem *createFileSystem( void ); ///< Factory for FileSystem classes virtual LocalFileSystem *createLocalFileSystem( void ) = 0; ///< Factory for LocalFileSystem classes virtual ArchiveFileSystem *createArchiveFileSystem( void ) = 0; ///< Factory for ArchiveFileSystem classes @@ -116,11 +130,14 @@ class GameEngine : public SubsystemInterface Real m_updateTime; ///< Last engine update delta time Real m_logicTimeAccumulator; ///< Frame time accumulated towards submitting a new logic frame - Bool m_quitting; ///< true when we need to quit the game - Bool m_isActive; ///< app has OS focus. + Bool m_quitting; ///< true when we need to quit the game + Bool m_isActive; ///< app has OS focus. Bool m_enableLogicTimeScale; + Bool m_isTimeFrozen; + Bool m_isGameHalted; }; + inline void GameEngine::setQuitting( Bool quitting ) { m_quitting = quitting; } inline Bool GameEngine::getQuitting(void) { return m_quitting; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h index 2b39bd6ea2b..d922060b405 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h @@ -406,7 +406,7 @@ class Drawable : public Thing, const Matrix3D *getTransformMatrix( void ) const; ///< return the world transform - void draw( View *view ); ///< render the drawable to the given view + void draw(); ///< render the drawable to the given view void updateDrawable(); ///< update the drawable void drawIconUI( void ); ///< draw "icon"(s) needed on drawable (health bars, veterency, etc) @@ -640,6 +640,8 @@ class Drawable : public Thing, private: + const Locomotor* getLocomotor() const; + // note, these are lazily allocated! TintEnvelope* m_selectionFlashEnvelope; ///< used for selection flash, works WITH m_colorTintEnvelope TintEnvelope* m_colorTintEnvelope; ///< house color flashing, etc... works WITH m_selectionFlashEnvelope @@ -685,6 +687,8 @@ class Drawable : public Thing, DrawableLocoInfo* m_locoInfo; // lazily allocated + PhysicsXformInfo* m_physicsXform; + DynamicAudioEventRTS* m_ambientSound; ///< sound module for ambient sound (lazily allocated) Module** m_modules[NUM_DRAWABLE_MODULE_TYPES]; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h index c6771816aee..3ce5706eac2 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h @@ -212,6 +212,7 @@ class GameLogic : public SubsystemInterface, public Snapshot void updateObjectsChangedTriggerAreas(void) {m_frameObjectsChangedTriggerAreas = m_frame;} UnsignedInt getFrameObjectsChangedTriggerAreas(void) {return m_frameObjectsChangedTriggerAreas;} + void exitGame(); void clearGameData(Bool showScoreScreen = TRUE); ///< Clear the game data void closeWindows( void ); @@ -220,7 +221,7 @@ class GameLogic : public SubsystemInterface, public Snapshot void bindObjectAndDrawable(Object* obj, Drawable* draw); - void setGamePausedInFrame( UnsignedInt frame ); + void setGamePausedInFrame( UnsignedInt frame, Bool disableLogicTimeScale ); UnsignedInt getGamePauseFrame() const { return m_pauseFrame; } void setGamePaused( Bool paused, Bool pauseMusic = TRUE, Bool pauseInput = TRUE ); Bool isGamePaused( void ); @@ -375,6 +376,7 @@ class GameLogic : public SubsystemInterface, public Snapshot Bool m_pauseInput; Bool m_inputEnabledMemory;// Latches used to remember what to restore to after we unpause Bool m_mouseVisibleMemory; + Bool m_logicTimeScaleEnabledMemory; Bool m_progressComplete[MAX_SLOTS]; enum { PROGRESS_COMPLETE_TIMEOUT = 60000 }; ///< Timeout we wait for when we've completed our Load diff --git a/GeneralsMD/Code/GameEngine/Include/GameNetwork/NetworkInterface.h b/GeneralsMD/Code/GameEngine/Include/GameNetwork/NetworkInterface.h index 1bc29f705a0..8d454add86b 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameNetwork/NetworkInterface.h +++ b/GeneralsMD/Code/GameEngine/Include/GameNetwork/NetworkInterface.h @@ -68,6 +68,7 @@ class NetworkInterface : public SubsystemInterface virtual void setLocalAddress(UnsignedInt ip, UnsignedInt port) = 0; ///< Tell the network what local ip and port to bind to. virtual Bool isFrameDataReady( void ) = 0; ///< Are the commands for the next frame available? + virtual Bool isStalling() = 0; virtual void parseUserList( const GameInfo *game ) = 0; ///< Parse a userlist, creating connections virtual void startGame(void) = 0; ///< Sets the network game frame counter to -1 virtual UnsignedInt getRunAhead(void) = 0; ///< Get the current RunAhead value diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp index 2b4f8ea7ba7..5eca7f3218f 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp @@ -258,6 +258,8 @@ GameEngine::GameEngine( void ) m_quitting = FALSE; m_isActive = FALSE; m_enableLogicTimeScale = FALSE; + m_isTimeFrozen = FALSE; + m_isGameHalted = FALSE; _Module.Init(NULL, ApplicationHInstance, NULL); } @@ -336,6 +338,45 @@ Real GameEngine::getUpdateFps() return 1.0f / m_updateTime; } +//------------------------------------------------------------------------------------------------- +Bool GameEngine::isTimeFrozen() +{ + // TheSuperHackers @fix The time can no longer be frozen in Network games. It would disconnect the player. + if (TheNetwork != NULL) + return false; + + if (TheTacticalView != NULL) + { + if (TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished()) + return true; + } + + if (TheScriptEngine != NULL) + { + if (TheScriptEngine->isTimeFrozenDebug() || TheScriptEngine->isTimeFrozenScript()) + return true; + } + + return false; +} + +//------------------------------------------------------------------------------------------------- +Bool GameEngine::isGameHalted() +{ + if (TheNetwork != NULL) + { + if (TheNetwork->isStalling()) + return true; + } + else + { + if (TheGameLogic != NULL && TheGameLogic->isGamePaused()) + return true; + } + + return false; +} + //------------------------------------------------------------------------------------------------- void GameEngine::setLogicTimeScaleFps( Int fps ) { @@ -361,41 +402,53 @@ Bool GameEngine::isLogicTimeScaleEnabled() } //------------------------------------------------------------------------------------------------- -Int GameEngine::getActualLogicTimeScaleFps( void ) +Int GameEngine::getActualLogicTimeScaleFps(LogicTimeQueryFlags flags) { + if (m_isTimeFrozen && (flags & IgnoreFrozenTime) == 0) + { + return 0; + } + + if (m_isGameHalted && (flags & IgnoreHaltedGame) == 0) + { + return 0; + } + if (TheNetwork != NULL) { return TheNetwork->getFrameRate(); } - else - { - const Bool enabled = isLogicTimeScaleEnabled(); - const Int logicTimeScaleFps = getLogicTimeScaleFps(); - const Int maxFps = getFramesPerSecondLimit(); - if (!enabled || logicTimeScaleFps >= maxFps) - { - return getFramesPerSecondLimit(); - } - else - { - return logicTimeScaleFps; - } + if (isLogicTimeScaleEnabled()) + { + return min(getLogicTimeScaleFps(), getFramesPerSecondLimit()); } + + return getFramesPerSecondLimit(); } //------------------------------------------------------------------------------------------------- -Real GameEngine::getActualLogicTimeScaleRatio() +Real GameEngine::getActualLogicTimeScaleRatio(LogicTimeQueryFlags flags) { - return (Real)getActualLogicTimeScaleFps() / LOGICFRAMES_PER_SECONDS_REAL; + return (Real)getActualLogicTimeScaleFps(flags) / LOGICFRAMES_PER_SECONDS_REAL; } //------------------------------------------------------------------------------------------------- -Real GameEngine::getActualLogicTimeScaleOverFpsRatio() +Real GameEngine::getActualLogicTimeScaleOverFpsRatio(LogicTimeQueryFlags flags) { // TheSuperHackers @info Clamps ratio to min 1, because the logic - // frame rate is (typically) capped by the render frame rate. - return min(1.0f, (Real)getActualLogicTimeScaleFps() / getUpdateFps()); + // frame rate is currently capped by the render frame rate. + return min(1.0f, (Real)getActualLogicTimeScaleFps(flags) / getUpdateFps()); +} + +Real GameEngine::getLogicTimeStepSeconds(LogicTimeQueryFlags flags) +{ + return SECONDS_PER_LOGICFRAME_REAL * getActualLogicTimeScaleOverFpsRatio(flags); +} + +Real GameEngine::getLogicTimeStepMilliseconds(LogicTimeQueryFlags flags) +{ + return MSEC_PER_LOGICFRAME_REAL * getActualLogicTimeScaleOverFpsRatio(flags); } /** ----------------------------------------------------------------------------------------------- @@ -871,21 +924,85 @@ void GameEngine::resetSubsystems( void ) TheSubsystemList->resetAll(); } +/// ----------------------------------------------------------------------------------------------- +Bool GameEngine::canUpdateGameLogic() +{ + // Must be first. + TheGameLogic->preUpdate(); + + m_isTimeFrozen = isTimeFrozen(); + m_isGameHalted = isGameHalted(); + + if (TheNetwork != NULL) + { + return canUpdateNetworkGameLogic(); + } + else + { + return canUpdateRegularGameLogic(); + } +} + +Bool GameEngine::canUpdateNetworkGameLogic() +{ + DEBUG_ASSERTCRASH(TheNetwork != NULL, ("TheNetwork is NULL")); + + if (TheNetwork->isFrameDataReady()) + { + // Important: The Network is definitely no longer stalling. + m_isGameHalted = false; + + return true; + } + + return false; +} + +Bool GameEngine::canUpdateRegularGameLogic() +{ + const Bool enabled = isLogicTimeScaleEnabled(); + const Int logicTimeScaleFps = getLogicTimeScaleFps(); + const Int maxRenderFps = getFramesPerSecondLimit(); + +#if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) + const Bool useFastMode = TheGlobalData->m_TiVOFastMode; +#else //always allow this cheat key if we're in a replay game. + const Bool useFastMode = TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame(); +#endif + + if (useFastMode || !enabled || logicTimeScaleFps >= maxRenderFps) + { + // Logic time scale is uncapped or larger equal Render FPS. Update straight away. + return true; + } + else + { + // TheSuperHackers @tweak xezon 06/08/2025 + // The logic time step is now decoupled from the render update. + const Real targetFrameTime = 1.0f / logicTimeScaleFps; + m_logicTimeAccumulator += min(m_updateTime, targetFrameTime); + + if (m_logicTimeAccumulator >= targetFrameTime) + { + m_logicTimeAccumulator -= targetFrameTime; + return true; + } + } + + return false; +} + /// ----------------------------------------------------------------------------------------------- DECLARE_PERF_TIMER(GameEngine_update) /** ----------------------------------------------------------------------------------------------- * Update the game engine by updating the GameClient and GameLogic singletons. - * @todo Allow the client to run as fast as possible, but limit the execution - * of TheNetwork and TheGameLogic to a fixed framerate. */ void GameEngine::update( void ) { USE_PERF_TIMER(GameEngine_update) { - { - // VERIFY CRC needs to be in this code block. Please to not pull TheGameLogic->update() inside this block. VERIFY_CRC @@ -905,55 +1022,22 @@ void GameEngine::update( void ) TheCDManager->UPDATE(); } - TheGameLogic->preUpdate(); + const Bool canUpdate = canUpdateGameLogic(); + const Bool canUpdateLogic = canUpdate && !m_isGameHalted && !m_isTimeFrozen; + const Bool canUpdateScript = canUpdate && !m_isGameHalted; - if (TheNetwork != NULL) + if (canUpdateLogic) { - if (TheNetwork->isFrameDataReady()) - { - TheGameClient->step(); - TheGameLogic->UPDATE(); - } + TheGameClient->step(); + TheGameLogic->UPDATE(); } - else + else if (canUpdateScript) { - if (!TheGameLogic->isGamePaused()) - { - const Bool enabled = isLogicTimeScaleEnabled(); - const Int logicTimeScaleFps = getLogicTimeScaleFps(); - const Int maxRenderFps = getFramesPerSecondLimit(); - -#if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) - Bool useFastMode = TheGlobalData->m_TiVOFastMode; -#else //always allow this cheat key if we're in a replay game. - Bool useFastMode = TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame(); -#endif - - if (useFastMode || !enabled || logicTimeScaleFps >= maxRenderFps) - { - // Logic time scale is uncapped or larger equal Render FPS. Update straight away. - TheGameClient->step(); - TheGameLogic->UPDATE(); - } - else - { - // TheSuperHackers @tweak xezon 06/08/2025 - // The logic time step is now decoupled from the render update. - const Real targetFrameTime = 1.0f / logicTimeScaleFps; - m_logicTimeAccumulator += min(m_updateTime, targetFrameTime); - - if (m_logicTimeAccumulator >= targetFrameTime) - { - m_logicTimeAccumulator -= targetFrameTime; - TheGameClient->step(); - TheGameLogic->UPDATE(); - } - } - } + // TheSuperHackers @info Still update the Script Engine to allow + // for scripted camera movements while the time is frozen. + TheScriptEngine->UPDATE(); } - } // end perfGather - } // Horrible reference, but we really, really need to know if we are windowed. diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp index ac1f04bc357..bbc17895d80 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp @@ -477,7 +477,7 @@ void RecorderClass::stopPlayback() { if (!m_doingAnalysis) { - TheMessageStream->appendMessage(GameMessage::MSG_CLEAR_GAME_DATA); + TheGameLogic->exitGame(); } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index 0ad661c609a..8393a5880bc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -78,6 +78,8 @@ #include "GameClient/Shadow.h" #include "GameClient/GameText.h" +#include "ww3d.h" + //#define KRIS_BRUTAL_HACK_FOR_AIRCRAFT_CARRIER_DEBUGGING #ifdef KRIS_BRUTAL_HACK_FOR_AIRCRAFT_CARRIER_DEBUGGING #include "GameLogic/Module/ParkingPlaceBehavior.h" @@ -408,6 +410,7 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatus statusBit m_flashCount = 0; m_locoInfo = NULL; + m_physicsXform = NULL; // sanity if( TheGameClient == NULL || thingTemplate == NULL ) @@ -577,6 +580,8 @@ Drawable::~Drawable() deleteInstance(m_locoInfo); m_locoInfo = NULL; + + delete m_physicsXform; } //------------------------------------------------------------------------------------------------- @@ -1377,25 +1382,19 @@ void Drawable::flashAsSelected( const RGBColor *color ) ///< drawable takes care //------------------------------------------------------------------------------------------------- void Drawable::applyPhysicsXform(Matrix3D* mtx) { - const Object *obj = getObject(); - - if( !obj || obj->isDisabledByType( DISABLED_HELD ) || !TheGlobalData->m_showClientPhysics ) - { - return; - } - - Bool frozen = TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished(); - frozen = frozen || TheScriptEngine->isTimeFrozenDebug() || TheScriptEngine->isTimeFrozenScript(); - if (frozen) - return; - PhysicsXformInfo info; - if (calcPhysicsXform(info)) + if (m_physicsXform != NULL) { - mtx->Translate(0.0f, 0.0f, info.m_totalZ); - mtx->Rotate_Y( info.m_totalPitch ); - mtx->Rotate_X( -info.m_totalRoll ); - mtx->Rotate_Z( info.m_totalYaw ); + // TheSuperHackers @tweak Update the physics transform on every WW Sync only. + // All calculations are originally catered to a 30 fps logic step. + if (WW3D::Get_Frame_Time() != 0) + { + calcPhysicsXform(*m_physicsXform); + } + mtx->Translate(0.0f, 0.0f, m_physicsXform->m_totalZ); + mtx->Rotate_Y( m_physicsXform->m_totalPitch ); + mtx->Rotate_X( -m_physicsXform->m_totalRoll ); + mtx->Rotate_Z( m_physicsXform->m_totalYaw ); } } @@ -1403,38 +1402,33 @@ void Drawable::applyPhysicsXform(Matrix3D* mtx) //------------------------------------------------------------------------------------------------- Bool Drawable::calcPhysicsXform(PhysicsXformInfo& info) { - const Object* obj = getObject(); - const AIUpdateInterface *ai = obj ? obj->getAIUpdateInterface() : NULL; Bool hasPhysicsXform = false; - if (ai) + + if (const Locomotor *locomotor = getLocomotor()) { - const Locomotor *locomotor = ai->getCurLocomotor(); - if (locomotor) + switch (locomotor->getAppearance()) { - switch (locomotor->getAppearance()) - { - case LOCO_WHEELS_FOUR: - calcPhysicsXformWheels(locomotor, info); - hasPhysicsXform = true; - break; - case LOCO_MOTORCYCLE: - calcPhysicsXformMotorcycle( locomotor, info ); - hasPhysicsXform = TRUE; - break; - case LOCO_TREADS: - calcPhysicsXformTreads(locomotor, info); - hasPhysicsXform = true; - break; - case LOCO_HOVER: - case LOCO_WINGS: - calcPhysicsXformHoverOrWings(locomotor, info); - hasPhysicsXform = true; - break; - case LOCO_THRUST: - calcPhysicsXformThrust(locomotor, info); - hasPhysicsXform = true; - break; - } + case LOCO_WHEELS_FOUR: + calcPhysicsXformWheels(locomotor, info); + hasPhysicsXform = true; + break; + case LOCO_MOTORCYCLE: + calcPhysicsXformMotorcycle( locomotor, info ); + hasPhysicsXform = true; + break; + case LOCO_TREADS: + calcPhysicsXformTreads(locomotor, info); + hasPhysicsXform = true; + break; + case LOCO_HOVER: + case LOCO_WINGS: + calcPhysicsXformHoverOrWings(locomotor, info); + hasPhysicsXform = true; + break; + case LOCO_THRUST: + calcPhysicsXformThrust(locomotor, info); + hasPhysicsXform = true; + break; } } @@ -2623,9 +2617,8 @@ void Drawable::setStealthLook(StealthLookType look) //------------------------------------------------------------------------------------------------- /** default draw is to just call the database defined draw */ //------------------------------------------------------------------------------------------------- -void Drawable::draw( View *view ) +void Drawable::draw() { - if ( testTintStatus( TINT_STATUS_FRENZY ) == FALSE ) { if ( getObject() && getObject()->isEffectivelyDead() ) @@ -2660,7 +2653,10 @@ void Drawable::draw( View *view ) #endif } - applyPhysicsXform(&transformMtx); + if (TheGlobalData->m_showClientPhysics && getObject() && !getObject()->isDisabledByType( DISABLED_HELD )) + { + applyPhysicsXform(&transformMtx); + } for (DrawModule** dm = getDrawModules(); *dm; ++dm) { @@ -4173,6 +4169,14 @@ void Drawable::friend_bindToObject( Object *obj ) ///< bind this drawable to an { (*dm)->onDrawableBoundToObject(); } + + PhysicsXformInfo physicsXform; + if (calcPhysicsXform(physicsXform)) + { + DEBUG_ASSERTCRASH(m_physicsXform == NULL, ("m_physicsXform is not NULL")); + m_physicsXform = new PhysicsXformInfo; + *m_physicsXform = physicsXform; + } } //------------------------------------------------------------------------------------------------- // when our Object changes teams, it calls us to let us know, so @@ -5433,6 +5437,19 @@ void Drawable::loadPostProcess( void ) } // end loadPostProcess +//------------------------------------------------------------------------------------------------- +const Locomotor* Drawable::getLocomotor() const +{ + if (const Object* obj = getObject()) + { + if (const AIUpdateInterface *ai = obj->getAIUpdateInterface()) + { + return ai->getCurLocomotor(); + } + } + return NULL; +} + //================================================================================================= //================================================================================================= #ifdef DIRTY_CONDITION_FLAGS diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp index 89595d8bf72..44bed1f0eaa 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp @@ -109,7 +109,7 @@ static void successQuitCallback( void ) // Clean up game data. No crashy-crash for you! if (TheGameLogic->isInGame()) - TheMessageStream->appendMessage( GameMessage::MSG_CLEAR_GAME_DATA ); + TheGameLogic->exitGame(); } static void successNoQuitCallback( void ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp index a42675511e1..2a5f0ea68c5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp @@ -265,7 +265,7 @@ static void quitCallback( void ) } if (TheGameLogic->isInGame()) - TheMessageStream->appendMessage( GameMessage::MSG_CLEAR_GAME_DATA ); + TheGameLogic->exitGame(); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp index 05cead033be..7f1d075e08b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp @@ -145,9 +145,7 @@ static void exitQuitMenu() GameMessage *msg = TheMessageStream->appendMessage(GameMessage::MSG_SELF_DESTRUCT); msg->appendBooleanArgument(TRUE); } - /*GameMessage *msg =*/ TheMessageStream->appendMessage( GameMessage::MSG_CLEAR_GAME_DATA ); - if ( !TheGameLogic->isInMultiplayerGame() ) - TheGameLogic->setGamePaused(FALSE); + TheGameLogic->exitGame(); // TheGameLogic->clearGameData(); // display the menu on top of the shell stack // TheShell->showShell(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp index 178c90049e0..2edbec54aa5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp @@ -542,7 +542,7 @@ void Shell::showShellMap(Bool useShellMap ) return; // we're in some other kind of game, clear it out foo! if(TheGameLogic->isInGame()) - TheMessageStream->appendMessage( GameMessage::MSG_CLEAR_GAME_DATA ); + TheGameLogic->exitGame(); TheWritableGlobalData->m_pendingFile = TheGlobalData->m_shellMapName; InitGameLogicRandom(0); @@ -554,7 +554,7 @@ void Shell::showShellMap(Bool useShellMap ) { // we're in a shell game, stop it! if(TheGameLogic->isInGame() && TheGameLogic->getGameMode() == GAME_SHELL) - TheMessageStream->appendMessage( GameMessage::MSG_CLEAR_GAME_DATA ); + TheGameLogic->exitGame(); // if the shell is active,we need a background if(!m_isShellActive) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp index a39542afa02..5d680cac0aa 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -640,17 +640,9 @@ void GameClient::update( void ) TheVideoPlayer->UPDATE(); } - Bool freezeTime = TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished(); - freezeTime = freezeTime || TheScriptEngine->isTimeFrozenDebug(); - freezeTime = freezeTime || TheScriptEngine->isTimeFrozenScript(); - freezeTime = freezeTime || TheGameLogic->isGamePaused(); + const Bool freezeTime = TheGameEngine->isTimeFrozen() || TheGameEngine->isGameHalted(); Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0; - // hack to let client spin fast in network games but still do effects at the same pace. -MDC - static UnsignedInt lastFrame = ~0; - freezeTime = freezeTime || (lastFrame == m_frame); - lastFrame = m_frame; - if (!freezeTime) { #if ENABLE_CONFIGURABLE_SHROUD diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 3f994adb3c4..ee6424345b0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -3478,7 +3478,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage #endif { TheGameLogic->setGamePaused(FALSE); - TheGameLogic->setGamePausedInFrame(TheGameLogic->getFrame() + 1); + TheGameLogic->setGamePausedInFrame(TheGameLogic->getFrame() + 1, TRUE); } break; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index db8eefc62d8..5c77b99f168 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -5542,8 +5542,7 @@ void ScriptEngine::update( void ) if (m_endGameTimer>0) { m_endGameTimer--; if (m_endGameTimer < 1) { - // clear out all the game data - /*GameMessage *msg =*/ TheMessageStream->appendMessage( GameMessage::MSG_CLEAR_GAME_DATA ); + TheGameLogic->exitGame(); //TheScriptActions->closeWindows(FALSE); // Close victory or defeat windows. } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 9cf79663e6d..80ebd4559e9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -252,6 +252,7 @@ GameLogic::GameLogic( void ) m_pauseInput = FALSE; m_inputEnabledMemory = TRUE; m_mouseVisibleMemory = TRUE; + m_logicTimeScaleEnabledMemory = FALSE; m_loadScreen = NULL; m_forceGameStartByTimeOut = FALSE; #ifdef DUMP_PERF_STATS @@ -421,6 +422,8 @@ void GameLogic::init( void ) m_pauseInput = FALSE; m_inputEnabledMemory = TRUE; m_mouseVisibleMemory = TRUE; + m_logicTimeScaleEnabledMemory = FALSE; + for(Int i = 0; i < MAX_SLOTS; ++i) { m_progressComplete[i] = FALSE; @@ -460,6 +463,8 @@ void GameLogic::reset( void ) m_pauseInput = FALSE; m_inputEnabledMemory = TRUE; m_mouseVisibleMemory = TRUE; + m_logicTimeScaleEnabledMemory = FALSE; + setFPMode(); // destroy all objects @@ -3684,7 +3689,6 @@ void GameLogic::update( void ) } // send the current time to the GameClient - DEBUG_ASSERTCRASH(TheGameLogic == this, ("hmm, TheGameLogic is not right")); UnsignedInt now = TheGameLogic->getFrame(); TheGameClient->setFrame(now); @@ -3693,22 +3697,6 @@ void GameLogic::update( void ) TheScriptEngine->UPDATE(); } - Bool freezeTime = TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished(); - freezeTime = freezeTime || TheScriptEngine->isTimeFrozenDebug() || TheScriptEngine->isTimeFrozenScript(); - - if (freezeTime) - { - if (TheCommandList->containsMessageOfType(GameMessage::MSG_CLEAR_GAME_DATA)) - { - TheScriptEngine->forceUnfreezeTime(); - } - else - { - /// @todo - make sure this never happens during a network game. jba. - return; - } - } - // Note - TerrainLogic update needs to happen after ScriptEngine update, but before object updates. jba. // This way changes in bridges are noted in the script engine before being cleared in TerrainLogic->update { @@ -4209,6 +4197,17 @@ UnsignedInt GameLogic::getCRC( Int mode, AsciiString deepCRCFileName ) return theCRC; } +// ------------------------------------------------------------------------------------------------ +void GameLogic::exitGame() +{ + // TheSuperHackers @fix The logic update must not be halted to process the game exit message. + setGamePaused(FALSE); + TheScriptEngine->forceUnfreezeTime(); + TheScriptEngine->doUnfreezeTime(); + + TheMessageStream->appendMessage(GameMessage::MSG_CLEAR_GAME_DATA); +} + // ------------------------------------------------------------------------------------------------ /** A new GameLogic object has been constructed, therefore create * a corresponding drawable and bind them together. */ @@ -4264,11 +4263,17 @@ Bool GameLogic::isGamePaused( void ) // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ -void GameLogic::setGamePausedInFrame( UnsignedInt frame ) +void GameLogic::setGamePausedInFrame( UnsignedInt frame, Bool disableLogicTimeScale ) { if (frame >= m_frame) { m_pauseFrame = frame; + + if (disableLogicTimeScale) + { + m_logicTimeScaleEnabledMemory = TheGameEngine->isLogicTimeScaleEnabled(); + TheGameEngine->enableLogicTimeScale(FALSE); + } } } @@ -4300,6 +4305,12 @@ void GameLogic::setGamePaused( Bool paused, Bool pauseMusic, Bool pauseInput ) void GameLogic::pauseGameLogic(Bool paused) { m_gamePaused = paused; + + if (!paused && m_logicTimeScaleEnabledMemory) + { + m_logicTimeScaleEnabledMemory = FALSE; + TheGameEngine->enableLogicTimeScale(TRUE); + } } // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/Network.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/Network.cpp index 58e800d861b..a8c009acc4d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/Network.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/Network.cpp @@ -116,6 +116,7 @@ class Network : public NetworkInterface inline UnsignedInt getFrameRate(void) { return m_frameRate; } UnsignedInt getPacketArrivalCushion(void); ///< Returns the smallest packet arrival cushion since this was last called. Bool isFrameDataReady( void ); + virtual Bool isStalling(); void parseUserList( const GameInfo *game ); void startGame(void); ///< Sets the network game frame counter to -1 @@ -740,7 +741,7 @@ void Network::endOfGameCheck() { if (m_conMgr != NULL) { if (m_conMgr->canILeave()) { m_conMgr->disconnectLocalPlayer(); - TheMessageStream->appendMessage(GameMessage::MSG_CLEAR_GAME_DATA); + TheGameLogic->exitGame(); m_localStatus = NETLOCALSTATUS_POSTGAME; DEBUG_LOG(("Network::endOfGameCheck - about to show the shell")); @@ -804,6 +805,13 @@ Bool Network::isFrameDataReady() { return (m_frameDataReady || (m_localStatus == NETLOCALSTATUS_LEFT)); } +Bool Network::isStalling() +{ + __int64 curTime; + QueryPerformanceCounter((LARGE_INTEGER *)&curTime); + return curTime >= m_nextFrameTime; +} + /** * returns the number of incoming bytes per second averaged over the last 30 sec. */ @@ -930,7 +938,7 @@ void Network::quitGame() { GameMessage *msg = TheMessageStream->appendMessage(GameMessage::MSG_SELF_DESTRUCT); msg->appendBooleanArgument(TRUE); - TheMessageStream->appendMessage(GameMessage::MSG_CLEAR_GAME_DATA); + TheGameLogic->exitGame(); m_localStatus = NETLOCALSTATUS_POSTGAME; DEBUG_LOG(("Network::quitGame - quitting game...")); } diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h index 80c07119dae..79a5dfa0416 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h @@ -163,7 +163,6 @@ class W3DDisplay : public Display void calculateTerrainLOD(void); ///< Calculate terrain LOD. void renderLetterBox(UnsignedInt time); ///< draw letter box border void updateAverageFPS(void); ///< figure out the average fps over the last 30 frames. - static Bool isTimeFrozen(); Byte m_initialized; ///< TRUE when system is initialized LightClass *m_myLight[LightEnvironmentClass::MAX_LIGHTS]; ///< light hack for now diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordAircraftDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordAircraftDraw.cpp index 39c1cbe3250..8aba0a4de3c 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordAircraftDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordAircraftDraw.cpp @@ -101,7 +101,7 @@ void W3DOverlordAircraftDraw::doDrawModule(const Matrix3D* transformMtx) riderDraw->setColorTintEnvelope( *env ); riderDraw->notifyDrawableDependencyCleared(); - riderDraw->draw( NULL );// What the hell? This param isn't used for anything + riderDraw->draw(); } DEBUG_ASSERTCRASH( riderDraw, ("OverlordAircraftDraw finds no rider's drawable") ); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp index 039cd926f12..530d8682a18 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp @@ -88,7 +88,7 @@ void W3DOverlordTankDraw::doDrawModule(const Matrix3D* transformMtx) riderDraw->setColorTintEnvelope( *getDrawable()->getColorTintEnvelope() ); riderDraw->notifyDrawableDependencyCleared(); - riderDraw->draw( NULL );// What the hell? This param isn't used for anything + riderDraw->draw(); } } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTruckDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTruckDraw.cpp index b8c26fe2842..471cb67dbb6 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTruckDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTruckDraw.cpp @@ -88,7 +88,7 @@ void W3DOverlordTruckDraw::doDrawModule(const Matrix3D* transformMtx) riderDraw->setColorTintEnvelope( *getDrawable()->getColorTintEnvelope() ); riderDraw->notifyDrawableDependencyCleared(); - riderDraw->draw( NULL );// What the hell? This param isn't used for anything + riderDraw->draw(); } } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp index ce402892c5a..f1dd1ae0205 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp @@ -310,12 +310,13 @@ void W3DTankDraw::onRenderObjRecreated(void) //------------------------------------------------------------------------------------------------- void W3DTankDraw::doDrawModule(const Matrix3D* transformMtx) { + // TheSuperHackers @tweak Update the draw on every WW Sync only. + // All calculations are originally catered to a 30 fps logic step. + if (WW3D::Get_Frame_Time() == 0) + return; + const Real DEBRIS_THRESHOLD = 0.00001f; - Bool frozen = TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished(); - frozen = frozen || TheScriptEngine->isTimeFrozenDebug() || TheScriptEngine->isTimeFrozenScript(); - if (frozen) - return; if (getRenderObject()==NULL) return; if (getRenderObject() != m_prevRenderObj) { updateTreadObjects(); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp index d65e739cc4d..cb26acc9ec2 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp @@ -515,9 +515,9 @@ void W3DTankTruckDraw::doDrawModule(const Matrix3D* transformMtx) if (!TheGlobalData->m_showClientPhysics) return; - Bool frozen = TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished(); - frozen = frozen || TheScriptEngine->isTimeFrozenDebug() || TheScriptEngine->isTimeFrozenScript(); - if (frozen) + // TheSuperHackers @tweak Update the draw on every WW Sync only. + // All calculations are originally catered to a 30 fps logic step. + if (WW3D::Get_Frame_Time() == 0) return; const Real ACCEL_THRESHOLD = 0.01f; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp index 24aaad8ec6a..7a68b8e71e5 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp @@ -388,12 +388,14 @@ void W3DTruckDraw::doDrawModule(const Matrix3D* transformMtx) if (!TheGlobalData->m_showClientPhysics) return; + const W3DTruckDrawModuleData *moduleData = getW3DTruckDrawModuleData(); - if (moduleData==NULL) return; // shouldn't ever happen. + if (moduleData==NULL) + return; // shouldn't ever happen. - Bool frozen = TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished(); - frozen = frozen || TheScriptEngine->isTimeFrozenDebug() || TheScriptEngine->isTimeFrozenScript(); - if (frozen) + // TheSuperHackers @tweak Update the draw on every WW Sync only. + // All calculations are originally catered to a 30 fps logic step. + if (WW3D::Get_Frame_Time() == 0) return; const Real ACCEL_THRESHOLD = 0.01f; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index f0fb3f2900a..f73d5af2214 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -1677,52 +1677,9 @@ Int W3DDisplay::getLastFrameDrawCalls() return Debug_Statistics::Get_Draw_Calls(); } -Bool W3DDisplay::isTimeFrozen() -{ - if (TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished()) - return true; - - if (TheScriptEngine->isTimeFrozenDebug()) - return true; - - if (TheScriptEngine->isTimeFrozenScript()) - return true; - - if (TheGameLogic->isGamePaused()) - return true; - - return false; -} - -// TheSuperHackers @tweak xezon 12/08/2025 The WW3D Sync is no longer tied -// to the render update, but is advanced separately for every fixed time step. +//============================================================================= void W3DDisplay::step() { - // TheSuperHackers @info This will wrap in 1205 hours at 30 fps logic step. - static UnsignedInt syncTime = 0; - - extern HWND ApplicationHWnd; - if (ApplicationHWnd && ::IsIconic(ApplicationHWnd)) { - return; - } - - if (TheGlobalData->m_headless) - return; - - Bool freezeTime = isTimeFrozen(); - - if (!freezeTime) - { - syncTime += (UnsignedInt)TheW3DFrameLengthInMsec; - - if (TheScriptEngine->isTimeFast()) - { - return; - } - } - - WW3D::Sync( syncTime ); - stepViews(); } @@ -1819,12 +1776,7 @@ void W3DDisplay::draw( void ) // //PredictiveLODOptimizerClass::Optimize_LODs( 5000 ); - Bool freezeTime = isTimeFrozen(); - - // hack to let client spin fast in network games but still do effects at the same pace. -MDC - static UnsignedInt lastFrame = ~0; - freezeTime = freezeTime || (TheNetwork != NULL && lastFrame == TheGameClient->getFrame()); - lastFrame = TheGameClient->getFrame(); + Bool freezeTime = TheGameEngine->isTimeFrozen() || TheGameEngine->isGameHalted(); /// @todo: I'm assuming the first view is our main 3D view. W3DView *primaryW3DView=(W3DView *)getFirstView(); @@ -1860,6 +1812,8 @@ void W3DDisplay::draw( void ) } } + WW3D::Add_Frame_Time(TheGameEngine->getLogicTimeStepMilliseconds()); + static Int now; now=timeGetTime(); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 41dce19ad42..35e570dce08 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -410,8 +410,7 @@ void W3DView::buildCameraTransform( Matrix3D *transform ) //WST 11/12/2002 New camera shaker system // TheSuperHackers @tweak The camera shaker is now decoupled from the render update. - const Real logicTimeScaleOverFpsRatio = TheGameEngine->getActualLogicTimeScaleOverFpsRatio(); - CameraShakerSystem.Timestep(TheW3DFrameLengthInMsec * logicTimeScaleOverFpsRatio); + CameraShakerSystem.Timestep(TheGameEngine->getLogicTimeStepMilliseconds()); CameraShakerSystem.Update_Camera_Shaker(sourcePos, &m_shakerAngles); transform->Rotate_X(m_shakerAngles.X); transform->Rotate_Y(m_shakerAngles.Y); @@ -701,7 +700,7 @@ void W3DView::reset( void ) static void drawDrawable( Drawable *draw, void *userData ) { - draw->draw( (View *)userData ); + draw->draw(); } // end drawDrawable @@ -1057,8 +1056,8 @@ Bool W3DView::updateCameraMovements() } else if (m_doingMoveCameraOnWaypointPath) { m_previousLookAtPosition = *getPosition(); // TheSuperHackers @tweak The scripted camera movement is now decoupled from the render update. - const Real logicTimeScaleOverFpsRatio = TheGameEngine->getActualLogicTimeScaleOverFpsRatio(); - moveAlongWaypointPath(TheW3DFrameLengthInMsec * logicTimeScaleOverFpsRatio); + // The scripted camera will still move when the time is frozen, but not when the game is halted. + moveAlongWaypointPath(TheGameEngine->getLogicTimeStepMilliseconds(GameEngine::IgnoreFrozenTime)); didUpdate = true; } if (m_doingScriptedCameraLock) @@ -1082,13 +1081,9 @@ void W3DView::updateView(void) UPDATE(); } -// TheSuperHackers @tweak xezon 12/08/2025 The drawable update is no longer tied to the -// render update, but it advanced separately for every fixed time step. This ensures that -// things like vehicle wheels no longer spin too fast on high frame rates or keep spinning -// on game pause. -// The camera shaker is also no longer tied to the render update. The shake does sharp shakes -// on every fixed time step, and is not intended to have linear interpolation during the -// render update. +// TheSuperHackers @tweak xezon 12/08/2025 The camera shaker is no longer tied to the render +// update. The shake does sharp shakes on every fixed time step, and is not intended to have +// linear interpolation during the render update. void W3DView::stepView() { // @@ -1113,17 +1108,6 @@ void W3DView::stepView() m_shakeOffset.x = 0.0f; m_shakeOffset.y = 0.0f; } - - if (TheScriptEngine->isTimeFast()) { - return; // don't draw - makes it faster :) jba. - } - - Region3D axisAlignedRegion; - getAxisAlignedViewRegion(axisAlignedRegion); - - // render all of the visible Drawables - /// @todo this needs to use a real region partition or something - TheGameClient->iterateDrawablesInRegion( &axisAlignedRegion, drawDrawable, this ); } //DECLARE_PERF_TIMER(W3DView_updateView) @@ -1408,9 +1392,16 @@ void W3DView::update(void) #ifdef DO_SEISMIC_SIMULATIONS - // Give the terrain a chance to refresh animaing (Seismic) regions, if any. + // Give the terrain a chance to refresh animating (Seismic) regions, if any. TheTerrainVisual->updateSeismicSimulations(); #endif + + Region3D axisAlignedRegion; + getAxisAlignedViewRegion(axisAlignedRegion); + + // render all of the visible Drawables + /// @todo this needs to use a real region partition or something + TheGameClient->iterateDrawablesInRegion( &axisAlignedRegion, drawDrawable, NULL ); } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp index 2168ea42357..fd88ad00cc1 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp @@ -166,6 +166,7 @@ const char* DAZZLE_INI_FILENAME="DAZZLE.INI"; ** ***********************************************************************************/ +float WW3D::FractionalSyncMs = 0.0f; unsigned int WW3D::SyncTime = 0; unsigned int WW3D::PreviousSyncTime = 0; bool WW3D::IsSortingEnabled = true; @@ -1162,6 +1163,23 @@ unsigned int WW3D::Get_Last_Frame_Vertex_Count(void) return Debug_Statistics::Get_DX8_Vertices(); } +void WW3D::Add_Frame_Time(float milliseconds) +{ + FractionalSyncMs += milliseconds; + unsigned int integralSyncMs = (unsigned int)FractionalSyncMs; + +#if MSEC_PER_WWSYNC_FRAME + if (integralSyncMs < MSEC_PER_WWSYNC_FRAME) + { + Sync(SyncTime); + return; + } +#endif + + FractionalSyncMs -= integralSyncMs; + Sync(SyncTime + integralSyncMs); +} + /*********************************************************************************************** * WW3D::Sync -- Time sychronization * diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h index bf453bc9d04..af2261961ea 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h @@ -162,7 +162,9 @@ class WW3D static void Flip_To_Primary(void); - + // TheSuperHackers @info Call this function to accumulate fractional render time. + // It will then call Sync with a new time on its own once an appropriate amount of time has passed. + static void Add_Frame_Time(float milliseconds); /* ** Timing ** By calling the Sync function, the application can move the ww3d library time forward. This @@ -321,6 +323,8 @@ class WW3D static void Allocate_Debug_Resources(void); static void Release_Debug_Resources(void); + static float FractionalSyncMs; + // Timing info: // The absolute synchronized frame time (in milliseconds) supplied by the // application at the start of every frame. Note that wraparound cases From 15933f7d661b3bcf5bd2d898da3b8acbc1f16472 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Wed, 10 Sep 2025 11:58:27 +0200 Subject: [PATCH 056/343] fix(draw): Fix wheel rotation math (#1507) --- Core/Libraries/Source/WWVegas/WWMath/wwmath.h | 9 ++++++++- .../Code/GameEngine/Include/Common/GameCommon.h | 1 + .../Source/Common/System/GameCommon.cpp | 1 + .../Drawable/Draw/W3DTankTruckDraw.cpp | 16 ++++++---------- .../GameClient/Drawable/Draw/W3DTruckDraw.cpp | 17 +++++++---------- .../Code/GameEngine/Include/Common/GameCommon.h | 1 + .../Source/Common/System/GameCommon.cpp | 1 + .../Drawable/Draw/W3DTankTruckDraw.cpp | 16 ++++++---------- .../GameClient/Drawable/Draw/W3DTruckDraw.cpp | 17 +++++++---------- 9 files changed, 38 insertions(+), 41 deletions(-) diff --git a/Core/Libraries/Source/WWVegas/WWMath/wwmath.h b/Core/Libraries/Source/WWVegas/WWMath/wwmath.h index 338426b9b6a..a18996b1660 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/wwmath.h +++ b/Core/Libraries/Source/WWVegas/WWMath/wwmath.h @@ -52,7 +52,8 @@ */ #define WWMATH_EPSILON 0.0001f #define WWMATH_EPSILON2 WWMATH_EPSILON * WWMATH_EPSILON -#define WWMATH_PI 3.141592654f +#define WWMATH_PI 3.141592654f +#define WWMATH_TWO_PI 6.283185308f #define WWMATH_FLOAT_MAX (FLT_MAX) #define WWMATH_FLOAT_MIN (FLT_MIN) #define WWMATH_SQRT2 1.414213562f @@ -171,6 +172,8 @@ static WWINLINE float Byte_To_Unit_Float(unsigned char byte) { return ((float) static WWINLINE bool Is_Valid_Float(float x); static WWINLINE bool Is_Valid_Double(double x); +static WWINLINE float Normalize_Angle(float angle); // Normalizes the angle to the range -PI..PI + }; WWINLINE float WWMath::Sign(float val) @@ -653,5 +656,9 @@ WWINLINE float WWMath::Inv_Sqrt(float val) } #endif +WWINLINE float WWMath::Normalize_Angle(float angle) +{ + return angle - (WWMATH_TWO_PI * Floor((angle + WWMATH_PI) / WWMATH_TWO_PI)); +} #endif diff --git a/Generals/Code/GameEngine/Include/Common/GameCommon.h b/Generals/Code/GameEngine/Include/Common/GameCommon.h index 60867cb2080..ab562f50f62 100644 --- a/Generals/Code/GameEngine/Include/Common/GameCommon.h +++ b/Generals/Code/GameEngine/Include/Common/GameCommon.h @@ -468,6 +468,7 @@ enum WhichTurretType CPP_11(: Int) // ------------------------------------------------------------------------ // this normalizes an angle to the range -PI...PI. +// TheSuperHackers @todo DO NOT USE THIS FUNCTION! Use WWMath::Normalize_Angle instead. Delete this. extern Real normalizeAngle(Real angle); // ------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Source/Common/System/GameCommon.cpp b/Generals/Code/GameEngine/Source/Common/System/GameCommon.cpp index e390f180277..f47338d4d99 100644 --- a/Generals/Code/GameEngine/Source/Common/System/GameCommon.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/GameCommon.cpp @@ -48,6 +48,7 @@ const char *TheRelationshipNames[] = }; //------------------------------------------------------------------------------------------------- +// TheSuperHackers @todo DO NOT USE THIS FUNCTION! Use WWMath::Normalize_Angle instead. Delete this. Real normalizeAngle(Real angle) { DEBUG_ASSERTCRASH(!_isnan(angle), ("Angle is NAN in normalizeAngle!")); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp index ee7f97e1b11..b9846646344 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp @@ -540,21 +540,17 @@ void W3DTankTruckDraw::doDrawModule(const Matrix3D* transformMtx) const Coord3D *vel = physics->getVelocity(); Real speed = physics->getVelocityMagnitude(); - const TWheelInfo *wheelInfo = getDrawable()->getWheelInfo(); // note, can return null! if (wheelInfo && (m_frontLeftTireBone || m_rearLeftTireBone)) { - static Real rotation = 0; const Real rotationFactor = getW3DTankTruckDrawModuleData()->m_rotationSpeedMultiplier; + const Real powerslideRotationAddition = getW3DTankTruckDrawModuleData()->m_powerslideRotationAddition * m_isPowersliding; + m_frontWheelRotation += rotationFactor*speed; - if (m_isPowersliding) - { - m_rearWheelRotation += rotationFactor*(speed+getW3DTankTruckDrawModuleData()->m_powerslideRotationAddition); - } - else - { - m_rearWheelRotation += rotationFactor*speed; - } + m_rearWheelRotation += rotationFactor*(speed+powerslideRotationAddition); + m_frontWheelRotation = WWMath::Normalize_Angle(m_frontWheelRotation); + m_rearWheelRotation = WWMath::Normalize_Angle(m_rearWheelRotation); + Matrix3D wheelXfrm(1); if (m_frontLeftTireBone) { diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp index 4807c3b93a3..b0a37c1f3a8 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp @@ -463,7 +463,9 @@ void W3DTruckDraw::doDrawModule(const Matrix3D* transformMtx) if (m_frontLeftTireBone || m_rearLeftTireBone) { - Real powerslideRotationAddition = moduleData->m_powerslideRotationAddition; + const Real rotationFactor = moduleData->m_rotationSpeedMultiplier; + Real powerslideRotationAddition = moduleData->m_powerslideRotationAddition * m_isPowersliding; + if (ai) { Locomotor *loco = ai->getCurLocomotor(); if (loco) { @@ -473,16 +475,11 @@ void W3DTruckDraw::doDrawModule(const Matrix3D* transformMtx) } } } - const Real rotationFactor = moduleData->m_rotationSpeedMultiplier; + m_frontWheelRotation += rotationFactor*speed; - if (m_isPowersliding) - { - m_rearWheelRotation += rotationFactor*(speed + powerslideRotationAddition); - } - else - { - m_rearWheelRotation += rotationFactor*speed; - } + m_rearWheelRotation += rotationFactor*(speed + powerslideRotationAddition); + m_frontWheelRotation = WWMath::Normalize_Angle(m_frontWheelRotation); + m_rearWheelRotation = WWMath::Normalize_Angle(m_rearWheelRotation); // For now, just use the same values for mid wheels -- may want to do independent calcs later... m_midFrontWheelRotation = m_frontWheelRotation; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h b/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h index 925126d7a66..410192d841a 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h @@ -487,6 +487,7 @@ enum WhichTurretType CPP_11(: Int) // ------------------------------------------------------------------------ // this normalizes an angle to the range -PI...PI. +// TheSuperHackers @todo DO NOT USE THIS FUNCTION! Use WWMath::Normalize_Angle instead. Delete this. extern Real normalizeAngle(Real angle); // ------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/GameCommon.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/GameCommon.cpp index bcd99841a42..db9914e0030 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/GameCommon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/GameCommon.cpp @@ -48,6 +48,7 @@ const char *TheRelationshipNames[] = }; //------------------------------------------------------------------------------------------------- +// TheSuperHackers @todo DO NOT USE THIS FUNCTION! Use WWMath::Normalize_Angle instead. Delete this. Real normalizeAngle(Real angle) { DEBUG_ASSERTCRASH(!_isnan(angle), ("Angle is NAN in normalizeAngle!")); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp index cb26acc9ec2..0be4df71f72 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp @@ -540,21 +540,17 @@ void W3DTankTruckDraw::doDrawModule(const Matrix3D* transformMtx) const Coord3D *vel = physics->getVelocity(); Real speed = physics->getVelocityMagnitude(); - const TWheelInfo *wheelInfo = getDrawable()->getWheelInfo(); // note, can return null! if (wheelInfo && (m_frontLeftTireBone || m_rearLeftTireBone)) { - static Real rotation = 0; const Real rotationFactor = getW3DTankTruckDrawModuleData()->m_rotationSpeedMultiplier; + const Real powerslideRotationAddition = getW3DTankTruckDrawModuleData()->m_powerslideRotationAddition * m_isPowersliding; + m_frontWheelRotation += rotationFactor*speed; - if (m_isPowersliding) - { - m_rearWheelRotation += rotationFactor*(speed+getW3DTankTruckDrawModuleData()->m_powerslideRotationAddition); - } - else - { - m_rearWheelRotation += rotationFactor*speed; - } + m_rearWheelRotation += rotationFactor*(speed+powerslideRotationAddition); + m_frontWheelRotation = WWMath::Normalize_Angle(m_frontWheelRotation); + m_rearWheelRotation = WWMath::Normalize_Angle(m_rearWheelRotation); + Matrix3D wheelXfrm(1); if (m_frontLeftTireBone) { diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp index 7a68b8e71e5..cca3ce92f22 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp @@ -463,7 +463,9 @@ void W3DTruckDraw::doDrawModule(const Matrix3D* transformMtx) if (m_frontLeftTireBone || m_rearLeftTireBone) { - Real powerslideRotationAddition = moduleData->m_powerslideRotationAddition; + const Real rotationFactor = moduleData->m_rotationSpeedMultiplier; + Real powerslideRotationAddition = moduleData->m_powerslideRotationAddition * m_isPowersliding; + if (ai) { Locomotor *loco = ai->getCurLocomotor(); if (loco) { @@ -473,16 +475,11 @@ void W3DTruckDraw::doDrawModule(const Matrix3D* transformMtx) } } } - const Real rotationFactor = moduleData->m_rotationSpeedMultiplier; + m_frontWheelRotation += rotationFactor*speed; - if (m_isPowersliding) - { - m_rearWheelRotation += rotationFactor*(speed + powerslideRotationAddition); - } - else - { - m_rearWheelRotation += rotationFactor*speed; - } + m_rearWheelRotation += rotationFactor*(speed + powerslideRotationAddition); + m_frontWheelRotation = WWMath::Normalize_Angle(m_frontWheelRotation); + m_rearWheelRotation = WWMath::Normalize_Angle(m_rearWheelRotation); // For now, just use the same values for mid wheels -- may want to do independent calcs later... m_midFrontWheelRotation = m_frontWheelRotation; From 55e6cd466abbd0d08372d1ccaa14fa6934c866c0 Mon Sep 17 00:00:00 2001 From: Felipe Braz Date: Wed, 10 Sep 2025 07:03:56 -0300 Subject: [PATCH 057/343] docs: Add AI coding agent instructions (#1559) --- .github/copilot-instructions.md | 133 ++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 00000000000..de2ca2326e4 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,133 @@ +# AI Coding Agent Instructions + +## Project Overview + +This is the **GeneralsGameCode** project - a community-driven effort to fix and improve the classic RTS games *Command & Conquer: Generals* and *Zero Hour*. The codebase has been modernized from Visual Studio 6/C++98 to Visual Studio 2022/C++20 while maintaining retail compatibility. + +## Architecture + +### Dual Game Structure +- **Generals/**: Original C&C Generals (v1.08) codebase +- **GeneralsMD/**: Zero Hour expansion (v1.04) codebase - **primary focus** +- **Core/**: Shared game engine and libraries used by both games + +### Key Components +- **Core/GameEngine/**: Base game engine with GameClient/GameLogic separation +- **Core/Libraries/**: Internal libraries including WWVegas graphics framework +- **Core/GameEngineDevice/**: Platform-specific rendering (DirectX 8) +- **Core/Tools/**: Development tools (W3DView, texture compression, etc.) +- **Dependencies/**: External dependencies (MaxSDK for VC6, utilities) + +## Build System + +### CMake Presets (Critical) +- **vc6**: Visual Studio 6 compatible build (retail compatibility required) +- **win32**: Modern Visual Studio 2022 build +- **vc6-debug/vc6-profile**: Debug/profiling variants +- Use `cmake --preset ` followed by `cmake --build build/` + +### Build Commands +```bash +# Configure with specific preset +cmake --preset vc6 + +# Build (from project root) +cmake --build build/vc6 + +# Build with tools and extras +cmake --build build/vc6 --target _tools _extras +``` + +### Retail Compatibility +- VC6 builds are required for replay compatibility testing +- Debug builds break retail compatibility +- Use RTS_BUILD_OPTION_DEBUG=OFF for compatibility testing + +## Development Workflow + +### Code Change Documentation +**Every user-facing change requires TheSuperHackers comment format:** +```cpp +// TheSuperHackers @keyword author DD/MM/YYYY Description +``` + +Common keywords: `@bugfix`, `@feature`, `@performance`, `@refactor`, `@tweak`, `@build` + +### Pull Request Guidelines +- Title format: `type: Description starting with action verb` +- Types: `bugfix:`, `feat:`, `fix:`, `refactor:`, `perf:`, `build:` +- Zero Hour changes take precedence over Generals +- Changes must be identical between both games when applicable + +### Code Style +- Maintain consistency with surrounding legacy code +- Prefer C++98 style unless modern features add significant value +- No big refactors mixed with logical changes +- Use present tense in documentation ("Fixes" not "Fixed") + +## Testing + +### Replay Compatibility Testing +Located in `GeneralsReplays/` - critical for ensuring retail compatibility: +```bash +generalszh.exe -jobs 4 -headless -replay subfolder/*.rep +``` +- Requires VC6 optimized build with RTS_BUILD_OPTION_DEBUG=OFF +- Copies replays to `%USERPROFILE%/Documents/Command and Conquer Generals Zero Hour Data/Replays` +- CI automatically tests GeneralsMD builds against known replays + +### Build Validation +- CI tests multiple presets: vc6, vc6-profile, vc6-debug, win32 variants +- Path-based change detection triggers relevant builds +- Tools and extras are built with `+t+e` flags + +## Common Patterns + +### Memory Management +- Manual memory management (delete/delete[]) - this is legacy C++98 code +- STLPort for VC6 compatibility (see `cmake/stlport.cmake`) + +### Game Engine Separation +- **GameLogic**: Game state, rules, simulation +- **GameClient**: Rendering, UI, platform-specific code +- Clean separation maintained for potential future networking + +### Module Structure +``` +Core/ +├── GameEngine/Include/Common/ # Shared interfaces +├── GameEngine/Include/GameLogic/ # Game simulation +├── GameEngine/Include/GameClient/ # Rendering/UI +├── Libraries/Include/rts/ # RTS-specific utilities +└── Libraries/Source/WWVegas/ # Graphics framework +``` + +## External Dependencies + +### Required for Building +- **VC6 builds**: Requires MSVC 6.0 toolchain (automated in CI via itsmattkc/MSVC600) +- **Modern builds**: Visual Studio 2022, Ninja generator +- **vcpkg** (optional): zlib, ffmpeg for enhanced builds + +### Platform-Specific +- **Windows**: DirectX 8, Miles Sound System, Bink Video +- **Registry detection**: Automatic game install path detection from EA registry keys + +## Tools and Utilities + +### Development Scripts (`scripts/cpp/`) +- `fixInludesCase.sh`: Fix include case sensitivity +- `refactor_*.py`: Code refactoring utilities +- `remove_trailing_whitespace.py`: Code cleanup + +### Build Tools +- W3DView: 3D model viewer +- TextureCompress: Asset optimization +- MapCacheBuilder: Map preprocessing + +## Key Files to Understand +- `CMakePresets.json`: All build configurations +- `cmake/config-build.cmake`: Build options and feature flags +- `Core/GameEngine/Include/`: Core engine interfaces +- `**/Code/Main/WinMain.cpp`: Application entry points +- `GeneralsReplays/`: Compatibility test data From 36b5277a69822e705ed08199f0d13af9e469c90a Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Wed, 10 Sep 2025 12:30:14 +0200 Subject: [PATCH 058/343] feat(options): Implement user options for Screen Edge Scrolling (#1538) Adds new options ScreenEdgeScrollEnabledInWindowedApp=no, ScreenEdgeScrollEnabledInFullscreenApp=yes to Options.ini --- .../Include/Common/UserPreferences.h | 4 ++ .../Include/GameClient/LookAtXlat.h | 25 +++++++++-- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 41 +++++++++++++++++++ .../GameClient/MessageStream/LookAtXlat.cpp | 40 +++++++++++++++--- .../Include/Common/UserPreferences.h | 4 ++ .../Include/GameClient/LookAtXlat.h | 25 +++++++++-- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 41 +++++++++++++++++++ .../GameClient/MessageStream/LookAtXlat.cpp | 40 +++++++++++++++--- 8 files changed, 200 insertions(+), 20 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/UserPreferences.h b/Generals/Code/GameEngine/Include/Common/UserPreferences.h index 22c6cdbc35f..35393244ba2 100644 --- a/Generals/Code/GameEngine/Include/Common/UserPreferences.h +++ b/Generals/Code/GameEngine/Include/Common/UserPreferences.h @@ -39,6 +39,7 @@ #include "Common/STLTypedefs.h" enum CursorCaptureMode CPP_11(: Int); +typedef UnsignedInt ScreenEdgeScrollMode; //----------------------------------------------------------------------------- // PUBLIC TYPES /////////////////////////////////////////////////////////////// @@ -95,6 +96,9 @@ class OptionPreferences : public UserPreferences Bool getDrawScrollAnchor(void); Bool getMoveScrollAnchor(void); CursorCaptureMode getCursorCaptureMode() const; + Bool getScreenEdgeScrollEnabledInWindowedApp() const; + Bool getScreenEdgeScrollEnabledInFullscreenApp() const; + ScreenEdgeScrollMode getScreenEdgeScrollMode() const; Bool getSendDelay(void); // convenience function Int getFirewallBehavior(void); // convenience function Short getFirewallPortAllocationDelta(void); // convenience function diff --git a/Generals/Code/GameEngine/Include/GameClient/LookAtXlat.h b/Generals/Code/GameEngine/Include/GameClient/LookAtXlat.h index 4b4ec7fd644..6cafbab541f 100644 --- a/Generals/Code/GameEngine/Include/GameClient/LookAtXlat.h +++ b/Generals/Code/GameEngine/Include/GameClient/LookAtXlat.h @@ -32,16 +32,30 @@ #include "GameClient/InGameUI.h" +//----------------------------------------------------------------------------- +// TheSuperHackers @feature The Screen Edge Scrolling can now be enabled or +// disabled depending on the App being Windowed or Fullscreen. +typedef UnsignedInt ScreenEdgeScrollMode; +enum ScreenEdgeScrollMode_ CPP_11(: ScreenEdgeScrollMode) +{ + ScreenEdgeScrollMode_EnabledInWindowedApp = 1<<0, // Scroll when touching the edge while the app is windowed + ScreenEdgeScrollMode_EnabledInFullscreenApp = 1<<1, // Scroll when touching the edge while the app is fullscreen + + ScreenEdgeScrollMode_Default = ScreenEdgeScrollMode_EnabledInFullscreenApp, // Default based on original game behavior +}; + //----------------------------------------------------------------------------- class LookAtTranslator : public GameMessageTranslator { public: LookAtTranslator(); ~LookAtTranslator(); + virtual GameMessageDisposition translateGameMessage(const GameMessage *msg); virtual const ICoord2D* getRMBScrollAnchor(void); // get m_anchor ICoord2D if we're RMB scrolling Bool hasMouseMovedRecently( void ); void setCurrentPos( const ICoord2D& pos ); + void setScreenEdgeScrollMode(ScreenEdgeScrollMode mode); void resetModes(); //Used when disabling input, so when we reenable it we aren't stuck in a mode. @@ -50,7 +64,7 @@ class LookAtTranslator : public GameMessageTranslator { MAX_VIEW_LOCS = 8 }; - enum + enum ScrollType { SCROLL_NONE = 0, SCROLL_RMB, @@ -67,10 +81,13 @@ class LookAtTranslator : public GameMessageTranslator UnsignedInt m_timestamp; // set when button goes down DrawableID m_lastPlaneID; ViewLocation m_viewLocation[ MAX_VIEW_LOCS ]; - Int m_scrollType; - void setScrolling( Int ); - void stopScrolling( void ); + ScrollType m_scrollType; + ScreenEdgeScrollMode m_screenEdgeScrollMode; UnsignedInt m_lastMouseMoveFrame; + + void setScrolling( ScrollType scrollType ); + void stopScrolling( void ); + Bool canScrollAtScreenEdge() const; }; extern LookAtTranslator *TheLookAtTranslator; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index b6d74b6f24e..c46a4967ad6 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -44,6 +44,7 @@ #include "GameClient/ClientInstance.h" #include "GameClient/GameClient.h" #include "GameClient/InGameUI.h" +#include "GameClient/LookAtXlat.h" #include "GameClient/WindowLayout.h" #include "GameClient/Gadget.h" #include "GameClient/GadgetCheckBox.h" @@ -390,6 +391,38 @@ CursorCaptureMode OptionPreferences::getCursorCaptureMode() const return mode; } +Bool OptionPreferences::getScreenEdgeScrollEnabledInWindowedApp() const +{ + OptionPreferences::const_iterator it = find("ScreenEdgeScrollEnabledInWindowedApp"); + if (it == end()) + return (ScreenEdgeScrollMode_Default & ScreenEdgeScrollMode_EnabledInWindowedApp) != 0; + + if (stricmp(it->second.str(), "yes") == 0) + return TRUE; + + return FALSE; +} + +Bool OptionPreferences::getScreenEdgeScrollEnabledInFullscreenApp() const +{ + OptionPreferences::const_iterator it = find("ScreenEdgeScrollEnabledInFullscreenApp"); + if (it == end()) + return (ScreenEdgeScrollMode_Default & ScreenEdgeScrollMode_EnabledInFullscreenApp) != 0; + + if (stricmp(it->second.str(), "yes") == 0) + return TRUE; + + return FALSE; +} + +ScreenEdgeScrollMode OptionPreferences::getScreenEdgeScrollMode() const +{ + ScreenEdgeScrollMode mode = 0; + mode |= getScreenEdgeScrollEnabledInWindowedApp() ? ScreenEdgeScrollMode_EnabledInWindowedApp : 0; + mode |= getScreenEdgeScrollEnabledInFullscreenApp() ? ScreenEdgeScrollMode_EnabledInFullscreenApp : 0; + return mode; +} + Bool OptionPreferences::usesSystemMapDir(void) { OptionPreferences::const_iterator it = find("UseSystemMapDir"); @@ -1191,6 +1224,14 @@ static void saveOptions( void ) TheMouse->setCursorCaptureMode(mode); } + // TheSuperHackers @todo Add combo box ? + { + ScreenEdgeScrollMode mode = pref->getScreenEdgeScrollMode(); + (*pref)["ScreenEdgeScrollEnabledInWindowedApp"] = (mode & ScreenEdgeScrollMode_EnabledInWindowedApp) ? "yes" : "no"; + (*pref)["ScreenEdgeScrollEnabledInFullscreenApp"] = (mode & ScreenEdgeScrollMode_EnabledInFullscreenApp) ? "yes" : "no"; + TheLookAtTranslator->setScreenEdgeScrollMode(mode); + } + //------------------------------------------------------------------------------------------------- // scroll speed val val = GadgetSliderGetPosition(sliderScrollSpeed); diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index 6a7235583fb..d2e09ed4353 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -35,6 +35,7 @@ #include "Common/PlayerList.h" #include "Common/Recorder.h" #include "Common/StatsCollector.h" +#include "Common/UserPreferences.h" #include "GameLogic/Object.h" #include "GameLogic/PartitionManager.h" #include "GameClient/Display.h" @@ -80,7 +81,7 @@ static const Int edgeScrollSize = 3; static Mouse::MouseCursor prevCursor = Mouse::ARROW; //----------------------------------------------------------------------------- -void LookAtTranslator::setScrolling(Int x) +void LookAtTranslator::setScrolling(ScrollType scrollType) { if (!TheInGameUI->getInputEnabled()) return; @@ -89,7 +90,7 @@ void LookAtTranslator::setScrolling(Int x) m_isScrolling = true; TheInGameUI->setScrolling( TRUE ); TheTacticalView->setMouseLock( TRUE ); - m_scrollType = x; + m_scrollType = scrollType; if(TheStatsCollector) TheStatsCollector->startScrollTime(); } @@ -103,12 +104,32 @@ void LookAtTranslator::stopScrolling( void ) TheMouse->setCursor(prevCursor); m_scrollType = SCROLL_NONE; - // if we have a stats collectore increment the stats + // increment the stats if we have a stats collector if(TheStatsCollector) TheStatsCollector->endScrollTime(); } +//----------------------------------------------------------------------------- +Bool LookAtTranslator::canScrollAtScreenEdge() const +{ + if (!TheMouse->isCursorCaptured()) + return false; + + if (TheDisplay->getWindowed()) + { + if ((m_screenEdgeScrollMode & ScreenEdgeScrollMode_EnabledInWindowedApp) == 0) + return false; + } + else + { + if ((m_screenEdgeScrollMode & ScreenEdgeScrollMode_EnabledInFullscreenApp) == 0) + return false; + } + + return true; +} + //----------------------------------------------------------------------------- LookAtTranslator::LookAtTranslator() : m_isScrolling(false), @@ -121,12 +142,15 @@ LookAtTranslator::LookAtTranslator() : m_scrollType(SCROLL_NONE) { //Added By Sadullah Nader - //Initializations misssing and needed + //Initializations missing and needed m_anchor.x = m_anchor.y = 0; m_currentPos.x = m_currentPos.y = 0; m_originalAnchor.x = m_originalAnchor.y = 0; // + OptionPreferences prefs; + m_screenEdgeScrollMode = prefs.getScreenEdgeScrollMode(); + DEBUG_ASSERTCRASH(!TheLookAtTranslator, ("Already have a LookAtTranslator - why do you need two?")); TheLookAtTranslator = this; } @@ -163,6 +187,11 @@ void LookAtTranslator::setCurrentPos( const ICoord2D& pos ) m_currentPos = pos; } +void LookAtTranslator::setScreenEdgeScrollMode(ScreenEdgeScrollMode mode) +{ + m_screenEdgeScrollMode = mode; +} + //----------------------------------------------------------------------------- /** * The LookAt Translator is responsible for camera movements. It is directly responsible for @@ -308,8 +337,7 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage break; } - // TheSuperHackers @tweak Ayumi/xezon 26/07/2025 Enables edge scrolling in windowed mode. - if (TheMouse->isCursorCaptured()) + if (canScrollAtScreenEdge()) { if (m_isScrolling) { diff --git a/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h b/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h index ac2c7e8cbaf..7003107e15c 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h @@ -40,6 +40,7 @@ class Money; enum CursorCaptureMode CPP_11(: Int); +typedef UnsignedInt ScreenEdgeScrollMode; //----------------------------------------------------------------------------- // PUBLIC TYPES /////////////////////////////////////////////////////////////// @@ -98,6 +99,9 @@ class OptionPreferences : public UserPreferences Bool getDrawScrollAnchor(void); Bool getMoveScrollAnchor(void); CursorCaptureMode getCursorCaptureMode() const; + Bool getScreenEdgeScrollEnabledInWindowedApp() const; + Bool getScreenEdgeScrollEnabledInFullscreenApp() const; + ScreenEdgeScrollMode getScreenEdgeScrollMode() const; Bool getSendDelay(void); // convenience function Int getFirewallBehavior(void); // convenience function Short getFirewallPortAllocationDelta(void); // convenience function diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/LookAtXlat.h b/GeneralsMD/Code/GameEngine/Include/GameClient/LookAtXlat.h index d23c58aa8e3..6f9611154f6 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/LookAtXlat.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/LookAtXlat.h @@ -32,16 +32,30 @@ #include "GameClient/InGameUI.h" +//----------------------------------------------------------------------------- +// TheSuperHackers @feature The Screen Edge Scrolling can now be enabled or +// disabled depending on the App being Windowed or Fullscreen. +typedef UnsignedInt ScreenEdgeScrollMode; +enum ScreenEdgeScrollMode_ CPP_11(: ScreenEdgeScrollMode) +{ + ScreenEdgeScrollMode_EnabledInWindowedApp = 1<<0, // Scroll when touching the edge while the app is windowed + ScreenEdgeScrollMode_EnabledInFullscreenApp = 1<<1, // Scroll when touching the edge while the app is fullscreen + + ScreenEdgeScrollMode_Default = ScreenEdgeScrollMode_EnabledInFullscreenApp, // Default based on original game behavior +}; + //----------------------------------------------------------------------------- class LookAtTranslator : public GameMessageTranslator { public: LookAtTranslator(); ~LookAtTranslator(); + virtual GameMessageDisposition translateGameMessage(const GameMessage *msg); virtual const ICoord2D* getRMBScrollAnchor(void); // get m_anchor ICoord2D if we're RMB scrolling Bool hasMouseMovedRecently( void ); void setCurrentPos( const ICoord2D& pos ); + void setScreenEdgeScrollMode(ScreenEdgeScrollMode mode); void resetModes(); //Used when disabling input, so when we reenable it we aren't stuck in a mode. @@ -50,7 +64,7 @@ class LookAtTranslator : public GameMessageTranslator { MAX_VIEW_LOCS = 8 }; - enum + enum ScrollType { SCROLL_NONE = 0, SCROLL_RMB, @@ -67,10 +81,13 @@ class LookAtTranslator : public GameMessageTranslator UnsignedInt m_timestamp; // set when button goes down DrawableID m_lastPlaneID; ViewLocation m_viewLocation[ MAX_VIEW_LOCS ]; - Int m_scrollType; - void setScrolling( Int ); - void stopScrolling( void ); + ScrollType m_scrollType; + ScreenEdgeScrollMode m_screenEdgeScrollMode; UnsignedInt m_lastMouseMoveFrame; + + void setScrolling( ScrollType scrollType ); + void stopScrolling( void ); + Bool canScrollAtScreenEdge() const; }; extern LookAtTranslator *TheLookAtTranslator; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index b671e5c5fea..f7e96138bc9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -44,6 +44,7 @@ #include "GameClient/ClientInstance.h" #include "GameClient/GameClient.h" #include "GameClient/InGameUI.h" +#include "GameClient/LookAtXlat.h" #include "GameClient/WindowLayout.h" #include "GameClient/Gadget.h" #include "GameClient/GadgetCheckBox.h" @@ -422,6 +423,38 @@ CursorCaptureMode OptionPreferences::getCursorCaptureMode() const return mode; } +Bool OptionPreferences::getScreenEdgeScrollEnabledInWindowedApp() const +{ + OptionPreferences::const_iterator it = find("ScreenEdgeScrollEnabledInWindowedApp"); + if (it == end()) + return (ScreenEdgeScrollMode_Default & ScreenEdgeScrollMode_EnabledInWindowedApp) != 0; + + if (stricmp(it->second.str(), "yes") == 0) + return TRUE; + + return FALSE; +} + +Bool OptionPreferences::getScreenEdgeScrollEnabledInFullscreenApp() const +{ + OptionPreferences::const_iterator it = find("ScreenEdgeScrollEnabledInFullscreenApp"); + if (it == end()) + return (ScreenEdgeScrollMode_Default & ScreenEdgeScrollMode_EnabledInFullscreenApp) != 0; + + if (stricmp(it->second.str(), "yes") == 0) + return TRUE; + + return FALSE; +} + +ScreenEdgeScrollMode OptionPreferences::getScreenEdgeScrollMode() const +{ + ScreenEdgeScrollMode mode = 0; + mode |= getScreenEdgeScrollEnabledInWindowedApp() ? ScreenEdgeScrollMode_EnabledInWindowedApp : 0; + mode |= getScreenEdgeScrollEnabledInFullscreenApp() ? ScreenEdgeScrollMode_EnabledInFullscreenApp : 0; + return mode; +} + Bool OptionPreferences::usesSystemMapDir(void) { OptionPreferences::const_iterator it = find("UseSystemMapDir"); @@ -1251,6 +1284,14 @@ static void saveOptions( void ) TheMouse->setCursorCaptureMode(mode); } + // TheSuperHackers @todo Add combo box ? + { + ScreenEdgeScrollMode mode = pref->getScreenEdgeScrollMode(); + (*pref)["ScreenEdgeScrollEnabledInWindowedApp"] = (mode & ScreenEdgeScrollMode_EnabledInWindowedApp) ? "yes" : "no"; + (*pref)["ScreenEdgeScrollEnabledInFullscreenApp"] = (mode & ScreenEdgeScrollMode_EnabledInFullscreenApp) ? "yes" : "no"; + TheLookAtTranslator->setScreenEdgeScrollMode(mode); + } + //------------------------------------------------------------------------------------------------- // scroll speed val val = GadgetSliderGetPosition(sliderScrollSpeed); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index 762d617e914..c106cdddf8a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -35,6 +35,7 @@ #include "Common/PlayerList.h" #include "Common/Recorder.h" #include "Common/StatsCollector.h" +#include "Common/UserPreferences.h" #include "GameLogic/Object.h" #include "GameLogic/PartitionManager.h" #include "GameClient/Display.h" @@ -80,7 +81,7 @@ static const Int edgeScrollSize = 3; static Mouse::MouseCursor prevCursor = Mouse::ARROW; //----------------------------------------------------------------------------- -void LookAtTranslator::setScrolling(Int x) +void LookAtTranslator::setScrolling(ScrollType scrollType) { if (!TheInGameUI->getInputEnabled()) return; @@ -89,7 +90,7 @@ void LookAtTranslator::setScrolling(Int x) m_isScrolling = true; TheInGameUI->setScrolling( TRUE ); TheTacticalView->setMouseLock( TRUE ); - m_scrollType = x; + m_scrollType = scrollType; if(TheStatsCollector) TheStatsCollector->startScrollTime(); } @@ -103,12 +104,32 @@ void LookAtTranslator::stopScrolling( void ) TheMouse->setCursor(prevCursor); m_scrollType = SCROLL_NONE; - // if we have a stats collectore increment the stats + // increment the stats if we have a stats collector if(TheStatsCollector) TheStatsCollector->endScrollTime(); } +//----------------------------------------------------------------------------- +Bool LookAtTranslator::canScrollAtScreenEdge() const +{ + if (!TheMouse->isCursorCaptured()) + return false; + + if (TheDisplay->getWindowed()) + { + if ((m_screenEdgeScrollMode & ScreenEdgeScrollMode_EnabledInWindowedApp) == 0) + return false; + } + else + { + if ((m_screenEdgeScrollMode & ScreenEdgeScrollMode_EnabledInFullscreenApp) == 0) + return false; + } + + return true; +} + //----------------------------------------------------------------------------- LookAtTranslator::LookAtTranslator() : m_isScrolling(false), @@ -121,12 +142,15 @@ LookAtTranslator::LookAtTranslator() : m_scrollType(SCROLL_NONE) { //Added By Sadullah Nader - //Initializations misssing and needed + //Initializations missing and needed m_anchor.x = m_anchor.y = 0; m_currentPos.x = m_currentPos.y = 0; m_originalAnchor.x = m_originalAnchor.y = 0; // + OptionPreferences prefs; + m_screenEdgeScrollMode = prefs.getScreenEdgeScrollMode(); + DEBUG_ASSERTCRASH(!TheLookAtTranslator, ("Already have a LookAtTranslator - why do you need two?")); TheLookAtTranslator = this; } @@ -163,6 +187,11 @@ void LookAtTranslator::setCurrentPos( const ICoord2D& pos ) m_currentPos = pos; } +void LookAtTranslator::setScreenEdgeScrollMode(ScreenEdgeScrollMode mode) +{ + m_screenEdgeScrollMode = mode; +} + //----------------------------------------------------------------------------- /** * The LookAt Translator is responsible for camera movements. It is directly responsible for @@ -307,8 +336,7 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage break; } - // TheSuperHackers @tweak Ayumi/xezon 26/07/2025 Enables edge scrolling in windowed mode. - if (TheMouse->isCursorCaptured()) + if (canScrollAtScreenEdge()) { if (m_isScrolling) { From 40ac1c0fc277ebc636c85019b1d58c121e901708 Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Fri, 12 Sep 2025 07:10:40 +0100 Subject: [PATCH 059/343] feat(gui): Add user option to adjust scale of game fonts in relation to resolution (#1457) Adds new option ResolutionFontAdjustment=0..100 to Options.ini --- .../Include/Common/UserPreferences.h | 2 ++ .../Include/GameClient/GlobalLanguage.h | 2 ++ .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 26 +++++++++++++++++++ .../Source/GameClient/GlobalLanguage.cpp | 19 ++++++++++++-- .../Include/Common/UserPreferences.h | 2 ++ .../Include/GameClient/GlobalLanguage.h | 2 ++ .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 26 +++++++++++++++++++ .../Source/GameClient/GlobalLanguage.cpp | 19 ++++++++++++-- 8 files changed, 94 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/UserPreferences.h b/Generals/Code/GameEngine/Include/Common/UserPreferences.h index 35393244ba2..5f1b033aed8 100644 --- a/Generals/Code/GameEngine/Include/Common/UserPreferences.h +++ b/Generals/Code/GameEngine/Include/Common/UserPreferences.h @@ -137,6 +137,8 @@ class OptionPreferences : public UserPreferences Int getSystemTimeFontSize(void); Int getGameTimeFontSize(void); + + Real getResolutionFontAdjustment(void); }; //----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameClient/GlobalLanguage.h b/Generals/Code/GameEngine/Include/GameClient/GlobalLanguage.h index 6ffd8bb0504..2f7d1557de3 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GlobalLanguage.h +++ b/Generals/Code/GameEngine/Include/GameClient/GlobalLanguage.h @@ -100,9 +100,11 @@ class GlobalLanguage : public SubsystemInterface FontDesc m_creditsNormalFont; Real m_resolutionFontSizeAdjustment; + Real m_userResolutionFontSizeAdjustment; //UnicodeString m_unicodeFontNameUStr; + float getResolutionFontSizeAdjustment() const; Int adjustFontSize(Int theFontSize); // Adjusts font size for resolution. jba. typedef std::list StringList; // Used for our font file names that we want to load diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index c46a4967ad6..6a6551d017b 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -63,6 +63,7 @@ #include "GameClient/IMEManager.h" #include "GameClient/ShellHooks.h" #include "GameClient/GUICallbacks.h" +#include "GameClient/GlobalLanguage.h" #include "GameNetwork/FirewallHelper.h" #include "GameNetwork/IPEnumeration.h" #include "GameNetwork/GameSpyOverlay.h" @@ -843,6 +844,20 @@ Int OptionPreferences::getGameTimeFontSize(void) return fontSize; } +Real OptionPreferences::getResolutionFontAdjustment(void) +{ + OptionPreferences::const_iterator it = find("ResolutionFontAdjustment"); + if (it == end()) + return -1.0f; + + Real fontScale = (Real)atof(it->second.str()) / 100.0f; + if (fontScale < 0.0f) + { + fontScale = -1.0f; + } + return fontScale; +} + static OptionPreferences *pref = NULL; static void setDefaults( void ) @@ -1379,6 +1394,17 @@ static void saveOptions( void ) TheInGameUI->refreshGameTimeResources(); } + //------------------------------------------------------------------------------------------------- + // Set User Font Scaling Percentage + val = pref->getResolutionFontAdjustment() * 100.0f; // TheSuperHackers @todo replace with options input when applicable + if (val >= 0 || val == -100) + { + AsciiString prefString; + prefString.format("%d", REAL_TO_INT( val ) ); + (*pref)["ResolutionFontAdjustment"] = prefString; + TheGlobalLanguageData->m_userResolutionFontSizeAdjustment = (Real)val / 100.0f; + } + //------------------------------------------------------------------------------------------------- // Resolution // diff --git a/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp b/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp index 4d6a665c1c3..df1d56d88d6 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp @@ -54,8 +54,10 @@ #include "Common/INI.h" #include "Common/Registry.h" -#include "GameClient/GlobalLanguage.h" #include "Common/FileSystem.h" +#include "Common/UserPreferences.h" + +#include "GameClient/GlobalLanguage.h" //----------------------------------------------------------------------------- // DEFINES //////////////////////////////////////////////////////////////////// @@ -117,6 +119,8 @@ GlobalLanguage::GlobalLanguage() m_useHardWrap = FALSE; m_resolutionFontSizeAdjustment = 0.7f; //End Add + + m_userResolutionFontSizeAdjustment = -1.0f; } GlobalLanguage::~GlobalLanguage() @@ -156,6 +160,9 @@ void GlobalLanguage::init( void ) ++it; } + // override values with user preferences + OptionPreferences optionPref; + m_userResolutionFontSizeAdjustment = optionPref.getResolutionFontAdjustment(); } void GlobalLanguage::reset( void ) {} @@ -176,10 +183,18 @@ void GlobalLanguage::parseFontFileName( INI *ini, void * instance, void *store, monkey->m_localFonts.push_front(asciiString); } +float GlobalLanguage::getResolutionFontSizeAdjustment( void ) const +{ + if (m_userResolutionFontSizeAdjustment >= 0.0f) + return m_userResolutionFontSizeAdjustment; + else + return m_resolutionFontSizeAdjustment; +} + Int GlobalLanguage::adjustFontSize(Int theFontSize) { Real adjustFactor = TheGlobalData->m_xResolution / (Real)DEFAULT_DISPLAY_WIDTH; - adjustFactor = 1.0f + (adjustFactor-1.0f) * m_resolutionFontSizeAdjustment; + adjustFactor = 1.0f + (adjustFactor-1.0f) * getResolutionFontSizeAdjustment(); if (adjustFactor<1.0f) adjustFactor = 1.0f; if (adjustFactor>2.0f) adjustFactor = 2.0f; Int pointSize = REAL_TO_INT_FLOOR(theFontSize*adjustFactor); diff --git a/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h b/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h index 7003107e15c..369d16f6277 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h @@ -141,6 +141,8 @@ class OptionPreferences : public UserPreferences Int getSystemTimeFontSize(void); Int getGameTimeFontSize(void); + + Real getResolutionFontAdjustment(void); }; //----------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GlobalLanguage.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GlobalLanguage.h index a8324393c91..d3a0a79d443 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GlobalLanguage.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GlobalLanguage.h @@ -101,9 +101,11 @@ class GlobalLanguage : public SubsystemInterface FontDesc m_creditsNormalFont; Real m_resolutionFontSizeAdjustment; + Real m_userResolutionFontSizeAdjustment; //UnicodeString m_unicodeFontNameUStr; + float getResolutionFontSizeAdjustment() const; Int adjustFontSize(Int theFontSize); // Adjusts font size for resolution. jba. typedef std::list StringList; // Used for our font file names that we want to load diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index f7e96138bc9..9c75900ab9b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -63,6 +63,7 @@ #include "GameClient/IMEManager.h" #include "GameClient/ShellHooks.h" #include "GameClient/GUICallbacks.h" +#include "GameClient/GlobalLanguage.h" #include "GameNetwork/FirewallHelper.h" #include "GameNetwork/IPEnumeration.h" #include "GameNetwork/GameSpyOverlay.h" @@ -887,6 +888,20 @@ Int OptionPreferences::getGameTimeFontSize(void) return fontSize; } +Real OptionPreferences::getResolutionFontAdjustment(void) +{ + OptionPreferences::const_iterator it = find("ResolutionFontAdjustment"); + if (it == end()) + return -1.0f; + + Real fontScale = (Real)atof(it->second.str()) / 100.0f; + if (fontScale < 0.0f) + { + fontScale = -1.0f; + } + return fontScale; +} + static OptionPreferences *pref = NULL; static void setDefaults( void ) @@ -1439,6 +1454,17 @@ static void saveOptions( void ) TheInGameUI->refreshGameTimeResources(); } + //------------------------------------------------------------------------------------------------- + // Set User Font Scaling Percentage + val = pref->getResolutionFontAdjustment() * 100.0f; // TheSuperHackers @todo replace with options input when applicable + if (val >= 0 || val == -100) + { + AsciiString prefString; + prefString.format("%d", REAL_TO_INT( val ) ); + (*pref)["ResolutionFontAdjustment"] = prefString; + TheGlobalLanguageData->m_userResolutionFontSizeAdjustment = (Real)val / 100.0f; + } + //------------------------------------------------------------------------------------------------- // Resolution // diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp index a1a24bd4e2c..e5b183298b2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp @@ -54,8 +54,10 @@ #include "Common/INI.h" #include "Common/Registry.h" -#include "GameClient/GlobalLanguage.h" #include "Common/FileSystem.h" +#include "Common/UserPreferences.h" + +#include "GameClient/GlobalLanguage.h" //----------------------------------------------------------------------------- // DEFINES //////////////////////////////////////////////////////////////////// @@ -119,6 +121,8 @@ GlobalLanguage::GlobalLanguage() m_resolutionFontSizeAdjustment = 0.7f; m_militaryCaptionDelayMS = 750; //End Add + + m_userResolutionFontSizeAdjustment = -1.0f; } GlobalLanguage::~GlobalLanguage() @@ -158,6 +162,9 @@ void GlobalLanguage::init( void ) ++it; } + // override values with user preferences + OptionPreferences optionPref; + m_userResolutionFontSizeAdjustment = optionPref.getResolutionFontAdjustment(); } void GlobalLanguage::reset( void ) {} @@ -178,10 +185,18 @@ void GlobalLanguage::parseFontFileName( INI *ini, void * instance, void *store, monkey->m_localFonts.push_front(asciiString); } +float GlobalLanguage::getResolutionFontSizeAdjustment( void ) const +{ + if (m_userResolutionFontSizeAdjustment >= 0.0f) + return m_userResolutionFontSizeAdjustment; + else + return m_resolutionFontSizeAdjustment; +} + Int GlobalLanguage::adjustFontSize(Int theFontSize) { Real adjustFactor = TheGlobalData->m_xResolution / (Real)DEFAULT_DISPLAY_WIDTH; - adjustFactor = 1.0f + (adjustFactor-1.0f) * m_resolutionFontSizeAdjustment; + adjustFactor = 1.0f + (adjustFactor-1.0f) * getResolutionFontSizeAdjustment(); if (adjustFactor<1.0f) adjustFactor = 1.0f; if (adjustFactor>2.0f) adjustFactor = 2.0f; Int pointSize = REAL_TO_INT_FLOOR(theFontSize*adjustFactor); From 95ac37d5de59a23ef9ed00688bb9e6293294624c Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 12 Sep 2025 09:09:14 +0200 Subject: [PATCH 060/343] feat(input): Implement alternative key mappings for Game Pause and Step Frame that are usable as a Solo player (#1530) The new default key mappings are SHIFT+P to Pause and SHIFT+O to Step Frame when playing --- Core/GameEngine/CMakeLists.txt | 2 + Core/GameEngine/Include/Common/GameUtility.h | 28 +++++++ Core/GameEngine/Source/Common/GameUtility.cpp | 42 ++++++++++ .../GameEngine/Include/Common/MessageStream.h | 6 +- .../GameEngine/Include/GameClient/MetaEvent.h | 8 +- .../Source/Common/MessageStream.cpp | 2 + .../GameClient/MessageStream/CommandXlat.cpp | 12 +-- .../GameClient/MessageStream/MetaEvent.cpp | 76 ++++++++++++----- .../GameEngine/Include/Common/MessageStream.h | 6 +- .../GameEngine/Include/GameClient/MetaEvent.h | 8 +- .../Source/Common/MessageStream.cpp | 2 + .../GameClient/MessageStream/CommandXlat.cpp | 12 +-- .../GameClient/MessageStream/MetaEvent.cpp | 84 +++++++++++++------ 13 files changed, 220 insertions(+), 68 deletions(-) create mode 100644 Core/GameEngine/Include/Common/GameUtility.h create mode 100644 Core/GameEngine/Source/Common/GameUtility.cpp diff --git a/Core/GameEngine/CMakeLists.txt b/Core/GameEngine/CMakeLists.txt index ceb87625573..f713e0a0ab5 100644 --- a/Core/GameEngine/CMakeLists.txt +++ b/Core/GameEngine/CMakeLists.txt @@ -53,6 +53,7 @@ set(GAMEENGINE_SRC # Include/Common/GameState.h # Include/Common/GameStateMap.h # Include/Common/GameType.h + Include/Common/GameUtility.h # Include/Common/Geometry.h # Include/Common/GlobalData.h # Include/Common/Handicap.h @@ -574,6 +575,7 @@ set(GAMEENGINE_SRC # Source/Common/GameEngine.cpp # Source/Common/GameLOD.cpp # Source/Common/GameMain.cpp + Source/Common/GameUtility.cpp # Source/Common/GlobalData.cpp # Source/Common/INI/INI.cpp # Source/Common/INI/INIAiData.cpp diff --git a/Core/GameEngine/Include/Common/GameUtility.h b/Core/GameEngine/Include/Common/GameUtility.h new file mode 100644 index 00000000000..8d5f979cf5f --- /dev/null +++ b/Core/GameEngine/Include/Common/GameUtility.h @@ -0,0 +1,28 @@ +/* +** Command & Conquer Generals Zero Hour(tm) +** Copyright 2025 TheSuperHackers +** +** This program is free software: you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation, either version 3 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program. If not, see . +*/ + +#pragma once + +// For miscellaneous game utility functions. + +namespace rts +{ + +Bool localPlayerIsObserving(); + +} // namespace rts diff --git a/Core/GameEngine/Source/Common/GameUtility.cpp b/Core/GameEngine/Source/Common/GameUtility.cpp new file mode 100644 index 00000000000..8fff8622f84 --- /dev/null +++ b/Core/GameEngine/Source/Common/GameUtility.cpp @@ -0,0 +1,42 @@ +/* +** Command & Conquer Generals Zero Hour(tm) +** Copyright 2025 TheSuperHackers +** +** This program is free software: you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation, either version 3 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program. If not, see . +*/ + +#include "PreRTS.h" + +#include "Common/GameUtility.h" +#include "Common/PlayerList.h" +#include "Common/Player.h" + +#include "GameLogic/GameLogic.h" + + +namespace rts +{ + +Bool localPlayerIsObserving() +{ + if (TheGameLogic->isInReplayGame() || TheGameLogic->isInShellGame()) + return true; + + if (ThePlayerList->getLocalPlayer()->isPlayerObserver()) + return true; + + return false; +} + +} // namespace rts diff --git a/Generals/Code/GameEngine/Include/Common/MessageStream.h b/Generals/Code/GameEngine/Include/Common/MessageStream.h index 31bb277da9f..6b70355b192 100644 --- a/Generals/Code/GameEngine/Include/Common/MessageStream.h +++ b/Generals/Code/GameEngine/Include/Common/MessageStream.h @@ -273,8 +273,10 @@ class GameMessage : public MemoryPoolObject MSG_META_END_CAMERA_ZOOM_OUT, MSG_META_CAMERA_RESET, MSG_META_TOGGLE_FAST_FORWARD_REPLAY, ///< Toggle the fast forward feature - MSG_META_TOGGLE_PAUSE, ///< TheSuperHackers @feature Toggle game pause (in replay playbacks) - MSG_META_STEP_FRAME, ///< TheSuperHackers @feature Step one frame (in replay playbacks) + MSG_META_TOGGLE_PAUSE, ///< TheSuperHackers @feature Toggle game pause + MSG_META_TOGGLE_PAUSE_ALT, ///< TheSuperHackers @feature Toggle game pause (alternative mapping) + MSG_META_STEP_FRAME, ///< TheSuperHackers @feature Step one frame + MSG_META_STEP_FRAME_ALT, ///< TheSuperHackers @feature Step one frame (alternative mapping) // META items that are really for debug/demo/development use only... diff --git a/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h b/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h index a1c77fa8b53..39f6eb7a982 100644 --- a/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h +++ b/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h @@ -314,16 +314,18 @@ enum CommandUsableInType CPP_11(: Int) { COMMANDUSABLE_NONE = 0, - COMMANDUSABLE_SHELL = (1 << 0), - COMMANDUSABLE_GAME = (1 << 1), + COMMANDUSABLE_SHELL = (1 << 0), // Command is usable when in Shell (Menus) + COMMANDUSABLE_GAME = (1 << 1), // Command is usable when not in Shell + COMMANDUSABLE_OBSERVER = (1 << 2), // TheSuperHackers @feature Command is usable when observing - COMMANDUSABLE_EVERYWHERE = COMMANDUSABLE_SHELL | COMMANDUSABLE_GAME, + COMMANDUSABLE_EVERYWHERE = ~0, }; static const char* TheCommandUsableInNames[] = { "SHELL", "GAME", + "OBSERVER", NULL }; diff --git a/Generals/Code/GameEngine/Source/Common/MessageStream.cpp b/Generals/Code/GameEngine/Source/Common/MessageStream.cpp index 2c19ec353d2..7a157439502 100644 --- a/Generals/Code/GameEngine/Source/Common/MessageStream.cpp +++ b/Generals/Code/GameEngine/Source/Common/MessageStream.cpp @@ -376,7 +376,9 @@ const char *GameMessage::getCommandTypeAsString(GameMessage::Type t) CASE_LABEL(MSG_META_CAMERA_RESET) CASE_LABEL(MSG_META_TOGGLE_FAST_FORWARD_REPLAY) CASE_LABEL(MSG_META_TOGGLE_PAUSE) + CASE_LABEL(MSG_META_TOGGLE_PAUSE_ALT) CASE_LABEL(MSG_META_STEP_FRAME) + CASE_LABEL(MSG_META_STEP_FRAME_ALT) #if defined(RTS_DEBUG) CASE_LABEL(MSG_META_DEMO_TOGGLE_BEHIND_BUILDINGS) diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 978e76218df..9c99592527f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -3302,10 +3302,9 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } case GameMessage::MSG_META_TOGGLE_PAUSE: + case GameMessage::MSG_META_TOGGLE_PAUSE_ALT: { -#if !defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)//may be defined in GameCommon.h - if (TheGameLogic->isInReplayGame()) -#endif + if (!TheGameLogic->isInMultiplayerGame()) { if (TheGameLogic->isGamePaused()) { @@ -3318,17 +3317,18 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage Bool pauseInput = FALSE; TheGameLogic->setGamePaused(pause, pauseMusic, pauseInput); } + disp = DESTROY_MESSAGE; } break; } case GameMessage::MSG_META_STEP_FRAME: + case GameMessage::MSG_META_STEP_FRAME_ALT: { -#if !defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)//may be defined in GameCommon.h - if (TheGameLogic->isInReplayGame()) -#endif + if (!TheGameLogic->isInMultiplayerGame()) { TheGameLogic->setGamePaused(FALSE); TheGameLogic->setGamePausedInFrame(TheGameLogic->getFrame() + 1, TRUE); + disp = DESTROY_MESSAGE; } break; } diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp index 9eb6e1f18ec..bf2093d78ee 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp @@ -30,6 +30,7 @@ // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine +#include "Common/GameUtility.h" #include "Common/INI.h" #include "Common/MessageStream.h" #include "Common/Player.h" @@ -174,7 +175,9 @@ static const LookupListRec GameMessageMetaTypeNames[] = { "CAMERA_RESET", GameMessage::MSG_META_CAMERA_RESET }, { "TOGGLE_FAST_FORWARD_REPLAY", GameMessage::MSG_META_TOGGLE_FAST_FORWARD_REPLAY }, { "TOGGLE_PAUSE", GameMessage::MSG_META_TOGGLE_PAUSE }, + { "TOGGLE_PAUSE_ALT", GameMessage::MSG_META_TOGGLE_PAUSE_ALT }, { "STEP_FRAME", GameMessage::MSG_META_STEP_FRAME }, + { "STEP_FRAME_ALT", GameMessage::MSG_META_STEP_FRAME_ALT }, #if defined(RTS_DEBUG) { "HELP", GameMessage::MSG_META_HELP }, @@ -362,6 +365,33 @@ static const char * findGameMessageNameByType(GameMessage::Type type) return "???"; } +//------------------------------------------------------------------------------------------------- +static Bool isMessageUsable(CommandUsableInType usableIn) +{ + // We will ignore all commands if the game client has not yet incremented to frame 1. + // It prevents the user from doing commands during a map load, which throws the input + // system into whack because there isn't a client frame for the input event, and in + // the case of a command that pauses the game, like the quit menu, the client frame + // will never get beyond 0 and we lose the ability to process any input. + if (TheGameClient->getFrame() == 0) + return false; + + const Bool usableInShell = (usableIn & COMMANDUSABLE_SHELL); + const Bool usableInGame = (usableIn & COMMANDUSABLE_GAME); + const Bool usableAsObserver = (usableIn & COMMANDUSABLE_OBSERVER); + + if (usableInShell && TheShell && TheShell->isShellActive()) + return true; + + if (usableInGame && (!TheShell || !TheShell->isShellActive())) + return true; + + if (usableAsObserver && rts::localPlayerIsObserving()) + return true; + + return false; +} + //------------------------------------------------------------------------------------------------- GameMessageDisposition MetaEventTranslator::translateGameMessage(const GameMessage *msg) { @@ -397,23 +427,7 @@ GameMessageDisposition MetaEventTranslator::translateGameMessage(const GameMessa DEBUG_ASSERTCRASH(map->m_meta > GameMessage::MSG_BEGIN_META_MESSAGES && map->m_meta < GameMessage::MSG_END_META_MESSAGES, ("hmm, expected only meta-msgs here")); - // - // if this command is *only* usable in the game, we will ignore it if the game client - // has not yet incremented to frame 1 (keeps us from doing in-game commands during - // a map load, which throws the input system into wack because there isn't a - // client frame for the input event, and in the case of a command that pauses the - // game, like the quit menu, the client frame will never get beyond 0 and we - // lose the ability to process any input - // - if( map->m_usableIn == COMMANDUSABLE_GAME && TheGameClient->getFrame() < 1 ) - continue; - - // if the shell is active, and this command is not usable in shell, continue - if (TheShell && TheShell->isShellActive() && !(map->m_usableIn & COMMANDUSABLE_SHELL) ) - continue; - - // if the shell is not active and this command is not usable in the game, continue - if (TheShell && !TheShell->isShellActive() && !(map->m_usableIn & COMMANDUSABLE_GAME) ) + if (!isMessageUsable(map->m_usableIn)) continue; // check for the special case of mods-only-changed. @@ -719,7 +733,7 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t) map->m_key = MK_F; map->m_transition = DOWN; map->m_modState = NONE; - map->m_usableIn = COMMANDUSABLE_GAME; + map->m_usableIn = COMMANDUSABLE_GAME; // @todo COMMANDUSABLE_OBSERVER } } { @@ -730,7 +744,18 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t) map->m_key = MK_P; map->m_transition = DOWN; map->m_modState = NONE; - map->m_usableIn = COMMANDUSABLE_GAME; + map->m_usableIn = COMMANDUSABLE_OBSERVER; + } + } + { + // Is useful for Generals and Zero Hour. + MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_TOGGLE_PAUSE_ALT); + if (map->m_key == MK_NONE) + { + map->m_key = MK_P; + map->m_transition = DOWN; + map->m_modState = SHIFT; // Requires modifier to avoid key conflicts as a player. + map->m_usableIn = COMMANDUSABLE_EVERYWHERE; } } { @@ -741,7 +766,18 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t) map->m_key = MK_O; map->m_transition = DOWN; map->m_modState = NONE; - map->m_usableIn = COMMANDUSABLE_GAME; + map->m_usableIn = COMMANDUSABLE_OBSERVER; + } + } + { + // Is useful for Generals and Zero Hour. + MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_STEP_FRAME_ALT); + if (map->m_key == MK_NONE) + { + map->m_key = MK_O; + map->m_transition = DOWN; + map->m_modState = SHIFT; // Requires modifier to avoid key conflicts as a player. + map->m_usableIn = COMMANDUSABLE_EVERYWHERE; } } { diff --git a/GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h b/GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h index 9bfeee47b3e..4bc25f74e6e 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h @@ -274,8 +274,10 @@ class GameMessage : public MemoryPoolObject MSG_META_CAMERA_RESET, MSG_META_TOGGLE_CAMERA_TRACKING_DRAWABLE, MSG_META_TOGGLE_FAST_FORWARD_REPLAY, ///< Toggle the fast forward feature - MSG_META_TOGGLE_PAUSE, ///< TheSuperHackers @feature Toggle game pause (in replay playbacks) - MSG_META_STEP_FRAME, ///< TheSuperHackers @feature Step one frame (in replay playbacks) + MSG_META_TOGGLE_PAUSE, ///< TheSuperHackers @feature Toggle game pause + MSG_META_TOGGLE_PAUSE_ALT, ///< TheSuperHackers @feature Toggle game pause (alternative mapping) + MSG_META_STEP_FRAME, ///< TheSuperHackers @feature Step one frame + MSG_META_STEP_FRAME_ALT, ///< TheSuperHackers @feature Step one frame (alternative mapping) MSG_META_DEMO_INSTANT_QUIT, ///< bail out of game immediately diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h b/GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h index cb358886ccf..4095fdde770 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h @@ -314,16 +314,18 @@ enum CommandUsableInType CPP_11(: Int) { COMMANDUSABLE_NONE = 0, - COMMANDUSABLE_SHELL = (1 << 0), - COMMANDUSABLE_GAME = (1 << 1), + COMMANDUSABLE_SHELL = (1 << 0), // Command is usable when in Shell (Menus) + COMMANDUSABLE_GAME = (1 << 1), // Command is usable when not in Shell + COMMANDUSABLE_OBSERVER = (1 << 2), // TheSuperHackers @feature Command is usable when observing - COMMANDUSABLE_EVERYWHERE = COMMANDUSABLE_SHELL | COMMANDUSABLE_GAME, + COMMANDUSABLE_EVERYWHERE = ~0, }; static const char* TheCommandUsableInNames[] = { "SHELL", "GAME", + "OBSERVER", NULL }; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp b/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp index d7b59709587..c790419d92a 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp @@ -402,7 +402,9 @@ const char *GameMessage::getCommandTypeAsString(GameMessage::Type t) CASE_LABEL(MSG_META_TOGGLE_FAST_FORWARD_REPLAY) CASE_LABEL(MSG_META_TOGGLE_PAUSE) + CASE_LABEL(MSG_META_TOGGLE_PAUSE_ALT) CASE_LABEL(MSG_META_STEP_FRAME) + CASE_LABEL(MSG_META_STEP_FRAME_ALT) #if defined(RTS_DEBUG) CASE_LABEL(MSG_META_DEMO_TOGGLE_BEHIND_BUILDINGS) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index ee6424345b0..545fc87835e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -3452,10 +3452,9 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } case GameMessage::MSG_META_TOGGLE_PAUSE: + case GameMessage::MSG_META_TOGGLE_PAUSE_ALT: { -#if !defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)//may be defined in GameCommon.h - if (TheGameLogic->isInReplayGame()) -#endif + if (!TheGameLogic->isInMultiplayerGame()) { if (TheGameLogic->isGamePaused()) { @@ -3468,17 +3467,18 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage Bool pauseInput = FALSE; TheGameLogic->setGamePaused(pause, pauseMusic, pauseInput); } + disp = DESTROY_MESSAGE; } break; } case GameMessage::MSG_META_STEP_FRAME: + case GameMessage::MSG_META_STEP_FRAME_ALT: { -#if !defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)//may be defined in GameCommon.h - if (TheGameLogic->isInReplayGame()) -#endif + if (!TheGameLogic->isInMultiplayerGame()) { TheGameLogic->setGamePaused(FALSE); TheGameLogic->setGamePausedInFrame(TheGameLogic->getFrame() + 1, TRUE); + disp = DESTROY_MESSAGE; } break; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp index 90484e191e8..90be12b0775 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp @@ -30,6 +30,7 @@ // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine +#include "Common/GameUtility.h" #include "Common/INI.h" #include "Common/MessageStream.h" #include "Common/Player.h" @@ -183,8 +184,10 @@ static const LookupListRec GameMessageMetaTypeNames[] = { "TOGGLE_CAMERA_TRACKING_DRAWABLE", GameMessage::MSG_META_TOGGLE_CAMERA_TRACKING_DRAWABLE }, { "TOGGLE_FAST_FORWARD_REPLAY", GameMessage::MSG_META_TOGGLE_FAST_FORWARD_REPLAY }, { "TOGGLE_PAUSE", GameMessage::MSG_META_TOGGLE_PAUSE }, + { "TOGGLE_PAUSE_ALT", GameMessage::MSG_META_TOGGLE_PAUSE_ALT }, { "STEP_FRAME", GameMessage::MSG_META_STEP_FRAME }, - { "DEMO_INSTANT_QUIT", GameMessage::MSG_META_DEMO_INSTANT_QUIT }, + { "STEP_FRAME_ALT", GameMessage::MSG_META_STEP_FRAME_ALT }, + { "DEMO_INSTANT_QUIT", GameMessage::MSG_META_DEMO_INSTANT_QUIT }, #if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)//may be defined in GameCommon.h { "CHEAT_RUNSCRIPT1", GameMessage::MSG_CHEAT_RUNSCRIPT1 }, @@ -400,6 +403,33 @@ static const char * findGameMessageNameByType(GameMessage::Type type) return "???"; } +//------------------------------------------------------------------------------------------------- +static Bool isMessageUsable(CommandUsableInType usableIn) +{ + // We will ignore all commands if the game client has not yet incremented to frame 1. + // It prevents the user from doing commands during a map load, which throws the input + // system into whack because there isn't a client frame for the input event, and in + // the case of a command that pauses the game, like the quit menu, the client frame + // will never get beyond 0 and we lose the ability to process any input. + if (TheGameClient->getFrame() == 0) + return false; + + const Bool usableInShell = (usableIn & COMMANDUSABLE_SHELL); + const Bool usableInGame = (usableIn & COMMANDUSABLE_GAME); + const Bool usableAsObserver = (usableIn & COMMANDUSABLE_OBSERVER); + + if (usableInShell && TheShell && TheShell->isShellActive()) + return true; + + if (usableInGame && (!TheShell || !TheShell->isShellActive())) + return true; + + if (usableAsObserver && rts::localPlayerIsObserving()) + return true; + + return false; +} + //------------------------------------------------------------------------------------------------- GameMessageDisposition MetaEventTranslator::translateGameMessage(const GameMessage *msg) { @@ -431,34 +461,14 @@ GameMessageDisposition MetaEventTranslator::translateGameMessage(const GameMessa } - for (const MetaMapRec *map = TheMetaMap->getFirstMetaMapRec(); map; map = map->m_next) + for (const MetaMapRec *map = TheMetaMap->getFirstMetaMapRec(); map; map = map->m_next) { DEBUG_ASSERTCRASH(map->m_meta > GameMessage::MSG_BEGIN_META_MESSAGES && map->m_meta < GameMessage::MSG_END_META_MESSAGES, ("hmm, expected only meta-msgs here")); - // - // if this command is *only* usable in the game, we will ignore it if the game client - // has not yet incremented to frame 1 (keeps us from doing in-game commands during - // a map load, which throws the input system into wack because there isn't a - // client frame for the input event, and in the case of a command that pauses the - // game, like the quit menu, the client frame will never get beyond 0 and we - // lose the ability to process any input - // - if( map->m_usableIn == COMMANDUSABLE_GAME && TheGameClient->getFrame() < 1 ) + if (!isMessageUsable(map->m_usableIn)) continue; - // if the shell is active, and this command is not usable in shell, continue - if (TheShell && TheShell->isShellActive() && !(map->m_usableIn & COMMANDUSABLE_SHELL) ) - continue; - - // if the shell is not active and this command is not usable in the game, continue - if (TheShell && !TheShell->isShellActive() && !(map->m_usableIn & COMMANDUSABLE_GAME) ) - continue; - - - - - // check for the special case of mods-only-changed. if ( map->m_key == MK_NONE && @@ -781,7 +791,7 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t) map->m_key = MK_F; map->m_transition = DOWN; map->m_modState = NONE; - map->m_usableIn = COMMANDUSABLE_GAME; + map->m_usableIn = COMMANDUSABLE_GAME; // @todo COMMANDUSABLE_OBSERVER } } { @@ -792,7 +802,18 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t) map->m_key = MK_P; map->m_transition = DOWN; map->m_modState = NONE; - map->m_usableIn = COMMANDUSABLE_GAME; + map->m_usableIn = COMMANDUSABLE_OBSERVER; + } + } + { + // Is useful for Generals and Zero Hour. + MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_TOGGLE_PAUSE_ALT); + if (map->m_key == MK_NONE) + { + map->m_key = MK_P; + map->m_transition = DOWN; + map->m_modState = SHIFT; // Requires modifier to avoid key conflicts as a player. + map->m_usableIn = COMMANDUSABLE_EVERYWHERE; } } { @@ -803,7 +824,18 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t) map->m_key = MK_O; map->m_transition = DOWN; map->m_modState = NONE; - map->m_usableIn = COMMANDUSABLE_GAME; + map->m_usableIn = COMMANDUSABLE_OBSERVER; + } + } + { + // Is useful for Generals and Zero Hour. + MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_STEP_FRAME_ALT); + if (map->m_key == MK_NONE) + { + map->m_key = MK_O; + map->m_transition = DOWN; + map->m_modState = SHIFT; // Requires modifier to avoid key conflicts as a player. + map->m_usableIn = COMMANDUSABLE_EVERYWHERE; } } { From 8adf4852ac02e9733531daeb8787b7a5827d4aa5 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Fri, 12 Sep 2025 09:09:46 +0200 Subject: [PATCH 061/343] fix(system): Use 64-bit compatible miles (#1563) --- .../MilesAudioDevice/MilesAudioManager.cpp | 26 +++++++++---------- .../Source/WWVegas/WWAudio/AudibleSound.cpp | 2 +- .../Source/WWVegas/WWAudio/FilteredSound.cpp | 6 ++--- .../Source/WWVegas/WWAudio/Listener.cpp | 2 +- .../Source/WWVegas/WWAudio/Sound3D.cpp | 2 +- .../Source/WWVegas/WWAudio/WWAudio.cpp | 16 ++++++------ .../Source/WWVegas/WWAudio/WWAudio.h | 8 +++--- .../Source/WWVegas/WWAudio/sound2dhandle.cpp | 6 ++--- .../Source/WWVegas/WWAudio/sound2dhandle.h | 4 +-- .../Source/WWVegas/WWAudio/sound3dhandle.cpp | 6 ++--- .../Source/WWVegas/WWAudio/sound3dhandle.h | 4 +-- .../Source/WWVegas/WWAudio/soundhandle.h | 4 +-- .../WWVegas/WWAudio/soundstreamhandle.cpp | 6 ++--- .../WWVegas/WWAudio/soundstreamhandle.h | 4 +-- cmake/miles.cmake | 2 +- 15 files changed, 49 insertions(+), 49 deletions(-) diff --git a/Core/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp b/Core/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp index 34956af69be..973669ed6b4 100644 --- a/Core/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp +++ b/Core/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp @@ -74,10 +74,10 @@ static void AILCALLBACK setSampleCompleted( HSAMPLE sampleCompleted ); static void AILCALLBACK set3DSampleCompleted( H3DSAMPLE sample3DCompleted ); static void AILCALLBACK setStreamCompleted( HSTREAM streamCompleted ); -static U32 AILCALLBACK streamingFileOpen(char const *fileName, U32 *file_handle); -static void AILCALLBACK streamingFileClose(U32 fileHandle); -static S32 AILCALLBACK streamingFileSeek(U32 fileHandle, S32 offset, U32 type); -static U32 AILCALLBACK streamingFileRead(U32 fileHandle, void *buffer, U32 bytes); +static U32 AILCALLBACK streamingFileOpen(char const *fileName, void **file_handle); +static void AILCALLBACK streamingFileClose(void *fileHandle); +static S32 AILCALLBACK streamingFileSeek(void *fileHandle, S32 offset, U32 type); +static U32 AILCALLBACK streamingFileRead(void *fileHandle, void *buffer, U32 bytes); //------------------------------------------------------------------------------------------------- MilesAudioManager::MilesAudioManager() : @@ -235,7 +235,7 @@ void MilesAudioManager::audioDebugDisplay(DebugDisplayInterface *dd, void *, FIL continue; } - playingArray[AIL_sample_user_data(playing->m_sample, 0)] = playing; + playingArray[(int)AIL_sample_user_data(playing->m_sample, 0)] = playing; } for (Int i = 1; i <= maxChannels && i <= channelCount; ++i) { @@ -296,7 +296,7 @@ void MilesAudioManager::audioDebugDisplay(DebugDisplayInterface *dd, void *, FIL continue; } - playingArray[AIL_3D_user_data(playing->m_3DSample, 0)] = playing; + playingArray[(int)AIL_3D_user_data(playing->m_3DSample, 0)] = playing; } for (Int i = 1; i <= maxChannels && i <= channelCount; ++i) @@ -2912,7 +2912,7 @@ void MilesAudioManager::initSamplePools( void ) DEBUG_ASSERTCRASH(sample, ("Couldn't get %d 2D samples", i + 1)); if (sample) { AIL_init_sample(sample); - AIL_set_sample_user_data(sample, 0, i + 1); + AIL_set_sample_user_data(sample, 0, (void *)(i + 1)); m_availableSamples.push_back(sample); ++m_num2DSamples; } @@ -2922,7 +2922,7 @@ void MilesAudioManager::initSamplePools( void ) H3DSAMPLE sample = AIL_allocate_3D_sample_handle(m_provider3D[m_selectedProvider].id); DEBUG_ASSERTCRASH(sample, ("Couldn't get %d 3D samples", i + 1)); if (sample) { - AIL_set_3D_user_data(sample, 0, i + 1); + AIL_set_3D_user_data(sample, 0, (void *)(i + 1)); m_available3DSamples.push_back(sample); ++m_num3DSamples; } @@ -3058,7 +3058,7 @@ void AILCALLBACK setStreamCompleted( HSTREAM streamCompleted ) } //------------------------------------------------------------------------------------------------- -U32 AILCALLBACK streamingFileOpen(char const *fileName, U32 *file_handle) +U32 AILCALLBACK streamingFileOpen(char const *fileName, void **file_handle) { #if defined(RTS_DEBUG) if (sizeof(U32) != sizeof(File*)) { @@ -3066,24 +3066,24 @@ U32 AILCALLBACK streamingFileOpen(char const *fileName, U32 *file_handle) } #endif - (*file_handle) = (U32) TheFileSystem->openFile(fileName, File::READ | File::STREAMING); + (*file_handle) = (void *) TheFileSystem->openFile(fileName, File::READ | File::STREAMING); return ((*file_handle) != 0); } //------------------------------------------------------------------------------------------------- -void AILCALLBACK streamingFileClose(U32 fileHandle) +void AILCALLBACK streamingFileClose(void *fileHandle) { ((File*) fileHandle)->close(); } //------------------------------------------------------------------------------------------------- -S32 AILCALLBACK streamingFileSeek(U32 fileHandle, S32 offset, U32 type) +S32 AILCALLBACK streamingFileSeek(void *fileHandle, S32 offset, U32 type) { return ((File*) fileHandle)->seek(offset, (File::seekMode) type); } //------------------------------------------------------------------------------------------------- -U32 AILCALLBACK streamingFileRead(U32 file_handle, void *buffer, U32 bytes) +U32 AILCALLBACK streamingFileRead(void *file_handle, void *buffer, U32 bytes) { return ((File*) file_handle)->read(buffer, bytes); } diff --git a/Core/Libraries/Source/WWVegas/WWAudio/AudibleSound.cpp b/Core/Libraries/Source/WWVegas/WWAudio/AudibleSound.cpp index eb343cf1a16..370b4537f06 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/AudibleSound.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/AudibleSound.cpp @@ -637,7 +637,7 @@ AudibleSoundClass::Initialize_Miles_Handle (void) // // Associate this object instance with the handle // - m_SoundHandle->Set_Sample_User_Data (INFO_OBJECT_PTR, (S32)this); + m_SoundHandle->Set_Sample_User_Data (INFO_OBJECT_PTR, (void *)this); } return ; diff --git a/Core/Libraries/Source/WWVegas/WWAudio/FilteredSound.cpp b/Core/Libraries/Source/WWVegas/WWAudio/FilteredSound.cpp index cd0093940c9..4228bb65b09 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/FilteredSound.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/FilteredSound.cpp @@ -57,7 +57,7 @@ SimplePersistFactoryClass _FilteredS // ///////////////////////////////////////////////////////////////////////////////// FilteredSoundClass::FilteredSoundClass (void) - : m_hFilter (INVALID_MILES_HANDLE) + : m_hFilter ((HPROVIDER)INVALID_MILES_HANDLE) { return ; } @@ -69,7 +69,7 @@ FilteredSoundClass::FilteredSoundClass (void) // //////////////////////////////////////////////////////////////////////////////////////////////// FilteredSoundClass::FilteredSoundClass (const FilteredSoundClass &src) - : m_hFilter (INVALID_MILES_HANDLE), + : m_hFilter ((HPROVIDER)INVALID_MILES_HANDLE), SoundPseudo3DClass (src) { (*this) = src; @@ -113,7 +113,7 @@ FilteredSoundClass::Initialize_Miles_Handle (void) SoundPseudo3DClass::Initialize_Miles_Handle (); m_hFilter = WWAudioClass::Get_Instance ()->Get_Reverb_Filter (); if ((m_SoundHandle != NULL) && - (m_hFilter != INVALID_MILES_HANDLE)) { + (m_hFilter != (HPROVIDER)INVALID_MILES_HANDLE)) { // // Pass the filter onto the sample diff --git a/Core/Libraries/Source/WWVegas/WWAudio/Listener.cpp b/Core/Libraries/Source/WWVegas/WWAudio/Listener.cpp index 3d76e2f9fe0..9797e5e8989 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/Listener.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/Listener.cpp @@ -84,7 +84,7 @@ Listener3DClass::Initialize_Miles_Handle (void) // Associate this object instance with the handle - m_SoundHandle->Set_Sample_User_Data (INFO_OBJECT_PTR, (S32)this); + m_SoundHandle->Set_Sample_User_Data (INFO_OBJECT_PTR, (void *)this); } return ; diff --git a/Core/Libraries/Source/WWVegas/WWAudio/Sound3D.cpp b/Core/Libraries/Source/WWVegas/WWAudio/Sound3D.cpp index bfeb51ef94e..d8870718086 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/Sound3D.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/Sound3D.cpp @@ -532,7 +532,7 @@ Sound3DClass::Initialize_Miles_Handle (void) Seek (m_CurrentPosition); // Associate this object instance with the handle - m_SoundHandle->Set_Sample_User_Data (INFO_OBJECT_PTR, (S32)this); + m_SoundHandle->Set_Sample_User_Data (INFO_OBJECT_PTR, (void *)this); } return ; diff --git a/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp b/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp index 230eff73244..6b30fb8648c 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp @@ -109,7 +109,7 @@ WWAudioClass::WWAudioClass (void) m_PlaybackRate (44100), m_PlaybackBits (16), m_PlaybackStereo (true), - m_ReverbFilter (INVALID_MILES_HANDLE), + m_ReverbFilter ((HPROVIDER)INVALID_MILES_HANDLE), m_UpdateTimer (-1), m_Driver3DPseudo (NULL), m_MusicVolume (DEF_MUSIC_VOL), @@ -2104,7 +2104,7 @@ WWAudioClass::Initialize (const char *registry_subkey_name) HPROENUM next = HPROENUM_FIRST; char *name = NULL; if (::AIL_enumerate_filters (&next, &m_ReverbFilter, &name) == 0) { - m_ReverbFilter = INVALID_MILES_HANDLE; + m_ReverbFilter = (HPROVIDER)INVALID_MILES_HANDLE; } } @@ -2143,7 +2143,7 @@ WWAudioClass::Initialize HPROENUM next = HPROENUM_FIRST; char *name = NULL; if (::AIL_enumerate_filters (&next, &m_ReverbFilter, &name) == 0) { - m_ReverbFilter = INVALID_MILES_HANDLE; + m_ReverbFilter = (HPROVIDER)INVALID_MILES_HANDLE; } } @@ -2740,7 +2740,7 @@ WWAudioClass::Save_To_Registry // //////////////////////////////////////////////////////////////////////////////////////////// U32 AILCALLBACK -WWAudioClass::File_Open_Callback (char const *filename, U32 *file_handle) +WWAudioClass::File_Open_Callback (char const *filename, void **file_handle) { U32 retval = false; @@ -2751,7 +2751,7 @@ WWAudioClass::File_Open_Callback (char const *filename, U32 *file_handle) // FileClass *file = Get_Instance ()->Get_File (filename); if (file != NULL && file->Open ()) { - (*file_handle) = (U32)file; + (*file_handle) = (void *)file; retval = true; } } @@ -2766,7 +2766,7 @@ WWAudioClass::File_Open_Callback (char const *filename, U32 *file_handle) // //////////////////////////////////////////////////////////////////////////////////////////// void AILCALLBACK -WWAudioClass::File_Close_Callback (U32 file_handle) +WWAudioClass::File_Close_Callback (void *file_handle) { if (Get_Instance () != NULL) { @@ -2789,7 +2789,7 @@ WWAudioClass::File_Close_Callback (U32 file_handle) // //////////////////////////////////////////////////////////////////////////////////////////// S32 AILCALLBACK -WWAudioClass::File_Seek_Callback (U32 file_handle, S32 offset, U32 type) +WWAudioClass::File_Seek_Callback (void *file_handle, S32 offset, U32 type) { S32 retval = 0; @@ -2834,7 +2834,7 @@ WWAudioClass::File_Seek_Callback (U32 file_handle, S32 offset, U32 type) // //////////////////////////////////////////////////////////////////////////////////////////// U32 AILCALLBACK -WWAudioClass::File_Read_Callback (U32 file_handle, void *buffer, U32 bytes) +WWAudioClass::File_Read_Callback (void *file_handle, void *buffer, U32 bytes) { U32 retval = 0; diff --git a/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.h b/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.h index f9aaf544004..b7842d14f35 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.h @@ -485,10 +485,10 @@ class WWAudioClass ////////////////////////////////////////////////////////////////////// // Miles File Callbacks ////////////////////////////////////////////////////////////////////// - static U32 AILCALLBACK File_Open_Callback (char const *filename, U32 *file_handle); - static void AILCALLBACK File_Close_Callback (U32 file_handle); - static S32 AILCALLBACK File_Seek_Callback (U32 file_handle, S32 offset, U32 type); - static U32 AILCALLBACK File_Read_Callback (U32 file_handle, void *buffer, U32 bytes); + static U32 AILCALLBACK File_Open_Callback (char const *filename, void **file_handle); + static void AILCALLBACK File_Close_Callback (void *file_handle); + static S32 AILCALLBACK File_Seek_Callback (void *file_handle, S32 offset, U32 type); + static U32 AILCALLBACK File_Read_Callback (void *file_handle, void *buffer, U32 bytes); private: diff --git a/Core/Libraries/Source/WWVegas/WWAudio/sound2dhandle.cpp b/Core/Libraries/Source/WWVegas/WWAudio/sound2dhandle.cpp index b615a54ee7e..9ff5f7ecbb5 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/sound2dhandle.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/sound2dhandle.cpp @@ -310,7 +310,7 @@ Sound2DHandleClass::Get_Sample_MS_Position (S32 *len, S32 *pos) // ////////////////////////////////////////////////////////////////////// void -Sound2DHandleClass::Set_Sample_User_Data (S32 i, U32 val) +Sound2DHandleClass::Set_Sample_User_Data (S32 i, void *val) { if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) { ::AIL_set_sample_user_data (SampleHandle, i, val); @@ -325,10 +325,10 @@ Sound2DHandleClass::Set_Sample_User_Data (S32 i, U32 val) // Get_Sample_User_Data // ////////////////////////////////////////////////////////////////////// -U32 +void * Sound2DHandleClass::Get_Sample_User_Data (S32 i) { - U32 retval = 0; + void *retval = NULL; if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) { retval = ::AIL_sample_user_data (SampleHandle, i); diff --git a/Core/Libraries/Source/WWVegas/WWAudio/sound2dhandle.h b/Core/Libraries/Source/WWVegas/WWAudio/sound2dhandle.h index cc6272f6784..31bc04d5e65 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/sound2dhandle.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/sound2dhandle.h @@ -90,8 +90,8 @@ class Sound2DHandleClass : public SoundHandleClass U32 Get_Sample_Loop_Count (void); void Set_Sample_MS_Position (U32 ms); void Get_Sample_MS_Position (S32 *len, S32 *pos); - void Set_Sample_User_Data (S32 i, U32 val); - U32 Get_Sample_User_Data (S32 i); + void Set_Sample_User_Data (S32 i, void *val); + void * Get_Sample_User_Data (S32 i); S32 Get_Sample_Playback_Rate (void); void Set_Sample_Playback_Rate (S32 rate); diff --git a/Core/Libraries/Source/WWVegas/WWAudio/sound3dhandle.cpp b/Core/Libraries/Source/WWVegas/WWAudio/sound3dhandle.cpp index ee13e10bdc6..2e281315239 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/sound3dhandle.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/sound3dhandle.cpp @@ -307,7 +307,7 @@ Sound3DHandleClass::Get_Sample_MS_Position (S32 *len, S32 *pos) // ////////////////////////////////////////////////////////////////////// void -Sound3DHandleClass::Set_Sample_User_Data (S32 i, U32 val) +Sound3DHandleClass::Set_Sample_User_Data (S32 i, void *val) { if (SampleHandle != (H3DSAMPLE)INVALID_MILES_HANDLE) { ::AIL_set_3D_object_user_data (SampleHandle, i, val); @@ -321,10 +321,10 @@ Sound3DHandleClass::Set_Sample_User_Data (S32 i, U32 val) // Get_Sample_User_Data // ////////////////////////////////////////////////////////////////////// -U32 +void * Sound3DHandleClass::Get_Sample_User_Data (S32 i) { - U32 retval = 0; + void *retval = NULL; if (SampleHandle != (H3DSAMPLE)INVALID_MILES_HANDLE) { retval = AIL_3D_object_user_data (SampleHandle, i); diff --git a/Core/Libraries/Source/WWVegas/WWAudio/sound3dhandle.h b/Core/Libraries/Source/WWVegas/WWAudio/sound3dhandle.h index b57a3141c2e..c5dd483fa69 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/sound3dhandle.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/sound3dhandle.h @@ -91,8 +91,8 @@ class Sound3DHandleClass : public SoundHandleClass U32 Get_Sample_Loop_Count (void); void Set_Sample_MS_Position (U32 ms); void Get_Sample_MS_Position (S32 *len, S32 *pos); - void Set_Sample_User_Data (S32 i, U32 val); - U32 Get_Sample_User_Data (S32 i); + void Set_Sample_User_Data (S32 i, void *val); + void * Get_Sample_User_Data (S32 i); S32 Get_Sample_Playback_Rate (void); void Set_Sample_Playback_Rate (S32 rate); diff --git a/Core/Libraries/Source/WWVegas/WWAudio/soundhandle.h b/Core/Libraries/Source/WWVegas/WWAudio/soundhandle.h index e1a61a2f38a..7c83738e3e1 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/soundhandle.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/soundhandle.h @@ -108,8 +108,8 @@ class SoundHandleClass virtual U32 Get_Sample_Loop_Count (void) = 0; virtual void Set_Sample_MS_Position (U32 ms) = 0; virtual void Get_Sample_MS_Position (S32 *len, S32 *pos) = 0; - virtual void Set_Sample_User_Data (S32 i, U32 val) = 0; - virtual U32 Get_Sample_User_Data (S32 i) = 0; + virtual void Set_Sample_User_Data (S32 i, void *val) = 0; + virtual void * Get_Sample_User_Data (S32 i) = 0; virtual S32 Get_Sample_Playback_Rate (void) = 0; virtual void Set_Sample_Playback_Rate (S32 rate) = 0; diff --git a/Core/Libraries/Source/WWVegas/WWAudio/soundstreamhandle.cpp b/Core/Libraries/Source/WWVegas/WWAudio/soundstreamhandle.cpp index 5fbcb5d5585..5bc7ed4e862 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/soundstreamhandle.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/soundstreamhandle.cpp @@ -305,7 +305,7 @@ SoundStreamHandleClass::Get_Sample_MS_Position (S32 *len, S32 *pos) // ////////////////////////////////////////////////////////////////////// void -SoundStreamHandleClass::Set_Sample_User_Data (S32 i, U32 val) +SoundStreamHandleClass::Set_Sample_User_Data (S32 i, void *val) { if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) { ::AIL_set_sample_user_data (SampleHandle, i, val); @@ -320,10 +320,10 @@ SoundStreamHandleClass::Set_Sample_User_Data (S32 i, U32 val) // Get_Sample_User_Data // ////////////////////////////////////////////////////////////////////// -U32 +void * SoundStreamHandleClass::Get_Sample_User_Data (S32 i) { - U32 retval = 0; + void *retval = NULL; if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) { retval = ::AIL_sample_user_data (SampleHandle, i); diff --git a/Core/Libraries/Source/WWVegas/WWAudio/soundstreamhandle.h b/Core/Libraries/Source/WWVegas/WWAudio/soundstreamhandle.h index c59b5439c3e..052bc690c4b 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/soundstreamhandle.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/soundstreamhandle.h @@ -92,8 +92,8 @@ class SoundStreamHandleClass : public SoundHandleClass U32 Get_Sample_Loop_Count (void); void Set_Sample_MS_Position (U32 ms); void Get_Sample_MS_Position (S32 *len, S32 *pos); - void Set_Sample_User_Data (S32 i, U32 val); - U32 Get_Sample_User_Data (S32 i); + void Set_Sample_User_Data (S32 i, void *val); + void * Get_Sample_User_Data (S32 i); S32 Get_Sample_Playback_Rate (void); void Set_Sample_Playback_Rate (S32 rate); diff --git a/cmake/miles.cmake b/cmake/miles.cmake index 61d43908b15..c25b27114c6 100644 --- a/cmake/miles.cmake +++ b/cmake/miles.cmake @@ -1,7 +1,7 @@ FetchContent_Declare( miles GIT_REPOSITORY https://github.com/TheSuperHackers/miles-sdk-stub.git - GIT_TAG 0fef646a85c822475d55f19e3ca185263fb4a967 + GIT_TAG 44c82ab6211028776facf53b0ce3a88a3e232c45 ) FetchContent_MakeAvailable(miles) From 4f06c9bdb31776e3c378ebc4554a32278d4878a9 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 12 Sep 2025 09:45:49 +0200 Subject: [PATCH 062/343] fix(memory): Fix miscellaneous memory issues (#1561) --- Core/Libraries/Source/WWVegas/WW3D2/collect.cpp | 1 + Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp | 5 ++--- Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.cpp | 1 + Generals/Code/Tools/GUIEdit/Source/EditWindow.cpp | 1 + GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp | 1 + 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Core/Libraries/Source/WWVegas/WW3D2/collect.cpp b/Core/Libraries/Source/WWVegas/WW3D2/collect.cpp index ea9985d2250..c911d68dd2e 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/collect.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/collect.cpp @@ -968,6 +968,7 @@ void CollectionDefClass::Free(void) for (int i=0; iFree_Assets(); delete m_assetManager; + m_assetManager = NULL; // shutdown WW3D WW3D::Shutdown(); diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp index 5e45cf100c5..01a22522bc6 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp @@ -500,6 +500,7 @@ void EditWindow::shutdown( void ) // delete asset manager m_assetManager->Free_Assets(); delete m_assetManager; + m_assetManager = NULL; // shutdown WW3D WW3D::Shutdown(); From bb39cc7bbbd5ba1cdc6b2b1f50bce0faa8f260e8 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 12 Sep 2025 09:46:09 +0200 Subject: [PATCH 063/343] refactor: Remove superfluous null tests before calls to free() (#1562) --- Core/Libraries/Source/WWVegas/WW3D2/font3d.cpp | 6 ++---- Core/Libraries/Source/WWVegas/WWAudio/Utils.h | 6 +----- Core/Libraries/Source/WWVegas/WWLib/rcfile.cpp | 10 ++++------ Core/Tools/Autorun/Locale_API.cpp | 6 ++---- .../Source/GameClient/GUI/Gadget/GadgetListBox.cpp | 10 ++++------ .../Source/GameNetwork/ConnectionManager.cpp | 6 ++---- .../Code/GameEngine/Source/GameNetwork/GameInfo.cpp | 6 +++--- .../Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp | 12 ++++-------- .../Source/GameClient/GUI/Gadget/GadgetListBox.cpp | 10 ++++------ .../Source/GameNetwork/ConnectionManager.cpp | 6 ++---- .../Code/GameEngine/Source/GameNetwork/GameInfo.cpp | 6 +++--- .../Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp | 12 ++++-------- GeneralsMD/Code/Tools/wdump/rawfilem.cpp | 2 +- 13 files changed, 36 insertions(+), 62 deletions(-) diff --git a/Core/Libraries/Source/WWVegas/WW3D2/font3d.cpp b/Core/Libraries/Source/WWVegas/WW3D2/font3d.cpp index 59f3039bef2..cc78b9ba331 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/font3d.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/font3d.cpp @@ -71,10 +71,8 @@ Font3DDataClass::Font3DDataClass( const char *filename ) ***********************************************************************************************/ Font3DDataClass::~Font3DDataClass(void) { - if (Name != NULL) { - free(Name); - Name = NULL; - } + free(Name); + Name = NULL; REF_PTR_RELEASE(Texture); } diff --git a/Core/Libraries/Source/WWVegas/WWAudio/Utils.h b/Core/Libraries/Source/WWVegas/WWAudio/Utils.h index 37b60b5a100..b100a851f4a 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/Utils.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/Utils.h @@ -58,11 +58,7 @@ pobject = NULL; \ } \ -#define SAFE_FREE(pobject) \ - if (pobject) { \ - ::free (pobject); \ - pobject = NULL; \ - } \ +#define SAFE_FREE(pobject) { ::free (pobject); pobject = NULL; } ///////////////////////////////////////////////////////////////////////////// diff --git a/Core/Libraries/Source/WWVegas/WWLib/rcfile.cpp b/Core/Libraries/Source/WWVegas/WWLib/rcfile.cpp index 2f8b0cb4582..5462b803980 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/rcfile.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/rcfile.cpp @@ -65,16 +65,14 @@ ResourceFileClass::ResourceFileClass(HMODULE hmodule, char const *filename) : ResourceFileClass::~ResourceFileClass(void) { - if (ResourceName) - free(ResourceName); + free(ResourceName); } char const * ResourceFileClass::Set_Name(char const *filename) { - if (ResourceName) { - free(ResourceName); - ResourceName = NULL; - } + free(ResourceName); + ResourceName = NULL; + if (filename) { ResourceName = strdup(filename); } diff --git a/Core/Tools/Autorun/Locale_API.cpp b/Core/Tools/Autorun/Locale_API.cpp index 046c877a7a0..28c73f480d8 100644 --- a/Core/Tools/Autorun/Locale_API.cpp +++ b/Core/Tools/Autorun/Locale_API.cpp @@ -300,10 +300,8 @@ void Locale_Restore ( void ) LOCALE_freetable(); LOCALE_restore(); #else - if( LocaleFile ) { - free( LocaleFile ); - LocaleFile = NULL; - } + free( LocaleFile ); + LocaleFile = NULL; #endif } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp index e93437566a5..90cb41d8f4d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp @@ -1724,8 +1724,8 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, { if( cells[j].cellType == LISTBOX_TEXT && cells[j].data ) TheDisplayStringManager->freeDisplayString((DisplayString *) cells[j].data ); -// if (cells[i].userData) -// free(cells[i].userData); + +// free(cells[i].userData); cells[j].data = NULL; cells[j].userData = NULL; cells[j].color = 0; @@ -1957,8 +1957,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, TheDisplayStringManager->freeDisplayString((DisplayString *) cells[j].data ); } } -// if ( cells[j].userData ) -// free(cells[j].userData); +// free(cells[j].userData); // Null out the data pointers so they're not destroyed when we free up this listdata cells[j].userData = NULL; @@ -2546,8 +2545,7 @@ void GadgetListBoxSetListLength( GameWindow *listbox, Int newLength ) TheDisplayStringManager->freeDisplayString((DisplayString *) cells[j].data ); } } -// if ( cells[j].userData ) -// free(cells[j].userData); +// free(cells[j].userData); } } if (i >= newLength) { diff --git a/Generals/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/Generals/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp index 696664a4e4b..ff864300cf8 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp @@ -1971,10 +1971,8 @@ void ConnectionManager::parseUserList(const GameInfo *game) return; } - if (list != NULL) { - free(list); // from the strdup above. - list = NULL; - } + free(list); // from the strdup above. + list = NULL; */ } diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameInfo.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameInfo.cpp index 9b61d2539cb..c499fb085a0 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameInfo.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameInfo.cpp @@ -1401,7 +1401,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) break; } } - if(freeMe) + free(freeMe); } else @@ -1410,8 +1410,8 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) break; } } - if( buf ) - free(buf); + + free(buf); //DEBUG_LOG(("Options were ok == %d", optionsOk)); if (optionsOk && sawMap && sawMapCRC && sawMapSize && sawSeed && sawSlotlist && sawCRC) diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp index d8d0ad8e4c0..e526933ff40 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp @@ -337,15 +337,11 @@ HLodDefClass::~HLodDefClass(void) *=============================================================================================*/ void HLodDefClass::Free(void) { - if (Name) { - ::free(Name); - Name = NULL; - } + ::free(Name); + Name = NULL; - if (HierarchyTreeName) { - ::free(HierarchyTreeName); - HierarchyTreeName = NULL; - } + ::free(HierarchyTreeName); + HierarchyTreeName = NULL; if (Lod) { delete[] Lod; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp index a501604732d..75076a9cc3b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp @@ -1724,8 +1724,8 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, { if( cells[j].cellType == LISTBOX_TEXT && cells[j].data ) TheDisplayStringManager->freeDisplayString((DisplayString *) cells[j].data ); -// if (cells[i].userData) -// free(cells[i].userData); + +// free(cells[i].userData); cells[j].data = NULL; cells[j].userData = NULL; cells[j].color = 0; @@ -1957,8 +1957,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, TheDisplayStringManager->freeDisplayString((DisplayString *) cells[j].data ); } } -// if ( cells[j].userData ) -// free(cells[j].userData); +// free(cells[j].userData); // Null out the data pointers so they're not destroyed when we free up this listdata cells[j].userData = NULL; @@ -2546,8 +2545,7 @@ void GadgetListBoxSetListLength( GameWindow *listbox, Int newLength ) TheDisplayStringManager->freeDisplayString((DisplayString *) cells[j].data ); } } -// if ( cells[j].userData ) -// free(cells[j].userData); +// free(cells[j].userData); } } if (i >= newLength) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp index 407af5e4411..72943db47ff 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp @@ -1957,10 +1957,8 @@ void ConnectionManager::parseUserList(const GameInfo *game) return; } - if (list != NULL) { - free(list); // from the strdup above. - list = NULL; - } + free(list); // from the strdup above. + list = NULL; */ } diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameInfo.cpp index 4a2526ed458..935b23ebe1a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameInfo.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameInfo.cpp @@ -1455,7 +1455,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) break; } } - if(freeMe) + free(freeMe); } else @@ -1464,8 +1464,8 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) break; } } - if( buf ) - free(buf); + + free(buf); //DEBUG_LOG(("Options were ok == %d", optionsOk)); if (optionsOk && sawMap && sawMapCRC && sawMapSize && sawSeed && sawSlotlist && sawCRC && sawUseStats && sawSuperweaponRestriction && sawStartingCash && sawOldFactions ) diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp index 2b8319fb7ae..caf2151cdfd 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp @@ -337,15 +337,11 @@ HLodDefClass::~HLodDefClass(void) *=============================================================================================*/ void HLodDefClass::Free(void) { - if (Name) { - ::free(Name); - Name = NULL; - } + ::free(Name); + Name = NULL; - if (HierarchyTreeName) { - ::free(HierarchyTreeName); - HierarchyTreeName = NULL; - } + ::free(HierarchyTreeName); + HierarchyTreeName = NULL; if (Lod) { delete[] Lod; diff --git a/GeneralsMD/Code/Tools/wdump/rawfilem.cpp b/GeneralsMD/Code/Tools/wdump/rawfilem.cpp index 664a9d8604e..1ba8263104c 100644 --- a/GeneralsMD/Code/Tools/wdump/rawfilem.cpp +++ b/GeneralsMD/Code/Tools/wdump/rawfilem.cpp @@ -141,7 +141,7 @@ RawFileMClass::RawFileMClass(char const * filename) : *=============================================================================================*/ char const * RawFileMClass::Set_Name(char const * filename) { - if (Filename != NULL && Allocated) { + if (Allocated) { free((char *)Filename); Filename = NULL; Allocated = false; From 244935b8baf6baf7ef85e38733e7c74067dec515 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 12 Sep 2025 10:09:00 +0200 Subject: [PATCH 064/343] refactor: Rename CONSTEXPR to constexpr (#1567) --- .../Source/StdDevice/Common/StdBIGFile.cpp | 2 +- .../Source/Win32Device/Common/Win32BIGFile.cpp | 2 +- Dependencies/Utility/Utility/CppMacros.h | 8 ++------ Generals/Code/GameEngine/Include/Common/GlobalData.h | 4 ++-- .../Code/GameEngine/Include/Common/SparseMatchFinder.h | 2 +- Generals/Code/GameEngine/Source/Common/Recorder.cpp | 4 ++-- .../Code/GameEngine/Source/GameClient/Input/Mouse.cpp | 2 +- .../Source/GameClient/MessageStream/LookAtXlat.cpp | 4 ++-- .../Source/W3DDevice/GameClient/W3DView.cpp | 2 +- GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h | 4 ++-- .../Code/GameEngine/Include/Common/SparseMatchFinder.h | 2 +- GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp | 4 ++-- .../Code/GameEngine/Source/GameClient/Input/Mouse.cpp | 2 +- .../Source/GameClient/MessageStream/LookAtXlat.cpp | 4 ++-- .../Source/W3DDevice/GameClient/W3DView.cpp | 2 +- 15 files changed, 22 insertions(+), 26 deletions(-) diff --git a/Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFile.cpp b/Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFile.cpp index df81f0bb330..3bfcc92f5ac 100644 --- a/Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFile.cpp +++ b/Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFile.cpp @@ -86,7 +86,7 @@ File* StdBIGFile::openFile( const Char *filename, Int access ) // whoever is opening this file wants write access, so copy the file to the local disk // and return that file pointer. - CONSTEXPR size_t bufferSize = 0; + constexpr size_t bufferSize = 0; File *localFile = TheLocalFileSystem->openFile(filename, access, bufferSize); if (localFile != NULL) { ramFile->copyDataToFile(localFile); diff --git a/Core/GameEngineDevice/Source/Win32Device/Common/Win32BIGFile.cpp b/Core/GameEngineDevice/Source/Win32Device/Common/Win32BIGFile.cpp index 540bd4ad487..c1c07f392f4 100644 --- a/Core/GameEngineDevice/Source/Win32Device/Common/Win32BIGFile.cpp +++ b/Core/GameEngineDevice/Source/Win32Device/Common/Win32BIGFile.cpp @@ -86,7 +86,7 @@ File* Win32BIGFile::openFile( const Char *filename, Int access ) // whoever is opening this file wants write access, so copy the file to the local disk // and return that file pointer. - CONSTEXPR size_t bufferSize = 0; + constexpr size_t bufferSize = 0; File *localFile = TheLocalFileSystem->openFile(filename, access, bufferSize); if (localFile != NULL) { ramFile->copyDataToFile(localFile); diff --git a/Dependencies/Utility/Utility/CppMacros.h b/Dependencies/Utility/Utility/CppMacros.h index 59a5ae09afa..fc973791ab5 100644 --- a/Dependencies/Utility/Utility/CppMacros.h +++ b/Dependencies/Utility/Utility/CppMacros.h @@ -38,12 +38,8 @@ #if __cplusplus >= 201103L #define CPP_11(code) code - #define CONSTEXPR constexpr #else #define CPP_11(code) - #define CONSTEXPR -#endif - -#if __cplusplus < 201103L -#define static_assert(expr, msg) + #define static_assert(expr, msg) + #define constexpr #endif diff --git a/Generals/Code/GameEngine/Include/Common/GlobalData.h b/Generals/Code/GameEngine/Include/Common/GlobalData.h index b904cd96d9d..8631dc87dfa 100644 --- a/Generals/Code/GameEngine/Include/Common/GlobalData.h +++ b/Generals/Code/GameEngine/Include/Common/GlobalData.h @@ -52,8 +52,8 @@ enum AIDebugOptions CPP_11(: Int); // PUBLIC ///////////////////////////////////////////////////////////////////////////////////////// -CONSTEXPR const Int MAX_GLOBAL_LIGHTS = 3; -CONSTEXPR const Int SIMULATE_REPLAYS_SEQUENTIAL = -1; +constexpr const Int MAX_GLOBAL_LIGHTS = 3; +constexpr const Int SIMULATE_REPLAYS_SEQUENTIAL = -1; //------------------------------------------------------------------------------------------------- class CommandLineData diff --git a/Generals/Code/GameEngine/Include/Common/SparseMatchFinder.h b/Generals/Code/GameEngine/Include/Common/SparseMatchFinder.h index 68b845e99ae..ad729530a34 100644 --- a/Generals/Code/GameEngine/Include/Common/SparseMatchFinder.h +++ b/Generals/Code/GameEngine/Include/Common/SparseMatchFinder.h @@ -202,7 +202,7 @@ class SparseMatchFinder //------------------------------------------------------------------------------------------------- SparseMatchFinder& operator=(const SparseMatchFinder& other) { - if CONSTEXPR ((FLAGS & SparseMatchFinderFlags_NoCopy) == 0) + if constexpr ((FLAGS & SparseMatchFinderFlags_NoCopy) == 0) { if (this != &other) { diff --git a/Generals/Code/GameEngine/Source/Common/Recorder.cpp b/Generals/Code/GameEngine/Source/Common/Recorder.cpp index 492dcc972c9..7d5cc10b280 100644 --- a/Generals/Code/GameEngine/Source/Common/Recorder.cpp +++ b/Generals/Code/GameEngine/Source/Common/Recorder.cpp @@ -47,8 +47,8 @@ #include "Common/CRCDebug.h" #include "Common/version.h" -CONSTEXPR const char s_genrep[] = "GENREP"; -CONSTEXPR const UnsignedInt replayBufferBytes = 8192; +constexpr const char s_genrep[] = "GENREP"; +constexpr const UnsignedInt replayBufferBytes = 8192; Int REPLAY_CRC_INTERVAL = 100; diff --git a/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp b/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp index ad455a32333..d49b22101fc 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp @@ -1072,7 +1072,7 @@ void Mouse::initCapture() // ------------------------------------------------------------------------------------------------ Bool Mouse::canCapture() const { - CONSTEXPR const CursorCaptureBlockReasonInt noGameBits = CursorCaptureBlockReason_NoGame | CursorCaptureBlockReason_Paused; + constexpr const CursorCaptureBlockReasonInt noGameBits = CursorCaptureBlockReason_NoGame | CursorCaptureBlockReason_Paused; switch (m_cursorCaptureMode) { diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index d2e09ed4353..c13ada960e9 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -73,8 +73,8 @@ static Bool scrollDir[4] = { false, false, false, false }; // The multiplier of 2 was logically chosen because originally the Scroll Factor did practically not affect the RMB scroll speed // and because the default Scroll Factor is/was 0.5, it needs to be doubled to get to a neutral 1x multiplier. -CONSTEXPR const Real SCROLL_MULTIPLIER = 2.0f; -CONSTEXPR const Real SCROLL_AMT = 100.0f * SCROLL_MULTIPLIER; +constexpr const Real SCROLL_MULTIPLIER = 2.0f; +constexpr const Real SCROLL_AMT = 100.0f * SCROLL_MULTIPLIER; static const Int edgeScrollSize = 3; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index c6c2806017e..7004b62d46a 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -1656,7 +1656,7 @@ void W3DView::scrollBy( Coord2D *delta ) // if we haven't moved, ignore if( delta && (delta->x != 0 || delta->y != 0) ) { - CONSTEXPR const Real SCROLL_RESOLUTION = 250.0f; + constexpr const Real SCROLL_RESOLUTION = 250.0f; Vector3 world, worldStart, worldEnd; Vector2 start, end; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h index aafc7316acb..381d1123c0f 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h @@ -53,8 +53,8 @@ enum AIDebugOptions CPP_11(: Int); // PUBLIC ///////////////////////////////////////////////////////////////////////////////////////// -CONSTEXPR const Int MAX_GLOBAL_LIGHTS = 3; -CONSTEXPR const Int SIMULATE_REPLAYS_SEQUENTIAL = -1; +constexpr const Int MAX_GLOBAL_LIGHTS = 3; +constexpr const Int SIMULATE_REPLAYS_SEQUENTIAL = -1; //------------------------------------------------------------------------------------------------- class CommandLineData diff --git a/GeneralsMD/Code/GameEngine/Include/Common/SparseMatchFinder.h b/GeneralsMD/Code/GameEngine/Include/Common/SparseMatchFinder.h index db0bb74f645..226dc5e2113 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/SparseMatchFinder.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/SparseMatchFinder.h @@ -204,7 +204,7 @@ class SparseMatchFinder //------------------------------------------------------------------------------------------------- SparseMatchFinder& operator=(const SparseMatchFinder& other) { - if CONSTEXPR ((FLAGS & SparseMatchFinderFlags_NoCopy) == 0) + if constexpr ((FLAGS & SparseMatchFinderFlags_NoCopy) == 0) { if (this != &other) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp index bbc17895d80..b276c5c8b66 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp @@ -47,8 +47,8 @@ #include "Common/CRCDebug.h" #include "Common/version.h" -CONSTEXPR const char s_genrep[] = "GENREP"; -CONSTEXPR const UnsignedInt replayBufferBytes = 8192; +constexpr const char s_genrep[] = "GENREP"; +constexpr const UnsignedInt replayBufferBytes = 8192; Int REPLAY_CRC_INTERVAL = 100; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp index ed1631f449f..49c0fb54cd6 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp @@ -1072,7 +1072,7 @@ void Mouse::initCapture() // ------------------------------------------------------------------------------------------------ Bool Mouse::canCapture() const { - CONSTEXPR const CursorCaptureBlockReasonInt noGameBits = CursorCaptureBlockReason_NoGame | CursorCaptureBlockReason_Paused; + constexpr const CursorCaptureBlockReasonInt noGameBits = CursorCaptureBlockReason_NoGame | CursorCaptureBlockReason_Paused; switch (m_cursorCaptureMode) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index c106cdddf8a..59d73005c19 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -73,8 +73,8 @@ static Bool scrollDir[4] = { false, false, false, false }; // The multiplier of 2 was logically chosen because originally the Scroll Factor did practically not affect the RMB scroll speed // and because the default Scroll Factor is/was 0.5, it needs to be doubled to get to a neutral 1x multiplier. -CONSTEXPR const Real SCROLL_MULTIPLIER = 2.0f; -CONSTEXPR const Real SCROLL_AMT = 100.0f * SCROLL_MULTIPLIER; +constexpr const Real SCROLL_MULTIPLIER = 2.0f; +constexpr const Real SCROLL_AMT = 100.0f * SCROLL_MULTIPLIER; static const Int edgeScrollSize = 3; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 35e570dce08..4206775cfc7 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -1820,7 +1820,7 @@ void W3DView::scrollBy( Coord2D *delta ) // if we haven't moved, ignore if( delta && (delta->x != 0 || delta->y != 0) ) { - CONSTEXPR const Real SCROLL_RESOLUTION = 250.0f; + constexpr const Real SCROLL_RESOLUTION = 250.0f; Vector3 world, worldStart, worldEnd; Vector2 start, end; From f6b82534c19b6cd8dacaa3097773f14de89b8127 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 12 Sep 2025 10:09:29 +0200 Subject: [PATCH 065/343] tweak(gui): No longer disable the idle worker button when the game input is disabled (#1566) --- Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp | 4 ++-- GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index 0418a888215..0c2337a5135 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -5557,10 +5557,10 @@ void InGameUI::updateIdleWorker( void ) { Int idleCount = getIdleWorkerCount(); - if(idleCount > 0 && m_currentIdleWorkerDisplay != idleCount && getInputEnabled()) + if(idleCount > 0 && m_currentIdleWorkerDisplay != idleCount) showIdleWorkerLayout(); - if((idleCount <= 0 && m_idleWorkerWin) || !getInputEnabled()) + if(idleCount <= 0 && m_idleWorkerWin) hideIdleWorkerLayout(); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index f831974df7c..a54d6876e9a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -5729,10 +5729,10 @@ void InGameUI::updateIdleWorker( void ) { Int idleCount = getIdleWorkerCount(); - if(idleCount > 0 && m_currentIdleWorkerDisplay != idleCount && getInputEnabled()) + if(idleCount > 0 && m_currentIdleWorkerDisplay != idleCount) showIdleWorkerLayout(); - if((idleCount <= 0 && m_idleWorkerWin) || !getInputEnabled()) + if(idleCount <= 0 && m_idleWorkerWin) hideIdleWorkerLayout(); } From b95042c583338c6c472b6f0c850625c92891f1c7 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 7 Sep 2025 17:05:38 +0200 Subject: [PATCH 066/343] refactor: Move some code comments into correct scopes (#1551) --- .../Source/WWVegas/WWLib/FastAllocator.h | 18 ++++++++++++------ .../Code/GameEngine/Source/Common/GameLOD.cpp | 6 ++++-- .../Source/GameLogic/AI/TurretAI.cpp | 3 ++- .../GameLogic/Object/PartitionManager.cpp | 13 ++++++++----- .../W3DDevice/GameClient/W3DInGameUI.cpp | 4 ++-- .../W3DDevice/GameClient/W3DTerrainTracks.cpp | 3 ++- .../Code/GameEngine/Source/Common/GameLOD.cpp | 6 ++++-- .../Source/GameLogic/AI/TurretAI.cpp | 3 ++- .../GameLogic/Object/PartitionManager.cpp | 13 ++++++++----- .../W3DDevice/GameClient/W3DInGameUI.cpp | 4 ++-- .../W3DDevice/GameClient/W3DTerrainTracks.cpp | 3 ++- .../Source/WWVegas/WW3D2/sortingrenderer.cpp | 6 ++++-- 12 files changed, 52 insertions(+), 30 deletions(-) diff --git a/Core/Libraries/Source/WWVegas/WWLib/FastAllocator.h b/Core/Libraries/Source/WWVegas/WWLib/FastAllocator.h index 61ec4bdc0b6..a172dcd0258 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/FastAllocator.h +++ b/Core/Libraries/Source/WWVegas/WWLib/FastAllocator.h @@ -163,14 +163,20 @@ class StackAllocator{ T* pTArray = (T*)mTArray; const T* const pTArrayEnd = pTArray + nCount; while(pTArray < pTArrayEnd){ - new(pTArray)T; //Use the placement operator new. This simply calls the constructor - ++pTArray; //of T with 'this' set to the input address. Note that we don't put - } //a '()' after the T this is because () causes trivial types like int - } //and class* to be assigned zero/NULL. We don't want that. + //Use the placement operator new. This simply calls the constructor + //of T with 'this' set to the input address. Note that we don't put + //a '()' after the T this is because () causes trivial types like int + //and class* to be assigned zero/NULL. We don't want that. + new(pTArray)T; + ++pTArray; + } + } return (T*)mTArray; - } //Else the request is too big. So let's use (the slower) operator new. + } + //Else the request is too big. So let's use (the slower) operator new. return (mpTHeap = new T[nCount]); //The compiler will call the constructors here. - } //Else we are being used. Let's be nice and allocate something anyway. + } + //Else we are being used. Let's be nice and allocate something anyway. return new T[nCount]; } diff --git a/Generals/Code/GameEngine/Source/Common/GameLOD.cpp b/Generals/Code/GameEngine/Source/Common/GameLOD.cpp index 2be8b54adab..9610b2c0fbe 100644 --- a/Generals/Code/GameEngine/Source/Common/GameLOD.cpp +++ b/Generals/Code/GameEngine/Source/Common/GameLOD.cpp @@ -288,8 +288,10 @@ void GameLODManager::init(void) if ((Real)(m_numRAM)/(Real)(256*1024*1024) >= PROFILE_ERROR_LIMIT) m_memPassed=TRUE; //check if they have at least 256 MB + //find data needed to determine m_idealDetailLevel if (m_idealDetailLevel == STATIC_GAME_LOD_UNKNOWN || TheGlobalData->m_forceBenchmark) { + //find equivalent CPU to unknown cpu. if (m_cpuType == XX || TheGlobalData->m_forceBenchmark) { //need to run the benchmark @@ -335,8 +337,8 @@ void GameLODManager::init(void) } prof++; } - } //finding equivalent CPU to unkown cpu. - } //find data needed to determine m_idealDetailLevel + } + } if (userSetDetail == STATIC_GAME_LOD_CUSTOM) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp index 5a76dc69e06..de336bae94c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp @@ -1265,12 +1265,13 @@ void TurretAIIdleState::resetIdleScan() StateReturnType TurretAIIdleState::onEnter() { AIUpdateInterface *ai = getMachineOwner()->getAIUpdateInterface(); + // ai doesn't exist if the object was just created this frame. if (ai) { ai->resetNextMoodCheckTime(); if (ai->friend_getTurretSync() == getTurretAI()->friend_getWhichTurret()) ai->friend_setTurretSync(TURRET_INVALID); - } // ai doesn't exist if the object was just created this frame. + } resetIdleScan(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index 707ae611d22..fc81898e27a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -1658,8 +1658,9 @@ ObjectShroudStatus PartitionData::getShroudedStatus(Int playerIndex) else if( shroudedCells + foggedCells == m_coiInUseCount ) { m_shroudedness[playerIndex] = OBJECTSHROUD_FOGGED; //object is visible but fogged. - if (m_object && m_ghostObject) //object does not exist for modules holding only GhostObjects + if (m_object && m_ghostObject) { + //object does not exist for modules holding only GhostObjects //fogged but may not be visible if faction unit or faction building that has not been seen before Player *player=ThePlayerList->getNthPlayer(playerIndex); if (player->getRelationship(m_object->getTeam()) == NEUTRAL) @@ -1667,8 +1668,9 @@ ObjectShroudStatus PartitionData::getShroudedStatus(Int playerIndex) if (!m_object->isKindOf(KINDOF_IMMOBILE)) m_shroudedness[playerIndex] = OBJECTSHROUD_SHROUDED; } - else //Not neutral - { //enemy unit will always be shrouded unless it's a building that's already been seen by the player. Fogged Mines are also always + else + { //Not neutral + //enemy unit will always be shrouded unless it's a building that's already been seen by the player. Fogged Mines are also always //shroued no matter what. if (!(m_object->isKindOf(KINDOF_IMMOBILE) && m_everSeenByPlayer[playerIndex]) || m_object->isKindOf(KINDOF_MINE)) m_shroudedness[playerIndex] = OBJECTSHROUD_SHROUDED; @@ -1685,7 +1687,8 @@ ObjectShroudStatus PartitionData::getShroudedStatus(Int playerIndex) } } else if( shroudedCells == 0 && foggedCells == 0 ) - { //Record that this object was seen by the player. This info will be used to show fogged enemy faction buildings. + { //no cell I use has anything + //Record that this object was seen by the player. This info will be used to show fogged enemy faction buildings. m_everSeenByPlayer[playerIndex] = true; m_shroudedness[playerIndex] = OBJECTSHROUD_CLEAR; if (m_ghostObject && m_shroudednessPrevious[playerIndex] == OBJECTSHROUD_FOGGED) @@ -1693,7 +1696,7 @@ ObjectShroudStatus PartitionData::getShroudedStatus(Int playerIndex) //need a ghost object. m_ghostObject->freeSnapShot(playerIndex); } - } // no cell I use has anything + } else { //Record that this object was seen by the player. This info will be used to show fogged enemy faction buildings. m_everSeenByPlayer[playerIndex] = true; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp index af0d0e77aa1..5edc124ab2f 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp @@ -355,8 +355,8 @@ void W3DInGameUI::init( void ) // hide it for now motd->winHide( TRUE ); - } // end if*/ - + } // end if +*/ } // end init diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp index fecc3c6e976..a766da69cba 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp @@ -884,6 +884,7 @@ Try improving the fit to vertical surfaces like cliffs. } //while (mod) }//edges to flush + //there are some edges to render in pool. //draw the filled vertex buffers if (m_edgesToFlush >= 2) { @@ -909,7 +910,7 @@ Try improving the fit to vertical surfaces like cliffs. } mod=mod->m_nextSystem; } - } //there are some edges to render in pool. + } m_edgesToFlush=0; //reset count for next flush } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp index f60ced63106..f7f3fda6b65 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp @@ -290,8 +290,10 @@ void GameLODManager::init(void) if ((Real)(m_numRAM)/(Real)(256*1024*1024) >= PROFILE_ERROR_LIMIT) m_memPassed=TRUE; //check if they have at least 256 MB + //find data needed to determine m_idealDetailLevel if (m_idealDetailLevel == STATIC_GAME_LOD_UNKNOWN || TheGlobalData->m_forceBenchmark) { + //find equivalent CPU to unknown cpu. if (m_cpuType == XX || TheGlobalData->m_forceBenchmark) { //need to run the benchmark @@ -337,8 +339,8 @@ void GameLODManager::init(void) } prof++; } - } //finding equivalent CPU to unkown cpu. - } //find data needed to determine m_idealDetailLevel + } + } if (userSetDetail == STATIC_GAME_LOD_CUSTOM) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp index fa146d3c73e..5fbfb0b38e5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp @@ -1287,12 +1287,13 @@ void TurretAIIdleState::resetIdleScan() StateReturnType TurretAIIdleState::onEnter() { AIUpdateInterface *ai = getMachineOwner()->getAIUpdateInterface(); + // ai doesn't exist if the object was just created this frame. if (ai) { ai->resetNextMoodCheckTime(); if (ai->friend_getTurretSync() == getTurretAI()->friend_getWhichTurret()) ai->friend_setTurretSync(TURRET_INVALID); - } // ai doesn't exist if the object was just created this frame. + } resetIdleScan(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index ff9b23dbee7..260d7f19102 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -1662,8 +1662,9 @@ ObjectShroudStatus PartitionData::getShroudedStatus(Int playerIndex) else if( shroudedCells + foggedCells == m_coiInUseCount ) { m_shroudedness[playerIndex] = OBJECTSHROUD_FOGGED; //object is visible but fogged. - if (m_object && m_ghostObject) //object does not exist for modules holding only GhostObjects + if (m_object && m_ghostObject) { + //object does not exist for modules holding only GhostObjects //fogged but may not be visible if faction unit or faction building that has not been seen before Player *player=ThePlayerList->getNthPlayer(playerIndex); if (player->getRelationship(m_object->getTeam()) == NEUTRAL) @@ -1671,8 +1672,9 @@ ObjectShroudStatus PartitionData::getShroudedStatus(Int playerIndex) if (!m_object->isKindOf(KINDOF_IMMOBILE)) m_shroudedness[playerIndex] = OBJECTSHROUD_SHROUDED; } - else //Not neutral - { //enemy unit will always be shrouded unless it's a building that's already been seen by the player. Fogged Mines are also always + else + { //Not neutral + //enemy unit will always be shrouded unless it's a building that's already been seen by the player. Fogged Mines are also always //shroued no matter what. if (!(m_object->isKindOf(KINDOF_IMMOBILE) && m_everSeenByPlayer[playerIndex]) || m_object->isKindOf(KINDOF_MINE)) m_shroudedness[playerIndex] = OBJECTSHROUD_SHROUDED; @@ -1689,7 +1691,8 @@ ObjectShroudStatus PartitionData::getShroudedStatus(Int playerIndex) } } else if( shroudedCells == 0 && foggedCells == 0 ) - { //Record that this object was seen by the player. This info will be used to show fogged enemy faction buildings. + { //no cell I use has anything + //Record that this object was seen by the player. This info will be used to show fogged enemy faction buildings. m_everSeenByPlayer[playerIndex] = true; m_shroudedness[playerIndex] = OBJECTSHROUD_CLEAR; if (m_ghostObject && m_shroudednessPrevious[playerIndex] == OBJECTSHROUD_FOGGED) @@ -1697,7 +1700,7 @@ ObjectShroudStatus PartitionData::getShroudedStatus(Int playerIndex) //need a ghost object. m_ghostObject->freeSnapShot(playerIndex); } - } // no cell I use has anything + } else { //Record that this object was seen by the player. This info will be used to show fogged enemy faction buildings. m_everSeenByPlayer[playerIndex] = true; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp index f6fc85e2e77..8c884054d0d 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp @@ -355,8 +355,8 @@ void W3DInGameUI::init( void ) // hide it for now motd->winHide( TRUE ); - } // end if*/ - + } // end if +*/ } // end init diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp index 56e4bdf9b53..293a5d23201 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp @@ -884,6 +884,7 @@ Try improving the fit to vertical surfaces like cliffs. } //while (mod) }//edges to flush + //there are some edges to render in pool. //draw the filled vertex buffers if (m_edgesToFlush >= 2) { @@ -909,7 +910,7 @@ Try improving the fit to vertical surfaces like cliffs. } mod=mod->m_nextSystem; } - } //there are some edges to render in pool. + } m_edgesToFlush=0; //reset count for next flush } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp index 4e3ce59dd90..e600c00762a 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp @@ -113,11 +113,13 @@ void Sort(TempIndexStruct *begin, TempIndexStruct *end) std::swap(begin[1], end[-1]); } if (begin[0] > end[-1]) { + // end[-1] has the largest element std::swap(begin[0], end[-1]); - } // end[-1] has the largest element + } if (begin[1] > begin[0]) { + // begin[0] has the middle element and begin[1] has the smallest element std::swap(begin[1], begin[0]); - } // begin[0] has the middle element and begin[1] has the smallest element + } // *begin is now the partitioning element TempIndexStruct *begin1 = begin + 1; // TODO: Temp fix until I find out who is passing me NaN From 6bc424cb09c803c0b391481d713504b25cbd8716 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 12 Sep 2025 10:32:08 +0200 Subject: [PATCH 067/343] refactor: Remove superfluous code comments behind closing scopes (#1551) --- .../Source/Common/INI/INIAudioEventInfo.cpp | 6 +- .../GameEngine/Source/Common/INI/INIVideo.cpp | 2 +- Core/GameEngine/Source/Common/RandomValue.cpp | 4 +- Core/GameEngine/Source/Common/System/Xfer.cpp | 158 ++++----- .../Source/Common/System/XferCRC.cpp | 54 +-- .../Source/Common/System/XferLoad.cpp | 36 +- .../Source/Common/System/XferSave.cpp | 48 +-- Core/GameEngine/Source/Common/crc.cpp | 2 +- .../Compression/LZHCompress/NoxCompress.cpp | 2 +- .../Source/WWVegas/WW3D2/dynamesh.cpp | 8 +- .../Libraries/Source/WWVegas/WW3D2/hcanim.cpp | 16 +- .../Source/WWVegas/WW3D2/metalmap.cpp | 2 +- .../Source/WWVegas/WW3D2/pointgr.cpp | 14 +- .../Source/WWVegas/WW3D2/ringobj.cpp | 16 +- .../Source/WWVegas/WW3D2/seglinerenderer.cpp | 16 +- .../Source/WWVegas/WW3D2/sphereobj.cpp | 24 +- .../Source/WWVegas/WW3D2/static_sort_list.h | 4 +- .../Source/WWVegas/WW3D2/streakRender.cpp | 16 +- .../Source/WWVegas/WW3D2/stripoptimizer.cpp | 4 +- .../Source/WWVegas/WWLib/tgatodxt.cpp | 2 +- Core/Libraries/Source/WWVegas/WWMath/tri.h | 6 +- Core/Tools/Autorun/TTFont.cpp | 4 +- Core/Tools/Autorun/autorun.cpp | 16 +- Core/Tools/Babylon/BabylonDlg.cpp | 2 +- Core/Tools/ImagePacker/Source/ImageInfo.cpp | 4 +- Core/Tools/ImagePacker/Source/ImagePacker.cpp | 150 ++++----- Core/Tools/ImagePacker/Source/TexturePage.cpp | 164 ++++----- Core/Tools/ImagePacker/Source/WinMain.cpp | 4 +- .../WindowProcedures/DirectorySelect.cpp | 38 +-- .../WindowProcedures/ImageErrorProc.cpp | 18 +- .../WindowProcedures/ImagePackerProc.cpp | 50 +-- .../Source/WindowProcedures/PageErrorProc.cpp | 16 +- .../Source/WindowProcedures/PreviewProc.cpp | 22 +- Core/Tools/Launcher/findpatch.cpp | 4 +- Core/Tools/MapCacheBuilder/Source/WinMain.cpp | 2 +- Core/Tools/WW3D/max2w3d/bchannel.cpp | 10 +- Core/Tools/WW3D/max2w3d/logdlg.cpp | 14 +- Core/Tools/WW3D/max2w3d/motion.cpp | 2 +- Core/Tools/WW3D/max2w3d/vchannel.cpp | 44 +-- Core/Tools/WW3D/max2w3d/vxl.cpp | 4 +- .../buildVersionUpdate/buildVersionUpdate.cpp | 6 +- Core/Tools/matchbot/generals.cpp | 4 +- Core/Tools/versionUpdate/versionUpdate.cpp | 6 +- Dependencies/Utility/Utility/compat.h | 3 +- Dependencies/Utility/Utility/endian_compat.h | 3 +- Dependencies/Utility/Utility/intrin_compat.h | 4 +- Dependencies/Utility/Utility/mem_compat.h | 3 +- Dependencies/Utility/Utility/stdint_adapter.h | 2 +- Dependencies/Utility/Utility/string_compat.h | 3 +- Dependencies/Utility/Utility/tchar_compat.h | 3 +- Dependencies/Utility/Utility/thread_compat.h | 3 +- Dependencies/Utility/Utility/time_compat.h | 3 +- Dependencies/Utility/Utility/wchar_compat.h | 3 +- .../GameEngine/Include/Common/BitFlagsIO.h | 14 +- .../Include/Common/BuildAssistant.h | 2 +- .../Include/Common/FunctionLexicon.h | 2 +- .../GameEngine/Include/Common/GameCommon.h | 2 +- .../Code/GameEngine/Include/Common/Module.h | 2 +- .../GameEngine/Include/Common/ModuleFactory.h | 2 +- .../Include/Common/NameKeyGenerator.h | 2 +- .../Include/Common/SparseMatchFinder.h | 4 +- .../Include/Common/SubsystemInterface.h | 2 +- .../Include/GameClient/DisplayString.h | 2 +- .../Include/GameClient/GameWindow.h | 2 +- .../Include/GameClient/GameWindowManager.h | 2 +- .../GameEngine/Include/GameClient/Image.h | 4 +- .../GameEngine/Include/GameClient/KeyDefs.h | 4 +- .../GameEngine/Include/GameClient/Keyboard.h | 4 +- .../GameEngine/Include/GameClient/Mouse.h | 2 +- .../GameEngine/Include/GameClient/RayEffect.h | 4 +- .../GameEngine/Include/GameClient/Shell.h | 2 +- .../Include/GameClient/TerrainVisual.h | 2 +- .../Include/GameClient/WindowLayout.h | 2 +- .../Code/GameEngine/Include/GameLogic/AI.h | 2 +- .../GameLogic/Module/RailroadGuideAIUpdate.h | 2 +- .../GameEngine/Include/GameLogic/Object.h | 2 +- .../Include/GameLogic/PartitionManager.h | 2 +- .../Include/GameLogic/ScriptActions.h | 4 +- .../Include/GameLogic/ScriptConditions.h | 4 +- .../Include/GameLogic/ScriptEngine.h | 2 +- .../Include/GameLogic/TerrainLogic.h | 2 +- .../GameEngine/Source/Common/GameEngine.cpp | 10 +- .../Code/GameEngine/Source/Common/GameLOD.cpp | 2 - .../GameEngine/Source/Common/GlobalData.cpp | 16 +- .../Code/GameEngine/Source/Common/INI/INI.cpp | 50 +-- .../Source/Common/INI/INIAnimation.cpp | 8 +- .../Source/Common/INI/INICommandButton.cpp | 4 +- .../Source/Common/INI/INICommandSet.cpp | 2 +- .../Source/Common/INI/INIControlBarScheme.cpp | 2 +- .../Source/Common/INI/INIMapData.cpp | 2 +- .../Source/Common/INI/INIMappedImage.cpp | 4 +- .../Source/Common/INI/INIMultiplayer.cpp | 4 +- .../Source/Common/INI/INITerrain.cpp | 2 +- .../Source/Common/INI/INITerrainBridge.cpp | 4 +- .../Source/Common/INI/INITerrainRoad.cpp | 4 +- .../GameEngine/Source/Common/INI/INIWater.cpp | 6 +- .../Source/Common/INI/INIWebpageURL.cpp | 2 +- .../Source/Common/MultiplayerSettings.cpp | 2 +- .../Source/Common/NameKeyGenerator.cpp | 14 +- .../Source/Common/RTS/ActionManager.cpp | 24 +- .../GameEngine/Source/Common/RTS/Energy.cpp | 10 +- .../Source/Common/RTS/MissionStats.cpp | 6 +- .../GameEngine/Source/Common/RTS/Money.cpp | 6 +- .../GameEngine/Source/Common/RTS/Player.cpp | 120 +++---- .../Source/Common/RTS/PlayerList.cpp | 18 +- .../Source/Common/RTS/PlayerTemplate.cpp | 2 +- .../Common/RTS/ProductionPrerequisite.cpp | 4 +- .../Common/RTS/ResourceGatheringManager.cpp | 6 +- .../Source/Common/RTS/ScoreKeeper.cpp | 24 +- .../Source/Common/RTS/SpecialPower.cpp | 18 +- .../GameEngine/Source/Common/RTS/Team.cpp | 96 +++--- .../Source/Common/RTS/TunnelTracker.cpp | 24 +- .../GameEngine/Source/Common/Recorder.cpp | 2 +- .../GameEngine/Source/Common/StateMachine.cpp | 6 +- .../Source/Common/System/BuildAssistant.cpp | 110 +++--- .../Source/Common/System/FunctionLexicon.cpp | 48 +-- .../Source/Common/System/Geometry.cpp | 6 +- .../GameEngine/Source/Common/System/Radar.cpp | 158 ++++----- .../Common/System/SaveGame/GameState.cpp | 174 +++++----- .../Common/System/SaveGame/GameStateMap.cpp | 52 +-- .../Source/Common/System/Snapshot.cpp | 4 +- .../Source/Common/System/Upgrade.cpp | 40 +-- .../GameEngine/Source/Common/TerrainTypes.cpp | 18 +- .../Source/Common/Thing/DrawModule.cpp | 6 +- .../GameEngine/Source/Common/Thing/Module.cpp | 28 +- .../Source/Common/Thing/ModuleFactory.cpp | 4 +- .../GameEngine/Source/Common/Thing/Thing.cpp | 4 +- .../Source/Common/Thing/ThingFactory.cpp | 26 +- .../Source/Common/Thing/ThingTemplate.cpp | 8 +- .../Source/Common/UserPreferences.cpp | 2 +- .../GameEngine/Source/GameClient/Color.cpp | 4 +- .../GameEngine/Source/GameClient/Credits.cpp | 2 +- .../GameEngine/Source/GameClient/Display.cpp | 4 +- .../Source/GameClient/DisplayString.cpp | 16 +- .../GameClient/DisplayStringManager.cpp | 10 +- .../GameEngine/Source/GameClient/Drawable.cpp | 120 +++---- .../AnimatedParticleSysBoneClientUpdate.cpp | 6 +- .../Drawable/Update/BeaconClientUpdate.cpp | 8 +- .../Drawable/Update/SwayClientUpdate.cpp | 6 +- .../GameClient/GUI/ControlBar/ControlBar.cpp | 150 ++++----- .../GUI/ControlBar/ControlBarBeacon.cpp | 6 +- .../GUI/ControlBar/ControlBarCommand.cpp | 74 ++--- .../ControlBarCommandProcessing.cpp | 54 +-- .../GUI/ControlBar/ControlBarMultiSelect.cpp | 34 +- .../GUI/ControlBar/ControlBarOCLTimer.cpp | 6 +- .../GUI/ControlBar/ControlBarObserver.cpp | 8 +- .../GUI/ControlBar/ControlBarResizer.cpp | 2 +- .../GUI/ControlBar/ControlBarScheme.cpp | 4 +- .../ControlBarStructureInventory.cpp | 8 +- .../ControlBarUnderConstruction.cpp | 8 +- .../GUI/GUICallbacks/ControlBarCallback.cpp | 30 +- .../ControlBarPopupDescription.cpp | 2 +- .../GameClient/GUI/GUICallbacks/Diplomacy.cpp | 18 +- .../GUI/GUICallbacks/ExtendedMessageBox.cpp | 20 +- .../GUI/GUICallbacks/GeneralsExpPoints.cpp | 18 +- .../GUI/GUICallbacks/IMECandidate.cpp | 22 +- .../GUI/GUICallbacks/InGameChat.cpp | 20 +- .../GUI/GUICallbacks/InGamePopupMessage.cpp | 18 +- .../GUI/GUICallbacks/Menus/CreditsMenu.cpp | 30 +- .../GUICallbacks/Menus/DifficultySelect.cpp | 16 +- .../GUICallbacks/Menus/DisconnectWindow.cpp | 22 +- .../GUI/GUICallbacks/Menus/DownloadMenu.cpp | 32 +- .../Menus/EstablishConnectionsWindow.cpp | 2 +- .../GUI/GUICallbacks/Menus/GameInfoWindow.cpp | 12 +- .../Menus/KeyboardOptionsMenu.cpp | 44 +-- .../GUICallbacks/Menus/LanGameOptionsMenu.cpp | 46 +-- .../GUI/GUICallbacks/Menus/LanLobbyMenu.cpp | 50 +-- .../GUICallbacks/Menus/LanMapSelectMenu.cpp | 36 +- .../GUI/GUICallbacks/Menus/MainMenu.cpp | 48 +-- .../GUI/GUICallbacks/Menus/MapSelectMenu.cpp | 42 +-- .../Menus/NetworkDirectConnect.cpp | 36 +- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 32 +- .../GUICallbacks/Menus/PopupCommunicator.cpp | 30 +- .../GUI/GUICallbacks/Menus/PopupHostGame.cpp | 24 +- .../GUI/GUICallbacks/Menus/PopupJoinGame.cpp | 18 +- .../GUICallbacks/Menus/PopupLadderSelect.cpp | 28 +- .../GUICallbacks/Menus/PopupPlayerInfo.cpp | 30 +- .../GUI/GUICallbacks/Menus/PopupReplay.cpp | 34 +- .../GUI/GUICallbacks/Menus/PopupSaveLoad.cpp | 78 ++--- .../GUI/GUICallbacks/Menus/QuitMenu.cpp | 18 +- .../GUI/GUICallbacks/Menus/ReplayMenu.cpp | 36 +- .../GUI/GUICallbacks/Menus/ScoreScreen.cpp | 18 +- .../GUICallbacks/Menus/SinglePlayerMenu.cpp | 40 +-- .../Menus/SkirmishGameOptionsMenu.cpp | 38 +-- .../Menus/SkirmishMapSelectMenu.cpp | 36 +- .../GUICallbacks/Menus/WOLBuddyOverlay.cpp | 50 +-- .../Menus/WOLCustomScoreScreen.cpp | 34 +- .../GUICallbacks/Menus/WOLGameSetupMenu.cpp | 44 +-- .../GUICallbacks/Menus/WOLLadderScreen.cpp | 32 +- .../GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp | 42 +-- .../Menus/WOLLocaleSelectPopup.cpp | 26 +- .../GUI/GUICallbacks/Menus/WOLLoginMenu.cpp | 48 +-- .../GUICallbacks/Menus/WOLMapSelectMenu.cpp | 36 +- .../GUICallbacks/Menus/WOLMessageWindow.cpp | 30 +- .../GUICallbacks/Menus/WOLQMScoreScreen.cpp | 34 +- .../GUICallbacks/Menus/WOLQuickMatchMenu.cpp | 44 +-- .../GUI/GUICallbacks/Menus/WOLStatusMenu.cpp | 32 +- .../GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp | 40 +-- .../GUI/GUICallbacks/MessageBox.cpp | 36 +- .../GUI/GUICallbacks/ReplayControls.cpp | 8 +- .../GameClient/GUI/Gadget/GadgetCheckBox.cpp | 44 +-- .../GameClient/GUI/Gadget/GadgetComboBox.cpp | 64 ++-- .../GUI/Gadget/GadgetHorizontalSlider.cpp | 44 +-- .../GameClient/GUI/Gadget/GadgetListBox.cpp | 180 +++++----- .../GUI/Gadget/GadgetProgressBar.cpp | 8 +- .../GUI/Gadget/GadgetPushButton.cpp | 62 ++-- .../GUI/Gadget/GadgetRadioButton.cpp | 68 ++-- .../GUI/Gadget/GadgetStaticText.cpp | 18 +- .../GUI/Gadget/GadgetTabControl.cpp | 8 +- .../GameClient/GUI/Gadget/GadgetTextEntry.cpp | 20 +- .../GUI/Gadget/GadgetVerticalSlider.cpp | 22 +- .../Source/GameClient/GUI/GameFont.cpp | 26 +- .../Source/GameClient/GUI/GameWindow.cpp | 266 +++++++-------- .../GameClient/GUI/GameWindowGlobal.cpp | 26 +- .../GameClient/GUI/GameWindowManager.cpp | 286 ++++++++-------- .../GUI/GameWindowManagerScript.cpp | 218 ++++++------ .../GUI/GameWindowTransitionsStyles.cpp | 26 +- .../Source/GameClient/GUI/HeaderTemplate.cpp | 4 +- .../Source/GameClient/GUI/Shell/Shell.cpp | 66 ++-- .../GameClient/GUI/Shell/ShellMenuScheme.cpp | 2 +- .../Source/GameClient/GUI/WinInstanceData.cpp | 16 +- .../Source/GameClient/GUI/WindowLayout.cpp | 32 +- .../Source/GameClient/GameClient.cpp | 90 ++--- .../Source/GameClient/GameClientDispatch.cpp | 2 +- .../Source/GameClient/GlobalLanguage.cpp | 2 +- .../GameEngine/Source/GameClient/InGameUI.cpp | 176 +++++----- .../Source/GameClient/Input/Keyboard.cpp | 70 ++-- .../Source/GameClient/Input/Mouse.cpp | 54 +-- .../GameEngine/Source/GameClient/Line2D.cpp | 4 +- .../GameEngine/Source/GameClient/MapUtil.cpp | 18 +- .../GameClient/MessageStream/CommandXlat.cpp | 152 ++++----- .../MessageStream/GUICommandTranslator.cpp | 40 +-- .../GameClient/MessageStream/HotKey.cpp | 2 +- .../GameClient/MessageStream/LookAtXlat.cpp | 10 +- .../MessageStream/PlaceEventTranslator.cpp | 14 +- .../MessageStream/SelectionXlat.cpp | 10 +- .../GameClient/MessageStream/WindowXlat.cpp | 14 +- .../Source/GameClient/SelectionInfo.cpp | 2 +- .../Source/GameClient/System/Anim2D.cpp | 112 +++---- .../GameClient/System/CampaignManager.cpp | 4 +- .../Source/GameClient/System/Image.cpp | 38 +-- .../Source/GameClient/System/ParticleSys.cpp | 146 ++++---- .../Source/GameClient/System/RayEffect.cpp | 28 +- .../GameClient/Terrain/TerrainRoads.cpp | 50 +-- .../GameClient/Terrain/TerrainVisual.cpp | 18 +- .../GameEngine/Source/GameClient/View.cpp | 4 +- .../GameEngine/Source/GameClient/Water.cpp | 4 +- .../GameEngine/Source/GameLogic/AI/AI.cpp | 14 +- .../GameEngine/Source/GameLogic/AI/AIDock.cpp | 8 +- .../Source/GameLogic/AI/AIGroup.cpp | 26 +- .../Source/GameLogic/AI/AIGuard.cpp | 30 +- .../Source/GameLogic/AI/AIPathfind.cpp | 26 +- .../Source/GameLogic/AI/AIPlayer.cpp | 84 ++--- .../Source/GameLogic/AI/AISkirmishPlayer.cpp | 16 +- .../Source/GameLogic/AI/AIStates.cpp | 194 +++++------ .../Source/GameLogic/AI/AITNGuard.cpp | 30 +- .../GameEngine/Source/GameLogic/AI/Squad.cpp | 16 +- .../Source/GameLogic/AI/TurretAI.cpp | 33 +- .../Source/GameLogic/Map/PolygonTrigger.cpp | 8 +- .../Source/GameLogic/Map/SidesList.cpp | 18 +- .../Source/GameLogic/Map/TerrainLogic.cpp | 162 ++++----- .../Object/Behavior/AutoHealBehavior.cpp | 8 +- .../Object/Behavior/BehaviorModule.cpp | 6 +- .../Object/Behavior/BridgeBehavior.cpp | 160 ++++----- .../Behavior/BridgeScaffoldBehavior.cpp | 34 +- .../Object/Behavior/BridgeTowerBehavior.cpp | 48 +-- .../Behavior/DumbProjectileBehavior.cpp | 18 +- .../FireWeaponWhenDamagedBehavior.cpp | 6 +- .../Behavior/FireWeaponWhenDeadBehavior.cpp | 6 +- .../Behavior/GenerateMinefieldBehavior.cpp | 6 +- .../Object/Behavior/InstantDeathBehavior.cpp | 6 +- .../Object/Behavior/JetSlowDeathBehavior.cpp | 36 +- .../Object/Behavior/MinefieldBehavior.cpp | 10 +- .../Object/Behavior/OverchargeBehavior.cpp | 40 +-- .../Object/Behavior/POWTruckBehavior.cpp | 16 +- .../Object/Behavior/ParkingPlaceBehavior.cpp | 34 +- .../Object/Behavior/PoisonedBehavior.cpp | 6 +- .../Object/Behavior/PrisonBehavior.cpp | 54 +-- .../Behavior/PropagandaCenterBehavior.cpp | 40 +-- .../Behavior/PropagandaTowerBehavior.cpp | 76 ++--- .../Object/Behavior/RebuildHoleBehavior.cpp | 58 ++-- .../Object/Behavior/SlowDeathBehavior.cpp | 6 +- .../Object/Behavior/SpawnBehavior.cpp | 28 +- .../SupplyWarehouseCripplingBehavior.cpp | 6 +- .../Object/Behavior/TechBuildingBehavior.cpp | 12 +- .../GameLogic/Object/Body/ActiveBody.cpp | 58 ++-- .../GameLogic/Object/Body/BodyModule.cpp | 6 +- .../GameLogic/Object/Body/HighlanderBody.cpp | 6 +- .../Object/Body/HiveStructureBody.cpp | 2 +- .../GameLogic/Object/Body/ImmortalBody.cpp | 6 +- .../GameLogic/Object/Body/InactiveBody.cpp | 12 +- .../GameLogic/Object/Body/StructureBody.cpp | 12 +- .../Object/Collide/CollideModule.cpp | 6 +- .../ConvertToCarBombCrateCollide.cpp | 6 +- .../ConvertToHijackedVehicleCrateCollide.cpp | 8 +- .../Collide/CrateCollide/CrateCollide.cpp | 6 +- .../Collide/CrateCollide/HealCrateCollide.cpp | 6 +- .../CrateCollide/MoneyCrateCollide.cpp | 6 +- .../CrateCollide/SalvageCrateCollide.cpp | 6 +- .../CrateCollide/ShroudCrateCollide.cpp | 6 +- .../Collide/CrateCollide/UnitCrateCollide.cpp | 6 +- .../CrateCollide/VeterancyCrateCollide.cpp | 6 +- .../Object/Collide/FireWeaponCollide.cpp | 10 +- .../Object/Collide/SquishCollide.cpp | 6 +- .../GameLogic/Object/Contain/CaveContain.cpp | 14 +- .../Object/Contain/GarrisonContain.cpp | 154 ++++----- .../GameLogic/Object/Contain/HealContain.cpp | 26 +- .../Object/Contain/MobNexusContain.cpp | 10 +- .../GameLogic/Object/Contain/OpenContain.cpp | 60 ++-- .../Object/Contain/OverlordContain.cpp | 6 +- .../Object/Contain/ParachuteContain.cpp | 6 +- .../Object/Contain/RailedTransportContain.cpp | 20 +- .../Object/Contain/TransportContain.cpp | 10 +- .../Object/Contain/TunnelContain.cpp | 10 +- .../GameLogic/Object/Create/CreateModule.cpp | 10 +- .../Object/Create/GrantUpgradeCreate.cpp | 14 +- .../Object/Create/PreorderCreate.cpp | 6 +- .../Object/Create/SpecialPowerCreate.cpp | 6 +- .../Object/Create/SupplyCenterCreate.cpp | 6 +- .../Object/Create/SupplyWarehouseCreate.cpp | 6 +- .../Object/Create/VeterancyGainCreate.cpp | 6 +- .../GameLogic/Object/Damage/BoneFXDamage.cpp | 12 +- .../GameLogic/Object/Damage/DamageModule.cpp | 6 +- .../Object/Damage/TransitionDamageFX.cpp | 72 ++-- .../Object/Destroy/DestroyModule.cpp | 10 +- .../GameLogic/Object/Die/CreateCrateDie.cpp | 6 +- .../GameLogic/Object/Die/CreateObjectDie.cpp | 8 +- .../Source/GameLogic/Object/Die/CrushDie.cpp | 6 +- .../Source/GameLogic/Object/Die/DamDie.cpp | 18 +- .../GameLogic/Object/Die/DestroyDie.cpp | 6 +- .../Source/GameLogic/Object/Die/DieModule.cpp | 6 +- .../GameLogic/Object/Die/EjectPilotDie.cpp | 6 +- .../Source/GameLogic/Object/Die/FXListDie.cpp | 6 +- .../GameLogic/Object/Die/KeepObjectDie.cpp | 6 +- .../Object/Die/RebuildHoleExposeDie.cpp | 16 +- .../Object/Die/SpecialPowerCompletionDie.cpp | 6 +- .../GameLogic/Object/Die/UpgradeDie.cpp | 6 +- .../GameLogic/Object/ExperienceTracker.cpp | 6 +- .../Source/GameLogic/Object/FiringTracker.cpp | 6 +- .../Source/GameLogic/Object/GhostObject.cpp | 18 +- .../Object/Helper/ObjectDefectionHelper.cpp | 6 +- .../GameLogic/Object/Helper/ObjectHelper.cpp | 8 +- .../Object/Helper/ObjectRepulsorHelper.cpp | 6 +- .../Object/Helper/ObjectSMCHelper.cpp | 6 +- .../Helper/ObjectWeaponStatusHelper.cpp | 6 +- .../Source/GameLogic/Object/Locomotor.cpp | 12 +- .../Source/GameLogic/Object/Object.cpp | 68 ++-- .../Source/GameLogic/Object/ObjectTypes.cpp | 10 +- .../GameLogic/Object/PartitionManager.cpp | 71 ++-- .../SpecialPower/BaikonurLaunchPower.cpp | 8 +- .../Object/SpecialPower/CashBountyPower.cpp | 12 +- .../SpecialPower/CashHackSpecialPower.cpp | 12 +- .../Object/SpecialPower/CleanupAreaPower.cpp | 8 +- .../SpecialPower/DefectorSpecialPower.cpp | 14 +- .../SpecialPower/DemoralizeSpecialPower.cpp | 24 +- .../Object/SpecialPower/OCLSpecialPower.cpp | 6 +- .../Object/SpecialPower/SpecialAbility.cpp | 10 +- .../SpecialPower/SpecialPowerModule.cpp | 28 +- .../SpecialPower/SpyVisionSpecialPower.cpp | 8 +- .../GameLogic/Object/Update/AIUpdate.cpp | 24 +- .../AIUpdate/AssaultTransportAIUpdate.cpp | 6 +- .../Update/AIUpdate/ChinookAIUpdate.cpp | 6 +- .../AIUpdate/DeliverPayloadAIUpdate.cpp | 30 +- .../Update/AIUpdate/DeployStyleAIUpdate.cpp | 6 +- .../Object/Update/AIUpdate/DozerAIUpdate.cpp | 234 ++++++------- .../Update/AIUpdate/HackInternetAIUpdate.cpp | 24 +- .../Object/Update/AIUpdate/JetAIUpdate.cpp | 6 +- .../Update/AIUpdate/MissileAIUpdate.cpp | 12 +- .../Update/AIUpdate/POWTruckAIUpdate.cpp | 108 +++--- .../AIUpdate/RailedTransportAIUpdate.cpp | 44 +-- .../Update/AIUpdate/RailroadGuideAIUpdate.cpp | 18 +- .../Update/AIUpdate/SupplyTruckAIUpdate.cpp | 12 +- .../Update/AIUpdate/TransportAIUpdate.cpp | 6 +- .../Object/Update/AIUpdate/WanderAIUpdate.cpp | 8 +- .../Object/Update/AIUpdate/WorkerAIUpdate.cpp | 68 ++-- .../Object/Update/AssistedTargetingUpdate.cpp | 6 +- .../Object/Update/AutoDepositUpdate.cpp | 8 +- .../Object/Update/AutoFindHealingUpdate.cpp | 8 +- .../Object/Update/BaseRenerateUpdate.cpp | 8 +- .../Object/Update/BattlePlanUpdate.cpp | 12 +- .../GameLogic/Object/Update/BoneFXUpdate.cpp | 40 +-- .../Object/Update/CheckpointUpdate.cpp | 10 +- .../Object/Update/CleanupHazardUpdate.cpp | 6 +- .../Object/Update/CommandButtonHuntUpdate.cpp | 16 +- .../Update/DelayedWeaponSetUpgradeUpdate.cpp | 8 +- .../Object/Update/DeletionUpdate.cpp | 6 +- .../Object/Update/DemoTrapUpdate.cpp | 6 +- .../Object/Update/DockUpdate/DockUpdate.cpp | 8 +- .../Update/DockUpdate/PrisonDockUpdate.cpp | 12 +- .../DockUpdate/RailedTransportDockUpdate.cpp | 54 +-- .../Update/DockUpdate/RepairDockUpdate.cpp | 20 +- .../DockUpdate/SupplyCenterDockUpdate.cpp | 8 +- .../DockUpdate/SupplyWarehouseDockUpdate.cpp | 8 +- .../Update/DynamicGeometryInfoUpdate.cpp | 14 +- .../DynamicShroudClearingRangeUpdate.cpp | 6 +- .../GameLogic/Object/Update/EMPUpdate.cpp | 6 +- .../Object/Update/EnemyNearUpdate.cpp | 6 +- .../FireOCLAfterWeaponCooldownUpdate.cpp | 6 +- .../Object/Update/FireSpreadUpdate.cpp | 6 +- .../Object/Update/FireWeaponUpdate.cpp | 6 +- .../FirestormDynamicGeometryInfoUpdate.cpp | 28 +- .../Object/Update/FlammableUpdate.cpp | 6 +- .../GameLogic/Object/Update/FloatUpdate.cpp | 16 +- .../Object/Update/HeightDieUpdate.cpp | 30 +- .../Update/HelicopterSlowDeathUpdate.cpp | 52 +-- .../Object/Update/HijackerUpdate.cpp | 10 +- .../GameLogic/Object/Update/HordeUpdate.cpp | 8 +- .../GameLogic/Object/Update/LaserUpdate.cpp | 6 +- .../Object/Update/LifetimeUpdate.cpp | 6 +- .../Update/MissileLauncherBuildingUpdate.cpp | 6 +- .../Object/Update/MobMemberSlavedUpdate.cpp | 6 +- .../Update/NeutronMissileSlowDeathUpdate.cpp | 52 +-- .../Object/Update/NeutronMissileUpdate.cpp | 12 +- .../GameLogic/Object/Update/OCLUpdate.cpp | 6 +- .../Update/ParticleUplinkCannonUpdate.cpp | 6 +- .../GameLogic/Object/Update/PhysicsUpdate.cpp | 10 +- .../Object/Update/PilotFindVehicleUpdate.cpp | 6 +- .../Object/Update/PointDefenseLaserUpdate.cpp | 8 +- .../Object/Update/PowerPlantUpdate.cpp | 16 +- .../DefaultProductionExitUpdate.cpp | 6 +- .../QueueProductionExitUpdate.cpp | 6 +- .../SpawnPointProductionExitUpdate.cpp | 6 +- .../SupplyCenterProductionExitUpdate.cpp | 6 +- .../Object/Update/ProductionUpdate.cpp | 140 ++++---- .../Object/Update/ProjectileStreamUpdate.cpp | 6 +- .../GameLogic/Object/Update/ProneUpdate.cpp | 6 +- .../GameLogic/Object/Update/RadarUpdate.cpp | 18 +- .../Object/Update/RadiusDecalUpdate.cpp | 6 +- .../GameLogic/Object/Update/SlavedUpdate.cpp | 6 +- .../Object/Update/SpecialAbilityUpdate.cpp | 6 +- .../Object/Update/SpyVisionUpdate.cpp | 6 +- .../Object/Update/StealthDetectorUpdate.cpp | 20 +- .../GameLogic/Object/Update/StealthUpdate.cpp | 14 +- .../Object/Update/StickyBombUpdate.cpp | 6 +- .../Object/Update/StructureCollapseUpdate.cpp | 6 +- .../Object/Update/StructureToppleUpdate.cpp | 6 +- .../Object/Update/TensileFormationUpdate.cpp | 16 +- .../GameLogic/Object/Update/ToppleUpdate.cpp | 8 +- .../GameLogic/Object/Update/UpdateModule.cpp | 6 +- .../Object/Update/WaveGuideUpdate.cpp | 110 +++--- .../Object/Upgrade/ActiveShroudUpgrade.cpp | 16 +- .../GameLogic/Object/Upgrade/ArmorUpgrade.cpp | 6 +- .../Object/Upgrade/CommandSetUpgrade.cpp | 6 +- .../Object/Upgrade/CostModifierUpgrade.cpp | 24 +- .../Object/Upgrade/DelayedUpgrade.cpp | 6 +- .../Upgrade/ExperienceScalarUpgrade.cpp | 8 +- .../Object/Upgrade/LocomotorSetUpgrade.cpp | 6 +- .../Object/Upgrade/MaxHealthUpgrade.cpp | 8 +- .../Object/Upgrade/ObjectCreationUpgrade.cpp | 16 +- .../Object/Upgrade/PowerPlantUpgrade.cpp | 16 +- .../GameLogic/Object/Upgrade/RadarUpgrade.cpp | 20 +- .../Object/Upgrade/StatusBitsUpgrade.cpp | 6 +- .../Object/Upgrade/StealthUpgrade.cpp | 6 +- .../Object/Upgrade/SubObjectsUpgrade.cpp | 6 +- .../Upgrade/UnpauseSpecialPowerUpgrade.cpp | 8 +- .../Object/Upgrade/UpgradeModule.cpp | 6 +- .../Object/Upgrade/WeaponBonusUpgrade.cpp | 6 +- .../Object/Upgrade/WeaponSetUpgrade.cpp | 6 +- .../Source/GameLogic/Object/Weapon.cpp | 24 +- .../Source/GameLogic/Object/WeaponSet.cpp | 4 +- .../GameLogic/ScriptEngine/ScriptActions.cpp | 18 +- .../ScriptEngine/ScriptConditions.cpp | 10 +- .../GameLogic/ScriptEngine/ScriptEngine.cpp | 202 +++++------ .../Source/GameLogic/ScriptEngine/Scripts.cpp | 18 +- .../Source/GameLogic/System/CaveSystem.cpp | 12 +- .../Source/GameLogic/System/Damage.cpp | 6 +- .../Source/GameLogic/System/GameLogic.cpp | 100 +++--- .../GameLogic/System/GameLogicDispatch.cpp | 112 +++---- .../Source/GameNetwork/GameInfo.cpp | 18 +- .../Source/GameNetwork/GameSpy/Chat.cpp | 2 +- .../GameSpy/Thread/GameResultsThread.cpp | 2 +- .../Source/GameNetwork/GameSpyOverlay.cpp | 2 +- .../GameEngine/Source/GameNetwork/LANAPI.cpp | 4 +- .../Source/GameNetwork/LANAPICallbacks.cpp | 20 +- .../Source/GameNetwork/NetCommandMsg.cpp | 2 +- .../Source/GameNetwork/NetPacket.cpp | 2 +- .../Source/GameNetwork/Transport.cpp | 2 +- .../W3DDevice/Common/W3DThingFactory.h | 2 +- .../Include/W3DDevice/GameClient/W3DDisplay.h | 2 +- .../W3DDevice/GameClient/W3DGameClient.h | 2 +- .../W3DDevice/GameClient/W3DGameFont.h | 2 +- .../W3DDevice/GameClient/W3DGameWindow.h | 2 +- .../GameClient/W3DGameWindowManager.h | 2 +- .../W3DDevice/GameClient/W3DInGameUI.h | 2 +- .../Include/W3DDevice/GameClient/W3DMouse.h | 2 +- .../Include/W3DDevice/GameClient/W3DScene.h | 6 +- .../Include/W3DDevice/GameClient/W3DShadow.h | 2 +- .../W3DDevice/GameClient/W3DTerrainTracks.h | 2 +- .../W3DDevice/GameClient/W3DTerrainVisual.h | 2 +- .../Include/W3DDevice/GameClient/W3DView.h | 2 +- .../GameClient/W3DVolumetricShadow.h | 4 +- .../W3DDevice/GameClient/W3DWaterTracks.h | 2 +- .../W3DDevice/GameLogic/W3DGameLogic.h | 2 +- .../W3DDevice/GameLogic/W3DTerrainLogic.h | 2 +- .../Win32Device/Common/Win32GameEngine.h | 2 +- .../Win32Device/GameClient/Win32DIKeyboard.h | 2 +- .../Win32Device/GameClient/Win32DIMouse.h | 2 +- .../Win32Device/GameClient/Win32Mouse.h | 2 +- .../Common/System/W3DFunctionLexicon.cpp | 10 +- .../W3DDevice/Common/System/W3DRadar.cpp | 114 +++---- .../Common/Thing/W3DModuleFactory.cpp | 2 +- .../Common/Thing/W3DThingFactory.cpp | 4 +- .../Source/W3DDevice/Common/W3DConvert.cpp | 4 +- .../Drawable/Draw/W3DDebrisDraw.cpp | 6 +- .../Drawable/Draw/W3DDefaultDraw.cpp | 6 +- .../Drawable/Draw/W3DDependencyModelDraw.cpp | 6 +- .../GameClient/Drawable/Draw/W3DLaserDraw.cpp | 12 +- .../GameClient/Drawable/Draw/W3DModelDraw.cpp | 50 +-- .../Drawable/Draw/W3DOverlordTankDraw.cpp | 6 +- .../Drawable/Draw/W3DPoliceCarDraw.cpp | 12 +- .../Drawable/Draw/W3DProjectileStreamDraw.cpp | 6 +- .../GameClient/Drawable/Draw/W3DRopeDraw.cpp | 6 +- .../Drawable/Draw/W3DScienceModelDraw.cpp | 6 +- .../Drawable/Draw/W3DSupplyDraw.cpp | 6 +- .../GameClient/Drawable/Draw/W3DTankDraw.cpp | 6 +- .../Drawable/Draw/W3DTankTruckDraw.cpp | 6 +- .../Drawable/Draw/W3DTracerDraw.cpp | 8 +- .../GameClient/Drawable/Draw/W3DTruckDraw.cpp | 6 +- .../GUI/GUICallbacks/W3DControlBar.cpp | 22 +- .../GameClient/GUI/GUICallbacks/W3DMOTD.cpp | 10 +- .../GUI/GUICallbacks/W3DMainMenu.cpp | 20 +- .../GameClient/GUI/Gadget/W3DCheckBox.cpp | 28 +- .../GameClient/GUI/Gadget/W3DComboBox.cpp | 16 +- .../GUI/Gadget/W3DHorizontalSlider.cpp | 22 +- .../GameClient/GUI/Gadget/W3DListBox.cpp | 58 ++-- .../GameClient/GUI/Gadget/W3DProgressBar.cpp | 32 +- .../GameClient/GUI/Gadget/W3DPushButton.cpp | 38 +-- .../GameClient/GUI/Gadget/W3DRadioButton.cpp | 26 +- .../GameClient/GUI/Gadget/W3DStaticText.cpp | 24 +- .../GameClient/GUI/Gadget/W3DTabControl.cpp | 4 +- .../GameClient/GUI/Gadget/W3DTextEntry.cpp | 26 +- .../GUI/Gadget/W3DVerticalSlider.cpp | 24 +- .../W3DDevice/GameClient/GUI/W3DGameFont.cpp | 6 +- .../GameClient/GUI/W3DGameWindow.cpp | 50 +-- .../GameClient/GUI/W3DGameWindowManager.cpp | 6 +- .../Source/W3DDevice/GameClient/HeightMap.cpp | 10 +- .../GameClient/Shadow/W3DProjectedShadow.cpp | 26 +- .../GameClient/Shadow/W3DVolumetricShadow.cpp | 164 ++++----- .../W3DDevice/GameClient/W3DBridgeBuffer.cpp | 12 +- .../W3DDevice/GameClient/W3DDisplay.cpp | 54 +-- .../W3DDevice/GameClient/W3DDisplayString.cpp | 30 +- .../GameClient/W3DDisplayStringManager.cpp | 12 +- .../W3DDevice/GameClient/W3DFileSystem.cpp | 30 +- .../W3DDevice/GameClient/W3DGameClient.cpp | 20 +- .../W3DDevice/GameClient/W3DInGameUI.cpp | 46 +-- .../Source/W3DDevice/GameClient/W3DMouse.cpp | 10 +- .../W3DDevice/GameClient/W3DParticleSys.cpp | 2 +- .../W3DDevice/GameClient/W3DRoadBuffer.cpp | 6 +- .../Source/W3DDevice/GameClient/W3DScene.cpp | 34 +- .../W3DDevice/GameClient/W3DShaderManager.cpp | 6 +- .../W3DDevice/GameClient/W3DTerrainTracks.cpp | 33 +- .../W3DDevice/GameClient/W3DTerrainVisual.cpp | 60 ++-- .../Source/W3DDevice/GameClient/W3DView.cpp | 70 ++-- .../W3DDevice/GameClient/Water/W3DWater.cpp | 48 +-- .../GameClient/Water/W3DWaterTracks.cpp | 30 +- .../W3DDevice/GameLogic/W3DGhostObject.cpp | 70 ++-- .../W3DDevice/GameLogic/W3DTerrainLogic.cpp | 26 +- .../Win32Device/Common/Win32GameEngine.cpp | 10 +- .../GameClient/Win32DIKeyboard.cpp | 46 +-- .../Win32Device/GameClient/Win32DIMouse.cpp | 58 ++-- .../Win32Device/GameClient/Win32Mouse.cpp | 50 +-- .../Code/Libraries/Include/Lib/BaseType.h | 2 +- .../Source/WWVegas/WW3D2/dx8renderer.cpp | 18 +- .../Source/WWVegas/WW3D2/motchan.cpp | 40 +-- Generals/Code/Main/WinMain.cpp | 26 +- .../Code/Tools/GUIEdit/Include/EditWindow.h | 2 +- Generals/Code/Tools/GUIEdit/Include/GUIEdit.h | 2 +- .../Code/Tools/GUIEdit/Include/GUIEditColor.h | 6 +- .../Tools/GUIEdit/Include/GUIEditDisplay.h | 2 +- .../Tools/GUIEdit/Include/HierarchyView.h | 2 +- .../Code/Tools/GUIEdit/Include/LayoutScheme.h | 2 +- .../Dialog Procedures/CallbackEditor.cpp | 30 +- .../Dialog Procedures/CheckBoxProperties.cpp | 18 +- .../Source/Dialog Procedures/ColorDialog.cpp | 112 +++---- .../Dialog Procedures/ComboBoxProperties.cpp | 34 +- .../Dialog Procedures/GenericProperties.cpp | 40 +-- .../Source/Dialog Procedures/GridSettings.cpp | 28 +- .../Dialog Procedures/ListboxProperties.cpp | 44 +-- .../Dialog Procedures/NewLayoutDialog.cpp | 18 +- .../ProgressBarProperties.cpp | 18 +- .../PushButtonProperties.cpp | 18 +- .../RadioButtonProperties.cpp | 24 +- .../Dialog Procedures/SliderProperties.cpp | 38 +-- .../StaticTextProperties.cpp | 20 +- .../TabControlProperties.cpp | 18 +- .../Dialog Procedures/TextEntryProperties.cpp | 24 +- .../Code/Tools/GUIEdit/Source/EditWindow.cpp | 184 +++++----- .../Code/Tools/GUIEdit/Source/GUIEdit.cpp | 314 +++++++++--------- .../Tools/GUIEdit/Source/GUIEditDisplay.cpp | 12 +- .../GUIEdit/Source/GUIEditWindowManager.cpp | 156 ++++----- .../Tools/GUIEdit/Source/HierarchyView.cpp | 144 ++++---- .../Tools/GUIEdit/Source/LayoutScheme.cpp | 122 +++---- .../Code/Tools/GUIEdit/Source/Properties.cpp | 144 ++++---- Generals/Code/Tools/GUIEdit/Source/Save.cpp | 136 ++++---- .../Code/Tools/GUIEdit/Source/WinMain.cpp | 72 ++-- .../Tools/WorldBuilder/src/BlendMaterial.cpp | 2 +- .../Code/Tools/WorldBuilder/src/BuildList.cpp | 6 +- .../Tools/WorldBuilder/src/CameraOptions.cpp | 6 +- .../WorldBuilder/src/EditObjectParameter.cpp | 8 +- .../Tools/WorldBuilder/src/EditParameter.cpp | 8 +- .../Tools/WorldBuilder/src/FeatherOptions.cpp | 6 +- .../Tools/WorldBuilder/src/FenceOptions.cpp | 8 +- .../WorldBuilder/src/GlobalLightOptions.cpp | 6 +- .../Tools/WorldBuilder/src/MapPreview.cpp | 34 +- .../WorldBuilder/src/MeshMoldOptions.cpp | 6 +- .../Tools/WorldBuilder/src/MoundOptions.cpp | 6 +- .../Tools/WorldBuilder/src/ObjectOptions.cpp | 14 +- .../Tools/WorldBuilder/src/PickUnitDialog.cpp | 12 +- .../Tools/WorldBuilder/src/RoadOptions.cpp | 6 +- .../Tools/WorldBuilder/src/ScorchOptions.cpp | 6 +- .../WorldBuilder/src/TerrainMaterial.cpp | 14 +- .../Tools/WorldBuilder/src/TerrainModal.cpp | 8 +- .../Tools/WorldBuilder/src/WBPopupSlider.cpp | 6 +- .../Tools/WorldBuilder/src/WHeightMapEdit.cpp | 4 +- .../Tools/WorldBuilder/src/WaterOptions.cpp | 6 +- .../Tools/WorldBuilder/src/brushoptions.cpp | 6 +- .../Tools/WorldBuilder/src/mapobjectprops.cpp | 6 +- .../Code/Tools/WorldBuilder/src/wbview3d.cpp | 10 +- .../GameEngine/Include/Common/BitFlagsIO.h | 14 +- .../Include/Common/BuildAssistant.h | 2 +- .../Include/Common/FunctionLexicon.h | 2 +- .../GameEngine/Include/Common/GameCommon.h | 2 +- .../Code/GameEngine/Include/Common/Module.h | 2 +- .../GameEngine/Include/Common/ModuleFactory.h | 2 +- .../Include/Common/NameKeyGenerator.h | 2 +- .../Include/Common/SparseMatchFinder.h | 4 +- .../Include/Common/SubsystemInterface.h | 2 +- .../Include/GameClient/DisplayString.h | 2 +- .../Include/GameClient/GameWindow.h | 2 +- .../Include/GameClient/GameWindowManager.h | 2 +- .../GameEngine/Include/GameClient/Image.h | 4 +- .../GameEngine/Include/GameClient/KeyDefs.h | 4 +- .../GameEngine/Include/GameClient/Keyboard.h | 4 +- .../GameEngine/Include/GameClient/Mouse.h | 2 +- .../GameEngine/Include/GameClient/RayEffect.h | 4 +- .../GameEngine/Include/GameClient/Shell.h | 2 +- .../Include/GameClient/TerrainVisual.h | 2 +- .../Include/GameClient/WindowLayout.h | 2 +- .../Code/GameEngine/Include/GameLogic/AI.h | 2 +- .../GameLogic/Module/RailroadGuideAIUpdate.h | 2 +- .../GameEngine/Include/GameLogic/Object.h | 2 +- .../Include/GameLogic/PartitionManager.h | 2 +- .../Include/GameLogic/ScriptActions.h | 4 +- .../Include/GameLogic/ScriptConditions.h | 4 +- .../Include/GameLogic/ScriptEngine.h | 2 +- .../Include/GameLogic/TerrainLogic.h | 2 +- .../GameEngine/Source/Common/GameEngine.cpp | 10 +- .../Code/GameEngine/Source/Common/GameLOD.cpp | 2 - .../GameEngine/Source/Common/GlobalData.cpp | 16 +- .../Code/GameEngine/Source/Common/INI/INI.cpp | 46 +-- .../Source/Common/INI/INIAnimation.cpp | 8 +- .../Source/Common/INI/INICommandButton.cpp | 4 +- .../Source/Common/INI/INICommandSet.cpp | 2 +- .../Source/Common/INI/INIControlBarScheme.cpp | 2 +- .../Source/Common/INI/INIMapData.cpp | 2 +- .../Source/Common/INI/INIMappedImage.cpp | 4 +- .../Source/Common/INI/INIMultiplayer.cpp | 4 +- .../Source/Common/INI/INITerrain.cpp | 2 +- .../Source/Common/INI/INITerrainBridge.cpp | 4 +- .../Source/Common/INI/INITerrainRoad.cpp | 4 +- .../GameEngine/Source/Common/INI/INIWater.cpp | 6 +- .../Source/Common/INI/INIWebpageURL.cpp | 2 +- .../Source/Common/MultiplayerSettings.cpp | 2 +- .../Source/Common/NameKeyGenerator.cpp | 14 +- .../Source/Common/RTS/AcademyStats.cpp | 6 +- .../Source/Common/RTS/ActionManager.cpp | 24 +- .../GameEngine/Source/Common/RTS/Energy.cpp | 10 +- .../Source/Common/RTS/MissionStats.cpp | 6 +- .../GameEngine/Source/Common/RTS/Money.cpp | 6 +- .../GameEngine/Source/Common/RTS/Player.cpp | 124 +++---- .../Source/Common/RTS/PlayerList.cpp | 18 +- .../Source/Common/RTS/PlayerTemplate.cpp | 2 +- .../Common/RTS/ProductionPrerequisite.cpp | 4 +- .../Common/RTS/ResourceGatheringManager.cpp | 6 +- .../Source/Common/RTS/ScoreKeeper.cpp | 24 +- .../Source/Common/RTS/SpecialPower.cpp | 18 +- .../GameEngine/Source/Common/RTS/Team.cpp | 96 +++--- .../Source/Common/RTS/TunnelTracker.cpp | 24 +- .../GameEngine/Source/Common/Recorder.cpp | 2 +- .../GameEngine/Source/Common/StateMachine.cpp | 6 +- .../Source/Common/System/BuildAssistant.cpp | 102 +++--- .../Source/Common/System/FunctionLexicon.cpp | 48 +-- .../Source/Common/System/Geometry.cpp | 6 +- .../GameEngine/Source/Common/System/Radar.cpp | 158 ++++----- .../Common/System/SaveGame/GameState.cpp | 174 +++++----- .../Common/System/SaveGame/GameStateMap.cpp | 52 +-- .../Source/Common/System/Snapshot.cpp | 4 +- .../Source/Common/System/Upgrade.cpp | 40 +-- .../GameEngine/Source/Common/TerrainTypes.cpp | 18 +- .../Source/Common/Thing/DrawModule.cpp | 6 +- .../GameEngine/Source/Common/Thing/Module.cpp | 28 +- .../Source/Common/Thing/ModuleFactory.cpp | 4 +- .../GameEngine/Source/Common/Thing/Thing.cpp | 4 +- .../Source/Common/Thing/ThingFactory.cpp | 26 +- .../Source/Common/Thing/ThingTemplate.cpp | 8 +- .../Source/Common/UserPreferences.cpp | 2 +- .../GameEngine/Source/GameClient/Color.cpp | 4 +- .../GameEngine/Source/GameClient/Credits.cpp | 2 +- .../GameEngine/Source/GameClient/Display.cpp | 4 +- .../Source/GameClient/DisplayString.cpp | 16 +- .../GameClient/DisplayStringManager.cpp | 10 +- .../GameEngine/Source/GameClient/Drawable.cpp | 120 +++---- .../AnimatedParticleSysBoneClientUpdate.cpp | 6 +- .../Drawable/Update/BeaconClientUpdate.cpp | 8 +- .../Drawable/Update/SwayClientUpdate.cpp | 6 +- .../GameClient/GUI/ControlBar/ControlBar.cpp | 150 ++++----- .../GUI/ControlBar/ControlBarBeacon.cpp | 6 +- .../GUI/ControlBar/ControlBarCommand.cpp | 74 ++--- .../ControlBarCommandProcessing.cpp | 56 ++-- .../GUI/ControlBar/ControlBarMultiSelect.cpp | 34 +- .../GUI/ControlBar/ControlBarOCLTimer.cpp | 8 +- .../GUI/ControlBar/ControlBarObserver.cpp | 8 +- .../GUI/ControlBar/ControlBarResizer.cpp | 2 +- .../GUI/ControlBar/ControlBarScheme.cpp | 4 +- .../ControlBarStructureInventory.cpp | 8 +- .../ControlBarUnderConstruction.cpp | 8 +- .../GUI/GUICallbacks/ControlBarCallback.cpp | 30 +- .../ControlBarPopupDescription.cpp | 2 +- .../GameClient/GUI/GUICallbacks/Diplomacy.cpp | 18 +- .../GUI/GUICallbacks/ExtendedMessageBox.cpp | 20 +- .../GUI/GUICallbacks/GeneralsExpPoints.cpp | 18 +- .../GUI/GUICallbacks/IMECandidate.cpp | 22 +- .../GUI/GUICallbacks/InGameChat.cpp | 20 +- .../GUI/GUICallbacks/InGamePopupMessage.cpp | 18 +- .../GUI/GUICallbacks/Menus/ChallengeMenu.cpp | 10 +- .../GUI/GUICallbacks/Menus/CreditsMenu.cpp | 30 +- .../GUICallbacks/Menus/DifficultySelect.cpp | 16 +- .../GUICallbacks/Menus/DisconnectWindow.cpp | 22 +- .../GUI/GUICallbacks/Menus/DownloadMenu.cpp | 32 +- .../Menus/EstablishConnectionsWindow.cpp | 2 +- .../GUI/GUICallbacks/Menus/GameInfoWindow.cpp | 12 +- .../Menus/KeyboardOptionsMenu.cpp | 44 +-- .../GUICallbacks/Menus/LanGameOptionsMenu.cpp | 46 +-- .../GUI/GUICallbacks/Menus/LanLobbyMenu.cpp | 50 +-- .../GUICallbacks/Menus/LanMapSelectMenu.cpp | 36 +- .../GUI/GUICallbacks/Menus/MainMenu.cpp | 48 +-- .../GUI/GUICallbacks/Menus/MapSelectMenu.cpp | 42 +-- .../Menus/NetworkDirectConnect.cpp | 36 +- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 32 +- .../GUICallbacks/Menus/PopupCommunicator.cpp | 30 +- .../GUI/GUICallbacks/Menus/PopupHostGame.cpp | 24 +- .../GUI/GUICallbacks/Menus/PopupJoinGame.cpp | 18 +- .../GUICallbacks/Menus/PopupLadderSelect.cpp | 28 +- .../GUICallbacks/Menus/PopupPlayerInfo.cpp | 30 +- .../GUI/GUICallbacks/Menus/PopupReplay.cpp | 34 +- .../GUI/GUICallbacks/Menus/PopupSaveLoad.cpp | 78 ++--- .../GUI/GUICallbacks/Menus/QuitMenu.cpp | 18 +- .../GUI/GUICallbacks/Menus/ReplayMenu.cpp | 36 +- .../GUI/GUICallbacks/Menus/ScoreScreen.cpp | 18 +- .../GUICallbacks/Menus/SinglePlayerMenu.cpp | 40 +-- .../Menus/SkirmishGameOptionsMenu.cpp | 38 +-- .../Menus/SkirmishMapSelectMenu.cpp | 36 +- .../GUICallbacks/Menus/WOLBuddyOverlay.cpp | 50 +-- .../Menus/WOLCustomScoreScreen.cpp | 34 +- .../GUICallbacks/Menus/WOLGameSetupMenu.cpp | 44 +-- .../GUICallbacks/Menus/WOLLadderScreen.cpp | 32 +- .../GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp | 42 +-- .../Menus/WOLLocaleSelectPopup.cpp | 26 +- .../GUI/GUICallbacks/Menus/WOLLoginMenu.cpp | 48 +-- .../GUICallbacks/Menus/WOLMapSelectMenu.cpp | 36 +- .../GUICallbacks/Menus/WOLMessageWindow.cpp | 30 +- .../GUICallbacks/Menus/WOLQMScoreScreen.cpp | 34 +- .../GUICallbacks/Menus/WOLQuickMatchMenu.cpp | 44 +-- .../GUI/GUICallbacks/Menus/WOLStatusMenu.cpp | 32 +- .../GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp | 48 +-- .../GUI/GUICallbacks/MessageBox.cpp | 36 +- .../GUI/GUICallbacks/ReplayControls.cpp | 8 +- .../GameClient/GUI/Gadget/GadgetCheckBox.cpp | 44 +-- .../GameClient/GUI/Gadget/GadgetComboBox.cpp | 64 ++-- .../GUI/Gadget/GadgetHorizontalSlider.cpp | 44 +-- .../GameClient/GUI/Gadget/GadgetListBox.cpp | 180 +++++----- .../GUI/Gadget/GadgetProgressBar.cpp | 8 +- .../GUI/Gadget/GadgetPushButton.cpp | 62 ++-- .../GUI/Gadget/GadgetRadioButton.cpp | 68 ++-- .../GUI/Gadget/GadgetStaticText.cpp | 18 +- .../GUI/Gadget/GadgetTabControl.cpp | 8 +- .../GameClient/GUI/Gadget/GadgetTextEntry.cpp | 20 +- .../GUI/Gadget/GadgetVerticalSlider.cpp | 22 +- .../Source/GameClient/GUI/GameFont.cpp | 26 +- .../Source/GameClient/GUI/GameWindow.cpp | 266 +++++++-------- .../GameClient/GUI/GameWindowGlobal.cpp | 26 +- .../GameClient/GUI/GameWindowManager.cpp | 286 ++++++++-------- .../GUI/GameWindowManagerScript.cpp | 218 ++++++------ .../GUI/GameWindowTransitionsStyles.cpp | 26 +- .../Source/GameClient/GUI/HeaderTemplate.cpp | 4 +- .../Source/GameClient/GUI/Shell/Shell.cpp | 66 ++-- .../GameClient/GUI/Shell/ShellMenuScheme.cpp | 2 +- .../Source/GameClient/GUI/WinInstanceData.cpp | 16 +- .../Source/GameClient/GUI/WindowLayout.cpp | 32 +- .../Source/GameClient/GameClient.cpp | 90 ++--- .../Source/GameClient/GameClientDispatch.cpp | 2 +- .../Source/GameClient/GlobalLanguage.cpp | 2 +- .../GameEngine/Source/GameClient/InGameUI.cpp | 176 +++++----- .../Source/GameClient/Input/Keyboard.cpp | 70 ++-- .../Source/GameClient/Input/Mouse.cpp | 54 +-- .../GameEngine/Source/GameClient/Line2D.cpp | 4 +- .../GameEngine/Source/GameClient/MapUtil.cpp | 16 +- .../GameClient/MessageStream/CommandXlat.cpp | 166 ++++----- .../MessageStream/GUICommandTranslator.cpp | 40 +-- .../GameClient/MessageStream/HotKey.cpp | 2 +- .../GameClient/MessageStream/LookAtXlat.cpp | 10 +- .../MessageStream/PlaceEventTranslator.cpp | 14 +- .../MessageStream/SelectionXlat.cpp | 10 +- .../GameClient/MessageStream/WindowXlat.cpp | 14 +- .../Source/GameClient/SelectionInfo.cpp | 2 +- .../Source/GameClient/System/Anim2D.cpp | 112 +++---- .../GameClient/System/CampaignManager.cpp | 4 +- .../Source/GameClient/System/Image.cpp | 28 +- .../Source/GameClient/System/ParticleSys.cpp | 142 ++++---- .../Source/GameClient/System/RayEffect.cpp | 28 +- .../GameClient/Terrain/TerrainRoads.cpp | 50 +-- .../GameClient/Terrain/TerrainVisual.cpp | 18 +- .../GameEngine/Source/GameClient/View.cpp | 4 +- .../GameEngine/Source/GameClient/Water.cpp | 4 +- .../GameEngine/Source/GameLogic/AI/AI.cpp | 14 +- .../GameEngine/Source/GameLogic/AI/AIDock.cpp | 8 +- .../Source/GameLogic/AI/AIGroup.cpp | 28 +- .../Source/GameLogic/AI/AIGuard.cpp | 30 +- .../Source/GameLogic/AI/AIGuardRetaliate.cpp | 30 +- .../Source/GameLogic/AI/AIPathfind.cpp | 26 +- .../Source/GameLogic/AI/AIPlayer.cpp | 84 ++--- .../Source/GameLogic/AI/AISkirmishPlayer.cpp | 16 +- .../Source/GameLogic/AI/AIStates.cpp | 206 ++++++------ .../Source/GameLogic/AI/AITNGuard.cpp | 30 +- .../GameEngine/Source/GameLogic/AI/Squad.cpp | 16 +- .../Source/GameLogic/AI/TurretAI.cpp | 33 +- .../Source/GameLogic/Map/PolygonTrigger.cpp | 8 +- .../Source/GameLogic/Map/SidesList.cpp | 18 +- .../Source/GameLogic/Map/TerrainLogic.cpp | 166 ++++----- .../Object/Behavior/AutoHealBehavior.cpp | 8 +- .../Behavior/BattleBusSlowDeathBehavior.cpp | 20 +- .../Object/Behavior/BehaviorModule.cpp | 6 +- .../Object/Behavior/BridgeBehavior.cpp | 160 ++++----- .../Behavior/BridgeScaffoldBehavior.cpp | 34 +- .../Object/Behavior/BridgeTowerBehavior.cpp | 48 +-- .../Object/Behavior/BunkerBusterBehavior.cpp | 20 +- .../Behavior/CountermeasuresBehavior.cpp | 6 +- .../Behavior/DumbProjectileBehavior.cpp | 18 +- .../FireWeaponWhenDamagedBehavior.cpp | 6 +- .../Behavior/FireWeaponWhenDeadBehavior.cpp | 6 +- .../Object/Behavior/FlightDeckBehavior.cpp | 36 +- .../Behavior/GenerateMinefieldBehavior.cpp | 14 +- .../Object/Behavior/GrantStealthBehavior.cpp | 6 +- .../Object/Behavior/InstantDeathBehavior.cpp | 6 +- .../Object/Behavior/JetSlowDeathBehavior.cpp | 36 +- .../Object/Behavior/MinefieldBehavior.cpp | 10 +- .../Object/Behavior/NeutonBlastBehavior.cpp | 6 +- .../Object/Behavior/OverchargeBehavior.cpp | 40 +-- .../Object/Behavior/POWTruckBehavior.cpp | 16 +- .../Object/Behavior/ParkingPlaceBehavior.cpp | 34 +- .../Object/Behavior/PoisonedBehavior.cpp | 6 +- .../Object/Behavior/PrisonBehavior.cpp | 54 +-- .../Behavior/PropagandaCenterBehavior.cpp | 40 +-- .../Behavior/PropagandaTowerBehavior.cpp | 76 ++--- .../Object/Behavior/RebuildHoleBehavior.cpp | 58 ++-- .../Object/Behavior/SlowDeathBehavior.cpp | 6 +- .../Object/Behavior/SpawnBehavior.cpp | 28 +- .../SupplyWarehouseCripplingBehavior.cpp | 6 +- .../Object/Behavior/TechBuildingBehavior.cpp | 12 +- .../GameLogic/Object/Body/ActiveBody.cpp | 64 ++-- .../GameLogic/Object/Body/BodyModule.cpp | 6 +- .../GameLogic/Object/Body/HighlanderBody.cpp | 6 +- .../Object/Body/HiveStructureBody.cpp | 2 +- .../GameLogic/Object/Body/ImmortalBody.cpp | 6 +- .../GameLogic/Object/Body/InactiveBody.cpp | 12 +- .../GameLogic/Object/Body/StructureBody.cpp | 12 +- .../GameLogic/Object/Body/UndeadBody.cpp | 6 +- .../Object/Collide/CollideModule.cpp | 6 +- .../ConvertToCarBombCrateCollide.cpp | 6 +- .../ConvertToHijackedVehicleCrateCollide.cpp | 8 +- .../Collide/CrateCollide/CrateCollide.cpp | 6 +- .../Collide/CrateCollide/HealCrateCollide.cpp | 6 +- .../CrateCollide/MoneyCrateCollide.cpp | 6 +- .../SabotageCommandCenterCrateCollide.cpp | 6 +- .../CrateCollide/SabotageFakeBuilding.cpp | 6 +- .../SabotageInternetCenterCrateCollide.cpp | 6 +- .../SabotageMilitaryFactoryCrateCollide.cpp | 6 +- .../SabotagePowerPlantCrateCollide.cpp | 6 +- .../SabotageSuperweaponCrateCollide.cpp | 6 +- .../SabotageSupplyCenterCrateCollide.cpp | 6 +- .../SabotageSupplyDropzoneCrateCollide.cpp | 6 +- .../CrateCollide/SalvageCrateCollide.cpp | 6 +- .../CrateCollide/ShroudCrateCollide.cpp | 6 +- .../Collide/CrateCollide/UnitCrateCollide.cpp | 6 +- .../CrateCollide/VeterancyCrateCollide.cpp | 6 +- .../Object/Collide/FireWeaponCollide.cpp | 10 +- .../Object/Collide/SquishCollide.cpp | 6 +- .../GameLogic/Object/Contain/CaveContain.cpp | 14 +- .../Object/Contain/GarrisonContain.cpp | 158 ++++----- .../GameLogic/Object/Contain/HealContain.cpp | 26 +- .../GameLogic/Object/Contain/HelixContain.cpp | 12 +- .../Object/Contain/InternetHackContain.cpp | 6 +- .../Object/Contain/MobNexusContain.cpp | 10 +- .../GameLogic/Object/Contain/OpenContain.cpp | 66 ++-- .../Object/Contain/OverlordContain.cpp | 8 +- .../Object/Contain/ParachuteContain.cpp | 6 +- .../Object/Contain/RailedTransportContain.cpp | 20 +- .../Object/Contain/RiderChangeContain.cpp | 6 +- .../Object/Contain/TransportContain.cpp | 12 +- .../Object/Contain/TunnelContain.cpp | 14 +- .../GameLogic/Object/Create/CreateModule.cpp | 10 +- .../Object/Create/GrantUpgradeCreate.cpp | 14 +- .../Object/Create/LockWeaponCreate.cpp | 14 +- .../Object/Create/PreorderCreate.cpp | 6 +- .../Object/Create/SpecialPowerCreate.cpp | 6 +- .../Object/Create/SupplyCenterCreate.cpp | 6 +- .../Object/Create/SupplyWarehouseCreate.cpp | 6 +- .../Object/Create/VeterancyGainCreate.cpp | 6 +- .../GameLogic/Object/Damage/BoneFXDamage.cpp | 12 +- .../GameLogic/Object/Damage/DamageModule.cpp | 6 +- .../Object/Damage/TransitionDamageFX.cpp | 72 ++-- .../Object/Destroy/DestroyModule.cpp | 10 +- .../GameLogic/Object/Die/CreateCrateDie.cpp | 6 +- .../GameLogic/Object/Die/CreateObjectDie.cpp | 8 +- .../Source/GameLogic/Object/Die/CrushDie.cpp | 6 +- .../Source/GameLogic/Object/Die/DamDie.cpp | 18 +- .../GameLogic/Object/Die/DestroyDie.cpp | 6 +- .../Source/GameLogic/Object/Die/DieModule.cpp | 6 +- .../GameLogic/Object/Die/EjectPilotDie.cpp | 6 +- .../Source/GameLogic/Object/Die/FXListDie.cpp | 6 +- .../GameLogic/Object/Die/KeepObjectDie.cpp | 6 +- .../Object/Die/RebuildHoleExposeDie.cpp | 16 +- .../Object/Die/SpecialPowerCompletionDie.cpp | 6 +- .../GameLogic/Object/Die/UpgradeDie.cpp | 6 +- .../GameLogic/Object/ExperienceTracker.cpp | 6 +- .../Source/GameLogic/Object/FiringTracker.cpp | 6 +- .../Source/GameLogic/Object/GhostObject.cpp | 18 +- .../Object/Helper/ObjectDefectionHelper.cpp | 6 +- .../GameLogic/Object/Helper/ObjectHelper.cpp | 8 +- .../Object/Helper/ObjectRepulsorHelper.cpp | 6 +- .../Object/Helper/ObjectSMCHelper.cpp | 6 +- .../Helper/ObjectWeaponStatusHelper.cpp | 6 +- .../Object/Helper/StatusDamageHelper.cpp | 6 +- .../Object/Helper/SubdualDamageHelper.cpp | 6 +- .../Object/Helper/TempWeaponBonusHelper.cpp | 6 +- .../Source/GameLogic/Object/Locomotor.cpp | 12 +- .../Source/GameLogic/Object/Object.cpp | 70 ++-- .../Source/GameLogic/Object/ObjectTypes.cpp | 10 +- .../GameLogic/Object/PartitionManager.cpp | 71 ++-- .../SpecialPower/BaikonurLaunchPower.cpp | 8 +- .../Object/SpecialPower/CashBountyPower.cpp | 12 +- .../SpecialPower/CashHackSpecialPower.cpp | 12 +- .../Object/SpecialPower/CleanupAreaPower.cpp | 8 +- .../SpecialPower/DefectorSpecialPower.cpp | 14 +- .../SpecialPower/DemoralizeSpecialPower.cpp | 24 +- .../Object/SpecialPower/FireWeaponPower.cpp | 8 +- .../Object/SpecialPower/OCLSpecialPower.cpp | 6 +- .../Object/SpecialPower/SpecialAbility.cpp | 10 +- .../SpecialPower/SpecialPowerModule.cpp | 28 +- .../SpecialPower/SpyVisionSpecialPower.cpp | 8 +- .../GameLogic/Object/Update/AIUpdate.cpp | 24 +- .../AIUpdate/AssaultTransportAIUpdate.cpp | 6 +- .../Update/AIUpdate/ChinookAIUpdate.cpp | 6 +- .../AIUpdate/DeliverPayloadAIUpdate.cpp | 30 +- .../Update/AIUpdate/DeployStyleAIUpdate.cpp | 6 +- .../Object/Update/AIUpdate/DozerAIUpdate.cpp | 234 ++++++------- .../Update/AIUpdate/HackInternetAIUpdate.cpp | 24 +- .../Object/Update/AIUpdate/JetAIUpdate.cpp | 6 +- .../Update/AIUpdate/MissileAIUpdate.cpp | 12 +- .../Update/AIUpdate/POWTruckAIUpdate.cpp | 108 +++--- .../AIUpdate/RailedTransportAIUpdate.cpp | 44 +-- .../Update/AIUpdate/RailroadGuideAIUpdate.cpp | 18 +- .../Update/AIUpdate/SupplyTruckAIUpdate.cpp | 12 +- .../Update/AIUpdate/TransportAIUpdate.cpp | 6 +- .../Object/Update/AIUpdate/WanderAIUpdate.cpp | 8 +- .../Object/Update/AIUpdate/WorkerAIUpdate.cpp | 68 ++-- .../Object/Update/AnimationSteeringUpdate.cpp | 2 +- .../Object/Update/AssistedTargetingUpdate.cpp | 6 +- .../Object/Update/AutoDepositUpdate.cpp | 8 +- .../Object/Update/AutoFindHealingUpdate.cpp | 8 +- .../Object/Update/BaseRenerateUpdate.cpp | 8 +- .../Object/Update/BattlePlanUpdate.cpp | 12 +- .../GameLogic/Object/Update/BoneFXUpdate.cpp | 40 +-- .../Object/Update/CheckpointUpdate.cpp | 10 +- .../Object/Update/CleanupHazardUpdate.cpp | 6 +- .../Object/Update/CommandButtonHuntUpdate.cpp | 16 +- .../Object/Update/DeletionUpdate.cpp | 6 +- .../Object/Update/DemoTrapUpdate.cpp | 6 +- .../Object/Update/DockUpdate/DockUpdate.cpp | 8 +- .../Update/DockUpdate/PrisonDockUpdate.cpp | 12 +- .../DockUpdate/RailedTransportDockUpdate.cpp | 54 +-- .../Update/DockUpdate/RepairDockUpdate.cpp | 20 +- .../DockUpdate/SupplyCenterDockUpdate.cpp | 8 +- .../DockUpdate/SupplyWarehouseDockUpdate.cpp | 8 +- .../Update/DynamicGeometryInfoUpdate.cpp | 14 +- .../DynamicShroudClearingRangeUpdate.cpp | 6 +- .../GameLogic/Object/Update/EMPUpdate.cpp | 12 +- .../Object/Update/EnemyNearUpdate.cpp | 6 +- .../FireOCLAfterWeaponCooldownUpdate.cpp | 6 +- .../Object/Update/FireSpreadUpdate.cpp | 6 +- .../Object/Update/FireWeaponUpdate.cpp | 6 +- .../FirestormDynamicGeometryInfoUpdate.cpp | 28 +- .../Object/Update/FlammableUpdate.cpp | 6 +- .../GameLogic/Object/Update/FloatUpdate.cpp | 16 +- .../Object/Update/HeightDieUpdate.cpp | 30 +- .../Update/HelicopterSlowDeathUpdate.cpp | 52 +-- .../Object/Update/HijackerUpdate.cpp | 10 +- .../GameLogic/Object/Update/HordeUpdate.cpp | 8 +- .../GameLogic/Object/Update/LaserUpdate.cpp | 6 +- .../Object/Update/LifetimeUpdate.cpp | 6 +- .../Update/MissileLauncherBuildingUpdate.cpp | 6 +- .../Object/Update/MobMemberSlavedUpdate.cpp | 6 +- .../Update/NeutronMissileSlowDeathUpdate.cpp | 52 +-- .../Object/Update/NeutronMissileUpdate.cpp | 12 +- .../GameLogic/Object/Update/OCLUpdate.cpp | 8 +- .../Update/ParticleUplinkCannonUpdate.cpp | 6 +- .../GameLogic/Object/Update/PhysicsUpdate.cpp | 10 +- .../Object/Update/PilotFindVehicleUpdate.cpp | 6 +- .../Object/Update/PointDefenseLaserUpdate.cpp | 8 +- .../Object/Update/PowerPlantUpdate.cpp | 16 +- .../DefaultProductionExitUpdate.cpp | 6 +- .../QueueProductionExitUpdate.cpp | 6 +- .../SpawnPointProductionExitUpdate.cpp | 6 +- .../SupplyCenterProductionExitUpdate.cpp | 6 +- .../Object/Update/ProductionUpdate.cpp | 140 ++++---- .../Object/Update/ProjectileStreamUpdate.cpp | 6 +- .../GameLogic/Object/Update/ProneUpdate.cpp | 6 +- .../GameLogic/Object/Update/RadarUpdate.cpp | 18 +- .../Object/Update/RadiusDecalUpdate.cpp | 6 +- .../GameLogic/Object/Update/SlavedUpdate.cpp | 6 +- .../Update/SmartBombTargetHomingUpdate.cpp | 6 +- .../Object/Update/SpecialAbilityUpdate.cpp | 6 +- .../Update/SpecialPowerUpdateModule.cpp | 6 +- .../Update/SpectreGunshipDeploymentUpdate.cpp | 6 +- .../Object/Update/SpectreGunshipUpdate.cpp | 18 +- .../Object/Update/SpyVisionUpdate.cpp | 6 +- .../Object/Update/StealthDetectorUpdate.cpp | 20 +- .../GameLogic/Object/Update/StealthUpdate.cpp | 14 +- .../Object/Update/StickyBombUpdate.cpp | 6 +- .../Object/Update/StructureCollapseUpdate.cpp | 6 +- .../Object/Update/StructureToppleUpdate.cpp | 6 +- .../Object/Update/TensileFormationUpdate.cpp | 16 +- .../GameLogic/Object/Update/ToppleUpdate.cpp | 8 +- .../GameLogic/Object/Update/UpdateModule.cpp | 6 +- .../Object/Update/WaveGuideUpdate.cpp | 110 +++--- .../Object/Update/WeaponBonusUpdate.cpp | 6 +- .../Object/Upgrade/ActiveShroudUpgrade.cpp | 16 +- .../GameLogic/Object/Upgrade/ArmorUpgrade.cpp | 6 +- .../Object/Upgrade/CommandSetUpgrade.cpp | 6 +- .../Object/Upgrade/CostModifierUpgrade.cpp | 24 +- .../Upgrade/ExperienceScalarUpgrade.cpp | 8 +- .../Object/Upgrade/GrantScienceUpgrade.cpp | 6 +- .../Object/Upgrade/LocomotorSetUpgrade.cpp | 6 +- .../Object/Upgrade/MaxHealthUpgrade.cpp | 8 +- .../Object/Upgrade/ModelConditionUpgrade.cpp | 6 +- .../Object/Upgrade/ObjectCreationUpgrade.cpp | 16 +- .../Object/Upgrade/PassengersFireUpgrade.cpp | 6 +- .../Object/Upgrade/PowerPlantUpgrade.cpp | 16 +- .../GameLogic/Object/Upgrade/RadarUpgrade.cpp | 20 +- .../Object/Upgrade/ReplaceObjectUpgrade.cpp | 6 +- .../Object/Upgrade/StatusBitsUpgrade.cpp | 6 +- .../Object/Upgrade/StealthUpgrade.cpp | 6 +- .../Object/Upgrade/SubObjectsUpgrade.cpp | 6 +- .../Upgrade/UnpauseSpecialPowerUpgrade.cpp | 8 +- .../Object/Upgrade/UpgradeModule.cpp | 6 +- .../Object/Upgrade/WeaponBonusUpgrade.cpp | 6 +- .../Object/Upgrade/WeaponSetUpgrade.cpp | 6 +- .../Source/GameLogic/Object/Weapon.cpp | 24 +- .../Source/GameLogic/Object/WeaponSet.cpp | 4 +- .../GameLogic/ScriptEngine/ScriptActions.cpp | 18 +- .../ScriptEngine/ScriptConditions.cpp | 10 +- .../GameLogic/ScriptEngine/ScriptEngine.cpp | 202 +++++------ .../Source/GameLogic/ScriptEngine/Scripts.cpp | 18 +- .../Source/GameLogic/System/CaveSystem.cpp | 12 +- .../Source/GameLogic/System/Damage.cpp | 6 +- .../Source/GameLogic/System/GameLogic.cpp | 108 +++--- .../GameLogic/System/GameLogicDispatch.cpp | 112 +++---- .../Source/GameNetwork/GameInfo.cpp | 18 +- .../Source/GameNetwork/GameSpy/Chat.cpp | 2 +- .../Source/GameNetwork/GameSpyOverlay.cpp | 2 +- .../GameEngine/Source/GameNetwork/LANAPI.cpp | 4 +- .../Source/GameNetwork/LANAPICallbacks.cpp | 20 +- .../Source/GameNetwork/NetCommandMsg.cpp | 2 +- .../Source/GameNetwork/NetPacket.cpp | 2 +- .../Source/GameNetwork/Transport.cpp | 2 +- .../W3DDevice/Common/W3DThingFactory.h | 2 +- .../Include/W3DDevice/GameClient/W3DDisplay.h | 2 +- .../W3DDevice/GameClient/W3DGameClient.h | 2 +- .../W3DDevice/GameClient/W3DGameFont.h | 2 +- .../W3DDevice/GameClient/W3DGameWindow.h | 2 +- .../GameClient/W3DGameWindowManager.h | 2 +- .../W3DDevice/GameClient/W3DInGameUI.h | 2 +- .../Include/W3DDevice/GameClient/W3DMouse.h | 2 +- .../Include/W3DDevice/GameClient/W3DScene.h | 6 +- .../Include/W3DDevice/GameClient/W3DShadow.h | 2 +- .../W3DDevice/GameClient/W3DTerrainTracks.h | 2 +- .../W3DDevice/GameClient/W3DTerrainVisual.h | 2 +- .../Include/W3DDevice/GameClient/W3DView.h | 2 +- .../GameClient/W3DVolumetricShadow.h | 4 +- .../W3DDevice/GameClient/W3DWaterTracks.h | 2 +- .../W3DDevice/GameLogic/W3DGameLogic.h | 2 +- .../W3DDevice/GameLogic/W3DTerrainLogic.h | 2 +- .../Win32Device/Common/Win32GameEngine.h | 2 +- .../Win32Device/GameClient/Win32DIKeyboard.h | 2 +- .../Win32Device/GameClient/Win32DIMouse.h | 2 +- .../Win32Device/GameClient/Win32Mouse.h | 2 +- .../Common/System/W3DFunctionLexicon.cpp | 10 +- .../W3DDevice/Common/System/W3DRadar.cpp | 114 +++---- .../Common/Thing/W3DModuleFactory.cpp | 2 +- .../Common/Thing/W3DThingFactory.cpp | 4 +- .../Source/W3DDevice/Common/W3DConvert.cpp | 4 +- .../W3DDevice/GameClient/BaseHeightMap.cpp | 22 +- .../Drawable/Draw/W3DDebrisDraw.cpp | 6 +- .../Drawable/Draw/W3DDefaultDraw.cpp | 6 +- .../Drawable/Draw/W3DDependencyModelDraw.cpp | 6 +- .../GameClient/Drawable/Draw/W3DLaserDraw.cpp | 12 +- .../GameClient/Drawable/Draw/W3DModelDraw.cpp | 52 +-- .../Drawable/Draw/W3DOverlordAircraftDraw.cpp | 6 +- .../Drawable/Draw/W3DOverlordTankDraw.cpp | 6 +- .../Drawable/Draw/W3DOverlordTruckDraw.cpp | 6 +- .../Drawable/Draw/W3DPoliceCarDraw.cpp | 12 +- .../Drawable/Draw/W3DProjectileStreamDraw.cpp | 6 +- .../GameClient/Drawable/Draw/W3DPropDraw.cpp | 8 +- .../GameClient/Drawable/Draw/W3DRopeDraw.cpp | 6 +- .../Drawable/Draw/W3DScienceModelDraw.cpp | 6 +- .../Drawable/Draw/W3DSupplyDraw.cpp | 6 +- .../GameClient/Drawable/Draw/W3DTankDraw.cpp | 6 +- .../Drawable/Draw/W3DTankTruckDraw.cpp | 6 +- .../Drawable/Draw/W3DTracerDraw.cpp | 8 +- .../GameClient/Drawable/Draw/W3DTreeDraw.cpp | 8 +- .../GameClient/Drawable/Draw/W3DTruckDraw.cpp | 6 +- .../GUI/GUICallbacks/W3DControlBar.cpp | 22 +- .../GameClient/GUI/GUICallbacks/W3DMOTD.cpp | 10 +- .../GUI/GUICallbacks/W3DMainMenu.cpp | 20 +- .../GameClient/GUI/Gadget/W3DCheckBox.cpp | 28 +- .../GameClient/GUI/Gadget/W3DComboBox.cpp | 16 +- .../GUI/Gadget/W3DHorizontalSlider.cpp | 22 +- .../GameClient/GUI/Gadget/W3DListBox.cpp | 58 ++-- .../GameClient/GUI/Gadget/W3DProgressBar.cpp | 32 +- .../GameClient/GUI/Gadget/W3DPushButton.cpp | 38 +-- .../GameClient/GUI/Gadget/W3DRadioButton.cpp | 26 +- .../GameClient/GUI/Gadget/W3DStaticText.cpp | 20 +- .../GameClient/GUI/Gadget/W3DTabControl.cpp | 4 +- .../GameClient/GUI/Gadget/W3DTextEntry.cpp | 26 +- .../GUI/Gadget/W3DVerticalSlider.cpp | 24 +- .../W3DDevice/GameClient/GUI/W3DGameFont.cpp | 6 +- .../GameClient/GUI/W3DGameWindow.cpp | 50 +-- .../GameClient/GUI/W3DGameWindowManager.cpp | 6 +- .../Source/W3DDevice/GameClient/HeightMap.cpp | 6 +- .../GameClient/Shadow/W3DProjectedShadow.cpp | 26 +- .../GameClient/Shadow/W3DVolumetricShadow.cpp | 164 ++++----- .../W3DDevice/GameClient/W3DBridgeBuffer.cpp | 12 +- .../W3DDevice/GameClient/W3DDisplay.cpp | 54 +-- .../W3DDevice/GameClient/W3DDisplayString.cpp | 30 +- .../GameClient/W3DDisplayStringManager.cpp | 12 +- .../W3DDevice/GameClient/W3DFileSystem.cpp | 30 +- .../W3DDevice/GameClient/W3DGameClient.cpp | 22 +- .../W3DDevice/GameClient/W3DInGameUI.cpp | 46 +-- .../Source/W3DDevice/GameClient/W3DMouse.cpp | 10 +- .../W3DDevice/GameClient/W3DParticleSys.cpp | 2 +- .../W3DDevice/GameClient/W3DPropBuffer.cpp | 6 +- .../W3DDevice/GameClient/W3DRoadBuffer.cpp | 6 +- .../Source/W3DDevice/GameClient/W3DScene.cpp | 34 +- .../W3DDevice/GameClient/W3DShaderManager.cpp | 8 +- .../W3DDevice/GameClient/W3DTerrainTracks.cpp | 33 +- .../W3DDevice/GameClient/W3DTerrainVisual.cpp | 62 ++-- .../W3DDevice/GameClient/W3DTreeBuffer.cpp | 6 +- .../Source/W3DDevice/GameClient/W3DView.cpp | 72 ++-- .../GameClient/W3dWaypointBuffer.cpp | 2 +- .../W3DDevice/GameClient/Water/W3DWater.cpp | 48 +-- .../GameClient/Water/W3DWaterTracks.cpp | 30 +- .../W3DDevice/GameClient/WorldHeightMap.cpp | 2 +- .../W3DDevice/GameLogic/W3DGhostObject.cpp | 70 ++-- .../W3DDevice/GameLogic/W3DTerrainLogic.cpp | 26 +- .../Win32Device/Common/Win32GameEngine.cpp | 10 +- .../GameClient/Win32DIKeyboard.cpp | 46 +-- .../Win32Device/GameClient/Win32DIMouse.cpp | 58 ++-- .../Win32Device/GameClient/Win32Mouse.cpp | 50 +-- .../Code/Libraries/Include/Lib/BaseType.h | 2 +- .../Source/WWVegas/WW3D2/dx8renderer.cpp | 20 +- .../Source/WWVegas/WW3D2/linegrp.cpp | 4 +- .../Source/WWVegas/WW3D2/motchan.cpp | 40 +-- .../Libraries/Source/WWVegas/WW3D2/shader.cpp | 8 +- .../Source/WWVegas/WW3D2/sortingrenderer.cpp | 2 - .../Libraries/Source/WWVegas/WW3D2/ww3d.cpp | 2 +- GeneralsMD/Code/Main/WinMain.cpp | 26 +- .../Code/Tools/GUIEdit/Include/EditWindow.h | 2 +- .../Code/Tools/GUIEdit/Include/GUIEdit.h | 2 +- .../Code/Tools/GUIEdit/Include/GUIEditColor.h | 6 +- .../Tools/GUIEdit/Include/GUIEditDisplay.h | 2 +- .../Tools/GUIEdit/Include/HierarchyView.h | 2 +- .../Code/Tools/GUIEdit/Include/LayoutScheme.h | 2 +- .../Dialog Procedures/CallbackEditor.cpp | 30 +- .../Dialog Procedures/CheckBoxProperties.cpp | 18 +- .../Source/Dialog Procedures/ColorDialog.cpp | 112 +++---- .../Dialog Procedures/ComboBoxProperties.cpp | 34 +- .../Dialog Procedures/GenericProperties.cpp | 40 +-- .../Source/Dialog Procedures/GridSettings.cpp | 28 +- .../Dialog Procedures/ListboxProperties.cpp | 44 +-- .../Dialog Procedures/NewLayoutDialog.cpp | 18 +- .../ProgressBarProperties.cpp | 18 +- .../PushButtonProperties.cpp | 18 +- .../RadioButtonProperties.cpp | 24 +- .../Dialog Procedures/SliderProperties.cpp | 38 +-- .../StaticTextProperties.cpp | 20 +- .../TabControlProperties.cpp | 18 +- .../Dialog Procedures/TextEntryProperties.cpp | 24 +- .../Code/Tools/GUIEdit/Source/EditWindow.cpp | 184 +++++----- .../Code/Tools/GUIEdit/Source/GUIEdit.cpp | 314 +++++++++--------- .../Tools/GUIEdit/Source/GUIEditDisplay.cpp | 12 +- .../GUIEdit/Source/GUIEditWindowManager.cpp | 156 ++++----- .../Tools/GUIEdit/Source/HierarchyView.cpp | 144 ++++---- .../Tools/GUIEdit/Source/LayoutScheme.cpp | 122 +++---- .../Code/Tools/GUIEdit/Source/Properties.cpp | 144 ++++---- GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp | 136 ++++---- .../Code/Tools/GUIEdit/Source/WinMain.cpp | 72 ++-- .../Tools/WorldBuilder/src/BlendMaterial.cpp | 2 +- .../Code/Tools/WorldBuilder/src/BuildList.cpp | 6 +- .../Tools/WorldBuilder/src/CameraOptions.cpp | 6 +- .../WorldBuilder/src/EditObjectParameter.cpp | 8 +- .../Tools/WorldBuilder/src/EditParameter.cpp | 8 +- .../Tools/WorldBuilder/src/FeatherOptions.cpp | 6 +- .../Tools/WorldBuilder/src/FenceOptions.cpp | 8 +- .../WorldBuilder/src/GlobalLightOptions.cpp | 6 +- .../Tools/WorldBuilder/src/MapPreview.cpp | 34 +- .../WorldBuilder/src/MeshMoldOptions.cpp | 6 +- .../Tools/WorldBuilder/src/MoundOptions.cpp | 6 +- .../Tools/WorldBuilder/src/ObjectOptions.cpp | 14 +- .../Tools/WorldBuilder/src/PickUnitDialog.cpp | 12 +- .../Tools/WorldBuilder/src/RoadOptions.cpp | 6 +- .../Tools/WorldBuilder/src/ScorchOptions.cpp | 6 +- .../WorldBuilder/src/TerrainMaterial.cpp | 14 +- .../Tools/WorldBuilder/src/TerrainModal.cpp | 8 +- .../Tools/WorldBuilder/src/WBPopupSlider.cpp | 6 +- .../Tools/WorldBuilder/src/WHeightMapEdit.cpp | 4 +- .../Tools/WorldBuilder/src/WaterOptions.cpp | 6 +- .../Tools/WorldBuilder/src/brushoptions.cpp | 6 +- .../Tools/WorldBuilder/src/mapobjectprops.cpp | 8 +- .../Code/Tools/WorldBuilder/src/wbview3d.cpp | 10 +- scripts/cpp/apply_code_formatting.py | 66 ++++ scripts/cpp/remove_trailing_whitespace.py | 49 --- 1231 files changed, 15352 insertions(+), 15343 deletions(-) create mode 100644 scripts/cpp/apply_code_formatting.py delete mode 100644 scripts/cpp/remove_trailing_whitespace.py diff --git a/Core/GameEngine/Source/Common/INI/INIAudioEventInfo.cpp b/Core/GameEngine/Source/Common/INI/INIAudioEventInfo.cpp index 37ce1ead857..a8b4d295879 100644 --- a/Core/GameEngine/Source/Common/INI/INIAudioEventInfo.cpp +++ b/Core/GameEngine/Source/Common/INI/INIAudioEventInfo.cpp @@ -65,7 +65,7 @@ void INI::parseMusicTrackDefinition( INI* ini ) // parse the ini definition ini->initFromINI( track, track->getFieldParse() ); -} // end parseMusicTrackDefinition +} //------------------------------------------------------------------------------------------------- void INI::parseAudioEventDefinition( INI* ini ) @@ -92,7 +92,7 @@ void INI::parseAudioEventDefinition( INI* ini ) // parse the ini definition ini->initFromINI( track, track->getFieldParse() ); -} // end parseAudioEventDefinition +} //------------------------------------------------------------------------------------------------- void INI::parseDialogDefinition( INI* ini ) @@ -119,7 +119,7 @@ void INI::parseDialogDefinition( INI* ini ) // parse the ini definition ini->initFromINI( track, track->getFieldParse() ); -} // end parseAudioEventDefinition +} //------------------------------------------------------------------------------------------------- diff --git a/Core/GameEngine/Source/Common/INI/INIVideo.cpp b/Core/GameEngine/Source/Common/INI/INIVideo.cpp index b25e495b2db..7c3d1c9028e 100644 --- a/Core/GameEngine/Source/Common/INI/INIVideo.cpp +++ b/Core/GameEngine/Source/Common/INI/INIVideo.cpp @@ -56,6 +56,6 @@ void INI::parseVideoDefinition( INI* ini ) TheVideoPlayer->addVideo(&video); -} // end parseVideoDefinition +} diff --git a/Core/GameEngine/Source/Common/RandomValue.cpp b/Core/GameEngine/Source/Common/RandomValue.cpp index 86d577e4e37..f9e63adbf32 100644 --- a/Core/GameEngine/Source/Common/RandomValue.cpp +++ b/Core/GameEngine/Source/Common/RandomValue.cpp @@ -377,7 +377,7 @@ Real GameClientRandomVariable::getValue( void ) const DEBUG_ASSERTLOG(m_low == m_high, ("m_low != m_high for a CONSTANT GameClientRandomVariable")); if (m_low == m_high) { return m_low; - } // else return as though a UNIFORM. + } FALLTHROUGH; case UNIFORM: @@ -422,7 +422,7 @@ Real GameLogicRandomVariable::getValue( void ) const DEBUG_ASSERTLOG(m_low == m_high, ("m_low != m_high for a CONSTANT GameLogicRandomVariable")); if (m_low == m_high) { return m_low; - } // else return as though a UNIFORM. + } FALLTHROUGH; case UNIFORM: diff --git a/Core/GameEngine/Source/Common/System/Xfer.cpp b/Core/GameEngine/Source/Common/System/Xfer.cpp index 3de20419979..f4e9a2f0827 100644 --- a/Core/GameEngine/Source/Common/System/Xfer.cpp +++ b/Core/GameEngine/Source/Common/System/Xfer.cpp @@ -45,14 +45,14 @@ Xfer::Xfer( void ) m_options = XO_NONE; m_xferMode = XFER_INVALID; -} // end Xfer +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- Xfer::~Xfer( void ) { -} // end ~Xfer +} // ------------------------------------------------------------------------------------------------ /** Open */ @@ -63,7 +63,7 @@ void Xfer::open( AsciiString identifier ) // save identifier m_identifier = identifier; -} // end open +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -72,7 +72,7 @@ void Xfer::xferByte( Byte *byteData ) xferImplementation( byteData, sizeof( Byte ) ); -} // end xferByte +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -89,9 +89,9 @@ void Xfer::xferVersion( XferVersion *versionData, XferVersion currentVersion ) *versionData, currentVersion )); throw XFER_INVALID_VERSION; - } // end if + } -} // end xferVersion +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -100,7 +100,7 @@ void Xfer::xferUnsignedByte( UnsignedByte *unsignedByteData ) xferImplementation( unsignedByteData, sizeof( UnsignedByte ) ); -} // end xferUnsignedByte +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -109,7 +109,7 @@ void Xfer::xferBool( Bool *boolData ) xferImplementation( boolData, sizeof( Bool ) ); -} // end xferBool +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -118,7 +118,7 @@ void Xfer::xferInt( Int *intData ) xferImplementation( intData, sizeof( Int ) ); -} // end xferInt +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -127,7 +127,7 @@ void Xfer::xferInt64( Int64 *int64Data ) xferImplementation( int64Data, sizeof( Int64 ) ); -} // end xferInt64 +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -136,7 +136,7 @@ void Xfer::xferUnsignedInt( UnsignedInt *unsignedIntData ) xferImplementation( unsignedIntData, sizeof( UnsignedInt ) ); -} // end xferUnsignedInt +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -145,7 +145,7 @@ void Xfer::xferShort( Short *shortData ) xferImplementation( shortData, sizeof( Short ) ); -} // end xferShort +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -154,7 +154,7 @@ void Xfer::xferUnsignedShort( UnsignedShort *unsignedShortData ) xferImplementation( unsignedShortData, sizeof( UnsignedShort ) ); -} // end xferUnsignedShort +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -163,7 +163,7 @@ void Xfer::xferReal( Real *realData ) xferImplementation( realData, sizeof( Real ) ); -} // end xferReal +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -179,7 +179,7 @@ void Xfer::xferMapName( AsciiString *mapNameData ) xferAsciiString(mapNameData); *mapNameData = TheGameState->portableMapPathToRealMapPath(*mapNameData); } -} // end xferAsciiString +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -188,13 +188,13 @@ void Xfer::xferAsciiString( AsciiString *asciiStringData ) xferImplementation( (void *)asciiStringData->str(), sizeof( Byte ) * asciiStringData->getLength() ); -} // end xferAsciiString +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ void Xfer::xferMarkerLabel( AsciiString asciiStringData ) { -} // end xferMarkerLabel +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -203,7 +203,7 @@ void Xfer::xferUnicodeString( UnicodeString *unicodeStringData ) xferImplementation( (void *)unicodeStringData->str(), sizeof( WideChar ) * unicodeStringData->getLength() ); -} // end xferUnicodeString +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -214,7 +214,7 @@ void Xfer::xferCoord3D( Coord3D *coord3D ) xferReal( &coord3D->y ); xferReal( &coord3D->z ); -} // end xferCoord3D +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -225,7 +225,7 @@ void Xfer::xferICoord3D( ICoord3D *iCoord3D ) xferInt( &iCoord3D->y ); xferInt( &iCoord3D->z ); -} // end xferICoor3D +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -235,7 +235,7 @@ void Xfer::xferRegion3D( Region3D *region3D ) xferCoord3D( ®ion3D->lo ); xferCoord3D( ®ion3D->hi ); -} // end xferRegion3D +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -245,7 +245,7 @@ void Xfer::xferIRegion3D( IRegion3D *iRegion3D ) xferICoord3D( &iRegion3D->lo ); xferICoord3D( &iRegion3D->hi ); -} // end xferIRegion3D +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -255,7 +255,7 @@ void Xfer::xferCoord2D( Coord2D *coord2D ) xferReal( &coord2D->x ); xferReal( &coord2D->y ); -} // end xferCoord2D +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -265,7 +265,7 @@ void Xfer::xferICoord2D( ICoord2D *iCoord2D ) xferInt( &iCoord2D->x ); xferInt( &iCoord2D->y ); -} // end xferICoord2D +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -275,7 +275,7 @@ void Xfer::xferRegion2D( Region2D *region2D ) xferCoord2D( ®ion2D->lo ); xferCoord2D( ®ion2D->hi ); -} // end xferRegion2D +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -285,7 +285,7 @@ void Xfer::xferIRegion2D( IRegion2D *iRegion2D ) xferICoord2D( &iRegion2D->lo ); xferICoord2D( &iRegion2D->hi ); -} // end xferIRegion2D +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -295,7 +295,7 @@ void Xfer::xferRealRange( RealRange *realRange ) xferReal( &realRange->lo ); xferReal( &realRange->hi ); -} // end xferRealRange +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -304,7 +304,7 @@ void Xfer::xferColor( Color *color ) xferImplementation( color, sizeof( Color ) ); -} // end xferColor +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -315,7 +315,7 @@ void Xfer::xferRGBColor( RGBColor *rgbColor ) xferReal( &rgbColor->green ); xferReal( &rgbColor->blue ); -} // end xferRGBColor +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -327,7 +327,7 @@ void Xfer::xferRGBAColorReal( RGBAColorReal *rgbaColorReal ) xferReal( &rgbaColorReal->blue ); xferReal( &rgbaColorReal->alpha ); -} // end xferRGBAColorReal +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -339,7 +339,7 @@ void Xfer::xferRGBAColorInt( RGBAColorInt *rgbaColorInt ) xferUnsignedInt( &rgbaColorInt->blue ); xferUnsignedInt( &rgbaColorInt->alpha ); -} // end xferRGBAColorInt +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -348,7 +348,7 @@ void Xfer::xferObjectID( ObjectID *objectID ) xferImplementation( objectID, sizeof( ObjectID ) ); -} // end xferObjeftID +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -357,7 +357,7 @@ void Xfer::xferDrawableID( DrawableID *drawableID ) xferImplementation( drawableID, sizeof( DrawableID ) ); -} // end xferDrawableID +} // ------------------------------------------------------------------------------------------------ @@ -388,9 +388,9 @@ void Xfer::xferSTLObjectIDVector( std::vector *objectIDVectorData ) objectID = *it; xferObjectID( &objectID ); - } // end for + } - } // end if, save + } else if( getXferMode() == XFER_LOAD ) { @@ -401,7 +401,7 @@ void Xfer::xferSTLObjectIDVector( std::vector *objectIDVectorData ) DEBUG_CRASH(( "Xfer::xferSTLObjectIDList - object vector should be empty before loading" )); throw XFER_LIST_NOT_EMPTY; - } // end if + } // read all ids for( UnsignedShort i = 0; i < listCount; ++i ) @@ -410,16 +410,16 @@ void Xfer::xferSTLObjectIDVector( std::vector *objectIDVectorData ) xferObjectID( &objectID ); objectIDVectorData->push_back( objectID ); - } // end for, i + } - } // end else if + } else { DEBUG_CRASH(( "xferSTLObjectIDList - Unknown xfer mode '%d'", getXferMode() )); throw XFER_MODE_UNKNOWN; - } // end else + } } // ------------------------------------------------------------------------------------------------ @@ -455,9 +455,9 @@ void Xfer::xferSTLObjectIDList( std::list< ObjectID > *objectIDListData ) objectID = *it; xferObjectID( &objectID ); - } // end for + } - } // end if, save + } else if( getXferMode() == XFER_LOAD ) { @@ -468,7 +468,7 @@ void Xfer::xferSTLObjectIDList( std::list< ObjectID > *objectIDListData ) DEBUG_CRASH(( "Xfer::xferSTLObjectIDList - object list should be empty before loading" )); throw XFER_LIST_NOT_EMPTY; - } // end if + } // read all ids for( UnsignedShort i = 0; i < listCount; ++i ) @@ -477,18 +477,18 @@ void Xfer::xferSTLObjectIDList( std::list< ObjectID > *objectIDListData ) xferObjectID( &objectID ); objectIDListData->push_back( objectID ); - } // end for, i + } - } // end else if + } else { DEBUG_CRASH(( "xferSTLObjectIDList - Unknown xfer mode '%d'", getXferMode() )); throw XFER_MODE_UNKNOWN; - } // end else + } -} // end xferSTLObjectIDList +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -521,9 +521,9 @@ void Xfer::xferSTLIntList( std::list< Int > *intListData ) intData = *it; xferInt( &intData ); - } // end for + } - } // end if, save + } else if( getXferMode() == XFER_LOAD ) { @@ -534,7 +534,7 @@ void Xfer::xferSTLIntList( std::list< Int > *intListData ) DEBUG_CRASH(( "Xfer::xferSTLIntList - int list should be empty before loading" )); throw XFER_LIST_NOT_EMPTY; - } // end if + } // read all ids for( UnsignedShort i = 0; i < listCount; ++i ) @@ -543,18 +543,18 @@ void Xfer::xferSTLIntList( std::list< Int > *intListData ) xferInt( &intData ); intListData->push_back( intData ); - } // end for, i + } - } // end else if + } else { DEBUG_CRASH(( "xferSTLIntList - Unknown xfer mode '%d'", getXferMode() )); throw XFER_MODE_UNKNOWN; - } // end else + } -} // end xferSTLIntList +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -574,7 +574,7 @@ void Xfer::xferScienceType( ScienceType *science ) // write the string xferAsciiString( &scienceName ); - } // end if, save + } else if( getXferMode() == XFER_LOAD ) { xferAsciiString( &scienceName ); @@ -587,23 +587,23 @@ void Xfer::xferScienceType( ScienceType *science ) DEBUG_CRASH(( "xferScienceType - Unknown science '%s'", scienceName.str() )); throw XFER_UNKNOWN_STRING; - } // end if + } - } // end else if, load + } else if( getXferMode() == XFER_CRC ) { xferImplementation( science, sizeof( *science ) ); - } // end else if, crc + } else { DEBUG_CRASH(( "xferScienceType - Unknown xfer mode '%d'", getXferMode() )); throw XFER_MODE_UNKNOWN; - } // end else + } -} // end xferScienceType +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -657,17 +657,17 @@ void Xfer::xferScienceVec( ScienceVec *scienceVec ) { ScienceType science = *it; xferImplementation( &science, sizeof( ScienceType ) ); - } // end for, it - } // end else if, crc + } + } else { DEBUG_CRASH(( "xferScienceVec - Unknown xfer mode '%d'", getXferMode() )); throw XFER_MODE_UNKNOWN; - } // end else + } -} // end xferScienceVec +} // ------------------------------------------------------------------------------------------------ /** kind of type, for load/save it is xfered as a string so we can reorder the @@ -691,7 +691,7 @@ void Xfer::xferKindOf( KindOfType *kindOfData ) AsciiString kindOfName = KindOfMaskType::getNameFromSingleBit(*kindOfData); xferAsciiString( &kindOfName ); - } // end if, save + } else if( getXferMode() == XFER_LOAD ) { @@ -704,23 +704,23 @@ void Xfer::xferKindOf( KindOfType *kindOfData ) if (bit != -1) *kindOfData = (KindOfType)bit; - } // end else if, load + } else if( getXferMode() == XFER_CRC ) { // just call the xfer implementation on the data values xferImplementation( kindOfData, sizeof( KindOfType ) ); - } // end else if, crc + } else { DEBUG_CRASH(( "xferKindOf - Unknown xfer mode '%d'", getXferMode() )); throw XFER_MODE_UNKNOWN; - } // end else + } -} // end xferKindOf +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -755,7 +755,7 @@ void Xfer::xferUpgradeMask( UpgradeMaskType *upgradeMaskData ) { count++; } - } // end for, upgradeTemplate + } // write the count xferUnsignedShort( &count ); @@ -768,9 +768,9 @@ void Xfer::xferUpgradeMask( UpgradeMaskType *upgradeMaskData ) { upgradeName = upgradeTemplate->getUpgradeName(); xferAsciiString( &upgradeName ); - } // end if - } // end for, upgradeTemplate - } // end if, save + } + } + } else if( getXferMode() == XFER_LOAD ) { AsciiString upgradeName; @@ -798,30 +798,30 @@ void Xfer::xferUpgradeMask( UpgradeMaskType *upgradeMaskData ) DEBUG_CRASH(( "Xfer::xferUpgradeMask - Unknown upgrade '%s'", upgradeName.str() )); throw XFER_UNKNOWN_STRING; - } // end if + } // set the mask data upgradeMaskData->set( upgradeTemplate->getUpgradeMask() ); - } // end for i + } - } // end else if, load + } else if( getXferMode() == XFER_CRC ) { // just xfer implementation the data itself xferImplementation( upgradeMaskData, sizeof( UpgradeMaskType ) ); - } // end else if, crc + } else { DEBUG_CRASH(( "xferUpgradeMask - Unknown xfer mode '%d'", getXferMode() )); throw XFER_MODE_UNKNOWN; - } // end else + } -} // end xferUpgradeMask +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -830,7 +830,7 @@ void Xfer::xferUser( void *data, Int dataSize ) xferImplementation( data, dataSize ); -} // end xferUser +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ diff --git a/Core/GameEngine/Source/Common/System/XferCRC.cpp b/Core/GameEngine/Source/Common/System/XferCRC.cpp index 83a4959525f..e90b944e719 100644 --- a/Core/GameEngine/Source/Common/System/XferCRC.cpp +++ b/Core/GameEngine/Source/Common/System/XferCRC.cpp @@ -46,14 +46,14 @@ XferCRC::XferCRC( void ) //Initialization(s) inserted m_crc = 0; // -} // end XferCRC +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- XferCRC::~XferCRC( void ) { -} // end ~XferCRC +} //------------------------------------------------------------------------------------------------- /** Open file 'identifier' for writing */ @@ -67,7 +67,7 @@ void XferCRC::open( AsciiString identifier ) // initialize CRC to brand new one at zero m_crc = 0; -} // end open +} //------------------------------------------------------------------------------------------------- /** Close our current file */ @@ -75,7 +75,7 @@ void XferCRC::open( AsciiString identifier ) void XferCRC::close( void ) { -} // end close +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -84,14 +84,14 @@ Int XferCRC::beginBlock( void ) return 0; -} // end beginBlock +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- void XferCRC::endBlock( void ) { -} // end endBlock +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -100,7 +100,7 @@ void XferCRC::addCRC( UnsignedInt val ) m_crc = (m_crc << 1) + htobe(val) + ((m_crc >> 31) & 0x01); -} // end addCRC +} // ------------------------------------------------------------------------------------------------ /** Entry point for xfering a snapshot */ @@ -113,12 +113,12 @@ void XferCRC::xferSnapshot( Snapshot *snapshot ) return; - } // end if + } // run the crc function of the snapshot snapshot->crc( this ); -} // end xferSnapshot +} //------------------------------------------------------------------------------------------------- /** Perform a single CRC operation on the data passed in */ @@ -154,14 +154,14 @@ void XferCRC::xferImplementation( void *data, Int dataSize ) break; } -} // end xferImplementation +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- void XferCRC::skip( Int dataSize ) { -} // end skip +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -170,7 +170,7 @@ UnsignedInt XferCRC::getCRC( void ) return htobe(m_crc); -} // end skip +} //------------------------------------------------------------------------------------------------- @@ -181,7 +181,7 @@ XferDeepCRC::XferDeepCRC( void ) m_xferMode = XFER_SAVE; m_fileFP = NULL; -} // end XferCRC +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -195,9 +195,9 @@ XferDeepCRC::~XferDeepCRC( void ) DEBUG_CRASH(( "Warning: Xfer file '%s' was left open", m_identifier.str() )); close(); - } // end if + } -} // end ~XferCRC +} //------------------------------------------------------------------------------------------------- /** Open file 'identifier' for writing */ @@ -215,7 +215,7 @@ void XferDeepCRC::open( AsciiString identifier ) identifier.str(), m_identifier.str() )); throw XFER_FILE_ALREADY_OPEN; - } // end if + } // call base class Xfer::open( identifier ); @@ -228,12 +228,12 @@ void XferDeepCRC::open( AsciiString identifier ) DEBUG_CRASH(( "File '%s' not found", identifier.str() )); throw XFER_FILE_NOT_FOUND; - } // end if + } // initialize CRC to brand new one at zero m_crc = 0; -} // end open +} //------------------------------------------------------------------------------------------------- /** Close our current file */ @@ -248,7 +248,7 @@ void XferDeepCRC::close( void ) DEBUG_CRASH(( "Xfer close called, but no file was open" )); throw XFER_FILE_NOT_OPEN; - } // end if + } // close the file fclose( m_fileFP ); @@ -257,7 +257,7 @@ void XferDeepCRC::close( void ) // erase the filename m_identifier.clear(); -} // end close +} //------------------------------------------------------------------------------------------------- /** Perform a single CRC operation on the data passed in */ @@ -281,11 +281,11 @@ void XferDeepCRC::xferImplementation( void *data, Int dataSize ) DEBUG_CRASH(( "XferSave - Error writing to file '%s'", m_identifier.str() )); throw XFER_WRITE_ERROR; - } // end if + } XferCRC::xferImplementation( data, dataSize ); -} // end xferImplementation +} // ------------------------------------------------------------------------------------------------ /** Save ascii string */ @@ -293,7 +293,7 @@ void XferDeepCRC::xferImplementation( void *data, Int dataSize ) void XferDeepCRC::xferMarkerLabel( AsciiString asciiStringData ) { -} // end xferAsciiString +} // ------------------------------------------------------------------------------------------------ /** Save ascii string */ @@ -308,7 +308,7 @@ void XferDeepCRC::xferAsciiString( AsciiString *asciiStringData ) DEBUG_CRASH(( "XferSave cannot save this ascii string because it's too long. Change the size of the length header (but be sure to preserve save file compatability" )); throw XFER_STRING_ERROR; - } // end if + } // save length of string to follow UnsignedShort len = asciiStringData->getLength(); @@ -318,7 +318,7 @@ void XferDeepCRC::xferAsciiString( AsciiString *asciiStringData ) if( len > 0 ) xferUser( (void *)asciiStringData->str(), sizeof( Byte ) * len ); -} // end xferAsciiString +} // ------------------------------------------------------------------------------------------------ /** Save unicodee string */ @@ -333,7 +333,7 @@ void XferDeepCRC::xferUnicodeString( UnicodeString *unicodeStringData ) DEBUG_CRASH(( "XferSave cannot save this unicode string because it's too long. Change the size of the length header (but be sure to preserve save file compatability" )); throw XFER_STRING_ERROR; - } // end if + } // save length of string to follow Byte len = unicodeStringData->getLength(); @@ -343,4 +343,4 @@ void XferDeepCRC::xferUnicodeString( UnicodeString *unicodeStringData ) if( len > 0 ) xferUser( (void *)unicodeStringData->str(), sizeof( WideChar ) * len ); -} // end xferUnicodeString +} diff --git a/Core/GameEngine/Source/Common/System/XferLoad.cpp b/Core/GameEngine/Source/Common/System/XferLoad.cpp index e04705a98ed..9b1f1981b3c 100644 --- a/Core/GameEngine/Source/Common/System/XferLoad.cpp +++ b/Core/GameEngine/Source/Common/System/XferLoad.cpp @@ -42,7 +42,7 @@ XferLoad::XferLoad( void ) m_xferMode = XFER_LOAD; m_fileFP = NULL; -} // end XferLoad +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -56,9 +56,9 @@ XferLoad::~XferLoad( void ) DEBUG_CRASH(( "Warning: Xfer file '%s' was left open", m_identifier.str() )); close(); - } // end if + } -} // end ~XferLoad +} //------------------------------------------------------------------------------------------------- /** Open file 'identifier' for reading */ @@ -74,7 +74,7 @@ void XferLoad::open( AsciiString identifier ) identifier.str(), m_identifier.str() )); throw XFER_FILE_ALREADY_OPEN; - } // end if + } // call base class Xfer::open( identifier ); @@ -87,9 +87,9 @@ void XferLoad::open( AsciiString identifier ) DEBUG_CRASH(( "File '%s' not found", identifier.str() )); throw XFER_FILE_NOT_FOUND; - } // end if + } -} // end open +} //------------------------------------------------------------------------------------------------- /** Close our current file */ @@ -104,7 +104,7 @@ void XferLoad::close( void ) DEBUG_CRASH(( "Xfer close called, but no file was open" )); throw XFER_FILE_NOT_OPEN; - } // end if + } // close the file fclose( m_fileFP ); @@ -113,7 +113,7 @@ void XferLoad::close( void ) // erase the filename m_identifier.clear(); -} // end close +} //------------------------------------------------------------------------------------------------- /** Read a block size descriptor from the file at the current position */ @@ -133,12 +133,12 @@ Int XferLoad::beginBlock( void ) DEBUG_CRASH(( "Xfer - Error reading block size for '%s'", m_identifier.str() )); return 0; - } // end if + } // return the block size return blockSize; -} // end beginBlock +} // ------------------------------------------------------------------------------------------------ /** End block ... this does nothing when reading */ @@ -146,7 +146,7 @@ Int XferLoad::beginBlock( void ) void XferLoad::endBlock( void ) { -} // end endBlock +} //------------------------------------------------------------------------------------------------- /** Skip forward 'dataSize' bytes in the file */ @@ -166,7 +166,7 @@ void XferLoad::skip( Int dataSize ) if( fseek( m_fileFP, dataSize, SEEK_CUR ) != 0 ) throw XFER_SKIP_ERROR; -} // end skip +} // ------------------------------------------------------------------------------------------------ /** Entry point for xfering a snapshot */ @@ -180,7 +180,7 @@ void XferLoad::xferSnapshot( Snapshot *snapshot ) DEBUG_CRASH(( "XferLoad::xferSnapshot - Invalid parameters" )); throw XFER_INVALID_PARAMETERS; - } // end if + } // run the xfer function of the snapshot snapshot->xfer( this ); @@ -189,7 +189,7 @@ void XferLoad::xferSnapshot( Snapshot *snapshot ) if( BitIsSet( getOptions(), XO_NO_POST_PROCESSING ) == FALSE ) TheGameState->addPostProcessSnapshot( snapshot ); -} // end xferSnapshot +} // ------------------------------------------------------------------------------------------------ /** Read string from file and store in ascii string */ @@ -212,7 +212,7 @@ void XferLoad::xferAsciiString( AsciiString *asciiStringData ) // save into ascii string asciiStringData->set( buffer ); -} // end xferAsciiString +} // ------------------------------------------------------------------------------------------------ /** Read string from file and store in unicode string */ @@ -235,7 +235,7 @@ void XferLoad::xferUnicodeString( UnicodeString *unicodeStringData ) // save into unicode string unicodeStringData->set( buffer ); -} // end xferUnicodeString +} //------------------------------------------------------------------------------------------------- /** Perform the read operation */ @@ -254,7 +254,7 @@ void XferLoad::xferImplementation( void *data, Int dataSize ) DEBUG_CRASH(( "XferLoad - Error reading from file '%s'", m_identifier.str() )); throw XFER_READ_ERROR; - } // end if + } -} // end xferImplementation +} diff --git a/Core/GameEngine/Source/Common/System/XferSave.cpp b/Core/GameEngine/Source/Common/System/XferSave.cpp index 02d01ebd19b..fbf0d46886c 100644 --- a/Core/GameEngine/Source/Common/System/XferSave.cpp +++ b/Core/GameEngine/Source/Common/System/XferSave.cpp @@ -59,7 +59,7 @@ XferSave::XferSave( void ) m_fileFP = NULL; m_blockStack = NULL; -} // end XferSave +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -73,7 +73,7 @@ XferSave::~XferSave( void ) DEBUG_CRASH(( "Warning: Xfer file '%s' was left open", m_identifier.str() )); close(); - } // end if + } // // the block stack should be empty, if it's not that means we started blocks but never @@ -94,11 +94,11 @@ XferSave::~XferSave( void ) deleteInstance(m_blockStack); m_blockStack = next; - } // end while + } - } // end if + } -} // end ~XferSave +} //------------------------------------------------------------------------------------------------- /** Open file 'identifier' for writing */ @@ -114,7 +114,7 @@ void XferSave::open( AsciiString identifier ) identifier.str(), m_identifier.str() )); throw XFER_FILE_ALREADY_OPEN; - } // end if + } // call base class Xfer::open( identifier ); @@ -127,9 +127,9 @@ void XferSave::open( AsciiString identifier ) DEBUG_CRASH(( "File '%s' not found", identifier.str() )); throw XFER_FILE_NOT_FOUND; - } // end if + } -} // end open +} //------------------------------------------------------------------------------------------------- /** Close our current file */ @@ -144,7 +144,7 @@ void XferSave::close( void ) DEBUG_CRASH(( "Xfer close called, but no file was open" )); throw XFER_FILE_NOT_OPEN; - } // end if + } // close the file fclose( m_fileFP ); @@ -153,7 +153,7 @@ void XferSave::close( void ) // erase the filename m_identifier.clear(); -} // end close +} //------------------------------------------------------------------------------------------------- /** Write a placeholder at the current location in the file and store this location @@ -181,7 +181,7 @@ Int XferSave::beginBlock( void ) m_identifier.str() )); return XFER_WRITE_ERROR; - } // end if + } // save this block position on the top of the "stack" XferBlockData *top = newInstance(XferBlockData); @@ -200,7 +200,7 @@ Int XferSave::beginBlock( void ) return XFER_OK; -} // end beginBlock +} //------------------------------------------------------------------------------------------------- /** Do the tail end as described in beginBlock above. Back up to the last begin block, @@ -221,7 +221,7 @@ void XferSave::endBlock( void ) DEBUG_CRASH(( "Xfer end block called, but no matching begin block was found" )); throw XFER_BEGIN_END_MISMATCH; - } // end if + } // save our current file position XferFilePos currentFilePos = ftell( m_fileFP ); @@ -241,7 +241,7 @@ void XferSave::endBlock( void ) DEBUG_CRASH(( "Error writing block size to file '%s'", m_identifier.str() )); throw XFER_WRITE_ERROR; - } // end if + } // place the file pointer back to the current position fseek( m_fileFP, currentFilePos, SEEK_SET ); @@ -249,7 +249,7 @@ void XferSave::endBlock( void ) // delete the block data as it's all used up now deleteInstance(top); -} // end endBlock +} //------------------------------------------------------------------------------------------------- /** Skip forward 'dataSize' bytes in the file */ @@ -265,7 +265,7 @@ void XferSave::skip( Int dataSize ) // skip forward dataSize bytes fseek( m_fileFP, dataSize, SEEK_CUR ); -} // end skip +} // ------------------------------------------------------------------------------------------------ /** Entry point for xfering a snapshot */ @@ -279,12 +279,12 @@ void XferSave::xferSnapshot( Snapshot *snapshot ) DEBUG_CRASH(( "XferSave::xferSnapshot - Invalid parameters" )); throw XFER_INVALID_PARAMETERS; - } // end if + } // run the xfer function of the snapshot snapshot->xfer( this ); -} // end xferSnapshot +} // ------------------------------------------------------------------------------------------------ /** Save ascii string */ @@ -299,7 +299,7 @@ void XferSave::xferAsciiString( AsciiString *asciiStringData ) DEBUG_CRASH(( "XferSave cannot save this unicode string because it's too long. Change the size of the length header (but be sure to preserve save file compatability" )); throw XFER_STRING_ERROR; - } // end if + } // save length of string to follow UnsignedByte len = asciiStringData->getLength(); @@ -309,7 +309,7 @@ void XferSave::xferAsciiString( AsciiString *asciiStringData ) if( len > 0 ) xferUser( (void *)asciiStringData->str(), sizeof( Byte ) * len ); -} // end xferAsciiString +} // ------------------------------------------------------------------------------------------------ /** Save unicodee string */ @@ -324,7 +324,7 @@ void XferSave::xferUnicodeString( UnicodeString *unicodeStringData ) DEBUG_CRASH(( "XferSave cannot save this unicode string because it's too long. Change the size of the length header (but be sure to preserve save file compatability" )); throw XFER_STRING_ERROR; - } // end if + } // save length of string to follow UnsignedByte len = unicodeStringData->getLength(); @@ -334,7 +334,7 @@ void XferSave::xferUnicodeString( UnicodeString *unicodeStringData ) if( len > 0 ) xferUser( (void *)unicodeStringData->str(), sizeof( WideChar ) * len ); -} // end xferUnicodeString +} //------------------------------------------------------------------------------------------------- /** Perform the write operation */ @@ -353,6 +353,6 @@ void XferSave::xferImplementation( void *data, Int dataSize ) DEBUG_CRASH(( "XferSave - Error writing to file '%s'", m_identifier.str() )); throw XFER_WRITE_ERROR; - } // end if + } -} // end xferImplementation +} diff --git a/Core/GameEngine/Source/Common/crc.cpp b/Core/GameEngine/Source/Common/crc.cpp index ddf54fff939..f99a8ab30d6 100644 --- a/Core/GameEngine/Source/Common/crc.cpp +++ b/Core/GameEngine/Source/Common/crc.cpp @@ -78,6 +78,6 @@ UnsignedInt CRC::get( void ) UnsignedInt tcrc = crc; return tcrc; -} // end skip +} #endif diff --git a/Core/Libraries/Source/Compression/LZHCompress/NoxCompress.cpp b/Core/Libraries/Source/Compression/LZHCompress/NoxCompress.cpp index 45aa2b7dc8a..6eb2271ae9d 100644 --- a/Core/Libraries/Source/Compression/LZHCompress/NoxCompress.cpp +++ b/Core/Libraries/Source/Compression/LZHCompress/NoxCompress.cpp @@ -114,7 +114,7 @@ Bool DecompressFile (char *infile, char *outfile) DbgFree(inBlock); DbgFree(outBlock); return success; - } // End of if fileptr + } return FALSE; } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/dynamesh.cpp b/Core/Libraries/Source/WWVegas/WW3D2/dynamesh.cpp index 888c05d0afa..0dfa7b141ba 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/dynamesh.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/dynamesh.cpp @@ -225,7 +225,7 @@ void DynamicMeshModel::Render(RenderInfoClass & rinfo) vertices += fvf_info.Get_FVF_Size(); } - } // end scope for lock + } /* ** Write index data to index buffers @@ -244,7 +244,7 @@ void DynamicMeshModel::Render(RenderInfoClass & rinfo) indices[i*3 + 2] = (unsigned short)tris[i][2]; } - } // end scope for lock + } /* ** Set vertex and index buffers @@ -390,9 +390,9 @@ void DynamicMeshModel::Render(RenderInfoClass & rinfo) cur_tri_idx = next_tri_idx; - } // while (!done) + } - } // for (pass) + } } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp b/Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp index 517adac99af..1a195e24fcc 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp @@ -155,7 +155,7 @@ NodeCompressedMotionStruct::~NodeCompressedMotionStruct() if (Vis) delete Vis; -} // ~NodeCompressedMotionStruct +} /*********************************************************************************************** @@ -370,7 +370,7 @@ int HCompressedAnimClass::Load_W3D(ChunkLoadClass & cload) Free(); return LOAD_ERROR; -} // Load_W3D +} /*********************************************************************************************** * HCompressedAnimClass::read_channel -- Reads in a single channel of motion * @@ -391,7 +391,7 @@ bool HCompressedAnimClass::read_channel(ChunkLoadClass & cload,TimeCodedMotionCh return result; -} // read_channel +} bool HCompressedAnimClass::read_channel(ChunkLoadClass & cload,AdaptiveDeltaMotionChannelClass * * newchan) { @@ -400,7 +400,7 @@ bool HCompressedAnimClass::read_channel(ChunkLoadClass & cload,AdaptiveDeltaMoti return result; -} // read_channel +} /*********************************************************************************************** @@ -438,7 +438,7 @@ void HCompressedAnimClass::add_channel(TimeCodedMotionChannelClass * newchan) break; } -} // add_channel +} void HCompressedAnimClass::add_channel(AdaptiveDeltaMotionChannelClass * newchan) { @@ -463,7 +463,7 @@ void HCompressedAnimClass::add_channel(AdaptiveDeltaMotionChannelClass * newchan break; } -} // add_channel +} @@ -487,7 +487,7 @@ bool HCompressedAnimClass::read_bit_channel(ChunkLoadClass & cload,TimeCodedBitC return result; -} // read_bit_channel +} /*********************************************************************************************** @@ -576,7 +576,7 @@ void HCompressedAnimClass::Get_Orientation(Quaternion& q, int pividx,float frame WWASSERT(0); // unknown flavor break; } -} // Get_Orientation +} /*********************************************************************************************** * HCompressedAnimClass::Get_Transform -- returns the transform matrix for the given frame * diff --git a/Core/Libraries/Source/WWVegas/WW3D2/metalmap.cpp b/Core/Libraries/Source/WWVegas/WW3D2/metalmap.cpp index 0d95448d3f6..5a91d8196ff 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/metalmap.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/metalmap.cpp @@ -342,7 +342,7 @@ void MetalMapManagerClass::Update_Textures(void) } metal_map_surface->Unlock(); REF_PTR_RELEASE(metal_map_surface); - } // for i + } } /*********************************************************************************************** diff --git a/Core/Libraries/Source/WWVegas/WW3D2/pointgr.cpp b/Core/Libraries/Source/WWVegas/WW3D2/pointgr.cpp index ee381be2a58..04a2f1ccb9d 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/pointgr.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/pointgr.cpp @@ -907,7 +907,7 @@ void PointGroupClass::Render(RenderInfoClass &rinfo) transformed_loc[i].Z=result.Z; } current_loc = &transformed_loc[0]; - } // if transform + } // Update the arrays with the offsets. int vnum, pnum; @@ -973,7 +973,7 @@ void PointGroupClass::Render(RenderInfoClass &rinfo) *(Vector2*)(vb+fvfinfo.Get_Tex_Offset(0))=VertexUV[i]; vb+=fvfinfo.Get_FVF_Size(); } - } // copy + } DX8Wrapper::Set_Index_Buffer (indexbuffer, 0); DX8Wrapper::Set_Vertex_Buffer (PointVerts); @@ -988,7 +988,7 @@ void PointGroupClass::Render(RenderInfoClass &rinfo) } current+=delta; - } // loop while (currentNextSegmentID]); - } // while + } // Copy from "read index" to "write index" write_int->PointCount = curr_int->PointCount; @@ -886,7 +886,7 @@ void SegLineRendererClass::Render write_int->Direction = curr_int->Direction; write_int->Fold = curr_int->Fold; - } // for iidx + } // If iidx_r is exactly equal to num_isects (rather than being larger by one) at this // point, this means that the last intersection was not merged with the previous one. In @@ -912,9 +912,9 @@ void SegLineRendererClass::Render assert(total_cnt == point_cnt); #endif - } // for edge - } // while (merged) - } // if (Is_Merge_Intersections()) + } + } + } /* ** Find vertex positions, generate vertices and triangles: @@ -1158,7 +1158,7 @@ void SegLineRendererClass::Render texture->V = vArray[i].v1; vb += vbSize; } - } // copy + } DynamicIBAccessClass ib_access((sorting?BUFFER_TYPE_DYNAMIC_SORTING:BUFFER_TYPE_DYNAMIC_DX8),tidx*3); { @@ -1188,7 +1188,7 @@ void SegLineRendererClass::Render REF_PTR_RELEASE(mat); - } // Chunking loop + } DX8Wrapper::Set_Transform(D3DTS_VIEW,view); diff --git a/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp b/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp index 24ade71dd70..9d1d337f260 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp @@ -236,7 +236,7 @@ SphereRenderObjClass::SphereRenderObjClass(const SphereRenderObjClass & src) SphereRenderObjClass::~SphereRenderObjClass() { REF_PTR_RELEASE(SphereMaterial); -} // destructor +} /*********************************************************************************************** * SphereRenderObjClass::operator -- assignment operator * @@ -365,7 +365,7 @@ void SphereRenderObjClass::Init_Material (void) // is to turn off backface culling... ug... SphereShader.Set_Cull_Mode(ShaderClass::CULL_MODE_DISABLE); -} // Init_Material +} /*********************************************************************************************** @@ -528,7 +528,7 @@ void SphereRenderObjClass::render_sphere() DX8Wrapper::Draw_Triangles(0,mesh.face_ct,0,mesh.Vertex_ct); } -} // render_sphere +} /*********************************************************************************************** @@ -547,7 +547,7 @@ void SphereRenderObjClass::render_sphere() *=============================================================================================*/ void SphereRenderObjClass::vis_render_sphere(SpecialRenderInfoClass & rinfo,const Vector3 & center,const Vector3 & extent) { -} // vis_render_sphere +} /*********************************************************************************************** @@ -1141,7 +1141,7 @@ void SphereRenderObjClass::animate (void) return ; -} // animate +} /* @@ -1382,7 +1382,7 @@ inverse_alpha(false) Generate(radius, slices, stacks); -} // SphereMesh Constructor +} /*********************************************************************************************** * SphereMeshClass::SphereMeshClass -- Constructor for SphereMesh Geometry * @@ -1415,7 +1415,7 @@ tri_poly(NULL), inverse_alpha(false) { -} // Empty SphereMesh Constructor +} @@ -1484,7 +1484,7 @@ void SphereMeshClass::Set_Alpha_Vector (const AlphaVectorStruct &v, bool inverse } return ; -} // Set_Alpha_Vector +} /*********************************************************************************************** @@ -1563,8 +1563,8 @@ void SphereMeshClass::Generate(float radius, int slices, int stacks) uv->V = stackstep; uv++; - } // for slices - } // for stacks + } + } // Assign vertex for south pole; *veclist = -1.0f * vec; @@ -1698,7 +1698,7 @@ void SphereMeshClass::Generate(float radius, int slices, int stacks) Set_Alpha_Vector (alpha_vector, inverse_alpha, IsAdditive, true); return ; -} // Generate +} @@ -1715,7 +1715,7 @@ SphereMeshClass::~SphereMeshClass(void) Free(); -} // Destructor +} /*********************************************************************************************** diff --git a/Core/Libraries/Source/WWVegas/WW3D2/static_sort_list.h b/Core/Libraries/Source/WWVegas/WW3D2/static_sort_list.h index 5492e7b50ed..90a14c34582 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/static_sort_list.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/static_sort_list.h @@ -59,7 +59,7 @@ class StaticSortListClass virtual void Add_To_List(RenderObjClass * robj, unsigned int sort_level) = 0; virtual void Render_And_Clear(RenderInfoClass & rinfo) = 0; -}; // end StaticSortListClass +}; // The actual implementation for the standard ww3d StaticSortList. class DefaultStaticSortListClass : public StaticSortListClass @@ -90,7 +90,7 @@ class DefaultStaticSortListClass : public StaticSortListClass // An array of lists - each object in a given list has same SortLevel. RefRenderObjListClass SortLists[MAX_SORT_LEVEL + 1]; -}; // end StaticSortListClass +}; diff --git a/Core/Libraries/Source/WWVegas/WW3D2/streakRender.cpp b/Core/Libraries/Source/WWVegas/WW3D2/streakRender.cpp index 3c0f8c9f51d..c93a2800a0a 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/streakRender.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/streakRender.cpp @@ -863,7 +863,7 @@ void StreakRendererClass::RenderStreak segment[intersectionIndex].StartPlane = -start_pl; } - } // for intersectionIndex + } /* @@ -1038,7 +1038,7 @@ void StreakRendererClass::RenderStreak next_int = &(intersection[intersectionIndex_r + 1][edge]); next_seg = &(segment[next_int->NextSegmentID]); - } // while + } // Copy from "read index" to "write index" write_int->PointCount = curr_int->PointCount; @@ -1048,7 +1048,7 @@ void StreakRendererClass::RenderStreak write_int->Direction = curr_int->Direction; write_int->Fold = curr_int->Fold; - } // for intersectionIndex + } // If intersectionIndex_r is exactly equal to num_isects (rather than being larger by one) at this // point, this means that the last intersection was not merged with the previous one. In @@ -1075,9 +1075,9 @@ void StreakRendererClass::RenderStreak assert(total_cnt == point_cnt); #endif - } // for edge - } // while (merged) - } // if (Is_Merge_Intersections()) + } + } + } /* ** Find vertex positions, generate vertices and triangles: @@ -1356,7 +1356,7 @@ void StreakRendererClass::RenderStreak texture->V = vertexArray[i].v1; vb += vbSize; } - } // copy + } DynamicIBAccessClass ib_access((sorting?BUFFER_TYPE_DYNAMIC_SORTING:BUFFER_TYPE_DYNAMIC_DX8),triangleIndex*3); { @@ -1387,7 +1387,7 @@ void StreakRendererClass::RenderStreak DX8Wrapper::Draw_Triangles(0,triangleIndex,0,vnum); } - } // Chunking loop + } DX8Wrapper::Set_Transform(D3DTS_VIEW,view); diff --git a/Core/Libraries/Source/WWVegas/WW3D2/stripoptimizer.cpp b/Core/Libraries/Source/WWVegas/WW3D2/stripoptimizer.cpp index 640f9f312e1..fdec676476a 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/stripoptimizer.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/stripoptimizer.cpp @@ -481,7 +481,7 @@ class Stripify }; int Stripify::s_mod[6] = {0,1,2,0,1,2}; -} // Strip +} template <> inline unsigned int HashTemplateKeyClass::Get_Hash_Value(const Strip::Edge& s) @@ -1009,7 +1009,7 @@ int* Stripify::stripify (const Vector3i* inTris, int N) return rOut; } -} // Strip +} int* StripOptimizerClass::Stripify(const int* tris, int N) { return Strip::Stripify::stripify((const Strip::Vector3i*)tris,N); diff --git a/Core/Libraries/Source/WWVegas/WWLib/tgatodxt.cpp b/Core/Libraries/Source/WWVegas/WWLib/tgatodxt.cpp index 08b32557abd..de1431fa995 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/tgatodxt.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/tgatodxt.cpp @@ -191,7 +191,7 @@ TGAToDXTClass::ErrorCode TGAToDXTClass::Convert (const char *inputpathname, cons if (!validsize) error_code = INVALID_SIZE; if (!validaspect) error_code = INVALID_ASPECT_RATIO; } - } // error == 0 + } return error_code; } diff --git a/Core/Libraries/Source/WWVegas/WWMath/tri.h b/Core/Libraries/Source/WWVegas/WWMath/tri.h index 5a7cd512b79..7eee8eb137d 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/tri.h +++ b/Core/Libraries/Source/WWVegas/WWMath/tri.h @@ -296,9 +296,9 @@ inline bool Cast_Semi_Infinite_Axis_Aligned_Ray_To_Triangle(const Vector3 &tri_p flags |= TRI_RAYCAST_FLAG_START_IN_TRI; } } - } // if (result == 0.0f) - } // else (result < 0.0f) - } // if Point_In_Triangle_2D() + } + } + } return retval; } diff --git a/Core/Tools/Autorun/TTFont.cpp b/Core/Tools/Autorun/TTFont.cpp index 344811c5f55..491ce8157a1 100644 --- a/Core/Tools/Autorun/TTFont.cpp +++ b/Core/Tools/Autorun/TTFont.cpp @@ -1148,7 +1148,7 @@ int TTFontClass::Find_Text_VLength( HDC hdc, char *str, int width ) //-------------------------------------------------------------- wspc += Char_Pixel_Width( localDC, ' ' ); } - } // end-of-for + } //-------------------------------------------------------------------- // @@ -1173,7 +1173,7 @@ int TTFontClass::Find_Text_VLength( HDC hdc, char *str, int width ) } letter += n; - } // end-of-while + } //----------------------------------------------------------------------- // Left over, add a line. diff --git a/Core/Tools/Autorun/autorun.cpp b/Core/Tools/Autorun/autorun.cpp index b63fe328818..11a5c8962d8 100644 --- a/Core/Tools/Autorun/autorun.cpp +++ b/Core/Tools/Autorun/autorun.cpp @@ -1760,7 +1760,7 @@ unsigned int MainWindow::Run_OpenFile(int cd_drive, const char *filename, bool w TranslateMessage( &msg ); DispatchMessage( &msg ); - } // end while + } DWORD exitCode; GetExitCodeProcess(hProcess, &exitCode); @@ -3410,7 +3410,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param hButtonBitmap = 0; } - } // END OF DRAW BITMAPS + } #if(0) TTFontClass *fontptr = ButtonList[i]->Return_Font_Ptr(); @@ -3495,9 +3495,9 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param - } // end of if button + } - } // For each button... + } //--------------------------------------------------------------- // Used in debugging -- draw rect around where buttons are. @@ -3553,7 +3553,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param DeleteDC( buttonDC ); DeleteDC( licenseDC ); - } // end of bitmaps + } //=================================================================== // Draw a solid colored background. @@ -4360,7 +4360,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param ButtonList[i]->Set_State( DrawButton::FOCUS_STATE ); // Msg( __LINE__, TEXT(__FILE__), TEXT("WM_MOUSEMOVE -- %s[FOCUS_STATE]."), ButtonList[i]->Return_Normal_Bitmap()); } - } // end of if + } //----------------------------------------------------------- // Get the area of the button, and post it for updating. @@ -4380,10 +4380,10 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param done = 1; } - } // end of if + } i++; - } // end of for + } #if( USE_MOUSE_MOVES ) diff --git a/Core/Tools/Babylon/BabylonDlg.cpp b/Core/Tools/Babylon/BabylonDlg.cpp index 8ecb19c6ada..2b73b8aca75 100644 --- a/Core/Tools/Babylon/BabylonDlg.cpp +++ b/Core/Tools/Babylon/BabylonDlg.cpp @@ -1982,7 +1982,7 @@ int CBabylonDlg::UpdateDB(TransDB *source, TransDB *destination, int update ) source->ClearChanges (); } } - } // update + } Ready (); diff --git a/Core/Tools/ImagePacker/Source/ImageInfo.cpp b/Core/Tools/ImagePacker/Source/ImageInfo.cpp index 24b8776abfc..8f24927a8dc 100644 --- a/Core/Tools/ImagePacker/Source/ImageInfo.cpp +++ b/Core/Tools/ImagePacker/Source/ImageInfo.cpp @@ -86,7 +86,7 @@ ImageInfo::ImageInfo( void ) m_gutterUsed.x = 0; m_gutterUsed.y = 0; -} // end ImageInfo +} // ImageInfo::~ImageInfo ====================================================== /** */ @@ -104,4 +104,4 @@ ImageInfo::~ImageInfo( void ) if( m_filenameOnlyNoExt ) delete [] m_filenameOnlyNoExt; -} // end ~ImageInfo +} diff --git a/Core/Tools/ImagePacker/Source/ImagePacker.cpp b/Core/Tools/ImagePacker/Source/ImagePacker.cpp index 9d8847f5da1..8e89774189d 100644 --- a/Core/Tools/ImagePacker/Source/ImagePacker.cpp +++ b/Core/Tools/ImagePacker/Source/ImagePacker.cpp @@ -86,7 +86,7 @@ TexturePage *ImagePacker::createNewTexturePage( void ) DEBUG_ASSERTCRASH( page, ("Unable to allocate new texture page.") ); return NULL; - } // end if + } // link page to list page->m_prev = NULL; @@ -107,7 +107,7 @@ TexturePage *ImagePacker::createNewTexturePage( void ) return page; -} // end createNewTexturePage +} // ImagePacker::validateImages ================================================ /** Check all the images in the image list, if any of them cannot be @@ -140,7 +140,7 @@ Bool ImagePacker::validateImages( void ) DEBUG_ASSERTCRASH( image, ("Image in imagelist is NULL") ); continue; // should never happen - } // end if + } // // if this image is too big to fit in the target page size as a whole @@ -154,7 +154,7 @@ Bool ImagePacker::validateImages( void ) BitSet( image->m_status, ImageInfo::TOOBIG ); BitSet( image->m_status, ImageInfo::CANTPROCESS ); - } // end if + } // // if this image is not the right format we can't process it, at @@ -167,9 +167,9 @@ Bool ImagePacker::validateImages( void ) BitSet( image->m_status, ImageInfo::INVALIDCOLORDEPTH ); BitSet( image->m_status, ImageInfo::CANTPROCESS ); - } // end if + } - } // end for i + } // // if we have errors, build a list and show them to the user @@ -182,11 +182,11 @@ Bool ImagePacker::validateImages( void ) TheImagePacker->getWindowHandle(), (DLGPROC)ImageErrorProc ); - } // end if + } return proceed; -} // end validateImages +} // ImagePacker::packImages ==================================================== /** Pack all the images in the image list, starting from the top and @@ -211,7 +211,7 @@ Bool ImagePacker::packImages( void ) statusMessage( "Build Cancelled By User." ); return FALSE; - } // end if + } // loop through all images for( i = 0; i < m_imageCount; i++ ) @@ -235,7 +235,7 @@ Bool ImagePacker::packImages( void ) if( page->addImage( image ) == TRUE ) break; // page added, stop trying to add into pages - } // end for page + } // if image was not able to go on any existing page create a new page for it if( page == NULL ) @@ -255,15 +255,15 @@ Bool ImagePacker::packImages( void ) MessageBox( NULL, buffer, "Internal Error", MB_OK | MB_ICONERROR ); return FALSE; - } // end if + } - } // end if + } - } // end for i + } return TRUE; // success -} // end packImages +} // ImagePacker::writeFinalTextures ============================================ /** Generate and write the final textures to the output directory @@ -295,7 +295,7 @@ void ImagePacker::writeFinalTextures( void ) errors = TRUE; continue; // could not generate this page, but try to continue - } // end if + } // // write this page out to a file using the filename given by @@ -307,9 +307,9 @@ void ImagePacker::writeFinalTextures( void ) errors = TRUE; continue; // could not write page, but try to go on - } // end if + } - } // end for page + } // check for any errors and notify the user if( errors == TRUE ) @@ -320,9 +320,9 @@ void ImagePacker::writeFinalTextures( void ) TheImagePacker->getWindowHandle(), (DLGPROC)PageErrorProc ); - } // end if + } -} // end writeFinalTextures +} // sortImageCompare =========================================================== /** Compare function for qsort @@ -343,7 +343,7 @@ static Int sortImageCompare( const void *aa, const void *bb ) else return 0; -} // end sortImageCompare +} // ImagePacker::sortImageList ================================================= /** Sort the image list */ @@ -354,7 +354,7 @@ void ImagePacker::sortImageList( void ) // sort all images so that largest area ones are first qsort( (void *)m_imageList, m_imageCount, sizeof( ImageInfo *), sortImageCompare ); -} // end sortImageList +} // ImagePacker::addImagesInDirectory ========================================== /** Add all the images in the specified directory */ @@ -400,9 +400,9 @@ void ImagePacker::addImagesInDirectory( char *dir ) sprintf( filePath, "%s%s", dir, item.cFileName ); addImage( filePath ); - } // end if + } - } // end if + } // find the rest of the files while( FindNextFile( hFile, &item ) != 0 ) @@ -425,21 +425,21 @@ void ImagePacker::addImagesInDirectory( char *dir ) sprintf( filePath, "%s%s", dir, item.cFileName ); addImage( filePath ); - } // end if + } - } // end if + } - } // end while + } // close search FindClose( hFile ); - } //end if, items found + } // restore our current directory SetCurrentDirectory( currDir ); -} // end addImagesInDirectory +} // ImagePacker::checkOutputDirectory ========================================== /** Verify that there are no files in the output directory ... if there @@ -487,12 +487,12 @@ Bool ImagePacker::checkOutputDirectory( void ) strcmp( item.cFileName, ".." ) ) fileCount++; - } // end while + } // close search FindClose( hFile ); - } //end if, items found + } // switch back to the current directory SetCurrentDirectory( currDir ); @@ -540,21 +540,21 @@ Bool ImagePacker::checkOutputDirectory( void ) strcmp( item.cFileName, ".." ) ) DeleteFile( item.cFileName ); - } // end while + } // close search FindClose( hFile ); - } //end if, items found + } // switch back to the current directory SetCurrentDirectory( currDir ); - } // end if + } return TRUE; // proceed -} // end checkOutputDirectory +} // ImagePacker::resetPageList ================================================= /** Clear the page list */ @@ -570,13 +570,13 @@ void ImagePacker::resetPageList( void ) delete m_pageList; m_pageList = next; - } // end while + } m_pageTail = NULL; m_pageCount = 0; m_targetPreviewPage = 1; -} // end resetPageList +} // ImagePacker::resetImageDirectoryList ======================================= /** Clear the image directory list */ @@ -592,12 +592,12 @@ void ImagePacker::resetImageDirectoryList( void ) delete m_dirList; m_dirList = next; - } // end while + } m_dirCount = 0; m_imagesInDirs = 0; -} // end resetImageDirectoryList +} // ImagePacker::resetImageList ================================================ /** Clear the image list */ @@ -610,7 +610,7 @@ void ImagePacker::resetImageList( void ) m_imageList = NULL; m_imageCount = 0; -} // end resetImageList +} // ImagePacker::addDirectory ================================================== /** Add the directory to the directory list, do not add it if it is already @@ -651,7 +651,7 @@ void ImagePacker::addDirectory( char *path, Bool subDirs ) MB_OK | MB_ICONERROR ); return; - } // end if + } // allocate space for the path Int len = strlen( path ); @@ -665,7 +665,7 @@ void ImagePacker::addDirectory( char *path, Bool subDirs ) delete dir; return; - } // end if + } // tie to list dir->m_prev = NULL; @@ -700,7 +700,7 @@ void ImagePacker::addDirectory( char *path, Bool subDirs ) (item.cFileName[ len - 1 ] == 'a' || item.cFileName[ len - 1 ] == 'A') ) dir->m_imageCount++; - } // end if + } // find the rest of the files while( FindNextFile( hFile, &item ) != 0 ) @@ -720,14 +720,14 @@ void ImagePacker::addDirectory( char *path, Bool subDirs ) (item.cFileName[ len - 1 ] == 'a' || item.cFileName[ len - 1 ] == 'A') ) dir->m_imageCount++; - } // end if + } - } // end while + } // close search FindClose( hFile ); - } //end if, items found + } // add the image count of this directory to the total image count m_imagesInDirs += dir->m_imageCount; @@ -751,7 +751,7 @@ void ImagePacker::addDirectory( char *path, Bool subDirs ) sprintf( subDir, "%s%s\\", path, item.cFileName ); addDirectory( subDir, subDirs ); - } // end if + } // find the rest of the files while( FindNextFile( hFile, &item ) != 0 ) @@ -766,21 +766,21 @@ void ImagePacker::addDirectory( char *path, Bool subDirs ) sprintf( subDir, "%s%s\\", path, item.cFileName ); addDirectory( subDir, subDirs ); - } // end if + } - } // end while + } // close search FindClose( hFile ); - } //end if, items found + } - } // end if + } // restore our current directory SetCurrentDirectory( currDir ); -} // end addDirectory +} // ImagePacker::addImage ====================================================== /** Add the image to the image list */ @@ -801,7 +801,7 @@ void ImagePacker::addImage( char *path ) MB_OK | MB_ICONERROR ); return; - } // end if + } // allocate space for the path Int len = strlen( path ); @@ -815,7 +815,7 @@ void ImagePacker::addImage( char *path ) delete info; return; - } // end if + } // load just the header information from the targa m_targa->Load( info->m_path, 0, TRUE ); @@ -838,7 +838,7 @@ void ImagePacker::addImage( char *path ) break; } - } // end for i + } Int nameLen = strlen( c ); info->m_filenameOnly = new char[ nameLen + 1 ]; @@ -856,7 +856,7 @@ void ImagePacker::addImage( char *path ) m_imageCount, m_imagesInDirs ); statusMessage( m_statusBuffer ); -} // end addImage +} // ImagePacker::generateINIFile =============================================== /** Generate the INI image file definition for the final packed images */ @@ -879,7 +879,7 @@ Bool ImagePacker::generateINIFile( void ) MessageBox( NULL, buffer, "Error Opening File", MB_OK | MB_ICONERROR ); return FALSE; - } // end if + } // print header for file fprintf( fp, "; ------------------------------------------------------------\n" ); @@ -926,16 +926,16 @@ Bool ImagePacker::generateINIFile( void ) "ROTATED_90_CLOCKWISE" : "NONE" ); fprintf( fp, "End\n\n" ); - } // end for image + } - } // end for page + } // close the file fclose( fp ); return TRUE; // success -} // end generateINIFile +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -975,12 +975,12 @@ Bool ImagePacker::getSettingsFromDialog( HWND dialog ) "Must Be Power Of 2", MB_OK | MB_ICONERROR ); return FALSE; - } // end if + } // set the size for the image packer setTargetSize( size, size ); - } // end if + } else if( IsDlgButtonChecked( dialog, RADIO_128X128 ) ) setTargetSize( 128, 128 ); else if( IsDlgButtonChecked( dialog, RADIO_256X256 ) ) @@ -994,7 +994,7 @@ Bool ImagePacker::getSettingsFromDialog( HWND dialog ) "Error", MB_OK | MB_ICONERROR ); return FALSE; - } // end else + } // get alpha option Bool outputAlpha = FALSE; @@ -1056,11 +1056,11 @@ Bool ImagePacker::getSettingsFromDialog( HWND dialog ) MessageBox( NULL, buffer, "Illegal Filename", MB_OK | MB_ICONERROR ); return FALSE; - } // end if + } - } // end for j + } - } // end for i + } // get the work on sub-folders option m_useSubFolders = IsDlgButtonChecked( dialog, CHECK_USE_SUB_FOLDERS ); @@ -1084,12 +1084,12 @@ Bool ImagePacker::getSettingsFromDialog( HWND dialog ) // add the directory addDirectory( buffer, m_useSubFolders ); - } // end for i + } // all done return TRUE; -} // end getSettingsFromDialog +} // ImagePacker::ImagePacker =================================================== /** */ @@ -1124,7 +1124,7 @@ ImagePacker::ImagePacker( void ) m_targa = NULL; m_compressTextures = FALSE; -} // end ImagePacker +} // ImagePacker::~ImagePacker ================================================== /** */ @@ -1141,7 +1141,7 @@ ImagePacker::~ImagePacker( void ) if( m_targa ) delete m_targa; -} // end ~ImagePacker +} // ImagePacker::init ========================================================== /** Initialize the image packer system */ @@ -1159,11 +1159,11 @@ Bool ImagePacker::init( void ) "Internal Error", MB_OK | MB_ICONERROR ); return FALSE; - } // end if + } return TRUE; -} // end init +} // ImagePacker::statusMessage ================================================= /** Status message for the program */ @@ -1173,7 +1173,7 @@ void ImagePacker::statusMessage( const char *message ) SetDlgItemText( getWindowHandle(), STATIC_STATUS, message ); -} // end statusMessage +} // ImagePacker::process ======================================================= /** Run the packing process */ @@ -1202,7 +1202,7 @@ Bool ImagePacker::process( void ) statusMessage( "Build Process Cancelled." ); return FALSE; - } // end if + } // reset the contents of our image list and existing textures resetImageList(); @@ -1241,9 +1241,9 @@ Bool ImagePacker::process( void ) m_pageCount, m_imageCount, m_dirCount ); statusMessage( m_statusBuffer ); - } // end if + } return TRUE; -} // end process +} diff --git a/Core/Tools/ImagePacker/Source/TexturePage.cpp b/Core/Tools/ImagePacker/Source/TexturePage.cpp index 837c2db7676..cee25e8341e 100644 --- a/Core/Tools/ImagePacker/Source/TexturePage.cpp +++ b/Core/Tools/ImagePacker/Source/TexturePage.cpp @@ -100,7 +100,7 @@ void TexturePage::extendToRowIfOpen( char *src, row = src + (buffWidth * buffBPP); - } // end if + } else if( srcY >= imageHeight / 2 && (srcY != imageHeight - 1 || BitIsSet( fitBits, ImageInfo::FIT_YBORDER_BOTTOM )) ) @@ -109,7 +109,7 @@ void TexturePage::extendToRowIfOpen( char *src, // try to extend pixel "down" if that pixel is "open" row = src - (buffWidth * buffBPP); - } // end else + } // // if a 'row' is available, try to extend the current pixel @@ -127,7 +127,7 @@ void TexturePage::extendToRowIfOpen( char *src, otherColor[ 1 ] = row[ 2 ]; otherColor[ 2 ] = row[ 3 ]; - } // end if + } else { @@ -135,7 +135,7 @@ void TexturePage::extendToRowIfOpen( char *src, otherColor[ 1 ] = row[ 1 ]; otherColor[ 2 ] = row[ 2 ]; - } // end else + } // // see if this pixel is "open", again we prefer to check the @@ -148,7 +148,7 @@ void TexturePage::extendToRowIfOpen( char *src, if( otherAlpha == 0 ) otherOpen = TRUE; - } // end if + } else { @@ -157,7 +157,7 @@ void TexturePage::extendToRowIfOpen( char *src, otherColor[ 2 ] == 0 ) otherOpen = TRUE; - } // end else + } // copy pixel data from 'src' to 'row' if 'row' is "open" if( otherOpen == TRUE ) @@ -174,7 +174,7 @@ void TexturePage::extendToRowIfOpen( char *src, color[ 1 ] = src[ 2 ]; color[ 2 ] = src[ 3 ]; - } // end if + } else { @@ -182,7 +182,7 @@ void TexturePage::extendToRowIfOpen( char *src, color[ 1 ] = src[ 1 ]; color[ 2 ] = src[ 2 ]; - } // end else + } // copy the pixel to 'row' if( buffBPP == 4 ) @@ -194,7 +194,7 @@ void TexturePage::extendToRowIfOpen( char *src, row[ 2 ] = color[ 1 ]; row[ 3 ] = color[ 2 ]; - } // end if + } else { @@ -202,13 +202,13 @@ void TexturePage::extendToRowIfOpen( char *src, row[ 1 ] = color[ 1 ]; row[ 2 ] = color[ 2 ]; - } // end else + } - } // end if, other spot is open, copy it + } - } // end if, row + } -} // end extendToRowIfOpen +} // TexturePage::extendImageEdges ============================================== /** We want to extend the image data in destBuffer at the location region @@ -244,14 +244,14 @@ void TexturePage::extendImageEdges( Byte *destBuffer, imageWidth = image->m_size.y; imageHeight = image->m_size.x; - } // end if + } else { imageWidth = image->m_size.x; imageHeight = image->m_size.y; - } // end else + } Int x, y; char *ptr; @@ -279,7 +279,7 @@ void TexturePage::extendImageEdges( Byte *destBuffer, color[ 1 ] = ptr[ 2 ]; color[ 2 ] = ptr[ 3 ]; - } // end if + } else { @@ -287,7 +287,7 @@ void TexturePage::extendImageEdges( Byte *destBuffer, color[ 1 ] = ptr[ 1 ]; color[ 2 ] = ptr[ 2 ]; - } // end else + } // // see wheter or not we have data at this pixel, if we have alpha @@ -301,7 +301,7 @@ void TexturePage::extendImageEdges( Byte *destBuffer, if( alpha != 0 ) currPixel = TRUE; - } // end if + } else { @@ -310,7 +310,7 @@ void TexturePage::extendImageEdges( Byte *destBuffer, color[ 2 ] != 0 ) currPixel = TRUE; - } // end else + } // // if we're at the right edge we will extend this pixel off the @@ -335,7 +335,7 @@ void TexturePage::extendImageEdges( Byte *destBuffer, *(ptr + 6) = color[ 1 ]; *(ptr + 7) = color[ 2 ]; - } // end if + } else { @@ -343,9 +343,9 @@ void TexturePage::extendImageEdges( Byte *destBuffer, *(ptr + 4) = color[ 1 ]; *(ptr + 5) = color[ 2 ]; - } // end else + } - } // end if + } // // if we have a pixel here, attempt to extend it to the above @@ -377,9 +377,9 @@ void TexturePage::extendImageEdges( Byte *destBuffer, *(ptr - 2) = color[ 1 ]; *(ptr - 1) = color[ 2 ]; - } // end if + } - } // end if + } else if( prevPixel == TRUE && currPixel == FALSE ) { @@ -405,7 +405,7 @@ void TexturePage::extendImageEdges( Byte *destBuffer, ptr[ 2 ] = *(ptr - 2); ptr[ 3 ] = *(ptr - 1); - } // end if + } else { @@ -413,9 +413,9 @@ void TexturePage::extendImageEdges( Byte *destBuffer, ptr[ 1 ] = *(ptr - 2); ptr[ 2 ] = *(ptr - 1); - } // end else + } - } // end else if + } // // one more time now for a special case in the corners of the extended @@ -465,7 +465,7 @@ void TexturePage::extendImageEdges( Byte *destBuffer, dst[ 2 ] = color[ 1 ]; dst[ 3 ] = color[ 2 ]; - } // end if + } else { @@ -473,11 +473,11 @@ void TexturePage::extendImageEdges( Byte *destBuffer, dst[ 1 ] = color[ 1 ]; dst[ 2 ] = color[ 2 ]; - } // end else + } - } // end if dst + } - } // end if + } // move to the next pixel ptr += destBPP; @@ -488,11 +488,11 @@ void TexturePage::extendImageEdges( Byte *destBuffer, // prevPixel = currPixel; - } // end for x + } - } // end for y + } -} // end extendImageEdges +} // TexturePage::addImageData ================================================== /** Add the actual image data from 'image' to the destination buffer @@ -528,7 +528,7 @@ Bool TexturePage::addImageData( Byte *destBuffer, MessageBox( NULL, buffer, "Cannot Load Source File", MB_OK | MB_ICONERROR ); return FALSE; - } // end if + } // get the source image buffer char *sourceBuffer = source.GetImage(); @@ -585,7 +585,7 @@ Bool TexturePage::addImageData( Byte *destBuffer, else dest[ 0 ] = (char)0xFF; // solid alpha - } // end if + } else { @@ -594,17 +594,17 @@ Bool TexturePage::addImageData( Byte *destBuffer, dest[ 1 ] = src[ 1 ]; dest[ 0 ] = src[ 2 ]; - } // end else + } // skip past all these pixels dest += destBPP; src += sourceBPP; - } // end for x + } - } // end for y + } - } // end if, not rotated + } else { @@ -643,7 +643,7 @@ Bool TexturePage::addImageData( Byte *destBuffer, else dest[ 0 ] = (char)0xFF; // solid alpha - } // end if + } else { @@ -652,17 +652,17 @@ Bool TexturePage::addImageData( Byte *destBuffer, dest[ 1 ] = src[ 1 ]; dest[ 0 ] = src[ 2 ]; - } // end else + } // skip past all these pixels dest += destBPP; src += sourceBPP; - } // end for x + } - } // end for y + } - } // end else + } // // if we have the option to extend the RGB edges on we now need to process @@ -680,7 +680,7 @@ Bool TexturePage::addImageData( Byte *destBuffer, return TRUE; // all done -} // end addImageData +} // TexturePage::spotUsed ====================================================== /** Is this spot in the texture page open? */ @@ -690,7 +690,7 @@ Bool TexturePage::spotUsed( Int x, Int y ) return m_canvas[ y * m_size.y + x ]; -} // end spotUsed +} // TexturePage::lineUsed ====================================================== /** Is there ANY spot in the line specified that is used */ @@ -711,11 +711,11 @@ Bool TexturePage::lineUsed( Int sx, Int sy, Int ex, Int ey ) if( *ptr == USED ) return USED; - } // end for y + } return FALSE; // it's open! -} // end lineUsed +} // TexturePage::markRegionUsed ================================================ /** Mark this region as used */ @@ -737,9 +737,9 @@ void TexturePage::markRegionUsed( IRegion2D *region ) count = (region->hi.x - region->lo.x) + 1; memset( ptr, USED, count ); - } // end for + } -} // end markRegionUsed +} // TexturePage::buildFitRegion ================================================ /** Build an image region to try to fit into the page based on the location @@ -775,7 +775,7 @@ UnsignedInt TexturePage::buildFitRegion( IRegion2D *region, xBorder = 2; yBorder = 2; - } // end if + } // // when the image size exactly matches the target size of the texture @@ -788,14 +788,14 @@ UnsignedInt TexturePage::buildFitRegion( IRegion2D *region, *xGutter = 0; xBorder = 0; - } // end if + } if( imageHeight == m_size.y ) { *yGutter = 0; yBorder = 0; - } // end if + } // // when an image is 1 pixel smaller than the destination texture @@ -839,7 +839,7 @@ UnsignedInt TexturePage::buildFitRegion( IRegion2D *region, return fitBits; -} // end buildFitRegion +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -866,7 +866,7 @@ TexturePage::TexturePage( Int width, Int height ) DEBUG_ASSERTCRASH( m_canvas, ("Cannot allocate canvas for texture page") ); memset( m_canvas, FREE, sizeof( UnsignedByte ) * canvasSize ); -} // end TexturePage +} // TexturePage::~TexturePage ================================================== /** */ @@ -886,7 +886,7 @@ TexturePage::~TexturePage( void ) if( m_packedImage ) delete [] m_packedImage; -} // end ~TexturePage +} // TexturePage::addImage ====================================================== /** If this image will fit on this page, add it */ @@ -902,7 +902,7 @@ Bool TexturePage::addImage( ImageInfo *image ) DEBUG_ASSERTCRASH( image, ("TexturePage::addImage: NULL image!") ); return TRUE; // say it was added - } // end if + } // get our options for fitting Bool useGutter, useRGBExtend; @@ -945,14 +945,14 @@ Bool TexturePage::addImage( ImageInfo *image ) xGutter = TheImagePacker->getGutter(); yGutter = TheImagePacker->getGutter(); - } // end if + } else { xGutter = 0; yGutter = 0; - } // end else + } // // compute the region of the image at this location, the region that will @@ -969,7 +969,7 @@ Bool TexturePage::addImage( ImageInfo *image ) imageWidth = image->m_size.x; imageHeight = image->m_size.y; - } // end if + } else { @@ -994,7 +994,7 @@ Bool TexturePage::addImage( ImageInfo *image ) imageWidth = image->m_size.y; imageHeight = image->m_size.x; - } // end else + } // build the region fitBits = buildFitRegion( ®ion, x, y, @@ -1028,7 +1028,7 @@ Bool TexturePage::addImage( ImageInfo *image ) useRGBExtend ); - } // end if + } if( region.hi.y >= m_size.y ) { @@ -1045,7 +1045,7 @@ Bool TexturePage::addImage( ImageInfo *image ) &xGutter, &yGutter, useRGBExtend ); - } // end if + } // reject this location if the hi region goes off the texture page if( region.hi.y >= m_size.y ) @@ -1054,14 +1054,14 @@ Bool TexturePage::addImage( ImageInfo *image ) y = m_size.y; // skip to end, this isn't gonna work continue; - } // end if + } if( region.hi.x >= m_size.x ) { x = m_size.x; // skip to end of row to try next row continue; - } // end if + } // // reject this location if any of the corners are in used spots, @@ -1081,7 +1081,7 @@ Bool TexturePage::addImage( ImageInfo *image ) x = region.hi.x; // next anchor spot will be to the right of here continue; - } // end if + } // upper left and lower left if( spotUsed( region.lo.x, region.lo.y ) || // upper left @@ -1158,16 +1158,16 @@ Bool TexturePage::addImage( ImageInfo *image ) return TRUE; // success - } // end for x + } - } // end for y + } - } // end while, triesLeft + } // no space return FALSE; -} // end addImage +} // TexturePage::generateTexture =============================================== /** Generate the final packed texture given all the images that have @@ -1195,7 +1195,7 @@ Bool TexturePage::generateTexture( void ) MessageBox( NULL, buffer, "Internal Error", MB_OK | MB_ICONERROR ); return FALSE; - } // end if + } Bool outputAlpha = TheImagePacker->getOutputAlpha(); Int depth, bpp; @@ -1226,7 +1226,7 @@ Bool TexturePage::generateTexture( void ) BitSet( m_status, CANT_ALLOCATE_PACKED_IMAGE ); return FALSE; - } // end if + } // zero the packed image to all zero memset( m_packedImage, 0, sizeof( Byte ) * bufferSize ); @@ -1250,16 +1250,16 @@ Bool TexturePage::generateTexture( void ) BitSet( m_status, CANT_ADD_IMAGE_DATA ); return FALSE; - } // end if + } - } // end for image + } // set this data into the targa structure m_targa->SetImage( m_packedImage ); return TRUE; // success -} // end generateTexture +} // TexturePage::writeFile ===================================================== /** Write the texture data that has already been generated to a file @@ -1277,7 +1277,7 @@ Bool TexturePage::writeFile( char *baseFilename ) BitSet( m_status, NO_TEXTURE_DATA ); return FALSE; - } // end if + } // construct filename char filePath[ _MAX_PATH ]; @@ -1298,12 +1298,12 @@ Bool TexturePage::writeFile( char *baseFilename ) BitSet( m_status, PAGE_ERROR ); BitSet( m_status, ERROR_DURING_SAVE ); - } // end if + } // return success or not return !error; -} // end writeFile +} // TexturePage::getPixel ====================================================== /** Get the RGB pixel stored at location (x,y) (where (0,0) is the upper @@ -1336,7 +1336,7 @@ void TexturePage::getPixel( Int x, Int y, Byte *r, Byte *g, Byte *b, Byte *a ) *g = buf[ 2 ]; *b = buf[ 3 ]; - } // end if + } else { @@ -1347,6 +1347,6 @@ void TexturePage::getPixel( Int x, Int y, Byte *r, Byte *g, Byte *b, Byte *a ) *g = buf[ 1 ]; *b = buf[ 2 ]; - } // end else + } -} // end getPixel +} diff --git a/Core/Tools/ImagePacker/Source/WinMain.cpp b/Core/Tools/ImagePacker/Source/WinMain.cpp index bd116f022bd..e31f28f4573 100644 --- a/Core/Tools/ImagePacker/Source/WinMain.cpp +++ b/Core/Tools/ImagePacker/Source/WinMain.cpp @@ -103,7 +103,7 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, TheImagePacker = NULL; return 0; - } // end if + } // load the dialog box DialogBox( hInstance, (LPCTSTR)IMAGE_PACKER_DIALOG, @@ -118,4 +118,4 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, // all done return 0; -} // end WinMain +} diff --git a/Core/Tools/ImagePacker/Source/WindowProcedures/DirectorySelect.cpp b/Core/Tools/ImagePacker/Source/WindowProcedures/DirectorySelect.cpp index 391917057fb..3d944516e31 100644 --- a/Core/Tools/ImagePacker/Source/WindowProcedures/DirectorySelect.cpp +++ b/Core/Tools/ImagePacker/Source/WindowProcedures/DirectorySelect.cpp @@ -90,7 +90,7 @@ static void selectDrive( HWND dialog ) if( index != CB_ERR ) SendDlgItemMessage( dialog, COMBO_DRIVE, CB_SETCURSEL, index, 0 ); -} // end selectDrive +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -141,7 +141,7 @@ BOOL CALLBACK DirectorySelectProc( HWND hWndDialog, UINT message, return TRUE; - } // end init + } // ------------------------------------------------------------------------ case WM_COMMAND: @@ -203,22 +203,22 @@ BOOL CALLBACK DirectorySelectProc( HWND hWndDialog, UINT message, MB_OK | MB_ICONINFORMATION ); continue; - } // end if + } // add path to the listbox SendDlgItemMessage( TheImagePacker->getWindowHandle(), LIST_FOLDERS, LB_INSERTSTRING, -1, (LPARAM)toAdd ); - } // end if + } - } // end if + } SetCurrentDirectory( startDir ); EndDialog( hWndDialog, TRUE ); break; - } // end proceed + } // -------------------------------------------------------------------- case BUTTON_CANCEL: @@ -228,7 +228,7 @@ BOOL CALLBACK DirectorySelectProc( HWND hWndDialog, UINT message, EndDialog( hWndDialog, FALSE ); break; - } // end cancel + } // -------------------------------------------------------------------- case COMBO_DRIVE: @@ -275,13 +275,13 @@ BOOL CALLBACK DirectorySelectProc( HWND hWndDialog, UINT message, (LPARAM)"*.*" ); - } // end if + } - } // end if + } break; - } // end drive + } // -------------------------------------------------------------------- case LIST_DIR: @@ -318,16 +318,16 @@ BOOL CALLBACK DirectorySelectProc( HWND hWndDialog, UINT message, if( strcmp( text, "[..]" ) == 0 ) enable = FALSE; - } // end if + } - } // end if + } else enable = FALSE; // do the enable EnableWindow( GetDlgItem( hWndDialog, BUTTON_ADD ), enable ); - } // end if + } if( notifyCode == LBN_DBLCLK ) { Int selected; @@ -365,23 +365,23 @@ BOOL CALLBACK DirectorySelectProc( HWND hWndDialog, UINT message, DDL_DIRECTORY | DDL_EXCLUSIVE, (LPARAM)"*.*" ); - } // end if + } break; - } // end list command + } - } // end switch + } break; - } // end command + } - } // end switch message + } return 0; -} // end DirectorySelectProc +} diff --git a/Core/Tools/ImagePacker/Source/WindowProcedures/ImageErrorProc.cpp b/Core/Tools/ImagePacker/Source/WindowProcedures/ImageErrorProc.cpp index 90e50ef226c..20b29b3f7cd 100644 --- a/Core/Tools/ImagePacker/Source/WindowProcedures/ImageErrorProc.cpp +++ b/Core/Tools/ImagePacker/Source/WindowProcedures/ImageErrorProc.cpp @@ -121,16 +121,16 @@ BOOL CALLBACK ImageErrorProc( HWND hWndDialog, UINT message, SendMessage( list, LB_INSERTSTRING, -1, (LPARAM)buffer ); - } // end if + } - } // end for i + } // set the extents for the horizontal scroll bar in the listbox SendMessage( list, LB_SETHORIZONTALEXTENT, 1280, 0 ); return TRUE; - } // end init + } // ------------------------------------------------------------------------ case WM_COMMAND: @@ -149,7 +149,7 @@ BOOL CALLBACK ImageErrorProc( HWND hWndDialog, UINT message, EndDialog( hWndDialog, TRUE ); break; - } // end proceed + } // -------------------------------------------------------------------- case BUTTON_CANCEL: @@ -158,18 +158,18 @@ BOOL CALLBACK ImageErrorProc( HWND hWndDialog, UINT message, EndDialog( hWndDialog, FALSE ); break; - } // end cancel + } - } // end switch + } break; - } // end command + } - } // end switch message + } return 0; -} // end ImageErrorProc +} diff --git a/Core/Tools/ImagePacker/Source/WindowProcedures/ImagePackerProc.cpp b/Core/Tools/ImagePacker/Source/WindowProcedures/ImagePackerProc.cpp index c1e6bab14c5..d89cfe244c3 100644 --- a/Core/Tools/ImagePacker/Source/WindowProcedures/ImagePackerProc.cpp +++ b/Core/Tools/ImagePacker/Source/WindowProcedures/ImagePackerProc.cpp @@ -85,7 +85,7 @@ BOOL CALLBACK ImagePackerProc( HWND hWndDialog, UINT message, "Internal Error", MB_OK ); EndDialog( hWndDialog, FALSE ); - } // end if + } // save our window handlw TheImagePacker->setWindowHandle( hWndDialog ); @@ -154,7 +154,7 @@ BOOL CALLBACK ImagePackerProc( HWND hWndDialog, UINT message, return TRUE; - } // end init dialog + } // ------------------------------------------------------------------------ case WM_COMMAND: @@ -179,11 +179,11 @@ BOOL CALLBACK ImagePackerProc( HWND hWndDialog, UINT message, TheImagePacker->setTargetPreviewPage( page ); UpdatePreviewWindow(); - } // end if + } break; - } // end previous + } // -------------------------------------------------------------------- case BUTTON_NEXT: @@ -197,11 +197,11 @@ BOOL CALLBACK ImagePackerProc( HWND hWndDialog, UINT message, TheImagePacker->setTargetPreviewPage( page ); UpdatePreviewWindow(); - } // end if + } break; - } // end next + } // -------------------------------------------------------------------- case CHECK_BITMAP_PREVIEW: @@ -218,7 +218,7 @@ BOOL CALLBACK ImagePackerProc( HWND hWndDialog, UINT message, break; - } // end preview using image + } // -------------------------------------------------------------------- case CHECK_GAP_GUTTER: @@ -233,7 +233,7 @@ BOOL CALLBACK ImagePackerProc( HWND hWndDialog, UINT message, break; - } // end transparent gutter + } // -------------------------------------------------------------------- case BUTTON_PREVIEW: @@ -248,7 +248,7 @@ BOOL CALLBACK ImagePackerProc( HWND hWndDialog, UINT message, TheImagePacker->setPreviewWindow( NULL ); SetDlgItemText( hWndDialog, BUTTON_PREVIEW, "Open Preview" ); - } // end if + } else { HWND preview = MakePreviewDisplay(); @@ -260,13 +260,13 @@ BOOL CALLBACK ImagePackerProc( HWND hWndDialog, UINT message, UpdatePreviewWindow(); SetDlgItemText( hWndDialog, BUTTON_PREVIEW, "Close Preview" ); - } // end if + } - } // end else + } break; - } // end test + } // -------------------------------------------------------------------- case BUTTON_ADD_FOLDER: @@ -279,7 +279,7 @@ BOOL CALLBACK ImagePackerProc( HWND hWndDialog, UINT message, (DLGPROC)DirectorySelectProc ); break; - } // end add folder + } // -------------------------------------------------------------------- case BUTTON_REMOVE_FOLDER: @@ -301,7 +301,7 @@ BOOL CALLBACK ImagePackerProc( HWND hWndDialog, UINT message, "Select Folder First", MB_OK | MB_ICONINFORMATION ); break; - } // end if + } // // start at the end of the listbox, delete any items that @@ -314,7 +314,7 @@ BOOL CALLBACK ImagePackerProc( HWND hWndDialog, UINT message, break; - } // end remove folder + } // -------------------------------------------------------------------- case RADIO_128X128: @@ -334,7 +334,7 @@ BOOL CALLBACK ImagePackerProc( HWND hWndDialog, UINT message, break; - } // end target image size radio buttons + } // -------------------------------------------------------------------- case EDIT_WIDTH: @@ -358,13 +358,13 @@ BOOL CALLBACK ImagePackerProc( HWND hWndDialog, UINT message, break; - } // end update + } - } // end switch + } break; - } // end user defined width + } // -------------------------------------------------------------------- case BUTTON_START: @@ -380,7 +380,7 @@ BOOL CALLBACK ImagePackerProc( HWND hWndDialog, UINT message, break; - } // end execute + } // -------------------------------------------------------------------- case BUTTON_EXIT: @@ -390,18 +390,18 @@ BOOL CALLBACK ImagePackerProc( HWND hWndDialog, UINT message, EndDialog( hWndDialog, TRUE ); break; - } // end exit + } - } // end switch + } return 0; - } // end command + } - } // end switch + } return 0; -} // end ImagePackerProc +} diff --git a/Core/Tools/ImagePacker/Source/WindowProcedures/PageErrorProc.cpp b/Core/Tools/ImagePacker/Source/WindowProcedures/PageErrorProc.cpp index f01b886dfa0..bb937c31405 100644 --- a/Core/Tools/ImagePacker/Source/WindowProcedures/PageErrorProc.cpp +++ b/Core/Tools/ImagePacker/Source/WindowProcedures/PageErrorProc.cpp @@ -118,16 +118,16 @@ BOOL CALLBACK PageErrorProc( HWND hWndDialog, UINT message, SendMessage( list, LB_INSERTSTRING, -1, (LPARAM)buffer ); - } // end if + } - } // end for i + } // set the extents for the horizontal scroll bar in the listbox SendMessage( list, LB_SETHORIZONTALEXTENT, 1280, 0 ); return TRUE; - } // end init + } // ------------------------------------------------------------------------ case WM_COMMAND: @@ -146,18 +146,18 @@ BOOL CALLBACK PageErrorProc( HWND hWndDialog, UINT message, EndDialog( hWndDialog, TRUE ); break; - } // end proceed + } - } // end switch + } break; - } // end command + } - } // end switch message + } return 0; -} // end PageErrorProc +} diff --git a/Core/Tools/ImagePacker/Source/WindowProcedures/PreviewProc.cpp b/Core/Tools/ImagePacker/Source/WindowProcedures/PreviewProc.cpp index 804af6c0fcf..dceb76b635b 100644 --- a/Core/Tools/ImagePacker/Source/WindowProcedures/PreviewProc.cpp +++ b/Core/Tools/ImagePacker/Source/WindowProcedures/PreviewProc.cpp @@ -127,11 +127,11 @@ LRESULT CALLBACK PreviewProc( HWND hWnd, UINT message, // delete the created pen DeleteObject( pen ); - } // end for x + } - } // end for y + } - } // end if + } else { @@ -149,22 +149,22 @@ LRESULT CALLBACK PreviewProc( HWND hWnd, UINT message, rect.bottom = image->m_pagePos.hi.y + 1; // FillRect not inclusive FillRect( hdc, &rect, whiteBrush ); - } // end for image + } - } // end else + } - } // end for page + } EndPaint( hWnd, &ps ); break; - } // end paint + } - } // end switch + } return DefWindowProc( hWnd, message, wParam, lParam ); -} // end PreviewProc +} // MakePreviewDisplay ========================================================= /** */ @@ -213,7 +213,7 @@ HWND MakePreviewDisplay( void ) return hWnd; -} // end MakePreviewDisplay +} // UpdatePreviewWindow ======================================================== /** Update the preview window, if present */ @@ -264,4 +264,4 @@ void UpdatePreviewWindow( void ) // invalidate the client area for redraw InvalidateRect( preview, NULL, TRUE ); -} // end UpdatePreviewWindow +} diff --git a/Core/Tools/Launcher/findpatch.cpp b/Core/Tools/Launcher/findpatch.cpp index f1556c2fb6d..01715600afd 100644 --- a/Core/Tools/Launcher/findpatch.cpp +++ b/Core/Tools/Launcher/findpatch.cpp @@ -206,8 +206,8 @@ void Delete_Patches(ConfigFile &config) DBGMSG("UNLINK: "<= 0) && (is_default(Get_Bit(End)))) { End--; } -} // compute_range +} // @@ -258,12 +258,12 @@ uint32 BitChannelClass::find_useless_packet(W3dTimeCodedBitChannelStruct * c) return(try_idx + 1); } - } // for + } } return( PACKETS_ALL_USEFUL ); -} // find_useless_packet +} // @@ -293,7 +293,7 @@ void BitChannelClass::remove_packet(W3dTimeCodedBitChannelStruct * c, uint32 pac // Decrement Packet Count c->NumTimeCodes--; -} // remove_packet +} // // Take a non-compressed TimeCoded Bit Channel @@ -311,7 +311,7 @@ void BitChannelClass::compress(W3dTimeCodedBitChannelStruct * c) } -} // compress +} diff --git a/Core/Tools/WW3D/max2w3d/logdlg.cpp b/Core/Tools/WW3D/max2w3d/logdlg.cpp index 8ff8cc37625..aa693b8223f 100644 --- a/Core/Tools/WW3D/max2w3d/logdlg.cpp +++ b/Core/Tools/WW3D/max2w3d/logdlg.cpp @@ -104,7 +104,7 @@ void LogDataDialogClass::printf(const char *text, ...) { va_list arguments; va_start(arguments, text); -} // printf +} void LogDataDialogClass::printf(const char * text, va_list args) { @@ -169,7 +169,7 @@ void LogDataDialogClass::rprintf(const char *text, va_list args) //SendMessage(GetDlgItem(Hwnd,IDC_ANIM_LOG_RICHEDIT), EM_SCROLLCARET, 0, 0); -} // rprintf +} /*********************************************************************************************** @@ -194,7 +194,7 @@ void LogDataDialogClass::updatebar(float position, float total) SendMessage(ctrlHwnd, PBM_SETPOS, pos, 0 ); -} // updatebar +} /*********************************************************************************************** @@ -218,7 +218,7 @@ void LogDataDialogClass::Wait_OK() // wait for the OK } -} // Wait_OK +} @@ -296,7 +296,7 @@ bool LogDataDialogClass::Dialog_Proc } return FALSE; -} // Dialog_Proc +} void LogDataDialogClass::Dialog_Init() { @@ -325,7 +325,7 @@ void LogDataDialogClass::Dialog_Init() status = 1; // signal init -} // Dialog_Init +} @@ -367,7 +367,7 @@ BOOL CALLBACK _logdata_dialog_proc return FALSE; } -} // _logdata_dialog_proc +} DWORD WINAPI _logdata_thread_function(LPVOID log_obj_ptr) diff --git a/Core/Tools/WW3D/max2w3d/motion.cpp b/Core/Tools/WW3D/max2w3d/motion.cpp index 78898401181..99f3cd28fc9 100644 --- a/Core/Tools/WW3D/max2w3d/motion.cpp +++ b/Core/Tools/WW3D/max2w3d/motion.cpp @@ -496,7 +496,7 @@ void MotionClass::compute_frame_motion(int frame) set_binary_movement(bindex, frame, binary_move); - } // if(bindex!=-1) + } } /* diff --git a/Core/Tools/WW3D/max2w3d/vchannel.cpp b/Core/Tools/WW3D/max2w3d/vchannel.cpp index f5853db4061..8392aaded4c 100644 --- a/Core/Tools/WW3D/max2w3d/vchannel.cpp +++ b/Core/Tools/WW3D/max2w3d/vchannel.cpp @@ -250,7 +250,7 @@ bool VectorChannelClass::SaveTimeCoded(ChunkSaveClass & csave, BitChannelClass * return true; -} // SaveTimeCoded +} /* @@ -349,7 +349,7 @@ float VectorChannelClass::test_compress(int filter_index, float scale, float val return( sqrt(error) ); -} // test_compress +} // // compress Adaptive Delta packet @@ -425,7 +425,7 @@ float VectorChannelClass::compress(int filter_index, float scale, float value1, return( error ); -} // compress +} bool VectorChannelClass::SaveAdaptiveDelta(ChunkSaveClass & csave, BitChannelClass *binmov) @@ -504,7 +504,7 @@ bool VectorChannelClass::SaveAdaptiveDelta(ChunkSaveClass & csave, BitChannelCla temp_frame++; - } // for gi + } // Brute Force Filter @@ -541,9 +541,9 @@ bool VectorChannelClass::SaveAdaptiveDelta(ChunkSaveClass & csave, BitChannelCla // update work[vi]; work[vi] = decompressed_packet[15]; - } // for vi + } frame+=16; - } // for numpackets + } // print how big we are vs non-compressed @@ -573,7 +573,7 @@ bool VectorChannelClass::SaveAdaptiveDelta(ChunkSaveClass & csave, BitChannelCla return true; -} // SaveAdaptiveDelta +} bool VectorChannelClass::Save(ChunkSaveClass & csave, BitChannelClass *binmov) @@ -675,7 +675,7 @@ void VectorChannelClass::SetSaveOptions(bool compress, int flavor, float Terr, f CompressAnimationTranslationError = Terr; CompressAnimationRotationError = DEG_TO_RAD(Rerr); -} // SetSaveOptions +} // // Set data in motion channel to identity vector @@ -706,7 +706,7 @@ void VectorChannelClass::ClearInvisibleData(BitChannelClass *vis) Set_Vector( idx, tvec ); } } -} // ClearInvisibleData +} void VectorChannelClass::set_value(int framenum,int vindex,float32 val) @@ -757,7 +757,7 @@ void VectorChannelClass::compute_range(void) while ((End >= 0) && (is_identity(Get_Vector(End)))) { End--; } -} // compute_range +} // @@ -787,7 +787,7 @@ void VectorChannelClass::remove_packet(W3dTimeCodedAnimChannelStruct * c, uint32 // Decrement Packet Count c->NumTimeCodes--; -} // remove_packet +} // // Take a non-compressed TimeCoded Motion Channel @@ -923,11 +923,11 @@ void VectorChannelClass::compress(W3dTimeCodedAnimChannelStruct * c) assert(0); break; } - } // if ReducePercent + } - } // if Reduce + } -} // compress +} @@ -1022,7 +1022,7 @@ static float32 tempvec[MAX_VECTOR_SIZE]; // else continue - } // for + } } else { @@ -1058,7 +1058,7 @@ static float32 tempvec[MAX_VECTOR_SIZE]; return( PACKETS_ALL_USEFUL ); -} // find_useless_packet +} // @@ -1137,7 +1137,7 @@ uint32 VectorChannelClass::find_useless_packetQ(W3dTimeCodedAnimChannelStruct * // else continue - } // for + } } @@ -1171,7 +1171,7 @@ uint32 VectorChannelClass::find_useless_packetQ(W3dTimeCodedAnimChannelStruct * return( PACKETS_ALL_USEFUL ); -} // find_useless_packetQ +} // @@ -1268,7 +1268,7 @@ static float32 tempvec[MAX_VECTOR_SIZE]; // else continue - } // for + } return( ret_idx ); @@ -1285,7 +1285,7 @@ static float32 tempvec[MAX_VECTOR_SIZE]; return( PACKETS_ALL_USEFUL ); -} // Find Least useful packet +} // @@ -1370,7 +1370,7 @@ uint32 VectorChannelClass::find_least_useful_packetQ(W3dTimeCodedAnimChannelStru // else continue - } // for + } return( ret_idx ); @@ -1390,7 +1390,7 @@ uint32 VectorChannelClass::find_least_useful_packetQ(W3dTimeCodedAnimChannelStru return( PACKETS_ALL_USEFUL ); -} // find_least_useful_packetQ +} // EOF - vchannel.cpp diff --git a/Core/Tools/WW3D/max2w3d/vxl.cpp b/Core/Tools/WW3D/max2w3d/vxl.cpp index 203be02d055..969095a7b2d 100644 --- a/Core/Tools/WW3D/max2w3d/vxl.cpp +++ b/Core/Tools/WW3D/max2w3d/vxl.cpp @@ -416,7 +416,7 @@ void VoxelClass::Compute_Visiblity meter.Add_Increment(); if (meter.Cancelled()) throw ErrorClass("Export Cancelled"); - } // done with the X-Y layers + } ///////////////////////////////////////////////////////////// @@ -443,7 +443,7 @@ void VoxelClass::Compute_Visiblity meter.Add_Increment(); if (meter.Cancelled()) throw ErrorClass("Export Cancelled"); - } // done with the X-Z layers + } /////////////////////////////////////////////////////////// diff --git a/Core/Tools/buildVersionUpdate/buildVersionUpdate.cpp b/Core/Tools/buildVersionUpdate/buildVersionUpdate.cpp index d4105726d24..18de6bd75b7 100644 --- a/Core/Tools/buildVersionUpdate/buildVersionUpdate.cpp +++ b/Core/Tools/buildVersionUpdate/buildVersionUpdate.cpp @@ -141,9 +141,9 @@ int APIENTRY WinMain(HINSTANCE hInstance, { printf ("Build 0. Oops, didn't find a string of the format: '#define VERSION \"x.y.z\"'"); } - } // End if if (strstr - } // End of while - } // End of if filePtr + } + } + } else { // Didn't find the file, write a new one diff --git a/Core/Tools/matchbot/generals.cpp b/Core/Tools/matchbot/generals.cpp index 4b9af37dd30..8c6837a8790 100644 --- a/Core/Tools/matchbot/generals.cpp +++ b/Core/Tools/matchbot/generals.cpp @@ -737,7 +737,7 @@ void GeneralsMatcher::checkMatchesInUserMap(UserMap& userMap, int ladderID, int } } } - } // for i2 + } if (bestUser && numPlayers == 2) { @@ -752,7 +752,7 @@ void GeneralsMatcher::checkMatchesInUserMap(UserMap& userMap, int ladderID, int u1, bestUser, NULL, NULL, NULL, NULL, NULL, NULL, 2, ladderID); break; } - } // for i1 + } dumpUsers(); } diff --git a/Core/Tools/versionUpdate/versionUpdate.cpp b/Core/Tools/versionUpdate/versionUpdate.cpp index 23c505ab6fc..e8c1a90929b 100644 --- a/Core/Tools/versionUpdate/versionUpdate.cpp +++ b/Core/Tools/versionUpdate/versionUpdate.cpp @@ -152,9 +152,9 @@ int APIENTRY WinMain(HINSTANCE hInstance, { printf ("Local build is 0. Oops, didn't find a string of the format: '#define VERSION \"x.y.z\"'"); } - } // End if if (strstr - } // End of while - } // End of if filePtr + } + } + } else { // Didn't find the file, write a new one diff --git a/Dependencies/Utility/Utility/compat.h b/Dependencies/Utility/Utility/compat.h index 7af2c302c24..32d00018aaa 100644 --- a/Dependencies/Utility/Utility/compat.h +++ b/Dependencies/Utility/Utility/compat.h @@ -71,4 +71,5 @@ #include "time_compat.h" #include "thread_compat.h" -#endif \ No newline at end of file +#endif + diff --git a/Dependencies/Utility/Utility/endian_compat.h b/Dependencies/Utility/Utility/endian_compat.h index 56b35c33bef..04ea2baa42e 100644 --- a/Dependencies/Utility/Utility/endian_compat.h +++ b/Dependencies/Utility/Utility/endian_compat.h @@ -243,4 +243,5 @@ template inline void letoh_ref(Type &value) { value = Endian::let #endif // _MSC_VER < 1300 -#endif // ENDIAN_COMPAT_H \ No newline at end of file +#endif // ENDIAN_COMPAT_H + diff --git a/Dependencies/Utility/Utility/intrin_compat.h b/Dependencies/Utility/Utility/intrin_compat.h index c02913e4325..efea3e62c78 100644 --- a/Dependencies/Utility/Utility/intrin_compat.h +++ b/Dependencies/Utility/Utility/intrin_compat.h @@ -103,7 +103,7 @@ static inline uint64_t _rdtsc() #endif } #endif // _rdtsc - + #ifdef _WIN32 #include #pragma intrinsic(_ReturnAddress) @@ -120,7 +120,7 @@ static inline uint64_t _rdtsc() #error "No implementation for _ReturnAddress" #endif -#if defined(__has_builtin) +#if defined(__has_builtin) #if __has_builtin(__builtin_debugtrap) #define __debugbreak() __builtin_debugtrap() #elif __has_builtin(__builtin_trap) diff --git a/Dependencies/Utility/Utility/mem_compat.h b/Dependencies/Utility/Utility/mem_compat.h index 189e1d058f9..42a5e8f0bfb 100644 --- a/Dependencies/Utility/Utility/mem_compat.h +++ b/Dependencies/Utility/Utility/mem_compat.h @@ -20,4 +20,5 @@ #pragma once #include -#define _alloca alloca \ No newline at end of file +#define _alloca alloca + diff --git a/Dependencies/Utility/Utility/stdint_adapter.h b/Dependencies/Utility/Utility/stdint_adapter.h index b73de836038..241b7cdb653 100644 --- a/Dependencies/Utility/Utility/stdint_adapter.h +++ b/Dependencies/Utility/Utility/stdint_adapter.h @@ -26,7 +26,7 @@ #else typedef int intptr_t; typedef unsigned int uintptr_t; -#endif +#endif /* 7.18.1.1 Exact-width integer types */ typedef signed char int8_t; diff --git a/Dependencies/Utility/Utility/string_compat.h b/Dependencies/Utility/Utility/string_compat.h index 0e26f3267ea..ff88aaa7a43 100644 --- a/Dependencies/Utility/Utility/string_compat.h +++ b/Dependencies/Utility/Utility/string_compat.h @@ -34,4 +34,5 @@ inline char *_strlwr(char *str) { #define strlwr _strlwr #define stricmp strcasecmp #define strnicmp strncasecmp -#define strcmpi strcasecmp \ No newline at end of file +#define strcmpi strcasecmp + diff --git a/Dependencies/Utility/Utility/tchar_compat.h b/Dependencies/Utility/Utility/tchar_compat.h index f5a470fbef7..69c85124095 100644 --- a/Dependencies/Utility/Utility/tchar_compat.h +++ b/Dependencies/Utility/Utility/tchar_compat.h @@ -27,4 +27,5 @@ typedef TCHAR* LPTSTR; #define _tcscmp strcmp #define _tcsicmp strcasecmp #define _tcsclen strlen -#define _tcscpy strcpy \ No newline at end of file +#define _tcscpy strcpy + diff --git a/Dependencies/Utility/Utility/thread_compat.h b/Dependencies/Utility/Utility/thread_compat.h index 9345944e7f7..bd13a42f5ab 100644 --- a/Dependencies/Utility/Utility/thread_compat.h +++ b/Dependencies/Utility/Utility/thread_compat.h @@ -29,4 +29,5 @@ inline int GetCurrentThreadId() inline void Sleep(int ms) { usleep(ms * 1000); -} \ No newline at end of file +} + diff --git a/Dependencies/Utility/Utility/time_compat.h b/Dependencies/Utility/Utility/time_compat.h index 1dd9582079a..82449ee9aef 100644 --- a/Dependencies/Utility/Utility/time_compat.h +++ b/Dependencies/Utility/Utility/time_compat.h @@ -37,4 +37,5 @@ inline unsigned int GetTickCount() clock_gettime(CLOCK_MONOTONIC, &ts); // Return ms since boot return ts.tv_sec * 1000 + ts.tv_nsec / 1000000; -} \ No newline at end of file +} + diff --git a/Dependencies/Utility/Utility/wchar_compat.h b/Dependencies/Utility/Utility/wchar_compat.h index e43fa7a7033..a6761905a71 100644 --- a/Dependencies/Utility/Utility/wchar_compat.h +++ b/Dependencies/Utility/Utility/wchar_compat.h @@ -30,4 +30,5 @@ typedef WCHAR* LPWSTR; // MultiByteToWideChar #define CP_ACP 0 #define MultiByteToWideChar(cp, flags, mbstr, cb, wcstr, cch) mbstowcs(wcstr, mbstr, cch) -#define WideCharToMultiByte(cp, flags, wcstr, cch, mbstr, cb, defchar, used) wcstombs(mbstr, wcstr, cb) \ No newline at end of file +#define WideCharToMultiByte(cp, flags, wcstr, cch, mbstr, cb, defchar, used) wcstombs(mbstr, wcstr, cb) + diff --git a/Generals/Code/GameEngine/Include/Common/BitFlagsIO.h b/Generals/Code/GameEngine/Include/Common/BitFlagsIO.h index f372afb7fd6..e010df5b617 100644 --- a/Generals/Code/GameEngine/Include/Common/BitFlagsIO.h +++ b/Generals/Code/GameEngine/Include/Common/BitFlagsIO.h @@ -182,9 +182,9 @@ void BitFlags::xfer(Xfer* xfer) AsciiString bitNameA = bitName; xfer->xferAsciiString( &bitNameA ); - } // end for i + } - } // end if, save + } else if( xfer->getXferMode() == XFER_LOAD ) { // clear the kind of mask data @@ -210,24 +210,24 @@ void BitFlags::xfer(Xfer* xfer) throw XFER_READ_ERROR; } - } // end for, i + } - } // end else if, load + } else if( xfer->getXferMode() == XFER_CRC ) { // just call the xfer implementation on the data values xfer->xferUser( this, sizeof( this ) ); - } // end else if, crc + } else { DEBUG_CRASH(( "BitFlagsXfer - Unknown xfer mode '%d'", xfer->getXferMode() )); throw XFER_MODE_UNKNOWN; - } // end else + } -} // end xfer +} #endif diff --git a/Generals/Code/GameEngine/Include/Common/BuildAssistant.h b/Generals/Code/GameEngine/Include/Common/BuildAssistant.h index 62c6d6b7402..6df0c153b1c 100644 --- a/Generals/Code/GameEngine/Include/Common/BuildAssistant.h +++ b/Generals/Code/GameEngine/Include/Common/BuildAssistant.h @@ -208,7 +208,7 @@ class BuildAssistant : public SubsystemInterface Int m_buildPositionSize; ///< number of elements in the build position array ObjectSellList m_sellList; ///< list of objects currently going through the "sell process" -}; // end BuildAssistant +}; // EXTERN ///////////////////////////////////////////////////////////////////////////////////////// extern BuildAssistant *TheBuildAssistant; diff --git a/Generals/Code/GameEngine/Include/Common/FunctionLexicon.h b/Generals/Code/GameEngine/Include/Common/FunctionLexicon.h index 1c20e2653c0..963b57678e1 100644 --- a/Generals/Code/GameEngine/Include/Common/FunctionLexicon.h +++ b/Generals/Code/GameEngine/Include/Common/FunctionLexicon.h @@ -125,7 +125,7 @@ class FunctionLexicon : public SubsystemInterface TableEntry *m_tables[ MAX_FUNCTION_TABLES ]; ///< the lookup tables -}; // end class FunctionLexicon +}; /////////////////////////////////////////////////////////////////////////////////////////////////// // INLINING diff --git a/Generals/Code/GameEngine/Include/Common/GameCommon.h b/Generals/Code/GameEngine/Include/Common/GameCommon.h index ab562f50f62..426906d8492 100644 --- a/Generals/Code/GameEngine/Include/Common/GameCommon.h +++ b/Generals/Code/GameEngine/Include/Common/GameCommon.h @@ -215,7 +215,7 @@ enum CommandSourceType CPP_11(: Int) CMD_FROM_AI, CMD_FROM_DOZER, // Special rare command when the dozer originates a command to attack a mine. Mines are not ai-attackable, and it seems deceitful for the dozer to generate a player or script command. jba. -}; ///< the source of a command +}; //------------------------------------------------------------------------------------------------- enum AbleToAttackType CPP_11(: Int) diff --git a/Generals/Code/GameEngine/Include/Common/Module.h b/Generals/Code/GameEngine/Include/Common/Module.h index 20c6d9d8164..0daf1f3f041 100644 --- a/Generals/Code/GameEngine/Include/Common/Module.h +++ b/Generals/Code/GameEngine/Include/Common/Module.h @@ -223,7 +223,7 @@ class Module : public MemoryPoolObject, private: const ModuleData* m_moduleData; -}; // end Module +}; //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/Common/ModuleFactory.h b/Generals/Code/GameEngine/Include/Common/ModuleFactory.h index dd3ea4da646..9437d10823f 100644 --- a/Generals/Code/GameEngine/Include/Common/ModuleFactory.h +++ b/Generals/Code/GameEngine/Include/Common/ModuleFactory.h @@ -122,7 +122,7 @@ class ModuleFactory : public SubsystemInterface, public Snapshot ModuleTemplateMap m_moduleTemplateMap; ModuleDataList m_moduleDataList; -}; // end class ModuleFactory +}; // EXTERN ///////////////////////////////////////////////////////////////////////////////////////// extern ModuleFactory *TheModuleFactory; ///< singleton definition diff --git a/Generals/Code/GameEngine/Include/Common/NameKeyGenerator.h b/Generals/Code/GameEngine/Include/Common/NameKeyGenerator.h index 22ad72650c6..dd1d6bcbaf5 100644 --- a/Generals/Code/GameEngine/Include/Common/NameKeyGenerator.h +++ b/Generals/Code/GameEngine/Include/Common/NameKeyGenerator.h @@ -135,7 +135,7 @@ class NameKeyGenerator : public SubsystemInterface Bucket* m_sockets[SOCKET_COUNT]; ///< Catalog of all Buckets already generated UnsignedInt m_nextID; ///< Next available ID -}; // end class NameKeyGenerator +}; //------------------------------------------------------------------------------------------------- // Externals diff --git a/Generals/Code/GameEngine/Include/Common/SparseMatchFinder.h b/Generals/Code/GameEngine/Include/Common/SparseMatchFinder.h index ad729530a34..5ffb8c457aa 100644 --- a/Generals/Code/GameEngine/Include/Common/SparseMatchFinder.h +++ b/Generals/Code/GameEngine/Include/Common/SparseMatchFinder.h @@ -169,9 +169,9 @@ class SparseMatchFinder curBestMatchStr = it->getDescription(); #endif } - } // end for i + } - } // end for it + } #ifdef SPARSEMATCH_DEBUG if (numDupMatches > 0) diff --git a/Generals/Code/GameEngine/Include/Common/SubsystemInterface.h b/Generals/Code/GameEngine/Include/Common/SubsystemInterface.h index 7f966730155..b8bc60d0d7a 100644 --- a/Generals/Code/GameEngine/Include/Common/SubsystemInterface.h +++ b/Generals/Code/GameEngine/Include/Common/SubsystemInterface.h @@ -136,7 +136,7 @@ class SubsystemInterface AsciiString getName(void) {return m_name;} void setName(AsciiString name) {m_name = name;} -}; // end SubsystemInterface +}; //------------------------------------------------------------------------------------------------- class SubsystemInterfaceList diff --git a/Generals/Code/GameEngine/Include/GameClient/DisplayString.h b/Generals/Code/GameEngine/Include/GameClient/DisplayString.h index 4b586e76caa..eaa479fdcf3 100644 --- a/Generals/Code/GameEngine/Include/GameClient/DisplayString.h +++ b/Generals/Code/GameEngine/Include/GameClient/DisplayString.h @@ -115,7 +115,7 @@ class DisplayString : public MemoryPoolObject DisplayString *m_next; ///< for the display string factory list ONLY DisplayString *m_prev; ///< for the display string factory list ONLY -}; // end DisplayString +}; /////////////////////////////////////////////////////////////////////////////// // INLINING /////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/GameWindow.h b/Generals/Code/GameEngine/Include/GameClient/GameWindow.h index 556202b0f9e..7de2f660795 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GameWindow.h +++ b/Generals/Code/GameEngine/Include/GameClient/GameWindow.h @@ -431,7 +431,7 @@ friend class GameWindowManager; // vector of window transitions that have a relation to the current GameWindow std::vector m_transitionWindows; -}; // end class GameWindow +}; // TheSuperHackers @feature helmutbuhler 24/04/2025 // GameWindow that does nothing. Used for Headless Mode. diff --git a/Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h b/Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h index b0e3771e685..8a1638e2c36 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h +++ b/Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h @@ -359,7 +359,7 @@ friend class GameWindow; const Image *m_cursorBitmap; UnsignedInt m_captureFlags; -}; // end GameWindowManager +}; // INLINE ///////////////////////////////////////////////////////////////////////////////////////// inline GameWinDrawFunc GameWindowManager::getDefaultDraw( void ) { return GameWinDefaultDraw; } diff --git a/Generals/Code/GameEngine/Include/GameClient/Image.h b/Generals/Code/GameEngine/Include/GameClient/Image.h index 43b49b84b74..2517ec5ade3 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Image.h +++ b/Generals/Code/GameEngine/Include/GameClient/Image.h @@ -113,7 +113,7 @@ friend class ImageCollection; static const FieldParse m_imageFieldParseTable[]; ///< the parse table for INI definition -}; // end Image +}; //------------------------------------------------------------------------------------------------- /** A collection of images */ @@ -144,7 +144,7 @@ class ImageCollection : public SubsystemInterface Image *m_imageList; ///< the image list -}; // end ImageCollection +}; // INLINING /////////////////////////////////////////////////////////////////////////////////////// inline void Image::setName( AsciiString name ) { m_name = name; } diff --git a/Generals/Code/GameEngine/Include/GameClient/KeyDefs.h b/Generals/Code/GameEngine/Include/GameClient/KeyDefs.h index 939c504760c..9cb65a7555c 100644 --- a/Generals/Code/GameEngine/Include/GameClient/KeyDefs.h +++ b/Generals/Code/GameEngine/Include/GameClient/KeyDefs.h @@ -229,7 +229,7 @@ enum KeyDefType CPP_11(: Int) KEY_NONE = 0x00, ///< to report end of key stream KEY_LOST = 0xFF ///< to report lost keyboard focus -}; // end KeyDefType +}; // state for keyboard IO ------------------------------------------------------ enum @@ -252,7 +252,7 @@ enum KEY_STATE_SHIFT = (KEY_STATE_LSHIFT | KEY_STATE_RSHIFT | KEY_STATE_SHIFT2 ), KEY_STATE_ALT = (KEY_STATE_LALT | KEY_STATE_RALT) -}; // end KeyStateType +}; // INLINING /////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/Keyboard.h b/Generals/Code/GameEngine/Include/GameClient/Keyboard.h index f8144236a89..818c83fa799 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Keyboard.h +++ b/Generals/Code/GameEngine/Include/GameClient/Keyboard.h @@ -79,7 +79,7 @@ struct KeyboardIO UnsignedShort state; // KEY_STATE_* in KeyDefs.h UnsignedInt sequence; // sequence info from DirectX used for order -}; // end KeyboardIO +}; // class Keyboard ============================================================= /** Keyboard singleton to interface with the keyboard */ @@ -162,7 +162,7 @@ class Keyboard : public SubsystemInterface } m_keyNames[ KEY_NAMES_COUNT ]; UnsignedInt m_inputFrame; ///< frame input was gathered on -}; // end Keyboard +}; // INLINING /////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/Mouse.h b/Generals/Code/GameEngine/Include/GameClient/Mouse.h index b3e044bd1d1..8d911d5eb95 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Mouse.h +++ b/Generals/Code/GameEngine/Include/GameClient/Mouse.h @@ -421,7 +421,7 @@ class Mouse : public SubsystemInterface CursorCaptureMode m_cursorCaptureMode; CursorCaptureBlockReasonInt m_captureBlockReasonBits; -}; // end class Mouse +}; // TheSuperHackers @feature helmutbuhler 17/05/2025 // Mouse that does nothing. Used for Headless Mode. diff --git a/Generals/Code/GameEngine/Include/GameClient/RayEffect.h b/Generals/Code/GameEngine/Include/GameClient/RayEffect.h index 0c612e45e27..8c30df89b6d 100644 --- a/Generals/Code/GameEngine/Include/GameClient/RayEffect.h +++ b/Generals/Code/GameEngine/Include/GameClient/RayEffect.h @@ -49,7 +49,7 @@ struct RayEffectData Coord3D startLoc; ///< start location for ray Coord3D endLoc; ///< end location for ray -}; // end RayEffectData +}; //------------------------------------------------------------------------------------------------- /** This class maintains all the ray effects visible in the world */ @@ -87,7 +87,7 @@ class RayEffectSystem : public SubsystemInterface }; RayEffectData m_effectData[ MAX_RAY_EFFECTS ]; ///< all the ray effects -}; // end RayEffectSystem +}; // EXTERN ///////////////////////////////////////////////////////////////////////////////////////// extern RayEffectSystem *TheRayEffects; ///< the ray effects singleton external diff --git a/Generals/Code/GameEngine/Include/GameClient/Shell.h b/Generals/Code/GameEngine/Include/GameClient/Shell.h index fb4f4a81eb9..01788c3e485 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Shell.h +++ b/Generals/Code/GameEngine/Include/GameClient/Shell.h @@ -200,7 +200,7 @@ class Shell : public SubsystemInterface WindowLayout *m_popupReplayLayout; ///< replay save menu layout WindowLayout *m_optionsLayout; ///< options menu layout -}; // end class Shell +}; // INLINING /////////////////////////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/TerrainVisual.h b/Generals/Code/GameEngine/Include/GameClient/TerrainVisual.h index 8aa96bacc03..bea2393879b 100644 --- a/Generals/Code/GameEngine/Include/GameClient/TerrainVisual.h +++ b/Generals/Code/GameEngine/Include/GameClient/TerrainVisual.h @@ -169,7 +169,7 @@ class TerrainVisual : public Snapshot, AsciiString m_filenameString; ///< file with terrain data -}; // end class TerrainVisual +}; // EXTERNALS ////////////////////////////////////////////////////////////////////////////////////// extern TerrainVisual *TheTerrainVisual; ///< singleton extern diff --git a/Generals/Code/GameEngine/Include/GameClient/WindowLayout.h b/Generals/Code/GameEngine/Include/GameClient/WindowLayout.h index 1b1aabe4d2d..10edd8c6021 100644 --- a/Generals/Code/GameEngine/Include/GameClient/WindowLayout.h +++ b/Generals/Code/GameEngine/Include/GameClient/WindowLayout.h @@ -107,7 +107,7 @@ class WindowLayout : public MemoryPoolObject WindowLayoutUpdateFunc m_update; ///< update callback WindowLayoutShutdownFunc m_shutdown; ///< shutdown callback -}; // end class WindowLayout +}; // INLINING /////////////////////////////////////////////////////////////////////////////////////// inline AsciiString WindowLayout::getFilename( void ) const { return m_filenameString; } diff --git a/Generals/Code/GameEngine/Include/GameLogic/AI.h b/Generals/Code/GameEngine/Include/GameLogic/AI.h index 999d2b6017e..10f51592cc8 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/AI.h +++ b/Generals/Code/GameEngine/Include/GameLogic/AI.h @@ -322,7 +322,7 @@ enum AttitudeType CPP_11(: Int) { ATTITUDE_ALERT=1, ATTITUDE_AGGRESSIVE=2, ATTITUDE_INVALID=3 -}; ///< AI "attitude" behavior modifiers +}; enum CommandSourceType CPP_11(: Int); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h index 73e51c1a4f2..c54c5c2dfbd 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h @@ -77,7 +77,7 @@ class RailroadBehaviorModuleData : public PhysicsBehaviorModuleData p.add( dataFieldParse ); - } // end buildFieldParse + } TemplateNameList m_carriageTemplateNameData; AsciiString m_pathPrefixName; ///< prefix to use for waypont start and end points we'll look for diff --git a/Generals/Code/GameEngine/Include/GameLogic/Object.h b/Generals/Code/GameEngine/Include/GameLogic/Object.h index 41e074b04d4..cf7fbf9dfdd 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Object.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Object.h @@ -766,7 +766,7 @@ class Object : public Thing, public Snapshot Bool m_singleUseCommandUsed; Bool m_isReceivingDifficultyBonus; -}; // end class Object +}; // deleteInstance is not meant to be used with Object in order to require the use of TheGameLogic->destroyObject() void deleteInstance(Object* object) CPP_11(= delete); diff --git a/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h b/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h index 33a17e3e749..213d0b284a7 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h +++ b/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h @@ -1496,7 +1496,7 @@ class PartitionManager : public SubsystemInterface, public Snapshot // If saveToFog is false, then we are writing STORE_PERMENANT_REVEAL void storeFoggedCells(ShroudStatusStoreRestore &outPartitionStore, Bool storeToFog) const; void restoreFoggedCells(const ShroudStatusStoreRestore &inPartitionStore, Bool restoreToFog); -}; // end class PartitionManager +}; // ----------------------------------------------------------------------------- inline void PartitionManager::worldToCell(Real wx, Real wy, Int *cx, Int *cy) diff --git a/Generals/Code/GameEngine/Include/GameLogic/ScriptActions.h b/Generals/Code/GameEngine/Include/GameLogic/ScriptActions.h index 3b6cba1dff5..a5aa954df7b 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/ScriptActions.h +++ b/Generals/Code/GameEngine/Include/GameLogic/ScriptActions.h @@ -60,7 +60,7 @@ class ScriptActionsInterface : public SubsystemInterface // Called by the script engine in postProcessLoad() virtual void doEnableOrDisableObjectDifficultyBonuses(Bool enableBonuses) = 0; -}; // end class ScriptActionsInterface +}; extern ScriptActionsInterface *TheScriptActions; ///< singleton definition @@ -377,7 +377,7 @@ class ScriptActions : public ScriptActionsInterface void doResizeViewGuardband(const Real gbx, const Real gby ); void deleteAllUnmanned(); -}; // end class ScriptActions +}; #endif // end __SCRIPTACTIONS_H_ diff --git a/Generals/Code/GameEngine/Include/GameLogic/ScriptConditions.h b/Generals/Code/GameEngine/Include/GameLogic/ScriptConditions.h index 61b82d4977c..dce81aee57d 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/ScriptConditions.h +++ b/Generals/Code/GameEngine/Include/GameLogic/ScriptConditions.h @@ -57,7 +57,7 @@ class ScriptConditionsInterface : public SubsystemInterface virtual Bool evaluateSkirmishCommandButtonIsReady( Parameter *pSkirmishPlayerParm, Parameter *pTeamParm, Parameter *pCommandButtonParm, Bool allReady ) = 0; virtual Bool evaluateTeamIsContained(Parameter *pTeamParm, Bool allContained) = 0; -}; // end class ScriptConditionsInterface +}; extern ScriptConditionsInterface *TheScriptConditions; ///< singleton definition @@ -186,7 +186,7 @@ class ScriptConditions : public ScriptConditionsInterface Bool evaluateMissionAttempts(Parameter *pPlayerParm, Parameter *pComparisonParm, Parameter *pAttemptsParm); -}; // end class ScriptConditions +}; #endif // end __SCRIPTCONDITIONS_H_ diff --git a/Generals/Code/GameEngine/Include/GameLogic/ScriptEngine.h b/Generals/Code/GameEngine/Include/GameLogic/ScriptEngine.h index 0a6268ec0ca..e363b2a434e 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/ScriptEngine.h +++ b/Generals/Code/GameEngine/Include/GameLogic/ScriptEngine.h @@ -486,7 +486,7 @@ class ScriptEngine : public SubsystemInterface, #endif #endif -}; // end class ScriptEngine +}; extern ScriptEngine *TheScriptEngine; ///< singleton definition diff --git a/Generals/Code/GameEngine/Include/GameLogic/TerrainLogic.h b/Generals/Code/GameEngine/Include/GameLogic/TerrainLogic.h index 27200ebb69a..12f94106dc0 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/TerrainLogic.h +++ b/Generals/Code/GameEngine/Include/GameLogic/TerrainLogic.h @@ -372,7 +372,7 @@ class TerrainLogic : public Snapshot, } m_waterToUpdate[ MAX_DYNAMIC_WATER ]; ///< water tables to dynamicall update Int m_numWaterToUpdate; ///< how many valid entries are in m_waterToUpdate -}; // end class TerrainLogic +}; // EXTERNALS ////////////////////////////////////////////////////////////////////////////////////// extern TerrainLogic *TheTerrainLogic; ///< singleton definition diff --git a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp index 999dc3c517c..fabdc0fc778 100644 --- a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp @@ -705,7 +705,7 @@ void GameEngine::init() resetSubsystems(); HideControlBar(); -} // end init +} /** ----------------------------------------------------------------------------------------------- * Reset all necessary parts of the game engine to be ready to accept new game data @@ -862,7 +862,7 @@ void GameEngine::update( void ) // for scripted camera movements while the time is frozen. TheScriptEngine->UPDATE(); } - } // end perfGather + } } // Horrible reference, but we really, really need to know if we are windowed. @@ -941,8 +941,8 @@ void GameEngine::execute( void ) { } RELEASE_CRASH(("Uncaught Exception in GameEngine::update")); - } // catch - } // perf + } + } { { @@ -972,7 +972,7 @@ void GameEngine::execute( void ) } } - } // perfgather for execute_loop + } #ifdef PERF_TIMERS if (!m_quitting && TheGameLogic->isInGame() && !TheGameLogic->isInShellGame() && !TheGameLogic->isGamePaused()) diff --git a/Generals/Code/GameEngine/Source/Common/GameLOD.cpp b/Generals/Code/GameEngine/Source/Common/GameLOD.cpp index 9610b2c0fbe..1aeaf7e6567 100644 --- a/Generals/Code/GameEngine/Source/Common/GameLOD.cpp +++ b/Generals/Code/GameEngine/Source/Common/GameLOD.cpp @@ -288,10 +288,8 @@ void GameLODManager::init(void) if ((Real)(m_numRAM)/(Real)(256*1024*1024) >= PROFILE_ERROR_LIMIT) m_memPassed=TRUE; //check if they have at least 256 MB - //find data needed to determine m_idealDetailLevel if (m_idealDetailLevel == STATIC_GAME_LOD_UNKNOWN || TheGlobalData->m_forceBenchmark) { - //find equivalent CPU to unknown cpu. if (m_cpuType == XX || TheGlobalData->m_forceBenchmark) { //need to run the benchmark diff --git a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp index e0b0abd720c..c3556cbf269 100644 --- a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp @@ -679,7 +679,7 @@ GlobalData::GlobalData() //Added By Sadullah Nader //Initializations missing and needed m_vertexWaterAvailableMaps[i].clear(); - } // end for i + } m_skyBoxPositionZ = 0.0f; m_drawSkyBox = FALSE; @@ -1008,7 +1008,7 @@ GlobalData::GlobalData() m_keyboardCameraRotateSpeed = 0.1f; -} // end GlobalData +} //------------------------------------------------------------------------------------------------- AsciiString GlobalData::getPath_UserData() const @@ -1029,7 +1029,7 @@ GlobalData::~GlobalData( void ) TheWritableGlobalData = NULL; } -} // end ~GlobalData +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1077,7 +1077,7 @@ GlobalData *GlobalData::newOverride( void ) return override; -} // end newOveride +} //------------------------------------------------------------------------------------------------- void GlobalData::init( void ) @@ -1109,7 +1109,7 @@ void GlobalData::reset( void ) // set next as top TheWritableGlobalData = next; - } // end while + } // // we now have the one single global data in TheWritableGlobalData singleton, lets sanity check @@ -1118,7 +1118,7 @@ void GlobalData::reset( void ) DEBUG_ASSERTCRASH( TheWritableGlobalData->m_next == NULL, ("ResetGlobalData: theOriginal is not original") ); DEBUG_ASSERTCRASH( TheWritableGlobalData == GlobalData::m_theOriginal, ("ResetGlobalData: oops") ); -} // end ResetGlobalData +} //------------------------------------------------------------------------------------------------- /** Parse GameData entry */ @@ -1135,14 +1135,14 @@ void GlobalData::parseGameDataDefinition( INI* ini ) if( ini->getLoadType() == INI_LOAD_CREATE_OVERRIDES ) TheWritableGlobalData->newOverride(); - } // end if + } else if (!TheWritableGlobalData) { // we don't have any global data instance at all yet, create one TheWritableGlobalData = NEW GlobalData; - } // end else + } // If we're multifile, then continue loading stuff into the Global Data as normal. // parse the ini weapon definition diff --git a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp index 1ee16934940..ca680b1cd37 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp @@ -189,14 +189,14 @@ INI::INI( void ) m_curBlockStart[0] = 0; #endif -} // end INI +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- INI::~INI( void ) { -} // end ~INI +} //------------------------------------------------------------------------------------------------- UnsignedInt INI::loadFileDirectory( AsciiString fileDirName, INILoadType loadType, Xfer *pXfer, Bool subdirs ) @@ -300,7 +300,7 @@ void INI::prepFile( AsciiString filename, INILoadType loadType ) DEBUG_CRASH(( "INI::load, cannot open file '%s', file already open", filename.str() )); throw INI_FILE_ALREADY_OPEN; - } // end if + } // open the file m_file = TheFileSystem->openFile(filename.str(), File::READ); @@ -310,7 +310,7 @@ void INI::prepFile( AsciiString filename, INILoadType loadType ) DEBUG_CRASH(( "INI::load, cannot open file '%s'", filename.str() )); throw INI_CANT_OPEN_FILE; - } // end if + } m_file = m_file->convertToRAMFile(); @@ -427,9 +427,9 @@ UnsignedInt INI::load( AsciiString filename, INILoadType loadType, Xfer *pXfer ) throw INI_UNKNOWN_TOKEN; } - } // end if + } - } // end while + } } catch (...) { @@ -478,7 +478,7 @@ void INI::readLine( void ) done = TRUE; m_buffer[ i ] = '\0'; - } // end if + } // check for new line if( m_buffer[ i ] == '\n' ) @@ -509,7 +509,7 @@ void INI::readLine( void ) if( ++i == INI_MAX_CHARS_PER_LINE ) done = TRUE; - } // end while + } // increase our line count m_lineNum++; @@ -521,7 +521,7 @@ void INI::readLine( void ) DEBUG_ASSERTCRASH( 0, ("Buffer too small (%d) and was truncated, increase INI_MAX_CHARS_PER_LINE", INI_MAX_CHARS_PER_LINE) ); - } // end if + } } if (s_xfer) @@ -858,7 +858,7 @@ void INI::parseAndTranslateLabel( INI* ini, void * /*instance*/, void *store, co UnicodeString *theString = (UnicodeString *)store; theString->set( translated.str() ); -} // end parseAndTranslateLabel +} //------------------------------------------------------------------------------------------------- /** Parse a string label assumed as an image as part of the image collection. Translate @@ -880,7 +880,7 @@ void INI::parseMappedImage( INI *ini, void * /*instance*/, void *store, const vo //else // throw INI_UNKNOWN_ERROR; -} // end parseMappedImage +} // ------------------------------------------------------------------------------------------------ /** Parse a string label assumed as a Anim2D template name. Translate that name to an @@ -894,16 +894,16 @@ void INI::parseMappedImage( INI *ini, void * /*instance*/, void *store, const vo { Anim2DTemplate **anim2DTemplate = (Anim2DTemplate **)store; *anim2DTemplate = TheAnim2DCollection->findTemplate( AsciiString( token ) ); - } // end if + } else { DEBUG_CRASH(( "INI::parseAnim2DTemplate - TheAnim2DCollection is NULL" )); throw INI_UNKNOWN_ERROR; - } // end else + } -} // end parseAnim2DTemplate +} //------------------------------------------------------------------------------------------------- /** Parse a percent in int or real form such as "23%" or "95.4%" and assign @@ -915,7 +915,7 @@ void INI::parsePercentToReal( INI* ini, void * /*instance*/, void *store, const Real *theReal = (Real *)store; *theReal = scanPercentToReal(token); -} // end parsePercentToReal +} //------------------------------------------------------------------------------------------------- /** 'store' points to an 32 bit unsigned integer. We will zero that integer, parse each token @@ -1084,7 +1084,7 @@ void INI::parseRGBAColorInt( INI* ini, void * /*instance*/, void *store, const v theColor->blue = colors[ 2 ]; theColor->alpha = colors[ 3 ]; -} // end parseRGBAColorInt +} //------------------------------------------------------------------------------------------------- /** Parse a color in the form of @@ -1133,7 +1133,7 @@ void INI::parseColorInt( INI* ini, void * /*instance*/, void *store, const void* Color *theColor = (Color *)store; *theColor = GameMakeColor(colors[0], colors[1], colors[2], colors[3]); -} // end parseColorInt +} //------------------------------------------------------------------------------------------------- /** Parse a 3D coordinate of reals in the form of: @@ -1147,7 +1147,7 @@ void INI::parseCoord3D( INI* ini, void * /*instance*/, void *store, const void* theCoord->y = scanReal(ini->getNextSubToken("Y")); theCoord->z = scanReal(ini->getNextSubToken("Z")); -} // end parseCoord3D +} //------------------------------------------------------------------------------------------------- /** Parse a 2D coordinate of reals in the form of: @@ -1160,7 +1160,7 @@ void INI::parseCoord2D( INI* ini, void * /*instance*/, void *store, const void* theCoord->x = scanReal(ini->getNextSubToken("X")); theCoord->y = scanReal(ini->getNextSubToken("Y")); -} // end parseCoord2D +} //------------------------------------------------------------------------------------------------- /** Parse a 2D coordinate of Ints in the form of: @@ -1173,7 +1173,7 @@ void INI::parseICoord2D( INI* ini, void * /*instance*/, void *store, const void* theCoord->x = scanInt(ini->getNextSubToken("X")); theCoord->y = scanInt(ini->getNextSubToken("Y")); -} // end parseICoord2D +} //------------------------------------------------------------------------------------------------- /** Parse an audio event and assign to the 'AudioEventRTS*' at store */ @@ -1320,7 +1320,7 @@ void INI::parseParticleSystemTemplate( INI *ini, void * /*instance*/, void *stor *theParticleSystemTemplate = pSystemT; -} // end parseParticleSystemTemplate +} //------------------------------------------------------------------------------------------------- /** Parse an DamageFX and assign to the 'DamageFX *' at store */ @@ -1568,9 +1568,9 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList INI::getLineNum(), INI::getFilename().str(), field, m_curBlockStart) ); } - } // end else + } - } // end if + } // sanity check for reaching end of file with no closing end token if( done == FALSE && INI::isEOF() == TRUE ) @@ -1581,9 +1581,9 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList m_curBlockStart, getFilename().str(), m_blockEndToken) ); throw INI_MISSING_END_TOKEN; - } // end if + } - } // end while + } } diff --git a/Generals/Code/GameEngine/Source/Common/INI/INIAnimation.cpp b/Generals/Code/GameEngine/Source/Common/INI/INIAnimation.cpp index dfeca7ea1f7..9fa8925c718 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INIAnimation.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INIAnimation.cpp @@ -56,7 +56,7 @@ void INI::parseAnim2DDefinition( INI* ini ) //We don't need it if we're in the builder... which doesn't have this. return; - } // end if + } // find existing animation template if present animTemplate = TheAnim2DCollection->findTemplate( name ); @@ -68,7 +68,7 @@ void INI::parseAnim2DDefinition( INI* ini ) DEBUG_ASSERTCRASH( animTemplate, ("INI""parseAnim2DDefinition - unable to allocate animation template for '%s'", name.str()) ); - } // end if + } else { @@ -77,12 +77,12 @@ void INI::parseAnim2DDefinition( INI* ini ) animTemplate->getName().str() )); return; - } // end else + } // parse the ini definition ini->initFromINI( animTemplate, animTemplate->getFieldParse() ); -} // end parseAnim2DDefinition +} diff --git a/Generals/Code/GameEngine/Source/Common/INI/INICommandButton.cpp b/Generals/Code/GameEngine/Source/Common/INI/INICommandButton.cpp index 83582adb074..cbf7f5140b1 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INICommandButton.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INICommandButton.cpp @@ -61,7 +61,7 @@ void ControlBar::parseCommandButtonDefinition( INI *ini ) { button->markAsOverride(); } - } // end if + } else if( ini->getLoadType() != INI_LOAD_CREATE_OVERRIDES ) { DEBUG_CRASH(( "[LINE: %d in '%s'] Duplicate commandbutton %s found!", ini->getLineNum(), ini->getFilename().str(), name.str() )); @@ -89,6 +89,6 @@ void ControlBar::parseCommandButtonDefinition( INI *ini ) ini->getLineNum(), ini->getFilename().str(), name.str() ) ); } -} // end parseCommandButtonDefinition +} diff --git a/Generals/Code/GameEngine/Source/Common/INI/INICommandSet.cpp b/Generals/Code/GameEngine/Source/Common/INI/INICommandSet.cpp index 0dac3e9a3e4..fd7b64e63b4 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INICommandSet.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INICommandSet.cpp @@ -40,4 +40,4 @@ void INI::parseCommandSetDefinition( INI *ini ) { ControlBar::parseCommandSetDefinition(ini); -} // end parseCommandSetDefinition +} diff --git a/Generals/Code/GameEngine/Source/Common/INI/INIControlBarScheme.cpp b/Generals/Code/GameEngine/Source/Common/INI/INIControlBarScheme.cpp index e17b52add4c..d37b8483a07 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INIControlBarScheme.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INIControlBarScheme.cpp @@ -96,6 +96,6 @@ void INI::parseControlBarSchemeDefinition( INI *ini ) // parse the ini definition ini->initFromINI( CBScheme, CBSchemeManager->getFieldParse() ); -} // end parseCommandButtonDefinition +} diff --git a/Generals/Code/GameEngine/Source/Common/INI/INIMapData.cpp b/Generals/Code/GameEngine/Source/Common/INI/INIMapData.cpp index 54fcfc6d5b5..788c9fc0b0e 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INIMapData.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INIMapData.cpp @@ -45,6 +45,6 @@ //------------------------------------------------------------------------------------------------- void INI::parseMapDataDefinition( INI* ini ) { -} // end parseMapData +} diff --git a/Generals/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp b/Generals/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp index d8d4df12021..0bd4d921184 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp @@ -71,9 +71,9 @@ void INI::parseMappedImageDefinition( INI* ini ) DEBUG_ASSERTCRASH( image, ("parseMappedImage: unable to allocate image for '%s'", name.str()) ); - } // end if + } // parse the ini definition ini->initFromINI( image, image->getFieldParse()); -} // end parseMappedImage +} diff --git a/Generals/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp b/Generals/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp index 2d80b09ba9f..25e22f2f401 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp @@ -45,12 +45,12 @@ void INI::parseMultiplayerSettingsDefinition( INI* ini ) { DEBUG_ASSERTCRASH(false, ("Creating an override of MultiplayerSettings!")); } - } // end if + } else { // we don't have any multiplayer settings instance at all yet, create one TheMultiplayerSettings = NEW MultiplayerSettings; - } // end else + } // parse the ini definition ini->initFromINI( TheMultiplayerSettings, TheMultiplayerSettings->getFieldParse() ); diff --git a/Generals/Code/GameEngine/Source/Common/INI/INITerrain.cpp b/Generals/Code/GameEngine/Source/Common/INI/INITerrain.cpp index ebb6fc64681..0e658ec7c08 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INITerrain.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INITerrain.cpp @@ -56,7 +56,7 @@ void INI::parseTerrainDefinition( INI* ini ) // parse the ini definition ini->initFromINI( terrainType, terrainType->getFieldParse() ); -} // end parseTerrain +} diff --git a/Generals/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp b/Generals/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp index fc74174b754..eaf1620a3e8 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp @@ -57,7 +57,7 @@ void INI::parseTerrainBridgeDefinition( INI* ini ) bridge->getName().str()) ); throw INI_INVALID_DATA; - } // end if + } if( bridge == NULL ) bridge = TheTerrainRoads->newBridge( name ); @@ -67,7 +67,7 @@ void INI::parseTerrainBridgeDefinition( INI* ini ) // parse the ini definition ini->initFromINI( bridge, bridge->getBridgeFieldParse() ); -} // end parseTerrainBridge +} diff --git a/Generals/Code/GameEngine/Source/Common/INI/INITerrainRoad.cpp b/Generals/Code/GameEngine/Source/Common/INI/INITerrainRoad.cpp index e666d8f42d0..1f61728b43e 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INITerrainRoad.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INITerrainRoad.cpp @@ -57,7 +57,7 @@ void INI::parseTerrainRoadDefinition( INI* ini ) road->getName().str()) ); throw INI_INVALID_DATA; - } // end if + } if( road == NULL ) road = TheTerrainRoads->newRoad( name ); @@ -67,7 +67,7 @@ void INI::parseTerrainRoadDefinition( INI* ini ) // parse the ini definition ini->initFromINI( road, road->getRoadFieldParse() ); -} // end parseTerrainRoad +} diff --git a/Generals/Code/GameEngine/Source/Common/INI/INIWater.cpp b/Generals/Code/GameEngine/Source/Common/INI/INIWater.cpp index 4ea563abd30..ff73a59359f 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INIWater.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INIWater.cpp @@ -68,13 +68,13 @@ void INI::parseWaterSettingDefinition( INI* ini ) waterSetting = &WaterSettings[ timeOfDayIndex ]; break; - } // end if + } // next name timeOfDayName++; timeOfDayIndex++; - } // end while + } // check for no time of day match if( waterSetting == NULL ) @@ -83,7 +83,7 @@ void INI::parseWaterSettingDefinition( INI* ini ) // parse the data ini->initFromINI( waterSetting, waterSetting->getFieldParse() ); -} // end parseWaterSetting +} //------------------------------------------------------------------------------------------------- void INI::parseWaterTransparencyDefinition( INI *ini ) diff --git a/Generals/Code/GameEngine/Source/Common/INI/INIWebpageURL.cpp b/Generals/Code/GameEngine/Source/Common/INI/INIWebpageURL.cpp index 60f16de728e..957b79c4b75 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INIWebpageURL.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INIWebpageURL.cpp @@ -118,6 +118,6 @@ void INI::parseWebpageURLDefinition( INI* ini ) url->m_url.format("file://%s\\Data\\%s\\%s", encodeURL(cwd).str(), GetRegistryLanguage().str(), url->m_url.str()+7); DEBUG_LOG(("INI::parseWebpageURLDefinition() - converted URL to [%s]", url->m_url.str())); } -} // end parseMusicTrackDefinition +} diff --git a/Generals/Code/GameEngine/Source/Common/MultiplayerSettings.cpp b/Generals/Code/GameEngine/Source/Common/MultiplayerSettings.cpp index 380b559b3c5..9d9d8149440 100644 --- a/Generals/Code/GameEngine/Source/Common/MultiplayerSettings.cpp +++ b/Generals/Code/GameEngine/Source/Common/MultiplayerSettings.cpp @@ -91,7 +91,7 @@ MultiplayerSettings::MultiplayerSettings() m_observerColor; m_randomColor; -} // end MultiplayerSettings +} MultiplayerColorDefinition::MultiplayerColorDefinition() { diff --git a/Generals/Code/GameEngine/Source/Common/NameKeyGenerator.cpp b/Generals/Code/GameEngine/Source/Common/NameKeyGenerator.cpp index 4e7cde7d50d..60006d4ae26 100644 --- a/Generals/Code/GameEngine/Source/Common/NameKeyGenerator.cpp +++ b/Generals/Code/GameEngine/Source/Common/NameKeyGenerator.cpp @@ -42,7 +42,7 @@ NameKeyGenerator::NameKeyGenerator() for (Int i = 0; i < SOCKET_COUNT; ++i) m_sockets[i] = NULL; -} // end NameKeyGenerator +} //------------------------------------------------------------------------------------------------- NameKeyGenerator::~NameKeyGenerator() @@ -51,7 +51,7 @@ NameKeyGenerator::~NameKeyGenerator() // free all system data freeSockets(); -} // end ~NameKeyGenerator +} //------------------------------------------------------------------------------------------------- void NameKeyGenerator::init() @@ -62,7 +62,7 @@ void NameKeyGenerator::init() freeSockets(); m_nextID = 1; -} // end init +} //------------------------------------------------------------------------------------------------- void NameKeyGenerator::reset() @@ -70,7 +70,7 @@ void NameKeyGenerator::reset() freeSockets(); m_nextID = 1; -} // end reset +} //------------------------------------------------------------------------------------------------- void NameKeyGenerator::freeSockets() @@ -86,7 +86,7 @@ void NameKeyGenerator::freeSockets() m_sockets[i] = NULL; } -} // end freeSockets +} /* ------------------------------------------------------------------------ */ inline UnsignedInt calcHashForString(const char* p) @@ -209,7 +209,7 @@ NameKeyType NameKeyGenerator::nameToKeyImpl(const char* nameString) return result; -} // end nameToKey +} //------------------------------------------------------------------------------------------------- NameKeyType NameKeyGenerator::nameToLowercaseKeyImpl(const char* nameString) @@ -257,7 +257,7 @@ NameKeyType NameKeyGenerator::nameToLowercaseKeyImpl(const char* nameString) return result; -} // end nameToLowercaseKey +} //------------------------------------------------------------------------------------------------- // Get a string out of the INI. Store it into a NameKeyType diff --git a/Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp b/Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp index 40357594310..5529c18ad4c 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp @@ -127,14 +127,14 @@ static Bool isObjectShroudedForAction ( const Object *source, const Object *targ ActionManager::ActionManager( void ) { -} // end ActionManager +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ ActionManager::~ActionManager( void ) { -} // end ~ActionManager +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -194,7 +194,7 @@ Bool ActionManager::canGetRepairedAt( const Object *obj, const Object *repairDes // all is well, we can be repaired here return TRUE; -} // end canGetRepairedAt +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -310,12 +310,12 @@ Bool ActionManager::canDockAt( const Object *obj, const Object *dockDest, Comman if( obj->isKindOf( KINDOF_VEHICLE ) || obj->isKindOf( KINDOF_INFANTRY ) ) return TRUE; - } // end if + } // cannot dock return FALSE; -} // end canDockAt +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -367,7 +367,7 @@ Bool ActionManager::canGetHealedAt( const Object *obj, const Object *healDest, C // all is well, we can be healed here return TRUE; -} // end canGetHealedAt +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -436,7 +436,7 @@ Bool ActionManager::canRepairObject( const Object *obj, const Object *objectToRe return TRUE; -} // end canRepair +} // ------------------------------------------------------------------------------------------------ /** Can 'obj' resume the construction of 'objectBeingConstructed' */ @@ -493,11 +493,11 @@ Bool ActionManager::canResumeConstructionOf( const Object *obj, dozerAI->getTaskTarget( DOZER_TASK_BUILD ) == objectBeingConstructed->getID() ) return FALSE; - } // end if + } - } // en dif + } - } //end if + } // if the target is in the shroud, we can't do anything if (isObjectShroudedForAction(obj, objectBeingConstructed, commandSource)) @@ -510,7 +510,7 @@ Bool ActionManager::canResumeConstructionOf( const Object *obj, return TRUE; -} // end canResumeConstructionOf +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1122,7 +1122,7 @@ Bool ActionManager::canPickUpPrisoner( const Object *obj, const Object *prisoner return TRUE; -} // end canPickUpPrisoner +} #endif // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Energy.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Energy.cpp index bf9c4d4e240..3e89fad868d 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Energy.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Energy.cpp @@ -130,7 +130,7 @@ void Energy::objectEnteringInfluence( Object *obj ) ("Energy - Negative Energy numbers, Produce=%d Consume=%d\n", m_energyProduction, m_energyConsumption) ); -} // end objectEnteringInfluence +} //------------------------------------------------------------------------------------------------- /** 'obj' will now no longer add/subtrack from this energy construct */ @@ -195,7 +195,7 @@ void Energy::removePowerBonus( Object *obj ) ("Energy - Negative Energy numbers, Produce=%d Consume=%d\n", m_energyProduction, m_energyConsumption) ); -} // end removePowerBonus +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -230,7 +230,7 @@ void Energy::addConsumption(Int amt) void Energy::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -263,7 +263,7 @@ void Energy::xfer( Xfer *xfer ) xfer->xferInt( &owningPlayerIndex ); m_owner = ThePlayerList->getNthPlayer( owningPlayerIndex ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -271,4 +271,4 @@ void Energy::xfer( Xfer *xfer ) void Energy::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/Common/RTS/MissionStats.cpp b/Generals/Code/GameEngine/Source/Common/RTS/MissionStats.cpp index 03ae3de124a..0a4ed0f5bf8 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/MissionStats.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/MissionStats.cpp @@ -75,7 +75,7 @@ void MissionStats::init() void MissionStats::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -102,7 +102,7 @@ void MissionStats::xfer( Xfer *xfer ) // buildings lost xfer->xferInt( &m_buildingsLost ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -110,4 +110,4 @@ void MissionStats::xfer( Xfer *xfer ) void MissionStats::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Money.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Money.cpp index f2c439e4556..20fcc928f6f 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Money.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Money.cpp @@ -111,7 +111,7 @@ void Money::triggerAudioEvent(const AudioEventRTS& audioEvent) void Money::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -129,7 +129,7 @@ void Money::xfer( Xfer *xfer ) // money value xfer->xferUnsignedInt( &m_money ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -137,7 +137,7 @@ void Money::xfer( Xfer *xfer ) void Money::loadPostProcess( void ) { -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp index bfdb88c4d60..9e1c6434501 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp @@ -203,7 +203,7 @@ void dumpBattlePlanBonuses(const BattlePlanBonuses *b, AsciiString name, const P PlayerRelationMap::PlayerRelationMap( void ) { -} // end PlayerRelationMap +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -213,7 +213,7 @@ PlayerRelationMap::~PlayerRelationMap( void ) // make sure the data is cleared m_map.clear(); -} // end ~PlayerRelationmap +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -221,7 +221,7 @@ PlayerRelationMap::~PlayerRelationMap( void ) void PlayerRelationMap::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -260,9 +260,9 @@ void PlayerRelationMap::xfer( Xfer *xfer ) r = (*playerRelationIt).second; xfer->xferUser( &r, sizeof( Relationship ) ); - } // end for, playerRelationIt + } - } // end if, save + } else { @@ -278,11 +278,11 @@ void PlayerRelationMap::xfer( Xfer *xfer ) // assign relationship m_map[ playerIndex ] = r; - } // end for, i + } - } // end else, load + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -290,7 +290,7 @@ void PlayerRelationMap::xfer( Xfer *xfer ) void PlayerRelationMap::loadPostProcess( void ) { -} // end loadPostProcess +} //============================================================================= Player::Player( Int playerIndex ) @@ -964,7 +964,7 @@ void Player::becomingTeamMember(Object *obj, Bool yes) if( !obj->getStatusBits().test( OBJECT_STATUS_UNDER_CONSTRUCTION ) ) { obj->friend_adjustPowerForPlayer(yes); - } // end if + } // when we capture a building, we need to see if there's an AutoDepositUpdate hooked to it, // if so, award the cash bonus @@ -1195,7 +1195,7 @@ void Player::onUnitCreated( Object *factory, Object *unit ) // ai notification callback if( m_ai ) m_ai->onUnitProduced( factory, unit ); -} // end onUnitCreated +} //------------------------------------------------------------------------------------------------- @@ -1207,7 +1207,7 @@ Bool Player::isSupplySourceSafe( Int minSupplies ) if( m_ai ) return m_ai->isSupplySourceSafe( minSupplies ); return true; -} // isSupplySourceSafe +} //------------------------------------------------------------------------------------------------- /** Is a supply source attacked? */ @@ -1218,7 +1218,7 @@ Bool Player::isSupplySourceAttacked( void ) if( m_ai ) return m_ai->isSupplySourceAttacked( ); return false; -} // isSupplySourceSafe +} //------------------------------------------------------------------------------------------------- /** Set delay between team production */ @@ -1228,7 +1228,7 @@ void Player::setTeamDelaySeconds(Int delay ) // ai action if( m_ai ) m_ai->setTeamDelaySeconds( delay ); -} // guardSupplyCenter +} //------------------------------------------------------------------------------------------------- /** Guard supply center */ @@ -1238,7 +1238,7 @@ void Player::guardSupplyCenter( Team *team, Int minSupplies ) // ai action if( m_ai ) m_ai->guardSupplyCenter( team, minSupplies ); -} // guardSupplyCenter +} //------------------------------------------------------------------------------------------------- /** A team is about to be destroyed */ @@ -1252,7 +1252,7 @@ void Player::preTeamDestroy( const Team *team ) // TheSuperHackers @bugfix Mauller/Xezon 03/05/2025 Clear the default team to prevent dangling pointer usage if( m_defaultTeam == team ) m_defaultTeam = NULL; -} // preTeamDestroy +} //------------------------------------------------------------------------------------------------- /// a structuer was just created, but is under construction @@ -1260,7 +1260,7 @@ void Player::preTeamDestroy( const Team *team ) void Player::onStructureCreated( Object *builder, Object *structure ) { -} // end onStructureCreated +} //------------------------------------------------------------------------------------------------- /// a structure that was under construction has become completed @@ -1307,13 +1307,13 @@ void Player::onStructureConstructionComplete( Object *builder, Object *structure if (structure->hasSpecialPower(SPECIAL_SCUD_STORM)) TheEva->setShouldPlay(EVA_SuperweaponDetected_ScudStorm); -} // end onStructureConstructionComplete +} //============================================================================= void Player::onStructureUndone(Object *structure) { m_scoreKeeper.removeObjectBuilt(structure); -} // end onStructureUndone +} //============================================================================= void Player::addTeamToList(TeamPrototype* team) @@ -2465,13 +2465,13 @@ void Player::deleteUpgradeList( void ) deleteInstance(m_upgradeList); m_upgradeList = next; - } // end while + } // This doesn't call removeUpgrade, so clear these ourselves. m_upgradesInProgress.clear(); m_upgradesCompleted.clear(); -} // end deleteUpgradeList +} //================================================================================================= /** Find an upgrade in our list of upgrades with matching name key */ @@ -2486,7 +2486,7 @@ Upgrade *Player::findUpgrade( const UpgradeTemplate *upgradeTemplate ) return NULL; -} // end findUpgrade +} //================================================================================================= /** Does the player have this completed upgrade */ @@ -2537,7 +2537,7 @@ Upgrade *Player::addUpgrade( const UpgradeTemplate *upgradeTemplate, UpgradeStat m_upgradeList->friend_setPrev( u ); m_upgradeList = u; - } // end if + } // set the new status for the upgrade u->setStatus( status ); @@ -2557,7 +2557,7 @@ Upgrade *Player::addUpgrade( const UpgradeTemplate *upgradeTemplate, UpgradeStat return u; -} // end addUpgrade +} //================================================================================================= /** @@ -2616,9 +2616,9 @@ void Player::removeUpgrade( const UpgradeTemplate *upgradeTemplate ) if( upgrade->getStatus() == UPGRADE_STATUS_COMPLETE ) onUpgradeRemoved(); - } // end if + } -} // end removeUpgrade +} //------------------------------------------------------------------------------------------------- @@ -2653,7 +2653,7 @@ void Player::addRadar( Bool disableProof ) soundToPlay.setPlayerIndex(getPlayerIndex()); TheAudio->addAudioEvent(&soundToPlay); } -} // end addRadar +} //------------------------------------------------------------------------------------------------- /** The parameter object has is taking its radar away from the player */ @@ -2676,7 +2676,7 @@ void Player::removeRadar( Bool disableProof ) soundToPlay.setPlayerIndex(getPlayerIndex()); TheAudio->addAudioEvent(&soundToPlay); } -} // end removeRadar +} //------------------------------------------------------------------------------------------------- void Player::disableRadar() @@ -3451,7 +3451,7 @@ Bool Player::isPlayableSide( void ) const return m_playerTemplate ? m_playerTemplate->isPlayableSide() : FALSE; -} // end isPlayableSide +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -3480,7 +3480,7 @@ void Player::crc( Xfer *xfer ) xfer->xferInt( &m_skillPoints ); xfer->xferInt( &m_sciencePurchasePoints ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -3540,9 +3540,9 @@ void Player::xfer( Xfer *xfer ) // xfer upgrade data xfer->xferSnapshot( upgrade ); - } // end for, upgrade + } - } // end if, save + } else { const UpgradeTemplate *upgradeTemplate; @@ -3563,7 +3563,7 @@ void Player::xfer( Xfer *xfer ) DEBUG_CRASH(( "Player::xfer - Unable to find upgrade '%s'", upgradeName.str() )); throw SC_INVALID_DATA; - } // end if + } // add upgrade to player, the status is invalid, but that's OK cause we're about to xfer it upgrade = addUpgrade( upgradeTemplate, UPGRADE_STATUS_INVALID ); @@ -3571,9 +3571,9 @@ void Player::xfer( Xfer *xfer ) // xfer upgrade data xfer->xferSnapshot( upgrade ); - } // end for, i + } - } // end else, load + } // radar info xfer->xferInt( &m_radarCount ); @@ -3609,9 +3609,9 @@ void Player::xfer( Xfer *xfer ) prototypeID = prototype->getID(); xfer->xferUser( &prototypeID, sizeof( TeamPrototypeID ) ); - } // end for + } - } // end if, save + } else { @@ -3635,14 +3635,14 @@ void Player::xfer( Xfer *xfer ) DEBUG_CRASH(( "Player::xfer - Unable to find team prototype by id" )); throw SC_INVALID_DATA; - } // end if + } // put in list m_playerTeamPrototypes.push_back( prototype ); - } // end for, i + } - } // end else, load + } // build list info UnsignedShort buildListInfoCount = 0; @@ -3657,7 +3657,7 @@ void Player::xfer( Xfer *xfer ) for( buildListInfo = m_pBuildList; buildListInfo; buildListInfo = buildListInfo->getNext() ) xfer->xferSnapshot( buildListInfo ); - } // end if, save + } else { @@ -3688,14 +3688,14 @@ void Player::xfer( Xfer *xfer ) last->setNextBuildList( buildListInfo ); - } // end else + } // xfer data xfer->xferSnapshot( buildListInfo ); - } // end for,i + } - } // end else, load + } // ai player data Bool aiPlayerPresent = m_ai ? TRUE : FALSE; @@ -3706,7 +3706,7 @@ void Player::xfer( Xfer *xfer ) DEBUG_CRASH(( "Player::xfer - m_ai present/missing mismatch" )); throw SC_INVALID_DATA;; - } // end if + } if( m_ai ) xfer->xferSnapshot( m_ai ); @@ -3720,7 +3720,7 @@ void Player::xfer( Xfer *xfer ) DEBUG_CRASH(( "Player::xfer - m_resourceGatheringManager present/missing mismatch" )); throw SC_INVALID_DATA; - } // end if + } if( m_resourceGatheringManager ) xfer->xferSnapshot( m_resourceGatheringManager ); @@ -3734,7 +3734,7 @@ void Player::xfer( Xfer *xfer ) DEBUG_CRASH(( "Player::xfer - m_tunnelSystem present/missing mismatch" )); throw SC_INVALID_DATA; - } // end if + } if( m_tunnelSystem ) xfer->xferSnapshot( m_tunnelSystem ); @@ -3884,9 +3884,9 @@ void Player::xfer( Xfer *xfer ) // ref xfer->xferUnsignedInt( &entry->m_ref ); - } // end for + } - } // end if, save + } else { @@ -3897,7 +3897,7 @@ void Player::xfer( Xfer *xfer ) DEBUG_CRASH(( "Player::xfer - m_kindOfPercentProductionChangeList should be empty but is not" )); throw SC_INVALID_DATA; - } // end if + } // read each entry for( UnsignedInt i = 0; i < percentProductionChangeCount; ++i ) @@ -3914,9 +3914,9 @@ void Player::xfer( Xfer *xfer ) // put at end of list m_kindOfPercentProductionChangeList.push_back( entry ); - } // end for i + } - } // end else, load + } @@ -3948,7 +3948,7 @@ void Player::xfer( Xfer *xfer ) { DEBUG_CRASH(( "Player::xfer - m_specialPowerReadyTimerList should be empty but is not" )); throw SC_INVALID_DATA; - } // end if + } // read each entry for( UnsignedInt i = 0; i < timerListSize; ++i ) @@ -3962,7 +3962,7 @@ void Player::xfer( Xfer *xfer ) // put at end of list m_specialPowerReadyTimerList.push_back( timer ); - } // end for i + } } } /////////////////////////////////////////////////////////////////////////// @@ -3979,7 +3979,7 @@ void Player::xfer( Xfer *xfer ) DEBUG_CRASH(( "Player::xfer - size of m_squadCount array has changed" )); throw SC_INVALID_DATA; - } // end if + } for( UnsignedShort i = 0; i < squadCount; ++i ) { @@ -3989,11 +3989,11 @@ void Player::xfer( Xfer *xfer ) DEBUG_CRASH(( "Player::xfer - NULL squad at index '%d'", i )); throw SC_INVALID_DATA; - } // end if + } xfer->xferSnapshot( m_squads[ i ] ); - } // end for, i + } // current squad selection Bool currentSelectionPresent = m_currentSelection ? TRUE : FALSE; @@ -4008,7 +4008,7 @@ void Player::xfer( Xfer *xfer ) // xfer xfer->xferSnapshot( m_currentSelection ); - } // end if + } // Player battle plan bonuses Bool battlePlanBonus = m_battlePlanBonuses != NULL; @@ -4044,7 +4044,7 @@ void Player::xfer( Xfer *xfer ) else m_unitsShouldHunt = FALSE; -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -4052,5 +4052,5 @@ void Player::xfer( Xfer *xfer ) void Player::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/Common/RTS/PlayerList.cpp b/Generals/Code/GameEngine/Source/Common/RTS/PlayerList.cpp index db78baee3a1..3bc243f14dd 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/PlayerList.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/PlayerList.cpp @@ -249,7 +249,7 @@ void PlayerList::update() for( Int i = 0; i < MAX_PLAYER_COUNT; i++ ) { m_players[i]->update(); - } // end for i + } } @@ -260,7 +260,7 @@ void PlayerList::newMap() for( Int i = 0; i < MAX_PLAYER_COUNT; i++ ) { m_players[i]->newMap(); - } // end for i + } } @@ -280,7 +280,7 @@ void PlayerList::updateTeamStates(void) for( Int i = 0; i < MAX_PLAYER_COUNT; i++ ) { m_players[i]->updateTeamStates(); - } // end for i + } } //----------------------------------------------------------------------------- @@ -354,12 +354,12 @@ Player *PlayerList::getPlayerFromMask( PlayerMaskType mask ) if( player && player->getPlayerMask() == mask ) return player; - } // end for i + } DEBUG_CRASH( ("Player does not exist for mask") ); return NULL; // mask not found -} // end getPlayerFromMask +} //----------------------------------------------------------------------------- Player *PlayerList::getEachPlayerFromMask( PlayerMaskType& maskToAdjust ) @@ -376,7 +376,7 @@ Player *PlayerList::getEachPlayerFromMask( PlayerMaskType& maskToAdjust ) maskToAdjust &= (~player->getPlayerMask()); return player; } - } // end for i + } DEBUG_CRASH( ("No players found that contain any matching masks.") ); maskToAdjust = 0; @@ -466,13 +466,13 @@ void PlayerList::xfer( Xfer *xfer ) DEBUG_CRASH(( "Invalid player count '%d', should be '%d'", playerCount, m_playerCount )); throw SC_INVALID_DATA; - } // end if + } // xfer each of the player data for( Int i = 0; i < playerCount; ++i ) xfer->xferSnapshot( m_players[ i ] ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -480,5 +480,5 @@ void PlayerList::xfer( Xfer *xfer ) void PlayerList::loadPostProcess( void ) { -} // end postProcessLoad +} diff --git a/Generals/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp b/Generals/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp index 817f5a30632..d7a0fbb3a02 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp @@ -173,7 +173,7 @@ AsciiString PlayerTemplate::getStartingUnit( Int i ) const theMoney->init(); theMoney->deposit( money ); -} // end parseStartMoney +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp b/Generals/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp index 6574013ee69..562f99098ff 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp @@ -197,7 +197,7 @@ void ProductionPrerequisite::addUnitPrereq( AsciiString unit, Bool orUnitWithPre info.unit = NULL; m_prereqUnits.push_back(info); -} // end addUnitPrereq +} //------------------------------------------------------------------------------------------------- /** Add a unit prerequisite, if 'orWithPrevious' is set then this unit is said @@ -214,7 +214,7 @@ void ProductionPrerequisite::addUnitPrereq( const std::vector& unit orWithPrevious = true; } -} // end addUnitPrereq +} //------------------------------------------------------------------------------------------------- // returns an asciistring which is a list of all the prerequisites diff --git a/Generals/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp b/Generals/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp index 613ee58c0fe..2138a32bed5 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp @@ -258,7 +258,7 @@ Object *ResourceGatheringManager::findBestSupplyCenter( Object *queryObject ) void ResourceGatheringManager::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -279,7 +279,7 @@ void ResourceGatheringManager::xfer( Xfer *xfer ) // supply centers xfer->xferSTLObjectIDList( &m_supplyCenters ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -287,5 +287,5 @@ void ResourceGatheringManager::xfer( Xfer *xfer ) void ResourceGatheringManager::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp b/Generals/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp index 03f3cd3e286..e1576dd7080 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp @@ -399,7 +399,7 @@ Int ScoreKeeper::getTotalUnitsDestroyed( void ) void ScoreKeeper::crc( Xfer *xfer ) { -} // end ScoreKeeper +} // ------------------------------------------------------------------------------------------------ /** Xfer of an object count map @@ -416,7 +416,7 @@ void ScoreKeeper::xferObjectCountMap( Xfer *xfer, ObjectCountMap *map ) DEBUG_CRASH(( "xferObjectCountMap - Invalid map parameter" )); throw SC_INVALID_DATA; - } // end if + } // version info XferVersion currentVersion = 1; @@ -448,9 +448,9 @@ void ScoreKeeper::xferObjectCountMap( Xfer *xfer, ObjectCountMap *map ) count = it->second; xfer->xferInt( &count ); - } // end for, it + } - } // end if, save + } else { @@ -467,7 +467,7 @@ void ScoreKeeper::xferObjectCountMap( Xfer *xfer, ObjectCountMap *map ) DEBUG_CRASH(( "xferObjectCountMap - Unknown thing template '%s'", thingTemplateName.str() )); throw SC_INVALID_DATA; - } // end if + } // read count xfer->xferInt( &count ); @@ -475,11 +475,11 @@ void ScoreKeeper::xferObjectCountMap( Xfer *xfer, ObjectCountMap *map ) // add to map (*map)[ thingTemplate ] = count; - } // end for, i + } - } // end else + } -} // end xferObjectCountMap +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -542,14 +542,14 @@ void ScoreKeeper::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScoreKeeper::xfer - size of objects destroyed array has changed" )); throw SC_INVALID_DATA; - } // end if + } for( UnsignedShort i = 0; i < destroyedArraySize; ++i ) { // xfer map data xferObjectCountMap( xfer, &m_objectsDestroyed[ i ] ); - } // end for i + } // objects lost xferObjectCountMap( xfer, &m_objectsLost ); @@ -557,7 +557,7 @@ void ScoreKeeper::xfer( Xfer *xfer ) // objects captured xferObjectCountMap( xfer, &m_objectsCaptured ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -565,4 +565,4 @@ void ScoreKeeper::xfer( Xfer *xfer ) void ScoreKeeper::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp b/Generals/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp index 2efe72faf6f..b370566651b 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp @@ -193,14 +193,14 @@ SpecialPowerTemplate::SpecialPowerTemplate() m_radiusCursorRadius = 0; m_shortcutPower = FALSE; -} // end SpecialPowerTemplate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- SpecialPowerTemplate::~SpecialPowerTemplate() { -} // end ~SpecialPowerTemplate +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -213,7 +213,7 @@ SpecialPowerStore::SpecialPowerStore( void ) m_nextSpecialPowerID = 0; -} // end SpecialPowerStore +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -230,7 +230,7 @@ SpecialPowerStore::~SpecialPowerStore( void ) // set our count to zero m_nextSpecialPowerID = 0; -} // end ~SpecialPowerStore +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -272,7 +272,7 @@ const SpecialPowerTemplate *SpecialPowerStore::getSpecialPowerTemplateByIndex( U return NULL; // not found -} // end getSpecialPowerTemplateByIndex +} //------------------------------------------------------------------------------------------------- /** Return the size of the store (WB) */ @@ -282,7 +282,7 @@ Int SpecialPowerStore::getNumSpecialPowers( void ) return m_specialPowerTemplates.size(); -} // end getNumSpecialPowers +} //------------------------------------------------------------------------------------------------- /** does the object (and therefore the player) meet all the requirements to use this power */ @@ -315,7 +315,7 @@ Bool SpecialPowerStore::canUseSpecialPower( Object *obj, const SpecialPowerTempl if( player->hasScience( requiredScience ) == FALSE ) return FALSE; - } // end if + } // I THINK THIS IS WHERE WE BAIL OUT IF A DIFFERENT CONYARD IS ALREADY CHARGIN THIS SPECIAL RIGHT NOW //LORENZEN @@ -324,7 +324,7 @@ Bool SpecialPowerStore::canUseSpecialPower( Object *obj, const SpecialPowerTempl // all is well return TRUE; -} // end canUseSpecialPower +} //------------------------------------------------------------------------------------------------- /** Reset */ @@ -344,4 +344,4 @@ void SpecialPowerStore::reset( void ) ++it; } } -} // end reset +} diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp index 03b8ab97a51..c0d2c3b2fc0 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp @@ -62,7 +62,7 @@ TeamFactory *TheTeamFactory = NULL; TeamRelationMap::TeamRelationMap( void ) { -} // end TeamRelationMap +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -72,7 +72,7 @@ TeamRelationMap::~TeamRelationMap( void ) // maek sure the data is clear m_map.clear(); -} // end ~TeamRelationMap +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -80,7 +80,7 @@ TeamRelationMap::~TeamRelationMap( void ) void TeamRelationMap::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -118,9 +118,9 @@ void TeamRelationMap::xfer( Xfer *xfer ) r = (*teamRelationIt).second; xfer->xferUser( &r, sizeof( Relationship ) ); - } // end for + } - } // end if, save + } else { @@ -136,11 +136,11 @@ void TeamRelationMap::xfer( Xfer *xfer ) // assign relationship m_map[teamID] = r; - } // end for, i + } - } // end else load + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -148,7 +148,7 @@ void TeamRelationMap::xfer( Xfer *xfer ) void TeamRelationMap::loadPostProcess( void ) { -} // end loadPostProcess +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -293,7 +293,7 @@ TeamPrototype *TeamFactory::findTeamPrototypeByID( TeamPrototypeID id ) if( prototype->getID() == id ) return prototype; - } // end for + } // not found return NULL; @@ -422,7 +422,7 @@ void TeamFactory::teamAboutToBeDeleted(Team* team) void TeamFactory::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------ /** Xfer method @@ -455,7 +455,7 @@ void TeamFactory::xfer( Xfer *xfer ) prototypeCount, m_prototypes.size() )); throw SC_INVALID_DATA; - } // end if + } // xfer each of the prototype information TeamPrototypeMap::iterator it; @@ -479,9 +479,9 @@ void TeamFactory::xfer( Xfer *xfer ) // xfer prototype data xfer->xferSnapshot( teamPrototype ); - } //end for, it + } - } // end if, saving + } else { @@ -502,14 +502,14 @@ void TeamFactory::xfer( Xfer *xfer ) DEBUG_CRASH(( "TeamFactory::xfer - Unable to find team prototype by id" )); throw SC_INVALID_DATA; - } // end if + } // xfer prototype data xfer->xferSnapshot( teamPrototype ); - } // end for, i + } - } // end else, loading + } /* // SAVE_LOAD_DEBUG @@ -537,15 +537,15 @@ fprintf( fp, " Team Instance '%s', id is '%d'\n", team->getName().str(), team-> obj = objIt.cur(); fprintf( fp, " Member '%s', id '%d'\n", obj->getTemplate()->getName().str(), obj->getID() ); } - } // end for + } -} // end for +} fclose( fp ); -} // end if, save +} */ -} // end xfer +} // ------------------------------------------------------------------------ /** Load post process */ @@ -577,9 +577,9 @@ void TeamFactory::loadPostProcess( void ) if( team->getID() >= m_uniqueTeamID ) m_uniqueTeamID = team->getID() + 1; - } // end for + } - } // end for, it + } /* // SAVE_LOAD_DEBUG @@ -602,13 +602,13 @@ fprintf( fp, " Team Instance '%s', id is '%d'\n", team->getName().str(), team-> obj = objIt.cur(); fprintf( fp, " Member '%s', id '%d'\n", obj->getTemplate()->getName().str(), obj->getID() ); } - } // end for + } -} // end for +} fclose( fp ); */ -} // end loadPostProcess +} // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ @@ -766,7 +766,7 @@ TeamTemplateInfo::TeamTemplateInfo(Dict *d) : void TeamTemplateInfo::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------ /** Xfer method @@ -784,7 +784,7 @@ void TeamTemplateInfo::xfer( Xfer *xfer ) // xfer the production priority xfer->xferInt( &m_productionPriority ); -} // end xfer +} // ------------------------------------------------------------------------ /** Load post process */ @@ -792,7 +792,7 @@ void TeamTemplateInfo::xfer( Xfer *xfer ) void TeamTemplateInfo::loadPostProcess( void ) { -} // end loadPostProcess +} // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ @@ -1182,7 +1182,7 @@ Bool TeamPrototype::evaluateProductionCondition(void) void TeamPrototype::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------ /** Xfer method @@ -1240,9 +1240,9 @@ void TeamPrototype::xfer( Xfer *xfer ) // write team data xfer->xferSnapshot( teamInstance ); - } // end for + } - } // end if, save + } else { @@ -1274,16 +1274,16 @@ void TeamPrototype::xfer( Xfer *xfer ) // restore original ID we read from the file teamInstance->setID( teamID ); - } // end if + } // xfer team data xfer->xferSnapshot( teamInstance ); - } // end for, i + } - } // end else, load + } -} // end xfer +} // ------------------------------------------------------------------------ /** Load post process */ @@ -1291,7 +1291,7 @@ void TeamPrototype::xfer( Xfer *xfer ) void TeamPrototype::loadPostProcess( void ) { -} // end loadPostProcess +} // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ @@ -2550,7 +2550,7 @@ void Team::updateGenericScripts(void) void Team::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -2575,7 +2575,7 @@ void Team::xfer( Xfer *xfer ) teamID, m_id )); throw SC_INVALID_DATA; - } // end if + } // member list count and data ObjectID memberID; @@ -2602,9 +2602,9 @@ void Team::xfer( Xfer *xfer ) memberID = obj->getID(); xfer->xferObjectID( &memberID ); - } // end for + } - } // end if, save + } else { @@ -2618,9 +2618,9 @@ void Team::xfer( Xfer *xfer ) // put on pending list for later processing m_xferMemberIDList.push_back( memberID ); - } // end for, i + } - } // end else, load + } // state xfer->xferAsciiString( &m_state ); @@ -2684,7 +2684,7 @@ void Team::xfer( Xfer *xfer ) // player relations xfer->xferSnapshot( m_playerRelations ); -} // ene xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -2709,7 +2709,7 @@ void Team::loadPostProcess( void ) DEBUG_CRASH(( "Team::loadPostProcess - Unable to post process object to member list, object ID = '%d'", *it )); throw SC_INVALID_DATA; - } // end if + } // // we are now disabling this code since the objects set their team during their @@ -2724,9 +2724,9 @@ void Team::loadPostProcess( void ) obj->getTemplate()->getName().str(), obj->getID() )); throw SC_INVALID_DATA; - } // end if + } - } // end for + } // since we prepended the object member pointers, reverse that list so it's just like before // reverse_TeamMemberList(); @@ -2734,7 +2734,7 @@ void Team::loadPostProcess( void ) // we're done with the xfer list now m_xferMemberIDList.clear(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp b/Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp index fd3c4508287..8f6767594ed 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp @@ -284,7 +284,7 @@ void TunnelTracker::healObject( Object *obj, void *frames) // set max health body->attemptHealing( &healInfo ); - } // end if + } else { // @@ -297,7 +297,7 @@ void TunnelTracker::healObject( Object *obj, void *frames) // do the healing body->attemptHealing( &healInfo ); - } // end else + } } // ------------------------------------------------------------------------------------------------ @@ -306,7 +306,7 @@ void TunnelTracker::healObject( Object *obj, void *frames) void TunnelTracker::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -339,9 +339,9 @@ void TunnelTracker::xfer( Xfer *xfer ) objectID = (*it)->getID(); xfer->xferObjectID( &objectID ); - } // end for, it + } - } // end if, save + } else { @@ -351,14 +351,14 @@ void TunnelTracker::xfer( Xfer *xfer ) xfer->xferObjectID( &objectID ); m_xferContainList.push_back( objectID ); - } // end for, i + } - } // end else, load + } // tunnel count xfer->xferUnsignedInt( &m_tunnelCount ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -373,7 +373,7 @@ void TunnelTracker::loadPostProcess( void ) DEBUG_CRASH(( "TunnelTracker::loadPostProcess - m_containList should be empty but is not" )); throw SC_INVALID_DATA; - } // end if + } // translate each object ids on the xferContainList into real object pointers in the contain list Object *obj; @@ -388,7 +388,7 @@ void TunnelTracker::loadPostProcess( void ) DEBUG_CRASH(( "TunnelTracker::loadPostProcess - Unable to find object ID '%d'", *it )); throw SC_INVALID_DATA; - } // end if + } // push on the back of the contain list m_containList.push_back( obj ); @@ -410,9 +410,9 @@ void TunnelTracker::loadPostProcess( void ) TheAI->pathfinder()->removeObjectFromPathfindMap( obj ); } - } // end for, it + } // we're done with the xfer contain list now m_xferContainList.clear(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/Common/Recorder.cpp b/Generals/Code/GameEngine/Source/Common/Recorder.cpp index 7d5cc10b280..b80c7abe6b1 100644 --- a/Generals/Code/GameEngine/Source/Common/Recorder.cpp +++ b/Generals/Code/GameEngine/Source/Common/Recorder.cpp @@ -1242,7 +1242,7 @@ Bool RecorderClass::playbackFile(AsciiString filename) Int rankPoints = 0; m_file->read(&rankPoints, sizeof(rankPoints)); - + Int maxFPS = 0; m_file->read(&maxFPS, sizeof(maxFPS)); diff --git a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp index f228aea0c1f..f552c8e4b2e 100644 --- a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp @@ -804,7 +804,7 @@ void StateMachine::internalSetGoalPosition( const Coord3D *pos ) void StateMachine::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -867,7 +867,7 @@ void StateMachine::xfer( Xfer *xfer ) xfer->xferCoord3D(&m_goalPosition); xfer->xferBool(&m_locked); xfer->xferBool(&m_defaultStateInited); -} // end xfer +} // ------------------------------------------------------------------------------------------------ @@ -876,5 +876,5 @@ void StateMachine::xfer( Xfer *xfer ) void StateMachine::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index cd13b50a308..82eca2cb91a 100644 --- a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -72,14 +72,14 @@ ObjectSellInfo::ObjectSellInfo( void ) m_id = INVALID_ID; m_sellFrame = 0; -} // end ObjectSellInfo +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ ObjectSellInfo::~ObjectSellInfo( void ) { -} // end ~ObjectSellInfo +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -99,7 +99,7 @@ static Bool isDozer( Object *obj ) return FALSE; -} // end isDozer +} // PUBLIC ///////////////////////////////////////////////////////////////////////////////////////// @@ -111,7 +111,7 @@ BuildAssistant::BuildAssistant( void ) m_buildPositions = NULL; m_buildPositionSize = 0; m_sellList.clear(); -} // end BuildAssistant +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -126,9 +126,9 @@ BuildAssistant::~BuildAssistant( void ) m_buildPositions = NULL; m_buildPositionSize = 0; - } // end if + } -} // end ~BuildAssistant +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -142,7 +142,7 @@ void BuildAssistant::init( void ) m_buildPositionSize = TheGlobalData->m_maxLineBuildObjects; m_buildPositions = NEW Coord3D[ m_buildPositionSize ]; -} // end init +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -161,12 +161,12 @@ void BuildAssistant::reset( void ) // delete our data and erase this entry from the list deleteInstance(sellInfo); - } // end for + } // clear the sell list m_sellList.clear(); -} // end reset +} static const Real FRAMES_TO_ALLOW_SCAFFOLD = LOGICFRAMES_PER_SECOND * 1.5f; static const Real TOTAL_FRAMES_TO_SELL_OBJECT = LOGICFRAMES_PER_SECOND * 3.0f; @@ -204,7 +204,7 @@ void BuildAssistant::update( void ) m_sellList.erase( thisIterator ); continue; - } // end if + } // decrement the construction percent if( TheGameLogic->getFrame() - sellInfo->m_sellFrame >= FRAMES_TO_ALLOW_SCAFFOLD ) @@ -233,9 +233,9 @@ void BuildAssistant::update( void ) if( draw ) draw->setAnimationLoopDuration( TOTAL_FRAMES_TO_SELL_OBJECT / 2 ); - } // end if + } - } // end if + } // // after we've reached zero ... the object has "sunk" back down into the ground ... but @@ -260,7 +260,7 @@ void BuildAssistant::update( void ) // this money shouldn't be scored since it wasn't really "earned." // player->getScoreKeeper()->addMoneyEarned( sellValue ); - } // end if + } // cancel any of the production items and refund to the controlling player ProductionUpdateInterface *pui = obj->getProductionUpdateInterface(); @@ -279,11 +279,11 @@ void BuildAssistant::update( void ) deleteInstance(sellInfo); m_sellList.erase( thisIterator ); - } // end if + } - } // end for + } -} // end update +} //------------------------------------------------------------------------------------------------- /** Xfer the sell list. */ //------------------------------------------------------------------------------------------------- @@ -320,7 +320,7 @@ void BuildAssistant::xferTheSellList( Xfer *xfer ) DEBUG_ASSERTCRASH(count==0, ("Inconsistent list size counts.")); } -} // end xferTheSellList +} //------------------------------------------------------------------------------------------------- /** Nice little method to wrap up creating an object from a build */ @@ -342,7 +342,7 @@ Object *BuildAssistant::buildObjectNow( Object *constructorObject, const ThingTe DEBUG_ASSERTCRASH( constructorObject->getControllingPlayer() == owningPlayer, ("buildObjectNow: Constructor object player is not the same as the controlling player passed in\n") ); - } // end if + } // Need to validate that we can make this in case someone fakes their CommandSet // A Null constructorObject is used by the script engine to cheat, so let it slide @@ -373,7 +373,7 @@ Object *BuildAssistant::buildObjectNow( Object *constructorObject, const ThingTe } return NULL; - } // end else if + } else { @@ -409,7 +409,7 @@ Object *BuildAssistant::buildObjectNow( Object *constructorObject, const ThingTe owningPlayer->onStructureCreated( constructorObject, obj ); owningPlayer->onStructureConstructionComplete( constructorObject, obj, FALSE ); - } // end if + } else { owningPlayer->onUnitCreated( constructorObject, obj ); @@ -436,11 +436,11 @@ Object *BuildAssistant::buildObjectNow( Object *constructorObject, const ThingTe return obj; - } // end else + } return NULL; -} // end buildObjectNow +} //------------------------------------------------------------------------------------------------- /** This method will create a line of objects end to end along the line defined in 3D @@ -470,7 +470,7 @@ void BuildAssistant::buildObjectLineNow( Object *constructorObject, const ThingT for( Int i = 0; i < tileBuildInfo->tilesUsed; i++ ) buildObjectNow( constructorObject, what, &tileBuildInfo->positions[ i ], angle, owningPlayer ); -} // end buildObjectLineNow +} //------------------------------------------------------------------------------------------------- /** This structure is passed along to the checkSampleBuildLocation while iterating the @@ -502,7 +502,7 @@ static void checkSampleBuildLocation( const Coord3D *samplePoint, void *userData if( terrain->getRestrictConstruction() ) sampleData->terrainRestricted = TRUE; - } // end if + } Int cellX = REAL_TO_INT_FLOOR( samplePoint->x / PATHFIND_CELL_SIZE ); Int cellY = REAL_TO_INT_FLOOR( samplePoint->y / PATHFIND_CELL_SIZE ); @@ -539,7 +539,7 @@ static void checkSampleBuildLocation( const Coord3D *samplePoint, void *userData } } -} // end checkSampleBuildLocation +} //------------------------------------------------------------------------------------------------- /** This function will call the user callback at each "sample point" across the footprint @@ -578,7 +578,7 @@ void BuildAssistant::iterateFootprint( const ThingTemplate *build, halfFootprintHeight = build->getTemplateGeometryInfo().getMinorRadius(); halfFootprintWidth = build->getTemplateGeometryInfo().getMajorRadius(); - } // end if + } else if( build->getTemplateGeometryInfo().getGeomType() == GEOMETRY_SPHERE || build->getTemplateGeometryInfo().getGeomType() == GEOMETRY_CYLINDER ) { @@ -586,7 +586,7 @@ void BuildAssistant::iterateFootprint( const ThingTemplate *build, halfFootprintHeight = build->getTemplateGeometryInfo().getBoundingCircleRadius(); halfFootprintWidth = build->getTemplateGeometryInfo().getBoundingCircleRadius(); - } // end else if + } else { @@ -594,7 +594,7 @@ void BuildAssistant::iterateFootprint( const ThingTemplate *build, build->getTemplateGeometryInfo().getGeomType(), build->getName().str()) ); return; - } // end else + } // // start at a corner of the extent ... box geometries have a major radius down @@ -639,7 +639,7 @@ void BuildAssistant::iterateFootprint( const ThingTemplate *build, if( vector.length() > halfFootprintWidth ) // could be height too, radius is all the same for circles continue; // ignore this point - } // end if + } // call the user callback Coord3D pos; @@ -648,11 +648,11 @@ void BuildAssistant::iterateFootprint( const ThingTemplate *build, pos.z = TheTerrainLogic->getGroundHeight( pos.x, pos.y ); func( &pos, funcUserData ); - } // end for x + } - } // end for y + } -} // end iterateFootprint +} //------------------------------------------------------------------------------------------------- @@ -706,7 +706,7 @@ Bool BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos, return false; } - } // end for, them + } if (onlyCheckEnemies) { return true; @@ -823,7 +823,7 @@ Bool BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos, } } - } // end for, them + } return true; } @@ -877,7 +877,7 @@ LegalBuildCode BuildAssistant::isLocationLegalToBuild( const Coord3D *worldPos, return LBC_OBJECTS_IN_THE_WAY; } - } // end if + } // // if NO_ENEMY_OBJECT_OVERLAP is set, we are not allowed to construct 'build' if it would overlap // any enemy objects. Friendly objects are ignored. @@ -889,7 +889,7 @@ LegalBuildCode BuildAssistant::isLocationLegalToBuild( const Coord3D *worldPos, return LBC_OBJECTS_IN_THE_WAY; } - } // end if + } if (build->isKindOf(KINDOF_CANNOT_BUILD_NEAR_SUPPLIES) && TheGlobalData->m_SupplyBuildBorder > 0) { @@ -944,16 +944,16 @@ LegalBuildCode BuildAssistant::isLocationLegalToBuild( const Coord3D *worldPos, if( ai->isQuickPathAvailable( worldPos ) == FALSE ) return LBC_NO_CLEAR_PATH; - } // end if + } else { if( ai->isPathAvailable( worldPos ) == FALSE ) return LBC_NO_CLEAR_PATH; - } // end else + } - } // end if + } // check basic terrain restrctions if( BitIsSet( options, TERRAIN_RESTRICTIONS ) ) @@ -1002,12 +1002,12 @@ LegalBuildCode BuildAssistant::isLocationLegalToBuild( const Coord3D *worldPos, if( sampleData.hiZ - sampleData.loZ > TheGlobalData->m_allowedHeightVariationForBuilding ) return LBC_NOT_FLAT_ENOUGH; - } // end if + } // we passed all the checks return LBC_OK; -} // end isLocationLegalToBuild +} //------------------------------------------------------------------------------------------------- /** Adds bibs to structures near to worldPos */ @@ -1036,7 +1036,7 @@ void BuildAssistant::addBibs(const Coord3D *worldPos, TheTerrainVisual->addFactionBib(them, true); } - } // end for, them + } } @@ -1086,7 +1086,7 @@ BuildAssistant::TileBuildInfo *BuildAssistant::buildTiledLocations( const ThingT // DEBUG_ASSERTCRASH( m_buildPositionSize < 200, ("Do you really need to tile this many objects!!!") ); - } // end if + } Coord3D *positions = m_buildPositions; // compute a vector from the start of the line in the world to the end @@ -1148,7 +1148,7 @@ BuildAssistant::TileBuildInfo *BuildAssistant::buildTiledLocations( const ThingT // we have now actually used one more "tile" tilesUsed++; - } // end for i + } // return a struct filled out with the actual tiles used and the array of locations static TileBuildInfo tileInfo; @@ -1156,7 +1156,7 @@ BuildAssistant::TileBuildInfo *BuildAssistant::buildTiledLocations( const ThingT tileInfo.positions = positions; return &tileInfo; -} // end buildTiledLocations +} //------------------------------------------------------------------------------------------------- /** Is the template passed in one of those wall type structures that we "build" in @@ -1174,7 +1174,7 @@ Bool BuildAssistant::isLineBuildTemplate( const ThingTemplate *tTemplate ) return FALSE; // not a line build object -} // end isLineBuildTemplate +} //------------------------------------------------------------------------------------------------- /** This method will check to make sure it is possible to build the requested unit. The @@ -1202,7 +1202,7 @@ Bool BuildAssistant::isPossibleToMakeUnit( Object *builder, const ThingTemplate builder->getTemplate()->getName().str()) ); return FALSE; - } // end if + } // // scan the command set, we must find whatToBuild as one of the "build" commands available @@ -1222,7 +1222,7 @@ Bool BuildAssistant::isPossibleToMakeUnit( Object *builder, const ThingTemplate commandButton->getThingTemplate() && commandButton->getThingTemplate()->isEquivalentTo(whatToBuild) ) foundCommand = commandButton; - } // end for i + } if( foundCommand == NULL ) return FALSE; @@ -1258,9 +1258,9 @@ static void countInProduction( Object *obj, void *userData ) // add the count of this type that are in the queue productionCountData->count += pui->countUnitTypeInQueue( productionCountData->type ); - } // end if + } -} // end countInProduction +} //------------------------------------------------------------------------------------------------- /** This method will check to make sure it is possible to build the requested unit. and @@ -1350,7 +1350,7 @@ Bool BuildAssistant::isRemovableForConstruction( Object *obj ) // not removable return FALSE; -} // end isRemovableForConstruction +} // ------------------------------------------------------------------------------------------------ /** Given that we are about to build 'whatToBuild' remove all the objects that are in the @@ -1373,9 +1373,9 @@ void BuildAssistant::clearRemovableForConstruction( const ThingTemplate *whatToB if( isRemovableForConstruction( them ) == TRUE && !them->isKindOf( KINDOF_ALWAYS_SELECTABLE ) ) TheGameLogic->destroyObject( them ); - } // end for, them + } -} // end clearRemovableForConstruction +} // ------------------------------------------------------------------------------------------------ /** clearRemovable is set up to delete objects that should cease to exist (for instance, trees). @@ -1488,7 +1488,7 @@ void BuildAssistant::sellObject( Object *obj ) else sellInfo = NULL; - } // end for + } if( sellInfo != NULL ) return; @@ -1581,5 +1581,5 @@ void BuildAssistant::sellObject( Object *obj ) } } -} // end sellObject +} diff --git a/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp b/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp index 8b6dd45ce99..21bb149c15b 100644 --- a/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp @@ -394,12 +394,12 @@ void FunctionLexicon::loadTable( TableEntry *table, // next table entry please entry++; - } // end while + } // assign table to the index specified m_tables[ tableIndex ] = table; -} // end loadTable +} //------------------------------------------------------------------------------------------------- /** Search the provided table for a function matching the key */ @@ -420,11 +420,11 @@ void *FunctionLexicon::keyToFunc( NameKeyType key, TableEntry *table ) return entry->func; entry++; - } // end if + } return NULL; // not found -} // end keyToFunc +} //------------------------------------------------------------------------------------------------- /** Search tables for the function given this key, if the index parameter @@ -451,21 +451,21 @@ void *FunctionLexicon::findFunction( NameKeyType key, TableIndex index ) if( func ) break; // exit for i - } // end for i + } - } // end if + } else { // do NOT search all tables, just the one specified by the parameter func = keyToFunc( key, m_tables[ index ] ); - } // end else + } // return function, if found return func; -} // end findFunction +} #ifdef NOT_IN_USE //------------------------------------------------------------------------------------------------- @@ -490,11 +490,11 @@ const char *FunctionLexicon::funcToName( void *func, TableEntry *table ) // not it, check next entry++; - } // end while + } return NULL; // not found -} // end funcToName +} #endif /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -511,14 +511,14 @@ FunctionLexicon::FunctionLexicon( void ) for( i = 0; i < MAX_FUNCTION_TABLES; i++ ) m_tables[ i ] = NULL; -} // end FunctionLexicon +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- FunctionLexicon::~FunctionLexicon( void ) { -} // end ~FunctionLexicon +} //------------------------------------------------------------------------------------------------- /** Initialize our dictionary of funtion pointers and symbols */ @@ -540,7 +540,7 @@ void FunctionLexicon::init( void ) validate(); -} // end init +} //------------------------------------------------------------------------------------------------- /** reset */ @@ -556,7 +556,7 @@ void FunctionLexicon::reset( void ) // nothing dynamically loaded, just reinit the tables init(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update */ @@ -564,7 +564,7 @@ void FunctionLexicon::reset( void ) void FunctionLexicon::update( void ) { -} // end update +} /* // !NOTE! We can not have this function, see the header for @@ -590,11 +590,11 @@ char *FunctionLexicon::functionToName( void *func ) if( name ) return name; - } // end for i + } return NULL; // not found -} // end functionToName +} */ //------------------------------------------------------------------------------------------------- @@ -647,28 +647,28 @@ Bool FunctionLexicon::validate( void ) sourceEntry->name, lookAtEntry->name )); valid = FALSE; - } // end if + } // next entry in this target table lookAtEntry++; - } // end while + } - } // end for j + } - } // end if + } // next source entry sourceEntry++; - } // end while + } - } // end for i + } // return the valid state of our tables return valid; -} // end validate +} //============================================================================ // FunctionLexicon::gameWinDrawFunc diff --git a/Generals/Code/GameEngine/Source/Common/System/Geometry.cpp b/Generals/Code/GameEngine/Source/Common/System/Geometry.cpp index 0d0f6c479a3..dda127192fb 100644 --- a/Generals/Code/GameEngine/Source/Common/System/Geometry.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/Geometry.cpp @@ -553,7 +553,7 @@ AsciiString GeometryInfo::getDescriptiveString() const void GeometryInfo::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -589,7 +589,7 @@ void GeometryInfo::xfer( Xfer *xfer ) // bounding sphere radius xfer->xferReal( &m_boundingSphereRadius ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -597,4 +597,4 @@ void GeometryInfo::xfer( Xfer *xfer ) void GeometryInfo::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/Common/System/Radar.cpp b/Generals/Code/GameEngine/Source/Common/System/Radar.cpp index e594fc1b471..e61684b85cb 100644 --- a/Generals/Code/GameEngine/Source/Common/System/Radar.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/Radar.cpp @@ -83,7 +83,7 @@ void Radar::deleteListResources( void ) // set head of the list to the next object m_localObjectList = nextObject; - } // end while + } // delete entries from the regular object list while( m_objectList ) @@ -101,7 +101,7 @@ void Radar::deleteListResources( void ) // set head of the list to the next object m_objectList = nextObject; - } // end while + } Object *obj; for( obj = TheGameLogic->getFirstObject(); obj; obj = obj->getNextObject() ) @@ -111,7 +111,7 @@ void Radar::deleteListResources( void ) } -} // end deleteListResources +} // PUBLIC METHODS ///////////////////////////////////////////////////////////////////////////////// //------------------------------------------------------------------------------------------------- @@ -156,7 +156,7 @@ Bool RadarObject::isTemporarilyHidden(const Object* obj) void RadarObject::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -185,17 +185,17 @@ void RadarObject::xfer( Xfer *xfer ) DEBUG_CRASH(( "RadarObject::xfer - Unable to find object for radar data" )); throw SC_INVALID_DATA; - } // end if + } // tell the object we now have some radar data m_object->friend_setRadarData( this ); - } // end if + } // color xfer->xferColor( &m_color ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -203,7 +203,7 @@ void RadarObject::xfer( Xfer *xfer ) void RadarObject::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -230,7 +230,7 @@ Radar::Radar( void ) // clear the radar events clearAllEvents(); -} // end Radar +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -240,7 +240,7 @@ Radar::~Radar( void ) // delete list resources deleteListResources(); -} // end ~Radar +} //------------------------------------------------------------------------------------------------- /** Clear all radar events */ @@ -274,9 +274,9 @@ void Radar::clearAllEvents( void ) m_event[ i ].radarLoc.y = 0; m_event[ i ].soundPlayed = FALSE; - } // end for i + } -} // end clearAllEvents +} //------------------------------------------------------------------------------------------------- /** Reset radar data */ @@ -293,7 +293,7 @@ void Radar::reset( void ) // stop forcing the radar on m_radarForceOn = false; -} // end reset +} //------------------------------------------------------------------------------------------------- /** Radar per frame update */ @@ -315,7 +315,7 @@ void Radar::update( void ) thisFrame > m_event[ i ].dieFrame ) m_event[ i ].active = FALSE; - } // end for i + } // see if we should refresh the terrain if( m_queueTerrainRefreshFrame != 0 && @@ -325,9 +325,9 @@ void Radar::update( void ) // refresh the terrain refreshTerrain( TheTerrainLogic ); - } // end if + } -} // end update +} //------------------------------------------------------------------------------------------------- /** Reset the radar for the new map data being given to it */ @@ -378,7 +378,7 @@ void Radar::newMap( TerrainLogic *terrain ) terrainSamples++; } - } // end for x + } // avoid divide by zeros if( terrainSamples == 0 ) @@ -390,7 +390,7 @@ void Radar::newMap( TerrainLogic *terrain ) m_terrainAverageZ = m_terrainAverageZ / INT_TO_REAL( terrainSamples ); m_waterAverageZ = m_waterAverageZ / INT_TO_REAL( waterSamples ); -} // end newMap +} //------------------------------------------------------------------------------------------------- /** Add an object to the radar list. The object will be sorted in the list to be grouped @@ -522,7 +522,7 @@ RadarObjectType Radar::addObject( Object *obj ) // the previous one next now points to the new entry prevObject->friend_setNext( newObj ); - } // end if + } else { @@ -532,29 +532,29 @@ RadarObjectType Radar::addObject( Object *obj ) // new list head is now newObj *list = newObj; - } // end else + } break; // exit for, stop the insert - } // end if + } else if( nextObject == NULL ) { // at the end of the list, put object here currObject->friend_setNext( newObj ); - } // end else if + } // our current object is now the previous object prevObject = currObject; prevPriority = currPriority; - } // end if + } - } // end else + } return objectType; -} // end addObject +} //------------------------------------------------------------------------------------------------- /** Try to delete an object from a specific list */ @@ -585,17 +585,17 @@ Bool Radar::deleteFromList( Object *obj, RadarObject **list ) // all done, object found and deleted return TRUE; - } // end if + } // save this object as previous one encountered in the list prevObject = radarObject; - } // end for, radarObject + } // object was not found in this list return FALSE; -} // end deleteFromList +} //------------------------------------------------------------------------------------------------- /** Remove an object from the radar, the object may reside in any list */ @@ -618,9 +618,9 @@ RadarObjectType Radar::removeObject( Object *obj ) DEBUG_ASSERTCRASH( 0, ("Radar: Tried to remove object '%s' which was not found", obj->getTemplate()->getName().str()) ); return RadarObjectType_None; - } // end else + } -} // end removeObject +} //------------------------------------------------------------------------------------------------- /** Translate a 2D spot on the radar (from (0,0) to (RADAR_CELL_WIDTH,RADAR_CELL_HEIGHT) @@ -672,7 +672,7 @@ Bool Radar::radarToWorld( const ICoord2D *radar, Coord3D *world ) return TRUE; // valid translation -} // end radarToWorld +} //------------------------------------------------------------------------------------------------- /** Translate a point in the world to the 2D radar (x,y) @@ -712,7 +712,7 @@ Bool Radar::worldToRadar( const Coord3D *world, ICoord2D *radar ) return TRUE; // valid translation -} // end worldToRadar +} // ------------------------------------------------------------------------------------------------ /** Translate an actual pixel location (relative pixel with (0,0) being the top left of @@ -764,7 +764,7 @@ Bool Radar::localPixelToRadar( const ICoord2D *pixel, ICoord2D *radar ) radar->y = (size.y - radar->y) * RADAR_CELL_HEIGHT / size.y; - } // end if + } else { @@ -780,11 +780,11 @@ Bool Radar::localPixelToRadar( const ICoord2D *pixel, ICoord2D *radar ) // radar->y = (size.y - pixel->y) * RADAR_CELL_HEIGHT / size.y; - } // end else + } return TRUE; -} // end localPixelToRadar +} // ------------------------------------------------------------------------------------------------ /** Translate a screen mouse position to world coords if the screen position is within @@ -816,7 +816,7 @@ Bool Radar::screenPixelToWorld( const ICoord2D *pixel, Coord3D *world ) // translate radar to world return radarToWorld( &radar, world ); -} // end screenPixelToWorld +} // ------------------------------------------------------------------------------------------------ /** Given the pixel coordinates, see if there is an object that is exactly in this @@ -852,7 +852,7 @@ Object *Radar::objectUnderRadarPixel( const ICoord2D *pixel ) // return the object found (if any) return obj; -} // end objectUnderRadarPixel +} // ------------------------------------------------------------------------------------------------ /** Search the object list for an object that maps to the given logical radar coords */ @@ -880,7 +880,7 @@ Object *Radar::searchListForRadarLocationMatch( RadarObject *listHead, ICoord2D DEBUG_CRASH(( "Radar::searchListForRadarLocationMatch - NULL object encountered in list" )); continue; - } // end if + } // convert object position to logical radar worldToRadar( obj->getPosition(), &radar ); @@ -892,12 +892,12 @@ Object *Radar::searchListForRadarLocationMatch( RadarObject *listHead, ICoord2D radar.y <= radarMatch->y + 1 ) return obj; - } // end for, radarObject + } // no match found return NULL; -} // end searchListForRadarLocationMatch +} // ------------------------------------------------------------------------------------------------ /** Given the RELATIVE SCREEN start X and Y, the width and height of the area to draw the whole @@ -954,7 +954,7 @@ void Radar::findDrawPositions( Int startX, Int startY, Int width, Int height, lr->x = width; lr->y = height - ul->y; - } // end if + } else if( m_mapExtent.height() > m_mapExtent.width() ) { @@ -975,7 +975,7 @@ void Radar::findDrawPositions( Int startX, Int startY, Int width, Int height, lr->x = width - ul->x; lr->y = height; - } // end else + } else { @@ -984,7 +984,7 @@ void Radar::findDrawPositions( Int startX, Int startY, Int width, Int height, lr->x = width; lr->y = height; - } // end else + } */ // make them pixel positions @@ -993,7 +993,7 @@ void Radar::findDrawPositions( Int startX, Int startY, Int width, Int height, lr->x += startX; lr->y += startY; -} // end findDrawPositions +} //------------------------------------------------------------------------------------------------- /** Radar color lookup table */ @@ -1043,9 +1043,9 @@ void Radar::createEvent( const Coord3D *world, RadarEventType type, Real seconds color[ 1 ] = radarColorLookupTable[ i ].color2; break; - } // end if + } - } // end while + } // check for no match found in color table if( radarColorLookupTable[ i ].event == RADAR_EVENT_INVALID ) @@ -1057,12 +1057,12 @@ void Radar::createEvent( const Coord3D *world, RadarEventType type, Real seconds color[ 0 ] = color1; color[ 1 ] = color2; - } // end if + } // call the internal method to create the event with these colors internalCreateEvent( world, type, secondsToLive, &color[ 0 ], &color[ 1 ] ); -} // end createEvent +} // ------------------------------------------------------------------------------------------------ /** Create radar event using a specific colors from the player */ @@ -1104,7 +1104,7 @@ void Radar::createPlayerEvent( Player *player, const Coord3D *world, // create the events using these colors internalCreateEvent( world, type, secondsToLive, &color[ 0 ], &color[ 1 ] ); -} // end createPlayerEvent +} //------------------------------------------------------------------------------------------------- /** Create a new radar event */ @@ -1146,7 +1146,7 @@ void Radar::internalCreateEvent( const Coord3D *world, RadarEventType type, Real if( m_nextFreeRadarEvent >= MAX_RADAR_EVENTS ) m_nextFreeRadarEvent = 0; -} // end createEvent +} //------------------------------------------------------------------------------------------------- /** Get the last event position, if any. @@ -1164,11 +1164,11 @@ Bool Radar::getLastEventLoc( Coord3D *eventPos ) *eventPos = m_event[ m_lastRadarEvent ].worldLoc; return TRUE; - } // end if + } return FALSE; // no last event -} // end getLastEventLoc +} // ------------------------------------------------------------------------------------------------ /** Try to create a radar event for "we're under attack". This will be called every time @@ -1222,7 +1222,7 @@ void Radar::tryUnderAttackEvent( const Object *obj ) unitAttackSound.setPlayerIndex(player->getPlayerIndex()); TheAudio->addAudioEvent( &unitAttackSound ); - } // end if + } else if( obj->isKindOf( KINDOF_STRUCTURE ) && obj->isKindOf( KINDOF_MP_COUNT_FOR_VICTORY ) ) { // play EVA. If its our object, play Base under attack. @@ -1239,7 +1239,7 @@ void Radar::tryUnderAttackEvent( const Object *obj ) structureAttackSound.setPlayerIndex(player->getPlayerIndex()); TheAudio->addAudioEvent( &structureAttackSound ); - } // end else if + } else { @@ -1251,11 +1251,11 @@ void Radar::tryUnderAttackEvent( const Object *obj ) underAttackSound.setPlayerIndex(player->getPlayerIndex()); TheAudio->addAudioEvent( &underAttackSound ); - } // end else + } - } // end if + } -} // end tryUnderAttackEvent +} // ------------------------------------------------------------------------------------------------ /** Try to create a radar event for "infiltration". @@ -1294,7 +1294,7 @@ void Radar::tryInfiltrationEvent( const Object *obj ) infiltrationWarningSound.setPlayerIndex(player->getPlayerIndex()); TheAudio->addAudioEvent( &infiltrationWarningSound ); -} // end tryInfiltrationEvent +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1332,11 +1332,11 @@ Bool Radar::tryEvent( RadarEventType event, const Coord3D *pos ) if( currentFrame - m_event[ i ].createFrame < framesBetweenEvents ) return FALSE; // reject it - } // end if + } - } // end if + } - } // end for i + } // if we got here then we want to create a new event createEvent( pos, event ); @@ -1344,7 +1344,7 @@ Bool Radar::tryEvent( RadarEventType event, const Coord3D *pos ) // return TRUE for successfully created event return TRUE; -} // end tryEvent +} // ------------------------------------------------------------------------------------------------ @@ -1355,7 +1355,7 @@ void Radar::refreshTerrain( TerrainLogic *terrain ) // no future queue is valid now m_queueTerrainRefreshFrame = 0; -} // end refreshTerrain +} // ------------------------------------------------------------------------------------------------ /** Queue a refresh of the radar terrain, we have this so that if there is code that @@ -1376,7 +1376,7 @@ void Radar::queueTerrainRefresh( void ) // m_queueTerrainRefreshFrame = TheGameLogic->getFrame(); -} // end queueTerrainRefresh +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -1384,7 +1384,7 @@ void Radar::queueTerrainRefresh( void ) void Radar::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer a radar object list given the head pointer as a parameter @@ -1420,9 +1420,9 @@ static void xferRadarObjectList( Xfer *xfer, RadarObject **head ) // save this object xfer->xferSnapshot( radarObject ); - } // end for, radarObject + } - } // end if, save + } else { @@ -1445,7 +1445,7 @@ static void xferRadarObjectList( Xfer *xfer, RadarObject **head ) DEBUG_CRASH(( "xferRadarObjectList - List head should be NULL, but isn't" )); throw SC_INVALID_DATA; #endif - } // end if + } // read each element for( UnsignedShort i = 0; i < count; ++i ) @@ -1463,21 +1463,21 @@ static void xferRadarObjectList( Xfer *xfer, RadarObject **head ) RadarObject *other; for( other = *head; other->friend_getNext() != NULL; other = other->friend_getNext() ) { - } // end for, other + } // set the end of the list to point to the new object other->friend_setNext( radarObject ); - } // end else + } // load the data xfer->xferSnapshot( radarObject ); - } // end for i + } - } // end else, load + } -} // end xferRadarObjectList +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -1515,7 +1515,7 @@ void Radar::xfer( Xfer *xfer ) eventCount, eventCountVerify )); throw SC_INVALID_DATA; - } // end if + } for( UnsignedShort i = 0; i < eventCount; ++i ) { @@ -1531,7 +1531,7 @@ void Radar::xfer( Xfer *xfer ) xfer->xferICoord2D( &m_event[ i ].radarLoc ); xfer->xferBool( &m_event[ i ].soundPlayed ); - } // end for i + } // next event index xfer->xferInt( &m_nextFreeRadarEvent ); @@ -1539,7 +1539,7 @@ void Radar::xfer( Xfer *xfer ) // last event index xfer->xferInt( &m_lastRadarEvent ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1553,7 +1553,7 @@ void Radar::loadPostProcess( void ) // refreshTerrain( TheTerrainLogic ); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ /** Is the priority type passed in a "visible" one that can show up on the radar */ @@ -1571,6 +1571,6 @@ Bool Radar::isPriorityVisible( RadarPriorityType priority ) default: return TRUE; - } // end switch + } -} // end isPriorityVisible +} diff --git a/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp b/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp index 67e274efd99..3c5d84a01e8 100644 --- a/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp @@ -89,14 +89,14 @@ SaveGameInfo::SaveGameInfo( void ) missionNumber = 0; saveFileType = SAVE_FILE_TYPE_NORMAL; -} // end SaveGameInfo +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ SaveGameInfo::~SaveGameInfo( void ) { -} // end ~SaveGameInfo +} // ------------------------------------------------------------------------------------------------ /** Is this date newer than the other one passed in? */ @@ -158,19 +158,19 @@ Bool SaveDate::isNewerThan( SaveDate *other ) else return FALSE; - } // end else + } - } // end else + } - } // end else + } - } // end else + } - } // end else + } - } // end else + } -} // end isNewerThan +} // ------------------------------------------------------------------------------------------------ /** Find a snapshot block info that matches the token passed in */ @@ -195,12 +195,12 @@ GameState::SnapshotBlock *GameState::findBlockInfoByToken( AsciiString token, Sn if( blockInfo->blockName == token ) return blockInfo; - } // end for + } // not found return NULL; -} // end findLexiconEntryByToken +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -279,7 +279,7 @@ GameState::GameState( void ) m_availableGames = NULL; m_isInLoadGame = FALSE; -} // end GameState +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -296,7 +296,7 @@ GameState::~GameState( void ) // clear any available game clearAvailableGames(); -} // end ~GameState +} // ------------------------------------------------------------------------------------------------ /** Init the game state subsystem */ @@ -333,7 +333,7 @@ void GameState::init( void ) m_isInLoadGame = FALSE; -} // end init +} // ------------------------------------------------------------------------------------------------ /** Reset */ @@ -349,7 +349,7 @@ void GameState::reset( void ) m_isInLoadGame = FALSE; -} // end reset +} // ------------------------------------------------------------------------------------------------ /** Clear any available games entries */ @@ -365,9 +365,9 @@ void GameState::clearAvailableGames( void ) delete m_availableGames; m_availableGames = gameInfo; - } // end while + } -} // end clearAvailableGames +} // ------------------------------------------------------------------------------------------------ /** Add a snapshot and block name pair to the systems used to load and save */ @@ -382,7 +382,7 @@ void GameState::addSnapshotBlock( AsciiString blockName, Snapshot *snapshot, Sna DEBUG_CRASH(( "addSnapshotBlock: Invalid parameters" )); return; - } // end if + } // add to the list SnapshotBlock blockInfo; @@ -390,7 +390,7 @@ void GameState::addSnapshotBlock( AsciiString blockName, Snapshot *snapshot, Sna blockInfo.blockName = blockName; m_snapshotBlockList[which].push_back( blockInfo ); -} // end addSnapshotBlock +} // ------------------------------------------------------------------------------------------------ /** Given the filename of a save file, find the highest filename number */ @@ -426,7 +426,7 @@ static void findHighFileNumber( AsciiString filename, void *userData ) if( fileNumber >= *highFileNumber ) *highFileNumber = fileNumber; -} // end findHighFileNumber +} // ------------------------------------------------------------------------------------------------ /** Given the save files on disk, find the "next" filename to use when saving a game */ @@ -485,7 +485,7 @@ AsciiString GameState::findNextSaveFilename( UnicodeString desc ) filename.format( "%08d%s", highFileNumber + 1, SAVE_GAME_EXTENSION ); return filename; - } // end if + } else if( searchType == LOWEST_NUMBER ) { AsciiString filename; @@ -512,22 +512,22 @@ AsciiString GameState::findNextSaveFilename( UnicodeString desc ) if( i > MAX_SAVE_FILE_NUMBER ) return AsciiString::TheEmptyString; - } // end while + } - } // end else if + } else { DEBUG_CRASH(( "GameState::findNextSaveFilename - Unknown file search type '%d'", searchType )); return AsciiString::TheEmptyString; - } // end else + } #endif // no appropriate filename could be found, return the empty string return AsciiString::TheEmptyString; -} // end findNextSaveFilename +} // ------------------------------------------------------------------------------------------------ /** Save the current state of the engine in a save file @@ -546,7 +546,7 @@ SaveCode GameState::saveGame( AsciiString filename, UnicodeString desc, DEBUG_CRASH(( "GameState::saveGame - Unable to find valid filename for save game" )); return SC_NO_FILE_AVAILABLE; - } // end if + } // make absolutely sure the save directory exists CreateDirectory( getSaveDirectory().str(), NULL ); @@ -589,7 +589,7 @@ SaveCode GameState::saveGame( AsciiString filename, UnicodeString desc, // save file xferSaveData( &xferSave, which ); - } // end try + } catch( ... ) { @@ -605,7 +605,7 @@ SaveCode GameState::saveGame( AsciiString filename, UnicodeString desc, xferSave.close(); return SC_ERROR; - } // end catch + } // close the file xferSave.close(); @@ -616,7 +616,7 @@ SaveCode GameState::saveGame( AsciiString filename, UnicodeString desc, return SC_OK; -} // end saveGame +} // ------------------------------------------------------------------------------------------------ /** A mission save */ @@ -638,7 +638,7 @@ SaveCode GameState::missionSave( void ) // do an automatic mission save return TheGameState->saveGame( AsciiString(""), desc, SAVE_FILE_TYPE_MISSION ); -} // end missionSave +} // ------------------------------------------------------------------------------------------------ /** Load the save game pointed to by filename */ @@ -657,7 +657,7 @@ SaveCode GameState::loadGame( AvailableGameInfo gameInfo ) if (TheGameLogic->isInGame()) TheGameLogic->clearGameData( FALSE ); - } // end if + } // // clear the save directory of any temporary "scratch pad" maps that were extracted @@ -688,11 +688,11 @@ SaveCode GameState::loadGame( AvailableGameInfo gameInfo ) // load file xferSaveData( &xferLoad, SNAPSHOT_SAVELOAD ); - } // end try + } catch( ... ) { error = TRUE; - } // end catch + } // close the file xferLoad.close(); @@ -729,7 +729,7 @@ SaveCode GameState::loadGame( AvailableGameInfo gameInfo ) return SC_INVALID_DATA; // you can't use a naked "throw" outside of a catch statement! - } // end if + } // // when loading a mission save, we want to do as much normal loading stuff as we @@ -752,11 +752,11 @@ SaveCode GameState::loadGame( AvailableGameInfo gameInfo ) gameInfo->saveFileType = SAVE_FILE_TYPE_NORMAL; gameInfo->missionMapName.clear(); - } // end if + } return SC_OK; -} // end loadGame +} //------------------------------------------------------------------------------------------------- AsciiString GameState::getSaveDirectory() const @@ -955,21 +955,21 @@ Bool GameState::doesSaveGameExist( AsciiString filename ) // try to open it xfer.open( filepath ); - } // end try + } catch( ... ) { // unable to open file, it must not be here return FALSE; - } // end catch + } // close the file, we don't want to to anything with it right now xfer.close(); return TRUE; -} // doesSaveGameExist +} // ------------------------------------------------------------------------------------------------ /** Get save game info from the filename specified */ @@ -988,7 +988,7 @@ void GameState::getSaveGameInfoFromFile( AsciiString filename, SaveGameInfo *sav DEBUG_CRASH(( "GameState::getSaveGameInfoFromFile - Illegal parameters" )); return; - } // end if + } // open file for partial loading XferLoad xferLoad; @@ -1015,7 +1015,7 @@ void GameState::getSaveGameInfoFromFile( AsciiString filename, SaveGameInfo *sav DEBUG_CRASH(( "GameState::getSaveGameInfoFromFile - Game info not found in file '%s'", filename.str() )); done = TRUE; - } // end if + } else { @@ -1039,7 +1039,7 @@ void GameState::getSaveGameInfoFromFile( AsciiString filename, SaveGameInfo *sav // load data xferLoad.xferSnapshot( &tempGameState ); - } // end try + } catch( ... ) { @@ -1047,7 +1047,7 @@ void GameState::getSaveGameInfoFromFile( AsciiString filename, SaveGameInfo *sav blockInfo->blockName.str(), filename.str() )); throw; - } // end catch + } // data was found, copy game state info over *saveGameInfo = *tempGameState.getSaveGameInfo(); @@ -1055,7 +1055,7 @@ void GameState::getSaveGameInfoFromFile( AsciiString filename, SaveGameInfo *sav // we're all done with this file now done = TRUE; - } // end if + } else { @@ -1065,16 +1065,16 @@ void GameState::getSaveGameInfoFromFile( AsciiString filename, SaveGameInfo *sav // end of block xferLoad.endBlock(); - } // end else + } - } // end else, valid data block token + } - } // end while, not done + } // close the file xferLoad.close(); -} // end getSaveGameInfoFromFile +} // ------------------------------------------------------------------------------------------------ /** Create game info and add to available list */ @@ -1129,9 +1129,9 @@ static void addGameToAvailableList( AsciiString filename, void *userData ) break; - } // end if + } - } // end for + } // if not inserted, put at end if( curr == NULL ) @@ -1140,15 +1140,15 @@ static void addGameToAvailableList( AsciiString filename, void *userData ) prev->next = newInfo; newInfo->prev = prev; - } // end if + } - } // end else + } } catch(...) { // Do nothing - just return. } -} // end addGameToAvailableList +} // ------------------------------------------------------------------------------------------------ /** Populate the listbox passed in with a list of the save games present on the hard drive */ @@ -1173,7 +1173,7 @@ void GameState::populateSaveGameListbox( GameWindow *listbox, SaveLoadLayoutType index = GadgetListBoxAddEntryText( listbox, newGameText, newGameColor, -1 ); GadgetListBoxSetItemData( listbox, NULL, index ); - } // end if + } // clear the available games clearAvailableGames(); @@ -1218,7 +1218,7 @@ void GameState::populateSaveGameListbox( GameWindow *listbox, SaveLoadLayoutType if( exists == FALSE ) displayLabel.format( L"%S", saveGameInfo->mapLabel.str() ); - } // end if + } // pick color for text (we alternate it each game) Color color; @@ -1237,12 +1237,12 @@ void GameState::populateSaveGameListbox( GameWindow *listbox, SaveLoadLayoutType // add this available game info in the user data pointer of that listbox item GadgetListBoxSetItemData( listbox, info, index ); - } // end for, info + } // select the top "new game" entry GadgetListBoxSetSelected( listbox, 0 ); -} // end pupulateSaveGameListbox +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE METHODS //////////////////////////////////////////////////////////////////////////////// @@ -1285,7 +1285,7 @@ void GameState::iterateSaveFiles( IterateSaveFileCallback callback, void *userDa // we are no longer on our first item first = FALSE; - } // end if, first + } // see if this is a file, and therefore a possible save file if( !(item.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ) @@ -1303,15 +1303,15 @@ void GameState::iterateSaveFiles( IterateSaveFileCallback callback, void *userDa // call the callback callback( filename, userData ); - } // end if, a save file + } - } // end if + } // on to the next file if( FindNextFile( hFile, &item ) == 0 ) done = TRUE; - } // end while + } // close search resources FindClose( hFile ); @@ -1319,7 +1319,7 @@ void GameState::iterateSaveFiles( IterateSaveFileCallback callback, void *userDa // restore the current directory SetCurrentDirectory( currentDirectory ); -} // end iterateSaveFiles +} // ------------------------------------------------------------------------------------------------ /** Save game to xfer or load game using xfer */ @@ -1391,7 +1391,7 @@ void GameState::xferSaveData( Xfer *xfer, SnapshotType which ) // end this block xfer->endBlock(); - } // end try + } catch( ... ) { @@ -1399,17 +1399,17 @@ void GameState::xferSaveData( Xfer *xfer, SnapshotType which ) blockName.str(), xfer->getIdentifier().str() )); throw; - } // end catch + } - } // end if + } - } // end for, all snapshots + } // write an end of file token AsciiString eofToken = SAVE_FILE_EOF; xfer->xferAsciiString( &eofToken ); - } // end if, save + } else { DEBUG_LOG(("GameState::xferSaveData() - not XFER_SAVE")); @@ -1432,7 +1432,7 @@ void GameState::xferSaveData( Xfer *xfer, SnapshotType which ) // all done done = TRUE; - } // end if + } else { @@ -1454,7 +1454,7 @@ void GameState::xferSaveData( Xfer *xfer, SnapshotType which ) // continue with while loop reading block tokens continue; - } // end if + } try { @@ -1468,7 +1468,7 @@ void GameState::xferSaveData( Xfer *xfer, SnapshotType which ) // read block end xfer->endBlock(); - } // end try + } catch( ... ) { @@ -1476,15 +1476,15 @@ void GameState::xferSaveData( Xfer *xfer, SnapshotType which ) blockInfo->blockName.str(), xfer->getIdentifier().str() )); throw; - } // end catch + } - } // end else, valid data block token + } - } // end while, not done + } - } // end else, load + } -} // end xferSaveData +} // ------------------------------------------------------------------------------------------------ /** Add a snapshot to the post process list for later */ @@ -1499,7 +1499,7 @@ void GameState::addPostProcessSnapshot( Snapshot *snapshot ) DEBUG_CRASH(( "GameState::addPostProcessSnapshot - invalid parameters" )); return; - } // end if + } /* // @@ -1518,15 +1518,15 @@ void GameState::addPostProcessSnapshot( Snapshot *snapshot ) DEBUG_CRASH(( "GameState::addPostProcessSnapshot - snapshot is already in list!" )); return; - } // end if + } - } // end for, it + } */ // add to the list m_snapshotPostProcessList.push_back( snapshot ); -} // end addPostProcessSnapshot +} // ------------------------------------------------------------------------------------------------ /** Post process entry point after all game data has been xferd from disk */ @@ -1549,7 +1549,7 @@ void GameState::gameStatePostProcessLoad( void ) // do processing snapshot->loadPostProcess(); - } // end for + } // clear the snapshot post process list as we are now done with it m_snapshotPostProcessList.clear(); @@ -1557,7 +1557,7 @@ void GameState::gameStatePostProcessLoad( void ) // evil... must ensure this is updated prior to the script engine running the first time. ThePartitionManager->update(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ /** Xfer method for the game state itself @@ -1586,7 +1586,7 @@ void GameState::xfer( Xfer *xfer ) // mission map name xfer->xferAsciiString( &saveGameInfo->missionMapName ); - } // end if + } // current system time SYSTEMTIME systemTime; @@ -1633,9 +1633,9 @@ void GameState::xfer( Xfer *xfer ) p++; // skip the '\' we're on saveGameInfo->mapLabel.set( p ); - } // end else + } - } // end if + } // xfer map label xfer->xferAsciiString( &saveGameInfo->mapLabel ); @@ -1654,7 +1654,7 @@ void GameState::xfer( Xfer *xfer ) xfer->xferInt( &saveGameInfo->missionNumber ); - } // end if + } else { @@ -1666,6 +1666,6 @@ void GameState::xfer( Xfer *xfer ) saveGameInfo->missionNumber = CampaignManager::INVALID_MISSION_NUMBER; xfer->xferInt( &saveGameInfo->missionNumber ); - } // end else + } -} // end xfer +} diff --git a/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp b/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp index 25be84d896b..604cd46a4ad 100644 --- a/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp @@ -51,7 +51,7 @@ GameStateMap *TheGameStateMap = NULL; GameStateMap::GameStateMap( void ) { -} // end GameStateMap +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -64,7 +64,7 @@ GameStateMap::~GameStateMap( void ) // clearScratchPadMaps(); -} // end ~GameStateMap +} // ------------------------------------------------------------------------------------------------ /** Embed the pristine map into the xfer stream */ @@ -80,7 +80,7 @@ static void embedPristineMap( AsciiString map, Xfer *xfer ) DEBUG_CRASH(( "embedPristineMap - Error opening source file '%s'", map.str() )); throw SC_INVALID_DATA; - } // end if + } // how big is the map file Int fileSize = file->seek( 0, File::END ); @@ -96,7 +96,7 @@ static void embedPristineMap( AsciiString map, Xfer *xfer ) DEBUG_CRASH(( "embedPristineMap - Unable to allocate buffer for file '%s'", map.str() )); throw SC_INVALID_DATA; - } // end if + } // copy the file to the buffer if( file->read( buffer, fileSize ) != fileSize ) @@ -105,7 +105,7 @@ static void embedPristineMap( AsciiString map, Xfer *xfer ) DEBUG_CRASH(( "embeddPristineMap - Error reading from file '%s'", map.str() )); throw SC_INVALID_DATA; - } // end if + } // close the BIG file file->close(); @@ -119,7 +119,7 @@ static void embedPristineMap( AsciiString map, Xfer *xfer ) // delete the buffer delete [] buffer; -} // end embedPristineMap +} // ------------------------------------------------------------------------------------------------ /** Embed an "in use" map into the xfer stream. An "in use" map is one that has already @@ -136,7 +136,7 @@ static void embedInUseMap( AsciiString map, Xfer *xfer ) DEBUG_CRASH(( "embedInUseMap - Unable to open file '%s'", map.str() )); throw SC_INVALID_DATA; - } // end if + } // how big is the file fseek( fp, 0, SEEK_END ); @@ -153,7 +153,7 @@ static void embedInUseMap( AsciiString map, Xfer *xfer ) DEBUG_CRASH(( "embedInUseMap - Unable to allocate buffer for file '%s'", map.str() )); throw SC_INVALID_DATA; - } // end if + } // read the entire file if( fread( buffer, 1, fileSize, fp ) != fileSize ) @@ -162,7 +162,7 @@ static void embedInUseMap( AsciiString map, Xfer *xfer ) DEBUG_CRASH(( "embedInUseMap - Error reading from file '%s'", map.str() )); throw SC_INVALID_DATA; - } // end if + } // embed file into xfer stream xfer->beginBlock(); @@ -175,7 +175,7 @@ static void embedInUseMap( AsciiString map, Xfer *xfer ) // delete buffer delete [] buffer; -} // embedInUseMap +} // ------------------------------------------------------------------------------------------------ /** Extract the map from the xfer stream and save as a file with filename 'mapToSave' */ @@ -192,7 +192,7 @@ static void extractAndSaveMap( AsciiString mapToSave, Xfer *xfer ) DEBUG_CRASH(( "extractAndSaveMap - Unable to open file '%s'", mapToSave.str() )); throw SC_INVALID_DATA; - } // en + } // read data size from file dataSize = xfer->beginBlock(); @@ -205,7 +205,7 @@ static void extractAndSaveMap( AsciiString mapToSave, Xfer *xfer ) DEBUG_CRASH(( "extractAndSaveMap - Unable to allocate buffer for file '%s'", mapToSave.str() )); throw SC_INVALID_DATA; - } // end if + } // read map file xfer->xferUser( buffer, dataSize ); @@ -217,7 +217,7 @@ static void extractAndSaveMap( AsciiString mapToSave, Xfer *xfer ) DEBUG_CRASH(( "extractAndSaveMap - Error writing to file '%s'", mapToSave.str() )); throw SC_INVALID_DATA; - } // end if + } // close the new file fclose( fp ); @@ -228,7 +228,7 @@ static void extractAndSaveMap( AsciiString mapToSave, Xfer *xfer ) // delete the buffer delete [] buffer; -} // end extractAndSaveMap +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -292,7 +292,7 @@ void GameStateMap::xfer( Xfer *xfer ) // firstSave = TRUE; - } // end if + } // save the pristine name // For cross-machine compatibility, we always write @@ -309,7 +309,7 @@ void GameStateMap::xfer( Xfer *xfer ) xfer->xferInt( &gameMode); } - } // end if, save + } else { @@ -341,7 +341,7 @@ void GameStateMap::xfer( Xfer *xfer ) TheGameLogic->setGameMode((GameMode)gameMode); } - } // end else, load + } // map data if( xfer->getXferMode() == XFER_SAVE ) @@ -356,7 +356,7 @@ void GameStateMap::xfer( Xfer *xfer ) embedPristineMap( saveGameInfo->pristineMapName, xfer ); - } // end if, first save + } else { @@ -367,9 +367,9 @@ void GameStateMap::xfer( Xfer *xfer ) // embedInUseMap( saveGameInfo->saveGameMapName, xfer ); - } // end else + } - } // end if, save + } else { @@ -379,7 +379,7 @@ void GameStateMap::xfer( Xfer *xfer ) // extractAndSaveMap( saveGameInfo->saveGameMapName, xfer ); - } // end else + } // // it's important that early in the load process, we xfer the object ID counter @@ -429,7 +429,7 @@ void GameStateMap::xfer( Xfer *xfer ) TheGameLogic->startNewGame( TRUE ); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Delete any scratch pad maps in the save directory. Scratch pad maps are maps that @@ -471,7 +471,7 @@ void GameStateMap::clearScratchPadMaps( void ) // we are no longer on our first item first = FALSE; - } // end if, first + } // see if this is a file, and therefore a possible .map file if( !(item.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ) @@ -482,7 +482,7 @@ void GameStateMap::clearScratchPadMaps( void ) if( c && stricmp( c, ".map" ) == 0 ) fileToDelete.set( item.cFileName ); // we want to delete this one - } // end if + } // // find the next file before we delete this one, this is probably not necessary @@ -496,7 +496,7 @@ void GameStateMap::clearScratchPadMaps( void ) if( fileToDelete.isEmpty() == FALSE ) DeleteFile( fileToDelete.str() ); - } // end while + } // close search resources FindClose( hFile ); @@ -504,4 +504,4 @@ void GameStateMap::clearScratchPadMaps( void ) // restore our directory to the current directory SetCurrentDirectory( currentDirectory ); -} // end clearScratchPadMaps +} diff --git a/Generals/Code/GameEngine/Source/Common/System/Snapshot.cpp b/Generals/Code/GameEngine/Source/Common/System/Snapshot.cpp index 604d2a9b65b..7d773de34f2 100644 --- a/Generals/Code/GameEngine/Source/Common/System/Snapshot.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/Snapshot.cpp @@ -37,7 +37,7 @@ Snapshot::Snapshot( void ) { -} // end Snapshot +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -53,4 +53,4 @@ Snapshot::~Snapshot( void ) // // TheGameState->notifySnapshotDeleted(); -} // end ~Snapshot +} diff --git a/Generals/Code/GameEngine/Source/Common/System/Upgrade.cpp b/Generals/Code/GameEngine/Source/Common/System/Upgrade.cpp index 2c9b273bc4c..9b911c04524 100644 --- a/Generals/Code/GameEngine/Source/Common/System/Upgrade.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/Upgrade.cpp @@ -63,14 +63,14 @@ Upgrade::Upgrade( const UpgradeTemplate *upgradeTemplate ) m_next = NULL; m_prev = NULL; -} // end Upgrade +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- Upgrade::~Upgrade( void ) { -} // end ~Upgrade +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -78,7 +78,7 @@ Upgrade::~Upgrade( void ) void Upgrade::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -96,7 +96,7 @@ void Upgrade::xfer( Xfer *xfer ) // status xfer->xferUser( &m_status, sizeof( UpgradeStatusType ) ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -104,7 +104,7 @@ void Upgrade::xfer( Xfer *xfer ) void Upgrade::loadPostProcess( void ) { -} // end loadPostProcess +} /////////////////////////////////////////////////////////////////////////////////////////////////// // UPGRADE TEMPLATE /////////////////////////////////////////////////////////////////////////////// @@ -141,14 +141,14 @@ UpgradeTemplate::UpgradeTemplate( void ) m_prev = NULL; m_buttonImage = NULL; -} // end UpgradeTemplate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- UpgradeTemplate::~UpgradeTemplate( void ) { -} // end ~UpgradeTemplate +} //------------------------------------------------------------------------------------------------- /** Calculate the time it takes (in logic frames) for a player to build this UpgradeTemplate */ @@ -165,7 +165,7 @@ Int UpgradeTemplate::calcTimeToBuild( Player *player ) const ///@todo modify this by power state of player return m_buildTime * LOGICFRAMES_PER_SECOND; -} // end calcTimeToBuild +} //------------------------------------------------------------------------------------------------- /** Calculate the cost takes this player to build this upgrade */ @@ -176,7 +176,7 @@ Int UpgradeTemplate::calcCostToBuild( Player *player ) const ///@todo modify this by any player handicaps return m_cost; -} // end calcCostToBuild +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -228,7 +228,7 @@ UpgradeCenter::UpgradeCenter( void ) m_nextTemplateMaskBit = 0; buttonImagesCached = FALSE; -} // end UpgradeCenter +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -249,9 +249,9 @@ UpgradeCenter::~UpgradeCenter( void ) // set head to next element m_upgradeList = next; - } // end while + } -} // end ~UpgradeCenter +} //------------------------------------------------------------------------------------------------- /** Upgrade center initialization */ @@ -327,7 +327,7 @@ UpgradeTemplate *UpgradeCenter::firstUpgradeTemplate( void ) return m_upgradeList; -} // end firstUpgradeTemplate +} //------------------------------------------------------------------------------------------------- /** Find upgrade matching name key */ @@ -353,7 +353,7 @@ const UpgradeTemplate *UpgradeCenter::findUpgrade( const AsciiString& name ) con return findUpgradeByKey( TheNameKeyGenerator->nameToKey( name ) ); -} // end findUpgrade +} //------------------------------------------------------------------------------------------------- /** Allocate a new upgrade template */ @@ -386,7 +386,7 @@ UpgradeTemplate *UpgradeCenter::newUpgrade( const AsciiString& name ) // return new upgrade return newUpgrade; -} // end newUnlinkedUpgrade +} //------------------------------------------------------------------------------------------------- /** Link an upgrade to our list */ @@ -405,7 +405,7 @@ void UpgradeCenter::linkUpgrade( UpgradeTemplate *upgrade ) m_upgradeList->friend_setPrev( upgrade ); m_upgradeList = upgrade; -} // end linkUpgrade +} //------------------------------------------------------------------------------------------------- /** Unlink an upgrade from our list */ @@ -424,7 +424,7 @@ void UpgradeCenter::unlinkUpgrade( UpgradeTemplate *upgrade ) else m_upgradeList = upgrade->friend_getNext(); -} // end unlinkUpgrade +} //------------------------------------------------------------------------------------------------- /** does this player have all the necessary things to make this upgrade */ @@ -452,7 +452,7 @@ Bool UpgradeCenter::canAffordUpgrade( Player *player, const UpgradeTemplate *upg return TRUE; // all is well -} // end canAffordUpgrade +} //------------------------------------------------------------------------------------------------- /** generate a list of upgrade names for WorldBuilder */ @@ -466,7 +466,7 @@ std::vector UpgradeCenter::getUpgradeNames( void ) const return upgradeNames; -} // end getUpgradeNames +} //------------------------------------------------------------------------------------------------- /** Parse an upgrade definition */ @@ -485,7 +485,7 @@ void UpgradeCenter::parseUpgradeDefinition( INI *ini ) // allocate a new item upgrade = TheUpgradeCenter->newUpgrade( name ); - } // end if + } // sanity DEBUG_ASSERTCRASH( upgrade, ("parseUpgradeDefinition: Unable to allocate upgrade '%s'", name.str()) ); diff --git a/Generals/Code/GameEngine/Source/Common/TerrainTypes.cpp b/Generals/Code/GameEngine/Source/Common/TerrainTypes.cpp index 305f8ea9b5c..30d987f5215 100644 --- a/Generals/Code/GameEngine/Source/Common/TerrainTypes.cpp +++ b/Generals/Code/GameEngine/Source/Common/TerrainTypes.cpp @@ -63,14 +63,14 @@ TerrainType::TerrainType( void ) m_restrictConstruction = FALSE; m_next = NULL; -} // end TerrainType +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- TerrainType::~TerrainType( void ) { -} // end ~TerrainType +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -83,7 +83,7 @@ TerrainTypeCollection::TerrainTypeCollection( void ) m_terrainList = NULL; -} // end TerrainTypeCollection +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -104,9 +104,9 @@ TerrainTypeCollection::~TerrainTypeCollection( void ) // set the new head of the type list m_terrainList = temp; - } // end while + } -} // end ~TerrainTypeCollection +} //------------------------------------------------------------------------------------------------- /** Find a terrain type given the name */ @@ -121,12 +121,12 @@ TerrainType *TerrainTypeCollection::findTerrain( AsciiString name ) if( terrain->getName() == name ) return terrain; - } // end for terrain + } // not found return NULL; -} // end findTerrain +} //------------------------------------------------------------------------------------------------- /** Allocate a new type, assign the name, and tie to type list */ @@ -149,7 +149,7 @@ TerrainType *TerrainTypeCollection::newTerrain( AsciiString name ) terrain->friend_setClass( defaultTerrain->getClass() ); terrain->friend_setBlendEdge( defaultTerrain->isBlendEdge() ); - } // end if + } */ // assign a name @@ -162,4 +162,4 @@ TerrainType *TerrainTypeCollection::newTerrain( AsciiString name ) // return the new terrain return terrain; -} // end newTerrain +} diff --git a/Generals/Code/GameEngine/Source/Common/Thing/DrawModule.cpp b/Generals/Code/GameEngine/Source/Common/Thing/DrawModule.cpp index 5e891487cc1..d0a99381086 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/DrawModule.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/DrawModule.cpp @@ -42,7 +42,7 @@ void DrawModule::crc( Xfer *xfer ) // extend base class DrawableModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -60,7 +60,7 @@ void DrawModule::xfer( Xfer *xfer ) // extend base class DrawableModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -71,5 +71,5 @@ void DrawModule::loadPostProcess( void ) // extend base class DrawableModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/Common/Thing/Module.cpp b/Generals/Code/GameEngine/Source/Common/Thing/Module.cpp index 652ac5aae7e..2b421987582 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/Module.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/Module.cpp @@ -69,7 +69,7 @@ Module::~Module() { -} // end ~Module +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -77,7 +77,7 @@ Module::~Module() void Module::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -92,7 +92,7 @@ void Module::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** load post process */ @@ -100,7 +100,7 @@ void Module::xfer( Xfer *xfer ) void Module::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -116,14 +116,14 @@ ObjectModule::ObjectModule( Thing *thing, const ModuleData* moduleData ) : Modul m_object = AsObject(thing); DEBUG_ASSERTCRASH( m_object, ("Thing passed to ObjectModule is not an Object!") ); -} // end ObjectModule +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- ObjectModule::~ObjectModule( void ) { -} // end ~ObjectModule +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -134,7 +134,7 @@ void ObjectModule::crc( Xfer *xfer ) // extend base class Module::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -152,7 +152,7 @@ void ObjectModule::xfer( Xfer *xfer ) // extend base class Module::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** load post process */ @@ -163,7 +163,7 @@ void ObjectModule::loadPostProcess( void ) // extend base class Module::loadPostProcess(); -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -179,14 +179,14 @@ DrawableModule::DrawableModule( Thing *thing, const ModuleData* moduleData ) : M m_drawable = AsDrawable(thing); DEBUG_ASSERTCRASH( m_drawable, ("Thing passed to DrawableModule is not a Drawable!") ); -} // end ~DrawableModule +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- DrawableModule::~DrawableModule( void ) { -} // end ~DrawableModule +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -197,7 +197,7 @@ void DrawableModule::crc( Xfer *xfer ) // extend base class Module::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -215,7 +215,7 @@ void DrawableModule::xfer( Xfer *xfer ) // extend base class Module::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** load post process */ @@ -226,7 +226,7 @@ void DrawableModule::loadPostProcess( void ) // extend base class Module::loadPostProcess(); -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp b/Generals/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp index 7504e206edb..0ce02a579fe 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp @@ -504,7 +504,7 @@ void ModuleFactory::init( void ) addModule( SwayClientUpdate ); addModule( BeaconClientUpdate ); -} // end init +} //------------------------------------------------------------------------------------------------- Int ModuleFactory::findModuleInterfaceMask(const AsciiString& name, ModuleType type) @@ -627,7 +627,7 @@ Module *ModuleFactory::newModule( Thing *thing, const AsciiString& name, const M return NULL; -} // end newModule +} //------------------------------------------------------------------------------------------------- /** Add a module template to our list of templates */ diff --git a/Generals/Code/GameEngine/Source/Common/Thing/Thing.cpp b/Generals/Code/GameEngine/Source/Common/Thing/Thing.cpp index 5e4415f5e86..9fbf11acf56 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/Thing.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/Thing.cpp @@ -60,7 +60,7 @@ Thing::Thing( const ThingTemplate *thingTemplate ) DEBUG_CRASH(( "no template" )); return; - } // end if + } m_template = thingTemplate; #if defined(RTS_DEBUG) @@ -384,4 +384,4 @@ void Thing::transformPoint( const Coord3D *in, Coord3D *out ) out->y = vectorOut.Y; out->z = vectorOut.Z; -} // end transformPoint +} diff --git a/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp b/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp index f375a63c510..5b90ed07ad6 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp @@ -74,7 +74,7 @@ void ThingFactory::freeDatabase( void ) m_templateHashMap.clear(); -} // end freeDatabase +} //------------------------------------------------------------------------------------------------- /** add the thing template passed in, into the databse */ @@ -93,7 +93,7 @@ void ThingFactory::addTemplate( ThingTemplate *tmplate ) // Add it to the hash table. m_templateHashMap[tmplate->getName()] = tmplate; -} // end addTemplate +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC METHODS @@ -111,7 +111,7 @@ ThingFactory::ThingFactory() #else m_templateHashMap.reserve( TEMPLATE_HASH_SIZE ); #endif -} // end ThingFactory +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -121,7 +121,7 @@ ThingFactory::~ThingFactory() // free all the template data freeDatabase(); -} // end ~ThingFactory +} //------------------------------------------------------------------------------------------------- /** Create a new template with name 'name' and add to our template list */ @@ -142,7 +142,7 @@ ThingTemplate *ThingFactory::newTemplate( const AsciiString& name ) *newTemplate = *defaultT; newTemplate->setCopiedFromDefault(); - } // end if + } // give template a unique identifier newTemplate->friend_setTemplateID( m_nextTemplateID++ ); @@ -192,7 +192,7 @@ ThingTemplate* ThingFactory::newOverride( ThingTemplate *thingTemplate ) // return the newly created override for us to set values with etc return newTemplate; -} // end newOverride +} //------------------------------------------------------------------------------------------------- /** Init */ @@ -200,7 +200,7 @@ ThingTemplate* ThingFactory::newOverride( ThingTemplate *thingTemplate ) void ThingFactory::init( void ) { -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset */ @@ -238,7 +238,7 @@ void ThingFactory::reset( void ) t = nextT; } -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update */ @@ -246,7 +246,7 @@ void ThingFactory::reset( void ) void ThingFactory::update( void ) { -} // end update +} //------------------------------------------------------------------------------------------------- /** Return the template with the matching database name */ @@ -295,7 +295,7 @@ ThingTemplate *ThingFactory::findTemplateInternal( const AsciiString& name ) //DEBUG_LOG(("*** Object template %s not found",name.str())); return NULL; -} // end getTemplate +} //============================================================================= Object *ThingFactory::newObject( const ThingTemplate *tmplate, Team *team, ObjectStatusMaskType statusBits ) @@ -356,7 +356,7 @@ Drawable *ThingFactory::newDrawable(const ThingTemplate *tmplate, DrawableStatus return draw; -} // end newDrawableByType +} #if defined(RTS_DEBUG) || defined(DEBUG_CRASHING) AsciiString TheThingTemplateBeingParsedName; @@ -532,10 +532,10 @@ void ThingFactory::postProcessLoad() } #endif - } // end for + } #ifdef CHECK_THING_NAMES dumpMissingStringNames(); exit(0); #endif -} // end postProcess +} diff --git a/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp b/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp index 60b96d8378b..bf6d7bab9fe 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp @@ -277,7 +277,7 @@ const ModuleInfo::Nugget *ModuleInfo::getNuggetWithTag( const AsciiString& tag ) // no match return NULL; -} // end isTagPresent +} // ------------------------------------------------------------------------------------------------ /** Add this module info to the thing template */ @@ -314,7 +314,7 @@ void ModuleInfo::addModuleInfo(ThingTemplate *thingTemplate, // srj sez: prevent people from ignoring this. throw INI_INVALID_DATA; - } // end if + } nugget = thingTemplate->getDrawModuleInfo().getNuggetWithTag( moduleTag ); if( nugget != NULL ) @@ -332,7 +332,7 @@ void ModuleInfo::addModuleInfo(ThingTemplate *thingTemplate, // srj sez: prevent people from ignoring this. throw INI_INVALID_DATA; - } // end if + } nugget = thingTemplate->getClientUpdateModuleInfo().getNuggetWithTag( moduleTag ); if( nugget != NULL ) @@ -349,7 +349,7 @@ void ModuleInfo::addModuleInfo(ThingTemplate *thingTemplate, nugget->first.str()) ); // srj sez: prevent people from ignoring this. throw INI_INVALID_DATA; - } // end if + } #endif diff --git a/Generals/Code/GameEngine/Source/Common/UserPreferences.cpp b/Generals/Code/GameEngine/Source/Common/UserPreferences.cpp index 2cf530e6cd0..e975b44632e 100644 --- a/Generals/Code/GameEngine/Source/Common/UserPreferences.cpp +++ b/Generals/Code/GameEngine/Source/Common/UserPreferences.cpp @@ -142,7 +142,7 @@ Bool UserPreferences::load(AsciiString fname) continue; (*this)[key] = val; - } // end while + } fclose(fp); return true; } diff --git a/Generals/Code/GameEngine/Source/GameClient/Color.cpp b/Generals/Code/GameEngine/Source/GameClient/Color.cpp index a47646c8aa5..6d0b4239bc4 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Color.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Color.cpp @@ -96,7 +96,7 @@ void GameGetColorComponents( Color color, *green = (color & 0x0000FF00) >> 8; *blue = (color & 0x000000FF); -} // end GameGetColorComponents +} //Put on ice until later M Lorenzen //void GameGetColorComponentsWithCheatSpy( Color color, @@ -148,5 +148,5 @@ Color GameDarkenColor( Color color, Int percent ) return GameMakeColor(r,g,b,a); -}// end GameDarkenColor +} diff --git a/Generals/Code/GameEngine/Source/GameClient/Credits.cpp b/Generals/Code/GameEngine/Source/GameClient/Credits.cpp index 0a2e0b678eb..a1543a4c045 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Credits.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Credits.cpp @@ -94,7 +94,7 @@ void INI::parseCredits( INI *ini ) // parse the ini definition ini->initFromINI( TheCredits, TheCredits->getFieldParse() ); -} // end parseCommandButtonDefinition +} CreditsLine::CreditsLine() diff --git a/Generals/Code/GameEngine/Source/GameClient/Display.cpp b/Generals/Code/GameEngine/Source/GameClient/Display.cpp index 4f36f624752..dfd0a8f31e8 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Display.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Display.cpp @@ -185,7 +185,7 @@ void Display::setWidth( UnsignedInt width ) if( TheMouse ) TheMouse->setMouseLimits(); -} // end setWidth +} // Display::setHeight ========================================================= /** Set the height of the display */ @@ -200,7 +200,7 @@ void Display::setHeight( UnsignedInt height ) if( TheMouse ) TheMouse->setMouseLimits(); -} // end setHeight +} //============================================================================ // Display::playLogoMovie diff --git a/Generals/Code/GameEngine/Source/GameClient/DisplayString.cpp b/Generals/Code/GameEngine/Source/GameClient/DisplayString.cpp index 505284a5bd3..e972343bf4b 100644 --- a/Generals/Code/GameEngine/Source/GameClient/DisplayString.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/DisplayString.cpp @@ -79,7 +79,7 @@ DisplayString::DisplayString( void ) m_next = NULL; m_prev = NULL; -} // end DisplayString +} // DisplayString::~DisplayString ============================================== /** */ @@ -90,7 +90,7 @@ DisplayString::~DisplayString( void ) // free any data reset(); -} // end ~DisplayString +} // DisplayString::setText ===================================================== /** Copy the text to this instance */ @@ -105,7 +105,7 @@ void DisplayString::setText( UnicodeString text ) // our text has now changed notifyTextChanged(); -} // end setText +} // DisplayString::reset ======================================================= /** Free and reset all the data for this string, effectively making this @@ -119,7 +119,7 @@ void DisplayString::reset( void ) // no font m_font = NULL; -} // end reset +} // DisplayString::removeLastChar ============================================== /** Remove the last character from the string text */ @@ -131,7 +131,7 @@ void DisplayString::removeLastChar( void ) // our text has now changed notifyTextChanged(); -} // end removeLastChar +} // DisplayString::truncateBy ================================================== /** Remove the last charCount characters from the string text */ @@ -143,7 +143,7 @@ void DisplayString::truncateBy(const Int charCount) // our text has now changed notifyTextChanged(); -} // end truncateBy +} // DisplayString::truncateTo ================================================== /** Remove the last characters from the string text so it's at the most @@ -156,7 +156,7 @@ void DisplayString::truncateTo(const Int maxLength) // our text has now changed notifyTextChanged(); -} // end truncateTo +} // DisplayString::appendChar ================================================== /** Append character to the end of the string */ @@ -168,5 +168,5 @@ void DisplayString::appendChar( WideChar c ) // text has now changed notifyTextChanged(); -} // end appendchar +} diff --git a/Generals/Code/GameEngine/Source/GameClient/DisplayStringManager.cpp b/Generals/Code/GameEngine/Source/GameClient/DisplayStringManager.cpp index 8d6730586aa..05e78e1e481 100644 --- a/Generals/Code/GameEngine/Source/GameClient/DisplayStringManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/DisplayStringManager.cpp @@ -46,7 +46,7 @@ DisplayStringManager::DisplayStringManager( void ) m_stringList = NULL; m_currentCheckpoint = NULL; -} // end DisplayStringManager +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -59,7 +59,7 @@ DisplayStringManager::~DisplayStringManager( void ) // assert( m_stringList == NULL ); -} // end ~DisplayStringManager +} //------------------------------------------------------------------------------------------------- /** Link a display string to the master list */ @@ -77,7 +77,7 @@ void DisplayStringManager::link( DisplayString *string ) m_stringList = string; -} // end link +} //------------------------------------------------------------------------------------------------- /** Unlink a display string from the master list */ @@ -98,6 +98,6 @@ void DisplayStringManager::unLink( DisplayString *string ) assert( string == m_stringList ); m_stringList = string->m_next; - } // end else + } -} // end unLink +} diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index 5721ef9f855..63a4aaf3ec0 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -192,7 +192,7 @@ static const char *drawableIconIndexToName( DrawableIconType iconIndex ) return TheDrawableIconNames[ iconIndex ]; -} // end drawableIconIndexToName +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -207,7 +207,7 @@ static DrawableIconType drawableIconNameToIndex( const char *iconName ) return ICON_INVALID; -} // end drawableIconNameToIndex +} // ------------------------------------------------------------------------------------------------ // constants @@ -382,7 +382,7 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatus statusBit assert( 0 ); return; - } // end if + } m_instance.Make_Identity(); m_instanceIsIdentity = true; @@ -474,7 +474,7 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatus statusBit startAmbientSound(); -} // end Drawable +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -549,9 +549,9 @@ void Drawable::onDestroy( void ) for( Module** m = m_modules[ i ]; m && *m; ++m ) (*m)->onDelete(); - } // end for i + } -} // end onDestroy +} //------------------------------------------------------------------------------------------------- Bool Drawable::isVisible() @@ -968,7 +968,7 @@ void Drawable::onSelected() } } -} // end onSelected +} //------------------------------------------------------------------------------------------------- /** Gathering point for all things besides actual selection that must happen on deselection */ @@ -1079,7 +1079,7 @@ void Drawable::setEffectiveOpacity( Real pulseFactor, Real explicitOpacity /* = Real pulseAmount = pulseMargin * pf; m_effectiveStealthOpacity = m_stealthOpacity + pulseAmount; -} ///< get alpha/opacity value used to override defaults when drawing. +} //------------------------------------------------------------------------------------------------- /** update is called once per frame */ @@ -1142,7 +1142,7 @@ void Drawable::updateDrawable( void ) (*dm)->setTerrainDecalOpacity(m_decalOpacity); } - }//end if (*dm) + } } else m_decalOpacity = 0; @@ -1346,19 +1346,19 @@ void Drawable::calcPhysicsXformThrust( const Locomotor *locomotor, PhysicsXformI m_locoInfo->m_pitch += WOBBLE_RATE; m_locoInfo->m_yaw += WOBBLE_RATE; - } // end if + } else { m_locoInfo->m_pitch += (WOBBLE_RATE / 2.0f); m_locoInfo->m_yaw += (WOBBLE_RATE / 2.0f); - } // end else + } if( m_locoInfo->m_pitch >= MAX_WOBBLE ) m_locoInfo->m_wobble = -1.0f; - } // end if + } else { @@ -1368,23 +1368,23 @@ void Drawable::calcPhysicsXformThrust( const Locomotor *locomotor, PhysicsXformI m_locoInfo->m_pitch -= WOBBLE_RATE; m_locoInfo->m_yaw -= WOBBLE_RATE; - } // end if + } else { m_locoInfo->m_pitch -= (WOBBLE_RATE / 2.0f); m_locoInfo->m_yaw -= (WOBBLE_RATE / 2.0f); - } // end else + } if( m_locoInfo->m_pitch <= MIN_WOBBLE ) m_locoInfo->m_wobble = 1.0f; - } // end else + } info.m_totalPitch = m_locoInfo->m_pitch; info.m_totalYaw = m_locoInfo->m_yaw; - } // end if, wobble exists + } if( THRUST_ROLL ) { @@ -1392,7 +1392,7 @@ void Drawable::calcPhysicsXformThrust( const Locomotor *locomotor, PhysicsXformI m_locoInfo->m_roll += THRUST_ROLL; info.m_totalRoll = m_locoInfo->m_roll; - } // end if + } } @@ -2266,7 +2266,7 @@ static Bool computeHealthRegion( const Drawable *draw, IRegion2D& region ) return TRUE; -} // end computeHealthRegion +} // ------------------------------------------------------------------------------------------------ @@ -3170,14 +3170,14 @@ void Drawable::drawDisabled(const IRegion2D* healthBarRegion) screen.y = healthBarRegion->hi.y - (frameHeight + barHeight); getIconInfo()->m_icon[ ICON_DISABLED ]->draw( screen.x, screen.y, frameWidth, frameHeight ); - } // end if - } // end if + } + } else { // delete icon if necessary killIcon(ICON_DISABLED); - } // end if + } } @@ -3225,7 +3225,7 @@ void Drawable::drawConstructPercent( const IRegion2D *healthBarRegion ) // record this percent as our last displayed so we don't un-necessarily rebuild the string m_lastConstructDisplayed = obj->getConstructionPercent(); - } // end if + } // get center position in drawable ICoord2D screen; @@ -3241,7 +3241,7 @@ void Drawable::drawConstructPercent( const IRegion2D *healthBarRegion ) screen.x -= (m_constructDisplayString->getWidth() / 2); m_constructDisplayString->draw( screen.x, screen.y, color, dropColor ); -} // end drawConstructPercent +} //------------------------------------------------------------------------------------------------- /** Draw caption */ @@ -3277,7 +3277,7 @@ void Drawable::drawCaption( const IRegion2D *healthBarRegion ) Color dropColor = GameMakeColor( 0, 0, 0, 255 ); m_captionDisplayString->draw( screen.x, screen.y, color, dropColor ); -} // end drawCaption +} // ------------------------------------------------------------------------------------------------ /** Draw any veterency markers that should be displayed */ @@ -3329,7 +3329,7 @@ void Drawable::drawVeterancy( const IRegion2D *healthBarRegion ) // draw the image TheDisplay->drawImage(image, screenCenter.x + 1, screenCenter.y + 1, screenCenter.x + 1 + vetBoxWidth, screenCenter.y + 1 + vetBoxHeight); -} // end drawVeterancy +} // ------------------------------------------------------------------------------------------------ /** Draw health bar information for drawable */ @@ -3446,9 +3446,9 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion) TheDisplay->drawFillRect( healthBarRegion->lo.x + 1, healthBarRegion->lo.y + 1, (healthBoxWidth - 2) * healthRatio, healthBoxHeight - 2, color ); - } // end if + } -} // end drawHealthBar +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -3624,7 +3624,7 @@ void Drawable::setID( DrawableID id ) m_ambientSound->m_event.setDrawableID(m_id); } -} // end setID +} // ------------------------------------------------------------------------------------------------ /** Return drawable ID, this ID is only good on the client */ @@ -3637,7 +3637,7 @@ DrawableID Drawable::getID( void ) const return m_id; -} // end get ID +} //------------------------------------------------------------------------------------------------- void Drawable::friend_bindToObject( Object *obj ) ///< bind this drawable to an object ID @@ -4093,7 +4093,7 @@ void Drawable::preloadAssets( TimeOfDay timeOfDay ) for( Module** m = m_modules[i]; m && *m; ++m ) (*m)->preloadAssets( timeOfDay ); -} // end preloadAssets +} //------------------------------------------------------------------------------------------------- // Simply searches for the first occurrence of a specified client update module. @@ -4120,7 +4120,7 @@ ClientUpdateModule* Drawable::findClientUpdateModule( NameKeyType key ) void Drawable::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer the drawable modules @@ -4183,9 +4183,9 @@ void Drawable::xferDrawableModules( Xfer *xfer ) // end data block xfer->endBlock(); - } // end for, m + } - } // end if, save + } else { // read each module @@ -4206,9 +4206,9 @@ void Drawable::xferDrawableModules( Xfer *xfer ) module = *m; break; // exit for m - } // end if + } - } // end for, m + } // new block of data Int dataSize = xfer->beginBlock(); @@ -4228,25 +4228,25 @@ void Drawable::xferDrawableModules( Xfer *xfer ) // skip this data in the file xfer->skip( dataSize ); - } // end if + } else { // xfer the data into this module xfer->xferSnapshot( module ); - } // end else + } // end of data block xfer->endBlock(); - } // end for j + } - } // end else, load + } - } // end for curModuleType + } -} // end xferDrawableModules +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -4289,7 +4289,7 @@ void Drawable::xfer( Xfer *xfer ) if( xfer->getXferMode() == XFER_LOAD ) replaceModelConditionFlags( m_conditionState, TRUE ); - } // end if + } if( version >= 3 ) { @@ -4326,7 +4326,7 @@ void Drawable::xfer( Xfer *xfer ) // xfer xfer->xferSnapshot( m_selectionFlashEnvelope ); - } // end if + } // color tint envelope Bool colFlash = (m_colorTintEnvelope != NULL); @@ -4341,7 +4341,7 @@ void Drawable::xfer( Xfer *xfer ) // xfer xfer->xferSnapshot( m_colorTintEnvelope ); - } // end if + } // terrain decal type TerrainDecalType decal = getTerrainDecalType(); @@ -4384,10 +4384,10 @@ void Drawable::xfer( Xfer *xfer ) getTemplate()->getName().str(), m_object->getTemplate()->getName().str() )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } else { @@ -4403,11 +4403,11 @@ void Drawable::xfer( Xfer *xfer ) #endif throw SC_INVALID_DATA; - } // end if + } - } // end else + } - } // end if + } // particle @@ -4537,7 +4537,7 @@ void Drawable::xfer( Xfer *xfer ) if( xfer->getXferMode() == XFER_LOAD ) replaceModelConditionFlags( m_conditionState, TRUE ); - } // end if + } // expiration date xfer->xferUnsignedInt( &m_expirationDate ); @@ -4581,9 +4581,9 @@ void Drawable::xfer( Xfer *xfer ) // icon data xfer->xferSnapshot( getIconInfo()->m_icon[ i ] ); - } // end for, i + } - } // end if, save + } else { Int i; @@ -4615,7 +4615,7 @@ void Drawable::xfer( Xfer *xfer ) DEBUG_CRASH(( "Drawable::xfer - Unknown icon template '%s'", iconTemplateName.str() )); throw SC_INVALID_DATA; - } // end if + } // create icon getIconInfo()->m_icon[ iconIndex ] = newInstance(Anim2D)( animTemplate, TheAnim2DCollection ); @@ -4623,9 +4623,9 @@ void Drawable::xfer( Xfer *xfer ) // icon data xfer->xferSnapshot( getIconInfo()->m_icon[ iconIndex ] ); - } // end for, i + } - } // end else, load + } if( xfer->getXferMode() == XFER_LOAD ) { @@ -4656,7 +4656,7 @@ void Drawable::xfer( Xfer *xfer ) xfer->xferBool( &m_ambientSoundEnabled ); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -4679,7 +4679,7 @@ void Drawable::loadPostProcess( void ) stopAmbientSound(); } -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- const Locomotor* Drawable::getLocomotor() const @@ -4852,7 +4852,7 @@ void TintEnvelope::update(void) void TintEnvelope::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -4888,7 +4888,7 @@ void TintEnvelope::xfer( Xfer *xfer ) // state xfer->xferByte( &m_envState ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load Post Process */ @@ -4896,5 +4896,5 @@ void TintEnvelope::xfer( Xfer *xfer ) void TintEnvelope::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/AnimatedParticleSysBoneClientUpdate.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/AnimatedParticleSysBoneClientUpdate.cpp index 51c798e7596..b46893c01dd 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/AnimatedParticleSysBoneClientUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/AnimatedParticleSysBoneClientUpdate.cpp @@ -100,7 +100,7 @@ void AnimatedParticleSysBoneClientUpdate::crc( Xfer *xfer ) // extend base class ClientUpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -119,7 +119,7 @@ void AnimatedParticleSysBoneClientUpdate::xfer( Xfer *xfer ) ClientUpdateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -130,4 +130,4 @@ void AnimatedParticleSysBoneClientUpdate::loadPostProcess( void ) // extend base class ClientUpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp index 1a3472e74d3..5e486a2aa1d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp @@ -150,7 +150,7 @@ void BeaconClientUpdate::hideBeacon( void ) if( system ) system->stop(); - } // end if + } // DEBUG_LOG(("in hideBeacon(): draw=%d, m_particleSystemID=%d", draw, m_particleSystemID)); @@ -192,7 +192,7 @@ void BeaconClientUpdate::crc( Xfer *xfer ) // extend base class ClientUpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -216,7 +216,7 @@ void BeaconClientUpdate::xfer( Xfer *xfer ) // last radar pulse xfer->xferUnsignedInt( &m_lastRadarPulse ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -227,4 +227,4 @@ void BeaconClientUpdate::loadPostProcess( void ) // extend base class ClientUpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp index 2b5c8d535fd..648860b3b80 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp @@ -145,7 +145,7 @@ void SwayClientUpdate::crc( Xfer *xfer ) // extend base class ClientUpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -184,7 +184,7 @@ void SwayClientUpdate::xfer( Xfer *xfer ) // swaying xfer->xferBool( &m_swaying ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -197,4 +197,4 @@ void SwayClientUpdate::loadPostProcess( void ) updateSway(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index af70f52f62e..65e27e967c6 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -227,7 +227,7 @@ void ControlBar::populatePurchaseScience( Player* player ) { // hide window on interface m_sciencePurchaseWindowsRank1[ i ]->winHide( TRUE ); - } // end if + } else { // make sure the window is not hidden @@ -272,9 +272,9 @@ void ControlBar::populatePurchaseScience( Player* player ) m_sciencePurchaseWindowsRank1[ i ]->winHide(TRUE); } } - } // end else + } - } // end for + } for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_3; i++ ) { @@ -287,7 +287,7 @@ void ControlBar::populatePurchaseScience( Player* player ) { // hide window on interface m_sciencePurchaseWindowsRank3[ i ]->winHide( TRUE ); - } // end if + } else { // make sure the window is not hidden @@ -335,9 +335,9 @@ void ControlBar::populatePurchaseScience( Player* player ) m_sciencePurchaseWindowsRank3[ i ]->winHide(TRUE); } - } // end else + } - } // end for + } for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_8; i++ ) { @@ -350,7 +350,7 @@ void ControlBar::populatePurchaseScience( Player* player ) { // hide window on interface m_sciencePurchaseWindowsRank8[ i ]->winHide( TRUE ); - } // end if + } else { // make sure the window is not hidden @@ -393,9 +393,9 @@ void ControlBar::populatePurchaseScience( Player* player ) m_sciencePurchaseWindowsRank8[ i ]->winHide(TRUE); } - } // end else + } - } // end for + } GameWindow *win = NULL; @@ -540,14 +540,14 @@ void CommandButton::parseCommand( INI* ini, void *instance, void *store, const v *command = (GUICommandType)i; return; - } // end if + } - } // end for i + } // if we're here the command was not found throw INI_INVALID_DATA; -} // end parseCommand +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -799,7 +799,7 @@ void CommandSet::parseCommandButton( INI* ini, void *instance, void *store, cons ini->getLineNum(), ini->getFilename().str(), token )); throw INI_INVALID_DATA; - } // end if + } // get the index to store the command at, and the command array itself const CommandButton **buttonArray = (const CommandButton **)store; @@ -812,7 +812,7 @@ void CommandSet::parseCommandButton( INI* ini, void *instance, void *store, cons // save it buttonArray[ buttonIndex ] = commandButton; -} // end parseCommand +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -849,7 +849,7 @@ void CommandSet::friend_addToList(CommandSet** listHead) CommandSet::~CommandSet( void ) { -} // end ~CommandSet +} /////////////////////////////////////////////////////////////////////////////////////////////////// // ControlBar ///////////////////////////////////////////////////////////////////////////////////// @@ -961,7 +961,7 @@ ControlBar::ControlBar( void ) m_consecutiveDirtyFrames = 0; #endif -} // end ControlBar +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1006,7 +1006,7 @@ ControlBar::~ControlBar( void ) deleteInstance(m_commandSets); m_commandSets = set; - } // end while + } // destroy all our command button definitions CommandButton *button; @@ -1016,7 +1016,7 @@ ControlBar::~ControlBar( void ) deleteInstance(m_commandButtons); m_commandButtons = button; - } // end while + } if(m_buildToolTipLayout) { m_buildToolTipLayout->destroyWindows(); @@ -1039,7 +1039,7 @@ ControlBar::~ControlBar( void ) m_rightHUDCameoWindow->winSetUserData(NULL); } -} // end ~ControlBar +} void ControlBarPopupDescriptionUpdateFunc( WindowLayout *layout, void *param ); //------------------------------------------------------------------------------------------------- @@ -1134,7 +1134,7 @@ void ControlBar::init( void ) - } // end for i + } for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_1; i++ ) @@ -1144,7 +1144,7 @@ void ControlBar::init( void ) m_sciencePurchaseWindowsRank1[ i ] = TheWindowManager->winGetWindowFromId( m_contextParent[ CP_PURCHASE_SCIENCE ], id ); m_sciencePurchaseWindowsRank1[ i ]->winSetStatus( WIN_STATUS_USE_OVERLAY_STATES ); - } // end for i + } for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_3; i++ ) { windowName.format( "GeneralsExpPoints.wnd:ButtonRank3Number%d", i ); @@ -1152,7 +1152,7 @@ void ControlBar::init( void ) m_sciencePurchaseWindowsRank3[ i ] = TheWindowManager->winGetWindowFromId( m_contextParent[ CP_PURCHASE_SCIENCE ], id ); m_sciencePurchaseWindowsRank3[ i ]->winSetStatus( WIN_STATUS_USE_OVERLAY_STATES ); - } // end for i + } for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_8; i++ ) { @@ -1161,7 +1161,7 @@ void ControlBar::init( void ) m_sciencePurchaseWindowsRank8[ i ] = TheWindowManager->winGetWindowFromId( m_contextParent[ CP_PURCHASE_SCIENCE ], id ); m_sciencePurchaseWindowsRank8[ i ]->winSetStatus( WIN_STATUS_USE_OVERLAY_STATES ); - } // end for i + } // keep a pointer to the window making up the right HUD display id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:RightHUD" ); @@ -1284,7 +1284,7 @@ void ControlBar::init( void ) switchToContext( CB_CONTEXT_NONE, NULL ); } -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset the context sensitive control bar GUI */ @@ -1372,7 +1372,7 @@ void ControlBar::reset( void ) m_lastFlashedAtPointValue = -1; m_genStarFlash = TRUE; -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update phase, we can track if our selected object is destroyed, update button @@ -1544,7 +1544,7 @@ void ControlBar::update( void ) updateContextMultiSelect(); return; - } // end if + } // if nothing is selected get out of here except if we're in the Purchase science context... that requires // us to not have anything selected @@ -1555,7 +1555,7 @@ void ControlBar::update( void ) DEBUG_ASSERTCRASH( m_currContext == CB_CONTEXT_NONE, ("ControlBar::update no selection, but not we're not showing the default NONE context") ); return; - } // end if + } @@ -1569,7 +1569,7 @@ void ControlBar::update( void ) switchToContext( CB_CONTEXT_NONE, NULL ); return; - } // end if + } switch( m_currContext ) { @@ -1603,11 +1603,11 @@ void ControlBar::update( void ) updateContextOCLTimer(); break; - } // end switch + } -} // end update +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1621,7 +1621,7 @@ void ControlBar::onDrawableSelected( Drawable *draw ) TheInGameUI->setGUICommand( NULL ); -} // end onDrawableSelected +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1644,7 +1644,7 @@ void ControlBar::onDrawableDeselected( Drawable *draw ) // TheInGameUI->placeBuildAvailable( NULL, NULL ); -} // end onDrawableDeselected +} //------------------------------------------------------------------------------------------------- @@ -1872,7 +1872,7 @@ void ControlBar::evaluateContextUI( void ) switchToContext( CB_CONTEXT_UNDER_CONSTRUCTION, drawToEvaluateFor ); contextSelected = TRUE; - } // end else if + } // check for a regular switch to the appropriate context if( contextSelected == FALSE ) @@ -1894,7 +1894,7 @@ void ControlBar::evaluateContextUI( void ) if( obj->isLocallyControlled() == TRUE || relationship == NEUTRAL ) switchToContext( CB_CONTEXT_STRUCTURE_INVENTORY, drawToEvaluateFor ); - } // end else if + } else if( update ) { switchToContext( CB_CONTEXT_OCL_TIMER, drawToEvaluateFor ); @@ -1904,18 +1904,18 @@ void ControlBar::evaluateContextUI( void ) switchToContext( CB_CONTEXT_COMMAND, drawToEvaluateFor ); - } // end else if + } else if (obj->getControllingPlayer()->getPlayerTemplate()->getBeaconTemplate().compare(obj->getTemplate()->getName()) == 0) { switchToContext( CB_CONTEXT_BEACON, drawToEvaluateFor ); } else switchToContext( CB_CONTEXT_NONE, drawToEvaluateFor ); - } // end else + } - } // end else + } -} // end evaluateContextUI +} //------------------------------------------------------------------------------------------------- /** Find a command button of the given name if present */ @@ -1929,7 +1929,7 @@ CommandButton *ControlBar::findNonConstCommandButton( const AsciiString& name ) return NULL; // not found -} // end findCommandButton +} //------------------------------------------------------------------------------------------------- /** Allocate a new command button, assign name, and tie to list */ @@ -1950,7 +1950,7 @@ CommandButton *ControlBar::newCommandButton( const AsciiString& name ) // return the new button return newButton; -} // end newCommandButton +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1995,7 +1995,7 @@ CommandButton *ControlBar::newCommandButtonOverride( CommandButton *buttonToOver if (ini->getLoadType() == INI_LOAD_CREATE_OVERRIDES) { commandSet->markAsOverride(); } - } // end if + } else if( ini->getLoadType() != INI_LOAD_CREATE_OVERRIDES ) { //Holy crap, this sucks to debug!!! @@ -2018,7 +2018,7 @@ CommandButton *ControlBar::newCommandButtonOverride( CommandButton *buttonToOver // parse the ini definition ini->initFromINI( commandSet, commandSet->friend_getFieldParse() ); -} // end parseCommandSetDefinition +} //------------------------------------------------------------------------------------------------- /** Find existing command set by name */ @@ -2070,7 +2070,7 @@ CommandSet *ControlBar::newCommandSet( const AsciiString& name ) // return the newly created set return set; -} // end newCommandSet +} //------------------------------------------------------------------------------------------------- /** Create an overridden command set. */ @@ -2105,7 +2105,7 @@ CBCommandStatus ControlBar::processContextSensitiveButtonClick( GameWindow *butt // call command processing method return processCommandUI( button, gadgetMessage ); -} // end processContextSensitiveButtonClick +} //------------------------------------------------------------------------------------------------- /** Process a button click for the context sensitive GUI */ @@ -2117,7 +2117,7 @@ CBCommandStatus ControlBar::processContextSensitiveButtonTransition( GameWindow // call command processing method return processCommandTransitionUI( button, gadgetMessage ); -} // end processContextSensitiveButtonClick +} //------------------------------------------------------------------------------------------------- @@ -2201,7 +2201,7 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) break; - } // end none + } //--------------------------------------------------------------------------------------------- case CB_CONTEXT_COMMAND: @@ -2234,17 +2234,17 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) m_contextParent[ CP_BUILD_QUEUE ]->winHide( FALSE ); populateBuildQueue( obj ); setPortraitByObject( NULL ); - } // end if + } else { setPortraitByObject( obj ); } - } // end if + } break; - } // end command + } //--------------------------------------------------------------------------------------------- case CB_CONTEXT_STRUCTURE_INVENTORY: @@ -2265,7 +2265,7 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) break; - } // end inventory + } //--------------------------------------------------------------------------------------------- case CB_CONTEXT_BEACON: @@ -2287,7 +2287,7 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) break; - } // end beacon + } //--------------------------------------------------------------------------------------------- case CB_CONTEXT_UNDER_CONSTRUCTION: @@ -2308,7 +2308,7 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) break; - } // end under construction + } //--------------------------------------------------------------------------------------------- case CB_CONTEXT_OCL_TIMER: @@ -2329,7 +2329,7 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) break; - } // end under construction + } //--------------------------------------------------------------------------------------------- case CB_CONTEXT_MULTI_SELECT: @@ -2351,7 +2351,7 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) break; - } // end multi select + } case CB_CONTEXT_OBSERVER_LIST: { @@ -2370,7 +2370,7 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) populateObserverList(); break; - } // end multi select + } //--------------------------------------------------------------------------------------------- default: @@ -2379,14 +2379,14 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) DEBUG_ASSERTCRASH( 0, ("ControlBar::switchToContext, unknown context '%d'", context) ); break; - } // end default + } - } // end switch + } // save our context m_currContext = context; -} // end switchToContext +} void ControlBar::setCommandBarBorder( GameWindow *button, CommandButtonMappedBorderType type) { @@ -2440,7 +2440,7 @@ void ControlBar::setControlCommand( GameWindow *button, const CommandButton *com DEBUG_ASSERTCRASH( 0, ("setControlCommand: Window is not a button") ); return; - } // end if + } // sanity if( commandButton == NULL ) @@ -2449,7 +2449,7 @@ void ControlBar::setControlCommand( GameWindow *button, const CommandButton *com DEBUG_ASSERTCRASH( 0, ("setControlCommand: NULL commandButton passed in") ); return; - } // end if + } // // set the button gadget control to be a normal button or a check like button if @@ -2507,7 +2507,7 @@ void ControlBar::setControlCommand( GameWindow *button, const CommandButton *com } GadgetButtonSetAltSound(button, "GUICommandBarClick"); -} // end setControlCommand +} //------------------------------------------------------------------------------------------------- void CommandButton::cacheButtonImage() @@ -2551,12 +2551,12 @@ void ControlBar::setControlCommand( const AsciiString& buttonWindowName, GameWin DEBUG_ASSERTCRASH( 0, ("setControlCommand: Unable to find window '%s'", buttonWindowName.str()) ); return; - } // end if + } // call the workhorse setControlCommand( win, commandButton ); -} // end setControlCommand +} //------------------------------------------------------------------------------------------------- /** show/hide the portrait window image */ @@ -2574,7 +2574,7 @@ void ControlBar::setPortraitByImage( const Image *image ) for(Int i = 0; i < MAX_UPGRADE_CAMEO_UPGRADES; ++i) m_rightHUDUpgradeCameos[i]->winHide(TRUE); - } // end if + } else { m_rightHUDWindow->winSetStatus( WIN_STATUS_IMAGE ); @@ -2587,7 +2587,7 @@ void ControlBar::setPortraitByImage( const Image *image ) } -} // end setPortraitByImage +} //------------------------------------------------------------------------------------------------- /** show/hide the portrait image by object. We like to use this method as opposed to the @@ -2677,7 +2677,7 @@ void ControlBar::setPortraitByObject( Object *obj ) } - } // end if + } else { m_rightHUDUnitSelectParent->winHide(TRUE); @@ -2690,7 +2690,7 @@ void ControlBar::setPortraitByObject( Object *obj ) GadgetButtonDrawOverlayImage( m_rightHUDCameoWindow, NULL ); } -} // end setPortraitByObject +} // ------------------------------------------------------------------------------------------------ /** Show a rally point marker at the world location specified. If no location is specified @@ -2874,11 +2874,11 @@ void ControlBar::updateBuildQueueDisabledImages( const Image *image ) buttonName.format( "ControlBar.wnd:ButtonQueue%02d", i + 1 ); buildQueueIDs[ i ] = TheNameKeyGenerator->nameToKey( buttonName ); - } // end for i + } idsInitialized = TRUE; - } // end if + } // get window pointers to all the buttons for the build queue for( i = 0; i < MAX_BUILD_QUEUE_BUTTONS; i++ ) @@ -2890,7 +2890,7 @@ void ControlBar::updateBuildQueueDisabledImages( const Image *image ) GadgetButtonSetDisabledImage( m_queueData[ i ].control, image ); - } // end for i + } } @@ -3254,7 +3254,7 @@ void ControlBar::initSpecialPowershortcutBar( Player *player) TheWindowManager->winGetWindowFromId( m_specialPowerShortcutParent, id ); - } // end for i + } @@ -3299,7 +3299,7 @@ void ControlBar::populateSpecialPowerShortcut( Player *player) // hide window on interface //m_specialPowerShortcutButtons[ i ]->winHide( TRUE ); - } // end if + } else { @@ -3369,7 +3369,7 @@ void ControlBar::populateSpecialPowerShortcut( Player *player) } } - } // end if + } // make sure the window is not hidden m_specialPowerShortcutButtons[ currentButton ]->winHide( FALSE ); m_specialPowerShortcutButtonParents[ currentButton ]->winHide( FALSE ); @@ -3382,9 +3382,9 @@ void ControlBar::populateSpecialPowerShortcut( Player *player) GadgetButtonSetAltSound(m_specialPowerShortcutButtons[ currentButton ], "GUIGenShortcutClick"); currentButton++; - } // end else + } - } // end for i + } if(m_contextParent[ CP_MASTER ] && !m_contextParent[ CP_MASTER ]->winIsHidden() && m_specialPowerShortcutParent->winIsHidden()) { showSpecialPowerShortcut(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp index d1ccff6ff34..dc5cb4fad5a 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp @@ -81,14 +81,14 @@ void ControlBar::populateBeacon( Object *beacon ) if (buttonWin) buttonWin->winHide(TRUE); } -} // end populateBeacon +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- void ControlBar::updateContextBeacon( void ) { -} // end updateContextBeacon +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -103,4 +103,4 @@ WindowMsgHandledType BeaconWindowInput( GameWindow *window, UnsignedInt msg, return MSG_IGNORED; -} // end InGameChatInput +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp index 0d028ee7024..b2f8bf0eee7 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp @@ -97,7 +97,7 @@ void ControlBar::populateInvDataCallback( Object *obj, void *userData ) data->transport->getTemplate()->getName().str()) ); return; - } // end if + } // get the window control that we're going to put our smiling faces in GameWindow *control = data->controls[ data->currIndex ]; @@ -126,7 +126,7 @@ void ControlBar::populateInvDataCallback( Object *obj, void *userData ) // enable the control control->winEnable( TRUE ); -} // end populateInvDataCallback +} //------------------------------------------------------------------------------------------------- /** Transports have an extra special manipulation of the user interface. They get to look @@ -223,9 +223,9 @@ void ControlBar::doTransportInventoryUI( Object *transport, const CommandSet *co // setControlCommand( m_commandWindows[ i ], commandButton ); - } // end if + } - } // end for i + } // After Every change to the m_commandWIndows, we need to show fill in the missing blanks with the images // removed from multiplayer branch @@ -246,7 +246,7 @@ void ControlBar::doTransportInventoryUI( Object *transport, const CommandSet *co data.transport = transport; contain->iterateContained( populateInvDataCallback, &data, FALSE ); - } // end if + } // // save the last recorded inventory count so we know when we have to redo the gui when @@ -254,7 +254,7 @@ void ControlBar::doTransportInventoryUI( Object *transport, const CommandSet *co // m_lastRecordedInventoryCount = contain->getContainCount(); -} // end doTransportInventoryUI +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -287,7 +287,7 @@ void ControlBar::populateCommand( Object *obj ) // nothing left to do return; - } // end if + } // transports do extra special things with the user interface buttons if( obj->getContain() && obj->getContain()->isDisplayedOnControlBar() ) @@ -310,7 +310,7 @@ void ControlBar::populateCommand( Object *obj ) // hide window on interface m_commandWindows[ i ]->winHide( TRUE ); - } // end if + } else { @@ -399,13 +399,13 @@ void ControlBar::populateCommand( Object *obj ) } } - } // end if + } - } // end else + } - } // end else + } - } // end for i + } // After Every change to the m_commandWIndows, we need to show fill in the missing blanks with the images // removed from multiplayer branch @@ -426,7 +426,7 @@ void ControlBar::populateCommand( Object *obj ) // showRallyPoint( exit->getRallyPoint() ); - } // end if + } // // to avoid a one frame delay where windows may become enabled/disabled, run the update @@ -434,7 +434,7 @@ void ControlBar::populateCommand( Object *obj ) // updateContextCommand(); -} // end populateCommand +} //------------------------------------------------------------------------------------------------- /** reset transport data */ @@ -449,9 +449,9 @@ void ControlBar::resetContainData( void ) m_containData[ i ].control = NULL; m_containData[ i ].objectID = INVALID_ID; - } // end for i + } -} // end resetTransportData +} //------------------------------------------------------------------------------------------------- /** reset the build queue data we use to die queue entires to control */ @@ -468,9 +468,9 @@ void ControlBar::resetBuildQueueData( void ) m_queueData[ i ].productionID = PRODUCTIONID_INVALID; m_queueData[ i ].upgradeToResearch = NULL; - } // end for i + } -} // end resetBuildQueue +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -498,11 +498,11 @@ void ControlBar::populateBuildQueue( Object *producer ) buttonName.format( "ControlBar.wnd:ButtonQueue%02d", i + 1 ); buildQueueIDs[ i ] = TheNameKeyGenerator->nameToKey( buttonName ); - } // end for i + } idsInitialized = TRUE; - } // end if + } // get window pointers to all the buttons for the build queue for( i = 0; i < MAX_BUILD_QUEUE_BUTTONS; i++ ) @@ -525,7 +525,7 @@ void ControlBar::populateBuildQueue( Object *producer ) //Clear any potential veterancy rank, or else we'll see it when it's empty! GadgetButtonDrawOverlayImage( m_queueData[ i ].control, NULL ); - } // end for i + } // step through each object being built and set the image data for the buttons ProductionUpdateInterface *pu = producer->getProductionUpdateInterface(); @@ -575,7 +575,7 @@ void ControlBar::populateBuildQueue( Object *producer ) // image = TheMappedImageCollection->findImageByName( production->getProductionObject()->getInventoryImageName( INV_IMAGE_DISABLED ) ); // GadgetButtonSetDisabledImage( m_queueData[ windowIndex ].control, image ); - } // end if + } else { const UpgradeTemplate *ut = production->getProductionUpgrade(); @@ -604,12 +604,12 @@ void ControlBar::populateBuildQueue( Object *producer ) // image = TheMappedImageCollection->findImageByName( ut->getQueueImageName( UpgradeTemplate::UPGRADE_DISABLED ) ); // GadgetButtonSetDisabledImage( m_queueData[ windowIndex ].control, image ); - } // end else + } // we have filled up this window now windowIndex++; - } // end for + } // // save the count of things being produced in the build queue, when it changes we will @@ -617,7 +617,7 @@ void ControlBar::populateBuildQueue( Object *producer ) // m_displayedQueueCount = pu->getProductionCount(); -} // end populateBuildQueue +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -645,7 +645,7 @@ void ControlBar::updateContextCommand( void ) // re-evaluate the UI because something has changed evaluateContextUI(); - } // end if, transport + } // get production update for those objects that have one ProductionUpdateInterface *pu = obj ? obj->getProductionUpdateInterface() : NULL; @@ -669,9 +669,9 @@ void ControlBar::updateContextCommand( void ) m_contextParent[ CP_BUILD_QUEUE ]->winHide( FALSE ); populateBuildQueue( obj ); - } // end if + } - } // end if + } else { @@ -684,9 +684,9 @@ void ControlBar::updateContextCommand( void ) // show the portrait image setPortraitByObject( obj ); - } // end if + } - } // end else + } // update a visible production queue if( m_contextParent[ CP_BUILD_QUEUE ]->winIsHidden() == FALSE ) @@ -725,11 +725,11 @@ void ControlBar::updateContextCommand( void ) GadgetButtonDrawInverseClock(win,produce->getPercentComplete(), m_buildUpClockColor); - } // end if + } - } // end if + } - } // end if + } // evaluate each command on whether or not it should be enabled for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) @@ -814,9 +814,9 @@ void ControlBar::updateContextCommand( void ) else GadgetCheckLikeButtonSetVisualCheck( win, FALSE ); - } // end if + } - } // end for i + } // After Every change to the m_commandWIndows, we need to show fill in the missing blanks with the images // removed from multiplayer branch @@ -825,7 +825,7 @@ void ControlBar::updateContextCommand( void ) // // if we have a build tooltip layout, update it with the new data. // repopulateBuildTooltipLayout(); -} // end updatecontextCommand +} //------------------------------------------------------------------------------------------------- const Image* ControlBar::calculateVeterancyOverlayForThing( const ThingTemplate *thingTemplate ) @@ -1383,5 +1383,5 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com // all is well with the command return COMMAND_AVAILABLE; -} // end getCommandAvailability +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp index 0d836f89750..a89442d535a 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp @@ -75,7 +75,7 @@ CBCommandStatus ControlBar::processCommandTransitionUI( GameWindow *control, Gad switchToContext( CB_CONTEXT_NONE, NULL ); return CBC_COMMAND_NOT_USED; - } // end if + } return CBC_COMMAND_USED; @@ -109,7 +109,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, switchToContext( CB_CONTEXT_NONE, NULL ); return CBC_COMMAND_NOT_USED; - } // end if + } // sanity if( control == NULL ) @@ -231,7 +231,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // end dozer construct + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_DOZER_CONSTRUCT_CANCEL: @@ -251,7 +251,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // end cancel dozer construction + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_UNIT_BUILD: @@ -310,7 +310,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, factory->getTemplate()->getName().str()) ); break; - } // end if + } // get a new production id to assign to this ProductionID productionID = pu->requestUniqueUnitID(); @@ -323,7 +323,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // end build unit + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_CANCEL_UNIT_BUILD: @@ -342,7 +342,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, DEBUG_ASSERTCRASH( 0, ("Control not found in build queue data") ); break; - } // end if + } // sanity if( m_queueData[ i ].type != PRODUCTION_UNIT ) @@ -366,7 +366,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // end cancel unit build + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_PLAYER_UPGRADE: @@ -402,7 +402,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // command player upgrade + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_OBJECT_UPGRADE: @@ -447,7 +447,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // end object upgrade + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_CANCEL_UPGRADE: @@ -466,7 +466,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, DEBUG_ASSERTCRASH( 0, ("Control not found in build queue data") ); break; - } // end if + } // sanity if( m_queueData[ i ].type != PRODUCTION_UPGRADE ) @@ -488,7 +488,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // end cancel upgrade + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_ATTACK_MOVE: @@ -546,7 +546,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, m_containData[ i ].objectID = INVALID_ID; break; // exit case - } // end if + } // send message to exit GameMessage *exitMsg = TheMessageStream->appendMessage( GameMessage::MSG_EXIT ); @@ -554,7 +554,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // end transport exit + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_EVACUATE: @@ -568,14 +568,14 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, } break; - } // end evacuate + } // -------------------------------------------------------------------------------------------- case GUI_COMMAND_EXECUTE_RAILED_TRANSPORT: { TheMessageStream->appendMessage( GameMessage::MSG_EXECUTE_RAILED_TRANSPORT ); break; - } // end execute railed transport + } // -------------------------------------------------------------------------------------------- case GUI_COMMAND_HACK_INTERNET: @@ -590,7 +590,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, { break; - } // end set rally point + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_SELL: @@ -600,7 +600,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, TheMessageStream->appendMessage( GameMessage::MSG_SELL ); break; - } // end sell + } // -------------------------------------------------------------------------------------------- case GUI_COMMAND_TOGGLE_OVERCHARGE: @@ -609,7 +609,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, TheMessageStream->appendMessage( GameMessage::MSG_TOGGLE_OVERCHARGE ); break; - } // end overcharge + } #ifdef ALLOW_SURRENDER // ------------------------------------------------------------------------------------------------ @@ -619,7 +619,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, TheMessageStream->appendMessage( GameMessage::MSG_RETURN_TO_PRISON ); break; - } // end return to prison + } #endif //--------------------------------------------------------------------------------------------- @@ -628,7 +628,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // end delete beacon + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_GUARD: @@ -666,7 +666,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // end fire weapon + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_SPECIAL_POWER_FROM_COMMAND_CENTER: @@ -682,7 +682,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, msg->appendObjectIDArgument( cmdCenter->getID() ); break; - } // end special weapon + } case GUI_COMMAND_SPECIAL_POWER: { @@ -693,7 +693,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, msg->appendObjectIDArgument( INVALID_ID ); // no specific source break; - } // end special weapon + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_PURCHASE_SCIENCE: @@ -726,7 +726,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // end pick specialized science + } //--------------------------------------------------------------------------------------------- default: @@ -734,9 +734,9 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, DEBUG_ASSERTCRASH( 0, ("Unknown command '%d'", commandButton->getCommandType()) ); return CBC_COMMAND_NOT_USED; - } // end switch + } return CBC_COMMAND_USED; -} // end processCommandUI +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp index b04b67ee8c3..8fa43ecdb06 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp @@ -57,7 +57,7 @@ void ControlBar::resetCommonCommandData( void ) GadgetButtonDrawOverlayImage( m_commandWindows[ i ], NULL ); } -} // end resetCommonCommandData +} //------------------------------------------------------------------------------------------------- /** add the common commands of this drawable to the common command set */ @@ -99,11 +99,11 @@ void ControlBar::addCommonCommands( Drawable *draw, Bool firstDrawable ) // removed from multiplayer branch //showCommandMarkers(); - } // end for i + } return; - } // end if + } // @@ -136,11 +136,11 @@ void ControlBar::addCommonCommands( Drawable *draw, Bool firstDrawable ) // set the command into the control setControlCommand( m_commandWindows[ i ], command ); - } // end if + } - } // end for i + } - } // end if + } else { @@ -189,15 +189,15 @@ void ControlBar::addCommonCommands( Drawable *draw, Bool firstDrawable ) m_commandWindows[ i ]->winHide( TRUE ); } - } // end if + } - } // end else + } // After Every change to the m_commandWIndows, we need to show fill in the missing blanks with the images // removed from multiplayer branch //showCommandMarkers(); -} // end addCommonCommands +} //------------------------------------------------------------------------------------------------- /** Populate the visible command bar with commands that are common to all the objects @@ -276,18 +276,18 @@ void ControlBar::populateMultiSelect( void ) portraitObj = draw->getObject(); portraitSet = TRUE; - } // end if + } else if( draw->getTemplate()->getSelectedPortraitImage() != portrait ) portrait = NULL; - } // end if + } - } // end for, drawble id iterator + } // set the portrait image setPortraitByObject( portraitObj ); -} // end populateMultiSelect +} //------------------------------------------------------------------------------------------------- /** Update logic for the multi select context sensitive GUI */ @@ -390,9 +390,9 @@ void ControlBar::updateContextMultiSelect( void ) if( availability == COMMAND_AVAILABLE || availability == COMMAND_ACTIVE ) objectsThatCanDoCommand[ i ]++; - } // end for i + } - } // end for, selected drawables + } // // for each command, if any objects can do the command we enable the window, otherwise @@ -417,11 +417,11 @@ void ControlBar::updateContextMultiSelect( void ) else m_commandWindows[ i ]->winEnable( FALSE ); - } // end for i + } // After Every change to the m_commandWIndows, we need to show fill in the missing blanks with the images // removed from multiplayer branch //showCommandMarkers(); -} // end updateContextMultiSelect +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp index aa49c0e1142..ff5a69e5aa4 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp @@ -71,7 +71,7 @@ void ControlBar::updateOCLTimerTextDisplay( UnsignedInt totalSeconds, Real perce // record this as the last time displayed m_displayedOCLTimerSeconds = totalSeconds; -} // end updateOCLTimerTextDisplay +} //------------------------------------------------------------------------------------------------- /** Populate the interface for an OCL Timer context. */ @@ -102,7 +102,7 @@ void ControlBar::populateOCLTimer( Object *creatorObject ) // set the portrait for the thing being constructed setPortraitByObject( creatorObject ); -} // end populateUnderConstruction +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -122,4 +122,4 @@ void ControlBar::updateContextOCLTimer( void ) if( m_displayedOCLTimerSeconds != seconds ) updateOCLTimerTextDisplay( seconds, percent ); -} // end updatecontextUnderConstruction +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp index c4c69d3e4cc..1aecbae08f3 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp @@ -142,7 +142,7 @@ WindowMsgHandledType ControlBarObserverSystem( GameWindow *window, UnsignedInt m { break; - } // end create + } //--------------------------------------------------------------------------------------------- case GBM_MOUSE_ENTERING: @@ -191,17 +191,17 @@ WindowMsgHandledType ControlBarObserverSystem( GameWindow *window, UnsignedInt m break; - } // end button selected + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end ControlBarSystem +} //----------------------------------------------------------------------------- // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp index c644f129bb8..c830e4c096b 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp @@ -236,7 +236,7 @@ void INI::parseControlBarResizerDefinition( INI* ini ) // // parse the ini definition // ini->initFromINI( rWin, resizer->getFieldParse()); // -} // end parseMappedImage +} //----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp index fce5b964819..b958f3f4404 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp @@ -678,7 +678,7 @@ void ControlBarScheme::addAnimation( ControlBarSchemeAnimation *schemeAnim ) return; } m_animations.push_back( schemeAnim ); -}// addAnimation +} // // Add an image to the proper layer list @@ -700,7 +700,7 @@ void ControlBarScheme::addImage( ControlBarSchemeImage *schemeImage ) } m_layer[schemeImage->m_layer].push_back(schemeImage); -}// addImage +} // // Update the position of the image that's animating diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp index 1baf15e7cd7..aa54eb46fb4 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp @@ -153,7 +153,7 @@ void ControlBar::populateStructureInventory( Object *building ) m_commandWindows[ i ]->winHide( TRUE ); - } // end for i + } // show the window m_commandWindows[ EVACUATE_ID ]->winHide( FALSE ); @@ -183,7 +183,7 @@ void ControlBar::populateStructureInventory( Object *building ) // m_lastRecordedInventoryCount = contain->getContainCount(); -} // end populateStructureInventory +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -206,7 +206,7 @@ void ControlBar::updateContextStructureInventory( void ) TheInGameUI->deselectDrawable( draw ); return; - } // end if + } // // if the object being displayed in the interface has a different count than we last knew @@ -220,5 +220,5 @@ void ControlBar::updateContextStructureInventory( void ) if( m_lastRecordedInventoryCount != contain->getContainCount() ) populateStructureInventory( source ); -} // end updateContextStructureInventory +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp index 70386b04323..496a019dd9e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp @@ -62,7 +62,7 @@ void ControlBar::updateConstructionTextDisplay( Object *obj ) // record this as the last percentage displayed m_displayedConstructPercent = obj->getConstructionPercent(); -} // end updateConstructionTextDisplay +} //------------------------------------------------------------------------------------------------- /** Populate the interface for an under construction context. */ @@ -99,7 +99,7 @@ void ControlBar::populateUnderConstruction( Object *objectUnderConstruction ) showRallyPoint( exit->getRallyPoint() ); -} // end populateUnderConstruction +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -114,10 +114,10 @@ void ControlBar::updateContextUnderConstruction( void ) evaluateContextUI(); return; - } // end if + } // if the construction percent has changed since what was last shown to the user update the text if( m_displayedConstructPercent != obj->getConstructionPercent() ) updateConstructionTextDisplay( obj ); -} // end updatecontextUnderConstruction +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp index c3c5e8b99fa..373afce2a83 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp @@ -128,7 +128,7 @@ WindowMsgHandledType LeftHUDInput( GameWindow *window, UnsignedInt msg, // Groovy TheMouse->setCursor(cur); - } // end if + } return MSG_HANDLED; } @@ -187,7 +187,7 @@ WindowMsgHandledType LeftHUDInput( GameWindow *window, UnsignedInt msg, else TheMouse->setCursor( Mouse::CROSS ); - } // end if + } else { // Else we are not super targeting, so we have to try to refresh the move cursor. @@ -212,11 +212,11 @@ WindowMsgHandledType LeftHUDInput( GameWindow *window, UnsignedInt msg, TheMouse->setCursor(cur); } - } // end if + } break; - } // end case mouse position + } // ------------------------------------------------------------------------ case GWM_RIGHT_UP:// Here to eat @@ -284,7 +284,7 @@ WindowMsgHandledType LeftHUDInput( GameWindow *window, UnsignedInt msg, // do the command TheGameClient->evaluateContextCommand( NULL, &world, CommandTranslator::DO_COMMAND ); - } // end if + } else if( command && command->getCommandType() == GUI_COMMAND_ATTACK_MOVE) { // Attack move has changed from a modifier to a command, so it moves up here. @@ -316,25 +316,25 @@ WindowMsgHandledType LeftHUDInput( GameWindow *window, UnsignedInt msg, // Play the unit voice response pickAndPlayUnitVoiceResponse(drawableList, GameMessage::MSG_DO_MOVETO); - } // end else + } } break; - } // end left down + } // ------------------------------------------------------------------------ default: return MSG_IGNORED; - } // end switch( msg ) + } TheInGameUI->clearAttackMoveToMode(); return MSG_HANDLED; -} // end LeftHUDInput +} //------------------------------------------------------------------------------------------------- /** Input procedure for the control bar */ @@ -345,7 +345,7 @@ WindowMsgHandledType ControlBarInput( GameWindow *window, UnsignedInt msg, return MSG_IGNORED; -} // end ControlBarInput +} void ToggleQuitMenu(void); //------------------------------------------------------------------------------------------------- /** System callback for the control bar parent */ @@ -367,7 +367,7 @@ WindowMsgHandledType ControlBarSystem( GameWindow *window, UnsignedInt msg, break; - } // end create + } //--------------------------------------------------------------------------------------------- case GBM_MOUSE_ENTERING: @@ -455,7 +455,7 @@ WindowMsgHandledType ControlBarSystem( GameWindow *window, UnsignedInt msg, } break; - } // end button selected + } //--------------------------------------------------------------------------------------------- case GEM_EDIT_DONE: @@ -480,17 +480,17 @@ WindowMsgHandledType ControlBarSystem( GameWindow *window, UnsignedInt msg, } } break; - } // end edit done + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end ControlBarSystem +} extern void showReplayControls( void ); extern void hideReplayControls( void ); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp index 21563d4c454..e217dc8d378 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp @@ -321,7 +321,7 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton, } } } - } //End overcharge special case + } //Special case: When building units, the CanMakeType determines reasons for not being able to buy stuff. else if( thingTemplate ) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp index 41f3d71ffbb..63d6d2a053f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp @@ -361,19 +361,19 @@ WindowMsgHandledType DiplomacyInput( GameWindow *window, UnsignedInt msg, HideDiplomacy(); return MSG_HANDLED; //return MSG_IGNORED; - } // end escape + } - } // end switch( key ) + } return MSG_HANDLED; - } // end char + } } return MSG_IGNORED; -} // end DiplomacyInput +} //------------------------------------------------------------------------------------------------- WindowMsgHandledType DiplomacySystem( GameWindow *window, UnsignedInt msg, @@ -392,7 +392,7 @@ WindowMsgHandledType DiplomacySystem( GameWindow *window, UnsignedInt msg, //if (focus) //TheWindowManager->winSetGrabWindow( chatTextEntry ); break; - } // end focus change + } //--------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -402,7 +402,7 @@ WindowMsgHandledType DiplomacySystem( GameWindow *window, UnsignedInt msg, *(Bool *)mData2 = FALSE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -442,17 +442,17 @@ WindowMsgHandledType DiplomacySystem( GameWindow *window, UnsignedInt msg, } break; - } // end button selected + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end DiplomacySystem +} void PopulateInGameDiplomacyPopup( void ) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp index 848e082557b..a097d88b5b9 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp @@ -186,7 +186,7 @@ static GameWindow *gogoExMessageBox(Int x, Int y, Int width, Int height, Unsigne parent->winBringToTop(); return parent; -}// gogoExMessageBox +} GameWindow *ExMessageBoxYesNo (UnicodeString titleString,UnicodeString bodyString, void *userData, MessageBoxFunc yesCallback, MessageBoxFunc noCallback) @@ -242,7 +242,7 @@ WindowMsgHandledType ExtendedMessageBoxSystem( GameWindow *window, UnsignedInt m window->winSetUserData( NULL ); break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -254,7 +254,7 @@ WindowMsgHandledType ExtendedMessageBoxSystem( GameWindow *window, UnsignedInt m break; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -273,36 +273,36 @@ WindowMsgHandledType ExtendedMessageBoxSystem( GameWindow *window, UnsignedInt m { if (MsgBoxCallbacks->okCallback) ret = MsgBoxCallbacks->okCallback(MsgBoxCallbacks->userData); - } // end if + } else if( controlID == buttonYesID ) { if (MsgBoxCallbacks->yesCallback) ret = MsgBoxCallbacks->yesCallback(MsgBoxCallbacks->userData); - } // end else if + } else if( controlID == buttonNoID ) { if (MsgBoxCallbacks->noCallback) ret = MsgBoxCallbacks->noCallback(MsgBoxCallbacks->userData); - } // end else if + } else if( controlID == buttonCancelID ) { if (MsgBoxCallbacks->cancelCallback) ret = MsgBoxCallbacks->cancelCallback(MsgBoxCallbacks->userData); - } // end else if + } if (ret == MB_RETURN_CLOSE) TheWindowManager->winDestroy(window); break; - } // end selected + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end ExtendedMessageBoxSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp index 45fa9c51d26..deb76dee609 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp @@ -93,19 +93,19 @@ WindowMsgHandledType GeneralsExpPointsInput( GameWindow *window, UnsignedInt msg TheControlBar->hidePurchaseScience(); return MSG_HANDLED; //return MSG_IGNORED; - } // end escape + } - } // end switch( key ) + } return MSG_HANDLED; - } // end char + } } return MSG_HANDLED; -} // end DiplomacyInput +} @@ -125,7 +125,7 @@ WindowMsgHandledType GeneralsExpPointsSystem( GameWindow *window, UnsignedInt ms //if (focus) //TheWindowManager->winSetGrabWindow( chatTextEntry ); break; - } // end focus change + } //--------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -135,7 +135,7 @@ WindowMsgHandledType GeneralsExpPointsSystem( GameWindow *window, UnsignedInt ms *(Bool *)mData2 = FALSE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -151,17 +151,17 @@ WindowMsgHandledType GeneralsExpPointsSystem( GameWindow *window, UnsignedInt ms TheControlBar->processContextSensitiveButtonClick( control, (GadgetGameMessage)msg ); break; - } // end button selected + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GeneralsExpPointsSystem +} //----------------------------------------------------------------------------- // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp index 98f8362f7ca..c036dacf2de 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp @@ -51,7 +51,7 @@ WindowMsgHandledType IMECandidateWindowInput( GameWindow *window, UnsignedInt ms return MSG_HANDLED; -} // end IMECandidateInput +} //------------------------------------------------------------------------------------------------- /** System callback for the IME Candidate widnow */ @@ -81,11 +81,11 @@ WindowMsgHandledType IMECandidateWindowSystem( GameWindow *window, UnsignedInt m default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end IMECandidateWidnowSystem +} // IMECandidateDraw ================================================================ /** Draw function for the IME candidate window */ @@ -120,7 +120,7 @@ void IMECandidateTextAreaDraw( GameWindow *window, WinInstanceData *instData ) textColor = window->winGetDisabledTextColor(); textBorder = window->winGetDisabledTextBorderColor(); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -129,7 +129,7 @@ void IMECandidateTextAreaDraw( GameWindow *window, WinInstanceData *instData ) textSelectColor = window->winGetHiliteTextColor(); textSelectBorder = window->winGetHiliteTextBorderColor(); - } // end else if, hilited + } else { @@ -138,7 +138,7 @@ void IMECandidateTextAreaDraw( GameWindow *window, WinInstanceData *instData ) textColor = window->winGetEnabledTextColor(); textBorder = window->winGetEnabledTextBorderColor(); - } // end else, just enabled + } { @@ -250,21 +250,21 @@ void IMECandidateMainDraw( GameWindow *window, WinInstanceData *instData ) backColor = window->winGetDisabledColor( 0 ); backBorder = window->winGetDisabledBorderColor( 0 ); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { backColor = window->winGetHiliteColor( 0 ); backBorder = window->winGetHiliteBorderColor( 0 ); - } // end else if, hilited + } else { backColor = window->winGetEnabledColor( 0 ); backBorder = window->winGetEnabledBorderColor( 0 ); - } // end else, just enabled + } // draw the back border if( backBorder != WIN_COLOR_UNDEFINED ) @@ -276,7 +276,7 @@ void IMECandidateMainDraw( GameWindow *window, WinInstanceData *instData ) end.y = start.y + size.y; TheWindowManager->winOpenRect( backBorder, borderWidth, start.x, start.y, end.x, end.y ); - } // end if + } // draw the filled back if( backColor != WIN_COLOR_UNDEFINED ) @@ -288,6 +288,6 @@ void IMECandidateMainDraw( GameWindow *window, WinInstanceData *instData ) end.y = start.y + size.y - 2; TheWindowManager->winFillRect( backColor, 0, start.x, start.y, end.x, end.y ); - } // end if + } } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp index 98a53f422df..9af01e1cb0b 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp @@ -284,19 +284,19 @@ WindowMsgHandledType InGameChatInput( GameWindow *window, UnsignedInt msg, HideInGameChat(); return MSG_HANDLED; //return MSG_IGNORED; - } // end escape + } - } // end switch( key ) + } return MSG_HANDLED; - } // end char + } } return MSG_IGNORED; -} // end InGameChatInput +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -312,7 +312,7 @@ WindowMsgHandledType InGameChatSystem( GameWindow *window, UnsignedInt msg, //if (focus) //TheWindowManager->winSetGrabWindow( chatTextEntry ); break; - } // end focus change + } //--------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -322,7 +322,7 @@ WindowMsgHandledType InGameChatSystem( GameWindow *window, UnsignedInt msg, *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } //--------------------------------------------------------------------------------------------- case GEM_EDIT_DONE: @@ -332,7 +332,7 @@ WindowMsgHandledType InGameChatSystem( GameWindow *window, UnsignedInt msg, break; - } // end button selected + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -347,15 +347,15 @@ WindowMsgHandledType InGameChatSystem( GameWindow *window, UnsignedInt msg, } break; - } // end button selected + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end InGameChatSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp index 9189cbf52ca..45cb9d0736b 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp @@ -168,18 +168,18 @@ WindowMsgHandledType InGamePopupMessageInput( GameWindow *window, UnsignedInt ms TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonOk, buttonOkID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; @@ -200,14 +200,14 @@ WindowMsgHandledType InGamePopupMessageSystem( GameWindow *window, UnsignedInt m break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { break; - } // end case + } //---------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -219,7 +219,7 @@ WindowMsgHandledType InGamePopupMessageSystem( GameWindow *window, UnsignedInt m break; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: { @@ -238,7 +238,7 @@ WindowMsgHandledType InGamePopupMessageSystem( GameWindow *window, UnsignedInt m default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp index d7806a9ec00..4fe6a8dfbd9 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp @@ -104,7 +104,7 @@ void CreditsMenuInit( WindowLayout *layout, void *userData ) TheAudio->addAudioEvent( &event ); -} // end CreditsMenuInit +} //------------------------------------------------------------------------------------------------- /** single player menu shutdown method */ @@ -124,7 +124,7 @@ void CreditsMenuShutdown( WindowLayout *layout, void *userData ) TheAudio->removeAudioEvent( AHSV_StopTheMusicFade ); -} // end CreditsMenuShutdown +} //------------------------------------------------------------------------------------------------- /** single player menu update method */ @@ -142,7 +142,7 @@ void CreditsMenuUpdate( WindowLayout *layout, void *userData ) else TheShell->pop(); -} // end CreditsMenuUpdate +} //------------------------------------------------------------------------------------------------- /** Replay menu input callback */ @@ -176,22 +176,22 @@ WindowMsgHandledType CreditsMenuInput( GameWindow *window, UnsignedInt msg, TheShell->pop(); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end CreditsMenuInput +} //------------------------------------------------------------------------------------------------- /** single player menu window system callback */ @@ -210,7 +210,7 @@ WindowMsgHandledType CreditsMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -218,7 +218,7 @@ WindowMsgHandledType CreditsMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -230,20 +230,20 @@ WindowMsgHandledType CreditsMenuSystem( GameWindow *window, UnsignedInt msg, return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: { break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end CreditsMenuSystem +} //----------------------------------------------------------------------------- // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp index f2766d257c4..6e96c9277bd 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp @@ -118,7 +118,7 @@ static void SetDifficultyRadioButton( void ) } } - } // if (TheScriptEngine) + } } @@ -152,7 +152,7 @@ void DifficultySelectInit( WindowLayout *layout, void *userData ) parent->winBringToTop(); TheWindowManager->winSetModal(parent); -} // end SkirmishMapSelectMenuInit +} //------------------------------------------------------------------------------------------------- @@ -206,7 +206,7 @@ WindowMsgHandledType DifficultySelectInput( GameWindow *window, UnsignedInt msg, return MSG_IGNORED; -} // end SkirmishMapSelectMenuInput +} //------------------------------------------------------------------------------------------------- /** MapSelect menu window system callback */ @@ -223,14 +223,14 @@ WindowMsgHandledType DifficultySelectSystem( GameWindow *window, UnsignedInt msg { break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -242,7 +242,7 @@ WindowMsgHandledType DifficultySelectSystem( GameWindow *window, UnsignedInt msg return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -294,12 +294,12 @@ WindowMsgHandledType DifficultySelectSystem( GameWindow *window, UnsignedInt msg break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DisconnectWindow.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DisconnectWindow.cpp index 44d9bfbfd4f..4efde1f221e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DisconnectWindow.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DisconnectWindow.cpp @@ -120,13 +120,13 @@ void ShowDisconnectWindow( void ) // show it disconnectMenuLayout->hide( FALSE ); - } // end if + } else { disconnectMenuLayout->hide( FALSE ); - } // end else + } // Disallow voting for 2-player games. Cheating punk. if ( TheGameInfo && TheGameInfo->getNumPlayers() < 3 ) @@ -156,7 +156,7 @@ void ShowDisconnectWindow( void ) GadgetListBoxAddEntryText(textDisplayWindow, TheGameText->fetch("GUI:InternetDisconnectionMenuBody1"), GameMakeColor(255,255,255,255), -1); -} // end ToggleQuitMenu +} //------------------------------------------------------ /** Hide the Disconnect Screen */ @@ -177,15 +177,15 @@ void HideDisconnectWindow( void ) // show it disconnectMenuLayout->hide( TRUE ); - } // end if + } else { disconnectMenuLayout->hide( TRUE ); - } // end else + } -} // end ToggleQuitMenu +} //------------------------------------------------------------------------------------------------- /** Input callback for the control bar parent */ @@ -196,7 +196,7 @@ WindowMsgHandledType DisconnectControlInput( GameWindow *window, UnsignedInt msg return MSG_IGNORED; -} // end DisconnectControlInput +} //------------------------------------------------------------------------------------------------- /** System callback for the control bar parent */ @@ -242,7 +242,7 @@ WindowMsgHandledType DisconnectControlSystem( GameWindow *window, UnsignedInt ms break; - } // end button selected + } case GEM_EDIT_DONE: { @@ -270,7 +270,7 @@ WindowMsgHandledType DisconnectControlSystem( GameWindow *window, UnsignedInt ms TheDisconnectMenu->sendChat(txtInput); } - }// if ( controlID == textEntryChatID ) + } break; } @@ -278,9 +278,9 @@ WindowMsgHandledType DisconnectControlSystem( GameWindow *window, UnsignedInt ms default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end ControlBarSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp index 3d6311318fd..86308d2ca56 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp @@ -268,7 +268,7 @@ void DownloadMenuInit( WindowLayout *layout, void *userData ) } TheDownloadManager = NEW DownloadManagerMunkee; -} // end DownloadMenuInit +} //------------------------------------------------------------------------------------------------- /** menu shutdown method */ @@ -289,7 +289,7 @@ void DownloadMenuShutdown( WindowLayout *layout, void *userData ) progressBarMunkee = NULL; parent = NULL; -} // end DownloadMenuShutdown +} //------------------------------------------------------------------------------------------------- /** menu update method */ @@ -322,7 +322,7 @@ void DownloadMenuUpdate( WindowLayout *layout, void *userData ) GadgetStaticTextSetText(staticTextTime, timeString); } -} // end DownloadMenuUpdate +} //------------------------------------------------------------------------------------------------- /** menu input callback */ @@ -360,22 +360,22 @@ WindowMsgHandledType DownloadMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)button, buttonID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end DownloadMenuInput +} //------------------------------------------------------------------------------------------------- /** menu window system callback */ @@ -393,14 +393,14 @@ WindowMsgHandledType DownloadMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { break; - } // end case + } //---------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -412,7 +412,7 @@ WindowMsgHandledType DownloadMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: { @@ -423,17 +423,17 @@ WindowMsgHandledType DownloadMenuSystem( GameWindow *window, UnsignedInt msg, { HandleCanceledDownload(); closeDownloadWindow(); - } // end if + } break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end DownloadMenuSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp index 0b40304cbce..324d963c2af 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp @@ -189,6 +189,6 @@ WindowMsgHandledType EstablishConnectionsControlSystem(GameWindow *window, Unsig } break; } - } // end switch + } return MSG_HANDLED; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp index b900a102e9f..ce585112442 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp @@ -234,7 +234,7 @@ void GameInfoWindowInit( WindowLayout *layout, void *userData ) GadgetStaticTextSetText(staticTextMapName,UnicodeString::TheEmptyString); GadgetListBoxReset(listBoxPlayers); -} // end MapSelectMenuInit +} //------------------------------------------------------------------------------------------------- @@ -256,7 +256,7 @@ WindowMsgHandledType GameInfoWindowSystem( GameWindow *window, UnsignedInt msg, break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -264,7 +264,7 @@ WindowMsgHandledType GameInfoWindowSystem( GameWindow *window, UnsignedInt msg, break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -276,15 +276,15 @@ WindowMsgHandledType GameInfoWindowSystem( GameWindow *window, UnsignedInt msg, return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end MapSelectMenuSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp index 519b2730fce..5e51f8760e4 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp @@ -468,7 +468,7 @@ void KeyboardOptionsMenuShutdown( WindowLayout *layout, void *userData ) void KeyboardOptionsMenuUpdate( WindowLayout *layout, void *userData ) { -} // end OptionsMenuUpdate +} //------------------------------------------------------------------------------------------------- /** Options menu input callback */ @@ -506,22 +506,22 @@ WindowMsgHandledType KeyboardOptionsMenuInput( GameWindow *window, UnsignedInt m TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)button, buttonID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end KeyboardOptionsMenuInput +} //------------------------------------------------------------------------------------------------- /** options menu window system callback */ @@ -538,7 +538,7 @@ WindowMsgHandledType KeyboardOptionsMenuSystem( GameWindow *window, UnsignedInt break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -546,7 +546,7 @@ WindowMsgHandledType KeyboardOptionsMenuSystem( GameWindow *window, UnsignedInt break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -558,7 +558,7 @@ WindowMsgHandledType KeyboardOptionsMenuSystem( GameWindow *window, UnsignedInt return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- case GCM_SELECTED: @@ -593,7 +593,7 @@ WindowMsgHandledType KeyboardOptionsMenuSystem( GameWindow *window, UnsignedInt } break; - } // end selected + } // --------------------------------------------------------------------------------------------- case GLM_SELECTED: @@ -635,13 +635,13 @@ WindowMsgHandledType KeyboardOptionsMenuSystem( GameWindow *window, UnsignedInt break; } - } // end if + } - } // end selected + } break; - } // end case + } // --------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -655,7 +655,7 @@ WindowMsgHandledType KeyboardOptionsMenuSystem( GameWindow *window, UnsignedInt // go back one screen TheShell->pop(); - } // end if + } else if( controlID == buttonAssignID ) { // check grammar in text field @@ -688,16 +688,16 @@ WindowMsgHandledType KeyboardOptionsMenuSystem( GameWindow *window, UnsignedInt break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end KeyboardOptionsMenuSystem +} // KeyboardTextEntryInput ======================================================= /** Handle input for text entry field */ @@ -1007,7 +1007,7 @@ WindowMsgHandledType KeyboardTextEntryInput( GameWindow *window, UnsignedInt msg GEM_UPDATE_TEXT, (WindowMsgData)window, 0 ); - } // end if + } } } break; @@ -1102,7 +1102,7 @@ WindowMsgHandledType KeyboardTextEntryInput( GameWindow *window, UnsignedInt msg }*/ - } // end switch( mData1 ) + } break; @@ -1153,10 +1153,10 @@ WindowMsgHandledType KeyboardTextEntryInput( GameWindow *window, UnsignedInt msg default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetTextEntryInput +} 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 826046e9dd8..46ccea00325 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp @@ -388,7 +388,7 @@ void StartPressed(void) } } -}//void StartPressed(void) +} void LANEnableStartButton(Bool enabled) { @@ -869,7 +869,7 @@ void LanGameOptionsMenuInit( WindowLayout *layout, void *userData ) // animate controls //TheShell->registerWithAnimateManager(buttonBack, WIN_ANIMATION_SLIDE_RIGHT, TRUE, 1); -}// void LanGameOptionsMenuInit( WindowLayout *layout, void *userData ) +} //------------------------------------------------------------------------------------------------- /** Update options on screen */ @@ -926,7 +926,7 @@ static void shutdownComplete( WindowLayout *layout ) LANnextScreen = NULL; -} // end if +} //------------------------------------------------------------------------------------------------- /** Lan Game Options menu shutdown method */ @@ -946,7 +946,7 @@ void LanGameOptionsMenuShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } TheShell->reverseAnimatewindow(); TheTransitionHandler->reverse("LanGameOptionsFade"); @@ -963,7 +963,7 @@ void LanGameOptionsMenuShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheShell->shutdownComplete( layout ); */ -} // void LanGameOptionsMenuShutdown( WindowLayout *layout, void *userData ) +} //------------------------------------------------------------------------------------------------- /** Lan Game Options menu update method */ @@ -973,7 +973,7 @@ void LanGameOptionsMenuUpdate( WindowLayout * layout, void *userData) if(LANisShuttingDown && TheShell->isAnimFinished() && TheTransitionHandler->isFinished()) shutdownComplete(layout); //TheLAN->update(); // this is handled in the lobby -}// void LanGameOptionsMenuUpdate( WindowLayout * layout, void *userData) +} //------------------------------------------------------------------------------------------------- /** Lan Game Options menu input callback */ @@ -1005,15 +1005,15 @@ WindowMsgHandledType LanGameOptionsMenuInput( GameWindow *window, UnsignedInt ms { TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonBack, buttonBackID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape - } // end switch( key ) - } // end char - } // end switch( msg ) + } + } + } + } return MSG_IGNORED; -}//WindowMsgHandledType LanGameOptionsMenuInput( GameWindow *window, UnsignedInt msg, +} //------------------------------------------------------------------------------------------------- @@ -1029,7 +1029,7 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m case GWM_CREATE: { break; - } // case GWM_DESTROY: + } //------------------------------------------------------------------------------------------------- case GWM_DESTROY: { @@ -1037,7 +1037,7 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m windowMap->winSetUserData(NULL); break; - } // case GWM_DESTROY: + } //------------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: { @@ -1046,7 +1046,7 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } //------------------------------------------------------------------------------------------------- case GCM_SELECTED: { @@ -1106,7 +1106,7 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m break; } } - }// case GCM_SELECTED: + } //------------------------------------------------------------------------------------------------- case GBM_SELECTED: { @@ -1126,7 +1126,7 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m TheLAN->RequestGameLeave(); //TheShell->pop(); - } //if ( controlID == buttonBack ) + } else if ( controlID == buttonEmoteID ) { // read the user's input @@ -1138,7 +1138,7 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m // Echo the user's input to the chat window if (!txtInput.isEmpty()) TheLAN->RequestChat(txtInput, LANAPIInterface::LANCHAT_EMOTE); - } //if ( controlID == buttonEmote ) + } else if ( controlID == buttonSelectMapID ) { //buttonBack->winEnable( false ); @@ -1211,7 +1211,7 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m } break; - }// case GBM_SELECTED: + } //------------------------------------------------------------------------------------------------- case GBM_SELECTED_RIGHT: { @@ -1271,15 +1271,15 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m if (!txtInput.isEmpty()) TheLAN->RequestChat(txtInput, LANAPIInterface::LANCHAT_NORMAL); - }// if ( controlID == textEntryChatID ) + } break; } //------------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}//WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt msg, +} //------------------------------------------------------------------------------------------------- /** Utility FUnction used as a bridge from other windows to this one */ @@ -1308,7 +1308,7 @@ void PostToLanGameOptions( PostToLanGameType post ) TheLAN->RequestGameOptions(GenerateGameOptionsString(), true); break; - } //------------------------------------------------------------------------------------------------- + } case MAP_BACK: { //buttonBack->winEnable( true ); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp index f750c250fa0..28489122cf7 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp @@ -480,7 +480,7 @@ void LanLobbyMenuInit( WindowLayout *layout, void *userData ) // //TheShell->registerWithAnimateManager(buttonOptions, WIN_ANIMATION_SLIDE_LEFT, TRUE, 1); // TheShell->registerWithAnimateManager(buttonBack, WIN_ANIMATION_SLIDE_RIGHT, TRUE, 1); -} // GameLobbyMenuInit +} //------------------------------------------------------------------------------------------------- /** This is called when a shutdown is complete for this menu */ @@ -503,7 +503,7 @@ static void shutdownComplete( WindowLayout *layout ) LANnextScreen = NULL; -} // end if +} //------------------------------------------------------------------------------------------------- /** Lan Lobby menu shutdown method */ @@ -540,13 +540,13 @@ void LanLobbyMenuShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } TheShell->reverseAnimatewindow(); TheTransitionHandler->reverse("LanLobbyFade"); //if( shellmapOn) // TheShell->showShellMap(TRUE); -} // LanLobbyMenuShutdown +} //------------------------------------------------------------------------------------------------- @@ -588,7 +588,7 @@ void LanLobbyMenuUpdate( WindowLayout * layout, void *userData) } -}// LanLobbyMenuUpdate +} //------------------------------------------------------------------------------------------------- /** Lan Lobby menu input callback */ @@ -623,21 +623,21 @@ WindowMsgHandledType LanLobbyMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonBack, buttonBackID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// LanLobbyMenuInput +} //------------------------------------------------------------------------------------------------- /** Lan Lobby menu window system callback */ @@ -655,13 +655,13 @@ WindowMsgHandledType LanLobbyMenuSystem( GameWindow *window, UnsignedInt msg, { SignalUIInteraction(SHELL_SCRIPT_HOOK_LAN_OPENED); break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { SignalUIInteraction(SHELL_SCRIPT_HOOK_LAN_CLOSED); break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -670,7 +670,7 @@ WindowMsgHandledType LanLobbyMenuSystem( GameWindow *window, UnsignedInt msg, *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } case GLM_DOUBLE_CLICKED: { if (LANbuttonPushed) @@ -732,12 +732,12 @@ WindowMsgHandledType LanLobbyMenuSystem( GameWindow *window, UnsignedInt msg, TheLAN = NULL; //TheTransitionHandler->reverse("LanLobbyFade"); - } //if ( controlID == buttonBack ) + } else if ( controlID == buttonHostID ) { TheLAN->RequestGameCreate( UnicodeString(L""), FALSE); - }//else if ( controlID == buttonHostID ) + } else if ( controlID == buttonClearID ) { GadgetTextEntrySetText(textEntryPlayerName, UnicodeString::TheEmptyString); @@ -768,7 +768,7 @@ WindowMsgHandledType LanLobbyMenuSystem( GameWindow *window, UnsignedInt msg, GadgetListBoxAddEntryText(listboxChatWindow, TheGameText->fetch("LAN:ErrorNoGameSelected") , chatSystemColor, -1, 0); } - } //else if ( controlID == buttonJoinID ) + } else if ( controlID == buttonEmoteID ) { // read the user's input @@ -782,7 +782,7 @@ WindowMsgHandledType LanLobbyMenuSystem( GameWindow *window, UnsignedInt msg, // TheLAN->RequestChat(txtInput, LANAPIInterface::LANCHAT_EMOTE); TheLAN->RequestChat(txtInput, LANAPIInterface::LANCHAT_NORMAL); } - } //if ( controlID == buttonEmote ) + } else if (controlID == buttonDirectConnectID) { TheLAN->RequestLobbyLeave( false ); @@ -790,7 +790,7 @@ WindowMsgHandledType LanLobbyMenuSystem( GameWindow *window, UnsignedInt msg, } break; - }// case GBM_SELECTED: + } case GEM_UPDATE_TEXT: { @@ -836,9 +836,9 @@ WindowMsgHandledType LanLobbyMenuSystem( GameWindow *window, UnsignedInt msg, // Put the whitespace-free version in the box GadgetTextEntrySetText( textEntryPlayerName, txtInput ); - }// if ( controlID == textEntryPlayerNameID ) + } break; - }//case GEM_UPDATE_TEXT: + } case GEM_EDIT_DONE: { if (LANbuttonPushed) @@ -863,7 +863,7 @@ WindowMsgHandledType LanLobbyMenuSystem( GameWindow *window, UnsignedInt msg, if (!txtInput.isEmpty()) TheLAN->RequestChat(txtInput, LANAPIInterface::LANCHAT_NORMAL); - }// if ( controlID == textEntryChatID ) + } /* else if ( controlID == textEntryPlayerNameID ) { @@ -880,14 +880,14 @@ WindowMsgHandledType LanLobbyMenuSystem( GameWindow *window, UnsignedInt msg, // Put the whitespace-free version in the box GadgetTextEntrySetText( textEntryPlayerName, txtInput ); - }// if ( controlID == textEntryPlayerNameID ) + } */ break; } default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// LanLobbyMenuSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp index d46602284df..fdece71b255 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp @@ -174,7 +174,7 @@ void LanMapSelectMenuInit( WindowLayout *layout, void *userData ) TheMapCache->updateCache(); populateMapListbox( mapList, usesSystemMapDir, TRUE, TheLAN->GetMyGame()->getMap() ); } -} // end LanMapSelectMenuInit +} //------------------------------------------------------------------------------------------------- /** MapSelect menu shutdown method */ @@ -189,7 +189,7 @@ void LanMapSelectMenuShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheShell->shutdownComplete( layout ); -} // end LanMapSelectMenuShutdown +} //------------------------------------------------------------------------------------------------- /** MapSelect menu update method */ @@ -197,7 +197,7 @@ void LanMapSelectMenuShutdown( WindowLayout *layout, void *userData ) void LanMapSelectMenuUpdate( WindowLayout *layout, void *userData ) { -} // end LanMapSelectMenuUpdate +} //------------------------------------------------------------------------------------------------- /** Map select menu input callback */ @@ -235,22 +235,22 @@ WindowMsgHandledType LanMapSelectMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)button, buttonID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end LanMapSelectMenuInput +} //------------------------------------------------------------------------------------------------- /** MapSelect menu window system callback */ @@ -273,7 +273,7 @@ WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -282,7 +282,7 @@ WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -294,7 +294,7 @@ WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- case GLM_DOUBLE_CLICKED: @@ -354,7 +354,7 @@ WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg NullifyControls(); showLANGameOptionsUnderlyingGUIElements(TRUE); PostToLanGameOptions( MAP_BACK ); - } // end if + } else if ( controlID == buttonOK ) { Int selected = -1; @@ -406,12 +406,12 @@ WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg showLANGameOptionsUnderlyingGUIElements(TRUE); PostToLanGameOptions(SEND_GAME_OPTS); - } // end if - } // end else if + } + } break; - } // end selected + } case GLM_SELECTED: { @@ -459,8 +459,8 @@ WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end LanMapSelectMenuSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp index 6c4362bdd52..c7f005347a7 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp @@ -328,7 +328,7 @@ static void shutdownComplete( WindowLayout *layout ) // our shutdown is complete TheShell->shutdownComplete( layout ); -} // end if +} @@ -639,7 +639,7 @@ void MainMenuInit( WindowLayout *layout, void *userData ) TheWindowManager->winSetFocus( parentMainMenu ); -} // end MainMenuInit +} //------------------------------------------------------------------------------------------------- /** Main menu shutdown method */ @@ -669,14 +669,14 @@ void MainMenuShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } if (!startGame) TheShell->reverseAnimatewindow(); //TheShell->reverseAnimatewindow(); // if(localAnimateWindowManager && dropDown != DROPDOWN_NONE) // localAnimateWindowManager->reverseAnimateWindow(); -} // end MainMenuShutdown +} extern Bool DontShowMainMenu; @@ -929,7 +929,7 @@ void MainMenuUpdate( WindowLayout *layout, void *userData ) // if(winVidManager) // winVidManager->update(); -} // end MainMenuUpdate +} //------------------------------------------------------------------------------------------------- /** Main menu input callback */ @@ -973,7 +973,7 @@ WindowMsgHandledType MainMenuInput( GameWindow *window, UnsignedInt msg, } } - } // end char + } break; case GWM_CHAR: { @@ -988,14 +988,14 @@ WindowMsgHandledType MainMenuInput( GameWindow *window, UnsignedInt msg, return MSG_HANDLED; } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end MainMenuInput +} void PrintOffsetsFromControlBarParent( void ); //------------------------------------------------------------------------------------------------- /** Main menu window system callback */ @@ -1014,7 +1014,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, { ghttpStartup(); break; - } // end case + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -1025,7 +1025,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, StopAsyncDNSCheck(); // kill off the async DNS check thread in case it is still running break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -1037,7 +1037,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_MOUSE_ENTERING: { @@ -1267,7 +1267,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, TheTransitionHandler->remove("MainMenuDefaultMenu"); TheTransitionHandler->reverse("MainMenuDefaultMenuBack"); TheTransitionHandler->setGroup("MainMenuSinglePlayerMenu"); - } // end if + } else if( controlID == buttonSingleBackID ) { if(campaignSelected || dontAllowTransitions) @@ -1278,7 +1278,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, TheTransitionHandler->reverse("MainMenuSinglePlayerMenuBack"); TheTransitionHandler->setGroup("MainMenuDefaultMenu"); dontAllowTransitions = TRUE; - } // end if + } else if( controlID == buttonMultiBackID ) { if(dontAllowTransitions) @@ -1289,7 +1289,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, TheTransitionHandler->remove("MainMenuMultiPlayerMenu"); TheTransitionHandler->reverse("MainMenuMultiPlayerMenuReverse"); TheTransitionHandler->setGroup("MainMenuDefaultMenu"); - } // end if + } else if( controlID == buttonLoadReplayBackID ) { if(dontAllowTransitions) @@ -1300,7 +1300,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, TheTransitionHandler->remove("MainMenuLoadReplayMenu"); TheTransitionHandler->reverse("MainMenuLoadReplayMenuBack"); TheTransitionHandler->setGroup("MainMenuDefaultMenu"); - } // end if + } else if( control == buttonCredits ) { @@ -1389,7 +1389,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, // localAnimateWindowManager->reverseAnimateWindow(); dropDown = DROPDOWN_NONE; - } // end else if + } else if( controlID == networkID ) { if(dontAllowTransitions) @@ -1401,7 +1401,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, TheShell->push( AsciiString("Menus/LanLobbyMenu.wnd") ); TheScriptEngine->signalUIInteract(TheShellHookNames[SHELL_SCRIPT_HOOK_MAIN_MENU_NETWORK_SELECTED]); - } // end else if + } else if( controlID == optionsID ) { if(dontAllowTransitions) @@ -1416,7 +1416,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, optLayout->runInit(); optLayout->hide(FALSE); optLayout->bringForward(); - } // end else if + } else if( controlID == worldBuilderID ) { #if defined RTS_DEBUG @@ -1450,7 +1450,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, // //#endif - } // end else if + } else if(controlID == buttonTRAININGID) { if(campaignSelected || dontAllowTransitions) @@ -1541,7 +1541,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, // layout->bringForward(); // setupGameStart(TheCampaignManager->getCurrentMap()); - }// end else if + } else if(controlID == buttonEasyID) { if(dontAllowTransitions) @@ -1576,17 +1576,17 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end selected + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end MainMenuSystem +} void diffReverseSide( void ) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp index 4593851f2b6..3569aa612f3 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp @@ -104,7 +104,7 @@ static void shutdownComplete( WindowLayout *layout ) // our shutdown is complete TheShell->shutdownComplete( layout ); -} // end if +} void SetDifficultyRadioButton( void ) { @@ -151,7 +151,7 @@ void SetDifficultyRadioButton( void ) } } - } // if (TheScriptEngine) + } } //------------------------------------------------------------------------------------------------- @@ -208,7 +208,7 @@ void MapSelectMenuInit( WindowLayout *layout, void *userData ) GadgetRadioSetSelection( radioButtonSystemMaps, FALSE ); else GadgetRadioSetSelection( radioButtonUserMaps, FALSE ); -} // end MapSelectMenuInit +} //------------------------------------------------------------------------------------------------- /** MapSelect menu shutdown method */ @@ -226,12 +226,12 @@ void MapSelectMenuShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } if (!startGame) TheShell->reverseAnimatewindow(); -} // end MapSelectMenuShutdown +} //------------------------------------------------------------------------------------------------- /** MapSelect menu update method */ @@ -247,7 +247,7 @@ void MapSelectMenuUpdate( WindowLayout *layout, void *userData ) shutdownComplete(layout); -} // end MapSelectMenuUpdate +} //------------------------------------------------------------------------------------------------- /** Map select menu input callback */ @@ -287,22 +287,22 @@ WindowMsgHandledType MapSelectMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)button, buttonID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end MapSelectMenuInput +} //------------------------------------------------------------------------------------------------- /** MapSelect menu window system callback */ @@ -332,7 +332,7 @@ WindowMsgHandledType MapSelectMenuSystem( GameWindow *window, UnsignedInt msg, radioButtonHardAI = TheNameKeyGenerator->nameToKey( AsciiString("MapSelectMenu.wnd:RadioButtonHardAI") ); break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -340,7 +340,7 @@ WindowMsgHandledType MapSelectMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -352,7 +352,7 @@ WindowMsgHandledType MapSelectMenuSystem( GameWindow *window, UnsignedInt msg, return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -402,7 +402,7 @@ WindowMsgHandledType MapSelectMenuSystem( GameWindow *window, UnsignedInt msg, TheShell->pop(); buttonPushed = true; - } // end if + } else if( controlID == buttonOK ) { @@ -424,9 +424,9 @@ WindowMsgHandledType MapSelectMenuSystem( GameWindow *window, UnsignedInt msg, DEBUG_ASSERTCRASH(mapFname, ("No map item data")); if (mapFname) setupGameStart(mapFname); - } // end if + } - } // end else if + } else if( controlID == radioButtonEasyAI) { s_AIDiff = DIFFICULTY_EASY; @@ -441,7 +441,7 @@ WindowMsgHandledType MapSelectMenuSystem( GameWindow *window, UnsignedInt msg, } break; - } // end selected + } case GLM_DOUBLE_CLICKED: { if (buttonPushed) @@ -469,8 +469,8 @@ WindowMsgHandledType MapSelectMenuSystem( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end MapSelectMenuSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp index 942fffac9fe..8ec0428b674 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp @@ -349,7 +349,7 @@ void NetworkDirectConnectInit( WindowLayout *layout, void *userData ) TheTransitionHandler->setGroup("NetworkDirectConnectFade"); -} // NetworkDirectConnectInit +} //------------------------------------------------------------------------------------------------- /** This is called when a shutdown is complete for this menu */ @@ -365,7 +365,7 @@ static void shutdownComplete( WindowLayout *layout ) // our shutdown is complete TheShell->shutdownComplete( layout ); -} // end if +} //------------------------------------------------------------------------------------------------- /** WOL Welcome Menu shutdown method */ @@ -382,12 +382,12 @@ void NetworkDirectConnectShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } TheShell->reverseAnimatewindow(); TheTransitionHandler->reverse("NetworkDirectConnectFade"); -} // NetworkDirectConnectShutdown +} //------------------------------------------------------------------------------------------------- @@ -398,7 +398,7 @@ void NetworkDirectConnectUpdate( WindowLayout * layout, void *userData) // We'll only be successful if we've requested to if(isShuttingDown && TheShell->isAnimFinished() && TheTransitionHandler->isFinished()) shutdownComplete(layout); -}// NetworkDirectConnectUpdate +} //------------------------------------------------------------------------------------------------- /** WOL Welcome Menu input callback */ @@ -433,21 +433,21 @@ WindowMsgHandledType NetworkDirectConnectInput( GameWindow *window, UnsignedInt TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonBack, buttonBackID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// NetworkDirectConnectInput +} //------------------------------------------------------------------------------------------------- /** WOL Welcome Menu window system callback */ @@ -465,12 +465,12 @@ WindowMsgHandledType NetworkDirectConnectSystem( GameWindow *window, UnsignedInt { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -479,7 +479,7 @@ WindowMsgHandledType NetworkDirectConnectSystem( GameWindow *window, UnsignedInt *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } case GBM_SELECTED: { @@ -504,7 +504,7 @@ WindowMsgHandledType NetworkDirectConnectSystem( GameWindow *window, UnsignedInt buttonPushed = true; LANbuttonPushed = true; TheShell->pop(); - } //if ( controlID == buttonBack ) + } else if (controlID == buttonHostID) { HostDirectConnectGame(); @@ -514,7 +514,7 @@ WindowMsgHandledType NetworkDirectConnectSystem( GameWindow *window, UnsignedInt JoinDirectConnectGame(); } break; - }// case GBM_SELECTED: + } case GEM_EDIT_DONE: { @@ -523,7 +523,7 @@ WindowMsgHandledType NetworkDirectConnectSystem( GameWindow *window, UnsignedInt default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// NetworkDirectConnectSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index 6a6551d017b..e5d8f047c50 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -2000,7 +2000,7 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) TheWindowManager->winSetModal(parent); ignoreSelected = FALSE; -} // end OptionsMenuInit +} //------------------------------------------------------------------------------------------------- /** options menu shutdown method */ @@ -2024,7 +2024,7 @@ void OptionsMenuShutdown( WindowLayout *layout, void *userData ) TheShell->shutdownComplete( layout ); */ -} // end OptionsMenuShutdown +} //------------------------------------------------------------------------------------------------- /** options menu update method */ @@ -2032,7 +2032,7 @@ void OptionsMenuShutdown( WindowLayout *layout, void *userData ) void OptionsMenuUpdate( WindowLayout *layout, void *userData ) { -} // end OptionsMenuUpdate +} //------------------------------------------------------------------------------------------------- /** Options menu input callback */ @@ -2070,22 +2070,22 @@ WindowMsgHandledType OptionsMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)button, buttonID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end OptionsMenuInput +} //------------------------------------------------------------------------------------------------- /** options menu window system callback */ @@ -2114,7 +2114,7 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -2122,7 +2122,7 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -2134,7 +2134,7 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- case GCM_SELECTED: @@ -2184,7 +2184,7 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, DestroyOptionsLayout(); } - } // end if + } else if (controlID == buttonAccept ) { saveOptions(); @@ -2298,13 +2298,13 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, } break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end OptionsMenuSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp index c507aa5f3c4..07d2eacae08 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp @@ -72,7 +72,7 @@ void PopupCommunicatorInit( WindowLayout *layout, void *userData ) buttonOkID = TheNameKeyGenerator->nameToKey( AsciiString("PopupCommunicator.wnd:ButtonOk") ); buttonOk = TheWindowManager->winGetWindowFromId( parent, buttonOkID ); -} // end PopupCommunicatorInit +} //------------------------------------------------------------------------------------------------- /** Popup Communicator shutdown method */ @@ -80,7 +80,7 @@ void PopupCommunicatorInit( WindowLayout *layout, void *userData ) void PopupCommunicatorShutdown( WindowLayout *layout, void *userData ) { -} // end PopupCommunicatorShutdown +} //------------------------------------------------------------------------------------------------- /** Popup Communicator update method */ @@ -88,7 +88,7 @@ void PopupCommunicatorShutdown( WindowLayout *layout, void *userData ) void PopupcommunicatorUpdate( WindowLayout *layout, void *userData ) { -} // end PopupCommunicatorUpdate +} //------------------------------------------------------------------------------------------------- /** Popup Communicator input callback */ @@ -123,22 +123,22 @@ WindowMsgHandledType PopupCommunicatorInput( GameWindow *window, UnsignedInt msg TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonOk, buttonOkID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end PopupCommunicatorInput +} //------------------------------------------------------------------------------------------------- /** Popup Communicator window system callback */ @@ -156,14 +156,14 @@ WindowMsgHandledType PopupCommunicatorSystem( GameWindow *window, UnsignedInt ms break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { break; - } // end case + } //---------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -175,7 +175,7 @@ WindowMsgHandledType PopupCommunicatorSystem( GameWindow *window, UnsignedInt ms break; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: { @@ -191,16 +191,16 @@ WindowMsgHandledType PopupCommunicatorSystem( GameWindow *window, UnsignedInt ms deleteInstance(popupCommunicatorLayout); popupCommunicatorLayout = NULL; } - } // end if + } break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp index 0b940c539d3..c62705bad6a 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp @@ -381,18 +381,18 @@ WindowMsgHandledType PopupHostGameInput( GameWindow *window, UnsignedInt msg, Wi TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonCancel, buttonCancelID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; @@ -412,7 +412,7 @@ WindowMsgHandledType PopupHostGameSystem( GameWindow *window, UnsignedInt msg, W break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { @@ -420,7 +420,7 @@ WindowMsgHandledType PopupHostGameSystem( GameWindow *window, UnsignedInt msg, W break; - } // end case + } //---------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -432,7 +432,7 @@ WindowMsgHandledType PopupHostGameSystem( GameWindow *window, UnsignedInt msg, W break; - } // end input + } //---------------------------------------------------------------------------------------------- case GEM_UPDATE_TEXT: @@ -460,9 +460,9 @@ WindowMsgHandledType PopupHostGameSystem( GameWindow *window, UnsignedInt msg, W // Put the whitespace-free version in the box GadgetTextEntrySetText( textEntryGameName, txtInput ); - }// if ( controlID == textEntryPlayerNameID ) + } break; - }//case GEM_UPDATE_TEXT: + } //--------------------------------------------------------------------------------------------- case GCM_SELECTED: { @@ -485,7 +485,7 @@ WindowMsgHandledType PopupHostGameSystem( GameWindow *window, UnsignedInt msg, W } } break; - } // case GCM_SELECTED + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -518,7 +518,7 @@ WindowMsgHandledType PopupHostGameSystem( GameWindow *window, UnsignedInt msg, W default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp index a371957196d..57535658af7 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp @@ -140,18 +140,18 @@ WindowMsgHandledType PopupJoinGameInput( GameWindow *window, UnsignedInt msg, Wi GameSpyCloseOverlay(GSOVERLAY_GAMEPASSWORD); SetLobbyAttemptHostJoin( FALSE ); parentPopup = NULL; - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; @@ -171,14 +171,14 @@ WindowMsgHandledType PopupJoinGameSystem( GameWindow *window, UnsignedInt msg, W break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { break; - } // end case + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -204,7 +204,7 @@ WindowMsgHandledType PopupJoinGameSystem( GameWindow *window, UnsignedInt msg, W break; - } // end input + } //--------------------------------------------------------------------------------------------- case GEM_EDIT_DONE: { @@ -230,7 +230,7 @@ WindowMsgHandledType PopupJoinGameSystem( GameWindow *window, UnsignedInt msg, W default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp index 9b3f5c63d67..e1412be7703 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp @@ -301,18 +301,18 @@ WindowMsgHandledType PopupLadderSelectInput( GameWindow *window, UnsignedInt msg break; } - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; @@ -341,7 +341,7 @@ WindowMsgHandledType PopupLadderSelectSystem( GameWindow *window, UnsignedInt ms case GWM_CREATE: { break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { @@ -350,7 +350,7 @@ WindowMsgHandledType PopupLadderSelectSystem( GameWindow *window, UnsignedInt ms listboxLadderDetails = NULL; CustomMatchHideHostPopup(FALSE); break; - } // end case + } //---------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -359,7 +359,7 @@ WindowMsgHandledType PopupLadderSelectSystem( GameWindow *window, UnsignedInt ms if( mData1 == TRUE ) *(Bool *)mData2 = TRUE; break; - } // end input + } //---------------------------------------------------------------------------------------------- case GBM_SELECTED: { @@ -429,7 +429,7 @@ WindowMsgHandledType PopupLadderSelectSystem( GameWindow *window, UnsignedInt ms setPasswordMode(PASS_NONE); } break; - } // end input + } //--------------------------------------------------------------------------------------------- case GLM_SELECTED: @@ -445,7 +445,7 @@ WindowMsgHandledType PopupLadderSelectSystem( GameWindow *window, UnsignedInt ms updateLadderDetails(selID, staticTextLadderName, listboxLadderDetails); break; - } // end GLM_DOUBLE_CLICKED + } //--------------------------------------------------------------------------------------------- case GLM_DOUBLE_CLICKED: @@ -479,7 +479,7 @@ WindowMsgHandledType PopupLadderSelectSystem( GameWindow *window, UnsignedInt ms default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; @@ -613,7 +613,7 @@ WindowMsgHandledType RCGameDetailsMenuSystem( GameWindow *window, UnsignedInt ms ladderInfoID = NAMEKEY("RCGameDetailsMenu.wnd:ButtonLadderDetails"); buttonOkID = NAMEKEY("PopupLadderDetails.wnd:ButtonOk"); break; - } // case GWM_DESTROY: + } case GGM_CLOSE: { @@ -625,7 +625,7 @@ WindowMsgHandledType RCGameDetailsMenuSystem( GameWindow *window, UnsignedInt ms case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GBM_SELECTED: { @@ -673,6 +673,6 @@ WindowMsgHandledType RCGameDetailsMenuSystem( GameWindow *window, UnsignedInt ms default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp index 4c0f2ba862e..1928f2a5e7d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp @@ -1243,7 +1243,7 @@ void GameSpyPlayerInfoOverlayInit( WindowLayout *layout, void *userData ) } //TheWindowManager->winSetModal(parent); -} // GameSpyPlayerInfoOverlayInit +} //------------------------------------------------------------------------------------------------- /** Overlay shutdown method */ @@ -1257,7 +1257,7 @@ void GameSpyPlayerInfoOverlayShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete isOverlayActive = false; -} // GameSpyPlayerInfoOverlayShutdown +} //------------------------------------------------------------------------------------------------- @@ -1268,7 +1268,7 @@ void GameSpyPlayerInfoOverlayUpdate( WindowLayout * layout, void *userData) if (raiseMessageBox) RaiseGSMessageBox(); raiseMessageBox = false; -}// GameSpyPlayerInfoOverlayUpdate +} //------------------------------------------------------------------------------------------------- /** Overlay input callback */ @@ -1301,21 +1301,21 @@ WindowMsgHandledType GameSpyPlayerInfoOverlayInput( GameWindow *window, Unsigned TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonClose, buttonCloseID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// GameSpyPlayerInfoOverlayInput +} void messageBoxYes( void ); //------------------------------------------------------------------------------------------------- /** Overlay window system callback */ @@ -1333,12 +1333,12 @@ WindowMsgHandledType GameSpyPlayerInfoOverlaySystem( GameWindow *window, Unsigne { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -1347,7 +1347,7 @@ WindowMsgHandledType GameSpyPlayerInfoOverlaySystem( GameWindow *window, Unsigne *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } case GBM_SELECTED: { GameWindow *control = (GameWindow *)mData1; @@ -1423,15 +1423,15 @@ WindowMsgHandledType GameSpyPlayerInfoOverlaySystem( GameWindow *window, Unsigne } break; - }// case GBM_SELECTED: + } default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// GameSpyPlayerInfoOverlaySystem +} static void messageBoxYes( void ) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp index a5f27836f61..5694bd78694 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp @@ -102,7 +102,7 @@ static void closeSaveMenu( GameWindow *window ) if( layout ) layout->hide( TRUE ); -} // end closeSaveMenu +} //------------------------------------------------------------------------------------------------- /** Initialize the SaveLoad menu */ @@ -151,7 +151,7 @@ void PopupReplayInit( WindowLayout *layout, void *userData ) control->winEnable( FALSE ); } -} // end SaveLoadMenuInit +} //------------------------------------------------------------------------------------------------- /** SaveLoad menu shutdown method */ @@ -160,7 +160,7 @@ void PopupReplayShutdown( WindowLayout *layout, void *userData ) { parent = NULL; -} // end SaveLoadMenuShutdown +} //------------------------------------------------------------------------------------------------- /** SaveLoad menu update method */ @@ -184,7 +184,7 @@ void PopupReplayUpdate( WindowLayout *layout, void *userData ) s_fileSavePopupStartTime = 0; } } -} // end SaveLoadMenuUpdate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -216,18 +216,18 @@ WindowMsgHandledType PopupReplayInput( GameWindow *window, UnsignedInt msg, Wind TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)button, buttonBackKey ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; } @@ -348,14 +348,14 @@ WindowMsgHandledType PopupReplaySystem( GameWindow *window, UnsignedInt msg, break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { break; - } // end case + } //---------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -367,7 +367,7 @@ WindowMsgHandledType PopupReplaySystem( GameWindow *window, UnsignedInt msg, break; - } // end input + } // -------------------------------------------------------------------------------------------- case GLM_SELECTED: @@ -396,7 +396,7 @@ WindowMsgHandledType PopupReplaySystem( GameWindow *window, UnsignedInt msg, break; - } // end selected + } //--------------------------------------------------------------------------------------------- case GEM_EDIT_DONE: @@ -416,7 +416,7 @@ WindowMsgHandledType PopupReplaySystem( GameWindow *window, UnsignedInt msg, break; - } // end selected + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: { @@ -443,11 +443,11 @@ WindowMsgHandledType PopupReplaySystem( GameWindow *window, UnsignedInt msg, closeSaveMenu( window ); ScoreScreenEnableControls(TRUE); - } // end if + } break; - } // end selected + } case GEM_UPDATE_TEXT: { @@ -478,7 +478,7 @@ WindowMsgHandledType PopupReplaySystem( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp index 1c5ace71d79..960516f64dd 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp @@ -121,7 +121,7 @@ static void updateMenuActions( void ) GameWindow *buttonDelete = TheWindowManager->winGetWindowFromId( NULL, buttonDeleteKey ); buttonDelete->winEnable( selectedGameInfo != NULL ); -} // end updateMenuActions +} //------------------------------------------------------------------------------------------------- /** Initialize the SaveLoad menu */ @@ -180,7 +180,7 @@ void SaveLoadMenuInit( WindowLayout *layout, void *userData ) // update the availability of the menu buttons updateMenuActions(); -} // end SaveLoadMenuInit +} //------------------------------------------------------------------------------------------------- /** Initialize the SaveLoad menu */ @@ -249,7 +249,7 @@ void SaveLoadMenuFullScreenInit( WindowLayout *layout, void *userData ) if(parent) parent->winHide(TRUE); isShuttingDown = false; -} // end SaveLoadMenuInit +} //------------------------------------------------------------------------------------------------- /** SaveLoad menu shutdown method */ @@ -265,12 +265,12 @@ void SaveLoadMenuShutdown( WindowLayout *layout, void *userData ) TheShell->shutdownComplete( layout ); return; - } //end if + } // our shutdown is complete TheTransitionHandler->reverse("SaveLoadMenuFade"); isShuttingDown = TRUE; -} // end SaveLoadMenuShutdown +} //------------------------------------------------------------------------------------------------- /** SaveLoad menu update method */ @@ -301,7 +301,7 @@ void SaveLoadMenuUpdate( WindowLayout *layout, void *userData ) if(isShuttingDown && TheShell->isAnimFinished()&& TheTransitionHandler->isFinished()) TheShell->shutdownComplete( layout ); -} // end SaveLoadMenuUpdate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -333,18 +333,18 @@ WindowMsgHandledType SaveLoadMenuInput( GameWindow *window, UnsignedInt msg, Win TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)button, buttonBackKey ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; } @@ -369,7 +369,7 @@ static AvailableGameInfo *getSelectedSaveFileInfo( GameWindow *window ) return selectedGameInfo; -} // end getSelectedSaveFileInfo +} // ---------------------------------------------------con------------------------------------------ // ------------------------------------------------------------------------------------------------ // close the save/load menu @@ -412,7 +412,7 @@ static void doLoadGame( void ) TheShell->showShell(TRUE); } -} // end doLoadGame +} // ------------------------------------------------------------------------------------------------ /** Close the save/load menu */ @@ -429,7 +429,7 @@ static void closeSaveMenu( GameWindow *window ) else TheShell->hideShell(); -} // end closeSaveMenu +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -456,12 +456,12 @@ static void setEditDescription( GameWindow *editControl ) else defaultDesc.format( L"%S", TheGlobalData->m_mapName.str() ); - } // end else + } // set into edit control GadgetTextEntrySetText( editControl, defaultDesc ); -} // end setEditDescription +} //---------------------------------------------------------------------------------------------- static void processLoadButtonPress(GameWindow *window) @@ -482,7 +482,7 @@ static void processLoadButtonPress(GameWindow *window) closeSaveMenu( window ); doLoadGame(); - } // end if + } else { @@ -497,9 +497,9 @@ static void processLoadButtonPress(GameWindow *window) // show the load confirm dialog loadConfirm->winHide( FALSE ); - } // end else + } - } // end if + } } //------------------------------------------------------------------------------------------------- @@ -518,14 +518,14 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { break; - } // end case + } //---------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -537,7 +537,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end input + } //---------------------------------------------------------------------------------------------- case GLM_DOUBLE_CLICKED: @@ -575,7 +575,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end selected + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -586,7 +586,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, if( controlID == buttonLoadKey ) { processLoadButtonPress(window); - } // end if + } else if( controlID == buttonSaveKey ) { @@ -621,7 +621,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, TheWindowManager->winSetFocus(editDesc); - } // end if + } else { @@ -637,7 +637,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, //GameWindow *overwriteConfirm = TheWindowManager->winGetWindowFromId( parent, NAMEKEY( "PopupSaveLoad.wnd:OverwriteConfirmParent" ) ); overwriteConfirm->winHide( FALSE ); - } // end else + } } else if( controlID == buttonDeleteKey ) @@ -665,9 +665,9 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, //GameWindow *deleteConfirm = TheWindowManager->winGetWindowFromId( parent, NAMEKEY( "PopupSaveLoad.wnd:DeleteConfirmParent" ) ); deleteConfirm->winHide( FALSE ); - } // end if + } - } // end else if + } else if( controlID == buttonBackKey ) { if(isPopup) @@ -680,7 +680,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, TheShell->pop(); } - } // end if + } else if( controlID == buttonDeleteConfirm || controlID == buttonDeleteCancel ) { //GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( parent, NAMEKEY( "PopupSaveLoad.wnd:ListboxGames" ) ); @@ -704,7 +704,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, // repopulate the listbox TheGameState->populateSaveGameListbox( listboxGames, currentLayoutType ); - } // end if + } // hide the confirm dialog //GameWindow *deleteConfirm = TheWindowManager->winGetWindowFromId( parent, NAMEKEY( "PopupSaveLoad.wnd:DeleteConfirmParent" ) ); @@ -718,7 +718,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, buttonFrame->winEnable( TRUE ); updateMenuActions(); - } // end if + } else if( controlID == buttonOverwriteCancel || controlID == buttonOverwriteConfirm ) { //GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( parent, NAMEKEY( "PopupSaveLoad.wnd:ListboxGames" ) ); @@ -780,7 +780,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, GameWindow *editDesc = TheWindowManager->winGetWindowFromId( saveDesc, NAMEKEY( "PopupSaveLoad.wnd:EntryDesc" ) ); setEditDescription( editDesc ); */ - } // end if + } else if( controlID == buttonOverwriteCancel ) { //GameWindow *buttonFrame = TheWindowManager->winGetWindowFromId( parent, NAMEKEY( "PopupSaveLoad.wnd:MenuButtonFrame" ) ); @@ -790,9 +790,9 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, updateMenuActions(); listboxGames->winEnable( TRUE ); - } // end else if + } - } // end else if + } else if( controlID == buttonSaveDescConfirm ) { @@ -839,7 +839,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, filename = selectedGameInfo->filename; TheGameState->saveGame( filename, desc, fileType ); - } // end else if + } else if( controlID == buttonSaveDescCancel ) { @@ -856,7 +856,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, buttonFrame->winEnable( TRUE ); updateMenuActions(); - } // end else if + } else if( controlID == buttonLoadConfirm || controlID == buttonLoadCancel ) { @@ -886,16 +886,16 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, doLoadGame(); } - } // end else if + } break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp index 6d631038551..eb51606ebb8 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp @@ -445,7 +445,7 @@ void ToggleQuitMenu() TheInGameUI->setQuitMenuVisible(isVisible); -} // end ToggleQuitMenu +} //------------------------------------------------------------------------------------------------- /** Quit menu window system callback */ @@ -462,7 +462,7 @@ WindowMsgHandledType QuitMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -470,7 +470,7 @@ WindowMsgHandledType QuitMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end case + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -509,14 +509,14 @@ WindowMsgHandledType QuitMenuSystem( GameWindow *window, UnsignedInt msg, else if( controlID == buttonExit ) { quitConfirmationWindow = QuitMessageBoxYesNo(TheGameText->fetch("GUI:QuitPopupTitle"), TheGameText->fetch("GUI:QuitPopupMessage"),/*quitCallback*/exitQuitMenu,noExitQuitMenu); - } // end if + } else if( controlID == buttonReturn ) { // hide this menu ToggleQuitMenu(); - } // end else if + } else if( buttonOptions == controlID ) { WindowLayout *optLayout = TheShell->getOptionsLayout(TRUE); @@ -546,17 +546,17 @@ WindowMsgHandledType QuitMenuSystem( GameWindow *window, UnsignedInt msg, TheGameText->fetch("GUI:RestartConfirmation"), /*quitCallback*/restartMissionMenu,noExitQuitMenu); } - } // end else if + } break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end QuitMenuSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp index f391dcdf5e5..21e62db7f32 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp @@ -378,7 +378,7 @@ void ReplayMenuInit( WindowLayout *layout, void *userData ) win->winHide(TRUE); isShuttingDown = FALSE; -} // end ReplayMenuInit +} //------------------------------------------------------------------------------------------------- /** single player menu shutdown method */ @@ -394,12 +394,12 @@ void ReplayMenuShutdown( WindowLayout *layout, void *userData ) TheShell->shutdownComplete( layout ); return; - } //end if + } // our shutdown is complete TheTransitionHandler->reverse("ReplayMenuFade"); isShuttingDown = TRUE; -} // end ReplayMenuShutdown +} //------------------------------------------------------------------------------------------------- /** single player menu update method */ @@ -427,7 +427,7 @@ void ReplayMenuUpdate( WindowLayout *layout, void *userData ) if(isShuttingDown && TheShell->isAnimFinished()&& TheTransitionHandler->isFinished()) TheShell->shutdownComplete( layout ); -} // end ReplayMenuUpdate +} //------------------------------------------------------------------------------------------------- /** Replay menu input callback */ @@ -462,22 +462,22 @@ WindowMsgHandledType ReplayMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonBack, buttonBackID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end ReplayMenuInput +} void reallyLoadReplay(void) { @@ -564,7 +564,7 @@ WindowMsgHandledType ReplayMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -572,7 +572,7 @@ WindowMsgHandledType ReplayMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -584,7 +584,7 @@ WindowMsgHandledType ReplayMenuSystem( GameWindow *window, UnsignedInt msg, return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- case GLM_DOUBLE_CLICKED: { @@ -652,14 +652,14 @@ WindowMsgHandledType ReplayMenuSystem( GameWindow *window, UnsignedInt msg, filename = GetReplayFilenameFromListbox(listboxReplayFiles, selected); loadReplay(filename); } - } // end else if + } else if( controlID == buttonBackID ) { // thou art directed to return to thy known solar system immediately! TheShell->pop(); - } // end else if + } else if( controlID == buttonDeleteID ) { Int selected; @@ -685,14 +685,14 @@ WindowMsgHandledType ReplayMenuSystem( GameWindow *window, UnsignedInt msg, MessageBoxYesNo(TheGameText->fetch("GUI:CopyReplay"), TheGameText->fetch("GUI:AreYouSureCopy"), copyReplayFlag, NULL); } break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end ReplayMenuSystem +} void deleteReplay( void ) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp index 72ce7ec708f..b6f5dd70b98 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp @@ -390,22 +390,22 @@ WindowMsgHandledType ScoreScreenInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonOk, buttonOkID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end MainMenuInput +} static Bool showReplayButtonContinue() { @@ -439,7 +439,7 @@ WindowMsgHandledType ScoreScreenSystem( GameWindow *window, UnsignedInt msg, *(Bool *)mData2 = TRUE; break; - } // end input + } // -------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -513,7 +513,7 @@ WindowMsgHandledType ScoreScreenSystem( GameWindow *window, UnsignedInt msg, if(TheLAN) TheLAN->RequestChat(txtInput, LANAPIInterface::LANCHAT_EMOTE); //add the gamespy chat request here - } //if ( controlID == buttonEmote ) + } for(Int i = 0; i < MAX_SLOTS; ++i) { AsciiString name; @@ -572,7 +572,7 @@ WindowMsgHandledType ScoreScreenSystem( GameWindow *window, UnsignedInt msg, TheLAN->RequestChat(txtInput, LANAPIInterface::LANCHAT_NORMAL); //add the gamespy chat request here - }// if ( controlID == textEntryChatID ) + } break; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp index 24a26edebfa..2be66156a81 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp @@ -54,7 +54,7 @@ static void shutdownComplete( WindowLayout *layout ) // our shutdown is complete TheShell->shutdownComplete( layout ); -} // end if +} //------------------------------------------------------------------------------------------------- /** Initialize the single player menu */ @@ -89,7 +89,7 @@ void SinglePlayerMenuInit( WindowLayout *layout, void *userData ) //TheShell->registerWithAnimateManager(parent, WIN_ANIMATION_SLIDE_TOP, TRUE); -} // end SinglePlayerMenuInit +} //------------------------------------------------------------------------------------------------- /** single player menu shutdown method */ @@ -106,11 +106,11 @@ void SinglePlayerMenuShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } TheShell->reverseAnimatewindow(); -} // end SinglePlayerMenuShutdown +} //------------------------------------------------------------------------------------------------- /** single player menu update method */ @@ -122,7 +122,7 @@ void SinglePlayerMenuUpdate( WindowLayout *layout, void *userData ) if(isShuttingDown && TheShell->isAnimFinished()) shutdownComplete(layout); -} // end SinglePlayerMenuUpdate +} //------------------------------------------------------------------------------------------------- /** SinglePlayer menu input callback */ @@ -162,22 +162,22 @@ WindowMsgHandledType SinglePlayerMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)button, buttonID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end SinglePlayerMenuInput +} //------------------------------------------------------------------------------------------------- /** single player menu window system callback */ @@ -203,7 +203,7 @@ WindowMsgHandledType SinglePlayerMenuSystem( GameWindow *window, UnsignedInt msg break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -211,7 +211,7 @@ WindowMsgHandledType SinglePlayerMenuSystem( GameWindow *window, UnsignedInt msg break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -223,7 +223,7 @@ WindowMsgHandledType SinglePlayerMenuSystem( GameWindow *window, UnsignedInt msg return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -240,11 +240,11 @@ WindowMsgHandledType SinglePlayerMenuSystem( GameWindow *window, UnsignedInt msg TheShell->push( AsciiString( "Menus/MapSelectMenu.wnd" ) ); buttonPushed = true; - } // end if + } else if( controlID == buttonLoad ) { - } // end else if + } else if( controlID == buttonBack ) { @@ -252,16 +252,16 @@ WindowMsgHandledType SinglePlayerMenuSystem( GameWindow *window, UnsignedInt msg TheShell->pop(); buttonPushed = true; - } // end else if + } break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end SinglePlayerMenuSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp index b5a1e97f3b8..7615ba4ae07 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp @@ -493,7 +493,7 @@ static void startPressed(void) CheckForCDAtGameStart( reallyDoStart ); } -}//void startPressed(void) +} ///////////////////////////////////////////////////// // MapSelectorTooltip - shows tooltips for the tech buildings @@ -1309,7 +1309,7 @@ void SkirmishGameOptionsMenuInit( WindowLayout *layout, void *userData ) if(win) win->winHide(TRUE); buttonPushed = FALSE; -}// void SkirmishGameOptionsMenuInit( WindowLayout *layout, void *userData ) +} //------------------------------------------------------------------------------------------------- /** This is called when a shutdown is complete for this menu */ @@ -1333,7 +1333,7 @@ static void shutdownComplete( WindowLayout *layout ) //LANnextScreen = NULL; -} // end if +} //------------------------------------------------------------------------------------------------- /** Skirmish Game Options menu shutdown method */ @@ -1352,7 +1352,7 @@ void SkirmishGameOptionsMenuShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } TheShell->reverseAnimatewindow(); @@ -1362,7 +1362,7 @@ void SkirmishGameOptionsMenuShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheTransitionHandler->reverse("SkirmishGameOptionsMenuFade"); -} // void SkirmishGameOptionsMenuShutdown( WindowLayout *layout, void *userData ) +} //------------------------------------------------------------------------------------------------- /** Skirmish Game Options menu update method */ @@ -1389,7 +1389,7 @@ void SkirmishGameOptionsMenuUpdate( WindowLayout * layout, void *userData) if(TheShell->isAnimFinished() && TheTransitionHandler->isFinished()) TheShell->shutdownComplete( layout ); -}// void SkirmishGameOptionsMenuUpdate( WindowLayout * layout, void *userData) +} //------------------------------------------------------------------------------------------------- /** Skirmish Game Options menu input callback */ @@ -1419,16 +1419,16 @@ WindowMsgHandledType SkirmishGameOptionsMenuInput( GameWindow *window, UnsignedI { TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonExit, buttonExitID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape - } // end switch( key ) - } // end char + } + } + } break; - } // end switch( msg ) + } return MSG_IGNORED; -}//WindowMsgHandledType SkirmishGameOptionsMenuInput( GameWindow *window, UnsignedInt msg, +} //------------------------------------------------------------------------------------------------- @@ -1444,7 +1444,7 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned case GWM_CREATE: { break; - } // case GWM_DESTROY: + } //------------------------------------------------------------------------------------------------- case GWM_DESTROY: { @@ -1452,7 +1452,7 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned windowMap->winSetUserData(NULL); break; - } // case GWM_DESTROY: + } //------------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: { @@ -1461,7 +1461,7 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } //------------------------------------------------------------------------------------------------- case GCM_SELECTED: { @@ -1488,7 +1488,7 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned } sandboxOk = FALSE; skirmishUpdateSlotList(); - }// case GCM_SELECTED: + } //------------------------------------------------------------------------------------------------- case GSM_SLIDER_TRACK: { @@ -1525,7 +1525,7 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned delete TheSkirmishGameInfo; TheSkirmishGameInfo = NULL; - } //if ( controlID == buttonBack ) + } // else if ( controlID == buttonResetFPSID ) // { // static NameKeyType sliderGameSpeedID = TheNameKeyGenerator->nameToKey( AsciiString( "SkirmishGameOptionsMenu.wnd:SliderGameSpeed" ) ); @@ -1601,7 +1601,7 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned } } break; - }// case GBM_SELECTED: + } //------------------------------------------------------------------------------------------------- case GBM_SELECTED_RIGHT: { @@ -1653,7 +1653,7 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned //------------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp index 5114618929a..294124fea5e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp @@ -314,7 +314,7 @@ void SkirmishMapSelectMenuInit( WindowLayout *layout, void *userData ) mapList->winSetTooltipFunc(mapListTooltipFunc); } -} // end SkirmishMapSelectMenuInit +} //------------------------------------------------------------------------------------------------- /** MapSelect menu shutdown method */ @@ -330,7 +330,7 @@ void SkirmishMapSelectMenuShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheShell->shutdownComplete( layout ); -} // end LanMapSelectMenuShutdown +} //------------------------------------------------------------------------------------------------- /** MapSelect menu update method */ @@ -338,7 +338,7 @@ void SkirmishMapSelectMenuShutdown( WindowLayout *layout, void *userData ) void SkirmishMapSelectMenuUpdate( WindowLayout *layout, void *userData ) { -} // end SkirmishMapSelectMenuUpdate +} //------------------------------------------------------------------------------------------------- /** Map select menu input callback */ @@ -376,22 +376,22 @@ WindowMsgHandledType SkirmishMapSelectMenuInput( GameWindow *window, UnsignedInt TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)button, buttonID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end SkirmishMapSelectMenuInput +} //------------------------------------------------------------------------------------------------- /** MapSelect menu window system callback */ @@ -408,7 +408,7 @@ WindowMsgHandledType SkirmishMapSelectMenuSystem( GameWindow *window, UnsignedIn { break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -416,7 +416,7 @@ WindowMsgHandledType SkirmishMapSelectMenuSystem( GameWindow *window, UnsignedIn NullifyControls(); break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -428,7 +428,7 @@ WindowMsgHandledType SkirmishMapSelectMenuSystem( GameWindow *window, UnsignedIn return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- case GLM_DOUBLE_CLICKED: @@ -536,7 +536,7 @@ WindowMsgHandledType SkirmishMapSelectMenuSystem( GameWindow *window, UnsignedIn //TheShell->pop(); //do you need this ?? //PostToLanGameOptions( MAP_BACK ); - } // end if + } else if ( controlID == buttonOK ) { @@ -599,18 +599,18 @@ WindowMsgHandledType SkirmishMapSelectMenuSystem( GameWindow *window, UnsignedIn } //TheShell->pop(); - } // end if - } // end else if + } + } break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end SkirmishMapSelectMenuSystem*/ +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp index dde2e635b85..87d5a651ccb 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp @@ -547,7 +547,7 @@ void HandleBuddyResponses( void ) if( TheAudio ) { TheAudio->addAudioEvent( &buddyMsgAudio ); - } // end if + } UnicodeString snippet = message.m_message; snippet.truncateTo(11); @@ -677,7 +677,7 @@ void showNotificationBox( AsciiString nick, UnicodeString message) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } } @@ -759,7 +759,7 @@ void WOLBuddyOverlayInit( WindowLayout *layout, void *userData ) isOverlayActive = true; updateBuddyInfo(); -} // WOLBuddyOverlayInit +} //------------------------------------------------------------------------------------------------- /** WOL Buddy Overlay shutdown method */ @@ -778,7 +778,7 @@ void WOLBuddyOverlayShutdown( WindowLayout *layout, void *userData ) InitBuddyControls(BUDDY_RESETALL_CRAP); -} // WOLBuddyOverlayShutdown +} //------------------------------------------------------------------------------------------------- @@ -788,7 +788,7 @@ void WOLBuddyOverlayUpdate( WindowLayout * layout, void *userData) { if (!TheGameSpyBuddyMessageQueue || !TheGameSpyBuddyMessageQueue->isConnected()) GameSpyCloseOverlay(GSOVERLAY_BUDDY); -}// WOLBuddyOverlayUpdate +} //------------------------------------------------------------------------------------------------- /** WOL Buddy Overlay input callback */ @@ -821,21 +821,21 @@ WindowMsgHandledType WOLBuddyOverlayInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonHide, buttonHideID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// WOLBuddyOverlayInput +} //------------------------------------------------------------------------------------------------- /** WOL Buddy Overlay window system callback */ @@ -856,12 +856,12 @@ WindowMsgHandledType WOLBuddyOverlaySystem( GameWindow *window, UnsignedInt msg, { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -870,7 +870,7 @@ WindowMsgHandledType WOLBuddyOverlaySystem( GameWindow *window, UnsignedInt msg, *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } case GLM_RIGHT_CLICKED: { GameWindow *control = (GameWindow *)mData1; @@ -983,7 +983,7 @@ WindowMsgHandledType WOLBuddyOverlaySystem( GameWindow *window, UnsignedInt msg, */ } break; - }// case GBM_SELECTED: + } case GLM_DOUBLE_CLICKED: { /* @@ -1091,10 +1091,10 @@ WindowMsgHandledType WOLBuddyOverlaySystem( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// WOLBuddyOverlaySystem +} WindowMsgHandledType PopupBuddyNotificationSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 ) @@ -1104,12 +1104,12 @@ WindowMsgHandledType PopupBuddyNotificationSystem( GameWindow *window, UnsignedI case GWM_CREATE: { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GBM_SELECTED: { @@ -1126,10 +1126,10 @@ WindowMsgHandledType PopupBuddyNotificationSystem( GameWindow *window, UnsignedI default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// PopupBuddyNotificationSystem +} /* static NameKeyType buttonAcceptBuddyID = NAMEKEY_INVALID; @@ -1220,7 +1220,7 @@ void RequestBuddyAdd(Int profileID, AsciiString nick) if( TheAudio ) { TheAudio->addAudioEvent( &buddyMsgAudio ); - } // end if + } lastNotificationWasStatus = FALSE; numOnlineInNotification = 0; @@ -1237,13 +1237,13 @@ WindowMsgHandledType WOLBuddyOverlayRCMenuSystem( GameWindow *window, UnsignedIn { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { rcMenu = NULL; break; - } // case GWM_DESTROY: + } case GGM_CLOSE: { @@ -1386,7 +1386,7 @@ WindowMsgHandledType WOLBuddyOverlayRCMenuSystem( GameWindow *window, UnsignedIn default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp index 3d778d64b9c..f6c794877da 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp @@ -84,7 +84,7 @@ void WOLCustomScoreScreenInit( WindowLayout *layout, void *userData ) // Set Keyboard to Main Parent TheWindowManager->winSetFocus( parentWOLCustomScore ); -} // WOLCustomScoreScreenInit +} //------------------------------------------------------------------------------------------------- /** WOL Status Menu shutdown method */ @@ -96,7 +96,7 @@ void WOLCustomScoreScreenShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheShell->shutdownComplete( layout ); -} // WOLCustomScoreScreenShutdown +} //------------------------------------------------------------------------------------------------- @@ -108,7 +108,7 @@ void WOLCustomScoreScreenUpdate( WindowLayout * layout, void *userData) if (WOL::TheWOL) WOL::TheWOL->update(); */ -}// WOLCustomScoreScreenUpdate +} //------------------------------------------------------------------------------------------------- /** WOL Status Menu input callback */ @@ -141,21 +141,21 @@ WindowMsgHandledType WOLCustomScoreScreenInput( GameWindow *window, UnsignedInt TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonDisconnect, buttonDisconnectID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// WOLCustomScoreScreenInput +} //------------------------------------------------------------------------------------------------- /** WOL Status Menu window system callback */ @@ -172,12 +172,12 @@ WindowMsgHandledType WOLCustomScoreScreenSystem( GameWindow *window, UnsignedInt { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -186,7 +186,7 @@ WindowMsgHandledType WOLCustomScoreScreenSystem( GameWindow *window, UnsignedInt *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } case GBM_SELECTED: { @@ -201,7 +201,7 @@ WindowMsgHandledType WOLCustomScoreScreenSystem( GameWindow *window, UnsignedInt WOL::TheWOL->addCommand( WOL::WOLCOMMAND_RESET ); // don't display an error, log out, or anything } - } //if ( controlID == buttonDisconnect ) + } else if ( controlID == buttonLobbyID ) { if (WOL::TheWOL->getState() != WOL::WOLAPI_FATAL_ERROR) @@ -214,10 +214,10 @@ WindowMsgHandledType WOLCustomScoreScreenSystem( GameWindow *window, UnsignedInt else { } - } //if ( controlID == buttonDisconnect ) + } */ break; - }// case GBM_SELECTED: + } case GEM_EDIT_DONE: { @@ -226,7 +226,7 @@ WindowMsgHandledType WOLCustomScoreScreenSystem( GameWindow *window, UnsignedInt default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// WOLCustomScoreScreenSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp index 12d5853bca5..1490af33dfb 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp @@ -894,7 +894,7 @@ static void StartPressed(void) TheGameSpyPeerMessageQueue->addRequest(req); } -}//void StartPressed(void) +} //------------------------------------------------------------------------------------------------- /** Update options on screen */ @@ -1320,7 +1320,7 @@ void WOLGameSetupMenuInit( WindowLayout *layout, void *userData ) TheWindowManager->winSetFocus( textEntryChat ); raiseMessageBoxes = true; TheTransitionHandler->setGroup("GameSpyGameOptionsMenuFade"); -}// void WOLGameSetupMenuInit( WindowLayout *layout, void *userData ) +} //------------------------------------------------------------------------------------------------- /** This is called when a shutdown is complete for this menu */ @@ -1358,7 +1358,7 @@ static void shutdownComplete( WindowLayout *layout ) nextScreen = NULL; -} // end if +} //------------------------------------------------------------------------------------------------- /** GameSpy Game Options menu shutdown method */ @@ -1392,13 +1392,13 @@ void WOLGameSetupMenuShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } TheShell->reverseAnimatewindow(); RaiseGSMessageBox(); TheTransitionHandler->reverse("GameSpyGameOptionsMenuFade"); -} // void WOLGameSetupMenuShutdown( WindowLayout *layout, void *userData ) +} static void fillPlayerInfo(const PeerResponse *resp, PlayerInfo *info) { @@ -2241,7 +2241,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) } -}// void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) +} //------------------------------------------------------------------------------------------------- /** Lan Game Options menu input callback */ @@ -2286,16 +2286,16 @@ WindowMsgHandledType WOLGameSetupMenuInput( GameWindow *window, UnsignedInt msg, { TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonBack, buttonBackID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape - } // end switch( key ) - } // end char - } // end switch( msg ) + } + } + } + } */ return MSG_IGNORED; -}//WindowMsgHandledType WOLGameSetupMenuInput( GameWindow *window, UnsignedInt msg, +} // Slash commands ------------------------------------------------------------------------- @@ -2399,7 +2399,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg { buttonCommunicatorID = NAMEKEY("GameSpyGameOptionsMenu.wnd:ButtonCommunicator"); break; - } // case GWM_DESTROY: + } //------------------------------------------------------------------------------------------------- case GWM_DESTROY: { @@ -2407,7 +2407,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg windowMap->winSetUserData(NULL); break; - } // case GWM_DESTROY: + } //------------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: { @@ -2416,7 +2416,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } //------------------------------------------------------------------------------------------------- case GCM_SELECTED: { @@ -2485,7 +2485,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg break; } } - }// case GCM_SELECTED: + } //------------------------------------------------------------------------------------------------- case GBM_SELECTED: { @@ -2513,7 +2513,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg nextScreen = "Menus/WOLCustomLobby.wnd"; TheShell->pop(); - } //if ( controlID == buttonBack ) + } else if ( controlID == buttonCommunicatorID ) { GameSpyToggleOverlay( GSOVERLAY_BUDDY ); @@ -2530,7 +2530,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg // Echo the user's input to the chat window if (!txtInput.isEmpty()) TheGameSpyInfo->sendChat(txtInput, FALSE, NULL); // 'emote' button is now carriage-return - } //if ( controlID == buttonEmote ) + } else if ( controlID == buttonSelectMapID ) { WOLMapSelectLayout = TheWindowManager->winCreateLayout( "Menus/WOLMapSelectMenu.wnd" ); @@ -2612,7 +2612,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg break; - }// case GBM_SELECTED: + } //------------------------------------------------------------------------------------------------- case GBM_SELECTED_RIGHT: { @@ -2675,14 +2675,14 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg } } - }// if ( controlID == textEntryChatID ) + } break; } //------------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}//WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg, +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp index 0059b2dff64..f5becf05da1 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp @@ -81,7 +81,7 @@ void WOLLadderScreenInit( WindowLayout *layout, void *userData ) // set keyboard focus to main parent TheWindowManager->winSetFocus( parentWindow ); -} // end ReplayMenuInit +} //------------------------------------------------------------------------------------------------- /** single player menu shutdown method */ @@ -100,7 +100,7 @@ void WOLLadderScreenShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheShell->shutdownComplete( layout ); -} // end ReplayMenuShutdown +} //------------------------------------------------------------------------------------------------- /** single player menu update method */ @@ -108,7 +108,7 @@ void WOLLadderScreenShutdown( WindowLayout *layout, void *userData ) void WOLLadderScreenUpdate( WindowLayout *layout, void *userData ) { -} // end ReplayMenuUpdate +} //------------------------------------------------------------------------------------------------- /** Replay menu input callback */ @@ -143,22 +143,22 @@ WindowMsgHandledType WOLLadderScreenInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonBack, buttonBackID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end ReplayMenuInput +} //------------------------------------------------------------------------------------------------- /** single player menu window system callback */ @@ -177,7 +177,7 @@ WindowMsgHandledType WOLLadderScreenSystem( GameWindow *window, UnsignedInt msg, break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -185,7 +185,7 @@ WindowMsgHandledType WOLLadderScreenSystem( GameWindow *window, UnsignedInt msg, break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -197,7 +197,7 @@ WindowMsgHandledType WOLLadderScreenSystem( GameWindow *window, UnsignedInt msg, return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: { @@ -210,16 +210,16 @@ WindowMsgHandledType WOLLadderScreenSystem( GameWindow *window, UnsignedInt msg, // thou art directed to return to thy known solar system immediately! TheShell->pop(); - } // end else if + } break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end ReplayMenuSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp index a9a2b283cef..439aafc56b3 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp @@ -703,7 +703,7 @@ void WOLLobbyMenuInit( WindowLayout *layout, void *userData ) if(win) win->winHide(TRUE); DontShowMainMenu = TRUE; -} // WOLLobbyMenuInit +} //------------------------------------------------------------------------------------------------- /** This is called when a shutdown is complete for this menu */ @@ -726,7 +726,7 @@ static void shutdownComplete( WindowLayout *layout ) nextScreen = NULL; -} // end if +} //------------------------------------------------------------------------------------------------- /** WOL Lobby Menu shutdown method */ @@ -771,7 +771,7 @@ void WOLLobbyMenuShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } TheShell->reverseAnimatewindow(); DontShowMainMenu = FALSE; @@ -779,7 +779,7 @@ void WOLLobbyMenuShutdown( WindowLayout *layout, void *userData ) RaiseGSMessageBox(); TheTransitionHandler->reverse("WOLCustomLobbyFade"); -} // WOLLobbyMenuShutdown +} static void fillPlayerInfo(const PeerResponse *resp, PlayerInfo *info) { @@ -1307,7 +1307,7 @@ void WOLLobbyMenuUpdate( WindowLayout * layout, void *userData) refreshGameList(); #endif } -}// WOLLobbyMenuUpdate +} //------------------------------------------------------------------------------------------------- /** WOL Lobby Menu input callback */ @@ -1342,21 +1342,21 @@ WindowMsgHandledType WOLLobbyMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonBack, buttonBackID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// WOLLobbyMenuInput +} //static void doSliderTrack(GameWindow *control, Int val) //{ @@ -1427,13 +1427,13 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, // sliderChatAdjustID = NAMEKEY("WOLCustomLobby.wnd:SliderChatAdjust"); break; - } // case GWM_DESTROY: + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } //--------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -1443,7 +1443,7 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } //--------------------------------------------------------------------------------------------- case GLM_SELECTED: @@ -1480,7 +1480,7 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, { RefreshGameInfoListBox(GetGameListBox(), GetGameInfoListBox()); } - } //if ( controlID == GetGameListBoxID() ) + } break; } @@ -1511,7 +1511,7 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, nextScreen = "Menus/WOLWelcomeMenu.wnd"; TheShell->pop(); - } //if ( controlID == buttonBack ) + } else if ( controlID == buttonRefreshID ) { // Added 2/17/03 added the game refresh button @@ -1633,7 +1633,7 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, } break; - }// case GBM_SELECTED: + } //--------------------------------------------------------------------------------------------- case GCM_SELECTED: @@ -1670,7 +1670,7 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, } } } - } // case GCM_SELECTED + } break; //--------------------------------------------------------------------------------------------- @@ -1695,7 +1695,7 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, } } break; - }// case GLM_DOUBLE_CLICKED: + } //--------------------------------------------------------------------------------------------- case GLM_RIGHT_CLICKED: @@ -1852,7 +1852,7 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// WOLLobbyMenuSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp index f3098a5ac5f..413afeb38a6 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp @@ -86,7 +86,7 @@ void WOLLocaleSelectInit( WindowLayout *layout, void *userData ) // Set Keyboard to Main Parent TheWindowManager->winSetFocus( parentLocaleSelect ); TheWindowManager->winSetModal( parentLocaleSelect ); -} // WOLLocaleSelectInit +} //------------------------------------------------------------------------------------------------- /** WOL Status Menu shutdown method */ @@ -100,7 +100,7 @@ void WOLLocaleSelectShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheShell->shutdownComplete( layout ); -} // WOLLocaleSelectShutdown +} //------------------------------------------------------------------------------------------------- @@ -109,7 +109,7 @@ void WOLLocaleSelectShutdown( WindowLayout *layout, void *userData ) void WOLLocaleSelectUpdate( WindowLayout * layout, void *userData) { -}// WOLLocaleSelectUpdate +} //------------------------------------------------------------------------------------------------- /** WOL Status Menu input callback */ @@ -129,10 +129,10 @@ WindowMsgHandledType WOLLocaleSelectInput( GameWindow *window, UnsignedInt msg, // ---------------------------------------------------------------------------------------- // don't let key fall through anywhere else return MSG_HANDLED; - } // end char - } // end switch( msg ) + } + } return MSG_IGNORED; -}// WOLLocaleSelectInput +} //Int getRegistryNicknameOffset(AsciiString nick); /// @todo: mdc remove this once we can save ini pref files //------------------------------------------------------------------------------------------------- @@ -151,12 +151,12 @@ WindowMsgHandledType WOLLocaleSelectSystem( GameWindow *window, UnsignedInt msg, { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -165,7 +165,7 @@ WindowMsgHandledType WOLLocaleSelectSystem( GameWindow *window, UnsignedInt msg, *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } case GBM_SELECTED: { @@ -213,9 +213,9 @@ WindowMsgHandledType WOLLocaleSelectSystem( GameWindow *window, UnsignedInt msg, TheGameSpyPSMessageQueue->addResponse(newResp); } CheckReOpenPlayerInfo(); - } //if ( controlID == buttonDisconnect ) + } break; - }// case GBM_SELECTED: + } case GEM_EDIT_DONE: { @@ -224,7 +224,7 @@ WindowMsgHandledType WOLLocaleSelectSystem( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// WOLLocaleSelectSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp index dc88a544e7a..f8bca741969 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp @@ -364,7 +364,7 @@ static void shutdownComplete( WindowLayout *layout ) nextScreen = NULL; -} // end if +} // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// @@ -726,7 +726,7 @@ void WOLLoginMenuInit( WindowLayout *layout, void *userData ) } TheTransitionHandler->setGroup("GameSpyLoginProfileFade"); -} // WOLLoginMenuInit +} //------------------------------------------------------------------------------------------------- /** WOL Login Menu shutdown method */ @@ -754,12 +754,12 @@ void WOLLoginMenuShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } TheShell->reverseAnimatewindow(); TheTransitionHandler->reverse("GameSpyLoginProfileFade"); -} // WOLLoginMenuShutdown +} // this is used to check if we've got all the pings @@ -899,7 +899,7 @@ void WOLLoginMenuUpdate( WindowLayout * layout, void *userData) SetUpGameSpy( motd.str(), config.str() ); } -}// WOLLoginMenuUpdate +} //------------------------------------------------------------------------------------------------- /** WOL Login Menu input callback */ @@ -934,21 +934,21 @@ WindowMsgHandledType WOLLoginMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonBack, buttonBackID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// WOLLoginMenuInput +} static Bool isNickOkay(UnicodeString nick) { @@ -1034,12 +1034,12 @@ WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, case GWM_CREATE: { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -1048,7 +1048,7 @@ WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } // someone typed in a combo box. Clear password (or fill it in if the typed name matches a known login name) case GCM_UPDATE_TEXT: @@ -1215,7 +1215,7 @@ WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, buttonPushed = true; TearDownGameSpy(); TheShell->pop(); - } //if ( controlID == buttonBack ) + } #ifdef ALLOW_NON_PROFILED_LOGIN else if ( controlID == buttonUseAccountID ) { @@ -1223,14 +1223,14 @@ WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, nextScreen = "Menus/GameSpyLoginProfile.wnd"; TheShell->pop(); //TheShell->push( "Menus/GameSpyLoginProfile.wnd" ); - } //if ( controlID == buttonUseAccount ) + } else if ( controlID == buttonDontUseAccountID ) { buttonPushed = true; nextScreen = "Menus/GameSpyLoginQuick.wnd"; TheShell->pop(); //TheShell->push( "Menus/GameSpyLoginQuick.wnd" ); - } //if ( controlID == buttonDontUseAccount ) + } #endif // ALLOW_NON_PROFILED_LOGIN else if ( controlID == buttonCreateAccountID ) { @@ -1320,7 +1320,7 @@ WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, TheShell->pop(); } #endif // ALLOW_NON_PROFILED_LOGIN - } //if ( controlID == buttonCreateAccount ) + } else if ( controlID == buttonLoginID ) { AsciiString login, password, email; @@ -1428,7 +1428,7 @@ WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, } #endif // ALLOW_NON_PROFILED_LOGIN - } //if ( controlID == buttonLogin ) + } else if ( controlID == buttonTOSID ) { parentTOS->winHide(FALSE); @@ -1500,7 +1500,7 @@ WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, buttonBack->winEnable(TRUE); } break; - }// case GBM_SELECTED: + } case GEM_EDIT_DONE: { @@ -1522,16 +1522,16 @@ WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, munkee.removeLastChar(); GadgetTextEntrySetText( textEntryLoginName, munkee ); } - }// if ( controlID == textEntryLoginNameID ) + } break; - }//case GEM_UPDATE_TEXT: + } */ default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// WOLLoginMenuSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp index 3cb7e5b490b..00d52c1ddae 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp @@ -183,7 +183,7 @@ void WOLMapSelectMenuInit( WindowLayout *layout, void *userData ) populateMapListbox( mapList, usesSystemMapDir, TRUE, TheGameSpyGame->getMap() ); } -} // end WOLMapSelectMenuInit +} //------------------------------------------------------------------------------------------------- /** MapSelect menu shutdown method */ @@ -198,7 +198,7 @@ void WOLMapSelectMenuShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheShell->shutdownComplete( layout ); -} // end WOLMapSelectMenuShutdown +} //------------------------------------------------------------------------------------------------- /** MapSelect menu update method */ @@ -214,7 +214,7 @@ void WOLMapSelectMenuUpdate( WindowLayout *layout, void *userData ) // No update because the game setup screen is up at the same // time and it does the update for us... -} // end WOLMapSelectMenuUpdate +} //------------------------------------------------------------------------------------------------- /** Map select menu input callback */ @@ -252,22 +252,22 @@ WindowMsgHandledType WOLMapSelectMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)button, buttonID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end WOLMapSelectMenuInput +} void WOLPositionStartSpots( void ); //------------------------------------------------------------------------------------------------- @@ -285,7 +285,7 @@ WindowMsgHandledType WOLMapSelectMenuSystem( GameWindow *window, UnsignedInt msg { break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -293,7 +293,7 @@ WindowMsgHandledType WOLMapSelectMenuSystem( GameWindow *window, UnsignedInt msg NullifyControls(); break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -305,7 +305,7 @@ WindowMsgHandledType WOLMapSelectMenuSystem( GameWindow *window, UnsignedInt msg return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- case GLM_DOUBLE_CLICKED: @@ -388,7 +388,7 @@ WindowMsgHandledType WOLMapSelectMenuSystem( GameWindow *window, UnsignedInt msg } WOLPositionStartSpots(); - } // end if + } else if ( controlID == radioButtonSystemMapsID ) { if (TheMapCache) @@ -459,19 +459,19 @@ WindowMsgHandledType WOLMapSelectMenuSystem( GameWindow *window, UnsignedInt msg WOLPositionStartSpots(); - } // end if + } - } // end else if + } break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end WOLMapSelectMenuSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp index a0eed63f193..d5f15f232f7 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp @@ -71,7 +71,7 @@ void WOLMessageWindowInit( WindowLayout *layout, void *userData ) // Set Keyboard to Main Parent TheWindowManager->winSetFocus( parentWOLMessageWindow ); -} // WOLMessageWindowInit +} //------------------------------------------------------------------------------------------------- /** WOLMessage Window shutdown method */ @@ -84,7 +84,7 @@ void WOLMessageWindowShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheShell->shutdownComplete( layout ); -} // WOLMessageWindowShutdown +} //------------------------------------------------------------------------------------------------- @@ -97,7 +97,7 @@ void WOLMessageWindowUpdate( WindowLayout * layout, void *userData) WOL::TheWOL->update(); */ -}// WOLMessageWindowUpdate +} //------------------------------------------------------------------------------------------------- /** WOLMessage Window input callback */ @@ -130,21 +130,21 @@ WindowMsgHandledType WOLMessageWindowInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonCancel, buttonCancelID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// WOLMessageWindowInput +} //------------------------------------------------------------------------------------------------- /** WOLMessage Window window system callback */ @@ -162,12 +162,12 @@ WindowMsgHandledType WOLMessageWindowSystem( GameWindow *window, UnsignedInt msg { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -176,12 +176,12 @@ WindowMsgHandledType WOLMessageWindowSystem( GameWindow *window, UnsignedInt msg *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } case GBM_SELECTED: { break; - }// case GBM_SELECTED: + } case GEM_EDIT_DONE: { @@ -190,7 +190,7 @@ WindowMsgHandledType WOLMessageWindowSystem( GameWindow *window, UnsignedInt msg default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// WOLMessageWindowSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp index 0d8cc5c9e60..467c9d8756b 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp @@ -85,7 +85,7 @@ void WOLQMScoreScreenInit( WindowLayout *layout, void *userData ) //progressLayout = TheShell->top(); -} // WOLQMScoreScreenInit +} //------------------------------------------------------------------------------------------------- /** WOL Status Menu shutdown method */ @@ -101,7 +101,7 @@ void WOLQMScoreScreenShutdown( WindowLayout *layout, void *userData ) //progressLayout = NULL; -} // WOLQMScoreScreenShutdown +} //------------------------------------------------------------------------------------------------- @@ -113,7 +113,7 @@ void WOLQMScoreScreenUpdate( WindowLayout * layout, void *userData) if (WOL::TheWOL) WOL::TheWOL->update(); */ -}// WOLQMScoreScreenUpdate +} //------------------------------------------------------------------------------------------------- /** WOL Status Menu input callback */ @@ -146,21 +146,21 @@ WindowMsgHandledType WOLQMScoreScreenInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonDisconnect, buttonDisconnectID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// WOLQMScoreScreenInput +} //------------------------------------------------------------------------------------------------- /** WOL Status Menu window system callback */ @@ -178,12 +178,12 @@ WindowMsgHandledType WOLQMScoreScreenSystem( GameWindow *window, UnsignedInt msg { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -192,7 +192,7 @@ WindowMsgHandledType WOLQMScoreScreenSystem( GameWindow *window, UnsignedInt msg *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } case GBM_SELECTED: { @@ -208,7 +208,7 @@ WindowMsgHandledType WOLQMScoreScreenSystem( GameWindow *window, UnsignedInt msg WOL::TheWOL->addCommand( WOL::WOLCOMMAND_RESET ); // don't display an error, log out, or anything } - } //if ( controlID == buttonDisconnect ) + } else if ( controlID == buttonQuickmatchID ) { //TheShell->pop(); @@ -221,10 +221,10 @@ WindowMsgHandledType WOLQMScoreScreenSystem( GameWindow *window, UnsignedInt msg } } - } //if ( controlID == buttonDisconnect ) + } */ break; - }// case GBM_SELECTED: + } case GEM_EDIT_DONE: { @@ -233,7 +233,7 @@ WindowMsgHandledType WOLQMScoreScreenSystem( GameWindow *window, UnsignedInt msg default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// WOLQMScoreScreenSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp index 0b281bd63a5..481b475b744 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp @@ -916,7 +916,7 @@ void WOLQuickMatchMenuInit( WindowLayout *layout, void *userData ) UpdateStartButton(); TheTransitionHandler->setGroup("WOLQuickMatchMenuFade"); isInInit= FALSE; -} // WOLQuickMatchMenuInit +} //------------------------------------------------------------------------------------------------- /** This is called when a shutdown is complete for this menu */ @@ -939,7 +939,7 @@ static void shutdownComplete( WindowLayout *layout ) nextScreen = NULL; -} // end if +} //------------------------------------------------------------------------------------------------- /** WOL Quick Match Menu shutdown method */ @@ -966,13 +966,13 @@ void WOLQuickMatchMenuShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } TheShell->reverseAnimatewindow(); TheTransitionHandler->reverse("WOLQuickMatchMenuFade"); RaiseGSMessageBox(); -} // WOLQuickMatchMenuShutdown +} #ifdef PERF_TEST @@ -1394,7 +1394,7 @@ void WOLQuickMatchMenuUpdate( WindowLayout * layout, void *userData) } #endif // PERF_TEST } -}// WOLQuickMatchMenuUpdate +} //------------------------------------------------------------------------------------------------- /** WOL Quick Match Menu input callback */ @@ -1430,21 +1430,21 @@ WindowMsgHandledType WOLQuickMatchMenuInput( GameWindow *window, UnsignedInt msg TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonBack, buttonBackID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// WOLQuickMatchMenuInput +} //------------------------------------------------------------------------------------------------- /** WOL Quick Match Menu window system callback */ @@ -1462,12 +1462,12 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -1476,7 +1476,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } case GCM_SELECTED: { @@ -1528,7 +1528,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms UpdateStartButton(); } break; - } // case GCM_SELECTED + } case GBM_SELECTED: { @@ -1759,7 +1759,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms TheGameSpyInfo->leaveGroupRoom(); nextScreen = "Menus/WOLWelcomeMenu.wnd"; TheShell->pop(); - } //if ( controlID == buttonBack ) + } else if ( controlID == buttonSelectAllMapsID ) { Int numMaps = GadgetListBoxGetNumEntries(listboxMapSelect); @@ -1769,7 +1769,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms GadgetListBoxSetItemData(listboxMapSelect, (void *)1, i); GadgetListBoxAddEntryText(listboxMapSelect, GadgetListBoxGetText(listboxMapSelect, i, 1), GameSpyColor[GSCOLOR_MAP_SELECTED], i, 1); } - } //if ( controlID == buttonSelectAllMapsID ) + } else if ( controlID == buttonSelectNoMapsID ) { Int numMaps = GadgetListBoxGetNumEntries(listboxMapSelect); @@ -1779,9 +1779,9 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms GadgetListBoxSetItemData(listboxMapSelect, (void *)0, i); GadgetListBoxAddEntryText(listboxMapSelect, GadgetListBoxGetText(listboxMapSelect, i, 1), GameSpyColor[GSCOLOR_MAP_UNSELECTED], i, 1); } - } //if ( controlID == buttonSelectNoMapsID ) + } break; - }// case GBM_SELECTED: + } case GLM_SELECTED: { @@ -1812,7 +1812,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms } UpdateStartButton(); break; - }// case GLM_SELECTED + } case GEM_EDIT_DONE: { @@ -1821,7 +1821,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// WOLQuickMatchMenuSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp index 78ccb8ee685..611013f1e93 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp @@ -76,7 +76,7 @@ void WOLStatusMenuInit( WindowLayout *layout, void *userData ) //progressLayout = TheShell->top(); //WOL::raiseWOLMessageBox(); -} // WOLStatusMenuInit +} //------------------------------------------------------------------------------------------------- /** WOL Status Menu shutdown method */ @@ -93,7 +93,7 @@ void WOLStatusMenuShutdown( WindowLayout *layout, void *userData ) //progressLayout = NULL; //WOL::raiseWOLMessageBox(); -} // WOLStatusMenuShutdown +} //------------------------------------------------------------------------------------------------- @@ -103,7 +103,7 @@ void WOLStatusMenuUpdate( WindowLayout * layout, void *userData) { //if (WOL::TheWOL) //WOL::TheWOL->update(); -}// WOLStatusMenuUpdate +} //------------------------------------------------------------------------------------------------- /** WOL Status Menu input callback */ @@ -136,21 +136,21 @@ WindowMsgHandledType WOLStatusMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonDisconnect, buttonDisconnectID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// WOLStatusMenuInput +} //------------------------------------------------------------------------------------------------- /** WOL Status Menu window system callback */ @@ -168,12 +168,12 @@ WindowMsgHandledType WOLStatusMenuSystem( GameWindow *window, UnsignedInt msg, { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -182,7 +182,7 @@ WindowMsgHandledType WOLStatusMenuSystem( GameWindow *window, UnsignedInt msg, *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } case GBM_SELECTED: { @@ -198,10 +198,10 @@ WindowMsgHandledType WOLStatusMenuSystem( GameWindow *window, UnsignedInt msg, WOL::TheWOL->addCommand( WOL::WOLCOMMAND_RESET ); // don't display an error, log out, or anything } - } //if ( controlID == buttonDisconnect ) + } */ break; - }// case GBM_SELECTED: + } case GEM_EDIT_DONE: { @@ -210,7 +210,7 @@ WindowMsgHandledType WOLStatusMenuSystem( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// WOLStatusMenuSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp index 55d3e677ffa..4a7396c3db5 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp @@ -201,7 +201,7 @@ static void shutdownComplete( WindowLayout *layout ) nextScreen = NULL; -} // end if +} //------------------------------------------------------------------------------------------------- /** Handle Num Players Online data */ @@ -544,7 +544,7 @@ void WOLWelcomeMenuInit( WindowLayout *layout, void *userData ) raiseMessageBoxes = TRUE; TheTransitionHandler->setGroup("WOLWelcomeMenuFade"); -} // WOLWelcomeMenuInit +} //------------------------------------------------------------------------------------------------- /** WOL Welcome Menu shutdown method */ @@ -568,14 +568,14 @@ void WOLWelcomeMenuShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } TheShell->reverseAnimatewindow(); TheTransitionHandler->reverse("WOLWelcomeMenuFade"); RaiseGSMessageBox(); -} // WOLWelcomeMenuShutdown +} //------------------------------------------------------------------------------------------------- @@ -676,7 +676,7 @@ void WOLWelcomeMenuUpdate( WindowLayout * layout, void *userData) } } -}// WOLWelcomeMenuUpdate +} //------------------------------------------------------------------------------------------------- /** WOL Welcome Menu input callback */ @@ -711,21 +711,21 @@ WindowMsgHandledType WOLWelcomeMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonBack, buttonBackID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// WOLWelcomeMenuInput +} //------------------------------------------------------------------------------------------------- /** WOL Welcome Menu window system callback */ @@ -743,12 +743,12 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -757,7 +757,7 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } case GBM_SELECTED: { @@ -804,7 +804,7 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, TheWOLGame = NULL; **/ - } //if ( controlID == buttonBack ) + } else if (controlID == buttonOptionsID) { GameSpyOpenOverlay( GSOVERLAY_OPTIONS ); @@ -822,7 +822,7 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, nextScreen = "Menus/WOLQuickMatchMenu.wnd"; TheShell->pop(); } - }// else if + } else if (controlID == buttonMyInfoID ) { SetLookAtPlayer(TheGameSpyInfo->getLocalProfileID(), TheGameSpyInfo->getLocalName()); @@ -842,7 +842,7 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, TheWOL->setState( WOL::WOLAPI_LOBBY ); TheWOL->addCommand( WOL::WOLCOMMAND_REFRESH_CHANNELS ); */ - }// else if + } else if (controlID == buttonBuddiesID) { GameSpyToggleOverlay( GSOVERLAY_BUDDY ); @@ -869,7 +869,7 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, TheShell->push(AsciiString("Menus/WOLLadderScreen.wnd")); } break; - }// case GBM_SELECTED: + } case GEM_EDIT_DONE: { @@ -878,7 +878,7 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// WOLWelcomeMenuSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp index 00102de2a4f..34faece501d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp @@ -113,7 +113,7 @@ WindowMsgHandledType MessageBoxSystem( GameWindow *window, UnsignedInt msg, window->winSetUserData( NULL ); break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -125,7 +125,7 @@ WindowMsgHandledType MessageBoxSystem( GameWindow *window, UnsignedInt msg, break; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -146,39 +146,39 @@ WindowMsgHandledType MessageBoxSystem( GameWindow *window, UnsignedInt msg, TheWindowManager->winDestroy(window); - } // end if + } else if( controlID == buttonYesID ) { if (MsgBoxCallbacks->yesCallback) MsgBoxCallbacks->yesCallback(); TheWindowManager->winDestroy(window); - } // end else if + } else if( controlID == buttonNoID ) { if (MsgBoxCallbacks->noCallback) MsgBoxCallbacks->noCallback(); TheWindowManager->winDestroy(window); - } // end else if + } else if( controlID == buttonCancelID ) { if (MsgBoxCallbacks->cancelCallback) MsgBoxCallbacks->cancelCallback(); TheWindowManager->winDestroy(window); - } // end else if + } break; - } // end selected + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end MessageBoxSystem +} //------------------------------------------------------------------------------------------------- /** Message Box window system callback */ //------------------------------------------------------------------------------------------------- @@ -197,7 +197,7 @@ WindowMsgHandledType QuitMessageBoxSystem( GameWindow *window, UnsignedInt msg, window->winSetUserData( NULL ); break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -209,7 +209,7 @@ WindowMsgHandledType QuitMessageBoxSystem( GameWindow *window, UnsignedInt msg, break; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -230,36 +230,36 @@ WindowMsgHandledType QuitMessageBoxSystem( GameWindow *window, UnsignedInt msg, TheWindowManager->winDestroy(window); - } // end if + } else if( controlID == buttonYesID ) { if (MsgBoxCallbacks->yesCallback) MsgBoxCallbacks->yesCallback(); TheWindowManager->winDestroy(window); - } // end else if + } else if( controlID == buttonNoID ) { if (MsgBoxCallbacks->noCallback) MsgBoxCallbacks->noCallback(); TheWindowManager->winDestroy(window); - } // end else if + } else if( controlID == buttonCancelID ) { if (MsgBoxCallbacks->cancelCallback) MsgBoxCallbacks->cancelCallback(); TheWindowManager->winDestroy(window); - } // end else if + } break; - } // end selected + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end MessageBoxSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp index a9c612d169a..a45ee19587e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp @@ -43,7 +43,7 @@ WindowMsgHandledType ReplayControlInput( GameWindow *window, UnsignedInt msg, return MSG_IGNORED; -} // end MapSelectMenuInput +} //------------------------------------------------------------------------------------------------- /** System callback for the control bar parent */ @@ -60,15 +60,15 @@ WindowMsgHandledType ReplayControlSystem( GameWindow *window, UnsignedInt msg, break; - } // end button selected + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end ControlBarSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp index 94b09e619f1..900af830fd0 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp @@ -93,10 +93,10 @@ WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, mData1 ); //TheWindowManager->winSetFocus( window ); - } // end if + } break; - } // end mouse entering + } // ------------------------------------------------------------------------ case GWM_MOUSE_LEAVING: @@ -110,10 +110,10 @@ WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, GBM_MOUSE_LEAVING, (WindowMsgData)window, mData1 ); - } // end if + } break; - } // end mouse leaving + } // ------------------------------------------------------------------------ case GWM_LEFT_DRAG: @@ -123,7 +123,7 @@ WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, (WindowMsgData)window, mData1 ); break; - } // end left drag + } // ------------------------------------------------------------------------ case GWM_LEFT_DOWN: @@ -131,7 +131,7 @@ WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, break; - } // end left down + } // ------------------------------------------------------------------------ case GWM_LEFT_UP: @@ -152,14 +152,14 @@ WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, break; - } // end left up and left click + } // ------------------------------------------------------------------------ case GWM_RIGHT_DOWN: { break; - } // end right down + } //------------------------------------------------------------------------- case GWM_RIGHT_UP: @@ -178,7 +178,7 @@ WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, return MSG_IGNORED; } break; - } // end right up or right click + } // ------------------------------------------------------------------------ case GWM_CHAR: @@ -201,10 +201,10 @@ WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, GBM_SELECTED, (WindowMsgData)window, 0 ); - } //end if + } break; - } // end enter/space + } // -------------------------------------------------------------------- case KEY_DOWN: @@ -216,7 +216,7 @@ WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winNextTab(window); break; - } // end down, right, tab + } // -------------------------------------------------------------------- case KEY_UP: @@ -227,7 +227,7 @@ WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winPrevTab(window); break; - } // end up, left + } // -------------------------------------------------------------------- default: @@ -235,13 +235,13 @@ WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, return MSG_IGNORED; - } // end default + } - } // end switch + } break; - } // end char msg + } // ------------------------------------------------------------------------ default: @@ -249,13 +249,13 @@ WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, return MSG_IGNORED; - } // end default + } - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetCheckBoxInput +} // GadgetCheckBoxSystem ======================================================= /** Handle system messages for check box */ @@ -303,11 +303,11 @@ WindowMsgHandledType GadgetCheckBoxSystem( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - } // end switch msg + } return MSG_HANDLED; -} // end GadgetCheckBoxSystem +} // GadgetCheckBoxSetText ====================================================== /** Set the text for the control */ @@ -321,7 +321,7 @@ void GadgetCheckBoxSetText( GameWindow *g, UnicodeString text ) TheWindowManager->winSendSystemMsg( g, GGM_SET_LABEL, (WindowMsgData)&text, 0 ); -} // end GadgetCheckBoxSetText +} // GadgetCheckBoxSetChecked ============================================ //============================================================================= diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp index fab432c9fb8..c8842fcf4b8 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp @@ -122,11 +122,11 @@ WindowMsgHandledType GadgetComboBoxInput( GameWindow *window, UnsignedInt msg, default: return TheWindowManager->winSendInputMsg( editBox, GWM_CHAR, mData1, mData2 ); - } // end switch( mData1 ) + } break; - } // end case char + } // ------------------------------------------------------------------------ case GWM_WHEEL_DOWN: @@ -134,14 +134,14 @@ WindowMsgHandledType GadgetComboBoxInput( GameWindow *window, UnsignedInt msg, break; - } // end wheel down + } // ------------------------------------------------------------------------ case GWM_WHEEL_UP: { break; - } // end wheel up + } // ------------------------------------------------------------------------ case GWM_LEFT_UP: @@ -158,7 +158,7 @@ WindowMsgHandledType GadgetComboBoxInput( GameWindow *window, UnsignedInt msg, if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } GameWindow *listBox = GadgetComboBoxGetListBox(window); if (listBox) @@ -212,14 +212,14 @@ WindowMsgHandledType GadgetComboBoxInput( GameWindow *window, UnsignedInt msg, } } break; - } // end left click, left up + } // ------------------------------------------------------------------------ case GWM_RIGHT_UP: { break; - } // end right up, right click + } /* // ------------------------------------------------------------------------ @@ -236,11 +236,11 @@ WindowMsgHandledType GadgetComboBoxInput( GameWindow *window, UnsignedInt msg, 0 ); TheWindowManager->winSetFocus( window ); - } // end if + } break; - } // end mouse entering + } // ------------------------------------------------------------------------ case GWM_MOUSE_LEAVING: @@ -254,11 +254,11 @@ WindowMsgHandledType GadgetComboBoxInput( GameWindow *window, UnsignedInt msg, GBM_MOUSE_LEAVING, (WindowMsgData)window, 0 ); - } // end if + } break; - } // end mouse leaving + } */ // ------------------------------------------------------------------------ @@ -281,11 +281,11 @@ WindowMsgHandledType GadgetComboBoxInput( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - } // end switch msg + } return MSG_HANDLED; -} // end GadgetComboBoxInput +} // HideListBox ================================================================ /** Called to close the listbox if it is opened */ @@ -325,7 +325,7 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, instData->setText(*(UnicodeString*)mData1); break; - } // end set lavel + } // ------------------------------------------------------------------------ case GCM_GET_TEXT: @@ -333,7 +333,7 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, if(comboData->editBox) *(UnicodeString*)mData2 = GadgetTextEntryGetText(comboData->editBox); break; - } // end Get text + } // ------------------------------------------------------------------------ case GCM_SET_TEXT: @@ -342,7 +342,7 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, GadgetTextEntrySetText(comboData->editBox,*(const UnicodeString*)mData1); break; - } // end set text + } case GEM_UPDATE_TEXT: { @@ -399,7 +399,7 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, *(Int *)mData2 = -1; } break; - } //case GCM_GET_SELECTION: + } // ------------------------------------------------------------------------ // Set the User Data for the specified listbox element case GCM_SET_ITEM_DATA: @@ -463,7 +463,7 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, break; - } // end left drag + } // ------------------------------------------------------------------------ case GCM_DEL_ALL: @@ -476,7 +476,7 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, //HideListBox(window); break; - } // end delete all + } // ------------------------------------------------------------------------ case GCM_DEL_ENTRY: @@ -484,14 +484,14 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, break; - } // end delete entry + } // ------------------------------------------------------------------------ case GGM_CLOSE: { HideListBox(window); break; - } // end delete entry + } // ------------------------------------------------------------------------ case GCM_ADD_ENTRY: @@ -550,7 +550,7 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, } return( (WindowMsgHandledType) addedIndex ); - } // end add entry + } // ------------------------------------------------------------------------ @@ -587,7 +587,7 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, } break; - } // end resized + } // ------------------------------------------------------------------------ @@ -599,7 +599,7 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, window->winSetUserData(NULL); comboData = NULL; break; - } // end destroy + } // ------------------------------------------------------------------------ case GWM_INPUT_FOCUS: @@ -628,7 +628,7 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, *(Bool*)mData2 = TRUE; break; - } // end input focus + } case GBM_SELECTED: @@ -699,11 +699,11 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetListBoxSystem +} // GadgetComboBoxSetColors ==================================================== /** Set the colors for a Combo box, note that this will also automatically @@ -800,7 +800,7 @@ void GadgetComboBoxSetColors( GameWindow *comboBox, hiliteSelectedItemColor, hiliteSelectedItemBorderColor ); } -} // end GadgetComboBoxSetColors +} // GadgetComboBoxSetIsEditable ================================================ /** Sets up the Text Entry gadget as editable or not */ @@ -830,7 +830,7 @@ void GadgetComboBoxSetIsEditable(GameWindow *comboBox, Bool isEditable ) // BitSet(status, WIN_STATUS_NO_FOCUS); editBox->winSetStatus(status); } -}//void GadgetComboBoxSetIsEditable(GameWindow *comboBox, Int maxChars ) +} // GadgetComboBoxSetIsAsciiOnly ================================================== /** Get the text the Combo Box */ @@ -877,7 +877,7 @@ void GadgetComboBoxSetMaxChars( GameWindow *comboBox, Int maxChars ) comboData->maxChars = maxChars; comboData->entryData->maxTextLen = maxChars; -}//void GadgetComboBoxSetMaxChars( GameWindow *comboBox, Int maxChars ) +} // GadgetComboBoxSetMaxDisplay ================================================ /** Sets the MaxDisplay variable to the new Max Display */ @@ -887,7 +887,7 @@ void GadgetComboBoxSetMaxDisplay( GameWindow *comboBox, Int maxDisplay ) ComboBoxData *comboData = (ComboBoxData *)comboBox->winGetUserData(); comboData->maxDisplay = maxDisplay; -}//void GadgetComboBoxSetMaxDisplay( GameWindow *comboBox, Int maxDisplay ); +} // GadgetComboBoxGetText ======================================================= /** Get the text the Combo Box */ @@ -1103,5 +1103,5 @@ Int GadgetComboBoxGetLength( GameWindow *combobox ) return comboboxData->entryCount; return 0; -} // end GadgetListBoxGetListLength +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp index fd3ee1c6033..067f16474fb 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp @@ -94,7 +94,7 @@ WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedIn 0 ); //TheWindowManager->winSetFocus( window ); - } // end if + } if(window->winGetChild() && BitIsSet(window->winGetChild()->winGetStyle(),GWS_PUSH_BUTTON) ) { @@ -104,7 +104,7 @@ WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedIn break; - } // end mouse entering + } // ------------------------------------------------------------------------ case GWM_MOUSE_LEAVING: @@ -118,7 +118,7 @@ WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedIn GBM_MOUSE_LEAVING, (WindowMsgData)window, 0 ); - } // end if + } if(window->winGetChild() && BitIsSet(window->winGetChild()->winGetStyle(),GWS_PUSH_BUTTON) ) { WinInstanceData *instDataChild = window->winGetChild()->winGetInstanceData(); @@ -127,7 +127,7 @@ WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedIn break; - } // end mouse leaving + } // ------------------------------------------------------------------------ case GWM_LEFT_DRAG: @@ -174,7 +174,7 @@ WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedIn if( clickPos > mousex - x ) clickPos = mousex - x; - } // end if + } else { @@ -182,7 +182,7 @@ WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedIn if( clickPos < mousex - x ) clickPos = mousex - x; - } // end else + } // keep it all valid to the window if( clickPos > x + size.x - childSize.x / 2 ) @@ -194,7 +194,7 @@ WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedIn TheWindowManager->winSendSystemMsg( window, GGM_LEFT_DRAG, 0, mData1 ); break; - } // end left up, left click + } // ------------------------------------------------------------------------ case GWM_CHAR: @@ -221,9 +221,9 @@ WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedIn // Translate to window coords child->winSetPosition( (Int)((s->position - s->minVal) * s->numTicks), HORIZONTAL_SLIDER_THUMB_POSITION ); - } // end if + } - } // if key down + } break; @@ -248,7 +248,7 @@ WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedIn } - } // end if key down + } break; @@ -271,11 +271,11 @@ WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedIn default: return MSG_IGNORED; - } // end switch( mData1 ) + } break; - } // end char + } // ------------------------------------------------------------------------ default: @@ -285,7 +285,7 @@ WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedIn return MSG_HANDLED; -} // end GadgetHorizontalSliderInput +} // GadgetHorizontalSliderSystem =============================================== /** Handle system messages for horizontal slider */ @@ -332,7 +332,7 @@ WindowMsgHandledType GadgetHorizontalSliderSystem( GameWindow *window, UnsignedI s->position ); break; - } // end if + } else if( mousex < x + HORIZONTAL_SLIDER_THUMB_WIDTH/2) { @@ -345,7 +345,7 @@ WindowMsgHandledType GadgetHorizontalSliderSystem( GameWindow *window, UnsignedI s->position ); break; - } // end else if + } if( childCenter.x < x + childSize.x / 2 ) { @@ -386,7 +386,7 @@ WindowMsgHandledType GadgetHorizontalSliderSystem( GameWindow *window, UnsignedI break; - } // end left drag + } // ------------------------------------------------------------------------ case GSM_SET_SLIDER: @@ -405,7 +405,7 @@ WindowMsgHandledType GadgetHorizontalSliderSystem( GameWindow *window, UnsignedI child->winSetPosition( newPos , HORIZONTAL_SLIDER_THUMB_POSITION ); break; - } // end set slider + } // ------------------------------------------------------------------------ case GSM_SET_MIN_MAX: @@ -423,7 +423,7 @@ WindowMsgHandledType GadgetHorizontalSliderSystem( GameWindow *window, UnsignedI child->winSetPosition( 0, HORIZONTAL_SLIDER_THUMB_POSITION ); break; - } // end set min max + } // ------------------------------------------------------------------------ case GWM_CREATE: @@ -454,7 +454,7 @@ WindowMsgHandledType GadgetHorizontalSliderSystem( GameWindow *window, UnsignedI *(Bool*)mData2 = TRUE; break; - } // end focus msg + } // ------------------------------------------------------------------------ case GGM_RESIZED: @@ -468,13 +468,13 @@ WindowMsgHandledType GadgetHorizontalSliderSystem( GameWindow *window, UnsignedI break; - } // end resized + } default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetHorizontalSliderSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp index 90cb41d8f4d..c5f17f3bf0f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp @@ -108,7 +108,7 @@ static void doAudioFeedback(GameWindow *window) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } } } @@ -278,7 +278,7 @@ static void adjustDisplay( GameWindow *window, Int adjustment, 0 ); } -} // end adjustDisplay +} // computeTotalHeight ========================================================= /** Compute Total Height and fill in listHeight values */ @@ -311,8 +311,8 @@ static void computeTotalHeight( GameWindow *window ) DisplayString *displayString = (DisplayString *)list->listData[i].cell[j].data; if(displayString) displayString->getSize( NULL, &cellHeight ); - }//else - }//if + } + } else if(list->listData[i].cell[j].cellType == LISTBOX_IMAGE) { if(list->listData[i].cell[j].height > 0) @@ -322,7 +322,7 @@ static void computeTotalHeight( GameWindow *window ) } if(cellHeight > tempHeight) tempHeight = cellHeight; - }//for + } list->listData[i].height = tempHeight; height += (list->listData[i].height + 1); list->listData[i].listHeight = height; @@ -383,7 +383,7 @@ static Int addImageEntry( const Image *image, Color color, Int row, Int column, return (row); -}// static Int addImageEntry( Image image, Int column, GameWindow *window) +} // startingRow will get moved to startingRow+1, etc. This assumes there is space!!!!! static Int moveRowsDown(ListboxData *list, Int startingRow) @@ -529,7 +529,7 @@ static Int addEntry( UnicodeString *string, Int color, Int row, Int column, Game } return (row); -} // end addEntry +} // PUBLIC DATA //////////////////////////////////////////////////////////////// @@ -573,11 +573,11 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, GLM_DOUBLE_CLICKED, (WindowMsgData)window, list->selectPos ); - } // end if + } break; - } // end enter or space + } // -------------------------------------------------------------------- case KEY_DOWN: @@ -624,11 +624,11 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, GLM_SELECTED, (WindowMsgData)window, list->selectPos ); - } // end if + } break; - } // end key down + } // -------------------------------------------------------------------- case KEY_UP: @@ -675,7 +675,7 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, break; - } // end key up + } // -------------------------------------------------------------------- case KEY_RIGHT: @@ -752,11 +752,11 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, return MSG_IGNORED; } - } // end switch( mData1 ) + } break; - } // end case char + } // ------------------------------------------------------------------------ case GWM_WHEEL_DOWN: @@ -769,7 +769,7 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, break; - } // end wheel down + } // ------------------------------------------------------------------------ case GWM_WHEEL_UP: @@ -780,7 +780,7 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, adjustDisplay( window, -1, TRUE ); break; - } // end wheel up + } // ------------------------------------------------------------------------ case GWM_LEFT_UP: @@ -858,7 +858,7 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, break; - } // end left click, left up + } // ------------------------------------------------------------------------ case GWM_RIGHT_DOWN: @@ -913,7 +913,7 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, (WindowMsgData)&rc ); break; - } // end right up, right click + } // ------------------------------------------------------------------------ case GWM_MOUSE_ENTERING: @@ -929,11 +929,11 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, 0 ); //TheWindowManager->winSetFocus( window ); - } // end if + } break; - } // end mouse entering + } // ------------------------------------------------------------------------ case GWM_MOUSE_LEAVING: @@ -947,11 +947,11 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, GBM_MOUSE_LEAVING, (WindowMsgData)window, 0 ); - } // end if + } break; - } // end mouse leaving + } // ------------------------------------------------------------------------ case GWM_LEFT_DRAG: @@ -973,11 +973,11 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - } // end switch msg + } return MSG_HANDLED; -} // end GadgetListBoxInput +} // GadgetListBoxMultiInput ==================================================== /** Handle input for multiple selection list box */ @@ -1009,7 +1009,7 @@ WindowMsgHandledType GadgetListBoxMultiInput( GameWindow *window, UnsignedInt ms } break; - } // end char + } // ------------------------------------------------------------------------ case GWM_LEFT_UP: @@ -1078,7 +1078,7 @@ WindowMsgHandledType GadgetListBoxMultiInput( GameWindow *window, UnsignedInt ms selectPos ); break; - } // end left up, left click + } // ------------------------------------------------------------------------ case GWM_RIGHT_UP: @@ -1169,7 +1169,7 @@ WindowMsgHandledType GadgetListBoxMultiInput( GameWindow *window, UnsignedInt ms (WindowMsgData)&rc ); break; - } // end right up, right click + } // ------------------------------------------------------------------------ case GWM_WHEEL_DOWN: @@ -1207,11 +1207,11 @@ WindowMsgHandledType GadgetListBoxMultiInput( GameWindow *window, UnsignedInt ms 0 ); //TheWindowManager->winSetFocus( window ); - } // end if + } break; - } // end mouse entering + } // ------------------------------------------------------------------------ case GWM_MOUSE_LEAVING: @@ -1225,11 +1225,11 @@ WindowMsgHandledType GadgetListBoxMultiInput( GameWindow *window, UnsignedInt ms GBM_MOUSE_LEAVING, (WindowMsgData)window, 0 ); - } // end if + } break; - } // end mouse leaving + } // ------------------------------------------------------------------------ case GWM_LEFT_DRAG: @@ -1251,11 +1251,11 @@ WindowMsgHandledType GadgetListBoxMultiInput( GameWindow *window, UnsignedInt ms default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetListBoxMultiInput +} // GadgetListBoxSystem ======================================================== /** Handle system messages for list box */ @@ -1275,7 +1275,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, instData->setText(*(UnicodeString*)mData1); break; - } // end set lavel + } // ------------------------------------------------------------------------ case GLM_GET_TEXT: @@ -1315,7 +1315,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, break; - } // end selected + } // ------------------------------------------------------------------------ case GGM_LEFT_DRAG: @@ -1334,7 +1334,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, break; - } // end left drag + } // ------------------------------------------------------------------------ case GLM_DEL_ALL: @@ -1388,7 +1388,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, adjustDisplay( window, 0, TRUE ); break; - } // end delete all + } // ------------------------------------------------------------------------ case GLM_DEL_ENTRY: @@ -1445,7 +1445,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, computeTotalHeight( window ); break; - } // end delete entry + } // ------------------------------------------------------------------------ case GLM_ADD_ENTRY: @@ -1535,20 +1535,20 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, i++; - } // end while + } - } // end if + } else { if( row == list->selectPos ) list->selectPos = -1; } - } // end success + } return((WindowMsgHandledType) addedIndex ); - } // end add entry + } // ------------------------------------------------------------------------ case GLM_TOGGLE_MULTI_SELECTION: @@ -1601,7 +1601,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, break; - } // end toggle multi-select + } // ------------------------------------------------------------------------ case GLM_SET_SELECTION: @@ -1685,9 +1685,9 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, adjustDisplay( window, 0, TRUE ); - } // end else if + } - } // end else + } TheWindowManager->winSendSystemMsg( window->winGetOwner(), GLM_SELECTED, @@ -1695,7 +1695,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, list->selectPos ); break; - } // end set selection + } // ------------------------------------------------------------------------ case GLM_SCROLL_BUFFER: @@ -1785,7 +1785,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, break; - } // end scroll buffer + } // ------------------------------------------------------------------------ case GLM_GET_SELECTION: @@ -1798,7 +1798,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, break; - } // end get selection + } // ------------------------------------------------------------------------ case GLM_SET_UP_BUTTON: @@ -1886,8 +1886,8 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, list->slider->winGetSize( &sliderSize.x, &sliderSize.y ); list->columnWidth[0] -= sliderSize.x; - } // end if - }// if + } + } else { if( !list->columnWidthPercentage ) @@ -1903,17 +1903,17 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, list->slider->winGetSize( &sliderSize.x, &sliderSize.y ); totalWidth -= sliderSize.x; - } // end if + } for(Int i = 0; i < list->columns; i++ ) { list->columnWidth[i] = list->columnWidthPercentage[i] * totalWidth / 100; - }// for - }// else + } + } //reset the total height computeTotalHeight(window); break; - } // end resized + } // ------------------------------------------------------------------------ case GLM_UPDATE_DISPLAY: @@ -1933,7 +1933,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, adjustDisplay( window, 0, TRUE ); break; - } // end update display + } // ------------------------------------------------------------------------ case GWM_DESTROY: @@ -1981,7 +1981,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, break; - } // end destroy + } // ------------------------------------------------------------------------ case GWM_INPUT_FOCUS: @@ -2005,7 +2005,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, *(Bool*)mData2 = TRUE; break; - } // end input focus + } // ------------------------------------------------------------------------ case GSM_SLIDER_TRACK: { @@ -2021,7 +2021,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, adjustDisplay( window, 0, FALSE ); break; - } // end slider track + } // ------------------------------------------------------------------------ case GLM_SET_ITEM_DATA: { @@ -2032,7 +2032,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, list->listData[pos->y].cell[pos->x].userData = data; break; - }//case GLM_SET_ITEM_DATA: + } // ------------------------------------------------------------------------ case GLM_GET_ITEM_DATA: { @@ -2044,17 +2044,17 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, *data = list->listData[pos->y].cell[pos->x].userData; break; - }//case GLM_GET_ITEM_DATA: + } default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetListBoxSystem +} // GadgetListBoxSetColors ===================================================== /** Set the colors for a list box, note that this will also automatically @@ -2156,9 +2156,9 @@ void GadgetListBoxSetColors( GameWindow *listbox, GadgetButtonSetHiliteSelectedColor( downButton, GadgetSliderGetHiliteSelectedThumbColor( slider ) ); GadgetButtonSetHiliteSelectedBorderColor( downButton, GadgetSliderGetHiliteSelectedThumbBorderColor( slider ) ); - } // end if + } -} // end GadgetListBoxSetColors +} // GadgetListBoxGetText ======================================================= /** Get the text for a list box entry */ @@ -2167,7 +2167,7 @@ UnicodeString GadgetListBoxGetText( GameWindow *listbox, Int row, Int column) { Color color; return GadgetListBoxGetTextAndColor( listbox,&color,row,column ); -} // end GadgetListBoxGetText +} // GadgetListBoxGetText ======================================================= /** Get the text for a list box entry */ @@ -2195,7 +2195,7 @@ UnicodeString GadgetListBoxGetTextAndColor( GameWindow *listbox, Color *color, I //return UnicodeString::TheEmptyString; -} // end GadgetListBoxGetText +} // GadgetListBoxAddEntryText ================================================== /** Add a new string entry into the listbox at the insert position */ @@ -2236,7 +2236,7 @@ Int GadgetListBoxAddEntryText( GameWindow *listbox, } return (index); -} // end GadgetListBoxAddEntry +} // GadgetListBoxAddEntryImage ================================================= /** Add a new string entry into the listbox at the insert position */ @@ -2258,7 +2258,7 @@ Int GadgetListBoxAddEntryImage( GameWindow *listbox, const Image *image, /// @TODO: Don't do this type cast! index = (Int) TheWindowManager->winSendSystemMsg( listbox, GLM_ADD_ENTRY, (WindowMsgData)&addInfo, color ); return (index); -} // end GadgetListBoxAddEntryImage +} Int GadgetListBoxAddEntryImage( GameWindow *listbox, const Image *image, Int row, Int column, @@ -2298,9 +2298,9 @@ void GadgetListBoxSetFont( GameWindow *g, GameFont *font ) dString->setFont( font ); } } - } // end for i + } -} // end GadgetListBoxSetFont +} // GadgetListboxCreateScrollbar =============================================== /** Create the scroll bar using a slider and two buttons for a listbox */ @@ -2411,7 +2411,7 @@ void GadgetListboxCreateScrollbar( GameWindow *listbox ) // we now have all the scrollbar parts, this better be set :) listData->scrollBar = TRUE; -} // end GadgetListBoxCreateScrollbar +} // GadgetListBoxAddMultiSelect ================================================ /** Enable multi selections for a listbox @@ -2439,7 +2439,7 @@ void GadgetListBoxAddMultiSelect( GameWindow *listbox ) listboxData->listData = NULL; return; - } // end if + } memset( listboxData->selections, -1, listboxData->listLength * sizeof(Int) ); @@ -2450,7 +2450,7 @@ void GadgetListBoxAddMultiSelect( GameWindow *listbox ) // adjust the input procedure for the listbox listbox->winSetInputFunc( GadgetListBoxMultiInput ); -} // end GadgetListBoxEnableMultiSelect +} // GadgetListBoxRemoveMultiSelect ============================================= /** Remove multi select capability from a listbox */ @@ -2465,14 +2465,14 @@ void GadgetListBoxRemoveMultiSelect( GameWindow *listbox ) delete[]( listData->selections ); listData->selections = NULL; - } // end if + } listData->multiSelect = FALSE; // adjust the input procedure for the listbox listbox->winSetInputFunc( GadgetListBoxInput ); -} // end GadgetListBoxRemoveMultiSelect +} // GadgetListBoxSetListLength ================================================= /** Set OR reset the list length data contained in the listboxData @@ -2571,7 +2571,7 @@ void GadgetListBoxSetListLength( GameWindow *listbox, Int newLength ) assert( 0 ); return; - } // end if + } // adjust the selection array for multi select listboxes if( listboxData->multiSelect ) @@ -2580,9 +2580,9 @@ void GadgetListBoxSetListLength( GameWindow *listbox, Int newLength ) GadgetListBoxRemoveMultiSelect( listbox ); GadgetListBoxAddMultiSelect( listbox ); - } // end if + } -} // end GadgetListBoxSetListLength +} // GadgetListBoxGetListLength ================================================= /** Get the list length data contained in the listboxData @@ -2599,7 +2599,7 @@ Int GadgetListBoxGetListLength( GameWindow *listbox ) { return 1; } -} // end GadgetListBoxGetListLength +} // GadgetListBoxGetNumEntries ================================================= /** Get the list length data contained in the listboxData @@ -2615,7 +2615,7 @@ Int GadgetListBoxGetNumEntries( GameWindow *listbox ) return listboxData->endPos; return 0; -} // end GadgetListBoxGetNumEntries +} //------------------------------------------------------------------------------------------------- /** Get the selected item(s) of a listbox. For a single select listbox the parameter @@ -2634,7 +2634,7 @@ void GadgetListBoxGetSelected( GameWindow *listbox, Int *selectList ) // get selected indeces via system message TheWindowManager->winSendSystemMsg( listbox, GLM_GET_SELECTION, 0, (WindowMsgData)selectList ); -} // end GadgetListBoxGetSelected +} //------------------------------------------------------------------------------------------------- /** Set the selected item of a listbox. The parameter is a single integer. If @@ -2650,7 +2650,7 @@ void GadgetListBoxSetSelected( GameWindow *listbox, Int selectIndex ) // set selected index via system message TheWindowManager->winSendSystemMsg( listbox, GLM_SET_SELECTION, (WindowMsgData)(&selectIndex), 1 ); -} // end GadgetListBoxSetSelected +} //------------------------------------------------------------------------------------------------- /** Set the selected item of a listbox. */ @@ -2677,7 +2677,7 @@ void GadgetListBoxReset( GameWindow *listbox ) // reset via system message TheWindowManager->winSendSystemMsg( listbox, GLM_DEL_ALL, 0, 0 ); -} // end GadgetListBoxReset +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2690,7 +2690,7 @@ void GadgetListBoxSetItemData( GameWindow *listbox, void *data, Int row, Int col if (listbox) TheWindowManager->winSendSystemMsg( listbox, GLM_SET_ITEM_DATA, (WindowMsgData)&pos, (WindowMsgData)data); -}// void GadgetListBoxSetItemData( Int index, void *data ) +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2755,7 +2755,7 @@ void GadgetListBoxSetBottomVisibleEntry( GameWindow *window, Int newPos ) int prevPos = GadgetListBoxGetBottomVisibleEntry( window ); adjustDisplay(window, newPos - prevPos + 1, true); -} // void GadgetListBoxSetTopVisibleEntry( GameWindow *window, Int newPos ) +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2769,7 +2769,7 @@ Int GadgetListBoxGetTopVisibleEntry( GameWindow *window ) return 0; return getListboxTopEntry(listData); -} // Int GadgetListBoxGetTopVisibleEntry( GameWindow *window ) +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2785,7 +2785,7 @@ void GadgetListBoxSetTopVisibleEntry( GameWindow *window, Int newPos ) int prevPos = GadgetListBoxGetTopVisibleEntry( window ); adjustDisplay(window, newPos - prevPos, true); -} // void GadgetListBoxSetTopVisibleEntry( GameWindow *window, Int newPos ) +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2798,7 +2798,7 @@ void GadgetListBoxSetAudioFeedback( GameWindow *listbox, Bool enable ) return; listboxData->audioFeedback = enable; -} // end GadgetListBoxSetAudioFeedback +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2811,7 +2811,7 @@ Int GadgetListBoxGetNumColumns( GameWindow *listbox ) return 0; return listboxData->columns; -} // end GadgetListBoxGetNumColumns +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2826,5 +2826,5 @@ Int GadgetListBoxGetColumnWidth( GameWindow *listbox, Int column ) return 0; return listboxData->columnWidth[column]; -} // end GadgetListBoxGetNumColumns +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp index 18f92b2663a..08ae8b24185 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp @@ -94,17 +94,17 @@ WindowMsgHandledType GadgetProgressBarSystem( GameWindow *window, UnsignedInt ms break; - } // end set progress + } // ------------------------------------------------------------------------ default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end GadgetProgressBarSystem +} // GadgetProgressBarSetProgress =============================================== /** send progress system message to Progress Bar */ @@ -115,4 +115,4 @@ void GadgetProgressBarSetProgress( GameWindow *g, Int progress ) return; TheWindowManager->winSendSystemMsg( g, GPM_SET_PROGRESS, progress, 0); -} // end GadgetProgressBarSetProgress +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetPushButton.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetPushButton.cpp index 50763eaff53..a91995cf948 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetPushButton.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetPushButton.cpp @@ -101,7 +101,7 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, } break; - } // end mouse entering + } // ------------------------------------------------------------------------ case GWM_MOUSE_LEAVING: @@ -131,7 +131,7 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, } break; - } // end mouse leaving + } // ------------------------------------------------------------------------ case GWM_LEFT_DRAG: @@ -141,7 +141,7 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, (WindowMsgData)window, mData1 ); break; - } // end left drag + } // ------------------------------------------------------------------------ case GWM_LEFT_DOWN: @@ -156,7 +156,7 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } // // for 'check-like' buttons we have "dual state", we flip the selected status @@ -174,17 +174,17 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, TheWindowManager->winSendSystemMsg( instData->getOwner(), GBM_SELECTED, (WindowMsgData)window, mData1 ); - } // end if + } else { // just select as normal BitSet( instData->m_state, WIN_STATE_SELECTED ); - } // end else + } break; - } // end left down + } //------------------------------------------------------------------------- case GWM_LEFT_UP: @@ -214,7 +214,7 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, break; - } // end left up or left click + } // ------------------------------------------------------------------------ case GWM_RIGHT_DOWN: @@ -233,7 +233,7 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } // // for 'check-like' buttons we have "dual state", we flip the selected status @@ -251,14 +251,14 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, TheWindowManager->winSendSystemMsg( instData->getOwner(), GBM_SELECTED_RIGHT, (WindowMsgData)window, mData1 ); - } // end if + } else { // just select as normal BitSet( instData->m_state, WIN_STATE_SELECTED ); - } // end else + } } else @@ -267,7 +267,7 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, return MSG_IGNORED; } break; - } // end right down + } //------------------------------------------------------------------------- case GWM_RIGHT_UP: @@ -307,7 +307,7 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, break; - } // end right up or right click + } // ------------------------------------------------------------------------ case GWM_CHAR: @@ -357,21 +357,21 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, TheWindowManager->winSendSystemMsg( instData->getOwner(), GBM_SELECTED, (WindowMsgData)window, mData1 ); - } // end if + } else { // just select as normal BitSet( instData->m_state, WIN_STATE_SELECTED ); - } // end else + } - } // end else + } break; - } // end handle enter and space button + } // -------------------------------------------------------------------- case KEY_DOWN: @@ -383,7 +383,7 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, TheWindowManager->winNextTab(window); break; - } // end key down, right or tab + } // -------------------------------------------------------------------- case KEY_UP: @@ -394,27 +394,27 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, TheWindowManager->winPrevTab(window); break; - } // end key up or left + } // -------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch on char + } break; - } // end character message + } // ------------------------------------------------------------------------ default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetPushButtonInput +} // GadgetPushButtonSystem ===================================================== /** Handle system messages for push button */ @@ -468,11 +468,11 @@ WindowMsgHandledType GadgetPushButtonSystem( GameWindow *window, UnsignedInt msg default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetPushButtonSystem +} // ------------------------------------------------------------------------------------------------ /** Set the visual status of a button to make it looked checked/unchecked ... DO NOT send @@ -497,7 +497,7 @@ void GadgetCheckLikeButtonSetVisualCheck( GameWindow *g, Bool checked ) DEBUG_CRASH(( "GadgetCheckLikeButtonSetVisualCheck: Window is not 'CHECK-LIKE'" )); return; - } // end if + } // set or clear the 'pushed' state if( instData ) @@ -508,9 +508,9 @@ void GadgetCheckLikeButtonSetVisualCheck( GameWindow *g, Bool checked ) else BitClear( instData->m_state, WIN_STATE_SELECTED ); - } // end if + } -} // end GadgetCheckLikeButtonSetVisualCheck +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -529,7 +529,7 @@ Bool GadgetCheckLikeButtonIsChecked( GameWindow *g ) // we just hold this "check like dual state thingie" using the selected state return BitIsSet( instData->m_state, WIN_STATE_SELECTED ); -} // end GadgetCheckLikeButtonIsChecked +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -557,7 +557,7 @@ void GadgetButtonEnableCheckLike( GameWindow *g, Bool makeCheckLike, Bool initia else BitClear( instData->m_state, WIN_STATE_SELECTED ); -} // end GadgetButtonEnableCheckLike +} // GadgetButtonSetText ======================================================== /** Set the text for a push button */ @@ -571,7 +571,7 @@ void GadgetButtonSetText( GameWindow *g, UnicodeString text ) TheWindowManager->winSendSystemMsg( g, GGM_SET_LABEL, (WindowMsgData)&text, 0 ); -} // end GadgetButtonSetText +} PushButtonData * getNewPushButtonData( void ) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp index 21016e0c27f..b09dccbc11f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp @@ -86,9 +86,9 @@ static void doRadioUnselect( GameWindow *window, Int group, Int screen, BitClear( instData->m_state, WIN_STATE_SELECTED ); - } // end if + } - } // end if + } // recursively call on all my children GameWindow *child; @@ -96,7 +96,7 @@ static void doRadioUnselect( GameWindow *window, Int group, Int screen, for( child = window->winGetChild(); child; child = child->winGetNext() ) doRadioUnselect( child, group, screen, except ); -} // end doRadioUnselect +} // unselectOtherRadioOfGroup ================================================== /** Go through the entire window system, including child windows and @@ -113,7 +113,7 @@ static void unselectOtherRadioOfGroup( Int group, Int screen, window = window->winGetNext() ) doRadioUnselect( window, group, screen, except ); -} // end unselectOtherRadioOfGroup +} // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -142,11 +142,11 @@ WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg mData1 ); //TheWindowManager->winSetFocus( window ); - } // end if + } break; - } // end mouse enter + } // ------------------------------------------------------------------------ case GWM_MOUSE_LEAVING: @@ -160,11 +160,11 @@ WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg GBM_MOUSE_LEAVING, (WindowMsgData)window, mData1 ); - } // end if + } break; - } // end mouse leaving + } // ------------------------------------------------------------------------ case GWM_LEFT_DRAG: @@ -174,7 +174,7 @@ WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg (WindowMsgData)window, mData1 ); break; - } // end left drag + } // ------------------------------------------------------------------------ case GWM_LEFT_DOWN: @@ -182,7 +182,7 @@ WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg break; - } // end down + } // ------------------------------------------------------------------------ case GWM_LEFT_UP: @@ -207,18 +207,18 @@ WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg // this button is now selected BitSet( instData->m_state, WIN_STATE_SELECTED ); - } // end if, not selected + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) == FALSE ) { // this up click was not meant for this button return MSG_IGNORED; - } // end else if + } break; - } // end left up or click + } // ------------------------------------------------------------------------ case GWM_CHAR: @@ -252,9 +252,9 @@ WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg // this button is now selected BitSet( instData->m_state, WIN_STATE_SELECTED ); - } // end if, not selected + } - } // end key down + } break; @@ -268,7 +268,7 @@ WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg window->winNextTab(); break; - } // end down, right, or tab + } // -------------------------------------------------------------------- case KEY_UP: @@ -279,7 +279,7 @@ WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg window->winPrevTab(); break; - } // end up, left + } // -------------------------------------------------------------------- default: @@ -287,13 +287,13 @@ WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg return MSG_IGNORED; - } // end default + } - } // end switch( mData1 ) + } break; - } // end char messsage + } // ------------------------------------------------------------------------ default: @@ -301,13 +301,13 @@ WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg return MSG_IGNORED; - } // end default + } - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetRadioButtonInput +} // GadgetRadioButtonSystem ==================================================== /** Handle system messages for radio button */ @@ -335,7 +335,7 @@ WindowMsgHandledType GadgetRadioButtonSystem( GameWindow *window, UnsignedInt ms GBM_SELECTED, (WindowMsgData)window, 0 ); - } // end if + } // // unselect any windows in the system (including children) that @@ -348,11 +348,11 @@ WindowMsgHandledType GadgetRadioButtonSystem( GameWindow *window, UnsignedInt ms // this button is now selected BitSet( instData->m_state, WIN_STATE_SELECTED ); - } // end if + } break; - } // end set selection + } // ------------------------------------------------------------------------ case GGM_SET_LABEL: @@ -361,7 +361,7 @@ WindowMsgHandledType GadgetRadioButtonSystem( GameWindow *window, UnsignedInt ms window->winSetText( *(UnicodeString*)mData1 ); break; - } // end set label + } // ------------------------------------------------------------------------ case GWM_CREATE: @@ -376,7 +376,7 @@ WindowMsgHandledType GadgetRadioButtonSystem( GameWindow *window, UnsignedInt ms break; - } // end destroy + } // ------------------------------------------------------------------------ case GWM_INPUT_FOCUS: @@ -393,16 +393,16 @@ WindowMsgHandledType GadgetRadioButtonSystem( GameWindow *window, UnsignedInt ms *(Bool*)mData2 = TRUE; break; - } // end focus + } default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetRadioButtonSystem +} // GadgetRadioSetText ========================================================= /** Set the text for the control */ @@ -416,7 +416,7 @@ void GadgetRadioSetText( GameWindow *g, UnicodeString text ) TheWindowManager->winSendSystemMsg( g, GGM_SET_LABEL, (WindowMsgData)&text, 0 ); -} // end GadgetRadioSetText +} // GadgetRadioSetGroup ======================================================== /** Set the group number for a radio button, only one radio button of @@ -429,7 +429,7 @@ void GadgetRadioSetGroup( GameWindow *g, Int group, Int screen ) radioData->group = group; radioData->screen = screen; -} // end GadgetRadioSetGroup +} // GadgetRadioSetText ========================================================= @@ -444,5 +444,5 @@ void GadgetRadioSetSelection( GameWindow *g, Bool sendMsg ) TheWindowManager->winSendSystemMsg( g, GBM_SET_SELECTION, (WindowMsgData)&sendMsg, 0 ); -} // end GadgetRadioSetText +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp index 94ad3ae6cfd..04230c15eb3 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp @@ -110,7 +110,7 @@ WindowMsgHandledType GadgetStaticTextInput( GameWindow *window, UnsignedInt msg, return MSG_HANDLED; -} // end GadgetStaticTextInput +} // GadgetStaticTextSystem ===================================================== /** Handle system messages for text field */ @@ -130,7 +130,7 @@ WindowMsgHandledType GadgetStaticTextSystem( GameWindow *window, UnsignedInt msg *(UnicodeString*)mData2 = tData->text->getText(); break; - } // end get label + } // ------------------------------------------------------------------------ case GGM_SET_LABEL: @@ -144,7 +144,7 @@ WindowMsgHandledType GadgetStaticTextSystem( GameWindow *window, UnsignedInt msg break; - } // end set label + } // ------------------------------------------------------------------------ case GWM_CREATE: @@ -164,15 +164,15 @@ WindowMsgHandledType GadgetStaticTextSystem( GameWindow *window, UnsignedInt msg break; - } // end destroy + } default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetStaticTextSystem +} // GadgetStaticTextSetText ==================================================== /** Set the text for a static text control */ @@ -183,7 +183,7 @@ void GadgetStaticTextSetText( GameWindow *window, UnicodeString text ) return; TheWindowManager->winSendSystemMsg( window, GGM_SET_LABEL, (WindowMsgData)&text, 0 ); -} // end GadgetStaticTextSetText +} UnicodeString GadgetStaticTextGetText( GameWindow *window ) { @@ -221,6 +221,6 @@ void GadgetStaticTextSetFont( GameWindow *g, GameFont *font ) if( dString ) dString->setFont( font ); - } // end if + } -} // end GadgetStaticTextSetFont +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp index ada52022073..bff497870f9 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp @@ -124,7 +124,7 @@ WindowMsgHandledType GadgetTabControlInput( GameWindow *tabControl, UnsignedInt return MSG_HANDLED; -} // end GadgetTabControlInput +} // GadgetTabControlSystem ==================================================== /** Handle system messages for TabControl */ @@ -147,7 +147,7 @@ WindowMsgHandledType GadgetTabControlSystem( GameWindow *tabControl, UnsignedInt break; - } // end destroy + } case GGM_RESIZED: {//On resize, we need to upkeep the pane sizes and tabs since they are bound to us @@ -170,11 +170,11 @@ WindowMsgHandledType GadgetTabControlSystem( GameWindow *tabControl, UnsignedInt default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetTabControlSystem +} void GadgetTabControlComputeTabRegion( GameWindow *tabControl )///< Recalc the tab positions based on userData { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp index 807fb6da33c..4d03cfcfef5 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp @@ -247,12 +247,12 @@ WindowMsgHandledType GadgetTextEntryInput( GameWindow *window, UnsignedInt msg, GEM_UPDATE_TEXT, (WindowMsgData)window, 0 ); - } // end if + } } } break; - } // end switch( mData1 ) + } break; @@ -303,11 +303,11 @@ WindowMsgHandledType GadgetTextEntryInput( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetTextEntryInput +} // GadgetTextEntrySystem ====================================================== /** Handle system messages for entry field */ @@ -344,7 +344,7 @@ WindowMsgHandledType GadgetTextEntrySystem( GameWindow *window, UnsignedInt msg, break; - } // end set text + } // ------------------------------------------------------------------------ case GWM_CREATE: @@ -410,11 +410,11 @@ WindowMsgHandledType GadgetTextEntrySystem( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetTextEntrySystem +} /** @todo we might want to do something like this if we use IME for language * support in this product */ @@ -559,9 +559,9 @@ void GadgetTextEntrySetFont( GameWindow *g, GameFont *font ) if( dString ) dString->setFont( font ); - } // end if + } -} // end GadgetTextEntrySetFont +} // GadgetTextEntryGetText ======================================================= /** Get the text for a Text entry */ @@ -581,4 +581,4 @@ UnicodeString GadgetTextEntryGetText( GameWindow *textentry ) TheWindowManager->winSendSystemMsg( textentry, GEM_GET_TEXT, 0, (WindowMsgData)&result ); return result; -} // end GadgetListBoxGetText +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp index 188d2362dd6..f06e6921397 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp @@ -154,7 +154,7 @@ WindowMsgHandledType GadgetVerticalSliderInput( GameWindow *window, UnsignedInt if( clickPos > mousey - y ) clickPos = mousey - y; - } // end if + } else { @@ -162,7 +162,7 @@ WindowMsgHandledType GadgetVerticalSliderInput( GameWindow *window, UnsignedInt if( clickPos < mousey - y ) clickPos = mousey - y; - } // end else + } // keep pos valid on window if( clickPos > y + size.y - childSize.y / 2 ) @@ -246,20 +246,20 @@ WindowMsgHandledType GadgetVerticalSliderInput( GameWindow *window, UnsignedInt default: return MSG_IGNORED; - } // end switch( mData1 ) + } break; - } // end char + } default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetVerticalSliderInput +} // GadgetVerticalSliderSystem ================================================= /** Handle system messages for vertical slider */ @@ -318,7 +318,7 @@ WindowMsgHandledType GadgetVerticalSliderSystem( GameWindow *window, UnsignedInt s->position ); break; - } // end if + } else if( mousey < y ) { @@ -332,7 +332,7 @@ WindowMsgHandledType GadgetVerticalSliderSystem( GameWindow *window, UnsignedInt s->position ); break; - } // end else if + } if( childCenter.y <= y + childSize.y / 2 ) { @@ -456,14 +456,14 @@ WindowMsgHandledType GadgetVerticalSliderSystem( GameWindow *window, UnsignedInt break; - } // end resized + } default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetVerticalSliderSystem +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp index dcb411c1142..e1da253a698 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp @@ -55,7 +55,7 @@ void FontLibrary::linkFont( GameFont *font ) // increment linked count m_count++; -} // end linkFont +} //------------------------------------------------------------------------------------------------- /** Unlink a font from the font list */ @@ -78,7 +78,7 @@ void FontLibrary::unlinkFont( GameFont *font ) DEBUG_CRASH(( "Font '%s' not found in library", font->nameString.str() )); return; - } // end if + } // scan for the font pointing to the one we're going to unlink for( other = m_fontList; other; other = other->next ) @@ -100,7 +100,7 @@ void FontLibrary::unlinkFont( GameFont *font ) // we now have one less font on the list m_count--; -} // end unlinkFont +} //------------------------------------------------------------------------------------------------- /** Delete all font data, DO NOT throw an exception ... the destructor uses this */ @@ -125,9 +125,9 @@ void FontLibrary::deleteAllFonts( void ) // delete the font list element deleteInstance(font); - } // end while + } -} // deleteAllFonts +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -141,7 +141,7 @@ FontLibrary::FontLibrary( void ) m_fontList = NULL; m_count = 0; -} // end FontLibrary +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -151,7 +151,7 @@ FontLibrary::~FontLibrary( void ) // delete all font data deleteAllFonts(); -} // end ~FontLibrary +} //------------------------------------------------------------------------------------------------- /** Initialize what we need to in the font library */ @@ -159,7 +159,7 @@ FontLibrary::~FontLibrary( void ) void FontLibrary::init( void ) { -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset the fonts for this font library */ @@ -170,7 +170,7 @@ void FontLibrary::reset( void ) // delete all font data deleteAllFonts(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Get a font from our list, if we don't have that font loaded we will @@ -190,7 +190,7 @@ GameFont *FontLibrary::getFont( AsciiString name, Int pointSize, Bool bold ) ) return font; // found - } // end for font + } // font not found, allocate a new font element font = newInstance(GameFont); @@ -200,7 +200,7 @@ GameFont *FontLibrary::getFont( AsciiString name, Int pointSize, Bool bold ) DEBUG_CRASH(( "getFont: Unable to allocate new font list element" )); return NULL; - } // end if + } // copy font data over to new element font->nameString = name; @@ -217,7 +217,7 @@ GameFont *FontLibrary::getFont( AsciiString name, Int pointSize, Bool bold ) deleteInstance(font); return NULL; - } // end if + } // tie font into list linkFont( font ); @@ -225,4 +225,4 @@ GameFont *FontLibrary::getFont( AsciiString name, Int pointSize, Bool bold ) // all is done and loaded return font; -} // end getFont +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp index 9156f0d3093..e3703cbfbe2 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp @@ -117,7 +117,7 @@ GameWindow::GameWindow( void ) m_editData = NULL; -} // end GameWindow +} // GameWindow::~GameWindow ==================================================== //============================================================================= @@ -134,7 +134,7 @@ GameWindow::~GameWindow( void ) unlinkFromTransitionWindows(); -} // end ~GameWindow +} // GameWindow::linkTransitionWindow ============================================ //============================================================================= @@ -143,7 +143,7 @@ void GameWindow::linkTransitionWindow( TransitionWindow* transitionWindow ) m_transitionWindows.push_back(transitionWindow); -} // end linkTransitionWindow +} // GameWindow::unlinkTransitionWindow ========================================= //============================================================================= @@ -162,7 +162,7 @@ void GameWindow::unlinkTransitionWindow( TransitionWindow* transitionWindow ) ++it; } -} // end unlinkTransitionWindow +} // GameWindow::unlinkFromTransitionWindows ========================================= //============================================================================= @@ -175,7 +175,7 @@ void GameWindow::unlinkFromTransitionWindows( void ) m_transitionWindows.pop_back(); } -} // end unlinkFromTransitionWindows +} // GameWindow::normalizeWindowRegion ========================================== /** Puts the upper left corner in the window's region.lo field */ @@ -191,7 +191,7 @@ void GameWindow::normalizeWindowRegion( void ) m_region.lo.x = m_region.hi.x; m_region.hi.x = temp; - } // end if + } if( m_region.lo.y > m_region.hi.y ) { @@ -200,9 +200,9 @@ void GameWindow::normalizeWindowRegion( void ) m_region.lo.y = m_region.hi.y; m_region.hi.y = temp; - } // end if + } -} // end normalizeWindowRegion +} // GameWindow::findFirstLeaf ================================================== /** Returns the first leaf of the branch */ @@ -221,7 +221,7 @@ GameWindow *GameWindow::findFirstLeaf( void ) return leaf; -} // end findFirstLeaf +} // GameWindow::findLastLeaf =================================================== /** Returns the last leaf of the branch */ @@ -243,11 +243,11 @@ GameWindow *GameWindow::findLastLeaf( void ) while( leaf->m_next ) leaf = leaf->m_next; - } // end while + } return leaf; -} // end findLastLeaf +} // GameWindow::findPrevLeaf =================================================== /** Returns the prev leaf of the tree */ @@ -270,11 +270,11 @@ GameWindow *GameWindow::findPrevLeaf( void ) while( leaf->m_next ) leaf = leaf->m_next; - } // end while + } return leaf; - } // end if + } else { @@ -297,24 +297,24 @@ GameWindow *GameWindow::findPrevLeaf( void ) while( leaf->m_next ) leaf = leaf->m_next; - } // end while + } return leaf; - } // end if + } - } // end while + } if( leaf ) return leaf->findLastLeaf(); else return NULL; - } // end else + } return NULL; -} // end findPrevLeaf +} // GameWindow::findNextLeaf =================================================== /** Returns the next leaf of the tree */ @@ -334,7 +334,7 @@ GameWindow *GameWindow::findNextLeaf( void ) WIN_STATUS_TAB_STOP ) ) return leaf; - } // end if + } else { @@ -351,20 +351,20 @@ GameWindow *GameWindow::findNextLeaf( void ) BitIsSet( leaf->m_status, WIN_STATUS_TAB_STOP ) ) return leaf; - } // end if + } - } // end while + } if( leaf ) return leaf->findFirstLeaf(); else return NULL; - } // end else + } return NULL; -} // end findNextLeav +} // GameWindow::winNextTab ===================================================== /** Go to next window in tab chain */ @@ -399,7 +399,7 @@ Int GameWindow::winNextTab( void ) */ return WIN_ERR_OK; -} // end WinNextTab +} // GameWindow::winPrevTab ===================================================== /** Go to previous window in tab chain */ @@ -422,7 +422,7 @@ Int GameWindow::winPrevTab( void ) newTab = findFirstLeaf( newTab ); firstTry = FALSE; - } // end if + } else newTab = findNextLeaf( newTab ); @@ -436,7 +436,7 @@ Int GameWindow::winPrevTab( void ) return WIN_ERR_OK; -} // end WinPrevTab +} // GameWindow::winBringToTop ================================================== /** Bring this window to the top of the window list, if we have a parent @@ -454,7 +454,7 @@ Int GameWindow::winBringToTop( void ) TheWindowManager->addWindowToParent( this, parent ); // TheWindowManager->addWindowToParentAtEnd( this, parent ); - } // end if + } else { @@ -469,7 +469,7 @@ Int GameWindow::winBringToTop( void ) TheWindowManager->unlinkWindow( this ); TheWindowManager->linkWindow( this ); - } // end else + } // // if the window is part of a screen layout, move it to the top @@ -488,11 +488,11 @@ Int GameWindow::winBringToTop( void ) saveLayout->removeWindow( this ); saveLayout->addWindow( this ); - } // end if + } return WIN_ERR_OK; -} // end winBringToTop +} // GameWindow::winActivate ==================================================== /** Pop window to top of window list AND activate it */ @@ -512,7 +512,7 @@ Int GameWindow::winActivate( void ) return WIN_ERR_OK; -} // end WinActivate +} // GameWindow::winSetPosition ================================================= /** Set the window's position */ @@ -530,7 +530,7 @@ Int GameWindow::winSetPosition( Int x, Int y ) return WIN_ERR_OK; -} // end WinSetPosition +} // WinGetPosition ============================================================= /** Get the window's postion */ @@ -547,7 +547,7 @@ Int GameWindow::winGetPosition( Int *x, Int *y ) return WIN_ERR_OK; -} // end WinGetPosition +} // WinSetCursorPosition ============================================================= /** Set the window's cursor postion */ @@ -559,7 +559,7 @@ Int GameWindow::winSetCursorPosition( Int x, Int y ) return WIN_ERR_OK; -} // end WinSetCursorPosition +} // WinGetCursorPosition ============================================================= /** Get the window's cursor postion */ @@ -578,7 +578,7 @@ Int GameWindow::winGetCursorPosition( Int *x, Int *y ) return WIN_ERR_OK; -} // end WinGetPosition +} // GameWindow::winGetScreenPosition =========================================== /** Get the window's postion in screen coordinates */ @@ -597,11 +597,11 @@ Int GameWindow::winGetScreenPosition( Int *x, Int *y ) *y += parent->m_region.lo.y; parent = parent->m_parent; - } // end while + } return WIN_ERR_OK; -} // end WinGetScreenPosition +} // GameWindow::winGetRegion =================================================== /** Get the window region */ @@ -614,7 +614,7 @@ Int GameWindow::winGetRegion( IRegion2D *region ) return WIN_ERR_OK; -} // end winGetRegion +} // GameWindow::winPointInWindow =============================================== /** Check to see if the given point is inside the window. Will @@ -633,7 +633,7 @@ Bool GameWindow::winPointInWindow( Int x, Int y ) return FALSE; -} // end WinPointInWindow +} // GameWindow::winSetSize ===================================================== /** Set the window's size */ @@ -653,7 +653,7 @@ Int GameWindow::winSetSize( Int width, Int height ) return WIN_ERR_OK; -} // end WinSetSize +} // GameWindow::winGetSize ===================================================== /** Get the window's size */ @@ -670,7 +670,7 @@ Int GameWindow::winGetSize( Int *width, Int *height ) return WIN_ERR_OK; -} // end WinGetSize +} // GameWindow::winEnable ====================================================== /** Enable or disable a window based on the enable parameter. @@ -691,11 +691,11 @@ Int GameWindow::winEnable( Bool enable ) for( child = m_child; child; child = child->m_next) child->winEnable( enable ); - } // end if + } return WIN_ERR_OK; -} // end WinEnable +} // GameWindow::winGetEnabled ====================================================== /** Enable or disable a window based on the enable parameter. @@ -705,7 +705,7 @@ Bool GameWindow::winGetEnabled( void ) { return BitIsSet( m_status, WIN_STATUS_ENABLED ); -} // end winGetEnabled +} // GameWindow::winHide ======================================================== /** Hide or show a window based on the hide parameter. @@ -730,17 +730,17 @@ Int GameWindow::winHide( Bool hide ) // notify the window manger we are hiding TheWindowManager->windowHiding( this ); - } // end if + } else { BitClear( m_status, WIN_STATUS_HIDDEN ); - } // end else + } return WIN_ERR_OK; -} // end WinHide +} // GameWindow::winIsHidden ==================================================== /** Am I hidden? */ @@ -750,7 +750,7 @@ Bool GameWindow::winIsHidden( void ) return BitIsSet( m_status, WIN_STATUS_HIDDEN ); -} // end WinIsHidden +} // GameWindow::winSetStatus =================================================== /** Allows the user to directly set a window's status flags. */ @@ -765,7 +765,7 @@ UnsignedInt GameWindow::winSetStatus( UnsignedInt status ) return oldStatus; -} // end WinSetStatus +} // GameWindow::winClearStatus ================================================= /** Allows the user to directly clear a window's status flags. */ @@ -779,7 +779,7 @@ UnsignedInt GameWindow::winClearStatus( UnsignedInt status ) return oldStatus; -} // end WinClearStatus +} // GameWindow::winGetStatus =================================================== /** Returns a window's status flags. */ @@ -789,7 +789,7 @@ UnsignedInt GameWindow::winGetStatus( void ) return m_status; -} // end WinGetStatus +} // GameWindow::winGetStyle ==================================================== /** Returns a window's style flags. */ @@ -799,7 +799,7 @@ UnsignedInt GameWindow::winGetStyle( void ) return m_instData.m_style; -} // end WinGetStyle +} // GameWindow::winSetHiliteState ============================================== /** Set whether window is highlighted or not */ @@ -812,7 +812,7 @@ void GameWindow::winSetHiliteState( Bool state ) else BitClear( m_instData.m_state, WIN_STATE_HILITED ); -} // end WinSetHiliteState +} // GameWindow::winSetDrawOffset =============================================== /** Set offset for drawing images */ @@ -823,7 +823,7 @@ void GameWindow::winSetDrawOffset( Int x, Int y ) m_instData.m_imageOffset.x = x; m_instData.m_imageOffset.y = y; -} // end WinSetDrawOffset +} // GameWindow::winGetDrawOffset =============================================== /** Get offset for drawing images */ @@ -838,7 +838,7 @@ void GameWindow::winGetDrawOffset( Int *x, Int *y ) *x = m_instData.m_imageOffset.x; *y = m_instData.m_imageOffset.y; -} // end WinGetDrawOffset +} // GameWindow::winSetText ===================================================== /** Sets the text in a window */ @@ -850,7 +850,7 @@ Int GameWindow::winSetText( UnicodeString newText ) return WIN_ERR_OK; -} // end WinSetText +} // GameWindow::winGetText ===================================================== /** Get text from a window ... this works for static text windows and @@ -861,7 +861,7 @@ UnicodeString GameWindow::winGetText( void ) // return the contents of our text field return m_instData.getText(); -} // end WinGetText +} // GameWindow::winGetTextLength ===================================================== //============================================================================= @@ -870,7 +870,7 @@ Int GameWindow::winGetTextLength() // return the contents of our text field return m_instData.getTextLength(); -} // end WinGetText +} // GameWindow::winGetFont ===================================================== /** Get the font being used by this window */ @@ -880,7 +880,7 @@ GameFont *GameWindow::winGetFont( void ) return m_instData.getFont(); -} // end WinGetFont +} // GameWindow::winSetFont ===================================================== /** Set font for text in this window */ @@ -912,9 +912,9 @@ void GameWindow::winSetFont( GameFont *font ) if( dString ) dString->setFont( font ); - } // end else + } -} // end WinSetFont +} // GameWindow::winSetEnabledTextColors ======================================== /** Set the text colors for the enabled state */ @@ -928,7 +928,7 @@ void GameWindow::winSetEnabledTextColors( Color color, Color borderColor ) GadgetComboBoxSetEnabledTextColors(this, color, borderColor ); -} // end winSetEnabledTextColors +} // GameWindow::winSetDisabledTextColors ======================================= /** Set the text colors for the disabled state */ @@ -942,7 +942,7 @@ void GameWindow::winSetDisabledTextColors( Color color, Color borderColor ) if( BitIsSet( m_instData.getStyle(), GWS_COMBO_BOX ) ) GadgetComboBoxSetDisabledTextColors( this, color, borderColor ); -} // end winSetDisabledTextColors +} // GameWindow::winSetHiliteTextColors ========================================= /** Set the text colors for the Hilite state */ @@ -956,7 +956,7 @@ void GameWindow::winSetHiliteTextColors( Color color, Color borderColor ) if( BitIsSet( m_instData.getStyle(), GWS_COMBO_BOX ) ) GadgetComboBoxSetHiliteTextColors( this, color, borderColor ); -} // end winSetHiliteTextColors +} // GameWindow::winSetIMECompositeTextColors ========================================= /** Set the text colors for the IME Composite state */ @@ -969,7 +969,7 @@ void GameWindow::winSetIMECompositeTextColors( Color color, Color borderColor ) if( BitIsSet( m_instData.getStyle(), GWS_COMBO_BOX ) ) GadgetComboBoxSetIMECompositeTextColors( this, color, borderColor ); -} // end winSetIMECompositeTextColors +} // GameWindow::winGetEnabledTextColor ========================================= /** Get the enabled text color */ @@ -979,7 +979,7 @@ Color GameWindow::winGetEnabledTextColor( void ) return m_instData.m_enabledText.color; -} // end winGetEnabledTextColor +} // GameWindow::winGetEnabledTextBorderColor =================================== /** Get the enabled text color */ @@ -989,7 +989,7 @@ Color GameWindow::winGetEnabledTextBorderColor( void ) return m_instData.m_enabledText.borderColor; -} // end winGetEnabledTextBorderColor +} // GameWindow::winGetDisabledTextColor ======================================== /** Get the disabled text color */ @@ -999,7 +999,7 @@ Color GameWindow::winGetDisabledTextColor( void ) return m_instData.m_disabledText.color; -} // end winGetDisabledTextColor +} // GameWindow::winGetDisabledTextBorderColor ================================== /** Get the disabled text color */ @@ -1009,7 +1009,7 @@ Color GameWindow::winGetDisabledTextBorderColor( void ) return m_instData.m_disabledText.borderColor; -} // end winGetEnabledTextBorderColor +} // GameWindow::winGetIMECompositeTextColor ========================================== /** Get the IME composite text color */ @@ -1019,7 +1019,7 @@ Color GameWindow::winGetIMECompositeTextColor( void ) return m_instData.m_imeCompositeText.color; -} // end winGetIMECompositeTextColor +} // GameWindow::winGetIMECompositeBorderColor ========================================== /** Get the IME composite border color */ @@ -1029,7 +1029,7 @@ Color GameWindow::winGetIMECompositeBorderColor( void ) return m_instData.m_imeCompositeText.borderColor; -} // end winGetIMECompositeBorderColor +} // GameWindow::winGetHiliteTextColor ========================================== /** Get the hilite text color */ @@ -1039,7 +1039,7 @@ Color GameWindow::winGetHiliteTextColor( void ) return m_instData.m_hiliteText.color; -} // end winGetHiliteTextColor +} // GameWindow::winGetHiliteTextBorderColor ==================================== /** Get the hilite text color */ @@ -1049,7 +1049,7 @@ Color GameWindow::winGetHiliteTextBorderColor( void ) return m_instData.m_hiliteText.borderColor; -} // end winGetHiliteTextBorderColor +} // GameWindow::winSetInstanceData ============================================= /** Sets the window's instance data which includes parameters @@ -1083,7 +1083,7 @@ Int GameWindow::winSetInstanceData( WinInstanceData *data ) return WIN_ERR_OK; -} // end WinSetInstanceData +} // GameWindow::winGetInstanceData ============================================= /** Return pointer to the instance data for this window */ @@ -1093,7 +1093,7 @@ WinInstanceData *GameWindow::winGetInstanceData( void ) return &m_instData; -} // end WinGetInstanceData +} // GameWindow::winGetUserData ================================================= /** Return the user data stored */ @@ -1103,7 +1103,7 @@ void *GameWindow::winGetUserData( void ) return m_userData; -} // end WinGetUserData +} // GameWindow::winSetUserData ================================================= /** Set the user data stored */ @@ -1113,7 +1113,7 @@ void GameWindow::winSetUserData( void *data ) m_userData = data; -} // end WinSetUserData +} // GameWindow::winSetTooltip ================================================== /** Sets the window's tooltip text */ @@ -1123,7 +1123,7 @@ void GameWindow::winSetTooltip( UnicodeString tip ) m_instData.setTooltipText( tip ); -} // end WinSetTooltip +} // GameWindow::winSetWindowId ================================================= /** Sets the window's id */ @@ -1135,7 +1135,7 @@ Int GameWindow::winSetWindowId( Int id ) return WIN_ERR_OK; -} // end WinSetWindowId +} // GameWindow::winGetWindowId ================================================= /** Gets the window's id */ @@ -1145,7 +1145,7 @@ Int GameWindow::winGetWindowId( void ) return m_instData.m_id; -} // end WinGetWindowId +} // GameWindow::winSetParent =================================================== /** Sets this window's parent */ @@ -1182,7 +1182,7 @@ Int GameWindow::winSetParent( GameWindow *parent ) return WIN_ERR_OK; -} // end WinSetParent +} // GameWindow::winGetParent =================================================== /** Gets the window's parent */ @@ -1192,7 +1192,7 @@ GameWindow *GameWindow::winGetParent( void ) return m_parent; -} // end WinGetParent +} // GameWindow::winIsChild ===================================================== /** Determins if a window is a child/grand-child of a parent */ @@ -1209,11 +1209,11 @@ Bool GameWindow::winIsChild( GameWindow *child ) // set up tree child = child->m_parent; - } // end while + } return FALSE; -} // end WinIsChild +} // GameWindow::winGetChild ==================================================== /** Get the child window of this window */ @@ -1223,7 +1223,7 @@ GameWindow *GameWindow::winGetChild( void ) return m_child; -} // end WinGetChild +} // GameWindow::winSetOwner ==================================================== /** Sets the window's owner */ @@ -1238,7 +1238,7 @@ Int GameWindow::winSetOwner( GameWindow *owner ) return WIN_ERR_OK; -} // end WinSetOwner +} // GameWindow::winGetOwner ==================================================== /** Gets the window's owner */ @@ -1248,7 +1248,7 @@ GameWindow *GameWindow::winGetOwner( void ) return m_instData.getOwner(); -} // end winGetOwner +} // GameWindow::winSetNext ===================================================== /** Set next pointer */ @@ -1258,7 +1258,7 @@ void GameWindow::winSetNext( GameWindow *next ) m_next = next; -} // end winSetNext +} // GameWindow::winGetNext ===================================================== /** Gets the next window */ @@ -1268,7 +1268,7 @@ GameWindow *GameWindow::winGetNext( void ) return m_next; -} // end winGetNext +} // GameWindow::winSetPrev ===================================================== /** Set prev pointer */ @@ -1278,7 +1278,7 @@ void GameWindow::winSetPrev( GameWindow *prev ) m_prev = prev; -} // end winSetPrev +} // GameWindow::winGetPrev ===================================================== /** Get the previous window */ @@ -1288,7 +1288,7 @@ GameWindow *GameWindow::winGetPrev( void ) return m_prev; -} // end winGetPrev +} // GameWindow::winSetNextInLayout ============================================= /** Set next window in layout */ @@ -1350,7 +1350,7 @@ Int GameWindow::winSetSystemFunc( GameWinSystemFunc system ) return WIN_ERR_OK; -} // end WinSetSystemFunc +} // GameWindow::winSetInputFunc ================================================ /** Sets the window's input callback functions. */ @@ -1365,7 +1365,7 @@ Int GameWindow::winSetInputFunc( GameWinInputFunc input ) return WIN_ERR_OK; -} // end WinSetInputFunc +} // GameWindow::winSetDrawFunc ================================================= /** Sets the window's redraw callback functions. */ @@ -1380,7 +1380,7 @@ Int GameWindow::winSetDrawFunc( GameWinDrawFunc draw ) return WIN_ERR_OK; -} // end WinSetDrawFunc +} // GameWindow::winSetTooltipFunc ============================================== /** Sets a window's tooltip callback */ @@ -1392,7 +1392,7 @@ Int GameWindow::winSetTooltipFunc( GameWinTooltipFunc tooltip ) return WIN_ERR_OK; -} // end WinSetTooltipFunc +} // GameWindow::winSetCallbacks ================================================ /** Sets the window's input, tooltip, and redraw callback functions. */ @@ -1408,7 +1408,7 @@ Int GameWindow::winSetCallbacks( GameWinInputFunc input, return WIN_ERR_OK; -} // end WinSetCallbacks +} // GameWindow::winDrawWindow ================================================== /** Draws the default background for the specified window. */ @@ -1421,7 +1421,7 @@ Int GameWindow::winDrawWindow( void ) return WIN_ERR_OK; -} // end WinDrawWindow +} // GameWindow::winPointInChild ================================================ /** Given a window and the mouse coordinates, return the child @@ -1447,7 +1447,7 @@ GameWindow *GameWindow::winPointInChild( Int x, Int y, Bool ignoreEnableCheck, B origin.y += parent->m_region.lo.y; parent = parent->m_parent; - } // end while + } if( x >= origin.x && x <= origin.x + child->m_size.x && y >= origin.y && y <= origin.y + child->m_size.y ) @@ -1471,12 +1471,12 @@ GameWindow *GameWindow::winPointInChild( Int x, Int y, Bool ignoreEnableCheck, B } } - } // end for child + } // not in any children, must be in parent return this; -} // end WinPointInChild +} // GameWindow::winPointInAnyChild ============================================= /** Find the child in which the cursor resides; regardless of @@ -1501,7 +1501,7 @@ GameWindow *GameWindow::winPointInAnyChild( Int x, Int y, Bool ignoreHidden, Boo origin.y += parent->m_region.lo.y; parent = parent->m_parent; - } // end while + } if( x >= origin.x && x <= origin.x + child->m_size.x && y >= origin.y && y <= origin.y + child->m_size.y ) @@ -1510,14 +1510,14 @@ GameWindow *GameWindow::winPointInAnyChild( Int x, Int y, Bool ignoreHidden, Boo if( !(ignoreHidden == TRUE && BitIsSet( child->m_status, WIN_STATUS_HIDDEN )) ) return child->winPointInChild( x, y, ignoreEnableCheck ); - } // end if + } - } // end for child + } // not in any children, must be in parent return this; -} // end WinPointInAnyChild +} // // In release builds the default input and system functions are optimized @@ -1537,7 +1537,7 @@ WindowMsgHandledType GameWinDefaultInput( GameWindow *window, UnsignedInt msg, return MSG_IGNORED; -} // end GameWinDefaultInput +} ///< Input that blocks all (mouse) input like a wall, instead of passing like it wasn't there WindowMsgHandledType GameWinBlockInput( GameWindow *window, UnsignedInt msg, @@ -1563,7 +1563,7 @@ WindowMsgHandledType GameWinBlockInput( GameWindow *window, UnsignedInt msg, return MSG_HANDLED; -} // end GameWinBlockInput +} // GameWinDefaultSystem ======================================================= /** The default system callback. Currently does nothing. */ @@ -1574,7 +1574,7 @@ WindowMsgHandledType GameWinDefaultSystem( GameWindow *window, UnsignedInt msg, return MSG_IGNORED; -} // end GameWinDefaultSystem +} // GameWinDefaultTooltip ====================================================== /** Default tooltip callback */ @@ -1585,7 +1585,7 @@ void GameWinDefaultTooltip( GameWindow *window, { return; -} // end GameWinDefaultTooltip +} // GameWinDefaultDraw ========================================================= /** Default draw, does nothing */ @@ -1595,7 +1595,7 @@ void GameWinDefaultDraw( GameWindow *window, WinInstanceData *instData ) return; -} // end GameWinDefaultDraw +} // GameWindow::winSetEnabledImage ============================================= /** Set an enabled image into the draw data for the enabled state */ @@ -1611,12 +1611,12 @@ Int GameWindow::winSetEnabledImage( Int index, const Image *image ) assert( 0 ); return WIN_ERR_INVALID_PARAMETER; - } // end if + } m_instData.m_enabledDrawData[ index ].image = image; return WIN_ERR_OK; -} // end winSetEnabledImage +} // GameWindow::winSetEnabledColor ============================================= /** set color for enabled state at index */ @@ -1632,12 +1632,12 @@ Int GameWindow::winSetEnabledColor( Int index, Color color ) assert( 0 ); return WIN_ERR_INVALID_PARAMETER; - } // end if + } m_instData.m_enabledDrawData[ index ].color = color; return WIN_ERR_OK; -} // end winSetEnabledColor +} // GameWindow::winSetEnabledBorderColor ======================================= /** set border color for state at this index */ @@ -1653,12 +1653,12 @@ Int GameWindow::winSetEnabledBorderColor( Int index, Color color ) assert( 0 ); return WIN_ERR_INVALID_PARAMETER; - } // end if + } m_instData.m_enabledDrawData[ index ].borderColor = color; return WIN_ERR_OK; -} // end winSetEnabledBorderColor +} // GameWindow::winSetDisabledImage ============================================ /** Set an disabled image into the draw data for the disabled state */ @@ -1674,12 +1674,12 @@ Int GameWindow::winSetDisabledImage( Int index, const Image *image ) assert( 0 ); return WIN_ERR_INVALID_PARAMETER; - } // end if + } m_instData.m_disabledDrawData[ index ].image = image; return WIN_ERR_OK; -} // end winSetDisabledImage +} // GameWindow::winSetDisabledColor ============================================ /** set color for disabled state at index */ @@ -1695,12 +1695,12 @@ Int GameWindow::winSetDisabledColor( Int index, Color color ) assert( 0 ); return WIN_ERR_INVALID_PARAMETER; - } // end if + } m_instData.m_disabledDrawData[ index ].color = color; return WIN_ERR_OK; -} // end winSetDisabledColor +} // GameWindow::winSetDisabledBorderColor ====================================== /** set border color for state at this index */ @@ -1716,12 +1716,12 @@ Int GameWindow::winSetDisabledBorderColor( Int index, Color color ) assert( 0 ); return WIN_ERR_INVALID_PARAMETER; - } // end if + } m_instData.m_disabledDrawData[ index ].borderColor = color; return WIN_ERR_OK; -} // end winSetDisabledBorderColor +} // GameWindow::winSetHiliteImage ============================================== /** Set an hilite image into the draw data for the hilite state */ @@ -1737,12 +1737,12 @@ Int GameWindow::winSetHiliteImage( Int index, const Image *image ) assert( 0 ); return WIN_ERR_INVALID_PARAMETER; - } // end if + } m_instData.m_hiliteDrawData[ index ].image = image; return WIN_ERR_OK; -} // end winSetHiliteImage +} // GameWindow::winSetHiliteColor ============================================== /** set color for hilite state at index */ @@ -1758,12 +1758,12 @@ Int GameWindow::winSetHiliteColor( Int index, Color color ) assert( 0 ); return WIN_ERR_INVALID_PARAMETER; - } // end if + } m_instData.m_hiliteDrawData[ index ].color = color; return WIN_ERR_OK; -} // end winSetHiliteColor +} // GameWindow::winSetHiliteBorderColor ======================================== /** set border color for state at this index */ @@ -1779,12 +1779,12 @@ Int GameWindow::winSetHiliteBorderColor( Int index, Color color ) assert( 0 ); return WIN_ERR_INVALID_PARAMETER; - } // end if + } m_instData.m_hiliteDrawData[ index ].borderColor = color; return WIN_ERR_OK; -} // end winSetHiliteBorderColor +} // GameWindow::winGetInputFunc ================================================ //============================================================================= @@ -1793,7 +1793,7 @@ GameWinInputFunc GameWindow::winGetInputFunc( void ) return m_input; -} // end winGetInputFunc +} // GameWindow::winGetSystemFunc =============================================== //============================================================================= @@ -1802,7 +1802,7 @@ GameWinSystemFunc GameWindow::winGetSystemFunc( void ) return m_system; -} // end winGetSystemFunc +} // GameWindow::winGetTooltipFunc ============================================== //============================================================================= @@ -1811,7 +1811,7 @@ GameWinTooltipFunc GameWindow::winGetTooltipFunc( void ) return m_tooltip; -} // end winGetTooltipFunc +} // GameWindow::winGetDrawFunc ================================================= //============================================================================= @@ -1820,7 +1820,7 @@ GameWinDrawFunc GameWindow::winGetDrawFunc( void ) return m_draw; -} // end winGetDrawFunc +} // GameWindow::winSetEditData ================================================= //============================================================================= @@ -1829,7 +1829,7 @@ void GameWindow::winSetEditData( GameWindowEditData *editData ) m_editData = editData; -} // end winSetEditData +} // GameWindow::winGetEditData ================================================= //============================================================================= @@ -1838,4 +1838,4 @@ GameWindowEditData *GameWindow::winGetEditData( void ) return m_editData; -} // end winGetEditData +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp index 44976352dbf..b600d6baf12 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp @@ -80,7 +80,7 @@ void GameWindowManager::winDrawImage( const Image *image, Int startX, Int startY TheDisplay->drawImage( image, startX, startY, endX, endY, color ); -} // end WinDrawImage +} // GameWindowManager::winFillRect ============================================= /** draw filled rect, coords are absolute screen coords */ @@ -94,7 +94,7 @@ void GameWindowManager::winFillRect( Color color, Real width, endX - startX, endY - startY, color ); -} // end WinFillRect +} // GameWindowManager::winOpenRect ============================================= /** draw rect outline, coords are absolute screen coords */ @@ -108,7 +108,7 @@ void GameWindowManager::winOpenRect( Color color, Real width, endX - startX, endY - startY, width, color ); -} // end WinOpenRect +} // GameWindowManager::winDrawLine ============================================= /** draw line, coords are absolute screen coords */ @@ -120,7 +120,7 @@ void GameWindowManager::winDrawLine( Color color, Real width, TheDisplay->drawLine( startX, startY, endX, endY, width, color ); -} // end WinDrawLine +} // GameWindowManager::winFindImage ============================================ /** Given an image name, return an image loc to that image information. @@ -136,7 +136,7 @@ const Image *GameWindowManager::winFindImage( const char *name ) return NULL; -} // end WinFindImage +} // GameWindowManager::winMakeColor ============================================ /** Given RGBA, make a color, you can change color representation for your @@ -150,7 +150,7 @@ Color GameWindowManager::winMakeColor( UnsignedByte red, return GameMakeColor( red, green, blue, alpha ); -} // end WinMakeColor +} // GameWindowManager::winFormatText =========================================== /** draw text to the screen */ @@ -161,7 +161,7 @@ void GameWindowManager::winFormatText( GameFont *font, UnicodeString text, Color /// @todo make all display string rendering go through here! -} // end WinFormatText +} // GameWindowManager::winGetTextSize ========================================== /** get the extent size of text */ @@ -178,7 +178,7 @@ void GameWindowManager::winGetTextSize( GameFont *font, UnicodeString text, if( height ) *height = 0; -} // end WinGetTextSize +} // GameWindowManager::winFontHeight =========================================== /** Return the font height in pixels */ @@ -188,7 +188,7 @@ Int GameWindowManager::winFontHeight( GameFont *font ) return font->height; -} // end WinFontHeight +} // GameWindowManager::winIsDigit ============================================== /** You implementation of whether or not character is a digit */ @@ -198,7 +198,7 @@ Int GameWindowManager::winIsDigit( Int c ) return GameIsDigit( c ); -} // end WinIsDigit +} // GameWindowManager::winIsAscii ============================================== /** You implementation of whether or not character is ascii */ @@ -208,7 +208,7 @@ Int GameWindowManager::winIsAscii( Int c ) return GameIsAscii( c ); -} // end WinIsDigit +} // GameWindowManager::winIsAlNum ============================================== /** Your implementation of whether or not character is alpha numeric */ @@ -218,7 +218,7 @@ Int GameWindowManager::winIsAlNum( Int c ) return GameIsAlNum( c ); -} // end WinIsAlNum +} // GameWindowManager::winFindFont ============================================= /** Get a font */ @@ -234,5 +234,5 @@ GameFont *GameWindowManager::winFindFont( AsciiString fontName, return NULL; -} // end WinFindFont +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp index 9f3b4cf4049..34d40de2b08 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp @@ -120,9 +120,9 @@ void GameWindowManager::processDestroyList( void ) // free the memory deleteInstance(doDestroy); - } // end for + } -} // end processDestroyList +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -146,11 +146,11 @@ WindowMsgHandledType PassSelectedButtonsToParentSystem( GameWindow *window, Unsi if( parent ) return TheWindowManager->winSendSystemMsg( parent, msg, mData1, mData2 ); - } // end if + } return MSG_IGNORED; -} // end PassSelectedButtonsToParentSystem +} //------------------------------------------------------------------------------------------------- /** Generic function to simply propagate only button press messages to parent and let it deal with it */ @@ -171,7 +171,7 @@ WindowMsgHandledType PassMessagesToParentSystem( GameWindow *window, UnsignedInt return MSG_IGNORED; -} // end PassSelectedButtonsToParentSystem +} //------------------------------------------------------------------------------------------------- @@ -194,7 +194,7 @@ GameWindowManager::GameWindowManager( void ) m_cursorBitmap = NULL; m_captureFlags = 0; -} // end GameWindowManger +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -207,7 +207,7 @@ GameWindowManager::~GameWindowManager( void ) if(TheTransitionHandler) delete TheTransitionHandler; TheTransitionHandler = NULL; -} // end ~GameWindowManager +} //------------------------------------------------------------------------------------------------- /** Initialize the game window manager system */ @@ -218,7 +218,7 @@ void GameWindowManager::init( void ) TheTransitionHandler = NEW GameWindowTransitionsHandler; TheTransitionHandler->load(); TheTransitionHandler->init(); -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset window system */ @@ -231,7 +231,7 @@ void GameWindowManager::reset( void ) if(TheTransitionHandler) TheTransitionHandler->reset(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update cycle for game widnow manager */ @@ -243,7 +243,7 @@ void GameWindowManager::update( void ) processDestroyList(); if(TheTransitionHandler) TheTransitionHandler->update(); -} // end update +} //------------------------------------------------------------------------------------------------- /** Puts a window at the head of the window list */ @@ -295,7 +295,7 @@ void GameWindowManager::linkWindow( GameWindow *window ) } } -} // end linkWindow +} //------------------------------------------------------------------------------------------------- /** Insert the window ahead of the the 'aheadOf' window. 'aheadOf' can @@ -317,7 +317,7 @@ void GameWindowManager::insertWindowAheadOf( GameWindow *window, linkWindow( window ); return; - } // end if + } // get parent of aheadOf GameWindow *aheadOfParent = aheadOf->winGetParent(); @@ -339,7 +339,7 @@ void GameWindowManager::insertWindowAheadOf( GameWindow *window, aheadOf->m_prev = window; window->m_next = aheadOf; - } // end if + } else { @@ -355,9 +355,9 @@ void GameWindowManager::insertWindowAheadOf( GameWindow *window, window->m_parent = aheadOfParent; - } // end else + } -} // end insertWindowAheadOf +} //------------------------------------------------------------------------------------------------- /** Takes a window off the window list */ @@ -378,7 +378,7 @@ void GameWindowManager::unlinkWindow( GameWindow *window ) else m_windowList = window->m_next; -} // end unlinkWindow +} //------------------------------------------------------------------------------------------------- /** Takes a child window off its parent's window list */ @@ -415,12 +415,12 @@ void GameWindowManager::unlinkChildWindow( GameWindow *window ) } - } // end else + } // remove the parent reference from this window window->m_parent = NULL; -} // end unlinkChildWindow +} //------------------------------------------------------------------------------------------------- /** Check window and parents to see if this window is enabled */ @@ -448,7 +448,7 @@ Bool GameWindowManager::isEnabled( GameWindow *win ) return TRUE; -} // end isEnabled +} //------------------------------------------------------------------------------------------------- /** Check window and parents to see if this window is hidden */ @@ -476,7 +476,7 @@ Bool GameWindowManager::isHidden( GameWindow *win ) return FALSE; -} // end isHidden +} //------------------------------------------------------------------------------------------------- // Adds a child window to its parent. @@ -500,7 +500,7 @@ void GameWindowManager::addWindowToParent( GameWindow *window, } -} // end addWindowToParent +} //------------------------------------------------------------------------------------------------- /** Add a child window to the parent, put place it at the end of the @@ -528,16 +528,16 @@ void GameWindowManager::addWindowToParentAtEnd( GameWindow *window, last->m_next = window; window->m_prev = last; - } // end if + } else parent->m_child = window; // assign the parent to the window window->m_parent = parent; - } // end if + } -} // end addWindowToParentAtEnd +} //------------------------------------------------------------------------------------------------- /** this gets called from winHide() when a window hides itself */ @@ -566,7 +566,7 @@ void GameWindowManager::windowHiding( GameWindow *window ) for( child = window->winGetChild(); child; child = child->winGetNext() ) windowHiding( child ); -} // end windowHiding +} //------------------------------------------------------------------------------------------------- /** Hide all windows in a certain range of id's (inclusive) */ @@ -585,9 +585,9 @@ void GameWindowManager::hideWindowsInRange( GameWindow *baseWindow, if( window ) window->winHide( hideFlag ); - } // end for i + } -} // end hideWindowsInRange +} //------------------------------------------------------------------------------------------------- // Enable all windows in a certain range of id's (inclusive) @@ -606,9 +606,9 @@ void GameWindowManager::enableWindowsInRange( GameWindow *baseWindow, if( window ) window->winEnable( enableFlag ); - } // end for i + } -} // end enableWindowsInRange +} //------------------------------------------------------------------------------------------------- /** Captures the mouse capture. */ @@ -623,7 +623,7 @@ Int GameWindowManager::winCapture( GameWindow *window ) return WIN_ERR_OK; -} // end WinCapture +} //------------------------------------------------------------------------------------------------- /** Releases the mouse capture. */ @@ -636,7 +636,7 @@ Int GameWindowManager::winRelease( GameWindow *window ) return WIN_ERR_OK; -} // end WinRelease +} //------------------------------------------------------------------------------------------------- /** Returns the current mouse captor. */ @@ -646,7 +646,7 @@ GameWindow *GameWindowManager::winGetCapture( void ) return m_mouseCaptor; -} // end WinGetCapture +} //------------------------------------------------------------------------------------------------- /** Gets the window pointer from its id */ @@ -669,13 +669,13 @@ GameWindow *GameWindowManager::winGetWindowFromId( GameWindow *window, Int id ) if( child ) return child; - } // end else if + } - } // end for + } return NULL; -} // end WinGetWindowFromId +} //------------------------------------------------------------------------------------------------- /** Gets the Window List Pointer */ @@ -685,7 +685,7 @@ GameWindow *GameWindowManager::winGetWindowList( void ) return m_windowList; -} // end winGetWindowList +} //------------------------------------------------------------------------------------------------- /** Send a system message to the specified window */ @@ -704,7 +704,7 @@ WindowMsgHandledType GameWindowManager::winSendSystemMsg( GameWindow *window, return window->m_system( window, msg, mData1, mData2 ); -} // end winSendSystemMsg +} //------------------------------------------------------------------------------------------------- /** Send a system message to the specified window */ @@ -723,7 +723,7 @@ WindowMsgHandledType GameWindowManager::winSendInputMsg( GameWindow *window, return window->m_input( window, msg, mData1, mData2 ); -} // end winSendInputMsg +} //------------------------------------------------------------------------------------------------- /** Get the current input focus */ @@ -733,7 +733,7 @@ GameWindow *GameWindowManager::winGetFocus( void ) return m_keyboardFocus; -} // end WinGetFocus +} //------------------------------------------------------------------------------------------------- /** Set the current input focus */ @@ -775,7 +775,7 @@ Int GameWindowManager::winSetFocus( GameWindow *window ) break; } - } // end if + } // If new window doesn't want focus, set focus to NULL if( wantsFocus == FALSE ) @@ -783,7 +783,7 @@ Int GameWindowManager::winSetFocus( GameWindow *window ) return WIN_ERR_OK; -} // end WinSetFocus +} //------------------------------------------------------------------------------------------------- /** Process key press through the GUI. */ @@ -814,15 +814,15 @@ WinInputReturnCode GameWindowManager::winProcessKey( UnsignedByte key, returnCode = WIN_INPUT_NOT_USED; // oops, it wasn't used after all break; - } // end if + } - } // end while + } - } // end if + } return returnCode; -} // end winProcessKey +} //------------------------------------------------------------------------------------------------- /** Process a single mouse event through the window system */ @@ -883,9 +883,9 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms win = win->winGetParent(); - } // end while + } - } // end if + } else { @@ -893,11 +893,11 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms if( winSendInputMsg( m_mouseCaptor, msg, packedMouseCoords, 0 ) == MSG_HANDLED ) returnCode = WIN_INPUT_USED; - } // end else + } - } // end if + } - } // end if, mouse captor window present + } else { @@ -925,7 +925,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms clearGrabWindow = TRUE; break; - } // end left up + } // -------------------------------------------------------------------- case MOUSE_EVENT_NONE: @@ -981,20 +981,20 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms m_grabWindow->winSetPosition( newRegion.lo.x, newRegion.lo.y ); - } // end if, draggable window + } // Send mouse drag message winSendInputMsg( m_grabWindow, msg, packedMouseCoords, 0 ); break; - } // end mouse event none or left drag + } - } // end switch + } // mark event handled returnCode = WIN_INPUT_USED; - } // end if, m_grabWindow + } else { @@ -1014,7 +1014,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms // check below and !hidden if( window == NULL ) window = findWindowUnderMouse(toolTipWindow, mousePos, WIN_STATUS_BELOW, WIN_STATUS_HIDDEN); - } // end else, no modal head + } if( window ) if( BitIsSet( window->m_status, WIN_STATUS_NO_INPUT ) ) @@ -1047,7 +1047,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms if( tempWin == NULL ) break; - } // end while + } // First check to see if m_loneWindow is set if so, close the window @@ -1084,16 +1084,16 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms // WinActivate( tempWin ); m_grabWindow = tempWin; - } // end if + } // event is used returnCode = WIN_INPUT_USED; - } // end if, tempWin + } - } // end if + } - } // end if( window ) + } if( toolTipWindow == NULL ) { @@ -1101,7 +1101,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms if( isHidden( window ) == FALSE ) toolTipWindow = window; - } // end if + } // if tooltips are on set them into the window Bool tooltipsOn = TRUE; @@ -1121,7 +1121,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms else if( toolTipWindow->m_instData.getTooltipTextLength() ) TheMouse->setCursorTooltip( toolTipWindow->m_instData.getTooltipText(), toolTipWindow->m_instData.m_tooltipDelay ); - } // end if + } else { @@ -1134,13 +1134,13 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms // objectTooltip = TRUE; - } // end else + } - } // end if + } - } // end if grabWindow not present + } - } // end else (mouseCaptor) + } // // check if new current window is different from the last @@ -1161,7 +1161,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms m_currMouseRgn = window; - } // end if + } // clear grabWindow if necessary if( clearGrabWindow == TRUE ) @@ -1170,11 +1170,11 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms m_grabWindow = NULL; clearGrabWindow = FALSE; - } // end if + } return returnCode; -} // end winProcessMouseEvent +} bool GameWindowManager::isMouseWithinWindow(GameWindow* window, const ICoord2D* mousePos, unsigned int requiredStatusMask, unsigned int forbiddenStatusMask) { @@ -1256,11 +1256,11 @@ Int GameWindowManager::drawWindow( GameWindow *window ) !BitIsSet( window->m_status, WIN_STATUS_SEE_THRU ) ) window->winDrawBorder(); - } // end if + } return WIN_ERR_OK; -} // end drawWindow +} //------------------------------------------------------------------------------------------------- /** Draw the GUI in reverse order to correlate with clicking priority */ @@ -1299,7 +1299,7 @@ void GameWindowManager::winRepaint( void ) if(TheTransitionHandler) TheTransitionHandler->draw(); -} // end WinRepaint +} //------------------------------------------------------------------------------------------------- /** Dump information about all the windows for resource problems */ @@ -1320,7 +1320,7 @@ void GameWindowManager::dumpWindow( GameWindow *window ) return; #endif -} // end dumpWindow +} //------------------------------------------------------------------------------------------------- /** Create a new window by setting up its parameters and callbacks. */ @@ -1351,7 +1351,7 @@ GameWindow *GameWindowManager::winCreate( GameWindow *parent, return NULL; - } // endif + } // If this is a child window add it to the parent's window list if( parent ) @@ -1390,7 +1390,7 @@ GameWindow *GameWindowManager::winCreate( GameWindow *parent, return window; -} // end WinCreate +} //------------------------------------------------------------------------------------------------- /** Take a window and its children off the top level list and free @@ -1458,7 +1458,7 @@ Int GameWindowManager::winDestroy( GameWindow *window ) return WIN_ERR_OK; -} // winDestroy +} //------------------------------------------------------------------------------------------------- /** Destroy all windows on the window list IMMEDIATELY */ @@ -1481,14 +1481,14 @@ Int GameWindowManager::winDestroyAll( void ) winDestroy( win ); - } // end for + } // Destroy All Windows just added to destroy list processDestroyList(); return WIN_ERR_OK; -} // end WinDestroyAll +} //------------------------------------------------------------------------------------------------- /** Sets selected window into a modal state. This window will get @@ -1522,7 +1522,7 @@ Int GameWindowManager::winSetModal( GameWindow *window ) return WIN_ERR_OK; -} // end WinSetModal +} //------------------------------------------------------------------------------------------------- /** pops window off of the modal stack. If this window is not the top @@ -1544,7 +1544,7 @@ Int GameWindowManager::winUnsetModal( GameWindow *window ) window->winGetWindowId() )); return WIN_ERR_GENERAL_FAILURE; - } // end if + } // remove from top of list next = m_modalHead->next; @@ -1553,7 +1553,7 @@ Int GameWindowManager::winUnsetModal( GameWindow *window ) return WIN_ERR_OK; -} // end WinUnsetModal +} //------------------------------------------------------------------------------------------------- /** Get the grabbed window */ @@ -1563,7 +1563,7 @@ GameWindow *GameWindowManager::winGetGrabWindow( void ) return m_grabWindow; -} // end WinGetGrabWindow +} //------------------------------------------------------------------------------------------------- /** Explicitly set the grab window */ @@ -1573,7 +1573,7 @@ void GameWindowManager::winSetGrabWindow( GameWindow *window ) m_grabWindow = window; -} // end winSetGrabWindow +} //------------------------------------------------------------------------------------------------- /** Explicitly set the grab window */ @@ -1587,7 +1587,7 @@ void GameWindowManager::winSetLoneWindow( GameWindow *window ) TheWindowManager->winSendSystemMsg( m_loneWindow, GGM_CLOSE, 0, 0 ); m_loneWindow = window; -} // end winSetGrabWindow +} //------------------------------------------------------------------------------------------------- /** Create a Modal Message Box */ @@ -1768,7 +1768,7 @@ GameWindow *GameWindowManager::gogoMessageBox(Int x, Int y, Int width, Int heigh //Changed By Chris return trueParent; -}// gogoMessageBox +} //------------------------------------------------------------------------------------------------- /** Create a button GUI control */ @@ -1791,7 +1791,7 @@ GameWindow *GameWindowManager::gogoGadgetPushButton( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // create the button window button = TheWindowManager->winCreate( parent, status, @@ -1805,7 +1805,7 @@ GameWindow *GameWindowManager::gogoGadgetPushButton( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // assign input function button->winSetInputFunc( GadgetPushButtonInput ); @@ -1835,7 +1835,7 @@ GameWindow *GameWindowManager::gogoGadgetPushButton( GameWindow *parent, return button; -} // end gogoGadgetPushButton +} //------------------------------------------------------------------------------------------------- /** Create a checkbox UI element */ @@ -1859,7 +1859,7 @@ GameWindow *GameWindowManager::gogoGadgetCheckbox( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // create the button window checkbox = TheWindowManager->winCreate( parent, status, @@ -1873,7 +1873,7 @@ GameWindow *GameWindowManager::gogoGadgetCheckbox( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // assign input function checkbox->winSetInputFunc( GadgetCheckBoxInput ); @@ -1900,7 +1900,7 @@ GameWindow *GameWindowManager::gogoGadgetCheckbox( GameWindow *parent, return checkbox; -} // end gogoGadgetCheckbox +} //------------------------------------------------------------------------------------------------- /** Create a radio button GUI element */ @@ -1926,7 +1926,7 @@ GameWindow *GameWindowManager::gogoGadgetRadioButton( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // create the button window radioButton = TheWindowManager->winCreate( parent, status, @@ -1940,7 +1940,7 @@ GameWindow *GameWindowManager::gogoGadgetRadioButton( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // allocate and store the radio button user data radioData = NEW RadioButtonData; @@ -1972,7 +1972,7 @@ GameWindow *GameWindowManager::gogoGadgetRadioButton( GameWindow *parent, return radioButton; -} // end gogoGadgetRadioButton +} //------------------------------------------------------------------------------------------------- /** Create a tab control GUI element */ @@ -1998,7 +1998,7 @@ GameWindow *GameWindowManager::gogoGadgetTabControl( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // create the tab control window tabControl = TheWindowManager->winCreate( parent, status, @@ -2012,7 +2012,7 @@ GameWindow *GameWindowManager::gogoGadgetTabControl( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // allocate and store the tab control user data tabData = NEW TabControlData; @@ -2043,7 +2043,7 @@ GameWindow *GameWindowManager::gogoGadgetTabControl( GameWindow *parent, return tabControl; -} // end gogoGadgetTabControl +} //------------------------------------------------------------------------------------------------- /** Create a list box GUI control */ @@ -2070,7 +2070,7 @@ GameWindow *GameWindowManager::gogoGadgetListBox( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // create the listbox listbox = winCreate( parent, status, x, y, width, height, @@ -2083,7 +2083,7 @@ GameWindow *GameWindowManager::gogoGadgetListBox( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // allocate the listbox data, copy template data over and set it into box listboxData = NEW ListboxData; @@ -2158,8 +2158,8 @@ GameWindow *GameWindowManager::gogoGadgetListBox( GameWindow *parent, listboxData->slider->winGetSize( &sliderSize.x, &sliderSize.y ); listboxData->columnWidth[0] -= (sliderSize.x + 2); - } // end if - }// if + } + } else { if( !listboxData->columnWidthPercentage ) @@ -2176,18 +2176,18 @@ GameWindow *GameWindowManager::gogoGadgetListBox( GameWindow *parent, listboxData->slider->winGetSize( &sliderSize.x, &sliderSize.y ); totalWidth -= (sliderSize.x + 2); - } // end if + } for(Int i = 0; i < listboxData->columns; i++ ) { listboxData->columnWidth[i] = listboxData->columnWidthPercentage[i] * totalWidth / 100; - }// for - }// else + } + } // assign the default images/colors assignDefaultGadgetLook( listbox, defaultFont, defaultVisual ); return listbox; -} // end gogoGadgetListBox +} //------------------------------------------------------------------------------------------------- /** Does all generic window creation, calls appropriate slider create @@ -2226,7 +2226,7 @@ GameWindow *GameWindowManager::gogoGadgetSlider( GameWindow *parent, else slider->winSetDrawFunc( getHorizontalSliderDrawFunc() ); - } // end if + } else if ( BitIsSet( instData->getStyle(), GWS_VERT_SLIDER ) ) { @@ -2241,7 +2241,7 @@ GameWindow *GameWindowManager::gogoGadgetSlider( GameWindow *parent, else slider->winSetDrawFunc( getVerticalSliderDrawFunc() ); - } // end else if + } else { @@ -2249,7 +2249,7 @@ GameWindow *GameWindowManager::gogoGadgetSlider( GameWindow *parent, assert( 0 ); return NULL; - } // end else + } // sanity if( slider == NULL ) @@ -2259,7 +2259,7 @@ GameWindow *GameWindowManager::gogoGadgetSlider( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // set the owner to the parent, or if no parent it will be itself slider->winSetOwner( parent ); @@ -2312,7 +2312,7 @@ GameWindow *GameWindowManager::gogoGadgetSlider( GameWindow *parent, return slider; -} // end gogoGadgetSlider +} //------------------------------------------------------------------------------------------------- /** Create a Combo Box GUI element */ @@ -2338,7 +2338,7 @@ GameWindow *GameWindowManager::gogoGadgetComboBox( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // create the listbox comboBox = winCreate( parent, status, x, y, width, height, @@ -2351,7 +2351,7 @@ GameWindow *GameWindowManager::gogoGadgetComboBox( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // begin here @@ -2542,7 +2542,7 @@ GameWindow *GameWindowManager::gogoGadgetProgressBar( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // create the button window progressBar = TheWindowManager->winCreate( parent, status, @@ -2556,7 +2556,7 @@ GameWindow *GameWindowManager::gogoGadgetProgressBar( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // // assign draw function, the draw functions must actually be implemented @@ -2575,7 +2575,7 @@ GameWindow *GameWindowManager::gogoGadgetProgressBar( GameWindow *parent, return progressBar; -} // end gogoGadgetProgressBar +} //------------------------------------------------------------------------------------------------- /** Does all generic window creation, calls appropriate text field create @@ -2640,11 +2640,11 @@ GameWindow *GameWindowManager::gogoGadgetStaticText( GameWindow *parent, if( text.getLength() ) GadgetStaticTextSetText( textWin, text ); - } // end if + } return textWin; -} // end gogoGadetStaticText +} //------------------------------------------------------------------------------------------------- /** Does all generic window creation, calls appropriate entry field create @@ -2670,7 +2670,7 @@ GameWindow *GameWindowManager::gogoGadgetTextEntry( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // create the window entry = winCreate( parent, status, x, y, width, height, @@ -2682,7 +2682,7 @@ GameWindow *GameWindowManager::gogoGadgetTextEntry( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // set owner of this control entry->winSetOwner( parent ); @@ -2777,9 +2777,9 @@ GameWindow *GameWindowManager::gogoGadgetTextEntry( GameWindow *parent, winDestroy( entry ); return NULL; - } // end if + } - } // end, korean or japanese + } // assign the default images/colors assignDefaultGadgetLook( entry, defaultFont, defaultVisual ); @@ -2791,7 +2791,7 @@ GameWindow *GameWindowManager::gogoGadgetTextEntry( GameWindow *parent, return entry; -} // end gogoGadgetTextEntry +} //------------------------------------------------------------------------------------------------- /** Use this method to assign the default images/colors to gadgets as @@ -2898,7 +2898,7 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - } // end if + } else if( BitIsSet( instData->getStyle(), GWS_CHECK_BOX ) ) { @@ -2947,7 +2947,7 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - } // end else if + } else if( BitIsSet( instData->getStyle(), GWS_RADIO_BUTTON ) ) { @@ -2996,7 +2996,7 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - } // end else if + } else if( BitIsSet( instData->getStyle(), GWS_HORZ_SLIDER ) ) { @@ -3058,7 +3058,7 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, GadgetSliderSetHiliteSelectedThumbBorderColor( gadget, GadgetSliderGetHiliteColor( gadget ) ); - } // end if + } else if( BitIsSet( instData->getStyle(), GWS_VERT_SLIDER ) ) { // enabled @@ -3118,7 +3118,7 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, GadgetSliderSetHiliteSelectedThumbColor( gadget, GadgetSliderGetHiliteBorderColor( gadget ) ); GadgetSliderSetHiliteSelectedThumbBorderColor( gadget, GadgetSliderGetHiliteColor( gadget ) ); - } // end else if + } else if( BitIsSet( instData->getStyle(), GWS_SCROLL_LISTBOX ) ) { ListboxData *listboxData = (ListboxData *)gadget->winGetUserData(); @@ -3223,9 +3223,9 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, GadgetButtonSetHiliteImage( downButton, winFindImage( "VSliderLargeDownButtonHilite" ) ); GadgetButtonSetHiliteSelectedImage( downButton, winFindImage( "VSliderLargeDownButtonHiliteSelected" ) ); - } // end if + } - } // end else if + } else if( BitIsSet( instData->getStyle(), GWS_COMBO_BOX ) ) { // ComboBoxData *comboBoxData = (ComboBoxData *)gadget->winGetUserData(); @@ -3403,9 +3403,9 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, GadgetButtonSetHiliteImage( downButton, winFindImage( "VSliderLargeDownButtonHilite" ) ); GadgetButtonSetHiliteSelectedImage( downButton, winFindImage( "VSliderLargeDownButtonHiliteSelected" ) ); - } // end if + } } - } // end else if + } else if( BitIsSet( instData->getStyle(), GWS_PROGRESS_BAR ) ) { @@ -3451,7 +3451,7 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, GadgetProgressBarSetHiliteBarImageCenter( gadget, winFindImage( "ProgressBarHiliteBarRepeatingCenter" ) ); GadgetProgressBarSetHiliteBarImageSmallCenter( gadget, winFindImage( "ProgressBarHiliteBarSmallRepeatingCenter" ) ); - } // end else if + } else if( BitIsSet( instData->getStyle(), GWS_STATIC_TEXT ) ) { @@ -3476,7 +3476,7 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - } // end else if + } else if( BitIsSet( instData->getStyle(), GWS_ENTRY_FIELD ) ) { @@ -3510,9 +3510,9 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - } // end else if + } -} // end assignDefaultGadgetLook +} //------------------------------------------------------------------------------------------------- /** Given a text label, retreive the real localized text associated @@ -3530,7 +3530,7 @@ UnicodeString GameWindowManager::winTextLabelToText( AsciiString label ) tmp.translate(label); return tmp; -} // end winTextLabelToText +} //------------------------------------------------------------------------------------------------- /** find the top window at the given coordinates */ @@ -3573,8 +3573,8 @@ GameWindow *GameWindowManager::getWindowUnderCursor( Int x, Int y, Bool ignoreEn window = window->winPointInChild( x, y, ignoreEnabled ); break; // exit for } - } // end if - } // end for window + } + } // check !above, below and hidden if( window == NULL ) @@ -3597,7 +3597,7 @@ GameWindow *GameWindowManager::getWindowUnderCursor( Int x, Int y, Bool ignoreEn } } } - } // end if, window == NULL + } // check below and !hidden if( window == NULL ) @@ -3619,8 +3619,8 @@ GameWindow *GameWindowManager::getWindowUnderCursor( Int x, Int y, Bool ignoreEn } } } - } // end if - } // end else, no modal head + } + } if( window ) { @@ -3971,7 +3971,7 @@ Bool GameWindowManager::initTestGUI( void ) return TRUE; -} // end initTestGUI +} void GameWindowManager::winNextTab( GameWindow *window ) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp index 4f2ef0f4fc7..4f477e461a7 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp @@ -217,7 +217,7 @@ static Bool parseBitFlag( const char *flagString, UnsignedInt *bits, return FALSE; -} // end parseBitFlag +} // parseBitString ============================================================= /** Given a character string of the form 'A+B+C+D', parse the @@ -244,7 +244,7 @@ static void parseBitString( const char *inBuffer, UnsignedInt *bits, const char } } -} // end parseBitString +} // readUntilSemicolon ========================================================= //============================================================================= @@ -290,7 +290,7 @@ static void readUntilSemicolon( File *fp, char *buffer, int maxBufLen ) buffer[ maxBufLen - 1 ] = '\000'; -} // end readUntilSemicolon +} // scanBool =================================================================== //============================================================================= @@ -301,7 +301,7 @@ static Int scanBool( const char *source, Bool& val ) val = (Bool)temp; return ret; -} // end scanBool +} // scanShort ================================================================== //============================================================================= @@ -312,7 +312,7 @@ static Int scanShort( const char *source, Short& val ) val = (Short)temp; return ret; -} // end scanShort +} // scanInt ==================================================================== //============================================================================= @@ -321,7 +321,7 @@ static Int scanInt( const char *source, Int& val ) Int ret = sscanf( source, "%d", &val ); // not strictly necessary to wrap this, but it's more consistent return ret; -} // end scanInt +} // scanUnsignedInt ============================================================ //============================================================================= @@ -330,7 +330,7 @@ static Int scanUnsignedInt( const char *source, UnsignedInt& val ) Int ret = sscanf( source, "%d", &val ); // not strictly necessary to wrap this, but it's more consistent return ret; -} // end scanUnsignedInt +} // resetWindowStack =========================================================== //============================================================================= @@ -340,7 +340,7 @@ static void resetWindowStack( void ) memset( windowStack, 0, sizeof( windowStack ) ); stackPtr = windowStack; -} // end resetWindowStack +} // resetWindowDefaults ======================================================== //============================================================================= @@ -355,7 +355,7 @@ static void resetWindowDefaults( void ) defTextColor = 0; defFont = 0; -} // end resetWindowDefaults +} // peekWindow ================================================================= //============================================================================= @@ -366,7 +366,7 @@ static GameWindow *peekWindow( void ) return *(stackPtr - 1); -} // end peekWindow +} // popWindow ================================================================== //============================================================================= @@ -379,7 +379,7 @@ static GameWindow *popWindow( void ) return *stackPtr; -} // end popWindow +} // pushWindow ================================================================= //============================================================================= @@ -392,11 +392,11 @@ static void pushWindow( GameWindow *window ) DEBUG_LOG(( "pushWindow: Warning, stack overflow" )); return; - } // end if + } *stackPtr++ = window; -} // end pushWindow +} // parseColor ================================================================= /** Parse a color entry and store it in the value pointed to by the @@ -420,7 +420,7 @@ static Bool parseColor( Color *color, char *buffer ) return TRUE; -} // end parseColor +} // parseDefaultColor ========================================================== /** Parse a default color entry and store it in the value pointed to by @@ -441,13 +441,13 @@ static Bool parseDefaultColor( Color *color, File *inFile, char *buffer ) *color = WIN_COLOR_UNDEFINED; - } // end if + } else parseColor( color, buffer ); return TRUE; -} // end parseDefaultColor +} // parseDefaultFont =========================================================== /** Parse the default font */ @@ -470,7 +470,7 @@ static Bool parseDefaultFont( GameFont *font, File *inFile, char *buffer ) return TRUE; -} // end parseDefaultFont +} // parseTooltip =============================================================== /** Parse the tooltip field */ @@ -485,7 +485,7 @@ static Bool parseTooltip( const char *token, WinInstanceData *instData, instData->setTooltipText( tooltip ); return TRUE; -} // end parseTooltip +} // parseScreenRect ============================================================ /** Parse the screen rect entry which tells us the position and size @@ -548,14 +548,14 @@ static Bool parseScreenRect( const char *token, char *buffer, *x = screenRegion.lo.x - parentScreenPos.x; *y = screenRegion.lo.y - parentScreenPos.y; - } // end if + } else { *x = screenRegion.lo.x; *y = screenRegion.lo.y; - } // end else + } // save our width and height from the adjusted screen region locations *width = screenRegion.hi.x - screenRegion.lo.x; @@ -563,7 +563,7 @@ static Bool parseScreenRect( const char *token, char *buffer, return TRUE; -} // end parseScreenRect +} // parseImageOffset =========================================================== /** Parse the image draw offset */ @@ -581,7 +581,7 @@ static Bool parseImageOffset( const char *token, WinInstanceData *instData, return TRUE; -} // end parseImageOffset +} // parseFont ================================================================== /** Parse the font field */ @@ -624,11 +624,11 @@ static Bool parseFont( const char *token, WinInstanceData *instData, if( font ) instData->m_font = font; - } // end if + } return TRUE; -} // end parseFont +} // parseName ================================================================= /** Parse the NAME field */ @@ -655,7 +655,7 @@ static Bool parseName( const char *token, WinInstanceData *instData, return TRUE; -} // end parseName +} // parseStatus ================================================================ /** Parse the STATUS field */ @@ -669,7 +669,7 @@ static Bool parseStatus( const char *token, WinInstanceData *instData, return TRUE; -} // end parseStatus +} // parseStyle ================================================================= /** Parse the STYLE field */ @@ -683,7 +683,7 @@ static Bool parseStyle( const char *token, WinInstanceData *instData, return TRUE; -} // end parseStyle +} // parseSystemCallback ======================================================== /** Parse the system method callback for a window */ @@ -710,7 +710,7 @@ static Bool parseSystemCallback( const char *token, WinInstanceData *instData, return TRUE; -} // end parseSystemCallback +} // parseInputCallback ========================================================= /** Parse the Input method callback for a window */ @@ -737,7 +737,7 @@ static Bool parseInputCallback( const char *token, WinInstanceData *instData, return TRUE; -} // end parseInputCallback +} // parseTooltipCallback ======================================================= /** Parse the Tooltip method callback for a window */ @@ -764,7 +764,7 @@ static Bool parseTooltipCallback( const char *token, WinInstanceData *instData, return TRUE; -} // end parseTooltipCallback +} // parseDrawCallback ========================================================== /** Parse the Draw method callback for a window */ @@ -791,7 +791,7 @@ static Bool parseDrawCallback( const char *token, WinInstanceData *instData, return TRUE; -} // end parseDrawCallback +} // parseHeaderTemplate ========================================================== /** Parse the Draw method callback for a window */ @@ -817,7 +817,7 @@ static Bool parseHeaderTemplate( const char *token, WinInstanceData *instData, return TRUE; -} // end parseDrawCallback +} // parseListboxData =========================================================== /** Parse listbox data entry */ @@ -893,7 +893,7 @@ static Bool parseListboxData( const char *token, WinInstanceData *instData, // " return TRUE; -} // end parseListboxData +} // parseComboBoxData =========================================================== /** Parse Combo Box data entry */ @@ -927,7 +927,7 @@ static Bool parseComboBoxData( const char *token, WinInstanceData *instData, return TRUE; -}//parseComboBoxData +} // parseSliderData ============================================================ /** Parse slider data entry */ @@ -951,7 +951,7 @@ static Bool parseSliderData( const char *token, WinInstanceData *instData, return TRUE; -} // end parseSliderData +} // parseRadioButtonData ======================================================= /** Parse radio button data entry */ @@ -970,7 +970,7 @@ static Bool parseRadioButtonData( const char *token, WinInstanceData *instData, return TRUE; -} // end parseRadioButtonData +} // parseTooltipText =========================================================== @@ -997,14 +997,14 @@ static Bool parseTooltipText( const char *token, WinInstanceData *instData, assert( 0 ); return FALSE; - } // end if + } instData->m_tooltipString.set(c); instData->setTooltipText(TheGameText->fetch(c)); return TRUE; -} // end parseTooltipText +} // parseTooltipDelay ======================================================= /** Parse the tooltip delay */ @@ -1022,7 +1022,7 @@ static Bool parseTooltipDelay( const char *token, WinInstanceData *instData, return TRUE; -} // end parseTooltipDelay +} // parseText ================================================================== @@ -1047,13 +1047,13 @@ static Bool parseText( const char *token, WinInstanceData *instData, assert( 0 ); return FALSE; - } // end if + } instData->m_textLabelString = c; return TRUE; -} // end parseText +} // parseTextColor ============================================================= /** Parse text color entries for enabled, disabled, and hilite with @@ -1086,7 +1086,7 @@ static Bool parseTextColor( const char *token, WinInstanceData *instData, assert( 0 ); return FALSE; - } // end else + } // color if( first == TRUE ) @@ -1116,11 +1116,11 @@ static Bool parseTextColor( const char *token, WinInstanceData *instData, scanUnsignedInt( c, a ); textData->borderColor = GameMakeColor( r, g, b, a ); - } // end if + } return TRUE; -} // end parseTextColor +} // parseStaticTextData ======================================================== /** Parse static text data entry */ @@ -1139,7 +1139,7 @@ static Bool parseStaticTextData( const char *token, WinInstanceData *instData, return TRUE; -} // end parseStaticTextDAta +} // parseTextEntryData ========================================================= /** Parse text entry data entry */ @@ -1178,7 +1178,7 @@ static Bool parseTextEntryData( const char *token, WinInstanceData *instData, return TRUE; -} // end parseStaticTextDAta +} // parseTabControlData ========================================================= /** Parse tab control data entry */ @@ -1307,7 +1307,7 @@ static Bool parseDrawData( const char *token, WinInstanceData *instData, assert( 0 ); return FALSE; - } // end else + } // IMAGE: X if( first == TRUE ) @@ -1345,11 +1345,11 @@ static Bool parseDrawData( const char *token, WinInstanceData *instData, scanUnsignedInt( c, a ); drawData->borderColor = GameMakeColor( r, g, b, a ); - } // end for i + } return TRUE; -} // end parseDrawData +} // getDataTemplate ============================================================ /** Given a window type style string return the address of a static @@ -1417,7 +1417,7 @@ void *getDataTemplate( char *type ) return data; -} // end getDataTemplate +} // parseData ================================================================== // @@ -1571,7 +1571,7 @@ static Bool parseData( void **data, char *type, char *buffer ) return TRUE; -} // end parseData +} // setWindowText ============================================================== /** Set the default text for a window or gadget control */ @@ -1603,7 +1603,7 @@ static void setWindowText( GameWindow *window, AsciiString textLabel ) else window->winSetText( theText ); -} // end setWindowText +} // createGadget =============================================================== /** Create a gadget based on the 'type' parm */ @@ -1702,9 +1702,9 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledSliderThumbDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteSliderThumbDrawData[ i ]; - } // end for i + } - } //end if + } } else if( !strcmp( type, "HORZSLIDER" ) ) @@ -1734,9 +1734,9 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledSliderThumbDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteSliderThumbDrawData[ i ]; - } // end for i + } - } //end if + } } else if( !strcmp( type, "SCROLLLISTBOX" ) ) @@ -1767,9 +1767,9 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledUpButtonDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteUpButtonDrawData[ i ]; - } // end for i + } - } // end if + } GameWindow *downButton = GadgetListBoxGetDownButton( window ); if( downButton ) @@ -1783,9 +1783,9 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledDownButtonDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteDownButtonDrawData[ i ]; - } // end for i + } - } // end if + } GameWindow *slider = GadgetListBoxGetSlider( window ); if( slider ) @@ -1799,7 +1799,7 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledSliderDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteSliderDrawData[ i ]; - } // end for i + } // do the slider thumb GameWindow *thumb = slider->winGetChild(); @@ -1814,11 +1814,11 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledSliderThumbDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteSliderThumbDrawData[ i ]; - } // end for i + } - } //end if + } - } // end if + } } else if( !strcmp( type, "COMBOBOX" ) ) @@ -1869,8 +1869,8 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledDropDownButtonDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteDropDownButtonDrawData[ i ]; - } // end for i - } // end if + } + } GameWindow *editBox = GadgetComboBoxGetEditBox( window ); if( editBox ) @@ -1884,8 +1884,8 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledEditBoxDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteEditBoxDrawData[ i ]; - } // end for i - } // end if + } + } GameWindow *listBox = GadgetComboBoxGetListBox( window ); @@ -1900,7 +1900,7 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledListBoxDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteListBoxDrawData[ i ]; - } // end for i + } GameWindow *upButton = GadgetListBoxGetUpButton( listBox ); @@ -1915,9 +1915,9 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledUpButtonDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteUpButtonDrawData[ i ]; - } // end for i + } - } // end if + } GameWindow *downButton = GadgetListBoxGetDownButton( listBox ); if( downButton ) @@ -1931,9 +1931,9 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledDownButtonDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteDownButtonDrawData[ i ]; - } // end for i + } - } // end if + } GameWindow *slider = GadgetListBoxGetSlider( listBox ); if( slider ) @@ -1947,7 +1947,7 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledSliderDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteSliderDrawData[ i ]; - } // end for i + } // do the slider thumb GameWindow *thumb = slider->winGetChild(); @@ -1962,11 +1962,11 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledSliderThumbDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteSliderThumbDrawData[ i ]; - } // end for i + } - } //end if + } - } // end if + } } } else if( !strcmp( type, "ENTRYFIELD" ) ) @@ -2005,7 +2005,7 @@ static GameWindow *createGadget( char *type, return window; -} // end createGadget +} // createWindow =============================================================== // Create a user window or a gadget depending on the 'type' parm @@ -2042,7 +2042,7 @@ static GameWindow *createWindow( char *type, window->winSetInstanceData( instData ); window->winSetWindowId( id ); - } // end if + } } else if( !strcmp( type, "TABPANE" ) ) @@ -2059,7 +2059,7 @@ static GameWindow *createWindow( char *type, window->winSetInstanceData( instData ); window->winSetWindowId( id ); - } // end if + } } @@ -2080,7 +2080,7 @@ static GameWindow *createWindow( char *type, // set id window->winSetWindowId( id ); - } // end if + } } @@ -2108,9 +2108,9 @@ static GameWindow *createWindow( char *type, editData->tooltipCallbackString = theTooltipString; editData->drawCallbackString = theDrawString; - } // end if + } - } // end if + } if( window ) { @@ -2118,7 +2118,7 @@ static GameWindow *createWindow( char *type, // set any text read from the textLabel setWindowText( window, instData->m_textLabelString ); - } // end if + } // If there is a parent window, send it the SCRIPT_CREATE message if( window && parent ) @@ -2126,7 +2126,7 @@ static GameWindow *createWindow( char *type, return window; -} // end createWindow +} // parseChildWindows ========================================================== /** Parse window descriptions until an extra end is encountered indicating @@ -2225,7 +2225,7 @@ static Bool parseChildWindows( GameWindow *window, } - } // end while( TRUE ) + } // Pop the current window off the stack lastWindow = popWindow(); @@ -2243,7 +2243,7 @@ static Bool parseChildWindows( GameWindow *window, return TRUE; -} // end parseChildWindows +} // lookup table for parsing functions static GameWindowParse gameWindowFieldList[] = @@ -2335,12 +2335,12 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) if( parent ) { parent->winGetSize( &parentSize.x, &parentSize.y ); - } // end if + } else { parentSize.x = TheDisplay->getWidth(); parentSize.y = TheDisplay->getHeight(); - } // end else + } // Initialize the instance data to the defaults /// @todo need to support enabled/disabled/hilite text colors here @@ -2410,7 +2410,7 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) break; } - } // end for + } if( parse->parse == NULL ) { @@ -2466,7 +2466,7 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) window = NULL; goto cleanupAndExit; - } // end if + } } else @@ -2477,9 +2477,9 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) } - } // end if + } - } // end while( TRUE ) + } cleanupAndExit: @@ -2494,7 +2494,7 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) return window; -} // end parseWindow +} //================================================================================================= //================================================================================================= @@ -2517,7 +2517,7 @@ Bool parseInit( const char *token, char *buffer, UnsignedInt version, WindowLayo return TRUE; // success -} // end parseInit +} //------------------------------------------------------------------------------------------------- /** Parse update for layout file */ @@ -2536,7 +2536,7 @@ Bool parseUpdate( const char *token, char *buffer, UnsignedInt version, WindowLa return TRUE; // success -} // end parseUpdate +} //------------------------------------------------------------------------------------------------- /** Parse shutdown for layout file */ @@ -2555,7 +2555,7 @@ Bool parseShutdown( const char *token, char *buffer, UnsignedInt version, Window return TRUE; // success -} // end parseShutdown +} static LayoutScriptParse layoutScriptTable[] = { @@ -2618,15 +2618,15 @@ Bool parseLayoutBlock( File *inFile, char *buffer, UnsignedInt version, WindowLa break; // exit for - } // end if + } - } // end for parse + } - } // end while + } return TRUE; -} // end parseLayoutBlock +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -2650,12 +2650,12 @@ WindowLayout *GameWindowManager::winCreateLayout( AsciiString filename ) deleteInstance(layout); return NULL; - } // end if + } // return loaded layout return layout; -} // end winCreateLayout +} /** Free up the memory used by static strings. Normally this memory is freed by the string destructor but we do it here to make the @@ -2745,9 +2745,9 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, DEBUG_LOG(( "WinCreateFromScript: Error parsing layout block" )); return FALSE; - } // end if + } - } // end if + } else { @@ -2756,7 +2756,7 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, scriptInfo.updateNameString = "[None]"; scriptInfo.shutdownNameString = "[None]"; - } // end else + } while( TRUE ) { @@ -2858,9 +2858,9 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, scriptInfo.windows.push_back(window); - } // end else if + } - } // end while( TRUE ) + } // close the file inFile->close(); @@ -2873,5 +2873,5 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, // return the first window created return firstWindow; -} // end WinCreateFromScript +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp index 107b8943adc..fffb5ea4b36 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp @@ -134,7 +134,7 @@ void FlashTransition::update( Int frame ) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } } FALLTHROUGH; @@ -294,7 +294,7 @@ void ButtonFlashTransition::update( Int frame ) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } m_drawState = frame; } @@ -805,7 +805,7 @@ void ScaleUpTransition::update( Int frame ) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } } FALLTHROUGH; @@ -928,7 +928,7 @@ void ScoreScaleUpTransition::update( Int frame ) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } } FALLTHROUGH; @@ -1069,7 +1069,7 @@ void MainMenuScaleUpTransition::update( Int frame ) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } } if(frame > MAINMENUSCALEUPTRANSITION_START && frame < MAINMENUSCALEUPTRANSITION_END) { @@ -1190,7 +1190,7 @@ void MainMenuMediumScaleUpTransition::update( Int frame ) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } } if(m_win) m_win->winHide(TRUE); @@ -1417,7 +1417,7 @@ void TextTypeTransition::update( Int frame ) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } if(m_isForward) { m_partialText.concat(m_fullText.getCharAt(frame - 1)); @@ -1561,7 +1561,7 @@ void CountUpTransition::update( Int frame ) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } m_currentValue +=m_countState; if(m_currentValue > m_intValue) m_currentValue = m_intValue; @@ -2023,7 +2023,7 @@ void ReverseSoundTransition::update( Int frame ) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } } break; @@ -2140,7 +2140,7 @@ void PushButtonImageDrawThree(GameWindow *window, Int alpha ) end.x, end.y,color ); start.x += centerImage->getImageWidth(); - } // end for i + } // we will draw the image but clip the parts we don't want to show IRegion2D reg; @@ -2227,7 +2227,7 @@ static void drawTypeText( GameWindow *window, DisplayString *str) textPos.y = origin.y + (size.y / 2) - (textHeight / 2); str->setClipRegion(&clipRegion); str->draw( textPos.x, textPos.y, textColor, textDropColor ); - } // end if + } else { @@ -2237,7 +2237,7 @@ static void drawTypeText( GameWindow *window, DisplayString *str) str->setClipRegion(&clipRegion); str->draw( textPos.x, textPos.y, textColor, textDropColor ); - } // end else + } -} // end drawStaticTextText +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp index df92b513500..3ee1d101401 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp @@ -92,7 +92,7 @@ void INI::parseHeaderTemplateDefinition( INI *ini ) // allocate a new item hTemplate = TheHeaderTemplateManager->newHeaderTemplate( name ); - } // end if + } else { DEBUG_CRASH(( "[LINE: %d in '%s'] Duplicate header Template %s found!", ini->getLineNum(), ini->getFilename().str(), name.str() )); @@ -100,7 +100,7 @@ void INI::parseHeaderTemplateDefinition( INI *ini ) // parse the ini definition ini->initFromINI( hTemplate, TheHeaderTemplateManager->getFieldParse() ); -} // end parseCommandButtonDefinition +} HeaderTemplate::HeaderTemplate( void ) : m_font(NULL), diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp index 3d79cc90509..42c01e1106d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp @@ -53,7 +53,7 @@ Shell::Shell( void ) { construct(); -} // end Shell +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -61,7 +61,7 @@ Shell::~Shell( void ) { deconstruct(); -} // end ~Shell +} //------------------------------------------------------------------------------------------------- void Shell::construct( void ) @@ -121,7 +121,7 @@ void Shell::deconstruct( void ) deleteInstance(m_saveLoadMenuLayout); m_saveLoadMenuLayout = NULL; - } //end if + } // delete the replay save menu if present if( m_popupReplayLayout ) @@ -131,7 +131,7 @@ void Shell::deconstruct( void ) deleteInstance(m_popupReplayLayout); m_popupReplayLayout = NULL; - } //end if + } // delete the options menu if present. if (m_optionsLayout != NULL) { @@ -154,7 +154,7 @@ void Shell::init( void ) if( m_schemeManager ) m_schemeManager->init(); -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset the shell system to a clean state just as though init had @@ -172,7 +172,7 @@ void Shell::reset( void ) m_animateWindowManager->reset(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update shell system cycle. All windows are updated that are on the stack, starting @@ -198,7 +198,7 @@ void Shell::update( void ) DEBUG_ASSERTCRASH( m_screenStack[ i ], ("Top of shell stack is NULL!") ); m_screenStack[ i ]->runUpdate( NULL ); - } // end for i + } if(TheGlobalData->m_shellMapOn && m_shellMapOn &&m_background) { @@ -216,9 +216,9 @@ void Shell::update( void ) // mark last time we ran the updates lastUpdate = now; - } // end if + } -} // end update +} //------------------------------------------------------------------------------------------------- namespace @@ -286,11 +286,11 @@ WindowLayout *Shell::findScreenByFilename( AsciiString filename ) if( screen && filename.compareNoCase(screen->getFilename()) == 0 ) return screen; - } // end for i + } return NULL; -} // end findScreenByFilename +} //------------------------------------------------------------------------------------------------- WindowLayout *Shell::getScreenLayout( Int index ) const @@ -315,7 +315,7 @@ void Shell::hide( Bool hide ) if (TheIMEManager) TheIMEManager->detatch(); -} // end hide +} //------------------------------------------------------------------------------------------------- /** Push layout onto shell */ @@ -346,7 +346,7 @@ void Shell::push( AsciiString filename, Bool shutdownImmediate ) filename.str(), MAX_SHELL_STACK )); return; - } // end if + } // set a push as pending with the layout name passed in m_pendingPush = TRUE; @@ -367,19 +367,19 @@ void Shell::push( AsciiString filename, Bool shutdownImmediate ) // run the shutdown currentTop->runShutdown( &shutdownImmediate ); - } // end if + } else { // just call shutdownComplete() which will immediately cause the push to happen shutdownComplete( NULL ); - } // end else + } // if (TheIMEManager) // TheIMEManager->detatch(); -} // end push +} //------------------------------------------------------------------------------------------------- /** Pop top layout of the stack. Note that we don't actually do the pop right here, @@ -419,7 +419,7 @@ void Shell::pop( void ) if (TheIMEManager) TheIMEManager->detatch(); -} // end pop +} //------------------------------------------------------------------------------------------------- /** When you need to immediately pop a screen off the stack use this method. It @@ -457,7 +457,7 @@ void Shell::popImmediate( void ) if (TheIMEManager) TheIMEManager->detatch(); -} // end popImmediate +} //------------------------------------------------------------------------------------------------- /** Run the initialize function for the top of the stack just as though it was pushed @@ -521,7 +521,7 @@ void Shell::showShell( Bool runInit ) //else push( AsciiString("Menus/MainMenu.wnd") ); m_isShellActive = TRUE; -} // end showShell +} void Shell::showShellMap(Bool useShellMap ) { @@ -586,7 +586,7 @@ void Shell::hideShell( void ) layout->runShutdown( &immediatePop ); - } // end if + } if (TheIMEManager) TheIMEManager->detatch(); @@ -594,7 +594,7 @@ void Shell::hideShell( void ) // Mark that the shell is no longer up. m_isShellActive = FALSE; -} // end hideShell +} //------------------------------------------------------------------------------------------------- /** Return the top layout on the stack */ @@ -609,7 +609,7 @@ WindowLayout *Shell::top( void ) // top layout is at count index return m_screenStack[ m_screenCount - 1 ]; -} // end top +} // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////////////////////////// //------------------------------------------------------------------------------------------------- @@ -629,12 +629,12 @@ void Shell::linkScreen( WindowLayout *screen ) DEBUG_CRASH(( "No room in shell stack for screen" )); return; - } // end if + } // add to array at top index m_screenStack[ m_screenCount++ ] = screen; -} // end linkScreen +} //------------------------------------------------------------------------------------------------- /** Remove screen from our list */ @@ -653,7 +653,7 @@ void Shell::unlinkScreen( WindowLayout *screen ) if( m_screenStack[ m_screenCount - 1 ] == screen ) m_screenStack[ --m_screenCount ] = NULL; -} // end unlinkScreen +} //------------------------------------------------------------------------------------------------- /** Actually do the work for a push */ @@ -679,7 +679,7 @@ void Shell::doPush( AsciiString layoutFile ) newScreen->bringForward(); -} // end doPush +} //------------------------------------------------------------------------------------------------- /** Actually do the work for a pop */ @@ -714,7 +714,7 @@ void Shell::doPop( Bool impendingPush ) if (TheIMEManager) TheIMEManager->detatch(); -} // end doPop +} //------------------------------------------------------------------------------------------------- /** This is called when a layout has finished its shutdown process. Layouts are @@ -747,7 +747,7 @@ void Shell::shutdownComplete( WindowLayout *screen, Bool impendingPush ) m_pendingPush = FALSE; m_pendingPushName.set( "" ); - } // end if + } else if( m_pendingPop ) { @@ -757,7 +757,7 @@ void Shell::shutdownComplete( WindowLayout *screen, Bool impendingPush ) // no more pending pop for you! m_pendingPop = FALSE; - } // end else if + } if(m_clearBackground) { @@ -771,7 +771,7 @@ void Shell::shutdownComplete( WindowLayout *screen, Bool impendingPush ) } -} // end shutdownComplete +} void Shell::registerWithAnimateManager( GameWindow *win, AnimTypes animType, Bool needsToFinish, UnsignedInt delayMS) @@ -850,7 +850,7 @@ WindowLayout *Shell::getSaveLoadMenuLayout( void ) // return the layout return m_saveLoadMenuLayout; -} // end getSaveLoadMenuLayout +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -867,7 +867,7 @@ WindowLayout *Shell::getPopupReplayLayout( void ) // return the layout return m_popupReplayLayout; -} // end getSaveLoadMenuLayout +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -884,7 +884,7 @@ WindowLayout *Shell::getOptionsLayout( Bool create ) // return the layout return m_optionsLayout; -} // end getOptionsLayout +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp index 6ee52a1f5e4..cddb8c76b96 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp @@ -98,7 +98,7 @@ void INI::parseShellMenuSchemeDefinition( INI *ini ) // parse the ini definition ini->initFromINI( SMScheme, SMSchemeManager->getFieldParse() ); -} // end parseCommandButtonDefinition +} ShellMenuSchemeLine::ShellMenuSchemeLine( void ) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/WinInstanceData.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/WinInstanceData.cpp index ac36f665831..fb48690067f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/WinInstanceData.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/WinInstanceData.cpp @@ -79,7 +79,7 @@ WinInstanceData::WinInstanceData( void ) m_videoBuffer = NULL; init(); -} // end WinInstanceData +} // WinInstanceData::~WinInstanceData ========================================== //============================================================================= @@ -94,7 +94,7 @@ WinInstanceData::~WinInstanceData( void ) m_videoBuffer = NULL; //Video Buffer needs to be clean up by the control that is in charge of the video. -} // end ~WinInstanceData +} // WinInstanceData::init ====================================================== /** Set initial values for instance data if desired */ @@ -119,7 +119,7 @@ void WinInstanceData::init( void ) m_hiliteDrawData[ i ].color = WIN_COLOR_UNDEFINED; m_hiliteDrawData[ i ].borderColor = WIN_COLOR_UNDEFINED; - } // end for i + } // initialize text colors m_enabledText.color = WIN_COLOR_UNDEFINED; @@ -150,19 +150,19 @@ void WinInstanceData::init( void ) TheDisplayStringManager->freeDisplayString( m_text ); m_text = NULL; - } // end if + } if( m_tooltip ) { TheDisplayStringManager->freeDisplayString( m_tooltip ); m_tooltip = NULL; - } // end if + } m_videoBuffer = NULL; -} // end init +} // WinInstanceData::setTooltipText ============================================ //============================================================================= @@ -177,7 +177,7 @@ void WinInstanceData::setTooltipText( UnicodeString tip ) // set text m_tooltip->setText( tip ); -} // end setTooltipText +} // WinInstanceData:setText ==================================================== /** Set the text for this window instance data */ @@ -193,7 +193,7 @@ void WinInstanceData::setText( UnicodeString text ) // set the text m_text->setText( text ); -} // end set text +} // WinInstanceData:setText ==================================================== /** Set the text for this window instance data */ diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp index 0ce2d4e5ebb..ab9a0a50cbe 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp @@ -51,7 +51,7 @@ WindowLayout::WindowLayout( void ) m_update = NULL; m_shutdown = NULL; -} // end WindowLayout +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -66,7 +66,7 @@ WindowLayout::~WindowLayout( void ) DEBUG_ASSERTCRASH( m_windowList == NULL, ("Window layout being destroyed still has window references") ); DEBUG_ASSERTCRASH( m_windowTail == NULL, ("Window layout being destroyed still has window references") ); -} // end ~WindowLayout +} //------------------------------------------------------------------------------------------------- /** Set the hidden/visible status of all the windows in this layout */ @@ -81,12 +81,12 @@ void WindowLayout::hide( Bool hide ) window->winHide( hide ); - } // end for window + } // save the new visible state of the system m_hidden = hide; -} // end hide +} //------------------------------------------------------------------------------------------------- /** Add window to this layout */ @@ -120,9 +120,9 @@ void WindowLayout::addWindow( GameWindow *window ) // we gots another window now m_windowCount++; - } // end if + } -} // end addWindow +} //------------------------------------------------------------------------------------------------- /** Remove window from this layout */ @@ -158,9 +158,9 @@ void WindowLayout::removeWindow( GameWindow *window ) // we lost one sir! m_windowCount--; - } // end if + } -} // end removeWindow +} //------------------------------------------------------------------------------------------------- /** Destroy all the windows in a layout */ @@ -178,9 +178,9 @@ void WindowLayout::destroyWindows( void ) // destroy window in window system TheWindowManager->winDestroy( window ); - } // end while + } -} // end destroyWindows +} //------------------------------------------------------------------------------------------------- /** Create the windows using the .wnd file script and load all windows into @@ -211,7 +211,7 @@ Bool WindowLayout::load( AsciiString filename ) DEBUG_LOG(( "WindowLayout::load - Unable to load layout file '%s'", filename.str() )); return FALSE; - } // end if + } // // add windows loaded from .wnd file to the layout, via info.windows. @@ -236,7 +236,7 @@ Bool WindowLayout::load( AsciiString filename ) // add window to this layout addWindow( window ); - } // end for window + } */ // copy filename @@ -249,7 +249,7 @@ Bool WindowLayout::load( AsciiString filename ) return TRUE; // success -} // end load +} //------------------------------------------------------------------------------------------------- /** Bring all windows in this layout forward */ @@ -276,9 +276,9 @@ void WindowLayout::bringForward( void ) window->winBringToTop(); countLeft--; - } // end for window + } -} // end bringForward +} // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////////////////////////// @@ -295,4 +295,4 @@ GameWindow *WindowLayout::findWindow( GameWindow *window ) return NULL; // window not found -} // end findWindow +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp index b1d1e6d0433..adecd04c4aa 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -229,7 +229,7 @@ GameClient::~GameClient() delete TheEva; TheEva = NULL; -} // end ~GameClient +} //------------------------------------------------------------------------------------------------- /** Initialize resources for the game client */ @@ -339,7 +339,7 @@ void GameClient::init( void ) TheWindowManager->setName("TheWindowManager"); // TheWindowManager->initTestGUI(); - } // end if + } // create the IME manager TheIMEManager = CreateIMEManagerInterface(); @@ -391,7 +391,7 @@ void GameClient::init( void ) TheMouse->setPosition( 0, 0 ); TheMouse->setMouseLimits(); TheMouse->setName("TheMouse"); - } // end if + } // create the video player TheVideoPlayer = createVideoPlayer(); @@ -422,7 +422,7 @@ void GameClient::init( void ) TheGraphDraw = new GraphDraw; #endif -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset the game client for a new game */ @@ -459,7 +459,7 @@ void GameClient::reset( void ) // TheSuperHackers @fix Mauller 13/04/2025 Reset the drawable id so it does not keep growing over the lifetime of the game. m_nextDrawableID = (DrawableID)1; -} // end reset +} /** ----------------------------------------------------------------------------------------------- * Return a new unique object id. @@ -484,7 +484,7 @@ void GameClient::registerDrawable( Drawable *draw ) // add the drawable to the master list draw->prependToList( &m_drawableList ); -} // end registerDrawable +} /** ----------------------------------------------------------------------------------------------- * Redraw all views, update the GUI, play sound effects, etc. @@ -571,7 +571,7 @@ void GameClient::update( void ) TheKeyboard->UPDATE(); TheKeyboard->createStreamMessages(); - } // end if + } // Update the Eva stuff TheEva->UPDATE(); @@ -582,7 +582,7 @@ void GameClient::update( void ) TheMouse->UPDATE(); TheMouse->createStreamMessages(); - } // end if + } if(TheGlobalData->m_playIntro || TheGlobalData->m_afterIntro) { @@ -690,7 +690,7 @@ void GameClient::update( void ) TheParticleSystemManager->setLocalPlayerIndex(localPlayerIndex); TheParticleSystemManager->update(); - } // end if + } // update the terrain visuals { @@ -725,7 +725,7 @@ void GameClient::update( void ) // update the in game UI TheInGameUI->UPDATE(); } -} // end update +} void GameClient::step() { @@ -810,7 +810,7 @@ void GameClient::destroyDrawable( Drawable *draw ) DEBUG_ASSERTCRASH( obj->getDrawable() == draw, ("Object/Drawable pointer mismatch!") ); obj->friend_bindToDrawable( NULL ); - } // end if + } // remove the drawable from our hash of drawables removeDrawableFromLookupTable( draw ); @@ -833,7 +833,7 @@ void GameClient::addDrawableToLookupTable(Drawable *draw ) // add to lookup m_drawableHash[ draw->getID() ] = draw; -} // end addDrawableToLookupTable +} // ------------------------------------------------------------------------------------------------ /** Remove drawable from lookup table of fast id searching */ @@ -848,7 +848,7 @@ void GameClient::removeDrawableFromLookupTable( Drawable *draw ) // remove from table m_drawableHash.erase( draw->getID() ); -} // end removeDrawableFromLookupTable +} //------------------------------------------------------------------------------------------------- /** Load a map into the game interface */ @@ -863,7 +863,7 @@ Bool GameClient::loadMap( AsciiString mapName ) return TRUE; -} // end loadMap +} //------------------------------------------------------------------------------------------------- /** Unload a map from the game interface */ @@ -872,7 +872,7 @@ void GameClient::unloadMap( AsciiString mapName ) assert( 0 ); // who calls this? -} // end unloadMap +} //------------------------------------------------------------------------------------------------- void GameClient::setTimeOfDay( TimeOfDay tod ) @@ -979,7 +979,7 @@ GameMessage::Type GameClient::evaluateContextCommand( Drawable *draw, else return GameMessage::MSG_INVALID; -} // end evaluateContextCommand +} //------------------------------------------------------------------------------------------------- /** Get the ray effect data for a drawable */ @@ -988,7 +988,7 @@ void GameClient::getRayEffectData( Drawable *draw, RayEffectData *effectData ) TheRayEffects->getRayEffectData( draw, effectData ); -} // end getRayEffectData +} //------------------------------------------------------------------------------------------------- /** remove the drawble from the ray effects sytem if present */ @@ -997,7 +997,7 @@ void GameClient::removeFromRayEffects( Drawable *draw ) TheRayEffects->deleteRayEffect( draw ); -} // end removeFromRayEffects +} /** frees all shadow resources used by this module - used by Options screen.*/ void GameClient::releaseShadows(void) @@ -1057,9 +1057,9 @@ void GameClient::preloadAssets( TimeOfDay timeOfDay ) // destroy the drawable TheGameClient->destroyDrawable( draw ); - } // end if + } - } // end for + } GlobalMemoryStatus(&after); DEBUG_LOG(("Preloading memory dwAvailPageFile %d --> %d : %d", @@ -1168,7 +1168,7 @@ void GameClient::preloadAssets( TimeOfDay timeOfDay ) // preloadTextureNamesGlobalHack2 = preloadTextureNamesGlobalHack; // preloadTextureNamesGlobalHack.clear(); -} // end preloadAssets +} // ------------------------------------------------------------------------------------------------ /** Given a string name, find the drawable TOC entry (if any) associated with it */ @@ -1182,7 +1182,7 @@ GameClient::DrawableTOCEntry *GameClient::findTOCEntryByName( AsciiString name ) return NULL; -} // end findTOCEntryByname +} // ------------------------------------------------------------------------------------------------ /** Given a drawable TOC identifier, find the drawable TOC if any */ @@ -1196,7 +1196,7 @@ GameClient::DrawableTOCEntry *GameClient::findTOCEntryById( UnsignedShort id ) return NULL; -} // end findTOCEntryById +} // ------------------------------------------------------------------------------------------------ /** Add an drawable TOC entry */ @@ -1209,7 +1209,7 @@ void GameClient::addTOCEntry( AsciiString name, UnsignedShort id ) tocEntry.id = id; m_drawableTOC.push_back( tocEntry ); -} // end addTOCEntry +} // ------------------------------------------------------------------------------------------------ static Bool shouldSaveDrawable(const Drawable* draw) @@ -1264,7 +1264,7 @@ void GameClient::xferDrawableTOC( Xfer *xfer ) // add this entry to the TOC addTOCEntry( draw->getTemplate()->getName(), ++tocCount ); - } // end for obj + } // xfer entries in the TOC xfer->xferUnsignedInt( &tocCount ); @@ -1284,9 +1284,9 @@ void GameClient::xferDrawableTOC( Xfer *xfer ) // xfer the paired id xfer->xferUnsignedShort( &tocEntry->id ); - } // end for + } - } // end if + } else { AsciiString templateName; @@ -1308,11 +1308,11 @@ void GameClient::xferDrawableTOC( Xfer *xfer ) // add this to the TOC addTOCEntry( templateName, id ); - } // end for i + } - } // end else + } -} // end xferDrawableTOC +} // ------------------------------------------------------------------------------------------------ /** Xfer method for Game Client @@ -1378,7 +1378,7 @@ void GameClient::xfer( Xfer *xfer ) DEBUG_CRASH(( "GameClient::xfer - Drawable TOC entry not found for '%s'", draw->getTemplate()->getName().str() )); throw SC_INVALID_DATA; - } // end if + } // xfer toc id entry xfer->xferUnsignedShort( &tocEntry->id ); @@ -1396,9 +1396,9 @@ void GameClient::xfer( Xfer *xfer ) // end data block xfer->endBlock(); - } // end for, draw + } - } // end if, save + } else { UnsignedShort tocID; @@ -1420,7 +1420,7 @@ void GameClient::xfer( Xfer *xfer ) DEBUG_CRASH(( "GameClient::xfer - No TOC entry match for id '%d'", tocID )); throw SC_INVALID_DATA; - } // end if + } // read data block size dataSize = xfer->beginBlock(); @@ -1435,7 +1435,7 @@ void GameClient::xfer( Xfer *xfer ) xfer->skip( dataSize ); continue; - } // end if + } // read the object ID this drawable is attached to (if any) xfer->xferObjectID( &objectID ); @@ -1456,7 +1456,7 @@ void GameClient::xfer( Xfer *xfer ) objectID, thingTemplate->getName().str() )); throw SC_INVALID_DATA; - } // end if + } // get the drawable from the object draw = object->getDrawable(); @@ -1467,7 +1467,7 @@ void GameClient::xfer( Xfer *xfer ) object->getTemplate()->getName().str(), object->getID() )); throw SC_INVALID_DATA; - } // end if + } // srj sez: some objects (eg, diguised bombtrucks) may have an "abnormal" drawable. so check. // @@ -1484,7 +1484,7 @@ void GameClient::xfer( Xfer *xfer ) TheGameLogic->bindObjectAndDrawable(object, draw); } - } // end if + } else { @@ -1502,9 +1502,9 @@ void GameClient::xfer( Xfer *xfer ) thingTemplate->getName().str() )); throw SC_INVALID_DATA; - } // end if + } - } // end else + } // xfer the drawable data xfer->xferSnapshot( draw ); @@ -1512,9 +1512,9 @@ void GameClient::xfer( Xfer *xfer ) // end block (not necessary since this is a no-op but symettrically nice) xfer->endBlock(); - } // end for, i + } - } // end else, load + } // xfer the in-game mission briefing history list if (version >= 2) @@ -1548,7 +1548,7 @@ void GameClient::xfer( Xfer *xfer ) } } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1566,7 +1566,7 @@ void GameClient::loadPostProcess( void ) if( draw->getID() >= m_nextDrawableID ) m_nextDrawableID = (DrawableID)((UnsignedInt)draw->getID() + 1); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -1574,4 +1574,4 @@ void GameClient::loadPostProcess( void ) void GameClient::crc( Xfer *xfer ) { -} // end crc +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GameClientDispatch.cpp b/Generals/Code/GameEngine/Source/GameClient/GameClientDispatch.cpp index 222adf8bac0..f23c915b4db 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GameClientDispatch.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GameClientDispatch.cpp @@ -53,4 +53,4 @@ GameMessageDisposition GameClientMessageDispatcher::translateGameMessage(const G //((GameMessage *)msg)->getCommandAsString(), TheGameClient->getFrame())); return DESTROY_MESSAGE; -} // end clientMessageDispatcher +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp b/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp index df1d56d88d6..5111b6c0f63 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp @@ -103,7 +103,7 @@ void INI::parseLanguageDefinition( INI *ini ) { DEBUG_ASSERTCRASH(TheGlobalLanguageData, ("INI::parseLanguageDefinition - TheGlobalLanguage Data is not around, please create it before trying to parse the ini file.")); return; - } // end if + } // parse the ini weapon definition ini->initFromINI( TheGlobalLanguageData, TheGlobalLanguageDataFieldParseTable ); } diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index 0c2337a5135..bd4247d6729 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -338,7 +338,7 @@ Real SuperweaponInfo::getHeight() const void InGameUI::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -505,7 +505,7 @@ void InGameUI::xfer( Xfer *xfer ) void InGameUI::loadPostProcess( void ) { -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -934,7 +934,7 @@ InGameUI::InGameUI() m_moveHint[ i ].sourceID = 0; m_moveHint[ i ].frame = 0; - } // end for i + } for( i = 0; i < MAX_BUILD_PROGRESS; i++ ) { @@ -943,7 +943,7 @@ InGameUI::InGameUI() m_buildProgress[ i ].m_percentComplete = 0.0f; m_buildProgress[ i ].m_control = NULL; - } // end for i + } m_pendingGUICommand = NULL; @@ -972,7 +972,7 @@ InGameUI::InGameUI() m_uiMessages[ i ].timestamp = 0; m_uiMessages[ i ].color = 0; - } // end for i + } m_replayWindow = NULL; m_messagesOn = TRUE; @@ -1056,7 +1056,7 @@ InGameUI::InGameUI() m_soloNexusSelectedDrawableID = INVALID_DRAWABLE_ID; -} // end InGameUI +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1189,7 +1189,7 @@ void InGameUI::init( void ) setDrawRMBScrollAnchor(TheGlobalData->m_drawScrollAnchor); setMoveRMBScrollAnchor(TheGlobalData->m_moveScrollAnchor); -} // end init +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1370,7 +1370,7 @@ void InGameUI::evaluateSoloNexus( Drawable *newlyAddedDrawable ) return; } - } // end for + } } @@ -1422,9 +1422,9 @@ void InGameUI::handleBuildPlacements( void ) const Real snapRadians = DEG_TO_RADF(45); angle = WWMath::Round(angle / snapRadians) * snapRadians; } - } // end if + } - } // end if + } else { const MouseIO *mouseIO = TheMouse->getMouseStatus(); @@ -1432,7 +1432,7 @@ void InGameUI::handleBuildPlacements( void ) // location is the mouse position loc = mouseIO->pos; - } // end else + } // set the location and angle of the place icon /**@todo this whole orientation vector thing is LAME! Must replace, all I want to @@ -1482,7 +1482,7 @@ void InGameUI::handleBuildPlacements( void ) } else { TheTerrainVisual->removeFactionBibDrawable(m_placeIcon[0]); } - } // end if + } @@ -1531,7 +1531,7 @@ void InGameUI::handleBuildPlacements( void ) m_placeIcon[ i ] = TheThingFactory->newDrawable( m_pendingPlaceType, DRAWABLE_STATUS_NO_STATE_PARTICLES ); - } // end for i + } // // destroy any drawables that we're not using anymore because a previous @@ -1544,7 +1544,7 @@ void InGameUI::handleBuildPlacements( void ) TheGameClient->destroyDrawable( m_placeIcon[ i ] ); m_placeIcon[ i ] = NULL; - } // end for i + } // // march down each drawable and set the position based on its position in the @@ -1562,13 +1562,13 @@ void InGameUI::handleBuildPlacements( void ) // set the drawable angle m_placeIcon[ i ]->setOrientation( angle ); - } // end for i + } - } // end if + } - } // end if + } -} // end handleBuildPlacements +} //------------------------------------------------------------------------------------------------- /** Pre-draw phase of the in game ui */ @@ -1588,7 +1588,7 @@ void InGameUI::preDraw( void ) // draw world animations updateAndDrawWorldAnimations(); -} // end preDraw +} //------------------------------------------------------------------------------------------------- /** Update the in game user interface */ @@ -1661,9 +1661,9 @@ void InGameUI::update( void ) if( a == 0 ) removeMessageAtIndex( i ); - } // end if + } - } // end for i + } // // Update the Military Subtitle display @@ -1805,7 +1805,7 @@ void InGameUI::update( void ) GadgetStaticTextSetText( moneyWin, buffer ); lastMoney = currentMoney; - } // end if + } moneyWin->winHide(FALSE); powerWin->winHide(FALSE); } @@ -1857,7 +1857,7 @@ void InGameUI::update( void ) } -} // end update +} //------------------------------------------------------------------------------------------------- void InGameUI::registerWindowLayout( WindowLayout *layout ) @@ -1951,7 +1951,7 @@ void InGameUI::reset( void ) m_moveHint[ i ].sourceID = 0; m_moveHint[ i ].frame = 0; - } // end for i + } m_waypointMode = false; m_forceAttackMode = false; @@ -1965,7 +1965,7 @@ void InGameUI::reset( void ) m_tooltipsDisabledUntil = 0; UpdateDiplomacyBriefingText(AsciiString::TheEmptyString, TRUE); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Free any resources we used for our messages */ @@ -1989,9 +1989,9 @@ void InGameUI::freeMessageResources( void ) // set timestamp to zero m_uiMessages[ i ].timestamp = 0; - } // end for i + } -} // end freeMessageResources +} void InGameUI::freeCustomUiResources( void ) { @@ -2033,7 +2033,7 @@ void InGameUI::message( AsciiString stringManagerLabel, ... ) { DEBUG_CRASH(("InGameUI::message failed with code:%d", result)); } -} // end +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2074,7 +2074,7 @@ void InGameUI::message( UnicodeString format, ... ) { DEBUG_CRASH(("InGameUI::message failed with code:%d", result)); } -} // end message +} //------------------------------------------------------------------------------------------------- /** Interface for display text messages to the user */ @@ -2101,7 +2101,7 @@ void InGameUI::messageColor( const RGBColor *rgbColor, UnicodeString format, ... { DEBUG_CRASH(("InGameUI::messageColor failed with code:%d", result)); } -} // end message +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2149,7 +2149,7 @@ void InGameUI::addMessageText( const UnicodeString& formattedMessage, const RGBC else m_uiMessages[ 0 ].color = color2; -} // end addFormattedMessage +} //------------------------------------------------------------------------------------------------- /** Remove the message on screen at index i */ @@ -2163,7 +2163,7 @@ void InGameUI::removeMessageAtIndex( Int i ) m_uiMessages[ i ].displayString = NULL; m_uiMessages[ i ].timestamp = 0; -} // end removeMessageAtIndex +} //------------------------------------------------------------------------------------------------- /** An area selection is occurring, start graphical "hint". */ @@ -2902,11 +2902,11 @@ void InGameUI::setGUICommand( const CommandButton *command ) m_mouseMode = MOUSEMODE_DEFAULT; return; - } // end if + } m_mouseMode = MOUSEMODE_GUI_COMMAND; - } // end if + } else { m_mouseMode = MOUSEMODE_DEFAULT; @@ -2937,7 +2937,7 @@ void InGameUI::setGUICommand( const CommandButton *command ) m_mouseModeCursor = TheMouse->getMouseCursor(); -} // end setGUICommand +} //------------------------------------------------------------------------------------------------- /** Get the pending gui command */ @@ -2966,10 +2966,10 @@ void InGameUI::destroyPlacementIcons( void ) } m_placeIcon[ i ] = NULL; - } // end for i + } TheTerrainVisual->removeAllBibs(); -} // end destroyPlacementIcons +} //------------------------------------------------------------------------------------------------- /** User has clicked on a built item that requires placement in the world. We will @@ -3063,7 +3063,7 @@ void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildD DEBUG_ASSERTCRASH( m_placeIcon[ 0 ] == NULL, ("placeBuildAvailable, build icon array is not empty!") ); m_placeIcon[ 0 ] = draw; - } // end if + } else { if (m_mouseMode == MOUSEMODE_BUILD_PLACE) @@ -3078,11 +3078,11 @@ void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildD // if we have a place icons destroy them destroyPlacementIcons(); - } // end else + } - } // end if + } -} // end placeBuildAvailable +} //------------------------------------------------------------------------------------------------- /** Return the thing we're attempting to place */ @@ -3099,7 +3099,7 @@ ObjectID InGameUI::getPendingPlaceSourceObjectID( void ) return m_pendingPlaceSourceObjectID; -} // end getPendingPlaceSourceObjectID +} //------------------------------------------------------------------------------------------------- /** Start the angle selection interface for selecting building angles when placing them */ @@ -3115,11 +3115,11 @@ void InGameUI::setPlacementStart( const ICoord2D *start ) m_placeAnchorEnd = *start; m_placeAnchorInProgress = TRUE; - } // end if + } else m_placeAnchorInProgress = FALSE; -} // end setPlacementStart +} //------------------------------------------------------------------------------------------------- /** Set the end anchor for the angle build interface */ @@ -3130,7 +3130,7 @@ void InGameUI::setPlacementEnd( const ICoord2D *end ) if( end ) m_placeAnchorEnd = *end; -} // end setPlacementEnd +} //------------------------------------------------------------------------------------------------- /** Is the angle selection interface for placing building at angles up? */ @@ -3140,7 +3140,7 @@ Bool InGameUI::isPlacementAnchored( void ) return m_placeAnchorInProgress; -} // end isPlacementAnchored +} //------------------------------------------------------------------------------------------------- /** Get the start and end anchor points for the building angle selection interface */ @@ -3153,7 +3153,7 @@ void InGameUI::getPlacementPoints( ICoord2D *start, ICoord2D *end ) if( end ) *end = m_placeAnchorEnd; -} // end getPlacementPoints +} //------------------------------------------------------------------------------------------------- /** Return the angle of the drawable at the cursor if any */ @@ -3166,7 +3166,7 @@ Real InGameUI::getPlacementAngle( void ) return 0.0f; -} // end getPlacementAngle +} //------------------------------------------------------------------------------------------------- /** Mark given Drawable as "selected". */ @@ -3194,9 +3194,9 @@ void InGameUI::selectDrawable( Drawable *draw ) // the control needs to update its context sensitive display now TheControlBar->onDrawableSelected( draw ); - } // end if + } -} // end selectDrawable +} //------------------------------------------------------------------------------------------------- /** Clear "selected" status of Drawable. */ @@ -3233,9 +3233,9 @@ void InGameUI::deselectDrawable( Drawable *draw ) // the control needs to update its context sensitive display now TheControlBar->onDrawableDeselected( draw ); - } // end if + } -} // end deselectDrawable +} //------------------------------------------------------------------------------------------------- /** Clear all drawables' "select" status */ @@ -3254,7 +3254,7 @@ void InGameUI::deselectAllDrawables( Bool postMsg ) // do the deselection TheInGameUI->deselectDrawable( draw ); - } // end while + } // keep our list all tidy m_selectedDrawables.clear(); @@ -3315,7 +3315,7 @@ Drawable *InGameUI::getFirstSelectedDrawable( void ) return m_selectedDrawables.front(); -} // end getFirstSelectedDrawable +} //------------------------------------------------------------------------------------------------- /** Return true if the selected ID is in the drawable list */ @@ -3329,11 +3329,11 @@ Bool InGameUI::isDrawableSelected( DrawableID idToCheck ) const if( (*it)->getID() == idToCheck ) return TRUE; - } // end for + } return FALSE; -} // end isDrawableSelected +} //------------------------------------------------------------------------------------------------- /** Return true if all of the given objects are selected */ @@ -3348,7 +3348,7 @@ Bool InGameUI::areAllObjectsSelected(const std::vector& objectsToCheck) return TRUE; -} // end areAllObjectsSelected +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -3368,11 +3368,11 @@ Bool InGameUI::isAnySelectedKindOf( KindOfType kindOf ) const if( draw && draw->isKindOf( kindOf ) ) return TRUE; - } // end for, it + } return FALSE; // no selected objects are of the kind of type -} // end isAnySelectedKindOf +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -3392,11 +3392,11 @@ Bool InGameUI::isAllSelectedKindOf( KindOfType kindOf ) const if( draw && draw->isKindOf( kindOf ) == FALSE ) return FALSE; // not all objects are of the kind of type - } // end for, it + } return TRUE; // all objects have this kindof bit set in them -} // end isAllSelectedKindOf +} //------------------------------------------------------------------------------------------------- /** Set the input enabled/disabled */ @@ -3490,11 +3490,11 @@ void InGameUI::postDraw( void ) GameFont *font = m_uiMessages[ i ].displayString->getFont(); y += font->height; - } //end if + } - } // end for i + } - } // end if + } if( m_militarySubtitle ) { @@ -3779,7 +3779,7 @@ void InGameUI::postDraw( void ) TheDisplay->drawFillRect( anchor->x-w, anchor->y-h*r, w*2+1, h*2*r+1, mainColor ); } } -} // end postDraw +} //------------------------------------------------------------------------------------------------- /** Expire a hint of the specified type with the corresponding hint index */ @@ -3797,7 +3797,7 @@ void InGameUI::expireHint( HintType type, UnsignedInt hintIndex ) m_moveHint[ hintIndex ].sourceID = 0; m_moveHint[ hintIndex ].frame = 0; - } // end if + } else { @@ -3805,9 +3805,9 @@ void InGameUI::expireHint( HintType type, UnsignedInt hintIndex ) DEBUG_CRASH(("undefined hint type")); return; - } // end else + } -} // end expireHint +} //------------------------------------------------------------------------------------------------- /** Create the control user interface GUI */ @@ -3824,7 +3824,7 @@ void InGameUI::createControlBar( void ) window->winHide( TRUE ); */ -} // end createControlBar +} //------------------------------------------------------------------------------------------------- /** Create the replay control GUI */ @@ -3841,7 +3841,7 @@ void InGameUI::createReplayControl( void ) window->winHide( TRUE ); */ -} // end createReplayControl +} // ------------------------------------------------------------------------------------------------ // InGameUI::playMovie @@ -4003,9 +4003,9 @@ void InGameUI::displayCantBuildMessage( LegalBuildCode lbc ) TheInGameUI->message( "GUI:CantBuildThere" ); break; - } // end switch + } -} // end displayCantBuildMessage +} // ------------------------------------------------------------------------------------------------ // InGameUI::militarySubtitle @@ -4208,7 +4208,7 @@ CanAttackResult InGameUI::getCanSelectedObjectsAttack( ActionType action, const } - } // end for + } if( count > 0 ) { @@ -4347,7 +4347,7 @@ Bool InGameUI::canSelectedObjectsDoAction( ActionType action, const Object *obje ++qualify; } - } // end for + } //If the rule is all must qualify, do the check now and return success //only if all the selected units qualified. @@ -5205,7 +5205,7 @@ WorldAnimationData::WorldAnimationData( void ) m_options = WORLD_ANIM_NO_OPTIONS; m_zRisePerSecond = 0.0f; -} // end WorldAnimationData +} // ------------------------------------------------------------------------------------------------ /** Add a 2D animation at a spot in the world */ @@ -5240,7 +5240,7 @@ void InGameUI::addWorldAnimation( Anim2DTemplate *animTemplate, // add to list m_worldAnimationList.push_front( wad ); -} // end addWorldAnimation +} // ------------------------------------------------------------------------------------------------ /** Delete all world animations */ @@ -5262,9 +5262,9 @@ void InGameUI::clearWorldAnimations( void ) it = m_worldAnimationList.erase( it ); - } // end for + } -} // end clearWorldAnimations +} static const UnsignedInt FRAMES_BEFORE_EXPIRE_TO_FADE = LOGICFRAMES_PER_SECOND * 1; // ------------------------------------------------------------------------------------------------ @@ -5299,13 +5299,13 @@ void InGameUI::updateAndDrawWorldAnimations( void ) it = m_worldAnimationList.erase( it ); continue; - } // end if + } // update the Z value if( wad->m_zRisePerSecond ) wad->m_worldPos.z += wad->m_zRisePerSecond / LOGICFRAMES_PER_SECOND; - } // end if + } // // don't bother going forward with the draw process if this location is shrouded for @@ -5318,7 +5318,7 @@ void InGameUI::updateAndDrawWorldAnimations( void ) ++it; continue; - } // end if + } // update translucency value if( BitIsSet( wad->m_options, WORLD_ANIM_FADE_ON_EXPIRE ) ) @@ -5333,9 +5333,9 @@ void InGameUI::updateAndDrawWorldAnimations( void ) Real alpha = INT_TO_REAL( framesTillExpire ) / INT_TO_REAL( FRAMES_BEFORE_EXPIRE_TO_FADE ); wad->m_anim->setAlpha( alpha ); - } // end if + } - } // end if + } // project the point to screen space ICoord2D screen; @@ -5356,14 +5356,14 @@ void InGameUI::updateAndDrawWorldAnimations( void ) // draw the animation wad->m_anim->draw( screen.x, screen.y, width, height ); - } // end if + } // go to the next element in the list ++it; - } // end for + } -} // end updateAndDrawWorldAnimations +} Object *InGameUI::findIdleWorker( Object *obj) @@ -5677,13 +5677,13 @@ WindowMsgHandledType IdleWorkerSystem( GameWindow *window, UnsignedInt msg, } break; - } // end button selected + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; diff --git a/Generals/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp b/Generals/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp index 3f011f6aebd..c1eee9113b2 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp @@ -66,20 +66,20 @@ void Keyboard::createStreamMessages( void ) msg = TheMessageStream->appendMessage( GameMessage::MSG_RAW_KEY_DOWN ); DEBUG_ASSERTCRASH( msg, ("Unable to append key down message to stream") ); - } // end if + } else if( BitIsSet( key->state, KEY_STATE_UP ) ) { msg = TheMessageStream->appendMessage( GameMessage::MSG_RAW_KEY_UP ); DEBUG_ASSERTCRASH( msg, ("Unable to append key up message to stream") ); - } // end else if + } else { DEBUG_CRASH(( "Unknown key state when creating msg stream" )); - } // end else + } // fill out message arguments if( msg ) @@ -91,9 +91,9 @@ void Keyboard::createStreamMessages( void ) // next key please key++; - } // end while + } -} // end createStreamMessages +} //------------------------------------------------------------------------------------------------- /** update all our key state data */ @@ -122,7 +122,7 @@ void Keyboard::updateKeys( void ) resetKeys(); index = 0; - } // end if + } } while( m_keys[ index ].key == KEY_LOST ); @@ -166,11 +166,11 @@ void Keyboard::updateKeys( void ) // translateKey( m_keys[ index ].key ); - } // end else if + } index++; - } // end while + } // check for key repeats checkKeyRepeat(); @@ -187,11 +187,11 @@ void Keyboard::updateKeys( void ) // next key index++; - } // end while + } - } // end if + } -} // end updateKeys +} //------------------------------------------------------------------------------------------------- /** check key repeat sequences, TRUE is returned if repeat is occurring */ @@ -239,15 +239,15 @@ Bool Keyboard::checkKeyRepeat( void ) retVal = TRUE; break; // exit for key - } // end if + } - } // end if, key down + } - } // end for key + } return retVal; -} // end checkKeyRepeat +} //------------------------------------------------------------------------------------------------- /** Initialize the keyboard key-names array */ @@ -268,7 +268,7 @@ void Keyboard::initKeyNames( void ) m_keyNames[ i ].shifted = L'\0'; m_keyNames[ i ].shifted2 = L'\0'; - } // end for i + } m_shift2Key = KEY_NONE; @@ -674,9 +674,9 @@ void Keyboard::initKeyNames( void ) m_shift2Key = KEY_RALT; break; - } // end switch( Language ) + } -} // end initKeyNames +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC PROTOTYPES ////////////////////////////////////////////////////////////////////////////// @@ -695,14 +695,14 @@ Keyboard::Keyboard( void ) memset( m_keyNames, 0, sizeof( m_keyNames ) ); m_inputFrame = 0; -} // end Keyboard +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- Keyboard::~Keyboard( void ) { -} // end ~Keyboard +} //------------------------------------------------------------------------------------------------- /** Initialzie the keyboard */ @@ -716,7 +716,7 @@ void Keyboard::init( void ) // first input frame m_inputFrame = 0; -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset keyboard system */ @@ -724,7 +724,7 @@ void Keyboard::init( void ) void Keyboard::reset( void ) { -} // end reset +} //------------------------------------------------------------------------------------------------- /** Called once per frame to gather key data input */ @@ -738,7 +738,7 @@ void Keyboard::update( void ) // update the key data updateKeys(); -} // end update +} //------------------------------------------------------------------------------------------------- /** Reset the state data for the keys, we likely want to do this when @@ -755,7 +755,7 @@ void Keyboard::resetKeys( void ) m_modifiers |= KEY_STATE_CAPSLOCK; } -} // end resetKeys +} //------------------------------------------------------------------------------------------------- /** get the first key in our current state of the keyboard */ @@ -763,7 +763,7 @@ void Keyboard::resetKeys( void ) KeyboardIO *Keyboard::getFirstKey( void ) { return &m_keys[ 0 ]; -} // end getFirstKey +} //------------------------------------------------------------------------------------------------- /** return the key status for the specified key */ @@ -771,7 +771,7 @@ KeyboardIO *Keyboard::getFirstKey( void ) UnsignedByte Keyboard::getKeyStatusData( UnsignedByte key ) { return m_keyStatus[ key ].status; -} // end getKeyStatusData +} //------------------------------------------------------------------------------------------------- /** Get the key state data as a Bool for the specified key */ @@ -779,7 +779,7 @@ UnsignedByte Keyboard::getKeyStatusData( UnsignedByte key ) Bool Keyboard::getKeyStateBit( UnsignedByte key, Int bit ) { return (m_keyStatus[ key ].state & bit) ? 1 : 0; -} // end getKeyStateBit +} //------------------------------------------------------------------------------------------------- /** return the sequence data for the given key */ @@ -787,7 +787,7 @@ Bool Keyboard::getKeyStateBit( UnsignedByte key, Int bit ) UnsignedInt Keyboard::getKeySequenceData( UnsignedByte key ) { return m_keyStatus[ key ].sequence; -} // end getKeySequenceData +} //------------------------------------------------------------------------------------------------- /** set the key status data */ @@ -795,7 +795,7 @@ UnsignedInt Keyboard::getKeySequenceData( UnsignedByte key ) void Keyboard::setKeyStatusData( UnsignedByte key, KeyboardIO::StatusType data ) { m_keyStatus[ key ].status = data; -} // end setKeyStatusData +} //------------------------------------------------------------------------------------------------- /** set the key state data */ @@ -803,7 +803,7 @@ void Keyboard::setKeyStatusData( UnsignedByte key, KeyboardIO::StatusType data ) void Keyboard::setKeyStateData( UnsignedByte key, UnsignedByte data ) { m_keyStatus[ key ].state = data; -} // end setKeyStateData +} //------------------------------------------------------------------------------------------------- /** This routine must be called with every character to @@ -933,8 +933,8 @@ WideChar Keyboard::translateKey( WideChar keyCode ) } return( m_keyNames[ubKeyCode ].stdKey ); - } // end switch( ubKeyCode ) -} // end translateKey + } +} //------------------------------------------------------------------------------------------------- /** returns true if any shift state is pressed */ @@ -946,7 +946,7 @@ Bool Keyboard::isShift() return TRUE; } return FALSE; -} // end isShift() +} //------------------------------------------------------------------------------------------------- /** returns true if any control state is pressed */ @@ -958,7 +958,7 @@ Bool Keyboard::isCtrl() return TRUE; } return FALSE; -} // end isCtrl() +} //------------------------------------------------------------------------------------------------- /** returns true if any shift state is pressed */ @@ -970,7 +970,7 @@ Bool Keyboard::isAlt() return TRUE; } return FALSE; -} // end isAlt() +} WideChar Keyboard::getPrintableKey( UnsignedByte key, Int state ) diff --git a/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp b/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp index d49b22101fc..dbc4489deae 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp @@ -152,7 +152,7 @@ void Mouse::moveMouse( Int x, Int y, Int relOrAbs ) else if( m_currMouse.pos.y < m_minY ) m_currMouse.pos.y = m_minY; -} // end moveMouse +} //------------------------------------------------------------------------------------------------- /** Get the current information for the mouse from the device */ @@ -184,7 +184,7 @@ void Mouse::updateMouseData( ) busy = FALSE; - } // end if + } if( index > 0 ) m_eventsThisFrame = index - 1; @@ -194,7 +194,7 @@ void Mouse::updateMouseData( ) if( index != 0 ) m_deadInputFrame = m_inputFrame; -} // end updateMouseData +} //------------------------------------------------------------------------------------------------- /** Combine mouse events into the main mouse variables */ @@ -369,7 +369,7 @@ void Mouse::processMouseEvent( Int index ) m_prevMouse = m_currMouse; -} // end processMouseEvent +} //------------------------------------------------------------------------------------------------- /** Check for mouse drag */ @@ -398,7 +398,7 @@ void Mouse::checkForDrag( void ) m_currMouse.middleEvent = GWM_MIDDLE_DRAG; } -} // end checkForDrag +} //------------------------------------------------------------------------------------------------- @@ -555,7 +555,7 @@ Mouse::Mouse( void ) m_captureBlockReasonBits = (1 << CursorCaptureBlockReason_NoInit) | (1 << CursorCaptureBlockReason_NoGame); DEBUG_LOG(("Mouse::Mouse: m_blockCaptureReason=CursorCaptureBlockReason_NoInit|CursorCaptureBlockReason_NoGame")); -} // end Mouse +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -569,7 +569,7 @@ Mouse::~Mouse( void ) TheDisplayStringManager->freeDisplayString( m_cursorTextDisplayString ); m_cursorTextDisplayString = NULL; -} // end ~Mouse +} /**Had to move this out of main init() because I need this data to properly initialize the Win32 version of the mouse (by preloading resources before D3D device is created).*/ @@ -618,7 +618,7 @@ void Mouse::init( void ) initCapture(); -} // end init +} //------------------------------------------------------------------------------------------------- /** Tell mouse system display resolution changed. */ @@ -648,7 +648,7 @@ void Mouse::mouseNotifyResolutionChange( void ) m_tooltipDisplayString->setWordWrap(120); -} // end reset +} //------------------------------------------------------------------------------------------------- void Mouse::onGameModeChanged(GameMode prev, GameMode next) @@ -693,7 +693,7 @@ void Mouse::reset( void ) blockCapture(CursorCaptureBlockReason_NoInit); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update the states of the mouse position and buttons */ @@ -707,7 +707,7 @@ void Mouse::update( void ) // update the mouse data updateMouseData( ); -} // end update +} //------------------------------------------------------------------------------------------------- /** Given the current state of this input device, turn the raw input @@ -795,7 +795,7 @@ void Mouse::createStreamMessages( void ) msg->appendIntegerArgument( TheKeyboard->getModifierFlags() ); break; - } // end switch + } msg = NULL; switch( m_currMouse.middleEvent ) @@ -830,7 +830,7 @@ void Mouse::createStreamMessages( void ) msg->appendIntegerArgument( TheKeyboard->getModifierFlags() ); break; - } // end switch + } msg = NULL; switch( m_currMouse.rightEvent ) @@ -865,7 +865,7 @@ void Mouse::createStreamMessages( void ) msg->appendIntegerArgument( TheKeyboard->getModifierFlags() ); break; - } // end switch + } // wheel pos msg = NULL; @@ -875,10 +875,10 @@ void Mouse::createStreamMessages( void ) msg->appendPixelArgument( m_currMouse.pos ); msg->appendIntegerArgument( m_currMouse.wheelPos / 120 ); // wheel delta msg->appendIntegerArgument( TheKeyboard->getModifierFlags() ); - } // end if + } - } // end for -} // end createStreamMessages + } +} //------------------------------------------------------------------------------------------------- /** Set the string to display at the cursor for the tooltip */ @@ -955,7 +955,7 @@ void Mouse::setCursorTooltip( UnicodeString tooltip, Int delay, const RGBColor * m_tooltipBackColor = m_tooltipColorBackground; } -} // end setCursorTooltip +} // ------------------------------------------------------------------------------------------------ /** Set the text for the mouse cursor ... note that this is *NOT* the tooltip text we @@ -979,7 +979,7 @@ void Mouse::setMouseText( UnicodeString text, if( dropColor ) m_cursorTextDropColor = *dropColor; -} // end setMouseText +} //------------------------------------------------------------------------------------------------- /** Move the mouse to the position */ @@ -990,7 +990,7 @@ void Mouse::setPosition( Int x, Int y ) m_currMouse.pos.x = x; m_currMouse.pos.y = y; -} // end setPosition +} //------------------------------------------------------------------------------------------------- /** This default implementation of SetMouseLimits will just set the limiting @@ -1013,9 +1013,9 @@ void Mouse::setMouseLimits( void ) m_maxX = TheDisplay->getWidth(); m_maxY = TheDisplay->getHeight(); - } // end if + } -} // end setMouseLimits +} // ------------------------------------------------------------------------------------------------ void Mouse::setCursorCaptureMode(CursorCaptureMode mode) @@ -1207,10 +1207,10 @@ void Mouse::drawTooltip( void ) UnsignedInt now = timeGetTime(); m_highlightPos = (width*(now-m_highlightUpdateStart))/m_tooltipFillTime; } - } // end if + } -} // end drawTooltip +} // ------------------------------------------------------------------------------------------------ /** Draw the cursor text at the mouse position. Note that this is *NOT* the tooltip text */ @@ -1243,7 +1243,7 @@ void Mouse::drawCursorText( void ) y = m_currMouse.pos.y - height / 2; m_cursorTextDisplayString->draw( x, y, color, dropColor ); -} // end drawCursorText +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1348,9 +1348,9 @@ void Mouse::setCursor( MouseCursor cursor ) else setMouseText( UnicodeString( L"" ), NULL, NULL ); - } // end if + } -} // end setCursor +} //------------------------------------------------------------------------------------------------- /** Parse MouseCursor entry */ diff --git a/Generals/Code/GameEngine/Source/GameClient/Line2D.cpp b/Generals/Code/GameEngine/Source/GameClient/Line2D.cpp index f928ecb925e..a8931c35ffb 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Line2D.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Line2D.cpp @@ -128,7 +128,7 @@ Bool ClipLine2D( ICoord2D *p1, ICoord2D *p2, ICoord2D *c1, ICoord2D *c2, *c2 = *p2; return TRUE; - } // end if + } // Both points outside window? if (clipCode1 & clipCode2) @@ -224,7 +224,7 @@ Bool ClipLine2D( ICoord2D *p1, ICoord2D *p2, ICoord2D *c1, ICoord2D *c2, x2 >= clipLeft && x2 <= clipRight && y2 >= clipTop && y2 <= clipBottom); -} // end ClipLine2D +} // This solution uses the diff --git a/Generals/Code/GameEngine/Source/GameClient/MapUtil.cpp b/Generals/Code/GameEngine/Source/GameClient/MapUtil.cpp index 45322374ea8..c4c18921d96 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MapUtil.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MapUtil.cpp @@ -929,7 +929,7 @@ typedef MapDisplayToFileNameList::iterator MapDisplayToFileNameListIter; } return selectionIndex; -} // end loadMapListbox +} //------------------------------------------------------------------------------------------------- /** Load the listbox with all the map files available to play */ @@ -970,7 +970,7 @@ Bool isValidMap( AsciiString mapName, Bool isMultiplayer ) } return FALSE; -} // end isValidMap +} //------------------------------------------------------------------------------------------------- /** Find a valid map */ @@ -992,7 +992,7 @@ AsciiString getDefaultMap( Bool isMultiplayer ) } return AsciiString::TheEmptyString; -} // end isValidMap +} const MapMetaData *MapCache::findMap(AsciiString mapName) { @@ -1015,7 +1015,7 @@ static void copyFromBigToDir( const AsciiString& infile, const AsciiString& outf { DEBUG_CRASH(( "copyFromBigToDir - Error opening source file '%s'", infile.str() )); throw SC_INVALID_DATA; - } // end if + } // how big is the map file Int fileSize = file->seek( 0, File::END ); @@ -1030,14 +1030,14 @@ static void copyFromBigToDir( const AsciiString& infile, const AsciiString& outf { DEBUG_CRASH(( "copyFromBigToDir - Unable to allocate buffer for file '%s'", infile.str() )); throw SC_INVALID_DATA; - } // end if + } // copy the file to the buffer if( file->read( buffer, fileSize ) < fileSize ) { DEBUG_CRASH(( "copyFromBigToDir - Error reading from file '%s'", infile.str() )); throw SC_INVALID_DATA; - } // end if + } // close the BIG file file->close(); @@ -1047,13 +1047,13 @@ static void copyFromBigToDir( const AsciiString& infile, const AsciiString& outf { DEBUG_CRASH(( "copyFromBigToDir - Error writing to file '%s'", outfile.str() )); throw SC_INVALID_DATA; - } // end if + } filenew->close(); // delete the buffer delete [] buffer; -} // end embedPristineMap +} Image *getMapPreviewImage( AsciiString mapName ) { @@ -1263,5 +1263,5 @@ void findDrawPositions( Int startX, Int startY, Int width, Int height, Region3D lr->x += startX; lr->y += startY; -} // end findDrawPositions +} diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 9c99592527f..eebfe674230 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -772,7 +772,7 @@ void pickAndPlayUnitVoiceResponse( const DrawableList *list, GameMessage::Type m break; } - }//next drawable in list + } @@ -984,7 +984,7 @@ GameMessage::Type CommandTranslator::issueMoveToLocationCommand( const Coord3D * else movemsg->appendLocationArgument( *pos ); - } // end if + } } // only make sounds if we really did the command messages @@ -993,7 +993,7 @@ GameMessage::Type CommandTranslator::issueMoveToLocationCommand( const Coord3D * PickAndPlayInfo info; info.m_drawTarget = drawableInWay; pickAndPlayUnitVoiceResponse( TheInGameUI->getAllSelectedDrawables(), GameMessage::MSG_DO_MOVETO, &info ); - } // end if + } if(TheStatsCollector) TheStatsCollector->incrementMoveCount(); @@ -1029,7 +1029,7 @@ GameMessage::Type CommandTranslator::createAttackMessage( Drawable *draw, attackmsg->appendObjectIDArgument( other->getObject()->getID() ); // must pass object IDs to logic - } // end if + } // return the message type created return msgType; @@ -1088,7 +1088,7 @@ GameMessage::Type CommandTranslator::issueAttackCommand( Drawable *target, // if we have a stats collector, inrement the stats if(TheStatsCollector) TheStatsCollector->incrementAttackCount(); - } // end if + } } else { @@ -1113,7 +1113,7 @@ GameMessage::Type CommandTranslator::issueAttackCommand( Drawable *target, info.m_air = targetObj->isUsingAirborneLocomotor(); info.m_drawTarget = target; pickAndPlayUnitVoiceResponse( TheInGameUI->getAllSelectedDrawables(), msgType, &info ); - } // end if + } // return the actual message type created return msgType; @@ -1362,7 +1362,7 @@ GameMessage::Type CommandTranslator::createEnterMessage( Drawable *enter, enterMsg->appendObjectIDArgument( INVALID_ID ); // 0 means current "selection team" of this player enterMsg->appendObjectIDArgument( enter->getObject()->getID() ); - } // end if + } else { DEBUG_CRASH(("Shouldn't get here. jkmcd")); @@ -1371,7 +1371,7 @@ GameMessage::Type CommandTranslator::createEnterMessage( Drawable *enter, // return the type of the message used return msgType; -} // end createEnterMessage +} //==================================================================================== CommandTranslator::CommandTranslator() : @@ -1500,7 +1500,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, //a position interaction. draw = NULL; obj = NULL; - } // end if + } // If the thing is a mine, and is locally controlled, then we should issue a moveto to its location. if (obj && obj->isLocallyControlled() && obj->isKindOf(KINDOF_MINE)) { @@ -1712,7 +1712,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage->appendObjectIDArgument( objectID ); } - } // if a special power + } // ******************************************************************************************** else if( TheInGameUI->canSelectedObjectsOverrideSpecialPowerDestination( pos, InGameUI::SELECTION_ANY, SPECIAL_INVALID ) ) @@ -1730,9 +1730,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, gameMsg->appendIntegerArgument( SPECIAL_INVALID ); gameMsg->appendObjectIDArgument( INVALID_ID ); // no specific source - } // end if + } - } // end if + } else { @@ -1740,7 +1740,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, msgType = GameMessage::MSG_DO_SPECIAL_POWER_OVERRIDE_DESTINATION_HINT; hintMessage = TheMessageStream->appendMessage( msgType ); - } // end else + } } // ******************************************************************************************** @@ -1761,9 +1761,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, pickAndPlayUnitVoiceResponse( TheInGameUI->getAllSelectedDrawables(), GameMessage::MSG_RESUME_CONSTRUCTION ); - } // end if + } - } // end if + } else { @@ -1772,9 +1772,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendObjectIDArgument( obj->getID() ); - } // end else + } - } // end else if + } // ******************************************************************************************** else if( draw && !TheInGameUI->isInForceAttackMode() && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_DOCK_AT, @@ -1799,7 +1799,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, // only make sounds if we really did the command messages pickAndPlayUnitVoiceResponse(TheInGameUI->getAllSelectedDrawables(), GameMessage::MSG_DOCK); - } // end if + } } else @@ -1831,9 +1831,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, pickAndPlayUnitVoiceResponse( TheInGameUI->getAllSelectedDrawables(), GameMessage::MSG_DO_REPAIR ); - } // end if + } - } // end if + } else { @@ -1842,9 +1842,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendObjectIDArgument( obj->getID() ); - } // end else + } - } // end else if + } // ******************************************************************************************** else if( draw && !TheInGameUI->isInForceAttackMode() && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_GET_REPAIRED_AT, obj, InGameUI::SELECTION_ANY ) ) @@ -1865,9 +1865,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, pickAndPlayUnitVoiceResponse( TheInGameUI->getAllSelectedDrawables(), GameMessage::MSG_GET_REPAIRED ); - } // end if + } - } // end if + } else { @@ -1876,9 +1876,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendObjectIDArgument( obj->getID() ); - } // end else + } - } // end else if + } // ******************************************************************************************** else if( draw && !TheInGameUI->isInForceAttackMode() && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_GET_HEALED_AT, obj, InGameUI::SELECTION_ANY ) ) @@ -1897,9 +1897,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, pickAndPlayUnitVoiceResponse( TheInGameUI->getAllSelectedDrawables(), GameMessage::MSG_GET_HEALED ); - } // end if + } - } // end if + } else { @@ -1908,9 +1908,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage = TheMessageStream->appendMessage( msgType); hintMessage->appendObjectIDArgument( obj->getID() ); - } // end else + } - } // end else if + } // ******************************************************************************************** else if( draw && draw->getObject() && !TheInGameUI->isInForceAttackMode() && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_HIJACK_VEHICLE, @@ -1925,7 +1925,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, // I must add a test to keep him from actually entering an enemy vehicle (contained)... Lorenzen msgType = createEnterMessage( draw, type ); - } // end if + } else { @@ -1933,9 +1933,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendObjectIDArgument( draw->getObject()->getID() ); - } // end else + } - } // end else if + } // ******************************************************************************************** else if( draw && !TheInGameUI->isInForceAttackMode() && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_CONVERT_OBJECT_TO_CARBOMB, obj, InGameUI::SELECTION_ANY ) ) @@ -1947,7 +1947,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, // issue the command (convert to carbomb is nearly identical to enter) msgType = createEnterMessage( draw, type ); - } // end if + } else { @@ -1955,7 +1955,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendObjectIDArgument( obj->getID() ); - } // end else + } } // ******************************************************************************************** else if( draw && !TheInGameUI->isInForceAttackMode() && canSelectionSalvage(obj) ) @@ -1976,7 +1976,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, msg->appendLocationArgument(*obj->getPosition()); } - } // end else if + } // ******************************************************************************************** else if( draw && !TheInGameUI->isInForceAttackMode() && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_ENTER_OBJECT, obj, InGameUI::SELECTION_ANY, true ) ) @@ -1988,16 +1988,16 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, // issue the command msgType = createEnterMessage( draw, type ); - } // end if + } else { msgType = GameMessage::MSG_ENTER_HINT; hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendObjectIDArgument( obj->getID() ); - } // end else + } - } // end else if + } // ******************************************************************************************** else if( draw && (result = TheInGameUI->getCanSelectedObjectsAttack( InGameUI::ACTIONTYPE_ATTACK_OBJECT, obj, InGameUI::SELECTION_ANY, TheInGameUI->isInForceAttackMode() )) == ATTACKRESULT_POSSIBLE ) { @@ -2008,7 +2008,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, // issue the attack order msgType = issueAttackCommand( draw, type ); - } // end if + } else { @@ -2017,9 +2017,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendObjectIDArgument( obj->getID() ); - } // end else + } - } // end else if + } // ******************************************************************************************** else if( draw && result == ATTACKRESULT_POSSIBLE_AFTER_MOVING ) { @@ -2029,7 +2029,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, // issue the attack order msgType = issueAttackCommand( draw, type ); - } // end if + } else { @@ -2038,7 +2038,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendObjectIDArgument( obj->getID() ); - } // end else + } } // ******************************************************************************************** @@ -2085,7 +2085,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, } } } - } // end else if + } // ******************************************************************************************** else if( draw && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_DISABLE_VEHICLE_VIA_HACKING, obj, InGameUI::SELECTION_ANY ) ) { @@ -2121,7 +2121,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage->appendObjectIDArgument( obj->getID() ); } - } // end else if + } // ******************************************************************************************** else if( draw && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_STEAL_CASH_VIA_HACKING, obj, InGameUI::SELECTION_ANY ) ) { @@ -2149,7 +2149,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, } } } - } // end if + } else { msgType = GameMessage::MSG_HACK_HINT; @@ -2157,7 +2157,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage->appendObjectIDArgument( obj->getID() ); } - } // end else if + } // ******************************************************************************************** else if( draw && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_DISABLE_BUILDING_VIA_HACKING, obj, InGameUI::SELECTION_ANY ) ) { @@ -2185,14 +2185,14 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, } } } - } // end if + } else { msgType = GameMessage::MSG_HACK_HINT; hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendObjectIDArgument( obj->getID() ); } - } // end else if + } #ifdef ALLOW_SURRENDER // ******************************************************************************************** else if( draw && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_PICK_UP_PRISONER, obj, InGameUI::SELECTION_ANY ) ) @@ -2204,7 +2204,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, // issue the command msgType = issueAttackCommand( draw, type, GUICOMMANDMODE_PICK_UP_PRISONER ); - } // end if + } else { @@ -2212,9 +2212,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendObjectIDArgument( obj->getID() ); - } // end else + } - } // end else if + } #endif // ******************************************************************************************** else if ( !draw && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_SET_RALLY_POINT, NULL, InGameUI::SELECTION_ALL, FALSE )) @@ -2245,7 +2245,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, msgType = GameMessage::MSG_IMPOSSIBLE_ATTACK_HINT; hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendLocationArgument( *pos ); - } // end else if + } // ******************************************************************************************** else @@ -2292,7 +2292,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, if ( draw == NULL ) msgType = issueMoveToLocationCommand( pos, drawableInWay, type ); - } // end if + } else { if( !validQuickPath ) @@ -2318,16 +2318,16 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendLocationArgument( *pos ); - } // end else + } - } // end else + } - } // end if + } // return the message type return msgType; -} // end evaluateContextCommand +} // ------------------------------------------------------------------------------------------------ @@ -2590,7 +2590,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage disp = DESTROY_MESSAGE; break; - } // end select previous unit + } //----------------------------------------------------------------------------------------- case GameMessage::MSG_META_SELECT_NEXT_WORKER: @@ -2700,7 +2700,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage disp = DESTROY_MESSAGE; break; - } // end select next worker + } //----------------------------------------------------------------------------------------- case GameMessage::MSG_META_SELECT_PREV_WORKER: @@ -2818,7 +2818,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage disp = DESTROY_MESSAGE; break; - } // end select previous worker + } //----------------------------------------------------------------------------------------- case GameMessage::MSG_META_SELECT_NEXT_IDLE_WORKER: @@ -2885,12 +2885,12 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if( TheRadar->getLastEventLoc( &lastEvent ) ) TheTacticalView->lookAt( &lastEvent ); - } // end if + } disp = DESTROY_MESSAGE; break; - } // end view last radar event + } //----------------------------------------------------------------------------------------- case GameMessage::MSG_META_SELECT_ALL: @@ -2994,7 +2994,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage break; */ - } // end select all + } //----------------------------------------------------------------------------------------- case GameMessage::MSG_META_SCATTER: @@ -3295,7 +3295,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage : TheGameText->FETCH_OR_SUBSTITUTE("GUI:FF_OFF", L"Fast Forward is off") ); } - } // end if + } disp = DESTROY_MESSAGE; break; @@ -3530,7 +3530,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage // Do not eat this message, as it will do something itself at HintSpy break; - } // end case GameMessage::MSG_MOUSEOVER_LOCATION_HINT + } //----------------------------------------------------------------------------- case GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_DOWN: @@ -3585,7 +3585,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage Drawable *draw = TheTacticalView->pickDrawable(&msg->getArgument(0)->pixelRegion.lo, TheInGameUI->isInForceAttackMode(), (PickType) pickType); - + // TheSuperHackers @bugfix Stubbjax 07/08/2025 Prevent dead units blocking positional context commands Object* obj = draw ? draw->getObject() : NULL; if (!obj || (obj->isEffectivelyDead() && !obj->isKindOf(KINDOF_ALWAYS_SELECTABLE))) @@ -3646,7 +3646,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage Drawable *draw = TheTacticalView->pickDrawable(&msg->getArgument(0)->pixelRegion.lo, TheInGameUI->isInForceAttackMode(), (PickType) pickType); - + // TheSuperHackers @bugfix Stubbjax 07/08/2025 Prevent dead units blocking positional context commands Object* obj = draw ? draw->getObject() : NULL; if (!obj || (obj->isEffectivelyDead() && !obj->isKindOf(KINDOF_ALWAYS_SELECTABLE))) @@ -3667,7 +3667,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } break; - } // end case GameMessage::MSG_MOUSE_LEFT_CLICK + } #if defined(RTS_DEBUG) @@ -3887,7 +3887,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage disp = DESTROY_MESSAGE; break; - } // end clear message text + } //------------------------------------------------------------------------------- DEMO MESSAGES //----------------------------------------------------------------------------------------- @@ -4860,7 +4860,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage else TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugCameraZoomLimitOff", L"Camera Zoom Limit is OFF") ); - } // end if + } disp = DESTROY_MESSAGE; break; @@ -4882,12 +4882,12 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage else TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugSpecialPowerDelaysOff", L"Special Power (Superweapon) Delay is OFF") ); - } // end if + } disp = DESTROY_MESSAGE; break; - } // end toggle special power delays + } #ifdef ALLOW_SURRENDER //------------------------------------------------------------------------------- DEMO MESSAGES @@ -5011,12 +5011,12 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage #endif // DUMP_PERF_STATS - } // end switch( msg->type ) + } return disp; -} // end CommandTranslator +} static Bool isSystemMessage( const GameMessage *msg ) { diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/GUICommandTranslator.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/GUICommandTranslator.cpp index 774bc6a3ccf..be727b03333 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/GUICommandTranslator.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/GUICommandTranslator.cpp @@ -100,12 +100,12 @@ static Object *validUnderCursor( const ICoord2D *mouse, const CommandButton *com if (!command->isValidObjectTarget(player, pickObj)) pickObj = NULL; - } // end if + } return pickObj; -} // end validUnderCursor +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -132,7 +132,7 @@ static CommandStatus doFireWeaponCommand( const CommandButton *command, const IC // get object id sourceID = draw->getObject()->getID(); - } // end if + } // create message and send to the logic GameMessage *msg; @@ -155,7 +155,7 @@ static CommandStatus doFireWeaponCommand( const CommandButton *command, const IC msg->appendObjectIDArgument( targetID ); - } // end if + } else if( BitIsSet( command->getOptions(), COMMAND_OPTION_NEED_OBJECT_TARGET ) ) { @@ -180,9 +180,9 @@ static CommandStatus doFireWeaponCommand( const CommandButton *command, const IC msg->appendObjectIDArgument( target->getID() ); msg->appendIntegerArgument( command->getMaxShotsToFire() ); - } // end if + } - } // end else + } else { msg = TheMessageStream->appendMessage( GameMessage::MSG_DO_WEAPON ); @@ -195,11 +195,11 @@ static CommandStatus doFireWeaponCommand( const CommandButton *command, const IC // command->m_name.str()) ); //return COMMAND_COMPLETE; - } // end else + } return COMMAND_COMPLETE; -} // end fire weapon +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -325,7 +325,7 @@ static CommandStatus doSetRallyPointCommand( const CommandButton *command, const return COMMAND_COMPLETE; -} // end doSetRallyPointCommand +} //------------------------------------------------------------------------------------------------- /** Do the beacon placement command */ @@ -347,7 +347,7 @@ static CommandStatus doPlaceBeacon( const CommandButton *command, const ICoord2D return COMMAND_COMPLETE; -} // end doPlaceBeacon +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -378,7 +378,7 @@ GameMessageDisposition GUICommandTranslator::translateGameMessage(const GameMess break; - } // end left mouse down + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_MOUSE_LEFT_DOUBLE_CLICK: @@ -405,7 +405,7 @@ GameMessageDisposition GUICommandTranslator::translateGameMessage(const GameMess pickAndPlayUnitVoiceResponse( TheInGameUI->getAllSelectedDrawables(), GameMessage::MSG_DO_WEAPON_AT_LOCATION, &info ); break; - } // end fire weapon command + } //--------------------------------------------------------------------------------------- @@ -456,7 +456,7 @@ GameMessageDisposition GUICommandTranslator::translateGameMessage(const GameMess return KEEP_MESSAGE; break; - } // end special power + } case GUI_COMMAND_ATTACK_MOVE: { @@ -470,7 +470,7 @@ GameMessageDisposition GUICommandTranslator::translateGameMessage(const GameMess commandStatus = doSetRallyPointCommand( command, &mouse ); break; - } // end set rally point + } //--------------------------------------------------------------------------------------- case GUICOMMANDMODE_PLACE_BEACON: @@ -478,9 +478,9 @@ GameMessageDisposition GUICommandTranslator::translateGameMessage(const GameMess commandStatus = doPlaceBeacon( command, &mouse ); break; - } // end set rally point + } - } // end switch + } // used the input disp = DESTROY_MESSAGE; @@ -491,13 +491,13 @@ GameMessageDisposition GUICommandTranslator::translateGameMessage(const GameMess TheInGameUI->setPreventLeftClickDeselectionInAlternateMouseModeForOneClick( TRUE ); TheInGameUI->setGUICommand( NULL ); } - } // end if + } break; - } // end left mouse up + } - } // end switch + } // If we're destroying the message, it means we used it. Therefore, destroy the current // attack move instruction as well. @@ -507,6 +507,6 @@ GameMessageDisposition GUICommandTranslator::translateGameMessage(const GameMess return disp; -} // end translateMessage +} diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp index 13c9b908039..2e8d7078c9d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp @@ -183,7 +183,7 @@ Bool HotKeyManager::executeHotKey( const AsciiString& keyIn ) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } return TRUE; } diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index c13ada960e9..ff6131b6a45 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -699,24 +699,24 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage done = true; break; } - } // if airborne found + } // if we're back to the first, quit if (d == first) break; - } // while - } // end plane lock + } + } disp = DESTROY_MESSAGE; break; } #endif // #if defined(RTS_DEBUG) - } // end switch + } return disp; -} // end LookAtTranslator +} void LookAtTranslator::resetModes() { diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp index e38972feb0a..77a194390f7 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp @@ -87,7 +87,7 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess TheInGameUI->placeBuildAvailable( NULL, NULL ); break; - } // end if + } // set this location as the placement anchor TheInGameUI->setPlacementStart( &mouse ); @@ -124,14 +124,14 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess // display a message to the user as to why you can't build there TheInGameUI->displayCantBuildMessage( lbc ); - } // end if + } else { // start placement anchor TheInGameUI->setPlacementStart(&mouse); - } // end else + } */ // used the input @@ -240,14 +240,14 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess TheTacticalView->screenToTerrain( &anchorEnd, &worldEnd ); placeMsg->appendLocationArgument( worldEnd ); - } // end if + } pickAndPlayUnitVoiceResponse( TheInGameUI->getAllSelectedDrawables(), placeMsg->getType() ); // get out of pending placement mode, this will also clear the arrow anchor status TheInGameUI->placeBuildAvailable( NULL, NULL ); - } // end if, location legal to build at + } else { // can't place, display why @@ -265,7 +265,7 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess // unhook the anchor so they can try again TheInGameUI->setPlacementStart( NULL ); - } // end else + } // used the input disp = DESTROY_MESSAGE; @@ -305,7 +305,7 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess TheInGameUI->setPlacementEnd(&mouse); disp = DESTROY_MESSAGE; - } // end if + } } break; diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp index 82d27310a5b..a24a043c705 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp @@ -101,7 +101,7 @@ struct SFWRec { SFWRec *info = (SFWRec *)userData; return info->translator->selectFriends(draw, info->createTeamMsg, info->dragSelecting) != 0; -} // end selectFriendsWrapper +} /*friend*/ Bool killThemKillThemAllWrapper( Drawable *draw, void *userData ) { @@ -202,7 +202,7 @@ Bool CanSelectDrawable( const Drawable *draw, Bool dragSelecting ) //Now we can select anything that is selectable. return TRUE; -} // end canSelect +} //----------------------------------------------------------------------------- static Bool canSelectWrapper( Drawable *draw, void *userData ) @@ -312,11 +312,11 @@ Bool SelectionTranslator::selectFriends( Drawable *draw, GameMessage *createTeam return true; // selected - } // end if + } return false; // not selected -} // end selectFriends +} //----------------------------------------------------------------------------- @@ -350,7 +350,7 @@ Bool SelectionTranslator::killThemKillThemAll( Drawable *draw, GameMessage *kill } } return false; -} // end selectFriends +} //----------------------------------------------------------------------------- /** diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp index df5f5b878de..72d3b2476fc 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp @@ -141,11 +141,11 @@ static GameWindowMessage rawMouseToWindowMessage( const GameMessage *msg ) gwm = GWM_WHEEL_DOWN; break; - } // end switch + } return gwm; -} // end rawMouseToWindowMessage +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -231,7 +231,7 @@ GameMessageDisposition WindowTranslator::translateGameMessage(const GameMessage break; - } // end, raw mouse position + } // ------------------------------------------------------------------------ case GameMessage::MSG_RAW_MOUSE_LEFT_DRAG: @@ -257,7 +257,7 @@ GameMessageDisposition WindowTranslator::translateGameMessage(const GameMessage break; - } // end drag mouse + } // ------------------------------------------------------------------------ case GameMessage::MSG_RAW_MOUSE_WHEEL: @@ -282,7 +282,7 @@ GameMessageDisposition WindowTranslator::translateGameMessage(const GameMessage break; - } // end mouse wheel + } // ------------------------------------------------------------------------ case GameMessage::MSG_RAW_KEY_DOWN: @@ -318,13 +318,13 @@ GameMessageDisposition WindowTranslator::translateGameMessage(const GameMessage break; - } // end key messages + } // ------------------------------------------------------------------------ default: break; - } // end switch( msg->getType() ) + } // remove event from the stream if the return code specifies to do so // If TheShell doesn't exist, then well, we're not in RTS, we're in GUIEdit diff --git a/Generals/Code/GameEngine/Source/GameClient/SelectionInfo.cpp b/Generals/Code/GameEngine/Source/GameClient/SelectionInfo.cpp index 40ef45b6e9a..e6d8e35d796 100644 --- a/Generals/Code/GameEngine/Source/GameClient/SelectionInfo.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/SelectionInfo.cpp @@ -269,7 +269,7 @@ UnsignedInt getPickTypesForContext( Bool forceAttackMode ) return types; -} // end getPickTypesForContext +} //------------------------------------------------------------------------------------------------- UnsignedInt getPickTypesForCurrentSelection( Bool forceAttackMode ) diff --git a/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp b/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp index 0d5001c2f6e..a77374eeccd 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp @@ -59,7 +59,7 @@ Anim2DTemplate::Anim2DTemplate( AsciiString name ) m_randomizeStartFrame = FALSE; m_nextTemplate = NULL; -} // end Anim2DTemplate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -70,7 +70,7 @@ Anim2DTemplate::~Anim2DTemplate( void ) if( m_images ) delete [] m_images; -} // end ~Anim2DTemplate +} // ------------------------------------------------------------------------------------------------ /** Field parse table for 2D animation templates */ @@ -110,12 +110,12 @@ void Anim2DTemplate::parseNumImages( INI *ini, void *instance, void *store, cons animTemplate->getName().str(), minimumFrames )); throw INI_INVALID_DATA; - } // end if + } // allocate the image array animTemplate->allocateImages( (UnsignedShort)numFrames ); -} // end parseNumImages +} // ------------------------------------------------------------------------------------------------ /** Allocate the image array for an animation template and store the number of frames we have */ @@ -133,7 +133,7 @@ void Anim2DTemplate::allocateImages( UnsignedShort numFrames ) for( Int i = 0; i < m_numFrames; ++i ) m_images[ i ] = NULL; -} // end allocateImages +} // ------------------------------------------------------------------------------------------------ /** Parsing a single image definition for an animation */ @@ -153,7 +153,7 @@ void Anim2DTemplate::parseImage( INI *ini, void *instance, void *store, const vo //DEBUG_CRASH(( "Anim2DTemplate::parseImage - Image not found" )); //throw INI_INVALID_DATA; - } // end if + } // // assign the image to the animation template list of images ... note since we've pre-allocated @@ -165,7 +165,7 @@ void Anim2DTemplate::parseImage( INI *ini, void *instance, void *store, const vo Anim2DTemplate *animTemplate = (Anim2DTemplate *)instance; animTemplate->storeImage( image ); -} // end parseImage +} // ------------------------------------------------------------------------------------------------ /** This will parse the image sequence of an animation. You can use this as a shortcut to @@ -193,7 +193,7 @@ void Anim2DTemplate::parseImage( INI *ini, void *instance, void *store, const vo animTemplate->getName().str() )); throw INI_INVALID_DATA; - } // end if + } // // the image storage has already been allocated, all we have to do now is count from @@ -219,14 +219,14 @@ void Anim2DTemplate::parseImage( INI *ini, void *instance, void *store, const vo imageName.str(), animTemplate->getName().str() )); throw INI_INVALID_DATA; - } // end if + } // store the image in the next free frame animTemplate->storeImage( image ); - } // end if + } -} // end parseImageSequence +} // ------------------------------------------------------------------------------------------------ /** Store the image at the next open image slot for the animation */ @@ -248,16 +248,16 @@ void Anim2DTemplate::storeImage( const Image *image ) m_images[ i ] = image; return; - } // end if + } - } // end for i + } // if we got here we tried to store an image in an array that was too small DEBUG_CRASH(( "Anim2DTemplate::storeImage - Unable to store image '%s' into animation '%s' because the animation is setup to only support '%d' image frames", image->getName().str(), getName().str(), m_numFrames )); throw INI_INVALID_DATA; -} // end storeImage +} // ------------------------------------------------------------------------------------------------ /** Return the Image* for the frame number requested */ @@ -278,16 +278,16 @@ const Image* Anim2DTemplate::getFrame( UnsignedShort frameNumber ) const frameNumber, getName().str() )); return NULL; - } // end if + } else { // return the image frame return m_images[ frameNumber ]; - } // end else + } -} // end getFrame +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -339,7 +339,7 @@ Anim2D::Anim2D( Anim2DTemplate *animTemplate, Anim2DCollection *collectionSystem m_collectionSystem->registerAnimation( this ); -} // end Anim2D +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -350,7 +350,7 @@ Anim2D::~Anim2D( void ) if( m_collectionSystem ) m_collectionSystem->unRegisterAnimation( this ); -} // end ~Anim2D +} // ------------------------------------------------------------------------------------------------ /** Set the current animation frame */ @@ -377,7 +377,7 @@ void Anim2D::setCurrentFrame( UnsignedShort frame ) // record the frame of this update to our current frame m_lastUpdateFrame = TheGameLogic->getFrame(); -} // end setCurrentFrame +} // ------------------------------------------------------------------------------------------------ /** Randomize the current frame */ @@ -391,7 +391,7 @@ void Anim2D::randomizeCurrentFrame( void ) // set the current frame to a random frame setCurrentFrame( GameClientRandomValue( 0, m_template->getNumFrames() - 1 ) ); -} // end randomizeCurrentFrame +} // ------------------------------------------------------------------------------------------------ /** Reset this animation instance to the "start" of the animation */ @@ -425,9 +425,9 @@ void Anim2D::reset( void ) m_template->getAnimMode(), m_template->getName().str() )); break; - } // end switch, animation mode + } -} // end reset +} // ------------------------------------------------------------------------------------------------ /** This is called after we are drawn ... if sufficient time has passed since our last @@ -458,7 +458,7 @@ void Anim2D::tryNextFrame( void ) setStatus( ANIM_2D_STATUS_COMPLETE ); break; - } // end once + } // ------------------------------------------------------------------------------------------- case ANIM_2D_ONCE_BACKWARDS: @@ -470,7 +470,7 @@ void Anim2D::tryNextFrame( void ) setStatus( ANIM_2D_STATUS_COMPLETE ); break; - } // end once backwards + } // ------------------------------------------------------------------------------------------- case ANIM_2D_LOOP: @@ -482,7 +482,7 @@ void Anim2D::tryNextFrame( void ) setCurrentFrame( m_currentFrame + 1 ); break; - } // end loop + } // ------------------------------------------------------------------------------------------- case ANIM_2D_LOOP_BACKWARDS: @@ -494,7 +494,7 @@ void Anim2D::tryNextFrame( void ) setCurrentFrame( m_maxFrame ); break; - } // end loop backwards + } // ------------------------------------------------------------------------------------------- case ANIM_2D_PING_PONG: @@ -513,15 +513,15 @@ void Anim2D::tryNextFrame( void ) setCurrentFrame( m_currentFrame + 1 ); clearStatus( ANIM_2D_STATUS_REVERSED ); - } // end if + } else { setCurrentFrame( m_currentFrame - 1 ); - } // end else + } - } // end if + } else { @@ -535,19 +535,19 @@ void Anim2D::tryNextFrame( void ) setCurrentFrame( m_currentFrame - 1 ); setStatus( ANIM_2D_STATUS_REVERSED ); - } // end if + } else { setCurrentFrame( m_currentFrame + 1 ); - } // end else + } - } // end else + } break; - } // end ping pong / ping pong backwards + } // ------------------------------------------------------------------------------------------- default: @@ -557,13 +557,13 @@ void Anim2D::tryNextFrame( void ) m_template->getAnimMode(), m_template->getName().str() )); break; - } // end default + } - } // end switch + } - } // end if + } -} // end tryNextFrame +} // ------------------------------------------------------------------------------------------------ /** Set status bit */ @@ -574,7 +574,7 @@ void Anim2D::setStatus( UnsignedByte statusBits ) // set the bits BitSet( m_status, statusBits ); -} // end setStatus +} // ------------------------------------------------------------------------------------------------ /** Clear status bit */ @@ -585,7 +585,7 @@ void Anim2D::clearStatus( UnsignedByte statusBits ) // clear bits BitClear( m_status, statusBits ); -} // end clearStatus +} // ------------------------------------------------------------------------------------------------ /** Return the "natural" width of the image for our current frame */ @@ -599,7 +599,7 @@ UnsignedInt Anim2D::getCurrentFrameWidth( void ) const return 0; -} // end getCurrentFrameWidth +} // ------------------------------------------------------------------------------------------------ /** Return the "natural" height of the image for our current frame */ @@ -613,7 +613,7 @@ UnsignedInt Anim2D::getCurrentFrameHeight( void ) const return 0; -} // end getCurrentFrameHeight +} // ------------------------------------------------------------------------------------------------ /** Draw an Anim2D using the natural width and height of the image data */ @@ -643,7 +643,7 @@ void Anim2D::draw( Int x, Int y ) if( m_collectionSystem == NULL && BitIsSet( m_status, ANIM_2D_STATUS_FROZEN ) == FALSE ) tryNextFrame(); -} // end draw +} // ------------------------------------------------------------------------------------------------ /** Drawing an Anim2D using a forced width and height */ @@ -671,7 +671,7 @@ void Anim2D::draw( Int x, Int y, Int width, Int height ) if( m_collectionSystem == NULL && BitIsSet( m_status, ANIM_2D_STATUS_FROZEN ) == FALSE ) tryNextFrame(); -} // end draw +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -707,7 +707,7 @@ void Anim2D::xfer( Xfer *xfer ) // alpha xfer->xferReal( &m_alpha ); -} // end xfer +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -720,7 +720,7 @@ Anim2DCollection::Anim2DCollection( void ) m_templateList = NULL; m_instanceList = NULL; -} // end Anim2DCollection +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -744,9 +744,9 @@ Anim2DCollection::~Anim2DCollection( void ) // set the head of our list to the next template m_templateList = nextTemplate; - } // end while + } -} // end ~Anim2DCollection +} // ------------------------------------------------------------------------------------------------ /** Initialize 2D animation collection */ @@ -757,7 +757,7 @@ void Anim2DCollection::init( void ) ini.loadFileDirectory( "Data\\INI\\Animation2D", INI_LOAD_OVERWRITE, NULL ); -} // end init +} // ------------------------------------------------------------------------------------------------ /** System update phase */ @@ -774,9 +774,9 @@ void Anim2DCollection::update( void ) if( BitIsSet( anim->getStatus(), ANIM_2D_STATUS_FROZEN ) == FALSE ) anim->tryNextFrame(); - } // end for, anim + } -} // end update +} // ------------------------------------------------------------------------------------------------ /** Search the template list for a template with a matching name */ @@ -793,11 +793,11 @@ Anim2DTemplate *Anim2DCollection::findTemplate( const AsciiString& name ) if( animTemplate->getName() == name ) return animTemplate; - } // end for + } return NULL; // template not found -} // end findTemplate +} //------------------------------------------------------------------------------------------------- Anim2DTemplate* Anim2DCollection::getNextTemplate( Anim2DTemplate *animTemplate ) const @@ -825,7 +825,7 @@ Anim2DTemplate *Anim2DCollection::newTemplate( const AsciiString& name ) // return the new template return animTemplate; -} // end newTemplate +} // ------------------------------------------------------------------------------------------------ /** Register animation instance with us. When an animation instance is registered it can @@ -851,7 +851,7 @@ void Anim2DCollection::registerAnimation( Anim2D *anim ) m_instanceList->m_collectionSystemPrev = anim; m_instanceList = anim; -} // end registerAnimation +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -874,5 +874,5 @@ void Anim2DCollection::unRegisterAnimation( Anim2D *anim ) else m_instanceList = anim->m_collectionSystemNext; -} // end unRegisterAnimation +} diff --git a/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp b/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp index e3e968dbf94..05842e14bd4 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp @@ -104,7 +104,7 @@ void INI::parseCampaignDefinition( INI *ini ) // parse the ini definition ini->initFromINI( campaign, TheCampaignManager->getFieldParse() ); -} // end parseCampaignDefinition +} //----------------------------------------------------------------------------- Campaign::Campaign( void ) @@ -438,7 +438,7 @@ void CampaignManager::xfer( Xfer *xfer ) if( xfer->getXferMode() == XFER_LOAD ) setCampaignAndMission( currentCampaign, currentMission ); -} // end xfer +} //----------------------------------------------------------------------------- // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp b/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp index 0a5354bff36..6a820a4e761 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp @@ -88,12 +88,12 @@ void Image::parseImageCoords( INI* ini, void *instance, void *store, const void* { uvCoords.lo.x /= (Real)textureSize->x; uvCoords.hi.x /= (Real)textureSize->x; - } // end if + } if( textureSize->y ) { uvCoords.lo.y /= (Real)textureSize->y; uvCoords.hi.y /= (Real)textureSize->y; - } // end if + } // store the uv coords theImage->setUV( &uvCoords ); @@ -104,7 +104,7 @@ void Image::parseImageCoords( INI* ini, void *instance, void *store, const void* imageSize.y = bottom - top; theImage->setImageSize( &imageSize ); -} // end parseImageCoord +} //------------------------------------------------------------------------------------------------- /** Parse the image status line */ @@ -129,9 +129,9 @@ void Image::parseImageStatus( INI* ini, void *instance, void *store, const void* imageSize.y = theImage->getImageWidth(); // note it's width not height theImage->setImageSize( &imageSize ); - } // end if + } -} // end parseImageStatus +} // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// ImageCollection *TheMappedImageCollection = NULL; ///< mapped images @@ -156,14 +156,14 @@ Image::Image( void ) m_status = IMAGE_STATUS_NONE; m_next = NULL; -} // end Image +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- Image::~Image( void ) { -} // end ~Image +} //------------------------------------------------------------------------------------------------- /** Set a status bit into the existing status, return the previous status @@ -176,7 +176,7 @@ UnsignedInt Image::setStatus( UnsignedInt bit ) BitSet( m_status, bit ); return prevStatus; -} // end setStatus +} //------------------------------------------------------------------------------------------------- /** Clear a status bit from the existing status, return the previous @@ -189,7 +189,7 @@ UnsignedInt Image::clearStatus( UnsignedInt bit ) BitClear( m_status, bit ); return prevStatus; -} // end clearStatus +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -202,7 +202,7 @@ ImageCollection::ImageCollection( void ) m_imageList = NULL; -} // end ImageCollection +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -219,10 +219,10 @@ ImageCollection::~ImageCollection( void ) deleteInstance(image); image = next; - } // end while + } m_imageList = NULL; -} // end ~ImageCollection +} //------------------------------------------------------------------------------------------------- /** Return the next image in the collection */ @@ -235,7 +235,7 @@ Image *ImageCollection::nextImage( Image *image ) return NULL; -} // end nextImage +} //------------------------------------------------------------------------------------------------- /** Allocate a new image, tie to the image list and return it */ @@ -250,7 +250,7 @@ Image *ImageCollection::newImage( void ) return image; -} // end newImage +} //------------------------------------------------------------------------------------------------- /** Find an image given the image name */ @@ -275,12 +275,12 @@ const Image *ImageCollection::findImageByName( const AsciiString& name ) return image; image = image->m_next; - } // end while + } // not found return NULL; -} // end findImageByName +} //------------------------------------------------------------------------------------------------- /** Find image given image filename */ @@ -301,12 +301,12 @@ const Image *ImageCollection::findImageByFilename( const AsciiString& filename ) return image; image = image->m_next; - } // end while + } // not found return NULL; -} // end findImageByFilename +} //------------------------------------------------------------------------------------------------- /** Load this image collection with all the images specified in the INI files @@ -339,4 +339,4 @@ void ImageCollection::load( Int textureSize ) ini.loadDirectory("Data\\INI\\MappedImages\\HandCreated", INI_LOAD_OVERWRITE, NULL ); -} // end load +} diff --git a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp index ccdfe58361f..6586b30c370 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -88,7 +88,7 @@ ParticleInfo::ParticleInfo( void ) m_particleUpTowardsEmitter = FALSE; // -} // end ParticleInfo +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -96,7 +96,7 @@ ParticleInfo::ParticleInfo( void ) void ParticleInfo::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -153,7 +153,7 @@ void ParticleInfo::xfer( Xfer *xfer ) xfer->xferReal( &m_alphaKey[ i ].value ); xfer->xferUnsignedInt( &m_alphaKey[ i ].frame ); - } // end for, i + } // color keys for( i = 0; i < MAX_KEYFRAMES; ++i ) @@ -162,7 +162,7 @@ void ParticleInfo::xfer( Xfer *xfer ) xfer->xferRGBColor( &m_colorKey[ i ].color ); xfer->xferUnsignedInt( &m_colorKey[ i ].frame ); - } // end for, i + } // color scale xfer->xferReal( &m_colorScale ); @@ -173,7 +173,7 @@ void ParticleInfo::xfer( Xfer *xfer ) // wind randomness xfer->xferReal( &m_windRandomness ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -181,7 +181,7 @@ void ParticleInfo::xfer( Xfer *xfer ) void ParticleInfo::loadPostProcess( void ) { -} // end loadPostProcess +} /** Load post process */ // ------------------------------------------------------------------------------------------------ @@ -577,9 +577,9 @@ void Particle::doWindMotion( void ) systemPos.y += objPos->y; systemPos.z += objPos->z; - } // end if + } - } // end if + } else if( DrawableID attachedDraw = m_system->getAttachedDrawable() ) { Drawable *draw = TheGameClient->findDrawableByID( attachedDraw ); @@ -592,9 +592,9 @@ void Particle::doWindMotion( void ) systemPos.y += drawPos->y; systemPos.z += drawPos->z; - } // end if + } - } // end else if + } // // compute a vector from the system position in the world to the particle ... we will use @@ -629,9 +629,9 @@ void Particle::doWindMotion( void ) m_pos.x += (Cos( windAngle ) * windForceStrength); m_pos.y += (Sin( windAngle ) * windForceStrength); - } // end if + } -} // doWindMotion +} // ------------------------------------------------------------------------------------------------ /** Get priority of a particle ... which is the priority of it's attached system */ @@ -696,7 +696,7 @@ Bool Particle::isInvisible( void ) void Particle::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -767,18 +767,18 @@ void Particle::xfer( Xfer *xfer ) DEBUG_CRASH(( "Particle::xfer - Unable to find matching drawable id for particle" )); throw SC_INVALID_DATA; - } // end if + } // set the particle pointer in the drawable m_drawable->friend_setParticle( this ); - } // end if + } // system under control as an id ParticleSystemID systemUnderControlID = m_systemUnderControl ? m_systemUnderControl->getSystemID() : INVALID_PARTICLE_SYSTEM_ID; xfer->xferUser( &systemUnderControlID, sizeof( ParticleSystemID ) ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -808,11 +808,11 @@ void Particle::loadPostProcess( void ) DEBUG_CRASH(( "Particle::loadPostProcess - Unable to find system under control pointer" )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } -} // end loadPostProcess +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -867,7 +867,7 @@ void ParticleSystemInfo::tintAllColors( Color tintColor ) m_colorKey[ key ].color.blue *= (Real)(rgb.blue ) / 255.0f; } -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ @@ -876,7 +876,7 @@ void ParticleSystemInfo::tintAllColors( Color tintColor ) void ParticleSystemInfo::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -945,7 +945,7 @@ void ParticleSystemInfo::xfer( Xfer *xfer ) xfer->xferUser( &m_alphaKey[ i ].var, sizeof( GameClientRandomVariable ) ); xfer->xferUnsignedInt( &m_alphaKey[ i ].frame ); - } // end for, i + } // color keys for( i = 0; i < MAX_KEYFRAMES; ++i ) @@ -954,7 +954,7 @@ void ParticleSystemInfo::xfer( Xfer *xfer ) xfer->xferRGBColor( &m_colorKey[ i ].color ); xfer->xferUnsignedInt( &m_colorKey[ i ].frame ); - } // end for, i + } // color scale xfer->xferUser( &m_colorScale, sizeof( GameClientRandomVariable ) ); @@ -1022,7 +1022,7 @@ void ParticleSystemInfo::xfer( Xfer *xfer ) xfer->xferUser( &m_emissionVelocity.outward.otherSpeed, sizeof( GameClientRandomVariable ) ); break; - } // end switch, m_emissionVelocityType + } // emission volume type xfer->xferUser( &m_emissionVolumeType, sizeof( EmissionVolumeType ) ); @@ -1058,7 +1058,7 @@ void ParticleSystemInfo::xfer( Xfer *xfer ) xfer->xferReal( &m_emissionVolume.cylinder.length ); break; - } // end switch, m_emissionVolumeType + } // is emission volume hollow xfer->xferBool( &m_isEmissionVolumeHollow ); @@ -1108,7 +1108,7 @@ void ParticleSystemInfo::xfer( Xfer *xfer ) // wind motion moving to end angle xfer->xferByte( &m_windMotionMovingToEndAngle ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1116,7 +1116,7 @@ void ParticleSystemInfo::xfer( Xfer *xfer ) void ParticleSystemInfo::loadPostProcess( void ) { -} // end loadPostProcess +} /////////////////////////////////////////////////////////////////////////////////////////////////// // ParticleSystem ///////////////////////////////////////////////////////////////////////////////// @@ -1267,9 +1267,9 @@ ParticleSystem::ParticleSystem( const ParticleSystemTemplate *sysTemplate, setSlave( slaveSystem ); m_slaveSystem->setMaster( this ); - } // end if + } - } // end if + } m_attachedSystemName = sysTemplate->m_attachedSystemName; m_particleCount = 0; @@ -1295,7 +1295,7 @@ ParticleSystem::~ParticleSystem() m_slaveSystem->setMaster( NULL ); setSlave( NULL ); - } // end if + } // tell any master system that *we* are going away if( m_masterSystem ) @@ -1305,7 +1305,7 @@ ParticleSystem::~ParticleSystem() m_masterSystem->setSlave( NULL ); setMaster( NULL ); - } // end if + } // destroy all particles "in the air" @@ -1333,7 +1333,7 @@ void ParticleSystem::setMaster( ParticleSystem *master ) m_masterSystem = master; m_masterSystemID = master ? master->getSystemID() : INVALID_PARTICLE_SYSTEM_ID; -} // end set Master +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1343,7 +1343,7 @@ void ParticleSystem::setSlave( ParticleSystem *slave ) m_slaveSystem = slave; m_slaveSystemID = slave ? slave->getSystemID() : INVALID_PARTICLE_SYSTEM_ID; -} // end setSlave +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1820,7 +1820,7 @@ Particle *ParticleSystem::createParticle( const ParticleInfo *info, return NULL; } - } // end if + } Particle *p = newInstance(Particle)( this, info ); return p; @@ -2131,9 +2131,9 @@ Bool ParticleSystem::update( Int localPlayerIndex ) m_burstDelayLeft--; } - } // end if stopped check - } // end if system lifetime check - } // end if is destroyed + } + } + } // // Update all particles in the system @@ -2256,9 +2256,9 @@ void ParticleSystem::updateWindMotion( void ) GameClientRandomValueReal( m_windMotionEndAngleMin, m_windMotionEndAngleMax ); - } // end if + } - } // end if + } else { @@ -2284,13 +2284,13 @@ void ParticleSystem::updateWindMotion( void ) GameClientRandomValueReal( m_windMotionEndAngleMin, m_windMotionEndAngleMax ); - } // end if + } - } // end else + } break; - } // end case + } // -------------------------------------------------------------------------------------------- case ParticleSystemInfo::WIND_MOTION_CIRCULAR: @@ -2311,7 +2311,7 @@ void ParticleSystem::updateWindMotion( void ) break; - } // end case + } // --------------------------------------------------------------------------------------------- default: @@ -2319,11 +2319,11 @@ void ParticleSystem::updateWindMotion( void ) break; - } // end default + } - } // end if + } -} // end updateWindMotion +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -2482,7 +2482,7 @@ void ParticleSystem::setControlParticle( Particle *p ) void ParticleSystem::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -2594,9 +2594,9 @@ void ParticleSystem::xfer( Xfer *xfer ) // write particle information xfer->xferSnapshot( particle ); - } // end for, particle + } - } // end if, save + } else { ParticlePriorityType priority = getPriority(); @@ -2616,11 +2616,11 @@ void ParticleSystem::xfer( Xfer *xfer ) // read in the particle data xfer->xferSnapshot( particle ); - } // end for i + } - } // end else, load + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -2642,7 +2642,7 @@ void ParticleSystem::loadPostProcess( void ) DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_slaveSystem is not NULL but should be" )); throw SC_INVALID_DATA; - } // end if + } // assign system m_slaveSystem = TheParticleSystemManager->findParticleSystem( m_slaveSystemID ); @@ -2654,9 +2654,9 @@ void ParticleSystem::loadPostProcess( void ) DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_slaveSystem is NULL or destroyed" )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } // reconnect master pointers if needed if( m_masterSystemID != INVALID_PARTICLE_SYSTEM_ID ) @@ -2669,7 +2669,7 @@ void ParticleSystem::loadPostProcess( void ) DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_masterSystem is not NULL but should be" )); throw SC_INVALID_DATA; - } // end if + } // assign system m_masterSystem = TheParticleSystemManager->findParticleSystem( m_masterSystemID ); @@ -2681,11 +2681,11 @@ void ParticleSystem::loadPostProcess( void ) DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_masterSystem is NULL or destroyed" )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } -} // end loadPostProcess +} /////////////////////////////////////////////////////////////////////////////////////////////////// // ParticleSystemTemplate ///////////////////////////////////////////////////////////////////////// @@ -2864,7 +2864,7 @@ void ParticleSystemTemplate::parseRandomRGBColor( INI* ini, void *instance, if( colors[j][i] < -255 || colors[j][i] > 255 ) throw INI_INVALID_DATA; - } // end for i + } } // assign the color components to the "RGBColor" pointer at 'store' @@ -2939,7 +2939,7 @@ ParticleSystemManager::ParticleSystemManager( void ) m_allParticlesHead[ i ] = NULL; m_allParticlesTail[ i ] = NULL; - } // end for, i + } } @@ -2977,7 +2977,7 @@ void ParticleSystemManager::init( void ) m_allParticlesHead[ i ] = NULL; m_allParticlesTail[ i ] = NULL; - } // end for, i + } } @@ -3005,7 +3005,7 @@ void ParticleSystemManager::reset( void ) m_allParticlesHead[ i ] = NULL; m_allParticlesTail[ i ] = NULL; - } // end for, i + } m_particleCount = 0; m_fieldParticleCount = 0; @@ -3102,7 +3102,7 @@ ParticleSystem *ParticleSystemManager::findParticleSystem( ParticleSystemID id ) return NULL; -} // end findParticleSystem +} // ------------------------------------------------------------------------------------------------ /** destroy the particle system with the given id (if it still exists) */ @@ -3334,7 +3334,7 @@ void ParticleSystemManager::preloadAssets( TimeOfDay timeOfDay ) void ParticleSystemManager::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -3384,10 +3384,10 @@ void ParticleSystemManager::xfer( Xfer *xfer ) // write system data xfer->xferSnapshot( system ); - } // end for, it + } DEBUG_ASSERTCRASH(systemCount==0, ("Mismatch in write count.")); - } // end if, save + } else { const ParticleSystemTemplate *systemTemplate; @@ -3411,7 +3411,7 @@ void ParticleSystemManager::xfer( Xfer *xfer ) systemName.str() )); throw SC_INVALID_DATA; - } // end if + } // create system system = createParticleSystem( systemTemplate, FALSE ); @@ -3423,16 +3423,16 @@ void ParticleSystemManager::xfer( Xfer *xfer ) systemName.str() )); throw SC_INVALID_DATA; - } // end if + } // read system data xfer->xferSnapshot( system ); - } // end for, i + } - } // end else, load + } -} // end particleSystemManager +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -3440,7 +3440,7 @@ void ParticleSystemManager::xfer( Xfer *xfer ) void ParticleSystemManager::loadPostProcess( void ) { -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ /** Output particle system statistics to the screen diff --git a/Generals/Code/GameEngine/Source/GameClient/System/RayEffect.cpp b/Generals/Code/GameEngine/Source/GameClient/System/RayEffect.cpp index d720195c46f..900efae9b7d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/RayEffect.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/RayEffect.cpp @@ -56,13 +56,13 @@ RayEffectData *RayEffectSystem::findEntry( const Drawable *draw ) effectData = &m_effectData[ i ]; break; // exit for i - } // end if + } - } // end for i + } return effectData; -} // end findEntry +} // PUBLIC METHODS ///////////////////////////////////////////////////////////////////////////////// @@ -73,14 +73,14 @@ RayEffectSystem::RayEffectSystem( void ) init(); -} // end RayEffectSystem +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- RayEffectSystem::~RayEffectSystem( void ) { -} // end ~RayEffectSystem +} //------------------------------------------------------------------------------------------------- /** initialize the system */ @@ -96,9 +96,9 @@ void RayEffectSystem::init( void ) m_effectData[ i ].startLoc.zero(); m_effectData[ i ].endLoc.zero(); - } // end for i + } -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset */ @@ -109,7 +109,7 @@ void RayEffectSystem::reset( void ) // nothing dynamic going on here, just initialize it init(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** add a ray effect entry for this drawable */ @@ -139,9 +139,9 @@ void RayEffectSystem::addRayEffect( const Drawable *draw, effectData = &m_effectData[ i ]; break; // exit for - } // end if + } - } // end for i + } // if no free slots we can't do it if( effectData == NULL ) @@ -173,9 +173,9 @@ void RayEffectSystem::deleteRayEffect( const Drawable *draw ) // remove the data for this entry effectData->draw = NULL; - } // end if + } -} // end deleteRayEffect +} //------------------------------------------------------------------------------------------------- /** given a drawable, if it is in the ray effect system list retrieve @@ -198,7 +198,7 @@ void RayEffectSystem::getRayEffectData( const Drawable *draw, // data has been found, copy to parameter *effectData = *entry; - } // end effectData + } -} // end getRayEffectData +} diff --git a/Generals/Code/GameEngine/Source/GameClient/Terrain/TerrainRoads.cpp b/Generals/Code/GameEngine/Source/GameClient/Terrain/TerrainRoads.cpp index ee58c0b78e7..2b90a81accb 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Terrain/TerrainRoads.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Terrain/TerrainRoads.cpp @@ -115,7 +115,7 @@ const FieldParse TerrainRoadType::m_terrainBridgeFieldParseTable[] = DEBUG_CRASH(( "Expected Damage/Repair transition keyword" )); throw INI_INVALID_DATA; - } // end else + } // get body damage state token = ini->getNextSubToken( "ToState" ); @@ -135,7 +135,7 @@ const FieldParse TerrainRoadType::m_terrainBridgeFieldParseTable[] = DEBUG_CRASH(( "Effect number max on bridge transitions is '%d'", MAX_BRIDGE_BODY_FX )); throw INI_INVALID_DATA; - } // end if + } // read the string token = ini->getNextSubToken( "OCL" ); @@ -144,7 +144,7 @@ const FieldParse TerrainRoadType::m_terrainBridgeFieldParseTable[] = else theInstance->friend_setRepairedToOCLString( state, effectNum, AsciiString( token ) ); -} // end parseTransitionToOCL +} // ------------------------------------------------------------------------------------------------ /** In the form of @@ -171,7 +171,7 @@ const FieldParse TerrainRoadType::m_terrainBridgeFieldParseTable[] = DEBUG_CRASH(( "Expected Damage/Repair transition keyword" )); throw INI_INVALID_DATA; - } // end else + } // get body damage state token = ini->getNextSubToken( "ToState" ); @@ -191,7 +191,7 @@ const FieldParse TerrainRoadType::m_terrainBridgeFieldParseTable[] = DEBUG_CRASH(( "Effect number max on bridge transitions is '%d'", MAX_BRIDGE_BODY_FX )); throw INI_INVALID_DATA; - } // end if + } // read the string token = ini->getNextSubToken( "FX" ); @@ -200,7 +200,7 @@ const FieldParse TerrainRoadType::m_terrainBridgeFieldParseTable[] = else theInstance->friend_setRepairedToFXString( state, effectNum, AsciiString( token ) ); -} // end parseTransitionToFX +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -219,14 +219,14 @@ TerrainRoadType::TerrainRoadType( void ) m_transitionEffectsHeight = 0.0f; m_numFXPerType = 0; -} // end TerrainRoadType +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- TerrainRoadType::~TerrainRoadType( void ) { -} // end ~TerrainRoadType +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -242,7 +242,7 @@ TerrainRoadCollection::TerrainRoadCollection( void ) m_idCounter = 1; ///< MUST start this at 1. -} // end TerrainRoadCollection +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -263,7 +263,7 @@ TerrainRoadCollection::~TerrainRoadCollection( void ) // set the new head of the list m_roadList = temp; - } // end while + } // delete all bridges in the list while( m_bridgeList ) @@ -278,9 +278,9 @@ TerrainRoadCollection::~TerrainRoadCollection( void ) // set the new head of the list m_bridgeList = temp; - } // end while + } -} // end ~TerrainRoadCollection +} //------------------------------------------------------------------------------------------------- /** Find road with matching name */ @@ -295,12 +295,12 @@ TerrainRoadType *TerrainRoadCollection::findRoad( AsciiString name ) if( road->getName() == name ) return road; - } // end for road + } // not found return NULL; -} // end findRoad +} //------------------------------------------------------------------------------------------------- /** Find bridge with matching name */ @@ -315,12 +315,12 @@ TerrainRoadType *TerrainRoadCollection::findBridge( AsciiString name ) if( bridge->getName() == name ) return bridge; - } // end for bridge + } // not found return NULL; -} // end findBridge +} //------------------------------------------------------------------------------------------------- /** Search the roads AND bridge lists for the name */ @@ -334,7 +334,7 @@ TerrainRoadType *TerrainRoadCollection::findRoadOrBridge( AsciiString name ) else return findBridge( name ); -} // end findRoadOrBridge +} //------------------------------------------------------------------------------------------------- /** Allocate a new road, set the name, and link to the road list */ @@ -361,7 +361,7 @@ TerrainRoadType *TerrainRoadCollection::newRoad( AsciiString name ) road->friend_setRoadWidth( defaultRoad->getRoadWidth() ); road->friend_setRoadWidthInTexture( defaultRoad->getRoadWidthInTexture() ); - } // end if + } // link to list road->friend_setNext( m_roadList ); @@ -370,7 +370,7 @@ TerrainRoadType *TerrainRoadCollection::newRoad( AsciiString name ) // return the new road return road; -} // end newRoad +} //------------------------------------------------------------------------------------------------- /** Allocate a new bridge */ @@ -419,11 +419,11 @@ TerrainRoadType *TerrainRoadCollection::newBridge( AsciiString name ) bridge->friend_setRepairedToOCLString( (BodyDamageType)state, i, bridge->getDamageToOCLString( (BodyDamageType)state, i ) ); bridge->friend_setRepairedToFXString( (BodyDamageType)state, i, bridge->getDamageToOCLString( (BodyDamageType)state, i ) ); - } // end for i + } - } // end for + } - } // end if + } // link to list bridge->friend_setNext( m_bridgeList ); @@ -432,7 +432,7 @@ TerrainRoadType *TerrainRoadCollection::newBridge( AsciiString name ) // return the new bridge return bridge; -} // end newBridge +} //------------------------------------------------------------------------------------------------- /** Return next road in list */ @@ -443,7 +443,7 @@ TerrainRoadType *TerrainRoadCollection::nextRoad( TerrainRoadType *road ) DEBUG_ASSERTCRASH( road->isBridge() == FALSE, ("nextRoad: road not a road") ); return road->friend_getNext(); -} // end nextRoad +} //------------------------------------------------------------------------------------------------- /** Return next bridge in list */ @@ -454,5 +454,5 @@ TerrainRoadType *TerrainRoadCollection::nextBridge( TerrainRoadType *bridge ) DEBUG_ASSERTCRASH( bridge->isBridge() == TRUE, ("nextBridge, bridge is not a bridge") ); return bridge->friend_getNext(); -} // end nextBridge +} diff --git a/Generals/Code/GameEngine/Source/GameClient/Terrain/TerrainVisual.cpp b/Generals/Code/GameEngine/Source/GameClient/Terrain/TerrainVisual.cpp index 2d9dd65d10b..f5fb2ec6d60 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Terrain/TerrainVisual.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Terrain/TerrainVisual.cpp @@ -47,14 +47,14 @@ TerrainVisual *TheTerrainVisual = NULL; TerrainVisual::TerrainVisual() { -} // end TerrainVisual +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- TerrainVisual::~TerrainVisual() { -} // end ~TerrainVisual +} //------------------------------------------------------------------------------------------------- /** initialize the device independent functionality of the visual terrain */ @@ -62,7 +62,7 @@ TerrainVisual::~TerrainVisual() void TerrainVisual::init( void ) { -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset */ @@ -72,7 +72,7 @@ void TerrainVisual::reset( void ) m_filenameString.clear(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update */ @@ -80,7 +80,7 @@ void TerrainVisual::reset( void ) void TerrainVisual::update( void ) { // All the interesting stuff happens in load. jba. -} // end update +} //------------------------------------------------------------------------------------------------- /** device independent implementation for common terrain visual systems */ @@ -96,7 +96,7 @@ Bool TerrainVisual::load( AsciiString filename ) return TRUE;; // success -} // end load +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -104,7 +104,7 @@ Bool TerrainVisual::load( AsciiString filename ) void TerrainVisual::crc( Xfer *xfer ) { -} // end CRC +} // ------------------------------------------------------------------------------------------------ /** Xfer @@ -119,7 +119,7 @@ void TerrainVisual::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -127,4 +127,4 @@ void TerrainVisual::xfer( Xfer *xfer ) void TerrainVisual::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameClient/View.cpp b/Generals/Code/GameEngine/Source/GameClient/View.cpp index 34283c797b0..c0bca09dee4 100644 --- a/Generals/Code/GameEngine/Source/GameClient/View.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/View.cpp @@ -247,7 +247,7 @@ void View::getScreenCornerWorldPointsAtZ( Coord3D *topLeft, Coord3D *topRight, screenToWorldAtZ( &screenBottomLeft, bottomLeft, z ); screenToWorldAtZ( &screenBottomRight, bottomRight, z ); -} // end getScreenCornerWorldPointsAtZ +} // ------------------------------------------------------------------------------------------------ /** Xfer method for a view */ @@ -273,4 +273,4 @@ void View::xfer( Xfer *xfer ) xfer->xferReal( &viewPos.z ); lookAt( &viewPos ); -} // end xfer +} diff --git a/Generals/Code/GameEngine/Source/GameClient/Water.cpp b/Generals/Code/GameEngine/Source/GameClient/Water.cpp index e97ed8b4f59..9eec7baced4 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Water.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Water.cpp @@ -122,13 +122,13 @@ WaterSetting::WaterSetting( void ) m_uScrollPerMs = 0.0f; m_vScrollPerMs = 0.0f; -} // end WaterSetting +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- WaterSetting::~WaterSetting( void ) { -} // end WaterSetting +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp index e2aca57781d..88a1ef3a871 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp @@ -430,7 +430,7 @@ void AI::parseAiDataDefinition( INI* ini ) // parse the ini weapon definition ini->initFromINI( TheAI->m_aiData, TheAIFieldParseTable ); - } // end if + } } @@ -978,7 +978,7 @@ void TAiData::crc( Xfer *xfer ) xfer->xferBool( &m_enableRepulsors ); CRCGEN_LOG(("CRC after AI TAiData for frame %d is 0x%8.8X", TheGameLogic->getFrame(), ((XferCRC *)xfer)->getCRC())); -} // end crc +} //----------------------------------------------------------------------------- void TAiData::xfer( Xfer *xfer ) @@ -989,13 +989,13 @@ void TAiData::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} //----------------------------------------------------------------------------- void TAiData::loadPostProcess( void ) { -} // end loadPostProcess +} //----------------------------------------------------------------------------- void AI::crc( Xfer *xfer ) @@ -1024,7 +1024,7 @@ void AI::crc( Xfer *xfer ) } } -} // end crc +} //----------------------------------------------------------------------------- void AI::xfer( Xfer *xfer ) @@ -1035,12 +1035,12 @@ void AI::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} //----------------------------------------------------------------------------- void AI::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp index 241824b05ed..203557d9c55 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp @@ -92,7 +92,7 @@ void AIDockMachine::halt() void AIDockMachine::crc( Xfer *xfer ) { StateMachine::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -105,7 +105,7 @@ void AIDockMachine::xfer( Xfer *xfer ) StateMachine::xfer(xfer); xfer->xferInt(&m_approachPosition); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -113,7 +113,7 @@ void AIDockMachine::xfer( Xfer *xfer ) void AIDockMachine::loadPostProcess( void ) { StateMachine::loadPostProcess(); -} // end loadPostProcess +} // State transition conditions ---------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -158,7 +158,7 @@ void AIDockApproachState::xfer( Xfer *xfer ) AIInternalMoveToState::xfer(xfer); } -} // end xfer +} //---------------------------------------------------------------------------------------------- /** diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp index eff90c4a9bd..e6e3d42f692 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp @@ -2454,9 +2454,9 @@ void AIGroup::groupExecuteRailedTransport( CommandSourceType cmdSource ) if( ai ) ai->aiExecuteRailedTransport( cmdSource ); - } // end for i + } -} // end groupExecuteRailedTransport +} ///< life altering state change, if this AI can do it void AIGroup::groupGoProne( const DamageInfo *damageInfo, CommandSourceType cmdSource ) @@ -2801,9 +2801,9 @@ void AIGroup::groupToggleOvercharge( CommandSourceType cmdSource ) if( obi ) obi->toggle(); - } // end for + } - } // end for, i + } } @@ -2826,7 +2826,7 @@ void AIGroup::groupPickUpPrisoner( Object *prisoner, enum CommandSourceType cmdS if( ai ) ai->aiPickUpPrisoner( prisoner, cmdSource ); - } // end for, i + } } #endif @@ -2850,7 +2850,7 @@ void AIGroup::groupReturnToPrison( Object *prison, enum CommandSourceType cmdSou if( ai ) ai->aiReturnPrisoners( prison, cmdSource ); - } // end for, i + } } #endif @@ -2873,7 +2873,7 @@ void AIGroup::groupCombatDrop( Object *target, const Coord3D &pos, CommandSource if( ai ) ai->aiCombatDrop( target, pos, cmdSource ); - } // end for, i + } } @@ -2893,7 +2893,7 @@ void AIGroup::groupDoCommandButton( const CommandButton *commandButton, CommandS source = *i; source->doCommandButton( commandButton, cmdSource ); - } // end for, i + } } @@ -2913,7 +2913,7 @@ void AIGroup::groupDoCommandButtonAtPosition( const CommandButton *commandButton source = *i; source->doCommandButtonAtPosition( commandButton, pos, cmdSource ); - } // end for, i + } } //------------------------------------------------------------------------------------- @@ -2932,7 +2932,7 @@ void AIGroup::groupDoCommandButtonAtObject( const CommandButton *commandButton, source = *i; source->doCommandButtonAtObject( commandButton, obj, cmdSource ); - } // end for, i + } } @@ -3248,7 +3248,7 @@ void AIGroup::crc( Xfer *xfer ) xfer->xferUnsignedInt( &m_id ); CRCGEN_LOG(("CRC after AI AIGroup m_id (%d) for frame %d is 0x%8.8X", m_id, TheGameLogic->getFrame(), ((XferCRC *)xfer)->getCRC())); -} // end crc +} //----------------------------------------------------------------------------- void AIGroup::xfer( Xfer *xfer ) @@ -3259,10 +3259,10 @@ void AIGroup::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} //----------------------------------------------------------------------------- void AIGroup::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp index cd816fad732..9fc2c2ea15f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp @@ -282,7 +282,7 @@ Bool AIGuardMachine::lookForInnerTarget(void) // ------------------------------------------------------------------------------------------------ void AIGuardMachine::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -312,14 +312,14 @@ void AIGuardMachine::xfer( Xfer *xfer ) } } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIGuardMachine::loadPostProcess( void ) { -} // end loadPostProcess +} //-- AIGuardInnerState ---------------------------------------------------------------------------- // ------------------------------------------------------------------------------------------------ @@ -327,7 +327,7 @@ void AIGuardMachine::loadPostProcess( void ) // ------------------------------------------------------------------------------------------------ void AIGuardInnerState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -339,7 +339,7 @@ void AIGuardInnerState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -347,7 +347,7 @@ void AIGuardInnerState::xfer( Xfer *xfer ) void AIGuardInnerState::loadPostProcess( void ) { onEnter(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ AIGuardInnerState::~AIGuardInnerState(void) @@ -420,7 +420,7 @@ void AIGuardInnerState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void AIGuardOuterState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -432,7 +432,7 @@ void AIGuardOuterState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -440,7 +440,7 @@ void AIGuardOuterState::xfer( Xfer *xfer ) void AIGuardOuterState::loadPostProcess( void ) { AIGuardOuterState onEnter(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ AIGuardOuterState::~AIGuardOuterState(void) @@ -543,7 +543,7 @@ void AIGuardOuterState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void AIGuardReturnState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -556,14 +556,14 @@ void AIGuardReturnState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUnsignedInt(&m_nextReturnScanTime); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIGuardReturnState::loadPostProcess( void ) { -} // end loadPostProcess +} //-------------------------------------------------------------------------------------- StateReturnType AIGuardReturnState::onEnter( void ) @@ -619,7 +619,7 @@ void AIGuardReturnState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void AIGuardIdleState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -632,14 +632,14 @@ void AIGuardIdleState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUnsignedInt(&m_nextEnemyScanTime); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIGuardIdleState::loadPostProcess( void ) { -} // end loadPostProcess +} //-------------------------------------------------------------------------------------- StateReturnType AIGuardIdleState::onEnter( void ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 92842873b01..93026c82810 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -250,7 +250,7 @@ Path::~Path( void ) // ------------------------------------------------------------------------------------------------ void Path::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -362,14 +362,14 @@ void Path::xfer( Xfer *xfer ) TheAI->pathfinder()->setDebugPath(this); } #endif -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void Path::loadPostProcess( void ) { -} // end loadPostProcess +} /** * Create a new node at the head of the path @@ -3494,11 +3494,11 @@ void Pathfinder::removeWallPiece(Object *wallPiece) // all done return; - } // end if + } - } // end for, i + } -} // end removeWallPiece +} /** * Checks if a point is on the wall. @@ -3825,11 +3825,11 @@ void Pathfinder::internal_classifyObjectFootprint( Object *obj, Bool insert ) m_map[i][j].removeObstacle( obj ); } } - } // for i - } // for j - } // cylinder + } + } + } break; - } // switch + } Region2D bounds; Int i, j; obj->getGeometryInfo().get2DBounds(*obj->getPosition(), obj->getOrientation(), bounds); @@ -10422,7 +10422,7 @@ void Pathfinder::crc( Xfer *xfer ) xfer->xferInt(&m_cumulativeCellsAllocated); CRCDEBUG_LOG(("m_cumulativeCellsAllocated: %8.8X", ((XferCRC *)xfer)->getCRC())); -} // end crc +} //----------------------------------------------------------------------------- void Pathfinder::xfer( Xfer *xfer ) @@ -10433,10 +10433,10 @@ void Pathfinder::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} //----------------------------------------------------------------------------- void Pathfinder::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp index 9ae77ddda0f..29b237702ea 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp @@ -494,7 +494,7 @@ Object *AIPlayer::buildStructureNow(const ThingTemplate *bldgPlan, BuildListInfo exitInterface->setRallyPoint(&rallyPoint); } } - } // bldg built + } return bldg; } @@ -683,7 +683,7 @@ Object *AIPlayer::buildStructureWithDozer(const ThingTemplate *bldgPlan, BuildLi bldgName.concat(" - Building started."); TheScriptEngine->AppendDebugMessage(bldgName, false); } - } // bldg built + } TheTerrainVisual->removeAllBibs(); // isLocationLegalToBuild adds bib feedback, turn it off. jba. return bldg; } @@ -797,7 +797,7 @@ void AIPlayer::processBaseBuilding( void ) m_frameLastBuildingBuilt = TheGameLogic->getFrame(); // only build one building per delay loop break; - } // bldg built + } #else // force delay between rebuilds @@ -832,12 +832,12 @@ void AIPlayer::processBaseBuilding( void ) m_frameLastBuildingBuilt = TheGameLogic->getFrame(); // only build one building per delay loop break; - } // bldg built - } // have money - } // rebuild delay ok + } + } + } #endif - } // building missing - } // is buildable + } + } } } } @@ -1031,7 +1031,7 @@ Bool AIPlayer::isLocationSafe(const Coord3D *pos, const ThingTemplate *tthing ) } return true; -} // isSupplySourceSafe +} // ------------------------------------------------------------------------------------------------ @@ -1283,7 +1283,7 @@ Bool AIPlayer::startTraining( WorkOrder *order, Bool busyOK, AsciiString teamNam } return true; } - } // end if + } return FALSE; @@ -1322,9 +1322,9 @@ Object *AIPlayer::findFactory(const ThingTemplate *thing, Bool busyOK) Bool busy = pu->getProductionCount()>0; if (!busy) return factory; // found a not busy factory. if (busyOK) busyFactory = factory; - } // end if + } - } // end for + } // We didn't find an idle factory, so return the busy one. if (busyOK) return busyFactory; return NULL; @@ -1718,8 +1718,8 @@ void AIPlayer::buildUpgrade(const AsciiString &upgrade) TheScriptEngine->AppendDebugMessage( msg, false); return; } - } // end if - } // end for + } + } AsciiString msg = TheNameKeyGenerator->keyToName(m_player->getPlayerNameKey()); msg.concat(" lacks factory to build upgrade "); @@ -2964,7 +2964,7 @@ Object * AIPlayer::findDozer( const Coord3D *pos ) void AIPlayer::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -3007,9 +3007,9 @@ void AIPlayer::xfer( Xfer *xfer ) // xfer it xfer->xferSnapshot( teamInQueue ); - } // end for, iterate team build queue + } - } // end if, save + } else { @@ -3020,7 +3020,7 @@ void AIPlayer::xfer( Xfer *xfer ) DEBUG_CRASH(( "AIPlayer::xfer - TeamBuildQueue head is not NULL, you should delete it or something before loading a new list" )); throw SC_INVALID_DATA; - } // end if + } // ready all data for( UnsignedShort i = 0; i < teamBuildQueueCount; ++i ) @@ -3035,12 +3035,12 @@ void AIPlayer::xfer( Xfer *xfer ) // xfer data xfer->xferSnapshot( teamInQueue ); - } // end for, i + } // the list was loaded in reverse order, reverse the list so it's in the same order as before reverse_TeamBuildQueue(); - } // end else, load + } // team ready queue count UnsignedShort teamReadyQueueCount = 0; @@ -3066,9 +3066,9 @@ void AIPlayer::xfer( Xfer *xfer ) // xfer data xfer->xferSnapshot( teamReadyQueue ); - } // end for, iterate team ready queue + } - } // end if, save + } else { @@ -3079,7 +3079,7 @@ void AIPlayer::xfer( Xfer *xfer ) DEBUG_CRASH(( "AIPlayer::xfer - TeamReadyQueue head is not NULL, you should delete it or something before loading a new list" )); throw SC_INVALID_DATA; - } // end if + } // read all data for( UnsignedShort i = 0; i < teamReadyQueueCount; ++i ) @@ -3094,12 +3094,12 @@ void AIPlayer::xfer( Xfer *xfer ) // xfer data xfer->xferSnapshot( teamInQueue ); - } // end for, i + } // reverse the list since it was loaded in reverse order due to the prepend reverse_TeamReadyQueue(); - } // end else, load + } // xfer player index ... this is really just for sanity PlayerIndex playerIndex = m_player->getPlayerIndex(); @@ -3110,7 +3110,7 @@ void AIPlayer::xfer( Xfer *xfer ) DEBUG_CRASH(( "AIPlayer::xfer - player index mismatch" )); throw SC_INVALID_DATA; - } // end if + } // xfer the rest of the ai player data (it's pretty straight forward) xfer->xferBool( &m_readyToBuildTeam ); @@ -3140,7 +3140,7 @@ void AIPlayer::xfer( Xfer *xfer ) xfer->xferBool( &m_dozerIsRepairing ); xfer->xferInt( &m_bridgeTimer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -3148,7 +3148,7 @@ void AIPlayer::xfer( Xfer *xfer ) void AIPlayer::loadPostProcess( void ) { -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -3272,7 +3272,7 @@ void TeamInQueue::disband() void TeamInQueue::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -3305,9 +3305,9 @@ void TeamInQueue::xfer( Xfer *xfer ) // xfer work order data xfer->xferSnapshot( workOrder ); - } // end for + } - } // end if, save + } else { @@ -3318,7 +3318,7 @@ void TeamInQueue::xfer( Xfer *xfer ) DEBUG_CRASH(( "TeamInQueue::xfer - m_workOrders should be NULL but isn't. Perhaps you should blow it away before loading" )); throw SC_INVALID_DATA; - } // end if + } // load all work orders for( UnsignedShort i = 0; i < workOrderCount; ++i ) @@ -3340,14 +3340,14 @@ void TeamInQueue::xfer( Xfer *xfer ) last->m_next = workOrder; - } // end else + } // load work order data xfer->xferSnapshot( workOrder ); - } // end for, i + } - } // end else, load + } // xfer the rest of the team in queue data xfer->xferBool( &m_priorityBuild ); @@ -3361,7 +3361,7 @@ void TeamInQueue::xfer( Xfer *xfer ) xfer->xferBool( &m_reinforcement ); xfer->xferObjectID( &m_reinforcementID ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -3369,7 +3369,7 @@ void TeamInQueue::xfer( Xfer *xfer ) void TeamInQueue::loadPostProcess( void ) { -} // end loadPostProcess +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -3380,7 +3380,7 @@ void TeamInQueue::loadPostProcess( void ) WorkOrder::~WorkOrder() { -} // end WorkOrder +} // ------------------------------------------------------------------------------------------------ /** Verify factoryID still refers to an active object */ @@ -3399,7 +3399,7 @@ void WorkOrder::validateFactory( Player *thisPlayer ) m_factoryID = INVALID_ID; } -} // end validateFactory +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -3407,7 +3407,7 @@ void WorkOrder::validateFactory( Player *thisPlayer ) void WorkOrder::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -3443,7 +3443,7 @@ void WorkOrder::xfer( Xfer *xfer ) // is resource gatherer xfer->xferBool( &m_isResourceGatherer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -3451,7 +3451,7 @@ void WorkOrder::xfer( Xfer *xfer ) void WorkOrder::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index 19ff097f2e6..5564ceaf2be 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp @@ -258,7 +258,7 @@ void AISkirmishPlayer::processBaseBuilding( void ) } m_frameLastBuildingBuilt = TheGameLogic->getFrame(); // only build one building per delay loop - } // bldg built + } #else // force delay between rebuilds @@ -293,9 +293,9 @@ void AISkirmishPlayer::processBaseBuilding( void ) m_frameLastBuildingBuilt = TheGameLogic->getFrame(); // only build one building per delay loop break; - } // bldg built - } // have money - } // rebuild delay ok + } + } + } #endif } } @@ -332,7 +332,7 @@ Bool AISkirmishPlayer::startTraining( WorkOrder *order, Bool busyOK, AsciiString } return true; } - } // end if + } return FALSE; @@ -1171,7 +1171,7 @@ void AISkirmishPlayer::computeSuperweaponTarget(const SpecialPowerTemplate *powe void AISkirmishPlayer::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1213,7 +1213,7 @@ void AISkirmishPlayer::xfer( Xfer *xfer ) // right flank right defense angle xfer->xferReal( &m_curRightFlankRightDefenseAngle ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1221,5 +1221,5 @@ void AISkirmishPlayer::xfer( Xfer *xfer ) void AISkirmishPlayer::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 88649001810..71345c48d94 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -229,7 +229,7 @@ static Bool isSamePosition( const Coord3D *ourPos, const Coord3D *prevTargetPos, void AttackStateMachine::crc( Xfer *xfer ) { StateMachine::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -241,7 +241,7 @@ void AttackStateMachine::xfer( Xfer *xfer ) xfer->xferVersion( &v, cv ); StateMachine::xfer(xfer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -249,7 +249,7 @@ void AttackStateMachine::xfer( Xfer *xfer ) void AttackStateMachine::loadPostProcess( void ) { StateMachine::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- static Bool inWeaponRangeObject(State *thisState, void* userData); @@ -470,7 +470,7 @@ AIRappelState::AIRappelState( StateMachine *machine ) : State( machine, "AIRappe // ------------------------------------------------------------------------------------------------ void AIRappelState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -485,14 +485,14 @@ void AIRappelState::xfer( Xfer *xfer ) xfer->xferReal(&m_rappelRate); xfer->xferReal(&m_destZ); xfer->xferBool(&m_targetIsBldg); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIRappelState::loadPostProcess( void ) { -} // end loadPostProcess +} //----------------------------------------------------------------------------------------------------------- StateReturnType AIRappelState::onEnter() { @@ -736,7 +736,7 @@ AIStateMachine::~AIStateMachine() void AIStateMachine::crc( Xfer *xfer ) { StateMachine::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -802,7 +802,7 @@ void AIStateMachine::xfer( Xfer *xfer ) } xfer->xferUnsignedInt(&m_temporaryStateFramEnd); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -810,7 +810,7 @@ void AIStateMachine::xfer( Xfer *xfer ) void AIStateMachine::loadPostProcess( void ) { StateMachine::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- /** @@ -1270,7 +1270,7 @@ AIIdleState::AIIdleState( StateMachine *machine, AIIdleState::AIIdleTargetingTyp // ------------------------------------------------------------------------------------------------ void AIIdleState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1285,14 +1285,14 @@ void AIIdleState::xfer( Xfer *xfer ) xfer->xferUnsignedShort(&m_initialSleepOffset); xfer->xferBool(&m_shouldLookForTargets); xfer->xferBool(&m_inited); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIIdleState::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------- /** * Stake out our space. @@ -1451,7 +1451,7 @@ StateReturnType AIIdleState::update() m_initialSleepOffset = oldSleepOffset; } } - } // end if, should look for targets + } return STATE_SLEEP(timeToSleep); } @@ -1537,7 +1537,7 @@ void AIDeadState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void AIInternalMoveToState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1557,7 +1557,7 @@ void AIInternalMoveToState::xfer( Xfer *xfer ) xfer->xferUnsignedInt(&m_pathTimestamp); xfer->xferUnsignedInt(&m_blockedRepathTimestamp); xfer->xferBool(&m_adjustDestinations); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1565,7 +1565,7 @@ void AIInternalMoveToState::xfer( Xfer *xfer ) void AIInternalMoveToState::loadPostProcess( void ) { startMoveSound(); -} // end loadPostProcess +} Bool AIInternalMoveToState::getAdjustsDestination() const { @@ -1917,7 +1917,7 @@ class AIAttackMoveStateMachine : public StateMachine void AIAttackMoveStateMachine::crc( Xfer *xfer ) { StateMachine::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1929,7 +1929,7 @@ void AIAttackMoveStateMachine::xfer( Xfer *xfer ) xfer->xferVersion( &v, cv ); StateMachine::xfer(xfer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1937,7 +1937,7 @@ void AIAttackMoveStateMachine::xfer( Xfer *xfer ) void AIAttackMoveStateMachine::loadPostProcess( void ) { StateMachine::loadPostProcess(); -} // end loadPostProcess +} //----------------------------------------------------------------------------------------------------------- AIAttackMoveStateMachine::AIAttackMoveStateMachine(Object *owner, AsciiString name) : StateMachine(owner, name) @@ -2136,7 +2136,7 @@ void AIMoveOutOfTheWayState::onExit( StateExitType status ) void AIMoveAndTightenState::crc( Xfer *xfer ) { AIInternalMoveToState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -2152,7 +2152,7 @@ void AIMoveAndTightenState::xfer( Xfer *xfer ) AIInternalMoveToState::xfer(xfer); xfer->xferInt(&m_okToRepathTimes); xfer->xferBool(&m_checkForPath); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -2160,7 +2160,7 @@ void AIMoveAndTightenState::xfer( Xfer *xfer ) void AIMoveAndTightenState::loadPostProcess( void ) { AIInternalMoveToState::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIMoveAndTightenState::onEnter() @@ -2459,7 +2459,7 @@ Bool AIAttackApproachTargetState::computePath() void AIAttackApproachTargetState::crc( Xfer *xfer ) { AIInternalMoveToState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -2480,7 +2480,7 @@ void AIAttackApproachTargetState::xfer( Xfer *xfer ) xfer->xferBool(&m_isAttackingObject); xfer->xferBool(&m_stopIfInRange); xfer->xferBool(&m_isInitialApproach); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -2489,7 +2489,7 @@ void AIAttackApproachTargetState::loadPostProcess( void ) { // extend base class AIInternalMoveToState::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIAttackApproachTargetState::onEnter() @@ -2814,7 +2814,7 @@ Bool AIAttackPursueTargetState::computePath() void AIAttackPursueTargetState::crc( Xfer *xfer ) { AIInternalMoveToState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -2835,7 +2835,7 @@ void AIAttackPursueTargetState::xfer( Xfer *xfer ) xfer->xferBool(&m_isAttackingObject); xfer->xferBool(&m_stopIfInRange); xfer->xferBool(&m_isInitialApproach); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -2844,7 +2844,7 @@ void AIAttackPursueTargetState::loadPostProcess( void ) { // extend base class AIInternalMoveToState::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIAttackPursueTargetState::onEnter() @@ -3042,7 +3042,7 @@ Bool AIPickUpCrateState::computePath() void AIPickUpCrateState::crc( Xfer *xfer ) { AIInternalMoveToState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -3060,7 +3060,7 @@ void AIPickUpCrateState::xfer( Xfer *xfer ) xfer->xferInt(&m_delayCounter); xfer->xferCoord3D(&m_goalPosition); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -3069,7 +3069,7 @@ void AIPickUpCrateState::loadPostProcess( void ) { // extend base class AIInternalMoveToState::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIPickUpCrateState::onEnter() @@ -3120,7 +3120,7 @@ StateReturnType AIPickUpCrateState::update() void AIFollowPathState::crc( Xfer *xfer ) { AIInternalMoveToState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -3137,7 +3137,7 @@ void AIFollowPathState::xfer( Xfer *xfer ) xfer->xferInt(&m_index); xfer->xferBool(&m_adjustFinal); xfer->xferBool(&m_adjustFinalOverride); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -3145,7 +3145,7 @@ void AIFollowPathState::xfer( Xfer *xfer ) void AIFollowPathState::loadPostProcess( void ) { AIInternalMoveToState::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIFollowPathState::onEnter() @@ -3322,7 +3322,7 @@ StateReturnType AIFollowPathState::update() void AIMoveAndEvacuateState::crc( Xfer *xfer ) { AIInternalMoveToState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -3337,7 +3337,7 @@ void AIMoveAndEvacuateState::xfer( Xfer *xfer ) AIInternalMoveToState::xfer(xfer); xfer->xferCoord3D(&m_origin); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -3345,7 +3345,7 @@ void AIMoveAndEvacuateState::xfer( Xfer *xfer ) void AIMoveAndEvacuateState::loadPostProcess( void ) { AIInternalMoveToState::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIMoveAndEvacuateState::onEnter() @@ -3428,7 +3428,7 @@ AIAttackMoveToState::~AIAttackMoveToState() // ------------------------------------------------------------------------------------------------ void AIAttackMoveToState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -3448,14 +3448,14 @@ void AIAttackMoveToState::xfer( Xfer *xfer ) xfer->xferInt(&m_retryCount); } xfer->xferSnapshot(m_attackMoveMachine); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIAttackMoveToState::loadPostProcess( void ) { -} // end loadPostProcess +} #ifdef STATE_MACHINE_DEBUG //---------------------------------------------------------------------------------------------------------- @@ -3583,7 +3583,7 @@ StateReturnType AIAttackMoveToState::update() void AIMoveAndDeleteState::crc( Xfer *xfer ) { AIInternalMoveToState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -3598,7 +3598,7 @@ void AIMoveAndDeleteState::xfer( Xfer *xfer ) AIInternalMoveToState::xfer(xfer); xfer->xferBool(&m_appendGoalPosition); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -3606,7 +3606,7 @@ void AIMoveAndDeleteState::xfer( Xfer *xfer ) void AIMoveAndDeleteState::loadPostProcess( void ) { AIInternalMoveToState::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIMoveAndDeleteState::onEnter() @@ -3832,7 +3832,7 @@ void AIFollowWaypointPathState::computeGoal(Bool useGroupOffsets) void AIFollowWaypointPathState::crc( Xfer *xfer ) { AIInternalMoveToState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -3870,7 +3870,7 @@ void AIFollowWaypointPathState::xfer( Xfer *xfer ) } xfer->xferBool(&m_appendGoalPosition); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -3878,7 +3878,7 @@ void AIFollowWaypointPathState::xfer( Xfer *xfer ) void AIFollowWaypointPathState::loadPostProcess( void ) { AIInternalMoveToState::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIFollowWaypointPathState::onEnter() @@ -4132,7 +4132,7 @@ StateReturnType AIFollowWaypointPathState::update() void AIFollowWaypointPathExactState::crc( Xfer *xfer ) { AIInternalMoveToState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -4154,7 +4154,7 @@ void AIFollowWaypointPathExactState::xfer( Xfer *xfer ) { m_lastWaypoint = TheTerrainLogic->getWaypointByID(id); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -4162,7 +4162,7 @@ void AIFollowWaypointPathExactState::xfer( Xfer *xfer ) void AIFollowWaypointPathExactState::loadPostProcess( void ) { AIInternalMoveToState::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIFollowWaypointPathExactState::onEnter() @@ -4266,7 +4266,7 @@ AIAttackFollowWaypointPathState::~AIAttackFollowWaypointPathState() // ------------------------------------------------------------------------------------------------ void AIAttackFollowWaypointPathState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -4282,14 +4282,14 @@ void AIAttackFollowWaypointPathState::xfer( Xfer *xfer ) AIFollowWaypointPathState::xfer( xfer ); xfer->xferSnapshot(m_attackFollowMachine); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIAttackFollowWaypointPathState::loadPostProcess( void ) { -} // end loadPostProcess +} #ifdef STATE_MACHINE_DEBUG //---------------------------------------------------------------------------------------------------------- @@ -4400,7 +4400,7 @@ void AIAttackFollowWaypointPathState ::onExit( StateExitType status ) void AIWanderState::crc( Xfer *xfer ) { AIFollowWaypointPathState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -4416,7 +4416,7 @@ void AIWanderState::xfer( Xfer *xfer ) xfer->xferInt(&m_waitFrames); xfer->xferInt(&m_timer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -4424,7 +4424,7 @@ void AIWanderState::xfer( Xfer *xfer ) void AIWanderState::loadPostProcess( void ) { AIFollowWaypointPathState::loadPostProcess(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -4522,7 +4522,7 @@ void AIWanderState::onExit( StateExitType status ) void AIWanderInPlaceState::crc( Xfer *xfer ) { AIInternalMoveToState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -4539,7 +4539,7 @@ void AIWanderInPlaceState::xfer( Xfer *xfer ) xfer->xferCoord3D(&m_origin); xfer->xferInt(&m_waitFrames); xfer->xferInt(&m_timer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** LoadPostProcess */ @@ -4547,7 +4547,7 @@ void AIWanderInPlaceState::xfer( Xfer *xfer ) void AIWanderInPlaceState::loadPostProcess( void ) { AIInternalMoveToState::loadPostProcess(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ StateReturnType AIWanderInPlaceState::onEnter() @@ -4632,7 +4632,7 @@ void AIWanderInPlaceState::onExit( StateExitType status ) void AIPanicState::crc( Xfer *xfer ) { AIFollowWaypointPathState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -4648,7 +4648,7 @@ void AIPanicState::xfer( Xfer *xfer ) xfer->xferInt(&m_waitFrames); xfer->xferInt(&m_timer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -4656,7 +4656,7 @@ void AIPanicState::xfer( Xfer *xfer ) void AIPanicState::loadPostProcess( void ) { AIFollowWaypointPathState::loadPostProcess(); -} // end loadPostProcess +} /** * Panic and run screaming along a waypoint path. @@ -4757,7 +4757,7 @@ void AIPanicState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void AIAttackAimAtTargetState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -4772,14 +4772,14 @@ void AIAttackAimAtTargetState::xfer( Xfer *xfer ) xfer->xferBool(&m_canTurnInPlace); xfer->xferBool(&m_setLocomotor); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIAttackAimAtTargetState::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIAttackAimAtTargetState::onEnter() @@ -5201,7 +5201,7 @@ AIAttackState::~AIAttackState() // ------------------------------------------------------------------------------------------------ void AIAttackState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -5231,7 +5231,7 @@ void AIAttackState::xfer( Xfer *xfer ) AttackExitConditionsInterface* m_attackParameters; ///< these are not owned by this, and will not be deleted on destruction Bool m_isForceAttacking */ -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -5245,7 +5245,7 @@ void AIAttackState::loadPostProcess( void ) } Object* source = getMachineOwner(); m_lockedWeaponOnEnter = source->isCurWeaponLocked() ? source->getCurrentWeapon() : NULL; -} // end loadPostProcess +} #ifdef STATE_MACHINE_DEBUG //---------------------------------------------------------------------------------------------------------- @@ -5536,7 +5536,7 @@ class AIAttackThenIdleStateMachine : public StateMachine void AIAttackThenIdleStateMachine::crc( Xfer *xfer ) { StateMachine::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -5548,7 +5548,7 @@ void AIAttackThenIdleStateMachine::xfer( Xfer *xfer ) xfer->xferVersion( &v, cv ); StateMachine::xfer(xfer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -5556,7 +5556,7 @@ void AIAttackThenIdleStateMachine::xfer( Xfer *xfer ) void AIAttackThenIdleStateMachine::loadPostProcess( void ) { StateMachine::loadPostProcess(); -} // end loadPostProcess +} //----------------------------------------------------------------------------------------------------------- AIAttackThenIdleStateMachine::AIAttackThenIdleStateMachine(Object *owner, AsciiString name) : StateMachine(owner, name) @@ -5590,7 +5590,7 @@ AIAttackSquadState::~AIAttackSquadState() // ------------------------------------------------------------------------------------------------ void AIAttackSquadState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -5614,14 +5614,14 @@ void AIAttackSquadState::xfer( Xfer *xfer ) if (hasMachine) { xfer->xferSnapshot(m_attackSquadMachine); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIAttackSquadState::loadPostProcess( void ) { -} // end loadPostProcess +} #ifdef STATE_MACHINE_DEBUG //---------------------------------------------------------------------------------------------------------- @@ -5824,7 +5824,7 @@ AIDockState::~AIDockState() // ------------------------------------------------------------------------------------------------ void AIDockState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -5848,14 +5848,14 @@ void AIDockState::xfer( Xfer *xfer ) xfer->xferSnapshot(m_dockMachine); } xfer->xferBool(&m_usingPrecisionMovement); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIDockState::loadPostProcess( void ) { -} // end loadPostProcess +} #ifdef STATE_MACHINE_DEBUG //---------------------------------------------------------------------------------------------------------- @@ -5976,7 +5976,7 @@ StateReturnType AIDockState::update() void AIEnterState::crc( Xfer *xfer ) { AIInternalMoveToState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -5991,7 +5991,7 @@ void AIEnterState::xfer( Xfer *xfer ) AIInternalMoveToState::xfer(xfer); xfer->xferObjectID(&m_entryToClear); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -5999,7 +5999,7 @@ void AIEnterState::xfer( Xfer *xfer ) void AIEnterState::loadPostProcess( void ) { AIInternalMoveToState::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIEnterState::onEnter() @@ -6184,7 +6184,7 @@ StateReturnType AIEnterState::update() // ------------------------------------------------------------------------------------------------ void AIExitState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -6197,14 +6197,14 @@ void AIExitState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferObjectID(&m_entryToClear); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIExitState::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIExitState::onEnter() @@ -6320,7 +6320,7 @@ AsciiString AIGuardState::getName( ) const // ------------------------------------------------------------------------------------------------ void AIGuardState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -6344,14 +6344,14 @@ void AIGuardState::xfer( Xfer *xfer ) xfer->xferSnapshot(m_guardMachine); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIGuardState::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- /** @@ -6446,7 +6446,7 @@ AsciiString AITunnelNetworkGuardState::getName( ) const // ------------------------------------------------------------------------------------------------ void AITunnelNetworkGuardState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -6470,14 +6470,14 @@ void AITunnelNetworkGuardState::xfer( Xfer *xfer ) xfer->xferSnapshot(m_guardMachine); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AITunnelNetworkGuardState::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- /** @@ -6560,7 +6560,7 @@ AIHuntState::~AIHuntState() // ------------------------------------------------------------------------------------------------ void AIHuntState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -6585,14 +6585,14 @@ void AIHuntState::xfer( Xfer *xfer ) } xfer->xferUnsignedInt(&m_nextEnemyScanTime); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIHuntState::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- /** @@ -6756,7 +6756,7 @@ AIAttackAreaState::~AIAttackAreaState() // ------------------------------------------------------------------------------------------------ void AIAttackAreaState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -6781,14 +6781,14 @@ void AIAttackAreaState::xfer( Xfer *xfer ) } xfer->xferUnsignedInt(&m_nextEnemyScanTime); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIAttackAreaState::loadPostProcess( void ) { -} // end loadPostProcess +} #ifdef STATE_MACHINE_DEBUG //---------------------------------------------------------------------------------------------------------- @@ -6890,7 +6890,7 @@ StateReturnType AIAttackAreaState::update() // ------------------------------------------------------------------------------------------------ void AIFaceState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -6903,7 +6903,7 @@ void AIFaceState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferBool(&m_canTurnInPlace); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -6911,7 +6911,7 @@ void AIFaceState::xfer( Xfer *xfer ) void AIFaceState::loadPostProcess( void ) { // empty. jba. -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIFaceState::onEnter() diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp index ec2ec20aa95..19aa957d386 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp @@ -263,7 +263,7 @@ Bool AITNGuardMachine::lookForInnerTarget(void) // ------------------------------------------------------------------------------------------------ void AITNGuardMachine::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -282,14 +282,14 @@ void AITNGuardMachine::xfer( Xfer *xfer ) xfer->xferObjectID(&m_nemesisToAttack); xfer->xferCoord3D(&m_positionToGuard); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AITNGuardMachine::loadPostProcess( void ) { -} // end loadPostProcess +} //-- AITNGuardInnerState ---------------------------------------------------------------------------- // ------------------------------------------------------------------------------------------------ @@ -297,7 +297,7 @@ void AITNGuardMachine::loadPostProcess( void ) // ------------------------------------------------------------------------------------------------ void AITNGuardInnerState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -309,7 +309,7 @@ void AITNGuardInnerState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -317,7 +317,7 @@ void AITNGuardInnerState::xfer( Xfer *xfer ) void AITNGuardInnerState::loadPostProcess( void ) { onEnter(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ AITNGuardInnerState::~AITNGuardInnerState(void) @@ -441,7 +441,7 @@ void AITNGuardInnerState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void AITNGuardOuterState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -453,7 +453,7 @@ void AITNGuardOuterState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -461,7 +461,7 @@ void AITNGuardOuterState::xfer( Xfer *xfer ) void AITNGuardOuterState::loadPostProcess( void ) { AITNGuardOuterState onEnter(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ AITNGuardOuterState::~AITNGuardOuterState(void) @@ -545,7 +545,7 @@ void AITNGuardOuterState::onExit( StateExitType status ) void AITNGuardReturnState::crc( Xfer *xfer ) { AIEnterState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -560,7 +560,7 @@ void AITNGuardReturnState::xfer( Xfer *xfer ) AIEnterState::xfer(xfer); xfer->xferUnsignedInt(&m_nextReturnScanTime); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -568,7 +568,7 @@ void AITNGuardReturnState::xfer( Xfer *xfer ) void AITNGuardReturnState::loadPostProcess( void ) { AIEnterState::loadPostProcess(); -} // end loadPostProcess +} //-------------------------------------------------------------------------------------- StateReturnType AITNGuardReturnState::onEnter( void ) @@ -639,7 +639,7 @@ void AITNGuardReturnState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void AITNGuardIdleState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -652,14 +652,14 @@ void AITNGuardIdleState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUnsignedInt(&m_nextEnemyScanTime); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AITNGuardIdleState::loadPostProcess( void ) { -} // end loadPostProcess +} //-------------------------------------------------------------------------------------- StateReturnType AITNGuardIdleState::onEnter( void ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/Squad.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/Squad.cpp index 4d6375bcb49..5bce21b66ba 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/Squad.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/Squad.cpp @@ -193,7 +193,7 @@ void Squad::aiGroupFromSquad(AIGroup* aiGroupToFill) void Squad::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -226,9 +226,9 @@ void Squad::xfer( Xfer *xfer ) objectID = *it; xfer->xferObjectID( &objectID ); - } // end for, it + } - } // end if, save + } else { @@ -239,7 +239,7 @@ void Squad::xfer( Xfer *xfer ) DEBUG_CRASH(( "Squad::xfer - m_objectsCached should be emtpy, but is not" )); throw SC_INVALID_DATA; - } // end of + } // read all items for( UnsignedShort i = 0; i < objectCount; ++i ) @@ -251,11 +251,11 @@ void Squad::xfer( Xfer *xfer ) // put on list m_objectIDs.push_back( objectID ); - } // end for, i + } - } // end else, load + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -263,4 +263,4 @@ void Squad::xfer( Xfer *xfer ) void Squad::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp index de336bae94c..3f2447f0aec 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp @@ -143,7 +143,7 @@ StateReturnType TurretStateMachine::setState(StateID newStateID) // ------------------------------------------------------------------------------------------------ void TurretStateMachine::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -154,14 +154,14 @@ void TurretStateMachine::xfer( Xfer *xfer ) XferVersion v = cv; xfer->xferVersion( &v, cv ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void TurretStateMachine::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------- @@ -329,7 +329,7 @@ TurretAI::~TurretAI() // ------------------------------------------------------------------------------------------------ void TurretAI::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -369,7 +369,7 @@ void TurretAI::xfer( Xfer *xfer ) if (version >= 2) xfer->xferUnsignedInt(&m_sleepUntil); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -380,7 +380,7 @@ void TurretAI::loadPostProcess( void ) if (victim) { m_victimInitialTeam = victim->getTeam(); } -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- Bool TurretAI::friend_turnTowardsAngle(Real desiredAngle, Real rateModifier, Real relThresh) @@ -721,7 +721,7 @@ UpdateSleepTime TurretAI::updateTurretAI() subMachineSleep = UPDATE_SLEEP_NONE; } - } // if enabled or recentering + } m_sleepUntil = now + subMachineSleep; @@ -1231,7 +1231,7 @@ void TurretAIRecenterTurretState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void TurretAIIdleState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1244,14 +1244,14 @@ void TurretAIIdleState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUnsignedInt(&m_nextIdleScan); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void TurretAIIdleState::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- void TurretAIIdleState::resetIdleScan() @@ -1265,7 +1265,6 @@ void TurretAIIdleState::resetIdleScan() StateReturnType TurretAIIdleState::onEnter() { AIUpdateInterface *ai = getMachineOwner()->getAIUpdateInterface(); - // ai doesn't exist if the object was just created this frame. if (ai) { ai->resetNextMoodCheckTime(); @@ -1309,7 +1308,7 @@ StateReturnType TurretAIIdleState::update() // ------------------------------------------------------------------------------------------------ void TurretAIIdleScanState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1322,14 +1321,14 @@ void TurretAIIdleScanState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferReal(&m_desiredAngle); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void TurretAIIdleScanState::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType TurretAIIdleScanState::onEnter() @@ -1381,7 +1380,7 @@ void TurretAIIdleScanState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void TurretAIHoldTurretState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1394,14 +1393,14 @@ void TurretAIHoldTurretState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUnsignedInt(&m_timestamp); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void TurretAIHoldTurretState::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType TurretAIHoldTurretState::onEnter() diff --git a/Generals/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp b/Generals/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp index 7cb1b8bb792..e3f58bb3eaf 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp @@ -497,7 +497,7 @@ Bool PolygonTrigger::isValid(void) const void PolygonTrigger::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -526,7 +526,7 @@ void PolygonTrigger::xfer( Xfer *xfer ) // xfer point xfer->xferICoord3D( point ); - } // end for, i + } // bounds xfer->xferIRegion2D( &m_bounds ); @@ -537,7 +537,7 @@ void PolygonTrigger::xfer( Xfer *xfer ) // bounds need update xfer->xferBool( &m_boundsNeedsUpdate ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -545,4 +545,4 @@ void PolygonTrigger::xfer( Xfer *xfer ) void PolygonTrigger::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp b/Generals/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp index eaf5bd54268..1385c48fa23 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp @@ -832,7 +832,7 @@ Bool SidesList::validateSides() void SidesList::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -856,7 +856,7 @@ void SidesList::xfer( Xfer *xfer ) DEBUG_CRASH(( "SidesList::xfer - The sides list size has changed, this was not supposed to happen, you must version this method and figure out how to translate between old and new versions now" )); throw SC_INVALID_DATA; - } // end if + } // side data ScriptList *scriptList; @@ -875,13 +875,13 @@ void SidesList::xfer( Xfer *xfer ) DEBUG_CRASH(( "SidesList::xfer - script list missing/present mismatch" )); throw SC_INVALID_DATA; - } // end if + } if( scriptListPresent ) xfer->xferSnapshot( scriptList ); - } // end for i + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -889,7 +889,7 @@ void SidesList::xfer( Xfer *xfer ) void SidesList::loadPostProcess( void ) { -} // end loadPostProcess +} /* ********* BuildListInfo class ****************************/ /** @@ -1000,7 +1000,7 @@ BuildListInfo *BuildListInfo::duplicate(void) void BuildListInfo::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1042,7 +1042,7 @@ void BuildListInfo::xfer( Xfer *xfer ) xfer->xferInt(&m_currentGatherers); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1050,7 +1050,7 @@ void BuildListInfo::xfer( Xfer *xfer ) void BuildListInfo::loadPostProcess( void ) { -} // end loadPostProcess +} /* ********* TeamsInfoRec class ****************************/ TeamsInfoRec::TeamsInfoRec() : diff --git a/Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp index a91b6608726..a236a373037 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp @@ -86,14 +86,14 @@ m_biDirectional(biDirectional) for (i=0; inewObject( towerTemplate, bridge->getTeam() ); @@ -169,7 +169,7 @@ Object *Bridge::createTower( Coord3D *worldPos, DEBUG_CRASH(( "Bridge::createTower - Unknown bridge tower type '%d'", towerType )); return NULL; - } // end switch + } // set the position and angle tower->setPosition( worldPos ); @@ -193,7 +193,7 @@ Object *Bridge::createTower( Coord3D *worldPos, // save our position type bridgeTowerInterface->setTowerType( towerType ); - } // end if + } // if the bridge is indestructible, so is this tower BodyModuleInterface *bridgeBody = bridge->getBodyModule(); @@ -203,12 +203,12 @@ Object *Bridge::createTower( Coord3D *worldPos, towerBody->setIndestructible( TRUE ); - } // end if + } // return the newly created tower return tower; -} // end createTower +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -310,17 +310,17 @@ m_bridgeInfo(theInfo) pos.y -= v.y*offset; break; - } // end switch + } tower = createTower( &pos, type, towerTemplate, bridge ); // store the tower object ID m_bridgeInfo.towerObjectID[ i ] = tower->getID(); - } // end for, i + } #endif m_next = NULL; -} // end Bridge +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -423,7 +423,7 @@ Bridge::Bridge(Object *bridgeObj) pos.y -= v.y*offset; break; - } // end switch + } tower = createTower( &pos, type, towerTemplate, bridgeObj ); if( tower ) { @@ -431,17 +431,17 @@ Bridge::Bridge(Object *bridgeObj) m_bridgeInfo.towerObjectID[ i ] = tower->getID(); } - } // end for, i + } m_next = NULL; -} // end Bridge +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- Bridge::~Bridge() { -} // end ~Bridge +} //------------------------------------------------------------------------------------------------- @@ -542,7 +542,7 @@ Bool LineInRegion( const Coord2D *p1, const Coord2D *p2, const Region2D *clipReg if ((clipCode1 | clipCode2) == 0) { return TRUE; - } // end if + } // Both points outside window? if (clipCode1 & clipCode2) @@ -626,7 +626,7 @@ Bool LineInRegion( const Coord2D *p1, const Coord2D *p2, const Region2D *clipReg x2 >= clipLeft && x2 <= clipRight && y2 >= clipTop && y2 <= clipBottom); -} // end LineInRegion +} static Bool PointInRegion2D( const Coord3D *pt, const Region2D *clipRegion ) { @@ -973,7 +973,7 @@ TerrainLogic::TerrainLogic() m_waterToUpdate[ i ].damageAmount = 0.0f; m_waterToUpdate[ i ].currentHeight = 0.0f; - } // end for i + } m_numWaterToUpdate = 0; m_waypointListHead = NULL; @@ -984,7 +984,7 @@ TerrainLogic::TerrainLogic() m_mapDY = 0; -} // end TerrainLogic +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -993,7 +993,7 @@ TerrainLogic::~TerrainLogic() reset(); // just in case -} // end ~TerrainLogic +} //------------------------------------------------------------------------------------------------- /** Init */ @@ -1001,7 +1001,7 @@ TerrainLogic::~TerrainLogic() void TerrainLogic::init( void ) { -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset */ @@ -1014,7 +1014,7 @@ void TerrainLogic::reset( void ) PolygonTrigger::deleteTriggers(); m_numWaterToUpdate = 0; -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update */ @@ -1058,14 +1058,14 @@ void TerrainLogic::update( void ) if( currentHeight + changePerFrame >= targetHeight ) finalTransition = TRUE; - } // end if + } else { if( currentHeight + changePerFrame <= targetHeight ) finalTransition = TRUE; - } // end else + } if( finalTransition == TRUE ) { @@ -1085,7 +1085,7 @@ void TerrainLogic::update( void ) m_waterToUpdate[ i ] = m_waterToUpdate[ j ]; m_numWaterToUpdate -= 1; - } // end if + } else { @@ -1107,13 +1107,13 @@ void TerrainLogic::update( void ) // update actual water setWaterHeight( water, currentHeight, damageAmount, FALSE ); - } // end else + } - } // end for i + } - } // end if + } -} // end update +} //------------------------------------------------------------------------------------------------- /** newMap */ @@ -1139,7 +1139,7 @@ void TerrainLogic::newMap( Bool saveGame ) enable = TRUE; enableWaterGrid( enable ); -} // end newMap +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1170,7 +1170,7 @@ void TerrainLogic::enableWaterGrid( Bool enable ) waterSettingIndex = i; break; // exit for i - } // end if + } // // no exact map name (including path) was found, try to look for a match in just the @@ -1203,9 +1203,9 @@ void TerrainLogic::enableWaterGrid( Bool enable ) waterSettingIndex = i; break; // exit for i - } // end if + } - } // end for i + } // check for no match found if( waterSettingIndex == -1 ) @@ -1215,7 +1215,7 @@ void TerrainLogic::enableWaterGrid( Bool enable ) TheGlobalData->m_mapName.str() )); return; - } // end if + } TheTerrainVisual->setWaterGridHeightClamps( NULL, TheGlobalData->m_vertexWaterHeightClampLow[ waterSettingIndex ], @@ -1235,12 +1235,12 @@ void TerrainLogic::enableWaterGrid( Bool enable ) TheGlobalData->m_vertexWaterAttenuationC[ waterSettingIndex ], TheGlobalData->m_vertexWaterAttenuationRange[ waterSettingIndex ] ); - } // end if + } // notify the terrain visual of the change TheTerrainVisual->enableWaterGrid( enable ); -} // end enableWaterGrid +} //------------------------------------------------------------------------------------------------- /** device independent terrain logic load. If query is true, we are just loading it to get @@ -1316,7 +1316,7 @@ Bool TerrainLogic::loadMap( AsciiString filename, Bool query ) return TRUE; // success -} // end load +} //------------------------------------------------------------------------------------------------- /** Reads in the waypoint chunk */ @@ -1437,7 +1437,7 @@ Real TerrainLogic::getGroundHeight( Real x, Real y, Coord3D* normal ) const return 0; -} // end getHight +} //------------------------------------------------------------------------------------------------- /** default get height for terrain logic */ @@ -1449,7 +1449,7 @@ Real TerrainLogic::getLayerHeight( Real x, Real y, PathfindLayerEnum layer, Coor return 0; -} // end getLayerHeight +} //------------------------------------------------------------------------------------------------- /** default isCliffCell for terrain logic */ @@ -1459,7 +1459,7 @@ Bool TerrainLogic::isCliffCell( Real x, Real y) const return false; -} // end isCliffCell +} //------------------------------------------------------------------------------------------------- void makeAlignToNormalMatrix( Real angle, const Coord3D& pos, const Coord3D& normal, Matrix3D& mtx) @@ -2010,7 +2010,7 @@ void TerrainLogic::deleteBridge( Bridge *bridge ) m_bridgeListHead = bridge->getNext(); - } // end if + } else { @@ -2029,11 +2029,11 @@ void TerrainLogic::deleteBridge( Bridge *bridge ) otherBridge->setNext( bridge->getNext() ); break; // exit for - } // end if + } - } // end for, otherBridge + } - } // end else + } // delete object associated with bridge if present BridgeInfo bridgeInfo; @@ -2047,7 +2047,7 @@ void TerrainLogic::deleteBridge( Bridge *bridge ) // delete the bridge in question deleteInstance(bridge); -} // end deleteBridge +} //------------------------------------------------------------------------------------------------- /** Returns the ground aligned point on the bounding box closest to the given point*/ @@ -2200,11 +2200,11 @@ const WaterHandle* TerrainLogic::getWaterHandle( Real x, Real y ) waterZ = pTrig->getPoint( 0 )->z; waterHandle = pTrig->getWaterHandle(); - } // end if + } - } // end if + } - } // end for + } /**@todo: Remove this after we have all water types included in water triggers. For now do special check for water grid mesh. */ @@ -2224,13 +2224,13 @@ const WaterHandle* TerrainLogic::getWaterHandle( Real x, Real y ) waterZ = meshZ; waterHandle = &m_gridWaterHandle; - } // end if + } - } // end if + } return waterHandle; -} // end getWaterHandle +} // ------------------------------------------------------------------------------------------------ /** Get water handle by name assigned from the editor */ @@ -2250,7 +2250,7 @@ const WaterHandle* TerrainLogic::getWaterHandleByName( AsciiString name ) return NULL; -} // end getWaterHandleByName +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -2271,7 +2271,7 @@ Real TerrainLogic::getWaterHeight( const WaterHandle *water ) DEBUG_CRASH(( "TerrainLogic::getWaterHeight( WaterHandle *water ) - water is a grid handle, cannot make this query" )); return 0.0f; - } // end if + } // sanity DEBUG_ASSERTCRASH( water->m_polygon != NULL, ("getWaterHeight: polygon trigger in water handle is NULL") ); @@ -2279,7 +2279,7 @@ Real TerrainLogic::getWaterHeight( const WaterHandle *water ) // return the height of the water using the polygon trigger return water->m_polygon->getPoint( 0 )->z; -} // end getWaterHeight +} // ------------------------------------------------------------------------------------------------ /** Set the water height. If the water rises, then any objects that now find themselves @@ -2314,7 +2314,7 @@ void TerrainLogic::setWaterHeight( const WaterHandle *water, Real height, Real d transform.Set_Z_Translation( height ); TheTerrainVisual->setWaterTransform( &transform ); - } // end if + } else { @@ -2334,10 +2334,10 @@ void TerrainLogic::setWaterHeight( const WaterHandle *water, Real height, Real d newPoint.z = height; water->m_polygon->setPoint( newPoint, i ); - } // end for + } height = getWaterHeight(water); - } // end else + } // find the bounding rectangle of this water area Region3D affectedRegion; @@ -2351,7 +2351,7 @@ void TerrainLogic::setWaterHeight( const WaterHandle *water, Real height, Real d // do the pathfind remapping TheAI->pathfinder()->forceMapRecalculation(); - } // end if + } // // if the water height has risen, we need apply water damage to things that are now @@ -2396,13 +2396,13 @@ void TerrainLogic::setWaterHeight( const WaterHandle *water, Real height, Real d damageInfo.in.m_amount = damageAmount; obj->attemptDamage( &damageInfo ); - } // end if + } - } // end for obj + } - } // end if, water has risen + } -} // end setWaterHeight +} // ------------------------------------------------------------------------------------------------ /** Change the height of a water table over time */ @@ -2420,7 +2420,7 @@ void TerrainLogic::changeWaterHeightOverTime( const WaterHandle *water, DEBUG_CRASH(( "Only '%d' simultaneous water table changes are supported", MAX_DYNAMIC_WATER )); return; - } // end if + } // sanity if( water == NULL ) @@ -2445,9 +2445,9 @@ void TerrainLogic::changeWaterHeightOverTime( const WaterHandle *water, // --i; - } // end if + } - } // end for i + } // get the current height of the water Real currentHeight = getWaterHeight( water ); @@ -2463,7 +2463,7 @@ void TerrainLogic::changeWaterHeightOverTime( const WaterHandle *water, // we now have one more entry to update ++m_numWaterToUpdate; -} // end chanageWaterHeightOverTime +} // ------------------------------------------------------------------------------------------------ /** Find the axis aligned bounding region around a water table */ @@ -2521,9 +2521,9 @@ void TerrainLogic::findAxisAlignedBoundingRect( const WaterHandle *water, Region if( v.Y > region->hi.y ) region->hi.y = v.Y; - } // end for i + } - } // end if + } else { @@ -2552,11 +2552,11 @@ void TerrainLogic::findAxisAlignedBoundingRect( const WaterHandle *water, Region if( p->z > region->hi.z ) region->hi.z = p->z; - } // end for i + } - } // end else + } -} // end findAxisAlignedBoundingRect +} void TerrainLogic::setActiveBoundary(Int newActiveBoundary) { @@ -2840,9 +2840,9 @@ void TerrainLogic::flattenTerrain(Object *obj) } } - } // cylinder + } break; - } // switch + } } @@ -2852,7 +2852,7 @@ void TerrainLogic::flattenTerrain(Object *obj) void TerrainLogic::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer @@ -2894,7 +2894,7 @@ void TerrainLogic::xfer( Xfer *xfer ) Int triggerID = m_waterToUpdate[ i ].waterTable->m_polygon->getID(); xfer->xferInt( &triggerID ); - } // end if, save + } else if (xfer->getXferMode() == XFER_LOAD) { @@ -2913,7 +2913,7 @@ void TerrainLogic::xfer( Xfer *xfer ) triggerID )); throw SC_INVALID_DATA; - } // end if + } // set water handle m_waterToUpdate[ i ].waterTable = poly->getWaterHandle(); @@ -2925,9 +2925,9 @@ void TerrainLogic::xfer( Xfer *xfer ) DEBUG_CRASH(( "TerrainLogic::xfer - Polygon trigger to use for water handle has no water handle!" )); throw SC_INVALID_DATA; - } // end if + } - } // end else, load + } // change per frame xfer->xferReal( &m_waterToUpdate[ i ].changePerFrame ); @@ -2941,11 +2941,11 @@ void TerrainLogic::xfer( Xfer *xfer ) // current height xfer->xferReal( &m_waterToUpdate[ i ].currentHeight ); - } // end for, i + } - } // end if + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -2965,5 +2965,5 @@ void TerrainLogic::loadPostProcess( void ) pBridge = pNext; } -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/AutoHealBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/AutoHealBehavior.cpp index 156b3a1f81a..f491ab5fd5f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/AutoHealBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/AutoHealBehavior.cpp @@ -268,7 +268,7 @@ UpdateSleepTime AutoHealBehavior::update( void ) } } - } // end for obj + } return UPDATE_SLEEP( d->m_singleBurst ? UPDATE_SLEEP_FOREVER : d->m_healingDelay ); } @@ -314,7 +314,7 @@ void AutoHealBehavior::crc( Xfer *xfer ) // extend base class UpgradeMux::upgradeMuxCRC( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -344,7 +344,7 @@ void AutoHealBehavior::xfer( Xfer *xfer ) // stopped xfer->xferBool( &m_stopped ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -358,4 +358,4 @@ void AutoHealBehavior::loadPostProcess( void ) // extend base class UpgradeMux::upgradeMuxLoadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BehaviorModule.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BehaviorModule.cpp index 8d7f761aa68..4a6e980ea5f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BehaviorModule.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BehaviorModule.cpp @@ -41,7 +41,7 @@ void BehaviorModule::crc( Xfer *xfer ) // call base class ObjectModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -59,7 +59,7 @@ void BehaviorModule::xfer( Xfer *xfer ) // call base class ObjectModule::xfer( xfer ); -} // xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -70,4 +70,4 @@ void BehaviorModule::loadPostProcess( void ) // call base class ObjectModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp index 02c010dfc16..4437eb20ab1 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp @@ -62,7 +62,7 @@ BridgeBehaviorModuleData::BridgeBehaviorModuleData( void ) m_lateralScaffoldSpeed = 1.0f; m_verticalScaffoldSpeed = 1.0f; -} // end BridgeBehaviorModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -75,7 +75,7 @@ BridgeBehaviorModuleData::~BridgeBehaviorModuleData( void ) // clear the ocl list m_ocl.clear(); -} // end ~BridgeBehaviorModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -94,7 +94,7 @@ BridgeBehaviorModuleData::~BridgeBehaviorModuleData( void ) p.add( dataFieldParse ); -} // end buildFieldParse +} // ------------------------------------------------------------------------------------------------ /** Parse time and location info in the form of: @@ -112,7 +112,7 @@ static void parseTimeAndLocationInfo( INI *ini, void *instance, DEBUG_CRASH(( "Expected 'Delay' token, found '%s'", token )); throw INI_INVALID_DATA; - } // end if + } // delay value ini->parseDurationUnsignedInt( ini, instance, &timeAndLocationInfo->delay, NULL ); @@ -129,14 +129,14 @@ static void parseTimeAndLocationInfo( INI *ini, void *instance, DEBUG_CRASH(( "Expected 'Bone' token, found '%s'", token )); throw INI_INVALID_DATA; - } // end if + } // read bone name and store timeAndLocationInfo->boneName = ini->getNextAsciiString(); - } // end if + } -} // end parseTimeAndLocationInfo +} //------------------------------------------------------------------------------------------------- // ------------------------------------------------------------------------------------------------ @@ -162,7 +162,7 @@ static void parseTimeAndLocationInfo( INI *ini, void *instance, DEBUG_CRASH(( "Expected 'FX' token, found '%s'", token )); throw INI_INVALID_DATA; - } // end if + } // fx list name and store as pointer FXList *fx; @@ -177,7 +177,7 @@ static void parseTimeAndLocationInfo( INI *ini, void *instance, // put on list bridgeFXList->push_back( item ); -} // end parseFX +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -203,7 +203,7 @@ static void parseTimeAndLocationInfo( INI *ini, void *instance, DEBUG_CRASH(( "Expected 'OCL' token, found '%s'", token )); throw INI_INVALID_DATA; - } // end if + } // fx list name and store as pointer ObjectCreationList *ocl; @@ -218,7 +218,7 @@ static void parseTimeAndLocationInfo( INI *ini, void *instance, // put on list bridgeOCLList->push_back( item ); -} // end parseOCL +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -249,17 +249,17 @@ BridgeBehavior::BridgeBehavior( Thing *thing, const ModuleData *moduleData ) m_repairToOCL[ bodyState ][ i ] = NULL; m_repairToFX[ bodyState ][ i ] = NULL; - } // end for i + } // these don't need initialization, they have constructors // m_damageToSound[ bodyState ] = ??? // m_repairToSound[ bodyState ] = ??? - } // end for, bodyState + } m_deathFrame = 0; -} // end BridgeBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -280,9 +280,9 @@ BridgeBehavior::~BridgeBehavior( void ) if( tower ) TheGameLogic->destroyObject( tower ); - } // end for i + } -} // end ~BridgeBehavior +} // ------------------------------------------------------------------------------------------------ /** Get bridge behavior interface */ @@ -303,12 +303,12 @@ BridgeBehavior::~BridgeBehavior( void ) if( bbi ) return bbi; - } // end for, bmi + } // interface not found return NULL; -} // end getBridgeBehaviorInterfaceFromObject +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -318,7 +318,7 @@ void BridgeBehavior::onDelete( void ) // clear the list of scaffold objects m_scaffoldObjectIDList.clear(); -} // end onDelete +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -369,7 +369,7 @@ void BridgeBehavior::resolveFX( void ) if( name.isEmpty() == FALSE && m_repairToFX[ bodyState ][ i ] == NULL ) DEBUG_CRASH(( "FX list '%s' not found", name.str() )); - } // end for i + } // audio sounds name = bridgeTemplate->getDamageToSoundString( (BodyDamageType)bodyState ); @@ -380,12 +380,12 @@ void BridgeBehavior::resolveFX( void ) m_repairToSound[ bodyState ].setEventName( name ); m_repairToSound[ bodyState ].setObjectID( us->getID() ); - } // end for, bodyState + } // fx are now "resolved" m_fxResolved = TRUE; -} // end resolveFX +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -399,7 +399,7 @@ void BridgeBehavior::setTower( BridgeTowerType towerType, Object *tower ) DEBUG_CRASH(( "BridgeBehavior::setTower - Invalid tower type index '%d'", towerType )); return; - } // end if + } // store it if( tower ) @@ -407,7 +407,7 @@ void BridgeBehavior::setTower( BridgeTowerType towerType, Object *tower ) else m_towerID[ towerType ] = INVALID_ID; -} // end setTower +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -421,12 +421,12 @@ ObjectID BridgeBehavior::getTowerID( BridgeTowerType towerType ) DEBUG_CRASH(( "BridgeBehavior::setTower - Invalid tower type index '%d'", towerType )); return INVALID_ID; - } // end if + } // return the stored ID return m_towerID[ towerType ]; -} // end getTowerID +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -464,13 +464,13 @@ void BridgeBehavior::onDamage( DamageInfo *damageInfo ) towerDamage.in.m_deathType = damageInfo->in.m_deathType; tower->attemptDamage( &towerDamage ); - } // end if + } - } // end for i + } - } // end if + } -} // end onDamage +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -502,13 +502,13 @@ void BridgeBehavior::onHealing( DamageInfo *damageInfo ) BodyModuleInterface *towerBody = tower->getBodyModule(); tower->attemptHealing(healingPercentage * towerBody->getMaxHealth(), getObject()); - } // end if + } - } // end for i + } - } // end if + } -} // end onHealing +} // ------------------------------------------------------------------------------------------------ /** Pick a random surface spot on the bridge surface */ @@ -557,7 +557,7 @@ void BridgeBehavior::getRandomSurfacePosition( TerrainRoadType *bridgeTemplate, // pos->z += GameLogicRandomValueReal( 0.0f, bridgeTemplate->getTransitionEffectsHeight() ); -} // end getRandomSurfacePosition +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -591,7 +591,7 @@ void BridgeBehavior::doAreaEffects( TerrainRoadType *bridgeTemplate, getRandomSurfacePosition( bridgeTemplate, bridgeInfo, &pos ); FXList::doFXPos( fx, &pos ); - } // end if + } // pick spot in the bridge area and do OCL if( ocl ) @@ -600,11 +600,11 @@ void BridgeBehavior::doAreaEffects( TerrainRoadType *bridgeTemplate, getRandomSurfacePosition( bridgeTemplate, bridgeInfo, &pos ); ObjectCreationList::create( ocl, getObject(), &pos, NULL ); - } // end if + } - } // end for i + } -} // end doAreaEffects +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -641,7 +641,7 @@ void BridgeBehavior::onBodyDamageStateChange( const DamageInfo* damageInfo, DEBUG_CRASH(( "BridgeBehavior - Unable to find bridge" )); return; - } // end if + } // get the bridge template name AsciiString bridgeTemplateName = bridge->getBridgeTemplateName(); @@ -673,7 +673,7 @@ void BridgeBehavior::onBodyDamageStateChange( const DamageInfo* damageInfo, for( Int i = 0; i < MAX_BRIDGE_BODY_FX; i++ ) doAreaEffects( bridgeTemplate, bridge, m_repairToOCL[ newState ][ i ], m_repairToFX[ newState ][ i ] ); - } // end if + } else { @@ -683,7 +683,7 @@ void BridgeBehavior::onBodyDamageStateChange( const DamageInfo* damageInfo, for( Int i = 0; i < MAX_BRIDGE_BODY_FX; i++ ) doAreaEffects( bridgeTemplate, bridge, m_damageToOCL[ newState ][ i ], m_damageToFX[ newState ][ i ] ); - } // end else + } // update bridge damage states ///@todo this should be re-written, there no need for this looping bridge examination @@ -699,7 +699,7 @@ void BridgeBehavior::onBodyDamageStateChange( const DamageInfo* damageInfo, if( oldState == BODY_RUBBLE || newState == BODY_RUBBLE ) TheRadar->queueTerrainRefresh(); -} // end onBodyDamageStateChange +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -766,9 +766,9 @@ UpdateSleepTime BridgeBehavior::update( void ) // launch the fx list FXList::doFXPos( (*fxIt).fx, &pos ); - } // end if + } - } // end for, fxIt + } // see if there are any ocl visuals we need to execute BridgeOCLList::const_iterator oclIt; @@ -804,7 +804,7 @@ UpdateSleepTime BridgeBehavior::update( void ) // launch the effects just using the parent object for location info ObjectCreationList::create( (*oclIt).ocl, us, NULL ); - } // endif + } else { @@ -814,9 +814,9 @@ UpdateSleepTime BridgeBehavior::update( void ) // launch the fx list ObjectCreationList::create( (*oclIt).ocl, us, &pos, NULL ); - } // end else + } - } // end if, bone name not empty + } else { @@ -829,17 +829,17 @@ UpdateSleepTime BridgeBehavior::update( void ) // launch the fx list ObjectCreationList::create( (*oclIt).ocl, us, &pos, NULL ); - } // end else + } - } // end if + } - } // end for, oclIt + } - } // end if + } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -855,7 +855,7 @@ void BridgeBehavior::onDie( const DamageInfo *damageInfo ) if( tower ) tower->kill(); - } // end for, i + } // we need to handle anything that was on top of us now that we've been destroyed handleObjectsOnBridgeOnDie(); @@ -863,7 +863,7 @@ void BridgeBehavior::onDie( const DamageInfo *damageInfo ) // we have now died, record the death frame m_deathFrame = TheGameLogic->getFrame(); -} // end onDie +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -947,11 +947,11 @@ void BridgeBehavior::handleObjectsOnBridgeOnDie( void ) else other->kill(); - } // end for, other + } - } // end if, terrainBridge + } -} // end handleObjectsOnBridgeDie +} // ------------------------------------------------------------------------------------------------ /** Set all the position, angle, and speed data we need to for a single scaffold object */ @@ -1013,7 +1013,7 @@ void BridgeBehavior::setScaffoldData( Object *obj, Real verticalSpeed = modData->m_verticalScaffoldSpeed; scaffoldBehavior->setVerticalSpeed( verticalSpeed ); -} // end setScaffoldData +} // ------------------------------------------------------------------------------------------------ /** Start the bridge repair scaffolding. If we already have scaffolding this call @@ -1047,7 +1047,7 @@ void BridgeBehavior::createScaffolding( void ) DEBUG_CRASH(( "Unable to find bridge scaffold template" )); return; - } // end if + } // get thing template for scaffold support object AsciiString scaffoldSupportObjectName = bridgeTemplate->getScaffoldSupportObjectName(); @@ -1058,7 +1058,7 @@ void BridgeBehavior::createScaffolding( void ) DEBUG_CRASH(( "Unable to find bridge support scaffold template" )); return; - } // end if + } // how much space is going to be between each of the scaffold objects at their final positions Real spacing = scaffoldTemplate->getTemplateGeometryInfo().getMajorRadius() * 2.0f; @@ -1201,7 +1201,7 @@ void BridgeBehavior::createScaffolding( void ) // off to the next layer offset -= scaffoldSupportHeight; - } // end while + } // // now create the object from the "right" side of the bridge ... but note that @@ -1266,11 +1266,11 @@ void BridgeBehavior::createScaffolding( void ) // off to the next layer offset -= scaffoldSupportHeight; - } // end while + } - } // end if + } - } // end for i + } // scaffolding is now present m_scaffoldPresent = TRUE; @@ -1278,7 +1278,7 @@ void BridgeBehavior::createScaffolding( void ) // when scaffolding is present, a bridge cannot be used TheAI->pathfinder()->changeBridgeState( bridge->getLayer(), FALSE ); -} // end createScaffolding +} // ------------------------------------------------------------------------------------------------ /** Remove the bridge scaffolding. If we don't have any then this call is ignored */ @@ -1309,7 +1309,7 @@ void BridgeBehavior::removeScaffolding( void ) // reverse the motion scaffoldBehavior->reverseMotion(); - } // end for, it + } // clear our scaffold object list m_scaffoldObjectIDList.clear(); @@ -1328,9 +1328,9 @@ void BridgeBehavior::removeScaffolding( void ) if( bridge ) TheAI->pathfinder()->changeBridgeState( bridge->getLayer(), TRUE ); - } // end if + } -} // end removeScaffolding +} // ------------------------------------------------------------------------------------------------ /** Is any of the scaffolding in motion */ @@ -1358,12 +1358,12 @@ Bool BridgeBehavior::isScaffoldInMotion( void ) if( bsbi->getCurrentMotion() != STM_STILL ) return TRUE; - } // end for + } // not in motion return FALSE; -} // end isScaffoldInMotion +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -1374,7 +1374,7 @@ void BridgeBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1404,7 +1404,7 @@ void BridgeBehavior::xfer( Xfer *xfer ) // set new object ID in bridge info to us bridge->setBridgeObjectID( us->getID() ); - } // end if + } // xfer the tower object ids for( Int i = 0; i < BRIDGE_MAX_TOWERS; ++i ) @@ -1423,7 +1423,7 @@ void BridgeBehavior::xfer( Xfer *xfer ) for( Int i = 0; i < BRIDGE_MAX_TOWERS; ++i ) bridge->setTowerObjectID( m_towerID[ i ], (BridgeTowerType)i ); - } // end if + } // scaffold present flag xfer->xferBool( &m_scaffoldPresent ); @@ -1444,9 +1444,9 @@ void BridgeBehavior::xfer( Xfer *xfer ) scaffoldObjectID = *it; xfer->xferObjectID( &scaffoldObjectID ); - } // end for + } - } // end if, save + } else { @@ -1462,14 +1462,14 @@ void BridgeBehavior::xfer( Xfer *xfer ) // put on list m_scaffoldObjectIDList.push_back( scaffoldObjectID ); - } // end for i + } - } // end load + } // death frame xfer->xferUnsignedInt( &m_deathFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1480,4 +1480,4 @@ void BridgeBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp index b216984be81..4ca29443328 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp @@ -49,14 +49,14 @@ BridgeScaffoldBehavior::BridgeScaffoldBehavior( Thing *thing, const ModuleData * m_lateralSpeed = 1.0f; m_verticalSpeed = 1.0f; -} // end BridgeScaffoldBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ BridgeScaffoldBehavior::~BridgeScaffoldBehavior( void ) { -} // end ~BridgeScaffoldBehavior +} // ------------------------------------------------------------------------------------------------ /** Set all of the target positions that we're care about as a moving scaffold object */ @@ -70,7 +70,7 @@ void BridgeScaffoldBehavior::setPositions( const Coord3D *createPos, m_riseToPos = *riseToPos; m_buildPos = *buildPos; -} // end setPositions +} // ------------------------------------------------------------------------------------------------ /** Set us moving to the right target position for the requested motion type */ @@ -101,9 +101,9 @@ void BridgeScaffoldBehavior::setMotion( ScaffoldTargetMotion targetMotion ) m_targetPos = m_createPos; break; - } // end switch + } -} // end setMotion +} // ------------------------------------------------------------------------------------------------ /** Whatever our current state of motion is, reverse it */ @@ -134,9 +134,9 @@ void BridgeScaffoldBehavior::reverseMotion( void ) setMotion( STM_RISE ); break; - } // end switch + } -} // end reverseMotion +} // ------------------------------------------------------------------------------------------------ /** The update method */ @@ -196,7 +196,7 @@ UpdateSleepTime BridgeScaffoldBehavior::update( void ) DEBUG_CRASH(("Unhandled case in BridgeScaffoldBehavior::update()")); return UPDATE_SLEEP_NONE; - } // end switch + } // adjust speed so it's slower at the end of motion Coord3D speedVector; @@ -262,11 +262,11 @@ UpdateSleepTime BridgeScaffoldBehavior::update( void ) TheGameLogic->destroyObject( us ); break; - } // end case + } - } // end switch + } - } // end if + } // set the new position us->setPosition( &newPos ); @@ -274,7 +274,7 @@ UpdateSleepTime BridgeScaffoldBehavior::update( void ) // do not sleep return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** STATIC MEMBER: @@ -297,12 +297,12 @@ BridgeScaffoldBehaviorInterface *BridgeScaffoldBehavior::getBridgeScaffoldBehavi if( bridgeScaffoldInterface ) return bridgeScaffoldInterface; - } // end for bmi + } // interface not found return NULL; -} // end getBridgeScaffoldBehaviorInterfaceFromObject +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -313,7 +313,7 @@ void BridgeScaffoldBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -352,7 +352,7 @@ void BridgeScaffoldBehavior::xfer( Xfer *xfer ) // current target pos xfer->xferCoord3D( &m_targetPos ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -363,4 +363,4 @@ void BridgeScaffoldBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp index 34c3c6ad312..0be412da1b1 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp @@ -48,14 +48,14 @@ BridgeTowerBehavior::BridgeTowerBehavior( Thing *thing, const ModuleData *module m_bridgeID = INVALID_ID; -} // end BridgeTowerBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ BridgeTowerBehavior::~BridgeTowerBehavior( void ) { -} // end ~BridgeTowerBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -67,7 +67,7 @@ void BridgeTowerBehavior::setBridge( Object *bridge ) else m_bridgeID = bridge->getID(); -} // end setBridge +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -76,7 +76,7 @@ ObjectID BridgeTowerBehavior::getBridgeID( void ) return m_bridgeID; -} // end getBridge +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -85,7 +85,7 @@ void BridgeTowerBehavior::setTowerType( BridgeTowerType type ) m_type = type; -} // end setTowerType +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -114,7 +114,7 @@ void BridgeTowerBehavior::onDamage( DamageInfo *damageInfo ) if( bridgeInterface ) break; - } // end for bmi + } DEBUG_ASSERTCRASH( bridgeInterface != NULL, ("BridgeTowerBehavior::onDamage - no 'BridgeBehaviorInterface' found") ); if( bridgeInterface ) { @@ -145,9 +145,9 @@ void BridgeTowerBehavior::onDamage( DamageInfo *damageInfo ) towerDamage.in.m_deathType = damageInfo->in.m_deathType; tower->attemptDamage( &towerDamage ); - } // end if + } - } // end for i + } // // damage bridge object, but make sure it's done through the bridge interface @@ -162,11 +162,11 @@ void BridgeTowerBehavior::onDamage( DamageInfo *damageInfo ) bridgeDamage.in.m_deathType = damageInfo->in.m_deathType; bridge->attemptDamage( &bridgeDamage ); - } // end if + } - } // end if + } -} // end onDamage +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -195,7 +195,7 @@ void BridgeTowerBehavior::onHealing( DamageInfo *damageInfo ) if( bridgeInterface ) break; - } // end for bmi + } DEBUG_ASSERTCRASH( bridgeInterface != NULL, ("BridgeTowerBehavior::onHealing - no 'BridgeBehaviorInterface' found") ); if( bridgeInterface ) { @@ -220,9 +220,9 @@ void BridgeTowerBehavior::onHealing( DamageInfo *damageInfo ) BodyModuleInterface *towerBody = tower->getBodyModule(); tower->attemptHealing(healingPercentage * towerBody->getMaxHealth(), getObject()); - } // end if + } - } // end for i + } // // heal bridge object, but make sure it's done through the bridge interface @@ -231,11 +231,11 @@ void BridgeTowerBehavior::onHealing( DamageInfo *damageInfo ) BodyModuleInterface *bridgeBody = bridge->getBodyModule(); bridge->attemptHealing(healingPercentage * bridgeBody->getMaxHealth(), getObject()); - } // end if + } - } // end if + } -} // end onHealing +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -244,7 +244,7 @@ void BridgeTowerBehavior::onBodyDamageStateChange( const DamageInfo* damageInfo, BodyDamageType newState ) { -} // end onBodyDamageStateChange +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -256,7 +256,7 @@ void BridgeTowerBehavior::onDie( const DamageInfo *damageInfo ) if( bridge ) bridge->kill(); -} // end onDie +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -281,12 +281,12 @@ BridgeTowerBehaviorInterface *BridgeTowerBehavior::getBridgeTowerBehaviorInterfa if( bridgeTowerInterface ) return bridgeTowerInterface; - } // end for bmi + } // interface not found return NULL; -} // getBridgeTowerBehaviorInterfaceFromObject +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -297,7 +297,7 @@ void BridgeTowerBehavior::crc( Xfer *xfer ) // extend base class BehaviorModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -321,7 +321,7 @@ void BridgeTowerBehavior::xfer( Xfer *xfer ) // xfer tower type xfer->xferUser( &m_type, sizeof( BridgeTowerType ) ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -332,4 +332,4 @@ void BridgeTowerBehavior::loadPostProcess( void ) // extend base class BehaviorModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp index e290266c5f4..829ec310ef6 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp @@ -493,8 +493,8 @@ Bool DumbProjectileBehavior::projectileHandleCollision( Object *other ) thingToKill->kill(); ++numKilled; } - } // next contained item - } // if items + } + } if (numKilled > 0) { @@ -506,7 +506,7 @@ Bool DumbProjectileBehavior::projectileHandleCollision( Object *other ) return true; } - } // if a garrisonable thing + } } } @@ -691,7 +691,7 @@ void DumbProjectileBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -744,16 +744,16 @@ void DumbProjectileBehavior::xfer( Xfer *xfer ) weaponTemplateName.str() )); throw SC_INVALID_DATA; - } // end if + } - } // end else + } - } // end if + } // lifespan frame xfer->xferUnsignedInt( &m_lifespanFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -764,4 +764,4 @@ void DumbProjectileBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDamagedBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDamagedBehavior.cpp index 6767147d257..5c46f53bef4 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDamagedBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDamagedBehavior.cpp @@ -269,7 +269,7 @@ void FireWeaponWhenDamagedBehavior::crc( Xfer *xfer ) // extend upgrade mux UpgradeMux::upgradeMuxCRC( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -340,7 +340,7 @@ void FireWeaponWhenDamagedBehavior::xfer( Xfer *xfer ) if( weaponPresent ) xfer->xferSnapshot( m_continuousWeaponRubble ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -354,4 +354,4 @@ void FireWeaponWhenDamagedBehavior::loadPostProcess( void ) // extend upgrade mux UpgradeMux::upgradeMuxLoadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDeadBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDeadBehavior.cpp index d6115a89fd0..6f1016bd6a1 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDeadBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDeadBehavior.cpp @@ -125,7 +125,7 @@ void FireWeaponWhenDeadBehavior::crc( Xfer *xfer ) // extend upgrade mux UpgradeMux::upgradeMuxCRC( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -146,7 +146,7 @@ void FireWeaponWhenDeadBehavior::xfer( Xfer *xfer ) // extend upgrade mux UpgradeMux::upgradeMuxXfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -160,4 +160,4 @@ void FireWeaponWhenDeadBehavior::loadPostProcess( void ) // extend upgrade mux UpgradeMux::upgradeMuxLoadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp index 9f4be5a6401..4821fefc9b5 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp @@ -441,7 +441,7 @@ void GenerateMinefieldBehavior::crc( Xfer *xfer ) // extend base class UpgradeMux::upgradeMuxCRC( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -467,7 +467,7 @@ void GenerateMinefieldBehavior::xfer( Xfer *xfer ) xfer->xferBool( &m_hasTarget ); xfer->xferCoord3D( &m_target ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -481,4 +481,4 @@ void GenerateMinefieldBehavior::loadPostProcess( void ) // extend base class UpgradeMux::upgradeMuxLoadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp index 1b52bf3c79a..dffbb8b1912 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp @@ -183,7 +183,7 @@ void InstantDeathBehavior::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -201,7 +201,7 @@ void InstantDeathBehavior::xfer( Xfer *xfer ) // extend base class DieModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -212,4 +212,4 @@ void InstantDeathBehavior::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp index 83a297b7108..c5d5f8b0ef5 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp @@ -75,7 +75,7 @@ JetSlowDeathBehaviorModuleData::JetSlowDeathBehaviorModuleData( void ) m_pitchRate = 0.0f; m_fallHowFast = 0.0f; -} // end JetSlowDeathBehaviorModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -117,7 +117,7 @@ JetSlowDeathBehaviorModuleData::JetSlowDeathBehaviorModuleData( void ) p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -133,14 +133,14 @@ JetSlowDeathBehavior::JetSlowDeathBehavior( Thing *thing, const ModuleData *modu m_timerOnGroundFrame = 0; m_rollRate = 0.0f; -} // end JetSlowDeathBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ JetSlowDeathBehavior::~JetSlowDeathBehavior( void ) { -} // end ~JetSlowDeathBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -162,16 +162,16 @@ void JetSlowDeathBehavior::onDie( const DamageInfo *damageInfo ) // destroy object TheGameLogic->destroyObject( us ); - } // end if + } else { // extend base class for slow death and begin the slow death behavior SlowDeathBehavior::onDie( damageInfo ); - } // end else + } -} // end onDie +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -200,7 +200,7 @@ void JetSlowDeathBehavior::beginSlowDeath( const DamageInfo *damageInfo ) m_deathLoopSound.setObjectID( us->getID() ); m_deathLoopSound.setPlayingHandle( TheAudio->addAudioEvent( &m_deathLoopSound ) ); - } // end if + } // initialize our roll rate to that defined as the initial value in the module data m_rollRate = modData->m_rollRate; @@ -212,7 +212,7 @@ void JetSlowDeathBehavior::beginSlowDeath( const DamageInfo *damageInfo ) // do not allow the jet to turn anymore locomotor->setMaxTurnRate( 0.0f ); -} // end beginSlowDeath +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -298,7 +298,7 @@ UpdateSleepTime JetSlowDeathBehavior::update( void ) if( physics ) physics->setPitchRate( modData->m_pitchRate ); - } // end if + } // timers for the secondary effect if( m_timerDeathFrame != 0 && @@ -312,9 +312,9 @@ UpdateSleepTime JetSlowDeathBehavior::update( void ) // clear the death frame timer since we've already executed the event now m_timerDeathFrame = 0; - } //end if + } - } // end if + } else { // we are on the ground, pay attention to the final explosion timers @@ -328,13 +328,13 @@ UpdateSleepTime JetSlowDeathBehavior::update( void ) // we're all done now TheGameLogic->destroyObject( us ); - } // end if + } - } // end else + } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -345,7 +345,7 @@ void JetSlowDeathBehavior::crc( Xfer *xfer ) // extend base class SlowDeathBehavior::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -372,7 +372,7 @@ void JetSlowDeathBehavior::xfer( Xfer *xfer ) // roll rate xfer->xferReal( &m_rollRate ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -383,4 +383,4 @@ void JetSlowDeathBehavior::loadPostProcess( void ) // extend base class SlowDeathBehavior::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp index 9d4a6a3d895..9a32eea433a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp @@ -618,7 +618,7 @@ void MinefieldBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -665,7 +665,7 @@ void MinefieldBehavior::xfer( Xfer *xfer ) DEBUG_CRASH(( "MinefieldBehavior::xfer - MAX_IMMUNITY has changed size, you must version this code and then you can remove this error message" )); throw SC_INVALID_DATA; - } // end if + } for( UnsignedByte i = 0; i < maxImmunity; ++i ) { @@ -675,12 +675,12 @@ void MinefieldBehavior::xfer( Xfer *xfer ) // collide time xfer->xferUnsignedInt( &m_immunes[ i ].collideTime ); - } // end for, i + } if( xfer->getXferMode() == XFER_LOAD ) m_detonators.clear(); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -691,4 +691,4 @@ void MinefieldBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/OverchargeBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/OverchargeBehavior.cpp index 5d41b7512be..8327c32ab82 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/OverchargeBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/OverchargeBehavior.cpp @@ -52,7 +52,7 @@ OverchargeBehaviorModuleData::OverchargeBehaviorModuleData( void ) m_healthPercentToDrainPerSecond = 0.0f; m_notAllowedWhenHealthBelowPercent = 0.0f; -} // end OverchargeBehaviorModuleData +} //------------------------------------------------------------------------------------------------- // ------------------------------------------------------------------------------------------------ @@ -70,7 +70,7 @@ OverchargeBehaviorModuleData::OverchargeBehaviorModuleData( void ) p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -87,14 +87,14 @@ OverchargeBehavior::OverchargeBehavior( Thing *thing, const ModuleData* moduleDa // start off sleeping forever until we become active setWakeFrame( getObject(), UPDATE_SLEEP_FOREVER ); -} // end OverchargeBehavior +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- OverchargeBehavior::~OverchargeBehavior( void ) { -} // end ~OverchargeBehavior +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -135,25 +135,25 @@ UpdateSleepTime OverchargeBehavior::update( void ) // do radar event TheRadar->createEvent( us->getPosition(), RADAR_EVENT_INFORMATION ); - } // end of + } // do nothing else return UPDATE_SLEEP_NONE; - } // end if + } - } // end if + } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------- void OverchargeBehavior::onDamage( DamageInfo *damageInfo ) { -} // end onDie +} // ------------------------------------------------------------------------------------------------ /** Flip the state of our 'overcharge-ness' */ @@ -164,7 +164,7 @@ void OverchargeBehavior::toggle( void ) // just toggle using enable() enable( !m_overchargeActive ); -} // end toggle +} // ------------------------------------------------------------------------------------------------ /** Enable or disable an overcharge */ @@ -199,9 +199,9 @@ void OverchargeBehavior::enable( Bool enable ) // sleep forever setWakeFrame( us, UPDATE_SLEEP_FOREVER ); - } // end if + } - } // end if + } else { @@ -229,11 +229,11 @@ void OverchargeBehavior::enable( Bool enable ) // need to update every frame now setWakeFrame( us, UPDATE_SLEEP_NONE ); - } // end if + } - } // end else + } -} // end enable +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -251,7 +251,7 @@ void OverchargeBehavior::onDelete( void ) m_overchargeActive = FALSE; -} // end onDelete +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -273,7 +273,7 @@ void OverchargeBehavior::onCapture( Player *oldOwner, Player *newOwner ) if( newOwner ) newOwner->addPowerBonus( getObject() ); -} // end onCapture +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -284,7 +284,7 @@ void OverchargeBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -305,7 +305,7 @@ void OverchargeBehavior::xfer( Xfer *xfer ) // overcharge active xfer->xferBool( &m_overchargeActive ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -320,4 +320,4 @@ void OverchargeBehavior::loadPostProcess( void ) if( m_overchargeActive && getObject()->getControllingPlayer() ) getObject()->getControllingPlayer()->addPowerBonus( getObject() ); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/POWTruckBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/POWTruckBehavior.cpp index e3e9020bded..8704f2d937e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/POWTruckBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/POWTruckBehavior.cpp @@ -48,7 +48,7 @@ POWTruckBehaviorModuleData::POWTruckBehaviorModuleData( void ) { -} // end POWTruckBehaviorModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -65,7 +65,7 @@ POWTruckBehaviorModuleData::POWTruckBehaviorModuleData( void ) p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -77,14 +77,14 @@ POWTruckBehavior::POWTruckBehavior( Thing *thing, const ModuleData *moduleData ) : OpenContain( thing, moduleData ) { -} // end POWTruckBehavior +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- POWTruckBehavior::~POWTruckBehavior( void ) { -} // end ~POWTruckBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -112,7 +112,7 @@ void POWTruckBehavior::onCollide( Object *other, const Coord3D *loc, const Coord // pick up the prisoner powTruckAI->loadPrisoner( other ); -} // end onCollide +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -123,7 +123,7 @@ void POWTruckBehavior::crc( Xfer *xfer ) // extend base class OpenContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -141,7 +141,7 @@ void POWTruckBehavior::xfer( Xfer *xfer ) // extend base class OpenContain::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -152,6 +152,6 @@ void POWTruckBehavior::loadPostProcess( void ) // extend base class OpenContain::loadPostProcess(); -} // end loadPostProcess +} #endif diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp index 3bdbdf6c612..68cec00aa60 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp @@ -855,7 +855,7 @@ void ParkingPlaceBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -897,9 +897,9 @@ void ParkingPlaceBehavior::xfer( Xfer *xfer ) // reserved for exit xfer->xferBool( &((*it).m_reservedForExit) ); - } // end for, it + } - } // end if, save + } else if( xfer->getXferMode() == XFER_LOAD ) { ObjectID objectID; @@ -925,11 +925,11 @@ void ParkingPlaceBehavior::xfer( Xfer *xfer ) (*it).m_reservedForExit = reservedForExit; ++it; - } // end if + } - } // end for, i + } - } // end else, load + } // runways cound and info UnsignedByte runwaysCount = m_runways.size(); @@ -947,9 +947,9 @@ void ParkingPlaceBehavior::xfer( Xfer *xfer ) xfer->xferObjectID( &((*it).m_nextInLineForTakeoff) ); xfer->xferBool( &((*it).m_wasInLine) ); - } // end for, it + } - } // end if, save + } else if( xfer->getXferMode() == XFER_LOAD ) { // read all elements @@ -976,11 +976,11 @@ void ParkingPlaceBehavior::xfer( Xfer *xfer ) (*it).m_wasInLine = wasInLine; ++it; - } // end if + } - } // end for, i + } - } // end else, load + } // healees UnsignedByte healCount = m_healing.size(); @@ -997,9 +997,9 @@ void ParkingPlaceBehavior::xfer( Xfer *xfer ) xfer->xferObjectID( &((*it).m_gettingHealedID) ); xfer->xferUnsignedInt( &((*it).m_healStartFrame) ); - } // end for, it + } - } // end if, save + } else if( xfer->getXferMode() == XFER_LOAD ) { // read all elements @@ -1013,9 +1013,9 @@ void ParkingPlaceBehavior::xfer( Xfer *xfer ) xfer->xferUnsignedInt( &info.m_healStartFrame ); m_healing.push_back(info); - } // end for, i + } - } // end else, load + } if (version >= 2) { @@ -1036,7 +1036,7 @@ void ParkingPlaceBehavior::xfer( Xfer *xfer ) } } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1051,4 +1051,4 @@ void ParkingPlaceBehavior::loadPostProcess( void ) // make sure we are awake... old save games let us sleep //setWakeFrame(getObject(), UPDATE_SLEEP_NONE); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp index 58b351f4e9c..1a4632d0ce4 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp @@ -197,7 +197,7 @@ void PoisonedBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -229,7 +229,7 @@ void PoisonedBehavior::xfer( Xfer *xfer ) xfer->xferUser(&m_deathType, sizeof(m_deathType)); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -240,4 +240,4 @@ void PoisonedBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PrisonBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PrisonBehavior.cpp index c94a828a6d7..3ca9c69d1fe 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PrisonBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PrisonBehavior.cpp @@ -74,14 +74,14 @@ PrisonVisual::PrisonVisual( void ) m_drawableID = INVALID_DRAWABLE_ID; m_next = NULL; -} // end PrisonVisual +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ PrisonVisual::~PrisonVisual( void ) { -} // end ~PrisonVisual +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -94,7 +94,7 @@ PrisonBehaviorModuleData::PrisonBehaviorModuleData( void ) m_showPrisoners = FALSE; -} // end PrisonBehaviorModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -113,7 +113,7 @@ PrisonBehaviorModuleData::PrisonBehaviorModuleData( void ) p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -127,14 +127,14 @@ PrisonBehavior::PrisonBehavior( Thing *thing, const ModuleData *moduleData ) m_visualList = NULL; -} // end PrisonBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ PrisonBehavior::~PrisonBehavior( void ) { -} // end ~PrisonBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -160,9 +160,9 @@ void PrisonBehavior::onDelete( void ) deleteInstance(m_visualList); m_visualList = visual; - } // end while + } -} // end onDelete +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -180,7 +180,7 @@ void PrisonBehavior::onContaining( Object *obj ) if( modData->m_showPrisoners ) addVisual( obj ); -} // end onContaining +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -198,7 +198,7 @@ void PrisonBehavior::onRemoving( Object *obj ) // extend functionality OpenContain::onRemoving( obj ); -} // end onRemoving +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE //////////////////////////////////////////////////////////////////////////////////////// @@ -253,7 +253,7 @@ void PrisonBehavior::pickVisualLocation( Coord3D *pos ) if( yardPositions[ i ].y > yardRegion.hi.y ) yardRegion.hi.y = yardPositions[ i ].y; - } // end for i + } // // now that we have a yard region, the default visual position will be in the middle @@ -282,16 +282,16 @@ void PrisonBehavior::pickVisualLocation( Coord3D *pos ) pickedLocation = loc; break; // exit for i - } // end if + } - } // end for i + } - } // end if + } // return the location picked *pos = pickedLocation; -} // end pickVisualLocation +} // ------------------------------------------------------------------------------------------------ /** Add prisoner visual to the prison yard */ @@ -329,7 +329,7 @@ void PrisonBehavior::addVisual( Object *obj ) visual->m_next = m_visualList; m_visualList = visual; -} // end addVisual +} // ------------------------------------------------------------------------------------------------ /** Remove prisoner visual from the prison yard */ @@ -367,19 +367,19 @@ void PrisonBehavior::removeVisual( Object *obj ) break; // exit for - } // end if + } // keep a pointer to the previous element prevVisual = visual; - } // end for + } // find the drawable visual and destroy it Drawable *draw = TheGameClient->findDrawableByID( drawableID ); if( draw ) TheGameClient->destroyDrawable( draw ); -} // end removeVisual +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -390,7 +390,7 @@ void PrisonBehavior::crc( Xfer *xfer ) // extend base class OpenContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -427,9 +427,9 @@ void PrisonBehavior::xfer( Xfer *xfer ) // drawable id xfer->xferDrawableID( &visual->m_drawableID ); - } // end for, visual + } - } // end if, save + } else { @@ -440,7 +440,7 @@ void PrisonBehavior::xfer( Xfer *xfer ) DEBUG_CRASH(( "PrisonBehavior::xfer - the visual list should be empty but is not" )); throw SC_INVALID_DATA; - } // end if + } // read each item for( UnsignedShort i = 0; i < visualCount; ++i ) @@ -457,11 +457,11 @@ void PrisonBehavior::xfer( Xfer *xfer ) // read drawable id xfer->xferDrawableID( &visual->m_drawableID ); - } // end for, i + } - } // end else, load + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -472,7 +472,7 @@ void PrisonBehavior::loadPostProcess( void ) // extend base class OpenContain::loadPostProcess(); -} // end loadPostProcess +} #endif diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaCenterBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaCenterBehavior.cpp index b74a62a20f6..aecf1440a22 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaCenterBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaCenterBehavior.cpp @@ -51,7 +51,7 @@ PropagandaCenterBehaviorModuleData::PropagandaCenterBehaviorModuleData( void ) m_brainwashDuration = 0; -} // end PropagandaCenterBehaviorModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -69,7 +69,7 @@ PropagandaCenterBehaviorModuleData::PropagandaCenterBehaviorModuleData( void ) p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -84,14 +84,14 @@ PropagandaCenterBehavior::PropagandaCenterBehavior( Thing *thing, const ModuleDa m_brainwashingSubjectID = INVALID_ID; m_brainwashingSubjectStartFrame = 0; -} // end PropagandaCenterBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ PropagandaCenterBehavior::~PropagandaCenterBehavior( void ) { -} // end ~PropagandaCenterBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -119,14 +119,14 @@ void PropagandaCenterBehavior::onDelete( void ) // return this object under the control of the original owner obj->restoreOriginalTeam(); - } // end if + } - } // end for + } // clear the list m_brainwashedList.clear(); -} // end onDelete +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -178,13 +178,13 @@ UpdateSleepTime PropagandaCenterBehavior::update( void ) // exit the prison exitObjectViaDoor( brainwashingSubject, exitDoor ); - } // end if + } - } // end if + } - } // end if, + } - } // end if + } // if we have no brainwashing subject, hook one up if we have people inside us if( m_brainwashingSubjectID == INVALID_ID ) @@ -202,14 +202,14 @@ UpdateSleepTime PropagandaCenterBehavior::update( void ) m_brainwashingSubjectID = obj->getID(); m_brainwashingSubjectStartFrame = TheGameLogic->getFrame(); - } // end if + } - } // end if + } - } // end if + } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -223,12 +223,12 @@ void PropagandaCenterBehavior::onRemoving( Object *obj ) m_brainwashingSubjectID = INVALID_ID; m_brainwashingSubjectStartFrame = 0; - } // end if + } // extend functionality PrisonBehavior::onRemoving( obj ); -} // end onRemoving +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -239,7 +239,7 @@ void PropagandaCenterBehavior::crc( Xfer *xfer ) // extend base class PrisonBehavior::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -266,7 +266,7 @@ void PropagandaCenterBehavior::xfer( Xfer *xfer ) // brainwashed list size and data xfer->xferSTLObjectIDList( &m_brainwashedList ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -277,6 +277,6 @@ void PropagandaCenterBehavior::loadPostProcess( void ) // extend base class PrisonBehavior::loadPostProcess(); -} // end loadPostProcess +} #endif diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp index f16f584a928..cd34783518b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp @@ -84,7 +84,7 @@ PropagandaTowerBehaviorModuleData::PropagandaTowerBehaviorModuleData( void ) m_upgradeRequired = NULL; m_upgradedPulseFX = NULL; -} // end PropagandaTowerBehaviorModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -106,7 +106,7 @@ PropagandaTowerBehaviorModuleData::PropagandaTowerBehaviorModuleData( void ) p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -124,14 +124,14 @@ PropagandaTowerBehavior::PropagandaTowerBehavior( Thing *thing, const ModuleData m_insideList = NULL; setWakeFrame( getObject(), UPDATE_SLEEP_NONE ); -} // end PropagandaTowerBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ PropagandaTowerBehavior::~PropagandaTowerBehavior( void ) { -} // end ~PropagandaTowerBehavior +} // ------------------------------------------------------------------------------------------------ /** Module is being deleted */ @@ -142,7 +142,7 @@ void PropagandaTowerBehavior::onDelete( void ) // remove any benefits from anybody in our area of influence removeAllInfluence(); -} // end onDelete +} // ------------------------------------------------------------------------------------------------ /** Resolve */ @@ -154,7 +154,7 @@ void PropagandaTowerBehavior::onObjectCreated( void ) // convert module upgrade name to a pointer m_upgradeRequired = TheUpgradeCenter->findUpgrade( modData->m_upgradeRequired ); -} // end onObjectCreated +} // ------------------------------------------------------------------------------------------------ void PropagandaTowerBehavior::onCapture( Player *oldOwner, Player *newOwner ) @@ -223,7 +223,7 @@ UpdateSleepTime PropagandaTowerBehavior::update( void ) doScan(); m_lastScanFrame = currentFrame; - } // end if + } // go through any objects in our area of influence and do the effect logic on them Object *obj; @@ -246,7 +246,7 @@ UpdateSleepTime PropagandaTowerBehavior::update( void ) // record this element as the previous one found in the list prev = curr; - } // end if + } else { @@ -260,13 +260,13 @@ UpdateSleepTime PropagandaTowerBehavior::update( void ) m_insideList = curr->next; deleteInstance(curr); - } // end else + } - } // end for, curr + } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** The death callback */ @@ -277,7 +277,7 @@ void PropagandaTowerBehavior::onDie( const DamageInfo *damageInfo ) // remove any benefits from anybody in our area of influence removeAllInfluence(); -} // end onDie +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -306,7 +306,7 @@ void PropagandaTowerBehavior::effectLogic( Object *obj, Bool giving, obj->setWeaponBonusCondition( WEAPONBONUSCONDITION_SUBLIMINAL ); } - } // hasdamageweapon + } // grant health to this object as well @@ -329,9 +329,9 @@ void PropagandaTowerBehavior::effectLogic( Object *obj, Bool giving, // obj->attemptHealing(amount, getObject()); // the regular way to give healing... obj->attemptHealingFromSoleBenefactor( amount, getObject(), modData->m_scanDelayInFrames );//the non-stacking way - } // end if + } - } // end if + } else { @@ -339,9 +339,9 @@ void PropagandaTowerBehavior::effectLogic( Object *obj, Bool giving, obj->clearWeaponBonusCondition( WEAPONBONUSCONDITION_ENTHUSIASTIC ); obj->clearWeaponBonusCondition( WEAPONBONUSCONDITION_SUBLIMINAL ); - } // end else + } -} // end effectLogic +} // ------------------------------------------------------------------------------------------------ /** Remove all influence from objects we've given bonuses to */ @@ -359,7 +359,7 @@ void PropagandaTowerBehavior::removeAllInfluence( void ) if( obj ) effectLogic( obj, FALSE, getPropagandaTowerBehaviorModuleData() ); - } // end for + } // delete the list of objects under our influence while( m_insideList ) @@ -369,9 +369,9 @@ void PropagandaTowerBehavior::removeAllInfluence( void ) deleteInstance(m_insideList); m_insideList = o; - } // end while + } -} // end removeAllInfluence +} // ------------------------------------------------------------------------------------------------ /** Do a scan */ @@ -399,7 +399,7 @@ void PropagandaTowerBehavior::doScan( void ) upgradePresent = player->hasUpgradeComplete( m_upgradeRequired ); break; - } // end player upgrade + } // ------------------------------------------------------------------------------------------ case UPGRADE_TYPE_OBJECT: @@ -408,7 +408,7 @@ void PropagandaTowerBehavior::doScan( void ) upgradePresent = us->hasUpgrade( m_upgradeRequired ); break; - } // end object upgrade + } // ------------------------------------------------------------------------------------------ default: @@ -418,11 +418,11 @@ void PropagandaTowerBehavior::doScan( void ) m_upgradeRequired->getUpgradeType() )); break; - } // end default + } - } // end switch + } - } // end if + } // play the right pulse if( upgradePresent == TRUE ) @@ -463,7 +463,7 @@ void PropagandaTowerBehavior::doScan( void ) newEntry->next = newInsideList; newInsideList = newEntry; - } // end for obj + } // // now that we have a list of objects that are in our area of influence, look through @@ -488,9 +488,9 @@ void PropagandaTowerBehavior::doScan( void ) if( obj ) effectLogic( obj, FALSE, modData ); - } // end if + } - } // end for + } // delete the inside list we have recoreded ObjectTracker *next; @@ -501,12 +501,12 @@ void PropagandaTowerBehavior::doScan( void ) deleteInstance(m_insideList); m_insideList = next; - } // end while + } // set the new inside list to the one we're recording m_insideList = newInsideList; -} // end doScan +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -517,7 +517,7 @@ void PropagandaTowerBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -554,9 +554,9 @@ void PropagandaTowerBehavior::xfer( Xfer *xfer ) // object id xfer->xferObjectID( &trackerEntry->objectID ); - } // end for + } - } // end if, save + } else { @@ -567,7 +567,7 @@ void PropagandaTowerBehavior::xfer( Xfer *xfer ) DEBUG_CRASH(( "PropagandaTowerBehavior::xfer - m_insideList should be empty but is not" )); throw SC_INVALID_DATA; - } // end if + } // read all entries for( UnsignedShort i = 0; i < insideCount; ++i ) @@ -581,11 +581,11 @@ void PropagandaTowerBehavior::xfer( Xfer *xfer ) // read object id xfer->xferObjectID( &trackerEntry->objectID ); - } // end for i + } - } // end else, load + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -596,4 +596,4 @@ void PropagandaTowerBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/RebuildHoleBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/RebuildHoleBehavior.cpp index c23adb49bb7..30843bdbb34 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/RebuildHoleBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/RebuildHoleBehavior.cpp @@ -51,7 +51,7 @@ RebuildHoleBehaviorModuleData::RebuildHoleBehaviorModuleData( void ) m_workerRespawnDelay = 0.0f; m_holeHealthRegenPercentPerSecond = 0.1f; -} // end RebuildHoleBehaviorModuleData +} //------------------------------------------------------------------------------------------------- // ------------------------------------------------------------------------------------------------ @@ -70,7 +70,7 @@ RebuildHoleBehaviorModuleData::RebuildHoleBehaviorModuleData( void ) p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -89,7 +89,7 @@ RebuildHoleBehavior::RebuildHoleBehavior( Thing *thing, const ModuleData* module m_workerTemplate = NULL; m_rebuildTemplate = NULL; -} // end RebuildHoleBehavior +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -107,7 +107,7 @@ RebuildHoleBehavior::~RebuildHoleBehavior( void ) } } -} // end ~RebuildHoleBehavior +} // ------------------------------------------------------------------------------------------------ /** we need to start all the timers and ID ties to make a new worker at the correct time */ @@ -136,7 +136,7 @@ void RebuildHoleBehavior::newWorkerRespawnProcess( Object *existingWorker ) // getObject()->maskObject( FALSE ); -} // end newWorkerRespawnProcess +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -152,7 +152,7 @@ void RebuildHoleBehavior::startRebuildProcess( const ThingTemplate *rebuild, Obj // start the spawning process for a worker newWorkerRespawnProcess( NULL ); -} /// end startRebuildProcess +} //---------------------------------------------------------------------------------------------- @@ -197,7 +197,7 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) if( worker == NULL ) newWorkerRespawnProcess( NULL ); - } // end if + } // if we have a reconstructing object built, get the actual object pointer if( m_reconstructingID != 0 ) @@ -216,9 +216,9 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) newWorkerRespawnProcess( worker ); m_reconstructingID = INVALID_ID; - } // end if + } - } // end if + } // see if it's time for us to spawn a worker if( worker == NULL && m_workerWaitCounter > 0 ) @@ -286,13 +286,13 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) transferBombs( reconstructing ); - } // end if + } - } // end if, worker + } - } // end if, time to spawn a worker + } - } // end if, check for working respawn + } // holes get auto-healed when they're sittin around BodyModuleInterface *body = hole->getBodyModule(); @@ -308,7 +308,7 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) healingInfo.in.m_deathType = DEATH_NONE; body->attemptHealing( &healingInfo ); - } // end if + } // when re-construction is complete, we remove this hole and worker if( reconstructing && !reconstructing->getStatusBits().test( OBJECT_STATUS_UNDER_CONSTRUCTION ) ) @@ -323,11 +323,11 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) // make the hole go away TheGameLogic->destroyObject( hole ); - } // end if + } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------- @@ -350,7 +350,7 @@ void RebuildHoleBehavior::onDie( const DamageInfo *damageInfo ) // destroy us TheGameLogic->destroyObject( obj ); -} // end onDie +} // ------------------------------------------------------------------------------------------------ /** Helper method to get interface given an object */ @@ -369,13 +369,13 @@ void RebuildHoleBehavior::onDie( const DamageInfo *damageInfo ) if( rhbi ) break; // exit for - } // end for i + } - } // end if, obj + } return rhbi; -} // end getRebuildHoleBehaviorInterfaceFromObject +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -386,7 +386,7 @@ void RebuildHoleBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -435,13 +435,13 @@ void RebuildHoleBehavior::xfer( Xfer *xfer ) workerName.str() )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } else m_workerTemplate = NULL; - } // end if + } // rebuild template AsciiString rebuildName = m_rebuildTemplate ? m_rebuildTemplate->getName() : AsciiString::TheEmptyString; @@ -460,15 +460,15 @@ void RebuildHoleBehavior::xfer( Xfer *xfer ) rebuildName.str() )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } else m_rebuildTemplate = NULL; - } // end if + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -479,4 +479,4 @@ void RebuildHoleBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp index 9c9112b7cb0..2c94fa7ef51 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp @@ -531,7 +531,7 @@ void SlowDeathBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -564,7 +564,7 @@ void SlowDeathBehavior::xfer( Xfer *xfer ) // flags xfer->xferUnsignedInt( &m_flags ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -575,4 +575,4 @@ void SlowDeathBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp index 42e198dbfd1..9c842b76b25 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp @@ -126,9 +126,9 @@ void SpawnBehavior::onDelete() if( obj && obj->isEffectivelyDead() == FALSE ) TheGameLogic->destroyObject( obj ); - } // end for, it + } - } // end if + } } @@ -184,9 +184,9 @@ void SpawnBehavior::onDie( const DamageInfo *damageInfo ) if( obj && obj->isEffectivelyDead() == FALSE ) obj->kill(); - } // end for, it + } - } // end if + } } @@ -514,9 +514,9 @@ static void findClosestOrphan( Object *obj, void *userData ) orphanData->m_closest = obj; orphanData->m_closestDistSq = distSq; - } // end if + } -} // findClosestOrphan +} // ------------------------------------------------------------------------------------------------ Object *SpawnBehavior::reclaimOrphanSpawn( void ) @@ -892,7 +892,7 @@ void SpawnBehavior::computeAggregateStates(void) spawnCount++; } - } // next iter + } @@ -927,7 +927,7 @@ void SpawnBehavior::computeAggregateStates(void) teamMsg->appendObjectIDArgument( currentSpawn->getID() ); } } - } // next iter + } } // if somebody is selected then I sure need to be! if ( ! obj->getDrawable()->isSelected()) @@ -980,7 +980,7 @@ void SpawnBehavior::crc( Xfer *xfer ) // extend base class BehaviorModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1023,11 +1023,11 @@ void SpawnBehavior::xfer( Xfer *xfer ) DEBUG_CRASH(( "SpawnBehavior::xfer - Unable to find template '%s'", name.str() )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } - } // end if + } // one shot countdown xfer->xferInt( &m_oneShotCountdown ); @@ -1058,7 +1058,7 @@ void SpawnBehavior::xfer( Xfer *xfer ) // self tasking spawn count xfer->xferUnsignedInt( &m_selfTaskingSpawnCount ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1069,4 +1069,4 @@ void SpawnBehavior::loadPostProcess( void ) // extend base class BehaviorModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp index dee6f352789..bd6e4ab6517 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp @@ -146,7 +146,7 @@ void SupplyWarehouseCripplingBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -170,7 +170,7 @@ void SupplyWarehouseCripplingBehavior::xfer( Xfer *xfer ) // next healing frame xfer->xferUnsignedInt( &m_nextHealingFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -181,4 +181,4 @@ void SupplyWarehouseCripplingBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/TechBuildingBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/TechBuildingBehavior.cpp index 25e00296a93..7b1efe52b69 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/TechBuildingBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/TechBuildingBehavior.cpp @@ -61,7 +61,7 @@ TechBuildingBehaviorModuleData::TechBuildingBehaviorModuleData( void ) p.add( dataFieldParse ); -} // end buildFieldParse +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -128,7 +128,7 @@ void TechBuildingBehavior::onDie( const DamageInfo *damageInfo ) Object *us = getObject(); us->setTeam( ThePlayerList->getNeutralPlayer()->getDefaultTeam() ); -} // end onDie +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -141,7 +141,7 @@ void TechBuildingBehavior::onCapture( Player *oldOwner, Player *newOwner ) // wake up next frame so we can re-evaluate our captured status setWakeFrame( getObject(), UPDATE_SLEEP_NONE ); -} // end onCapture +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -151,7 +151,7 @@ void TechBuildingBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -166,7 +166,7 @@ void TechBuildingBehavior::xfer( Xfer *xfer ) // extend base class UpdateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -176,5 +176,5 @@ void TechBuildingBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp index 03cf4f1c627..bb827f0f109 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp @@ -85,7 +85,7 @@ class BodyParticleSystem : public MemoryPoolObject BodyParticleSystem::~BodyParticleSystem( void ) { -} // end ~BodyParticleSystem +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -183,7 +183,7 @@ void ActiveBody::onDelete( void ) // delete all particle systems deleteAllParticleSystems(); -} // end onDelete +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -789,16 +789,16 @@ void ActiveBody::createParticleSystems( const AsciiString &boneBaseName, usedBoneIndices[ j ] = TRUE; break; // exit for j - } // end if + } else { // we won't use this index, increment count until we find a suitable index to use ++count; - } // end else + } - } // end for, j + } // sanity DEBUG_ASSERTCRASH( j != numBones, @@ -821,11 +821,11 @@ void ActiveBody::createParticleSystems( const AsciiString &boneBaseName, newEntry->m_next = m_particleSystems; m_particleSystems = newEntry; - } // end if + } - } // end for, i + } -} // end createParticleSystems +} // ------------------------------------------------------------------------------------------------ /** Delete all the body particle systems */ @@ -852,9 +852,9 @@ void ActiveBody::deleteAllParticleSystems( void ) // set the body systems head to the next m_particleSystems = nextBodySystem; - } // end while + } -} // end deleteAllParticleSystems +} // ------------------------------------------------------------------------------------------------ /* This function is called on state changes only. Body Type or Aflameness. */ @@ -893,7 +893,7 @@ void ActiveBody::updateBodyParticleSystems( void ) // we get to make more of them all too countModifier = 2; - } // end if + } else { @@ -908,7 +908,7 @@ void ActiveBody::updateBodyParticleSystems( void ) // we make just the normal amount of these countModifier = 1; - } // end else + } // // remove any particle systems we have currently in the list in favor of any new ones @@ -949,7 +949,7 @@ void ActiveBody::updateBodyParticleSystems( void ) createParticleSystems( TheGlobalData->m_autoAflameParticlePrefix, aflameTemplate, TheGlobalData->m_autoAflameParticleMax * countModifier ); -} // end updatebodyParticleSystems +} //------------------------------------------------------------------------------------------------- /** Simple changing of the health value, it does *NOT* track any transition @@ -994,7 +994,7 @@ void ActiveBody::internalChangeHealth( Real delta ) if( !getObject()->getStatusBits().test( OBJECT_STATUS_UNDER_CONSTRUCTION ) ) evaluateVisualCondition(); - } // end if + } // mark the bit according to our health. (if our AI is dead but our health improves, it will // still re-flag this bit in the AIDeadState every frame.) @@ -1021,14 +1021,14 @@ BodyDamageType ActiveBody::getDamageState() const Real ActiveBody::getMaxHealth() const { return m_maxHealth; -} ///< return max health +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- Real ActiveBody::getInitialHealth() const { return m_initialHealth; -} // return initial health +} // ------------------------------------------------------------------------------------------------ @@ -1060,15 +1060,15 @@ void ActiveBody::setIndestructible( Bool indestructible ) if( body ) body->setIndestructible( indestructible ); - } // end if + } - } // end for, i + } - } // end if + } - } // end if + } -} // end setIndestructible +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1186,7 +1186,7 @@ void ActiveBody::crc( Xfer *xfer ) // extend base class BodyModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1264,9 +1264,9 @@ void ActiveBody::xfer( Xfer *xfer ) // write particle system ID xfer->xferUser( &system->m_particleSystemID, sizeof( ParticleSystemID ) ); - } // end for, system + } - } // end if, save + } else { ParticleSystemID particleSystemID; @@ -1278,7 +1278,7 @@ void ActiveBody::xfer( Xfer *xfer ) DEBUG_CRASH(( "ActiveBody::xfer - m_particleSystems should be empty, but is not" )); throw SC_INVALID_DATA; - } // end if + } // read all data elements BodyParticleSystem *newEntry; @@ -1294,14 +1294,14 @@ void ActiveBody::xfer( Xfer *xfer ) newEntry->m_next = m_particleSystems; // the list will be reversed, but we don't care m_particleSystems = newEntry; - } // end for, i + } - } // end else, load + } // armor set flags m_curArmorSetFlags.xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1312,4 +1312,4 @@ void ActiveBody::loadPostProcess( void ) // extend base class BodyModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/BodyModule.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/BodyModule.cpp index aa28bcf0d14..e85e5890f2b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/BodyModule.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/BodyModule.cpp @@ -41,7 +41,7 @@ void BodyModule::crc( Xfer *xfer ) // call base class BehaviorModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -62,7 +62,7 @@ void BodyModule::xfer( Xfer *xfer ) // damage scalar xfer->xferReal( &m_damageScalar ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -73,4 +73,4 @@ void BodyModule::loadPostProcess( void ) // call base class BehaviorModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/HighlanderBody.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/HighlanderBody.cpp index f07954be642..6ec1e0f3151 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/HighlanderBody.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/HighlanderBody.cpp @@ -69,7 +69,7 @@ void HighlanderBody::crc( Xfer *xfer ) // extend base class ActiveBody::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -87,7 +87,7 @@ void HighlanderBody::xfer( Xfer *xfer ) // extend base class ActiveBody::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -98,4 +98,4 @@ void HighlanderBody::loadPostProcess( void ) // extend base class ActiveBody::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/HiveStructureBody.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/HiveStructureBody.cpp index ba4a004e338..e5cb90429ee 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/HiveStructureBody.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/HiveStructureBody.cpp @@ -113,7 +113,7 @@ void HiveStructureBody::crc( Xfer *xfer ) // extend parent class StructureBody::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ImmortalBody.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ImmortalBody.cpp index 0f323fe1a31..1fffc969c68 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ImmortalBody.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ImmortalBody.cpp @@ -74,7 +74,7 @@ void ImmortalBody::crc( Xfer *xfer ) // extend base class ActiveBody::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -92,7 +92,7 @@ void ImmortalBody::xfer( Xfer *xfer ) // extend base class ActiveBody::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -103,4 +103,4 @@ void ImmortalBody::loadPostProcess( void ) // extend base class ActiveBody::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/InactiveBody.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/InactiveBody.cpp index acded0b23ff..7f820cb5304 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/InactiveBody.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/InactiveBody.cpp @@ -47,14 +47,14 @@ InactiveBody::InactiveBody( Thing *thing, const ModuleData* moduleData ) : BodyModule( thing, moduleData ), m_dieCalled(false) { getObject()->setEffectivelyDead(true); -} // end InactiveBody +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- InactiveBody::~InactiveBody( void ) { -} // end ~InactiveBody +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -146,7 +146,7 @@ Real InactiveBody::getHealth() const // Inactive bodies have no health to get return 0.0f; -} // end getHealth +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -171,7 +171,7 @@ void InactiveBody::crc( Xfer *xfer ) // extend base class BodyModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -189,7 +189,7 @@ void InactiveBody::xfer( Xfer *xfer ) // base class BodyModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -200,6 +200,6 @@ void InactiveBody::loadPostProcess( void ) // extend base class BodyModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/StructureBody.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/StructureBody.cpp index 0ad60fa91ee..01023408379 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/StructureBody.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/StructureBody.cpp @@ -45,14 +45,14 @@ StructureBody::StructureBody( Thing *thing, const ModuleData* moduleData ) m_constructorObjectID = INVALID_ID; -} // end StructureBody +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- StructureBody::~StructureBody( void ) { -} // end ~StructureBody +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -62,7 +62,7 @@ void StructureBody::setConstructorObject( Object *obj ) if( obj ) m_constructorObjectID = obj->getID(); -} // end setConstructorObject +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -73,7 +73,7 @@ void StructureBody::crc( Xfer *xfer ) // extend base class ActiveBody::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -94,7 +94,7 @@ void StructureBody::xfer( Xfer *xfer ) // constructor object id xfer->xferObjectID( &m_constructorObjectID ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -105,4 +105,4 @@ void StructureBody::loadPostProcess( void ) // extend base class ActiveBody::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CollideModule.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CollideModule.cpp index ff3ef22f97d..4e63d980878 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CollideModule.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CollideModule.cpp @@ -41,7 +41,7 @@ void CollideModule::crc( Xfer *xfer ) // extend base class BehaviorModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -57,7 +57,7 @@ void CollideModule::xfer( Xfer *xfer ) // call base class BehaviorModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -68,4 +68,4 @@ void CollideModule::loadPostProcess( void ) // call base class BehaviorModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToCarBombCrateCollide.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToCarBombCrateCollide.cpp index 1b7c9415383..5155e0a01f2 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToCarBombCrateCollide.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToCarBombCrateCollide.cpp @@ -159,7 +159,7 @@ void ConvertToCarBombCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -177,7 +177,7 @@ void ConvertToCarBombCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -188,4 +188,4 @@ void ConvertToCarBombCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToHijackedVehicleCrateCollide.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToHijackedVehicleCrateCollide.cpp index 11b979d16d1..cf6a3dfd953 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToHijackedVehicleCrateCollide.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToHijackedVehicleCrateCollide.cpp @@ -194,7 +194,7 @@ Bool ConvertToHijackedVehicleCrateCollide::executeCrateBehavior( Object *other ) targetCanEject = TRUE; break; } - } // end for dmi + } if ( ! targetCanEject ) { @@ -251,7 +251,7 @@ void ConvertToHijackedVehicleCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -269,7 +269,7 @@ void ConvertToHijackedVehicleCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -280,4 +280,4 @@ void ConvertToHijackedVehicleCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp index 77258db5afb..8565823575f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp @@ -189,7 +189,7 @@ void CrateCollide::crc( Xfer *xfer ) // extend base class CollideModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -207,7 +207,7 @@ void CrateCollide::xfer( Xfer *xfer ) // extend base class CollideModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -218,4 +218,4 @@ void CrateCollide::loadPostProcess( void ) // extend base class CollideModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/HealCrateCollide.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/HealCrateCollide.cpp index d07d9dac0ec..ed49bc9a485 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/HealCrateCollide.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/HealCrateCollide.cpp @@ -73,7 +73,7 @@ void HealCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -91,7 +91,7 @@ void HealCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -102,5 +102,5 @@ void HealCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/MoneyCrateCollide.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/MoneyCrateCollide.cpp index 23e352bf844..da226517f03 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/MoneyCrateCollide.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/MoneyCrateCollide.cpp @@ -75,7 +75,7 @@ void MoneyCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -93,7 +93,7 @@ void MoneyCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -104,4 +104,4 @@ void MoneyCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SalvageCrateCollide.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SalvageCrateCollide.cpp index 20d5573116b..8d948109b54 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SalvageCrateCollide.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SalvageCrateCollide.cpp @@ -221,7 +221,7 @@ void SalvageCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -239,7 +239,7 @@ void SalvageCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -250,4 +250,4 @@ void SalvageCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ShroudCrateCollide.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ShroudCrateCollide.cpp index a024287d3ca..8c4e43b6a4a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ShroudCrateCollide.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ShroudCrateCollide.cpp @@ -73,7 +73,7 @@ void ShroudCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -91,7 +91,7 @@ void ShroudCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -102,4 +102,4 @@ void ShroudCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/UnitCrateCollide.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/UnitCrateCollide.cpp index 7883095a0a9..d7a01e0ff82 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/UnitCrateCollide.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/UnitCrateCollide.cpp @@ -100,7 +100,7 @@ void UnitCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -118,7 +118,7 @@ void UnitCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -129,4 +129,4 @@ void UnitCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/VeterancyCrateCollide.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/VeterancyCrateCollide.cpp index fb3cb799570..a0f5eedd1fa 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/VeterancyCrateCollide.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/VeterancyCrateCollide.cpp @@ -178,7 +178,7 @@ void VeterancyCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -196,7 +196,7 @@ void VeterancyCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -207,4 +207,4 @@ void VeterancyCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/FireWeaponCollide.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/FireWeaponCollide.cpp index 98ccfd13bcb..e80fe95fac7 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/FireWeaponCollide.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/FireWeaponCollide.cpp @@ -120,7 +120,7 @@ void FireWeaponCollide::crc( Xfer *xfer ) // extend base class CollideModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -148,19 +148,19 @@ void FireWeaponCollide::xfer( Xfer *xfer ) ("FireWeaponCollide::xfer - m_collideWeapon present mismatch") ); xfer->xferSnapshot( m_collideWeapon ); - } // end else + } else { DEBUG_ASSERTCRASH( m_collideWeapon == NULL, ("FireWeaponCollide::Xfer - m_collideWeapon missing mismatch" )); - } // end else + } // ever fired xfer->xferBool( &m_everFired ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -171,4 +171,4 @@ void FireWeaponCollide::loadPostProcess( void ) // extend base class CollideModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/SquishCollide.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/SquishCollide.cpp index efc7546a22e..956fd4c3973 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/SquishCollide.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/SquishCollide.cpp @@ -138,7 +138,7 @@ void SquishCollide::crc( Xfer *xfer ) // extend base class CollideModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -156,7 +156,7 @@ void SquishCollide::xfer( Xfer *xfer ) // extend base class CollideModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -167,4 +167,4 @@ void SquishCollide::loadPostProcess( void ) // extend base class CollideModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/CaveContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/CaveContain.cpp index 785fad78171..02e587efdb1 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/CaveContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/CaveContain.cpp @@ -188,7 +188,7 @@ void CaveContain::onRemoving( Object *obj ) draw->clearModelConditionState( MODELCONDITION_GARRISONED ); } - } // end if + } } Bool CaveContain::isValidContainerFor(const Object* obj, Bool checkCapacity) const @@ -374,7 +374,7 @@ void CaveContain::crc( Xfer *xfer ) // extend base class OpenContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -414,15 +414,15 @@ void CaveContain::xfer( Xfer *xfer ) DEBUG_CRASH(( "CaveContain::xfer - Unable to find original team by id" )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } else m_originalTeam = NULL; - } // end if + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -433,4 +433,4 @@ void CaveContain::loadPostProcess( void ) // extend base class OpenContain::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp index ab1f93efa3f..29f3a866cd0 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp @@ -75,7 +75,7 @@ GarrisonContainModuleData::GarrisonContainModuleData( void ) m_immuneToClearBuildingAttacks = false; m_initialRoster.count = 0; -} // end if +} //----------------------------------------------------------------------------- inline Real calcDistSqr(const Coord3D& a, const Coord3D& b) @@ -117,15 +117,15 @@ Int GarrisonContain::findClosestFreeGarrisonPointIndex( Int conditionIndex, closestDistSq = distSq; closestIndex = i; - } // end if + } - } // end if + } - } // end for i + } return closestIndex; -} // end findClosestFreeGarrisonPointIndex +} // ------------------------------------------------------------------------------------------------ /** Given the object, return the garrison point index the object is placed at ... if any */ @@ -143,7 +143,7 @@ Int GarrisonContain::getObjectGarrisonPointIndex( Object *obj ) return GARRISON_INDEX_INVALID; -} // end getObjectGarrisonPointIndex +} // ------------------------------------------------------------------------------------------------ /** Put the object at the specified garrison point by index */ @@ -163,7 +163,7 @@ void GarrisonContain::putObjectAtGarrisonPoint( Object *obj, DEBUG_CRASH(( "GarrisionContain::putObjectAtGarrisionPoint - Invalid arguments" )); return; - } // end if + } // make sure this point is empty if( m_garrisonPointData[ pointIndex ].object != NULL ) @@ -173,7 +173,7 @@ void GarrisonContain::putObjectAtGarrisonPoint( Object *obj, pointIndex )); return; - } // end if + } // get the position we're going to use Coord3D pos = m_garrisonPoint[ conditionIndex ][ pointIndex ]; @@ -211,9 +211,9 @@ void GarrisonContain::putObjectAtGarrisonPoint( Object *obj, if (containerDrawable) draw->setFullyObscuredByShroud(containerDrawable->getFullyObscuredByShroud()); - } // end if + } - } // end if + } /* UnicodeString msg; @@ -224,7 +224,7 @@ msg.format( L"Added object '%S'(%d) to point '%d'", TheInGameUI->message( msg ); */ -} // end putObjectAtGarrisonPoint +} // ------------------------------------------------------------------------------------------------ /** Given the current state of the structure, return the condition index we are to use @@ -265,11 +265,11 @@ Int GarrisonContain::findConditionIndex( void ) bodyDamage )); break; - } // end switch + } return index; -} // end findConditionIndex +} //------------------------------------------------------------------------------------------------- //The weapon system would like to perform a range check assuming the object is placed in the @@ -401,7 +401,7 @@ void GarrisonContain::putObjectAtBestGarrisonPoint( Object *obj, Object *target, // put it here putObjectAtGarrisonPoint( obj, target ? target->getID() : INVALID_ID, conditionIndex, placeIndex ); -} // end putObjectAtBestGarrisonPoint +} // ------------------------------------------------------------------------------------------------ /** Remove the object from the garrison point position and replace at the center of the building */ @@ -427,11 +427,11 @@ void GarrisonContain::removeObjectFromGarrisonPoint( Object *obj, Int index ) removeIndex = i; break; - } // end if + } - } // end for i + } - } // end if + } // validate the index slot to remove if( removeIndex < 0 || removeIndex >= MAX_GARRISON_POINTS ) @@ -443,7 +443,7 @@ void GarrisonContain::removeObjectFromGarrisonPoint( Object *obj, Int index ) // return; - } // end if + } // remove from this spot m_garrisonPointData[ removeIndex ].object = NULL; @@ -469,7 +469,7 @@ msg.format( L"Removed object '%S'(%d) from point '%d'", TheInGameUI->message( msg ); */ -} // end removeObjectFromGarrisonPoint +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -495,19 +495,19 @@ GarrisonContain::GarrisonContain( Thing *thing, const ModuleData *moduleData ) : for( j = 0; j < MAX_GARRISON_POINT_CONDITIONS; ++j ) m_garrisonPoint[ j ][ i ].zero(); - } // end for i + } m_rallyValid = FALSE; m_exitRallyPoint.zero(); -} // end GarrisonContain +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- GarrisonContain::~GarrisonContain( void ) { -} // end ~GarrisonContain +} //------------------------------------------------------------------------------------------------- /** can this container contain this kind of object? @@ -584,11 +584,11 @@ void GarrisonContain::removeInvalidObjectsFromGarrisonPoints( void ) removeObjectFromGarrisonPoint( obj, i ); } - } // end if + } - } // end for i + } -} // end removeInvalidObjectsFromGarrisonPoints +} // ------------------------------------------------------------------------------------------------ /** Are there any objects in the center that have now obtained targets and need to move to @@ -619,11 +619,11 @@ void GarrisonContain::addValidObjectsToGarrisonPoints( void ) else if( victimPos ) putObjectAtBestGarrisonPoint( obj, NULL, victimPos ); - } // end if + } - } // end for it + } -} // end addValidObjectsToGarrisonPoints +} // ------------------------------------------------------------------------------------------------ /** Every frame this method is called. It keeps any of the attacking units at any of the @@ -688,9 +688,9 @@ void GarrisonContain::trackTargets( void ) // place at the new index putObjectAtGarrisonPoint( obj, victim ? victim->getID() : INVALID_ID, conditionIndex, newIndex ); - } // end if, new index is closer + } - } // end if, possible closer index was found + } // // we are now either at a new garrison fire point, or we have remained at our @@ -707,17 +707,17 @@ void GarrisonContain::trackTargets( void ) // orient the effect object towards the victim position m_garrisonPointData[ ourIndex ].effect->setOrientation( v.toAngle() ); - } // end if + } - } // end if, victim present + } - } // end if, ai + } - } // end if, we're at a garrison point + } - } // end for it + } -} // end trackTargets +} // ------------------------------------------------------------------------------------------------ /** Remove all the objects at garrison points back to the center and redeploy them among the @@ -754,11 +754,11 @@ void GarrisonContain::redeployOccupants( void ) if( index != GARRISON_INDEX_INVALID ) m_garrisonPointData[ index ].placeFrame = garrisonPointDataCopy[ i ].placeFrame; - } // end if + } - } // end for i + } -} // end redeployOccupants +} // ------------------------------------------------------------------------------------------------ /** Do any effects during an update cycle that we need to */ @@ -798,13 +798,13 @@ void GarrisonContain::updateEffects( void ) // mark this "fire frame" so we can turn it off in a little while m_garrisonPointData[ garrisonIndex ].lastEffectFrame = currentFrame; - } // end if + } - } // end if, object is at garrision point + } - } // end if, object shot last frame + } - } // end for containment iterator + } // remove any firing effects for time that has passed for( Int i = 0; i < MAX_GARRISON_POINTS; ++i ) @@ -821,11 +821,11 @@ void GarrisonContain::updateEffects( void ) // clear the last effect frame m_garrisonPointData[ i ].lastEffectFrame = 0; - } // end if + } - } // end for i + } -} // end updateEffects +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -860,9 +860,9 @@ UpdateSleepTime GarrisonContain::update( void ) #define HUGE_FRAME_IN_FUTURE (LOGICFRAMES_PER_SECOND * 1000) contained->setSafeOcclusionFrame( TheGameLogic->getFrame() + HUGE_FRAME_IN_FUTURE ); - } // end if + } - } // end for, it + } // are there any objects at the garrison points who now need to go back to the center of the structure removeInvalidObjectsFromGarrisonPoints(); @@ -898,7 +898,7 @@ UpdateSleepTime GarrisonContain::update( void ) } return UPDATE_SLEEP_NONE; -} // end update +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -944,7 +944,7 @@ void GarrisonContain::healSingleObject( Object *obj, Real framesForFullHeal) // set max health body->attemptHealing( &healInfo ); - } // end if + } else { // @@ -957,7 +957,7 @@ void GarrisonContain::healSingleObject( Object *obj, Real framesForFullHeal) // do the healing body->attemptHealing( &healInfo ); - } // end else + } } //------------------------------------------------------------------------------------------------- @@ -1146,7 +1146,7 @@ void GarrisonContain::loadGarrisonPoints( void ) // restore the original condition flags draw->replaceModelConditionFlags( originalFlags ); - } // end if, draw + } // garrison points are now initialized m_garrisonPointsInitialized = TRUE; @@ -1161,7 +1161,7 @@ void GarrisonContain::loadGarrisonPoints( void ) -} // end loadGarrisonPoints +} // ------------------------------------------------------------------------------------------------ /** Validate any exit rally point that has been chosen (if any). If it's not valid, @@ -1185,7 +1185,7 @@ void GarrisonContain::validateRallyPoint( void ) if( ThePartitionManager->findPositionAround( &m_exitRallyPoint, &options, &result ) == FALSE ) m_rallyValid = FALSE; - } // end if + } // if no rally point is present, try to find one if( m_rallyValid == FALSE ) @@ -1201,9 +1201,9 @@ void GarrisonContain::validateRallyPoint( void ) m_rallyValid = ThePartitionManager->findPositionAround( getObject()->getPosition(), &options, &m_exitRallyPoint ); - } // end if + } -} // end validateRallyPoint +} // ------------------------------------------------------------------------------------------------ /** Remove all contents of this container. We will try to do so with intelligent garrison @@ -1228,14 +1228,14 @@ void GarrisonContain::removeAllContained( Bool exposeStealthUnits ) // validate the current rally point is still a good one, or pick a new one validateRallyPoint(); - } // end if + } // call the base class to extend functionality and do the actual removal OpenContain::removeAllContained( exposeStealthUnits ); recalcApparentControllingPlayer(); -} // end removeAllContained +} // ------------------------------------------------------------------------------------------------ /** 'exitObj' is one of the things we contain, it needs to 'exit' us */ @@ -1324,7 +1324,7 @@ void GarrisonContain::onContaining( Object *obj ) // recalcApparentControllingPlayer(); -} // end onContaining +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1366,7 +1366,7 @@ void GarrisonContain::onRemoving( Object *obj ) draw->clearModelConditionState( MODELCONDITION_GARRISONED ); } - } // end if + } else if( getStealthUnitsContained() != getContainCount() ) { m_hideGarrisonedStateFromNonallies = false; @@ -1377,7 +1377,7 @@ void GarrisonContain::onRemoving( Object *obj ) obj->setSafeOcclusionFrame(TheGameLogic->getFrame()+obj->getTemplate()->getOcclusionDelay()); recalcApparentControllingPlayer(); -} // end onRemoving +} // ------------------------------------------------------------------------------------------------ /** A GarrisonContain always lets people shoot out */ @@ -1387,7 +1387,7 @@ Bool GarrisonContain::isPassengerAllowedToFire() const return TRUE; -} // end isPassengerAllowedToFire +} // ------------------------------------------------------------------------------------------------ /** A Mobile garrison keeps its occupants with it when it moves */ @@ -1457,7 +1457,7 @@ void GarrisonContain::crc( Xfer *xfer ) // extend base class OpenContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1492,13 +1492,13 @@ void GarrisonContain::xfer( Xfer *xfer ) DEBUG_CRASH(( "GarrisonContain::xfer - Unable to find original team by id" )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } else m_originalTeam = NULL; - } // end if + } xfer->xferBool( &m_hideGarrisonedStateFromNonallies ); @@ -1530,7 +1530,7 @@ void GarrisonContain::xfer( Xfer *xfer ) DrawableID drawableID = draw ? draw->getID() : INVALID_DRAWABLE_ID; xfer->xferDrawableID( &drawableID ); - } // end if, save + } else { @@ -1564,11 +1564,11 @@ void GarrisonContain::xfer( Xfer *xfer ) m_garrisonPointData[ i ].lastEffectFrame = lastEffectFrame; m_garrisonPointData[ i ].effectID = drawableID; - } // end if + } - } // end else, load + } - } // end for i + } // garrison points in use xfer->xferInt( &m_garrisonPointsInUse ); @@ -1585,7 +1585,7 @@ void GarrisonContain::xfer( Xfer *xfer ) // exit rally point xfer->xferCoord3D( &m_exitRallyPoint ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1611,9 +1611,9 @@ void GarrisonContain::loadPostProcess( void ) DEBUG_CRASH(( "GarrisonContain::loadPostProcess - Unable to find object for point data" )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } else m_garrisonPointData[ i ].object = NULL; @@ -1628,15 +1628,15 @@ void GarrisonContain::loadPostProcess( void ) DEBUG_CRASH(( "GarrisonContain::loadPostProcess - Unable to find effect for point data" )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } else m_garrisonPointData[ i ].effect = NULL; - } // end for i + } -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/HealContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/HealContain.cpp index 87fd4abb669..ab3028b2004 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/HealContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/HealContain.cpp @@ -48,7 +48,7 @@ HealContainModuleData::HealContainModuleData( void ) m_framesForFullHeal = 0; -} // end HealContainModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -65,7 +65,7 @@ HealContainModuleData::HealContainModuleData( void ) p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -77,14 +77,14 @@ HealContain::HealContain( Thing *thing, const ModuleData *moduleData ) : OpenContain( thing, moduleData ) { -} // end HealContain +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ HealContain::~HealContain( void ) { -} // end ~HealContain +} // ------------------------------------------------------------------------------------------------ /** Per frame update */ @@ -123,13 +123,13 @@ UpdateSleepTime HealContain::update( void ) ExitDoorType exitDoor = reserveDoorForExit(obj->getTemplate(), obj); if (exitDoor != DOOR_NONE_AVAILABLE) exitObjectViaDoor( obj, exitDoor ); - } // end if + } - } // end for, it + } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** Do the healing for a single object for a single frame. */ @@ -160,7 +160,7 @@ Bool HealContain::doHeal( Object *obj, UnsignedInt framesForFullHeal ) // we're done healing doneHealing = TRUE; - } // end if + } else { @@ -174,12 +174,12 @@ Bool HealContain::doHeal( Object *obj, UnsignedInt framesForFullHeal ) // do the healing body->attemptHealing( &healInfo ); - } // end else + } // return if we're done healing return doneHealing; -} // end doHeal +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -190,7 +190,7 @@ void HealContain::crc( Xfer *xfer ) // extend base class OpenContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -208,7 +208,7 @@ void HealContain::xfer( Xfer *xfer ) // extend base class OpenContain::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -219,4 +219,4 @@ void HealContain::loadPostProcess( void ) // extend base class OpenContain::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/MobNexusContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/MobNexusContain.cpp index 8bea5050f1b..486d4f00348 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/MobNexusContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/MobNexusContain.cpp @@ -221,7 +221,7 @@ void MobNexusContain::onContaining( Object *rider ) if( draw ) draw->setModelConditionState( MODELCONDITION_LOADED ); - } // end if + } } @@ -289,7 +289,7 @@ void MobNexusContain::onRemoving( Object *rider ) if( draw ) draw->clearModelConditionState( MODELCONDITION_LOADED ); - } // end if + } if (getObject()->isAboveTerrain()) { @@ -462,7 +462,7 @@ void MobNexusContain::crc( Xfer *xfer ) // extend base class OpenContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -483,7 +483,7 @@ void MobNexusContain::xfer( Xfer *xfer ) // extra slots in use xfer->xferInt( &m_extraSlotsInUse ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -494,4 +494,4 @@ void MobNexusContain::loadPostProcess( void ) // extend base class OpenContain::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp index 501890c9c57..1f1d6eca1c3 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp @@ -78,7 +78,7 @@ OpenContainModuleData::OpenContainModuleData( void ) m_allowAlliesInside = TRUE; m_allowEnemiesInside = TRUE; m_allowNeutralInside = TRUE; -} // end OpenContainModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -143,7 +143,7 @@ OpenContain::OpenContain( Thing *thing, const ModuleData* moduleData ) : UpdateM for( Int i = 0; i < MAX_FIRE_POINTS; i++ ) { m_firePoints[ i ].Make_Identity(); - } // end for i + } } @@ -155,7 +155,7 @@ Int OpenContain::getContainMax( void ) const return modData->m_containMax; -} // end getContainMax +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -408,9 +408,9 @@ void OpenContain::removeAllContained( Bool exposeStealthUnits ) // note that this invalidates the iterator! removeFromContainViaIterator( it, exposeStealthUnits ); - } // end while + } -} // end removeAllContained +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -612,14 +612,14 @@ void OpenContain::scatterToNearbyPosition(Object* rider) ai->ignoreObstacle(theContainer); ai->aiMoveToPosition( &pos, CMD_FROM_AI ); - } // end if + } else { // no ai, just set position at the target pos rider->setPosition( &pos ); - } // end else + } } //------------------------------------------------------------------------------------------------- @@ -805,14 +805,14 @@ Bool OpenContain::isValidContainerFor(const Object* obj, Bool checkCapacity) con obj->getTemplate()->getName().str() )); return FALSE; - } // end switch + } if( relationshipRestricted == TRUE ) return FALSE; // all is well return true; -} // end isValidContainerFor +} // ------------------------------------------------------------------------------------------------ /** @@ -1076,7 +1076,7 @@ void OpenContain::monitorConditionChanges( void ) m_conditionState = currCondition; } -} // end monitorConditionChanges +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1104,7 +1104,7 @@ void OpenContain::redeployOccupants( void ) putObjAtNextFirePoint( *it ); } -} // end redeployOccupants +} //------------------------------------------------------------------------------------------------- /** Place the object at the 3D position of the next fire point to use */ @@ -1129,7 +1129,7 @@ void OpenContain::putObjAtNextFirePoint( Object *obj ) if( m_firePointSize == 0 ) m_noFirePointsInArt = TRUE; - } // end if + } // // if there are no fire points in the art we just put the object at the center @@ -1142,7 +1142,7 @@ void OpenContain::putObjAtNextFirePoint( Object *obj ) obj->setPosition( pos ); return; - } // end if + } // get the position Matrix3D matrix; @@ -1180,7 +1180,7 @@ void OpenContain::putObjAtNextFirePoint( Object *obj ) if( m_firePointNext >= m_firePointSize ) m_firePointNext = 0; -} // end putObjAtNextFirePoint +} //------------------------------------------------------------------------------------------------- /** @@ -1440,7 +1440,7 @@ void OpenContain::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1472,9 +1472,9 @@ void OpenContain::xfer( Xfer *xfer ) objectID = (*it)->getID(); xfer->xferObjectID( &objectID ); - } // end for, it + } - } // end if, save + } else { @@ -1498,7 +1498,7 @@ void OpenContain::xfer( Xfer *xfer ) throw SC_INVALID_DATA; #endif - } // end if + } // contain list size xfer->xferUnsignedInt( &m_containListSize ); @@ -1513,9 +1513,9 @@ void OpenContain::xfer( Xfer *xfer ) // put on list for later processing once objects are loaded m_xferContainIDList.push_back( objectID ); - } // end for, i + } - } // end else, load + } // player entered mask xfer->xferUser( &m_playerEnteredMask, sizeof( PlayerMaskType ) ); @@ -1575,9 +1575,9 @@ void OpenContain::xfer( Xfer *xfer ) enterExitType = (*it).second; xfer->xferUser( &enterExitType, sizeof( ObjectEnterExitType ) ); - } // end for, it + } - } // end if, save + } else { @@ -1588,7 +1588,7 @@ void OpenContain::xfer( Xfer *xfer ) DEBUG_CRASH(( "OpenContain::xfer - m_objectEnterExitInfo should be empty, but is not" )); throw SC_INVALID_DATA; - } // end if + } // read all data items for( UnsignedShort i = 0; i < enterExitCount; ++i ) @@ -1603,14 +1603,14 @@ void OpenContain::xfer( Xfer *xfer ) // assign m_objectEnterExitInfo[ objectID ] = enterExitType; - } // end for, i + } - } // end else, load + } // which exit path xfer->xferInt( &m_whichExitPath ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1629,7 +1629,7 @@ void OpenContain::loadPostProcess( void ) DEBUG_CRASH(( "OpenContain::loadPostProcess - Contain list should be empty before load but is not" )); throw SC_INVALID_DATA; - } // end if + } // turn the contained id list into actual object pointers in the contain list Object *obj; @@ -1647,7 +1647,7 @@ void OpenContain::loadPostProcess( void ) DEBUG_CRASH(( "OpenContain::loadPostProcess - Unable to find object to put on contain list" )); throw SC_INVALID_DATA; - } // end if + } // put object on list m_containList.push_back( obj ); @@ -1659,7 +1659,7 @@ void OpenContain::loadPostProcess( void ) // record in the object who we are contained by obj->friend_setContainedBy( us ); - } // end for, idIt + } // sanity DEBUG_ASSERTCRASH( m_containListSize == m_containList.size(), @@ -1668,4 +1668,4 @@ void OpenContain::loadPostProcess( void ) // clear the list as we don't need it anymore m_xferContainIDList.clear(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp index 7aecb1355b2..1014aa67457 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp @@ -466,7 +466,7 @@ void OverlordContain::crc( Xfer *xfer ) // extend base class TransportContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -487,7 +487,7 @@ void OverlordContain::xfer( Xfer *xfer ) // redirection activated xfer->xferBool( &m_redirectionActivated ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -498,4 +498,4 @@ void OverlordContain::loadPostProcess( void ) // extend base class TransportContain::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp index e2902fd9b02..2795b8b829e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp @@ -646,7 +646,7 @@ void ParachuteContain::crc( Xfer *xfer ) // extend base class OpenContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -718,7 +718,7 @@ void ParachuteContain::xfer( Xfer *xfer ) // opened xfer->xferBool( &m_opened ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -729,4 +729,4 @@ void ParachuteContain::loadPostProcess( void ) // extend base class OpenContain::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/RailedTransportContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/RailedTransportContain.cpp index fa9245aa367..2d314956ef4 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/RailedTransportContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/RailedTransportContain.cpp @@ -51,7 +51,7 @@ static RailedTransportDockUpdateInterface *getRailedTransportDockUpdateInterface return rtdui; -} // end getRailedTransportDockUpdateInterface +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -59,14 +59,14 @@ RailedTransportContain::RailedTransportContain( Thing *thing, const ModuleData * : TransportContain( thing, moduleData ) { -} // end RailedTransportContain +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ RailedTransportContain::~RailedTransportContain( void ) { -} // end ~RailedTransportContain +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -83,9 +83,9 @@ void RailedTransportContain::onRemoving( Object *obj ) if( dui ) dui->setDockOpen( TRUE ); - } // end if + } -} // end onRemoving +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -101,7 +101,7 @@ Bool RailedTransportContain::isSpecificRiderFreeToExit( Object *obj ) // we can now exit, note we're not extending the base class cause *we* handle it all return TRUE; -} // end isSpecificRiderFreeToExit +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -115,7 +115,7 @@ void RailedTransportContain::exitObjectViaDoor( Object *newObj, ExitDoorType exi // tell the railed dock to exit ONE object, this one rtdui->unloadSingleObject( newObj ); -} // end exitObjectViaDoor +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -126,7 +126,7 @@ void RailedTransportContain::crc( Xfer *xfer ) // extend base class TransportContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -144,7 +144,7 @@ void RailedTransportContain::xfer( Xfer *xfer ) // extend base class TransportContain::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -155,4 +155,4 @@ void RailedTransportContain::loadPostProcess( void ) // extend base class TransportContain::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp index ccc6d84493d..09d571e4c9a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp @@ -227,7 +227,7 @@ void TransportContain::onContaining( Object *rider ) if( draw ) draw->setModelConditionState( MODELCONDITION_LOADED ); - } // end if + } } @@ -292,7 +292,7 @@ void TransportContain::onRemoving( Object *rider ) if( draw ) draw->clearModelConditionState( MODELCONDITION_LOADED ); - } // end if + } if (getObject()->isAboveTerrain()) { @@ -517,7 +517,7 @@ void TransportContain::crc( Xfer *xfer ) // extend base class OpenContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -544,7 +544,7 @@ void TransportContain::xfer( Xfer *xfer ) // frame exit not busy xfer->xferUnsignedInt( &m_frameExitNotBusy ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -555,4 +555,4 @@ void TransportContain::loadPostProcess( void ) // extend base class OpenContain::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp index 7708516be6a..68e5d01e8b0 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp @@ -290,14 +290,14 @@ void TunnelContain::scatterToNearbyPosition(Object* obj) ai->ignoreObstacle(theContainer); ai->aiMoveToPosition( &pos, CMD_FROM_AI ); - } // end if + } else { // no ai, just set position at the target pos obj->setPosition( &pos ); - } // end else + } } //------------------------------------------------------------------------------------------------- @@ -431,7 +431,7 @@ void TunnelContain::crc( Xfer *xfer ) // extend base class OpenContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -455,7 +455,7 @@ void TunnelContain::xfer( Xfer *xfer ) // Currently registered with owning player xfer->xferBool( &m_isCurrentlyRegistered ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -466,4 +466,4 @@ void TunnelContain::loadPostProcess( void ) // extend base class OpenContain::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/CreateModule.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/CreateModule.cpp index 14a4e25c5ba..63d7cfc5980 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/CreateModule.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/CreateModule.cpp @@ -39,14 +39,14 @@ CreateModule::CreateModule( Thing *thing, const ModuleData* moduleData ) m_needToRunOnBuildComplete(TRUE) { -} // end createModule +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ CreateModule::~CreateModule() { -} // end ~CreateModule +} //------------------------------------------------------------------------------------------------- /** CRC */ @@ -57,7 +57,7 @@ void CreateModule::crc( Xfer *xfer ) // extend base class BehaviorModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -78,7 +78,7 @@ void CreateModule::xfer( Xfer *xfer ) // need to run on build complete xfer->xferBool( &m_needToRunOnBuildComplete ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -89,6 +89,6 @@ void CreateModule::loadPostProcess( void ) // extend base class BehaviorModule::loadPostProcess(); -} // ene loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp index 39a3e4eb9f5..4817205da7e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp @@ -68,14 +68,14 @@ void GrantUpgradeCreateModuleData::buildFieldParse(MultiIniFieldParse& p) //------------------------------------------------------------------------------------------------- GrantUpgradeCreate::GrantUpgradeCreate( Thing *thing, const ModuleData* moduleData ) : CreateModule( thing, moduleData ) { -} // end GrantUpgradeCreate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- GrantUpgradeCreate::~GrantUpgradeCreate( void ) { -} // end ~GrantUpgradeCreate +} //------------------------------------------------------------------------------------------------- /** The create callback. */ @@ -109,7 +109,7 @@ void GrantUpgradeCreate::onCreate( void ) } } -} // end onCreate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -137,7 +137,7 @@ void GrantUpgradeCreate::onBuildComplete( void ) { getObject()->giveUpgrade( upgradeTemplate ); } -} // end onBuildComplete +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -148,7 +148,7 @@ void GrantUpgradeCreate::crc( Xfer *xfer ) // extend base class CreateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -166,7 +166,7 @@ void GrantUpgradeCreate::xfer( Xfer *xfer ) // extend base class CreateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -177,4 +177,4 @@ void GrantUpgradeCreate::loadPostProcess( void ) // extend base class CreateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/PreorderCreate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/PreorderCreate.cpp index 811a6fcdd88..faffa69e987 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/PreorderCreate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/PreorderCreate.cpp @@ -77,7 +77,7 @@ void PreorderCreate::crc( Xfer *xfer ) // extend base class CreateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -95,7 +95,7 @@ void PreorderCreate::xfer( Xfer *xfer ) // extend base class CreateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -106,4 +106,4 @@ void PreorderCreate::loadPostProcess( void ) // extend base class CreateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/SpecialPowerCreate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/SpecialPowerCreate.cpp index 71734f7953b..234927a8600 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/SpecialPowerCreate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/SpecialPowerCreate.cpp @@ -81,7 +81,7 @@ void SpecialPowerCreate::crc( Xfer *xfer ) // extend base class CreateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -99,7 +99,7 @@ void SpecialPowerCreate::xfer( Xfer *xfer ) // extend base class CreateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -110,4 +110,4 @@ void SpecialPowerCreate::loadPostProcess( void ) // extend base class CreateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/SupplyCenterCreate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/SupplyCenterCreate.cpp index df1e715ecdd..c3709280838 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/SupplyCenterCreate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/SupplyCenterCreate.cpp @@ -87,7 +87,7 @@ void SupplyCenterCreate::crc( Xfer *xfer ) // extend base class CreateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -105,7 +105,7 @@ void SupplyCenterCreate::xfer( Xfer *xfer ) // extend base class CreateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -116,4 +116,4 @@ void SupplyCenterCreate::loadPostProcess( void ) // extend base class CreateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/SupplyWarehouseCreate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/SupplyWarehouseCreate.cpp index db1bbdbe499..8933fba25de 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/SupplyWarehouseCreate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/SupplyWarehouseCreate.cpp @@ -78,7 +78,7 @@ void SupplyWarehouseCreate::crc( Xfer *xfer ) // extend base class CreateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -96,7 +96,7 @@ void SupplyWarehouseCreate::xfer( Xfer *xfer ) // extend base class CreateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -107,4 +107,4 @@ void SupplyWarehouseCreate::loadPostProcess( void ) // extend base class CreateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp index bcad27cb6b7..7a58e0056a3 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp @@ -107,7 +107,7 @@ void VeterancyGainCreate::crc( Xfer *xfer ) // extend base class CreateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -125,7 +125,7 @@ void VeterancyGainCreate::xfer( Xfer *xfer ) // extend base class CreateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -136,4 +136,4 @@ void VeterancyGainCreate::loadPostProcess( void ) // extend base class CreateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Damage/BoneFXDamage.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Damage/BoneFXDamage.cpp index f219f56efc1..e77c8919adb 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Damage/BoneFXDamage.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Damage/BoneFXDamage.cpp @@ -42,14 +42,14 @@ BoneFXDamage::BoneFXDamage( Thing *thing, const ModuleData* moduleData ) : DamageModule( thing, moduleData ) { -} // end BoneFXDamage +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- BoneFXDamage::~BoneFXDamage( void ) { -} // end ~BoneFXDamage +} //------------------------------------------------------------------------------------------------- void BoneFXDamage::onObjectCreated() @@ -75,7 +75,7 @@ void BoneFXDamage::onBodyDamageStateChange( const DamageInfo *damageInfo, if (bfxu) bfxu->changeBodyDamageState(oldState, newState); -} // end onBodyDamageStateChange +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -86,7 +86,7 @@ void BoneFXDamage::crc( Xfer *xfer ) // extend base class DamageModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -104,7 +104,7 @@ void BoneFXDamage::xfer( Xfer *xfer ) // extend base class DamageModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -115,4 +115,4 @@ void BoneFXDamage::loadPostProcess( void ) // extend base class DamageModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Damage/DamageModule.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Damage/DamageModule.cpp index cac94500fbf..aecfa8d4efc 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Damage/DamageModule.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Damage/DamageModule.cpp @@ -41,7 +41,7 @@ void DamageModule::crc( Xfer *xfer ) // extend base class BehaviorModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -57,7 +57,7 @@ void DamageModule::xfer( Xfer *xfer ) // call base class BehaviorModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -68,4 +68,4 @@ void DamageModule::loadPostProcess( void ) // call base class BehaviorModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp index 8a82f6386f8..eda9d2eda31 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp @@ -69,15 +69,15 @@ TransitionDamageFXModuleData::TransitionDamageFXModuleData( void ) m_particleSystem[ i ][ j ].locInfo.locType = FX_DAMAGE_LOC_TYPE_COORD; m_particleSystem[ i ][ j ].locInfo.randomBone = FALSE; - } // end for j + } - } // end for i + } m_damageFXTypes = DAMAGE_TYPE_FLAGS_ALL; m_damageOCLTypes = DAMAGE_TYPE_FLAGS_ALL; m_damageParticleTypes = DAMAGE_TYPE_FLAGS_ALL; -} // end TransitionDamageFXModuleData +} //------------------------------------------------------------------------------------------------- /** Parse fx location info ... that is a named bone or a coord3d position */ @@ -105,12 +105,12 @@ static void parseFXLocInfo( INI *ini, void *instance, FXLocInfo *locInfo ) DEBUG_CRASH(( "parseFXLocInfo: Bone name not followed by RandomBone specifier\nPress IGNORE to see which INI file and line # is incorrect." )); throw INI_INVALID_DATA; - } // end if + } // parse the Bool definition ini->parseBool( ini, instance, &locInfo->randomBone, NULL ); - } // end if + } else if( stricmp( token, "loc" ) == 0 ) { @@ -120,16 +120,16 @@ static void parseFXLocInfo( INI *ini, void *instance, FXLocInfo *locInfo ) locInfo->loc.z = ini->scanReal( ini->getNextSubToken("Z") ); locInfo->locType = FX_DAMAGE_LOC_TYPE_COORD; - } // end else + } else { // error throw INI_INVALID_DATA; - } // end else + } -} // end parseFXLocInfo +} //------------------------------------------------------------------------------------------------- /** In the form of: @@ -152,12 +152,12 @@ void TransitionDamageFXModuleData::parseFXList( INI *ini, void *instance, // error throw INI_INVALID_DATA; - } // end if + } // parse the fx list name ini->parseFXList( ini, instance, &info->fx, NULL ); -} // end parseFXList +} //------------------------------------------------------------------------------------------------- /** In the form of: @@ -180,12 +180,12 @@ void TransitionDamageFXModuleData::parseObjectCreationList( INI *ini, void *inst // error throw INI_INVALID_DATA; - } // end if + } // parse the ocl name ini->parseObjectCreationList( ini, instance, store, &info->ocl ); -} // end parseObjectCreationList +} //------------------------------------------------------------------------------------------------- /** In the form of: @@ -208,12 +208,12 @@ void TransitionDamageFXModuleData::parseParticleSystem( INI *ini, void *instance // error throw INI_INVALID_DATA; - } // end if + } // parse the particle system name ini->parseParticleSystemTemplate( ini, instance, store, &info->particleSysTemplate ); -} // end parseParticleSystem +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -226,14 +226,14 @@ TransitionDamageFX::TransitionDamageFX( Thing *thing, const ModuleData* moduleDa for( j = 0; j < DAMAGE_MODULE_MAX_FX; j++ ) m_particleSystemID[ i ][ j ] = INVALID_PARTICLE_SYSTEM_ID; -} // end TransitionDamageFX +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- TransitionDamageFX::~TransitionDamageFX( void ) { -} // end ~TransitionDamageFX +} /* //------------------------------------------------------------------------------------------------- @@ -246,7 +246,7 @@ void TransitionDamageFX::onDelete( void ) // particle system will automatically delete itself when the object is destroyed // -} // end onDelete +} */ //------------------------------------------------------------------------------------------------- @@ -275,7 +275,7 @@ static Coord3D getLocalEffectPos( const FXLocInfo *locInfo, Drawable *draw ) // return the position retrieved return pos; - } // end if + } else { const Int MAX_BONES = 32; @@ -293,13 +293,13 @@ static Coord3D getLocalEffectPos( const FXLocInfo *locInfo, Drawable *draw ) Int pick = GameLogicRandomValue( 0, boneCount - 1 ); return positions[ pick ]; - } // end else + } - } // end if + } else return locInfo->loc; -} // end getLocalEffectPos +} //------------------------------------------------------------------------------------------------- /** Switching damage states */ @@ -327,9 +327,9 @@ void TransitionDamageFX::onBodyDamageStateChange( const DamageInfo* damageInfo, TheParticleSystemManager->destroyParticleSystemByID( m_particleSystemID[ oldState ][ i ] ); m_particleSystemID[ oldState ][ i ] = INVALID_PARTICLE_SYSTEM_ID; - } // end if + } - } // end for i + } // // when we are transitioning to a "worse" state we will play a set of effects for that @@ -358,9 +358,9 @@ void TransitionDamageFX::onBodyDamageStateChange( const DamageInfo* damageInfo, getObject()->convertBonePosToWorldPos( &pos, NULL, &pos, NULL ); FXList::doFXPos( modData->m_fxList[ newState ][ i ].fx, &pos ); - } // end if + } - } // end if + } // do any object creation list for our new state if( damageSource && modData->m_OCL[ newState ][ i ].ocl ) @@ -375,9 +375,9 @@ void TransitionDamageFX::onBodyDamageStateChange( const DamageInfo* damageInfo, ObjectCreationList::create( modData->m_OCL[ newState ][ i ].ocl, getObject(), &pos, damageSource->getPosition() ); - } // end if + } - } // end if + } // get the template of the system to create pSystemT = modData->m_particleSystem[ newState ][ i ].particleSysTemplate; @@ -410,17 +410,17 @@ void TransitionDamageFX::onBodyDamageStateChange( const DamageInfo* damageInfo, // save the id of this particle system so we can remove it later if it still exists m_particleSystemID[ newState ][ i ] = pSystem->getSystemID(); - } // end if + } - } // end if + } - } // end if + } - } // end for i + } - } // end if + } -} // end onBodyDamageStateChange +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -431,7 +431,7 @@ void TransitionDamageFX::crc( Xfer *xfer ) // extend base class DamageModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -452,7 +452,7 @@ void TransitionDamageFX::xfer( Xfer *xfer ) // particle systems ids xfer->xferUser( m_particleSystemID, sizeof( ParticleSystemID ) * BODYDAMAGETYPE_COUNT * DAMAGE_MODULE_MAX_FX ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -463,4 +463,4 @@ void TransitionDamageFX::loadPostProcess( void ) // extend base class DamageModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Destroy/DestroyModule.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Destroy/DestroyModule.cpp index cc5e6e50eba..06beb8b7e9b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Destroy/DestroyModule.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Destroy/DestroyModule.cpp @@ -38,14 +38,14 @@ DestroyModule::DestroyModule( Thing *thing, const ModuleData* moduleData ) : BehaviorModule( thing, moduleData ) { -} // end DestroyModule +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ DestroyModule::~DestroyModule( void ) { -} // end ~DestroyModule +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -56,7 +56,7 @@ void DestroyModule::crc( Xfer *xfer ) // extend base class BehaviorModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -74,7 +74,7 @@ void DestroyModule::xfer( Xfer *xfer ) // extend base class BehaviorModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -85,5 +85,5 @@ void DestroyModule::loadPostProcess( void ) // extend base class BehaviorModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CreateCrateDie.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CreateCrateDie.cpp index a1ff175bd3e..1f31df7993a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CreateCrateDie.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CreateCrateDie.cpp @@ -261,7 +261,7 @@ void CreateCrateDie::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -279,7 +279,7 @@ void CreateCrateDie::xfer( Xfer *xfer ) // extend base class DieModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -290,4 +290,4 @@ void CreateCrateDie::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CreateObjectDie.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CreateObjectDie.cpp index d524b785c28..b57369bcbff 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CreateObjectDie.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CreateObjectDie.cpp @@ -90,7 +90,7 @@ void CreateObjectDie::onDie( const DamageInfo * damageInfo ) Object *damageDealer = TheGameLogic->findObjectByID( damageInfo->in.m_sourceID ); ObjectCreationList::create(getCreateObjectDieModuleData()->m_ocl, getObject(), damageDealer); -} // end onDie +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -101,7 +101,7 @@ void CreateObjectDie::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -119,7 +119,7 @@ void CreateObjectDie::xfer( Xfer *xfer ) // extend base class DieModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -130,4 +130,4 @@ void CreateObjectDie::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CrushDie.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CrushDie.cpp index b2fe57c6458..c4bb4178069 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CrushDie.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CrushDie.cpp @@ -216,7 +216,7 @@ void CrushDie::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -234,7 +234,7 @@ void CrushDie::xfer( Xfer *xfer ) // extend base class DieModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -245,4 +245,4 @@ void CrushDie::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/DamDie.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/DamDie.cpp index d4647bc83ef..343ede485a1 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/DamDie.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/DamDie.cpp @@ -48,7 +48,7 @@ DamDieModuleData::DamDieModuleData( void ) { -} // end DamDieModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -64,7 +64,7 @@ DamDieModuleData::DamDieModuleData( void ) // // p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -76,14 +76,14 @@ DamDie::DamDie( Thing *thing, const ModuleData *moduleData ) :DieModule( thing, moduleData ) { -} // end DamDie +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ DamDie::~DamDie( void ) { -} // end ~DamDie +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -104,9 +104,9 @@ void DamDie::onDie( const DamageInfo *damageInfo ) // clear any disabled status of the water wave obj->clearDisabled( DISABLED_DEFAULT ); - } // end for, obj + } -} // end onDie +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -117,7 +117,7 @@ void DamDie::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -135,7 +135,7 @@ void DamDie::xfer( Xfer *xfer ) // extend base class DieModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -146,4 +146,4 @@ void DamDie::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/DestroyDie.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/DestroyDie.cpp index 816ee45df54..7950b4daa42 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/DestroyDie.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/DestroyDie.cpp @@ -67,7 +67,7 @@ void DestroyDie::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -85,7 +85,7 @@ void DestroyDie::xfer( Xfer *xfer ) // extend base class DieModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -96,4 +96,4 @@ void DestroyDie::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/DieModule.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/DieModule.cpp index a83e002be25..baae823c63c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/DieModule.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/DieModule.cpp @@ -94,7 +94,7 @@ void DieModule::crc( Xfer *xfer ) // extend base class BehaviorModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -110,7 +110,7 @@ void DieModule::xfer( Xfer *xfer ) // call base class BehaviorModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -121,4 +121,4 @@ void DieModule::loadPostProcess( void ) // call base class BehaviorModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/EjectPilotDie.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/EjectPilotDie.cpp index 6fe58edca67..d1625af3085 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/EjectPilotDie.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/EjectPilotDie.cpp @@ -120,7 +120,7 @@ void EjectPilotDie::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -138,7 +138,7 @@ void EjectPilotDie::xfer( Xfer *xfer ) // extend base class DieModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -149,4 +149,4 @@ void EjectPilotDie::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/FXListDie.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/FXListDie.cpp index 7fcd26d9f8f..f204c04897f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/FXListDie.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/FXListDie.cpp @@ -87,7 +87,7 @@ void FXListDie::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -105,7 +105,7 @@ void FXListDie::xfer( Xfer *xfer ) // extend base class DieModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -116,4 +116,4 @@ void FXListDie::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/KeepObjectDie.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/KeepObjectDie.cpp index 4de6c46bc73..25025dc87b6 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/KeepObjectDie.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/KeepObjectDie.cpp @@ -70,7 +70,7 @@ void KeepObjectDie::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -88,7 +88,7 @@ void KeepObjectDie::xfer( Xfer *xfer ) // extend base class DieModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -99,4 +99,4 @@ void KeepObjectDie::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/RebuildHoleExposeDie.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/RebuildHoleExposeDie.cpp index 104a4aa91d7..f74d3a4b83f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/RebuildHoleExposeDie.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/RebuildHoleExposeDie.cpp @@ -71,7 +71,7 @@ RebuildHoleExposeDieModuleData::RebuildHoleExposeDieModuleData() p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -83,14 +83,14 @@ RebuildHoleExposeDie::RebuildHoleExposeDie( Thing *thing, const ModuleData* modu : DieModule( thing, moduleData ) { -} // end RebuildHoleExposeDie +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- RebuildHoleExposeDie::~RebuildHoleExposeDie( void ) { -} // end ~RebuildHoleExposeDie +} //------------------------------------------------------------------------------------------------- /** The die callback. */ @@ -163,9 +163,9 @@ void RebuildHoleExposeDie::onDie( const DamageInfo *damageInfo ) } } - } // end if + } -} // end onDie +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -176,7 +176,7 @@ void RebuildHoleExposeDie::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -194,7 +194,7 @@ void RebuildHoleExposeDie::xfer( Xfer *xfer ) // extend base class DieModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -205,4 +205,4 @@ void RebuildHoleExposeDie::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/SpecialPowerCompletionDie.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/SpecialPowerCompletionDie.cpp index af82b8cdeb8..f2799449b44 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/SpecialPowerCompletionDie.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/SpecialPowerCompletionDie.cpp @@ -93,7 +93,7 @@ void SpecialPowerCompletionDie::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -117,7 +117,7 @@ void SpecialPowerCompletionDie::xfer( Xfer *xfer ) // creator set xfer->xferBool( &m_creatorSet ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -128,4 +128,4 @@ void SpecialPowerCompletionDie::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/UpgradeDie.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/UpgradeDie.cpp index 54f9af87952..37ebc28fe83 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/UpgradeDie.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/UpgradeDie.cpp @@ -95,7 +95,7 @@ void UpgradeDie::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -113,7 +113,7 @@ void UpgradeDie::xfer( Xfer *xfer ) // extend base class DieModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -124,4 +124,4 @@ void UpgradeDie::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp index b2c2ab6ab0b..a8bd115b557 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp @@ -230,7 +230,7 @@ void ExperienceTracker::crc( Xfer *xfer ) { xfer->xferInt( &m_currentExperience ); xfer->xferUser( &m_currentLevel, sizeof( VeterancyLevel ) ); -} // end crc +} //----------------------------------------------------------------------------- /** Xfer method @@ -261,11 +261,11 @@ void ExperienceTracker::xfer( Xfer *xfer ) // experience scalar xfer->xferReal( &m_experienceScalar ); -} // end xfer +} //----------------------------------------------------------------------------- void ExperienceTracker::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/FiringTracker.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/FiringTracker.cpp index b19d9c39aac..cf5845d83ef 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/FiringTracker.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/FiringTracker.cpp @@ -330,7 +330,7 @@ void FiringTracker::crc( Xfer *xfer ) // object helper base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -357,7 +357,7 @@ void FiringTracker::xfer( Xfer *xfer ) // frame to start cooldown xfer->xferUnsignedInt( &m_frameToStartCooldown ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -368,4 +368,4 @@ void FiringTracker::loadPostProcess( void ) // object helper back class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp index 82f640f3b71..646f97ab6a0 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp @@ -53,7 +53,7 @@ m_partitionData(NULL) { m_parentPosition.zero(); // End Initializations -} // end Object +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -68,7 +68,7 @@ GhostObject::~GhostObject() void GhostObject::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -101,9 +101,9 @@ void GhostObject::xfer( Xfer *xfer ) DEBUG_CRASH(( "GhostObject::xfer - Unable to connect m_parentObject" )); throw INI_INVALID_DATA; - } // end if + } - } // end if + } // parent geometry type xfer->xferUser( &m_parentGeometryType, sizeof( GeometryType ) ); @@ -127,7 +127,7 @@ void GhostObject::xfer( Xfer *xfer ) ///@todo write me ---> !!!!! // PartitionData *m_partitionData; ///< our PartitionData -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -135,7 +135,7 @@ void GhostObject::xfer( Xfer *xfer ) void GhostObject::loadPostProcess( void ) { -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -198,7 +198,7 @@ void GhostObjectManager::restorePartitionData(void) void GhostObjectManager::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method: @@ -216,7 +216,7 @@ void GhostObjectManager::xfer( Xfer *xfer ) // local player xfer->xferInt( &m_localPlayer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -224,4 +224,4 @@ void GhostObjectManager::xfer( Xfer *xfer ) void GhostObjectManager::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectDefectionHelper.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectDefectionHelper.cpp index 6ab995ba36b..43aaf537eb9 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectDefectionHelper.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectDefectionHelper.cpp @@ -136,7 +136,7 @@ void ObjectDefectionHelper::crc( Xfer *xfer ) // object helper crc ObjectHelper::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -166,7 +166,7 @@ void ObjectDefectionHelper::xfer( Xfer *xfer ) // do defector fx xfer->xferBool( &m_doDefectorFX ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -177,4 +177,4 @@ void ObjectDefectionHelper::loadPostProcess( void ) // object helper base class ObjectHelper::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectHelper.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectHelper.cpp index d2bf7a3c8ba..14e5533bceb 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectHelper.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectHelper.cpp @@ -40,7 +40,7 @@ ObjectHelper::~ObjectHelper( void ) { -} // end ~ObjectHelper +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -67,7 +67,7 @@ void ObjectHelper::crc( Xfer *xfer ) // update module crc UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /* Xfer method @@ -85,7 +85,7 @@ void ObjectHelper::xfer( Xfer *xfer ) // update module xfer UpdateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -96,4 +96,4 @@ void ObjectHelper::loadPostProcess( void ) // update module post process UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectRepulsorHelper.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectRepulsorHelper.cpp index 15b2a4ebc1c..c3c39591c7b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectRepulsorHelper.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectRepulsorHelper.cpp @@ -60,7 +60,7 @@ void ObjectRepulsorHelper::crc( Xfer *xfer ) // object helper crc ObjectHelper::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -78,7 +78,7 @@ void ObjectRepulsorHelper::xfer( Xfer *xfer ) // object helper base class ObjectHelper::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -89,5 +89,5 @@ void ObjectRepulsorHelper::loadPostProcess( void ) // object helper base class ObjectHelper::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectSMCHelper.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectSMCHelper.cpp index 36a5a4165ba..0de2401d8b7 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectSMCHelper.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectSMCHelper.cpp @@ -60,7 +60,7 @@ void ObjectSMCHelper::crc( Xfer *xfer ) // object helper crc ObjectHelper::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -78,7 +78,7 @@ void ObjectSMCHelper::xfer( Xfer *xfer ) // object helper base class ObjectHelper::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -89,5 +89,5 @@ void ObjectSMCHelper::loadPostProcess( void ) // object helper base class ObjectHelper::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectWeaponStatusHelper.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectWeaponStatusHelper.cpp index ae329cbd80d..1e753641e22 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectWeaponStatusHelper.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectWeaponStatusHelper.cpp @@ -48,7 +48,7 @@ void ObjectWeaponStatusHelper::crc( Xfer *xfer ) // object helper crc ObjectHelper::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -66,7 +66,7 @@ void ObjectWeaponStatusHelper::xfer( Xfer *xfer ) // object helper base class ObjectHelper::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -77,4 +77,4 @@ void ObjectWeaponStatusHelper::loadPostProcess( void ) // object helper base class ObjectHelper::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp index d28b9c28fea..668c5aab0b4 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp @@ -584,7 +584,7 @@ LocomotorTemplate *LocomotorStore::newOverride( LocomotorTemplate *locoTemplate // return the newly created override for us to set values with etc return newTemplate; -} // end newOverride +} //------------------------------------------------------------------------------------------------- /*static*/ void LocomotorStore::parseLocomotorTemplateDefinition(INI* ini) @@ -719,7 +719,7 @@ Locomotor::~Locomotor() void Locomotor::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -754,7 +754,7 @@ void Locomotor::xfer( Xfer *xfer ) xfer->xferReal(&m_angleOffset); xfer->xferReal(&m_offsetIncrement); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -762,7 +762,7 @@ void Locomotor::xfer( Xfer *xfer ) void Locomotor::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- void Locomotor::startMove(void) @@ -2609,7 +2609,7 @@ LocomotorSet::~LocomotorSet() void LocomotorSet::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -2676,7 +2676,7 @@ void LocomotorSet::xfer( Xfer *xfer ) void LocomotorSet::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- void LocomotorSet::xferSelfAndCurLocoPtr(Xfer *xfer, Locomotor** loco) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp index 336c541510a..f4d77051071 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -229,7 +229,7 @@ Object::Object( const ThingTemplate *tt, const ObjectStatusMaskType &objectStatu assert( 0 ); return; - } // end if + } // Object's set of these persist for the life of the object. m_partitionLastLook = newInstance(SightingInfo); @@ -436,7 +436,7 @@ Object::Object( const ThingTemplate *tt, const ObjectStatusMaskType &objectStatu // emit message announcing object's creation TheGameLogic->sendObjectCreated( this ); -} // end Object +} //------------------------------------------------------------------------------------------------- /** Emit message announcing object's creation @@ -690,7 +690,7 @@ void Object::onDestroy() //Have to remove ourself from looking as well. RebuildHoleWorkers definately hit here. handlePartitionCellMaintenance(); -} // end onDestroy +} //============================================================================= //============================================================================= @@ -897,7 +897,7 @@ void Object::setStatus( ObjectStatusMaskType objectStatus, Bool set ) TheGameLogic->destroyObject(them); } } - }// next object + } if (m_partitionData) m_partitionData->makeDirty(true); @@ -1071,9 +1071,9 @@ void Object::topple( const Coord3D *toppleDirection, Real toppleSpeed, UnsignedI // apply the topple force toppleUpdate->applyTopplingForce( toppleDirection, toppleSpeed, options ); - } // end if + } -} // end topple +} //============================================================================= void Object::reloadAllAmmo(Bool now) @@ -1760,7 +1760,7 @@ void Object::kill() DEBUG_ASSERTCRASH(!damageInfo.out.m_noEffect, ("Attempting to kill an unKillable object (InactiveBody?)")); -} // end kill +} //------------------------------------------------------------------------------------------------- /** Restore max health to this Object */ @@ -2283,7 +2283,7 @@ ExitInterface *Object::getObjectExitInterface() const return exitInterface; -} // end getObjectExitInterface +} //------------------------------------------------------------------------------------------------- /** Checks the object against trigger areas when the position changes. */ @@ -2467,7 +2467,7 @@ void Object::setID( ObjectID id ) // add new id to lookup table TheGameLogic->addObjectToLookupTable( this ); -} // end setID +} // ------------------------------------------------------------------------------------------------ Real Object::calculateHeightAboveTerrain(void) const @@ -2991,7 +2991,7 @@ void Object::maskObject( Bool mask ) if (mask) TheGameLogic->deselectObject(this, ~getControllingPlayer()->getPlayerMask(), TRUE); -} // end maskObject +} //------------------------------------------------------------------------------------------------- /* @@ -3468,7 +3468,7 @@ void Object::crc( Xfer *xfer ) } } -} // end crc +} //------------------------------------------------------------------------------------------------- /** Object xfer implemtation @@ -3540,7 +3540,7 @@ void Object::xfer( Xfer *xfer ) // change the ID of the drawable attached to be the same ID as it was when it was saved draw->setID( drawableID ); - } // end if + } // internal name xfer->xferAsciiString( &m_name ); @@ -3763,9 +3763,9 @@ void Object::xfer( Xfer *xfer ) // end data block xfer->endBlock(); - } // end for, it + } - } // end if, save + } else { AsciiString otherModuleIdentifier; @@ -3789,7 +3789,7 @@ void Object::xfer( Xfer *xfer ) break; } - } // end for, moduleIt + } // start of a new block Int dataSize = xfer->beginBlock(); @@ -3809,21 +3809,21 @@ void Object::xfer( Xfer *xfer ) // skip this data in the file xfer->skip( dataSize ); - } // end if + } else { // xfer the data into this module xfer->xferSnapshot( module ); - } // end else + } // end block xfer->endBlock(); - } // end for, i module count recorded in file + } - } // end else, load + } if ( version >= 3 ) @@ -3881,7 +3881,7 @@ void Object::xfer( Xfer *xfer ) else m_isReceivingDifficultyBonus = FALSE; -} // end xfer +} //------------------------------------------------------------------------------------------------- /** Object load game post process phase */ @@ -3893,7 +3893,7 @@ void Object::loadPostProcess() else m_containedBy = NULL; -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- /** Does this object have this upgrade */ @@ -3905,7 +3905,7 @@ Bool Object::hasUpgrade( const UpgradeTemplate *upgradeT ) const return TRUE; } return FALSE; -} // end hasUpgrade +} //------------------------------------------------------------------------------------------------- /** Is this object capable of having this upgrade */ @@ -3935,7 +3935,7 @@ Bool Object::affectedByUpgrade( const UpgradeTemplate *upgradeT ) const } return FALSE; -} // end affectedByUpgrade +} //------------------------------------------------------------------------------------------------- /** Give this upgrade to this object */ @@ -3952,7 +3952,7 @@ void Object::giveUpgrade( const UpgradeTemplate *upgradeT ) // updateUpgradeModules(); } -} // end giveUpgrade +} //------------------------------------------------------------------------------------------------- /** Remove this upgrade from this object */ @@ -4010,7 +4010,7 @@ void Object::onCapture( Player *oldOwner, Player *newOwner ) } } -} // end onCapture +} //------------------------------------------------------------------------------------------------- /// Object level events that need to happen upon game death @@ -4991,11 +4991,11 @@ ProductionUpdateInterface* Object::getProductionUpdateInterface( void ) if( pui ) return pui; - } // end for + } return NULL; -} // end getProductionUpdateInterface +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -5011,7 +5011,7 @@ DockUpdateInterface *Object::getDockUpdateInterface( void ) return NULL; -} // end getDockUpdateInterface +} // ------------------------------------------------------------------------------------------------ // Search our special power modules for a specific one. @@ -5067,7 +5067,7 @@ SpawnBehaviorInterface* Object::getSpawnBehaviorInterface() const } } return NULL; -} // end getSpawnBehaviorInterfaceFromObject +} // ------------------------------------------------------------------------------------------------ // Simply find the special power module that is currently allowing plotting of positions to target. @@ -5084,7 +5084,7 @@ SpecialPowerUpdateInterface* Object::findSpecialPowerWithOverridableDestinationA return spInterface; } } - } // end for + } return NULL; } @@ -5103,7 +5103,7 @@ SpecialPowerUpdateInterface* Object::findSpecialPowerWithOverridableDestination( return spInterface; } } - } // end for + } return NULL; } @@ -5124,7 +5124,7 @@ SpecialAbilityUpdate* Object::findSpecialAbilityUpdate( SpecialPowerType type ) return spUpdate; } } - } // end for + } return NULL; } @@ -5428,7 +5428,7 @@ RadarPriorityType Object::getRadarPriority( void ) const priority = RADAR_PRIORITY_STRUCTURE; - } // end if + } // Carbombs will show up as units regardless of their default priority if ( testStatus( OBJECT_STATUS_IS_CARBOMB ) ) @@ -5438,7 +5438,7 @@ RadarPriorityType Object::getRadarPriority( void ) const // return the priority we're going to use return priority; -} // end getRadarPriority +} // ------------------------------------------------------------------------------------------------ AIGroup *Object::getGroup(void) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectTypes.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectTypes.cpp index ff1f6d8454a..ebb220a392b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectTypes.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectTypes.cpp @@ -169,9 +169,9 @@ void ObjectTypes::xfer(Xfer *xfer) // write type name xfer->xferAsciiString( &(*it) ); - } // end for, it + } - } // end if, save + } else { @@ -182,7 +182,7 @@ void ObjectTypes::xfer(Xfer *xfer) DEBUG_CRASH(( "ObjectTypes::xfer - m_objectTypes vector should be emtpy but is not!" )); throw SC_INVALID_DATA; - } // end if + } // read all data AsciiString typeName; @@ -195,9 +195,9 @@ void ObjectTypes::xfer(Xfer *xfer) // put on vector m_objectTypes.push_back( typeName ); - } // end for, i + } - } // end else, load + } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index fc81898e27a..c66f797ea30 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -1508,7 +1508,7 @@ void PartitionCell::crc( Xfer *xfer ) xfer->xferUser(&m_cellX, sizeof(m_cellX)); xfer->xferUser(&m_cellY, sizeof(m_cellY)); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1524,7 +1524,7 @@ void PartitionCell::xfer( Xfer *xfer ) // xfer shroud data xfer->xferUser( &m_shroudLevel, sizeof( ShroudLevel ) * MAX_PLAYER_COUNT ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1532,7 +1532,7 @@ void PartitionCell::xfer( Xfer *xfer ) void PartitionCell::loadPostProcess( void ) { -} // end loadPostProcess +} //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- @@ -1658,9 +1658,8 @@ ObjectShroudStatus PartitionData::getShroudedStatus(Int playerIndex) else if( shroudedCells + foggedCells == m_coiInUseCount ) { m_shroudedness[playerIndex] = OBJECTSHROUD_FOGGED; //object is visible but fogged. - if (m_object && m_ghostObject) + if (m_object && m_ghostObject) //object does not exist for modules holding only GhostObjects { - //object does not exist for modules holding only GhostObjects //fogged but may not be visible if faction unit or faction building that has not been seen before Player *player=ThePlayerList->getNthPlayer(playerIndex); if (player->getRelationship(m_object->getTeam()) == NEUTRAL) @@ -1668,9 +1667,8 @@ ObjectShroudStatus PartitionData::getShroudedStatus(Int playerIndex) if (!m_object->isKindOf(KINDOF_IMMOBILE)) m_shroudedness[playerIndex] = OBJECTSHROUD_SHROUDED; } - else - { //Not neutral - //enemy unit will always be shrouded unless it's a building that's already been seen by the player. Fogged Mines are also always + else //Not neutral + { //enemy unit will always be shrouded unless it's a building that's already been seen by the player. Fogged Mines are also always //shroued no matter what. if (!(m_object->isKindOf(KINDOF_IMMOBILE) && m_everSeenByPlayer[playerIndex]) || m_object->isKindOf(KINDOF_MINE)) m_shroudedness[playerIndex] = OBJECTSHROUD_SHROUDED; @@ -1687,8 +1685,7 @@ ObjectShroudStatus PartitionData::getShroudedStatus(Int playerIndex) } } else if( shroudedCells == 0 && foggedCells == 0 ) - { //no cell I use has anything - //Record that this object was seen by the player. This info will be used to show fogged enemy faction buildings. + { //Record that this object was seen by the player. This info will be used to show fogged enemy faction buildings. m_everSeenByPlayer[playerIndex] = true; m_shroudedness[playerIndex] = OBJECTSHROUD_CLEAR; if (m_ghostObject && m_shroudednessPrevious[playerIndex] == OBJECTSHROUD_FOGGED) @@ -2587,7 +2584,7 @@ PartitionManager::~PartitionManager() shutdown(); -} // end ~PartitionManager +} //----------------------------------------------------------------------------- #ifdef PM_CACHE_TERRAIN_HEIGHT @@ -2852,7 +2849,7 @@ void PartitionManager::update() } } #endif // defined(RTS_DEBUG) -} // end update +} //------------------------------------------------------------------------------ void PartitionManager::registerObject( Object* object ) @@ -2867,7 +2864,7 @@ void PartitionManager::registerObject( Object* object ) DEBUG_LOG(( "Object '%s' already registered with partition manager", object->getTemplate()->getName().str() )); return; - } // end if + } // allocate a new module of partition data PartitionData *mod = newInstance( PartitionData ); @@ -2941,7 +2938,7 @@ void PartitionManager::registerGhostObject( GhostObject* object) { DEBUG_LOG(( "GhostObject already registered with partition manager")); return; - } // end if + } // allocate a new module of partition data PartitionData *mod = newInstance( PartitionData ); @@ -3341,9 +3338,9 @@ Object *PartitionManager::getClosestObjects( foundAny = true; } - } // next coi - } // next cell in this radius - } // next radius + } + } + } #else // not FASTER_GCO @@ -3774,7 +3771,7 @@ Bool PartitionManager::tryPosition( const Coord3D *center, else if( isUnderwater == TRUE && layer == LAYER_GROUND ) return FALSE; - } // end if + } // object checks if( BitIsSet( options->flags, FPF_IGNORE_ALL_OBJECTS ) == FALSE ) @@ -3824,7 +3821,7 @@ Bool PartitionManager::tryPosition( const Coord3D *center, them->isKindOf( KINDOF_STRUCTURE ) ) continue; - } // end if, relationship checks + } // // if we have a source that must path to the destination we will ignore that too @@ -3839,9 +3836,9 @@ Bool PartitionManager::tryPosition( const Coord3D *center, // oops, we have overlapped something return FALSE; - } // end for, them + } - } // end if + } // // finally ... if sourceToPathDest is valid ... the source object must be able to @@ -3858,13 +3855,13 @@ Bool PartitionManager::tryPosition( const Coord3D *center, &pos ) == FALSE ) return FALSE; - } // end if + } // save result and return TRUE for position found *result = pos; return TRUE; -} // end tryPosition +} // // the following determines how fast we expand our concentric ring search for the @@ -3947,14 +3944,14 @@ Bool PartitionManager::findPositionAround( const Coord3D *center, if( tryPosition( center, dist, startAngle - angleSpacing * i, options, result ) == TRUE ) return TRUE; - } // end if + } - } // end for, dist + } // no position was able to be found return FALSE; -} // end findPositionAround +} //----------------------------------------------------------------------------- // This is the main accessor of the shroud system. At this level, allies are taken @@ -4574,7 +4571,7 @@ void PartitionManager::crc( Xfer *xfer ) m_cells[i].crc(xfer); } -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -4606,7 +4603,7 @@ void PartitionManager::xfer( Xfer *xfer ) DEBUG_CRASH(( "Partition cell size has changed, this save game file is invalid" )); throw SC_INVALID_DATA; - } // end if + } // cell count Int totalCellCount = m_totalCellCount; @@ -4620,7 +4617,7 @@ void PartitionManager::xfer( Xfer *xfer ) totalCellCount, m_totalCellCount )); throw SC_INVALID_DATA; - } // end if + } // xfer each cell information PartitionCell *cell; @@ -4633,7 +4630,7 @@ void PartitionManager::xfer( Xfer *xfer ) // xfer the data for this cell xfer->xferSnapshot( cell ); - } // end for i + } // when loading tell the partition manager to rethink and refresh all shroud information if( xfer->getXferMode() == XFER_LOAD ) @@ -4645,7 +4642,7 @@ void PartitionManager::xfer( Xfer *xfer ) // refresh the shroud for the local player which will update the radar and everything refreshShroudForLocalPlayer(); - } // end if + } if( version >= 2 ) { @@ -4688,7 +4685,7 @@ void PartitionManager::xfer( Xfer *xfer ) // Version 1 save games will just not have any SightingInfos in the queue to be undone. } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -4696,7 +4693,7 @@ void PartitionManager::xfer( Xfer *xfer ) void PartitionManager::loadPostProcess( void ) { -} // end loadPostProcess +} //----------------------------------------------------------------------------- Real PartitionManager::getGroundOrStructureHeight(Real posx, Real posy) @@ -5770,7 +5767,7 @@ Bool SightingInfo::isInvalid() const void SightingInfo::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -5797,7 +5794,7 @@ void SightingInfo::xfer( Xfer *xfer ) // how much xfer->xferUnsignedInt( &m_data ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -5805,11 +5802,11 @@ void SightingInfo::xfer( Xfer *xfer ) void SightingInfo::loadPostProcess() { -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ SightingInfo::~SightingInfo() { -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/BaikonurLaunchPower.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/BaikonurLaunchPower.cpp index 5f247212360..4b850ec4cfa 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/BaikonurLaunchPower.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/BaikonurLaunchPower.cpp @@ -69,7 +69,7 @@ BaikonurLaunchPowerModuleData::BaikonurLaunchPowerModuleData( void ) }; p.add(dataFieldParse); -} // end buildFieldParse +} // ------------------------------------------------------------------------------------------------ @@ -130,7 +130,7 @@ void BaikonurLaunchPower::crc( Xfer *xfer ) // extend base class SpecialPowerModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -148,7 +148,7 @@ void BaikonurLaunchPower::xfer( Xfer *xfer ) // extend base class SpecialPowerModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -159,4 +159,4 @@ void BaikonurLaunchPower::loadPostProcess( void ) // extend base class SpecialPowerModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashBountyPower.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashBountyPower.cpp index f8fa50902b6..b4372f64a35 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashBountyPower.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashBountyPower.cpp @@ -110,7 +110,7 @@ static void parseBountyUpgradePair( INI* ini, void * /*instance*/, void *store, }; p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -121,14 +121,14 @@ static void parseBountyUpgradePair( INI* ini, void * /*instance*/, void *store, CashBountyPower::CashBountyPower( Thing *thing, const ModuleData* moduleData ) : SpecialPowerModule( thing, moduleData ) { -} // end CashBountyPower +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- CashBountyPower::~CashBountyPower() { -} // end ~CashBountyPower +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -188,7 +188,7 @@ void CashBountyPower::crc( Xfer *xfer ) // extend base class SpecialPowerModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -206,7 +206,7 @@ void CashBountyPower::xfer( Xfer *xfer ) // extend base class SpecialPowerModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -217,4 +217,4 @@ void CashBountyPower::loadPostProcess( void ) // extend base class SpecialPowerModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashHackSpecialPower.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashHackSpecialPower.cpp index 89112a1b0ca..6ecaab85dbb 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashHackSpecialPower.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashHackSpecialPower.cpp @@ -74,7 +74,7 @@ static void parseCashHackUpgradePair( INI* ini, void * /*instance*/, void *store }; p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -86,14 +86,14 @@ CashHackSpecialPower::CashHackSpecialPower( Thing *thing, const ModuleData *modu : SpecialPowerModule( thing, moduleData ) { -} // end CashHackSpecialPower +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ CashHackSpecialPower::~CashHackSpecialPower( void ) { -} // end ~CashHackSpecialPower +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -187,7 +187,7 @@ void CashHackSpecialPower::crc( Xfer *xfer ) // extend base class SpecialPowerModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -205,7 +205,7 @@ void CashHackSpecialPower::xfer( Xfer *xfer ) // extend base class SpecialPowerModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -216,4 +216,4 @@ void CashHackSpecialPower::loadPostProcess( void ) // extend base class SpecialPowerModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CleanupAreaPower.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CleanupAreaPower.cpp index 4aab9fe6429..7546e595787 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CleanupAreaPower.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CleanupAreaPower.cpp @@ -69,7 +69,7 @@ void CleanupAreaPowerModuleData::buildFieldParse(MultiIniFieldParse& p) }; p.add(dataFieldParse); -} // end buildFieldParse +} //------------------------------------------------------------------------------------------------- CleanupAreaPower::CleanupAreaPower( Thing *thing, const ModuleData* moduleData ) : SpecialPowerModule( thing, moduleData ) @@ -113,7 +113,7 @@ void CleanupAreaPower::crc( Xfer *xfer ) // extend base class SpecialPowerModule::crc( xfer ); -} // end crc +} //------------------------------------------------------------------------------------------------- // Xfer method @@ -131,7 +131,7 @@ void CleanupAreaPower::xfer( Xfer *xfer ) // extend base class SpecialPowerModule::xfer( xfer ); -} // end xfer +} //------------------------------------------------------------------------------------------------- void CleanupAreaPower::loadPostProcess( void ) @@ -140,4 +140,4 @@ void CleanupAreaPower::loadPostProcess( void ) // extend base class SpecialPowerModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DefectorSpecialPower.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DefectorSpecialPower.cpp index 9a871ce110f..7ecd6ccaa98 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DefectorSpecialPower.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DefectorSpecialPower.cpp @@ -48,7 +48,7 @@ DefectorSpecialPowerModuleData::DefectorSpecialPowerModuleData( void ) m_fatCursorRadius = 0.0f; -} // end DefectorSpecialPowerModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -66,7 +66,7 @@ DefectorSpecialPowerModuleData::DefectorSpecialPowerModuleData( void ) }; p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -78,14 +78,14 @@ DefectorSpecialPower::DefectorSpecialPower( Thing *thing, const ModuleData *modu : SpecialPowerModule( thing, moduleData ) { -} // end DefectorSpecialPower +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ DefectorSpecialPower::~DefectorSpecialPower( void ) { -} // end ~DefectorSpecialPower +} // ------------------------------------------------------------------------------------------------ @@ -143,7 +143,7 @@ void DefectorSpecialPower::crc( Xfer *xfer ) // extend base class SpecialPowerModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -161,7 +161,7 @@ void DefectorSpecialPower::xfer( Xfer *xfer ) // extend base class SpecialPowerModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -172,4 +172,4 @@ void DefectorSpecialPower::loadPostProcess( void ) // extend base class SpecialPowerModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DemoralizeSpecialPower.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DemoralizeSpecialPower.cpp index 0790e45f6ec..b0e7ec22e05 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DemoralizeSpecialPower.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DemoralizeSpecialPower.cpp @@ -54,7 +54,7 @@ DemoralizeSpecialPowerModuleData::DemoralizeSpecialPowerModuleData( void ) m_maxDurationInFrames = 0; m_fxList = NULL; -} // end DemoralizeSpecialPowerModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -75,7 +75,7 @@ void DemoralizeSpecialPowerModuleData::buildFieldParse( MultiIniFieldParse &p ) }; p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -87,14 +87,14 @@ DemoralizeSpecialPower::DemoralizeSpecialPower( Thing *thing, const ModuleData * : SpecialPowerModule( thing, moduleData ) { -} // end DemoralizeSpecialPower +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ DemoralizeSpecialPower::~DemoralizeSpecialPower( void ) { -} // end ~DemoralizeSpecialPower +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -140,7 +140,7 @@ void DemoralizeSpecialPower::doSpecialPowerAtLocation( const Coord3D *loc, Real if( range > modData->m_maxRange ) range = modData->m_maxRange; - } // end if + } // scan the objects in the area range and demoralize them PartitionFilterRelationship filter1( source, PartitionFilterRelationship::ALLOW_ENEMIES | @@ -164,7 +164,7 @@ void DemoralizeSpecialPower::doSpecialPowerAtLocation( const Coord3D *loc, Real if( ai ) ai->setDemoralized( duration ); - } // end for obj + } // play an effect at the destination location if( modData->m_fxList ) @@ -173,9 +173,9 @@ void DemoralizeSpecialPower::doSpecialPowerAtLocation( const Coord3D *loc, Real // execute FX FXList::doFXPos( modData->m_fxList, loc ); - } // end if + } -} // end doSpecialPowerAtLocation +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -187,7 +187,7 @@ void DemoralizeSpecialPower::doSpecialPowerAtObject( const Object *obj, Real ang if( obj ) doSpecialPowerAtLocation( obj->getPosition(), angle, commandOptions ); -} // end doSpecialPowerAtObject +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -198,7 +198,7 @@ void DemoralizeSpecialPower::crc( Xfer *xfer ) // extend base class SpecialPowerModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -216,7 +216,7 @@ void DemoralizeSpecialPower::xfer( Xfer *xfer ) // extend base class SpecialPowerModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -227,7 +227,7 @@ void DemoralizeSpecialPower::loadPostProcess( void ) // extend base class SpecialPowerModule::loadPostProcess(); -} // end loadPostProcess +} #endif // #ifdef ALLOW_DEMORALIZE diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp index 6eefb1f7a4b..19059cc77c8 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp @@ -230,7 +230,7 @@ void OCLSpecialPower::crc( Xfer *xfer ) // extend base class SpecialPowerModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -248,7 +248,7 @@ void OCLSpecialPower::xfer( Xfer *xfer ) // extend base class SpecialPowerModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -259,4 +259,4 @@ void OCLSpecialPower::loadPostProcess( void ) // extend base class SpecialPowerModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialAbility.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialAbility.cpp index 6f122f609c0..b6986e682a0 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialAbility.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialAbility.cpp @@ -46,14 +46,14 @@ SpecialAbility::SpecialAbility( Thing *thing, const ModuleData *moduleData ) : SpecialPowerModule( thing, moduleData ) { -} // end SpecialAbility +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ SpecialAbility::~SpecialAbility( void ) { -} // end ~SpecialAbility +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -105,7 +105,7 @@ void SpecialAbility::crc( Xfer *xfer ) // extend base class SpecialPowerModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -123,7 +123,7 @@ void SpecialAbility::xfer( Xfer *xfer ) // extend base class SpecialPowerModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -134,4 +134,4 @@ void SpecialAbility::loadPostProcess( void ) // extend base class SpecialPowerModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp index 3baa5d1af41..4d164ee5775 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp @@ -64,7 +64,7 @@ SpecialPowerModuleData::SpecialPowerModuleData() m_updateModuleStartsAttack = false; m_startsPaused = FALSE; -} // end SpecialPowerModuleData +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -82,7 +82,7 @@ SpecialPowerModuleData::SpecialPowerModuleData() }; p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -140,7 +140,7 @@ SpecialPowerModule::SpecialPowerModule( Thing *thing, const ModuleData *moduleDa } -} // end SpecialPowerModule +} //------------------------------------------------------------------------------------------------- const AudioEventRTS& SpecialPowerModule::getInitiateSound() const @@ -160,7 +160,7 @@ SpecialPowerModule::~SpecialPowerModule() getObject()->getID(), getSpecialPowerModuleData()->m_specialPowerTemplate ); -} // end ~SpecialPowerModule +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -229,7 +229,7 @@ ScienceType SpecialPowerModule::getRequiredScience( void ) const { return getSpecialPowerModuleData()->m_specialPowerTemplate->getRequiredScience(); -} // end ~SpecialPowerModule +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -237,7 +237,7 @@ const SpecialPowerTemplate * SpecialPowerModule::getSpecialPowerTemplate( void ) { return getSpecialPowerModuleData()->m_specialPowerTemplate; -} // end ~SpecialPowerModule +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -245,7 +245,7 @@ AsciiString SpecialPowerModule::getPowerName( void ) const { return getSpecialPowerModuleData()->m_specialPowerTemplate->getName(); -} // end ~SpecialPowerModule +} //------------------------------------------------------------------------------------------------- /** Is this module designed for the power identier template passed in? */ @@ -262,7 +262,7 @@ Bool SpecialPowerModule::isModuleForPower( const SpecialPowerTemplate *specialPo // return modData->m_specialPowerTemplate == specialPowerTemplate; -} // end canExecutePower +} //------------------------------------------------------------------------------------------------- /** Is this special power ready to use */ @@ -290,7 +290,7 @@ Bool SpecialPowerModule::isReady() const return (m_pausedCount == 0) && (TheGameLogic->getFrame() >= m_availableOnFrame); -} // end isReady +} //------------------------------------------------------------------------------------------------- /** Get the percentage ready a special power is to use @@ -521,7 +521,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) soundAtLocation.setPlayerIndex(getObject()->getControllingPlayer()->getPlayerIndex()); TheAudio->addAudioEvent( &soundAtLocation ); - } // end if + } } @@ -643,7 +643,7 @@ void SpecialPowerModule::pauseCountdown( Bool pause ) m_availableOnFrame += (TheGameLogic->getFrame() - m_pausedOnFrame); } } -} // end pauseCountdown +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -680,7 +680,7 @@ void SpecialPowerModule::crc( Xfer *xfer ) // extend base class BehaviorModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -710,7 +710,7 @@ void SpecialPowerModule::xfer( Xfer *xfer ) // paused percent xfer->xferReal( &m_pausedPercent ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -744,4 +744,4 @@ void SpecialPowerModule::loadPostProcess( void ) -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpyVisionSpecialPower.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpyVisionSpecialPower.cpp index e70eafebeae..9ada6fa1536 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpyVisionSpecialPower.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpyVisionSpecialPower.cpp @@ -62,7 +62,7 @@ void SpyVisionSpecialPowerModuleData::buildFieldParse( MultiIniFieldParse &p ) }; p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -135,7 +135,7 @@ void SpyVisionSpecialPower::crc( Xfer *xfer ) // extend base class SpecialPowerModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -153,7 +153,7 @@ void SpyVisionSpecialPower::xfer( Xfer *xfer ) // extend base class SpecialPowerModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -164,4 +164,4 @@ void SpyVisionSpecialPower::loadPostProcess( void ) // extend base class SpecialPowerModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index d24a379f3d5..ca2a0f34bb8 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -2045,7 +2045,7 @@ Bool AIUpdateInterface::isPathAvailable( const Coord3D *destination ) const return TheAI->pathfinder()->quickDoesPathExist( m_locomotorSet, myPos, destination ); -} // end isPathAvailable +} //------------------------------------------------------------------------------------------------- /** Is there a path (computed using the less accurate but quick method ) @@ -2062,7 +2062,7 @@ Bool AIUpdateInterface::isQuickPathAvailable( const Coord3D *destination ) const return TheAI->pathfinder()->quickDoesPathExist( m_locomotorSet, myPos, destination ); -} // end isQuickPathAvailable +} @@ -2533,7 +2533,7 @@ void AIUpdateInterface::joinTeam( void ) getStateMachine()->setState( state ); } -} // end joinTeam +} //------------------------------------------------------------------------------------------------- Bool AIUpdateInterface::isAllowedToRespondToAiCommands(const AICommandParms* parms) const @@ -4444,7 +4444,7 @@ void AIUpdateInterface::evaluateMoraleBonus( void ) if( hui && hui->isInHorde() ) horde = TRUE; - } // end for + } // do we have nationalism ///@todo Find a better way to represent nationalism without hardcoding here (CBD) @@ -4475,7 +4475,7 @@ void AIUpdateInterface::evaluateMoraleBonus( void ) { us->setWeaponBonusCondition( WEAPONBONUSCONDITION_HORDE ); - } // end if + } else us->clearWeaponBonusCondition( WEAPONBONUSCONDITION_HORDE ); @@ -4485,7 +4485,7 @@ void AIUpdateInterface::evaluateMoraleBonus( void ) else us->clearWeaponBonusCondition( WEAPONBONUSCONDITION_NATIONALISM ); - } // end if + } #ifdef ALLOW_DEMORALIZE else { @@ -4504,7 +4504,7 @@ void AIUpdateInterface::evaluateMoraleBonus( void ) // we cannot have nationalism bonus condition us->clearWeaponBonusCondition( WEAPONBONUSCONDITION_NATIONALISM ); - } // end else + } #endif /* @@ -4514,7 +4514,7 @@ void AIUpdateInterface::evaluateMoraleBonus( void ) TheInGameUI->message( msg ); */ -} // end evaluateMoraleBonus +} #ifdef ALLOW_DEMORALIZE // ------------------------------------------------------------------------------------------------ @@ -4534,7 +4534,7 @@ void AIUpdateInterface::setDemoralized( UnsignedInt durationInFrames ) // evaluate demoralization, nationalism, and horde effect as they are all intertwined evaluateMoraleBonus(); - } // end if + } } #endif @@ -4732,7 +4732,7 @@ void AIUpdateInterface::crc( Xfer *x ) CRCGEN_LOG(("AIUpdateInterface::crc() end - %8.8X", ((XferCRC *)x)->getCRC())); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -4955,7 +4955,7 @@ void AIUpdateInterface::xfer( Xfer *xfer ) xfer->xferInt(&repulsorCountdown); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -4992,7 +4992,7 @@ void AIUpdateInterface::loadPostProcess( void ) } } -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp index aa72d55c77f..0b2468483d6 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp @@ -485,7 +485,7 @@ void AssaultTransportAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} //------------------------------------------------------------------------------------------------- /** Xfer method @@ -521,7 +521,7 @@ void AssaultTransportAIUpdate::xfer( Xfer *xfer ) xfer->xferBool( &m_isAttackMove ); xfer->xferBool( &m_isAttackObject ); -} // end xfer +} //------------------------------------------------------------------------------------------------- /** Load post process */ @@ -530,5 +530,5 @@ void AssaultTransportAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index 2e100ab2fad..c1d3fb03e85 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -1219,7 +1219,7 @@ void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms) void ChinookAIUpdate::crc( Xfer *xfer ) { SupplyTruckAIUpdate::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1242,7 +1242,7 @@ void ChinookAIUpdate::xfer( Xfer *xfer ) xfer->xferUser(&m_flightStatus, sizeof(m_flightStatus)); xfer->xferObjectID(&m_airfieldForHealing); // extend base class -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1250,4 +1250,4 @@ void ChinookAIUpdate::xfer( Xfer *xfer ) void ChinookAIUpdate::loadPostProcess( void ) { SupplyTruckAIUpdate::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp index 9a2070ee5e8..24452fce436 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp @@ -404,7 +404,7 @@ void DeliverPayloadAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -485,7 +485,7 @@ void DeliverPayloadAIUpdate::xfer( Xfer *xfer ) } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -494,7 +494,7 @@ void DeliverPayloadAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -531,7 +531,7 @@ DeliverPayloadStateMachine::~DeliverPayloadStateMachine() void DeliverPayloadStateMachine::crc( Xfer *xfer ) { StateMachine::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -543,7 +543,7 @@ void DeliverPayloadStateMachine::xfer( Xfer *xfer ) xfer->xferVersion( &v, cv ); StateMachine::xfer(xfer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -551,7 +551,7 @@ void DeliverPayloadStateMachine::xfer( Xfer *xfer ) void DeliverPayloadStateMachine::loadPostProcess( void ) { StateMachine::loadPostProcess(); -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- /*static*/ Bool DeliverPayloadStateMachine::isOffMap( State *thisState, void* userData ) @@ -623,7 +623,7 @@ StateReturnType ApproachState::update() // ------------------------------------------------------------------------------------------------ void DeliveringState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -637,14 +637,14 @@ void DeliveringState::xfer( Xfer *xfer ) xfer->xferUnsignedInt(&m_dropDelayLeft); xfer->xferBool(&m_didOpen); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void DeliveringState::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- @@ -902,7 +902,7 @@ void DeliveringState::onExit( StateExitType ) // Close the doors // ------------------------------------------------------------------------------------------------ void ConsiderNewApproachState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -915,14 +915,14 @@ void ConsiderNewApproachState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferInt(&m_numberEntriesToState); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void ConsiderNewApproachState::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- @@ -1014,7 +1014,7 @@ void ConsiderNewApproachState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void RecoverFromOffMapState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1027,14 +1027,14 @@ void RecoverFromOffMapState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUnsignedInt(&m_reEntryFrame); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void RecoverFromOffMapState::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeployStyleAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeployStyleAIUpdate.cpp index 753c4b6ddbb..b5889002ad1 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeployStyleAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeployStyleAIUpdate.cpp @@ -465,7 +465,7 @@ void DeployStyleAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -512,7 +512,7 @@ void DeployStyleAIUpdate::xfer( Xfer *xfer ) obsolete.doXfer(xfer); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -521,5 +521,5 @@ void DeployStyleAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp index 5e833a1f6a0..cefe2f6a269 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp @@ -113,14 +113,14 @@ DozerActionPickActionPosState::DozerActionPickActionPosState( StateMachine *mach m_task = task; m_failedAttempts = 0; -} // end DozerActionPickActionPosState +} // ------------------------------------------------------------------------------------------------ /** CRC */ // ------------------------------------------------------------------------------------------------ void DozerActionPickActionPosState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -134,14 +134,14 @@ void DozerActionPickActionPosState::xfer( Xfer *xfer ) xfer->xferUser(&m_task, sizeof(m_task)); xfer->xferInt(&m_failedAttempts); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void DozerActionPickActionPosState::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- /** Pick a position around the target */ @@ -179,7 +179,7 @@ StateReturnType DozerActionPickActionPosState::update( void ) // exit with failure return STATE_FAILURE; - } // end if + } // pick a location to move to Coord3D goalPos; @@ -213,7 +213,7 @@ StateReturnType DozerActionPickActionPosState::update( void ) // if ai. goalPos = *goalObject->getPosition(); - } // end if + } // // we only ignore the goal object when we did the point selection in this more @@ -221,7 +221,7 @@ StateReturnType DozerActionPickActionPosState::update( void ) // ai->ignoreObstacle( goalObject ); - } // end if + } // set goal position and object machine->setGoalObject( goalObject ); @@ -231,7 +231,7 @@ StateReturnType DozerActionPickActionPosState::update( void ) return STATE_SUCCESS; -} // end update +} //------------------------------------------------------------------------------------------------- /** Dozer moves to the action position */ @@ -263,7 +263,7 @@ EMPTY_DTOR(DozerActionMoveToActionPosState) // ------------------------------------------------------------------------------------------------ void DozerActionMoveToActionPosState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -276,14 +276,14 @@ void DozerActionMoveToActionPosState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUser(&m_task, sizeof(m_task)); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void DozerActionMoveToActionPosState::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- /** We are supposed to be on route to our action position now, see when we get there or @@ -355,11 +355,11 @@ StateReturnType DozerActionMoveToActionPosState::update( void ) MAKE_MODELCONDITION_MASK(MODELCONDITION_AWAITING_CONSTRUCTION), MAKE_MODELCONDITION_MASK2(MODELCONDITION_PARTIALLY_CONSTRUCTED, MODELCONDITION_ACTIVELY_BEING_CONSTRUCTED)); - } // end if + } return STATE_SUCCESS; - } // end if + } // if we're in the idle state fail our move @@ -370,7 +370,7 @@ StateReturnType DozerActionMoveToActionPosState::update( void ) return STATE_CONTINUE; -} // end update +} //------------------------------------------------------------------------------------------------- /** Dozer does the "action" */ @@ -411,7 +411,7 @@ EMPTY_DTOR(DozerActionDoActionState) // ------------------------------------------------------------------------------------------------ void DozerActionDoActionState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -425,14 +425,14 @@ void DozerActionDoActionState::xfer( Xfer *xfer ) xfer->xferUser(&m_task, sizeof(m_task)); xfer->xferUnsignedInt(&m_enterFrame); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void DozerActionDoActionState::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- /** Entering the do action state */ @@ -456,7 +456,7 @@ StateReturnType DozerActionDoActionState::onEnter( void ) return STATE_CONTINUE; -} // end onEnter +} //------------------------------------------------------------------------------------------------- /** Do the action */ @@ -508,7 +508,7 @@ StateReturnType DozerActionDoActionState::update( void ) // we're now moving to the dock location dozerAI->setBuildSubTask( DOZER_MOVING_TO_BUILD_DOCK_LOCATION ); - } // end if + } // if we're moving to the build dock location, when we become idle we are there if( dozerAI->getBuildSubTask() == DOZER_MOVING_TO_BUILD_DOCK_LOCATION ) @@ -520,7 +520,7 @@ StateReturnType DozerActionDoActionState::update( void ) // from the building itself) dozerAI->startBuildingSound( goalObject->getTemplate()->getPerUnitSound( "UnderConstruction" ), goalObject->getID() ); } - } // end if + } // only do the build if we've moved into the dock position if( dozerAI->getBuildSubTask() == DOZER_DO_BUILD_AT_DOCK ) @@ -599,7 +599,7 @@ StateReturnType DozerActionDoActionState::update( void ) create->onBuildComplete(); } - } // end if + } // Creation is another valid and essential time to call this. This building now Looks. goalObject->handlePartitionCellMaintenance(); @@ -620,7 +620,7 @@ StateReturnType DozerActionDoActionState::update( void ) objectName.format( format, goalObject->getTemplate()->getName().str() ); - } // end if + } UnicodeString msg; msg.format( format.str(), objectName.str() ); @@ -633,7 +633,7 @@ StateReturnType DozerActionDoActionState::update( void ) /// make radar neat-o attention grabber event at build location TheRadar->createEvent( goalObject->getPosition(), RADAR_EVENT_CONSTRUCTION ); - } // end if + } // this will allow us to exit the state machine with success complete = TRUE; @@ -648,13 +648,13 @@ StateReturnType DozerActionDoActionState::update( void ) TheAI->pathfinder()->adjustToPossibleDestination(dozer, ai->getLocomotorSet(), &pos); ai->aiMoveToPosition( &pos, CMD_FROM_AI ); - } // end if + } - } // end if + } break; - } // end build + } //--------------------------------------------------------------------------------------------- case DOZER_TASK_REPAIR: @@ -671,7 +671,7 @@ StateReturnType DozerActionDoActionState::update( void ) // we're now complete complete = TRUE; - } // end if + } else { Bool canHeal = TRUE; @@ -699,7 +699,7 @@ StateReturnType DozerActionDoActionState::update( void ) if( bbi->isScaffoldInMotion() == TRUE ) canHeal = FALSE; - } // end if + } // do healing if( canHeal ) @@ -725,15 +725,15 @@ StateReturnType DozerActionDoActionState::update( void ) - } // end if + } - } // end else + } // play a repairing sound break; - } // end repair + } //--------------------------------------------------------------------------------------------- case DOZER_TASK_FORTIFY: @@ -742,7 +742,7 @@ StateReturnType DozerActionDoActionState::update( void ) /// @todo write me break; - } // end fortify + } //--------------------------------------------------------------------------------------------- default: @@ -751,9 +751,9 @@ StateReturnType DozerActionDoActionState::update( void ) DEBUG_CRASH(( "Unknown task for the dozer action do action state" )); return STATE_FAILURE; - } // end default + } - } // end switch + } // if we're complete with the task we exit success if( complete == TRUE ) @@ -770,14 +770,14 @@ StateReturnType DozerActionDoActionState::update( void ) // we're done return STATE_SUCCESS; - } // end if + } // just continue sitting here for a while getMachineOwner()->clearWeaponSetFlag(WEAPONSET_MINE_CLEARING_DETAIL);// no mine clearing fun while I'm on the job return STATE_CONTINUE; -} // end update +} //------------------------------------------------------------------------------------------------- /** The Dozer action state machine */ @@ -826,7 +826,7 @@ DozerActionStateMachine::DozerActionStateMachine( Object *owner, DozerTask task // ------------------------------------------------------------------------------------------------ void DozerActionStateMachine::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -839,14 +839,14 @@ void DozerActionStateMachine::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUser(&m_task, sizeof(m_task)); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void DozerActionStateMachine::loadPostProcess( void ) { -} // end loadPostProcess +} /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -895,7 +895,7 @@ static Object *findObjectToRepair( Object *dozer ) closestRepairTarget = obj; closestRepairTargetDistSqr = ThePartitionManager->getDistanceSquared( dozer, obj, FROM_CENTER_2D ); - } // end if + } else { @@ -907,15 +907,15 @@ static Object *findObjectToRepair( Object *dozer ) closestRepairTarget = obj; closestRepairTargetDistSqr = distSqr; - } // end if + } - } // end else + } - } // end for obj + } return closestRepairTarget; -} // end findObjectToRepair +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -940,7 +940,7 @@ static Object *findMine( Object *dozer ) Object* mine = ThePartitionManager->getClosestObject(dozer, dozerAI->getBoredRange(), FROM_CENTER_2D, filters); return mine; -} // end findMine +} //------------------------------------------------------------------------------------------------- /** Available primary Dozer states */ @@ -992,7 +992,7 @@ EMPTY_DTOR(DozerPrimaryIdleState) // ------------------------------------------------------------------------------------------------ void DozerPrimaryIdleState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1007,14 +1007,14 @@ void DozerPrimaryIdleState::xfer( Xfer *xfer ) xfer->xferUnsignedInt(&m_idleTooLongTimestamp); xfer->xferInt(&m_idlePlayerNumber); xfer->xferBool(&m_isMarkedAsIdle); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void DozerPrimaryIdleState::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- @@ -1035,7 +1035,7 @@ StateReturnType DozerPrimaryIdleState::onEnter( void ) return STATE_CONTINUE; -} // end onEnter +} //------------------------------------------------------------------------------------------------- /** Upon exiting the dozer primary idle state */ @@ -1131,11 +1131,11 @@ StateReturnType DozerPrimaryIdleState::update( void ) } - } // end if + } return STATE_CONTINUE; -} // end update +} //------------------------------------------------------------------------------------------------- /** Dozer action state */ @@ -1180,7 +1180,7 @@ inline DozerActionState::~DozerActionState( void ) { deleteInstance(m_actionMach // ------------------------------------------------------------------------------------------------ void DozerActionState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1194,14 +1194,14 @@ void DozerActionState::xfer( Xfer *xfer ) xfer->xferUser(&m_task, sizeof(m_task)); xfer->xferSnapshot(m_actionMachine); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void DozerActionState::loadPostProcess( void ) { -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ @@ -1228,7 +1228,7 @@ StateReturnType DozerActionState::onEnter( void ) return STATE_CONTINUE; -} // end onEnter +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1244,7 +1244,7 @@ void DozerActionState::onExit( StateExitType status ) DozerAIInterface *dozerAI = dozer->getAIUpdateInterface()->getDozerAIInterface(); dozerAI->setCurrentTask( DOZER_TASK_INVALID ); -} // end onExit +} //------------------------------------------------------------------------------------------------- /** Dozer primary going home state */ @@ -1286,14 +1286,14 @@ DozerPrimaryStateMachine::DozerPrimaryStateMachine( Object *owner ) : StateMachi defineState( DOZER_PRIMARY_FORTIFY, newInstance(DozerActionState)( this, DOZER_TASK_FORTIFY ), DOZER_PRIMARY_IDLE, DOZER_PRIMARY_IDLE ); defineState( DOZER_PRIMARY_GO_HOME, newInstance(DozerPrimaryGoingHomeState)( this ), DOZER_PRIMARY_IDLE, DOZER_PRIMARY_IDLE ); -} // end DozerPrimaryStateMachine +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- DozerPrimaryStateMachine::~DozerPrimaryStateMachine( void ) { -} // end ~DozerPrimaryStateMachine +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -1301,7 +1301,7 @@ DozerPrimaryStateMachine::~DozerPrimaryStateMachine( void ) void DozerPrimaryStateMachine::crc( Xfer *xfer ) { StateMachine::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1313,7 +1313,7 @@ void DozerPrimaryStateMachine::xfer( Xfer *xfer ) xfer->xferVersion( &v, cv ); StateMachine::xfer(xfer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1321,7 +1321,7 @@ void DozerPrimaryStateMachine::xfer( Xfer *xfer ) void DozerPrimaryStateMachine::loadPostProcess( void ) { StateMachine::loadPostProcess(); -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1346,7 +1346,7 @@ Bool DozerPrimaryStateMachine::isBuildMostImportant( State *thisState, void* use DozerTask task = dozerAI->getMostRecentCommand(); return task == DOZER_TASK_BUILD; -} // end isBuildMostImportant +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1371,7 +1371,7 @@ Bool DozerPrimaryStateMachine::isRepairMostImportant( State *thisState, void* us DozerTask task = dozerAI->getMostRecentCommand(); return task == DOZER_TASK_REPAIR; -} // end isRepairMostImportant +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1396,7 +1396,7 @@ Bool DozerPrimaryStateMachine::isFortifyMostImportant( State *thisState, void* u DozerTask task = dozerAI->getMostRecentCommand(); return task == DOZER_TASK_FORTIFY; -} // end isFortifyMostImportat +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1411,7 +1411,7 @@ DozerAIUpdateModuleData::DozerAIUpdateModuleData( void ) m_boredTime = 0.0f; m_boredRange = 0.0f; -} // end DozerAIUpdateModuleData +} // ------------------------------------------------------------------------------------------------ void DozerAIUpdateModuleData::buildFieldParse( MultiIniFieldParse& p) @@ -1428,7 +1428,7 @@ void DozerAIUpdateModuleData::buildFieldParse( MultiIniFieldParse& p) p.add( dataFieldParse ); -} // end buildFieldParse +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1450,9 +1450,9 @@ DozerAIUpdate::DozerAIUpdate( Thing *thing, const ModuleData* moduleData ) : m_dockPoint[ i ][ j ].valid = FALSE; m_dockPoint[ i ][ j ].location.zero(); - } // end for j + } - } // end for i + } m_currentTask = DOZER_TASK_INVALID; m_buildSubTask = DOZER_SELECT_BUILD_DOCK_LOCATION; // irrelavant, but I want non-garbage value @@ -1464,7 +1464,7 @@ DozerAIUpdate::DozerAIUpdate( Thing *thing, const ModuleData* moduleData ) : m_dozerMachine = NULL; createMachines(); -} // end DozerAIUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1481,9 +1481,9 @@ DozerAIUpdate::~DozerAIUpdate( void ) m_task[ i ].m_targetObjectID = INVALID_ID; m_task[ i ].m_taskOrderFrame = 0; - } // end for i + } -} // end ~DozerAIUpdate +} // ------------------------------------------------------------------------------------------------ /** Create any sub machines we need to do all our behavior */ @@ -1497,9 +1497,9 @@ void DozerAIUpdate::createMachines( void ) m_dozerMachine = newInstance(DozerPrimaryStateMachine)( getObject() ); m_dozerMachine->initDefaultState(); - } // end if + } -} // end createMachines +} // ------------------------------------------------------------------------------------------------ /** Create the bridge scaffolding if necessary for the bridge that is attached to this tower */ @@ -1525,7 +1525,7 @@ void DozerAIUpdate::createBridgeScaffolding( Object *bridgeTower ) // tell the bridge to create scaffolding if necessary bbi->createScaffolding(); -} // end createBridgeScaffolding +} // ------------------------------------------------------------------------------------------------ /** Remove the bridge scaffolding from the bridge object that is attached to this tower */ @@ -1551,7 +1551,7 @@ void DozerAIUpdate::removeBridgeScaffolding( Object *bridgeTower ) // tell the bridge to end any scaffolding from repairing bbi->removeScaffolding(); -} // end removeBridgeScaffolding +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1604,7 +1604,7 @@ UpdateSleepTime DozerAIUpdate::update( void ) if( invalidTask == TRUE ) cancelTask( currentTask ); - } // end if + } else getObject()->setWeaponSetFlag(WEAPONSET_MINE_CLEARING_DETAIL);//maybe go clear some mines, if I feel like it @@ -1613,7 +1613,7 @@ UpdateSleepTime DozerAIUpdate::update( void ) return UPDATE_SLEEP_NONE; -} // end update +} //------------------------------------------------------------------------------------------------- /** The entry point of a construct command to the Dozer */ @@ -1653,7 +1653,7 @@ Object *DozerAIUpdate::construct( const ThingTemplate *what, // Just build it. The ai will validate, or cheat. jba. - } // end if + } else { @@ -1670,9 +1670,9 @@ Object *DozerAIUpdate::construct( const ThingTemplate *what, getObject(), NULL ) != LBC_OK ) return NULL; - } // end else + } - } // end if + } // // what will our initial status bits be, it is important to do this early @@ -1696,7 +1696,7 @@ Object *DozerAIUpdate::construct( const ThingTemplate *what, money->withdraw( what->calcCostToBuild( owningPlayer ) ); - } // end if + } // initialize object obj->setPosition( pos ); @@ -1731,7 +1731,7 @@ Object *DozerAIUpdate::construct( const ThingTemplate *what, return obj; -} // end construct +} // ------------------------------------------------------------------------------------------------ /** Given our current task and repair target, can we accept this as a new repair target */ @@ -1774,20 +1774,20 @@ Bool DozerAIUpdate::canAcceptNewRepair( Object *obj ) DEBUG_CRASH(( "Unable to find bridge tower interface on object" )); return FALSE; - } // end if + } // if they are part of the same bridge, ignore this repair command if( currentTowerInterface->getBridgeID() == newTowerInterface->getBridgeID() ) return FALSE; - } // end if + } - } // end if, currentRepair object exists + } // all is well return TRUE; -} // end canAcceptNewRepair +} // ------------------------------------------------------------------------------------------------ /** Issue an order for the Dozer to go repair the target 'obj' */ @@ -1842,7 +1842,7 @@ void DozerAIUpdate::privateRepair( Object *obj, CommandSourceType cmdSource ) // start the new task newTask( DOZER_TASK_REPAIR, obj ); -} // end repair +} // ------------------------------------------------------------------------------------------------ /** Resume construction on a building */ @@ -1861,7 +1861,7 @@ void DozerAIUpdate::privateResumeConstruction( Object *obj, CommandSourceType cm // start the new task for construction newTask( DOZER_TASK_BUILD, obj ); -} // end privateResumeConstruction +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2010,7 +2010,7 @@ void DozerAIUpdate::newTask( DozerTask task, Object *target ) m_dockPoint[ task ][ DOZER_DOCK_POINT_END ].valid = TRUE; m_dockPoint[ task ][ DOZER_DOCK_POINT_END ].location = position; - } // end if + } // set the new task target and the frame in which we got this order m_task[ task ].m_targetObjectID = target->getID(); @@ -2019,7 +2019,7 @@ void DozerAIUpdate::newTask( DozerTask task, Object *target ) // reset the dozer behavior so that it can re-evluate which task to continue working on m_dozerMachine->resetToDefaultState(); -} // end newTask +} //------------------------------------------------------------------------------------------------- /** Cancel a task and reset the dozer behavior state machine so that it can @@ -2035,7 +2035,7 @@ void DozerAIUpdate::cancelTask( DozerTask task ) // reset the machine to we can re-evaluate what we want to do m_dozerMachine->resetToDefaultState(); -} // end cancelTask +} //------------------------------------------------------------------------------------------------- /** Is there a given task waiting to be done */ @@ -2048,7 +2048,7 @@ Bool DozerAIUpdate::isTaskPending( DozerTask task ) return m_task[ task ].m_targetObjectID != 0 ? TRUE : FALSE; -} // end isTaskPending +} //------------------------------------------------------------------------------------------------- /** Is there any task pending */ @@ -2062,7 +2062,7 @@ Bool DozerAIUpdate::isAnyTaskPending( void ) return FALSE; -} // end isAnyTaskPending +} //------------------------------------------------------------------------------------------------- /** Get the target object of a given task */ @@ -2075,7 +2075,7 @@ ObjectID DozerAIUpdate::getTaskTarget( DozerTask task ) return m_task[ task ].m_targetObjectID; -} // end getTaskTarget +} //------------------------------------------------------------------------------------------------- /** Set a task as successfully completed */ @@ -2097,7 +2097,7 @@ void DozerAIUpdate::internalTaskComplete( DozerTask task ) for( Int i = 0; i < DOZER_NUM_DOCK_POINTS; i++ ) m_dockPoint[ task ][ i ].valid = FALSE; -} // end internalTaskComplete +} //------------------------------------------------------------------------------------------------- /** Clear a task from the Dozer for consideration, we can use this when a goal object becomes @@ -2127,7 +2127,7 @@ void DozerAIUpdate::internalCancelTask( DozerTask task ) AIUpdateInterface *ai = getObject()->getAIUpdateInterface(); ai->aiIdle( CMD_FROM_AI ); -} // end internalCancelTask +} // ------------------------------------------------------------------------------------------------ /** This method is called whenever a task is completed *OR* cancelled */ @@ -2144,7 +2144,7 @@ void DozerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) break; // do nothing, this is really no task - } // end invalid + } // -------------------------------------------------------------------------------------------- case DOZER_TASK_BUILD: @@ -2163,7 +2163,7 @@ void DozerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) // } break; - } // end build + } // -------------------------------------------------------------------------------------------- case DOZER_TASK_REPAIR: @@ -2202,7 +2202,7 @@ void DozerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) break; - } // end repair + } // -------------------------------------------------------------------------------------------- case DOZER_TASK_FORTIFY: @@ -2210,7 +2210,7 @@ void DozerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) break; - } // end fortify + } // -------------------------------------------------------------------------------------------- default: @@ -2219,11 +2219,11 @@ void DozerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) DEBUG_CRASH(( "internalTaskCompleteOrCancelled: Unknown Dozer task '%d'", task )); break; - } // end default + } - } // end switch( task ) + } -} // end internalTaskCompleteOrCancelled +} //------------------------------------------------------------------------------------------------- /** If we were building something, kill the active-construction flag on it */ @@ -2239,7 +2239,7 @@ void DozerAIUpdate::onDelete( void ) if( isTaskPending( (DozerTask)i ) ) cancelTask( (DozerTask)i ); - } // end for i + } for( i = 0; i < DOZER_NUM_TASKS; i++ ) { @@ -2272,15 +2272,15 @@ DozerTask DozerAIUpdate::getMostRecentCommand( void ) mostRecentTask = (DozerTask)i; mostRecentFrame = m_task[ i ].m_taskOrderFrame; - } // end if + } - } // end if + } - } // end for i + } return mostRecentTask; -} // end getMostRecentCommand +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -2302,7 +2302,7 @@ const Coord3D* DozerAIUpdate::getDockPoint( DozerTask task, DozerDockPoint point // no valid point has been set for this dock point on this task return NULL; -} // end getDockPoint +} // ------------------------------------------------------------------------------------------------ Real DozerAIUpdate::getRepairHealthPerSecond( void ) const @@ -2368,7 +2368,7 @@ void DozerAIUpdate::aiDoCommand(const AICommandParms* parms) privateRepair(parms->m_obj, parms->m_cmdSource); break; - } // end repair + } // -------------------------------------------------------------------------------------------- case AICMD_RESUME_CONSTRUCTION: @@ -2382,7 +2382,7 @@ void DozerAIUpdate::aiDoCommand(const AICommandParms* parms) privateResumeConstruction( parms->m_obj, parms->m_cmdSource ); break; - } // end resume construction + } // -------------------------------------------------------------------------------------------- default: @@ -2400,11 +2400,11 @@ void DozerAIUpdate::aiDoCommand(const AICommandParms* parms) m_dozerMachine->resetToDefaultState(); break; - } // end default + } - } // end switch + } -} // end aiDoCommand +} //------------------------------------------------------------------------------------------------ void DozerAIUpdate::startBuildingSound( const AudioEventRTS *sound, ObjectID constructionSiteID ) @@ -2428,7 +2428,7 @@ void DozerAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -2473,7 +2473,7 @@ void DozerAIUpdate::xfer( Xfer *xfer ) } xfer->xferUser(&m_buildSubTask, sizeof(m_buildSubTask)); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -2482,6 +2482,6 @@ void DozerAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp index b155ac76159..425f6a9cecf 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp @@ -201,7 +201,7 @@ void HackInternetAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -221,7 +221,7 @@ void HackInternetAIUpdate::xfer( Xfer *xfer ) if (m_hasPendingCommand) { m_pendingCommand.doXfer(xfer); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -230,7 +230,7 @@ void HackInternetAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- @@ -258,7 +258,7 @@ HackInternetStateMachine::~HackInternetStateMachine() // ------------------------------------------------------------------------------------------------ void UnpackingState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -271,14 +271,14 @@ void UnpackingState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUnsignedInt(&m_framesRemaining); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void UnpackingState::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- StateReturnType UnpackingState::onEnter() @@ -347,7 +347,7 @@ void UnpackingState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void PackingState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -360,14 +360,14 @@ void PackingState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUnsignedInt(&m_framesRemaining); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void PackingState::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- StateReturnType PackingState::onEnter() @@ -423,7 +423,7 @@ void PackingState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void HackInternetState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -436,14 +436,14 @@ void HackInternetState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUnsignedInt(&m_framesRemaining); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void HackInternetState::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- StateReturnType HackInternetState::onEnter() diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp index 7c347169f9b..2208beac770 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp @@ -2281,7 +2281,7 @@ void JetAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -2344,7 +2344,7 @@ void JetAIUpdate::xfer( Xfer *xfer ) } } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -2364,4 +2364,4 @@ void JetAIUpdate::loadPostProcess( void ) // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp index f82f8276535..131df30fa13 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp @@ -344,8 +344,8 @@ Bool MissileAIUpdate::projectileHandleCollision( Object *other ) thingToKill->kill(); ++numKilled; } - } // next contained item - } // if items + } + } if (numKilled > 0) { @@ -357,7 +357,7 @@ Bool MissileAIUpdate::projectileHandleCollision( Object *other ) return true; } - } // if a garrisonable thing + } } } @@ -737,7 +737,7 @@ void MissileAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -803,7 +803,7 @@ void MissileAIUpdate::xfer( Xfer *xfer ) xfer->xferUser( &m_exhaustID, sizeof( m_exhaustID ) ); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -812,4 +812,4 @@ void MissileAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp index 1be4dee7779..2c452a9155c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp @@ -58,7 +58,7 @@ POWTruckAIUpdateModuleData::POWTruckAIUpdateModuleData( void ) m_boredTimeInFrames = 0; m_hangAroundPrisonDistance = 0; -} // end POWTruckAIUpdateModuleData +} // ------------------------------------------------------------------------------------------------ void POWTruckAIUpdateModuleData::buildFieldParse( MultiIniFieldParse &p ) @@ -74,7 +74,7 @@ void POWTruckAIUpdateModuleData::buildFieldParse( MultiIniFieldParse &p ) p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC ///////////////////////////////////////////////////////////////////////////////////////// @@ -93,21 +93,21 @@ POWTruckAIUpdate::POWTruckAIUpdate( Thing *thing, const ModuleData *moduleData ) m_enteredWaitingFrame = 0; m_lastFindFrame = 0; -} // end POWTruckAIUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- POWTruckAIUpdate::~POWTruckAIUpdate( void ) { -} // end ~POWTruckAIUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- void POWTruckAIUpdate::onDelete( void ) { -} // end onDelete +} // ------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------- @@ -127,7 +127,7 @@ void POWTruckAIUpdate::aiDoCommand( const AICommandParms *parms ) // set our task to waiting setTask( POW_TRUCK_TASK_WAITING ); - } // end if + } switch( parms->m_cmd ) { @@ -139,7 +139,7 @@ void POWTruckAIUpdate::aiDoCommand( const AICommandParms *parms ) privatePickUpPrisoner( parms->m_obj, parms->m_cmdSource ); break; - } // end pick up prisoner + } // -------------------------------------------------------------------------------------------- case AICMD_RETURN_PRISONERS: @@ -148,7 +148,7 @@ void POWTruckAIUpdate::aiDoCommand( const AICommandParms *parms ) privateReturnPrisoners( parms->m_obj, parms->m_cmdSource ); break; - } // end return prisoners + } // -------------------------------------------------------------------------------------------- default: @@ -158,11 +158,11 @@ void POWTruckAIUpdate::aiDoCommand( const AICommandParms *parms ) AIUpdateInterface::aiDoCommand( parms ); break; - } // end default + } - } // end switch( parms->m_cmd ) + } -} // end aiDoCommand +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -201,11 +201,11 @@ UpdateSleepTime POWTruckAIUpdate::update( void ) DEBUG_CRASH(( "POWTruckAIUpdate::update - Unknown current task '%d'", m_currentTask )); break; - } // end switch, current task + } return UPDATE_SLEEP_NONE; -} // end update +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PROTECTED ////////////////////////////////////////////////////////////////////////////////////// @@ -227,7 +227,7 @@ void POWTruckAIUpdate::setTask( POWTruckTask task, Object *taskObject ) setTask( POW_TRUCK_TASK_WAITING ); return; - } // end if + } // when leaving the collecting target state, we need to do some bookeeping if( oldTask == POW_TRUCK_TASK_COLLECTING_TARGET ) @@ -236,7 +236,7 @@ void POWTruckAIUpdate::setTask( POWTruckTask task, Object *taskObject ) // target cleanup m_targetID = INVALID_ID; - } // end if + } // to be clean, when leaving the POW_TRUCK_TASK_RETURNING_PRISONERS state, clear out the prison ID we were watching if( oldTask == POW_TRUCK_TASK_RETURNING_PRISONERS ) @@ -253,26 +253,26 @@ void POWTruckAIUpdate::setTask( POWTruckTask task, Object *taskObject ) DEBUG_ASSERTCRASH( taskObject->getAIUpdateInterface(), ("POWTruckAIUpdate::setTask - '%s' has no ai module", taskObject->getTemplate()->getName().str()) ); - } // end if + } else if( task == POW_TRUCK_TASK_RETURNING_PRISONERS ) { // save ID of the prison we're going to m_prisonID = taskObject->getID(); - } // end else + } else if( task == POW_TRUCK_TASK_WAITING ) { // mark the frame and always go idle m_enteredWaitingFrame = TheGameLogic->getFrame(); - } // end else if + } // store the new current task m_currentTask = task; -} // end task +} // ------------------------------------------------------------------------------------------------ /** Set this unit into automatic or manual AI mode, when automatic the AI will look for @@ -285,7 +285,7 @@ void POWTruckAIUpdate::setAIMode( POWTruckAIMode mode ) // save the mode m_aiMode = mode; -} // end setAIModel +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -317,7 +317,7 @@ void POWTruckAIUpdate::privatePickUpPrisoner( Object *prisoner, CommandSourceTyp getCurLocomotor()->setUltraAccurate( TRUE ); aiMoveToObject( prisoner, CMD_FROM_AI ); -} // end privatePickUpPrisoner +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -344,7 +344,7 @@ void POWTruckAIUpdate::privateReturnPrisoners( Object *prison, CommandSourceType getCurLocomotor()->setUltraAccurate( TRUE ); aiDock( prison, cmdSource ); -} // end privateReturnPrisoners +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -376,7 +376,7 @@ void POWTruckAIUpdate::updateWaiting( void ) if( TheGameLogic->getFrame() - m_enteredWaitingFrame > modData->m_boredTimeInFrames ) setTask( POW_TRUCK_TASK_FIND_TARGET ); -} // updateWaiting +} static const UnsignedInt FIND_DELAY = LOGICFRAMES_PER_SECOND * 1; // ------------------------------------------------------------------------------------------------ @@ -410,7 +410,7 @@ void POWTruckAIUpdate::updateFindTarget( void ) doReturnPrisoners(); return; - } // end if + } // find closest target not already targeted for pickup by another POW truck Object *target = findBestTarget(); @@ -422,7 +422,7 @@ void POWTruckAIUpdate::updateFindTarget( void ) // send the pickup command ai->aiPickUpPrisoner( target, CMD_FROM_AI ); - } // end if + } else { @@ -432,9 +432,9 @@ void POWTruckAIUpdate::updateFindTarget( void ) else doReturnToPrison( NULL ); - } // end else + } -} // end updateFindTarget +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -454,7 +454,7 @@ void POWTruckAIUpdate::updateCollectingTarget( void ) return; - } // end if + } // we should never become idle while collecting a target, if we do, find a target Object *us = getObject(); @@ -467,7 +467,7 @@ void POWTruckAIUpdate::updateCollectingTarget( void ) else setTask( POW_TRUCK_TASK_WAITING ); - } // end if + } /* // @@ -487,12 +487,12 @@ void POWTruckAIUpdate::updateCollectingTarget( void ) // tell them to start moving to us targetAI->aiMoveToObject( us, CMD_FROM_AI ); - } // end if + } - } // end if + } */ -} // end updateCollectingTarget +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -526,7 +526,7 @@ static void putContainedInPrison( Object *obj, void *userData ) destContain->addToContain( obj ); } -} // end putContainedInPrison +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -547,13 +547,13 @@ void POWTruckAIUpdate::updateReturnPrisoners( void ) doReturnPrisoners(); return; - } // end if + } // we should not go idle, we should collide with the prison to return the prisoners if( ai->isIdle() ) doReturnPrisoners(); -} // end updateReturnPrisoners +} // ------------------------------------------------------------------------------------------------ /** Is the object 'target' a valid target for collection */ @@ -563,7 +563,7 @@ Bool POWTruckAIUpdate::validateTarget( const Object *target ) return TheActionManager->canPickUpPrisoner( getObject(), target, getLastCommandSource() ); -} // end validateTarget +} // ------------------------------------------------------------------------------------------------ /** Initiate a return prisoners contained in us to prison */ @@ -581,7 +581,7 @@ void POWTruckAIUpdate::doReturnPrisoners( void ) setTask( POW_TRUCK_TASK_WAITING ); return; - } // end if + } // start the prisoner return process Object *us = getObject(); @@ -590,7 +590,7 @@ void POWTruckAIUpdate::doReturnPrisoners( void ) us->getTemplate()->getName().str()) ); ai->aiReturnPrisoners( prison, CMD_FROM_AI ); -} // end doReturnPrisoners +} // ------------------------------------------------------------------------------------------------ /** Initate a return of our empty truck back near the closest prison */ @@ -624,7 +624,7 @@ void POWTruckAIUpdate::doReturnToPrison( Object *prison ) // dock us with the prison aiDock( prison, CMD_FROM_AI ); -} // end doReturnToPrison +} // ------------------------------------------------------------------------------------------------ /** Find the best prison for us to use given our current position */ @@ -641,7 +641,7 @@ Object *POWTruckAIUpdate::findBestPrison( void ) return prison; -} // end findBestPrison +} // ------------------------------------------------------------------------------------------------ /** Find the best prisoner for us to go pick up given our current situation */ @@ -693,15 +693,15 @@ Object *POWTruckAIUpdate::findBestTarget( void ) closestTarget = other; closestTargetDistSq = distSq; - } // end if + } - } // end if + } - } // end for other + } return closestTarget; -} // end findBestTarget +} // ------------------------------------------------------------------------------------------------ /** We are chosing to pass a structure through the iterate function to unload the @@ -755,7 +755,7 @@ static void putPrisonersInPrison( Object *obj, void *userData ) prisonUnloadData->bounty += TheGlobalData->m_prisonBountyMultiplier * obj->getTemplate()->calcCostToBuild( prisonerOwningPlayer ); -} // end putPrisonersInPrison +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -815,16 +815,16 @@ void POWTruckAIUpdate::unloadPrisonersToPrison( Object *prison ) moneyString.format( TheGameText->fetch( "GUI:AddCash" ), prisonUnloadData.bounty ); TheInGameUI->addFloatingText( moneyString, &pos, moneyColor ); - } // end if + } - } // end if + } - } // end if + } // set our state to waiting and become idle setTask( POW_TRUCK_TASK_WAITING ); -} // end unloadPrisonersToPrison +} // ------------------------------------------------------------------------------------------------ /** We have arrived at a prisoner to load into us ... do it */ @@ -850,7 +850,7 @@ void POWTruckAIUpdate::loadPrisoner( Object *prisoner ) doReturnPrisoners(); return; - } // end if + } // add object to our containment contain->addToContain( prisoner ); @@ -870,7 +870,7 @@ void POWTruckAIUpdate::loadPrisoner( Object *prisoner ) else setTask( POW_TRUCK_TASK_WAITING ); -} // end loadPrisoner +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -879,7 +879,7 @@ void POWTruckAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -903,7 +903,7 @@ void POWTruckAIUpdate::xfer( Xfer *xfer ) xfer->xferUnsignedInt(&m_enteredWaitingFrame); xfer->xferUnsignedInt(&m_lastFindFrame); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -912,6 +912,6 @@ void POWTruckAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} #endif diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailedTransportAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailedTransportAIUpdate.cpp index 0226195f1ac..df7e62a6602 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailedTransportAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailedTransportAIUpdate.cpp @@ -45,7 +45,7 @@ static const Int INVALID_PATH = -1; RailedTransportAIUpdateModuleData::RailedTransportAIUpdateModuleData( void ) { -} // end RailedTransportAIUpdateModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -61,7 +61,7 @@ void RailedTransportAIUpdateModuleData::buildFieldParse( MultiIniFieldParse &p ) p.add( dataFieldParse ); -} // end buildFieldParse +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -76,19 +76,19 @@ RailedTransportAIUpdate::RailedTransportAIUpdate( Thing *thing, const ModuleData m_path[ i ].startWaypointID = 0; m_path[ i ].endWaypointID = 0; - } // end for i + } m_numPaths = 0; m_currentPath = INVALID_PATH; m_waypointDataLoaded = FALSE; -} // end RailedTransportAIUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- RailedTransportAIUpdate::~RailedTransportAIUpdate( void ) { -} // end ~RailedTransportAIUpdate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -118,14 +118,14 @@ void RailedTransportAIUpdate::loadWaypointData( void ) m_path[ i ].endWaypointID = end->getID(); m_numPaths++; - } // end if + } - } // end for i + } // waypoint data is loaded m_waypointDataLoaded = TRUE; -} // end loadWaypointData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -163,11 +163,11 @@ void RailedTransportAIUpdate::pickAndMoveToInitialLocation( void ) closestPath = i; closestEndWaypoint = waypoint; - } // end if + } - } // end if + } - } // end for i + } // a path must have been found DEBUG_ASSERTCRASH( closestPath != INVALID_PATH, @@ -183,7 +183,7 @@ void RailedTransportAIUpdate::pickAndMoveToInitialLocation( void ) // we are now "in transit" setInTransit( TRUE ); -} // end pickAndMoveToInitialLocation +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -245,18 +245,18 @@ UpdateSleepTime RailedTransportAIUpdate::update( void ) // we are no longer in transit setInTransit( FALSE ); - } // end if + } } else { setInTransit( FALSE ); } - } // end if + } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------- @@ -276,7 +276,7 @@ void RailedTransportAIUpdate::aiDoCommand( const AICommandParms *parms ) // call the default do command AIUpdateInterface::aiDoCommand( parms ); -} // end aiDoCommand +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE //////////////////////////////////////////////////////////////////////////////////////// @@ -296,7 +296,7 @@ void RailedTransportAIUpdate::setInTransit( Bool inTransit ) // no longer in transit m_inTransit = inTransit; -} // end setInTransit +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -332,7 +332,7 @@ void RailedTransportAIUpdate::privateExecuteRailedTransport( CommandSourceType c // we are now in transit setInTransit( TRUE ); -} // end privateExecuteRailedTransport +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -365,7 +365,7 @@ void RailedTransportAIUpdate::privateEvacuate( Int exposeStealthUnits, CommandSo // start the manual undocking process rtdui->unloadAll(); -} // end privateEvacuate +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -374,7 +374,7 @@ void RailedTransportAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -404,7 +404,7 @@ void RailedTransportAIUpdate::xfer( Xfer *xfer ) xfer->xferInt(&m_currentPath); xfer->xferBool(&m_waypointDataLoaded); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -413,4 +413,4 @@ void RailedTransportAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp index 0467e76389f..05608fd5f5b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp @@ -90,7 +90,7 @@ RailroadBehaviorModuleData::RailroadBehaviorModuleData( void ) m_braking = 0.99f; m_friction = 0.97f; m_waitAtStationTime = 150; -} // end RailroadBehaviorModuleData +} //------------------------------------------------------------------------------------------------- @@ -159,7 +159,7 @@ RailroadBehavior::RailroadBehavior( Thing *thing, const ModuleData *moduleData ) m_conductorState = m_isLocomotive ? ACCELERATE : COAST; -} // end RailroadBehavior +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -177,7 +177,7 @@ RailroadBehavior::~RailroadBehavior( void ) } -} // end ~RailroadBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -421,7 +421,7 @@ void RailroadBehavior::onCollide( Object *other, const Coord3D *loc, const Coord -} // end RailroadBehavior:: on collide +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -635,7 +635,7 @@ void RailroadBehavior::loadTrackData( void ) } } -} // end loadTrackData +} @@ -806,7 +806,7 @@ UpdateSleepTime RailroadBehavior::update( void ) return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------- @@ -1467,7 +1467,7 @@ void RailroadBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1547,7 +1547,7 @@ void RailroadBehavior::xfer( Xfer *xfer ) } -} // end xfer +} @@ -1589,7 +1589,7 @@ void RailroadBehavior::loadPostProcess( void ) m_whistleSound.setObjectID( getObject()->getID() ) ; m_clicketyClackSound.setObjectID( getObject()->getID() ) ; -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp index c1a4ec13870..edcec017f36 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp @@ -245,7 +245,7 @@ void SupplyTruckAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -266,7 +266,7 @@ void SupplyTruckAIUpdate::xfer( Xfer *xfer ) xfer->xferInt(&m_numberBoxes); xfer->xferBool(&m_forcePending); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -275,7 +275,7 @@ void SupplyTruckAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------- @@ -443,7 +443,7 @@ SupplyTruckStateMachine::~SupplyTruckStateMachine() void SupplyTruckStateMachine::crc( Xfer *xfer ) { StateMachine::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -455,7 +455,7 @@ void SupplyTruckStateMachine::xfer( Xfer *xfer ) xfer->xferVersion( &v, cv ); StateMachine::xfer(xfer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -463,7 +463,7 @@ void SupplyTruckStateMachine::xfer( Xfer *xfer ) void SupplyTruckStateMachine::loadPostProcess( void ) { StateMachine::loadPostProcess(); -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp index c5c4df46048..7c90f32ed7c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp @@ -201,7 +201,7 @@ void TransportAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -217,7 +217,7 @@ void TransportAIUpdate::xfer( Xfer *xfer ) // extend base class AIUpdateInterface::xfer(xfer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -226,4 +226,4 @@ void TransportAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WanderAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WanderAIUpdate.cpp index 3d8fbafdae5..271aefa6aef 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WanderAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WanderAIUpdate.cpp @@ -66,7 +66,7 @@ UpdateSleepTime WanderAIUpdate::update( void ) //return (mine < ret) ? mine : ret; /// @todo srj -- someday, make sleepy. for now, must not sleep. return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -75,7 +75,7 @@ void WanderAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -91,7 +91,7 @@ void WanderAIUpdate::xfer( Xfer *xfer ) // extend base class AIUpdateInterface::xfer(xfer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -100,4 +100,4 @@ void WanderAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp index ddba3bbfc3b..96ebaa8fbb4 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp @@ -288,12 +288,12 @@ UpdateSleepTime WorkerAIUpdate::update( void ) if( invalidTask == TRUE ) cancelTask( currentTask ); - } // end if + } // update dozer behavior m_dozerMachine->updateStateMachine(); - } // end if + } else { m_supplyTruckStateMachine->updateStateMachine(); @@ -360,7 +360,7 @@ Object *WorkerAIUpdate::construct( const ThingTemplate *what, getObject(), NULL ) != LBC_OK ) return NULL; - } // end if + } else { @@ -377,9 +377,9 @@ Object *WorkerAIUpdate::construct( const ThingTemplate *what, getObject(), NULL ) != LBC_OK ) return NULL; - } // end else + } - } // end if + } // what will our initial status bits ObjectStatusMaskType statusBits = MAKE_OBJECT_STATUS_MASK( OBJECT_STATUS_UNDER_CONSTRUCTION ); @@ -403,7 +403,7 @@ Object *WorkerAIUpdate::construct( const ThingTemplate *what, money->withdraw( what->calcCostToBuild( owningPlayer ) ); - } // end if + } // // set a bit that this object is under construction, it is important to do this early @@ -511,20 +511,20 @@ Bool WorkerAIUpdate::canAcceptNewRepair( Object *obj ) DEBUG_CRASH(( "Unable to find bridge tower interface on object" )); return FALSE; - } // end if + } // if they are part of the same bridge, ignore this repair command if( currentTowerInterface->getBridgeID() == newTowerInterface->getBridgeID() ) return FALSE; - } // end if + } - } // end if, currentRepair object exists + } // all is well return TRUE; -} // end canAcceptNewRepair +} //---------------------------------------------------------------------------------------- void WorkerAIUpdate::privateIdle(CommandSourceType cmdSource) @@ -579,7 +579,7 @@ void WorkerAIUpdate::privateRepair( Object *obj, CommandSourceType cmdSource ) // start the new task newTask( DOZER_TASK_REPAIR, obj ); -} // end privateRepair +} // ------------------------------------------------------------------------------------------------ /** Resume construction on a building */ @@ -598,7 +598,7 @@ void WorkerAIUpdate::privateResumeConstruction( Object *obj, CommandSourceType c // start the new task for construction newTask( DOZER_TASK_BUILD, obj ); -} // end privateResumeConstruction +} //------------------------------------------------------------------------------------------------- /** Issue and order to the dozer */ @@ -652,7 +652,7 @@ void WorkerAIUpdate::newTask( DozerTask task, Object* target ) m_dockPoint[ task ][ DOZER_DOCK_POINT_END ].valid = TRUE; m_dockPoint[ task ][ DOZER_DOCK_POINT_END ].location = position; - } // end if, build task + } // set the new task target and the frame in which we got this order m_task[ task ].m_targetObjectID = target->getID(); @@ -806,7 +806,7 @@ void WorkerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) break; // do nothing, this is really no task - } // end invalid + } // -------------------------------------------------------------------------------------------- case DOZER_TASK_BUILD: @@ -825,7 +825,7 @@ void WorkerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) // } break; - } // end build + } // -------------------------------------------------------------------------------------------- case DOZER_TASK_REPAIR: @@ -844,11 +844,11 @@ void WorkerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) if( obj->isKindOf( KINDOF_BRIDGE_TOWER ) ) removeBridgeScaffolding( obj ); - } // end if + } break; - } // end repair + } // -------------------------------------------------------------------------------------------- case DOZER_TASK_FORTIFY: @@ -856,7 +856,7 @@ void WorkerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) break; - } // end fortify + } // -------------------------------------------------------------------------------------------- default: @@ -865,9 +865,9 @@ void WorkerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) DEBUG_CRASH(( "internalTaskCompleteOrCancelled: Unknown Dozer task '%d'", task )); break; - } // end default + } - } // end switch( task ) + } } @@ -885,7 +885,7 @@ void WorkerAIUpdate::onDelete( void ) if( isTaskPending( (DozerTask)i ) ) cancelTask( (DozerTask)i ); - } // end for i + } for( i = 0; i < DOZER_NUM_TASKS; i++ ) { @@ -940,7 +940,7 @@ const Coord3D* WorkerAIUpdate::getDockPoint( DozerTask task, DozerDockPoint poin // no valid point has been set for this dock point on this task return NULL; -} // end getDockPoint +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -980,7 +980,7 @@ void WorkerAIUpdate::aiDoCommand(const AICommandParms* parms) privateRepair(parms->m_obj, parms->m_cmdSource); break; - } // end repair + } // -------------------------------------------------------------------------------------------- case AICMD_RESUME_CONSTRUCTION: @@ -994,7 +994,7 @@ void WorkerAIUpdate::aiDoCommand(const AICommandParms* parms) privateResumeConstruction( parms->m_obj, parms->m_cmdSource ); break; - } // end resume construction + } // -------------------------------------------------------------------------------------------- default: @@ -1012,9 +1012,9 @@ void WorkerAIUpdate::aiDoCommand(const AICommandParms* parms) m_dozerMachine->resetToDefaultState(); break; - } // end default + } - } // end switch + } if (isClearingMines() && m_numberBoxes > 0 ) { @@ -1198,7 +1198,7 @@ WorkerStateMachine::~WorkerStateMachine() void WorkerStateMachine::crc( Xfer *xfer ) { StateMachine::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1210,7 +1210,7 @@ void WorkerStateMachine::xfer( Xfer *xfer ) xfer->xferVersion( &v, cv ); StateMachine::xfer(xfer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1218,7 +1218,7 @@ void WorkerStateMachine::xfer( Xfer *xfer ) void WorkerStateMachine::loadPostProcess( void ) { StateMachine::loadPostProcess(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1344,7 +1344,7 @@ void WorkerAIUpdate::createBridgeScaffolding( Object *bridgeTower ) // tell the bridge to create scaffolding if necessary bbi->createScaffolding(); -} // end createBridgeScaffolding +} // ------------------------------------------------------------------------------------------------ /** Remove the bridge scaffolding from the bridge object that is attached to this tower */ @@ -1370,7 +1370,7 @@ void WorkerAIUpdate::removeBridgeScaffolding( Object *bridgeTower ) // tell the bridge to end any scaffolding from repairing bbi->removeScaffolding(); -} // end removeBridgeScaffolding +} //------------------------------------------------------------------------------------------------ void WorkerAIUpdate::startBuildingSound( const AudioEventRTS *sound, ObjectID constructionSiteID ) @@ -1396,7 +1396,7 @@ void WorkerAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1453,7 +1453,7 @@ void WorkerAIUpdate::xfer( Xfer *xfer ) //-------------------------- xfer Worker info xfer->xferSnapshot(m_workerMachine); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1462,4 +1462,4 @@ void WorkerAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp index 6521600d03e..cd590918e2d 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp @@ -149,7 +149,7 @@ void AssistedTargetingUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -167,7 +167,7 @@ void AssistedTargetingUpdate::xfer( Xfer *xfer ) // extend base class UpdateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -178,4 +178,4 @@ void AssistedTargetingUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AutoDepositUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AutoDepositUpdate.cpp index 36bc384a5b9..52cde1d2214 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AutoDepositUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AutoDepositUpdate.cpp @@ -97,7 +97,7 @@ void parseUpgradePair( INI *ini, void *instance, void *store, const void *userDa std::list * theList = (std::list*)store; theList->push_back(info); -} // end parseFactionObjectCreationList +} //----------------------------------------------------------------------------- // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -192,7 +192,7 @@ void AutoDepositUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -219,7 +219,7 @@ void AutoDepositUpdate::xfer( Xfer *xfer ) xfer->xferBool(&m_initialized); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -230,4 +230,4 @@ void AutoDepositUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AutoFindHealingUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AutoFindHealingUpdate.cpp index 2acdda59d59..7637a09f748 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AutoFindHealingUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AutoFindHealingUpdate.cpp @@ -179,7 +179,7 @@ Object* AutoFindHealingUpdate::scanClosestTarget() closestDistSqr = fDistSqr; continue; } - } // end for, other + } return bestTarget; } @@ -193,7 +193,7 @@ void AutoFindHealingUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -214,7 +214,7 @@ void AutoFindHealingUpdate::xfer( Xfer *xfer ) // next scan frames xfer->xferInt( &m_nextScanFrames ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -225,4 +225,4 @@ void AutoFindHealingUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BaseRenerateUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BaseRenerateUpdate.cpp index 32e91518d5a..881a2114fd6 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BaseRenerateUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BaseRenerateUpdate.cpp @@ -143,7 +143,7 @@ UpdateSleepTime BaseRegenerateUpdate::update( void ) return UPDATE_SLEEP(HEAL_RATE); } -} // end update +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -154,7 +154,7 @@ void BaseRegenerateUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -172,7 +172,7 @@ void BaseRegenerateUpdate::xfer( Xfer *xfer ) // extend base class UpdateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -183,4 +183,4 @@ void BaseRegenerateUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp index 083db83af6b..c30667d7cf8 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp @@ -193,7 +193,7 @@ void BattlePlanUpdate::onDelete() obj = TheGameLogic->findObjectByID( m_visionObjectID ); if( obj ) TheGameLogic->destroyObject( obj ); - } // end if + } // If we get destroyed, then make sure we remove our bonus! // srj sez: we can't do this in the dtor because our team @@ -436,9 +436,9 @@ void BattlePlanUpdate::createVisionObject() // set the shroud clearing range visionObject->setShroudClearingRange( obj->getGeometryInfo().getBoundingSphereRadius() ); - } // end if + } -} // end createVisionObject +} //------------------------------------------------------------------------------------------------- void BattlePlanUpdate::setStatus( TransitionStatus newStatus ) @@ -869,7 +869,7 @@ void BattlePlanUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} //------------------------------------------------------------------------------------------------ // Xfer method @@ -923,7 +923,7 @@ void BattlePlanUpdate::xfer( Xfer *xfer ) // vision object data xfer->xferObjectID( &m_visionObjectID ); -} // end xfer +} //------------------------------------------------------------------------------------------------ void BattlePlanUpdate::loadPostProcess( void ) @@ -932,4 +932,4 @@ void BattlePlanUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BoneFXUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BoneFXUpdate.cpp index bb4370f91f6..26b8344c738 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BoneFXUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BoneFXUpdate.cpp @@ -124,16 +124,16 @@ static void parseFXLocInfo( INI *ini, void *instance, BoneLocInfo *locInfo ) // save bone name and location type locInfo->boneName = ini->getNextToken(); - } // end if + } else { // error throw INI_INVALID_DATA; - } // end else + } -} // end parseFXLocInfo +} //------------------------------------------------------------------------------------------------- /** Parse a random delay. This is a number pair, where the numbers are a min and max time in miliseconds. */ @@ -177,7 +177,7 @@ void BoneFXUpdateModuleData::parseFXList( INI *ini, void *instance, // error throw INI_INVALID_DATA; - } // end if + } ini->parseBool( ini, instance, &info->onlyOnce, NULL); @@ -191,12 +191,12 @@ void BoneFXUpdateModuleData::parseFXList( INI *ini, void *instance, // error throw INI_INVALID_DATA; - } // end if + } // parse the fx list name ini->parseFXList( ini, instance, &info->fx, NULL ); -} // end parseFXList +} //------------------------------------------------------------------------------------------------- /** In the form of: @@ -219,7 +219,7 @@ void BoneFXUpdateModuleData::parseObjectCreationList( INI *ini, void *instance, // error throw INI_INVALID_DATA; - } // end if + } ini->parseBool( ini, instance, &info->onlyOnce, NULL ); @@ -233,12 +233,12 @@ void BoneFXUpdateModuleData::parseObjectCreationList( INI *ini, void *instance, // error throw INI_INVALID_DATA; - } // end if + } // parse the ocl name ini->parseObjectCreationList( ini, instance, &info->ocl, NULL ); -} // end parseObjectCreationList +} //------------------------------------------------------------------------------------------------- /** In the form of: @@ -261,7 +261,7 @@ void BoneFXUpdateModuleData::parseParticleSystem( INI *ini, void *instance, // error throw INI_INVALID_DATA; - } // end if + } ini->parseBool( ini, instance, &info->onlyOnce, NULL ); @@ -275,12 +275,12 @@ void BoneFXUpdateModuleData::parseParticleSystem( INI *ini, void *instance, // error throw INI_INVALID_DATA; - } // end if + } // parse the particle system name ini->parseParticleSystemTemplate( ini, instance, &info->particleSysTemplate, NULL ); -} // end parseParticleSystem +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -556,7 +556,7 @@ void BoneFXUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -588,9 +588,9 @@ void BoneFXUpdate::xfer( Xfer *xfer ) systemID = *it; xfer->xferUser( &systemID, sizeof( ParticleSystemID ) ); - } // end for + } - } // end if, save + } else { @@ -601,7 +601,7 @@ void BoneFXUpdate::xfer( Xfer *xfer ) DEBUG_CRASH(( "BoneFXUpdate::xfer - m_particleSystemIDs should be empty but is not" )); throw SC_INVALID_DATA; - } // end if + } // read all data for( UnsignedShort i = 0; i < particleSystemCount; ++i ) @@ -613,9 +613,9 @@ void BoneFXUpdate::xfer( Xfer *xfer ) // put at end of vector m_particleSystemIDs.push_back( systemID ); - } // end for, i + } - } // end else + } // next fx frame xfer->xferUser( m_nextFXFrame, sizeof( Int ) * BODYDAMAGETYPE_COUNT * BONE_FX_MAX_BONES ); @@ -644,7 +644,7 @@ void BoneFXUpdate::xfer( Xfer *xfer ) // active xfer->xferBool( &m_active ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -655,4 +655,4 @@ void BoneFXUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CheckpointUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CheckpointUpdate.cpp index 6ffc6960d0b..cefbcc97f07 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CheckpointUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CheckpointUpdate.cpp @@ -141,7 +141,7 @@ UpdateSleepTime CheckpointUpdate::update() } } - }// end if change + } GeometryInfo geom = obj->getGeometryInfo(); @@ -164,7 +164,7 @@ UpdateSleepTime CheckpointUpdate::update() obj->setGeometryInfo( geom ); - } // end if draw + } return UPDATE_SLEEP_NONE; @@ -179,7 +179,7 @@ void CheckpointUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -209,7 +209,7 @@ void CheckpointUpdate::xfer( Xfer *xfer ) // enemy scan delay xfer->xferUnsignedInt( &m_enemyScanDelay ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -220,4 +220,4 @@ void CheckpointUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CleanupHazardUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CleanupHazardUpdate.cpp index ac246850eee..9fc92b0a4e7 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CleanupHazardUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CleanupHazardUpdate.cpp @@ -318,7 +318,7 @@ void CleanupHazardUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -357,7 +357,7 @@ void CleanupHazardUpdate::xfer( Xfer *xfer ) // move range xfer->xferReal( &m_moveRange ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -368,4 +368,4 @@ void CleanupHazardUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CommandButtonHuntUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CommandButtonHuntUpdate.cpp index 6988d3da0c0..802d2d7afa2 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CommandButtonHuntUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CommandButtonHuntUpdate.cpp @@ -328,7 +328,7 @@ void CommandButtonHuntUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -376,17 +376,17 @@ void CommandButtonHuntUpdate::xfer( Xfer *xfer ) m_commandButton = button; break; // exit for, i - } // end if + } - } // end for, i + } - } // end if, commandSet + } - } // end if, command button name present + } - } // end if, loading + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -397,4 +397,4 @@ void CommandButtonHuntUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DelayedWeaponSetUpgradeUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DelayedWeaponSetUpgradeUpdate.cpp index a9afdc3e72c..ef5649735ec 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DelayedWeaponSetUpgradeUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DelayedWeaponSetUpgradeUpdate.cpp @@ -53,7 +53,7 @@ void DelayedWeaponSetUpgradeUpdateModuleData::buildFieldParse(MultiIniFieldParse p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -102,7 +102,7 @@ void DelayedWeaponSetUpgradeUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -120,7 +120,7 @@ void DelayedWeaponSetUpgradeUpdate::xfer( Xfer *xfer ) // extend base class UpdateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -131,4 +131,4 @@ void DelayedWeaponSetUpgradeUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DeletionUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DeletionUpdate.cpp index 0f712d92999..36b0699f043 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DeletionUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DeletionUpdate.cpp @@ -115,7 +115,7 @@ void DeletionUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -136,7 +136,7 @@ void DeletionUpdate::xfer( Xfer *xfer ) // die frame xfer->xferUnsignedInt( &m_dieFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -147,4 +147,4 @@ void DeletionUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DemoTrapUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DemoTrapUpdate.cpp index 0ddf32ee2d2..85ddd241bd7 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DemoTrapUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DemoTrapUpdate.cpp @@ -269,7 +269,7 @@ void DemoTrapUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -293,7 +293,7 @@ void DemoTrapUpdate::xfer( Xfer *xfer ) // detonated xfer->xferBool( &m_detonated ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -304,4 +304,4 @@ void DemoTrapUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp index aef9b636d42..82db568c2e1 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp @@ -61,7 +61,7 @@ DockUpdateModuleData::DockUpdateModuleData( void ) p.add(dataFieldParse); -} // end buildFieldParse +} DockUpdate::DockUpdate( Thing *thing, const ModuleData* moduleData ) : UpdateModule( thing, moduleData ) { @@ -540,7 +540,7 @@ void DockUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -616,7 +616,7 @@ void DockUpdate::xfer( Xfer *xfer ) // dock open xfer->xferBool( &m_dockOpen ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -627,5 +627,5 @@ void DockUpdate::loadPostProcess( void ) // call base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/PrisonDockUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/PrisonDockUpdate.cpp index 6a0b690ade2..15091987203 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/PrisonDockUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/PrisonDockUpdate.cpp @@ -45,14 +45,14 @@ PrisonDockUpdate::PrisonDockUpdate( Thing *thing, const ModuleData* moduleData ) : DockUpdate( thing, moduleData ) { -} // end PrisonDockUpdate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ PrisonDockUpdate::~PrisonDockUpdate( void ) { -} // end ~PrisonDockUpdate +} // ------------------------------------------------------------------------------------------------ /** Do the action while docked @@ -84,7 +84,7 @@ Bool PrisonDockUpdate::action( Object *docker, Object *drone ) // end docking return FALSE; -} // end action +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -95,7 +95,7 @@ void PrisonDockUpdate::crc( Xfer *xfer ) // extend base class DockUpdate::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -113,7 +113,7 @@ void PrisonDockUpdate::xfer( Xfer *xfer ) // extend base class DockUpdate::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -124,6 +124,6 @@ void PrisonDockUpdate::loadPostProcess( void ) // extend base class DockUpdate::loadPostProcess(); -} // end loadPostProcess +} #endif diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp index 4dc94c4f581..a447bffb1f7 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp @@ -53,7 +53,7 @@ RailedTransportDockUpdateModuleData::RailedTransportDockUpdateModuleData( void ) m_pullInsideDurationInFrames = 0; m_pushOutsideDurationInFrames = 0; -} // end RailedTransportDockUpdateModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -72,7 +72,7 @@ RailedTransportDockUpdateModuleData::RailedTransportDockUpdateModuleData( void ) p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -90,14 +90,14 @@ RailedTransportDockUpdate::RailedTransportDockUpdate( Thing *thing, const Module m_pushOutsideDistancePerFrame = 0.0f; m_unloadCount = UNLOAD_ALL; -} // end RailedTransportDockUpdate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ RailedTransportDockUpdate::~RailedTransportDockUpdate( void ) { -} // end ~RailedTransportDockUpdate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -116,7 +116,7 @@ UpdateSleepTime RailedTransportDockUpdate::update( void ) doPushOutDocking(); return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** The dock action callback, return FALSE when done docking */ @@ -166,11 +166,11 @@ Bool RailedTransportDockUpdate::action( Object *docker, Object *drone ) angleVector.y = dockPos->y - dockerPos->y; docker->setOrientation( angleVector.toAngle() ); - } // end if + } return TRUE; -} // end action +} // ------------------------------------------------------------------------------------------------ /** Is clear to enter the railed transport */ @@ -191,7 +191,7 @@ Bool RailedTransportDockUpdate::isClearToEnter( Object const *docker ) const return TRUE; -} // end isClearToEnter +} // ------------------------------------------------------------------------------------------------ /** Is anything currently loading or unloading */ @@ -204,7 +204,7 @@ Bool RailedTransportDockUpdate::isLoadingOrUnloading( void ) return FALSE; -} // end isLoadingOrUnloading +} // ------------------------------------------------------------------------------------------------ /** Start the unload process */ @@ -220,7 +220,7 @@ void RailedTransportDockUpdate::unloadAll( void ) m_unloadCount = UNLOAD_ALL; unloadNext(); -} // end manualUnload +} // ------------------------------------------------------------------------------------------------ /** Unload a single individual only */ @@ -232,7 +232,7 @@ void RailedTransportDockUpdate::unloadSingleObject( Object *obj ) m_unloadCount = 1; unloadNext(); -} // end unloadSingleObject +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -318,13 +318,13 @@ void RailedTransportDockUpdate::doPullInDocking( void ) // no object is docking now m_dockingObjectID = INVALID_ID; - } // end if + } - } // end if + } - } // end if + } -} // end doPullInDocking +} // ------------------------------------------------------------------------------------------------ /** If we have an object recorded as being pushed out of us then do that here */ @@ -343,7 +343,7 @@ void RailedTransportDockUpdate::doPushOutDocking( void ) unloadNext(); return; - } // end if + } // pull it if( unloader ) @@ -412,18 +412,18 @@ void RailedTransportDockUpdate::doPushOutDocking( void ) us->convertBonePosToWorldPos( &finalPos, NULL, &finalPos, NULL ); unloaderAI->aiMoveToPosition( &finalPos, CMD_FROM_AI ); - } // end if + } // unload the next object unloadNext(); - } // end if + } - } // end if + } - } // end if, m_unloadingID + } -} // end doPushOutDocking +} // ------------------------------------------------------------------------------------------------ /** Iterate callback for the finding the first contained object */ @@ -439,7 +439,7 @@ static void getFirstContain( Object *obj, void *userData ) // assign this as the first object found *firstContain = obj; -} // end getFirstContain +} // ------------------------------------------------------------------------------------------------ /** Start the next object contained by us as "unloading and coming out" */ @@ -510,9 +510,9 @@ void RailedTransportDockUpdate::unloadNext( void ) if( m_unloadCount != UNLOAD_ALL ) --m_unloadCount; - } // end if + } -} // end unloadNext +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -523,7 +523,7 @@ void RailedTransportDockUpdate::crc( Xfer *xfer ) // extend base class DockUpdate::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -556,7 +556,7 @@ void RailedTransportDockUpdate::xfer( Xfer *xfer ) // unload count xfer->xferInt( &m_unloadCount ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -567,4 +567,4 @@ void RailedTransportDockUpdate::loadPostProcess( void ) // extend base class DockUpdate::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RepairDockUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RepairDockUpdate.cpp index 1e9c5dd9593..1db9c45a30f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RepairDockUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RepairDockUpdate.cpp @@ -42,7 +42,7 @@ RepairDockUpdateModuleData::RepairDockUpdateModuleData( void ) m_framesForFullHeal = 1.0f; // 1 frame, instant heal by default (keeps away from divide by 0's) -} // end RepairDockUpdateModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -59,7 +59,7 @@ RepairDockUpdateModuleData::RepairDockUpdateModuleData( void ) p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -74,14 +74,14 @@ RepairDockUpdate::RepairDockUpdate( Thing *thing, const ModuleData* moduleData ) m_lastRepair = INVALID_ID; m_healthToAddPerFrame = 0.0f; -} // end RepairDockUpdate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ RepairDockUpdate::~RepairDockUpdate( void ) { -} // end ~RepairDockUpdate +} // ------------------------------------------------------------------------------------------------ /** Do the action while docked @@ -120,7 +120,7 @@ Bool RepairDockUpdate::action( Object *docker, Object *drone ) // m_healthToAddPerFrame = (body->getMaxHealth() - body->getHealth()) / modData->m_framesForFullHeal; - } // end if + } // if we're at max health we're done if( body->getHealth() >= body->getMaxHealth() ) @@ -132,7 +132,7 @@ Bool RepairDockUpdate::action( Object *docker, Object *drone ) // returning false will complete the docking process return FALSE; - } // end if + } // give us some health buddy DamageInfo healingInfo; @@ -151,7 +151,7 @@ Bool RepairDockUpdate::action( Object *docker, Object *drone ) // stay docked return TRUE; -} // end action +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -162,7 +162,7 @@ void RepairDockUpdate::crc( Xfer *xfer ) // extend base class DockUpdate::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -186,7 +186,7 @@ void RepairDockUpdate::xfer( Xfer *xfer ) // health to add per frame xfer->xferReal( &m_healthToAddPerFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -197,4 +197,4 @@ void RepairDockUpdate::loadPostProcess( void ) // extend base class DockUpdate::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyCenterDockUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyCenterDockUpdate.cpp index fb9531381f3..d0aaea154b3 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyCenterDockUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyCenterDockUpdate.cpp @@ -57,7 +57,7 @@ SupplyCenterDockUpdateModuleData::SupplyCenterDockUpdateModuleData( void ) p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -143,7 +143,7 @@ void SupplyCenterDockUpdate::crc( Xfer *xfer ) // extend base class DockUpdate::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -161,7 +161,7 @@ void SupplyCenterDockUpdate::xfer( Xfer *xfer ) // extend base class DockUpdate::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -172,4 +172,4 @@ void SupplyCenterDockUpdate::loadPostProcess( void ) // extend base class DockUpdate::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyWarehouseDockUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyWarehouseDockUpdate.cpp index a4b85e5791c..0cb9632cd36 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyWarehouseDockUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyWarehouseDockUpdate.cpp @@ -62,7 +62,7 @@ SupplyWarehouseDockUpdateModuleData::SupplyWarehouseDockUpdateModuleData( void ) p.add(dataFieldParse); -} // end buildFieldParse +} // ------------------------------------------------------------------------------------------------ @@ -187,7 +187,7 @@ void SupplyWarehouseDockUpdate::crc( Xfer *xfer ) // extend base class DockUpdate::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -208,7 +208,7 @@ void SupplyWarehouseDockUpdate::xfer( Xfer *xfer ) // boxes stored xfer->xferInt( &m_boxesStored ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -226,4 +226,4 @@ void SupplyWarehouseDockUpdate::loadPostProcess( void ) if( draw ) draw->updateDrawableSupplyStatus( modData->m_startingBoxesData, m_boxesStored ); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DynamicGeometryInfoUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DynamicGeometryInfoUpdate.cpp index e83603fd1a1..5cd2ab5f4c0 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DynamicGeometryInfoUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DynamicGeometryInfoUpdate.cpp @@ -129,7 +129,7 @@ UpdateSleepTime DynamicGeometryInfoUpdate::update( void ) m_started = TRUE; - } // end if + } // Either we've been running, or we just started right now. Doesn't matter. const DynamicGeometryInfoUpdateModuleData *data = getDynamicGeometryInfoUpdateModuleData(); @@ -171,16 +171,16 @@ UpdateSleepTime DynamicGeometryInfoUpdate::update( void ) m_finalMajorRadius = data->m_initialMajorRadius; m_finalMinorRadius = data->m_initialMinorRadius; - } // end if + } else { // no switch needed ... we're all done m_finished = TRUE; - } // end else + } - } // end if, time active is longer than transition time + } return UPDATE_SLEEP_NONE; } @@ -194,7 +194,7 @@ void DynamicGeometryInfoUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -251,7 +251,7 @@ void DynamicGeometryInfoUpdate::xfer( Xfer *xfer ) // final minor radius xfer->xferReal( &m_finalMinorRadius ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -262,4 +262,4 @@ void DynamicGeometryInfoUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp index 3f7509f2628..0253517006a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp @@ -337,7 +337,7 @@ void DynamicShroudClearingRangeUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -378,7 +378,7 @@ void DynamicShroudClearingRangeUpdate::xfer( Xfer *xfer ) xfer->xferReal( &m_nativeClearingRange ); xfer->xferReal( &m_currentClearingRange ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -389,4 +389,4 @@ void DynamicShroudClearingRangeUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp index cea29f918a9..3bfdc41b174 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp @@ -276,7 +276,7 @@ void EMPUpdate::doDisableAttack( void ) void EMPUpdate::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -291,7 +291,7 @@ void EMPUpdate::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -299,4 +299,4 @@ void EMPUpdate::xfer( Xfer *xfer ) void EMPUpdate::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/EnemyNearUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/EnemyNearUpdate.cpp index 7ad86ed8cfe..51fd64d4c22 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/EnemyNearUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/EnemyNearUpdate.cpp @@ -115,7 +115,7 @@ void EnemyNearUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -139,7 +139,7 @@ void EnemyNearUpdate::xfer( Xfer *xfer ) // enemy near xfer->xferBool( &m_enemyNear ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -150,4 +150,4 @@ void EnemyNearUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp index 72f3f6c2249..6466809cf00 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp @@ -214,7 +214,7 @@ void FireOCLAfterWeaponCooldownUpdate::crc( Xfer *xfer ) // extend base class UpgradeMux::upgradeMuxCRC( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -244,7 +244,7 @@ void FireOCLAfterWeaponCooldownUpdate::xfer( Xfer *xfer ) // start frame xfer->xferUnsignedInt( &m_startFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -258,4 +258,4 @@ void FireOCLAfterWeaponCooldownUpdate::loadPostProcess( void ) // extend base class UpgradeMux::upgradeMuxLoadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireSpreadUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireSpreadUpdate.cpp index ac2c4cd86c4..156fb7eda15 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireSpreadUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireSpreadUpdate.cpp @@ -188,7 +188,7 @@ void FireSpreadUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -206,7 +206,7 @@ void FireSpreadUpdate::xfer( Xfer *xfer ) // extend base class UpdateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -217,4 +217,4 @@ void FireSpreadUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp index d4461349cc7..968bb8863de 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp @@ -110,7 +110,7 @@ void FireWeaponUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -131,7 +131,7 @@ void FireWeaponUpdate::xfer( Xfer *xfer ) // weapon xfer->xferSnapshot( m_weapon ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -142,4 +142,4 @@ void FireWeaponUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FirestormDynamicGeometryInfoUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FirestormDynamicGeometryInfoUpdate.cpp index 104fe186b57..037c7a2aa42 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FirestormDynamicGeometryInfoUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FirestormDynamicGeometryInfoUpdate.cpp @@ -154,9 +154,9 @@ UpdateSleepTime FirestormDynamicGeometryInfoUpdate::update( void ) sys->setPosition( &pos ); m_myParticleSystemID[ i ] = sys->getSystemID(); - } // end if + } - } // end for i + } // do the FX list FXList::doFXObj( modData->m_fxList, getObject() ); @@ -186,18 +186,18 @@ UpdateSleepTime FirestormDynamicGeometryInfoUpdate::update( void ) else if( type == ParticleSystemInfo::EmissionVolumeType::CYLINDER ) sys->setEmissionVolumeCylinderRadius( getObject()->getGeometryInfo().getMajorRadius() ); - } // end if + } else { // this system not found (it probably died)... stop trying to find it in the future m_myParticleSystemID[ i ] = INVALID_PARTICLE_SYSTEM_ID; - } // end else + } - } // end if + } - } // end for, i + } // when we first start running backward ... make a scorch mark if( m_switchedDirections == TRUE && m_scorchPlaced == FALSE ) @@ -206,7 +206,7 @@ UpdateSleepTime FirestormDynamicGeometryInfoUpdate::update( void ) TheGameClient->addScorch( getObject()->getPosition(), modData->m_scorchSize, SCORCH_1 ); m_scorchPlaced = TRUE; - } // end if + } // scan and do some damage every once in a while if( TheGameLogic->getFrame() - m_lastDamageFrame >= modData->m_delayBetweenDamageFrames ) @@ -215,7 +215,7 @@ UpdateSleepTime FirestormDynamicGeometryInfoUpdate::update( void ) doDamageScan(); m_lastDamageFrame = TheGameLogic->getFrame(); - } // end if + } return UPDATE_SLEEP_NONE; } @@ -260,11 +260,11 @@ void FirestormDynamicGeometryInfoUpdate::doDamageScan( void ) // do damage other->attemptDamage( &damageInfo ); - } // end for, other + } - } // end if, an boundingCircle radius exists + } -} // end doDamageScan +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -275,7 +275,7 @@ void FirestormDynamicGeometryInfoUpdate::crc( Xfer *xfer ) // extend base class DynamicGeometryInfoUpdate::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -305,7 +305,7 @@ void FirestormDynamicGeometryInfoUpdate::xfer( Xfer *xfer ) // last damage frame xfer->xferUnsignedInt( &m_lastDamageFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -316,4 +316,4 @@ void FirestormDynamicGeometryInfoUpdate::loadPostProcess( void ) // extend base class DynamicGeometryInfoUpdate::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp index 06ad8318be3..95888864883 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp @@ -276,7 +276,7 @@ void FlammableUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -312,7 +312,7 @@ void FlammableUpdate::xfer( Xfer *xfer ) // last flame damage dealt xfer->xferUnsignedInt( &m_lastFlameDamageDealt ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -323,4 +323,4 @@ void FlammableUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FloatUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FloatUpdate.cpp index d5ea632f23f..69540f81b00 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FloatUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FloatUpdate.cpp @@ -49,7 +49,7 @@ FloatUpdateModuleData::FloatUpdateModuleData( void ) m_enabled = FALSE; -} // end FloatUpdateModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -65,7 +65,7 @@ FloatUpdateModuleData::FloatUpdateModuleData( void ) }; p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -80,14 +80,14 @@ FloatUpdate::FloatUpdate( Thing *thing, const ModuleData *moduleData ) // save our initial enabled status based on INI settings m_enabled = ((FloatUpdateModuleData *)moduleData)->m_enabled; -} // end FloatUpdate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ FloatUpdate::~FloatUpdate( void ) { -} // end ~FloatUpdate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -134,7 +134,7 @@ UpdateSleepTime FloatUpdate::update( void ) } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -145,7 +145,7 @@ void FloatUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -166,7 +166,7 @@ void FloatUpdate::xfer( Xfer *xfer ) // enabled xfer->xferBool( &m_enabled ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -177,4 +177,4 @@ void FloatUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HeightDieUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HeightDieUpdate.cpp index 733a3b4ef23..2e84b621943 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HeightDieUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HeightDieUpdate.cpp @@ -55,7 +55,7 @@ HeightDieUpdateModuleData::HeightDieUpdateModuleData( void ) m_snapToGroundOnDeath = FALSE; m_initialDelay = 0; -} // end HeightDieUpdateModuleData +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -78,7 +78,7 @@ void HeightDieUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -97,14 +97,14 @@ HeightDieUpdate::HeightDieUpdate( Thing *thing, const ModuleData* moduleData ) m_earliestDeathFrame = UINT_MAX; // m_lastPosition = *thing->getPosition(); -} // end HeightDieUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- HeightDieUpdate::~HeightDieUpdate( void ) { -} // end ~HeightDieUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -128,7 +128,7 @@ UpdateSleepTime HeightDieUpdate::update( void ) // get outta here return UPDATE_SLEEP_NONE; - } // end if + } // get the module data const HeightDieUpdateModuleData *modData = getHeightDieUpdateModuleData(); @@ -146,7 +146,7 @@ UpdateSleepTime HeightDieUpdate::update( void ) if( pos->z >= m_lastPosition.z ) directionOK = FALSE; - } // end fi + } // get the terrain height Real terrainHeightAtPos = TheTerrainLogic->getGroundHeight( pos->x, pos->y ); @@ -203,7 +203,7 @@ UpdateSleepTime HeightDieUpdate::update( void ) if( thisHeight > tallestHeight ) tallestHeight = thisHeight; - } // end for obj + } // // our target height is either the height above the terrain as specified by the INI @@ -213,7 +213,7 @@ UpdateSleepTime HeightDieUpdate::update( void ) if( tallestHeight > modData->m_targetHeightAboveTerrain ) targetHeight = tallestHeight + terrainHeightAtPos; - } // end if + } // if we are below the target height ... DIE! if( pos->z < targetHeight && directionOK ) @@ -238,9 +238,9 @@ UpdateSleepTime HeightDieUpdate::update( void ) // we have died ... don't do this again m_hasDied = TRUE; - } // end if + } - } // end if + } // // if our height is below the destroy attached particles height above the terrain, clean @@ -255,14 +255,14 @@ UpdateSleepTime HeightDieUpdate::update( void ) // don't do this again m_particlesDestroyed = TRUE; - } // end if + } // save our current position as the last position we monitored m_lastPosition = *pos; return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -273,7 +273,7 @@ void HeightDieUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -307,7 +307,7 @@ void HeightDieUpdate::xfer( Xfer *xfer ) else m_earliestDeathFrame = 0; -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -318,4 +318,4 @@ void HeightDieUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp index b21fe9eba8c..bc3ef7adc4d 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp @@ -94,7 +94,7 @@ HelicopterSlowDeathBehaviorModuleData::HelicopterSlowDeathBehaviorModuleData( vo m_delayFromGroundToFinalDeath = 0; m_maxBraking = 99999.0f; -} // end HelicopterSlowDeathBehaviorModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -137,7 +137,7 @@ HelicopterSlowDeathBehaviorModuleData::HelicopterSlowDeathBehaviorModuleData( vo p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// // Helicopter slow death update /////////////////////////////////////////////////////////////////// @@ -165,14 +165,14 @@ HelicopterSlowDeathBehavior::HelicopterSlowDeathBehavior( Thing *thing, const Mo m_bladeFlyOffFrame = 0; m_hitGroundFrame = 0; -} // end HelicopterSlowDeathBehavior +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- HelicopterSlowDeathBehavior::~HelicopterSlowDeathBehavior( void ) { -} // end ~HelicopterSlowDeathBehavior +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -250,27 +250,27 @@ void HelicopterSlowDeathBehavior::beginSlowDeath( const DamageInfo *damageInfo ) if( draw->getPristineBonePositions( modData->m_attachParticleBone.str(), 0, &pos, NULL, 1 ) ) pSys->setPosition( &pos ); - } // end if + } - } // end if + } else { // use location coord specified ... it will be zero if not given which is center of obj anyway pSys->setPosition( &modData->m_attachParticleLoc ); - } // end else + } // attach the particle system to the object pSys->attachToObject( getObject() ); - } // end if + } - } // end if + } -} // end beginSlowDeath +} @@ -328,9 +328,9 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) m_selfSpin = modData->m_maxSelfSpin; // cap at max m_selfSpinTowardsMax = FALSE; // now start changing spin towards min again - } // end if + } - } // end if + } else { @@ -342,14 +342,14 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) m_selfSpin = modData->m_minSelfSpin; // cap at min m_selfSpinTowardsMax = TRUE; // now start chaning spin towards max again - } // end if + } - } // end else + } // we have made a change to the self spinning m_lastSelfSpinUpdateFrame = TheGameLogic->getFrame(); - } // end if + } // get the physics update module PhysicsBehavior *physics = copter->getPhysics(); @@ -390,7 +390,7 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) draw->getPristineBonePositions( modData->m_bladeBone.str(), 0, &bladePos, NULL, 1 ); draw->convertBonePosToWorldPos( &bladePos, NULL, &bladePos, NULL ); - } // end if + } // create the blades flying through the air // const ObjectCreationList *ocl = TheObjectCreationListStore->findObjectCreationList( "OCL_ComancheBlades" ); @@ -408,11 +408,11 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) if( modData->m_oclEjectPilot && copter->getVeterancyLevel() > LEVEL_REGULAR ) EjectPilotDie::ejectPilot( modData->m_oclEjectPilot, copter, NULL ); - } // end if + } - } // endif + } - } // end if, not on ground + } @@ -465,7 +465,7 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) // Stop the sound from playing. TheAudio->removeAudioEvent(m_deathSound.getPlayingHandle()); - } // end if + } } // if we're on the ground, see if it's time for our final boom @@ -485,16 +485,16 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) rubble->setTransformMatrix( copter->getTransformMatrix() ); - } // end if + } // destroy the copter finally TheGameLogic->destroyObject( copter ); - } // end if + } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -505,7 +505,7 @@ void HelicopterSlowDeathBehavior::crc( Xfer *xfer ) // extend base class SlowDeathBehavior::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -547,7 +547,7 @@ void HelicopterSlowDeathBehavior::xfer( Xfer *xfer ) // hit ground frame xfer->xferUnsignedInt( &m_hitGroundFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -558,4 +558,4 @@ void HelicopterSlowDeathBehavior::loadPostProcess( void ) // extend base class SlowDeathBehavior::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp index f719866720f..0941481e8b6 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp @@ -146,14 +146,14 @@ UpdateSleepTime HijackerUpdate::update( void ) } - }// end if (! hostVehicleHasEjection) + } setTargetObject( NULL ); setIsInVehicle( FALSE ); setUpdate( FALSE ); m_wasTargetAirborne = false; - }// end if( target ) + } } else // not in vehicle @@ -210,7 +210,7 @@ void HijackerUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -243,7 +243,7 @@ void HijackerUpdate::xfer( Xfer *xfer ) // was target airborne xfer->xferBool( &m_wasTargetAirborne ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -258,4 +258,4 @@ void HijackerUpdate::loadPostProcess( void ) Object *obj = TheGameLogic->findObjectByID( m_targetID ); setTargetObject( obj ); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp index 8dbfb2aa7ba..38b5fe8475a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp @@ -204,7 +204,7 @@ void HordeUpdate::joinOrLeaveHorde(SimpleObjectIterator *iter, Bool join) else DEBUG_CRASH(( "HordeUpdate::joinOrLeaveHorde - We (%s) must have an AI to benefit from horde", getObject()->getTemplate()->getName().str() )); - } // end if + } } break; @@ -379,7 +379,7 @@ void HordeUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -403,7 +403,7 @@ void HordeUpdate::xfer( Xfer *xfer ) // has flag xfer->xferBool( &m_hasFlag ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -414,4 +414,4 @@ void HordeUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp index ef35f4c2815..ddfa4917ebb 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp @@ -354,7 +354,7 @@ void LaserUpdate::crc( Xfer *xfer ) // extend base class ClientUpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -389,7 +389,7 @@ void LaserUpdate::xfer( Xfer *xfer ) m_laserRadius.xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -400,4 +400,4 @@ void LaserUpdate::loadPostProcess( void ) // extend base class ClientUpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/LifetimeUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/LifetimeUpdate.cpp index db8bb5e63f5..e54d8498d7f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/LifetimeUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/LifetimeUpdate.cpp @@ -101,7 +101,7 @@ void LifetimeUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -122,7 +122,7 @@ void LifetimeUpdate::xfer( Xfer *xfer ) // die frame xfer->xferUnsignedInt( &m_dieFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -133,4 +133,4 @@ void LifetimeUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp index 780f1765eaa..e3eb7351efa 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp @@ -279,7 +279,7 @@ void MissileLauncherBuildingUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -309,7 +309,7 @@ void MissileLauncherBuildingUpdate::xfer( Xfer *xfer ) // timeout frame xfer->xferUnsignedInt( &m_timeoutFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -320,4 +320,4 @@ void MissileLauncherBuildingUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/MobMemberSlavedUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/MobMemberSlavedUpdate.cpp index 6580ab592d8..28aff35234f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/MobMemberSlavedUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/MobMemberSlavedUpdate.cpp @@ -410,7 +410,7 @@ void MobMemberSlavedUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -452,7 +452,7 @@ void MobMemberSlavedUpdate::xfer( Xfer *xfer ) // catch up crisis timer xfer->xferUnsignedInt( &m_catchUpCrisisTimer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -463,4 +463,4 @@ void MobMemberSlavedUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cpp index d4b46e50174..debced09ec6 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cpp @@ -67,11 +67,11 @@ NeutronMissileSlowDeathBehaviorModuleData::NeutronMissileSlowDeathBehaviorModule m_blastInfo[ i ].toppleSpeed = 0.0f; m_blastInfo[ i ].pushForceMag = 0.0f; - } // end for i + } m_scorchSize = 0.0f; m_fxList = NULL; -} // end NeutronMissileSlowDeathBehaviorModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -180,7 +180,7 @@ NeutronMissileSlowDeathBehaviorModuleData::NeutronMissileSlowDeathBehaviorModule p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -201,16 +201,16 @@ NeutronMissileSlowDeathBehavior::NeutronMissileSlowDeathBehavior( Thing *thing, m_completedBlasts[ i ] = FALSE; m_completedScorchBlasts[ i ] = FALSE; - } // end for i + } -} // end NeutronMissileSlowDeathBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ NeutronMissileSlowDeathBehavior::~NeutronMissileSlowDeathBehavior( void ) { -} // end ~NeutronMissileSlowDeathBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -245,7 +245,7 @@ UpdateSleepTime NeutronMissileSlowDeathBehavior::update( void ) m_activationFrame = currFrame; FXList::doFXPos( modData->m_fxList, &pos ); - } // end if + } // see if it's time for any explosions for( Int i = 0; i < MAX_NEUTRON_BLASTS; i++ ) @@ -266,7 +266,7 @@ UpdateSleepTime NeutronMissileSlowDeathBehavior::update( void ) // mark this blast as complete now m_completedBlasts[ i ] = TRUE; - } // end if + } // has the time for a scorch blast come if( m_completedScorchBlasts[ i ] == FALSE && @@ -279,13 +279,13 @@ UpdateSleepTime NeutronMissileSlowDeathBehavior::update( void ) // mark this scorch blast as complete now m_completedScorchBlasts[ i ] = TRUE; - } // end if + } - } // end for i + } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** Do a single blast for the bomb */ @@ -356,7 +356,7 @@ void NeutronMissileSlowDeathBehavior::doBlast( const BlastInfo *blastInfo ) if( damageInfo.in.m_amount < blastInfo->minDamage ) damageInfo.in.m_amount = blastInfo->minDamage; - } // end else + } // do actual damage if( damageInfo.in.m_amount ) @@ -372,9 +372,9 @@ void NeutronMissileSlowDeathBehavior::doBlast( const BlastInfo *blastInfo ) TheGameClient->addScorch( missilePos, modData->m_scorchSize, SCORCH_1 ); m_scorchPlaced = TRUE; - } // end if + } - } // end if + } /* // apply a small force to the object from the shockwave center @@ -397,14 +397,14 @@ void NeutronMissileSlowDeathBehavior::doBlast( const BlastInfo *blastInfo ) // apply the force physics->applyForce( &physicsForce ); - } // end if, physics + } */ - } // end for, other + } - } // end if, an outer radius exists + } -} // end doBlast +} // ------------------------------------------------------------------------------------------------ /** Do a scorch blast event ... this doesn't do actual damage, but it "scorches" things */ @@ -453,13 +453,13 @@ void NeutronMissileSlowDeathBehavior::doScorchBlast( const BlastInfo *blastInfo if( draw ) draw->setShadowsEnabled( FALSE ); - } // end if + } - } // end for, other + } - } // end if, outer radius exists + } -} // end doScorchBlast +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -470,7 +470,7 @@ void NeutronMissileSlowDeathBehavior::crc( Xfer *xfer ) // extend base class SlowDeathBehavior::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -500,7 +500,7 @@ void NeutronMissileSlowDeathBehavior::xfer( Xfer *xfer ) DEBUG_CRASH(( "NeutronMissileSlowDeathBehavior::xfer - Size of MAX_NEUTRON_BLASTS has changed, you must version this xfer code and then you can remove this error message" )); throw SC_INVALID_DATA; - } // end if + } // completed blasts UnsignedByte i; @@ -514,7 +514,7 @@ void NeutronMissileSlowDeathBehavior::xfer( Xfer *xfer ) // scorch placed xfer->xferBool( &m_scorchPlaced ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -525,4 +525,4 @@ void NeutronMissileSlowDeathBehavior::loadPostProcess( void ) // extend base class SlowDeathBehavior::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileUpdate.cpp index 9b7a690aa58..438e5c936f7 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileUpdate.cpp @@ -538,7 +538,7 @@ void NeutronMissileUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -622,13 +622,13 @@ void NeutronMissileUpdate::xfer( Xfer *xfer ) DEBUG_CRASH(( "NeutronMissileUpdate::xfer - Unable to find particle system '%s'", name.str() )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } - } // end if + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -639,4 +639,4 @@ void NeutronMissileUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp index 8f442d0f329..ae5549043f2 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp @@ -167,7 +167,7 @@ void OCLUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -191,7 +191,7 @@ void OCLUpdate::xfer( Xfer *xfer ) // timer stated frame xfer->xferUnsignedInt( &m_timerStartedFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -202,4 +202,4 @@ void OCLUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp index c9aac33c1ba..88b67ce4e50 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp @@ -1305,7 +1305,7 @@ void ParticleUplinkCannonUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1427,7 +1427,7 @@ void ParticleUplinkCannonUpdate::xfer( Xfer *xfer ) m_orbitToTargetLaserRadius.xfer( xfer ); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1461,4 +1461,4 @@ void ParticleUplinkCannonUpdate::loadPostProcess( void ) } #endif -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp index 6f27f4f95a9..40bed738e11 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp @@ -690,7 +690,7 @@ UpdateSleepTime PhysicsBehavior::update() obj->setTransformMatrix(&mtx); - } // if not held + } // reset the acceleration for accumulation next frame m_accel.zero(); @@ -1635,7 +1635,7 @@ Bool PhysicsBehavior::checkForOverlapCollision(Object *other) crusheeOther->attemptDamage( &damageInfo ); } - } // if crushable + } return true; } @@ -1649,7 +1649,7 @@ void PhysicsBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1729,7 +1729,7 @@ void PhysicsBehavior::xfer( Xfer *xfer ) // mag of current vel xfer->xferReal( &m_velMag ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1740,4 +1740,4 @@ void PhysicsBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PilotFindVehicleUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PilotFindVehicleUpdate.cpp index 6981cfaffc5..e82f830db91 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PilotFindVehicleUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PilotFindVehicleUpdate.cpp @@ -190,7 +190,7 @@ void PilotFindVehicleUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -211,7 +211,7 @@ void PilotFindVehicleUpdate::xfer( Xfer *xfer ) // did move to base xfer->xferBool( &m_didMoveToBase ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -222,4 +222,4 @@ void PilotFindVehicleUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp index f1ac68e8d99..f8ed7a44af1 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp @@ -323,7 +323,7 @@ Object* PointDefenseLaserUpdate::scanClosestTarget() bestTargetOutOfRange[index] = other; } } - } // end for, other + } if( bestTargetInRange[ 0 ] ) { @@ -372,7 +372,7 @@ void PointDefenseLaserUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -402,7 +402,7 @@ void PointDefenseLaserUpdate::xfer( Xfer *xfer ) // next shot available in frames xfer->xferInt( &m_nextShotAvailableInFrames ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -413,4 +413,4 @@ void PointDefenseLaserUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PowerPlantUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PowerPlantUpdate.cpp index 49e5a0acfcd..9df941b9762 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PowerPlantUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PowerPlantUpdate.cpp @@ -46,7 +46,7 @@ PowerPlantUpdateModuleData::PowerPlantUpdateModuleData( void ) m_rodsExtendTime = 0; -} // end PowerPlantUpdateModuleData +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -61,14 +61,14 @@ PowerPlantUpdate::PowerPlantUpdate( Thing *thing, const ModuleData *moduleData ) m_extended = FALSE; setWakeFrame(getObject(), UPDATE_SLEEP_FOREVER); -} // end PowerPlantUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- PowerPlantUpdate::~PowerPlantUpdate( void ) { -} // end PowerPlantUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -101,7 +101,7 @@ void PowerPlantUpdate::extendRods( Bool extend ) setWakeFrame(getObject(), UPDATE_SLEEP_FOREVER); } -} // end PowerPlantUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -115,7 +115,7 @@ UpdateSleepTime PowerPlantUpdate::update( void ) m_extended = TRUE; return UPDATE_SLEEP_FOREVER; -} // end update +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -126,7 +126,7 @@ void PowerPlantUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -147,7 +147,7 @@ void PowerPlantUpdate::xfer( Xfer *xfer ) // extend complete xfer->xferBool( &m_extended ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -158,4 +158,4 @@ void PowerPlantUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/DefaultProductionExitUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/DefaultProductionExitUpdate.cpp index c91a2bc10ad..7bd4d9a6fe2 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/DefaultProductionExitUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/DefaultProductionExitUpdate.cpp @@ -186,7 +186,7 @@ void DefaultProductionExitUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -210,7 +210,7 @@ void DefaultProductionExitUpdate::xfer( Xfer *xfer ) // rally point exists xfer->xferBool( &m_rallyPointExists ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -221,4 +221,4 @@ void DefaultProductionExitUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp index 55d7cc0000c..c48ea65c58f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp @@ -306,7 +306,7 @@ void QueueProductionExitUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -339,7 +339,7 @@ void QueueProductionExitUpdate::xfer( Xfer *xfer ) // current burst count xfer->xferUnsignedInt( &m_currentBurstCount ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -350,4 +350,4 @@ void QueueProductionExitUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SpawnPointProductionExitUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SpawnPointProductionExitUpdate.cpp index 62558c2a389..581203d7805 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SpawnPointProductionExitUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SpawnPointProductionExitUpdate.cpp @@ -197,7 +197,7 @@ void SpawnPointProductionExitUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -227,7 +227,7 @@ void SpawnPointProductionExitUpdate::xfer( Xfer *xfer ) // spawn point occupants xfer->xferUser( &m_spawnPointOccupier, sizeof( ObjectID ) * MAX_SPAWN_POINTS ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -238,4 +238,4 @@ void SpawnPointProductionExitUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SupplyCenterProductionExitUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SupplyCenterProductionExitUpdate.cpp index f57b6beb7b7..22fe0dcfd41 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SupplyCenterProductionExitUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SupplyCenterProductionExitUpdate.cpp @@ -195,7 +195,7 @@ void SupplyCenterProductionExitUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -219,7 +219,7 @@ void SupplyCenterProductionExitUpdate::xfer( Xfer *xfer ) // rally point exists xfer->xferBool( &m_rallyPointExists ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -230,4 +230,4 @@ void SupplyCenterProductionExitUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp index 838ca25c65e..e35b8b1b255 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp @@ -163,14 +163,14 @@ ProductionEntry::ProductionEntry( void ) m_productionQuantityProduced = 0; m_productionQuantityTotal = 0; // -} // end ProductionEntry +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- ProductionEntry::~ProductionEntry( void ) { -} // end ~ProductionEntry +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -198,7 +198,7 @@ ProductionUpdate::ProductionUpdate( Thing *thing, const ModuleData* moduleData ) m_setFlags.clear(); m_flagsDirty = FALSE; -} // end ProductionUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -215,9 +215,9 @@ ProductionUpdate::~ProductionUpdate( void ) // TheSuperHackers @fix Mauller 13/04/2025 Delete instance of production item deleteInstance(production); - } // end while + } -} // end ~ProductionUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -320,7 +320,7 @@ Bool ProductionUpdate::queueUpgrade( const UpgradeTemplate *upgrade ) return TRUE; // queued -} // end queueUpgrade +} //------------------------------------------------------------------------------------------------- /** Cancel an upgrade being produced here */ @@ -351,7 +351,7 @@ void ProductionUpdate::cancelUpgrade( const UpgradeTemplate *upgrade ) production->m_upgradeToResearch == upgrade ) break; - } // end for + } // sanity, entry not found if( production == NULL ) @@ -374,7 +374,7 @@ void ProductionUpdate::cancelUpgrade( const UpgradeTemplate *upgrade ) if( upgrade->getUpgradeType() == UPGRADE_TYPE_PLAYER ) player->removeUpgrade( upgrade ); -} // end cancelUpgrade +} //------------------------------------------------------------------------------------------------- /** Queue the prodcution of a unit. Returns TRUE if unit was added to queue, FALSE if it @@ -455,7 +455,7 @@ Bool ProductionUpdate::queueCreateUnit( const ThingTemplate *unitType, Productio return TRUE; // unit queued -} // end queueMakeUnit +} //------------------------------------------------------------------------------------------------- /** Cancel the construction of the unit with the matching production ID */ @@ -485,11 +485,11 @@ void ProductionUpdate::cancelUnitCreate( ProductionID productionID ) return; - } // end if + } - } // end for + } -} // end cancelUnitCreate +} //------------------------------------------------------------------------------------------------- /** Cancel all production of type unitType */ @@ -514,18 +514,18 @@ void ProductionUpdate::cancelAllUnitsOfType( const ThingTemplate *unitType) // advance production = temp; - } // end if + } else { // advance production = production->m_next; - } // end else + } - } // end for + } -} // end cancelAllUnitsOfType +} //------------------------------------------------------------------------------------------------- /** Update the door behavior */ @@ -559,9 +559,9 @@ void ProductionUpdate::updateDoors() m_setFlags.set( theWaitingOpenFlags[i] ); m_flagsDirty = TRUE; - } // end if + } - } // end if + } else if( m_doors[i].m_doorWaitOpenFrame ) { @@ -579,9 +579,9 @@ void ProductionUpdate::updateDoors() m_setFlags.set( theClosingFlags[i] ); m_flagsDirty = TRUE; - } // end if + } - } // end if + } else if( m_doors[i].m_doorClosedFrame && !m_doors[i].m_holdOpen ) { @@ -596,9 +596,9 @@ void ProductionUpdate::updateDoors() m_setFlags.set( theClosingFlags[i], false ); m_flagsDirty = TRUE; - } // end if + } - } // end else if + } } } @@ -634,9 +634,9 @@ UpdateSleepTime ProductionUpdate::update( void ) m_setFlags.set( MODELCONDITION_CONSTRUCTION_COMPLETE, false ); m_flagsDirty = TRUE; - } // end if + } - } // end if + } // if we have dirty bits that need to be set and cleared, do it here all at once if( m_flagsDirty == TRUE ) @@ -651,7 +651,7 @@ UpdateSleepTime ProductionUpdate::update( void ) m_setFlags.clear(); m_flagsDirty = FALSE; - } // end if + } // if nothing in the queue get outta here if( production == NULL ) @@ -682,7 +682,7 @@ UpdateSleepTime ProductionUpdate::update( void ) return UPDATE_SLEEP_NONE; - } // end if + } // // you can disallow types of units on the fly in scripts, so if there is something @@ -699,9 +699,9 @@ UpdateSleepTime ProductionUpdate::update( void ) cancelUnitCreate(production->getProductionID()); return UPDATE_SLEEP_NONE; - } // end if + } - } // end if + } // increase the frames we've been under production for production->m_framesUnderConstruction++; @@ -771,14 +771,14 @@ UpdateSleepTime ProductionUpdate::update( void ) m_setFlags.set( theOpeningFlags[exitDoor] ); m_flagsDirty = TRUE; - } // end if + } // if the door is waiting-open, keep it there else if( door->m_doorWaitOpenFrame != 0 ) { door->m_doorWaitOpenFrame = now; - } // end else if + } // if the door is closing, for now, pop it to waiting open else if( door->m_doorClosedFrame != 0 ) { @@ -793,9 +793,9 @@ UpdateSleepTime ProductionUpdate::update( void ) m_setFlags.set( theWaitingOpenFlags[exitDoor] ); m_flagsDirty = TRUE; - } // end else + } - } // end if, has door animation + } // we now go into the construction complete condition for a while if( m_constructionCompleteFrame == 0 ) @@ -805,7 +805,7 @@ UpdateSleepTime ProductionUpdate::update( void ) m_setFlags.set( MODELCONDITION_CONSTRUCTION_COMPLETE ); m_flagsDirty = TRUE; - } // end if + } // // make a new object, note that for production buildings that have door @@ -856,11 +856,11 @@ UpdateSleepTime ProductionUpdate::update( void ) // This is last so the voice check can easily check for "first" guy production->oneProductionSuccessful(); - } // end if, door open or no door animation ... make the object + } - } // end, if we got a door reservation + } - } //end of trying to exit all the things we were planning on attempting + } if( production->getProductionQuantityRemaining() == 0 ) { @@ -871,7 +871,7 @@ UpdateSleepTime ProductionUpdate::update( void ) deleteInstance(production); } - } // end if we found an exit interface + } else { @@ -886,9 +886,9 @@ UpdateSleepTime ProductionUpdate::update( void ) // delete the production entry deleteInstance(production); - } // end else + } - } // end if, production unit + } else if( production->m_type == PRODUCTION_UPGRADE ) { const UpgradeTemplate *upgrade = production->m_upgradeToResearch; @@ -934,7 +934,7 @@ UpdateSleepTime ProductionUpdate::update( void ) sound.setObjectID( us->getID() ); TheAudio->addAudioEvent( &sound ); - } // end if + } // update the upgrade status in the player or give the upgrade to the object if( upgrade->getUpgradeType() == UPGRADE_TYPE_PLAYER ) @@ -971,12 +971,12 @@ UpdateSleepTime ProductionUpdate::update( void ) // delete the production entry deleteInstance(production); - } // end else, production upgrade + } - } // end if, production is 100% complete + } return UPDATE_SLEEP_NONE; -} // end update +} //------------------------------------------------------------------------------------------------- /** Add the production entry to the *END* of the production queue list */ @@ -995,7 +995,7 @@ void ProductionUpdate::addToProductionQueue( ProductionEntry *production ) m_productionQueueTail->m_next = production; production->m_prev = m_productionQueueTail; - } // end if + } // this production entry is now the new tail at the end of the list m_productionQueueTail = production; @@ -1015,11 +1015,11 @@ void ProductionUpdate::addToProductionQueue( ProductionEntry *production ) m_setFlags.set( MODELCONDITION_ACTIVELY_CONSTRUCTING ); m_flagsDirty = TRUE; - } // end if + } - } // end if + } -} // end addToProductionQueue +} //------------------------------------------------------------------------------------------------- /** Remove the production entry from the production queue list */ @@ -1064,9 +1064,9 @@ void ProductionUpdate::removeFromProductionQueue( ProductionEntry *production ) m_setFlags.set( MODELCONDITION_ACTIVELY_CONSTRUCTING, false ); m_flagsDirty = TRUE; - } // end if + } - } // end if + } /* // Debugging @@ -1084,7 +1084,7 @@ void ProductionUpdate::removeFromProductionQueue( ProductionEntry *production ) } */ -} // end removeFromProductionQueue +} //------------------------------------------------------------------------------------------------- /** Is the upgrade already in the production queue. Note that you can only have one @@ -1101,7 +1101,7 @@ Bool ProductionUpdate::isUpgradeInQueue( const UpgradeTemplate *upgrade ) const return FALSE; // not in queue -} // end isUpgradeInQueue +} // ------------------------------------------------------------------------------------------------ /** count number of units with matching unit type in the production queue */ @@ -1118,7 +1118,7 @@ UnsignedInt ProductionUpdate::countUnitTypeInQueue( const ThingTemplate *unitTyp return count; -} // end countUnitTypeInQueue +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1152,10 +1152,10 @@ void ProductionUpdate::cancelAndRefundAllProduction( void ) DEBUG_CRASH(( "ProductionUpdate::cancelAndRefundAllProduction - Unknown production type '%d'", m_productionQueue->getProductionType() )); return; - } // end else - } // end if + } + } } -} // end cancelAndRefundAllProduction +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1193,13 +1193,13 @@ void ProductionUpdate::setHoldDoorOpen(ExitDoorType exitDoor, Bool holdIt) if( pui ) return pui; - } // end for, bmi + } // interface not found return NULL; -} // end getProductionUpdateInterfaceFromObject +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -1210,7 +1210,7 @@ void ProductionUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1272,9 +1272,9 @@ void ProductionUpdate::xfer( Xfer *xfer ) // exit door xfer->xferInt( (Int*)&production->m_exitDoor ); - } // end for + } - } // end if, save + } else { AsciiString name; @@ -1286,7 +1286,7 @@ void ProductionUpdate::xfer( Xfer *xfer ) DEBUG_CRASH(( "ProductionUpdate::xfer - m_productionQueue is not empty, but should be" )); throw SC_INVALID_DATA; - } // end if + } // read each element for( UnsignedShort i = 0; i < productionCount; ++i ) @@ -1306,7 +1306,7 @@ void ProductionUpdate::xfer( Xfer *xfer ) m_productionQueueTail->m_next = production; production->m_prev = m_productionQueueTail; - } // end if + } // this production entry is now the new tail at the end of the list m_productionQueueTail = production; @@ -1326,9 +1326,9 @@ void ProductionUpdate::xfer( Xfer *xfer ) DEBUG_CRASH(( "ProductionUpdate::xfer - Cannot find template '%s'", name.str() )); throw SC_INVALID_DATA; - } // end if + } - } // end if, unit production + } else { @@ -1339,9 +1339,9 @@ void ProductionUpdate::xfer( Xfer *xfer ) DEBUG_CRASH(( "ProductionUpdate::xfer - Cannot find upgrade '%s'", name.str() )); throw SC_INVALID_DATA; - } // end if + } - } // end else, upgrade production + } // production ID xfer->xferUser( &production->m_productionID, sizeof( ProductionID ) ); @@ -1361,9 +1361,9 @@ void ProductionUpdate::xfer( Xfer *xfer ) // exit door xfer->xferInt( (Int*)&production->m_exitDoor ); - } // end for, i + } - } // end else, load + } // unique id xfer->xferUser( &m_uniqueID, sizeof( ProductionID ) ); @@ -1386,7 +1386,7 @@ void ProductionUpdate::xfer( Xfer *xfer ) // flags dirty xfer->xferBool( &m_flagsDirty ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1397,4 +1397,4 @@ void ProductionUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProjectileStreamUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProjectileStreamUpdate.cpp index d3a6e84a2dc..2e6f60b89b9 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProjectileStreamUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProjectileStreamUpdate.cpp @@ -176,7 +176,7 @@ void ProjectileStreamUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -206,7 +206,7 @@ void ProjectileStreamUpdate::xfer( Xfer *xfer ) // owning object xfer->xferObjectID( &m_owningObject ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -217,4 +217,4 @@ void ProjectileStreamUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProneUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProneUpdate.cpp index d54aa271ff4..a20832afb20 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProneUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProneUpdate.cpp @@ -127,7 +127,7 @@ void ProneUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -148,7 +148,7 @@ void ProneUpdate::xfer( Xfer *xfer ) // prone frames xfer->xferInt( &m_proneFrames ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -159,5 +159,5 @@ void ProneUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/RadarUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/RadarUpdate.cpp index 81caf41eb9c..54197f6172e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/RadarUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/RadarUpdate.cpp @@ -44,7 +44,7 @@ RadarUpdateModuleData::RadarUpdateModuleData( void ) m_radarExtendTime = 0.0f; -} // end RadarUpdateModuleData +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -60,14 +60,14 @@ RadarUpdate::RadarUpdate( Thing *thing, const ModuleData *moduleData ) m_extendDoneFrame = 0; m_extendComplete = FALSE; -} // end RadarUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- RadarUpdate::~RadarUpdate( void ) { -} // end RadarUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -86,7 +86,7 @@ void RadarUpdate::extendRadar( void ) //Change this to make the radar active after extension... m_radarActive = true; -} // end extendRadar +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -116,11 +116,11 @@ UpdateSleepTime RadarUpdate::update( void ) draw->clearAndSetModelConditionState( MODELCONDITION_RADAR_EXTENDING, MODELCONDITION_RADAR_UPGRADED ); - } // end if + } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -131,7 +131,7 @@ void RadarUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -158,7 +158,7 @@ void RadarUpdate::xfer( Xfer *xfer ) // radar active xfer->xferBool( &m_radarActive ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -169,5 +169,5 @@ void RadarUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/RadiusDecalUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/RadiusDecalUpdate.cpp index 501ec2ed4da..786d1bab713 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/RadiusDecalUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/RadiusDecalUpdate.cpp @@ -90,7 +90,7 @@ void RadiusDecalUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -113,7 +113,7 @@ void RadiusDecalUpdate::xfer( Xfer *xfer ) xfer->xferBool(&m_killWhenNoLongerAttacking); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -124,4 +124,4 @@ void RadiusDecalUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp index 2b9fc401dbb..201be5c6d2e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp @@ -735,7 +735,7 @@ void SlavedUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -768,7 +768,7 @@ void SlavedUpdate::xfer( Xfer *xfer ) // repairing xfer->xferBool( &m_repairing ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -779,5 +779,5 @@ void SlavedUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp index 4e8c7d3b58e..39d5045da63 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp @@ -1820,7 +1820,7 @@ void SpecialAbilityUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1883,7 +1883,7 @@ void SpecialAbilityUpdate::xfer( Xfer *xfer ) // capture flash phase xfer->xferReal( &m_captureFlashPhase ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1894,4 +1894,4 @@ void SpecialAbilityUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpyVisionUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpyVisionUpdate.cpp index 88f7c7dfbc7..6d0bf189d21 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpyVisionUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpyVisionUpdate.cpp @@ -123,7 +123,7 @@ void SpyVisionUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -144,7 +144,7 @@ void SpyVisionUpdate::xfer( Xfer *xfer ) // deactivate frame xfer->xferUnsignedInt( &m_deactivateFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -155,4 +155,4 @@ void SpyVisionUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp index 96ee702a69d..c3fa866afae 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp @@ -242,9 +242,9 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) // ui msg TheInGameUI->message( TheGameText->fetch( "MESSAGE:StealthDiscovered" ) ); - } // end if + } - } // end if + } // for the unit being revealed, do some UI feedback if( ThePlayerList->getLocalPlayer() == them->getControllingPlayer() && @@ -272,11 +272,11 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) // ui msg TheInGameUI->message( TheGameText->fetch( "MESSAGE:StealthNeutralized" ) ); - } // end if + } - } // end if + } - } // end if, them was not previously detected + } // updateRate PLUS 1 is necessary to ensure it stays detected 'till we are called again... stealth->markAsDetected(data->m_updateRate + 1); @@ -307,7 +307,7 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) } } - }//end if them has stealthupdate + } else // perhaps they are garrisoning something stealthy, eh? { ContainModuleInterface *contain = them->getContain(); @@ -387,7 +387,7 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) IRPingSound.setObjectID( self->getID() ); TheAudio->addAudioEvent(&IRPingSound); - } // end if doIRFX + } return UPDATE_SLEEP(data->m_updateRate); @@ -403,7 +403,7 @@ void StealthDetectorUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -424,7 +424,7 @@ void StealthDetectorUpdate::xfer( Xfer *xfer ) // enabled xfer->xferBool( &m_enabled ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -435,4 +435,4 @@ void StealthDetectorUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp index 55ec439e5b3..ca34b598f1e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp @@ -365,7 +365,7 @@ UpdateSleepTime StealthUpdate::update( void ) if( wasHidden && draw ) draw->setDrawableHidden( TRUE ); - } // end if + } Object *self = getObject(); UnsignedInt now = TheGameLogic->getFrame(); @@ -828,7 +828,7 @@ void StealthUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -881,11 +881,11 @@ void StealthUpdate::xfer( Xfer *xfer ) DEBUG_CRASH(( "StealthUpdate::xfer - Unknown template '%s'", name.str() )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } - } // end if + } // disguise transition frames xfer->xferUnsignedInt( &m_disguiseTransitionFrames ); @@ -899,7 +899,7 @@ void StealthUpdate::xfer( Xfer *xfer ) // disguised xfer->xferBool( &m_disguised ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -920,4 +920,4 @@ void StealthUpdate::loadPostProcess( void ) if( isDisguised() ) m_xferRestoreDisguise = TRUE; -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp index 4eb07fe26c5..54996d05c0d 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp @@ -220,7 +220,7 @@ void StickyBombUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -247,7 +247,7 @@ void StickyBombUpdate::xfer( Xfer *xfer ) //Next frame that a ping sound will play. xfer->xferUnsignedInt( &m_nextPingFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -258,4 +258,4 @@ void StickyBombUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp index 5f2b4a6acaa..42014a77fc3 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp @@ -361,7 +361,7 @@ void StructureCollapseUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -394,7 +394,7 @@ void StructureCollapseUpdate::xfer( Xfer *xfer ) // current height xfer->xferReal( &m_currentHeight ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -405,4 +405,4 @@ void StructureCollapseUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp index 64f00be9d8b..bdd9bc0bd24 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp @@ -571,7 +571,7 @@ void StructureToppleUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -616,7 +616,7 @@ void StructureToppleUpdate::xfer( Xfer *xfer ) // delay burst location xfer->xferCoord3D( &m_delayBurstLocation ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -627,4 +627,4 @@ void StructureToppleUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/TensileFormationUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/TensileFormationUpdate.cpp index e85fbe92b86..c459bf4141c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/TensileFormationUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/TensileFormationUpdate.cpp @@ -88,7 +88,7 @@ TensileFormationUpdateModuleData::TensileFormationUpdateModuleData( void ) m_enabled = FALSE; -} // end TensileFormationUpdateModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -105,7 +105,7 @@ TensileFormationUpdateModuleData::TensileFormationUpdateModuleData( void ) }; p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -149,14 +149,14 @@ TensileFormationUpdate::TensileFormationUpdate( Thing *thing, const ModuleData * -} // end TensileFormationUpdate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ TensileFormationUpdate::~TensileFormationUpdate( void ) { -} // end ~TensileFormationUpdate +} @@ -374,7 +374,7 @@ UpdateSleepTime TensileFormationUpdate::update( void ) return UPDATE_SLEEP_NONE; -} // end update +} @@ -440,7 +440,7 @@ void TensileFormationUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -461,7 +461,7 @@ void TensileFormationUpdate::xfer( Xfer *xfer ) // enabled xfer->xferBool( &m_enabled ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -472,4 +472,4 @@ void TensileFormationUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp index 59ad9f41700..580d8edb236 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp @@ -330,7 +330,7 @@ UpdateSleepTime ToppleUpdate::update() obj->setOrientation(obj->getOrientation()); } - } // if kill when toppled + } if (d->m_killStumpWhenToppled) { @@ -403,7 +403,7 @@ void ToppleUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -451,7 +451,7 @@ void ToppleUpdate::xfer( Xfer *xfer ) // stump id xfer->xferObjectID( &m_stumpID ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -462,4 +462,4 @@ void ToppleUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/UpdateModule.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/UpdateModule.cpp index ff29283075e..8a3105a46a8 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/UpdateModule.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/UpdateModule.cpp @@ -92,7 +92,7 @@ void UpdateModule::crc( Xfer *xfer ) // extend base class BehaviorModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -178,7 +178,7 @@ void UpdateModule::xfer( Xfer *xfer ) m_indexInLogic = -1; } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -189,7 +189,7 @@ void UpdateModule::loadPostProcess( void ) // extned base class BehaviorModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp index 830910a990e..50de44798d4 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp @@ -74,7 +74,7 @@ WaveGuideUpdateModuleData::WaveGuideUpdateModuleData( void ) m_damageAmount = 0.0f; m_toppleForce = 0.0f; -} // end WaveGuideUpdateModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -106,7 +106,7 @@ WaveGuideUpdateModuleData::WaveGuideUpdateModuleData( void ) p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -138,16 +138,16 @@ WaveGuideUpdate::WaveGuideUpdate( Thing *thing, const ModuleData *moduleData ) for( Int j = 0; j < MAX_SHAPE_EFFECTS; j++ ) m_shapeEffects[ i ][ j ] = INVALID_PARTICLE_SYSTEM_ID; - } // end for i + } -} // end WaveGuideUpdate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ WaveGuideUpdate::~WaveGuideUpdate( void ) { -} // end ~WaveGuideUpdate +} // ------------------------------------------------------------------------------------------------ /** Start the waveguide moving along its waypoint path, bringing water destruction and havok @@ -182,7 +182,7 @@ Bool WaveGuideUpdate::startMoving( void ) DEBUG_CRASH(( "WaveGuideUpdate::startMoving - The waypoint path cannot have multiple link choices at any node" )); return FALSE; - } // end if + } // set our destination location to this waypoint position m_finalDestination = *verify->getLocation(); @@ -190,7 +190,7 @@ Bool WaveGuideUpdate::startMoving( void ) // on to the next verify = verify->getLink( 0 ); - } // end while + } // there must be at least one link Waypoint *next = waypoint->getLink( 0 ); @@ -200,7 +200,7 @@ Bool WaveGuideUpdate::startMoving( void ) DEBUG_CRASH(( "WaveGuideUpdate:startMoving - There must be a linked waypoint path to follow" )); return FALSE; - } // end if + } // get vector from next waypoint to first waypoint Coord2D v; @@ -234,13 +234,13 @@ Bool WaveGuideUpdate::startMoving( void ) // ai->setPathExtraDistance( PATH_EXTRA_DISTANCE ); - } // end if + } - } // endif + } return TRUE; // all is well -} // end startMoving +} // ------------------------------------------------------------------------------------------------ /** The wave guide has started moving ... this is called once */ @@ -273,7 +273,7 @@ Bool WaveGuideUpdate::initWaveGuide( void ) particleSys->attachToObject( getObject() ); m_shapeEffects[ i ][ 0 ] = particleSys->getSystemID(); - } // end if + } // create spray 2 effect particleSys = TheParticleSystemManager->createParticleSystem( wave2 ); @@ -284,7 +284,7 @@ Bool WaveGuideUpdate::initWaveGuide( void ) particleSys->attachToObject( getObject() ); m_shapeEffects[ i ][ 1 ] = particleSys->getSystemID(); - } // end if + } // create spray 3 every few points across the wave if( i % 5 == 0 ) @@ -298,15 +298,15 @@ Bool WaveGuideUpdate::initWaveGuide( void ) particleSys->attachToObject( getObject() ); m_shapeEffects[ i ][ 2 ] = particleSys->getSystemID(); - } // end if + } - } // end if + } - } // end if + } return TRUE; // all is well -} // end initWaveGuide +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -342,9 +342,9 @@ void WaveGuideUpdate::computeWaveShapePoints( void ) m_shapePoints[ m_shapePointCount ].z = 0.0f; m_shapePointCount++; - } // end for width + } -} // end computeWaveShapePoints +} // ------------------------------------------------------------------------------------------------ /** Given the current position and orientation of the wave guide, transform all the wave @@ -365,9 +365,9 @@ void WaveGuideUpdate::transformWaveShape( void ) m_transformedShapePoints[ i ].z = TheTerrainLogic->getGroundHeight( m_transformedShapePoints[ i ].x, m_transformedShapePoints[ i ].y ); - } // end for i + } -} // end transformWaveShape +} // ------------------------------------------------------------------------------------------------ /** Update phase for the effects that make up the front shape of the wave */ @@ -406,15 +406,15 @@ void WaveGuideUpdate::doShapeEffects( void ) pos.z = m_transformedShapePoints[ i ].z; particleSys->setPosition( &pos ); - } // end if + } - } // end if + } - } // end for j + } - } // end for i + } -} // end doShapeEffects +} // ------------------------------------------------------------------------------------------------ /** Given all our sample points, make the wave go */ @@ -439,9 +439,9 @@ void WaveGuideUpdate::doWaterMotion( void ) modData->m_preferredHeight ); - } // end for i + } -} // end doWaterMotion +} // ------------------------------------------------------------------------------------------------ /** Any points in our wave that are on the shoreline that are close enough to the effect @@ -476,7 +476,7 @@ void WaveGuideUpdate::doShoreEffects( void ) // transform the point waveGuide->transformPoint( &effectPoints[ i ], &effectPoints[ i ] ); - } // end for i + } // // go across the shape of our wave ... when we detect a transition from underground to @@ -513,12 +513,12 @@ void WaveGuideUpdate::doShoreEffects( void ) if( particleSystem ) particleSystem->setPosition( prevPoint ); - } // end if + } // we are now 'above' underWater = FALSE; - } // end if + } else { @@ -533,16 +533,16 @@ void WaveGuideUpdate::doShoreEffects( void ) if( particleSystem ) particleSystem->setPosition( point ); - } // end if + } // we are now 'under' underWater = TRUE; - } // end else + } - } // end for i + } -} // end doShoreEffects +} // ------------------------------------------------------------------------------------------------ /** Do damage to things that have fallen victim in the path of this enourmous wave */ @@ -638,7 +638,7 @@ void WaveGuideUpdate::doDamage( void ) particleSystem->setPosition( &pos ); particleSystem->attachToObject( waveGuide ); - } // end if + } // this object is now wet obj->setStatus( MAKE_OBJECT_STATUS_MASK( OBJECT_STATUS_WET ) ); @@ -671,7 +671,7 @@ void WaveGuideUpdate::doDamage( void ) draw->setModelConditionState( MODELCONDITION_FLOODED ); draw->setShadowsEnabled( FALSE ); - } // end if + } // // Temp demo hack, replace bridges destroyed with the special destroyed bridge art @@ -700,7 +700,7 @@ void WaveGuideUpdate::doDamage( void ) v.y = bridgeInfo.to.y - bridgeInfo.from.y; angle = v.toAngle(); - } // end if + } // put new bridge looking object in the world newBridge->setPosition( obj->getPosition() ); @@ -734,24 +734,24 @@ void WaveGuideUpdate::doDamage( void ) particleSystem->setLocalTransform( &transform ); - } // end if + } // destroy the old bridge and bridge object TheTerrainLogic->deleteBridge( oldBridge ); - } // end if + } - } // end if + } - } // end if + } - } // end if + } - } // end for obj + } - } // end for i + } -} // end doDamage +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -797,12 +797,12 @@ UpdateSleepTime WaveGuideUpdate::update( void ) TheGameLogic->destroyObject( getObject() ); return UPDATE_SLEEP_NONE; - } // end if + } // we are now in motion m_initialized = TRUE; - } // end if + } // every half second we try to play a random spash sound if( TheGameLogic->getFrame() - m_splashSoundFrame > LOGICFRAMES_PER_SECOND / 2.0f ) @@ -817,8 +817,8 @@ UpdateSleepTime WaveGuideUpdate::update( void ) AudioEventRTS randomSplash(modData->m_randomSplashSound); randomSplash.setObjectID(waveGuide->getID()); TheAudio->addAudioEvent(&randomSplash); - } // end if - } // end if + } + } // // transform the wave shape points once for the current position ... we have this array @@ -850,7 +850,7 @@ UpdateSleepTime WaveGuideUpdate::update( void ) return UPDATE_SLEEP_NONE; - } // end if + } // do wavefront effects doShapeEffects(); @@ -866,7 +866,7 @@ UpdateSleepTime WaveGuideUpdate::update( void ) return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -877,7 +877,7 @@ void WaveGuideUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -922,7 +922,7 @@ void WaveGuideUpdate::xfer( Xfer *xfer ) // final destination xfer->xferCoord3D( &m_finalDestination ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -933,4 +933,4 @@ void WaveGuideUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ActiveShroudUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ActiveShroudUpgrade.cpp index bee532990d6..dbbfb2a280b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ActiveShroudUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ActiveShroudUpgrade.cpp @@ -41,7 +41,7 @@ ActiveShroudUpgradeModuleData::ActiveShroudUpgradeModuleData( void ) m_newShroudRange = 0.0f; -} // end SpecialPowerModuleData +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -56,7 +56,7 @@ ActiveShroudUpgradeModuleData::ActiveShroudUpgradeModuleData( void ) }; p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -68,14 +68,14 @@ ActiveShroudUpgrade::ActiveShroudUpgrade( Thing *thing, const ModuleData* module UpgradeModule( thing, moduleData ) { -} // end ActiveShroudUpgrade +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- ActiveShroudUpgrade::~ActiveShroudUpgrade( void ) { -} // end ~ActiveShroudUpgrade +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -87,7 +87,7 @@ void ActiveShroudUpgrade::upgradeImplementation( void ) getObject()->setShroudRange( getActiveShroudUpgradeModuleData()->m_newShroudRange ); getObject()->handlePartitionCellMaintenance();// To shroud where I am without waiting. } -} // end upgradeImplementation +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -98,7 +98,7 @@ void ActiveShroudUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -116,7 +116,7 @@ void ActiveShroudUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -127,4 +127,4 @@ void ActiveShroudUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ArmorUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ArmorUpgrade.cpp index 4c8e23bb36d..e8332345905 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ArmorUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ArmorUpgrade.cpp @@ -104,7 +104,7 @@ void ArmorUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -122,7 +122,7 @@ void ArmorUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -133,4 +133,4 @@ void ArmorUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp index ba7ed69cd73..8342943672b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp @@ -78,7 +78,7 @@ void CommandSetUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -96,7 +96,7 @@ void CommandSetUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -107,4 +107,4 @@ void CommandSetUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/CostModifierUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/CostModifierUpgrade.cpp index 2bee3f2380e..03e639ba17d 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/CostModifierUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/CostModifierUpgrade.cpp @@ -78,7 +78,7 @@ CostModifierUpgradeModuleData::CostModifierUpgradeModuleData( void ) m_kindOf = KINDOFMASK_NONE; m_percentage = 0; -} // end CostModifierUpgradeModuleData +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -94,7 +94,7 @@ CostModifierUpgradeModuleData::CostModifierUpgradeModuleData( void ) }; p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -106,14 +106,14 @@ CostModifierUpgrade::CostModifierUpgrade( Thing *thing, const ModuleData* module UpgradeModule( thing, moduleData ) { -} // end CostModifierUpgrade +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- CostModifierUpgrade::~CostModifierUpgrade( void ) { -} // end ~CostModifierUpgrade +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -132,7 +132,7 @@ void CostModifierUpgrade::onDelete( void ) // this upgrade module is now "not upgraded" setUpgradeExecuted(FALSE); -} // end onDelete +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -150,16 +150,16 @@ void CostModifierUpgrade::onCapture( Player *oldOwner, Player *newOwner ) oldOwner->removeKindOfProductionCostChange(getCostModifierUpgradeModuleData()->m_kindOf,getCostModifierUpgradeModuleData()->m_percentage ); setUpgradeExecuted(FALSE); - } // end if + } if( newOwner ) { newOwner->addKindOfProductionCostChange(getCostModifierUpgradeModuleData()->m_kindOf,getCostModifierUpgradeModuleData()->m_percentage ); setUpgradeExecuted(TRUE); - } // end if + } -} // end onCapture +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -170,7 +170,7 @@ void CostModifierUpgrade::upgradeImplementation( void ) // update the player with another TypeOfProductionCostChange player->addKindOfProductionCostChange(getCostModifierUpgradeModuleData()->m_kindOf,getCostModifierUpgradeModuleData()->m_percentage ); -} // end upgradeImplementation +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -181,7 +181,7 @@ void CostModifierUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -199,7 +199,7 @@ void CostModifierUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -210,4 +210,4 @@ void CostModifierUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/DelayedUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/DelayedUpgrade.cpp index 386c1709806..b7928e8f35b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/DelayedUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/DelayedUpgrade.cpp @@ -82,7 +82,7 @@ void DelayedUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -100,7 +100,7 @@ void DelayedUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -111,4 +111,4 @@ void DelayedUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ExperienceScalarUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ExperienceScalarUpgrade.cpp index 389548d16cd..f842021af67 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ExperienceScalarUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ExperienceScalarUpgrade.cpp @@ -57,7 +57,7 @@ void ExperienceScalarUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p) p.add(dataFieldParse); -} // end buildFieldParse +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -95,7 +95,7 @@ void ExperienceScalarUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -113,7 +113,7 @@ void ExperienceScalarUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -124,4 +124,4 @@ void ExperienceScalarUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/LocomotorSetUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/LocomotorSetUpgrade.cpp index a8b7d5d69df..ca43d2620d4 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/LocomotorSetUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/LocomotorSetUpgrade.cpp @@ -65,7 +65,7 @@ void LocomotorSetUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -83,7 +83,7 @@ void LocomotorSetUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -94,4 +94,4 @@ void LocomotorSetUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/MaxHealthUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/MaxHealthUpgrade.cpp index 98472b49fd1..fe03656414b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/MaxHealthUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/MaxHealthUpgrade.cpp @@ -61,7 +61,7 @@ void MaxHealthUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p) p.add(dataFieldParse); -} // end buildFieldParse +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -100,7 +100,7 @@ void MaxHealthUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -118,7 +118,7 @@ void MaxHealthUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -129,4 +129,4 @@ void MaxHealthUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ObjectCreationUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ObjectCreationUpgrade.cpp index f97bf100054..efb268d56ba 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ObjectCreationUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ObjectCreationUpgrade.cpp @@ -45,7 +45,7 @@ ObjectCreationUpgradeModuleData::ObjectCreationUpgradeModuleData( void ) m_ocl = NULL; -} // end SpecialPowerModuleData +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -60,7 +60,7 @@ ObjectCreationUpgradeModuleData::ObjectCreationUpgradeModuleData( void ) }; p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -72,20 +72,20 @@ ObjectCreationUpgrade::ObjectCreationUpgrade( Thing *thing, const ModuleData* mo UpgradeModule( thing, moduleData ) { -} // end ObjectCreationUpgrade +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- ObjectCreationUpgrade::~ObjectCreationUpgrade( void ) { -} // end ~ObjectCreationUpgrade +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- void ObjectCreationUpgrade::onDelete( void ) { -} // end onDelete +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -107,7 +107,7 @@ void ObjectCreationUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -125,7 +125,7 @@ void ObjectCreationUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -136,4 +136,4 @@ void ObjectCreationUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/PowerPlantUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/PowerPlantUpgrade.cpp index e998ee909b6..d65e983460f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/PowerPlantUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/PowerPlantUpgrade.cpp @@ -45,14 +45,14 @@ PowerPlantUpgrade::PowerPlantUpgrade( Thing *thing, const ModuleData* moduleData UpgradeModule( thing, moduleData ) { -} // end PowerPlantUpgrade +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- PowerPlantUpgrade::~PowerPlantUpgrade( void ) { -} // end ~PowerPlantUpgrade +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -71,7 +71,7 @@ void PowerPlantUpgrade::onDelete( void ) // this upgrade module is now "not upgraded" setUpgradeExecuted(FALSE); -} // end onDelete +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -103,7 +103,7 @@ void PowerPlantUpgrade::onCapture( Player *oldOwner, Player *newOwner ) } -} // end onCapture +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -125,7 +125,7 @@ void PowerPlantUpgrade::upgradeImplementation( void ) ppui->extendRods(TRUE); } -} // end upgradeImplementation +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -136,7 +136,7 @@ void PowerPlantUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -154,7 +154,7 @@ void PowerPlantUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -176,4 +176,4 @@ void PowerPlantUpgrade::loadPostProcess( void ) player->addPowerBonus(getObject()); } -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/RadarUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/RadarUpgrade.cpp index 80f4b0003d3..569fcd48b9f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/RadarUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/RadarUpgrade.cpp @@ -58,14 +58,14 @@ RadarUpgrade::RadarUpgrade( Thing *thing, const ModuleData* moduleData ) : UpgradeModule( thing, moduleData ) { -} // end RadarUpgrade +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- RadarUpgrade::~RadarUpgrade( void ) { -} // end ~RadarUpgrade +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -89,7 +89,7 @@ void RadarUpgrade::onDelete( void ) // this upgrade module is now "not upgraded" setUpgradeExecuted(FALSE); -} // end onDelete +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -112,16 +112,16 @@ void RadarUpgrade::onCapture( Player *oldOwner, Player *newOwner ) oldOwner->removeRadar( md->m_isDisableProof ); setUpgradeExecuted(FALSE); - } // end if + } if( newOwner ) { newOwner->addRadar( md->m_isDisableProof ); setUpgradeExecuted(TRUE); - } // end if + } -} // end onCapture +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -140,7 +140,7 @@ void RadarUpgrade::upgradeImplementation( void ) if( radarUpdate ) radarUpdate->extendRadar(); -} // end upgradeImplementation +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -151,7 +151,7 @@ void RadarUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -169,7 +169,7 @@ void RadarUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -180,4 +180,4 @@ void RadarUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/StatusBitsUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/StatusBitsUpgrade.cpp index a666bd74b70..c498a95c8ad 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/StatusBitsUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/StatusBitsUpgrade.cpp @@ -116,7 +116,7 @@ void StatusBitsUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -134,7 +134,7 @@ void StatusBitsUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -145,4 +145,4 @@ void StatusBitsUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/StealthUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/StealthUpgrade.cpp index 97da33f855f..7dffe6bfcb7 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/StealthUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/StealthUpgrade.cpp @@ -63,7 +63,7 @@ void StealthUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -81,7 +81,7 @@ void StealthUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -92,4 +92,4 @@ void StealthUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/SubObjectsUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/SubObjectsUpgrade.cpp index 39ad08a39ce..13f97aa5e40 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/SubObjectsUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/SubObjectsUpgrade.cpp @@ -136,7 +136,7 @@ void SubObjectsUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} //------------------------------------------------------------------------------------------------ // Xfer method @@ -154,7 +154,7 @@ void SubObjectsUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} //------------------------------------------------------------------------------------------------ void SubObjectsUpgrade::loadPostProcess( void ) @@ -163,4 +163,4 @@ void SubObjectsUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/UnpauseSpecialPowerUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/UnpauseSpecialPowerUpgrade.cpp index 686c0dce805..2edb3c799aa 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/UnpauseSpecialPowerUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/UnpauseSpecialPowerUpgrade.cpp @@ -57,7 +57,7 @@ UnpauseSpecialPowerUpgradeModuleData::UnpauseSpecialPowerUpgradeModuleData( void }; p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -102,7 +102,7 @@ void UnpauseSpecialPowerUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -120,7 +120,7 @@ void UnpauseSpecialPowerUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -131,4 +131,4 @@ void UnpauseSpecialPowerUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/UpgradeModule.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/UpgradeModule.cpp index e548389d922..f9425513a97 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/UpgradeModule.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/UpgradeModule.cpp @@ -45,7 +45,7 @@ void UpgradeModule::crc( Xfer *xfer ) // extned base class UpgradeMux::upgradeMuxCRC( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -64,7 +64,7 @@ void UpgradeModule::xfer( Xfer *xfer ) // extend base class UpgradeMux::upgradeMuxXfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -78,7 +78,7 @@ void UpgradeModule::loadPostProcess( void ) // extend base class UpgradeMux::upgradeMuxLoadPostProcess(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/WeaponBonusUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/WeaponBonusUpgrade.cpp index 87f00177a3d..549ab7dbdea 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/WeaponBonusUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/WeaponBonusUpgrade.cpp @@ -101,7 +101,7 @@ void WeaponBonusUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -119,7 +119,7 @@ void WeaponBonusUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -130,4 +130,4 @@ void WeaponBonusUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/WeaponSetUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/WeaponSetUpgrade.cpp index 5684604f53f..0821d5f2ac1 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/WeaponSetUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/WeaponSetUpgrade.cpp @@ -65,7 +65,7 @@ void WeaponSetUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -83,7 +83,7 @@ void WeaponSetUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -94,4 +94,4 @@ void WeaponSetUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index 74c71a6f939..19c4e9d2c0f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -324,7 +324,7 @@ WeaponTemplate::~WeaponTemplate() void WeaponTemplate::reset( void ) { m_historicDamage.clear(); -} // end reset +} //------------------------------------------------------------------------------------------------- /*static*/ void WeaponTemplate::parseWeaponBonusSet( INI* ini, void *instance, void * /*store*/, const void* /*userData*/ ) @@ -434,7 +434,7 @@ void WeaponTemplate::postProcessLoad() m_projectileDetonationOCLNames[i].clear(); } -} // end postProcessLoad +} //------------------------------------------------------------------------------------------------- Real WeaponTemplate::getAttackRange(const WeaponBonus& bonus) const @@ -1173,9 +1173,9 @@ void WeaponTemplate::dealDamageInternal(ObjectID sourceID, ObjectID victimID, co // add AFTER checking for historic stuff m_historicDamage.push_back( HistoricWeaponDamageInfo(frameNow, *pos) ); - } // end else + } - } // if historic bonuses + } //DEBUG_LOG(("WeaponTemplate::dealDamageInternal: dealing damage %s at frame %d",m_name.str(),TheGameLogic->getFrame())); @@ -1529,7 +1529,7 @@ void WeaponStore::postProcessLoad() wt->postProcessLoad(); } -} // end postProcessLoad +} //------------------------------------------------------------------------------------------------- /*static*/ void WeaponStore::parseWeaponTemplateDefinition(INI* ini) @@ -3077,7 +3077,7 @@ void Weapon::crc( Xfer *xfer ) } #endif // DEBUG_CRC - } // end for, it + } // pitch limited xfer->xferBool( &m_pitchLimited ); @@ -3107,7 +3107,7 @@ void Weapon::crc( Xfer *xfer ) } #endif // DEBUG_CRC -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer @@ -3190,9 +3190,9 @@ void Weapon::xfer( Xfer *xfer ) intData = *it; xfer->xferInt( &intData ); - } // end for, it + } - } // end if, save + } else { @@ -3205,9 +3205,9 @@ void Weapon::xfer( Xfer *xfer ) xfer->xferInt( &intData ); m_scatterTargetsUnused.push_back( intData ); - } // end for, i + } - } // end else, load + } // pitch limited xfer->xferBool( &m_pitchLimited ); @@ -3215,7 +3215,7 @@ void Weapon::xfer( Xfer *xfer ) // leech weapon range active xfer->xferBool( &m_leechWeaponRangeActive ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp index c9cf5019933..95aba310827 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp @@ -192,7 +192,7 @@ WeaponSet::~WeaponSet() void WeaponSet::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -280,7 +280,7 @@ void WeaponSet::xfer( Xfer *xfer ) void WeaponSet::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- void WeaponSet::updateWeaponSet(const Object* obj) diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp index 400d802a594..479f5bd42c2 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp @@ -127,14 +127,14 @@ ScriptActions::ScriptActions() m_suppressNewWindows = FALSE; m_unnamedUnit = AsciiString::TheEmptyString; -} // end ScriptActions +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- ScriptActions::~ScriptActions() { reset(); // just in case. -} // end ~ScriptActions +} //------------------------------------------------------------------------------------------------- /** Init */ @@ -144,7 +144,7 @@ void ScriptActions::init( void ) reset(); -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset */ @@ -154,7 +154,7 @@ void ScriptActions::reset( void ) m_suppressNewWindows = FALSE; closeWindows(FALSE); // Close victory or defeat windows. -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update */ @@ -162,7 +162,7 @@ void ScriptActions::reset( void ) void ScriptActions::update( void ) { // Empty for now. jba. -} // end update +} //------------------------------------------------------------------------------------------------- @@ -567,7 +567,7 @@ void ScriptActions::doCreateReinforcements(const AsciiString& team, const AsciiS pos.z = TheTerrainLogic->getGroundHeight(pos.x, pos.y); obj->setPosition( &pos ); obj->setOrientation(0.0f); - } // end if + } } if (obj) pos.y += 2*obj->getGeometryInfo().getMajorRadius(); } @@ -997,7 +997,7 @@ void ScriptActions::doCreateObject(const AsciiString& objectName, const AsciiStr obj->setOrientation(angle); obj->setPosition( pos ); - } // end if + } } else { DEBUG_LOG(("WARNING - ThingTemplate '%s' not found.", thingName.str())); } @@ -1171,7 +1171,7 @@ void ScriptActions::createUnitOnTeamAt(const AsciiString& unitName, const AsciiS Coord3D destination = *way->getLocation(); obj->setPosition(&destination); } - } // end if + } } else { DEBUG_LOG(("WARNING - ThingTemplate '%s' not found.", objType.str())); } @@ -2138,7 +2138,7 @@ void ScriptActions::doTeamHuntWithCommandButton(const AsciiString& teamName, con msg.concat("' requires CommandButtonHuntUpdate in .ini definition to hunt with "); msg.concat(ability); TheScriptEngine->AppendDebugMessage(msg, false); - } // end if + } } break; diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp index 76c4f4f8e76..de72929feea 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp @@ -124,14 +124,14 @@ static TransportStatus *s_transportStatuses; ScriptConditions::ScriptConditions() { -} // end ScriptConditions +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- ScriptConditions::~ScriptConditions() { reset(); // just in case. -} // end ~ScriptConditions +} //------------------------------------------------------------------------------------------------- /** Init */ @@ -141,7 +141,7 @@ void ScriptConditions::init( void ) reset(); -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset */ @@ -152,7 +152,7 @@ void ScriptConditions::reset( void ) deleteInstance(s_transportStatuses); s_transportStatuses = NULL; // Empty for now. jba. -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update */ @@ -161,7 +161,7 @@ void ScriptConditions::update( void ) { // Empty for now. jba -} // end update +} //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index 71833af2242..6713a1f1211 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -223,9 +223,9 @@ void AttackPriorityInfo::reset( void ) delete m_priorityMap; m_priorityMap = NULL; - } // end if + } -} // end reset +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -233,7 +233,7 @@ void AttackPriorityInfo::reset( void ) void AttackPriorityInfo::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -270,7 +270,7 @@ void AttackPriorityInfo::xfer( Xfer *xfer ) for( it = m_priorityMap->begin(); it != m_priorityMap->end(); ++it ) ++priorityMapCount; - } // end if + } xfer->xferUnsignedShort( &priorityMapCount ); // priority map @@ -303,16 +303,16 @@ void AttackPriorityInfo::xfer( Xfer *xfer ) priority = (*it).second; xfer->xferInt( &priority ); - } // end for i + } // sanity DEBUG_ASSERTCRASH( count == priorityMapCount, ("AttackPriorityInfo::xfer - Mismatch in priority map size. Size() method returned '%d' but actual iteration count was '%d'", priorityMapCount, count) ); - } // end if + } - } // end if, save + } else { @@ -330,7 +330,7 @@ void AttackPriorityInfo::xfer( Xfer *xfer ) thingTemplateName.str() )); throw SC_INVALID_DATA; - } // end if + } // read priority xfer->xferInt( &priority ); @@ -338,11 +338,11 @@ void AttackPriorityInfo::xfer( Xfer *xfer ) // set priority (this will allocate the map on the first call as well) setPriority( thingTemplate, priority ); - } // end for + } - } // end else, load + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -350,7 +350,7 @@ void AttackPriorityInfo::xfer( Xfer *xfer ) void AttackPriorityInfo::loadPostProcess( void ) { -} // end loadPostProcess +} // ScriptEngine class @@ -391,7 +391,7 @@ m_ChooseVictimAlwaysUsesNormal(false) // By default, difficulty should be normal. setGlobalDifficulty(DIFFICULTY_NORMAL); -} // end ScriptEngine +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -422,7 +422,7 @@ ScriptEngine::~ScriptEngine() #endif reset(); // just in case. -} // end ~ScriptEngine +} //------------------------------------------------------------------------------------------------- /** Init */ @@ -4528,7 +4528,7 @@ void ScriptEngine::init( void ) reset(); -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset */ @@ -4694,7 +4694,7 @@ void ScriptEngine::reset( void ) // clear topple directions m_toppleDirections.clear(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** newMap */ @@ -4763,7 +4763,7 @@ void ScriptEngine::newMap( void ) m_fadeFramesDecrease = FRAMES_TO_FADE_IN_AT_START; m_curFadeValue = 0.0f; -} // end newMap +} //------------------------------------------------------------------------------------------------- /** Update */ @@ -4906,7 +4906,7 @@ void ScriptEngine::update( void ) _updateVTune(); #endif -} // end update +} //------------------------------------------------------------------------------------------------- /** getStats */ @@ -4964,7 +4964,7 @@ AsciiString ScriptEngine::getStats(Real *curTimePtr, Real *script1Time, Real *sc #endif #endif return msg; -} // end getStats +} //------------------------------------------------------------------------------------------------- /** startQuickEndGameTimer */ @@ -4972,7 +4972,7 @@ AsciiString ScriptEngine::getStats(Real *curTimePtr, Real *script1Time, Real *sc void ScriptEngine::startQuickEndGameTimer( void ) { m_endGameTimer = 1; -} // end startQuickEndGameTimer +} //------------------------------------------------------------------------------------------------- /** startEndGameTimer */ @@ -4980,7 +4980,7 @@ void ScriptEngine::startQuickEndGameTimer( void ) void ScriptEngine::startEndGameTimer( void ) { m_endGameTimer = FRAMES_TO_SHOW_WIN_LOSE_MESSAGE; -} // end startEndGameTimer +} //------------------------------------------------------------------------------------------------- /** startCloseWindowTimer */ @@ -4988,7 +4988,7 @@ void ScriptEngine::startEndGameTimer( void ) void ScriptEngine::startCloseWindowTimer( void ) { m_closeWindowTimer = FRAMES_TO_SHOW_WIN_LOSE_MESSAGE; -} // end startCloseWindowTimer +} //------------------------------------------------------------------------------------------------- /** updateFades */ @@ -5018,7 +5018,7 @@ void ScriptEngine::updateFades( void ) } // time is up. m_fade = FADE_NONE; -} // end updateFades +} //------------------------------------------------------------------------------------------------- /** getCurrentPlayer */ @@ -5028,7 +5028,7 @@ Player *ScriptEngine::getCurrentPlayer(void) if (m_currentPlayer==NULL) AppendDebugMessage("***Unexpected NULL player:***", false); return m_currentPlayer; -} // end getCurrentPlayer +} //------------------------------------------------------------------------------------------------- /** clearFlag */ @@ -5047,7 +5047,7 @@ void ScriptEngine::clearFlag(const AsciiString &name) } } } -} // end clearFlag +} //------------------------------------------------------------------------------------------------- /** clearTeamFlags */ @@ -5063,7 +5063,7 @@ void ScriptEngine::clearTeamFlags(void) clearFlag("GLA Team is Building"); clearFlag("GLA Inf Team is Building"); -} // end clearTeamFlags +} //------------------------------------------------------------------------------------------------- /** getSkirmishEnemyPlayer */ @@ -5273,7 +5273,7 @@ Team * ScriptEngine::getTeamNamed(const AsciiString& teamName) } } return theTeamProto->getFirstItemIn_TeamInstanceList(); -} // end getTeamNamed +} //------------------------------------------------------------------------------------------------- /** getUnitNamed */ @@ -5361,7 +5361,7 @@ void ScriptEngine::runScript(const AsciiString& scriptName, Team *pThisTeam) // m_callingTeam is restored automatically via LatchRestore m_conditionTeam = m_conditionTeam; m_currentPlayer = savPlayer; -} // end runScript +} //------------------------------------------------------------------------------------------------- @@ -5406,7 +5406,7 @@ void ScriptEngine::runObjectScript(const AsciiString& scriptName, Object *pThisO } } m_callingObject = pSavCallingObject; -} // end runScript +} //------------------------------------------------------------------------------------------------- @@ -6967,7 +6967,7 @@ void ScriptEngine::executeScripts( Script *pScriptHead ) } executeScript(pCurScript); } -} // end update +} //------------------------------------------------------------------------------------------------- @@ -6980,7 +6980,7 @@ const ActionTemplate * ScriptEngine::getActionTemplate( Int ndx ) DEBUG_ASSERTCRASH (!m_actionTemplates[ndx].getName().isEmpty(), ("Need to initialize action enum=%d.", ndx)); return &m_actionTemplates[ndx]; -} // end getActionTemplate +} //------------------------------------------------------------------------------------------------- /** Gets the ui and parameter template for a script condition */ @@ -6991,7 +6991,7 @@ const ConditionTemplate * ScriptEngine::getConditionTemplate( Int ndx ) if (ndx <0 || ndx >= Condition::NUM_ITEMS) ndx = 0; DEBUG_ASSERTCRASH (!m_conditionTemplates[ndx].getName().isEmpty(), ("Need to initialize Condition enum=%d.", ndx)); return &m_conditionTemplates[ndx]; -} // end getConditionTemplate +} //------------------------------------------------------------------------------------------------- /** Fills the named object cache initally. */ @@ -7430,7 +7430,7 @@ SequentialScript::SequentialScript() : m_teamToExecOn(NULL), void SequentialScript::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -7462,9 +7462,9 @@ void SequentialScript::xfer( Xfer *xfer ) teamID )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } // object id xfer->xferObjectID( &m_objectID ); @@ -7478,7 +7478,7 @@ void SequentialScript::xfer( Xfer *xfer ) scriptName = m_scriptToExecuteSequentially->getName(); xfer->xferAsciiString( &scriptName ); - } // end if, save + } else { @@ -7495,7 +7495,7 @@ void SequentialScript::xfer( Xfer *xfer ) DEBUG_ASSERTCRASH( m_scriptToExecuteSequentially != NULL, ("SequentialScript::xfer - m_scriptToExecuteSequentially is NULL but should not be") ); - } // end else, load + } // current instruction xfer->xferInt( &m_currentInstruction ); @@ -7509,7 +7509,7 @@ void SequentialScript::xfer( Xfer *xfer ) // dont advance instruction xfer->xferBool( &m_dontAdvanceInstruction ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -7517,7 +7517,7 @@ void SequentialScript::xfer( Xfer *xfer ) void SequentialScript::loadPostProcess( void ) { -} // end loadPostProcess +} #ifdef NOT_IN_USE //----SequentialScriptStatus Stuff ---------------------------------------------------------------- @@ -7527,7 +7527,7 @@ void SequentialScript::loadPostProcess( void ) void SequentialScriptStatus::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -7551,7 +7551,7 @@ void SequentialScriptStatus::xfer( Xfer *xfer ) // is executing sequentially xfer->xferBool( &m_isExecutingSequentially ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ // Load post process */ @@ -7559,7 +7559,7 @@ void SequentialScriptStatus::xfer( Xfer *xfer ) void SequentialScriptStatus::loadPostProcess( void ) { -} // end loadPostProcess +} #endif //----Particle Editor Stuff------------------------------------------------------------------------ @@ -7814,7 +7814,7 @@ void ScriptEngine::AdjustDebugVariableData(const AsciiString& variableName, Int void ScriptEngine::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Version Info: @@ -7848,9 +7848,9 @@ static void xferListAsciiString( Xfer *xfer, ListAsciiString *list ) string = *it; xfer->xferAsciiString( &string ); - } // end for, it + } - } // end if, save + } else { @@ -7861,7 +7861,7 @@ static void xferListAsciiString( Xfer *xfer, ListAsciiString *list ) DEBUG_CRASH(( "xferListAsciiString - list should be empty upon loading but is not" )); throw SC_INVALID_DATA; - } // end if + } // read each string for( UnsignedShort i = 0; i < count; ++i ) @@ -7873,11 +7873,11 @@ static void xferListAsciiString( Xfer *xfer, ListAsciiString *list ) // put on list list->push_back( string ); - } // end for, i + } - } // end else, load + } -} // end xferListAsciiString +} // ------------------------------------------------------------------------------------------------ /** Version Info: @@ -7917,9 +7917,9 @@ static void xferListAsciiStringUINT( Xfer *xfer, ListAsciiStringUINT *list ) unsignedIntData = it->second; xfer->xferUnsignedInt( &unsignedIntData ); - } // end for, it + } - } // end if, save + } else { PairAsciiStringUINT newPair; @@ -7931,7 +7931,7 @@ static void xferListAsciiStringUINT( Xfer *xfer, ListAsciiStringUINT *list ) DEBUG_CRASH(( "xferListAsciiStringUINT - list should be empty upon loading but is not" )); throw SC_INVALID_DATA; - } // end if + } // read each string for( UnsignedShort i = 0; i < count; ++i ) @@ -7948,11 +7948,11 @@ static void xferListAsciiStringUINT( Xfer *xfer, ListAsciiStringUINT *list ) newPair.second = unsignedIntData; list->push_back( newPair ); - } // end for, i + } - } // end else, load + } -} // end xferListAsciiStringUINT +} // ------------------------------------------------------------------------------------------------ /** Version Info: @@ -7992,9 +7992,9 @@ static void xferListAsciiStringObjectID( Xfer *xfer, ListAsciiStringObjectID *li objectID = it->second; xfer->xferObjectID( &objectID ); - } // end for, it + } - } // end if, save + } else { AsciiStringObjectIDPair newPair; @@ -8006,7 +8006,7 @@ static void xferListAsciiStringObjectID( Xfer *xfer, ListAsciiStringObjectID *li DEBUG_CRASH(( "xferListAsciiStringObjectID - list should be empty upon loading but is not" )); throw SC_INVALID_DATA; - } // end if + } // read each string for( UnsignedShort i = 0; i < count; ++i ) @@ -8023,11 +8023,11 @@ static void xferListAsciiStringObjectID( Xfer *xfer, ListAsciiStringObjectID *li newPair.second = objectID; list->push_back( newPair ); - } // end for, i + } - } // end else, load + } -} // end xferListAsciiStringObjectID +} // ------------------------------------------------------------------------------------------------ /** Version Info: @@ -8067,9 +8067,9 @@ static void xferListAsciiStringCoord3D( Xfer *xfer, ListAsciiStringCoord3D *list coord = it->second; xfer->xferCoord3D( &coord ); - } // end for, it + } - } // end if, save + } else { AsciiStringCoord3DPair newPair; @@ -8081,7 +8081,7 @@ static void xferListAsciiStringCoord3D( Xfer *xfer, ListAsciiStringCoord3D *list DEBUG_CRASH(( "xferListAsciiStringCoord3D - list should be empty upon loading but is not" )); throw SC_INVALID_DATA; - } // end if + } // read each string for( UnsignedShort i = 0; i < count; ++i ) @@ -8098,11 +8098,11 @@ static void xferListAsciiStringCoord3D( Xfer *xfer, ListAsciiStringCoord3D *list newPair.second = coord; list->push_back( newPair ); - } // end for, i + } - } // end else, load + } -} // ene xferListAsciiStringCoord3D +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -8149,9 +8149,9 @@ void ScriptEngine::xfer( Xfer *xfer ) // xfer data xfer->xferSnapshot( sequentialScript ); - } // end for, it + } - } // end if, save + } else { @@ -8162,7 +8162,7 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - m_sequentialScripts should be empty but is not" )); throw SC_INVALID_DATA; - } // end if + } // read each entry for( UnsignedShort i = 0; i < sequentialScriptCount; ++i ) @@ -8177,9 +8177,9 @@ void ScriptEngine::xfer( Xfer *xfer ) // xfer data xfer->xferSnapshot( sequentialScript ); - } // end for i + } - } // end else, load + } // counters UnsignedShort countersSize = m_numCounters; @@ -8190,7 +8190,7 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - MAX_COUNTERS has changed size, need to version this" )); throw SC_INVALID_DATA; - } // end if + } for( i = 0; i < countersSize; ++i ) { @@ -8203,7 +8203,7 @@ void ScriptEngine::xfer( Xfer *xfer ) // countdown timer xfer->xferBool( &m_counters[ i ].isCountdownTimer ); - } // end for, i + } // num counters xfer->xferInt( &m_numCounters ); @@ -8217,7 +8217,7 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - MAX_FLAGS has changed size, need to version this" )); throw SC_INVALID_DATA; - } // end if + } for( i = 0; i < flagsSize; ++i ) { @@ -8227,7 +8227,7 @@ void ScriptEngine::xfer( Xfer *xfer ) // name xfer->xferAsciiString( &m_flags[ i ].name ); - } // end for i + } // num flags xfer->xferInt( &m_numFlags ); @@ -8241,14 +8241,14 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - MAX_ATTACK_PRIORITIES size has changed, need to version this" )); throw SC_INVALID_DATA; - } // end if + } for( i = 0; i < attackPriorityInfoSize; ++i ) { // xfer each data xfer->xferSnapshot( &m_attackPriorityInfo[ i ] ); - } // end for i + } // num attack info xfer->xferInt( &m_numAttackInfo ); @@ -8280,9 +8280,9 @@ void ScriptEngine::xfer( Xfer *xfer ) objectID = obj ? obj->getID() : INVALID_ID; xfer->xferObjectID( &objectID ); - } // end for i + } - } // end if, save + } else { NamedRequest req; @@ -8309,16 +8309,16 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - Unable to find object by ID for m_namedObjects" )); throw SC_INVALID_DATA; - } // end if + } // assign req.first = namedObjectName; req.second = obj; m_namedObjects.push_back( req ); - } // end for, i + } - } // end else, load + } // first update xfer->xferBool( &m_firstUpdate ); @@ -8368,7 +8368,7 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - MAX_PLAYER_COUNT has changed, m_triggeredSpecialPowers size is now different and we must version this" )); throw SC_INVALID_DATA; - } // end if + } for( i = 0; i < triggeredSpecialPowersSize; ++i ) xferListAsciiStringObjectID( xfer, &m_triggeredSpecialPowers[ i ] ); @@ -8381,7 +8381,7 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - MAX_PLAYER_COUNT has changed, m_midwaySpecialPowers size is now different and we must version this" )); throw SC_INVALID_DATA; - } // end if + } for( i = 0; i < midwaySpecialPowersSize; ++i ) xferListAsciiStringObjectID( xfer, &m_midwaySpecialPowers[ i ] ); @@ -8394,7 +8394,7 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - MAX_PLAYER_COUNT has changed, m_finishedSpecialPowers size is now different and we must version this" )); throw SC_INVALID_DATA; - } // end if + } for( i = 0; i < finishedSpecialPowersSize; ++i ) xferListAsciiStringObjectID( xfer, &m_finishedSpecialPowers[ i ] ); @@ -8407,7 +8407,7 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - MAX_PLAYER_COUNT has changed, m_completedUpgrades size is now different and we must version this" )); throw SC_INVALID_DATA; - } // end if + } for( i = 0; i < completedUpgradesSize; ++i ) xferListAsciiStringObjectID( xfer, &m_completedUpgrades[ i ] ); @@ -8420,7 +8420,7 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - MAX_PLAYER_COUNT has changed, m_acquiredSciences size is now different and we must version this" )); throw SC_INVALID_DATA; - } // end if + } for( i = 0; i < acquiredSciencesSize; ++i ) xfer->xferScienceVec( &m_acquiredSciences[ i ] ); @@ -8472,9 +8472,9 @@ void ScriptEngine::xfer( Xfer *xfer ) // player name xfer->xferAsciiString( &it->m_playerName ); - } // end for, it + } - } // end if, save + } else { @@ -8485,7 +8485,7 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - m_namedReveals should be empty but is not!" )); throw SC_INVALID_DATA; - } // end if + } // read all entries NamedReveal reveal; @@ -8507,9 +8507,9 @@ void ScriptEngine::xfer( Xfer *xfer ) // put on list m_namedReveals.push_back( reveal ); - } // end for, i + } - } // end else, load + } // all object type lists size UnsignedShort allObjectTypesCount = m_allObjectTypeLists.size(); @@ -8531,9 +8531,9 @@ void ScriptEngine::xfer( Xfer *xfer ) // save object types xfer->xferSnapshot( objectTypes ); - } // end for, it + } - } // end if, save + } else { @@ -8544,7 +8544,7 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - m_allObjectTypeLists should be empty but is not!" )); throw SC_INVALID_DATA; - } // end if + } // read all data ObjectTypes *objectTypes; @@ -8560,11 +8560,11 @@ void ScriptEngine::xfer( Xfer *xfer ) // put on list m_allObjectTypeLists.push_back( objectTypes ); - } // end for, i + } - } // end else, load + } - } // end if, version 2 + } if (version >= 3) { xfer->xferBool(&m_objectsShouldReceiveDifficultyBonus); @@ -8599,7 +8599,7 @@ void ScriptEngine::xfer( Xfer *xfer ) m_curFadeValue = 0.0f; } } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -8618,7 +8618,7 @@ void ScriptEngine::loadPostProcess( void ) TheAudio->addAudioEvent(&event); } -} // end loadPostProcess +} //#if defined(RTS_DEBUG) void ScriptEngine::debugVictory( void ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp index cbb5d5fb7dc..261c82695d6 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp @@ -257,7 +257,7 @@ void ScriptList::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptList::xfer - Script list count has changed, attempting to recover.")); // throw SC_INVALID_DATA; try to recover. jba. - } // end if + } // all script data here for( script = getScript(); script; script = script->getNext() ) { @@ -286,7 +286,7 @@ void ScriptList::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptList::xfer - Script group count has changed, attempting to recover.")); - } // end if + } // all script group data for( scriptGroup = getScriptGroup(); scriptGroup; scriptGroup = scriptGroup->getNext() ) { @@ -667,7 +667,7 @@ ScriptGroup::~ScriptGroup(void) void ScriptGroup::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -695,7 +695,7 @@ void ScriptGroup::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptGroup::xfer - Script list count has changed, attempting to recover.")); // throw SC_INVALID_DATA; try to recover. jba. - } // end if + } // xfer script data for( script = getScript(); script; script = script->getNext() ) { @@ -712,7 +712,7 @@ void ScriptGroup::xfer( Xfer *xfer ) } } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -720,7 +720,7 @@ void ScriptGroup::xfer( Xfer *xfer ) void ScriptGroup::loadPostProcess( void ) { -} // end loadPostProcess +} /** ScriptGroup::duplicate - Creates a full, "deep" copy of ScriptGroup. @@ -940,7 +940,7 @@ Script::~Script(void) void Script::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -960,7 +960,7 @@ void Script::xfer( Xfer *xfer ) xfer->xferBool( &active ); setActive( active ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -968,7 +968,7 @@ void Script::xfer( Xfer *xfer ) void Script::loadPostProcess( void ) { -} // end loadPostProcess +} /** Script::duplicate - Creates a full, "deep" copy of script. Condition list and action diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/CaveSystem.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/CaveSystem.cpp index f83a816fec7..513f964b5ba 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/CaveSystem.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/CaveSystem.cpp @@ -156,9 +156,9 @@ void CaveSystem::xfer( Xfer *xfer ) tracker = *it; xfer->xferSnapshot( tracker ); - } // end + } - } // end if, save + } else { @@ -169,7 +169,7 @@ void CaveSystem::xfer( Xfer *xfer ) DEBUG_CRASH(( "CaveSystem::xfer - m_tunnelTrackerVector should be empty but is not" )); throw SC_INVALID_DATA; - } // end if + } // read each item for( UnsignedShort i = 0; i < count; ++i ) @@ -184,10 +184,10 @@ void CaveSystem::xfer( Xfer *xfer ) // put in vector m_tunnelTrackerVector.push_back( tracker ); - } // end for, i + } - } // end else, laod + } -} // end xfer +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/Damage.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/Damage.cpp index 3e380628919..25a65e0c3fc 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/Damage.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/Damage.cpp @@ -55,7 +55,7 @@ void DamageInfo::xfer( Xfer *xfer ) // xfer output xfer->xferSnapshot( &out ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -85,7 +85,7 @@ void DamageInfoInput::xfer( Xfer *xfer ) // amount xfer->xferReal( &m_amount ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -109,5 +109,5 @@ void DamageInfoOutput::xfer( Xfer *xfer ) // no effect xfer->xferBool( &m_noEffect ); -} // end xfer +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 483f86677e9..09edcd448d4 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -314,7 +314,7 @@ void GameLogic::destroyAllObjectsImmediate() processDestroyList(); DEBUG_ASSERTCRASH( m_objList == NULL, ("destroyAllObjectsImmediate: Object list not cleared") ); -} // end destroyAllObjectsImmediate +} //------------------------------------------------------------------------------------------------- /**GameLogic class destructor, the destruction order should mirror the @@ -497,7 +497,7 @@ void GameLogic::reset( void ) TheWaterTransparency = (WaterTransparencySetting*) wt->deleteOverrides(); m_rankPointsToAddAtGameStart = 0; -} // end reset +} static Object * placeObjectAtPosition(Int slotNum, AsciiString objectTemplateName, Coord3D& pos, Player *pPlayer, const PlayerTemplate *pTemplate) @@ -966,7 +966,7 @@ void GameLogic::updateLoadProgress( Int progress ) if( m_loadScreen ) m_loadScreen->update( progress ); -} // end updateLoadProgress +} // ------------------------------------------------------------------------------------------------ /** Delete the load screen */ @@ -980,9 +980,9 @@ void GameLogic::deleteLoadScreen( void ) delete m_loadScreen; m_loadScreen = NULL; - } // end if + } -} // end deleteLoadScreen +} void GameLogic::setGameLoading( Bool loading ) { @@ -1037,7 +1037,7 @@ void GameLogic::startNewGame( Bool saveGame ) DEBUG_CRASH(( "FATAL SAVE/LOAD ERROR! - Setting a pristine map name that refers to a map in the save directory. The pristine map should always refer to the ORIGINAL map in the Maps directory, if the pristine map string is corrupt then map.ini files will not load correctly." )); - } // end if + } if( m_startNewGame == FALSE ) { @@ -1067,7 +1067,7 @@ void GameLogic::startNewGame( Bool saveGame ) } - } // end if + } m_rankLevelLimit = 1000; // this is reset every game. setDefaults( saveGame ); @@ -1594,9 +1594,9 @@ void GameLogic::startNewGame( Bool saveGame ) // in the map object properties. // update this object instance with properties from the map object obj->updateObjValuesFromMapProperties( pMapObj->getProperties() ); - } // end if + } - } // for, loading bridge map objects + } // update the loadscreen updateLoadProgress(LOAD_PROGRESS_POST_BRIDGE_LOAD); @@ -1734,7 +1734,7 @@ void GameLogic::startNewGame( Bool saveGame ) team->setActive(); TheAI->pathfinder()->addObjectToPathfindMap( obj ); - } // end if + } if(timeGetTime() > timer + 500) { @@ -1744,9 +1744,9 @@ void GameLogic::startNewGame( Bool saveGame ) timer = timeGetTime(); } - } // for, loading map objects + } - } // end if, not loading save game + } #ifdef DUMP_PERF_STATS GetPrecisionTimer(&endTime64); @@ -2107,7 +2107,7 @@ void GameLogic::startNewGame( Bool saveGame ) } -} // end startNewGame +} //----------------------------------------------------------------------------------------- static void findAndSelectCommandCenter(Object *obj, void* alreadyFound) @@ -2346,7 +2346,7 @@ void GameLogic::processCommandList( CommandList *list ) } } -} // end processCommandList +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -3383,7 +3383,7 @@ void GameLogic::addObjectToLookupTable( Object *obj ) // add to lookup m_objHash[ obj->getID() ] = obj; -} // end addObjectToLookupTable +} // ------------------------------------------------------------------------------------------------ /** Remove object from the ID lookup table */ @@ -3398,7 +3398,7 @@ void GameLogic::removeObjectFromLookupTable( Object *obj ) // remove from lookup table m_objHash.erase( obj->getID() ); -} // end removeObjectFromLookupTable +} // ------------------------------------------------------------------------------------------------ /** Given an object, register it with the GameLogic and give it a unique ID. */ @@ -3513,7 +3513,7 @@ void GameLogic::destroyObject( Object *obj ) if( obj->isKindOf( KINDOF_WALK_ON_TOP_OF_WALL ) ) TheAI->pathfinder()->removeWallPiece( obj ); -} // end destroyObject +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -4071,7 +4071,7 @@ void GameLogic::getAIMetricsStatistics( UnsignedInt *numAI, UnsignedInt *numMovi void GameLogic::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Given a string name, find the object TOC entry (if any) associated with it */ @@ -4085,7 +4085,7 @@ GameLogic::ObjectTOCEntry *GameLogic::findTOCEntryByName( AsciiString name ) return NULL; -} // end findTOCEntryByname +} // ------------------------------------------------------------------------------------------------ /** Given a object TOC identifier, find the object TOC if any */ @@ -4099,7 +4099,7 @@ GameLogic::ObjectTOCEntry *GameLogic::findTOCEntryById( UnsignedShort id ) return NULL; -} // end findTOCEntryById +} // ------------------------------------------------------------------------------------------------ /** Add an object TOC entry */ @@ -4112,7 +4112,7 @@ void GameLogic::addTOCEntry( AsciiString name, UnsignedShort id ) tocEntry.id = id; m_objectTOC.push_back( tocEntry ); -} // end addTOCEntry +} // ------------------------------------------------------------------------------------------------ /** Xfer object table of contents */ @@ -4148,7 +4148,7 @@ void GameLogic::xferObjectTOC( Xfer *xfer ) // add this entry to the TOC addTOCEntry( obj->getTemplate()->getName(), ++tocCount ); - } // end for obj + } // xfer entries in the TOC xfer->xferUnsignedInt( &tocCount ); @@ -4168,9 +4168,9 @@ void GameLogic::xferObjectTOC( Xfer *xfer ) // xfer the paired id xfer->xferUnsignedShort( &tocEntry->id ); - } // end for + } - } // end if + } else { AsciiString templateName; @@ -4192,11 +4192,11 @@ void GameLogic::xferObjectTOC( Xfer *xfer ) // add this to the TOC addTOCEntry( templateName, id ); - } // end for i + } - } // end else + } -} // end xferObjectTOC +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -4243,21 +4243,21 @@ void GameLogic::prepareLogicForObjectLoad( void ) destroyObject( oldTower ); } - } // end for, i + } // destroy the old bridge object destroyObject( oldObject ); - } // end if, bridge + } else if( obj->isKindOf( KINDOF_WALK_ON_TOP_OF_WALL ) ) { // destroy walk on top of wall things too destroyObject( obj ); - } // end else if + } - } // end for, obj + } // process the destruction of these objects immediately before we proceed with the load process processDestroyList(); @@ -4267,7 +4267,7 @@ void GameLogic::prepareLogicForObjectLoad( void ) ("GameLogic::prepareLogicForObjectLoad - There are still objects loaded in the engine, but it should be empty (Top is '%s')", getFirstObject()->getTemplate()->getName().str()) ); -} // end prepareLogicForObjectLoad +} // ------------------------------------------------------------------------------------------------ /** Load/Save game logic to xfer @@ -4330,7 +4330,7 @@ void GameLogic::xfer( Xfer *xfer ) DEBUG_CRASH(( "GameLogic::xfer - Object TOC entry not found for '%s'", obj->getTemplate()->getName().str() )); throw SC_INVALID_DATA; - } // end if + } // transfer TOC id entry xfer->xferUnsignedShort( &tocEntry->id ); @@ -4344,9 +4344,9 @@ void GameLogic::xfer( Xfer *xfer ) // end a block of data xfer->endBlock(); - } // end for + } - } // end if, save + } else { Team *defaultTeam = ThePlayerList->getNeutralPlayer()->getDefaultTeam(); @@ -4370,7 +4370,7 @@ void GameLogic::xfer( Xfer *xfer ) DEBUG_CRASH(( "GameLogic::xfer - No TOC entry match for id '%d'", tocID )); throw SC_INVALID_DATA; - } // end if + } // a block of data has begun objectDataSize = xfer->beginBlock(); @@ -4385,7 +4385,7 @@ void GameLogic::xfer( Xfer *xfer ) xfer->skip( objectDataSize ); continue; - } // end if + } // create new object obj = TheThingFactory->newObject( thingTemplate, defaultTeam ); @@ -4400,9 +4400,9 @@ void GameLogic::xfer( Xfer *xfer ) if( obj->isKindOf( KINDOF_WALK_ON_TOP_OF_WALL ) ) TheAI->pathfinder()->addWallPiece( obj ); - } // end for, i + } - } // end else + } // campaign info xfer->xferSnapshot( TheCampaignManager ); @@ -4441,7 +4441,7 @@ void GameLogic::xfer( Xfer *xfer ) sanityTriggerCount, triggerCount )); throw SC_INVALID_DATA; - } // end if + } // xfer each of the polygon triggers if( xfer->getXferMode() == XFER_SAVE ) @@ -4458,9 +4458,9 @@ void GameLogic::xfer( Xfer *xfer ) // xfer polygon data xfer->xferSnapshot( poly ); - } // end for, poly + } - } // end if, save + } else { Int triggerID; @@ -4483,12 +4483,12 @@ void GameLogic::xfer( Xfer *xfer ) triggerID )); throw SC_INVALID_DATA; - } // end if + } // xfer polygon data xfer->xferSnapshot( poly ); - } // end for, i + } // // force a recalculation of the pathfinding cause some of these polygon triggers @@ -4497,9 +4497,9 @@ void GameLogic::xfer( Xfer *xfer ) // TheAI->pathfinder()->newMap(); - } // end else, load + } - } // end if, version >= 3 + } // note that version=4 is the same as version=3 if (version >= 5) @@ -4598,7 +4598,7 @@ void GameLogic::xfer( Xfer *xfer ) xfer->xferInt(&m_rankPointsToAddAtGameStart); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process entry point */ @@ -4671,13 +4671,13 @@ void GameLogic::loadPostProcess( void ) u->friend_setIndexInLogic(m_sleepyUpdates.size() - 1); } - } // end for, u + } - } // end for, obj + } // re-sort the priority queue all at once now that all modules are on it remakeSleepyUpdate(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index 59b11397df7..b2f16ae9fcc 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -164,11 +164,11 @@ static void doSetRallyPoint( Object *obj, const Coord3D& pos ) rallyNotSet.setPlayerIndex(obj->getControllingPlayer()->getPlayerIndex()); TheAudio->addAudioEvent(&rallyNotSet); - } // end if + } return; - } // end if + } // feedback to the player if( isLocalPlayer ) @@ -191,7 +191,7 @@ static void doSetRallyPoint( Object *obj, const Coord3D& pos ) if( draw && draw->isSelected() ) TheControlBar->markUIDirty(); - } // end if + } // if this object has a ProductionExitUpdate interface, we are setting a rally point ExitInterface *exitInterface = obj->getObjectExitInterface(); @@ -329,7 +329,7 @@ void GameLogic::prepareNewGame( GameMode gameMode, GameDifficulty diff, Int rank m_startNewGame = FALSE; -} // end prepareNewGame +} //------------------------------------------------------------------------------------------------- /** This message handles dispatches object command messages to the @@ -439,7 +439,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end new game + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_CLEAR_GAME_DATA: @@ -462,7 +462,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) TheGameLogic->clearGameData(); break; - } // end clear game data + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_META_BEGIN_PATH_BUILD: @@ -552,7 +552,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end GameMessage::MSG_COMBATDROP_AT_OBJECT + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_COMBATDROP_AT_LOCATION: @@ -575,7 +575,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end GameMessage::MSG_COMBATDROP_AT_LOCATION + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_WEAPON_AT_OBJECT: @@ -597,10 +597,10 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // lock it just till the weapon is empty or the attack is "done" if (currentlySelectedGroup->setWeaponLockForGroup( weaponSlot, LOCKED_TEMPORARILY )) currentlySelectedGroup->groupAttackObject( targetObject, maxShotsToFire, CMD_FROM_PLAYER ); - } // end if, command for group + } break; - } // end do weapon at object + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_SWITCH_WEAPONS: @@ -638,11 +638,11 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) currentlySelectedGroup->groupAttackPosition( &targetLoc, maxShotsToFire, CMD_FROM_PLAYER ); - } // end if, command for group + } break; - } //end do weapon at location + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_SPECIAL_POWER: @@ -678,7 +678,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) } break; - } // end do special + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_SPECIAL_POWER_AT_LOCATION: @@ -720,7 +720,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) } break; - } // end do special at location + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_SPECIAL_POWER_AT_OBJECT: @@ -762,7 +762,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) } break; - } // end do special at object + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_ATTACKMOVETO: @@ -988,7 +988,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end GameMessage::MSG_ENTER + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_EXIT: @@ -1023,7 +1023,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end GameMessage::MSG_EXIT + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_EVACUATE: @@ -1050,11 +1050,11 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // no, this is bad, don't do here, do when POSTING message // pickAndPlayUnitVoiceResponse( TheInGameUI->getAllSelectedDrawables(), GameMessage::MSG_EVACUATE ); - } // end if, command for group + } break; - } // end GameMessage::MSG_EVACUATE + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_EXECUTE_RAILED_TRANSPORT: @@ -1066,7 +1066,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end GameMessage::MSG_EXECUTE_RAILED_TRANSPORT + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_INTERNET_HACK: @@ -1095,7 +1095,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end get repaired + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_DOCK: @@ -1112,7 +1112,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end get repaired + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_GET_HEALED: @@ -1129,7 +1129,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end get repaired + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_REPAIR: @@ -1149,7 +1149,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end get repaired + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_RESUME_CONSTRUCTION: @@ -1173,7 +1173,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end resume construction + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_SPECIAL_POWER_OVERRIDE_DESTINATION: @@ -1204,7 +1204,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end GameMessage::MSG_DO_SPECIAL_POWER_OVERRIDE_DESTINATION + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_ATTACK_OBJECT: @@ -1226,7 +1226,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end GameMessage::MSG_DO_ATTACK_OBJECT + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_FORCE_ATTACK_OBJECT: @@ -1246,7 +1246,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end GameMessage::MSG_DO_FORCE_ATTACK_OBJECT + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_FORCE_ATTACK_GROUND: @@ -1285,7 +1285,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end GameMessage::MSG_DO_FORCE_ATTACK_GROUND + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_QUEUE_UPGRADE: @@ -1299,7 +1299,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end queue upgrade + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_CANCEL_UPGRADE: @@ -1329,7 +1329,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end cancel upgrade + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_QUEUE_UNIT_CREATE: @@ -1359,14 +1359,14 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) producer->getTemplate()->getName().str()) ); break; - } // end if + } // queue the build pu->queueCreateUnit( whatToCreate, productionID ); break; - } // end GameMessage::MSG_QUEUE_UNIT_CREATE + } //------------------------------------------------------------------------------------------------- case GameMessage::MSG_CANCEL_UNIT_CREATE: @@ -1396,7 +1396,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end GameMessage::MSG_CANCEL_UNIT_CREATE + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DOZER_CONSTRUCT: @@ -1425,7 +1425,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) TheBuildAssistant->buildObjectNow( constructorObject, place, &loc, angle, constructorObject->getControllingPlayer() ); - } // end if + } else { Coord3D locEnd; @@ -1437,7 +1437,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) TheBuildAssistant->buildObjectLineNow( constructorObject, place, &loc, &locEnd, angle, constructorObject->getControllingPlayer() ); - } // end else + } // place the sound for putting a building down @@ -1451,7 +1451,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end build start + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DOZER_CANCEL_CONSTRUCT: @@ -1491,7 +1491,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end cancel dozer construction + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_SELL: @@ -1503,7 +1503,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end sell + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_TOGGLE_OVERCHARGE: @@ -1515,7 +1515,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end toggle overcharge + } #ifdef ALLOW_SURRENDER // -------------------------------------------------------------------------------------------- @@ -1530,11 +1530,11 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) if( currentlySelectedGroup ) currentlySelectedGroup->groupPickUpPrisoner( prisoner, CMD_FROM_PLAYER ); - } // end if + } break; - } // end pick up prisoner + } #endif #ifdef ALLOW_SURRENDER @@ -1548,7 +1548,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end return to prison + } #endif //--------------------------------------------------------------------------------------------- @@ -1578,7 +1578,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end build start + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_REMOVE_FROM_SELECTED_GROUP: @@ -1602,7 +1602,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end MSG_REMOVE_FROM_SELECTED_GROUP + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DESTROY_SELECTED_GROUP: @@ -1615,7 +1615,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end build start + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_SELECTED_GROUP_COMMAND: @@ -1623,7 +1623,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end selected group command + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_PLACE_BEACON: @@ -1718,7 +1718,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) TheAudio->addAudioEvent(&aSound); } break; - } // end beacon placement + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_REMOVE_BEACON: @@ -1783,7 +1783,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) #endif } break; - } // end beacon removal + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_SET_BEACON_TEXT: @@ -1814,7 +1814,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) } } break; - } // end beacon text + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_SELF_DESTRUCT: @@ -1883,7 +1883,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) } } break; - } // end beacon text + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_CREATE_TEAM0: @@ -1906,7 +1906,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) player->processCreateTeamGameMessage(msg->getType() - GameMessage::MSG_CREATE_TEAM0, msg); break; - } // end create team command + } case GameMessage::MSG_SELECT_TEAM0: case GameMessage::MSG_SELECT_TEAM1: @@ -2004,7 +2004,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) } break; - } // end CRC message + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_PURCHASE_SCIENCE: @@ -2019,9 +2019,9 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end pick specialized science + } - } // end switch + } #if RETAIL_COMPATIBLE_AIGROUP // TheSuperHackers @bugfix xezon 28/06/2025 This hack avoids crashing when players are selected during Replay playback. @@ -2058,4 +2058,4 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) #endif } -} // end logicMessageDispatches +} diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameInfo.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameInfo.cpp index c499fb085a0..340e2c079a8 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameInfo.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameInfo.cpp @@ -211,7 +211,7 @@ void GameSlot::setState( SlotState state, UnicodeString name, UnsignedInt IP ) reset(); m_state = state; m_name = name; - }// state == SLOT_PLAYER + } else { m_state = state; @@ -1252,7 +1252,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) } newSlot[i].setNATBehavior(NATType); DEBUG_LOG(("ParseAsciiStringToGameInfo - NAT behavior is %X", NATType)); - }// case 'H': + } break; case 'C': { @@ -1293,7 +1293,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) DEBUG_LOG(("ParseAsciiStringToGameInfo - Unknown AI, quitting")); } break; - }//switch(*rawSlot.str()+1) + } //Read color index slotValue = strtok_r(NULL,",",&slotPos); @@ -1379,19 +1379,19 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) newSlot[i].setTeamNumber(team); //DEBUG_LOG(("ParseAsciiStringToGameInfo - team number is %d", team)); - }//case 'C': + } break; case 'O': { newSlot[i].setState( SLOT_OPEN ); //DEBUG_LOG(("ParseAsciiStringToGameInfo - Slot is open")); - }// case 'O': + } break; case 'X': { newSlot[i].setState( SLOT_CLOSED ); //DEBUG_LOG(("ParseAsciiStringToGameInfo - Slot is closed")); - }// case 'X': + } break; default: { @@ -1452,7 +1452,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) // ------------------------------------------------------------------------------------------------ void SkirmishGameInfo::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1539,13 +1539,13 @@ void SkirmishGameInfo::xfer( Xfer *xfer ) xfer->xferInt(&m_seed); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void SkirmishGameInfo::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp index c6ba4a2b6ac..deb518bd9e8 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp @@ -246,7 +246,7 @@ void GameSpyInfo::addChat( PlayerInfo p, UnicodeString msg, Bool isPublic, Bool if( TheAudio ) { TheAudio->addAudioEvent( &privMsgAudio ); - } // end if + } } } diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/GameResultsThread.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/GameResultsThread.cpp index 95b006aa032..a00893ea80a 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/GameResultsThread.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/GameResultsThread.cpp @@ -219,7 +219,7 @@ static void WrapHTTP( const std::string& hostname, std::string& results ) char szHdr[256]; snprintf( szHdr, 256, HEADER, hostname.c_str(), results.length() ); results = szHdr + results; -} //WrapHTTP +} //------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpyOverlay.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpyOverlay.cpp index 2be3b5ccae8..8fb7330c9fb 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpyOverlay.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpyOverlay.cpp @@ -214,7 +214,7 @@ void GameSpyOpenOverlay( GSOverlayType overlay ) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } } if (overlayLayouts[overlay]) { diff --git a/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp b/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp index 7121c0f6a38..56c6eeb8477 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp @@ -425,7 +425,7 @@ void LANAPI::update( void ) // Mark it as read m_transport->m_inBuffer[i].length = 0; } - } // End message handling + } if(LANbuttonPushed) return; // Send out periodic I'm Here messages @@ -1024,7 +1024,7 @@ void LANAPI::RequestSlotList( void ) sendMessage(&reply); OnSlotList(LANAPIInterface::RET_OK, m_currentGame); -} // void LANAPI::RequestSlotList( void ) +} */ void LANAPI::RequestSetName( UnicodeString newName ) { diff --git a/Generals/Code/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp b/Generals/Code/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp index eaecc83b12d..1f3ef4291cc 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp @@ -109,14 +109,14 @@ void LANAPI::OnAccept( UnsignedInt playerIP, Bool status ) else m_currentGame->getLANSlot(i)->unAccept(); break; - }// if - }// for + } + } if (i != MAX_SLOTS ) { RequestGameOptions( GenerateGameOptionsString(), false ); lanUpdateSlotList(); } - }//if + } else { //i'm not the host but if the accept came from the host... @@ -127,7 +127,7 @@ void LANAPI::OnAccept( UnsignedInt playerIP, Bool status ) OnChat(UnicodeString(L"SYSTEM"), m_localIP, text, LANCHAT_SYSTEM); } } -}// void LANAPI::OnAccept( UnicodeString player, Bool status ) +} void LANAPI::OnHasMap( UnsignedInt playerIP, Bool status ) { @@ -140,8 +140,8 @@ void LANAPI::OnHasMap( UnsignedInt playerIP, Bool status ) { m_currentGame->getLANSlot(i)->setMapAvailability( status ); break; - }// if - }// for + } + } if (i != MAX_SLOTS ) { UnicodeString mapDisplayName; @@ -169,8 +169,8 @@ void LANAPI::OnHasMap( UnsignedInt playerIP, Bool status ) } lanUpdateSlotList(); } - }//if -}// void LANAPI::OnHasMap( UnicodeString player, Bool status ) + } +} void LANAPI::OnGameStartTimer( Int seconds ) { @@ -587,7 +587,7 @@ void LANAPI::OnGameList( LANGameInfo *gameList ) { LANDisplayGameList(listboxGames, gameList); } -}//void LANAPI::OnGameList( LANGameInfo *gameList ) +} void LANAPI::OnGameCreate( ReturnType ret ) { @@ -618,7 +618,7 @@ void LANAPI::OnGameCreate( ReturnType ret ) } } -}//void OnGameCreate( ReturnType ret ) +} void LANAPI::OnPlayerList( LANPlayer *playerList ) { diff --git a/Generals/Code/GameEngine/Source/GameNetwork/NetCommandMsg.cpp b/Generals/Code/GameEngine/Source/GameNetwork/NetCommandMsg.cpp index 0ec0cc57349..29b62d59958 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/NetCommandMsg.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/NetCommandMsg.cpp @@ -161,7 +161,7 @@ static Int indexFromMask(UnsignedInt mask) player = ThePlayerList->getNthPlayer( i ); if( player && player->getPlayerMask() == mask ) return i; - } // end for i + } return -1; } diff --git a/Generals/Code/GameEngine/Source/GameNetwork/NetPacket.cpp b/Generals/Code/GameEngine/Source/GameNetwork/NetPacket.cpp index 6ce456ff9e8..09f4aab429c 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/NetPacket.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/NetPacket.cpp @@ -362,7 +362,7 @@ UnsignedInt NetPacket::GetGameCommandSize(NetCommandMsg *msg) { GameMessageArgumentDataType type = arg->getType(); switch (type) { - + case ARGUMENTDATATYPE_INTEGER: msglen += arg->getArgCount() * sizeof(Int); break; diff --git a/Generals/Code/GameEngine/Source/GameNetwork/Transport.cpp b/Generals/Code/GameEngine/Source/GameNetwork/Transport.cpp index 880ce4bca55..c26ddd76a8d 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/Transport.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/Transport.cpp @@ -243,7 +243,7 @@ Bool Transport::doSend() { //DEBUG_LOG(("Transport::doSend returning FALSE")); } } - } // for (i=0; igetZoom(); m_reconstructViewBox = FALSE; -} // end reconstructViewBox +} //------------------------------------------------------------------------------------------------- /** Convert radar position to actual pixel coord */ @@ -243,7 +243,7 @@ void W3DRadar::radarToPixel( const ICoord2D *radar, ICoord2D *pixel, // note the "inverted" y here to orient the way our world looks with +x=right and -y=down pixel->y = ((RADAR_CELL_HEIGHT - 1 - radar->y) * radarHeight / RADAR_CELL_HEIGHT) + radarUpperLeftY; -} // end radarToPixel +} //------------------------------------------------------------------------------------------------- @@ -362,7 +362,7 @@ void W3DRadar::drawViewBox( Int pixelX, Int pixelY, Int width, Int height ) TheDisplay->drawLine( clipStart.x, clipStart.y, clipEnd.x, clipEnd.y, lineWidth, bottomColor, topColor ); -} // end drawViewBox +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -437,7 +437,7 @@ void W3DRadar::drawSingleBeaconEvent( Int pixelX, Int pixelY, Int width, Int hei a = REAL_TO_UNSIGNEDBYTE( (Real)a * (1.0f - (Real)(currentFrame - event->fadeFrame) / (Real)(event->dieFrame - event->fadeFrame) ) ); - } // end if + } startColor = GameMakeColor( r, g, b, a ); // color 2 ------------------ @@ -451,7 +451,7 @@ void W3DRadar::drawSingleBeaconEvent( Int pixelX, Int pixelY, Int width, Int hei a = REAL_TO_UNSIGNEDBYTE( (Real)a * (1.0f - (Real)(currentFrame - event->fadeFrame) / (Real)(event->dieFrame - event->fadeFrame) ) ); - } // end if + } endColor = GameMakeColor( r, g, b, a ); // draw the lines @@ -536,7 +536,7 @@ void W3DRadar::drawSingleGenericEvent( Int pixelX, Int pixelY, Int width, Int he a = REAL_TO_UNSIGNEDBYTE( (Real)a * (1.0f - (Real)(currentFrame - event->fadeFrame) / (Real)(event->dieFrame - event->fadeFrame) ) ); - } // end if + } startColor = GameMakeColor( r, g, b, a ); // color 2 ------------------ @@ -550,7 +550,7 @@ void W3DRadar::drawSingleGenericEvent( Int pixelX, Int pixelY, Int width, Int he a = REAL_TO_UNSIGNEDBYTE( (Real)a * (1.0f - (Real)(currentFrame - event->fadeFrame) / (Real)(event->dieFrame - event->fadeFrame) ) ); - } // end if + } endColor = GameMakeColor( r, g, b, a ); // draw the lines @@ -582,7 +582,7 @@ void W3DRadar::drawEvents( Int pixelX, Int pixelY, Int width, Int height ) static AudioEventRTS eventSound("RadarEvent"); TheAudio->addAudioEvent( &eventSound ); - } // end if + } m_event[ i ].soundPlayed = TRUE; @@ -591,11 +591,11 @@ void W3DRadar::drawEvents( Int pixelX, Int pixelY, Int width, Int height ) else drawSingleGenericEvent( pixelX, pixelY, width, height, i ); - } // end if + } - } // end for i + } -} // end drawEvents +} //------------------------------------------------------------------------------------------------- @@ -717,7 +717,7 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text a = REAL_TO_UNSIGNEDBYTE( (alphaScale * (255.0f - minAlpha)) + minAlpha ); c = GameMakeColor( r, g, b, a ); - } // end if + } @@ -738,10 +738,10 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text if( legalRadarPoint( radarPoint.x, radarPoint.y ) ) surface->DrawPixel( radarPoint.x, radarPoint.y, c ); - } // end for + } REF_PTR_RELEASE(surface); -} // end renderObjectList +} //------------------------------------------------------------------------------------------------- /** Shade the color passed in using the height parameter to lighten and darken it. Colors @@ -781,7 +781,7 @@ void W3DRadar::interpolateColorForHeight( RGBColor *color, colorTarget.green = color->green + (1.0f - color->green) * howBright; colorTarget.blue = color->blue + (1.0f - color->blue) * howBright; - } // end if + } else // interpolate darker { @@ -793,7 +793,7 @@ void W3DRadar::interpolateColorForHeight( RGBColor *color, colorTarget.green = color->green + (0.0f - color->green) * howDark; colorTarget.blue = color->blue + (0.0f - color->blue) * howDark; - } // end else + } // interpolate toward the target color color->red = color->red + (colorTarget.red - color->red) * t; @@ -814,7 +814,7 @@ void W3DRadar::interpolateColorForHeight( RGBColor *color, if( color->blue > 1.0f ) color->blue = 1.0f; -} // end interpolateColorForHeight +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC METHODS ///////////////////////////////////////////////////////////////////////////////// @@ -849,9 +849,9 @@ W3DRadar::W3DRadar( void ) m_viewBox[ i ].x = 0; m_viewBox[ i ].y = 0; - } // end for + } -} // end W3DRadar +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -861,7 +861,7 @@ W3DRadar::~W3DRadar( void ) // delete resources used for the W3D radar deleteResources(); -} // end ~W3DRadar +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -959,7 +959,7 @@ void W3DRadar::init( void ) size.y = m_textureHeight; m_shroudImage->setImageSize( &size ); -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset the radar to the initial empty state ready for new data */ @@ -993,7 +993,7 @@ void W3DRadar::reset( void ) //gs Dude, it's called CLEARshroud. It needs to clear the shroud. clearShroud(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update */ @@ -1004,7 +1004,7 @@ void W3DRadar::update( void ) // extend base class Radar::update(); -} // end update +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1056,7 +1056,7 @@ void W3DRadar::newMap( TerrainLogic *terrain ) // build terrain texture buildTerrainTexture( terrain ); -} // end newMap +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1113,9 +1113,9 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain ) if( body->getDamageState() != BODY_RUBBLE ) workingBridge = TRUE; - } // end if + } - } // end if + } // create a color based on the Z height of the map Real waterZ; @@ -1165,15 +1165,15 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain ) sampleColor.blue += color.blue; samples++; - } // end if + } - } // end if + } - } // end for i + } - } // end if + } - } // end for j + } // prevent divide by zeros if( samples == 0 ) @@ -1184,7 +1184,7 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain ) color.green = sampleColor.green / (Real)samples; color.blue = sampleColor.blue / (Real)samples; - } // end if + } else // regular terrain ... { const Int samplesAway = 1; // how many "tiles" from the center tile we will sample away @@ -1238,7 +1238,7 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain ) getTerrainAverageZ(), m_mapExtent.hi.z, m_mapExtent.lo.z ); - } // end if + } else { @@ -1249,7 +1249,7 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain ) interpolateColorForHeight( &color, z, getTerrainAverageZ(), m_mapExtent.hi.z, m_mapExtent.lo.z ); - } // end else + } // add color to our samples sampleColor.red += color.red; @@ -1257,13 +1257,13 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain ) sampleColor.blue += color.blue; samples++; - } // end if + } - } // end for i + } - } // end if + } - } // end for j + } // prevent divide by zeros if( samples == 0 ) @@ -1274,7 +1274,7 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain ) color.green = sampleColor.green / (Real)samples; color.blue = sampleColor.blue / (Real)samples; - } // end else + } // // draw the pixel for the terrain at this point, note that because of the orientation @@ -1290,14 +1290,14 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain ) color.blue * 255, 255 ) ); - } // end for x + } - } // end for y + } // all done with the surface REF_PTR_RELEASE(surface); -} // end buildTerrainTexture +} // ------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------- @@ -1426,7 +1426,7 @@ void W3DRadar::draw( Int pixelX, Int pixelY, Int width, Int height ) TheDisplay->drawLine(pixelX, ul.y, pixelX + width, ul.y, 1, lineColor); TheDisplay->drawLine(pixelX, lr.y + 1, pixelX + width, lr.y + 1, 1, lineColor); - } // end if + } else { @@ -1436,7 +1436,7 @@ void W3DRadar::draw( Int pixelX, Int pixelY, Int width, Int height ) TheDisplay->drawLine(ul.x, pixelY, ul.x, pixelY + height, 1, lineColor); TheDisplay->drawLine(lr.x + 1, pixelY, lr.x + 1, pixelY + height, 1, lineColor); - } // end else + } // draw the terrain texture TheDisplay->drawImage( m_terrainImage, ul.x, ul.y, lr.x, lr.y ); @@ -1454,7 +1454,7 @@ void W3DRadar::draw( Int pixelX, Int pixelY, Int width, Int height ) renderObjectList( getObjectList(), m_overlayTexture ); renderObjectList( getLocalObjectList(), m_overlayTexture, TRUE ); - } // end if + } // draw the overlay image TheDisplay->drawImage( m_overlayImage, ul.x, ul.y, lr.x, lr.y ); @@ -1487,7 +1487,7 @@ void W3DRadar::draw( Int pixelX, Int pixelY, Int width, Int height ) // draw the view region on top of the radar reconstructing if necessary drawViewBox( ul.x, ul.y, scaledWidth, scaledHeight ); -} // end draw +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1500,7 +1500,7 @@ void W3DRadar::refreshTerrain( TerrainLogic *terrain ) // rebuild the entire terrain texture buildTerrainTexture( terrain ); -} // end refreshTerrain +} @@ -1607,7 +1607,7 @@ void W3DRadar::refreshTerrain( TerrainLogic *terrain ) a = REAL_TO_UNSIGNEDBYTE( (alphaScale * (255.0f - minAlpha)) + minAlpha ); c = GameMakeColor( r, g, b, a ); - } // end if + } @@ -1631,10 +1631,10 @@ void W3DRadar::refreshTerrain( TerrainLogic *terrain ) - } // end for + } REF_PTR_RELEASE(surface); -} // end renderObjectList +} * diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/Thing/W3DModuleFactory.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/Thing/W3DModuleFactory.cpp index 7b8bdc0df67..21cdc985c92 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/Thing/W3DModuleFactory.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/Thing/W3DModuleFactory.cpp @@ -71,4 +71,4 @@ void W3DModuleFactory::init( void ) addModule( W3DTracerDraw ); addModule( W3DTankTruckDraw ); -} // end init +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/Thing/W3DThingFactory.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/Thing/W3DThingFactory.cpp index b0c331143f7..3da7098e715 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/Thing/W3DThingFactory.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/Thing/W3DThingFactory.cpp @@ -37,12 +37,12 @@ W3DThingFactory::W3DThingFactory( void ) { -} // end W3DThingFactory +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- W3DThingFactory::~W3DThingFactory( void ) { -} // end ~W3DThingFactory +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/W3DConvert.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/W3DConvert.cpp index f440ee58089..f32700d30e7 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/W3DConvert.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/W3DConvert.cpp @@ -90,7 +90,7 @@ void W3DLogicalScreenToPixelScreen( Real logX, Real logY, *screenX = REAL_TO_INT((screenWidth * (logX + 1.0f)) / 2.0f); *screenY = REAL_TO_INT((screenHeight * (-logY + 1.0f)) / 2.0f); -} // end W3DLogicalScreenToPixelScreen +} //============================================================================= // PixelScreenToW3DLogicalScreen @@ -107,4 +107,4 @@ void PixelScreenToW3DLogicalScreen( Int screenX, Int screenY, *logX = ((2.0f * screenX) / (Real)screenWidth) - 1.0f; *logY = -(((2.0f * screenY) / (Real)screenHeight) - 1.0f); -} // end PixelScreenToW3DLogicalScreen +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDebrisDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDebrisDraw.cpp index 58480048ee7..664d9bbe058 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDebrisDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDebrisDraw.cpp @@ -270,7 +270,7 @@ void W3DDebrisDraw::crc( Xfer *xfer ) // extend base class DrawModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -320,7 +320,7 @@ void W3DDebrisDraw::xfer( Xfer *xfer ) // final stop xfer->xferBool( &m_finalStop ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -331,4 +331,4 @@ void W3DDebrisDraw::loadPostProcess( void ) // extend base class DrawModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp index 5d52f8d6d07..e07a19a7ca3 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp @@ -170,7 +170,7 @@ void W3DDefaultDraw::crc( Xfer *xfer ) // extend base class DrawModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -188,7 +188,7 @@ void W3DDefaultDraw::xfer( Xfer *xfer ) // extend base class DrawModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -199,4 +199,4 @@ void W3DDefaultDraw::loadPostProcess( void ) // extend base class DrawModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDependencyModelDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDependencyModelDraw.cpp index 6cd0467ad2f..a0151a6016e 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDependencyModelDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDependencyModelDraw.cpp @@ -138,7 +138,7 @@ void W3DDependencyModelDraw::crc( Xfer *xfer ) // extend base class W3DModelDraw::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -159,7 +159,7 @@ void W3DDependencyModelDraw::xfer( Xfer *xfer ) // Dependency status xfer->xferBool( &m_dependencyCleared ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -170,6 +170,6 @@ void W3DDependencyModelDraw::loadPostProcess( void ) // extend base class W3DModelDraw::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DLaserDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DLaserDraw.cpp index 5760328c829..c79b154f017 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DLaserDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DLaserDraw.cpp @@ -206,9 +206,9 @@ W3DLaserDraw::W3DLaserDraw( Thing *thing, const ModuleData* moduleData ) : } - } // end for i + } - } //end segment loop + } } @@ -228,7 +228,7 @@ W3DLaserDraw::~W3DLaserDraw( void ) // delete line REF_PTR_RELEASE( m_line3D[ i ] ); - } // end for i + } delete [] m_line3D; // TheSuperHackers @fix Mauller 11/03/2025 Free reference counted material @@ -428,7 +428,7 @@ void W3DLaserDraw::crc( Xfer *xfer ) // extend base class DrawModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -449,7 +449,7 @@ void W3DLaserDraw::xfer( Xfer *xfer ) // Kris says there is no data to save for these, go ask him. // m_selfDirty is not saved, is runtime only -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -462,4 +462,4 @@ void W3DLaserDraw::loadPostProcess( void ) m_selfDirty = true; // so we update the first time after reload -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp index 3830c3e3034..022f359a548 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp @@ -823,7 +823,7 @@ void ModelConditionInfo::validateWeaponBarrelInfo() const CRCDEBUG_LOG(("validateWeaponBarrelInfo() - model name %s (unadorned) found nothing", m_modelName.str())); BONEPOS_LOG(("validateWeaponBarrelInfo() - model name %s (unadorned) found nothing", m_modelName.str())); } - } // if empty + } DEBUG_ASSERTCRASH(!(m_modelName.isNotEmpty() && m_weaponBarrelInfoVec[wslot].empty()), ("*** ASSET ERROR: No fx bone named '%s' found in model %s!",fxBoneName.str(),m_modelName.str())); } @@ -2413,7 +2413,7 @@ void W3DModelDraw::handleClientTurretPositioning() } } } - } // next tslot + } } @@ -2660,7 +2660,7 @@ Bool W3DModelDraw::updateBonesForClientParticleSystems() } } - }// end if Drawable + } return TRUE; @@ -3146,7 +3146,7 @@ void W3DModelDraw::setSelectable(Bool selectable) current &= ~PICK_TYPE_SELECTABLE; } m_renderObject->Set_Collision_Type(current); - } // end if + } } //------------------------------------------------------------------------------------------------- @@ -3907,7 +3907,7 @@ void W3DModelDraw::crc( Xfer *xfer ) // extend base class DrawModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -3955,9 +3955,9 @@ void W3DModelDraw::xfer( Xfer *xfer ) weaponRecoilInfo.m_recoilRate = (*it).m_recoilRate; xfer->xferReal( &weaponRecoilInfo.m_recoilRate ); - } // end for, it + } - } // end if, save + } else { @@ -3980,11 +3980,11 @@ void W3DModelDraw::xfer( Xfer *xfer ) // stuff it in the vector m_weaponRecoilInfoVec[ i ].push_back( weaponRecoilInfo ); - } // end for, j + } - } // end else, load + } - } // end for, i + } // sub object vector UnsignedByte subObjectCount = m_subObjectVec.size(); @@ -4005,9 +4005,9 @@ void W3DModelDraw::xfer( Xfer *xfer ) hideShowSubObjInfo.hide = (*it).hide; xfer->xferBool( &hideShowSubObjInfo.hide ); - } // end for, it + } - } // end if, save + } else { @@ -4027,9 +4027,9 @@ void W3DModelDraw::xfer( Xfer *xfer ) // stuff in vector m_subObjectVec.push_back( hideShowSubObjInfo ); - } // end for, i + } - } // end else, load + } // animation if( version >= 2 ) @@ -4071,9 +4071,9 @@ void W3DModelDraw::xfer( Xfer *xfer ) Real percent = frame / INT_TO_REAL( anim->Get_Num_Frames()-1 ); xfer->xferReal( &percent ); - } // end if, anim + } - } // end if + } else { @@ -4081,9 +4081,9 @@ void W3DModelDraw::xfer( Xfer *xfer ) Bool present = FALSE; xfer->xferBool( &present ); - } // end else + } - } // end if, save + } else { @@ -4132,21 +4132,21 @@ void W3DModelDraw::xfer( Xfer *xfer ) // set animation data hlod->Set_Animation( anim, frame, curMode ); - } // end if, anim + } - } // end if + } - } // end if + } - } // end else, load + } - } // end if, version with animation info + } // when loading, update the sub objects if we have any if( xfer->getXferMode() == XFER_LOAD && m_subObjectVec.empty() == FALSE ) updateSubObjects(); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -4157,7 +4157,7 @@ void W3DModelDraw::loadPostProcess( void ) // extend base class DrawModule::loadPostProcess(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp index f35f1977c23..a89398e22f5 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp @@ -119,7 +119,7 @@ void W3DOverlordTankDraw::crc( Xfer *xfer ) // extend base class W3DTankDraw::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -137,7 +137,7 @@ void W3DOverlordTankDraw::xfer( Xfer *xfer ) // extend base class W3DTankDraw::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -148,4 +148,4 @@ void W3DOverlordTankDraw::loadPostProcess( void ) // extend base class W3DTankDraw::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPoliceCarDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPoliceCarDraw.cpp index b8b5eb2b1d9..d05f9103dfd 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPoliceCarDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPoliceCarDraw.cpp @@ -62,11 +62,11 @@ W3DDynamicLight *W3DPoliceCarDraw::createDynamicLight( void ) light->Set_Position( Vector3( 0.0f, 0.0f, 0.0f ) ); light->Set_Far_Attenuation_Range( 5, 15 ); - } // end if + } return light; -} // end createDynamicSearchLight +} // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -92,7 +92,7 @@ W3DPoliceCarDraw::~W3DPoliceCarDraw( void ) m_light->setDecayRange(); m_light->setDecayColor(); m_light = NULL; - } // end if + } } @@ -165,7 +165,7 @@ void W3DPoliceCarDraw::crc( Xfer *xfer ) // extend base class W3DTruckDraw::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -185,7 +185,7 @@ void W3DPoliceCarDraw::xfer( Xfer *xfer ) // John A says there is no data for these to save -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -196,4 +196,4 @@ void W3DPoliceCarDraw::loadPostProcess( void ) // extend base class W3DTruckDraw::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DProjectileStreamDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DProjectileStreamDraw.cpp index e20b68e8845..44a69928ea0 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DProjectileStreamDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DProjectileStreamDraw.cpp @@ -230,7 +230,7 @@ void W3DProjectileStreamDraw::crc( Xfer *xfer ) // extend base class DrawModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -250,7 +250,7 @@ void W3DProjectileStreamDraw::xfer( Xfer *xfer ) // Graham says there is no data that needs saving here -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -261,4 +261,4 @@ void W3DProjectileStreamDraw::loadPostProcess( void ) // extend base class DrawModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DRopeDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DRopeDraw.cpp index 19574f92ea5..4680154732f 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DRopeDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DRopeDraw.cpp @@ -222,7 +222,7 @@ void W3DRopeDraw::crc( Xfer *xfer ) // extend base class DrawModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -282,7 +282,7 @@ void W3DRopeDraw::xfer( Xfer *xfer ) tossSegments(); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -293,4 +293,4 @@ void W3DRopeDraw::loadPostProcess( void ) // extend base class DrawModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp index 929ccb5e943..776bcde3160 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp @@ -103,7 +103,7 @@ void W3DScienceModelDraw::crc( Xfer *xfer ) // extend base class W3DModelDraw::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -121,7 +121,7 @@ void W3DScienceModelDraw::xfer( Xfer *xfer ) // extend base class W3DModelDraw::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -132,6 +132,6 @@ void W3DScienceModelDraw::loadPostProcess( void ) // extend base class W3DModelDraw::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DSupplyDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DSupplyDraw.cpp index 7eae22d22b9..f9b5dbd254c 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DSupplyDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DSupplyDraw.cpp @@ -119,7 +119,7 @@ void W3DSupplyDraw::crc( Xfer *xfer ) // extend base class W3DModelDraw::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -139,7 +139,7 @@ void W3DSupplyDraw::xfer( Xfer *xfer ) // Graham says there's no data to save here -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -150,6 +150,6 @@ void W3DSupplyDraw::loadPostProcess( void ) // extend base class W3DModelDraw::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp index 71962a979f1..1138e394b8d 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp @@ -418,7 +418,7 @@ void W3DTankDraw::crc( Xfer *xfer ) // extend base class W3DModelDraw::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -438,7 +438,7 @@ void W3DTankDraw::xfer( Xfer *xfer ) // John A and Mark W say there is no data to save here -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -453,4 +453,4 @@ void W3DTankDraw::loadPostProcess( void ) tossEmitters(); createEmitters(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp index b9846646344..899a4da37e4 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp @@ -751,7 +751,7 @@ void W3DTankTruckDraw::crc( Xfer *xfer ) // extend base class W3DModelDraw::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -771,7 +771,7 @@ void W3DTankTruckDraw::xfer( Xfer *xfer ) // John A and Mark W say there is no data to save here -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -785,4 +785,4 @@ void W3DTankTruckDraw::loadPostProcess( void ) // toss any existing ones (no need to re-create; we'll do that on demand) tossEmitters(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTracerDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTracerDraw.cpp index a462644bde3..c56ae62d0af 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTracerDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTracerDraw.cpp @@ -61,7 +61,7 @@ W3DTracerDraw::W3DTracerDraw( Thing *thing, const ModuleData* moduleData ) : Dra m_speedInDistPerFrame = 1.0f; m_theTracer = NULL; -} // end W3DTracerDraw +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -160,7 +160,7 @@ void W3DTracerDraw::crc( Xfer *xfer ) // extend base class DrawModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -180,7 +180,7 @@ void W3DTracerDraw::xfer( Xfer *xfer ) // no data to save here, nobody will ever notice -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -191,4 +191,4 @@ void W3DTracerDraw::loadPostProcess( void ) // extend base class DrawModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp index b0a37c1f3a8..c34a8c4303d 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp @@ -642,7 +642,7 @@ void W3DTruckDraw::crc( Xfer *xfer ) // extend base class W3DModelDraw::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -662,7 +662,7 @@ void W3DTruckDraw::xfer( Xfer *xfer ) // John A and Mark W say there is no data to save here -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -676,4 +676,4 @@ void W3DTruckDraw::loadPostProcess( void ) // toss any existing ones (no need to re-create; we'll do that on demand) tossEmitters(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp index 35784684a9b..c15f6af55a7 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp @@ -53,7 +53,7 @@ void W3DCameoMovieDraw( GameWindow *window, WinInstanceData *instData ) TheDisplay->drawVideoBuffer( video, pos.x, pos.y, pos.x + size.x, pos.y + size.y ); } -} // end W3DLeftHUDDraw +} //------------------------------------------------------------------------------------------------- @@ -83,10 +83,10 @@ void W3DLeftHUDDraw( GameWindow *window, WinInstanceData *instData ) // draw the radar on the screen now TheRadar->draw( pos.x + 1, pos.y + 1, size.x - 2, size.y - 2 ); - } // end else if + } -} // end W3DLeftHUDDraw +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -97,7 +97,7 @@ void W3DRightHUDDraw( GameWindow *window, WinInstanceData *instData ) if( BitIsSet(window->winGetStatus(), WIN_STATUS_IMAGE )) W3DGameWinDefaultDraw( window, instData ); -} // end W3DRightHUDDraw +} Real logN(Real value, Real logBase) { @@ -214,7 +214,7 @@ void W3DPowerDraw( GameWindow *window, WinInstanceData *instData ) end.x, end.y ); start.x += centerBar->getImageWidth(); - } // end for i + } // we will draw the image but clip the parts we don't want to show IRegion2D reg; @@ -389,7 +389,7 @@ void W3DPowerDrawA( GameWindow *window, WinInstanceData *instData ) end.x, end.y ); start.x += centerBar->getImageWidth(); - } // end for i + } // we will draw the image but clip the parts we don't want to show IRegion2D reg; @@ -565,7 +565,7 @@ void W3DCommandBarGenExpDraw( GameWindow *window, WinInstanceData *instData ) end.x, end.y ); start.y += centerBar->getImageHeight(); - } // end for i + } // we will draw the image but clip the parts we don't want to show IRegion2D reg; @@ -676,7 +676,7 @@ void W3DNoDraw( GameWindow *window, WinInstanceData *instData ) // draw the default stuff // W3DGameWinDefaultDraw( window, instData ); -} // end W3DRightHUDDraw +} void drawSkinnyBorder( Int x, Int y, Int width, Int height); void W3DDrawMapPreview( GameWindow *window, WinInstanceData *instData) @@ -720,7 +720,7 @@ void W3DDrawMapPreview( GameWindow *window, WinInstanceData *instData) TheDisplay->drawLine(pixelX, ul.y, pixelX + width, ul.y, 1, lineColor); TheDisplay->drawLine(pixelX, lr.y + 1, pixelX + width, lr.y + 1, 1, lineColor); - } // end if + } else { @@ -730,7 +730,7 @@ void W3DDrawMapPreview( GameWindow *window, WinInstanceData *instData) TheDisplay->drawLine(ul.x, pixelY, ul.x, pixelY + height, 1, lineColor); TheDisplay->drawLine(lr.x + 1, pixelY, lr.x + 1, pixelY + height, 1, lineColor); - } // end else + } if(!BitIsSet(window->winGetStatus(), WIN_STATUS_IMAGE) || !window->winGetEnabledImage(0)) TheDisplay->drawFillRect(ul.x, ul.y, lr.x -ul.x, lr.y-ul.y, lineColor); @@ -978,7 +978,7 @@ void W3DCommandBarHelpPopupDraw( GameWindow *window, WinInstanceData *instData ) end.x, end.y ); start.y += centerBar->getImageHeight(); - } // end for i + } // we will draw the image but clip the parts we don't want to show IRegion2D reg; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMOTD.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMOTD.cpp index 98475b95051..0d08e965d6d 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMOTD.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMOTD.cpp @@ -95,7 +95,7 @@ WindowMsgHandledType MOTDSystem( GameWindow *window, UnsignedInt msg, break; - } // end create + } // ------------------------------------------------------------------------ case GWM_DESTROY: @@ -103,7 +103,7 @@ WindowMsgHandledType MOTDSystem( GameWindow *window, UnsignedInt msg, break; - } // end case + } // ------------------------------------------------------------------------ case GBM_SELECTED: @@ -116,14 +116,14 @@ WindowMsgHandledType MOTDSystem( GameWindow *window, UnsignedInt msg, break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end MOTDSystem +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp index ab36bebd4ca..07e4dfa5bb0 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp @@ -594,7 +594,7 @@ void W3DMainMenuButtonDropShadowDraw( GameWindow *window, } - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -613,7 +613,7 @@ void W3DMainMenuButtonDropShadowDraw( GameWindow *window, } - } // end else if, hilited and enabled + } else { @@ -632,7 +632,7 @@ void W3DMainMenuButtonDropShadowDraw( GameWindow *window, } - } // end else, enabled only + } // sanity, we need to have these images to make it look right if( leftImage == NULL || rightImage == NULL || @@ -696,7 +696,7 @@ void W3DMainMenuButtonDropShadowDraw( GameWindow *window, end.x, end.y ); start.x += centerImage->getImageWidth(); - } // end for i + } // we will draw the image but clip the parts we don't want to show IRegion2D reg; @@ -772,7 +772,7 @@ void W3DMainMenuButtonDropShadowDraw( GameWindow *window, } // TheDisplay->enableClipping(FALSE); -} // end W3DGadgetPushButtonImageDraw +} // drawButtonText ============================================================= @@ -801,17 +801,17 @@ static void drawText( GameWindow *window, WinInstanceData *instData ) { textColor = window->winGetDisabledTextColor(); dropColor = window->winGetDisabledTextBorderColor(); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { textColor = window->winGetHiliteTextColor(); dropColor = window->winGetHiliteTextBorderColor(); - } // end else if, hilited + } else { textColor = window->winGetEnabledTextColor(); dropColor = window->winGetEnabledTextBorderColor(); - } // end enabled only + } // set our font to that of our parent if not the same if( text->getFont() != window->winGetFont() ) @@ -827,7 +827,7 @@ static void drawText( GameWindow *window, WinInstanceData *instData ) // draw it text->draw( textPos.x, textPos.y, textColor, dropColor ); -} // end drawButtonText +} // W3DMainMenuRandomTextDraw ================================================== /** Specialized drawing function for the random text */ @@ -887,7 +887,7 @@ void W3DThinBorderDraw( GameWindow *window, WinInstanceData *instData ) end.y = begin.y + size.y; TheWindowManager->winDrawImage( image, begin.x, begin.y, end.x, end.y ); - } // end if + } // get window position // TheDisplay->drawOpenRect(start.x - 1, start.y - 1, size.x + 2, size.y + 2, 1, BrownishColor); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp index 58645e6098d..f321f803e6c 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp @@ -86,17 +86,17 @@ static void drawCheckBoxText( GameWindow *window, WinInstanceData *instData ) { textColor = window->winGetDisabledTextColor(); dropColor = window->winGetDisabledTextBorderColor(); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { textColor = window->winGetHiliteTextColor(); dropColor = window->winGetHiliteTextBorderColor(); - } // end else if, hilited + } else { textColor = window->winGetEnabledTextColor(); dropColor = window->winGetEnabledTextBorderColor(); - } // end enabled only + } // set our font to that of our parent if not the same if( text->getFont() != window->winGetFont() ) @@ -112,7 +112,7 @@ static void drawCheckBoxText( GameWindow *window, WinInstanceData *instData ) // draw it text->draw( textPos.x, textPos.y, textColor, dropColor ); -} // end drawCheckBoxText +} // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// @@ -162,7 +162,7 @@ void W3DGadgetCheckBoxDraw( GameWindow *window, WinInstanceData *instData ) boxBorder = GadgetCheckBoxGetDisabledUncheckedBoxBorderColor( window ); } - } // end if + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -182,7 +182,7 @@ void W3DGadgetCheckBoxDraw( GameWindow *window, WinInstanceData *instData ) boxBorder = GadgetCheckBoxGetHiliteUncheckedBoxBorderColor( window ); } - } // end else if + } else { @@ -202,7 +202,7 @@ void W3DGadgetCheckBoxDraw( GameWindow *window, WinInstanceData *instData ) boxBorder = GadgetCheckBoxGetEnabledUncheckedBoxBorderColor( window ); } - } // end else + } // draw background border start.x = origin.x; @@ -237,13 +237,13 @@ void W3DGadgetCheckBoxDraw( GameWindow *window, WinInstanceData *instData ) TheWindowManager->winDrawLine( boxColor, WIN_DRAW_LINE_WIDTH, start.x, end.y, end.x, start.y ); - } // end if + } // draw the button text if( instData->getTextLength() ) drawCheckBoxText( window, instData ); -} // end W3DGadgetCheckBoxDraw +} // W3DGadgetCheckBoxImageDraw ================================================= /** Draw check box with user supplied images */ @@ -283,7 +283,7 @@ void W3DGadgetCheckBoxImageDraw( GameWindow *window, WinInstanceData *instData ) else boxImage = GadgetCheckBoxGetDisabledUncheckedBoxImage( window ); - } // end if + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -296,7 +296,7 @@ void W3DGadgetCheckBoxImageDraw( GameWindow *window, WinInstanceData *instData ) else boxImage = GadgetCheckBoxGetHiliteUncheckedBoxImage( window ); - } // end else if + } else { @@ -309,7 +309,7 @@ void W3DGadgetCheckBoxImageDraw( GameWindow *window, WinInstanceData *instData ) else boxImage = GadgetCheckBoxGetEnabledUncheckedBoxImage( window ); - } // end else + } // draw background image // if( backgroundImage ) @@ -327,10 +327,10 @@ void W3DGadgetCheckBoxImageDraw( GameWindow *window, WinInstanceData *instData ) TheWindowManager->winDrawImage( boxImage, start.x, start.y, end.x, end.y ); - } // end if + } // draw the text if( instData->getTextLength() ) drawCheckBoxText( window, instData ); -} // end W3DGadgetCheckBoxImageDraw +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DComboBox.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DComboBox.cpp index a0d7296f68f..062c966d6b6 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DComboBox.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DComboBox.cpp @@ -102,21 +102,21 @@ void W3DGadgetComboBoxDraw( GameWindow *window, WinInstanceData *instData ) border = GadgetComboBoxGetDisabledBorderColor( window ); titleColor = window->winGetDisabledTextColor(); titleBorder = window->winGetDisabledTextBorderColor(); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { background = GadgetComboBoxGetHiliteColor( window ); border = GadgetComboBoxGetHiliteBorderColor( window ); titleColor = window->winGetHiliteTextColor(); titleBorder = window->winGetHiliteTextBorderColor(); - } // end else if, hilited + } else { background = GadgetComboBoxGetEnabledColor( window ); border = GadgetComboBoxGetEnabledBorderColor( window ); titleColor = window->winGetEnabledTextColor(); titleBorder = window->winGetEnabledTextBorderColor(); - } // end else, enabled + } // Draw the title if( title && title->getTextLength() ) @@ -132,7 +132,7 @@ void W3DGadgetComboBoxDraw( GameWindow *window, WinInstanceData *instData ) y += fontHeight + 1; height -= fontHeight + 1; - } // end if + } // draw the back border if( border != WIN_COLOR_UNDEFINED ) @@ -145,7 +145,7 @@ void W3DGadgetComboBoxDraw( GameWindow *window, WinInstanceData *instData ) x + 1, y + 1, x + width - 1, y + height - 1 ); -} // end W3DGadgetComboBoxDraw +} // W3DGadgetComboBoxImageDraw ================================================== /** Draw combo box with user supplied images */ @@ -200,7 +200,7 @@ void W3DGadgetComboBoxImageDraw( GameWindow *window, WinInstanceData *instData ) start.x, start.y, end.x, end.y ); - } // end if + } // Draw the title if( title && title->getTextLength() ) @@ -216,8 +216,8 @@ void W3DGadgetComboBoxImageDraw( GameWindow *window, WinInstanceData *instData ) y += TheWindowManager->winFontHeight( instData->getFont() ); height -= TheWindowManager->winFontHeight( instData->getFont() ) + 1; - } // end if + } -} // end W3DGadgetComboBoxImageDraw +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp index a7411a238fb..b58f44730bb 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp @@ -88,21 +88,21 @@ void W3DGadgetHorizontalSliderDraw( GameWindow *window, WinInstanceData *instDat backBorder = GadgetSliderGetDisabledBorderColor( window ); backColor = GadgetSliderGetDisabledColor( window ); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { backBorder = GadgetSliderGetHiliteBorderColor( window ); backColor = GadgetSliderGetHiliteColor( window ); - } // end else if, hilited + } else { backBorder = GadgetSliderGetEnabledBorderColor( window ); backColor = GadgetSliderGetEnabledColor( window ); - } // end else, enabled + } // draw background border and rect over whole control if( backBorder != WIN_COLOR_UNDEFINED ) @@ -115,7 +115,7 @@ void W3DGadgetHorizontalSliderDraw( GameWindow *window, WinInstanceData *instDat TheWindowManager->winOpenRect( backBorder, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } if( backColor != WIN_COLOR_UNDEFINED ) { @@ -126,10 +126,10 @@ void W3DGadgetHorizontalSliderDraw( GameWindow *window, WinInstanceData *instDat TheWindowManager->winFillRect( backColor, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } -} // end W3DGadgetHorizontalSliderDraw +} // W3DGadgetHorizontalSliderImageDraw ========================================= /** Draw horizontal slider with user supplied images */ @@ -354,7 +354,7 @@ void W3DGadgetHorizontalSliderImageDrawA( GameWindow *window, // centerImageRight = centerImageLeft = GadgetSliderGetDisabledImageCenter( window ); // smallCenterImageRight = smallCenterImageLeft = GadgetSliderGetDisabledImageSmallCenter( window ); - } // end if, disabled + } else //if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -368,7 +368,7 @@ void W3DGadgetHorizontalSliderImageDrawA( GameWindow *window, centerImageRight = GadgetSliderGetEnabledImageCenter( window ); smallCenterImageRight = GadgetSliderGetEnabledImageSmallCenter( window ); - } // end else, enabled + } // sanity, we need to have these images to make it look right if( leftImageLeft == NULL || rightImageLeft == NULL || @@ -431,7 +431,7 @@ void W3DGadgetHorizontalSliderImageDrawA( GameWindow *window, end.x, end.y ); start.x += centerImageLeft->getImageWidth(); - } // end for i + } // // how many small repeating pieces will fit in the gap from where the @@ -455,7 +455,7 @@ void W3DGadgetHorizontalSliderImageDrawA( GameWindow *window, end.x, end.y ); start.x += smallCenterImageLeft->getImageWidth(); - } // end for i + } // draw left end start.x = origin.x + xOffset; @@ -475,5 +475,5 @@ void W3DGadgetHorizontalSliderImageDrawA( GameWindow *window, TheWindowManager->winDrawImage(rightImageRight, start.x, start.y, end.x, end.y); TheDisplay->enableClipping(FALSE); -} // end W3DGadgetHorizontalSliderImageDraw +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp index 26fb71e48e7..de19dceee59 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp @@ -132,7 +132,7 @@ static void drawHiliteBar( const Image *left, const Image *right, end.x, end.y ); start.x += center->getImageWidth(); - } // end for i + } // // how many small repeating pieces will fit in the gap from where the @@ -160,9 +160,9 @@ static void drawHiliteBar( const Image *left, const Image *right, end.x, end.y ); start.x += smallCenter->getImageWidth(); - } // end for i + } - } // end if + } TheDisplay->enableClipping(FALSE); // draw left end start.x = startX + xOffset; @@ -176,7 +176,7 @@ static void drawHiliteBar( const Image *left, const Image *right, end.y = start.y + barWindowSize.y; TheWindowManager->winDrawImage(right, start.x, start.y, end.x, end.y); -} // end drawHiliteBar +} // drawListBoxText ============================================================ /** Draw the text for a listbox */ @@ -270,7 +270,7 @@ static void drawListBoxText( GameWindow *window, WinInstanceData *instData, center = GadgetListBoxGetDisabledSelectedItemImageCenter( window ); smallCenter = GadgetListBoxGetDisabledSelectedItemImageSmallCenter( window ); - } // end if + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -279,7 +279,7 @@ static void drawListBoxText( GameWindow *window, WinInstanceData *instData, center = GadgetListBoxGetHiliteSelectedItemImageCenter( window ); smallCenter = GadgetListBoxGetHiliteSelectedItemImageSmallCenter( window ); - } // end else if + } else { @@ -288,7 +288,7 @@ static void drawListBoxText( GameWindow *window, WinInstanceData *instData, center = GadgetListBoxGetEnabledSelectedItemImageCenter( window ); smallCenter = GadgetListBoxGetEnabledSelectedItemImageSmallCenter( window ); - } // end else + } // draw select image across area @@ -309,7 +309,7 @@ static void drawListBoxText( GameWindow *window, WinInstanceData *instData, if( left && right && center && smallCenter ) drawHiliteBar( left, right, center, smallCenter, start.x + 1, start.y, end.x , end.y ); - } // end if, use images + } else { Color selectColor = WIN_COLOR_UNDEFINED, @@ -319,17 +319,17 @@ static void drawListBoxText( GameWindow *window, WinInstanceData *instData, { selectColor = GadgetListBoxGetDisabledSelectedItemColor( window ); selectBorder = GadgetListBoxGetDisabledSelectedItemBorderColor( window ); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { selectColor = GadgetListBoxGetHiliteSelectedItemColor( window ); selectBorder = GadgetListBoxGetHiliteSelectedItemBorderColor( window ); - } // end else if, hilited + } else { selectColor = GadgetListBoxGetEnabledSelectedItemColor( window ); selectBorder = GadgetListBoxGetEnabledSelectedItemBorderColor( window ); - } // end else, enabled + } // draw border @@ -375,9 +375,9 @@ static void drawListBoxText( GameWindow *window, WinInstanceData *instData, start.x, start.y, end.x, end.y ); - } // end else, draw selection with colors + } - } // end if + } @@ -440,8 +440,8 @@ static void drawListBoxText( GameWindow *window, WinInstanceData *instData, drawY, textColor, dropColor ); - }//else - }// if + } + } else if(cells[j].cellType == LISTBOX_IMAGE && cells[j].data) { Int width, height; @@ -473,10 +473,10 @@ static void drawListBoxText( GameWindow *window, WinInstanceData *instData, offsetX, offsetY, offsetX + width, offsetY + height,cells[j].color ); - }//else + } columnX = columnX + list->columnWidth[j]; - }// for - }//if + } + } drawY += listLineHeight; @@ -486,7 +486,7 @@ static void drawListBoxText( GameWindow *window, WinInstanceData *instData, // TheWindowManager->winSetClipRegion( clipRegion.lo.x, clipRegion.lo.y, // clipRegion.hi.x, clipRegion.hi.y ); -} // end drawListBoxText +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -521,21 +521,21 @@ void W3DGadgetListBoxDraw( GameWindow *window, WinInstanceData *instData ) border = GadgetListBoxGetDisabledBorderColor( window ); titleColor = window->winGetDisabledTextColor(); titleBorder = window->winGetDisabledTextBorderColor(); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { background = GadgetListBoxGetHiliteColor( window ); border = GadgetListBoxGetHiliteBorderColor( window ); titleColor = window->winGetHiliteTextColor(); titleBorder = window->winGetHiliteTextBorderColor(); - } // end else if, hilited + } else { background = GadgetListBoxGetEnabledColor( window ); border = GadgetListBoxGetEnabledBorderColor( window ); titleColor = window->winGetEnabledTextColor(); titleBorder = window->winGetEnabledTextBorderColor(); - } // end else, enabled + } // Draw the title if( title && title->getTextLength() ) @@ -551,7 +551,7 @@ void W3DGadgetListBoxDraw( GameWindow *window, WinInstanceData *instData ) y += fontHeight + 1; height -= fontHeight + 1; - } // end if + } // draw the back border if( border != WIN_COLOR_UNDEFINED ) @@ -572,14 +572,14 @@ void W3DGadgetListBoxDraw( GameWindow *window, WinInstanceData *instData ) list->slider->winGetSize( &sliderSize.x, &sliderSize.y ); width -= (sliderSize.x +3); - } // end if + } // draw the text drawListBoxText( window, instData, x, y + 4 , width, height-4, TRUE ); -} // end W3DGadgetListBoxDraw +} // W3DGadgetListBoxImageDraw ================================================== /** Draw list box with user supplied images */ @@ -609,7 +609,7 @@ void W3DGadgetListBoxImageDraw( GameWindow *window, WinInstanceData *instData ) list->slider->winGetSize( &sliderSize.x, &sliderSize.y ); width -= sliderSize.x; - } // end if + } // get the image if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) @@ -644,7 +644,7 @@ void W3DGadgetListBoxImageDraw( GameWindow *window, WinInstanceData *instData ) start.x, start.y, end.x, end.y ); - } // end if + } // Draw the title if( title && title->getTextLength() ) @@ -660,12 +660,12 @@ void W3DGadgetListBoxImageDraw( GameWindow *window, WinInstanceData *instData ) y += TheWindowManager->winFontHeight( instData->getFont() ); height -= TheWindowManager->winFontHeight( instData->getFont() ) + 1; - } // end if + } // draw the listbox text drawListBoxText( window, instData, x, y+4, width, height-4, TRUE ); -} // end W3DGadgetListBoxImageDraw +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp index 61ecb267b7e..f6e4f252fb1 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp @@ -89,21 +89,21 @@ void W3DGadgetProgressBarDraw( GameWindow *window, WinInstanceData *instData ) backBorder = GadgetProgressBarGetDisabledBorderColor( window ); barColor = GadgetProgressBarGetDisabledBarColor( window ); barBorder = GadgetProgressBarGetDisabledBarBorderColor( window ); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { backColor = GadgetProgressBarGetHiliteColor( window ); backBorder = GadgetProgressBarGetHiliteBorderColor( window ); barColor = GadgetProgressBarGetHiliteBarColor( window ); barBorder = GadgetProgressBarGetHiliteBarBorderColor( window ); - } // end else if, hilited + } else { backColor = GadgetProgressBarGetEnabledColor( window ); backBorder = GadgetProgressBarGetEnabledBorderColor( window ); barColor = GadgetProgressBarGetEnabledBarColor( window ); barBorder = GadgetProgressBarGetEnabledBarBorderColor( window ); - } // end else, enabled + } // draw background border if( backBorder != WIN_COLOR_UNDEFINED ) @@ -116,7 +116,7 @@ void W3DGadgetProgressBarDraw( GameWindow *window, WinInstanceData *instData ) TheWindowManager->winOpenRect( backBorder, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } // draw background fill if( backColor != WIN_COLOR_UNDEFINED ) @@ -129,7 +129,7 @@ void W3DGadgetProgressBarDraw( GameWindow *window, WinInstanceData *instData ) TheWindowManager->winFillRect( backColor, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } // draw the progress so far if( progress ) @@ -149,7 +149,7 @@ void W3DGadgetProgressBarDraw( GameWindow *window, WinInstanceData *instData ) start.x, start.y, end.x, end.y ); } - } // end if + } // draw bar fill if( barColor != WIN_COLOR_UNDEFINED ) @@ -171,13 +171,13 @@ void W3DGadgetProgressBarDraw( GameWindow *window, WinInstanceData *instData ) TheWindowManager->winDrawLine(GameMakeColor(200,200,200,255),WIN_DRAW_LINE_WIDTH, start.x, start.y, start.x, end.y); } - } // end if + } - } // end if + } -} // end W3DGadgetProgressBarDraw +} // W3DGadgetProgressBarImageDraw ============================================== /** Draw Progress Bar with user supplied images */ @@ -254,7 +254,7 @@ void W3DGadgetProgressBarImageDraw( GameWindow *window, WinInstanceData *instDat //backSmallCenter = GadgetProgressBarGetDisabledImageSmallCenter( window ); //barSmallCenter = GadgetProgressBarGetDisabledBarImageSmallCenter( window ); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -267,7 +267,7 @@ void W3DGadgetProgressBarImageDraw( GameWindow *window, WinInstanceData *instDat //backSmallCenter = GadgetProgressBarGetHiliteImageSmallCenter( window ); //barSmallCenter = GadgetProgressBarGetHiliteBarImageSmallCenter( window ); - } // end else if, hilited + } else { @@ -280,7 +280,7 @@ void W3DGadgetProgressBarImageDraw( GameWindow *window, WinInstanceData *instDat //backSmallCenter = GadgetProgressBarGetEnabledImageSmallCenter( window ); //barSmallCenter = GadgetProgressBarGetEnabledBarImageSmallCenter( window ); - } // end else, enabled + } // sanity if( backLeft == NULL || backRight == NULL || @@ -325,7 +325,7 @@ void W3DGadgetProgressBarImageDraw( GameWindow *window, WinInstanceData *instDat end.x, end.y ); start.x += backCenter->getImageWidth(); - } // end for i + } // // how many small repeating pieces will fit in the gap from where the @@ -398,7 +398,7 @@ void W3DGadgetProgressBarImageDraw( GameWindow *window, WinInstanceData *instDat end.x, end.y ); start.x += barCenter->getImageWidth(); - } // end for i + } start.x = origin.x + 10 + barCenter->getImageWidth() * pieces; //pieces = (size.x - barWindowSize.x -20) / barRight->getImageWidth(); //Changed By Saad for flashing grey piece @@ -412,6 +412,6 @@ void W3DGadgetProgressBarImageDraw( GameWindow *window, WinInstanceData *instDat end.x, end.y ); start.x += barRight->getImageWidth(); - } // end for i + } -} // end W3DGadgetProgressBarImageDraw +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp index bee1174eb70..fb5f3390dc8 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp @@ -101,17 +101,17 @@ static void drawButtonText( GameWindow *window, WinInstanceData *instData ) { textColor = window->winGetDisabledTextColor(); dropColor = window->winGetDisabledTextBorderColor(); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { textColor = window->winGetHiliteTextColor(); dropColor = window->winGetHiliteTextBorderColor(); - } // end else if, hilited + } else { textColor = window->winGetEnabledTextColor(); dropColor = window->winGetEnabledTextBorderColor(); - } // end enabled only + } // set our font to that of our parent if not the same if( text->getFont() != window->winGetFont() ) @@ -127,7 +127,7 @@ static void drawButtonText( GameWindow *window, WinInstanceData *instData ) // draw it text->draw( textPos.x, textPos.y, textColor, dropColor ); -} // end drawButtonText +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -163,7 +163,7 @@ void W3DGadgetPushButtonDraw( GameWindow *window, WinInstanceData *instData ) border = GadgetButtonGetDisabledBorderColor( window ); } - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -178,7 +178,7 @@ void W3DGadgetPushButtonDraw( GameWindow *window, WinInstanceData *instData ) border = GadgetButtonGetHiliteBorderColor( window ); } - } // end else if, hilited and enabled + } else { @@ -193,7 +193,7 @@ void W3DGadgetPushButtonDraw( GameWindow *window, WinInstanceData *instData ) border = GadgetButtonGetEnabledBorderColor( window ); } - } // end else, enabled only + } // compute draw position start.x = origin.x; @@ -208,7 +208,7 @@ void W3DGadgetPushButtonDraw( GameWindow *window, WinInstanceData *instData ) TheWindowManager->winOpenRect( border, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } if( color != WIN_COLOR_UNDEFINED ) { @@ -221,7 +221,7 @@ void W3DGadgetPushButtonDraw( GameWindow *window, WinInstanceData *instData ) TheWindowManager->winFillRect( color, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } // draw the button text if( instData->getTextLength() ) @@ -262,7 +262,7 @@ void W3DGadgetPushButtonDraw( GameWindow *window, WinInstanceData *instData ) } } -} // end W3DGadgetPushButtonDraw +} @@ -325,7 +325,7 @@ void W3DGadgetPushButtonImageDrawOne( GameWindow *window, else image = GadgetButtonGetDisabledImage( window ); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -334,13 +334,13 @@ void W3DGadgetPushButtonImageDrawOne( GameWindow *window, else image = GadgetButtonGetHiliteImage( window ); - } // end else if, hilited and enabled + } else { if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) ) image = GadgetButtonGetHiliteSelectedImage( window ); - } // end else, enabled only + } } @@ -385,7 +385,7 @@ void W3DGadgetPushButtonImageDrawOne( GameWindow *window, } } TheDisplay->drawImage( image, start.x, start.y, end.x, end.y, colorMultiplier, drawMode ); - } // end if + } // draw the button text if( instData->getTextLength() ) @@ -472,7 +472,7 @@ void W3DGadgetPushButtonImageDrawOne( GameWindow *window, } } } -} // end W3DGadgetPushButtonImageDraw +} void W3DGadgetPushButtonImageDrawThree(GameWindow *window, WinInstanceData *instData ) @@ -514,7 +514,7 @@ void W3DGadgetPushButtonImageDrawThree(GameWindow *window, WinInstanceData *inst } - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -533,7 +533,7 @@ void W3DGadgetPushButtonImageDrawThree(GameWindow *window, WinInstanceData *inst } - } // end else if, hilited and enabled + } else { @@ -552,7 +552,7 @@ void W3DGadgetPushButtonImageDrawThree(GameWindow *window, WinInstanceData *inst } - } // end else, enabled only + } // sanity, we need to have these images to make it look right if( leftImage == NULL || rightImage == NULL || @@ -614,7 +614,7 @@ void W3DGadgetPushButtonImageDrawThree(GameWindow *window, WinInstanceData *inst end.x, end.y ); start.x += centerImage->getImageWidth(); - } // end for i + } // we will draw the image but clip the parts we don't want to show IRegion2D reg; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp index 98d4f22b796..e13bf6fa405 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp @@ -86,17 +86,17 @@ static void drawRadioButtonText( GameWindow *window, WinInstanceData *instData ) { textColor = window->winGetDisabledTextColor(); dropColor = window->winGetDisabledTextBorderColor(); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { textColor = window->winGetHiliteTextColor(); dropColor = window->winGetHiliteTextBorderColor(); - } // end else if, hilited + } else { textColor = window->winGetEnabledTextColor(); dropColor = window->winGetEnabledTextBorderColor(); - } // end enabled only + } // set our font to that of our parent if not the same if( text->getFont() != window->winGetFont() ) @@ -112,7 +112,7 @@ static void drawRadioButtonText( GameWindow *window, WinInstanceData *instData ) // draw it text->draw( textPos.x, textPos.y, textColor, dropColor ); -} // end drawRadioButtonText +} // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// @@ -162,7 +162,7 @@ void W3DGadgetRadioButtonDraw( GameWindow *window, WinInstanceData *instData ) boxBorder = GadgetRadioGetDisabledUncheckedBoxBorderColor( window ); } - } // end if + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -182,7 +182,7 @@ void W3DGadgetRadioButtonDraw( GameWindow *window, WinInstanceData *instData ) boxBorder = GadgetRadioGetHiliteUncheckedBoxBorderColor( window ); } - } // end else if + } else { @@ -202,7 +202,7 @@ void W3DGadgetRadioButtonDraw( GameWindow *window, WinInstanceData *instData ) boxBorder = GadgetRadioGetEnabledUncheckedBoxBorderColor( window ); } - } // end else + } // draw background border start.x = origin.x; @@ -259,7 +259,7 @@ void W3DGadgetRadioButtonDraw( GameWindow *window, WinInstanceData *instData ) -} // end W3DGadgetRadioButtonDraw +} void W3DGadgetRadioButtonImageDraw( GameWindow *window, @@ -295,7 +295,7 @@ void W3DGadgetRadioButtonImageDraw( GameWindow *window, centerImage = GadgetRadioGetDisabledUncheckedBoxImage( window ); rightImage = GadgetRadioGetDisabledCheckedBoxImage( window ); - } // end if + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { // hilited background @@ -303,7 +303,7 @@ void W3DGadgetRadioButtonImageDraw( GameWindow *window, centerImage = GadgetRadioGetHiliteUncheckedBoxImage( window ); rightImage = GadgetRadioGetHiliteCheckedBoxImage( window ); - } // end else if + } else { // enabled background @@ -311,7 +311,7 @@ void W3DGadgetRadioButtonImageDraw( GameWindow *window, centerImage = GadgetRadioGetEnabledUncheckedBoxImage( window ); rightImage = GadgetRadioGetEnabledCheckedBoxImage( window ); - } // end else + } // sanity, we need to have these images to make it look right if( leftImage == NULL || centerImage == NULL || @@ -363,7 +363,7 @@ void W3DGadgetRadioButtonImageDraw( GameWindow *window, start.x, start.y, end.x, end.y ); start.x += centerImage->getImageWidth(); - } // end for i + } TheDisplay->enableClipping(FALSE); // draw left end @@ -383,5 +383,5 @@ void W3DGadgetRadioButtonImageDraw( GameWindow *window, drawRadioButtonText( window, instData ); -} // end W3DGadgetHorizontalSliderImageDraw +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp index 0bdad2f487a..84c4e9ff1d8 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp @@ -122,7 +122,7 @@ static void drawStaticTextText( GameWindow *window, WinInstanceData *instData, text->setClipRegion(&clipRegion); text->draw( textPos.x, textPos.y, textColor, textDropColor ); - } // end if + } else { @@ -132,10 +132,10 @@ static void drawStaticTextText( GameWindow *window, WinInstanceData *instData, text->setClipRegion(&clipRegion); text->draw( textPos.x, textPos.y, textColor, textDropColor ); - } // end else + } -} // end drawStaticTextText +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -163,7 +163,7 @@ void W3DGadgetStaticTextDraw( GameWindow *window, WinInstanceData *instData ) textColor = window->winGetDisabledTextColor(); textOutlineColor = window->winGetDisabledTextBorderColor(); - } // end if, disabled + } else { @@ -172,7 +172,7 @@ void W3DGadgetStaticTextDraw( GameWindow *window, WinInstanceData *instData ) textColor = window->winGetEnabledTextColor(); textOutlineColor = window->winGetEnabledTextBorderColor(); - } // end else, enabled + } // draw the back border if( backBorder != WIN_COLOR_UNDEFINED ) @@ -185,7 +185,7 @@ void W3DGadgetStaticTextDraw( GameWindow *window, WinInstanceData *instData ) TheWindowManager->winOpenRect( backBorder, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } // draw the back fill area if( backColor != WIN_COLOR_UNDEFINED ) @@ -197,7 +197,7 @@ void W3DGadgetStaticTextDraw( GameWindow *window, WinInstanceData *instData ) end.y = start.y + size.y - 2; TheWindowManager->winFillRect( backColor, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } // draw the text if( tData->text && (textColor != WIN_COLOR_UNDEFINED) ) @@ -205,7 +205,7 @@ void W3DGadgetStaticTextDraw( GameWindow *window, WinInstanceData *instData ) -} // end W3DGadgetStaticTextDraw +} // W3DGadgetStaticTextImageDraw =============================================== /** Draw colored text field with user supplied images */ @@ -229,7 +229,7 @@ void W3DGadgetStaticTextImageDraw( GameWindow *window, WinInstanceData *instData textColor = window->winGetDisabledTextColor(); textOutlineColor = window->winGetDisabledTextBorderColor(); - } // end if, disabled + } else { @@ -237,7 +237,7 @@ void W3DGadgetStaticTextImageDraw( GameWindow *window, WinInstanceData *instData textColor = window->winGetEnabledTextColor(); textOutlineColor = window->winGetEnabledTextBorderColor(); - } // end else, enabled + } // draw the back image if( image ) @@ -249,7 +249,7 @@ void W3DGadgetStaticTextImageDraw( GameWindow *window, WinInstanceData *instData end.y = start.y + size.y; TheWindowManager->winDrawImage( image, start.x, start.y, end.x, end.y ); - } // end if + } // draw the text if( tData->text && (textColor != WIN_COLOR_UNDEFINED) ) @@ -257,5 +257,5 @@ void W3DGadgetStaticTextImageDraw( GameWindow *window, WinInstanceData *instData -} // end W3DGadgetStaticTextImageDraw +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp index 5eb4305cbe7..30f356cfa48 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp @@ -378,7 +378,7 @@ void W3DGadgetTabControlDraw( GameWindow *tabControl, WinInstanceData *instData } } -} // end W3DGadgetTabControlDraw +} // W3DGadgetRadioButtonImageDraw ============================================== /** Draw tabs with user supplied images */ @@ -649,4 +649,4 @@ void W3DGadgetTabControlImageDraw( GameWindow *tabControl, } } -} // end W3DGadgetTabControlImageDraw +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp index a76bbbe59cf..dba4d4f1e78 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp @@ -204,7 +204,7 @@ static void drawTextEntryText( GameWindow *window, WinInstanceData *instData, cursorPos + 2, origin.y + size.y - 3 ); window->winSetCursorPosition( cursorPos + 2 - origin.x, 0 ); -} // end drawTextEntryText +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -238,7 +238,7 @@ void W3DGadgetTextEntryDraw( GameWindow *window, WinInstanceData *instData ) backColor = GadgetTextEntryGetDisabledColor( window ); backBorder = GadgetTextEntryGetDisabledBorderColor( window ); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -249,7 +249,7 @@ void W3DGadgetTextEntryDraw( GameWindow *window, WinInstanceData *instData ) backColor = GadgetTextEntryGetHiliteColor( window ); backBorder = GadgetTextEntryGetHiliteBorderColor( window ); - } // end else if, hilited + } else { @@ -260,7 +260,7 @@ void W3DGadgetTextEntryDraw( GameWindow *window, WinInstanceData *instData ) backColor = GadgetTextEntryGetEnabledColor( window ); backBorder = GadgetTextEntryGetEnabledBorderColor( window ); - } // end else, just enabled + } // draw the back border if( backBorder != WIN_COLOR_UNDEFINED ) @@ -273,7 +273,7 @@ void W3DGadgetTextEntryDraw( GameWindow *window, WinInstanceData *instData ) TheWindowManager->winOpenRect( backBorder, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } // draw the filled back if( backColor != WIN_COLOR_UNDEFINED ) @@ -286,7 +286,7 @@ void W3DGadgetTextEntryDraw( GameWindow *window, WinInstanceData *instData ) TheWindowManager->winFillRect( backColor, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } // draw the text Int fontHeight = TheWindowManager->winFontHeight( instData->getFont() ); @@ -306,7 +306,7 @@ void W3DGadgetTextEntryDraw( GameWindow *window, WinInstanceData *instData ) -} // end W3DGadgetTextEntryDraw +} // W3DGadgetTextEntryImageDraw ================================================ /** Draw horizontal slider with user supplied images */ @@ -345,7 +345,7 @@ void W3DGadgetTextEntryImageDraw( GameWindow *window, WinInstanceData *instData centerImage = GadgetTextEntryGetDisabledImageCenter( window ); smallCenterImage = GadgetTextEntryGetDisabledImageSmallCenter( window ); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -358,7 +358,7 @@ void W3DGadgetTextEntryImageDraw( GameWindow *window, WinInstanceData *instData centerImage = GadgetTextEntryGetHiliteImageCenter( window ); smallCenterImage = GadgetTextEntryGetHiliteImageSmallCenter( window ); - } // end else if, hilited + } else { @@ -371,7 +371,7 @@ void W3DGadgetTextEntryImageDraw( GameWindow *window, WinInstanceData *instData centerImage = GadgetTextEntryGetEnabledImageCenter( window ); smallCenterImage = GadgetTextEntryGetEnabledImageSmallCenter( window ); - } // end else, just enabled + } // get image sizes for the ends ICoord2D leftSize, rightSize; @@ -409,7 +409,7 @@ void W3DGadgetTextEntryImageDraw( GameWindow *window, WinInstanceData *instData end.x, end.y ); start.x += centerImage->getImageWidth(); - } // end for i + } // // how many small repeating pieces will fit in the gap from where the @@ -428,7 +428,7 @@ void W3DGadgetTextEntryImageDraw( GameWindow *window, WinInstanceData *instData end.x, end.y ); start.x += smallCenterImage->getImageWidth(); - } // end for i + } // draw left end start.x = origin.x + xOffset; @@ -460,4 +460,4 @@ void W3DGadgetTextEntryImageDraw( GameWindow *window, WinInstanceData *instData -} // end W3DGadgetTextEntryImageDraw +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp index a13a34e7942..8884b0f095d 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp @@ -89,21 +89,21 @@ void W3DGadgetVerticalSliderDraw( GameWindow *window, backBorder = GadgetSliderGetDisabledBorderColor( window ); backColor = GadgetSliderGetDisabledColor( window ); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { backBorder = GadgetSliderGetHiliteBorderColor( window ); backColor = GadgetSliderGetHiliteColor( window ); - } // end else if, hilited + } else { backBorder = GadgetSliderGetEnabledBorderColor( window ); backColor = GadgetSliderGetEnabledColor( window ); - } // end else, enabled + } // draw background border and rect over whole control if( backBorder != WIN_COLOR_UNDEFINED ) @@ -116,7 +116,7 @@ void W3DGadgetVerticalSliderDraw( GameWindow *window, TheWindowManager->winOpenRect( backBorder, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } if( backColor != WIN_COLOR_UNDEFINED ) { @@ -127,11 +127,11 @@ void W3DGadgetVerticalSliderDraw( GameWindow *window, TheWindowManager->winFillRect( backColor, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } -} // end W3DGadgetVerticalSliderDraw +} // W3DGadgetVerticalSliderImageDraw =========================================== /** Draw vertical slider with user supplied images */ @@ -161,7 +161,7 @@ void W3DGadgetVerticalSliderImageDraw( GameWindow *window, centerImage = GadgetSliderGetDisabledImageCenter( window ); smallCenterImage = GadgetSliderGetDisabledImageSmallCenter( window ); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -170,7 +170,7 @@ void W3DGadgetVerticalSliderImageDraw( GameWindow *window, centerImage = GadgetSliderGetHiliteImageCenter( window ); smallCenterImage = GadgetSliderGetHiliteImageSmallCenter( window ); - } // end else if, hilited + } else { @@ -179,7 +179,7 @@ void W3DGadgetVerticalSliderImageDraw( GameWindow *window, centerImage = GadgetSliderGetEnabledImageCenter( window ); smallCenterImage = GadgetSliderGetEnabledImageSmallCenter( window ); - } // end else, enabled + } // sanity, we need to have these images to make it look right if( topImage == NULL || bottomImage == NULL || @@ -241,7 +241,7 @@ void W3DGadgetVerticalSliderImageDraw( GameWindow *window, start.y += centerImage->getImageHeight(); end.y += centerImage->getImageHeight(); - } // end for i + } // // how many small repeating pieces will fit in the gap from where the @@ -260,7 +260,7 @@ void W3DGadgetVerticalSliderImageDraw( GameWindow *window, start.y += smallCenterImage->getImageHeight(); end.y += smallCenterImage->getImageHeight(); - } // end for i + } // draw top end start.x = origin.x + xOffset; @@ -276,6 +276,6 @@ void W3DGadgetVerticalSliderImageDraw( GameWindow *window, } -} // end W3DGadgetVerticalSliderImageDraw +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp index 5a80152e281..d7dfc1c9687 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp @@ -96,7 +96,7 @@ Bool W3DFontLibrary::loadFontData( GameFont *font ) DEBUG_ASSERTCRASH(fontChar, ("Missing or Corrupted Font. Pleas see log for details")); return FALSE; - } // end if + } // assign font data font->fontData = fontChar; @@ -122,7 +122,7 @@ Bool W3DFontLibrary::loadFontData( GameFont *font ) // all done and loaded return TRUE; -} // end loadFont +} // W3DFontLibrary::releaseFontData ============================================ /** Release font data */ @@ -141,7 +141,7 @@ void W3DFontLibrary::releaseFontData( GameFont *font ) font->fontData = NULL; } -} // end releaseFontData +} // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp index 306e8e91c35..3147bad59e0 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp @@ -253,7 +253,7 @@ void W3DGameWindow::blitBorderRect( Int x, Int y, Int width, Int height ) TheDisplay->drawImage( borderPieces[ BORDER_CORNER_LR ], x, y, x + size, y + size ); -} // end blitBorderRect +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -272,14 +272,14 @@ W3DGameWindow::W3DGameWindow( void ) m_needPolyDraw = FALSE; m_newTextPos = FALSE; -} // end W3DGameWindow +} // W3DGameWindow::~W3DGameWindow ============================================== //============================================================================= W3DGameWindow::~W3DGameWindow( void ) { -} // end ~W3DGameWindow +} // W3DGameWinDefaultDraw ====================================================== /** The default redraw callback. Draws the background using either @@ -330,9 +330,9 @@ void W3DGameWinDefaultDraw( GameWindow *window, WinInstanceData *instData ) end.y = start.y + size.y; TheWindowManager->winDrawImage( image, start.x, start.y, end.x, end.y ); - } // end if + } - } // end if + } else { Color color, borderColor; @@ -344,21 +344,21 @@ void W3DGameWinDefaultDraw( GameWindow *window, WinInstanceData *instData ) color = window->winGetDisabledColor( 0 ); borderColor = window->winGetDisabledBorderColor( 0 ); - } // end if + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { color = window->winGetHiliteColor( 0 ); borderColor = window->winGetHiliteBorderColor( 0 ); - } // end else if + } else { color = window->winGetEnabledColor( 0 ); borderColor = window->winGetEnabledBorderColor( 0 ); - } // end else + } // // draw the border at the edges @@ -376,7 +376,7 @@ void W3DGameWinDefaultDraw( GameWindow *window, WinInstanceData *instData ) origin.x + size.x - borderWidth, origin.y + size.y - borderWidth ); - } // end else + } // if we have a video buffer, draw the video buffer if ( instData->m_videoBuffer ) @@ -388,7 +388,7 @@ void W3DGameWinDefaultDraw( GameWindow *window, WinInstanceData *instData ) TheDisplay->drawVideoBuffer( instData->m_videoBuffer, pos.x, pos.y, pos.x + size.x, pos.y + size.y ); } -} // end W3DGameWinDefaultDraw +} // W3DGameWindow::winDrawBorder =============================================== //============================================================================= @@ -486,7 +486,7 @@ void W3DGameWindow::winDrawBorder( void ) child->winGetSize( &size.x, &size.y ); sliderAdjustment = size.y; - } // end if + } if( m_instData.getTextLength() ) labelAdjustment = 4; @@ -511,13 +511,13 @@ void W3DGameWindow::winDrawBorder( void ) found = TRUE; break; - } // end switch + } - } // end if + } - } // end for i + } -} // end WinDrawBorder +} // W3DGameWindow::winSetFont ================================================== /** Set the font for a widow */ @@ -534,7 +534,7 @@ void W3DGameWindow::winSetFont( GameFont *font ) // this is a visual change m_needPolyDraw = TRUE; -} // end WinSetFont +} // W3DGameWindow::winSetText ================================================== /** Set the text for window */ @@ -553,7 +553,7 @@ Int W3DGameWindow::winSetText( UnicodeString newText ) return WIN_ERR_OK; -} // end WinSetText +} // W3DGameWindow::winSetPosition ============================================== /** Set window position */ @@ -576,7 +576,7 @@ Int W3DGameWindow::winSetPosition( Int x, Int y ) return WIN_ERR_OK; -} // end WinSetPosition +} // W3DGameWindow::getTextSize ================================================= /** Get the size of the text in our inst data */ @@ -590,7 +590,7 @@ void W3DGameWindow::getTextSize( Int *width, Int *height ) if( height ) *height = extents.Y; -} // end getTextSize +} // W3DGameWindow::getTextLoc ================================================== // Set our text rendering location */ @@ -611,9 +611,9 @@ void W3DGameWindow::setTextLoc( Int x, Int y ) m_textPos.y = y; m_newTextPos = TRUE; - } // end if + } -} // end setTextLoc +} // W3DGameWindow::drawText ==================================================== /** Draw the text in our 2d sentence renderer */ @@ -629,7 +629,7 @@ void W3DGameWindow::drawText( Color color ) m_newTextPos = FALSE; needDraw = TRUE; - } // end if + } // if color switch, set new color if( m_currTextColor != color ) @@ -638,7 +638,7 @@ void W3DGameWindow::drawText( Color color ) m_currTextColor = color; needDraw = TRUE; - } // end if + } // draw the quads if needed if( needDraw || m_needPolyDraw ) @@ -654,10 +654,10 @@ void W3DGameWindow::drawText( Color color ) m_needPolyDraw = FALSE; - } // end if + } // do the render m_textRenderer.Render(); -} // end drawText +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindowManager.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindowManager.cpp index be1d44cf491..0643a02b749 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindowManager.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindowManager.cpp @@ -43,14 +43,14 @@ W3DGameWindowManager::W3DGameWindowManager( void ) { -} // end W3DGameWindowManager +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- W3DGameWindowManager::~W3DGameWindowManager( void ) { -} // end ~W3DGameWindowManager +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -60,5 +60,5 @@ void W3DGameWindowManager::init( void ) // extend GameWindowManager::init(); -} // end init +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp index 79ed22ef399..22d09092521 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp @@ -4221,13 +4221,13 @@ void HeightMapRenderObjClass::renderShoreLines(CameraClass *pCamera) DX8Wrapper::Set_Index_Buffer(ib_access,0); DX8Wrapper::Set_Vertex_Buffer(vb_access); - }//lock and fill ib/vb + } if (indexCount > 0 && vertexCount > 0) DX8Wrapper::Draw_Triangles( 0,indexCount/3, 0, vertexCount); //draw a quad, 2 triangles, 4 verts vertexCount=0; indexCount=0; - }//for all shore tiles + } //Disable writes to destination alpha DX8Wrapper::Set_DX8_Render_State(D3DRS_COLORWRITEENABLE,D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_RED); @@ -4420,9 +4420,9 @@ void HeightMapRenderObjClass::renderExtraBlendTiles(void) ib += 6; vertexCount +=4; indexCount +=6; - }//tile has 3rd blend layer and is visible - } //for all extre blend tiles - }//unlock vertex buffer + } + } + } if (vertexCount) { diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp index 6d394cad15f..7014a309f92 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp @@ -241,7 +241,7 @@ void W3DProjectedShadowManager::reset( void ) m_W3DShadowTextureManager->freeAllTextures(); -} // end Reset +} Bool W3DProjectedShadowManager::init( void ) { @@ -1415,17 +1415,17 @@ Int W3DProjectedShadowManager::renderShadows(RenderInfoClass & rinfo) rinfo.Pop_Material_Pass(); projectionCount++; //keep track of number of shadow projections } - }//robj - }//di - } // end for drawmodule - } // end for obj + } + } + } + } } - }//shadow is enabled + } } flushDecals(lastShadowDecalTexture,lastShadowType); //make sure there are not any unrendered decals left over. TheDX8MeshRenderer.Flush(); //draw all the shadow receiving objects - }//rendering shadows + } if (m_decalList) { //keep track of active decal texture so we can render all decals at once. @@ -1453,7 +1453,7 @@ Int W3DProjectedShadowManager::renderShadows(RenderInfoClass & rinfo) queueDecal(shadow); //only draw shadow if casting object is visible projectionCount++; } - }//shadow is enabled + } } flushDecals(lastShadowDecalTexture,lastShadowType); //make sure there are not any unrendered decals left over. @@ -1806,7 +1806,7 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S return NULL; //could not create the shadow texture } shadowType=SHADOW_PROJECTION; - }//SHADOW_PROJECTION + } } else { //no shadow info, assume user wants a projected shadow @@ -2042,7 +2042,7 @@ void W3DProjectedShadowManager::removeShadow (W3DProjectedShadow *shadow) delete shadow; return; } - } // end for + } } //search for this shadow @@ -2068,7 +2068,7 @@ void W3DProjectedShadowManager::removeShadow (W3DProjectedShadow *shadow) delete shadow; return; } - } // end for + } } void W3DProjectedShadowManager::removeAllShadows(void) @@ -2086,7 +2086,7 @@ void W3DProjectedShadowManager::removeAllShadows(void) next_shadow = cur_shadow->m_next; cur_shadow->m_next = NULL; delete cur_shadow; - } // end for + } next_shadow=m_decalList; cur_shadow=NULL; @@ -2096,7 +2096,7 @@ void W3DProjectedShadowManager::removeAllShadows(void) next_shadow = cur_shadow->m_next; cur_shadow->m_next = NULL; delete cur_shadow; - } // end for + } } #if defined(RTS_DEBUG) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp index 4f95a453274..51a4c7fff6c 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp @@ -346,7 +346,7 @@ class W3DShadowGeometryMesh // in our current geometry. W3DShadowGeometry *m_parentGeometry; // mesh hierarchy containing this mesh. -}; //end of meshInfo +}; #ifdef DO_TERRAIN_SHADOW_VOLUMES @@ -758,7 +758,7 @@ W3DShadowGeometryMesh::W3DShadowGeometryMesh( void ) m_numPolyNeighbors = 0; m_parentVerts = NULL; m_polygonNormals = NULL; -} // end W3DShadowGeometry +} // ~W3DShadowGeometry ============================================================ // ============================================================================ @@ -772,7 +772,7 @@ W3DShadowGeometryMesh::~W3DShadowGeometryMesh( void ) if (m_polygonNormals) delete [] m_polygonNormals; -} // end ~W3DShadowGeometry +} // GetPolyNeighbor ============================================================ // Return the poly neighbor structure at the given index @@ -788,11 +788,11 @@ PolyNeighbor *W3DShadowGeometryMesh::GetPolyNeighbor( Int polyIndex ) assert( 0 ); return NULL; - } // en dif + } return &m_polyNeighbors[ polyIndex ]; -} // end GetPolyNeighbor +} // buildPolygonNeighbors ====================================================== // Whenever we set a new geometry we want to build some information about @@ -823,7 +823,7 @@ void W3DShadowGeometryMesh::buildPolygonNeighbors( void ) return; // nothing to see here people, move along - } // end if + } // // in the event that this geometry can deform on the fly or we are @@ -842,7 +842,7 @@ void W3DShadowGeometryMesh::buildPolygonNeighbors( void ) if( allocateNeighbors( numPolys ) == FALSE ) return; - } // end if + } // // initialize all polygon neighbor information to none and assign our @@ -858,7 +858,7 @@ void W3DShadowGeometryMesh::buildPolygonNeighbors( void ) for( j = 0; j < MAX_POLYGON_NEIGHBORS; j++ ) m_polyNeighbors[ i ].neighbor[ j ].neighborIndex = NO_NEIGHBOR; - } // end for i + } // assign polygon data for each of our polygons for( i = 0; i < m_numPolyNeighbors; i++ ) @@ -929,7 +929,7 @@ void W3DShadowGeometryMesh::buildPolygonNeighbors( void ) index1=index2=-1; continue; } - } // end if + } if( index1 != -1 && index2 != -1 ) { // @@ -949,7 +949,7 @@ void W3DShadowGeometryMesh::buildPolygonNeighbors( void ) break; // exit for a - } // end if + } // // error condition, if our counter a is at the max number @@ -973,13 +973,13 @@ void W3DShadowGeometryMesh::buildPolygonNeighbors( void ) // DEBUG_ASSERTCRASH(a != MAX_POLYGON_NEIGHBORS,(errorText)); } - } // end if + } - } // end for j + } - } // end for i + } -} // end buildPolygonNeighbors +} // allocateNeighbors ========================================================== // Allocate storage for the polygon neighbors and record its size @@ -1000,14 +1000,14 @@ Bool W3DShadowGeometryMesh::allocateNeighbors( Int numPolys ) assert( 0 ); return FALSE; - } // end if + } // list is now acutally allocated m_numPolyNeighbors = numPolys; return TRUE; // success! -} // end allocateNeighbors +} // deleteNeighbors ============================================================ // Delete all polygon neighbor storage and information @@ -1023,13 +1023,13 @@ void W3DShadowGeometryMesh::deleteNeighbors( void ) m_polyNeighbors = NULL; m_numPolyNeighbors = 0; - } // end if + } // sanity error checking assert( m_numPolyNeighbors == 0 ); assert( m_polyNeighbors == NULL ); -} // end deleteNeighbors +} //#include "Common/ThingTemplate.h" @@ -1576,9 +1576,9 @@ W3DVolumetricShadow::W3DVolumetricShadow( void ) m_objectXformHistory[ i ][j].Make_Identity(); m_lightPosHistory[ i ][j] = Vector3(0,0,0); } - } // end for i + } -} // end W3DVolumetricShadow +} // ~W3DVolumetricShadow ==================================================================== // W3DVolumetricShadow destructor @@ -1609,7 +1609,7 @@ W3DVolumetricShadow::~W3DVolumetricShadow( void ) m_geometry=NULL; m_robj=NULL; -} // end ~W3DVolumetricShadow +} void W3DVolumetricShadow::SetGeometry( W3DShadowGeometry *geometry ) { @@ -1646,13 +1646,13 @@ void W3DVolumetricShadow::SetGeometry( W3DShadowGeometry *geometry ) if( allocateSilhouette(i, numNewVertices ) == FALSE ) return; - } // end if + } } // assign the new geometry, possible over an old geometry m_geometry = geometry; -} // end SetGeometry +} /**Called once per frame for each object, when necessary it will reconstruct the shadow volume for this shadow from the silhouette of the geometry @@ -1730,9 +1730,9 @@ void W3DVolumetricShadow::Update() // update delay time lastTime = currentTime; - } // end if + } -} // end Update +} /** Update shadow volumes belonging to all meshes of this shadow caster. * Use zoffset to extend shadows below object's base by given amount. @@ -1814,8 +1814,8 @@ void W3DVolumetricShadow::updateVolumes(Real zoffset) } } } - } // end for j - } // end for, i + } + } } /*floorZ is the assumed ground height below the model. The code will try to extrude shadows just long enough to hit this point in order @@ -2044,7 +2044,7 @@ void W3DVolumetricShadow::updateMeshVolume(Int meshIndex, Int lightIndex, const sphere.Center -= objectCenter; m_shadowVolume[ lightIndex ][meshIndex]->setBoundingSphere(sphere); m_shadowVolume[ lightIndex ][meshIndex]->setVisibleState(Geometry::STATE_VISIBLE); //this volume needs rendering. - }//end if inside view frustum + } else if (m_shadowVolume[ lightIndex ][meshIndex]) { //outside view frustum, shadow wasn't updated. @@ -2054,7 +2054,7 @@ void W3DVolumetricShadow::updateMeshVolume(Int meshIndex, Int lightIndex, const m_shadowVolume[ lightIndex ][meshIndex]->setBoundingSphere(sphere); m_shadowVolume[ lightIndex ][meshIndex]->setVisibleState(Geometry::STATE_INVISIBLE); } - } // end if + } else { //not reconstructing volume, so don't know if visible or not. if (m_shadowVolume[ lightIndex ][meshIndex]) @@ -2093,9 +2093,9 @@ void W3DVolumetricShadow::addSilhouetteEdge(Int meshIndex, PolyNeighbor *visible neighborIndex = i; break; // exit for - } // end if + } - } // end for i + } // get the three vertex indices of "visible" geomMesh->GetPolygonIndex( visible->myIndex, visibleIndexList, 3 ); @@ -2121,7 +2121,7 @@ void W3DVolumetricShadow::addSilhouetteEdge(Int meshIndex, PolyNeighbor *visible edgeStart = visibleIndexList[ 1 ]; edgeEnd = visibleIndexList[ 2 ]; - } // end if + } else if( (visibleIndexList[ 1 ] != visible->neighbor[ neighborIndex ].neighborEdgeIndex[ 0 ]) && (visibleIndexList[ 1 ] != @@ -2132,7 +2132,7 @@ void W3DVolumetricShadow::addSilhouetteEdge(Int meshIndex, PolyNeighbor *visible edgeStart = visibleIndexList[ 2 ]; edgeEnd = visibleIndexList[ 0 ]; - } // end if + } else { @@ -2140,12 +2140,12 @@ void W3DVolumetricShadow::addSilhouetteEdge(Int meshIndex, PolyNeighbor *visible edgeStart = visibleIndexList[ 0 ]; edgeEnd = visibleIndexList[ 1 ]; - } // end if + } // add to silhouette edge list addSilhouetteIndices(meshIndex, edgeStart, edgeEnd ); -} // end addSilhouetteEdge +} // addNeighborlessEdges ======================================================= // Given a polygon neighbor information, it has been determined that this @@ -2200,11 +2200,11 @@ void W3DVolumetricShadow::addNeighborlessEdges(Int meshIndex, PolyNeighbor *us ) addEdge = FALSE; break; // exit for j, no need to search on - } // end if + } - } // end if + } - } // end for j + } // add the edge if no neighbors have that edge if( addEdge == TRUE ) @@ -2212,11 +2212,11 @@ void W3DVolumetricShadow::addNeighborlessEdges(Int meshIndex, PolyNeighbor *us ) addSilhouetteIndices(meshIndex, edgeStart, edgeEnd ); - } // end if + } - } // end for i + } -} // end addNeighborlessEdges +} // addSilhouetteIndices ======================================================= // Add these two indices to the silhouette data @@ -2233,7 +2233,7 @@ void W3DVolumetricShadow::addSilhouetteIndices(Int meshIndex, Short edgeStart, S assert( m_numSilhouetteIndices[meshIndex] < m_maxSilhouetteEntries[meshIndex] ); m_silhouetteIndex[meshIndex][ m_numSilhouetteIndices[meshIndex]++ ] = edgeEnd; -} // end if +} // buildSilhouette ============================================================ // Given a light position, and our polygon neighbor information this will @@ -2298,7 +2298,7 @@ void W3DVolumetricShadow::buildSilhouette(Int meshIndex, Vector3 *lightPosObject if( Vector3::Dot_Product( lightVector, normal ) < 0.0f ) BitSet( polyNeighbor->status, POLY_VISIBLE ); - } // end for i + } // // check all our polys using our poly neighbors, where one poly neighbor @@ -2338,7 +2338,7 @@ void W3DVolumetricShadow::buildSilhouette(Int meshIndex, Vector3 *lightPosObject if( BitIsSet( otherNeighbor->status, POLY_PROCESSED ) ) continue; // for j - } // end if + } // // finally, if our own visible status is different from our @@ -2357,16 +2357,16 @@ void W3DVolumetricShadow::buildSilhouette(Int meshIndex, Vector3 *lightPosObject visibleNeighborless = TRUE; - } // end if + } else if( BitIsSet( otherNeighbor->status, POLY_VISIBLE ) == FALSE ) { // "we" are visible and "they" are not addSilhouetteEdge(meshIndex, polyNeighbor, otherNeighbor ); - } // end if + } - } // end if + } else if( otherNeighbor != NULL && BitIsSet( otherNeighbor->status, POLY_VISIBLE ) ) { @@ -2374,9 +2374,9 @@ void W3DVolumetricShadow::buildSilhouette(Int meshIndex, Vector3 *lightPosObject // "they" are visible and "we" are not addSilhouetteEdge(meshIndex, otherNeighbor, polyNeighbor ); - } // end else + } - } // end for j + } // // if this polygon is visible, add any edges that are not @@ -2387,7 +2387,7 @@ void W3DVolumetricShadow::buildSilhouette(Int meshIndex, Vector3 *lightPosObject addNeighborlessEdges(meshIndex, polyNeighbor ); - } // end if + } // // this polyNeighbor is now considered "processed", any other @@ -2396,12 +2396,12 @@ void W3DVolumetricShadow::buildSilhouette(Int meshIndex, Vector3 *lightPosObject // BitSet( polyNeighbor->status, POLY_PROCESSED ); - } // end for i + } //record number of edge indices contrinuted by this mesh m_numIndicesPerMesh[meshIndex]=m_numSilhouetteIndices[meshIndex]-meshEdgeStart; -} // end buildSilhouette +} // constructVolume ============================================================ // Given a fresh new geometry class called "shadowVolume" to hold the actual @@ -2441,7 +2441,7 @@ void W3DVolumetricShadow::constructVolume( Vector3 *lightPosObject,Real shadowEx assert( 0 ); return; - } // end if + } // get the geometry struct we're storing the actual shadow volume data in shadowVolume = m_shadowVolume[ volumeIndex ][meshIndex]; @@ -2453,7 +2453,7 @@ void W3DVolumetricShadow::constructVolume( Vector3 *lightPosObject,Real shadowEx assert( 0 ); return; - } // end if + } // step through each of the silhouette pairs vertexCount = 0; @@ -2636,7 +2636,7 @@ void W3DVolumetricShadow::constructVolume( Vector3 *lightPosObject,Real shadowEx shadowVolume->SetNumActivePolygon(polygonCount); shadowVolume->SetNumActiveVertex(vertexCount); -} // end constructVolume +} // constructVolumeVB ========================================================== // Given a fresh new geometry class called "shadowVolume" to hold the actual @@ -2680,7 +2680,7 @@ void W3DVolumetricShadow::constructVolumeVB( Vector3 *lightPosObject,Real shadow assert( 0 ); return; - } // end if + } // get the geometry struct we're storing the actual shadow volume data in shadowVolume = m_shadowVolume[ volumeIndex ][meshIndex]; @@ -2692,7 +2692,7 @@ void W3DVolumetricShadow::constructVolumeVB( Vector3 *lightPosObject,Real shadow assert( 0 ); return; - } // end if + } //*****************************************************************************************/ //Do an initial pass through silhouette data to determine the actual vertex/polygon counts. @@ -2795,7 +2795,7 @@ void W3DVolumetricShadow::constructVolumeVB( Vector3 *lightPosObject,Real shadow maxStripLength=__max(maxStripLength,stripLength); #endif } - } //initial pass to determine vertex/polygon counts. + } //*********************************************************************************************** DEBUG_ASSERTCRASH(m_shadowVolumeVB[ volumeIndex ][meshIndex] == NULL,("Updating Existing Static Vertex Buffer Shadow")); @@ -2977,7 +2977,7 @@ void W3DVolumetricShadow::constructVolumeVB( Vector3 *lightPosObject,Real shadow } // DEBUG_ASSERTLOG(polygonCount == vertexCount, ("WARNING***Shadow volume mesh not optimal: %s",m_geometry->Get_Name())); -} // end constructVolume +} // allocateShadowVolume ======================================================= // Allocate a space for us to construct the shadow volume in @@ -2995,7 +2995,7 @@ Bool W3DVolumetricShadow::allocateShadowVolume( Int volumeIndex, Int meshIndex ) assert( 0 ); return FALSE; - } // end if + } if ((shadowVolume = m_shadowVolume[ volumeIndex ][meshIndex]) == 0) { @@ -3014,7 +3014,7 @@ Bool W3DVolumetricShadow::allocateShadowVolume( Int volumeIndex, Int meshIndex ) m_shadowVolumeCount[meshIndex]--; return FALSE; - } // end if + } // assign to list m_shadowVolume[ volumeIndex ][meshIndex] = shadowVolume; @@ -3057,12 +3057,12 @@ Bool W3DVolumetricShadow::allocateShadowVolume( Int volumeIndex, Int meshIndex ) delete shadowVolume; return FALSE; - } // end if + } } return TRUE; // success -} // end allocateShadowVolume +} // deleteShadowVolume ========================================================= // Free all resources allocated to the shadow volume(s) @@ -3078,7 +3078,7 @@ void W3DVolumetricShadow::deleteShadowVolume( Int volumeIndex ) assert( 0 ); return; - } // end if + } // delete it! for (Int meshIndex=0; meshIndexRelease(); } -} // end resetShadowVolume +} // allocateSilhouette ========================================================= // Allocate space for new silhouette storage, the number of vertices passed @@ -3158,7 +3158,7 @@ Bool W3DVolumetricShadow::allocateSilhouette(Int meshIndex, Int numVertices ) assert( 0 ); return FALSE; - } // end if + } // set our list to empty just to be clean m_numSilhouetteIndices[meshIndex] = 0; @@ -3168,7 +3168,7 @@ Bool W3DVolumetricShadow::allocateSilhouette(Int meshIndex, Int numVertices ) return TRUE; // success -} // end allocateSilhouette +} // deleteSilhouette =========================================================== // Delete all silhouette data and memory allocated @@ -3181,7 +3181,7 @@ void W3DVolumetricShadow::deleteSilhouette( Int meshIndex ) m_silhouetteIndex[meshIndex] = NULL; m_numSilhouetteIndices[meshIndex] = 0; -} // end deletesilhouette +} // resetSilhouette ============================================================ // Resets the silhouette to empty, it does NOT free any of the memory @@ -3192,7 +3192,7 @@ void W3DVolumetricShadow::resetSilhouette( Int meshIndex ) m_numSilhouetteIndices[meshIndex] = 0; -} // end resetSilhouette +} // renderStencilShadows ======================================================= // The stencil buffer now has our shadow information in it, take that @@ -3263,7 +3263,7 @@ void W3DVolumetricShadowManager::renderStencilShadows( void ) // turn off the stencil buffer m_pDev->SetRenderState( D3DRS_STENCILENABLE, FALSE ); -} // end renderStencilShadows +} void W3DVolumetricShadowManager::renderShadows( Bool forceStencilFill ) { @@ -3401,7 +3401,7 @@ void W3DVolumetricShadowManager::renderShadows( Bool forceStencilFill ) numRenderedShadows++; } } - } // end for + } // Set vertex format to that used by static shadow volumes m_pDev->SetVertexShader(W3DBufferManager::getDX8Format(W3DBufferManager::VBM_FVF_XYZ)); @@ -3496,7 +3496,7 @@ void W3DVolumetricShadowManager::renderShadows( Bool forceStencilFill ) DX8Wrapper::Invalidate_Cached_Render_States(); } -} // end RenderShadows +} /** This class will manage shadow geometry for each render object. Shadow geometry may be the same as render geometry but doesn't need to be. This allows lower LOD versions of @@ -3556,7 +3556,7 @@ void W3DVolumetricShadowManager::invalidateCachedLightPositions(void) shadow->setLightPosHistory(i,meshIndex,vec); } } - } // end for + } } // W3DVolumetricShadowManager ============================================================= @@ -3570,7 +3570,7 @@ W3DVolumetricShadowManager::W3DVolumetricShadowManager( void ) TheW3DBufferManager = NEW W3DBufferManager; -} // end ShadowManager +} // ~W3DVolumetricShadowManager ============================================================ // ============================================================================ @@ -3585,7 +3585,7 @@ W3DVolumetricShadowManager::~W3DVolumetricShadowManager( void ) //all shadows should be freed up at this point but check anyway assert(m_shadowList==NULL); -} // end ~W3DVolumetricShadowManager +} /** Releases all W3D/D3D assets before a reset.. */ void W3DVolumetricShadowManager::ReleaseResources(void) @@ -3648,7 +3648,7 @@ Bool W3DVolumetricShadowManager::ReAcquireResources(void) Bool W3DVolumetricShadowManager::init( void ) { return TRUE; -} // end Init +} // Reset ====================================================================== // Reset our list of shadows to empty @@ -3660,7 +3660,7 @@ void W3DVolumetricShadowManager::reset( void ) m_W3DShadowGeometryManager->Free_All_Geoms(); TheW3DBufferManager->freeAllBuffers(); -} // end Reset +} // addShadow ================================================================== // Add the shadows for this hierarchy to the shadow management for @@ -3742,7 +3742,7 @@ void W3DVolumetricShadowManager::removeShadow(W3DVolumetricShadow *shadow) delete shadow; break; } - } // end for + } } /** removeAllShadows =========================================================== @@ -3762,7 +3762,7 @@ void W3DVolumetricShadowManager::removeAllShadows(void) next_shadow = cur_shadow->m_next; cur_shadow->m_next = NULL; delete cur_shadow; - } // end for + } } W3DShadowGeometryManager::W3DShadowGeometryManager(void) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp index a4577310a3b..d96364cb710 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp @@ -864,7 +864,7 @@ static RenderObjClass* createTower( SimpleSceneClass *scene, case BRIDGE_TOWER_TO_RIGHT: towerPos = bridgeInfo->toRight; break; default: return NULL; - } // end switch + } // set the Z position to that of the terrain towerPos.z = TheTerrainRenderObject->getHeightMapHeight( towerPos.x, towerPos.y, NULL); @@ -949,7 +949,7 @@ static void updateTowerPos( RenderObjClass* tower, case BRIDGE_TOWER_TO_RIGHT: towerPos = bridgeInfo->toRight; break; default: return; - } // end switch + } // set the position of the tower render object to the position in the world Matrix3D transform; @@ -1030,7 +1030,7 @@ void W3DBridgeBuffer::worldBuilderUpdateBridgeTowers( W3DAssetManager *assetMana towerRenderObj = createTower( scene, assetManager, pMapObj, (BridgeTowerType)j, &bridgeInfo ); created = TRUE; - } // end if + } // sanity DEBUG_ASSERTCRASH( towerRenderObj != NULL, ("worldBuilderUpdateBridgeTowers: unable to create tower for bridge '%s'", @@ -1043,11 +1043,11 @@ void W3DBridgeBuffer::worldBuilderUpdateBridgeTowers( W3DAssetManager *assetMana if( created ) REF_PTR_RELEASE( towerRenderObj ); - } // end for j + } - } // end if + } - } // end for i + } // skip the 2nd map object representing the second half of the bridgef pMapObj = pMapObj2; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index b6d19b675be..0f1306bcb86 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -360,7 +360,7 @@ W3DDisplay::W3DDisplay() for (i = 0; i < DisplayStringCount; i++) m_displayStrings[i] = NULL; -} // end W3DDisplay +} // W3DDisplay::~W3DDisplay ==================================================== /** */ @@ -390,7 +390,7 @@ W3DDisplay::~W3DDisplay() delete m_2DRender; m_2DRender = NULL; - } // end if + } // // delete all our views now since they are W3D views and we need to @@ -421,7 +421,7 @@ W3DDisplay::~W3DDisplay() delete TheW3DFileSystem; TheW3DFileSystem = NULL; -} // end ~W3DDisplay +} // TheSuperHackers @tweak valeronm 20/03/2025 No longer filters resolutions by a 4:3 aspect ratio. inline Bool isResolutionSupported(const ResolutionDescClass &res) @@ -524,7 +524,7 @@ void W3DDisplay::setWidth( UnsignedInt width ) // of the screen with (width,height) at the lower right m_2DRender->Set_Coordinate_Range( RectClass( 0, 0, getWidth(), getHeight() ) ); -} // end set width +} // W3DDisplay::setHeight ====================================================== /** Set height of display */ @@ -539,7 +539,7 @@ void W3DDisplay::setHeight( UnsignedInt height ) // of the screen with (width,height) at the lower right m_2DRender->Set_Coordinate_Range( RectClass( 0, 0, getWidth(), getHeight() ) ); -} // end set height +} // W3DDisplay::initAssets ===================================================== /** */ @@ -547,7 +547,7 @@ void W3DDisplay::setHeight( UnsignedInt height ) void W3DDisplay::initAssets( void ) { -} // end initAssets +} // W3DDisplay::init3DScene ==================================================== /** */ @@ -555,7 +555,7 @@ void W3DDisplay::initAssets( void ) void W3DDisplay::init3DScene( void ) { -} // end init3DScene +} // W3DDisplay::init2DScene ==================================================== /** This is the 2D scene, you can use it to draw on a 2D plane over the @@ -564,7 +564,7 @@ void W3DDisplay::init3DScene( void ) void W3DDisplay::init2DScene( void ) { -} // end init2DScene +} // W3DDisplay::init =========================================================== /** Initialize or re-initialize the W3D display system. Here we need to @@ -586,7 +586,7 @@ void W3DDisplay::init( void ) /// @todo W3DDisplay needs RE-init logic! return; - } // end if + } // Override the W3D File system TheW3DFileSystem = NEW W3DFileSystem; @@ -796,7 +796,7 @@ void W3DDisplay::init( void ) { m_debugDisplayCallback = StatDebugDisplay; } -} // end init +} // W3DDisplay::reset =========================================================== /** Reset the W3D display system. Here we need to @@ -932,7 +932,7 @@ void W3DDisplay::gatherDebugStats( void ) } } - } // end if + } if (m_benchmarkDisplayString == NULL) { @@ -1427,7 +1427,7 @@ void W3DDisplay::gatherDebugStats( void ) //Render ALL modelcondition statii - } // end if + } m_displayStrings[ SelectedInfo ]->setText( unibuffer ); } @@ -1462,7 +1462,7 @@ void W3DDisplay::drawDebugStats( void ) y += h; } -} // end drawDebugStats +} // W3DDisplay::drawFPSStats ================================================= /** Draw the FPS on the screen */ @@ -1506,7 +1506,7 @@ void W3DDisplay::drawCurrentDebugDisplay( void ) m_debugDisplayCallback( m_debugDisplay, m_debugDisplayUserData, NULL ); } } -} // end drawCurrentDebugDisplay +} // W3DDisplay::calculateTerrainLOD ================================================= /** Calculates an adequately speedy terrain Level Of Detail. */ @@ -1902,7 +1902,7 @@ void W3DDisplay::draw( void ) goto AGAIN; } #endif -} // end draw +} #define LETTER_BOX_FADE_TIME 1000.0f ///1000 ms. @@ -2069,7 +2069,7 @@ void W3DDisplay::drawLine( Int startX, Int startY, lineWidth, lineColor ); m_2DRender->Render(); -} // end drawLine +} // W3DDisplay::drawLine ======================================================= /** draw a line on the display in pixel coordinates with the specified color */ @@ -2087,7 +2087,7 @@ void W3DDisplay::drawLine( Int startX, Int startY, lineWidth, lineColor1, lineColor2 ); m_2DRender->Render(); -} // end drawLine +} // W3DDisplay::drawOpenRect =================================================== @@ -2140,7 +2140,7 @@ void W3DDisplay::drawOpenRect( Int startX, Int startY, Int width, Int height, m_2DRender->Render(); } -} // end drawOpenRect +} // W3DDisplay::drawFillRect =================================================== //============================================================================= @@ -2158,7 +2158,7 @@ void W3DDisplay::drawFillRect( Int startX, Int startY, Int width, Int height, // render it now! m_2DRender->Render(); -} // end drawFillRect +} void W3DDisplay::drawRectClock(Int startX, Int startY, Int width, Int height, Int percent, UnsignedInt color) { @@ -2652,14 +2652,14 @@ void W3DDisplay::drawImage( const Image *image, Int startX, Int startY, Vector2( uv_rect.Left, uv_rect.Top ), color ); - } // end if + } else { // just draw as normal m_2DRender->Add_Quad( screen_rect, uv_rect, color ); - } // end else + } m_2DRender->Render(); @@ -2668,7 +2668,7 @@ void W3DDisplay::drawImage( const Image *image, Int startX, Int startY, if (doAlphaReset) m_2DRender->Enable_Alpha(true); -} // end drawImage +} //============================================================================ // W3DDisplay::createVideoBuffer @@ -2787,7 +2787,7 @@ void W3DDisplay::setClipRegion( IRegion2D *region ) m_clipRegion = *region; m_isClippedEnabled = TRUE; -} // end setClipRegion +} //============================================================================= /* we don't really need to override this call, since we will soon be called to @@ -3148,9 +3148,9 @@ void W3DDisplay::preloadModelAssets( AsciiString model ) nameWithExtension.format( "%s.w3d", model.str() ); m_assetManager->Load_3D_Assets( nameWithExtension.str() ); - } // end if + } -} // end preloadModelAssets +} //------------------------------------------------------------------------------------------------- /** Preload using the W3D asset manager the texture referenced by the string parameter */ @@ -3162,9 +3162,9 @@ void W3DDisplay::preloadTextureAssets( AsciiString texture ) { TextureClass *theTexture = m_assetManager->Get_Texture( texture.str() ); theTexture->Release_Ref();//release reference - } // end if + } -} // end preloadModelAssets +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp index 4220aad80db..33775af48ad 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp @@ -95,7 +95,7 @@ W3DDisplayString::W3DDisplayString( void ) m_hotKeyPos.y = 0; m_hotKeyColor = GameMakeColor(255,255,255,255); -} // end W3DDisplayString +} // W3DDisplayString::~W3DDisplayString ======================================== /** */ @@ -103,7 +103,7 @@ W3DDisplayString::W3DDisplayString( void ) W3DDisplayString::~W3DDisplayString( void ) { -} // end ~W3DDisplayString +} // W3DDisplayString::textChanged ============================================== /** This method automatically gets called from some methods in the display @@ -142,7 +142,7 @@ void W3DDisplayString::notifyTextChanged( void ) m_textRenderer.Reset(); m_textRendererHotKey.Reset(); -} // end notifyTextChanged +} // W3DDisplayString::Draw ===================================================== /** Draw the text at the specified location in in the specified colors @@ -186,7 +186,7 @@ void W3DDisplayString::draw( Int x, Int y, Color color, Color dropColor, Int xDr m_textChanged = FALSE; needNewPolys = TRUE; - } // end if + } // // if our position has changed, or our colors have chagned, or our @@ -224,7 +224,7 @@ void W3DDisplayString::draw( Int x, Int y, Color color, Color dropColor, Int xDr m_textRendererHotKey.Render(); } - } // end if + } // render the text m_textRenderer.Render(); @@ -233,7 +233,7 @@ void W3DDisplayString::draw( Int x, Int y, Color color, Color dropColor, Int xDr if( TheGameClient ) usingResources( TheGameClient->getFrame() ); -} // end draw +} // W3DDisplayString::getSize ================================================== /** Get the render size width and height of the string in this instance @@ -248,7 +248,7 @@ void W3DDisplayString::getSize( Int *width, Int *height ) if( height ) *height = m_size.y; -} // end getSize +} // DisplayString::appendChar ================================================== /** Get text with up to charPos characters, -1 = all characters */ @@ -307,7 +307,7 @@ void W3DDisplayString::setFont( GameFont *font ) // set flag telling us the font has changed since last render m_fontChanged = TRUE; -} // end setFont +} // W3DDisplayString::setClipRegion ============================================ /** Set the clipping region for the text */ @@ -337,9 +337,9 @@ void W3DDisplayString::setClipRegion( IRegion2D *region ) m_clipRegion.lo.y, m_clipRegion.hi.x, m_clipRegion.hi.y ) ); - } // end if + } -} // end setClipRegion +} // W3DDisplayString::computeExtents =========================================== /** Update the width and height of our string */ @@ -355,7 +355,7 @@ void W3DDisplayString::computeExtents( void ) m_size.x = 0; m_size.y = 0; - } // end if + } else { @@ -363,9 +363,9 @@ void W3DDisplayString::computeExtents( void ) m_size.x = extents.X; m_size.y = extents.Y; - } // end else + } -} // end computeExtents +} // W3DDisplayString::setWordWrap =========================================== /** Set the wordwrap of the m_textRenderer */ @@ -375,7 +375,7 @@ void W3DDisplayString::setWordWrap( Int wordWrap ) // set the Word Wrap if(m_textRenderer.Set_Wrapping_Width(wordWrap)) notifyTextChanged(); -}// void setWordWrap( Int wordWrap ) +} void W3DDisplayString::setUseHotkey( Bool useHotkey, Color hotKeyColor ) { @@ -393,4 +393,4 @@ void W3DDisplayString::setWordWrapCentered( Bool isCentered ) // set the Word Wrap if( m_textRenderer.Set_Word_Wrap_Centered(isCentered) ) notifyTextChanged(); -}// void setWordWrap( Int wordWrap ) +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp index 3c922dbe544..9b5058abd4f 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp @@ -120,7 +120,7 @@ DisplayString *W3DDisplayStringManager::newDisplayString( void ) assert( 0 ); return NULL; - } // end if + } // assign a default font if (TheGlobalLanguageData && TheGlobalLanguageData->m_defaultDisplayStringFont.name.isNotEmpty()) @@ -139,7 +139,7 @@ DisplayString *W3DDisplayStringManager::newDisplayString( void ) // return our new string return newString; -} // end newDisplayString +} //------------------------------------------------------------------------------------------------- /** Remove a display string from the master list and delete the data */ @@ -162,7 +162,7 @@ void W3DDisplayStringManager::freeDisplayString( DisplayString *string ) // free data deleteInstance(string); -} // end freeDisplayString +} //------------------------------------------------------------------------------------------------- /** Update method for our display string Manager ... if it's been too @@ -217,16 +217,16 @@ void W3DDisplayStringManager::update( void ) // string->m_lastResourceFrame = 0; - } // end if + } // move to next string string = static_cast(string->next()); - } // end while + } // reset the starting point for our next search m_currentCheckpoint = string; -} // end update +} //------------------------------------------------------------------------------------------------- DisplayString *W3DDisplayStringManager::getGroupNumeralString( Int numeral ) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp index 7abe2b7a516..fdd14ec1fc5 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp @@ -174,14 +174,14 @@ char const * GameFileClass::Set_Name( char const *filename ) strcpy( m_filePath, W3D_DIR_PATH ); strcat( m_filePath, filename ); - } // end if + } else if( isImageFileType(fileType) ) { strcpy( m_filePath, TGA_DIR_PATH ); strcat( m_filePath, filename ); - } // end else if + } else strcpy( m_filePath, filename ); @@ -199,19 +199,19 @@ char const * GameFileClass::Set_Name( char const *filename ) strcpy( m_filePath, LEGACY_W3D_DIR_PATH ); strcat( m_filePath, filename ); - } // end if + } else if( isImageFileType(fileType) ) { strcpy( m_filePath, LEGACY_TGA_DIR_PATH ); strcat( m_filePath, filename ); - } // end else if + } // see if the file exists m_fileExists = TheFileSystem->doesFileExist( m_filePath ); - } // end if + } #endif // if file is still not found, try the test art folders @@ -225,19 +225,19 @@ char const * GameFileClass::Set_Name( char const *filename ) strcpy( m_filePath, TEST_W3D_DIR_PATH ); strcat( m_filePath, filename ); - } // end if + } else if( isImageFileType(fileType) ) { strcpy( m_filePath, TEST_TGA_DIR_PATH ); strcat( m_filePath, filename ); - } // end else if + } // see if the file exists m_fileExists = TheFileSystem->doesFileExist( m_filePath ); - } // end if + } #endif // We allow the user to load their own images for various assets (like the control bar) @@ -249,19 +249,19 @@ char const * GameFileClass::Set_Name( char const *filename ) //strcpy( m_filePath, USER_W3D_DIR_PATH ); strcat( m_filePath, filename ); - } // end if + } if( isImageFileType(fileType) ) { sprintf(m_filePath,USER_TGA_DIR_PATH, TheGlobalData->getPath_UserData().str()); //strcpy( m_filePath, USER_TGA_DIR_PATH ); strcat( m_filePath, filename ); - } // end else if + } // see if the file exists m_fileExists = TheFileSystem->doesFileExist( m_filePath ); - } // end if + } // We Need to be able to "temporarily copy over the map preview for whichever directory it came from @@ -273,12 +273,12 @@ char const * GameFileClass::Set_Name( char const *filename ) //strcpy( m_filePath, USER_TGA_DIR_PATH ); strcat( m_filePath, filename ); - } // end else if + } // see if the file exists m_fileExists = TheFileSystem->doesFileExist( m_filePath ); - } // end if + } // We need to be able to grab images from a localization dir, because Art has a fetish for baked-in text. Munkee. if( m_fileExists == FALSE ) @@ -289,12 +289,12 @@ char const * GameFileClass::Set_Name( char const *filename ) sprintf(m_filePath,localizedPathFormat, GetRegistryLanguage().str()); strcat( m_filePath, filename ); - } // end else if + } // see if the file exists m_fileExists = TheFileSystem->doesFileExist( m_filePath ); - } // end if + } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp index 2f557a88606..0b9cdc576c9 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp @@ -64,14 +64,14 @@ W3DGameClient::W3DGameClient() { -} // end W3DGameClient +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- W3DGameClient::~W3DGameClient() { -} // end ~W3DGameClient +} //------------------------------------------------------------------------------------------------- /** Initialize resources for the w3d game client */ @@ -82,7 +82,7 @@ void W3DGameClient::init( void ) // extending initialization routine GameClient::init(); -} // end init +} //------------------------------------------------------------------------------------------------- /** Per frame udpate, note we are extending functionality */ @@ -93,7 +93,7 @@ void W3DGameClient::update( void ) // call base GameClient::update(); -} // end update +} //------------------------------------------------------------------------------------------------- /** Reset this device client system. Note we are extending reset functionality from @@ -105,7 +105,7 @@ void W3DGameClient::reset( void ) // call base class GameClient::reset(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** allocate a new drawable using the thing template for initialization. @@ -162,9 +162,9 @@ void W3DGameClient::createRayEffectByTemplate( const Coord3D *start, // add this ray effect to the list of ray effects TheRayEffects->addRayEffect( draw, start, end ); - } // end if + } -} // end createRayEffectByTemplate +} //------------------------------------------------------------------------------------------------- /** Tell all the drawables what time of day it is now */ @@ -183,7 +183,7 @@ void W3DGameClient::setTimeOfDay( TimeOfDay tod ) //tell the display to update its lighting TheDisplay->setTimeOfDay( tod ); -} // end setTimeOfDay +} //------------------------------------------------------------------------------------------------- @@ -193,7 +193,7 @@ void W3DGameClient::setTeamColor(Int red, Int green, Int blue) W3DStatusCircle::setColor(red, green, blue); -} // end setTeamColor +} //------------------------------------------------------------------------------------------------- /** temporary entry point for adjusting LOD for development testing. */ @@ -221,4 +221,4 @@ void W3DGameClient::adjustLOD( Int adj ) // if( TheTerrainRenderObject ) // TheTerrainRenderObject->adjustTerrainLOD( adj ); -} // end adjustLOD +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp index 5edc124ab2f..129256c8013 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp @@ -273,12 +273,12 @@ W3DInGameUI::W3DInGameUI() m_moveHintRenderObj[ i ] = NULL; m_moveHintAnim[ i ] = NULL; - } // end for i + } m_buildingPlacementAnchor = NULL; m_buildingPlacementArrow = NULL; -} // end W3DInGameUI +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -293,12 +293,12 @@ W3DInGameUI::~W3DInGameUI() REF_PTR_RELEASE( m_moveHintRenderObj[ i ] ); REF_PTR_RELEASE( m_moveHintAnim[ i ] ); - } // end for i + } REF_PTR_RELEASE( m_buildingPlacementAnchor ); REF_PTR_RELEASE( m_buildingPlacementArrow ); -} // end ~W3DInGameUI +} // loadText =================================================================== /** Load text from the file */ @@ -326,12 +326,12 @@ static void loadText( char *filename, GameWindow *listboxText ) if (line.isEmpty()) line = UnicodeString(L" "); GadgetListBoxAddEntryText(listboxText, line, color, -1, -1); - } // end while + } // close the file fclose( fp ); -} // end loadText +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -355,10 +355,10 @@ void W3DInGameUI::init( void ) // hide it for now motd->winHide( TRUE ); - } // end if + } */ -} // end init +} //------------------------------------------------------------------------------------------------- /** Update in game UI */ @@ -369,7 +369,7 @@ void W3DInGameUI::update( void ) // call base InGameUI::update(); -} // end update +} //------------------------------------------------------------------------------------------------- /** Reset the in game ui */ @@ -380,7 +380,7 @@ void W3DInGameUI::reset( void ) // call base InGameUI::reset(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Draw member for the W3D implemenation of the game user interface */ @@ -413,9 +413,9 @@ void W3DInGameUI::draw( void ) // draw placement angle selection if needed drawPlaceAngle( view ); - } // end for view + } - } // end if + } // repaint all our windows @@ -439,7 +439,7 @@ void W3DInGameUI::draw( void ) } #endif -} // end draw +} //------------------------------------------------------------------------------------------------- /** draw 2d selection region on screen */ @@ -456,7 +456,7 @@ void W3DInGameUI::drawSelectionRegion( void ) width, color ); -} // end drawSelectionRegion +} //------------------------------------------------------------------------------------------------- /** Draw the visual feedback for clicking in the world and telling units @@ -501,7 +501,7 @@ void W3DInGameUI::drawMoveHints( View *view ) DEBUG_CRASH(("unable to create hint")); return; - } // end if + } // asign render objects to GUI data m_moveHintRenderObj[ i ] = hint; @@ -511,7 +511,7 @@ void W3DInGameUI::drawMoveHints( View *view ) REF_PTR_RELEASE(m_moveHintAnim[i]); m_moveHintAnim[i] = anim; - } // end if, create render objects + } // show the render object if hidden if( m_moveHintRenderObj[ i ]->Is_Hidden() == 1 ) { @@ -560,8 +560,8 @@ void W3DInGameUI::drawMoveHints( View *view ) // draw the line TheDisplay->drawLine( start.x, start.y, end.x, end.y, width, color ); - } // end if - } // end if + } + } #endif } @@ -575,11 +575,11 @@ void W3DInGameUI::drawMoveHints( View *view ) W3DDisplay::m_3DScene->Remove_Render_Object( m_moveHintRenderObj[ i ] ); } - } // end else + } - } // end for i + } -} // end drawMoveHints +} //------------------------------------------------------------------------------------------------- /** Draw visual back for clicking to attack a unit in the world */ @@ -587,7 +587,7 @@ void W3DInGameUI::drawMoveHints( View *view ) void W3DInGameUI::drawAttackHints( View *view ) { -} // end drawAttackHints +} //------------------------------------------------------------------------------------------------- /** Draw the angle selection for placing building if needed */ @@ -729,5 +729,5 @@ void W3DInGameUI::drawPlaceAngle( View *view ) //start.y = o.y * size + p.y * (size/2.0f) + end.y; //TheDisplay->drawLine( start.x, start.y, end.x, end.y, width, color ); -} // end drawPlaceAngle +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp index d3b64be4929..260558f8cb6 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp @@ -104,7 +104,7 @@ W3DMouse::W3DMouse( void ) m_camera = NULL; m_drawing = FALSE; -} // end Win32Mouse +} W3DMouse::~W3DMouse( void ) { @@ -121,7 +121,7 @@ W3DMouse::~W3DMouse( void ) thread.Stop(); -} // end Win32Mouse +} void W3DMouse::initPolygonAssets(void) { @@ -343,7 +343,7 @@ void W3DMouse::init( void ) thread.Execute(); thread.Set_Priority(0); -} // end int +} //------------------------------------------------------------------------------------------------- /** Reset */ @@ -354,7 +354,7 @@ void W3DMouse::reset( void ) // extend Win32Mouse::reset(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Super basic simplistic cursor */ @@ -468,7 +468,7 @@ void W3DMouse::setCursor( MouseCursor cursor ) // save current cursor m_currentCursor = cursor; -} // end setCursor +} extern HWND ApplicationHWnd; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp index 4a70009fc87..f71bccd308b 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp @@ -324,7 +324,7 @@ void W3DParticleSystemManager::doParticles(RenderInfoClass &rinfo) */ - }// next system + } /// @todo lorenzen sez: this should be debug only: TheParticleSystemManager->setOnScreenParticleCount(m_onScreenParticleCount); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp index d2411d9e97e..a2e634c6190 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp @@ -1597,7 +1597,7 @@ void W3DRoadBuffer::addMapObjects() curRoad.m_scale = road->getRoadWidth(); curRoad.m_uniqueID = road->getID(); found = TRUE; - } // end if + } #ifdef LOAD_TEST_ASSETS const Real DEFAULT_SCALE = 30; if (!found) { @@ -3116,9 +3116,9 @@ void W3DRoadBuffer::allocateRoadBuffers(void) m_maxUID = id; #endif // LOAD_TEST_ASSETS - } // end if + } - } // end for road + } #ifdef LOAD_TEST_ASSETS while (iSet_Diffuse( restore ); - } // next light + } temp = lightEnv.Get_Equivalent_Ambient(); Vector3::Add(sumTint, temp, &temp ); @@ -777,12 +777,12 @@ void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, I rinfo.Pop_Override_Flags(); rinfo.Pop_Material_Pass(); } - }//drawInfo exists so rendering a drawable. + } else { robj->Render(rinfo); } - }//drawable or robj is not hidden + } rinfo.light_environment = NULL; if (doExtraMaterialPop) //check if there is an extra material on the stack from the heatvision effect. @@ -1139,7 +1139,7 @@ void RTS3DScene::Customized_Render( RenderInfoClass &rinfo ) { TheParticleSystemManager->queueParticleRender(); } -} // end Customized_Renderer +} /**Convert a player index to a color index, we use this because color indices are assigned in left-right binary flipped fashion so as not to occupy lower bits unless @@ -1264,7 +1264,7 @@ void renderStenciledPlayerColor( UnsignedInt color, UnsignedInt stencilRef, Bool if (oldColorWriteEnable != 0x12345678) DX8Wrapper::Set_DX8_Render_State(D3DRS_COLORWRITEENABLE,oldColorWriteEnable); -} // end renderStencilShadows +} #define MAX_VISIBLE_OCCLUDED_PLAYER_OBJECTS 512 //maximum number of occluded objects permitted per player void RTS3DScene::flushOccludedObjectsIntoStencil(RenderInfoClass & rinfo) @@ -1645,7 +1645,7 @@ void RTS3DScene::doRender( CameraClass * cam ) DRAW(); m_camera = NULL; -} // end Customized_Render +} //============================================================================= // RTS3DScene::draw @@ -1662,7 +1662,7 @@ void RTS3DScene::draw( ) WW3D::Render( this, m_camera ); -} // end Customized_Render +} /////////////////////////////////////////////////////////////////////////////// @@ -1679,7 +1679,7 @@ RTS2DScene::RTS2DScene() setName("RTS2DScene"); m_status = NEW_REF( W3DStatusCircle, () ); Add_Render_Object( m_status ); -} // end RTS2DScene +} //============================================================================= // RTS2DScene::~RTS2DScene @@ -1690,7 +1690,7 @@ RTS2DScene::~RTS2DScene() { this->Remove_Render_Object(m_status); REF_PTR_RELEASE(m_status); -} // end ~RTS2DScene +} //============================================================================= // RTS2DScene::Custimized_Render @@ -1703,7 +1703,7 @@ void RTS2DScene::Customized_Render( RenderInfoClass &rinfo ) // call simple scene class renderer SimpleSceneClass::Customized_Render( rinfo ); -} // end Customized_Render +} //============================================================================= // RTS2DScene::doRender @@ -1717,7 +1717,7 @@ void RTS2DScene::doRender( CameraClass * cam ) DRAW(); m_camera = NULL; -} // end Customized_Render +} //============================================================================= // RTS2DScene::draw @@ -1734,7 +1734,7 @@ void RTS2DScene::draw( ) WW3D::Render( this, m_camera ); -} // end Customized_Render +} @@ -1749,7 +1749,7 @@ void RTS2DScene::draw( ) //============================================================================= RTS3DInterfaceScene::RTS3DInterfaceScene() { -} // end RTS3DInterfaceScene +} //============================================================================= // RTS3DInterfaceScene::~RTS3DInterfaceScene @@ -1758,7 +1758,7 @@ RTS3DInterfaceScene::RTS3DInterfaceScene() //============================================================================= RTS3DInterfaceScene::~RTS3DInterfaceScene() { -} // end ~RTS3DInterfaceScene +} //============================================================================= // RTS3DInterfaceScene::Custimized_Render @@ -1771,7 +1771,7 @@ void RTS3DInterfaceScene::Customized_Render( RenderInfoClass &rinfo ) // call simple scene class renderer SimpleSceneClass::Customized_Render( rinfo ); -} // end Customized_Render +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp index cb21d257921..2c9d8a26d51 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp @@ -1491,7 +1491,7 @@ Int TerrainShader2Stage::set(Int pass) DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_ADDRESSU, D3DTADDRESS_WRAP); DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_ADDRESSV, D3DTADDRESS_WRAP); - } //ST_TERRAIN_BASE_NOISE12 + } else { //only 1 noise or cloud texture // Now setup the texture pipeline. @@ -2222,7 +2222,7 @@ Int RoadShader2Stage::set(Int pass) DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_COLOROP, D3DTOP_DISABLE ); DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE ); } - } //pass 0 + } else { //pass 1, apply additional noise pass Matrix4x4 curView; @@ -2726,7 +2726,7 @@ ChipsetType W3DShaderManager::getChipset( void ) if (maxTextures >= 8 && pixelShaderVersion >= 2.0f) chip=DC_GENERIC_PIXEL_SHADER_2_0; } - } //D3D8 interface and device exist. + } return chip; } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp index a766da69cba..7e1d5b352cc 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp @@ -491,11 +491,11 @@ TerrainTracksRenderObjClass *TerrainTracksRenderObjClassSystem::bindTrack( Rende mod->init(computeTrackSpacing(renderObject),length,texturename); mod->m_bound=true; m_TerrainTracksScene->Add_Render_Object( mod); - } // end if + } return mod; -} //end bindTrack +} //============================================================================= //TerrainTracksRenderObjClassSystem::unbindTrack @@ -658,7 +658,7 @@ void TerrainTracksRenderObjClassSystem::init( SceneClass *TerrainTracksScene ) assert( 0 ); return; - } // end if + } // allocate our modules for this system for( i = 0; i < numModules; i++ ) @@ -673,7 +673,7 @@ void TerrainTracksRenderObjClassSystem::init( SceneClass *TerrainTracksScene ) assert( 0 ); return; - } // end if + } mod->m_prevSystem = NULL; mod->m_nextSystem = m_freeModules; @@ -681,9 +681,9 @@ void TerrainTracksRenderObjClassSystem::init( SceneClass *TerrainTracksScene ) m_freeModules->m_prevSystem = mod; m_freeModules = mod; - } // end for i + } -} // end init +} //============================================================================= // TerrainTracksRenderObjClassSystem::shutdown @@ -705,7 +705,7 @@ void TerrainTracksRenderObjClassSystem::shutdown( void ) releaseTrack(mod); mod = nextMod; - } // end while + } // free all attached things and used modules @@ -719,13 +719,13 @@ void TerrainTracksRenderObjClassSystem::shutdown( void ) REF_PTR_RELEASE (m_freeModules); m_freeModules = nextMod; - } // end while + } REF_PTR_RELEASE(m_indexBuffer); REF_PTR_RELEASE(m_vertexMaterialClass); REF_PTR_RELEASE(m_vertexBuffer); -} // end shutdown +} //============================================================================= // TerrainTracksRenderObjClassSystem::update @@ -778,7 +778,7 @@ void TerrainTracksRenderObjClassSystem::update() releaseTrack(mod); } mod = nextMod; - } // end while + } } @@ -878,13 +878,12 @@ Try improving the fit to vertical surfaces like cliffs. verts->diffuse=diffuseLight | ( REAL_TO_INT(distanceFade*255.0f) <<24); verts++; - }//for - }// mod has edges to render + } + } mod = mod->m_nextSystem; - } //while (mod) - }//edges to flush + } + } - //there are some edges to render in pool. //draw the filled vertex buffers if (m_edgesToFlush >= 2) { @@ -927,7 +926,7 @@ void TerrainTracksRenderObjClassSystem::Reset(void) releaseTrack(mod); mod = nextMod; - } // end while + } // free all attached things and used modules @@ -951,7 +950,7 @@ void TerrainTracksRenderObjClassSystem::clearTracks(void) mod->m_totalEdgesAdded=0; mod = mod->m_nextSystem; - } // end while + } m_edgesToFlush=0; } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp index 0e6f8b97029..8b09244a7be 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp @@ -67,7 +67,7 @@ W3DTerrainVisual::W3DTerrainVisual() m_waterRenderObject = NULL; TheWaterRenderObj = NULL; -} // end W3DTerrainVisual +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -94,7 +94,7 @@ W3DTerrainVisual::~W3DTerrainVisual() TheWaterRenderObj=NULL; REF_PTR_RELEASE( m_terrainRenderObject ); REF_PTR_RELEASE( m_terrainHeightMap ); -} // end ~W3DTerrainVisual +} //------------------------------------------------------------------------------------------------- /** init */ @@ -163,7 +163,7 @@ void W3DTerrainVisual::init( void ) TheGlobalData->m_vertexWaterAttenuationRange[ waterSettingIndex ] ); m_isWaterGridRenderingEnabled = FALSE; -} // end init +} //------------------------------------------------------------------------------------------------- /** reset */ @@ -198,7 +198,7 @@ void W3DTerrainVisual::reset( void ) m_waterRenderObject->reset(); } -} // end reset +} //------------------------------------------------------------------------------------------------- /** update */ @@ -213,7 +213,7 @@ void W3DTerrainVisual::update( void ) if( m_waterRenderObject ) m_waterRenderObject->update(); -} // end update +} //------------------------------------------------------------------------------------------------- /** load method for W3D visual terrain */ @@ -253,7 +253,7 @@ Bool W3DTerrainVisual::load( AsciiString filename ) REF_PTR_RELEASE( m_terrainRenderObject ); return FALSE; - } // end if + } if( m_terrainRenderObject == NULL ) return FALSE; @@ -352,7 +352,7 @@ Bool W3DTerrainVisual::load( AsciiString filename ) return TRUE; // success -} // end load +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -366,7 +366,7 @@ void W3DTerrainVisual::enableWaterGrid( Bool enable ) if( m_waterRenderObject ) m_waterRenderObject->enableWaterGrid( enable ); -} // end enableWaterGrid +} //------------------------------------------------------------------------------------------------- /** intersect the ray with the terrain, if a hit occurs TRUE is returned @@ -398,14 +398,14 @@ Bool W3DTerrainVisual::intersectTerrain( Coord3D *rayStart, result->y = point.Y; result->z = point.Z; - } // end if + } - } // end if + } // return hit result return hit; -} // end intersectTerrain +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -415,7 +415,7 @@ void W3DTerrainVisual::getTerrainColorAt( Real x, Real y, RGBColor *pColor ) if( m_terrainHeightMap ) m_terrainHeightMap->getTerrainColorAt( x, y, pColor ); -} // end getTerrainColorAt +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -429,11 +429,11 @@ TerrainType *W3DTerrainVisual::getTerrainTile( Real x, Real y ) tile = TheTerrainTypes->findTerrain( tileName ); - } // end if + } return tile; -} // end getTerrainTile +} // ------------------------------------------------------------------------------------------------ /** set min/max height values allowed in water grid pointed to by waterTable */ @@ -445,7 +445,7 @@ void W3DTerrainVisual::setWaterGridHeightClamps( const WaterHandle *waterTable, if( m_waterRenderObject ) m_waterRenderObject->setGridHeightClamps( minZ, maxZ ); -} // end setWaterGridHeightClamps +} // ------------------------------------------------------------------------------------------------ /** adjust fallof parameters for grid change method */ @@ -457,7 +457,7 @@ void W3DTerrainVisual::setWaterAttenuationFactors( const WaterHandle *waterTable if( m_waterRenderObject ) m_waterRenderObject->setGridChangeAttenuationFactors( a, b, c, range ); -} // end setWaterAttenuationFactors +} // ------------------------------------------------------------------------------------------------ /** set the water table position and orientation in world space */ @@ -469,7 +469,7 @@ void W3DTerrainVisual::setWaterTransform( const WaterHandle *waterTable, if( m_waterRenderObject ) m_waterRenderObject->setGridTransform( angle, x, y, z ); -} // end setWaterTransform +} // ------------------------------------------------------------------------------------------------ /** set water table transform by matrix */ @@ -480,7 +480,7 @@ void W3DTerrainVisual::setWaterTransform( const Matrix3D *transform ) if( m_waterRenderObject ) m_waterRenderObject->setGridTransform( transform ); -} // end setWaterTransform +} // ------------------------------------------------------------------------------------------------ /** get the water transform matrix */ @@ -491,7 +491,7 @@ void W3DTerrainVisual::getWaterTransform( const WaterHandle *waterTable, Matrix3 if( m_waterRenderObject ) m_waterRenderObject->getGridTransform( transform ); -} // end getWaterTransform +} // ------------------------------------------------------------------------------------------------ /** water grid resolution spacing */ @@ -503,7 +503,7 @@ void W3DTerrainVisual::setWaterGridResolution( const WaterHandle *waterTable, if( m_waterRenderObject ) m_waterRenderObject->setGridResolution( gridCellsX, gridCellsY, cellSize ); -} // end setWaterGridResolution +} // ------------------------------------------------------------------------------------------------ /** get water grid resolution spacing */ @@ -515,7 +515,7 @@ void W3DTerrainVisual::getWaterGridResolution( const WaterHandle *waterTable, if( m_waterRenderObject ) m_waterRenderObject->getGridResolution( gridCellsX, gridCellsY, cellSize ); -} // end getWaterGridResolution +} // ------------------------------------------------------------------------------------------------ /** adjust the water grid in world coords by the delta */ @@ -526,7 +526,7 @@ void W3DTerrainVisual::changeWaterHeight( Real x, Real y, Real delta ) if( m_waterRenderObject ) m_waterRenderObject->changeGridHeight( x, y, delta ); -} // end changeWaterHeight +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -537,7 +537,7 @@ void W3DTerrainVisual::addWaterVelocity( Real worldX, Real worldY, if( m_waterRenderObject ) m_waterRenderObject->addVelocity( worldX, worldY, velocity, preferredHeight ); -} // end addWaterVelocity +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -728,7 +728,7 @@ void W3DTerrainVisual::crc( Xfer *xfer ) // extend base class TerrainVisual::crc( xfer ); -} // end CRC +} // ------------------------------------------------------------------------------------------------ /** Xfer @@ -755,7 +755,7 @@ void W3DTerrainVisual::xfer( Xfer *xfer ) DEBUG_CRASH(( "W3DTerrainVisual::xfer - m_isWaterGridRenderingEnabled mismatch" )); throw SC_INVALID_DATA; - } // end if + } // xfer grid data if enabled if( gridEnabled ) @@ -776,7 +776,7 @@ void W3DTerrainVisual::xfer( Xfer *xfer ) width, getGridWidth() )); throw SC_INVALID_DATA; - } // end if + } if( height != getGridHeight() ) { @@ -784,11 +784,11 @@ void W3DTerrainVisual::xfer( Xfer *xfer ) height, getGridHeight() )); throw SC_INVALID_DATA; - } // end if + } // write data for each grid - } // end if + } */ // Write out the terrain height data. @@ -810,7 +810,7 @@ void W3DTerrainVisual::xfer( Xfer *xfer ) } } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -821,5 +821,5 @@ void W3DTerrainVisual::loadPostProcess( void ) // extend base class TerrainVisual::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 7004b62d46a..43657ed7c2d 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -172,7 +172,7 @@ W3DView::W3DView() m_locationRequests.clear(); m_locationRequests.reserve(MAX_REQUEST_CACHE_SIZE + 10); // This prevents the vector from ever re-allocing -} // end W3DView +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -182,7 +182,7 @@ W3DView::~W3DView() REF_PTR_RELEASE( m_2DCamera ); REF_PTR_RELEASE( m_3DCamera ); -} // end ~W3DView +} //------------------------------------------------------------------------------------------------- /** Sets the height of the viewport, while maintaining original camera perspective. */ @@ -518,7 +518,7 @@ void W3DView::init( void ) m_scrollAmountCutoff = TheGlobalData->m_scrollAmountCutoff; -} // end init +} //------------------------------------------------------------------------------------------------- const Coord3D& W3DView::get3DCameraPosition() const @@ -557,7 +557,7 @@ static void drawDrawable( Drawable *draw, void *userData ) draw->draw(); -} // end drawDrawable +} // ------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------- @@ -623,7 +623,7 @@ static void drawContainedDrawable( Object *obj, void *userData ) if( draw ) drawDrawableExtents( draw, userData ); -} // end drawContainedDrawable +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -673,11 +673,11 @@ static void drawDrawableExtents( Drawable *draw, void *userData ) z += draw->getDrawableGeometryInfo().getMaxHeightAbovePosition(); - } // end for i + } break; - } // end case box + } //--------------------------------------------------------------------------------------------- case GEOMETRY_SPHERE: // not quite right, but close enough @@ -693,7 +693,7 @@ static void drawDrawableExtents( Drawable *draw, void *userData ) // next time 'round, draw the top of the cylinder center.z += draw->getDrawableGeometryInfo().getMaxHeightAbovePosition(); - } // end for i + } // draw centerline ICoord2D start, end; @@ -705,9 +705,9 @@ static void drawDrawableExtents( Drawable *draw, void *userData ) break; - } // case CYLINDER + } - } // end switch + } // draw any extents for things that are contained by this Object *obj = draw->getObject(); @@ -718,9 +718,9 @@ static void drawDrawableExtents( Drawable *draw, void *userData ) if( contain ) contain->iterateContained( drawContainedDrawable, userData, FALSE ); - } // end if + } -} // end drawDrawableExtents +} void drawAudioLocations( Drawable *draw, void *userData ); @@ -734,7 +734,7 @@ static void drawContainedAudioLocations( Object *obj, void *userData ) if( draw ) drawAudioLocations( draw, userData ); -} // end drawContainedAudio +} //------------------------------------------------------------------------------------------------- @@ -751,7 +751,7 @@ static void drawAudioLocations( Drawable *draw, void *userData ) if( contain ) contain->iterateContained( drawContainedAudioLocations, userData, FALSE ); - } // end if + } const ThingTemplate * thingTemplate = draw->getTemplate(); @@ -879,7 +879,7 @@ static void drawablePostDraw( Drawable *draw, void *userData ) TheGameClient->incrementRenderedObjectCount(); -} // end drawablePostDraw +} //------------------------------------------------------------------------------------------------- // Display AI debug visuals @@ -1272,7 +1272,7 @@ void W3DView::getAxisAlignedViewRegion(Region3D &axisAlignedRegion) if( box[ i ].y > axisAlignedRegion.hi.y ) axisAlignedRegion.hi.y = box[ i ].y; - } // end for i + } // low and high regions will be based of the extent of the map Region3D mapExtent; @@ -1533,7 +1533,7 @@ void W3DView::draw( void ) } } - } // end if, show debug AI + } #if defined(RTS_DEBUG) if( TheGlobalData->m_debugCamera ) @@ -1694,9 +1694,9 @@ void W3DView::scrollBy( Coord2D *delta ) // set new camera position setCameraTransform(); - } // end if + } -} // end scrollBy +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1787,7 +1787,7 @@ void W3DView::setHeightAboveGround(Real z) if (m_heightAboveGround > m_maxHeightAboveGround) m_heightAboveGround = m_maxHeightAboveGround; - } // end if + } m_doingMoveCameraOnWaypointPath = false; m_doingRotateCamera = false; @@ -1908,10 +1908,10 @@ View::WorldToScreenReturn W3DView::worldToScreenTriReturn( const Coord3D *w, ICo return WTS_INSIDE_FRUSTUM; - } // end if + } return WTS_INVALID; -} // end worldToScreenTriReturn +} //------------------------------------------------------------------------------------------------- /** Using the W3D camera translate the screen coord to world coord */ @@ -1926,9 +1926,9 @@ void W3DView::screenToWorld( const ICoord2D *s, Coord3D *w ) if( m_3DCamera ) { DEBUG_CRASH(("implement me")); - } // end if + } -} // end screenToWorld +} //------------------------------------------------------------------------------------------------- /** all the drawables in the view, that fall within the 2D screen region @@ -1972,7 +1972,7 @@ Int W3DView::iterateDrawablesInRegion( IRegion2D *screenRegion, normalizedRegion.hi.x = ((Real)(screenRegion->hi.x - m_originX) / (Real)getWidth()) * 2.0f - 1.0f; normalizedRegion.hi.y = -(((Real)(screenRegion->lo.y - m_originY) / (Real)getHeight()) * 2.0f - 1.0f); - } // end if + } Drawable *onlyDrawableToTest = NULL; @@ -2023,10 +2023,10 @@ Int W3DView::iterateDrawablesInRegion( IRegion2D *screenRegion, inside = TRUE; - } // end if + } } - } //end else + } // if inside do the callback and count up if( inside ) @@ -2035,17 +2035,17 @@ Int W3DView::iterateDrawablesInRegion( IRegion2D *screenRegion, if( callback( draw, userData ) ) ++count; - } // end if + } // If onlyDrawableToTest, then we should bail out now. if (onlyDrawableToTest != NULL) break; - } // end for draw + } return count; -} // end iterateDrawablesInRegion +} //------------------------------------------------------------------------------------------------- /** cast a ray from the screen coords into the scene and return a drawable @@ -2104,7 +2104,7 @@ Drawable *W3DView::pickDrawable( const ICoord2D *screen, Bool forceAttack, PickT return draw; -} // end pickDrawable +} //------------------------------------------------------------------------------------------------- /** convert a pixel (x,y) to a location in the world on the terrain. @@ -2151,7 +2151,7 @@ void W3DView::screenToTerrain( const ICoord2D *screen, Coord3D *world ) // get the point of intersection according to W3D intersection = result.ContactPoint; - } // end if + } // Pick bridges. Vector3 bridgePt; @@ -2169,7 +2169,7 @@ void W3DView::screenToTerrain( const ICoord2D *screen, Coord3D *world ) req.second = (*world); m_locationRequests.push_back(req); // Insert this request at the end, requires no extra copies -} // end screenToTerrain +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2208,7 +2208,7 @@ void W3DView::lookAt( const Coord3D *o ) pos.x = result.ContactPoint.X; pos.y = result.ContactPoint.Y; - } // end if + } } pos.z = 0; setPosition(&pos); @@ -3151,5 +3151,5 @@ void W3DView::screenToWorldAtZ( const ICoord2D *s, Coord3D *w, Real z ) w->y = Vector3::Find_Y_At_Z( z, rayStart, rayEnd ); w->z = z; -} // end screenToWorldAtZ +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp index 5b05ac88837..af8492bf79e 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp @@ -520,7 +520,7 @@ HRESULT WaterRenderObjClass::initBumpMap(LPDIRECT3DTEXTURE8 *pTex, TextureClass pTex[0]->UnlockRect(level); surf->Unlock(); REF_PTR_RELEASE (surf); - }//for each level + } #else surf=pBumpSource->Get_Surface_Level(); @@ -1141,14 +1141,14 @@ void WaterRenderObjClass::reset( void ) // on to the next one pData++; - } // end for i + } - } // end for j + } // mesh data is no longer in motion m_meshInMotion = FALSE; - } // end if, water type 3 + } if (m_waterTrackSystem) m_waterTrackSystem->reset(); @@ -1262,32 +1262,32 @@ void WaterRenderObjClass::update( void ) pData->height = pData->preferredHeight; pData->velocity = 0.0f; - } // end if + } else { // there is still motion in the mesh, we need to process next frame m_meshInMotion = TRUE; - } // end else + } - } // end if + } // on to the next one pData++; - } // end for i + } - } // end for j + } - } // end if + } // mark the last logic frame we processed on lastLogicFrame = currLogicFrame; - } // end if, a logic frame has passed + } -} // end update +} //------------------------------------------------------------------------------------------------- @@ -1687,12 +1687,12 @@ void WaterRenderObjClass::Render(RenderInfoClass & rinfo) ShaderClass::Invalidate(); //reset shading system so it forces full state set. renderWater(); - } //WATER_TYPE_1 + } break; default: break; - }//switch + } if (TheGlobalData && TheGlobalData->m_drawSkyBox) { //center skybox around camera @@ -2506,7 +2506,7 @@ void WaterRenderObjClass::addVelocity( Real worldX, Real worldY, } - } // end if, water type is 3 + } } @@ -2668,11 +2668,11 @@ Real WaterRenderObjClass::getWaterHeight(Real x, Real y) waterZ = pTrig->getPoint( 0 )->z; waterHandle = pTrig->getWaterHandle(); - } // end if + } - } // end if + } - } // end for + } if (waterHandle) return waterHandle->m_polygon->getPoint( 0 )->z; @@ -3397,7 +3397,7 @@ void WaterRenderObjClass::renderSkyBody(Matrix3D *mat) void WaterRenderObjClass::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer @@ -3421,7 +3421,7 @@ void WaterRenderObjClass::xfer( Xfer *xfer ) DEBUG_CRASH(( "WaterRenderObjClass::xfer - cells X mismatch" )); throw SC_INVALID_DATA; - } // end if + } // grid cells Y Int cellsY = m_gridCellsY; @@ -3432,7 +3432,7 @@ void WaterRenderObjClass::xfer( Xfer *xfer ) DEBUG_CRASH(( "WaterRenderObjClass::xfer - cells Y mismatch" )); throw SC_INVALID_DATA; - } // end if + } // xfer each of the mesh data points for( UnsignedInt i = 0; i < m_meshDataSize; ++i ) @@ -3450,9 +3450,9 @@ void WaterRenderObjClass::xfer( Xfer *xfer ) // preferred height xfer->xferUnsignedByte( &m_meshData[ i ].preferredHeight ); - } // end for, i + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -3460,6 +3460,6 @@ void WaterRenderObjClass::xfer( Xfer *xfer ) void WaterRenderObjClass::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp index c59db950268..0964c1ab4cf 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp @@ -541,7 +541,7 @@ WaterTracksObj *WaterTracksRenderSystem::bindTrack(waveType type) } mod->m_bound=true; - } // end if + } #ifdef SYNC_WAVES nextmod=m_usedModules; @@ -550,11 +550,11 @@ WaterTracksObj *WaterTracksRenderSystem::bindTrack(waveType type) { nextmod->m_elapsedMs=nextmod->m_initTimeOffset; nextmod=nextmod->m_nextSystem; - } // end while + } #endif return mod; -} //end bindTrack +} //============================================================================= //WaterTracksRenderSystem::unbindTrack @@ -728,7 +728,7 @@ void WaterTracksRenderSystem::init(void) assert( 0 ); return; - } // end if + } // allocate our modules for this system for( i = 0; i < numModules; i++ ) @@ -743,7 +743,7 @@ void WaterTracksRenderSystem::init(void) assert( 0 ); return; - } // end if + } mod->m_prevSystem = NULL; mod->m_nextSystem = m_freeModules; @@ -751,9 +751,9 @@ void WaterTracksRenderSystem::init(void) m_freeModules->m_prevSystem = mod; m_freeModules = mod; - } // end for i + } -} // end init +} void WaterTracksRenderSystem::reset(void) { @@ -769,7 +769,7 @@ void WaterTracksRenderSystem::reset(void) releaseTrack(mod); mod = nextMod; - } // end while + } // free all attached things and used modules @@ -796,7 +796,7 @@ void WaterTracksRenderSystem::shutdown( void ) releaseTrack(mod); mod = nextMod; - } // end while + } // free all attached things and used modules @@ -810,13 +810,13 @@ void WaterTracksRenderSystem::shutdown( void ) delete m_freeModules; m_freeModules = nextMod; - } // end while + } REF_PTR_RELEASE(m_indexBuffer); REF_PTR_RELEASE(m_vertexMaterialClass); REF_PTR_RELEASE(m_vertexBuffer); -} // end shutdown +} //============================================================================= // WaterTracksRenderSystem::update @@ -843,7 +843,7 @@ void WaterTracksRenderSystem::update() } mod = nextMod; - } // end while + } } @@ -914,7 +914,7 @@ Try improving the fit to vertical surfaces like cliffs. m_batchStart = vertsRendered; //advance past vertices already in buffer mod = mod->m_nextSystem; - } //while (mod) + } DX8Wrapper::Set_DX8_Render_State(D3DRS_ZBIAS,0); } @@ -930,7 +930,7 @@ WaterTracksObj *WaterTracksRenderSystem::findTrack(Vector2 &start, Vector2 &end, mod->m_type == type) return mod; mod = mod->m_nextSystem; - } //while (mod) + } return NULL; } void WaterTracksRenderSystem::saveTracks(void) @@ -965,7 +965,7 @@ void WaterTracksRenderSystem::saveTracks(void) trackCount++; } umod=umod->m_nextSystem; - } // end while + } fwrite(&trackCount,sizeof(trackCount),1,fp); fclose(fp); } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index 913744d9246..66b4abce4bc 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -134,7 +134,7 @@ void W3DRenderObjectSnapshot::update(RenderObjClass *robj, DrawableInfo *drawInf HAnimClass *hanim=((HLodClass *)robj)->Peek_Animation_And_Info(frame,numFrames,mode,mult); m_robj->Set_Animation(hanim,frame); disableUVAnimations(m_robj); - } //HLOD + } } else m_robj=robj; @@ -167,7 +167,7 @@ W3DRenderObjectSnapshot::W3DRenderObjectSnapshot(RenderObjClass *robj, DrawableI void W3DRenderObjectSnapshot::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -216,7 +216,7 @@ void W3DRenderObjectSnapshot::xfer( Xfer *xfer ) subObjectName.set( subObject->Get_Name() ); xfer->xferAsciiString( &subObjectName ); - } // end if, save + } else { @@ -226,7 +226,7 @@ void W3DRenderObjectSnapshot::xfer( Xfer *xfer ) // find this sub object on the object subObject = m_robj->Get_Sub_Object_By_Name( subObjectName.str() ); - } // end else load + } // // NOTE that the remainder of this xfer code works on a sub object only *if* @@ -259,18 +259,18 @@ void W3DRenderObjectSnapshot::xfer( Xfer *xfer ) if( subObject->Class_ID() == RenderObjClass::CLASSID_HLOD ) ((HLodClass *)subObject)->Friend_Set_Hierarchy_Valid( TRUE ); - } // end if + } // release reference to sub object if( subObject ) REF_PTR_RELEASE( subObject ); - } // end for, i + } // tell W3D that the transforms for our sub objects are all OK cause we've done them ourselves m_robj->Set_Sub_Object_Transforms_Dirty( FALSE ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -278,7 +278,7 @@ void W3DRenderObjectSnapshot::xfer( Xfer *xfer ) void W3DRenderObjectSnapshot::loadPostProcess( void ) { -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -597,7 +597,7 @@ void W3DGhostObject::crc( Xfer *xfer ) // extend base class GhostObject::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -634,7 +634,7 @@ void W3DGhostObject::xfer( Xfer *xfer ) if( drawableID != INVALID_DRAWABLE_ID && m_drawableInfo.m_drawable == NULL ) DEBUG_CRASH(( "W3DGhostObject::xfer - Unable to find drawable for ghost object" )); - } // end if + } // // no need to mess with this "circular" back into itself pointer to the ghost object @@ -659,7 +659,7 @@ void W3DGhostObject::xfer( Xfer *xfer ) // on to the next snapshot objectSnapshot = objectSnapshot->m_next; - } // end while + } // xfer the snapshot count at this index xfer->xferUnsignedByte( &snapshotCount ); @@ -674,7 +674,7 @@ void W3DGhostObject::xfer( Xfer *xfer ) DEBUG_CRASH(( "W3DGhostObject::xfer - m_parentShapshots[ %d ] has data present but the count from the xfer stream is empty", i )); throw INI_INVALID_DATA; - } // end if + } // xfer each of the snapshots at this index Real scale; @@ -706,9 +706,9 @@ void W3DGhostObject::xfer( Xfer *xfer ) // onto the next objectSnapshot = objectSnapshot->m_next; - } // end while + } - } // end if, save + } else { RenderObjClass *renderObject; @@ -746,11 +746,11 @@ void W3DGhostObject::xfer( Xfer *xfer ) // add snapshot to the scene objectSnapshot->addToScene(); - } // end for, j + } - } // end else, load + } - } // end for, i + } // // since there is a snapshot for this object, there cannot be a regular object/drawable @@ -793,11 +793,11 @@ void W3DGhostObject::xfer( Xfer *xfer ) status = m_partitionData->friend_getShroudednessPrevious( playerIndex ); xfer->xferUser( &status, sizeof( ObjectShroudStatus ) ); - } // end if, snapshot list here exists + } - } // end for, i + } - } // end if, save + } else { UnsignedByte i; @@ -817,11 +817,11 @@ void W3DGhostObject::xfer( Xfer *xfer ) xfer->xferUser( &status, sizeof( ObjectShroudStatus ) ); m_partitionData->friend_setShroudednessPrevious( playerIndex, status ); - } // end for, i + } - } // end else load + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -832,7 +832,7 @@ void W3DGhostObject::loadPostProcess( void ) // extend base class GhostObject::loadPostProcess(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -941,9 +941,9 @@ GhostObject *W3DGhostObjectManager::addGhostObject(Object *object, PartitionData ("W3DGhostObjectManager::addGhostObject - Duplicate ghost object detected\n") ); sanity = sanity->m_nextSystem; - } // end while + } - } // end if + } #endif W3DGhostObject *mod = m_freeModules; @@ -1129,7 +1129,7 @@ void W3DGhostObjectManager::crc( Xfer *xfer ) // extend base class GhostObjectManager::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -1175,9 +1175,9 @@ void W3DGhostObjectManager::xfer( Xfer *xfer ) // write out ghost object data xfer->xferSnapshot( w3dGhostObject ); - } // end for, ghostObject + } - } // end if, saving + } else { @@ -1220,7 +1220,7 @@ void W3DGhostObjectManager::xfer( Xfer *xfer ) object->getTemplate()->getName().str()) ); object->friend_getPartitionData()->friend_setGhostObject( ghostObject ); - } // end if + } else { @@ -1230,16 +1230,16 @@ void W3DGhostObjectManager::xfer( Xfer *xfer ) // register ghost object object with partition system and fill out partition data ThePartitionManager->registerGhostObject( ghostObject ); - } // end else + } // read ghost object data xfer->xferSnapshot( ghostObject ); - } // end for, i + } - } // end else, loading + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1250,4 +1250,4 @@ void W3DGhostObjectManager::loadPostProcess( void ) // extend base class GhostObjectManager::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp index 706e74b0c01..85f8c9b5bb4 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp @@ -49,7 +49,7 @@ m_mapMinZ(0), m_mapMaxZ(1) { m_mapData = NULL; -} // end W3DTerrainLogic +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -58,7 +58,7 @@ W3DTerrainLogic::~W3DTerrainLogic() // free terrain data -} // end W3DTerrainLogic +} //------------------------------------------------------------------------------------------------- /** Device DEPENDENT implementation init details for logical terrain */ @@ -73,7 +73,7 @@ void W3DTerrainLogic::init( void ) m_mapMinZ = 0; m_mapMaxZ = 1; -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset */ @@ -86,7 +86,7 @@ void W3DTerrainLogic::reset( void ) m_mapMinZ = 0; m_mapMaxZ = 1; WorldHeightMap::freeListOfMapObjects(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** newMap */ @@ -96,7 +96,7 @@ void W3DTerrainLogic::newMap( Bool saveGame ) TheTerrainRenderObject->loadRoadsAndBridges( this, saveGame ); TerrainLogic::newMap( saveGame ); -} // end update +} //------------------------------------------------------------------------------------------------- /** Update */ @@ -104,7 +104,7 @@ void W3DTerrainLogic::newMap( Bool saveGame ) void W3DTerrainLogic::update( void ) { TerrainLogic::update(); -} // end update +} //------------------------------------------------------------------------------------------------- /** Device DEPENDENT implementation for load details of logical terrain. @@ -187,7 +187,7 @@ Bool W3DTerrainLogic::loadMap( AsciiString filename , Bool query ) return TRUE; // success -} // end load +} //------------------------------------------------------------------------------------------------- /** Get the 3D extent of the terrain in world coordinates */ @@ -294,7 +294,7 @@ Real W3DTerrainLogic::getGroundHeight( Real x, Real y, Coord3D* normal ) const return 0; } #endif -} // end getHight +} //------------------------------------------------------------------------------------------------- /** Get the height considering the layer. */ @@ -348,7 +348,7 @@ Real W3DTerrainLogic::getLayerHeight( Real x, Real y, PathfindLayerEnum layer, C return height; #endif -} // end getLayerHeight +} //------------------------------------------------------------------------------------------------- /** W3D isCliffCell for terrain logic */ @@ -359,7 +359,7 @@ Bool W3DTerrainLogic::isCliffCell( Real x, Real y) const // W3DTerrainLogic shouldn't depend on TheTerrainRenderObject! return TheTerrainRenderObject->isCliffCell(x,y); -} // end isCliffCell +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -370,7 +370,7 @@ void W3DTerrainLogic::crc( Xfer *xfer ) // extend base class TerrainLogic::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer @@ -388,7 +388,7 @@ void W3DTerrainLogic::xfer( Xfer *xfer ) // extend base class TerrainLogic::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -399,4 +399,4 @@ void W3DTerrainLogic::loadPostProcess( void ) // extend base class TerrainLogic::loadPostProcess(); -} // end loadPostProcess +} diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp index 1989c99335a..03801ec67a7 100644 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp +++ b/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp @@ -65,7 +65,7 @@ void Win32GameEngine::init( void ) // extending functionality GameEngine::init(); -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset the system */ @@ -76,7 +76,7 @@ void Win32GameEngine::reset( void ) // extending functionality GameEngine::reset(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update the game engine by updating the GameClient and @@ -116,7 +116,7 @@ void Win32GameEngine::update( void ) // allow windows to perform regular windows maintenance stuff like msgs serviceWindowsOS(); -} // end update +} //------------------------------------------------------------------------------------------------- /** This function may be called from within this application to let @@ -157,7 +157,7 @@ void Win32GameEngine::serviceWindowsOS( void ) DispatchMessage( &msg ); TheMessageTime = 0; - } // end while + } -} // end ServiceWindowsOS +} diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp index 81762532423..6bc06e14eaf 100644 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp +++ b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp @@ -107,7 +107,7 @@ static void printReturnCode( char *label, HRESULT hr ) } -} // end printReturnCode +} //------------------------------------------------------------------------------------------------- /** create our interface to the direct input keybard */ @@ -130,7 +130,7 @@ void DirectInputKeyboard::openKeyboard( void ) closeKeyboard(); return; - } // end if + } // obtain an interface to the system keyboard device hr = m_pDirectInput->CreateDevice( GUID_SysKeyboard, @@ -144,7 +144,7 @@ void DirectInputKeyboard::openKeyboard( void ) closeKeyboard(); return; - } // end if + } // set the data format for the keyboard hr = m_pKeyboardDevice->SetDataFormat( &c_dfDIKeyboard ); @@ -156,7 +156,7 @@ void DirectInputKeyboard::openKeyboard( void ) closeKeyboard(); return; - } // end if + } /// @todo Check the cooperative level of keyboard for NT, 2000, DX8 etc ... // set the cooperative level for the keyboard, must be non-exclusive for @@ -174,7 +174,7 @@ void DirectInputKeyboard::openKeyboard( void ) closeKeyboard(); return; - } // end if + } // set the keyboard buffer size DIPROPDWORD prop; @@ -192,7 +192,7 @@ void DirectInputKeyboard::openKeyboard( void ) closeKeyboard(); return; - } // end if + } // acquire the keyboard hr = m_pKeyboardDevice->Acquire(); @@ -205,11 +205,11 @@ void DirectInputKeyboard::openKeyboard( void ) // closeKeyboard(); return; - } // end if + } DEBUG_LOG(( "OK - Keyboard initialized successfully." )); -} // end openKeyboard +} //------------------------------------------------------------------------------------------------- /** close the direct input keyboard */ @@ -225,7 +225,7 @@ void DirectInputKeyboard::closeKeyboard( void ) m_pKeyboardDevice = NULL; DEBUG_LOG(( "OK - Keyboard deviced closed" )); - } // end if + } if( m_pDirectInput ) { @@ -233,11 +233,11 @@ void DirectInputKeyboard::closeKeyboard( void ) m_pDirectInput = NULL; DEBUG_LOG(( "OK - Keyboard direct input interface closed" )); - } // end if + } DEBUG_LOG(( "OK - Keyboard shutdown complete" )); -} // end closeKeyboard +} //------------------------------------------------------------------------------------------------- /** Get a single keyboard event from direct input */ @@ -296,9 +296,9 @@ void DirectInputKeyboard::getKey( KeyboardIO *key ) break; - } // end, got the keyboard back OK + } - } // end switch + } return; @@ -306,7 +306,7 @@ void DirectInputKeyboard::getKey( KeyboardIO *key ) default: return; - } // end switch( hr ) + } // no keys returned if( num == 0 ) @@ -328,9 +328,9 @@ void DirectInputKeyboard::getKey( KeyboardIO *key ) // set status as unused (unprocessed) key->status = KeyboardIO::STATUS_UNUSED; - } // end if, we have a DI keyboard device + } -} // end getKey +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -354,7 +354,7 @@ DirectInputKeyboard::DirectInputKeyboard( void ) m_modifiers &= ~KEY_STATE_CAPSLOCK; } -} // end DirectInputKeyboard +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -364,7 +364,7 @@ DirectInputKeyboard::~DirectInputKeyboard( void ) // close keyboard and release all resource closeKeyboard(); -} // end ~DirectInputKeyboard +} //------------------------------------------------------------------------------------------------- /** initialize the keyboard */ @@ -378,7 +378,7 @@ void DirectInputKeyboard::init( void ) // open the direct input keyboard openKeyboard(); -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset keyboard system */ @@ -389,7 +389,7 @@ void DirectInputKeyboard::reset( void ) // extend functionality Keyboard::reset(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** called once per frame to update the keyboard state */ @@ -409,10 +409,10 @@ void DirectInputKeyboard::update( void ) m_pKeyboardDevice->GetDeviceData( sizeof( DIDEVICEOBJECTDATA ), NULL, &items, 0 ); - } // end if + } */ -} // end update +} //------------------------------------------------------------------------------------------------- /** Return TRUE if the caps lock key is down/hilighted */ @@ -422,4 +422,4 @@ Bool DirectInputKeyboard::getCapsState( void ) return BitIsSet( GetKeyState( VK_CAPITAL ), 0X01); -} // end getCapsState +} diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp index 5363985730c..56eadc80fb2 100644 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp +++ b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp @@ -59,7 +59,7 @@ void DirectInputMouse::openMouse( void ) closeMouse(); return; - } // end if + } // create a device for the system mouse hr = m_pDirectInput->CreateDevice( GUID_SysMouse, @@ -73,7 +73,7 @@ void DirectInputMouse::openMouse( void ) closeMouse(); return; - } // end if + } // set the data format for the mouse hr = m_pMouseDevice->SetDataFormat( &c_dfDIMouse ); @@ -85,7 +85,7 @@ void DirectInputMouse::openMouse( void ) closeMouse(); return; - } // end if + } // set the mouse cooperative level hr = m_pMouseDevice->SetCooperativeLevel( ApplicationHWnd, @@ -99,7 +99,7 @@ void DirectInputMouse::openMouse( void ) closeMouse(); return; - } // end if + } // set the mouse buffer size DIPROPDWORD prop; @@ -117,7 +117,7 @@ void DirectInputMouse::openMouse( void ) closeMouse(); return; - } // end if + } // acquire the mouse hr = m_pMouseDevice->Acquire(); @@ -129,7 +129,7 @@ void DirectInputMouse::openMouse( void ) closeMouse(); return; - } // end if + } // get some information about the mouse DIDEVCAPS diDevCaps; @@ -141,7 +141,7 @@ void DirectInputMouse::openMouse( void ) DEBUG_LOG(( "WARNING - openMouse: Cann't get capabilities of mouse for button setup" )); - } // end if + } else { @@ -153,11 +153,11 @@ void DirectInputMouse::openMouse( void ) DEBUG_LOG(( "OK - Mouse info: Buttons = '%d', Force Feedback = '%s', Axes = '%d'", m_numButtons, m_forceFeedback ? "Yes" : "No", m_numAxes )); - } // end else + } DEBUG_LOG(( "OK - Mouse initialized successfully" )); -} // end openMouse +} //------------------------------------------------------------------------------------------------- /** Release any resources for our direct input mouse */ @@ -174,7 +174,7 @@ void DirectInputMouse::closeMouse( void ) m_pMouseDevice = NULL; DEBUG_LOG(( "OK - Mouse device closed" )); - } // end if + } // release our direct input interface for the mouse if( m_pDirectInput ) @@ -184,11 +184,11 @@ void DirectInputMouse::closeMouse( void ) m_pDirectInput = NULL; DEBUG_LOG(( "OK - Mouse direct input interface closed" )); - } // end if + } DEBUG_LOG(( "OK - Mouse shutdown complete" )); -} // end closeMouse +} //------------------------------------------------------------------------------------------------- /** Get a single mouse event from the device */ @@ -254,7 +254,7 @@ UnsignedByte DirectInputMouse::getMouseEvent( MouseIO *result, Bool flush ) default: break; - } // end switch + } break; } @@ -264,13 +264,13 @@ UnsignedByte DirectInputMouse::getMouseEvent( MouseIO *result, Bool flush ) // DBGPRINTF(("GetMouseEvent: GetDeviceData Error: %X.\r\n", hr )); break; - } // end switch + } - } // end if + } return mouseResult; -} // end getMouseEvent +} //------------------------------------------------------------------------------------------------- /** Map the direct input codes to our own mouse format */ @@ -312,7 +312,7 @@ void DirectInputMouse::mapDirectInputMouse( MouseIO *mouse, break; } -} // end mapDirectInputMouse +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -326,7 +326,7 @@ DirectInputMouse::DirectInputMouse( void ) m_pDirectInput = NULL; m_pMouseDevice = NULL; -} // end DirectInputMouse +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -337,7 +337,7 @@ DirectInputMouse::~DirectInputMouse( void ) closeMouse(); // ShowCursor( TRUE ); -} // end ~DirectInputMouse +} //------------------------------------------------------------------------------------------------- /** Initialize the direct input mouse device */ @@ -359,7 +359,7 @@ void DirectInputMouse::init( void ) SetCursorPos( p.x, p.y ); // ShowCursor( FALSE ); -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset direct input mouse */ @@ -370,7 +370,7 @@ void DirectInputMouse::reset( void ) // extend Mouse::reset(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update the mouse position and button data, this is called once per @@ -396,7 +396,7 @@ void DirectInputMouse::update( void ) ScreenToClient( ApplicationHWnd, &p ); moveMouse( p.x, p.y, MOUSE_MOVE_ABSOLUTE ); -} // end update +} //------------------------------------------------------------------------------------------------- /** Set the limits which the mouse is allowed to move around in. We @@ -428,9 +428,9 @@ void DirectInputMouse::setMouseLimits( void ) // keep the cursor clipped to these coords when running windowed ClipCursor( &windowRect ); - } // end if + } -} // end setMouseLimits +} //------------------------------------------------------------------------------------------------- /** set the cursor position for windows OS */ @@ -450,7 +450,7 @@ void DirectInputMouse::setPosition( Int x, Int y ) // set the window mouse SetCursorPos( p.x, p.y ); -} // end setPosition +} //------------------------------------------------------------------------------------------------- /** Super basic simplistic cursor */ @@ -485,12 +485,12 @@ void DirectInputMouse::setCursor( MouseCursor cursor ) SetCursor( LoadCursor( NULL, IDC_CROSS ) ); break; - } // end switch + } // save current cursor m_currentCursor = cursor; -} // end setCursor +} //------------------------------------------------------------------------------------------------- /** Capture the mouse to our application */ @@ -500,7 +500,7 @@ void DirectInputMouse::capture( void ) SetCapture( ApplicationHWnd ); -} // end capture +} //------------------------------------------------------------------------------------------------- /** Release the mouse capture for our app window */ @@ -510,4 +510,4 @@ void DirectInputMouse::releaseCapture( void ) ReleaseCapture(); -} // end releaseCapture +} diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp index c5f60c4c45e..5f84cca905b 100644 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp +++ b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp @@ -75,7 +75,7 @@ UnsignedByte Win32Mouse::getMouseEvent( MouseIO *result, Bool flush ) // got event OK and all done with this one return MOUSE_OK; -} // end getMouseEvent +} //------------------------------------------------------------------------------------------------- /** Translate a win32 mouse event to our own event info */ @@ -118,7 +118,7 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) result->pos.y = HIWORD( lParam ); break; - } // end left button down + } // ------------------------------------------------------------------------ case WM_LBUTTONUP: @@ -130,7 +130,7 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) result->pos.y = HIWORD( lParam ); break; - } // end left button up + } // ------------------------------------------------------------------------ case WM_LBUTTONDBLCLK: @@ -142,7 +142,7 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) result->pos.y = HIWORD( lParam ); break; - } // end left button double click + } // ------------------------------------------------------------------------ case WM_MBUTTONDOWN: @@ -154,7 +154,7 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) result->pos.y = HIWORD( lParam ); break; - } // end middle button down + } // ------------------------------------------------------------------------ case WM_MBUTTONUP: @@ -166,7 +166,7 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) result->pos.y = HIWORD( lParam ); break; - } // end middle button up + } // ------------------------------------------------------------------------ case WM_MBUTTONDBLCLK: @@ -178,7 +178,7 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) result->pos.y = HIWORD( lParam ); break; - } // end middle button double click + } // ------------------------------------------------------------------------ case WM_RBUTTONDOWN: @@ -190,7 +190,7 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) result->pos.y = HIWORD( lParam ); break; - } // end right button down + } // ------------------------------------------------------------------------ case WM_RBUTTONUP: @@ -202,7 +202,7 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) result->pos.y = HIWORD( lParam ); break; - } // end right button up + } // ------------------------------------------------------------------------ case WM_RBUTTONDBLCLK: @@ -214,7 +214,7 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) result->pos.y = HIWORD( lParam ); break; - } // end right button double click + } // ------------------------------------------------------------------------ case WM_MOUSEMOVE: @@ -224,7 +224,7 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) result->pos.y = HIWORD( lParam ); break; - } // end mouse move + } // ------------------------------------------------------------------------ case 0x020A: // WM_MOUSEWHEEL @@ -242,7 +242,7 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) result->pos.y = p.y; break; - } // end mouse wheel + } // ------------------------------------------------------------------------ default: @@ -252,11 +252,11 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) msg, wParam, lParam )); return; - } // end default + } - } // end switch on message at event index in buffer + } -} // end translateEvent +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -278,7 +278,7 @@ Win32Mouse::Win32Mouse( void ) cursorResources[i][j]=NULL; m_directionFrame=0; //points up. m_lostFocus = FALSE; -} // end Win32Mouse +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -288,7 +288,7 @@ Win32Mouse::~Win32Mouse( void ) // remove our global reference that was for the WndProc() only TheWin32Mouse = NULL; -} // end ~Win32Mouse +} //------------------------------------------------------------------------------------------------- /** Initialize our device */ @@ -306,7 +306,7 @@ void Win32Mouse::init( void ) // m_inputMovesAbsolute = TRUE; -} // end int +} //------------------------------------------------------------------------------------------------- /** Reset */ @@ -317,7 +317,7 @@ void Win32Mouse::reset( void ) // extend Mouse::reset(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update, called once per frame */ @@ -328,7 +328,7 @@ void Win32Mouse::update( void ) // extend Mouse::update(); -} // end update +} //------------------------------------------------------------------------------------------------- /** Add a window message event along with its WPARAM and LPARAM parameters @@ -356,7 +356,7 @@ void Win32Mouse::addWin32Event( UINT msg, WPARAM wParam, LPARAM lParam, DWORD ti if( m_nextFreeIndex >= Mouse::NUM_MOUSE_EVENTS ) m_nextFreeIndex = 0; -} // end addWin32Event +} extern HINSTANCE ApplicationHInstance; @@ -440,12 +440,12 @@ void Win32Mouse::setCursor( MouseCursor cursor ) else { SetCursor(cursorResources[cursor][m_directionFrame]); - } // end switch + } // save current cursor m_currentWin32Cursor=m_currentCursor = cursor; -} // end setCursor +} //------------------------------------------------------------------------------------------------- /** Capture the mouse to our application */ @@ -477,7 +477,7 @@ void Win32Mouse::capture( void ) onCursorCaptured(true); } -} // end capture +} //------------------------------------------------------------------------------------------------- /** Release the mouse capture for our app window */ @@ -490,4 +490,4 @@ void Win32Mouse::releaseCapture( void ) onCursorCaptured(false); } -} // end releaseCapture +} diff --git a/Generals/Code/Libraries/Include/Lib/BaseType.h b/Generals/Code/Libraries/Include/Lib/BaseType.h index b681494511c..f704dab8f4d 100644 --- a/Generals/Code/Libraries/Include/Lib/BaseType.h +++ b/Generals/Code/Libraries/Include/Lib/BaseType.h @@ -196,7 +196,7 @@ inline Real Coord2D::toAngle( void ) return value; -} // end toAngle +} struct ICoord2D { diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp index 2640cf52180..b088e3361f1 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp @@ -543,13 +543,13 @@ void DX8FVFCategoryContainer::Change_Polygon_Renderer_Texture( prl.Add(rem); } poly_it.Next(); - } // while - } //if src_texture==texture + } + } else // quit loop if we've got a texture change if (foundtexture) break; src_it.Next(); - } // while + } PolyRemoverListIterator prli(&prl); @@ -634,12 +634,12 @@ void DX8FVFCategoryContainer::Change_Polygon_Renderer_Material( prl.Add(rem); } poly_it.Next(); - } // while - } // if + } + } else if (foundtexture) break; src_it.Next(); - } // while + } PolyRemoverListIterator prli(&prl); @@ -1346,8 +1346,8 @@ void DX8SkinFVFCategoryContainer::Render(void) renderedVertexCount += mesh_vertex_count; mesh = mesh->Peek_Next_Visible_Skin(); - } //while - }//lock + } + } SNAPSHOT_SAY(("Set vb: %x ib: %x",&vb.FVF_Info(),index_buffer)); @@ -1366,7 +1366,7 @@ void DX8SkinFVFCategoryContainer::Render(void) } Render_Procedural_Material_Passes(); - }//while + } //remove all the rendered data from queues for (unsigned pass=0;passsetUnsaved( TRUE ); -} // end SaveCallbacks +} // setCurrentWindow =========================================================== /** Set the window passed in as the active window for editing */ @@ -196,10 +196,10 @@ static void setCurrentWindow( GameWindow *window, HWND dialog ) else name = noNameWindowString; - } // end if + } SetWindowText( GetDlgItem( dialog, STATIC_WINDOW ), name.str() ); -} // end setCurrentWindow +} // loadUserWindows ============================================================ /** Given the window list passed in, load the list box passed with the @@ -235,12 +235,12 @@ static void loadUserWindows( HWND listbox, GameWindow *root ) // check the children loadUserWindows( listbox, root->winGetChild() ); - } // end if + } // check the rest of the list loadUserWindows( listbox, root->winGetNext() ); -} // end loadUserWindows +} //------------------------------------------------------------------------------------------------- /** save the layout callbacks */ @@ -265,7 +265,7 @@ static void saveLayoutCallbacks( HWND dialog ) SendDlgItemMessage( dialog, COMBO_SHUTDOWN, CB_GETLBTEXT, sel, (LPARAM)buffer ); TheEditor->setLayoutShutdown( AsciiString(buffer) ); -} // end saveLayoutCallbacks +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -303,7 +303,7 @@ BOOL CALLBACK CallbackEditorDialogProc( HWND hWndDialog, UINT message, return TRUE; - } // end init dialog + } // ------------------------------------------------------------------------ case WM_COMMAND: @@ -347,13 +347,13 @@ BOOL CALLBACK CallbackEditorDialogProc( HWND hWndDialog, UINT message, break; - } // end case selection change + } - } // end switch + } break; - } // end window listbox + } // -------------------------------------------------------------------- case IDOK: @@ -371,20 +371,20 @@ BOOL CALLBACK CallbackEditorDialogProc( HWND hWndDialog, UINT message, break; - } // end ok + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end CallbackEditorDialogProc +} diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/CheckBoxProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/CheckBoxProperties.cpp index ea382df7e00..b53865f58f5 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/CheckBoxProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/CheckBoxProperties.cpp @@ -160,12 +160,12 @@ static LRESULT CALLBACK checkBoxPropertiesCallback( HWND hWndDialog, GadgetCheckBoxSetHiliteCheckedBoxColor( window, info->color ); GadgetCheckBoxSetHiliteCheckedBoxBorderColor( window, info->borderColor ); - } // end if + } DestroyWindow( hWndDialog ); break; - } // end OK + } // -------------------------------------------------------------------- case IDCANCEL: @@ -174,13 +174,13 @@ static LRESULT CALLBACK checkBoxPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -189,15 +189,15 @@ static LRESULT CALLBACK checkBoxPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end checkBoxPropertiesCallback +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -284,7 +284,7 @@ HWND InitCheckBoxPropertiesDialog( GameWindow *window ) return dialog; -} // end InitCheckBoxPropertiesDialog +} diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ColorDialog.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ColorDialog.cpp index 7f9cfc41569..f65f77b0316 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ColorDialog.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ColorDialog.cpp @@ -119,7 +119,7 @@ HSVColorReal rgbToHSV( RGBColorReal rgbColor ) // calculate hue if (saturation == 0) { hue = 0; // hue is really undefined - } // end if + } else { // chromatic case, determine hue Real delta = max - min; @@ -134,7 +134,7 @@ HSVColorReal rgbToHSV( RGBColorReal rgbColor ) if (hue < 0) hue += 360; // make sure hue is non negative - } // end else, chromatic case, determine hue + } // set and return an HSVColor hsvColor.hue = hue; @@ -155,7 +155,7 @@ HSVColorReal rgbToHSV( RGBColorReal rgbColor ) return hsvColor; -} // end rgbToHSV +} // hsvToRGB =================================================================== // Converts the HSV colors passed in to RGB values @@ -181,13 +181,13 @@ RGBColorReal hsvToRGB( HSVColorReal hsvColor ) if( hue == 0.0f ) { // achromatic color ... there is no hue red = green = blue = value; - } // end if, achromatic color .. there is no hue + } else { DEBUG_LOG(( "HSVToRGB error, hue should be undefined" )); - } // end else + } - } // end if + } else { @@ -230,9 +230,9 @@ RGBColorReal hsvToRGB( HSVColorReal hsvColor ) green = p; blue = q; break; - } // end switch (i) + } - } // end else, chromatic case + } // store and return and RGB color rgbColor.red = red; @@ -242,7 +242,7 @@ RGBColorReal hsvToRGB( HSVColorReal hsvColor ) return rgbColor; -} // end hsvToRGB +} // FORWARD DECLARATIONS /////////////////////////////////////////////////////// BOOL CALLBACK SelectColorDlgProc( HWND hWnd, UINT uMsg, @@ -278,7 +278,7 @@ RGBColorInt *SelectColor( Int red, Int green, Int blue, Int alpha, else return NULL; -} // end SelectColor +} // SelectColorDlgProc ========================================================= /** Dialog procedure for color selector dialog */ @@ -345,7 +345,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, SetDlgItemInt (hWndDlg, LABEL_ALPHA, (Int) hsvColor.alpha, FALSE); - } // end if + } else { @@ -367,7 +367,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, SetDlgItemInt (hWndDlg, LABEL_ALPHA, selectedColor.alpha, FALSE); - } // end else + } // // move the window to the display position, but keep the whole @@ -377,7 +377,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, return TRUE; - } // end case WM_INITDIALOG + } // ------------------------------------------------------------------------ case WM_DRAWITEM: { @@ -411,7 +411,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, NULL, FALSE); rgbColor.blue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, NULL, FALSE); - } // end if + } else { hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, NULL, FALSE); @@ -427,7 +427,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, rgbColor.red *= 255; rgbColor.green *= 255; rgbColor.blue *= 255; - } // end else + } // create a new brush and select it into DC hBrushNew = CreateSolidBrush (RGB ((BYTE) rgbColor.red, @@ -448,7 +448,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, break; - } // end case BUTTON_PREVIEW + } // -------------------------------------------------------------------- // Draw the bar of either HUE or RED next to the scroll bar @@ -476,12 +476,12 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, rgbColor.red *= 255.0f; rgbColor.green *= 255.0f; rgbColor.blue *= 255.0f; - } // end if + } else { rgbColor.red = 0; rgbColor.green = 0; rgbColor.blue = 0; - } // end else + } // loop through each horizontal line available in the bar drawing // the correct color there @@ -500,16 +500,16 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, rgbColor.red *= 255; rgbColor.green *= 255; rgbColor.blue *= 255; - } // end if + } else { rgbColor.red += step; - } // end else + } - } // end for i + } break; - } // end case BUTTON_COLORBAR1 + } // -------------------------------------------------------------------- // Draw the bar of either SATURATION or GREEN next to the scroll bar @@ -538,12 +538,12 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, rgbColor.red *= 255; rgbColor.green *= 255; rgbColor.blue *= 255; - } // end if + } else { rgbColor.red = 0; rgbColor.green = 0; rgbColor.blue = 0; - } // end else + } // loop through each horizontal line available in the bar drawing // the correct color there @@ -562,16 +562,16 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, rgbColor.red *= 255; rgbColor.green *= 255; rgbColor.blue *= 255; - } // end if + } else { rgbColor.green += step; - } // end else + } - } // end for i + } break; - } // end case BUTTON_COLORBAR2 + } // -------------------------------------------------------------------- // Draw the bar of either VALUE or BLUE next to the scroll bar @@ -601,12 +601,12 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, rgbColor.red *= 255.0f; rgbColor.green *= 255.0f; rgbColor.blue *= 255.0f; - } // end if + } else { rgbColor.red = 0; rgbColor.green = 0; rgbColor.blue = 0; - } // end else + } // loop through each horizontal line available in the bar drawing // the correct color there @@ -625,22 +625,22 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, rgbColor.red *= 255; rgbColor.green *= 255; rgbColor.blue *= 255; - } // end if + } else { rgbColor.blue += step; - } // end else + } - } // end for i + } break; - } // end case BUTTON_COLORBAR3 + } - } // end switch + } return TRUE; - } // end case WM_DRAWITEM + } // ------------------------------------------------------------------------ // horizontal scrolling on the color bars @@ -676,34 +676,34 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, if (thumbPos > minPos) thumbPos--; break; - } // end case SB_LINELEFT + } case SB_PAGELEFT: { if (thumbPos - 45 >= minPos) thumbPos -= 45; else thumbPos = minPos; break; - } // end case SB_PAGELEFT + } case SB_LINERIGHT: { if (thumbPos < maxPos) thumbPos++; break; - } // end case SB_LINERIGHT + } case SB_PAGERIGHT: { if (thumbPos + 45 < maxPos) thumbPos += 45; else thumbPos = maxPos; break; - } // end case SB_PAGERIGHT + } case SB_THUMBTRACK: { thumbPos = nPos; break; - } // end case SB_THUBTRACK + } default: { return 0; - } // end default - } // end switch nScrollCode + } + } // set the new scrollbar position and the text with it SendMessage (hWndScroll, SBM_SETPOS, (WPARAM) thumbPos, (LPARAM) TRUE); @@ -730,7 +730,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, rgbColor.alpha = (Real) GetDlgItemInt( hWndDlg, LABEL_ALPHA, NULL, FALSE ); - } // end if + } else { hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, NULL, FALSE); @@ -749,7 +749,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, rgbColor.red *= 255; rgbColor.green *= 255; rgbColor.blue *= 255; - } // end else + } // store the color selectedColor.red = (Int) rgbColor.red; @@ -770,11 +770,11 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, UpdateWindow (hWndColorBar2); UpdateWindow (hWndColorBar3); - } // end if, color bar scroll message + } return 0; - } // end case WM_HSCROLL + } // ------------------------------------------------------------------------ case WM_COMMAND: { @@ -792,7 +792,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, EndDialog( hWndDlg, TRUE ); // color selected break; - } // end case IDOK + } // -------------------------------------------------------------------- case IDCANCEL: { @@ -800,7 +800,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, EndDialog( hWndDlg, FALSE ); // selection cancelled break; - } // end case IDCANCEL + } // -------------------------------------------------------------------- // Change from RGB mode to HSV mode and vice versa @@ -847,7 +847,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, SetWindowText (GetDlgItem (hWndDlg, BUTTON_RGB_HSV), "Switch to RGB"); - } // end if, switch to HSV + } else { // switch to RGB hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, NULL, FALSE); hsvColor.saturation = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, NULL, FALSE); @@ -885,20 +885,20 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, mode = MODE_RGB; - } // end else, switch to RGB + } // invalidate all the vertical color bars so they are redrawn InvalidateRect (hWndColorBar1, NULL, TRUE); InvalidateRect (hWndColorBar2, NULL, TRUE); InvalidateRect (hWndColorBar3, NULL, TRUE); - } // end case BUTTON_RGB_HSV + } - } // end switch (LOWORD (wParam)) + } return 0; - } // end case WM_COMMAND + } // ------------------------------------------------------------------------ // Only hide the window on a close rather than destroy it since it will @@ -911,6 +911,6 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, default: return 0; // for all messages that are not processed - } // end of switch (uMsg) + } -} // End of SelectColor +} diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ComboBoxProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ComboBoxProperties.cpp index 2103fa8d7b9..4a31019bc94 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ComboBoxProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ComboBoxProperties.cpp @@ -164,7 +164,7 @@ static LRESULT CALLBACK comboBoxPropertiesCallback( HWND hWndDialog, break; - } // end case subcontrol color + } // -------------------------------------------------------------------- case IDOK: @@ -405,7 +405,7 @@ static LRESULT CALLBACK comboBoxPropertiesCallback( HWND hWndDialog, GadgetButtonSetHiliteSelectedColor( upButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( upButton, info->borderColor ); - } // end if + } // down button GameWindow *downButton = GadgetListBoxGetDownButton( listBox ); @@ -445,7 +445,7 @@ static LRESULT CALLBACK comboBoxPropertiesCallback( HWND hWndDialog, GadgetButtonSetHiliteSelectedColor( downButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( downButton, info->borderColor ); - } // end if + } // slider GameWindow *slider = GadgetListBoxGetSlider( listBox ); @@ -532,8 +532,8 @@ static LRESULT CALLBACK comboBoxPropertiesCallback( HWND hWndDialog, GadgetSliderSetHiliteSelectedThumbColor( slider, info->color ); GadgetSliderSetHiliteSelectedThumbBorderColor( slider, info->borderColor ); - } // end if - } // end if (listBox) + } + } // save specific list data ComboBoxData *comboData = (ComboBoxData *)window->winGetUserData(); @@ -551,12 +551,12 @@ static LRESULT CALLBACK comboBoxPropertiesCallback( HWND hWndDialog, GadgetComboBoxSetMaxDisplay( window, newMaxDisplay ); - } // end if + } DestroyWindow( hWndDialog ); break; - } // end OK + } // -------------------------------------------------------------------- case IDCANCEL: @@ -565,13 +565,13 @@ static LRESULT CALLBACK comboBoxPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -580,15 +580,15 @@ static LRESULT CALLBACK comboBoxPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end comboBoxPropertiesCallback +} /////////////////////////////////////////////////////////////////////////////// @@ -758,7 +758,7 @@ HWND InitComboBoxPropertiesDialog( GameWindow *window ) borderColor = GadgetButtonGetHiliteSelectedBorderColor( upButton ); StoreImageAndColor( COMBOBOX_LISTBOX_UP_BUTTON_HILITE_PUSHED, image, color, borderColor ); - } // end if + } // -------------------------------------------------------------------------- GameWindow *downButton = GadgetListBoxGetDownButton( listBox ); @@ -798,7 +798,7 @@ HWND InitComboBoxPropertiesDialog( GameWindow *window ) borderColor = GadgetButtonGetHiliteSelectedBorderColor( downButton ); StoreImageAndColor( COMBOBOX_LISTBOX_DOWN_BUTTON_HILITE_PUSHED, image, color, borderColor ); - } // end if + } GameWindow *slider = GadgetListBoxGetSlider( listBox ); if( slider ) @@ -882,7 +882,7 @@ HWND InitComboBoxPropertiesDialog( GameWindow *window ) borderColor = GadgetSliderGetHiliteSelectedThumbBorderColor( slider ); StoreImageAndColor( COMBOBOX_LISTBOX_SLIDER_THUMB_HILITE_PUSHED, image, color, borderColor ); - } // end if + } GameWindow *dropDownButton = GadgetComboBoxGetDropDownButton( window ); if ( dropDownButton ) @@ -977,7 +977,7 @@ HWND InitComboBoxPropertiesDialog( GameWindow *window ) return dialog; -} // end InitComboBoxPropertiesDialog +} diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/GenericProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/GenericProperties.cpp index a594712ffd3..b8aa5f2fd9f 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/GenericProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/GenericProperties.cpp @@ -136,11 +136,11 @@ static LRESULT CALLBACK genericPropertiesCallback( HWND hWndDialog, // we have taken care of it return TRUE; - } // end if + } return FALSE; - } // end draw item + } // ------------------------------------------------------------------------ case WM_COMMAND: @@ -182,13 +182,13 @@ static LRESULT CALLBACK genericPropertiesCallback( HWND hWndDialog, SetControlColor( controlID, newGameColor ); InvalidateRect( hWndControl, NULL, TRUE ); - } // end if + } - } // end if + } break; - } // end color buttons + } // -------------------------------------------------------------------- case IDOK: @@ -239,12 +239,12 @@ static LRESULT CALLBACK genericPropertiesCallback( HWND hWndDialog, color = GameMakeColor( rgbColor->red, rgbColor->green, rgbColor->blue, rgbColor->alpha ); window->winSetHiliteBorderColor( 0, color ); - } // end if + } DestroyWindow( hWndDialog ); break; - } // end OK + } // -------------------------------------------------------------------- case IDCANCEL: @@ -253,13 +253,13 @@ static LRESULT CALLBACK genericPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -268,15 +268,15 @@ static LRESULT CALLBACK genericPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end genericPropertiesCallback +} // InitCallbackCombos ========================================================= /** load the callbacks combo boxes with the functions that the user cal @@ -300,7 +300,7 @@ void InitCallbackCombos( HWND dialog, GameWindow *window ) { SendMessage( combo, CB_ADDSTRING, 0, (LPARAM)entry->name ); entry++; - } // end while + } SendMessage( combo, CB_INSERTSTRING, 0, (LPARAM)GUIEDIT_NONE_STRING ); // select the current function of the window in the combo if present @@ -318,7 +318,7 @@ void InitCallbackCombos( HWND dialog, GameWindow *window ) { SendMessage( combo, CB_ADDSTRING, 0, (LPARAM)entry->name ); entry++; - } // end while + } SendMessage( combo, CB_INSERTSTRING, 0, (LPARAM)GUIEDIT_NONE_STRING ); // select the current function of the window in the combo if present @@ -336,7 +336,7 @@ void InitCallbackCombos( HWND dialog, GameWindow *window ) { SendMessage( combo, CB_ADDSTRING, 0, (LPARAM)entry->name ); entry++; - } // end while + } SendMessage( combo, CB_INSERTSTRING, 0, (LPARAM)GUIEDIT_NONE_STRING ); // select the current function of the window in the combo if present @@ -354,13 +354,13 @@ void InitCallbackCombos( HWND dialog, GameWindow *window ) { SendMessage( combo, CB_ADDSTRING, 0, (LPARAM)entry->name ); entry++; - } // end while + } entry = TheFunctionLexicon->getTable( FunctionLexicon::TABLE_GAME_WIN_DEVICEDRAW ); while( entry && entry ->key != NAMEKEY_INVALID ) { SendMessage( combo, CB_ADDSTRING, 0, (LPARAM)entry->name ); entry++; - } // end while + } SendMessage( combo, CB_INSERTSTRING, 0, (LPARAM)GUIEDIT_NONE_STRING ); // select the current function of the window in the combo if present @@ -417,7 +417,7 @@ void InitCallbackCombos( HWND dialog, GameWindow *window ) name = TheEditor->getLayoutShutdown(); SendMessage( combo, CB_SELECTSTRING, -1, (LPARAM)name.str() ); -} // end InitCallbackCombos +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -479,7 +479,7 @@ HWND InitUserWinPropertiesDialog( GameWindow *window ) return dialog; -} // end InitUserWinPropertiesDialog +} diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/GridSettings.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/GridSettings.cpp index 3e104d0d6fc..ea0b71c3123 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/GridSettings.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/GridSettings.cpp @@ -96,7 +96,7 @@ static void initGridSettings( HWND hWndDialog ) RGBColorInt *color = TheEditor->getGridColor(); gridColor = *color; -} // end initGridSettings +} // GridSettingsDialogProc ===================================================== /** Dialog procedure for grid settings dialog */ @@ -116,7 +116,7 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, initGridSettings( hWndDialog ); return TRUE; - } // end init dialog + } // ------------------------------------------------------------------------ case WM_DRAWITEM: @@ -158,11 +158,11 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, // we have taken care of it return TRUE; - } // end if + } return FALSE; - } // end draw item + } // ------------------------------------------------------------------------ case WM_COMMAND: @@ -196,13 +196,13 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, gridColor = *newColor; InvalidateRect( hWndControl, NULL, TRUE ); - } // end if + } - } // end if + } break; - } // end color buttons + } // -------------------------------------------------------------------- case IDOK: @@ -229,7 +229,7 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, break; - } // end ok + } // -------------------------------------------------------------------- case IDCANCEL: @@ -238,13 +238,13 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, EndDialog( hWndDialog, FALSE ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -253,13 +253,13 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, EndDialog( hWndDialog, FALSE ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end GridSettingsDialogProc +} diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp index 39c87a592ff..770001592c9 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp @@ -135,7 +135,7 @@ static void addScrollbar( GameWindow *listbox ) info = TheDefaultScheme->getImageAndColor( LISTBOX_UP_BUTTON_HILITE_PUSHED ); GadgetButtonSetHiliteSelectedImage( upButton, info->image ); - } // end if + } GameWindow *downButton = GadgetListBoxGetDownButton( listbox ); if( downButton ) @@ -156,7 +156,7 @@ static void addScrollbar( GameWindow *listbox ) info = TheDefaultScheme->getImageAndColor( LISTBOX_DOWN_BUTTON_HILITE_PUSHED ); GadgetButtonSetHiliteSelectedImage( downButton, info->image ); - } // end if + } GameWindow *slider = GadgetListBoxGetSlider( listbox ); if( slider ) @@ -211,9 +211,9 @@ static void addScrollbar( GameWindow *listbox ) info = TheDefaultScheme->getImageAndColor( LISTBOX_SLIDER_THUMB_HILITE_PUSHED ); GadgetSliderSetHiliteSelectedThumbImage( slider, info->image ); - } // end if, slider + } -} // end addScrollbar +} // removeScrollbar ============================================================ /** Remove all scrollbar constructs froma listbox that has it already */ @@ -237,7 +237,7 @@ static void removeScrollbar( GameWindow *listbox ) // remove the scrollbar flag from the listbox data listData->scrollBar = FALSE; -} // end removeScrollbar +} // resizeMaxItems ============================================================= /** Change the max items that a listbox can accomodate */ @@ -248,7 +248,7 @@ static void resizeMaxItems( GameWindow *listbox, UnsignedInt newMaxItems ) -} // end resizeMaxItems +} // listboxPropertiesCallback ================================================== /** Dialog callback for properties */ @@ -326,7 +326,7 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, break; - } // end case subcontrol color + } // -------------------------------------------------------------------- case IDOK: @@ -432,7 +432,7 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, GadgetButtonSetHiliteSelectedColor( upButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( upButton, info->borderColor ); - } // end if + } // down button GameWindow *downButton = GadgetListBoxGetDownButton( window ); @@ -472,7 +472,7 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, GadgetButtonSetHiliteSelectedColor( downButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( downButton, info->borderColor ); - } // end if + } // slider GameWindow *slider = GadgetListBoxGetSlider( window ); @@ -559,7 +559,7 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, GadgetSliderSetHiliteSelectedThumbColor( slider, info->color ); GadgetSliderSetHiliteSelectedThumbBorderColor( slider, info->borderColor ); - } // end if + } // save specific list data ListboxData *listData = (ListboxData *)window->winGetUserData(); @@ -647,12 +647,12 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, } listData->columns = newColumns; - } // end if + } DestroyWindow( hWndDialog ); break; - } // end OK + } // -------------------------------------------------------------------- case IDCANCEL: @@ -661,13 +661,13 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -676,15 +676,15 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end listboxPropertiesCallback +} /////////////////////////////////////////////////////////////////////////////// @@ -804,7 +804,7 @@ HWND InitListboxPropertiesDialog( GameWindow *window ) borderColor = GadgetButtonGetHiliteSelectedBorderColor( upButton ); StoreImageAndColor( LISTBOX_UP_BUTTON_HILITE_PUSHED, image, color, borderColor ); - } // end if + } // -------------------------------------------------------------------------- GameWindow *downButton = GadgetListBoxGetDownButton( window ); @@ -844,7 +844,7 @@ HWND InitListboxPropertiesDialog( GameWindow *window ) borderColor = GadgetButtonGetHiliteSelectedBorderColor( downButton ); StoreImageAndColor( LISTBOX_DOWN_BUTTON_HILITE_PUSHED, image, color, borderColor ); - } // end if + } GameWindow *slider = GadgetListBoxGetSlider( window ); if( slider ) @@ -928,7 +928,7 @@ HWND InitListboxPropertiesDialog( GameWindow *window ) borderColor = GadgetSliderGetHiliteSelectedThumbBorderColor( slider ); StoreImageAndColor( LISTBOX_SLIDER_THUMB_HILITE_PUSHED, image, color, borderColor ); - } // end if + } // init listbox specific property section ListboxData *listData = (ListboxData *)window->winGetUserData(); @@ -968,7 +968,7 @@ HWND InitListboxPropertiesDialog( GameWindow *window ) return dialog; -} // end InitListboxPropertiesDialog +} diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/NewLayoutDialog.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/NewLayoutDialog.cpp index e3e22d88538..8f3206df8f2 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/NewLayoutDialog.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/NewLayoutDialog.cpp @@ -77,7 +77,7 @@ static void initNewLayoutDialog( HWND hWndDialog ) // set default keyboard focus SetFocus( GetDlgItem( hWndDialog, IDOK ) ); -} // end initNewLayoutDialog +} // NewLayoutDialogProc ======================================================== /** Dialog procedure for the new layout dialog when starting an entire @@ -98,7 +98,7 @@ LRESULT CALLBACK NewLayoutDialogProc( HWND hWndDialog, UINT message, initNewLayoutDialog( hWndDialog ); return FALSE; - } // end init dialog + } // ------------------------------------------------------------------------ case WM_COMMAND: @@ -119,7 +119,7 @@ LRESULT CALLBACK NewLayoutDialogProc( HWND hWndDialog, UINT message, break; - } // end ok + } // -------------------------------------------------------------------- case IDCANCEL: @@ -128,13 +128,13 @@ LRESULT CALLBACK NewLayoutDialogProc( HWND hWndDialog, UINT message, EndDialog( hWndDialog, FALSE ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -143,13 +143,13 @@ LRESULT CALLBACK NewLayoutDialogProc( HWND hWndDialog, UINT message, EndDialog( hWndDialog, FALSE ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end NewLayoutDialogProc +} diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ProgressBarProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ProgressBarProperties.cpp index 06dbb99f5c3..9692ada0d91 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ProgressBarProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ProgressBarProperties.cpp @@ -181,12 +181,12 @@ static LRESULT CALLBACK progressBarPropertiesCallback( HWND hWndDialog, info = GetStateInfo( PROGRESS_BAR_HILITE_BAR_SMALL_CENTER ); GadgetProgressBarSetHiliteBarImageSmallCenter( window, info->image ); - } // end if + } DestroyWindow( hWndDialog ); break; - } // end OK + } // -------------------------------------------------------------------- case IDCANCEL: @@ -195,13 +195,13 @@ static LRESULT CALLBACK progressBarPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -210,15 +210,15 @@ static LRESULT CALLBACK progressBarPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end progressBarPropertiesCallback +} /////////////////////////////////////////////////////////////////////////////// @@ -327,7 +327,7 @@ HWND InitProgressBarPropertiesDialog( GameWindow *window ) return dialog; -} // end InitProgressBarPropertiesDialog +} diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/PushButtonProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/PushButtonProperties.cpp index 588eda6a9bb..4b34062e485 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/PushButtonProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/PushButtonProperties.cpp @@ -151,12 +151,12 @@ static LRESULT CALLBACK pushButtonPropertiesCallback( HWND hWndDialog, if( IsDlgButtonChecked( hWndDialog, CHECK_RIGHT_CLICK ) ) window->winSetStatus( bit ); - } // end if + } DestroyWindow( hWndDialog ); break; - } // end OK + } // -------------------------------------------------------------------- case IDCANCEL: @@ -165,13 +165,13 @@ static LRESULT CALLBACK pushButtonPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -180,15 +180,15 @@ static LRESULT CALLBACK pushButtonPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end pushButtonPropertiesCallback +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -260,7 +260,7 @@ HWND InitPushButtonPropertiesDialog( GameWindow *window ) return dialog; -} // end InitPushButtonPropertiesDialog +} diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp index de9cacc5e85..b47aaa6f29c 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp @@ -111,7 +111,7 @@ static LRESULT CALLBACK radioButtonPropertiesCallback( HWND hWndDialog, SetDlgItemInt( hWndDialog, COMBO_GROUP, 0, FALSE ); break; - } // end clear group + } // -------------------------------------------------------------------- case IDOK: @@ -181,12 +181,12 @@ static LRESULT CALLBACK radioButtonPropertiesCallback( HWND hWndDialog, Int screen = TheNameKeyGenerator->nameToKey( AsciiString(TheEditor->getSaveFilename()) ); GadgetRadioSetGroup( window, group, screen ); - } // end if + } DestroyWindow( hWndDialog ); break; - } // end OK + } // -------------------------------------------------------------------- case IDCANCEL: @@ -195,13 +195,13 @@ static LRESULT CALLBACK radioButtonPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -210,15 +210,15 @@ static LRESULT CALLBACK radioButtonPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end radioButtonPropertiesCallback +} /////////////////////////////////////////////////////////////////////////////// @@ -252,7 +252,7 @@ static void loadExistingGroupsCombo( HWND combo, GameWindow *window ) if( SendMessage( combo, CB_FINDSTRINGEXACT, -1, (LPARAM)buffer ) == CB_ERR ) SendMessage( combo, CB_ADDSTRING, 0, (LPARAM)buffer ); - } // end if + } // search our children GameWindow *child; @@ -262,7 +262,7 @@ static void loadExistingGroupsCombo( HWND combo, GameWindow *window ) // search the next in line loadExistingGroupsCombo( combo, window->winGetNext() ); -} // end loadExistingGroupsCombo +} // InitRadioButtonPropertiesDialog ============================================ /** Bring up the radio button properties dialog */ @@ -355,7 +355,7 @@ HWND InitRadioButtonPropertiesDialog( GameWindow *window ) return dialog; -} // end InitRadioButtonPropertiesDialog +} diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp index 4cd08ae7b13..a02474ed9c6 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp @@ -127,7 +127,7 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, StoreColor( VSLIDER_THUMB_HILITE, info->color, info->borderColor ); StoreColor( VSLIDER_THUMB_HILITE_PUSHED, info->borderColor, info->color ); - } // end if, vertical slider + } else { @@ -143,11 +143,11 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, StoreColor( HSLIDER_THUMB_HILITE, info->color, info->borderColor ); StoreColor( HSLIDER_THUMB_HILITE_PUSHED, info->borderColor, info->color ); - } // end else horizontal slider + } break; - } // end case subcontrol color + } // -------------------------------------------------------------------- case IDOK: @@ -175,7 +175,7 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, info = GetStateInfo( VSLIDER_ENABLED_BOTTOM ); GadgetSliderSetEnabledImageBottom( window, info->image ); - } // end if + } else { info = GetStateInfo( HSLIDER_ENABLED_LEFT ); @@ -185,7 +185,7 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, info = GetStateInfo( HSLIDER_ENABLED_RIGHT ); GadgetSliderSetEnabledImageRight( window, info->image ); - } // end else + } info = GetStateInfo( vert ? VSLIDER_ENABLED_CENTER : HSLIDER_ENABLED_CENTER ); GadgetSliderSetEnabledImageCenter( window, info->image ); @@ -203,7 +203,7 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, info = GetStateInfo( VSLIDER_DISABLED_BOTTOM ); GadgetSliderSetDisabledImageBottom( window, info->image ); - } // end if + } else { info = GetStateInfo( HSLIDER_DISABLED_LEFT ); @@ -213,7 +213,7 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, info = GetStateInfo( HSLIDER_DISABLED_RIGHT ); GadgetSliderSetDisabledImageRight( window, info->image ); - } // end else + } info = GetStateInfo( vert ? VSLIDER_DISABLED_CENTER : HSLIDER_DISABLED_CENTER ); GadgetSliderSetDisabledImageCenter( window, info->image ); @@ -231,7 +231,7 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, info = GetStateInfo( VSLIDER_HILITE_BOTTOM ); GadgetSliderSetHiliteImageBottom( window, info->image ); - } // end if + } else { info = GetStateInfo( HSLIDER_HILITE_LEFT ); @@ -241,7 +241,7 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, info = GetStateInfo( HSLIDER_HILITE_RIGHT ); GadgetSliderSetHiliteImageRight( window, info->image ); - } // end else + } info = GetStateInfo( vert ? VSLIDER_HILITE_CENTER : HSLIDER_HILITE_CENTER ); GadgetSliderSetHiliteImageCenter( window, info->image ); @@ -298,14 +298,14 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, MessageBox( NULL, "Slider min greated than max, the values were swapped", "Warning", MB_OK | MB_ICONINFORMATION ); - } // end if + } - } // end if + } DestroyWindow( hWndDialog ); break; - } // end OK + } // -------------------------------------------------------------------- case IDCANCEL: @@ -314,13 +314,13 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -329,15 +329,15 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end sliderPropertiesCallback +} /////////////////////////////////////////////////////////////////////////////// @@ -478,7 +478,7 @@ HWND InitSliderPropertiesDialog( GameWindow *window ) return dialog; -} // end InitSliderPropertiesDialog +} diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/StaticTextProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/StaticTextProperties.cpp index b00cf94a230..2fd0bec921e 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/StaticTextProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/StaticTextProperties.cpp @@ -112,7 +112,7 @@ static LRESULT CALLBACK staticTextPropertiesCallback( HWND hWndDialog, SetDlgItemText( hWndDialog, BUTTON_CENTERED, "No" ); break; - } // end centered + } // -------------------------------------------------------------------- case IDOK: @@ -151,12 +151,12 @@ static LRESULT CALLBACK staticTextPropertiesCallback( HWND hWndDialog, TextData *textData = (TextData *)window->winGetUserData(); textData->centered = currCentered; - } // end if + } DestroyWindow( hWndDialog ); break; - } // end OK + } // -------------------------------------------------------------------- case IDCANCEL: @@ -165,13 +165,13 @@ static LRESULT CALLBACK staticTextPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -180,15 +180,15 @@ static LRESULT CALLBACK staticTextPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end staticTextPropertiesCallback +} /////////////////////////////////////////////////////////////////////////////// @@ -251,7 +251,7 @@ HWND InitStaticTextPropertiesDialog( GameWindow *window ) return dialog; -} // end InitStaticTextPropertiesDialog +} diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/TabControlProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/TabControlProperties.cpp index 369d9e2dc45..c3dc2732b2c 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/TabControlProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/TabControlProperties.cpp @@ -343,12 +343,12 @@ static LRESULT CALLBACK tabControlPropertiesCallback( HWND hWndDialog, GadgetTabControlShowSubPane( tabControl, tabData->activeTab ); GadgetTabControlUpdatePaneNames( tabControl ); - } // end if + } DestroyWindow( hWndDialog ); break; - } // end OK + } // -------------------------------------------------------------------- case IDCANCEL: @@ -357,13 +357,13 @@ static LRESULT CALLBACK tabControlPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -372,15 +372,15 @@ static LRESULT CALLBACK tabControlPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end tabControlPropertiesCallback +} /////////////////////////////////////////////////////////////////////////////// @@ -616,7 +616,7 @@ HWND InitTabControlPropertiesDialog( GameWindow *tabControl ) return dialog; -} // end InitTabControlPropertiesDialog +} diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/TextEntryProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/TextEntryProperties.cpp index 7559cfc1a5f..2d8b21d0188 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/TextEntryProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/TextEntryProperties.cpp @@ -160,28 +160,28 @@ static LRESULT CALLBACK textEntryPropertiesCallback( HWND hWndDialog, entryData->alphaNumericalOnly = TRUE; entryData->numericalOnly = FALSE; - } // end if + } else if( IsDlgButtonChecked( hWndDialog, RADIO_NUMBERS ) ) { entryData->alphaNumericalOnly = FALSE; entryData->numericalOnly = TRUE; - } // end else if + } else { entryData->alphaNumericalOnly = FALSE; entryData->numericalOnly = FALSE; - } // end else + } - } // end if + } DestroyWindow( hWndDialog ); break; - } // end OK + } // -------------------------------------------------------------------- case IDCANCEL: @@ -190,13 +190,13 @@ static LRESULT CALLBACK textEntryPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -205,15 +205,15 @@ static LRESULT CALLBACK textEntryPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end textEntryPropertiesCallback +} /////////////////////////////////////////////////////////////////////////////// @@ -304,7 +304,7 @@ HWND InitTextEntryPropertiesDialog( GameWindow *window ) return dialog; -} // end InitTextEntryPropertiesDialog +} diff --git a/Generals/Code/Tools/GUIEdit/Source/EditWindow.cpp b/Generals/Code/Tools/GUIEdit/Source/EditWindow.cpp index 46ff3b79ccc..3b8c95eb684 100644 --- a/Generals/Code/Tools/GUIEdit/Source/EditWindow.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/EditWindow.cpp @@ -105,11 +105,11 @@ LRESULT CALLBACK EditWindow::editProc( HWND hWnd, UINT message, if( timerID == TIMER_EDIT_WINDOW_PULSE ) TheEditWindow->updatePulse(); - } // end if + } return 0; - } // end timer + } //------------------------------------------------------------------------- case WM_MOUSEMOVE: @@ -124,7 +124,7 @@ LRESULT CALLBACK EditWindow::editProc( HWND hWnd, UINT message, TheEditWindow->mouseEvent( message, wParam, lParam ); return 0; - } // end mouse events + } // ------------------------------------------------------------------------ case WM_COMMAND: @@ -281,17 +281,17 @@ LRESULT CALLBACK EditWindow::editProc( HWND hWnd, UINT message, InitPropertiesDialog( window, pos.x, pos.y ); break; - } // end switch + } break; - } // end new window + } - } // end switch on control id + } return 0; - } // end command + } // ------------------------------------------------------------------------ default: @@ -299,13 +299,13 @@ LRESULT CALLBACK EditWindow::editProc( HWND hWnd, UINT message, break; - } // end default + } - } // end switch( message ) + } return DefWindowProc( hWnd, message, wParam, lParam ); -} // end editProc +} // EditWindow::registerEditWindowClass ======================================== /** Register a class with the windows OS for an edit window */ @@ -336,7 +336,7 @@ void EditWindow::registerEditWindowClass( void ) if( atom != 0 ) m_classRegistered = TRUE; -} // end registerEditWindowClass +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -391,7 +391,7 @@ EditWindow::EditWindow( void ) m_clipRegion.hi.y = 0; m_isClippedEnabled = FALSE; -} // end EditWindow +} // EditWindow::~EditWindow ==================================================== /** */ @@ -402,7 +402,7 @@ EditWindow::~EditWindow( void ) // call the shutdown shutdown(); -} // end ~EditWindow +} // EditWindow::init =========================================================== /** Initialize the edit window */ @@ -472,7 +472,7 @@ void EditWindow::init( UnsignedInt clientWidth, UnsignedInt clientHeight ) shutdown(); return; - } // end if + } // create asset manager m_assetManager = new WW3DAssetManager; @@ -485,7 +485,7 @@ void EditWindow::init( UnsignedInt clientWidth, UnsignedInt clientHeight ) // set a timer for updating visual pulse drawing SetTimer( m_editWindowHWnd, TIMER_EDIT_WINDOW_PULSE, 5, NULL ); -} // end init +} // EditWindow::shutdown ======================================================= /** Shutdown edit window */ @@ -519,7 +519,7 @@ void EditWindow::shutdown( void ) UnregisterClass( m_className, TheEditor->getInstance() ); m_classRegistered = FALSE; -} // EditWindowShutdown +} // EditWindow::updatePulse ==================================================== /** Update pulse from timer message */ @@ -537,15 +537,15 @@ void EditWindow::updatePulse( void ) m_pulse += stepSize; if( m_pulse >= pulseMax ) dir = 0; - } // end if + } else { m_pulse -= stepSize; if( m_pulse <= pulseMin ) dir = 1; - } // end else + } -} // end updatePulse +} // EditWindow::mouseEvent ===================================================== /** A mouse event has occurred from our window procedure */ @@ -588,7 +588,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, if( GetFocus() != TheEditor->getWindowHandle() ) SetFocus( TheEditor->getWindowHandle() ); - } // end if + } // // if we're in test mode just pump all input through to the @@ -601,7 +601,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, return; - } // end if + } // // If we're in the keyboard move, ignore the mouse @@ -635,7 +635,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, // update destination for drag move m_dragMoveDest = mouse; - } // end if + } else if( m_dragSelecting ) { @@ -643,14 +643,14 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, m_selectRegion.hi.x = x; m_selectRegion.hi.y = y; - } // end else if + } else if( m_resizingWindow ) { // save the position of our mouse for resizing m_resizeDest = mouse; - } // end else if + } else { @@ -660,11 +660,11 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, // TheEditWindow->handleResizeAvailable( x, y ); - } // end else + } break; - } // end mouse move + } // ------------------------------------------------------------------------ case WM_LBUTTONDOWN: @@ -704,7 +704,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, m_resizeOrigin = mouse; m_resizeDest = mouse; - } // end if + } else { GameWindow *window = TheEditor->getWindowAtPos( x, y ); @@ -728,7 +728,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, // select this window TheEditor->selectWindow( window ); - } // end if + } else { @@ -739,7 +739,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, if( controlDown == TRUE ) TheEditor->unSelectWindow( window ); - } // end else + } // only proceed into drag mode if we have something selected if( TheEditor->isWindowSelected( window ) ) @@ -756,9 +756,9 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, // change to drag move mode and switch cursor TheEditor->setMode( MODE_DRAG_MOVE ); - } // end if + } - } // end if + } else { @@ -769,13 +769,13 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, m_selectRegion.hi.x = x; m_selectRegion.hi.y = y; - } // end else + } - } // end if + } break; - } // end left button down + } // ------------------------------------------------------------------------ case WM_LBUTTONUP: @@ -794,7 +794,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, // go back to normal mode TheEditor->setMode( MODE_EDIT ); - } // end if + } else if( m_dragSelecting ) { @@ -804,7 +804,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, // stop a drag selection if in progress m_dragSelecting = FALSE; - } // end else + } else if( m_resizingWindow ) { GameWindow *window = TheEditor->getFirstSelected(); @@ -836,11 +836,11 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, m_resizingWindow = FALSE; TheEditor->setMode( MODE_EDIT ); - } // end resizing window + } break; - } // end left button up + } // ------------------------------------------------------------------------ case WM_MBUTTONDOWN: @@ -848,7 +848,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, break; - } // end middle button down + } // ------------------------------------------------------------------------ case WM_MBUTTONUP: @@ -856,7 +856,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, break; - } // end middle button up + } // ------------------------------------------------------------------------ case WM_RBUTTONDOWN: @@ -884,21 +884,21 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, // select this window TheEditor->selectWindow( window ); - } // end if + } else { // no window here, clear selections anyway TheEditor->clearSelections(); - } // end else + } // open right click menu TheEditWindow->openPopupMenu( clickPos.x, clickPos.y ); break; - } // end right button down + } // ------------------------------------------------------------------------ case WM_RBUTTONUP: @@ -906,7 +906,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, break; - } // end right button up + } // ------------------------------------------------------------------------ default: @@ -914,11 +914,11 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, break; - } // end default + } - } // end switch on widnows message + } -} // end mouseEvent +} // EditWindow::inCornerTolerance ============================================== /** If the 'dest' point is within 'tolerance' distance to the 'source' @@ -950,7 +950,7 @@ Bool EditWindow::inCornerTolerance( ICoord2D *dest, ICoord2D *source, return FALSE; -} // end inCornerTolerance +} // EditWindow::inLineTolerance ================================================ /** If the 'dest' point is within the region defined around the @@ -981,7 +981,7 @@ Bool EditWindow::inLineTolerance( ICoord2D *dest, return FALSE; -} // end inLineTolerance +} // EditWindow::handleResizeAvailable ========================================== /** Given the mouse position, if it is close enough to a corner of a @@ -1016,7 +1016,7 @@ void EditWindow::handleResizeAvailable( Int mouseX, Int mouseY ) TheEditor->setMode( MODE_RESIZE_TOP_LEFT ); return; - } // end if + } // check for around bottom right corner point.x = origin.x + size.x; @@ -1027,7 +1027,7 @@ void EditWindow::handleResizeAvailable( Int mouseX, Int mouseY ) TheEditor->setMode( MODE_RESIZE_BOTTOM_RIGHT ); return; - } // end if + } // check for around top right corner point.x = origin.x + size.x; @@ -1038,7 +1038,7 @@ void EditWindow::handleResizeAvailable( Int mouseX, Int mouseY ) TheEditor->setMode( MODE_RESIZE_TOP_RIGHT ); return; - } // end if + } // check for around bottom left corner point.x = origin.x; @@ -1049,7 +1049,7 @@ void EditWindow::handleResizeAvailable( Int mouseX, Int mouseY ) TheEditor->setMode( MODE_RESIZE_BOTTOM_LEFT ); return; - } // end if + } ICoord2D lineStart, lineEnd; @@ -1063,7 +1063,7 @@ void EditWindow::handleResizeAvailable( Int mouseX, Int mouseY ) TheEditor->setMode( MODE_RESIZE_TOP ); return; - } // end if + } // check for along bottom edge lineStart.x = origin.x; @@ -1076,7 +1076,7 @@ void EditWindow::handleResizeAvailable( Int mouseX, Int mouseY ) TheEditor->setMode( MODE_RESIZE_BOTTOM ); return; - } // end if + } // check for along left edge lineStart = origin; @@ -1088,7 +1088,7 @@ void EditWindow::handleResizeAvailable( Int mouseX, Int mouseY ) TheEditor->setMode( MODE_RESIZE_LEFT ); return; - } // end if + } // check for along right edge lineStart.x = origin.x + size.x; @@ -1101,12 +1101,12 @@ void EditWindow::handleResizeAvailable( Int mouseX, Int mouseY ) TheEditor->setMode( MODE_RESIZE_RIGHT ); return; - } // end if + } // we are not resizing anything at all, set us to normal mode TheEditor->setMode( MODE_EDIT ); -} // end handleResizeAvailable +} // EditWindow::drawSeeThruOutlines ============================================ /** Draw an outline for a window that is see thru so we can still work @@ -1132,7 +1132,7 @@ void EditWindow::drawSeeThruOutlines( GameWindow *windowList, Color c ) // draw a box on the window drawOpenRect( pos.x, pos.y, size.x, size.y, 1, c ); - } // end if + } // check window children GameWindow *child; @@ -1142,7 +1142,7 @@ void EditWindow::drawSeeThruOutlines( GameWindow *windowList, Color c ) // go to siblings drawSeeThruOutlines( windowList->winGetNext(), c ); -} // end drawSeeThruOutlines +} // EditWindow::drawHiddenOutlines ============================================= /** Draw an outline for a window that is hidden so we can still work @@ -1168,7 +1168,7 @@ void EditWindow::drawHiddenOutlines( GameWindow *windowList, Color c ) hidden = TRUE; parent = parent->winGetParent(); - } // end while + } if( BitIsSet( windowList->winGetStatus(), WIN_STATUS_HIDDEN ) ) hidden = TRUE; if( hidden ) @@ -1183,7 +1183,7 @@ void EditWindow::drawHiddenOutlines( GameWindow *windowList, Color c ) // draw a box on the window drawOpenRect( pos.x, pos.y, size.x, size.y, 2, c ); - } // end if + } // check window children GameWindow *child; @@ -1193,7 +1193,7 @@ void EditWindow::drawHiddenOutlines( GameWindow *windowList, Color c ) // go to siblings drawHiddenOutlines( windowList->winGetNext(), c ); -} // end drawHiddenOutlines +} // EditWindow::drawUIback ===================================================== /** Draw any visual feedback to the user about selection boxes or windows @@ -1233,7 +1233,7 @@ void EditWindow::drawUIFeedback( void ) drawOpenRect( m_selectRegion.lo.x, m_selectRegion.lo.y, width, height, selectBoxWidth, selectBoxColor ); - } // end if + } // draw select lines on selected windows select = TheEditor->getSelectList(); @@ -1258,7 +1258,7 @@ void EditWindow::drawUIFeedback( void ) // go to next selection select = select->next; - } // end while + } // // if we're drag moving, draw outlines of all the windows in the @@ -1307,7 +1307,7 @@ void EditWindow::drawUIFeedback( void ) safeLoc.x += parentOrigin.x; safeLoc.y += parentOrigin.y; - } // end if + } // draw outline of window at what would be the drag move destination drawOpenRect( safeLoc.x, safeLoc.y, size.x, size.y, @@ -1316,9 +1316,9 @@ void EditWindow::drawUIFeedback( void ) // go to next selection select = select->next; - } // end while + } - } // end if + } // if resizing a window draw that resize representation if( m_resizingWindow ) @@ -1354,13 +1354,13 @@ void EditWindow::drawUIFeedback( void ) loc.x += parentOrigin.x; loc.y += parentOrigin.y; - } // end if + } // draw a box for the window at its new location outlineColor = GameMakeColor( m_pulse, m_pulse, m_pulse, 255 ); drawOpenRect( loc.x, loc.y, size.x, size.y, outlineWidth, outlineColor ); - } // end if + } // draw lines around any drag source and drag targets in the hierarchy view GameWindow *dragSource = TheHierarchyView->getDragWindow(); @@ -1376,7 +1376,7 @@ void EditWindow::drawUIFeedback( void ) // draw box drawOpenRect( origin.x, origin.y, size.x, size.y, 2, dragColor ); - } // end if + } // drag target GameWindow *dragTarget = TheHierarchyView->getDragTarget(); @@ -1391,9 +1391,9 @@ void EditWindow::drawUIFeedback( void ) // draw box drawOpenRect( origin.x, origin.y, size.x, size.y, 2, dragColor ); - } // end if + } -} // end drawUIFeedback +} // EditWindow::drawGrid ======================================================= /** Draw the grid */ @@ -1441,15 +1441,15 @@ void EditWindow::drawGrid( void ) // TheDisplay->drawLine( x, y, x + 1, y + 1, 1, 0xFFFFFFFF ); - } // end for x + } - } // end for y + } */ // release the dc // ReleaseDC( getWindowHandle(), hdc ); -} // end drawGrid +} // EditWindow::draw =========================================================== /** Draw the edit window */ @@ -1479,7 +1479,7 @@ void EditWindow::draw( void ) // render is all done! WW3D::End_Render(); -} // end draw +} // EditWindow::setSize ======================================================== /** The edit window should now be logically consider this size */ @@ -1497,7 +1497,7 @@ void EditWindow::setSize( ICoord2D *size ) TheDisplay->setWidth( m_size.x ); TheDisplay->setHeight( m_size.y ); - } // end if + } // set the extents for our 2D renderer if( m_2DRender ) @@ -1506,7 +1506,7 @@ void EditWindow::setSize( ICoord2D *size ) m_size.x, m_size.y ) ); -} // end setSize +} // EditWindow::openPopupMenu ================================================== /** Open the new control menu that comes up when the user right clicks @@ -1530,7 +1530,7 @@ void EditWindow::openPopupMenu( Int x, Int y ) EnableMenuItem( subMenu, POPUP_MENU_PROPERTIES, MF_GRAYED ); EnableMenuItem( subMenu, POPUP_MENU_BRING_TO_TOP, MF_GRAYED ); - } // end if + } else { @@ -1538,7 +1538,7 @@ void EditWindow::openPopupMenu( Int x, Int y ) EnableMenuItem( subMenu, POPUP_MENU_PROPERTIES, MF_ENABLED ); EnableMenuItem( subMenu, POPUP_MENU_BRING_TO_TOP, MF_ENABLED ); - } // end else + } // // open up right mouse track menu, note that we have to translate the @@ -1554,7 +1554,7 @@ void EditWindow::openPopupMenu( Int x, Int y ) m_popupMenuClickPos.x = x; m_popupMenuClickPos.y = y; -} // end openPopupMenu +} // EditWindow::drawLine ======================================================= /** draw a line on the display in pixel coordinates with the specified color */ @@ -1570,7 +1570,7 @@ void EditWindow::drawLine( Int startX, Int startY, lineWidth, lineColor ); m_2DRender->Render(); -} // end drawLIne +} // EditWindow::drawOpenRect =================================================== /** draw a rect border on the display in pixel coordinates with the @@ -1590,7 +1590,7 @@ void EditWindow::drawOpenRect( Int startX, Int startY, // render it now! m_2DRender->Render(); -} // end drawOpenRect +} // EditWindow::drawFillRect =================================================== /** draw a filled rect on the display in pixel coords with the @@ -1610,7 +1610,7 @@ void EditWindow::drawFillRect( Int startX, Int startY, // render it now! m_2DRender->Render(); -} // end drawFillRect +} // EditWindow::drawImage ====================================================== /** draw an image fit within the screen coordinates */ @@ -1699,18 +1699,18 @@ void EditWindow::drawImage( const Image *image, Vector2( uv_rect.Left, uv_rect.Top ), color ); - } // end if + } else { // just draw as normal m_2DRender->Add_Quad( screen_rect, uv_rect, color ); - } // end else + } m_2DRender->Render(); -} // end drawImage +} // EditWindow::getBackgroundColor ============================================= /** Get the background color for the edit window */ @@ -1720,7 +1720,7 @@ RGBColorReal EditWindow::getBackgroundColor( void ) return m_backgroundColor; -} // end getBackgroundColor +} // EditWindow::setBackgroundColor ============================================= /** Set the background color for the edit window */ @@ -1730,7 +1730,7 @@ void EditWindow::setBackgroundColor( RGBColorReal color ) m_backgroundColor = color; -} // end setBackgroundColor +} // EditWindow::notifyWindowDeleted ============================================ /** A window has been deleted from the editor and the editor is now @@ -1753,7 +1753,7 @@ void EditWindow::notifyWindowDeleted( GameWindow *window ) m_resizingWindow = FALSE; TheEditor->setMode( MODE_EDIT ); - } // end if + } // null out picked window if needed if( m_pickedWindow == window ) @@ -1765,4 +1765,4 @@ void EditWindow::notifyWindowDeleted( GameWindow *window ) // TheEditor->setMode( MODE_EDIT ); -} // end notifyWindowDeleted +} diff --git a/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp b/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp index b91eee83317..0bfeeb375f7 100644 --- a/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp @@ -153,7 +153,7 @@ char *GUIEdit::saveAsDialog( void ) else return NULL; -} // end saveAsDialog +} // GUIEdit::openDialog ======================================================== /** Bring up the standard windows browser open dialog and return @@ -195,7 +195,7 @@ char *GUIEdit::openDialog( void ) else return NULL; -} // end openDialog +} // GUIEdit::setUnsaved ======================================================== /** Set the current contents of the editor as either saved or unsaved, @@ -224,7 +224,7 @@ void GUIEdit::setUnsaved( Bool unsaved ) sprintf( title, "GUIEdit: %s *", filename ); SetWindowText( m_appHWnd, title ); - } // end if + } //else if( m_unsaved == TRUE && unsaved == FALSE ) else { @@ -234,12 +234,12 @@ void GUIEdit::setUnsaved( Bool unsaved ) sprintf( title, "GUIEdit: %s", filename ); SetWindowText( m_appHWnd, title ); - } // end else + } // save the new state we're in m_unsaved = unsaved; -} // end setUnsaved +} // GUIEdit::setSaveFile ======================================================= /** Set our member variables for the full path and filename passed in @@ -260,7 +260,7 @@ void GUIEdit::setSaveFile( const char *fullPathAndFilename ) ptr = strrchr( fullPathAndFilename, '\\' ) + 1; strcpy( m_saveFilename, ptr ); -} // end setSaveFile +} // GUIEdit::validateParentForCreate =========================================== /** This method is used when creating new windows and gadgets, if a @@ -283,11 +283,11 @@ Bool GUIEdit::validateParentForCreate( GameWindow *parent ) "Illegal Parent", MB_OK ); return FALSE; - } // end if + } return TRUE; // ok -} // end validateParentForCreate +} // GUIEdit::findSelectionEntry ================================================ /** Find selection entry for this window */ @@ -311,11 +311,11 @@ WindowSelectionEntry *GUIEdit::findSelectionEntry( GameWindow *window ) // next entry entry = entry->next; - } // end while + } return NULL; // not found -} // end findSelectionEntry +} // GUIEdit::normalizeRegion =================================================== /** Normalize the region so that lo and hi are actually lo and hi */ @@ -334,7 +334,7 @@ void GUIEdit::normalizeRegion( IRegion2D *region ) region->hi = region->lo; region->lo = temp; - } // end if + } else { @@ -342,9 +342,9 @@ void GUIEdit::normalizeRegion( IRegion2D *region ) region->hi.x = region->lo.x; region->lo.x = temp.x; - } // end else + } - } // end if + } else if( region->hi.y < region->lo.y ) { @@ -352,9 +352,9 @@ void GUIEdit::normalizeRegion( IRegion2D *region ) region->hi.y = region->lo.y; region->lo.y = temp.y; - } // end if + } -} // end normalizeRegion +} // GUIEdit::selectWindowsInRegion ============================================= /** Select all the windows that are fully in the region */ @@ -393,14 +393,14 @@ void GUIEdit::selectWindowsInRegion( IRegion2D *region ) // add to selection list selectWindow( window ); - } // end if + } // go to next window window = window->winGetNext(); - } // end while + } -} // end selectWindowsInRegion +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -438,7 +438,7 @@ GUIEdit::GUIEdit( void ) m_layoutInitString = GUIEDIT_NONE_STRING; m_layoutUpdateString = GUIEDIT_NONE_STRING; m_layoutShutdownString = GUIEDIT_NONE_STRING; -} // end GUIEdit +} // GUIEdit::~GUIEdit ========================================================== /** */ @@ -468,7 +468,7 @@ GUIEdit::~GUIEdit( void ) // all the shutdown routine shutdown(); -} // end ~GUIEdit +} // GUIEdit::init ============================================================== /** Initialize all the GUI edit data */ @@ -618,7 +618,7 @@ void GUIEdit::init( void ) // { // TheIMEManager->init(); // } -} // end init +} // GUIEdit::shutdown ========================================================== /** Shutdown our GUI edit application */ @@ -713,7 +713,7 @@ void GUIEdit::shutdown( void ) TheKeyboard = NULL; -} // end shutdown +} // GUIEdit::update ============================================================ /** Update method for our GUI edit application */ @@ -733,7 +733,7 @@ void GUIEdit::update( void ) TheMessageStream->propagateMessages(); TheCommandList->reset(); - } // end if + } // update the window manager itself TheWindowManager->update(); @@ -741,7 +741,7 @@ void GUIEdit::update( void ) // draw the edit window TheEditWindow->draw(); -} // end update +} // GUIEdit::writeConfigFile =================================================== /** Write the guiedit config file */ @@ -759,7 +759,7 @@ Bool GUIEdit::writeConfigFile( const char *filename ) assert( 0 ); return FALSE; - } // end if + } // version fprintf( fp, "GUIEdit Config file version '%d'\n", GUIEDIT_CONFIG_VERSION ); @@ -796,7 +796,7 @@ Bool GUIEdit::writeConfigFile( const char *filename ) return TRUE; -} // end writeConfigFile +} // GUIEdit::readConfigFile ==================================================== /** Read the guiedit config file */ @@ -861,7 +861,7 @@ Bool GUIEdit::readConfigFile( const char *filename ) return TRUE; -} // end readConfigFile +} // GUIEdit::readFontFile ====================================================== /** Read the font file defintitions and load them */ @@ -904,7 +904,7 @@ void GUIEdit::readFontFile( const char *filename ) fontBuffer[ index++ ] = c; c = fgetc( fp ); - } // end while + } fontBuffer[ index ] = '\0'; c = fgetc( fp ); // the end quite itself @@ -921,14 +921,14 @@ void GUIEdit::readFontFile( const char *filename ) fontBuffer, size, bold ); MessageBox( m_appHWnd, buffer, "Cannot Load Font", MB_OK ); - } // end if + } - } // end for i + } // close the file fclose( fp ); -} // end readFontFile +} // GUIEdit::writeFontFile ===================================================== /** If we can, write a file containing a definition of all the fonts @@ -958,12 +958,12 @@ void GUIEdit::writeFontFile( const char *filename ) { fprintf( fp, "AVAILABLEFONT = \"%s\" Size: %d Bold: %d\n", font->nameString.str(), font->pointSize, font->bold ); - } // end for + } // close the file fclose( fp ); -} // end writeFontFile +} // GUIEdit::setMode =========================================================== /** Set a new mode for the editor */ @@ -983,7 +983,7 @@ void GUIEdit::setMode( EditMode mode ) TheMessageStream->removeTranslator( transID ); transID = 0; - } // end if + } // assign new mode m_mode = mode; @@ -1072,9 +1072,9 @@ void GUIEdit::setMode( EditMode mode ) statusMessage( STATUS_MODE, "Drag right to resize" ); break; - } // end switch + } -} // end setMode +} // GUIEdit::setCursor ========================================================= /** Set the cursor to the specified type */ @@ -1121,12 +1121,12 @@ void GUIEdit::setCursor( CursorType type ) identifier = IDC_WAIT; break; - } // end switchType + } // set the new cursor SetCursor( LoadCursor( NULL, identifier ) ); -} // end setCursor +} // pointInChild =============================================================== /** Given a mouse position, get the topmost window at that location. We needed @@ -1155,19 +1155,19 @@ static GameWindow *pointInChild( Int x, Int y , GameWindow *win) origin.y += tempRegion.lo.y; parent = parent->winGetParent(); - } // end while + } child->winGetSize(&tempX,&tempY); if( x >= origin.x && x <= origin.x + tempX && y >= origin.y && y <= origin.y + tempY && BitIsSet( child->winGetStatus(), WIN_STATUS_HIDDEN ) == FALSE) return child->winPointInChild( x, y ); - } // end for child + } // not in any children, must be in parent return win; -} // end pointInChild +} // pointInAnyChild ============================================================ /** Given a mouse position, get the topmost window at that location. We needed @@ -1196,7 +1196,7 @@ static GameWindow *pointInAnyChild( Int x, Int y, Bool ignoreHidden, GameWindow origin.y += tempRegion.lo.y; parent = parent->winGetParent(); - } // end while + } child->winGetSize(&tempX,&tempY); if( x >= origin.x && x <= origin.x + tempX && y >= origin.y && y <= origin.y + tempY ) @@ -1205,14 +1205,14 @@ static GameWindow *pointInAnyChild( Int x, Int y, Bool ignoreHidden, GameWindow if( !(ignoreHidden == TRUE && BitIsSet( child->winGetStatus(), WIN_STATUS_HIDDEN )) ) return pointInChild( x, y , child); - } // end if + } - } // end for child + } // not in any children, must be in parent return win; -} // end pointInAnyChild +} // GUIEdit::getWindowAtPos ==================================================== /** Given a mouse position, get the topmost window at that location */ @@ -1238,9 +1238,9 @@ GameWindow *GUIEdit::getWindowAtPos( Int x, Int y ) pick = pointInAnyChild( x, y, FALSE, window ); break; // exit for - } // end if + } - } // end for + } // // gadget controls are just composed of generic windows and buttons, @@ -1287,7 +1287,7 @@ GameWindow *GUIEdit::getWindowAtPos( Int x, Int y ) GWS_SCROLL_LISTBOX ) ) pick = grandParent; - } // end if + } //must check to see of the parent of a scroll box is a combo box if(BitIsSet(pick->winGetStyle(), GWS_SCROLL_LISTBOX)) @@ -1296,15 +1296,15 @@ GameWindow *GUIEdit::getWindowAtPos( Int x, Int y ) if( grandParent && BitIsSet( grandParent->winGetStyle(), GWS_COMBO_BOX)) pick = grandParent; } - } // end if + } - } // end if + } - } // end if + } return pick; -} // end getWindowAtPos +} // GUIEdit::clipCreationParamsToParent ======================================== /** when creating child windows we don't want them to exist outside the @@ -1362,7 +1362,7 @@ void GUIEdit::clipCreationParamsToParent( GameWindow *parent, *width = newWidth; *height= newHeight; -} // end clipcreationParamsToParent +} /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// @@ -1383,9 +1383,9 @@ void GUIEdit::deleteAllWindows( void ) deleteWindow( window ); window = next; - } // end while + } -} // end deleteAllWindows +} // GUIEdit::removeWindowCleanup =============================================== /** This is called on each window before it is deleted or removed from @@ -1423,7 +1423,7 @@ void GUIEdit::removeWindowCleanup( GameWindow *window ) for( child = window->winGetChild(); child; child = child->winGetNext() ) removeWindowCleanup( child ); -} // end removeWindowCleanup +} // GUIEdit::deleteWindow ====================================================== /** Delete the window from the editor */ @@ -1440,7 +1440,7 @@ void GUIEdit::deleteWindow( GameWindow *window ) // we've changed contents setUnsaved( TRUE ); -} // end deleteWindow +} // GUIEdit::newWindow ========================================================= /** Create a new window of the specified type. This is the single creation @@ -1523,11 +1523,11 @@ GameWindow *GUIEdit::newWindow( UnsignedInt windowStyle, MB_OK | MB_ICONERROR ); break; - } // end switch + } return window; -} // end newWindow +} // GUIEdit::newUserWindow ===================================================== /** Create a new window at the given location */ @@ -1585,7 +1585,7 @@ GameWindow *GUIEdit::newUserWindow( GameWindow *parent, Int x, Int y, return window; -} // end newUserWindow +} // GUIEdit::newPushButton ===================================================== /** Create a new push button */ @@ -1667,7 +1667,7 @@ GameWindow *GUIEdit::newPushButton( GameWindow *parent, // set default font window->winSetFont( TheDefaultScheme->getFont() ); - } // end if + } // contents have changed setUnsaved( TRUE ); @@ -1677,7 +1677,7 @@ GameWindow *GUIEdit::newPushButton( GameWindow *parent, return window; -} // end newPushButton +} // GUIEdit::newCheckBox ======================================================= /** Create a new check box */ @@ -1772,7 +1772,7 @@ GameWindow *GUIEdit::newCheckBox( GameWindow *parent, // set default font window->winSetFont( TheDefaultScheme->getFont() ); - } // end if + } // contents have changed setUnsaved( TRUE ); @@ -1782,7 +1782,7 @@ GameWindow *GUIEdit::newCheckBox( GameWindow *parent, return window; -} // end newCheckBox +} // GUIEdit::newRadioButton ==================================================== /** Create a new radio button */ @@ -1880,7 +1880,7 @@ GameWindow *GUIEdit::newRadioButton( GameWindow *parent, // set default font window->winSetFont( TheDefaultScheme->getFont() ); - } // end if + } // contents have changed setUnsaved( TRUE ); @@ -1890,7 +1890,7 @@ GameWindow *GUIEdit::newRadioButton( GameWindow *parent, return window; -} // end newRadioButton +} // GUIEdit::newTabControl ==================================================== /** Create a tab control gadget */ @@ -2078,7 +2078,7 @@ GameWindow *GUIEdit::newTabControl( GameWindow *parent, GadgetTabControlSetHiliteColorBackground( window, info->color ); GadgetTabControlSetHiliteBorderColorBackground( window, info->borderColor ); - } // end if + } // contents have changed setUnsaved( TRUE ); @@ -2088,7 +2088,7 @@ GameWindow *GUIEdit::newTabControl( GameWindow *parent, return window; -} // end newTabControl +} // GUIEdit::newHorizontalSlider =============================================== /** Create a new horizontal slider*/ @@ -2199,7 +2199,7 @@ GameWindow *GUIEdit::newHorizontalSlider( GameWindow *parent, // set default font window->winSetFont( TheDefaultScheme->getFont() ); - } // end if + } // contents have changed setUnsaved( TRUE ); @@ -2209,7 +2209,7 @@ GameWindow *GUIEdit::newHorizontalSlider( GameWindow *parent, return window; -} // end newHorizontalSlider +} // GUIEdit::newVerticlaSlider ================================================= /** Create a new vertical slider */ @@ -2320,7 +2320,7 @@ GameWindow *GUIEdit::newVerticalSlider( GameWindow *parent, // set default font window->winSetFont( TheDefaultScheme->getFont() ); - } // end if + } // contents have changed setUnsaved( TRUE ); @@ -2330,7 +2330,7 @@ GameWindow *GUIEdit::newVerticalSlider( GameWindow *parent, return window; -} // end newVerticalSlider +} // GUIEdit::newProgressBar ==================================================== /** Create a new progress bar */ @@ -2455,7 +2455,7 @@ GameWindow *GUIEdit::newProgressBar( GameWindow *parent, // set default font window->winSetFont( TheDefaultScheme->getFont() ); - } // end if + } // contents have changed setUnsaved( TRUE ); @@ -2465,7 +2465,7 @@ GameWindow *GUIEdit::newProgressBar( GameWindow *parent, return window; -} // end newProgressBar +} // GUIEdit::newListbox ======================================================== /** Create a new list box */ @@ -2709,7 +2709,7 @@ GameWindow *GUIEdit::newComboBox( GameWindow *parent, GadgetButtonSetHiliteSelectedColor( upButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( upButton, info->borderColor ); - } // end if + } GameWindow *downButton = GadgetListBoxGetDownButton( listBox ); if( downButton ) @@ -2742,7 +2742,7 @@ GameWindow *GUIEdit::newComboBox( GameWindow *parent, GadgetButtonSetHiliteSelectedColor( downButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( downButton, info->borderColor ); - } // end if + } GameWindow *slider = GadgetListBoxGetSlider( listBox ); if( slider ) @@ -2814,7 +2814,7 @@ GameWindow *GUIEdit::newComboBox( GameWindow *parent, GadgetSliderSetHiliteSelectedThumbBorderColor( slider, info->borderColor ); } - } //end listbox if + } GameWindow *dropDownButton = GadgetComboBoxGetDropDownButton( window ); if( dropDownButton ) { @@ -2846,7 +2846,7 @@ GameWindow *GUIEdit::newComboBox( GameWindow *parent, GadgetButtonSetHiliteSelectedColor( dropDownButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( dropDownButton, info->borderColor ); - } // end if + } Color color, border; @@ -2869,7 +2869,7 @@ GameWindow *GUIEdit::newComboBox( GameWindow *parent, // set default font window->winSetFont( TheDefaultScheme->getFont() ); - }// end if + } // contents have changed setUnsaved( TRUE ); @@ -2880,7 +2880,7 @@ GameWindow *GUIEdit::newComboBox( GameWindow *parent, return window; -} // end newComboBox +} // GUIEdit::newListbox ======================================================== /** Create a new list box */ @@ -3010,7 +3010,7 @@ GameWindow *GUIEdit::newListbox( GameWindow *parent, GadgetButtonSetHiliteSelectedColor( upButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( upButton, info->borderColor ); - } // end if + } GameWindow *downButton = GadgetListBoxGetDownButton( window ); if( downButton ) @@ -3043,7 +3043,7 @@ GameWindow *GUIEdit::newListbox( GameWindow *parent, GadgetButtonSetHiliteSelectedColor( downButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( downButton, info->borderColor ); - } // end if + } GameWindow *slider = GadgetListBoxGetSlider( window ); if( slider ) @@ -3114,7 +3114,7 @@ GameWindow *GUIEdit::newListbox( GameWindow *parent, GadgetSliderSetHiliteSelectedThumbColor( slider, info->color ); GadgetSliderSetHiliteSelectedThumbBorderColor( slider, info->borderColor ); - } // end if, slider + } Color color, border; @@ -3133,7 +3133,7 @@ GameWindow *GUIEdit::newListbox( GameWindow *parent, // set default font window->winSetFont( TheDefaultScheme->getFont() ); - } // end if + } // contents have changed setUnsaved( TRUE ); @@ -3143,7 +3143,7 @@ GameWindow *GUIEdit::newListbox( GameWindow *parent, return window; -} // end newListbox +} // GUIEdit::newTextEntry ====================================================== /** Create a new text entry */ @@ -3239,7 +3239,7 @@ GameWindow *GUIEdit::newTextEntry( GameWindow *parent, // set default font window->winSetFont( TheDefaultScheme->getFont() ); - } // end if + } // contents have changed setUnsaved( TRUE ); @@ -3249,7 +3249,7 @@ GameWindow *GUIEdit::newTextEntry( GameWindow *parent, return window; -} // end newTextEntry +} // GUIEdit::newStaticText ===================================================== /** Create a new static text*/ @@ -3327,7 +3327,7 @@ GameWindow *GUIEdit::newStaticText( GameWindow *parent, // set default font window->winSetFont( TheDefaultScheme->getFont() ); - } // end if + } // contents have changed setUnsaved( TRUE ); @@ -3337,7 +3337,7 @@ GameWindow *GUIEdit::newStaticText( GameWindow *parent, return window; -} // end newStaticText +} // GUIEdit::createStatusBar =================================================== /** Create a status bar at the bottom of the editor */ @@ -3371,11 +3371,11 @@ void GUIEdit::createStatusBar( void ) sizes[ i ] = (i + 1) * (width / STATUS_NUM_PARTS); - } // end for i + } sizes[ STATUS_NUM_PARTS - 1 ] = -1; // right edge SendMessage( m_statusBarHWnd, SB_SETPARTS, STATUS_NUM_PARTS, (LPARAM)sizes ); -} // end createStatusBar +} // GUIEdit::statusMessage ===================================================== /** Set a message in the status bar */ @@ -3391,12 +3391,12 @@ void GUIEdit::statusMessage( StatusPart part, const char *message ) assert( 0 ); return; - } // end if + } if( m_statusBarHWnd ) SendMessage( m_statusBarHWnd, SB_SETTEXT, part, (LPARAM)message ); -} // end statusMessage +} // GUIEdit::createToolbar ===================================================== /** Create the toolbar for the editor */ @@ -3404,7 +3404,7 @@ void GUIEdit::statusMessage( StatusPart part, const char *message ) void GUIEdit::createToolbar( void ) { -} // end createToolbar +} /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// @@ -3429,7 +3429,7 @@ Bool GUIEdit::newLayout( void ) return TRUE; -} // end newLayout +} // GUIEdit::menuExit ========================================================== /** The user clicked on exit in the menu and wishes to exit the editor */ @@ -3465,9 +3465,9 @@ Bool GUIEdit::menuExit( void ) "File not saved. If you continue to exit all data will be LOST!", "File Not Saved", MB_OK ); - } // end if + } - } // end if + } // ask them if they really want to quit result = MessageBox( m_appHWnd, "Exit GUIEdit?", "Really Quit?", MB_YESNO ); @@ -3476,7 +3476,7 @@ Bool GUIEdit::menuExit( void ) return TRUE; -} // end menuExit +} // GUIEdit::menuNew =========================================================== /** file->new menu option */ @@ -3516,11 +3516,11 @@ Bool GUIEdit::menuNew( void ) if( result == IDNO ) return TRUE; // they chose to proceed anyway, no error - } // end if + } - } // end if + } - } // end if + } // reset the layout in the editor strcpy( m_savePathAndFilename, "" ); @@ -3530,7 +3530,7 @@ Bool GUIEdit::menuNew( void ) return TRUE; -} // end menuNew +} // GUIEdit::stripNameDecorations ============================================== /** Strip name decorations of the entire tree of windows */ @@ -3564,9 +3564,9 @@ void GUIEdit::stripNameDecorations( GameWindow *root ) // put the name only in the decoration field instData->m_decoratedNameString = nameOnly; - } // end if + } - } // end if + } // strip from children GameWindow *child; @@ -3576,7 +3576,7 @@ void GUIEdit::stripNameDecorations( GameWindow *root ) // onto the next stripNameDecorations( root->winGetNext() ); -} // end stripNameDecorations +} //============================================================================= /** After a load, we will restore default callbacks to all user windows @@ -3598,7 +3598,7 @@ void GUIEdit::revertDefaultCallbacks( GameWindow *root ) root->winSetTooltipFunc( TheWindowManager->getDefaultTooltip() ); root->winSetDrawFunc( TheWindowManager->getDefaultDraw() ); - } // end if + } // do the children revertDefaultCallbacks( root->winGetChild() ); @@ -3606,7 +3606,7 @@ void GUIEdit::revertDefaultCallbacks( GameWindow *root ) // do the next window revertDefaultCallbacks( root->winGetNext() ); -} // end revertDefaultCallbacks +} // GUIEdit::menuOpen ========================================================== /** User has clicked on file->open */ @@ -3647,11 +3647,11 @@ Bool GUIEdit::menuOpen( void ) if( result == IDNO ) return TRUE; // they chose to proceed anyway, no error - } // end if + } - } // end if + } - } // end if + } // open the standard window file browser filePath = openDialog(); @@ -3706,7 +3706,7 @@ Bool GUIEdit::menuOpen( void ) return TRUE; -} // end menuOpen +} // GUIEdit::menuSave ========================================================== /** file->save menu option */ @@ -3727,17 +3727,17 @@ Bool GUIEdit::menuSave( void ) // our contents are now considered "unchanged" setUnsaved( FALSE ); - } // end if + } else { MessageBox( m_appHWnd, "Layout not saved!", "Error", MB_OK ); - } // end else + } return success; -} // end menuSave +} // GUIEdit::menuSaveAs ======================================================== /** file->saveAs menu option */ @@ -3765,17 +3765,17 @@ Bool GUIEdit::menuSaveAs( void ) // our contents are now considered "unchanged" setUnsaved( FALSE ); - } // end if + } else { MessageBox( m_appHWnd, "Layout not saved!", "Error", MB_OK ); - } // end else + } return success; -} // end menuSaveAs +} // GUIEdit::menuCopy ========================================================== /** Copy selected windows into clipboard */ @@ -3793,7 +3793,7 @@ Bool GUIEdit::menuCopy( void ) "No Windows Selected", MB_OK ); return TRUE; - } // end if + } // // cut the selected windows out of the current window system, and @@ -3803,7 +3803,7 @@ Bool GUIEdit::menuCopy( void ) return TRUE; -} // end menuCopy +} // GUIEdit::menuPaste ========================================================= /** Paste contents of clipboard into current layout */ @@ -3814,7 +3814,7 @@ Bool GUIEdit::menuPaste( void ) TheGUIEditWindowManager->pasteClipboard(); return TRUE; -} // end menuPaste +} // GUIEdit::menuCut =========================================================== /** Cut selected windows into the clipboard */ @@ -3832,7 +3832,7 @@ Bool GUIEdit::menuCut( void ) "No Windows Selected", MB_OK ); return TRUE; - } // end if + } // // cut the selected windows out of the current window system, and @@ -3842,7 +3842,7 @@ Bool GUIEdit::menuCut( void ) return TRUE; -} // end menuCut +} /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// @@ -3866,7 +3866,7 @@ Bool GUIEdit::isWindowSelected( GameWindow *window ) else return FALSE; -} // end isWindowSelected +} // GUIEdit::selectWindow ====================================================== /** Add window to selection list */ @@ -3892,7 +3892,7 @@ void GUIEdit::selectWindow( GameWindow *window ) assert( 0 ); return; - } // end if + } // fill out information and tie to head of list entry->window = window; @@ -3906,7 +3906,7 @@ void GUIEdit::selectWindow( GameWindow *window ) if( selectionCount() == 1 ) TheHierarchyView->selectWindow( window ); -} // end selectWindow +} // GUIEdit::unSelectWindow ==================================================== /** Remove window from the selection list */ @@ -3935,9 +3935,9 @@ void GUIEdit::unSelectWindow( GameWindow *window ) // delete the entry delete entry; - } // end if + } -} // end unSelectWindow +} // GUIEdit::clearSelections =================================================== /** Clear the entire selection list */ @@ -3948,7 +3948,7 @@ void GUIEdit::clearSelections( void ) while( m_selectList ) unSelectWindow( m_selectList->window ); -} // end clearSelections +} // GUIEdit::selectionCount ==================================================== /** How many items are selected */ @@ -3965,11 +3965,11 @@ Int GUIEdit::selectionCount( void ) count++; select = select->next; - } // end while + } return count; -} // end selectionCount +} // GUIEdit::notifyNewWindow =================================================== /** The passed in window has just been added into the GUI layout. It @@ -4003,9 +4003,9 @@ void GUIEdit::notifyNewWindow( GameWindow *window ) for( child = window->winGetChild(); child; child = child->winGetNext() ) notifyNewWindow( child ); - } // end if + } -} // end notifyNewWindow +} // GUIEdit::deleteSelected ==================================================== /** Delete the windows in the selection list */ @@ -4031,7 +4031,7 @@ void GUIEdit::deleteSelected( void ) assert( 0 ); return; - } // end if + } // fill out the delete list for( i = 0, select = m_selectList; i < count; i++, select = select->next ) @@ -4044,7 +4044,7 @@ void GUIEdit::deleteSelected( void ) // free memory for the delete list delete [] deleteList; -} // end deleteSelected +} // GUIEdit::bringSelectedToTop ================================================ /** Bring the selected windows to the top so they draw on top of @@ -4074,7 +4074,7 @@ void GUIEdit::bringSelectedToTop( void ) assert( 0 ); return; - } // end if + } // take the snapshot Int i; @@ -4092,12 +4092,12 @@ void GUIEdit::bringSelectedToTop( void ) // update the hierarchy to have the new window on the top TheHierarchyView->bringWindowToTop( snapshot[ i ] ); - } // end for i + } // delete the snapshot list delete [] snapshot; -} // end bringSelectedToTop +} // GUIEdit::dragMoveSelectedWindows =========================================== /** Move all the windows in the selection list from a drag move, note @@ -4142,10 +4142,10 @@ void GUIEdit::dragMoveSelectedWindows( ICoord2D *dragOrigin, // goto next selected window select = select->next; - } // end while + } -} // end dragMoveSelectedWindows +} // GUIEdit::getSelectList ===================================================== /** Return the selection list */ @@ -4155,7 +4155,7 @@ WindowSelectionEntry *GUIEdit::getSelectList( void ) return m_selectList; -} // end getSelectList +} // GUIEdit::getFirstSelected ================================================== /** Get the first GameWindow * from the selection list */ @@ -4168,7 +4168,7 @@ GameWindow *GUIEdit::getFirstSelected( void ) return NULL; -} // end getFirstSelected +} // GUIEdit::computeSafeLocation =============================================== /** If we attempt to move the window to the given (x,y) it may result @@ -4215,7 +4215,7 @@ void GUIEdit::computeSafeLocation( GameWindow *window, else if( region.hi.y + dy > parentSize.y ) dy = parentSize.y - region.hi.y; - } // end else if, parent + } // Move the window, but keep it completely visible within screen boundaries IRegion2D newRegion; @@ -4246,7 +4246,7 @@ void GUIEdit::computeSafeLocation( GameWindow *window, *safeX = newRegion.lo.x; *safeY = newRegion.lo.y; -} // end computeSafeLocation +} // GUIEdit::computeSafeSizeLocation =========================================== /** Like the method computeSafeLocation, this method also takes into @@ -4281,7 +4281,7 @@ void GUIEdit::computeSafeSizeLocation( GameWindow *window, parent->winGetScreenPosition( &parentLoc.x, &parentLoc.y ); parent->winGetSize( &parentSize.x, &parentSize.y ); - } // end if + } // upper left corner must be in screen or in parent topLeftLimit.x = 0; // screen top left @@ -4309,7 +4309,7 @@ void GUIEdit::computeSafeSizeLocation( GameWindow *window, bottomRightLimit.x = parentLoc.x + parentSize.x; bottomRightLimit.y = parentLoc.y + parentSize.y; - } // end if + } if( newX + newWidth > bottomRightLimit.x ) newWidth = bottomRightLimit.x - newX; if( newY + newHeight > bottomRightLimit.y ) @@ -4326,7 +4326,7 @@ void GUIEdit::computeSafeSizeLocation( GameWindow *window, *safeY = *safeY - parentLoc.y; } -} // end computeSafeSizeLocation +} // GUIEdit::computeResizeLocation ============================================= /** Given the current resize drag mode, the selected window to resize, @@ -4513,7 +4513,7 @@ void GUIEdit::computeResizeLocation( EditMode resizeMode, break; - } // end switch( resizeMode ) + } // to finalize the size we must now clip to any parent or the screen computeSafeSizeLocation( window, @@ -4522,7 +4522,7 @@ void GUIEdit::computeResizeLocation( EditMode resizeMode, &resultLoc->x, &resultLoc->y, &resultSize->x, &resultSize->y ); -} // end computeResizeLocation +} // GUIEdit::moveWindowTo ====================================================== /** Move the window passed into the the absolute position (x,y), @@ -4537,7 +4537,7 @@ void GUIEdit::moveWindowTo( GameWindow *window, Int x, Int y ) // we've now made a change TheEditor->setUnsaved( TRUE ); -} // end moveWindowTo +} // GUIEdit::windowIsGadget ==================================================== /** Return TRUE if this window is one of our predefined gadtet types */ @@ -4551,7 +4551,7 @@ Bool GUIEdit::windowIsGadget( GameWindow *window ) return BitIsSet( window->winGetStyle(), GWS_GADGET_WINDOW ); -} // end windowIsGadget +} // GUIEdit::gridSnapLocation ================================================== /** Given the source input point, return in 'snapped' the closest grid @@ -4567,7 +4567,7 @@ void GUIEdit::gridSnapLocation( ICoord2D *source, ICoord2D *snapped ) snapped->x = (source->x / m_gridResolution) * m_gridResolution; snapped->y = (source->y / m_gridResolution) * m_gridResolution; -} // end gridSnapLocation +} // GUIEdit::checkMenuItem ===================================================== /** Check the menu item from the guiedit main menu */ @@ -4583,7 +4583,7 @@ void GUIEdit::checkMenuItem( Int item ) // check it CheckMenuItem( menu, item, MF_CHECKED ); -} // end checkMenuItem +} // GUIEdit::unCheckMenuItem =================================================== /** Un-check the menu item from the guiedit main menu */ @@ -4599,7 +4599,7 @@ void GUIEdit::unCheckMenuItem( Int item ) // check it CheckMenuItem( menu, item, MF_UNCHECKED ); -} // end unCheckMenuItem +} // GUIEdit::isNameDuplicate =================================================== /** Is the name passed in found as the name of any window in in the @@ -4630,7 +4630,7 @@ Bool GUIEdit::isNameDuplicate( GameWindow *root, GameWindow *ignore, AsciiString // check the next window in the list return isNameDuplicate( root->winGetNext(), ignore, name ); -} // end isNameDuplicate +} // GUIEdit::loadGUIEditFontLibrary ============================================ /** Load the set of fonts that we will make available to users in @@ -4653,7 +4653,7 @@ void GUIEdit::loadGUIEditFontLibrary( FontLibrary *library ) library->getFont( times, 10, FALSE ); library->getFont( times, 10, TRUE ); -} // end loadGUIEditFontLibrary +} // GUIEdit::setShowHiddenOutlines ============================================= //============================================================================= @@ -4667,7 +4667,7 @@ void GUIEdit::setShowHiddenOutlines( Bool show ) else CheckMenuItem( GetMenu( m_appHWnd ), MENU_SHOW_HIDDEN_OUTLINES, MF_UNCHECKED ); -} // end setShowHiddenOutlines +} // GUIEdit::setShowSeeThruOutlines ============================================ //============================================================================= @@ -4681,5 +4681,5 @@ void GUIEdit::setShowSeeThruOutlines( Bool show ) else CheckMenuItem( GetMenu( m_appHWnd ), MENU_SHOW_SEE_THRU_OUTLINES, MF_UNCHECKED ); -} // end setShowSeeThruOutlines +} diff --git a/Generals/Code/Tools/GUIEdit/Source/GUIEditDisplay.cpp b/Generals/Code/Tools/GUIEdit/Source/GUIEditDisplay.cpp index 6e73dbdf964..0ee39f732b9 100644 --- a/Generals/Code/Tools/GUIEdit/Source/GUIEditDisplay.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/GUIEditDisplay.cpp @@ -72,7 +72,7 @@ GUIEditDisplay::GUIEditDisplay( void ) { -} // end GUIEditDisplay +} // GUIEditDisplay::~GUIEditDisplay ============================================ /** */ @@ -80,7 +80,7 @@ GUIEditDisplay::GUIEditDisplay( void ) GUIEditDisplay::~GUIEditDisplay( void ) { -} // end ~GUIEditDisplay +} // GUIEditDisplay::drawLine =================================================== /** draw a line on the display in pixel coordinates with the specified color */ @@ -92,7 +92,7 @@ void GUIEditDisplay::drawLine( Int startX, Int startY, TheEditWindow->drawLine( startX, startY, endX, endY, lineWidth, lineColor ); -} // end drawLIne +} // GUIEditDisplay::drawOpenRect =============================================== /** draw a rect border on the display in pixel coordinates with the @@ -106,7 +106,7 @@ void GUIEditDisplay::drawOpenRect( Int startX, Int startY, TheEditWindow->drawOpenRect( startX, startY, width, height, lineWidth, lineColor ); -} // end drawOpenRect +} // GUIEditDisplay::drawFillRect =============================================== /** draw a filled rect on the display in pixel coords with the @@ -121,7 +121,7 @@ void GUIEditDisplay::drawFillRect( Int startX, Int startY, width, height, color ); -} // end drawFillRect +} // GUIEditDisplay::drawImage ================================================== /** draw an image fit within the screen coordinates */ @@ -138,7 +138,7 @@ void GUIEditDisplay::drawImage( const Image *image, color ); -} // end drawImage +} // GUIEditDisplay::setClipRegion ============================================== /** sets clipping rectangle for 2D drawing operations */ diff --git a/Generals/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp b/Generals/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp index 2fd91fc9c04..f26eb7428eb 100644 --- a/Generals/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp @@ -70,11 +70,11 @@ Bool GUIEditWindowManager::isWindowInClipboard( GameWindow *window, if( window == other ) return TRUE; // found - } // end for window + } return FALSE; // not found -} // end isWindowInClipboard +} //------------------------------------------------------------------------------------------------- /** Add the window to clipboard list */ @@ -97,7 +97,7 @@ void GUIEditWindowManager::linkToClipboard( GameWindow *window, (*list)->winSetPrev( window ); *list = window; -} // end linkToClipboard +} //------------------------------------------------------------------------------------------------- /** Unlink window from the clipboard list */ @@ -125,7 +125,7 @@ void GUIEditWindowManager::unlinkFromClipboard( GameWindow *window, else *list = next; -} // end unlinkFromClipboard +} //------------------------------------------------------------------------------------------------- /** Remove selection entries for child windows that also have ANY of @@ -157,7 +157,7 @@ void GUIEditWindowManager::removeSupervisedChildSelections( void ) parentSelected = TRUE; parent = parent->winGetParent(); - } // end while + } // // if there is a parent selected then we can remove this @@ -166,9 +166,9 @@ void GUIEditWindowManager::removeSupervisedChildSelections( void ) if( parentSelected == TRUE ) TheEditor->unSelectWindow( window ); - } // end for select + } -} // end removeSupervisedChildSelections +} //------------------------------------------------------------------------------------------------- /** Traverse the selected window list, any child windows we encounter @@ -206,11 +206,11 @@ void GUIEditWindowManager::orphanSelectedChildren( void ) // window->winSetPosition( pos.x, pos.y ); - } // end if, we had a parent + } - } // end for select + } -} // end orphanSelectedChildren +} */ /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -228,7 +228,7 @@ GUIEditWindowManager::GUIEditWindowManager( void ) m_copySpacing = 8; m_numCopiesPasted = 0; -} // end GUIEditWindowManager +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -241,7 +241,7 @@ GUIEditWindowManager::~GUIEditWindowManager( void ) // free all data on the clipboard resetClipboard(); -} // end ~GUIEditWindowManager +} //------------------------------------------------------------------------------------------------- /** initialize the system */ @@ -252,7 +252,7 @@ void GUIEditWindowManager::init( void ) // extending functionality W3DGameWindowManager::init(); -} // end init +} //------------------------------------------------------------------------------------------------- /** Destroy a game window */ @@ -275,12 +275,12 @@ Int GUIEditWindowManager::winDestroy( GameWindow *window ) // set the edit data to NULL in the window window->winSetEditData( NULL ); - } // end if + } // call our base class functionality return W3DGameWindowManager::winDestroy( window ); -} // end winDestroy +} //------------------------------------------------------------------------------------------------- /** Create a new window by setting up its parameters and callbacks. */ @@ -310,11 +310,11 @@ GameWindow *GUIEditWindowManager::winCreate( GameWindow *parent, // attach edit data to window window->winSetEditData( editData ); - } // end if + } return window; -} // end winCreate +} //------------------------------------------------------------------------------------------------- /** Destroy all windows in the clipboard */ @@ -346,7 +346,7 @@ void GUIEditWindowManager::resetClipboard( void ) // winDestroy( window ); - } // end for window + } // immediately process the destroyed windows just to be clean here processDestroyList(); @@ -355,7 +355,7 @@ void GUIEditWindowManager::resetClipboard( void ) m_clipboard = NULL; m_numCopiesPasted = 0; -} // end resetClipboard +} //------------------------------------------------------------------------------------------------- /** Is the clipboard empty */ @@ -368,7 +368,7 @@ Bool GUIEditWindowManager::isClipboardEmpty( void ) return FALSE; -} // end isClipboardEmtpy +} //------------------------------------------------------------------------------------------------- /** Remove the selected windows from the current layout and put them into @@ -395,7 +395,7 @@ void GUIEditWindowManager::cutSelectedToClipboard( void ) if( m_clipboard ) TheEditor->deleteSelected(); -} // end cutSelectedToClipboard +} //------------------------------------------------------------------------------------------------- /** Given the current window in a list pointed to by 'root', if that @@ -440,14 +440,14 @@ void GUIEditWindowManager::duplicateSelected( GameWindow *root ) pos.y += parentPos.y; duplicate->winSetPosition( pos.x, pos.y ); - } // end if + } // add window to the clipboard linkToClipboard( duplicate, &m_clipboard ); - } // end if + } - } // end if + } else { @@ -457,12 +457,12 @@ void GUIEditWindowManager::duplicateSelected( GameWindow *root ) // duplicateSelected( root->winGetChild() ); - } // end else + } // move on to the next window duplicateSelected( root->winGetNext() ); -} // end duplicateSelected +} //------------------------------------------------------------------------------------------------- /** Copy the selected windows to the clipboard */ @@ -487,7 +487,7 @@ void GUIEditWindowManager::copySelectedToClipboard( void ) // duplicateSelected( m_windowList ); -} // end copySelectedToClipboard +} //------------------------------------------------------------------------------------------------- /** Take the string representation of the name of the window passed in, @@ -518,7 +518,7 @@ void GUIEditWindowManager::incrementName( GameWindow *window ) strcat( name, "1" ); goto cleanup; - } // end if + } // // start from the end of the string and back up to the start picking @@ -540,16 +540,16 @@ void GUIEditWindowManager::incrementName( GameWindow *window ) hasNumberSuffix = TRUE; numberBuffer[ j-- ] = c; - } // end if + } else { numberStartIndex = i + 1; break; // exit for i - } // end else + } - } // end for i + } // // if we have a number suffix change it to a number, increment it, and @@ -577,24 +577,24 @@ void GUIEditWindowManager::incrementName( GameWindow *window ) name[ i + numberStartIndex ] = numberBuffer[ i ]; charsAdded++; - } // end if + } } name[ numberStartIndex + charsAdded ] = 0; // terminate at end of new string - } // end if + } else { // no number at end, easy ... just append a number '1' strcat( name, "1" ); - } // end else + } cleanup: instData->m_decoratedNameString = name; -} // end incrementName +} //------------------------------------------------------------------------------------------------- /** Validate the names for all the windows and child windows in the copy @@ -644,9 +644,9 @@ void GUIEditWindowManager::validateClipboardNames( GameWindow *root ) MessageBox( TheEditor->getWindowHandle(), buffer, "Error Mapping Names", MB_OK ); nameOK = TRUE; - } // end if + } - } // end if + } // validate our children names GameWindow *child; @@ -656,7 +656,7 @@ void GUIEditWindowManager::validateClipboardNames( GameWindow *root ) // validate the next window in the list validateClipboardNames( root->winGetNext() ); -} // end validateClipboardNames +} //------------------------------------------------------------------------------------------------- /** Paste the contents of the clipboard into the window world */ @@ -676,7 +676,7 @@ void GUIEditWindowManager::pasteClipboard( void ) MB_OK ); return; - } // end if + } // create a duplicate of everything in the clipboard assert( m_clipboardDup == NULL ); @@ -727,7 +727,7 @@ void GUIEditWindowManager::pasteClipboard( void ) // notify the hierarchy of the new window added TheHierarchyView->addWindow( window, HIERARCHY_ADD_AT_TOP ); - } // end for window + } // the clipboard duplicate list is only for the act of pasting assert( m_clipboardDup == NULL ); @@ -754,13 +754,13 @@ void GUIEditWindowManager::pasteClipboard( void ) // notify the editor that each of the windows was created TheEditor->notifyNewWindow( window ); - } // end while + } // if we did in fact paste a window then our file contents have changed if( firstWindow ) TheEditor->setUnsaved( TRUE ); -} // end pasteClipboard +} //------------------------------------------------------------------------------------------------- /** Convinience funtion to copy the Draw state info for a given instance */ @@ -828,7 +828,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, source->winGetFont(), FALSE ); - } // end if + } else if( BitIsSet( style, GWS_RADIO_BUTTON ) ) { RadioButtonData *radioData = (RadioButtonData *)source->winGetUserData(); @@ -849,7 +849,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, source->winGetFont(), FALSE ); - } // end else if + } else if( BitIsSet( style, GWS_CHECK_BOX ) ) { @@ -864,7 +864,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, source->winGetFont(), FALSE ); - } // end else if + } else if( BitIsSet( style, GWS_HORZ_SLIDER | GWS_VERT_SLIDER ) ) { SliderData *sliderData = (SliderData *)source->winGetUserData(); @@ -913,11 +913,11 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, &sourceInstData->m_hiliteDrawData, sizeof( WinDrawData ) * MAX_DRAW_DATA ); - } // end if + } - } // end if + } - } // end else if + } else if( BitIsSet( style, GWS_COMBO_BOX ) ) { ComboBoxData *comboData = (ComboBoxData *)source->winGetUserData(); @@ -1033,7 +1033,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, &sourceInstData->m_hiliteDrawData, sizeof( WinDrawData ) * MAX_DRAW_DATA ); - } // if + } // down button GameWindow *downButton = comboData->listboxData->downButton; @@ -1055,7 +1055,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, &sourceInstData->m_hiliteDrawData, sizeof( WinDrawData ) * MAX_DRAW_DATA ); - } // if + } // slider GameWindow *slider = comboData->listboxData->slider; @@ -1097,15 +1097,15 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, &sourceInstData->m_hiliteDrawData, sizeof( WinDrawData ) * MAX_DRAW_DATA ); - } // end if + } - } // if + } - } // if + } - } // end if + } - } // end else if + } else if( BitIsSet( style, GWS_SCROLL_LISTBOX ) ) { ListboxData *listData = (ListboxData *)source->winGetUserData(); @@ -1185,7 +1185,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, &sourceInstData->m_hiliteDrawData, sizeof( WinDrawData ) * MAX_DRAW_DATA ); - } // if + } // down button GameWindow *downButton = listData->downButton; @@ -1207,7 +1207,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, &sourceInstData->m_hiliteDrawData, sizeof( WinDrawData ) * MAX_DRAW_DATA ); - } // if + } // slider GameWindow *slider = listData->slider; @@ -1249,13 +1249,13 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, &sourceInstData->m_hiliteDrawData, sizeof( WinDrawData ) * MAX_DRAW_DATA ); - } // end if + } - } // if + } - } // end if + } - } // end else if + } else if( BitIsSet( style, GWS_ENTRY_FIELD ) ) { EntryData *entryData = (EntryData *)source->winGetUserData(); @@ -1280,7 +1280,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, source->winGetFont(), FALSE ); - } // end else if + } else if( BitIsSet( style, GWS_STATIC_TEXT ) ) { TextData *textData = (TextData *)source->winGetUserData(); @@ -1300,7 +1300,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, source->winGetFont(), FALSE ); - } // end else if + } else if( BitIsSet( style, GWS_PROGRESS_BAR ) ) { @@ -1315,7 +1315,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, source->winGetFont(), FALSE ); - } // end else if + } else if( BitIsSet( style, GWS_USER_WINDOW ) ) { @@ -1329,7 +1329,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, NULL, &instDataCopy ); - } // end else if + } else { @@ -1340,7 +1340,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, memset( &instDataCopy, 0, sizeof( instDataCopy ) ); // see comment below return NULL; - } // end else + } // sanity if( duplicate == NULL ) @@ -1352,7 +1352,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, memset( &instDataCopy, 0, sizeof( instDataCopy ) ); // see comment below return NULL; - } // end if + } // // since we're using the real window system here to create things, we @@ -1376,7 +1376,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, *editData = *sourceEditData; // memcpy( editData, sourceEditData, sizeof( GameWindowEditData ) ); - } // end if + } // // duplicate all the children for the window, except if this window @@ -1391,7 +1391,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, for( child = source->winGetChild(); child; child = child->winGetNext() ) duplicateWindow( child, duplicate ); - } // end if + } // // the inst data copy was literally a copy, now it's going to go out of @@ -1403,7 +1403,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, // return the duped window return duplicate; -} // end duplicateWindow +} //------------------------------------------------------------------------------------------------- /** Create a duplicate everything on the clipboard list and put it @@ -1435,9 +1435,9 @@ void GUIEditWindowManager::createClipboardDuplicate( void ) if( duplicate ) linkToClipboard( duplicate, &m_clipboardDup ); - } // end for + } -} // end createClipboardDuplicate +} //------------------------------------------------------------------------------------------------- /** Make the 'target' a child of the 'parent' */ @@ -1473,7 +1473,7 @@ void GUIEditWindowManager::makeChildOf( GameWindow *target, target->winSetPosition( screenPos.x, screenPos.y ); return; - } // end if + } // check to see if this is already out parent, nothing to do if( prevParent == parent ) @@ -1489,7 +1489,7 @@ void GUIEditWindowManager::makeChildOf( GameWindow *target, MB_OK ); return; - } // end if + } // get the target screen position before the move to child ICoord2D screenPosBeforeMove; @@ -1528,7 +1528,7 @@ void GUIEditWindowManager::makeChildOf( GameWindow *target, // move the target TheEditor->moveWindowTo( target, safeLoc.x, safeLoc.y ); -} // end makeChildOf +} //------------------------------------------------------------------------------------------------- /** Move the 'windowToMove' to be just in front of the 'aheadOf' window @@ -1570,14 +1570,14 @@ void GUIEditWindowManager::moveAheadOf( GameWindow *windowToMove, // windowToMove->winSetPosition( pos.x, pos.y ); - } // end if + } else { // just take off the main list unlinkWindow( windowToMove ); - } // end else + } // insert the window at the specified location insertWindowAheadOf( windowToMove, aheadOf ); @@ -1613,5 +1613,5 @@ void GUIEditWindowManager::moveAheadOf( GameWindow *windowToMove, // move the target TheEditor->moveWindowTo( windowToMove, safeLoc.x, safeLoc.y ); -} // end moveAheadOf +} diff --git a/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp b/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp index 87766520c28..59dc28e3128 100644 --- a/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp @@ -107,7 +107,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, return 0; - } // end move + } // ------------------------------------------------------------------------ case WM_SIZE: @@ -141,13 +141,13 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, width - (border * 2), (height - border) - p.y, TRUE ); - } // end if + } - } // end if + } return 0; - } // end size + } // ------------------------------------------------------------------------ case WM_MOUSEMOVE: @@ -191,13 +191,13 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, else SetCursor( LoadCursor( NULL, IDC_NO ) ); - } // end if + } - } // end if + } return 0; - } // end mouse move + } // ------------------------------------------------------------------------ case WM_LBUTTONUP: @@ -270,21 +270,21 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, clearDragWindow = FALSE; TheHierarchyView->setPopupTarget( overWindow ); - } // end if + } else { // our only option is to move the window here TheGUIEditWindowManager->moveAheadOf( dragWindow, overWindow ); - } // end else + } // we've made a change now TheEditor->setUnsaved( TRUE ); - } // end if + } - } // end if + } // window has been dragged and operation complete if( clearDragWindow ) @@ -293,7 +293,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, TheHierarchyView->setDragWindow( NULL ); TheHierarchyView->setDragTarget( NULL ); - } // end if + } // release window capture ReleaseCapture(); @@ -301,11 +301,11 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, // set the cursor back to normal SetCursor( LoadCursor( NULL, IDC_ARROW ) ); - } // end if, drag in progress + } return 0; - } // end left button up + } // ------------------------------------------------------------------------ case WM_RBUTTONUP: @@ -352,11 +352,11 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, ClientToScreen( hWndDialog, &screen ); TrackPopupMenuEx( subMenu, 0, screen.x, screen.y, hWndDialog, NULL ); - } // end if + } return 0; - } // end right button up + } // ------------------------------------------------------------------------ case WM_NOTIFY: @@ -396,11 +396,11 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, if( window ) TheEditor->selectWindow( window ); - } // end if + } break; - } // end selection changed + } // ---------------------------------------------------------------- case NM_DBLCLK: @@ -436,11 +436,11 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, GetCursorPos( &screen ); TrackPopupMenuEx( subMenu, 0, screen.x, screen.y, hWndDialog, NULL ); - } // end if + } break; - } // end double click + } // ---------------------------------------------------------------- case TVN_BEGINDRAG: @@ -460,17 +460,17 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, break; - } // end begin left mouse drag + } - } // end switch + } - } // end hierarchy + } - } // end switch + } return 0; - } // end notify + } // ------------------------------------------------------------------------ case WM_COMMAND: @@ -499,7 +499,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, break; - } // end hierarchy move window in heirarchy + } // -------------------------------------------------------------------- case HIERARCHY_MAKE_CHILD_HERE: @@ -518,7 +518,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, break; - } // end hierarchy, make child of + } // -------------------------------------------------------------------- case HIERARCHY_POPUP_MOVE: @@ -545,7 +545,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, break; - } // end move + } // -------------------------------------------------------------------- case HIERARCHY_POPUP_DELETE: @@ -557,7 +557,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, break; - } // end delete + } // -------------------------------------------------------------------- case HIERARCHY_POPUP_PROPERTIES: @@ -572,11 +572,11 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, ScreenToClient( TheEditWindow->getWindowHandle(), &p ); InitPropertiesDialog( target, p.x, p.y ); - } // end if + } break; - } // end properties + } // -------------------------------------------------------------------- case IDOK: @@ -586,19 +586,19 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, case IDCANCEL: break; - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end dialogProc +} // HierarchyView::findItemEntry =============================================== /** Workhorse to find the tree item anywhere in the tree with the @@ -632,13 +632,13 @@ HTREEITEM HierarchyView::findItemEntry( HTREEITEM node, GameWindow *window ) if( found ) return found; - } // end if + } // not there, check the siblings return findItemEntry( TreeView_GetNextItem( m_tree, node, TVGN_NEXT ), window ); -} // end findItemEntry +} // HierarchyView::findTreeEntry =============================================== /** Find the game window entry in the hierarchy tree, if found the @@ -654,7 +654,7 @@ HTREEITEM HierarchyView::findTreeEntry( GameWindow *window ) // get root and search from there return findItemEntry( TreeView_GetRoot( m_tree ), window ); -} // end findTreeEntry +} // HierarchyView::addWindowToTree ============================================= /** Add a single window to the hierarchy tree */ @@ -703,9 +703,9 @@ void HierarchyView::addWindowToTree( GameWindow *window, assert( 0 ); return; - } // end if + } - } // end if, not in already + } // // add children if requested, but not on gadgets no matter what becuase @@ -718,14 +718,14 @@ void HierarchyView::addWindowToTree( GameWindow *window, for( child = window->winGetChild(); child; child = child->winGetNext() ) addWindowToTree( child, newItem, HIERARCHY_ADD_AT_BOTTOM, TRUE, TRUE ); - } // end if + } // add siblings if requested if( addSiblings ) addWindowToTree( window->winGetNext(), treeParent, option, addChildren, addSiblings ); -} // end addWindowToTree +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -745,7 +745,7 @@ HierarchyView::HierarchyView( void ) m_dragTarget = NULL; m_popupTarget = NULL; -} // end HierarchyView +} // HierarchyView::~HierarchyView ============================================== /** */ @@ -756,7 +756,7 @@ HierarchyView::~HierarchyView( void ) // call the shutdown shutdown(); -} // end ~HierarchyView +} // HierarchyView::init ========================================================= /** Create the control palette */ @@ -799,7 +799,7 @@ void HierarchyView::init( void ) // keep a handle to the tree m_tree = GetDlgItem( m_dialog, TREE_HIERARCHY ); -} // end init +} // HierarchyView::reset ======================================================= /** Reset everything about our hierarchy view */ @@ -811,7 +811,7 @@ void HierarchyView::reset( void ) HTREEITEM parentItem = TreeView_GetRoot( m_tree ); SendMessage( m_tree, TVM_EXPAND, TVE_COLLAPSERESET, (LPARAM)parentItem ); -} // end reset +} // HierarchyView::shutdown ==================================================== /** Destroy the control palette and all data associated with it */ @@ -824,7 +824,7 @@ void HierarchyView::shutdown( void ) m_dialog = NULL; m_tree = NULL; -} // end shutdown +} // HierarchyView::getWindowTreeName =========================================== /** Given a window, return a string representation for that window in @@ -880,11 +880,11 @@ char *HierarchyView::getWindowTreeName( GameWindow *window ) strcat( buffer, ": " ); strcat( buffer, instData->m_decoratedNameString.str() ); - } // end if + } return buffer; -} // end getWindowTreeName +} // HierarchyView::addWindow =================================================== /** Add a window to the hierarchy view AND any of it's children */ @@ -913,7 +913,7 @@ void HierarchyView::addWindow( GameWindow *window, HierarchyOption option ) // InvalidateRect( m_tree, NULL, TRUE ); -} // end addWindow +} // HierarchyView::removeWindow ================================================ /** Remove the window from the hierarchy tree view */ @@ -948,7 +948,7 @@ void HierarchyView::removeWindow( GameWindow *window ) // remove it from the tree TreeView_DeleteItem( m_tree, item ); -} // end removeWindow +} // HierarchyView::bringWindowToTop ============================================ /** Bring the window to the top of its parent list in the hierarchy @@ -970,7 +970,7 @@ void HierarchyView::bringWindowToTop( GameWindow *window ) assert( 0 ); return; - } // end if + } // remove the entry from the tree removeWindow( window ); @@ -981,7 +981,7 @@ void HierarchyView::bringWindowToTop( GameWindow *window ) // add the window as a child of the parent entry at the top of it's list addWindowToTree( window, itemParent, HIERARCHY_ADD_AT_TOP, TRUE, FALSE ); -} // end bringWindowToTop +} // HierarchyView::updateWindowName ============================================ /** A window name may have been updated, reconstruct its hierarchy @@ -1003,7 +1003,7 @@ void HierarchyView::updateWindowName( GameWindow *window ) assert( 0 ); return; - } // end if + } // setup the item to modify in the tree TVITEM modify; @@ -1014,7 +1014,7 @@ void HierarchyView::updateWindowName( GameWindow *window ) // modify the item TreeView_SetItem( m_tree, &modify ); -} // end updateWindowName +} // HierarchyView::getDialogPos ================================================ /** Get the dialog position as recorded from the static */ @@ -1028,7 +1028,7 @@ void HierarchyView::getDialogPos( ICoord2D *pos ) *pos = dialogPos; -} // end getDialogPos +} // HierarchyView::getDialogSize =============================================== /** Get the dialog size as recorded from the static */ @@ -1042,7 +1042,7 @@ void HierarchyView::getDialogSize( ICoord2D *size ) *size = dialogSize; -} // end getDialogSize +} // HierarchyView::setDialogPos ================================================ /** */ @@ -1057,7 +1057,7 @@ void HierarchyView::setDialogPos( ICoord2D *pos ) MoveWindow( m_dialog, dialogPos.x, dialogPos.y, dialogSize.x, dialogSize.y, TRUE ); -} // end setDialogPos +} // HierarchyView::setDialogSize =============================================== /** */ @@ -1072,7 +1072,7 @@ void HierarchyView::setDialogSize( ICoord2D *size ) MoveWindow( m_dialog, dialogPos.x, dialogPos.y, dialogSize.x, dialogSize.y, TRUE ); -} // end setDialogSize +} // HierarchyView::moveWindowAheadOf =========================================== /** Move the window hierarchy representation to be just ahead of the @@ -1096,7 +1096,7 @@ void HierarchyView::moveWindowAheadOf( GameWindow *window, addWindow( window, HIERARCHY_ADD_AT_TOP ); return; - } // end if + } // get the hierarchy item of the aheadOf window HTREEITEM aheadOfItem = findTreeEntry( aheadOf ); @@ -1107,7 +1107,7 @@ void HierarchyView::moveWindowAheadOf( GameWindow *window, assert( 0 ); return; - } // end iof + } // // get the parent item we will be inserting the new entry at, a parent @@ -1143,7 +1143,7 @@ void HierarchyView::moveWindowAheadOf( GameWindow *window, assert( 0 ); return; - } // end if + } // // add ALL the children of this window as well, do not worry about @@ -1155,9 +1155,9 @@ void HierarchyView::moveWindowAheadOf( GameWindow *window, addWindowToTree( child, newItem, HIERARCHY_ADD_AT_BOTTOM, TRUE, TRUE ); - } // end if + } -} // end moveWindowAheadOf +} // HierarchyView::moveWindowChildOf =========================================== /** Move the hierarchy entry for window so that it is now the first @@ -1180,7 +1180,7 @@ void HierarchyView::moveWindowChildOf( GameWindow *window, GameWindow *parent ) addWindow( window, HIERARCHY_ADD_AT_TOP ); return; - } // end if + } // find the entry of the parent HTREEITEM parentItem = findTreeEntry( parent ); @@ -1191,13 +1191,13 @@ void HierarchyView::moveWindowChildOf( GameWindow *window, GameWindow *parent ) assert( 0 ); return; - } // end if + } // add the window as child of the parent at the top, dont forget to // also add the children of the window too! addWindowToTree( window, parentItem, HIERARCHY_ADD_AT_TOP, TRUE, FALSE ); -} // end moveWindowChildOf +} // HierarchyView::treePointToItem ============================================= /** Given the location (x,y) in TREE COORDINATES, correlate that to @@ -1214,7 +1214,7 @@ HTREEITEM HierarchyView::treePointToItem( Int x, Int y ) hitTest.flags = TVHT_ONITEM; return TreeView_HitTest( TheHierarchyView->getTreeHandle(), &hitTest ); -} // end treePointToItem +} // HierarchyView::getWindowFromItem =========================================== /** Get the game window we stored as the user data lParam in the tree @@ -1240,7 +1240,7 @@ GameWindow *HierarchyView::getWindowFromItem( HTREEITEM treeItem ) return window; -} // end getWindowFromItem +} // HierarchyView::selectWindow ================================================ /** Select the tree item */ @@ -1257,7 +1257,7 @@ void HierarchyView::selectWindow( GameWindow *window ) TreeView_SelectItem( m_tree, item ); TreeView_Expand( m_tree, item, 0 ); -} // end selectWindow +} // HierarchyView::validateDragDropOperation =================================== /** Return TRUE if the drag drop operation of source onto target @@ -1281,12 +1281,12 @@ Bool HierarchyView::validateDragDropOperation( GameWindow *source, return FALSE; other = other->winGetParent(); - } // end while + } // everything is ok return TRUE; -} // end validateDragDropOperation +} diff --git a/Generals/Code/Tools/GUIEdit/Source/LayoutScheme.cpp b/Generals/Code/Tools/GUIEdit/Source/LayoutScheme.cpp index 6bab1fee542..5ea70e94051 100644 --- a/Generals/Code/Tools/GUIEdit/Source/LayoutScheme.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/LayoutScheme.cpp @@ -137,7 +137,7 @@ static void loadSchemeDataToDialog( HWND hWndDialog ) info->color, info->borderColor ); - } // end for i + } // switch to the generic state SwitchToState( GENERIC_ENABLED, hWndDialog ); @@ -156,7 +156,7 @@ static void loadSchemeDataToDialog( HWND hWndDialog ) SendDlgItemMessage( hWndDialog, COMBO_FONT, CB_RESETCONTENT, 0, 0 ); LoadFontCombo( GetDlgItem( hWndDialog, COMBO_FONT ), theScheme->getFont() ); -} // end loadSchemeDataToDialog +} // saveData =================================================================== //============================================================================= @@ -179,7 +179,7 @@ static void saveData( HWND hWndDialog ) info->color, info->borderColor ); - } // end for i + } // save default text colors theScheme->setEnabledTextColor( GetPropsEnabledTextColor() ); @@ -192,7 +192,7 @@ static void saveData( HWND hWndDialog ) // save the font theScheme->setFont( GetSelectedFontFromCombo( GetDlgItem( hWndDialog, COMBO_FONT ) ) ); -} // end saveData +} // saveAsDialog =============================================================== /** Bring up the standard windows browser save as dialog and return @@ -234,7 +234,7 @@ char *saveAsDialog( void ) else return NULL; -} // end saveAsDialog +} // openDialog ================================================================= /** Bring up the standard windows browser open dialog and return @@ -276,7 +276,7 @@ char *openDialog( void ) else return NULL; -} // end openDialog +} // layoutSchemeCallback ======================================================= /** Dialog callback for layout scheme dialog */ @@ -307,7 +307,7 @@ static LRESULT CALLBACK layoutSchemeCallback( HWND hWndDialog, loadSchemeDataToDialog( hWndDialog ); break; - } // end init dialog + } // ------------------------------------------------------------------------ case WM_COMMAND: @@ -355,7 +355,7 @@ static LRESULT CALLBACK layoutSchemeCallback( HWND hWndDialog, break; - } // end apply scheme + } // -------------------------------------------------------------------- case BUTTON_SAVE: @@ -370,11 +370,11 @@ static LRESULT CALLBACK layoutSchemeCallback( HWND hWndDialog, SetDlgItemText( hWndDialog, STATIC_CURRENT_SCHEME, theScheme->getSchemeFilename() ); - } // end if + } break; - } // end save + } // -------------------------------------------------------------------- case BUTTON_LOAD: @@ -391,20 +391,20 @@ static LRESULT CALLBACK layoutSchemeCallback( HWND hWndDialog, // load the dialog engine and items with the current data of the scheme loadSchemeDataToDialog( hWndDialog ); - } // end if + } else { MessageBox( TheEditor->getWindowHandle(), "Unable to open scheme file.", "Error", MB_OK ); - } // end else + } - } // end if + } break; - } // end load + } // -------------------------------------------------------------------- case IDOK: @@ -421,17 +421,17 @@ static LRESULT CALLBACK layoutSchemeCallback( HWND hWndDialog, EndDialog( hWndDialog, FALSE ); break; - } // end switch + } break; - } // end command + } - } // end switch, message + } return 0; -} // end layoutSchemeCallback +} // LayoutScheme::applyPropertyTablesToWindow ================================== /** apply the image and color info stored in the state identifer tables @@ -478,7 +478,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetButtonSetHiliteSelectedColor( root, info->color ); GadgetButtonSetHiliteSelectedBorderColor( root, info->borderColor ); - } // end if + } else if( BitIsSet( root->winGetStyle(), GWS_RADIO_BUTTON ) ) { @@ -521,7 +521,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetRadioSetHiliteCheckedBoxColor( root, info->color ); GadgetRadioSetHiliteCheckedBoxBorderColor( root, info->borderColor ); - } // end else if + } else if( BitIsSet( root->winGetStyle(), GWS_CHECK_BOX ) ) { @@ -564,7 +564,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetCheckBoxSetHiliteCheckedBoxColor( root, info->color ); GadgetCheckBoxSetHiliteCheckedBoxBorderColor( root, info->borderColor ); - } // end else if + } else if( BitIsSet( root->winGetStyle(), GWS_VERT_SLIDER ) ) { @@ -628,7 +628,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetSliderSetHiliteSelectedThumbColor( root, info->color ); GadgetSliderSetHiliteSelectedThumbBorderColor( root, info->borderColor ); - } // end else if + } else if( BitIsSet( root->winGetStyle(), GWS_HORZ_SLIDER ) ) { @@ -692,7 +692,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetSliderSetHiliteSelectedThumbColor( root, info->color ); GadgetSliderSetHiliteSelectedThumbBorderColor( root, info->borderColor ); - } // end else if + } else if( BitIsSet( root->winGetStyle(), GWS_SCROLL_LISTBOX ) ) { @@ -772,7 +772,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetButtonSetHiliteSelectedColor( upButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( upButton, info->borderColor ); - } // end if + } GameWindow *downButton = GadgetListBoxGetDownButton( root ); if( downButton ) @@ -805,7 +805,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetButtonSetHiliteSelectedColor( downButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( downButton, info->borderColor ); - } // end if + } GameWindow *slider = GadgetListBoxGetSlider( root ); if( slider ) @@ -871,9 +871,9 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetSliderSetHiliteSelectedThumbColor( slider, info->color ); GadgetSliderSetHiliteSelectedThumbBorderColor( slider, info->borderColor ); - } // end if + } - } // end else if + } else if( BitIsSet( root->winGetStyle(), GWS_COMBO_BOX ) ) { info = GetStateInfo( COMBOBOX_ENABLED ); @@ -950,7 +950,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetButtonSetHiliteSelectedImage( dropDownButton, info->image ); GadgetButtonSetHiliteSelectedColor( dropDownButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( dropDownButton, info->borderColor ); - }// end if + } GameWindow *editBox = GadgetComboBoxGetEditBox( root ); if ( editBox ) @@ -987,7 +987,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetTextEntrySetHiliteImageCenter( editBox, info->image ); info = GetStateInfo( COMBOBOX_EDIT_BOX_HILITE_SMALL_CENTER ); GadgetTextEntrySetHiliteImageSmallCenter( editBox, info->image ); - } // end if + } GameWindow *listBox = GadgetComboBoxGetListBox( root ); if( listBox ) @@ -1068,7 +1068,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetButtonSetHiliteSelectedColor( upButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( upButton, info->borderColor ); - } // end if + } GameWindow *downButton = GadgetListBoxGetDownButton( listBox ); if( downButton ) @@ -1101,7 +1101,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetButtonSetHiliteSelectedColor( downButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( downButton, info->borderColor ); - } // end if + } GameWindow *slider = GadgetListBoxGetSlider( listBox ); if( slider ) @@ -1167,9 +1167,9 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetSliderSetHiliteSelectedThumbColor( slider, info->color ); GadgetSliderSetHiliteSelectedThumbBorderColor( slider, info->borderColor ); - } // end if - }// end if (combo listbox) - }// end if + } + } + } else if( BitIsSet( root->winGetStyle(), GWS_ENTRY_FIELD ) ) { @@ -1206,7 +1206,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) info = GetStateInfo( TEXT_ENTRY_HILITE_SMALL_CENTER ); GadgetTextEntrySetHiliteImageSmallCenter( root, info->image ); - } // end else if + } else if( BitIsSet( root->winGetStyle(), GWS_STATIC_TEXT ) ) { @@ -1225,7 +1225,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetStaticTextSetHiliteColor( root, info->color ); GadgetStaticTextSetHiliteBorderColor( root, info->borderColor ); - } // end else if + } else if( BitIsSet( root->winGetStyle(), GWS_PROGRESS_BAR ) ) { @@ -1292,7 +1292,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) info = GetStateInfo( PROGRESS_BAR_HILITE_BAR_SMALL_CENTER ); GadgetProgressBarSetHiliteBarImageSmallCenter( root, info->image ); - } // end else if + } else if( BitIsSet( root->winGetStyle(), GWS_TAB_CONTROL ) ) { info = GetStateInfo( TC_TAB_0_ENABLED ); @@ -1454,7 +1454,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) root->winSetHiliteColor( 0, info->color ); root->winSetHiliteBorderColor( 0, info->borderColor ); - } // end else + } // // apply changes to children of this window, unless this @@ -1469,7 +1469,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) // force an update of the edit window TheEditWindow->draw(); -} // end applyPropertyTablesToWindow +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -1491,7 +1491,7 @@ LayoutScheme::LayoutScheme( void ) m_hiliteText.borderColor = GAME_COLOR_UNDEFINED; m_font = NULL; -} // end LayoutScheme +} // LayoutScheme::~LayoutScheme ================================================ /** */ @@ -1511,11 +1511,11 @@ LayoutScheme::~LayoutScheme( void ) m_imageAndColorTable[ i ].stateNameBuffer = NULL; m_imageAndColorTable[ i ].stateName = NULL; - } // end if + } - } // end for i + } -} // end ~LayoutScheme +} // LayoutScheme::init ========================================================= /** Init */ @@ -1541,7 +1541,7 @@ void LayoutScheme::init( void ) m_imageAndColorTable[ i ].stateName = m_imageAndColorTable[ i ].stateNameBuffer; strcpy(m_imageAndColorTable[ i ].stateNameBuffer, info->stateName ); - } // end for i + } // assign a default set of colors UnsignedByte alpha = 255; @@ -2149,7 +2149,7 @@ void LayoutScheme::init( void ) // default font m_font = TheWindowManager->winFindFont( AsciiString("Times New Roman"), 14, FALSE ); -} // end init +} // LayoutScheme::openDialog =================================================== /** Bring up the layout scheme dialog box */ @@ -2166,7 +2166,7 @@ void LayoutScheme::openDialog( void ) theScheme = NULL; -} // end openDialog +} // LayoutScheme::findEntry ==================================================== /** Find the entry for the state */ @@ -2182,7 +2182,7 @@ ImageAndColorInfo *LayoutScheme::findEntry( StateIdentifier id ) assert( 0 ); return NULL; - } // end if + } // search the state table for( Int i = 0; i < NUM_STATE_IDENTIFIERS; i++ ) @@ -2191,11 +2191,11 @@ ImageAndColorInfo *LayoutScheme::findEntry( StateIdentifier id ) if( m_imageAndColorTable[ i ].stateID == id ) return &m_imageAndColorTable[ i ]; - } // end for i + } return NULL; // not found -} // end findEntry +} // LayoutScheme::getImageAndColor ============================================= /** Get the color and color info for the state */ @@ -2211,12 +2211,12 @@ ImageAndColorInfo *LayoutScheme::getImageAndColor( StateIdentifier id ) assert( 0 ); return NULL; - } // end if + } // return the entry for the state return findEntry( id ); -} // end getImageAndColor +} // LayoutScheme::storeImageAndColor =========================================== /** Store the image and colors of the specific state in our own data array */ @@ -2233,7 +2233,7 @@ void LayoutScheme::storeImageAndColor( StateIdentifier id, const Image *image, assert( 0 ); return; - } // end if + } // store the info ImageAndColorInfo *entry = findEntry( id ); @@ -2244,9 +2244,9 @@ void LayoutScheme::storeImageAndColor( StateIdentifier id, const Image *image, entry->color = color; entry->borderColor = borderColor; - } // en dif + } -} // end storeImageAndColor +} // LayoutScheme::saveScheme =================================================== /** Save the scheme to the filename provided */ @@ -2267,7 +2267,7 @@ Bool LayoutScheme::saveScheme( char *filename ) "Unable to open scheme for for saving. Read only?", "Save Error", MB_OK ); return FALSE; - } // end if + } // save the filename we're using now setSchemeFilename( filename ); @@ -2321,14 +2321,14 @@ Bool LayoutScheme::saveScheme( char *filename ) i, info->image ? info->image->getName().str() : "NONE", colorR, colorG, colorB, colorA, bColorR, bColorG, bColorB, bColorA ); - } // end for i + } // close the file fclose( fp ); return TRUE; -} // end saveScheme +} // LayoutScheme::loadScheme =================================================== /** Load the layout scheme into this class instance */ @@ -2359,7 +2359,7 @@ Bool LayoutScheme::loadScheme( char *filename ) "Old layout version, cannot open.", "Old File", MB_OK ); return FALSE; - } // end if + } } // default text colors if (fscanf( fp, "Enabled Text: (%hhu,%hhu,%hhu,%hhu)\n", &colorR, &colorG, &colorB, &colorA ) == 4) @@ -2405,7 +2405,7 @@ Bool LayoutScheme::loadScheme( char *filename ) fontBuffer[ index++ ] = c; c = fgetc( fp ); - } // end while + } fontBuffer[ index ] = '\0'; c = fgetc( fp ); // the end quite itself @@ -2438,12 +2438,12 @@ Bool LayoutScheme::loadScheme( char *filename ) GameMakeColor( colorR, colorG, colorB, colorA ), GameMakeColor( bColorR, bColorG, bColorB, bColorA ) ); } - } // end for i + } } // close the file fclose( fp ); return TRUE; -} // end loadScheme +} diff --git a/Generals/Code/Tools/GUIEdit/Source/Properties.cpp b/Generals/Code/Tools/GUIEdit/Source/Properties.cpp index eabea38f4e4..734dc780ca0 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Properties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Properties.cpp @@ -437,7 +437,7 @@ void InitPropertiesDialog( GameWindow *window, Int x, Int y ) assert( 0 ); return; - } // end if + } // save the window we're working with TheEditor->setPropertyTarget( window ); @@ -448,7 +448,7 @@ void InitPropertiesDialog( GameWindow *window, Int x, Int y ) // PositionWindowOnScreen( dialog, screen.x, screen.y ); -} // end InitPropertiesDialog +} // LoadFontCombo ============================================================== /** Load the font combo with fonts currently available */ @@ -486,7 +486,7 @@ void LoadFontCombo( HWND comboBox, GameFont *currFont ) // attach pointer to font at combo index SendMessage( comboBox, CB_SETITEMDATA, index, (DWORD)font ); - } // end for font + } // add a "[None]" at the top index SendMessage( comboBox, CB_INSERTSTRING, 0, (LPARAM)"[None]" ); @@ -497,7 +497,7 @@ void LoadFontCombo( HWND comboBox, GameFont *currFont ) SendMessage( comboBox, CB_SETCURSEL, 0, 0 ); - } // end if + } else { Int count; @@ -518,13 +518,13 @@ void LoadFontCombo( HWND comboBox, GameFont *currFont ) SendMessage( comboBox, CB_SETCURSEL, i, 0 ); break; // exit for i - } // end if + } - } // end for i + } - } // end else + } -} // end LoadFontCombo +} // GetSelectedFontFromCombo =================================================== /** Based on the combo box selection return the game font associated @@ -548,7 +548,7 @@ GameFont *GetSelectedFontFromCombo( HWND combo ) // get the font from the selected item return (GameFont *)SendMessage( combo, CB_GETITEMDATA, selected, 0 ); -} // end GetSelectedFontFromCombo +} // saveFontSelection ========================================================== /** Save the font from the currently selected item in the font dialog */ @@ -565,7 +565,7 @@ static void saveFontSelection( HWND combo, GameWindow *window ) font = GetSelectedFontFromCombo( combo ); window->winSetFont( font ); -} // end saveFontSelection +} // saveHeaderSelection ======================================================== /** Save the Header from the currently selected item in the font dialog */ @@ -592,7 +592,7 @@ static void saveHeaderSelection( HWND comboBox, GameWindow *window ) // return the image loc that matches the string window->winGetInstanceData()->m_headerTemplateName.set(buffer); -} // end ComboBoxSelectionToImage +} // loadTooltipTextLabel ============================================================== /** Load the edit control with the window text label */ @@ -611,7 +611,7 @@ static void loadTooltipTextLabel( HWND edit, GameWindow *window ) WinInstanceData *instData = window->winGetInstanceData(); SendMessage( edit, WM_SETTEXT, 0, (LPARAM)instData->m_tooltipString.str() ); -} // end loadTooltipTextLabel +} // loadTooltipDelayTextLabel ============================================================== /** Load the edit control with the window text label */ @@ -630,7 +630,7 @@ static void loadTooltipDelayTextLabel( HWND dialog, HWND edit, GameWindow *windo // WinInstanceData *instData = window->winGetInstanceData(); // SetDlgItemInt( dialog, edit, instData->m_tooltipDelay, TRUE ); -} // end loadTooltipDelayTextLabel +} // saveTooltipTextLabel ============================================================== /** Save the text label entry */ @@ -649,7 +649,7 @@ static void saveTooltipTextLabel( HWND edit, GameWindow *window ) instData->m_tooltipString.set(buffer); instData->setTooltipText(TheGameText->fetch(buffer) ); -} // end saveTooltipTextLabel +} // saveTooltipTextLabel ============================================================== /** Save the text label entry */ @@ -664,7 +664,7 @@ static void saveTooltipDelayTextLabel(HWND dialog, HWND edit, GameWindow *window // instData->m_tooltipDelay = GetDlgItemInt( dialog, edit, NULL, TRUE ); -} // end saveTooltipDelayTextLabel +} // loadTextLabel ============================================================== @@ -683,7 +683,7 @@ static void loadTextLabel( HWND edit, GameWindow *window ) // load the text WinInstanceData *instData = window->winGetInstanceData(); SendMessage( edit, WM_SETTEXT, 0, (LPARAM)instData->m_textLabelString.str() ); -} // end loadTextLabel +} // saveTextLabel ============================================================== /** Save the text label entry */ @@ -722,7 +722,7 @@ static void saveTextLabel( HWND edit, GameWindow *window ) else window->winSetText( text ); -} // end saveTextLavel +} // LoadTextStateCombo ========================================================= /** Load the text state combo */ @@ -756,7 +756,7 @@ void LoadTextStateCombo( HWND comboBox, currTextIndex = 0; SendMessage( comboBox, CB_SETCURSEL, currTextIndex, 0 ); -} // end LoadTextStateCombo +} // LoadStateCombo ============================================================= /** Load the state combo box passed in based on the window type @@ -786,11 +786,11 @@ void LoadStateCombo( UnsignedInt style, HWND comboBox ) // set the state identifier as the item data of this entry SendMessage( comboBox, CB_SETITEMDATA, index, entry->stateID ); - } // end if + } - } // end for entry + } -} // end LoadStateCombo +} // CommonDialogInitialize ===================================================== /** Called from all dialog initializations */ @@ -885,7 +885,7 @@ void CommonDialogInitialize( GameWindow *window, HWND dialog ) -} // end CommonDialogInitialize +} // validateName =============================================================== /** Validate a name before saving it into a window. All window names @@ -907,7 +907,7 @@ static Bool validateName( GameWindow *root, GameWindow *exception, char *name ) MessageBox( TheEditor->getWindowHandle(), buffer, "Illegal Character", MB_OK ); return FALSE; - } // end if + } // if this root window is not the exception window compare name if( root != exception ) @@ -922,10 +922,10 @@ static Bool validateName( GameWindow *root, GameWindow *exception, char *name ) MessageBox( TheEditor->getWindowHandle(), buffer, "Duplicate Name", MB_OK ); return FALSE; - } // end if + } - } // end if + } // check our children GameWindow *child; @@ -936,7 +936,7 @@ static Bool validateName( GameWindow *root, GameWindow *exception, char *name ) // check the next window in the list return validateName( root->winGetNext(), exception, name ); -} // end validateName +} // adjustGadgetDrawMethods ==================================================== /** Based on the WIN_STATUS_IMAGE, set the draw callbacks to the @@ -987,12 +987,12 @@ static void adjustGadgetDrawMethods( Bool useImages, GameWindow *window ) assert( 0 ); return; - } // end else + } // set the image status bit window->winSetStatus( WIN_STATUS_IMAGE ); - } // end if, image set + } else { @@ -1025,20 +1025,20 @@ static void adjustGadgetDrawMethods( Bool useImages, GameWindow *window ) assert( 0 ); return; - } // end else + } // clear the image bit window->winClearStatus( WIN_STATUS_IMAGE ); - } // end else, image not set - }//end if window is gadget + } + } // adjust any child gadgets GameWindow *child; for( child = window->winGetChild(); child; child = child->winGetNext() ) adjustGadgetDrawMethods( useImages, child ); -} // end adjustGadgetDrawMethods +} // SaveCommonDialogProperties ================================================= /** Save properties common on all dialogs for all windows */ @@ -1159,7 +1159,7 @@ Bool SaveCommonDialogProperties( HWND dialog, GameWindow *window ) return TRUE; -} // end SaveCommonDialogProperties +} // LoadImageListComboBox ====================================================== /** Load a combo box with image names from the GUI image collection @@ -1184,7 +1184,7 @@ void LoadImageListComboBox( HWND comboBox ) SendMessage( comboBox, CB_ADDSTRING, 0, (LPARAM)image->getName().str() ); - } // end for image + } // add a [NONE] at the top of the image lists SendMessage( comboBox, CB_INSERTSTRING, 0, (LPARAM)"[NONE]" ); @@ -1192,7 +1192,7 @@ void LoadImageListComboBox( HWND comboBox ) // select the [NONE] label SendMessage( comboBox, CB_SETCURSEL, 0, 0 ); -} // end LoadImageListComboBox +} // LoadHeaderTemplateListComboBox ============================================= /** Load a combo box with header template names @@ -1217,7 +1217,7 @@ void LoadHeaderTemplateListComboBox( HWND comboBox, AsciiString selected ) SendMessage( comboBox, CB_ADDSTRING, 0, (LPARAM)ht->m_name.str()); - } // end for image + } // add a [NONE] at the top of the image lists SendMessage( comboBox, CB_INSERTSTRING, 0, (LPARAM)"[NONE]" ); @@ -1229,7 +1229,7 @@ void LoadHeaderTemplateListComboBox( HWND comboBox, AsciiString selected ) SendMessage( comboBox, CB_SELECTSTRING, -1, (LPARAM)selected.str() ); -} // end LoadHeaderTemplateListComboBox +} // ComboBoxSelectionToImage =================================================== @@ -1263,7 +1263,7 @@ const Image *ComboBoxSelectionToImage( HWND comboBox ) // return the image loc that matches the string return TheMappedImageCollection->findImageByName( AsciiString( buffer ) ); -} // end ComboBoxSelectionToImage +} // GetControlColor ============================================================ /** Search the control color table and return the color for the @@ -1279,12 +1279,12 @@ RGBColorInt *GetControlColor( UnsignedInt controlID ) if( entry->controlID == controlID ) return &entry->color; - } // end for + } // not found return NULL; -} // end GetControlColor +} // SetControlColor ============================================================ /** Set the color in the table with the matching control ID */ @@ -1309,11 +1309,11 @@ void SetControlColor( UnsignedInt controlID, Color color ) entry->color.blue = blue; break; - } // end if + } - } // end for + } -} // end SetControlColor +} // GetStateInfo =============================================================== /** Get a image and color state entry */ @@ -1328,11 +1328,11 @@ ImageAndColorInfo *GetStateInfo( StateIdentifier id ) if( entry->stateID == id ) return entry; - } // end for entry + } return NULL; -} // end GetStateInfo +} // SwitchToState ============================================================== /** Switch the image and color combo box to specified state, invalidate @@ -1355,7 +1355,7 @@ void SwitchToState( StateIdentifier id, HWND dialog ) assert( 0 ); return; - } // end if + } // select the string in the state combo box SendMessage( stateBox, CB_SELECTSTRING, -1, (LPARAM)info->stateName ); @@ -1373,7 +1373,7 @@ void SwitchToState( StateIdentifier id, HWND dialog ) InvalidateRect( colorButton, NULL, TRUE ); InvalidateRect( borderColorButton, NULL, TRUE ); -} // end SwitchToState +} // StoreImageAndColor ========================================================= /** Store the image and colors in the table */ @@ -1394,11 +1394,11 @@ void StoreImageAndColor( StateIdentifier id, const Image *image, entry->borderColor = borderColor; break; // exit for - } // end if + } - } // end for + } -} // end StoreImageAndColor +} // StoreColor ================================================================= /** Store the colors in the table */ @@ -1417,11 +1417,11 @@ void StoreColor( StateIdentifier id, Color color, Color borderColor ) entry->borderColor = borderColor; break; // exit for - } // end if + } - } // end for + } -} // end StoreColor +} // GetCurrentStateInfo ======================================================== /** Get the info on the current state selected in the state combo */ @@ -1442,7 +1442,7 @@ ImageAndColorInfo *GetCurrentStateInfo( HWND dialog ) return GetStateInfo( stateID ); -} // end GetCurrentStateInfo +} // PositionWindowOnScreen ===================================================== /** Position the window on the screen, but keep the window completely @@ -1482,7 +1482,7 @@ void PositionWindowOnScreen( HWND window, Int x, Int y ) // show the window ShowWindow( window, SW_SHOW ); -} // end PositionWindowOnScreen +} // HandleCommonDialogMessages ================================================= /** Handle any messages common to all controls on all property dialogs */ @@ -1515,7 +1515,7 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, else color = info->borderColor; - } // end if + } else if( controlID == BUTTON_TEXT_COLOR || controlID == BUTTON_TEXT_BORDER_COLOR ) { TextDrawData textDraw = textDrawData[ currTextIndex ]; @@ -1525,7 +1525,7 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, else color = textDraw.borderColor; - } // end else if + } if( color != GAME_COLOR_UNDEFINED ) { @@ -1541,7 +1541,7 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, *returnCode = FALSE; break; - } // end if + } // get the color info GameGetColorComponents( color, &r, &g, &b, &a ); @@ -1568,12 +1568,12 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, used = TRUE; break; - } // end if + } *returnCode = FALSE; break; - } // end draw item + } // ------------------------------------------------------------------------ case WM_COMMAND: @@ -1600,11 +1600,11 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, newState = (StateIdentifier)SendMessage( hWndControl, CB_GETITEMDATA, selected, 0 ); SwitchToState( newState, hWndDialog ); - } // end if + } used = TRUE; break; - } // end state + } // -------------------------------------------------------------------- case COMBO_TEXT_STATE: @@ -1621,11 +1621,11 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, InvalidateRect( GetDlgItem( hWndDialog, BUTTON_TEXT_COLOR ), NULL, TRUE ); InvalidateRect( GetDlgItem( hWndDialog, BUTTON_TEXT_BORDER_COLOR ), NULL, TRUE ); - } // end if + } used = TRUE; break; - } // end text state + } // -------------------------------------------------------------------- case COMBO_IMAGE: @@ -1640,12 +1640,12 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, StoreImageAndColor( info->stateID, newImage, info->color, info->borderColor ); - } // end if + } used = TRUE; break; - } // end image + } // -------------------------------------------------------------------- case BUTTON_COLOR: @@ -1700,25 +1700,25 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, // invalidate the color preview InvalidateRect( hWndControl, NULL, TRUE ); - } // end if + } used = TRUE; break; - } // end color buttons + } - } // end switch( LOWORD( wParam ) ) + } *returnCode = 0; break; - } // end of WM_COMMAND + } - } // end of switch + } return used; -} // end HandleCommonDialogMessages +} // GetProprsEnabledTextColor ================================================== //============================================================================= diff --git a/Generals/Code/Tools/GUIEdit/Source/Save.cpp b/Generals/Code/Tools/GUIEdit/Source/Save.cpp index 77b2db4a575..ea99537a36d 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Save.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Save.cpp @@ -88,7 +88,7 @@ static void fileNewLine( FILE *fp ) fprintf( fp, "\n" ); fflush( fp ); -} // end fileNewLine +} // writeBufferToFile ========================================================== /** Write the contents of the buffer to the file */ @@ -106,7 +106,7 @@ static void writeBufferToFile( FILE *fp, char *buffer ) // fflush( fp ); -} // end writeBufferToFile +} // clearBufferToSpaces ======================================================== /** Clear the buffer to all spaces */ @@ -118,7 +118,7 @@ static void clearBufferToSpaces( void ) for( i = 0; i < BUFFER_SIZE; i++ ) buffer[ i ] = ' '; -} // end clearBufferToSpaces +} // saveType =================================================================== /** Save type of window */ @@ -159,7 +159,7 @@ static Bool saveType( GameWindow *window, FILE *fp, Int dataIndent ) return TRUE; -} // end saveType +} // savePosition =============================================================== /** Save window position data */ @@ -192,7 +192,7 @@ static Bool savePosition( GameWindow *window, FILE *fp, Int dataIndent ) return TRUE; -} // end savePosition +} // saveName =================================================================== // Save name */ @@ -207,7 +207,7 @@ static Bool saveName( GameWindow *window, FILE *fp, Int dataIndent ) return TRUE; -} // end saveName +} // saveStatus ================================================================= /** Save status information */ @@ -236,10 +236,10 @@ static Bool saveStatus( GameWindow *window, FILE *fp, Int dataIndent ) strcat( buffer, WindowStatusNames[ i ] ); bitWritten = TRUE; - } // end + } i++; - } // end while + } // if no bits written write NONE in the file if( bitWritten == FALSE ) @@ -251,7 +251,7 @@ static Bool saveStatus( GameWindow *window, FILE *fp, Int dataIndent ) return TRUE; -} // end saveStatus +} // saveStyle ================================================================== /** Save style information */ @@ -280,10 +280,10 @@ static Bool saveStyle( GameWindow *window, FILE *fp, Int dataIndent ) strcat( buffer, WindowStyleNames[ i ] ); bitWritten = TRUE; - } // end + } i++; - } // end while + } // if no bits written write NONE in the file if( bitWritten == FALSE ) @@ -295,7 +295,7 @@ static Bool saveStyle( GameWindow *window, FILE *fp, Int dataIndent ) return TRUE; -} // end saveStyle +} // saveCallbacks ============================================================== /** Save string representations of the window function callbacks into @@ -341,7 +341,7 @@ static Bool saveCallbacks( GameWindow *window, FILE *fp, Int dataIndent ) return TRUE; -} // end saveCallbacks +} // saveHeaderTemplate ========================================================= /** Save HeaderTemplate for a window */ @@ -376,7 +376,7 @@ static Bool saveFont( GameWindow *window, FILE *fp, Int dataIndent ) return TRUE; -} // end saveFont +} // saveTooltipText =================================================================== /** Save the text for a window */ @@ -391,11 +391,11 @@ static Bool saveTooltipText( GameWindow *window, FILE *fp, Int dataIndent ) sprintf( &buffer[ dataIndent ], "TOOLTIPTEXT = \"%s\";\n", instData->m_tooltipString.str() ); writeBufferToFile( fp, buffer ); - } // end if + } return TRUE; -} // end saveTooltipText +} // saveTooltipDelay =================================================================== /** Save the delay for a window */ @@ -414,7 +414,7 @@ static Bool saveTooltipDelay( GameWindow *window, FILE *fp, Int dataIndent ) return TRUE; -} // end saveTooltipText +} // saveText =================================================================== /** Save the text for a window */ @@ -430,11 +430,11 @@ static Bool saveText( GameWindow *window, FILE *fp, Int dataIndent ) sprintf( &buffer[ dataIndent ], "TEXT = \"%s\";\n", instData->m_textLabelString.str() ); writeBufferToFile( fp, buffer ); - } // end if + } return TRUE; -} // end saveText +} // saveTextColor ============================================================== /** Save the text colors for enabled, disable, and hilite with @@ -477,11 +477,11 @@ static Bool saveTextColor( GameWindow *window, FILE *fp, Int dataIndent ) r, g, b, a, br, bg, bb, ba ); writeBufferToFile( fp, buffer ); - } // end for i + } return TRUE; -} // end saveTextColor +} // tokenIsEnabledData ========================================================= /** Token refers to enabled draw data */ @@ -502,7 +502,7 @@ static Bool tokenIsEnabledData( const char *token ) return FALSE; -} // end tokenIsEnabledData +} // tokenIsDisabledData ======================================================== /** Token refers to Disabled draw data */ @@ -522,7 +522,7 @@ static Bool tokenIsDisabledData( const char *token ) return FALSE; -} // end tokenIsDisabledData +} // tokenIsHiliteData ========================================================== /** Token refers to Hilite draw data */ @@ -542,7 +542,7 @@ static Bool tokenIsHiliteData( const char *token ) return FALSE; -} // end tokenIsHiliteData +} // saveDrawData =============================================================== /** Save the draw data array */ @@ -581,7 +581,7 @@ static Bool saveDrawData( const char *token, GameWindow *window, assert( 0 ); return FALSE; - } // end else + } image = drawData->image; GameGetColorComponents( drawData->color, &r, &g, &b, &a ); @@ -599,11 +599,11 @@ static Bool saveDrawData( const char *token, GameWindow *window, writeBufferToFile( fp, buffer ); - } // end for i + } return TRUE; -} // end saveDrawData +} // saveListboxData ============================================================ /** Save listbox data to the file */ @@ -621,7 +621,7 @@ static Bool saveListboxData( GameWindow *window, FILE *fp, Int dataIndent ) assert( 0 ); return FALSE; - } // end if + } sprintf( &buffer[ dataIndent ], "LISTBOXDATA = LENGTH: %d,\n", listData->listLength ); writeBufferToFile( fp, buffer ); @@ -656,7 +656,7 @@ static Bool saveListboxData( GameWindow *window, FILE *fp, Int dataIndent ) saveDrawData( "LISTBOXDISABLEDUPBUTTONDRAWDATA", listData->upButton, fp, dataIndent ); saveDrawData( "LISTBOXHILITEUPBUTTONDRAWDATA", listData->upButton, fp, dataIndent ); - } // end if + } // save down button draw data for listbox if( listData->downButton ) @@ -666,7 +666,7 @@ static Bool saveListboxData( GameWindow *window, FILE *fp, Int dataIndent ) saveDrawData( "LISTBOXDISABLEDDOWNBUTTONDRAWDATA", listData->downButton, fp, dataIndent ); saveDrawData( "LISTBOXHILITEDOWNBUTTONDRAWDATA", listData->downButton, fp, dataIndent ); - } // end if + } // save the slider draw data on the listbox if( listData->slider ) @@ -683,13 +683,13 @@ static Bool saveListboxData( GameWindow *window, FILE *fp, Int dataIndent ) saveDrawData( "SLIDERTHUMBDISABLEDDRAWDATA", thumb, fp, dataIndent ); saveDrawData( "SLIDERTHUMBHILITEDRAWDATA", thumb, fp, dataIndent ); - } // end if + } - } // end if + } return TRUE; -} // end saveListboxData +} // saveComboBoxData ============================================================ /** Save Combo Box data to the file */ @@ -707,7 +707,7 @@ static Bool saveComboBoxData( GameWindow *window, FILE *fp, Int dataIndent ) assert( 0 ); return FALSE; - } // end if + } sprintf( &buffer[ dataIndent ], "COMBOBOXDATA = ISEDITABLE: %d,\n", comboData->isEditable ); writeBufferToFile( fp, buffer ); @@ -728,7 +728,7 @@ static Bool saveComboBoxData( GameWindow *window, FILE *fp, Int dataIndent ) saveDrawData( "COMBOBOXDROPDOWNBUTTONDISABLEDDRAWDATA", comboData->dropDownButton, fp, dataIndent ); saveDrawData( "COMBOBOXDROPDOWNBUTTONHILITEDRAWDATA", comboData->dropDownButton, fp, dataIndent ); - } // end if + } if( comboData->editBox ) { @@ -737,7 +737,7 @@ static Bool saveComboBoxData( GameWindow *window, FILE *fp, Int dataIndent ) saveDrawData( "COMBOBOXEDITBOXDISABLEDDRAWDATA", comboData->editBox, fp, dataIndent ); saveDrawData( "COMBOBOXEDITBOXHILITEDRAWDATA", comboData->editBox, fp, dataIndent ); - } // end if + } if(comboData->listBox) { @@ -755,7 +755,7 @@ static Bool saveComboBoxData( GameWindow *window, FILE *fp, Int dataIndent ) saveDrawData( "LISTBOXDISABLEDUPBUTTONDRAWDATA", listData->upButton, fp, dataIndent ); saveDrawData( "LISTBOXHILITEUPBUTTONDRAWDATA", listData->upButton, fp, dataIndent ); - } // end if + } // save down button draw data for listbox if( listData->downButton ) @@ -765,7 +765,7 @@ static Bool saveComboBoxData( GameWindow *window, FILE *fp, Int dataIndent ) saveDrawData( "LISTBOXDISABLEDDOWNBUTTONDRAWDATA", listData->downButton, fp, dataIndent ); saveDrawData( "LISTBOXHILITEDOWNBUTTONDRAWDATA", listData->downButton, fp, dataIndent ); - } // end if + } // save the slider draw data on the listbox if( listData->slider ) @@ -782,13 +782,13 @@ static Bool saveComboBoxData( GameWindow *window, FILE *fp, Int dataIndent ) saveDrawData( "SLIDERTHUMBDISABLEDDRAWDATA", thumb, fp, dataIndent ); saveDrawData( "SLIDERTHUMBHILITEDRAWDATA", thumb, fp, dataIndent ); - } // end if + } - } // end if - }// end if + } + } return TRUE; -} // end saveComboBoxData +} // saveRadioButtonData ======================================================== @@ -807,14 +807,14 @@ static Bool saveRadioButtonData( GameWindow *window, FILE *fp, Int dataIndent ) assert( 0 ); return FALSE; - } // end if + } sprintf( &buffer[ dataIndent ], "RADIOBUTTONDATA = GROUP: %d;\n", radioData->group ); writeBufferToFile( fp, buffer ); return TRUE; -} // end saveRadioButtonData +} // saveSliderData ============================================================= /** Save slider specific data */ @@ -832,7 +832,7 @@ static Bool saveSliderData( GameWindow *window, FILE *fp, Int dataIndent ) assert( 0 ); return FALSE; - } // end if + } sprintf( &buffer[ dataIndent ], "SLIDERDATA = MINVALUE: %d,\n", sliderData->minVal ); writeBufferToFile( fp, buffer ); @@ -848,11 +848,11 @@ static Bool saveSliderData( GameWindow *window, FILE *fp, Int dataIndent ) saveDrawData( "SLIDERTHUMBDISABLEDDRAWDATA", thumb, fp, dataIndent ); saveDrawData( "SLIDERTHUMBHILITEDRAWDATA", thumb, fp, dataIndent ); - } // end if + } return TRUE; -} // end saveSliderData +} // saveStaticTextData ========================================================= /** Save static text data entry */ @@ -870,14 +870,14 @@ static Bool saveStaticTextData( GameWindow *window, FILE *fp, Int dataIndent ) assert( 0 ); return FALSE; - } // end if + } sprintf( &buffer[ dataIndent ], "STATICTEXTDATA = CENTERED: %d;\n", textData->centered ); writeBufferToFile( fp, buffer ); return TRUE; -} // end saveStaticTextData +} // saveTextEntryData ========================================================== /** Save static text data entry */ @@ -895,7 +895,7 @@ static Bool saveTextEntryData( GameWindow *window, FILE *fp, Int dataIndent ) assert( 0 ); return FALSE; - } // end if + } sprintf( &buffer[ dataIndent ], "TEXTENTRYDATA = MAXLEN: %d,\n", entryData->maxTextLen ); writeBufferToFile( fp, buffer ); @@ -910,7 +910,7 @@ static Bool saveTextEntryData( GameWindow *window, FILE *fp, Int dataIndent ) return TRUE; -} // end saveTextEntryData +} // saveTabControlData ========================================================== /** Save tab control entry */ @@ -928,7 +928,7 @@ static Bool saveTabControlData( GameWindow *window, FILE *fp, Int dataIndent ) assert( 0 ); return FALSE; - } // end if + } sprintf( &buffer[ dataIndent ], "TABCONTROLDATA = TABORIENTATION: %d,\n", tabControlData->tabOrientation ); writeBufferToFile( fp, buffer ); @@ -982,7 +982,7 @@ static Bool saveGadgetData( GameWindow *window, FILE *fp, Int dataIndent ) return TRUE; -} // end saveGadgetData +} // saveWindow ================================================================= /** Save a single window and any of its child windows. Note that child @@ -1058,22 +1058,22 @@ static Bool saveWindow( FILE *fp, GameWindow *window, Int indent ) // previous child child = child->winGetPrev(); - } // end while + } // all children saved sprintf( &buffer[ dataIndent ], "ENDALLCHILDREN\n" ); writeBufferToFile( fp, buffer ); - } // end if, children present + } - } // end if + } else { // save specific gadget data saveGadgetData( window, fp, dataIndent ); - } // end else + } // end of window definition sprintf( &buffer[ indent ], "END\n" ); @@ -1081,7 +1081,7 @@ static Bool saveWindow( FILE *fp, GameWindow *window, Int indent ) return success; -} // end saveWindow +} // GUIEdit::validateNames ===================================================== /** Stored in the m_decorated field for each window is a name given @@ -1108,7 +1108,7 @@ void GUIEdit::validateNames( GameWindow *root, char *filename, Bool *valid ) *valid = FALSE; return; - } // end if + } // check this name for too long WinInstanceData *instData = root->winGetInstanceData(); @@ -1122,7 +1122,7 @@ void GUIEdit::validateNames( GameWindow *root, char *filename, Bool *valid ) strcat( offendingNames, "\n"); *valid = FALSE; - } // end if + } // check for a duplicate filename if( TheEditor->isNameDuplicate( TheWindowManager->winGetWindowList(), @@ -1136,7 +1136,7 @@ void GUIEdit::validateNames( GameWindow *root, char *filename, Bool *valid ) strcat( offendingNames, "\n" ); *valid = FALSE; - } // end if + } //You only call this on the first child since the call right after it will handle siblings (depth first) GameWindow *child = root->winGetChild(); @@ -1145,7 +1145,7 @@ void GUIEdit::validateNames( GameWindow *root, char *filename, Bool *valid ) // onto the next window validateNames( root->winGetNext(), filename, valid ); -} // end validateNames +} // GUIEdit::updateRadioScreenIdentifiers ====================================== /** update all radio button screen identifiers with the new identifier */ @@ -1164,7 +1164,7 @@ void GUIEdit::updateRadioScreenIdentifiers( GameWindow *window, Int screenID ) GadgetRadioSetGroup( window, radioData->group, screenID ); - } // end if + } // check our children GameWindow *child; @@ -1174,7 +1174,7 @@ void GUIEdit::updateRadioScreenIdentifiers( GameWindow *window, Int screenID ) // check the next one updateRadioScreenIdentifiers( window->winGetNext(), screenID ); -} // end updateRadioScreenIdentifiers +} //------------------------------------------------------------------------------------------------- /** Write layout block for a window file */ @@ -1193,7 +1193,7 @@ static void writeLayoutBlock( FILE *fp ) // end marker fprintf( fp, "ENDLAYOUTBLOCK\n" ); -} // end writeLayoutBlock +} // GUIEdit::saveData ========================================================== /** Save all our data to the file specified in filePath, which is a full @@ -1232,7 +1232,7 @@ Bool GUIEdit::saveData( char *filePathAndFilename, char *filename ) MessageBox( TheEditor->getWindowHandle(), offendingNames, "Window Name Error", MB_OK ); return FALSE; - } // end if + } // update all radio button screen identifiers with the filename updateRadioScreenIdentifiers( TheWindowManager->winGetWindowList(), @@ -1270,14 +1270,14 @@ Bool GUIEdit::saveData( char *filePathAndFilename, char *filename ) break; window = window->winGetPrev(); - } // end while + } // close the file fclose( fp ); return success; -} // end saveData +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// diff --git a/Generals/Code/Tools/GUIEdit/Source/WinMain.cpp b/Generals/Code/Tools/GUIEdit/Source/WinMain.cpp index b0f2e7fd1e5..1d692600e36 100644 --- a/Generals/Code/Tools/GUIEdit/Source/WinMain.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/WinMain.cpp @@ -128,7 +128,7 @@ static BOOL initInstance( HINSTANCE hInstance, int nCmdShow ) return TRUE; -} // end initInstance +} // registerClass ============================================================== // @@ -165,7 +165,7 @@ static ATOM registerClass(HINSTANCE hInstance) return RegisterClassEx( &wcex ); -} // registerClass +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -254,11 +254,11 @@ Int APIENTRY WinMain(HINSTANCE hInstance, TranslateMessage( &msg ); DispatchMessage( &msg ); - } // end if + } - } // end while + } - } // end if + } else { @@ -266,9 +266,9 @@ Int APIENTRY WinMain(HINSTANCE hInstance, TheEditor->update(); Sleep(1); - } // end else + } - } // end while + } // shutdown GUIEdit data delete TheEditor; @@ -278,7 +278,7 @@ Int APIENTRY WinMain(HINSTANCE hInstance, return msg.wParam; -} // end WinMain +} // WndProc ==================================================================== // @@ -307,7 +307,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, SetFocus( hWnd ); return 0; - } // end move mouse + } // ------------------------------------------------------------------------ case WM_COMMAND: @@ -394,7 +394,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, else TheEditor->setMode( MODE_EDIT ); - } // end if + } break; // -------------------------------------------------------------------- @@ -424,9 +424,9 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, color.alpha = (Real)newColor->alpha / 255.0f; TheEditWindow->setBackgroundColor( color ); - } // end if + } - } // end if + } break; @@ -439,7 +439,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, TheDefaultScheme->openDialog(); break; - } // end scheme + } // -------------------------------------------------------------------- case MENU_ABOUT: @@ -449,7 +449,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, hWnd, (DLGPROC)AboutCallback ); break; - } // end about + } // -------------------------------------------------------------------- @@ -458,13 +458,13 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, return DefWindowProc( hWnd, message, wParam, lParam ); - } // end default + } - } // end switch( controlID ) + } return 0; - } // end command + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -474,7 +474,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, TheEditor->menuExit(); return 0; - } // end close + } // ------------------------------------------------------------------------ case WM_KEYDOWN: @@ -498,7 +498,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, TheEditor->clearSelections(); break; - } // end escape + } // -------------------------------------------------------------------- case VK_DELETE: @@ -509,7 +509,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, TheEditor->deleteSelected(); break; - } // end delete + } // -------------------------------------------------------------------- case VK_LEFT: @@ -550,7 +550,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, } break; - } // end Left + } // -------------------------------------------------------------------- case VK_RIGHT: { @@ -590,7 +590,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, } break; - } // end RIGHT + } // -------------------------------------------------------------------- case VK_UP: { @@ -631,7 +631,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, } break; - } // end Up + } // -------------------------------------------------------------------- case VK_DOWN: { @@ -671,7 +671,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, } break; - } // end Down + } // -------------------------------------------------------------------- case VK_RETURN: @@ -689,13 +689,13 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, TheEditor->setMode( MODE_EDIT ); } break; - }// end Enter + } - } // end switch( virtualKey ) + } return 0; - } // end key down + } // ------------------------------------------------------------------------ case WM_SIZE: @@ -723,13 +723,13 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, barY = height - barHeight; MoveWindow( statusBar, barX, barY, barWidth, barHeight, TRUE ); - } // end if + } - } // end if + } return 0; - } // end size + } // ------------------------------------------------------------------------ case WM_PAINT: @@ -741,7 +741,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, EndPaint(hWnd, &ps); break; - } // end paint + } // ------------------------------------------------------------------------ case WM_DESTROY: @@ -750,7 +750,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, PostQuitMessage(0); break; - } // end destroy + } // ------------------------------------------------------------------------ default: @@ -758,13 +758,13 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, return DefWindowProc(hWnd, message, wParam, lParam); - } // end default + } - } // end switch( message ) + } return DefWindowProc( hWnd, message, wParam, lParam ); -} // end WndProc +} // AboutCallback ============================================================== /** Mesage handler for about box. */ @@ -788,5 +788,5 @@ LRESULT CALLBACK AboutCallback( HWND hDlg, UINT message, } return FALSE; -} // end AboutCallback +} diff --git a/Generals/Code/Tools/WorldBuilder/src/BlendMaterial.cpp b/Generals/Code/Tools/WorldBuilder/src/BlendMaterial.cpp index 14fae6d6f9b..775a9aea7d5 100644 --- a/Generals/Code/Tools/WorldBuilder/src/BlendMaterial.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/BlendMaterial.cpp @@ -201,7 +201,7 @@ void BlendMaterial::addTerrain(const char *pPath, Int terrainNdx, HTREEITEM pare parent = findOrAdd( parent, "**EVAL**" ); strcpy(buffer, pPath); doAdd = true; - } // end if + } // Int tilesPerRow = TEXTURE_WIDTH/(2*TILE_PIXEL_EXTENT+TILE_OFFSET); // Int availableTiles = 4 * tilesPerRow * tilesPerRow; diff --git a/Generals/Code/Tools/WorldBuilder/src/BuildList.cpp b/Generals/Code/Tools/WorldBuilder/src/BuildList.cpp index f740045be2f..d47437e28d4 100644 --- a/Generals/Code/Tools/WorldBuilder/src/BuildList.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/BuildList.cpp @@ -631,7 +631,7 @@ void BuildList::GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, lo // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void BuildList::PopSliderChanged(const long sliderID, long theVal) @@ -659,7 +659,7 @@ void BuildList::PopSliderChanged(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void BuildList::PopSliderFinished(const long sliderID, long theVal) @@ -673,7 +673,7 @@ void BuildList::PopSliderFinished(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } diff --git a/Generals/Code/Tools/WorldBuilder/src/CameraOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/CameraOptions.cpp index fc83324b354..a998b7869be 100644 --- a/Generals/Code/Tools/WorldBuilder/src/CameraOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/CameraOptions.cpp @@ -193,7 +193,7 @@ void CameraOptions::GetPopSliderInfo(const long sliderID, long *pMin, long *pMax // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void CameraOptions::PopSliderChanged(const long sliderID, long theVal) @@ -209,7 +209,7 @@ void CameraOptions::PopSliderChanged(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void CameraOptions::PopSliderFinished(const long sliderID, long theVal) @@ -222,7 +222,7 @@ void CameraOptions::PopSliderFinished(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } diff --git a/Generals/Code/Tools/WorldBuilder/src/EditObjectParameter.cpp b/Generals/Code/Tools/WorldBuilder/src/EditObjectParameter.cpp index 121f1e924da..fe38881e938 100644 --- a/Generals/Code/Tools/WorldBuilder/src/EditObjectParameter.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/EditObjectParameter.cpp @@ -87,7 +87,7 @@ BOOL EditObjectParameter::OnInitDialog() { addObject(tTemplate); - } // end for tTemplate + } addObjectLists(); @@ -137,9 +137,9 @@ void EditObjectParameter::addObject( const ThingTemplate *thingTemplate ) parent = findOrAdd( parent, EditorSortingNames[ i ] ); break; // exit for - } // end if + } - } // end for i + } if( i == ES_NUM_SORTING_TYPES ) parent = findOrAdd( parent, "UNSORTED" ); @@ -147,7 +147,7 @@ void EditObjectParameter::addObject( const ThingTemplate *thingTemplate ) // the leaf name is the name of the template leafName = thingTemplate->getName().str(); - } // end if + } // add to the tree view if( leafName ) diff --git a/Generals/Code/Tools/WorldBuilder/src/EditParameter.cpp b/Generals/Code/Tools/WorldBuilder/src/EditParameter.cpp index aa848b233d1..fc43e739ad9 100644 --- a/Generals/Code/Tools/WorldBuilder/src/EditParameter.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/EditParameter.cpp @@ -1315,7 +1315,7 @@ void EditParameter::readFontFile( const char *filename ) fontBuffer[ index++ ] = c; fp->read(&c, 1); - } // end while + } fontBuffer[ index ] = '\0'; fp->read(&c, 1); @@ -1336,15 +1336,15 @@ void EditParameter::readFontFile( const char *filename ) fontBuffer, size, bold ); //MessageBox( m_appHWnd, buffer, "Cannot Load Font", MB_OK ); - } // end if + } - } // end for i + } // close the file fp->close(); fp = NULL; -} // end readFontFile +} Bool EditParameter::loadWaypoints(CComboBox *pCombo, AsciiString match) { diff --git a/Generals/Code/Tools/WorldBuilder/src/FeatherOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/FeatherOptions.cpp index 03685612524..fb4bbfd37da 100644 --- a/Generals/Code/Tools/WorldBuilder/src/FeatherOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/FeatherOptions.cpp @@ -172,7 +172,7 @@ void FeatherOptions::GetPopSliderInfo(const long sliderID, long *pMin, long *pMa default: DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void FeatherOptions::PopSliderChanged(const long sliderID, long theVal) @@ -207,7 +207,7 @@ void FeatherOptions::PopSliderChanged(const long sliderID, long theVal) default: break; - } // switch + } } void FeatherOptions::PopSliderFinished(const long sliderID, long theVal) @@ -221,7 +221,7 @@ void FeatherOptions::PopSliderFinished(const long sliderID, long theVal) default: DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } diff --git a/Generals/Code/Tools/WorldBuilder/src/FenceOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/FenceOptions.cpp index d46782fd0a4..6c42f202c46 100644 --- a/Generals/Code/Tools/WorldBuilder/src/FenceOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/FenceOptions.cpp @@ -161,7 +161,7 @@ BOOL FenceOptions::OnInitDialog() Color cc = tTemplate->getDisplayColor(); pMap->setColor(cc); - } // end for tTemplate + } CWnd *pWnd = GetDlgItem(IDC_OBJECT_HEIGHT_EDIT); @@ -278,9 +278,9 @@ void FenceOptions::addObject( MapObject *mapObject, const char *pPath, const cha parent = findOrAdd( parent, EditorSortingNames[ i ] ); break; // exit for - } // end if + } - } // end for i + } if( i == ES_NUM_SORTING_TYPES ) parent = findOrAdd( parent, "UNSORTED" ); @@ -288,7 +288,7 @@ void FenceOptions::addObject( MapObject *mapObject, const char *pPath, const cha // the leaf name is the name of the template leafName = thingTemplate->getName().str(); - } // end if + } // add to the tree view if( leafName ) diff --git a/Generals/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp index 5eba8d16fa8..5cbd61e86f6 100644 --- a/Generals/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp @@ -775,7 +775,7 @@ void GlobalLightOptions::GetPopSliderInfo(const long sliderID, long *pMin, long // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void GlobalLightOptions::PopSliderChanged(const long sliderID, long theVal) @@ -822,7 +822,7 @@ void GlobalLightOptions::PopSliderChanged(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void GlobalLightOptions::PopSliderFinished(const long sliderID, long theVal) @@ -845,7 +845,7 @@ void GlobalLightOptions::PopSliderFinished(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } diff --git a/Generals/Code/Tools/WorldBuilder/src/MapPreview.cpp b/Generals/Code/Tools/WorldBuilder/src/MapPreview.cpp index 39e1cc1a1d1..367926cc89f 100644 --- a/Generals/Code/Tools/WorldBuilder/src/MapPreview.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/MapPreview.cpp @@ -129,7 +129,7 @@ void MapPreview::interpolateColorForHeight( RGBColor *color, colorTarget.green = color->green + (1.0f - color->green) * howBright; colorTarget.blue = color->blue + (1.0f - color->blue) * howBright; - } // end if + } else // interpolate darker { @@ -141,7 +141,7 @@ void MapPreview::interpolateColorForHeight( RGBColor *color, colorTarget.green = color->green + (0.0f - color->green) * howDark; colorTarget.blue = color->blue + (0.0f - color->blue) * howDark; - } // end else + } // interpolate toward the target color color->red = color->red + (colorTarget.red - color->red) * t; @@ -162,7 +162,7 @@ void MapPreview::interpolateColorForHeight( RGBColor *color, if( color->blue > 1.0f ) color->blue = 1.0f; -} // end interpolateColorForHeight +} Bool MapPreview::mapPreviewToWorld(const ICoord2D *radar, Coord3D *world) { @@ -317,15 +317,15 @@ void MapPreview::buildMapPreviewTexture( CString tgaName ) sampleColor.blue += color.blue; samples++; - } // end if + } - } // end if + } - } // end for i + } - } // end if + } - } // end for j + } // prevent divide by zeros if( samples == 0 ) @@ -336,7 +336,7 @@ void MapPreview::buildMapPreviewTexture( CString tgaName ) color.green = sampleColor.green / (Real)samples; color.blue = sampleColor.blue / (Real)samples; - } // end if + } else // regular terrain ... { const Int samplesAway = 1; // how many "tiles" from the center tile we will sample away @@ -378,13 +378,13 @@ void MapPreview::buildMapPreviewTexture( CString tgaName ) sampleColor.blue += color.blue; samples++; - } // end if + } - } // end for i + } - } // end if + } - } // end for j + } // prevent divide by zeros if( samples == 0 ) @@ -395,7 +395,7 @@ void MapPreview::buildMapPreviewTexture( CString tgaName ) color.green = sampleColor.green / (Real)samples; color.blue = sampleColor.blue / (Real)samples; - } // end else + } // // draw the pixel for the terrain at this point, note that because of the orientation @@ -408,9 +408,9 @@ void MapPreview::buildMapPreviewTexture( CString tgaName ) // m_pixelBuffer[y][x]= 255 | (REAL_TO_INT(color.red *255) << 8) | (REAL_TO_INT(color.green *255) << 16) | REAL_TO_INT(color.blue * 255)<< 24; - } // end for x + } - } // end for y + } { Targa tga; tga.Header.Width = MAP_PREVIEW_WIDTH; @@ -421,7 +421,7 @@ void MapPreview::buildMapPreviewTexture( CString tgaName ) tga.Save(tgaName,TGAF_IMAGE, FALSE); } -} // end buildTerrainTexture +} diff --git a/Generals/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp index b4a7c4d2c6e..ea6b3d0d24c 100644 --- a/Generals/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp @@ -205,7 +205,7 @@ void MeshMoldOptions::GetPopSliderInfo(const long sliderID, long *pMin, long *pM // uh-oh! DEBUG_CRASH(("Missing ID.")); break; - } // switch + } } void MeshMoldOptions::PopSliderChanged(const long sliderID, long theVal) @@ -240,7 +240,7 @@ void MeshMoldOptions::PopSliderChanged(const long sliderID, long theVal) default: DEBUG_CRASH(("Missing ID.")); break; - } // switch + } } void MeshMoldOptions::PopSliderFinished(const long sliderID, long theVal) @@ -256,7 +256,7 @@ void MeshMoldOptions::PopSliderFinished(const long sliderID, long theVal) default: DEBUG_CRASH(("Missing ID.")); break; - } // switch + } } diff --git a/Generals/Code/Tools/WorldBuilder/src/MoundOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/MoundOptions.cpp index a3dca3b6563..c40a69587d6 100644 --- a/Generals/Code/Tools/WorldBuilder/src/MoundOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/MoundOptions.cpp @@ -212,7 +212,7 @@ void MoundOptions::GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void MoundOptions::PopSliderChanged(const long sliderID, long theVal) @@ -249,7 +249,7 @@ void MoundOptions::PopSliderChanged(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void MoundOptions::PopSliderFinished(const long sliderID, long theVal) @@ -266,7 +266,7 @@ void MoundOptions::PopSliderFinished(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } diff --git a/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp index ed8f9c24e14..463f0cbce21 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp @@ -252,7 +252,7 @@ BOOL ObjectOptions::OnInitDialog() Color cc = tTemplate->getDisplayColor(); pMap->setColor(cc); - } // end for tTemplate + } #if 0 // Lights are not working right now. { @@ -438,7 +438,7 @@ HTREEITEM ObjectOptions::_FindOrDont(const char* pLabel, HTREEITEM startPoint) } else { // add the first child, the others will be caught by the adding of the siblings itemsToEx.push_back(m_objectTreeView.GetChildItem(hItem)); - } // Always add the first sibling, if it exists + } if (m_objectTreeView.GetNextSiblingItem(hItem)) { itemsToEx.push_back(m_objectTreeView.GetNextSiblingItem(hItem)); @@ -496,9 +496,9 @@ void ObjectOptions::addObject( MapObject *mapObject, const char *pPath, parent = findOrAdd( parent, EditorSortingNames[ i ] ); break; // exit for - } // end if + } - } // end for i + } if( i == ES_NUM_SORTING_TYPES ) parent = findOrAdd( parent, "UNSORTED" ); @@ -506,7 +506,7 @@ void ObjectOptions::addObject( MapObject *mapObject, const char *pPath, // the leaf name is the name of the template leafName = thingTemplate->getName().str(); - } // end if + } else { @@ -532,9 +532,9 @@ void ObjectOptions::addObject( MapObject *mapObject, const char *pPath, buffer[ i ] = 0; leafName = buffer; - } // end if + } - } // end else if + } // add to the tree view if( leafName ) diff --git a/Generals/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp b/Generals/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp index 816f1363793..e1047940cc1 100644 --- a/Generals/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp @@ -173,7 +173,7 @@ BOOL PickUnitDialog::OnInitDialog() pMap = newInstance(MapObject)( loc, tTemplate->getName(), 0.0f, 0, NULL, tTemplate ); pMap->setNextMap( m_objectsList ); m_objectsList = pMap; - } // end for tTemplate + } CWnd *pWnd = GetDlgItem(IDC_OBJECT_HEIGHT_EDIT); if (pWnd) { @@ -323,9 +323,9 @@ void PickUnitDialog::addObject( MapObject *mapObject, const char *pPath, Int ind parent = findOrAdd( parent, EditorSortingNames[ i ] ); break; // exit for - } // end if + } - } // end for i + } if( i == ES_NUM_SORTING_TYPES ) parent = findOrAdd( parent, "UNSORTED" ); @@ -333,7 +333,7 @@ void PickUnitDialog::addObject( MapObject *mapObject, const char *pPath, Int ind // the leaf name is the name of the template leafName = thingTemplate->getName().str(); - } // end if + } else { @@ -359,9 +359,9 @@ void PickUnitDialog::addObject( MapObject *mapObject, const char *pPath, Int ind buffer[ i ] = 0; leafName = buffer; - } // end if + } - } // end else if + } // add to the tree view if( leafName ) diff --git a/Generals/Code/Tools/WorldBuilder/src/RoadOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/RoadOptions.cpp index f580726a994..a2366228194 100644 --- a/Generals/Code/Tools/WorldBuilder/src/RoadOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/RoadOptions.cpp @@ -237,7 +237,7 @@ BOOL RoadOptions::OnInitDialog() index++; m_numberOfRoads++; - } // end for raod + } // load roads from test assets #ifdef LOAD_TEST_ASSETS @@ -298,7 +298,7 @@ BOOL RoadOptions::OnInitDialog() index++; m_numberOfBridges++; - } // end for bridge + } m_currentRoadIndex = 1; setRoadTreeViewSelection(TVI_ROOT, m_currentRoadIndex); @@ -392,7 +392,7 @@ void RoadOptions::addRoad(char *pPath, Int terrainNdx, HTREEITEM parent) // do the add doAdd = TRUE; - } // end if + } #ifdef LOAD_TEST_ASSETS if (!doAdd && !strncmp(TEST_STRING, pPath, strlen(TEST_STRING))) { diff --git a/Generals/Code/Tools/WorldBuilder/src/ScorchOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/ScorchOptions.cpp index 61530450596..12c8ef06c20 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ScorchOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ScorchOptions.cpp @@ -176,7 +176,7 @@ void ScorchOptions::GetPopSliderInfo(const long sliderID, long *pMin, long *pMax // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void ScorchOptions::PopSliderChanged(const long sliderID, long theVal) @@ -197,7 +197,7 @@ void ScorchOptions::PopSliderChanged(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } m_updating = false; } @@ -212,7 +212,7 @@ void ScorchOptions::PopSliderFinished(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } diff --git a/Generals/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp b/Generals/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp index cd2c23b72d9..f65721ddcfd 100644 --- a/Generals/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp @@ -297,15 +297,15 @@ void TerrainMaterial::addTerrain(char *pPath, Int terrainNdx, HTREEITEM parent) parent = findOrAdd( parent, terrainTypeNames[ i ] ); break; // exit for - } // end if + } - } // end for i + } // set the name in the tree view to that of the entry strcpy( buffer, terrain->getName().str() ); doAdd = TRUE; - } // end if + } else if (!WorldHeightMapEdit::getTexClassIsBlendEdge(terrainNdx)) { @@ -329,7 +329,7 @@ void TerrainMaterial::addTerrain(char *pPath, Int terrainNdx, HTREEITEM parent) doAdd = TRUE; i++; } - } // end else + } Int tilesPerRow = TEXTURE_WIDTH/(2*TILE_PIXEL_EXTENT+TILE_OFFSET); Int availableTiles = 4 * tilesPerRow * tilesPerRow; @@ -425,7 +425,7 @@ void TerrainMaterial::GetPopSliderInfo(const long sliderID, long *pMin, long *pM break; default: break; - } // switch + } } @@ -445,7 +445,7 @@ void TerrainMaterial::PopSliderChanged(const long sliderID, long theVal) default: break; - } // switch + } } void TerrainMaterial::PopSliderFinished(const long sliderID, long theVal) @@ -456,7 +456,7 @@ void TerrainMaterial::PopSliderFinished(const long sliderID, long theVal) default: break; - } // switch + } } diff --git a/Generals/Code/Tools/WorldBuilder/src/TerrainModal.cpp b/Generals/Code/Tools/WorldBuilder/src/TerrainModal.cpp index ffb1a0d4f67..f038bf80495 100644 --- a/Generals/Code/Tools/WorldBuilder/src/TerrainModal.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/TerrainModal.cpp @@ -168,15 +168,15 @@ void TerrainModal::addTerrain(char *pPath, Int terrainNdx, HTREEITEM parent) parent = findOrAdd( parent, terrainTypeNames[ i ] ); break; // exit for - } // end if + } - } // end for i + } strcpy( buffer, terrain->getName().str() ); doAdd = TRUE; - } // end if + } else { @@ -202,7 +202,7 @@ void TerrainModal::addTerrain(char *pPath, Int terrainNdx, HTREEITEM parent) doAdd = TRUE; } - } // end else + } if (doAdd) { diff --git a/Generals/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp b/Generals/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp index 53cf02422bc..111041118af 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp @@ -261,7 +261,7 @@ void PopupSlider::New(CWnd *pParentWnd, long kind, pPopupSlider = NULL; } - } // catch + } gPopupSlider = pPopupSlider; // gPopupSlider will be deleted when its PostNcDestroy method is called @@ -386,7 +386,7 @@ BOOL PopupSlider::Create(const RECT& rect, CWnd* pParentWnd) } catch (...) { // don't rethrow retVal = FALSE; - } // catch + } return retVal; } @@ -579,7 +579,7 @@ void PopupSlider::OnMouseMove(UINT nFlags, CPoint point) if (mSliderOwner) { mSliderOwner->PopSliderChanged(mSliderID, m_curValue); } - } // if (PtInRect) + } } } diff --git a/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp b/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp index c69de64dd47..977f3a78dca 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp @@ -406,7 +406,7 @@ void WorldHeightMapEdit::loadBaseImages(void) // load the terrain definition for the WorldBuilder to reference loadImagesFromTerrainType( terrain ); - } // end for + } } @@ -905,7 +905,7 @@ Int WorldHeightMapEdit::getTileIndexFromTerrainType( TerrainType *terrain ) // not found return -1; -} // end getTileIndexFromTerrainType +} Int WorldHeightMapEdit::allocateTiles(Int textureClass) { diff --git a/Generals/Code/Tools/WorldBuilder/src/WaterOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/WaterOptions.cpp index ab8a34208f7..5493b5789fc 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WaterOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WaterOptions.cpp @@ -360,7 +360,7 @@ void WaterOptions::GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void WaterOptions::PopSliderChanged(const long sliderID, long theVal) @@ -386,7 +386,7 @@ void WaterOptions::PopSliderChanged(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void WaterOptions::PopSliderFinished(const long sliderID, long theVal) @@ -401,7 +401,7 @@ void WaterOptions::PopSliderFinished(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } diff --git a/Generals/Code/Tools/WorldBuilder/src/brushoptions.cpp b/Generals/Code/Tools/WorldBuilder/src/brushoptions.cpp index 567abd40a23..022377789b4 100644 --- a/Generals/Code/Tools/WorldBuilder/src/brushoptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/brushoptions.cpp @@ -212,7 +212,7 @@ void BrushOptions::GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void BrushOptions::PopSliderChanged(const long sliderID, long theVal) @@ -249,7 +249,7 @@ void BrushOptions::PopSliderChanged(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void BrushOptions::PopSliderFinished(const long sliderID, long theVal) @@ -266,7 +266,7 @@ void BrushOptions::PopSliderFinished(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } diff --git a/Generals/Code/Tools/WorldBuilder/src/mapobjectprops.cpp b/Generals/Code/Tools/WorldBuilder/src/mapobjectprops.cpp index 8d6f404c42b..eaee6f6f142 100644 --- a/Generals/Code/Tools/WorldBuilder/src/mapobjectprops.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/mapobjectprops.cpp @@ -1373,7 +1373,7 @@ void MapObjectProps::GetPopSliderInfo(const long sliderID, long *pMin, long *pMa // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void MapObjectProps::PopSliderChanged(const long sliderID, long theVal) @@ -1410,7 +1410,7 @@ void MapObjectProps::PopSliderChanged(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void MapObjectProps::PopSliderFinished(const long sliderID, long theVal) @@ -1426,7 +1426,7 @@ void MapObjectProps::PopSliderFinished(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } diff --git a/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp b/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp index 7151cfd6bb2..4f1ce2855aa 100644 --- a/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -1012,7 +1012,7 @@ void WbView3d::updateFenceListObjects(MapObject *pObject) renderObj = m_assetManager->Create_Render_Obj( modelName.str(), scale, 0); - } // end if + } } if (renderObj) { @@ -1152,7 +1152,7 @@ void WbView3d::invalBuildListItemInView(BuildListInfo *pBuildToInval) shadowInfo.m_offsetY=tTemplate->getShadowOffsetY(); shadowObj=TheW3DShadowManager->addShadow(renderObj, &shadowInfo); } - } // end if + } } if (renderObj) { pBuild->setRenderObj(renderObj); @@ -1426,7 +1426,7 @@ void WbView3d::invalObjectInView(MapObject *pMapObjIn) shadowObj=TheW3DShadowManager->addShadow(renderObj, &shadowInfo); } } - } // end if + } } if (renderObj && !(pMapObj->getFlags() & FLAG_DONT_RENDER)) { @@ -1690,7 +1690,7 @@ Bool WbView3d::viewToDocCoords(CPoint curPt, Coord3D *newPt, Bool constrain) intersection = castResult.ContactPoint; m_curTrackingZ = intersection.Z; result = true; - } // end if + } } if (!result) { intersection.X = Vector3::Find_X_At_Z(m_curTrackingZ, rayLocation, rayDirectionPt); @@ -2477,7 +2477,7 @@ void WbView3d::drawLabels(HDC hdc) DeleteObject(pen); //delete new pen } #endif //DRAW_LIGHT_DIRECTION_RAYS - }//end for + } } else { if (!m_doLightFeedback) diff --git a/GeneralsMD/Code/GameEngine/Include/Common/BitFlagsIO.h b/GeneralsMD/Code/GameEngine/Include/Common/BitFlagsIO.h index 5520ec29481..91208bdb2aa 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/BitFlagsIO.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/BitFlagsIO.h @@ -182,9 +182,9 @@ void BitFlags::xfer(Xfer* xfer) AsciiString bitNameA = bitName; xfer->xferAsciiString( &bitNameA ); - } // end for i + } - } // end if, save + } else if( xfer->getXferMode() == XFER_LOAD ) { // clear the kind of mask data @@ -210,24 +210,24 @@ void BitFlags::xfer(Xfer* xfer) throw XFER_READ_ERROR; } - } // end for, i + } - } // end else if, load + } else if( xfer->getXferMode() == XFER_CRC ) { // just call the xfer implementation on the data values xfer->xferUser( this, sizeof( this ) ); - } // end else if, crc + } else { DEBUG_CRASH(( "BitFlagsXfer - Unknown xfer mode '%d'", xfer->getXferMode() )); throw XFER_MODE_UNKNOWN; - } // end else + } -} // end xfer +} #endif diff --git a/GeneralsMD/Code/GameEngine/Include/Common/BuildAssistant.h b/GeneralsMD/Code/GameEngine/Include/Common/BuildAssistant.h index f0aeb69030c..94445b7d950 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/BuildAssistant.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/BuildAssistant.h @@ -211,7 +211,7 @@ class BuildAssistant : public SubsystemInterface Int m_buildPositionSize; ///< number of elements in the build position array ObjectSellList m_sellList; ///< list of objects currently going through the "sell process" -}; // end BuildAssistant +}; // EXTERN ///////////////////////////////////////////////////////////////////////////////////////// extern BuildAssistant *TheBuildAssistant; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/FunctionLexicon.h b/GeneralsMD/Code/GameEngine/Include/Common/FunctionLexicon.h index 3e27f853330..ad3b0aeb7da 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/FunctionLexicon.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/FunctionLexicon.h @@ -125,7 +125,7 @@ class FunctionLexicon : public SubsystemInterface TableEntry *m_tables[ MAX_FUNCTION_TABLES ]; ///< the lookup tables -}; // end class FunctionLexicon +}; /////////////////////////////////////////////////////////////////////////////////////////////////// // INLINING diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h b/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h index 410192d841a..72468b20e9c 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h @@ -234,7 +234,7 @@ enum CommandSourceType CPP_11(: Int) CMD_FROM_DOZER, // Special rare command when the dozer originates a command to attack a mine. Mines are not ai-attackable, and it seems deceitful for the dozer to generate a player or script command. jba. CMD_DEFAULT_SWITCH_WEAPON, // Special case: A weapon that can be chosen -- this is the default case (machine gun vs flashbang). -}; ///< the source of a command +}; //------------------------------------------------------------------------------------------------- enum AbleToAttackType CPP_11(: Int) diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Module.h b/GeneralsMD/Code/GameEngine/Include/Common/Module.h index 6b7c3105104..3c9a921edfb 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Module.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Module.h @@ -226,7 +226,7 @@ class Module : public MemoryPoolObject, private: const ModuleData* m_moduleData; -}; // end Module +}; //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ModuleFactory.h b/GeneralsMD/Code/GameEngine/Include/Common/ModuleFactory.h index aedca8ecc3c..72f635d86f2 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/ModuleFactory.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/ModuleFactory.h @@ -122,7 +122,7 @@ class ModuleFactory : public SubsystemInterface, public Snapshot ModuleTemplateMap m_moduleTemplateMap; ModuleDataList m_moduleDataList; -}; // end class ModuleFactory +}; // EXTERN ///////////////////////////////////////////////////////////////////////////////////////// extern ModuleFactory *TheModuleFactory; ///< singleton definition diff --git a/GeneralsMD/Code/GameEngine/Include/Common/NameKeyGenerator.h b/GeneralsMD/Code/GameEngine/Include/Common/NameKeyGenerator.h index 394b41c59bf..ecede5c75d9 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/NameKeyGenerator.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/NameKeyGenerator.h @@ -133,7 +133,7 @@ class NameKeyGenerator : public SubsystemInterface Bucket* m_sockets[SOCKET_COUNT]; ///< Catalog of all Buckets already generated UnsignedInt m_nextID; ///< Next available ID -}; // end class NameKeyGenerator +}; //------------------------------------------------------------------------------------------------- // Externals diff --git a/GeneralsMD/Code/GameEngine/Include/Common/SparseMatchFinder.h b/GeneralsMD/Code/GameEngine/Include/Common/SparseMatchFinder.h index 226dc5e2113..787b6b0939f 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/SparseMatchFinder.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/SparseMatchFinder.h @@ -171,9 +171,9 @@ class SparseMatchFinder curBestMatchStr = it->getDescription(); #endif } - } // end for i + } - } // end for it + } #ifdef SPARSEMATCH_DEBUG if (numDupMatches > 0) diff --git a/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h b/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h index 4b767dc77f9..fec6c93c4dc 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h @@ -140,7 +140,7 @@ class SubsystemInterface AsciiString getName(void) {return m_name;} void setName(AsciiString name) {m_name = name;} -}; // end SubsystemInterface +}; //------------------------------------------------------------------------------------------------- class SubsystemInterfaceList diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/DisplayString.h b/GeneralsMD/Code/GameEngine/Include/GameClient/DisplayString.h index 6214d9784bb..a5000976181 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/DisplayString.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/DisplayString.h @@ -115,7 +115,7 @@ class DisplayString : public MemoryPoolObject DisplayString *m_next; ///< for the display string factory list ONLY DisplayString *m_prev; ///< for the display string factory list ONLY -}; // end DisplayString +}; /////////////////////////////////////////////////////////////////////////////// // INLINING /////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindow.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindow.h index 40f01ade50b..5cf628a9bd6 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindow.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindow.h @@ -433,7 +433,7 @@ friend class GameWindowManager; // vector of window transitions that have a relation to the current GameWindow std::vector m_transitionWindows; -}; // end class GameWindow +}; // TheSuperHackers @feature helmutbuhler 24/04/2025 // GameWindow that does nothing. Used for Headless Mode. diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowManager.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowManager.h index f523011bcd6..9cb85cd0015 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowManager.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowManager.h @@ -359,7 +359,7 @@ friend class GameWindow; const Image *m_cursorBitmap; UnsignedInt m_captureFlags; -}; // end GameWindowManager +}; // INLINE ///////////////////////////////////////////////////////////////////////////////////////// inline GameWinDrawFunc GameWindowManager::getDefaultDraw( void ) { return GameWinDefaultDraw; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Image.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Image.h index 55297128015..148362dca40 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Image.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Image.h @@ -112,7 +112,7 @@ friend class ImageCollection; static const FieldParse m_imageFieldParseTable[]; ///< the parse table for INI definition -}; // end Image +}; //------------------------------------------------------------------------------------------------- /** A collection of images */ @@ -147,7 +147,7 @@ class ImageCollection : public SubsystemInterface protected: std::map m_imageMap; ///< maps named keys to images -}; // end ImageCollection +}; // INLINING /////////////////////////////////////////////////////////////////////////////////////// inline void Image::setName( AsciiString name ) { m_name = name; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/KeyDefs.h b/GeneralsMD/Code/GameEngine/Include/GameClient/KeyDefs.h index d706b909302..c767bb08152 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/KeyDefs.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/KeyDefs.h @@ -229,7 +229,7 @@ enum KeyDefType CPP_11(: Int) KEY_NONE = 0x00, ///< to report end of key stream KEY_LOST = 0xFF ///< to report lost keyboard focus -}; // end KeyDefType +}; // state for keyboard IO ------------------------------------------------------ enum @@ -252,7 +252,7 @@ enum KEY_STATE_SHIFT = (KEY_STATE_LSHIFT | KEY_STATE_RSHIFT | KEY_STATE_SHIFT2 ), KEY_STATE_ALT = (KEY_STATE_LALT | KEY_STATE_RALT) -}; // end KeyStateType +}; // INLINING /////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Keyboard.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Keyboard.h index 7961ac2fb80..692a0b06d6b 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Keyboard.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Keyboard.h @@ -79,7 +79,7 @@ struct KeyboardIO UnsignedShort state; // KEY_STATE_* in KeyDefs.h UnsignedInt sequence; // sequence info from DirectX used for order -}; // end KeyboardIO +}; // class Keyboard ============================================================= /** Keyboard singleton to interface with the keyboard */ @@ -162,7 +162,7 @@ class Keyboard : public SubsystemInterface } m_keyNames[ KEY_NAMES_COUNT ]; UnsignedInt m_inputFrame; ///< frame input was gathered on -}; // end Keyboard +}; // INLINING /////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h index 46f71a553b7..0571e81bdbf 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h @@ -422,7 +422,7 @@ class Mouse : public SubsystemInterface CursorCaptureMode m_cursorCaptureMode; CursorCaptureBlockReasonInt m_captureBlockReasonBits; -}; // end class Mouse +}; // TheSuperHackers @feature helmutbuhler 17/05/2025 // Mouse that does nothing. Used for Headless Mode. diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/RayEffect.h b/GeneralsMD/Code/GameEngine/Include/GameClient/RayEffect.h index 61a8b2e2a52..b3d192be9cf 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/RayEffect.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/RayEffect.h @@ -49,7 +49,7 @@ struct RayEffectData Coord3D startLoc; ///< start location for ray Coord3D endLoc; ///< end location for ray -}; // end RayEffectData +}; //------------------------------------------------------------------------------------------------- /** This class maintains all the ray effects visible in the world */ @@ -87,7 +87,7 @@ class RayEffectSystem : public SubsystemInterface }; RayEffectData m_effectData[ MAX_RAY_EFFECTS ]; ///< all the ray effects -}; // end RayEffectSystem +}; // EXTERN ///////////////////////////////////////////////////////////////////////////////////////// extern RayEffectSystem *TheRayEffects; ///< the ray effects singleton external diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Shell.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Shell.h index 75f0955c878..af1415f3f32 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Shell.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Shell.h @@ -200,7 +200,7 @@ class Shell : public SubsystemInterface WindowLayout *m_popupReplayLayout; ///< replay save menu layout WindowLayout *m_optionsLayout; ///< options menu layout -}; // end class Shell +}; // INLINING /////////////////////////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/TerrainVisual.h b/GeneralsMD/Code/GameEngine/Include/GameClient/TerrainVisual.h index 605e2b530ec..35db966f9c2 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/TerrainVisual.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/TerrainVisual.h @@ -318,7 +318,7 @@ class TerrainVisual : public Snapshot, AsciiString m_filenameString; ///< file with terrain data -}; // end class TerrainVisual +}; // EXTERNALS ////////////////////////////////////////////////////////////////////////////////////// extern TerrainVisual *TheTerrainVisual; ///< singleton extern diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/WindowLayout.h b/GeneralsMD/Code/GameEngine/Include/GameClient/WindowLayout.h index d4deebcfba0..7e1a14b1ae3 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/WindowLayout.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/WindowLayout.h @@ -107,7 +107,7 @@ class WindowLayout : public MemoryPoolObject WindowLayoutUpdateFunc m_update; ///< update callback WindowLayoutShutdownFunc m_shutdown; ///< shutdown callback -}; // end class WindowLayout +}; // INLINING /////////////////////////////////////////////////////////////////////////////////////// inline AsciiString WindowLayout::getFilename( void ) const { return m_filenameString; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h index 8a4a7ce2b98..d7ae01ca0bc 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h @@ -330,7 +330,7 @@ enum AttitudeType CPP_11(: Int) ATTITUDE_ALERT=1, ATTITUDE_AGGRESSIVE=2, ATTITUDE_INVALID=3 -}; ///< AI "attitude" behavior modifiers +}; enum CommandSourceType CPP_11(: Int); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h index d13589f54be..112adb8dc4e 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h @@ -77,7 +77,7 @@ class RailroadBehaviorModuleData : public PhysicsBehaviorModuleData p.add( dataFieldParse ); - } // end buildFieldParse + } TemplateNameList m_carriageTemplateNameData; AsciiString m_pathPrefixName; ///< prefix to use for waypont start and end points we'll look for diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h index 95f318bd843..70714d8f37d 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h @@ -812,7 +812,7 @@ class Object : public Thing, public Snapshot Bool m_singleUseCommandUsed; Bool m_isReceivingDifficultyBonus; -}; // end class Object +}; // deleteInstance is not meant to be used with Object in order to require the use of TheGameLogic->destroyObject() void deleteInstance(Object* object) CPP_11(= delete); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h index b0a167582ea..85035e86603 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h @@ -1535,7 +1535,7 @@ class PartitionManager : public SubsystemInterface, public Snapshot // If saveToFog is false, then we are writing STORE_PERMENANT_REVEAL void storeFoggedCells(ShroudStatusStoreRestore &outPartitionStore, Bool storeToFog) const; void restoreFoggedCells(const ShroudStatusStoreRestore &inPartitionStore, Bool restoreToFog); -}; // end class PartitionManager +}; // ----------------------------------------------------------------------------- inline void PartitionManager::worldToCell(Real wx, Real wy, Int *cx, Int *cy) diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptActions.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptActions.h index 86f8e8299b9..b3945e3e87a 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptActions.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptActions.h @@ -60,7 +60,7 @@ class ScriptActionsInterface : public SubsystemInterface // Called by the script engine in postProcessLoad() virtual void doEnableOrDisableObjectDifficultyBonuses(Bool enableBonuses) = 0; -}; // end class ScriptActionsInterface +}; extern ScriptActionsInterface *TheScriptActions; ///< singleton definition @@ -390,7 +390,7 @@ class ScriptActions : public ScriptActionsInterface void doNamedSetTrainHeld( const AsciiString &locoName, const Bool set ); void doEnableObjectSound(const AsciiString& objectName, Bool enable); -}; // end class ScriptActions +}; #endif // end __SCRIPTACTIONS_H_ diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptConditions.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptConditions.h index 34c36e5860f..e1a20f32888 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptConditions.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptConditions.h @@ -57,7 +57,7 @@ class ScriptConditionsInterface : public SubsystemInterface virtual Bool evaluateSkirmishCommandButtonIsReady( Parameter *pSkirmishPlayerParm, Parameter *pTeamParm, Parameter *pCommandButtonParm, Bool allReady ) = 0; virtual Bool evaluateTeamIsContained(Parameter *pTeamParm, Bool allContained) = 0; -}; // end class ScriptConditionsInterface +}; extern ScriptConditionsInterface *TheScriptConditions; ///< singleton definition @@ -187,7 +187,7 @@ class ScriptConditions : public ScriptConditionsInterface Bool evaluateMissionAttempts(Parameter *pPlayerParm, Parameter *pComparisonParm, Parameter *pAttemptsParm); -}; // end class ScriptConditions +}; #endif // end __SCRIPTCONDITIONS_H_ diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptEngine.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptEngine.h index e79ab1e713b..f70c7354486 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptEngine.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptEngine.h @@ -495,7 +495,7 @@ class ScriptEngine : public SubsystemInterface, #endif #endif -}; // end class ScriptEngine +}; extern ScriptEngine *TheScriptEngine; ///< singleton definition diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/TerrainLogic.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/TerrainLogic.h index 7c4afa09030..61fab68a5ca 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/TerrainLogic.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/TerrainLogic.h @@ -373,7 +373,7 @@ class TerrainLogic : public Snapshot, } m_waterToUpdate[ MAX_DYNAMIC_WATER ]; ///< water tables to dynamicall update Int m_numWaterToUpdate; ///< how many valid entries are in m_waterToUpdate -}; // end class TerrainLogic +}; // EXTERNALS ////////////////////////////////////////////////////////////////////////////////////// extern TerrainLogic *TheTerrainLogic; ///< singleton definition diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp index 5eca7f3218f..4b087c1c796 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp @@ -880,7 +880,7 @@ void GameEngine::init() resetSubsystems(); HideControlBar(); -} // end init +} /** ----------------------------------------------------------------------------------------------- * Reset all necessary parts of the game engine to be ready to accept new game data @@ -1037,7 +1037,7 @@ void GameEngine::update( void ) // for scripted camera movements while the time is frozen. TheScriptEngine->UPDATE(); } - } // end perfGather + } } // Horrible reference, but we really, really need to know if we are windowed. @@ -1116,8 +1116,8 @@ void GameEngine::execute( void ) { } RELEASE_CRASH(("Uncaught Exception in GameEngine::update")); - } // catch - } // perf + } + } { { @@ -1147,7 +1147,7 @@ void GameEngine::execute( void ) } } - } // perfgather for execute_loop + } #ifdef PERF_TIMERS if (!m_quitting && TheGameLogic->isInGame() && !TheGameLogic->isInShellGame() && !TheGameLogic->isGamePaused()) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp index f7f3fda6b65..8805ce5e4ba 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp @@ -290,10 +290,8 @@ void GameLODManager::init(void) if ((Real)(m_numRAM)/(Real)(256*1024*1024) >= PROFILE_ERROR_LIMIT) m_memPassed=TRUE; //check if they have at least 256 MB - //find data needed to determine m_idealDetailLevel if (m_idealDetailLevel == STATIC_GAME_LOD_UNKNOWN || TheGlobalData->m_forceBenchmark) { - //find equivalent CPU to unknown cpu. if (m_cpuType == XX || TheGlobalData->m_forceBenchmark) { //need to run the benchmark diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp index f5395312b0f..bc293fa0ee4 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp @@ -685,7 +685,7 @@ GlobalData::GlobalData() //Added By Sadullah Nader //Initializations missing and needed m_vertexWaterAvailableMaps[i].clear(); - } // end for i + } m_skyBoxPositionZ = 0.0f; m_drawSkyBox = FALSE; @@ -1051,7 +1051,7 @@ GlobalData::GlobalData() m_clientRetaliationModeEnabled = TRUE; //On by default. -} // end GlobalData +} //------------------------------------------------------------------------------------------------- @@ -1067,7 +1067,7 @@ GlobalData::~GlobalData( void ) TheWritableGlobalData = NULL; } -} // end ~GlobalData +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1115,7 +1115,7 @@ GlobalData *GlobalData::newOverride( void ) return override; -} // end newOveride +} //------------------------------------------------------------------------------------------------- void GlobalData::init( void ) @@ -1147,7 +1147,7 @@ void GlobalData::reset( void ) // set next as top TheWritableGlobalData = next; - } // end while + } // // we now have the one single global data in TheWritableGlobalData singleton, lets sanity check @@ -1156,7 +1156,7 @@ void GlobalData::reset( void ) DEBUG_ASSERTCRASH( TheWritableGlobalData->m_next == NULL, ("ResetGlobalData: theOriginal is not original") ); DEBUG_ASSERTCRASH( TheWritableGlobalData == GlobalData::m_theOriginal, ("ResetGlobalData: oops") ); -} // end ResetGlobalData +} //------------------------------------------------------------------------------------------------- /** Parse GameData entry */ @@ -1173,14 +1173,14 @@ void GlobalData::parseGameDataDefinition( INI* ini ) if( ini->getLoadType() == INI_LOAD_CREATE_OVERRIDES ) TheWritableGlobalData->newOverride(); - } // end if + } else if (!TheWritableGlobalData) { // we don't have any global data instance at all yet, create one TheWritableGlobalData = NEW GlobalData; - } // end else + } // If we're multifile, then continue loading stuff into the Global Data as normal. // parse the ini weapon definition diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp index 9433932ef36..23114c66752 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp @@ -195,14 +195,14 @@ INI::INI( void ) m_curBlockStart[0] = 0; #endif -} // end INI +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- INI::~INI( void ) { -} // end ~INI +} //------------------------------------------------------------------------------------------------- UnsignedInt INI::loadFileDirectory( AsciiString fileDirName, INILoadType loadType, Xfer *pXfer, Bool subdirs ) @@ -306,7 +306,7 @@ void INI::prepFile( AsciiString filename, INILoadType loadType ) DEBUG_CRASH(( "INI::load, cannot open file '%s', file already open", filename.str() )); throw INI_FILE_ALREADY_OPEN; - } // end if + } // open the file m_file = TheFileSystem->openFile(filename.str(), File::READ); @@ -316,7 +316,7 @@ void INI::prepFile( AsciiString filename, INILoadType loadType ) DEBUG_CRASH(( "INI::load, cannot open file '%s'", filename.str() )); throw INI_CANT_OPEN_FILE; - } // end if + } m_file = m_file->convertToRAMFile(); @@ -434,9 +434,9 @@ UnsignedInt INI::load( AsciiString filename, INILoadType loadType, Xfer *pXfer ) throw INI_UNKNOWN_TOKEN; } - } // end if + } - } // end while + } } catch (...) { @@ -513,7 +513,7 @@ void INI::readLine( void ) DEBUG_ASSERTCRASH( 0, ("Buffer too small (%d) and was truncated, increase INI_MAX_CHARS_PER_LINE", INI_MAX_CHARS_PER_LINE) ); - } // end if + } } if (s_xfer) @@ -857,7 +857,7 @@ void INI::parseAndTranslateLabel( INI* ini, void * /*instance*/, void *store, co UnicodeString *theString = (UnicodeString *)store; theString->set( translated.str() ); -} // end parseAndTranslateLabel +} //------------------------------------------------------------------------------------------------- /** Parse a string label assumed as an image as part of the image collection. Translate @@ -879,7 +879,7 @@ void INI::parseMappedImage( INI *ini, void * /*instance*/, void *store, const vo //else // throw INI_UNKNOWN_ERROR; -} // end parseMappedImage +} // ------------------------------------------------------------------------------------------------ /** Parse a string label assumed as a Anim2D template name. Translate that name to an @@ -893,16 +893,16 @@ void INI::parseMappedImage( INI *ini, void * /*instance*/, void *store, const vo { Anim2DTemplate **anim2DTemplate = (Anim2DTemplate **)store; *anim2DTemplate = TheAnim2DCollection->findTemplate( AsciiString( token ) ); - } // end if + } else { DEBUG_CRASH(( "INI::parseAnim2DTemplate - TheAnim2DCollection is NULL" )); throw INI_UNKNOWN_ERROR; - } // end else + } -} // end parseAnim2DTemplate +} //------------------------------------------------------------------------------------------------- /** Parse a percent in int or real form such as "23%" or "95.4%" and assign @@ -914,7 +914,7 @@ void INI::parsePercentToReal( INI* ini, void * /*instance*/, void *store, const Real *theReal = (Real *)store; *theReal = scanPercentToReal(token); -} // end parsePercentToReal +} //------------------------------------------------------------------------------------------------- /** 'store' points to an 32 bit unsigned integer. We will zero that integer, parse each token @@ -1083,7 +1083,7 @@ void INI::parseRGBAColorInt( INI* ini, void * /*instance*/, void *store, const v theColor->blue = colors[ 2 ]; theColor->alpha = colors[ 3 ]; -} // end parseRGBAColorInt +} //------------------------------------------------------------------------------------------------- /** Parse a color in the form of @@ -1132,7 +1132,7 @@ void INI::parseColorInt( INI* ini, void * /*instance*/, void *store, const void* Color *theColor = (Color *)store; *theColor = GameMakeColor(colors[0], colors[1], colors[2], colors[3]); -} // end parseColorInt +} //------------------------------------------------------------------------------------------------- /** Parse a 3D coordinate of reals in the form of: @@ -1146,7 +1146,7 @@ void INI::parseCoord3D( INI* ini, void * /*instance*/, void *store, const void* theCoord->y = scanReal(ini->getNextSubToken("Y")); theCoord->z = scanReal(ini->getNextSubToken("Z")); -} // end parseCoord3D +} //------------------------------------------------------------------------------------------------- /** Parse a 2D coordinate of reals in the form of: @@ -1159,7 +1159,7 @@ void INI::parseCoord2D( INI* ini, void * /*instance*/, void *store, const void* theCoord->x = scanReal(ini->getNextSubToken("X")); theCoord->y = scanReal(ini->getNextSubToken("Y")); -} // end parseCoord2D +} //------------------------------------------------------------------------------------------------- /** Parse a 2D coordinate of Ints in the form of: @@ -1172,7 +1172,7 @@ void INI::parseICoord2D( INI* ini, void * /*instance*/, void *store, const void* theCoord->x = scanInt(ini->getNextSubToken("X")); theCoord->y = scanInt(ini->getNextSubToken("Y")); -} // end parseICoord2D +} //------------------------------------------------------------------------------------------------- /** Parse an audio event and assign to the 'AudioEventRTS*' at store */ @@ -1319,7 +1319,7 @@ void INI::parseParticleSystemTemplate( INI *ini, void * /*instance*/, void *stor *theParticleSystemTemplate = pSystemT; -} // end parseParticleSystemTemplate +} //------------------------------------------------------------------------------------------------- /** Parse an DamageFX and assign to the 'DamageFX *' at store */ @@ -1570,9 +1570,9 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList INI::getLineNum(), INI::getFilename().str(), field, m_curBlockStart) ); } - } // end else + } - } // end if + } // sanity check for reaching end of file with no closing end token if( done == FALSE && INI::isEOF() == TRUE ) @@ -1583,9 +1583,9 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList m_curBlockStart, getFilename().str(), m_blockEndToken) ); throw INI_MISSING_END_TOKEN; - } // end if + } - } // end while + } } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIAnimation.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIAnimation.cpp index ec685b6107c..1755732b028 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIAnimation.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIAnimation.cpp @@ -56,7 +56,7 @@ void INI::parseAnim2DDefinition( INI* ini ) //We don't need it if we're in the builder... which doesn't have this. return; - } // end if + } // find existing animation template if present animTemplate = TheAnim2DCollection->findTemplate( name ); @@ -68,7 +68,7 @@ void INI::parseAnim2DDefinition( INI* ini ) DEBUG_ASSERTCRASH( animTemplate, ("INI""parseAnim2DDefinition - unable to allocate animation template for '%s'", name.str()) ); - } // end if + } else { @@ -77,12 +77,12 @@ void INI::parseAnim2DDefinition( INI* ini ) animTemplate->getName().str() )); return; - } // end else + } // parse the ini definition ini->initFromINI( animTemplate, animTemplate->getFieldParse() ); -} // end parseAnim2DDefinition +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandButton.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandButton.cpp index 04c0b8ce063..cec366418b4 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandButton.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandButton.cpp @@ -61,7 +61,7 @@ void ControlBar::parseCommandButtonDefinition( INI *ini ) { button->markAsOverride(); } - } // end if + } else if( ini->getLoadType() != INI_LOAD_CREATE_OVERRIDES ) { DEBUG_CRASH(( "[LINE: %d in '%s'] Duplicate commandbutton %s found!", ini->getLineNum(), ini->getFilename().str(), name.str() )); @@ -89,6 +89,6 @@ void ControlBar::parseCommandButtonDefinition( INI *ini ) ini->getLineNum(), ini->getFilename().str(), name.str() ) ); } -} // end parseCommandButtonDefinition +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandSet.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandSet.cpp index 9d8a3584dfc..2f507b65fea 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandSet.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandSet.cpp @@ -40,4 +40,4 @@ void INI::parseCommandSetDefinition( INI *ini ) { ControlBar::parseCommandSetDefinition(ini); -} // end parseCommandSetDefinition +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIControlBarScheme.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIControlBarScheme.cpp index 130d13c437c..1269aa5bcaf 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIControlBarScheme.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIControlBarScheme.cpp @@ -96,6 +96,6 @@ void INI::parseControlBarSchemeDefinition( INI *ini ) // parse the ini definition ini->initFromINI( CBScheme, CBSchemeManager->getFieldParse() ); -} // end parseCommandButtonDefinition +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMapData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMapData.cpp index 51abd28b078..fdb05cc0f99 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMapData.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMapData.cpp @@ -45,6 +45,6 @@ //------------------------------------------------------------------------------------------------- void INI::parseMapDataDefinition( INI* ini ) { -} // end parseMapData +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp index a092b4c5c58..518630aef37 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp @@ -72,9 +72,9 @@ void INI::parseMappedImageDefinition( INI* ini ) DEBUG_ASSERTCRASH( image, ("parseMappedImage: unable to allocate image for '%s'", name.str()) ); - } // end if + } // parse the ini definition ini->initFromINI( image, image->getFieldParse()); -} // end parseMappedImage +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp index 53f184b8e66..dd10ef26d47 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp @@ -45,12 +45,12 @@ void INI::parseMultiplayerSettingsDefinition( INI* ini ) { DEBUG_ASSERTCRASH(false, ("Creating an override of MultiplayerSettings!")); } - } // end if + } else { // we don't have any multiplayer settings instance at all yet, create one TheMultiplayerSettings = NEW MultiplayerSettings; - } // end else + } // parse the ini definition ini->initFromINI( TheMultiplayerSettings, TheMultiplayerSettings->getFieldParse() ); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrain.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrain.cpp index 7bdec7c1497..c8fef092729 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrain.cpp @@ -56,7 +56,7 @@ void INI::parseTerrainDefinition( INI* ini ) // parse the ini definition ini->initFromINI( terrainType, terrainType->getFieldParse() ); -} // end parseTerrain +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp index f5339656d94..831690a8085 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp @@ -57,7 +57,7 @@ void INI::parseTerrainBridgeDefinition( INI* ini ) bridge->getName().str()) ); throw INI_INVALID_DATA; - } // end if + } if( bridge == NULL ) bridge = TheTerrainRoads->newBridge( name ); @@ -67,7 +67,7 @@ void INI::parseTerrainBridgeDefinition( INI* ini ) // parse the ini definition ini->initFromINI( bridge, bridge->getBridgeFieldParse() ); -} // end parseTerrainBridge +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrainRoad.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrainRoad.cpp index 81c8f288bb6..ca4122fb72f 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrainRoad.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrainRoad.cpp @@ -57,7 +57,7 @@ void INI::parseTerrainRoadDefinition( INI* ini ) road->getName().str()) ); throw INI_INVALID_DATA; - } // end if + } if( road == NULL ) road = TheTerrainRoads->newRoad( name ); @@ -67,7 +67,7 @@ void INI::parseTerrainRoadDefinition( INI* ini ) // parse the ini definition ini->initFromINI( road, road->getRoadFieldParse() ); -} // end parseTerrainRoad +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIWater.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIWater.cpp index 6dc192cd97e..ba248f8d58a 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIWater.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIWater.cpp @@ -68,13 +68,13 @@ void INI::parseWaterSettingDefinition( INI* ini ) waterSetting = &WaterSettings[ timeOfDayIndex ]; break; - } // end if + } // next name timeOfDayName++; timeOfDayIndex++; - } // end while + } // check for no time of day match if( waterSetting == NULL ) @@ -83,7 +83,7 @@ void INI::parseWaterSettingDefinition( INI* ini ) // parse the data ini->initFromINI( waterSetting, waterSetting->getFieldParse() ); -} // end parseWaterSetting +} //------------------------------------------------------------------------------------------------- void INI::parseWaterTransparencyDefinition( INI *ini ) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIWebpageURL.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIWebpageURL.cpp index 81cc5bae458..668b0721e2e 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIWebpageURL.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIWebpageURL.cpp @@ -118,6 +118,6 @@ void INI::parseWebpageURLDefinition( INI* ini ) url->m_url.format("file://%s\\Data\\%s\\%s", encodeURL(cwd).str(), GetRegistryLanguage().str(), url->m_url.str()+7); DEBUG_LOG(("INI::parseWebpageURLDefinition() - converted URL to [%s]", url->m_url.str())); } -} // end parseMusicTrackDefinition +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/MultiplayerSettings.cpp b/GeneralsMD/Code/GameEngine/Source/Common/MultiplayerSettings.cpp index 4c99b5f7829..98d64cea3aa 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/MultiplayerSettings.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/MultiplayerSettings.cpp @@ -85,7 +85,7 @@ MultiplayerSettings::MultiplayerSettings() m_randomColor; m_gotDefaultStartingMoney = false; -} // end MultiplayerSettings +} MultiplayerColorDefinition::MultiplayerColorDefinition() { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/NameKeyGenerator.cpp b/GeneralsMD/Code/GameEngine/Source/Common/NameKeyGenerator.cpp index 9d800933f55..35c55784cd1 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/NameKeyGenerator.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/NameKeyGenerator.cpp @@ -42,7 +42,7 @@ NameKeyGenerator::NameKeyGenerator() for (Int i = 0; i < SOCKET_COUNT; ++i) m_sockets[i] = NULL; -} // end NameKeyGenerator +} //------------------------------------------------------------------------------------------------- NameKeyGenerator::~NameKeyGenerator() @@ -51,7 +51,7 @@ NameKeyGenerator::~NameKeyGenerator() // free all system data freeSockets(); -} // end ~NameKeyGenerator +} //------------------------------------------------------------------------------------------------- void NameKeyGenerator::init() @@ -62,7 +62,7 @@ void NameKeyGenerator::init() freeSockets(); m_nextID = 1; -} // end init +} //------------------------------------------------------------------------------------------------- void NameKeyGenerator::reset() @@ -70,7 +70,7 @@ void NameKeyGenerator::reset() freeSockets(); m_nextID = 1; -} // end reset +} //------------------------------------------------------------------------------------------------- void NameKeyGenerator::freeSockets() @@ -86,7 +86,7 @@ void NameKeyGenerator::freeSockets() m_sockets[i] = NULL; } -} // end freeSockets +} /* ------------------------------------------------------------------------ */ inline UnsignedInt calcHashForString(const char* p) @@ -209,7 +209,7 @@ NameKeyType NameKeyGenerator::nameToKeyImpl(const char* nameString) return result; -} // end nameToKey +} //------------------------------------------------------------------------------------------------- NameKeyType NameKeyGenerator::nameToLowercaseKeyImpl(const char* nameString) @@ -257,7 +257,7 @@ NameKeyType NameKeyGenerator::nameToLowercaseKeyImpl(const char* nameString) return result; -} // end nameToLowercaseKey +} //------------------------------------------------------------------------------------------------- // Get a string out of the INI. Store it into a NameKeyType diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/AcademyStats.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/AcademyStats.cpp index d88f8d243b4..87f9ec98241 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/AcademyStats.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/AcademyStats.cpp @@ -1106,7 +1106,7 @@ Bool AcademyStats::calculateAcademyAdvice( AcademyAdviceInfo *info ) void AcademyStats::crc( Xfer *xfer ) { -} // end crc +} //------------------------------------------------------------------------------------------------ /** Xfer method @@ -1253,7 +1253,7 @@ void AcademyStats::xfer( Xfer *xfer ) //35) Did the player ever create a "Firestorm" with his MiGs or Inferno Cannons? xfer->xferUnsignedInt( &m_firestormsCreated ); -} // end xfer +} //------------------------------------------------------------------------------------------------ // Load post process @@ -1261,4 +1261,4 @@ void AcademyStats::xfer( Xfer *xfer ) void AcademyStats::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp index b9ff31c1b31..74b66f8e236 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp @@ -127,14 +127,14 @@ static Bool isObjectShroudedForAction ( const Object *source, const Object *targ ActionManager::ActionManager( void ) { -} // end ActionManager +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ ActionManager::~ActionManager( void ) { -} // end ~ActionManager +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -198,7 +198,7 @@ Bool ActionManager::canGetRepairedAt( const Object *obj, const Object *repairDes // all is well, we can be repaired here return TRUE; -} // end canGetRepairedAt +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -314,12 +314,12 @@ Bool ActionManager::canDockAt( const Object *obj, const Object *dockDest, Comman if( obj->isKindOf( KINDOF_VEHICLE ) || obj->isKindOf( KINDOF_INFANTRY ) ) return TRUE; - } // end if + } // cannot dock return FALSE; -} // end canDockAt +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -371,7 +371,7 @@ Bool ActionManager::canGetHealedAt( const Object *obj, const Object *healDest, C // all is well, we can be healed here return TRUE; -} // end canGetHealedAt +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -440,7 +440,7 @@ Bool ActionManager::canRepairObject( const Object *obj, const Object *objectToRe return TRUE; -} // end canRepair +} // ------------------------------------------------------------------------------------------------ /** Can 'obj' resume the construction of 'objectBeingConstructed' */ @@ -497,11 +497,11 @@ Bool ActionManager::canResumeConstructionOf( const Object *obj, dozerAI->getTaskTarget( DOZER_TASK_BUILD ) == objectBeingConstructed->getID() ) return FALSE; - } // end if + } - } // en dif + } - } //end if + } // if the target is in the shroud, we can't do anything if (isObjectShroudedForAction(obj, objectBeingConstructed, commandSource)) @@ -514,7 +514,7 @@ Bool ActionManager::canResumeConstructionOf( const Object *obj, return TRUE; -} // end canResumeConstructionOf +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1211,7 +1211,7 @@ Bool ActionManager::canPickUpPrisoner( const Object *obj, const Object *prisoner return TRUE; -} // end canPickUpPrisoner +} #endif // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Energy.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Energy.cpp index c7c11f03d36..f2018319870 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Energy.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Energy.cpp @@ -149,7 +149,7 @@ void Energy::objectEnteringInfluence( Object *obj ) ("Energy - Negative Energy numbers, Produce=%d Consume=%d\n", m_energyProduction, m_energyConsumption) ); -} // end objectEnteringInfluence +} //------------------------------------------------------------------------------------------------- /** 'obj' will now no longer add/subtrack from this energy construct */ @@ -214,7 +214,7 @@ void Energy::removePowerBonus( Object *obj ) ("Energy - Negative Energy numbers, Produce=%d Consume=%d\n", m_energyProduction, m_energyConsumption) ); -} // end removePowerBonus +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -249,7 +249,7 @@ void Energy::addConsumption(Int amt) void Energy::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -288,7 +288,7 @@ void Energy::xfer( Xfer *xfer ) xfer->xferUnsignedInt( &m_powerSabotagedTillFrame ); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -296,4 +296,4 @@ void Energy::xfer( Xfer *xfer ) void Energy::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/MissionStats.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/MissionStats.cpp index 7ae87125e0b..6ac4fbe6676 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/MissionStats.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/MissionStats.cpp @@ -75,7 +75,7 @@ void MissionStats::init() void MissionStats::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -102,7 +102,7 @@ void MissionStats::xfer( Xfer *xfer ) // buildings lost xfer->xferInt( &m_buildingsLost ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -110,4 +110,4 @@ void MissionStats::xfer( Xfer *xfer ) void MissionStats::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Money.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Money.cpp index 8a45812ecc7..6bcd991d5e3 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Money.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Money.cpp @@ -120,7 +120,7 @@ void Money::triggerAudioEvent(const AudioEventRTS& audioEvent) void Money::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -138,7 +138,7 @@ void Money::xfer( Xfer *xfer ) // money value xfer->xferUnsignedInt( &m_money ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -146,7 +146,7 @@ void Money::xfer( Xfer *xfer ) void Money::loadPostProcess( void ) { -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp index 802eab0066d..d6c845ffad4 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp @@ -205,7 +205,7 @@ void dumpBattlePlanBonuses(const BattlePlanBonuses *b, AsciiString name, const P PlayerRelationMap::PlayerRelationMap( void ) { -} // end PlayerRelationMap +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -215,7 +215,7 @@ PlayerRelationMap::~PlayerRelationMap( void ) // make sure the data is cleared m_map.clear(); -} // end ~PlayerRelationmap +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -223,7 +223,7 @@ PlayerRelationMap::~PlayerRelationMap( void ) void PlayerRelationMap::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -262,9 +262,9 @@ void PlayerRelationMap::xfer( Xfer *xfer ) r = (*playerRelationIt).second; xfer->xferUser( &r, sizeof( Relationship ) ); - } // end for, playerRelationIt + } - } // end if, save + } else { @@ -280,11 +280,11 @@ void PlayerRelationMap::xfer( Xfer *xfer ) // assign relationship m_map[ playerIndex ] = r; - } // end for, i + } - } // end else, load + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -292,7 +292,7 @@ void PlayerRelationMap::xfer( Xfer *xfer ) void PlayerRelationMap::loadPostProcess( void ) { -} // end loadPostProcess +} //============================================================================= Player::Player( Int playerIndex ) @@ -1015,7 +1015,7 @@ void Player::becomingTeamMember(Object *obj, Bool yes) if( !obj->getStatusBits().test( OBJECT_STATUS_UNDER_CONSTRUCTION ) ) { obj->friend_adjustPowerForPlayer(yes); - } // end if + } // when we capture a building, we need to see if there's an AutoDepositUpdate hooked to it, // if so, award the cash bonus @@ -1548,7 +1548,7 @@ void Player::onUnitCreated( Object *factory, Object *unit ) // ai notification callback if( m_ai ) m_ai->onUnitProduced( factory, unit ); -} // end onUnitCreated +} //------------------------------------------------------------------------------------------------- @@ -1560,7 +1560,7 @@ Bool Player::isSupplySourceSafe( Int minSupplies ) if( m_ai ) return m_ai->isSupplySourceSafe( minSupplies ); return true; -} // isSupplySourceSafe +} //------------------------------------------------------------------------------------------------- /** Is a supply source attacked? */ @@ -1571,7 +1571,7 @@ Bool Player::isSupplySourceAttacked( void ) if( m_ai ) return m_ai->isSupplySourceAttacked( ); return false; -} // isSupplySourceSafe +} //------------------------------------------------------------------------------------------------- /** Set delay between team production */ @@ -1581,7 +1581,7 @@ void Player::setTeamDelaySeconds(Int delay ) // ai action if( m_ai ) m_ai->setTeamDelaySeconds( delay ); -} // guardSupplyCenter +} //------------------------------------------------------------------------------------------------- /** Guard supply center */ @@ -1591,7 +1591,7 @@ void Player::guardSupplyCenter( Team *team, Int minSupplies ) // ai action if( m_ai ) m_ai->guardSupplyCenter( team, minSupplies ); -} // guardSupplyCenter +} //------------------------------------------------------------------------------------------------- /** A team is about to be destroyed */ @@ -1605,7 +1605,7 @@ void Player::preTeamDestroy( const Team *team ) // TheSuperHackers @bugfix Mauller/Xezon 03/05/2025 Clear the default team to prevent dangling pointer usage if( m_defaultTeam == team ) m_defaultTeam = NULL; -} // preTeamDestroy +} //------------------------------------------------------------------------------------------------- /// a structuer was just created, but is under construction @@ -1613,7 +1613,7 @@ void Player::preTeamDestroy( const Team *team ) void Player::onStructureCreated( Object *builder, Object *structure ) { -} // end onStructureCreated +} //------------------------------------------------------------------------------------------------- /// a structure that was under construction has become completed @@ -1702,13 +1702,13 @@ void Player::onStructureConstructionComplete( Object *builder, Object *structure TheEva->setShouldPlay(EVA_SuperweaponDetected_Enemy_ScudStorm); } } -} // end onStructureConstructionComplete +} //============================================================================= void Player::onStructureUndone(Object *structure) { m_scoreKeeper.removeObjectBuilt(structure); -} // end onStructureUndone +} //============================================================================= void Player::addTeamToList(TeamPrototype* team) @@ -2853,9 +2853,9 @@ static void countExisting( Object *obj, void *userData ) { // add the count of this type that are in the queue typeCountData->count += pui->countUnitTypeInQueue( typeCountData->type ); - } // end if + } } -} // end countInProduction +} //============================================================================= // Make sure that building another of this unit/structure/object won't exceed MaxSimultaneousOfType() @@ -2956,13 +2956,13 @@ void Player::deleteUpgradeList( void ) deleteInstance(m_upgradeList); m_upgradeList = next; - } // end while + } // This doesn't call removeUpgrade, so clear these ourselves. m_upgradesInProgress.clear(); m_upgradesCompleted.clear(); -} // end deleteUpgradeList +} //================================================================================================= /** Find an upgrade in our list of upgrades with matching name key */ @@ -2977,7 +2977,7 @@ Upgrade *Player::findUpgrade( const UpgradeTemplate *upgradeTemplate ) return NULL; -} // end findUpgrade +} //================================================================================================= /** Does the player have this completed upgrade */ @@ -3028,7 +3028,7 @@ Upgrade *Player::addUpgrade( const UpgradeTemplate *upgradeTemplate, UpgradeStat m_upgradeList->friend_setPrev( u ); m_upgradeList = u; - } // end if + } // set the new status for the upgrade u->setStatus( status ); @@ -3053,7 +3053,7 @@ Upgrade *Player::addUpgrade( const UpgradeTemplate *upgradeTemplate, UpgradeStat return u; -} // end addUpgrade +} //================================================================================================= /** @@ -3117,9 +3117,9 @@ void Player::removeUpgrade( const UpgradeTemplate *upgradeTemplate ) TheControlBar->markUIDirty(); } - } // end if + } -} // end removeUpgrade +} //------------------------------------------------------------------------------------------------- @@ -3154,7 +3154,7 @@ void Player::addRadar( Bool disableProof ) soundToPlay.setPlayerIndex(getPlayerIndex()); TheAudio->addAudioEvent(&soundToPlay); } -} // end addRadar +} //------------------------------------------------------------------------------------------------- /** The parameter object has is taking its radar away from the player */ @@ -3177,7 +3177,7 @@ void Player::removeRadar( Bool disableProof ) soundToPlay.setPlayerIndex(getPlayerIndex()); TheAudio->addAudioEvent(&soundToPlay); } -} // end removeRadar +} //------------------------------------------------------------------------------------------------- void Player::disableRadar() @@ -3938,7 +3938,7 @@ Bool Player::isPlayableSide( void ) const return m_playerTemplate ? m_playerTemplate->isPlayableSide() : FALSE; -} // end isPlayableSide +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -3964,7 +3964,7 @@ void Player::crc( Xfer *xfer ) xfer->xferInt( &m_skillPoints ); xfer->xferInt( &m_sciencePurchasePoints ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -4024,9 +4024,9 @@ void Player::xfer( Xfer *xfer ) // xfer upgrade data xfer->xferSnapshot( upgrade ); - } // end for, upgrade + } - } // end if, save + } else { const UpgradeTemplate *upgradeTemplate; @@ -4047,7 +4047,7 @@ void Player::xfer( Xfer *xfer ) DEBUG_CRASH(( "Player::xfer - Unable to find upgrade '%s'", upgradeName.str() )); throw SC_INVALID_DATA; - } // end if + } // add upgrade to player, the status is invalid, but that's OK cause we're about to xfer it upgrade = addUpgrade( upgradeTemplate, UPGRADE_STATUS_INVALID ); @@ -4055,9 +4055,9 @@ void Player::xfer( Xfer *xfer ) // xfer upgrade data xfer->xferSnapshot( upgrade ); - } // end for, i + } - } // end else, load + } // radar info xfer->xferInt( &m_radarCount ); @@ -4093,9 +4093,9 @@ void Player::xfer( Xfer *xfer ) prototypeID = prototype->getID(); xfer->xferUser( &prototypeID, sizeof( TeamPrototypeID ) ); - } // end for + } - } // end if, save + } else { @@ -4119,14 +4119,14 @@ void Player::xfer( Xfer *xfer ) DEBUG_CRASH(( "Player::xfer - Unable to find team prototype by id" )); throw SC_INVALID_DATA; - } // end if + } // put in list m_playerTeamPrototypes.push_back( prototype ); - } // end for, i + } - } // end else, load + } // build list info UnsignedShort buildListInfoCount = 0; @@ -4141,7 +4141,7 @@ void Player::xfer( Xfer *xfer ) for( buildListInfo = m_pBuildList; buildListInfo; buildListInfo = buildListInfo->getNext() ) xfer->xferSnapshot( buildListInfo ); - } // end if, save + } else { @@ -4172,14 +4172,14 @@ void Player::xfer( Xfer *xfer ) last->setNextBuildList( buildListInfo ); - } // end else + } // xfer data xfer->xferSnapshot( buildListInfo ); - } // end for,i + } - } // end else, load + } // ai player data Bool aiPlayerPresent = m_ai ? TRUE : FALSE; @@ -4190,7 +4190,7 @@ void Player::xfer( Xfer *xfer ) DEBUG_CRASH(( "Player::xfer - m_ai present/missing mismatch" )); throw SC_INVALID_DATA;; - } // end if + } if( m_ai ) xfer->xferSnapshot( m_ai ); @@ -4204,7 +4204,7 @@ void Player::xfer( Xfer *xfer ) DEBUG_CRASH(( "Player::xfer - m_resourceGatheringManager present/missing mismatch" )); throw SC_INVALID_DATA; - } // end if + } if( m_resourceGatheringManager ) xfer->xferSnapshot( m_resourceGatheringManager ); @@ -4218,7 +4218,7 @@ void Player::xfer( Xfer *xfer ) DEBUG_CRASH(( "Player::xfer - m_tunnelSystem present/missing mismatch" )); throw SC_INVALID_DATA; - } // end if + } if( m_tunnelSystem ) xfer->xferSnapshot( m_tunnelSystem ); @@ -4357,9 +4357,9 @@ void Player::xfer( Xfer *xfer ) // ref xfer->xferUnsignedInt( &entry->m_ref ); - } // end for + } - } // end if, save + } else { @@ -4370,7 +4370,7 @@ void Player::xfer( Xfer *xfer ) DEBUG_CRASH(( "Player::xfer - m_kindOfPercentProductionChangeList should be empty but is not" )); throw SC_INVALID_DATA; - } // end if + } // read each entry for( UnsignedInt i = 0; i < percentProductionChangeCount; ++i ) @@ -4387,9 +4387,9 @@ void Player::xfer( Xfer *xfer ) // put at end of list m_kindOfPercentProductionChangeList.push_back( entry ); - } // end for i + } - } // end else, load + } @@ -4421,7 +4421,7 @@ void Player::xfer( Xfer *xfer ) { DEBUG_CRASH(( "Player::xfer - m_specialPowerReadyTimerList should be empty but is not" )); throw SC_INVALID_DATA; - } // end if + } // read each entry for( UnsignedInt i = 0; i < timerListSize; ++i ) @@ -4435,7 +4435,7 @@ void Player::xfer( Xfer *xfer ) // put at end of list m_specialPowerReadyTimerList.push_back( timer ); - } // end for i + } } } /////////////////////////////////////////////////////////////////////////// @@ -4452,7 +4452,7 @@ void Player::xfer( Xfer *xfer ) DEBUG_CRASH(( "Player::xfer - size of m_squadCount array has changed" )); throw SC_INVALID_DATA; - } // end if + } for( UnsignedShort i = 0; i < squadCount; ++i ) { @@ -4462,11 +4462,11 @@ void Player::xfer( Xfer *xfer ) DEBUG_CRASH(( "Player::xfer - NULL squad at index '%d'", i )); throw SC_INVALID_DATA; - } // end if + } xfer->xferSnapshot( m_squads[ i ] ); - } // end for, i + } // current squad selection Bool currentSelectionPresent = m_currentSelection ? TRUE : FALSE; @@ -4481,7 +4481,7 @@ void Player::xfer( Xfer *xfer ) // xfer xfer->xferSnapshot( m_currentSelection ); - } // end if + } // Player battle plan bonuses Bool battlePlanBonus = m_battlePlanBonuses != NULL; @@ -4517,7 +4517,7 @@ void Player::xfer( Xfer *xfer ) else m_unitsShouldHunt = FALSE; -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -4525,5 +4525,5 @@ void Player::xfer( Xfer *xfer ) void Player::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerList.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerList.cpp index 5fe06306985..4be04735eff 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerList.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerList.cpp @@ -249,7 +249,7 @@ void PlayerList::update() for( Int i = 0; i < MAX_PLAYER_COUNT; i++ ) { m_players[i]->update(); - } // end for i + } } @@ -260,7 +260,7 @@ void PlayerList::newMap() for( Int i = 0; i < MAX_PLAYER_COUNT; i++ ) { m_players[i]->newMap(); - } // end for i + } } @@ -280,7 +280,7 @@ void PlayerList::updateTeamStates(void) for( Int i = 0; i < MAX_PLAYER_COUNT; i++ ) { m_players[i]->updateTeamStates(); - } // end for i + } } //----------------------------------------------------------------------------- @@ -354,12 +354,12 @@ Player *PlayerList::getPlayerFromMask( PlayerMaskType mask ) if( player && player->getPlayerMask() == mask ) return player; - } // end for i + } DEBUG_CRASH( ("Player does not exist for mask") ); return NULL; // mask not found -} // end getPlayerFromMask +} //----------------------------------------------------------------------------- Player *PlayerList::getEachPlayerFromMask( PlayerMaskType& maskToAdjust ) @@ -376,7 +376,7 @@ Player *PlayerList::getEachPlayerFromMask( PlayerMaskType& maskToAdjust ) maskToAdjust &= (~player->getPlayerMask()); return player; } - } // end for i + } DEBUG_CRASH( ("No players found that contain any matching masks.") ); maskToAdjust = 0; @@ -466,13 +466,13 @@ void PlayerList::xfer( Xfer *xfer ) DEBUG_CRASH(( "Invalid player count '%d', should be '%d'", playerCount, m_playerCount )); throw SC_INVALID_DATA; - } // end if + } // xfer each of the player data for( Int i = 0; i < playerCount; ++i ) xfer->xferSnapshot( m_players[ i ] ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -480,5 +480,5 @@ void PlayerList::xfer( Xfer *xfer ) void PlayerList::loadPostProcess( void ) { -} // end postProcessLoad +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp index 3fe64a90889..9c96bf7fec9 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp @@ -183,7 +183,7 @@ AsciiString PlayerTemplate::getStartingUnit( Int i ) const theMoney->init(); theMoney->deposit( money ); -} // end parseStartMoney +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp index 46cb5e7b7d1..0d5f3176f1e 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp @@ -200,7 +200,7 @@ void ProductionPrerequisite::addUnitPrereq( AsciiString unit, Bool orUnitWithPre info.unit = NULL; m_prereqUnits.push_back(info); -} // end addUnitPrereq +} //------------------------------------------------------------------------------------------------- /** Add a unit prerequisite, if 'orWithPrevious' is set then this unit is said @@ -217,7 +217,7 @@ void ProductionPrerequisite::addUnitPrereq( const std::vector& unit orWithPrevious = true; } -} // end addUnitPrereq +} //------------------------------------------------------------------------------------------------- // returns an asciistring which is a list of all the prerequisites diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp index 089e9b8f360..9686ec1dd58 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp @@ -258,7 +258,7 @@ Object *ResourceGatheringManager::findBestSupplyCenter( Object *queryObject ) void ResourceGatheringManager::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -279,7 +279,7 @@ void ResourceGatheringManager::xfer( Xfer *xfer ) // supply centers xfer->xferSTLObjectIDList( &m_supplyCenters ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -287,5 +287,5 @@ void ResourceGatheringManager::xfer( Xfer *xfer ) void ResourceGatheringManager::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp index 83928210186..8b338eea4e4 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp @@ -399,7 +399,7 @@ Int ScoreKeeper::getTotalUnitsDestroyed( void ) void ScoreKeeper::crc( Xfer *xfer ) { -} // end ScoreKeeper +} // ------------------------------------------------------------------------------------------------ /** Xfer of an object count map @@ -416,7 +416,7 @@ void ScoreKeeper::xferObjectCountMap( Xfer *xfer, ObjectCountMap *map ) DEBUG_CRASH(( "xferObjectCountMap - Invalid map parameter" )); throw SC_INVALID_DATA; - } // end if + } // version info XferVersion currentVersion = 1; @@ -448,9 +448,9 @@ void ScoreKeeper::xferObjectCountMap( Xfer *xfer, ObjectCountMap *map ) count = it->second; xfer->xferInt( &count ); - } // end for, it + } - } // end if, save + } else { @@ -467,7 +467,7 @@ void ScoreKeeper::xferObjectCountMap( Xfer *xfer, ObjectCountMap *map ) DEBUG_CRASH(( "xferObjectCountMap - Unknown thing template '%s'", thingTemplateName.str() )); throw SC_INVALID_DATA; - } // end if + } // read count xfer->xferInt( &count ); @@ -475,11 +475,11 @@ void ScoreKeeper::xferObjectCountMap( Xfer *xfer, ObjectCountMap *map ) // add to map (*map)[ thingTemplate ] = count; - } // end for, i + } - } // end else + } -} // end xferObjectCountMap +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -542,14 +542,14 @@ void ScoreKeeper::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScoreKeeper::xfer - size of objects destroyed array has changed" )); throw SC_INVALID_DATA; - } // end if + } for( UnsignedShort i = 0; i < destroyedArraySize; ++i ) { // xfer map data xferObjectCountMap( xfer, &m_objectsDestroyed[ i ] ); - } // end for i + } // objects lost xferObjectCountMap( xfer, &m_objectsLost ); @@ -557,7 +557,7 @@ void ScoreKeeper::xfer( Xfer *xfer ) // objects captured xferObjectCountMap( xfer, &m_objectsCaptured ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -565,4 +565,4 @@ void ScoreKeeper::xfer( Xfer *xfer ) void ScoreKeeper::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp index 1be9ef2dbed..22a61ce66f7 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp @@ -223,14 +223,14 @@ SpecialPowerTemplate::SpecialPowerTemplate() m_radiusCursorRadius = 0; m_shortcutPower = FALSE; -} // end SpecialPowerTemplate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- SpecialPowerTemplate::~SpecialPowerTemplate() { -} // end ~SpecialPowerTemplate +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -243,7 +243,7 @@ SpecialPowerStore::SpecialPowerStore( void ) m_nextSpecialPowerID = 0; -} // end SpecialPowerStore +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -260,7 +260,7 @@ SpecialPowerStore::~SpecialPowerStore( void ) // set our count to zero m_nextSpecialPowerID = 0; -} // end ~SpecialPowerStore +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -302,7 +302,7 @@ const SpecialPowerTemplate *SpecialPowerStore::getSpecialPowerTemplateByIndex( U return NULL; // not found -} // end getSpecialPowerTemplateByIndex +} //------------------------------------------------------------------------------------------------- /** Return the size of the store (WB) */ @@ -312,7 +312,7 @@ Int SpecialPowerStore::getNumSpecialPowers( void ) return m_specialPowerTemplates.size(); -} // end getNumSpecialPowers +} //------------------------------------------------------------------------------------------------- /** does the object (and therefore the player) meet all the requirements to use this power */ @@ -345,7 +345,7 @@ Bool SpecialPowerStore::canUseSpecialPower( Object *obj, const SpecialPowerTempl if( player->hasScience( requiredScience ) == FALSE ) return FALSE; - } // end if + } // I THINK THIS IS WHERE WE BAIL OUT IF A DIFFERENT CONYARD IS ALREADY CHARGIN THIS SPECIAL RIGHT NOW //LORENZEN @@ -354,7 +354,7 @@ Bool SpecialPowerStore::canUseSpecialPower( Object *obj, const SpecialPowerTempl // all is well return TRUE; -} // end canUseSpecialPower +} //------------------------------------------------------------------------------------------------- /** Reset */ @@ -374,4 +374,4 @@ void SpecialPowerStore::reset( void ) ++it; } } -} // end reset +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp index 42e9214f3ee..b8e95298d5d 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp @@ -62,7 +62,7 @@ TeamFactory *TheTeamFactory = NULL; TeamRelationMap::TeamRelationMap( void ) { -} // end TeamRelationMap +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -72,7 +72,7 @@ TeamRelationMap::~TeamRelationMap( void ) // maek sure the data is clear m_map.clear(); -} // end ~TeamRelationMap +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -80,7 +80,7 @@ TeamRelationMap::~TeamRelationMap( void ) void TeamRelationMap::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -118,9 +118,9 @@ void TeamRelationMap::xfer( Xfer *xfer ) r = (*teamRelationIt).second; xfer->xferUser( &r, sizeof( Relationship ) ); - } // end for + } - } // end if, save + } else { @@ -136,11 +136,11 @@ void TeamRelationMap::xfer( Xfer *xfer ) // assign relationship m_map[teamID] = r; - } // end for, i + } - } // end else load + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -148,7 +148,7 @@ void TeamRelationMap::xfer( Xfer *xfer ) void TeamRelationMap::loadPostProcess( void ) { -} // end loadPostProcess +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -293,7 +293,7 @@ TeamPrototype *TeamFactory::findTeamPrototypeByID( TeamPrototypeID id ) if( prototype->getID() == id ) return prototype; - } // end for + } // not found return NULL; @@ -422,7 +422,7 @@ void TeamFactory::teamAboutToBeDeleted(Team* team) void TeamFactory::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------ /** Xfer method @@ -455,7 +455,7 @@ void TeamFactory::xfer( Xfer *xfer ) prototypeCount, m_prototypes.size() )); throw SC_INVALID_DATA; - } // end if + } // xfer each of the prototype information TeamPrototypeMap::iterator it; @@ -479,9 +479,9 @@ void TeamFactory::xfer( Xfer *xfer ) // xfer prototype data xfer->xferSnapshot( teamPrototype ); - } //end for, it + } - } // end if, saving + } else { @@ -502,14 +502,14 @@ void TeamFactory::xfer( Xfer *xfer ) DEBUG_CRASH(( "TeamFactory::xfer - Unable to find team prototype by id" )); throw SC_INVALID_DATA; - } // end if + } // xfer prototype data xfer->xferSnapshot( teamPrototype ); - } // end for, i + } - } // end else, loading + } /* // SAVE_LOAD_DEBUG @@ -537,15 +537,15 @@ fprintf( fp, " Team Instance '%s', id is '%d'\n", team->getName().str(), team-> obj = objIt.cur(); fprintf( fp, " Member '%s', id '%d'\n", obj->getTemplate()->getName().str(), obj->getID() ); } - } // end for + } -} // end for +} fclose( fp ); -} // end if, save +} */ -} // end xfer +} // ------------------------------------------------------------------------ /** Load post process */ @@ -577,9 +577,9 @@ void TeamFactory::loadPostProcess( void ) if( team->getID() >= m_uniqueTeamID ) m_uniqueTeamID = team->getID() + 1; - } // end for + } - } // end for, it + } /* // SAVE_LOAD_DEBUG @@ -602,13 +602,13 @@ fprintf( fp, " Team Instance '%s', id is '%d'\n", team->getName().str(), team-> obj = objIt.cur(); fprintf( fp, " Member '%s', id '%d'\n", obj->getTemplate()->getName().str(), obj->getID() ); } - } // end for + } -} // end for +} fclose( fp ); */ -} // end loadPostProcess +} // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ @@ -766,7 +766,7 @@ TeamTemplateInfo::TeamTemplateInfo(Dict *d) : void TeamTemplateInfo::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------ /** Xfer method @@ -784,7 +784,7 @@ void TeamTemplateInfo::xfer( Xfer *xfer ) // xfer the production priority xfer->xferInt( &m_productionPriority ); -} // end xfer +} // ------------------------------------------------------------------------ /** Load post process */ @@ -792,7 +792,7 @@ void TeamTemplateInfo::xfer( Xfer *xfer ) void TeamTemplateInfo::loadPostProcess( void ) { -} // end loadPostProcess +} // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ @@ -1182,7 +1182,7 @@ Bool TeamPrototype::evaluateProductionCondition(void) void TeamPrototype::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------ /** Xfer method @@ -1240,9 +1240,9 @@ void TeamPrototype::xfer( Xfer *xfer ) // write team data xfer->xferSnapshot( teamInstance ); - } // end for + } - } // end if, save + } else { @@ -1274,16 +1274,16 @@ void TeamPrototype::xfer( Xfer *xfer ) // restore original ID we read from the file teamInstance->setID( teamID ); - } // end if + } // xfer team data xfer->xferSnapshot( teamInstance ); - } // end for, i + } - } // end else, load + } -} // end xfer +} // ------------------------------------------------------------------------ /** Load post process */ @@ -1291,7 +1291,7 @@ void TeamPrototype::xfer( Xfer *xfer ) void TeamPrototype::loadPostProcess( void ) { -} // end loadPostProcess +} // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ @@ -2556,7 +2556,7 @@ void Team::updateGenericScripts(void) void Team::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -2581,7 +2581,7 @@ void Team::xfer( Xfer *xfer ) teamID, m_id )); throw SC_INVALID_DATA; - } // end if + } // member list count and data ObjectID memberID; @@ -2608,9 +2608,9 @@ void Team::xfer( Xfer *xfer ) memberID = obj->getID(); xfer->xferObjectID( &memberID ); - } // end for + } - } // end if, save + } else { @@ -2624,9 +2624,9 @@ void Team::xfer( Xfer *xfer ) // put on pending list for later processing m_xferMemberIDList.push_back( memberID ); - } // end for, i + } - } // end else, load + } // state xfer->xferAsciiString( &m_state ); @@ -2690,7 +2690,7 @@ void Team::xfer( Xfer *xfer ) // player relations xfer->xferSnapshot( m_playerRelations ); -} // ene xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -2715,7 +2715,7 @@ void Team::loadPostProcess( void ) DEBUG_CRASH(( "Team::loadPostProcess - Unable to post process object to member list, object ID = '%d'", *it )); throw SC_INVALID_DATA; - } // end if + } // // we are now disabling this code since the objects set their team during their @@ -2730,9 +2730,9 @@ void Team::loadPostProcess( void ) obj->getTemplate()->getName().str(), obj->getID() )); throw SC_INVALID_DATA; - } // end if + } - } // end for + } // since we prepended the object member pointers, reverse that list so it's just like before // reverse_TeamMemberList(); @@ -2740,7 +2740,7 @@ void Team::loadPostProcess( void ) // we're done with the xfer list now m_xferMemberIDList.clear(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp index 1bfe88f145a..8e035dfd377 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp @@ -285,7 +285,7 @@ void TunnelTracker::healObject( Object *obj, void *frames) // set max health body->attemptHealing( &healInfo ); - } // end if + } else { // @@ -298,7 +298,7 @@ void TunnelTracker::healObject( Object *obj, void *frames) // do the healing body->attemptHealing( &healInfo ); - } // end else + } } // ------------------------------------------------------------------------------------------------ @@ -307,7 +307,7 @@ void TunnelTracker::healObject( Object *obj, void *frames) void TunnelTracker::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -340,9 +340,9 @@ void TunnelTracker::xfer( Xfer *xfer ) objectID = (*it)->getID(); xfer->xferObjectID( &objectID ); - } // end for, it + } - } // end if, save + } else { @@ -352,14 +352,14 @@ void TunnelTracker::xfer( Xfer *xfer ) xfer->xferObjectID( &objectID ); m_xferContainList.push_back( objectID ); - } // end for, i + } - } // end else, load + } // tunnel count xfer->xferUnsignedInt( &m_tunnelCount ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -374,7 +374,7 @@ void TunnelTracker::loadPostProcess( void ) DEBUG_CRASH(( "TunnelTracker::loadPostProcess - m_containList should be empty but is not" )); throw SC_INVALID_DATA; - } // end if + } // translate each object ids on the xferContainList into real object pointers in the contain list Object *obj; @@ -389,7 +389,7 @@ void TunnelTracker::loadPostProcess( void ) DEBUG_CRASH(( "TunnelTracker::loadPostProcess - Unable to find object ID '%d'", *it )); throw SC_INVALID_DATA; - } // end if + } // push on the back of the contain list m_containList.push_back( obj ); @@ -411,9 +411,9 @@ void TunnelTracker::loadPostProcess( void ) TheAI->pathfinder()->removeObjectFromPathfindMap( obj ); } - } // end for, it + } // we're done with the xfer contain list now m_xferContainList.clear(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp index b276c5c8b66..99e70f26c51 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp @@ -1245,7 +1245,7 @@ Bool RecorderClass::playbackFile(AsciiString filename) Int rankPoints = 0; m_file->read(&rankPoints, sizeof(rankPoints)); - + Int maxFPS = 0; m_file->read(&maxFPS, sizeof(maxFPS)); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp index f65ecafd783..65344e390ca 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp @@ -812,7 +812,7 @@ void StateMachine::internalSetGoalPosition( const Coord3D *pos ) void StateMachine::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -893,7 +893,7 @@ void StateMachine::xfer( Xfer *xfer ) xfer->xferCoord3D(&m_goalPosition); xfer->xferBool(&m_locked); xfer->xferBool(&m_defaultStateInited); -} // end xfer +} // ------------------------------------------------------------------------------------------------ @@ -902,5 +902,5 @@ void StateMachine::xfer( Xfer *xfer ) void StateMachine::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index 72704ed607b..73143fabee7 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -72,14 +72,14 @@ ObjectSellInfo::ObjectSellInfo( void ) m_id = INVALID_ID; m_sellFrame = 0; -} // end ObjectSellInfo +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ ObjectSellInfo::~ObjectSellInfo( void ) { -} // end ~ObjectSellInfo +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -99,7 +99,7 @@ static Bool isDozer( Object *obj ) return FALSE; -} // end isDozer +} // PUBLIC ///////////////////////////////////////////////////////////////////////////////////////// @@ -111,7 +111,7 @@ BuildAssistant::BuildAssistant( void ) m_buildPositions = NULL; m_buildPositionSize = 0; m_sellList.clear(); -} // end BuildAssistant +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -126,9 +126,9 @@ BuildAssistant::~BuildAssistant( void ) m_buildPositions = NULL; m_buildPositionSize = 0; - } // end if + } -} // end ~BuildAssistant +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -142,7 +142,7 @@ void BuildAssistant::init( void ) m_buildPositionSize = TheGlobalData->m_maxLineBuildObjects; m_buildPositions = NEW Coord3D[ m_buildPositionSize ]; -} // end init +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -161,12 +161,12 @@ void BuildAssistant::reset( void ) // delete our data and erase this entry from the list deleteInstance(sellInfo); - } // end for + } // clear the sell list m_sellList.clear(); -} // end reset +} static const Real FRAMES_TO_ALLOW_SCAFFOLD = LOGICFRAMES_PER_SECOND * 1.5f; static const Real TOTAL_FRAMES_TO_SELL_OBJECT = LOGICFRAMES_PER_SECOND * 3.0f; @@ -204,7 +204,7 @@ void BuildAssistant::update( void ) m_sellList.erase( thisIterator ); continue; - } // end if + } // decrement the construction percent if( TheGameLogic->getFrame() - sellInfo->m_sellFrame >= FRAMES_TO_ALLOW_SCAFFOLD ) @@ -233,9 +233,9 @@ void BuildAssistant::update( void ) if( draw ) draw->setAnimationLoopDuration( TOTAL_FRAMES_TO_SELL_OBJECT / 2 ); - } // end if + } - } // end if + } // // after we've reached zero ... the object has "sunk" back down into the ground ... but @@ -260,7 +260,7 @@ void BuildAssistant::update( void ) // this money shouldn't be scored since it wasn't really "earned." // player->getScoreKeeper()->addMoneyEarned( sellValue ); - } // end if + } // cancel any of the production items and refund to the controlling player ProductionUpdateInterface *pui = obj->getProductionUpdateInterface(); @@ -279,11 +279,11 @@ void BuildAssistant::update( void ) deleteInstance(sellInfo); m_sellList.erase( thisIterator ); - } // end if + } - } // end for + } -} // end update +} //------------------------------------------------------------------------------------------------- /** Xfer the sell list. */ //------------------------------------------------------------------------------------------------- @@ -320,7 +320,7 @@ void BuildAssistant::xferTheSellList( Xfer *xfer ) DEBUG_ASSERTCRASH(count==0, ("Inconsistent list size counts.")); } -} // end xferTheSellList +} //------------------------------------------------------------------------------------------------- /** Nice little method to wrap up creating an object from a build */ @@ -342,7 +342,7 @@ Object *BuildAssistant::buildObjectNow( Object *constructorObject, const ThingTe DEBUG_ASSERTCRASH( constructorObject->getControllingPlayer() == owningPlayer, ("buildObjectNow: Constructor object player is not the same as the controlling player passed in\n") ); - } // end if + } // Need to validate that we can make this in case someone fakes their CommandSet // A NULL constructor Object means a script built building so let it slide. @@ -373,7 +373,7 @@ Object *BuildAssistant::buildObjectNow( Object *constructorObject, const ThingTe } return NULL; - } // end else if + } else { @@ -409,7 +409,7 @@ Object *BuildAssistant::buildObjectNow( Object *constructorObject, const ThingTe owningPlayer->onStructureCreated( constructorObject, obj ); owningPlayer->onStructureConstructionComplete( constructorObject, obj, FALSE ); - } // end if + } else { owningPlayer->onUnitCreated( constructorObject, obj ); @@ -436,11 +436,11 @@ Object *BuildAssistant::buildObjectNow( Object *constructorObject, const ThingTe return obj; - } // end else + } return NULL; -} // end buildObjectNow +} //------------------------------------------------------------------------------------------------- /** This method will create a line of objects end to end along the line defined in 3D @@ -470,7 +470,7 @@ void BuildAssistant::buildObjectLineNow( Object *constructorObject, const ThingT for( Int i = 0; i < tileBuildInfo->tilesUsed; i++ ) buildObjectNow( constructorObject, what, &tileBuildInfo->positions[ i ], angle, owningPlayer ); -} // end buildObjectLineNow +} //------------------------------------------------------------------------------------------------- /** This structure is passed along to the checkSampleBuildLocation while iterating the @@ -502,7 +502,7 @@ static void checkSampleBuildLocation( const Coord3D *samplePoint, void *userData if( terrain->getRestrictConstruction() ) sampleData->terrainRestricted = TRUE; - } // end if + } Int cellX = REAL_TO_INT_FLOOR( samplePoint->x / PATHFIND_CELL_SIZE ); Int cellY = REAL_TO_INT_FLOOR( samplePoint->y / PATHFIND_CELL_SIZE ); @@ -539,7 +539,7 @@ static void checkSampleBuildLocation( const Coord3D *samplePoint, void *userData } } -} // end checkSampleBuildLocation +} //------------------------------------------------------------------------------------------------- /** This function will call the user callback at each "sample point" across the footprint @@ -578,7 +578,7 @@ void BuildAssistant::iterateFootprint( const ThingTemplate *build, halfFootprintHeight = build->getTemplateGeometryInfo().getMinorRadius(); halfFootprintWidth = build->getTemplateGeometryInfo().getMajorRadius(); - } // end if + } else if( build->getTemplateGeometryInfo().getGeomType() == GEOMETRY_SPHERE || build->getTemplateGeometryInfo().getGeomType() == GEOMETRY_CYLINDER ) { @@ -586,7 +586,7 @@ void BuildAssistant::iterateFootprint( const ThingTemplate *build, halfFootprintHeight = build->getTemplateGeometryInfo().getBoundingCircleRadius(); halfFootprintWidth = build->getTemplateGeometryInfo().getBoundingCircleRadius(); - } // end else if + } else { @@ -594,7 +594,7 @@ void BuildAssistant::iterateFootprint( const ThingTemplate *build, build->getTemplateGeometryInfo().getGeomType(), build->getName().str()) ); return; - } // end else + } // // start at a corner of the extent ... box geometries have a major radius down @@ -639,7 +639,7 @@ void BuildAssistant::iterateFootprint( const ThingTemplate *build, if( vector.length() > halfFootprintWidth ) // could be height too, radius is all the same for circles continue; // ignore this point - } // end if + } // call the user callback Coord3D pos; @@ -648,11 +648,11 @@ void BuildAssistant::iterateFootprint( const ThingTemplate *build, pos.z = TheTerrainLogic->getGroundHeight( pos.x, pos.y ); func( &pos, funcUserData ); - } // end for x + } - } // end for y + } -} // end iterateFootprint +} //------------------------------------------------------------------------------------------------- @@ -760,7 +760,7 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos return LBC_GENERIC_FAILURE; } - } // end for, them + } if (onlyCheckEnemies) { @@ -891,7 +891,7 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos } } - } // end for, them + } return LBC_OK; } @@ -946,7 +946,7 @@ LegalBuildCode BuildAssistant::isLocationLegalToBuild( const Coord3D *worldPos, return code; } - } // end if + } // // if NO_ENEMY_OBJECT_OVERLAP is set, we are not allowed to construct 'build' if it would overlap // any enemy objects. Friendly objects are ignored. @@ -958,7 +958,7 @@ LegalBuildCode BuildAssistant::isLocationLegalToBuild( const Coord3D *worldPos, { return code; } - } // end if + } if (build->isKindOf(KINDOF_CANNOT_BUILD_NEAR_SUPPLIES) && TheGlobalData->m_SupplyBuildBorder > 0) { @@ -1006,7 +1006,7 @@ LegalBuildCode BuildAssistant::isLocationLegalToBuild( const Coord3D *worldPos, if( ai->isQuickPathAvailable( worldPos ) == FALSE ) return LBC_NO_CLEAR_PATH; - } // end if + } // check basic terrain restrctions if( BitIsSet( options, TERRAIN_RESTRICTIONS ) ) @@ -1055,12 +1055,12 @@ LegalBuildCode BuildAssistant::isLocationLegalToBuild( const Coord3D *worldPos, if( sampleData.hiZ - sampleData.loZ > TheGlobalData->m_allowedHeightVariationForBuilding ) return LBC_NOT_FLAT_ENOUGH; - } // end if + } // we passed all the checks return LBC_OK; -} // end isLocationLegalToBuild +} //------------------------------------------------------------------------------------------------- /** Adds bibs to structures near to worldPos */ @@ -1089,7 +1089,7 @@ void BuildAssistant::addBibs(const Coord3D *worldPos, TheTerrainVisual->addFactionBib(them, true); } - } // end for, them + } } @@ -1139,7 +1139,7 @@ BuildAssistant::TileBuildInfo *BuildAssistant::buildTiledLocations( const ThingT // DEBUG_ASSERTCRASH( m_buildPositionSize < 200, ("Do you really need to tile this many objects!!!") ); - } // end if + } Coord3D *positions = m_buildPositions; // compute a vector from the start of the line in the world to the end @@ -1201,7 +1201,7 @@ BuildAssistant::TileBuildInfo *BuildAssistant::buildTiledLocations( const ThingT // we have now actually used one more "tile" tilesUsed++; - } // end for i + } // return a struct filled out with the actual tiles used and the array of locations static TileBuildInfo tileInfo; @@ -1209,7 +1209,7 @@ BuildAssistant::TileBuildInfo *BuildAssistant::buildTiledLocations( const ThingT tileInfo.positions = positions; return &tileInfo; -} // end buildTiledLocations +} //------------------------------------------------------------------------------------------------- /** Is the template passed in one of those wall type structures that we "build" in @@ -1227,7 +1227,7 @@ Bool BuildAssistant::isLineBuildTemplate( const ThingTemplate *tTemplate ) return FALSE; // not a line build object -} // end isLineBuildTemplate +} //------------------------------------------------------------------------------------------------- /** This method will check to make sure it is possible to build the requested unit. The @@ -1255,7 +1255,7 @@ Bool BuildAssistant::isPossibleToMakeUnit( Object *builder, const ThingTemplate builder->getTemplate()->getName().str()) ); return FALSE; - } // end if + } // // scan the command set, we must find whatToBuild as one of the "build" commands available @@ -1275,7 +1275,7 @@ Bool BuildAssistant::isPossibleToMakeUnit( Object *builder, const ThingTemplate commandButton->getThingTemplate() && commandButton->getThingTemplate()->isEquivalentTo(whatToBuild) ) foundCommand = commandButton; - } // end for i + } if( foundCommand == NULL ) return FALSE; @@ -1374,7 +1374,7 @@ Bool BuildAssistant::isRemovableForConstruction( Object *obj ) // not removable return FALSE; -} // end isRemovableForConstruction +} // ------------------------------------------------------------------------------------------------ /** Given that we are about to build 'whatToBuild' remove all the objects that are in the @@ -1397,10 +1397,10 @@ void BuildAssistant::clearRemovableForConstruction( const ThingTemplate *whatToB if( isRemovableForConstruction( them ) == TRUE && !them->isKindOf( KINDOF_ALWAYS_SELECTABLE ) ) TheGameLogic->destroyObject( them ); - } // end for, them + } TheTerrainVisual->removeTreesAndPropsForConstruction(pos, whatToBuild->getTemplateGeometryInfo(), angle); -} // end clearRemovableForConstruction +} // ------------------------------------------------------------------------------------------------ /** clearRemovable is set up to delete objects that should cease to exist (for instance, trees). @@ -1513,7 +1513,7 @@ void BuildAssistant::sellObject( Object *obj ) else sellInfo = NULL; - } // end for + } if( sellInfo != NULL ) return; @@ -1606,5 +1606,5 @@ void BuildAssistant::sellObject( Object *obj ) } } -} // end sellObject +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp index 3a2c52f4634..b4e06d7f79c 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp @@ -400,12 +400,12 @@ void FunctionLexicon::loadTable( TableEntry *table, // next table entry please entry++; - } // end while + } // assign table to the index specified m_tables[ tableIndex ] = table; -} // end loadTable +} //------------------------------------------------------------------------------------------------- /** Search the provided table for a function matching the key */ @@ -426,11 +426,11 @@ void *FunctionLexicon::keyToFunc( NameKeyType key, TableEntry *table ) return entry->func; entry++; - } // end if + } return NULL; // not found -} // end keyToFunc +} //------------------------------------------------------------------------------------------------- /** Search tables for the function given this key, if the index parameter @@ -457,21 +457,21 @@ void *FunctionLexicon::findFunction( NameKeyType key, TableIndex index ) if( func ) break; // exit for i - } // end for i + } - } // end if + } else { // do NOT search all tables, just the one specified by the parameter func = keyToFunc( key, m_tables[ index ] ); - } // end else + } // return function, if found return func; -} // end findFunction +} #ifdef NOT_IN_USE //------------------------------------------------------------------------------------------------- @@ -496,11 +496,11 @@ const char *FunctionLexicon::funcToName( void *func, TableEntry *table ) // not it, check next entry++; - } // end while + } return NULL; // not found -} // end funcToName +} #endif /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -517,14 +517,14 @@ FunctionLexicon::FunctionLexicon( void ) for( i = 0; i < MAX_FUNCTION_TABLES; i++ ) m_tables[ i ] = NULL; -} // end FunctionLexicon +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- FunctionLexicon::~FunctionLexicon( void ) { -} // end ~FunctionLexicon +} //------------------------------------------------------------------------------------------------- /** Initialize our dictionary of funtion pointers and symbols */ @@ -546,7 +546,7 @@ void FunctionLexicon::init( void ) validate(); -} // end init +} //------------------------------------------------------------------------------------------------- /** reset */ @@ -562,7 +562,7 @@ void FunctionLexicon::reset( void ) // nothing dynamically loaded, just reinit the tables init(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update */ @@ -570,7 +570,7 @@ void FunctionLexicon::reset( void ) void FunctionLexicon::update( void ) { -} // end update +} /* // !NOTE! We can not have this function, see the header for @@ -596,11 +596,11 @@ char *FunctionLexicon::functionToName( void *func ) if( name ) return name; - } // end for i + } return NULL; // not found -} // end functionToName +} */ //------------------------------------------------------------------------------------------------- @@ -653,28 +653,28 @@ Bool FunctionLexicon::validate( void ) sourceEntry->name, lookAtEntry->name )); valid = FALSE; - } // end if + } // next entry in this target table lookAtEntry++; - } // end while + } - } // end for j + } - } // end if + } // next source entry sourceEntry++; - } // end while + } - } // end for i + } // return the valid state of our tables return valid; -} // end validate +} //============================================================================ // FunctionLexicon::gameWinDrawFunc diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/Geometry.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/Geometry.cpp index 2b8da5f3c71..7d1a0db2bb6 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/Geometry.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/Geometry.cpp @@ -553,7 +553,7 @@ AsciiString GeometryInfo::getDescriptiveString() const void GeometryInfo::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -589,7 +589,7 @@ void GeometryInfo::xfer( Xfer *xfer ) // bounding sphere radius xfer->xferReal( &m_boundingSphereRadius ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -597,4 +597,4 @@ void GeometryInfo::xfer( Xfer *xfer ) void GeometryInfo::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/Radar.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/Radar.cpp index 5344b9d942a..5408d7e4fb6 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/Radar.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/Radar.cpp @@ -83,7 +83,7 @@ void Radar::deleteListResources( void ) // set head of the list to the next object m_localObjectList = nextObject; - } // end while + } // delete entries from the regular object list while( m_objectList ) @@ -101,7 +101,7 @@ void Radar::deleteListResources( void ) // set head of the list to the next object m_objectList = nextObject; - } // end while + } Object *obj; for( obj = TheGameLogic->getFirstObject(); obj; obj = obj->getNextObject() ) @@ -111,7 +111,7 @@ void Radar::deleteListResources( void ) } -} // end deleteListResources +} // PUBLIC METHODS ///////////////////////////////////////////////////////////////////////////////// //------------------------------------------------------------------------------------------------- @@ -156,7 +156,7 @@ Bool RadarObject::isTemporarilyHidden(const Object* obj) void RadarObject::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -185,17 +185,17 @@ void RadarObject::xfer( Xfer *xfer ) DEBUG_CRASH(( "RadarObject::xfer - Unable to find object for radar data" )); throw SC_INVALID_DATA; - } // end if + } // tell the object we now have some radar data m_object->friend_setRadarData( this ); - } // end if + } // color xfer->xferColor( &m_color ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -203,7 +203,7 @@ void RadarObject::xfer( Xfer *xfer ) void RadarObject::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -230,7 +230,7 @@ Radar::Radar( void ) // clear the radar events clearAllEvents(); -} // end Radar +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -240,7 +240,7 @@ Radar::~Radar( void ) // delete list resources deleteListResources(); -} // end ~Radar +} //------------------------------------------------------------------------------------------------- /** Clear all radar events */ @@ -274,9 +274,9 @@ void Radar::clearAllEvents( void ) m_event[ i ].radarLoc.y = 0; m_event[ i ].soundPlayed = FALSE; - } // end for i + } -} // end clearAllEvents +} //------------------------------------------------------------------------------------------------- /** Reset radar data */ @@ -293,7 +293,7 @@ void Radar::reset( void ) // stop forcing the radar on m_radarForceOn = false; -} // end reset +} //------------------------------------------------------------------------------------------------- /** Radar per frame update */ @@ -315,7 +315,7 @@ void Radar::update( void ) thisFrame > m_event[ i ].dieFrame ) m_event[ i ].active = FALSE; - } // end for i + } // see if we should refresh the terrain if( m_queueTerrainRefreshFrame != 0 && @@ -325,9 +325,9 @@ void Radar::update( void ) // refresh the terrain refreshTerrain( TheTerrainLogic ); - } // end if + } -} // end update +} //------------------------------------------------------------------------------------------------- /** Reset the radar for the new map data being given to it */ @@ -380,7 +380,7 @@ void Radar::newMap( TerrainLogic *terrain ) terrainSamples++; } - } // end for x + } } // avoid divide by zeros @@ -393,7 +393,7 @@ void Radar::newMap( TerrainLogic *terrain ) m_terrainAverageZ = m_terrainAverageZ / INT_TO_REAL( terrainSamples ); m_waterAverageZ = m_waterAverageZ / INT_TO_REAL( waterSamples ); -} // end newMap +} //------------------------------------------------------------------------------------------------- /** Add an object to the radar list. The object will be sorted in the list to be grouped @@ -525,7 +525,7 @@ RadarObjectType Radar::addObject( Object *obj ) // the previous one next now points to the new entry prevObject->friend_setNext( newObj ); - } // end if + } else { @@ -535,29 +535,29 @@ RadarObjectType Radar::addObject( Object *obj ) // new list head is now newObj *list = newObj; - } // end else + } break; // exit for, stop the insert - } // end if + } else if( nextObject == NULL ) { // at the end of the list, put object here currObject->friend_setNext( newObj ); - } // end else if + } // our current object is now the previous object prevObject = currObject; prevPriority = currPriority; - } // end if + } - } // end else + } return objectType; -} // end addObject +} //------------------------------------------------------------------------------------------------- /** Try to delete an object from a specific list */ @@ -588,17 +588,17 @@ Bool Radar::deleteFromList( Object *obj, RadarObject **list ) // all done, object found and deleted return TRUE; - } // end if + } // save this object as previous one encountered in the list prevObject = radarObject; - } // end for, radarObject + } // object was not found in this list return FALSE; -} // end deleteFromList +} //------------------------------------------------------------------------------------------------- /** Remove an object from the radar, the object may reside in any list */ @@ -621,9 +621,9 @@ RadarObjectType Radar::removeObject( Object *obj ) DEBUG_ASSERTCRASH( 0, ("Radar: Tried to remove object '%s' which was not found", obj->getTemplate()->getName().str()) ); return RadarObjectType_None; - } // end else + } -} // end removeObject +} //------------------------------------------------------------------------------------------------- /** Translate a 2D spot on the radar (from (0,0) to (RADAR_CELL_WIDTH,RADAR_CELL_HEIGHT) @@ -675,7 +675,7 @@ Bool Radar::radarToWorld( const ICoord2D *radar, Coord3D *world ) return TRUE; // valid translation -} // end radarToWorld +} //------------------------------------------------------------------------------------------------- /** Translate a point in the world to the 2D radar (x,y) @@ -715,7 +715,7 @@ Bool Radar::worldToRadar( const Coord3D *world, ICoord2D *radar ) return TRUE; // valid translation -} // end worldToRadar +} // ------------------------------------------------------------------------------------------------ /** Translate an actual pixel location (relative pixel with (0,0) being the top left of @@ -767,7 +767,7 @@ Bool Radar::localPixelToRadar( const ICoord2D *pixel, ICoord2D *radar ) radar->y = (size.y - radar->y) * RADAR_CELL_HEIGHT / size.y; - } // end if + } else { @@ -783,11 +783,11 @@ Bool Radar::localPixelToRadar( const ICoord2D *pixel, ICoord2D *radar ) // radar->y = (size.y - pixel->y) * RADAR_CELL_HEIGHT / size.y; - } // end else + } return TRUE; -} // end localPixelToRadar +} // ------------------------------------------------------------------------------------------------ /** Translate a screen mouse position to world coords if the screen position is within @@ -819,7 +819,7 @@ Bool Radar::screenPixelToWorld( const ICoord2D *pixel, Coord3D *world ) // translate radar to world return radarToWorld( &radar, world ); -} // end screenPixelToWorld +} // ------------------------------------------------------------------------------------------------ /** Given the pixel coordinates, see if there is an object that is exactly in this @@ -855,7 +855,7 @@ Object *Radar::objectUnderRadarPixel( const ICoord2D *pixel ) // return the object found (if any) return obj; -} // end objectUnderRadarPixel +} // ------------------------------------------------------------------------------------------------ /** Search the object list for an object that maps to the given logical radar coords */ @@ -883,7 +883,7 @@ Object *Radar::searchListForRadarLocationMatch( RadarObject *listHead, ICoord2D DEBUG_CRASH(( "Radar::searchListForRadarLocationMatch - NULL object encountered in list" )); continue; - } // end if + } // convert object position to logical radar worldToRadar( obj->getPosition(), &radar ); @@ -895,12 +895,12 @@ Object *Radar::searchListForRadarLocationMatch( RadarObject *listHead, ICoord2D radar.y <= radarMatch->y + 1 ) return obj; - } // end for, radarObject + } // no match found return NULL; -} // end searchListForRadarLocationMatch +} // ------------------------------------------------------------------------------------------------ /** Given the RELATIVE SCREEN start X and Y, the width and height of the area to draw the whole @@ -957,7 +957,7 @@ void Radar::findDrawPositions( Int startX, Int startY, Int width, Int height, lr->x = width; lr->y = height - ul->y; - } // end if + } else if( m_mapExtent.height() > m_mapExtent.width() ) { @@ -978,7 +978,7 @@ void Radar::findDrawPositions( Int startX, Int startY, Int width, Int height, lr->x = width - ul->x; lr->y = height; - } // end else + } else { @@ -987,7 +987,7 @@ void Radar::findDrawPositions( Int startX, Int startY, Int width, Int height, lr->x = width; lr->y = height; - } // end else + } */ // make them pixel positions @@ -996,7 +996,7 @@ void Radar::findDrawPositions( Int startX, Int startY, Int width, Int height, lr->x += startX; lr->y += startY; -} // end findDrawPositions +} //------------------------------------------------------------------------------------------------- /** Radar color lookup table */ @@ -1046,9 +1046,9 @@ void Radar::createEvent( const Coord3D *world, RadarEventType type, Real seconds color[ 1 ] = radarColorLookupTable[ i ].color2; break; - } // end if + } - } // end while + } // check for no match found in color table if( radarColorLookupTable[ i ].event == RADAR_EVENT_INVALID ) @@ -1060,12 +1060,12 @@ void Radar::createEvent( const Coord3D *world, RadarEventType type, Real seconds color[ 0 ] = color1; color[ 1 ] = color2; - } // end if + } // call the internal method to create the event with these colors internalCreateEvent( world, type, secondsToLive, &color[ 0 ], &color[ 1 ] ); -} // end createEvent +} // ------------------------------------------------------------------------------------------------ /** Create radar event using a specific colors from the player */ @@ -1107,7 +1107,7 @@ void Radar::createPlayerEvent( Player *player, const Coord3D *world, // create the events using these colors internalCreateEvent( world, type, secondsToLive, &color[ 0 ], &color[ 1 ] ); -} // end createPlayerEvent +} //------------------------------------------------------------------------------------------------- /** Create a new radar event */ @@ -1149,7 +1149,7 @@ void Radar::internalCreateEvent( const Coord3D *world, RadarEventType type, Real if( m_nextFreeRadarEvent >= MAX_RADAR_EVENTS ) m_nextFreeRadarEvent = 0; -} // end createEvent +} //------------------------------------------------------------------------------------------------- /** Get the last event position, if any. @@ -1167,11 +1167,11 @@ Bool Radar::getLastEventLoc( Coord3D *eventPos ) *eventPos = m_event[ m_lastRadarEvent ].worldLoc; return TRUE; - } // end if + } return FALSE; // no last event -} // end getLastEventLoc +} // ------------------------------------------------------------------------------------------------ /** Try to create a radar event for "we're under attack". This will be called every time @@ -1225,7 +1225,7 @@ void Radar::tryUnderAttackEvent( const Object *obj ) unitAttackSound.setPlayerIndex(player->getPlayerIndex()); TheAudio->addAudioEvent( &unitAttackSound ); - } // end if + } else if( obj->isKindOf( KINDOF_STRUCTURE ) && obj->isKindOf( KINDOF_MP_COUNT_FOR_VICTORY ) ) { // play EVA. If its our object, play Base under attack. @@ -1242,7 +1242,7 @@ void Radar::tryUnderAttackEvent( const Object *obj ) structureAttackSound.setPlayerIndex(player->getPlayerIndex()); TheAudio->addAudioEvent( &structureAttackSound ); - } // end else if + } else { @@ -1254,11 +1254,11 @@ void Radar::tryUnderAttackEvent( const Object *obj ) underAttackSound.setPlayerIndex(player->getPlayerIndex()); TheAudio->addAudioEvent( &underAttackSound ); - } // end else + } - } // end if + } -} // end tryUnderAttackEvent +} // ------------------------------------------------------------------------------------------------ /** Try to create a radar event for "infiltration". @@ -1297,7 +1297,7 @@ void Radar::tryInfiltrationEvent( const Object *obj ) infiltrationWarningSound.setPlayerIndex(player->getPlayerIndex()); TheAudio->addAudioEvent( &infiltrationWarningSound ); -} // end tryInfiltrationEvent +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1335,11 +1335,11 @@ Bool Radar::tryEvent( RadarEventType event, const Coord3D *pos ) if( currentFrame - m_event[ i ].createFrame < framesBetweenEvents ) return FALSE; // reject it - } // end if + } - } // end if + } - } // end for i + } // if we got here then we want to create a new event createEvent( pos, event ); @@ -1347,7 +1347,7 @@ Bool Radar::tryEvent( RadarEventType event, const Coord3D *pos ) // return TRUE for successfully created event return TRUE; -} // end tryEvent +} // ------------------------------------------------------------------------------------------------ @@ -1358,7 +1358,7 @@ void Radar::refreshTerrain( TerrainLogic *terrain ) // no future queue is valid now m_queueTerrainRefreshFrame = 0; -} // end refreshTerrain +} // ------------------------------------------------------------------------------------------------ /** Queue a refresh of the radar terrain, we have this so that if there is code that @@ -1379,7 +1379,7 @@ void Radar::queueTerrainRefresh( void ) // m_queueTerrainRefreshFrame = TheGameLogic->getFrame(); -} // end queueTerrainRefresh +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -1387,7 +1387,7 @@ void Radar::queueTerrainRefresh( void ) void Radar::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer a radar object list given the head pointer as a parameter @@ -1423,9 +1423,9 @@ static void xferRadarObjectList( Xfer *xfer, RadarObject **head ) // save this object xfer->xferSnapshot( radarObject ); - } // end for, radarObject + } - } // end if, save + } else { @@ -1448,7 +1448,7 @@ static void xferRadarObjectList( Xfer *xfer, RadarObject **head ) DEBUG_CRASH(( "xferRadarObjectList - List head should be NULL, but isn't" )); throw SC_INVALID_DATA; #endif - } // end if + } // read each element for( UnsignedShort i = 0; i < count; ++i ) @@ -1466,21 +1466,21 @@ static void xferRadarObjectList( Xfer *xfer, RadarObject **head ) RadarObject *other; for( other = *head; other->friend_getNext() != NULL; other = other->friend_getNext() ) { - } // end for, other + } // set the end of the list to point to the new object other->friend_setNext( radarObject ); - } // end else + } // load the data xfer->xferSnapshot( radarObject ); - } // end for i + } - } // end else, load + } -} // end xferRadarObjectList +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -1518,7 +1518,7 @@ void Radar::xfer( Xfer *xfer ) eventCount, eventCountVerify )); throw SC_INVALID_DATA; - } // end if + } for( UnsignedShort i = 0; i < eventCount; ++i ) { @@ -1534,7 +1534,7 @@ void Radar::xfer( Xfer *xfer ) xfer->xferICoord2D( &m_event[ i ].radarLoc ); xfer->xferBool( &m_event[ i ].soundPlayed ); - } // end for i + } // next event index xfer->xferInt( &m_nextFreeRadarEvent ); @@ -1542,7 +1542,7 @@ void Radar::xfer( Xfer *xfer ) // last event index xfer->xferInt( &m_lastRadarEvent ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1556,7 +1556,7 @@ void Radar::loadPostProcess( void ) // refreshTerrain( TheTerrainLogic ); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ /** Is the priority type passed in a "visible" one that can show up on the radar */ @@ -1574,6 +1574,6 @@ Bool Radar::isPriorityVisible( RadarPriorityType priority ) default: return TRUE; - } // end switch + } -} // end isPriorityVisible +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp index ce4e9667b9d..acfe4e3aa3a 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp @@ -89,14 +89,14 @@ SaveGameInfo::SaveGameInfo( void ) missionNumber = 0; saveFileType = SAVE_FILE_TYPE_NORMAL; -} // end SaveGameInfo +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ SaveGameInfo::~SaveGameInfo( void ) { -} // end ~SaveGameInfo +} // ------------------------------------------------------------------------------------------------ /** Is this date newer than the other one passed in? */ @@ -158,19 +158,19 @@ Bool SaveDate::isNewerThan( SaveDate *other ) else return FALSE; - } // end else + } - } // end else + } - } // end else + } - } // end else + } - } // end else + } - } // end else + } -} // end isNewerThan +} // ------------------------------------------------------------------------------------------------ /** Find a snapshot block info that matches the token passed in */ @@ -195,12 +195,12 @@ GameState::SnapshotBlock *GameState::findBlockInfoByToken( AsciiString token, Sn if( blockInfo->blockName == token ) return blockInfo; - } // end for + } // not found return NULL; -} // end findLexiconEntryByToken +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -279,7 +279,7 @@ GameState::GameState( void ) m_availableGames = NULL; m_isInLoadGame = FALSE; -} // end GameState +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -296,7 +296,7 @@ GameState::~GameState( void ) // clear any available game clearAvailableGames(); -} // end ~GameState +} // ------------------------------------------------------------------------------------------------ /** Init the game state subsystem */ @@ -333,7 +333,7 @@ void GameState::init( void ) m_isInLoadGame = FALSE; -} // end init +} // ------------------------------------------------------------------------------------------------ /** Reset */ @@ -349,7 +349,7 @@ void GameState::reset( void ) m_isInLoadGame = FALSE; -} // end reset +} // ------------------------------------------------------------------------------------------------ /** Clear any available games entries */ @@ -365,9 +365,9 @@ void GameState::clearAvailableGames( void ) delete m_availableGames; m_availableGames = gameInfo; - } // end while + } -} // end clearAvailableGames +} // ------------------------------------------------------------------------------------------------ /** Add a snapshot and block name pair to the systems used to load and save */ @@ -382,7 +382,7 @@ void GameState::addSnapshotBlock( AsciiString blockName, Snapshot *snapshot, Sna DEBUG_CRASH(( "addSnapshotBlock: Invalid parameters" )); return; - } // end if + } // add to the list SnapshotBlock blockInfo; @@ -390,7 +390,7 @@ void GameState::addSnapshotBlock( AsciiString blockName, Snapshot *snapshot, Sna blockInfo.blockName = blockName; m_snapshotBlockList[which].push_back( blockInfo ); -} // end addSnapshotBlock +} // ------------------------------------------------------------------------------------------------ /** Given the filename of a save file, find the highest filename number */ @@ -426,7 +426,7 @@ static void findHighFileNumber( AsciiString filename, void *userData ) if( fileNumber >= *highFileNumber ) *highFileNumber = fileNumber; -} // end findHighFileNumber +} // ------------------------------------------------------------------------------------------------ /** Given the save files on disk, find the "next" filename to use when saving a game */ @@ -485,7 +485,7 @@ AsciiString GameState::findNextSaveFilename( UnicodeString desc ) filename.format( "%08d%s", highFileNumber + 1, SAVE_GAME_EXTENSION ); return filename; - } // end if + } else if( searchType == LOWEST_NUMBER ) { AsciiString filename; @@ -512,22 +512,22 @@ AsciiString GameState::findNextSaveFilename( UnicodeString desc ) if( i > MAX_SAVE_FILE_NUMBER ) return AsciiString::TheEmptyString; - } // end while + } - } // end else if + } else { DEBUG_CRASH(( "GameState::findNextSaveFilename - Unknown file search type '%d'", searchType )); return AsciiString::TheEmptyString; - } // end else + } #endif // no appropriate filename could be found, return the empty string return AsciiString::TheEmptyString; -} // end findNextSaveFilename +} // ------------------------------------------------------------------------------------------------ /** Save the current state of the engine in a save file @@ -546,7 +546,7 @@ SaveCode GameState::saveGame( AsciiString filename, UnicodeString desc, DEBUG_CRASH(( "GameState::saveGame - Unable to find valid filename for save game" )); return SC_NO_FILE_AVAILABLE; - } // end if + } // make absolutely sure the save directory exists CreateDirectory( getSaveDirectory().str(), NULL ); @@ -589,7 +589,7 @@ SaveCode GameState::saveGame( AsciiString filename, UnicodeString desc, // save file xferSaveData( &xferSave, which ); - } // end try + } catch( ... ) { @@ -605,7 +605,7 @@ SaveCode GameState::saveGame( AsciiString filename, UnicodeString desc, xferSave.close(); return SC_ERROR; - } // end catch + } // close the file xferSave.close(); @@ -616,7 +616,7 @@ SaveCode GameState::saveGame( AsciiString filename, UnicodeString desc, return SC_OK; -} // end saveGame +} // ------------------------------------------------------------------------------------------------ /** A mission save */ @@ -638,7 +638,7 @@ SaveCode GameState::missionSave( void ) // do an automatic mission save return TheGameState->saveGame( AsciiString(""), desc, SAVE_FILE_TYPE_MISSION ); -} // end missionSave +} // ------------------------------------------------------------------------------------------------ /** Load the save game pointed to by filename */ @@ -657,7 +657,7 @@ SaveCode GameState::loadGame( AvailableGameInfo gameInfo ) if (TheGameLogic->isInGame()) TheGameLogic->clearGameData( FALSE ); - } // end if + } // // clear the save directory of any temporary "scratch pad" maps that were extracted @@ -688,11 +688,11 @@ SaveCode GameState::loadGame( AvailableGameInfo gameInfo ) // load file xferSaveData( &xferLoad, SNAPSHOT_SAVELOAD ); - } // end try + } catch( ... ) { error = TRUE; - } // end catch + } // close the file xferLoad.close(); @@ -729,7 +729,7 @@ SaveCode GameState::loadGame( AvailableGameInfo gameInfo ) return SC_INVALID_DATA; // you can't use a naked "throw" outside of a catch statement! - } // end if + } // // when loading a mission save, we want to do as much normal loading stuff as we @@ -752,11 +752,11 @@ SaveCode GameState::loadGame( AvailableGameInfo gameInfo ) gameInfo->saveFileType = SAVE_FILE_TYPE_NORMAL; gameInfo->missionMapName.clear(); - } // end if + } return SC_OK; -} // end loadGame +} //------------------------------------------------------------------------------------------------- AsciiString GameState::getSaveDirectory() const @@ -955,21 +955,21 @@ Bool GameState::doesSaveGameExist( AsciiString filename ) // try to open it xfer.open( filepath ); - } // end try + } catch( ... ) { // unable to open file, it must not be here return FALSE; - } // end catch + } // close the file, we don't want to to anything with it right now xfer.close(); return TRUE; -} // doesSaveGameExist +} // ------------------------------------------------------------------------------------------------ /** Get save game info from the filename specified */ @@ -988,7 +988,7 @@ void GameState::getSaveGameInfoFromFile( AsciiString filename, SaveGameInfo *sav DEBUG_CRASH(( "GameState::getSaveGameInfoFromFile - Illegal parameters" )); return; - } // end if + } // open file for partial loading XferLoad xferLoad; @@ -1015,7 +1015,7 @@ void GameState::getSaveGameInfoFromFile( AsciiString filename, SaveGameInfo *sav DEBUG_CRASH(( "GameState::getSaveGameInfoFromFile - Game info not found in file '%s'", filename.str() )); done = TRUE; - } // end if + } else { @@ -1039,7 +1039,7 @@ void GameState::getSaveGameInfoFromFile( AsciiString filename, SaveGameInfo *sav // load data xferLoad.xferSnapshot( &tempGameState ); - } // end try + } catch( ... ) { @@ -1047,7 +1047,7 @@ void GameState::getSaveGameInfoFromFile( AsciiString filename, SaveGameInfo *sav blockInfo->blockName.str(), filename.str() )); throw; - } // end catch + } // data was found, copy game state info over *saveGameInfo = *tempGameState.getSaveGameInfo(); @@ -1055,7 +1055,7 @@ void GameState::getSaveGameInfoFromFile( AsciiString filename, SaveGameInfo *sav // we're all done with this file now done = TRUE; - } // end if + } else { @@ -1065,16 +1065,16 @@ void GameState::getSaveGameInfoFromFile( AsciiString filename, SaveGameInfo *sav // end of block xferLoad.endBlock(); - } // end else + } - } // end else, valid data block token + } - } // end while, not done + } // close the file xferLoad.close(); -} // end getSaveGameInfoFromFile +} // ------------------------------------------------------------------------------------------------ /** Create game info and add to available list */ @@ -1129,9 +1129,9 @@ static void addGameToAvailableList( AsciiString filename, void *userData ) break; - } // end if + } - } // end for + } // if not inserted, put at end if( curr == NULL ) @@ -1140,15 +1140,15 @@ static void addGameToAvailableList( AsciiString filename, void *userData ) prev->next = newInfo; newInfo->prev = prev; - } // end if + } - } // end else + } } catch(...) { // Do nothing - just return. } -} // end addGameToAvailableList +} // ------------------------------------------------------------------------------------------------ /** Populate the listbox passed in with a list of the save games present on the hard drive */ @@ -1173,7 +1173,7 @@ void GameState::populateSaveGameListbox( GameWindow *listbox, SaveLoadLayoutType index = GadgetListBoxAddEntryText( listbox, newGameText, newGameColor, -1 ); GadgetListBoxSetItemData( listbox, NULL, index ); - } // end if + } // clear the available games clearAvailableGames(); @@ -1218,7 +1218,7 @@ void GameState::populateSaveGameListbox( GameWindow *listbox, SaveLoadLayoutType if( exists == FALSE ) displayLabel.format( L"%S", saveGameInfo->mapLabel.str() ); - } // end if + } // pick color for text (we alternate it each game) Color color; @@ -1237,12 +1237,12 @@ void GameState::populateSaveGameListbox( GameWindow *listbox, SaveLoadLayoutType // add this available game info in the user data pointer of that listbox item GadgetListBoxSetItemData( listbox, info, index ); - } // end for, info + } // select the top "new game" entry GadgetListBoxSetSelected( listbox, 0 ); -} // end pupulateSaveGameListbox +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE METHODS //////////////////////////////////////////////////////////////////////////////// @@ -1285,7 +1285,7 @@ void GameState::iterateSaveFiles( IterateSaveFileCallback callback, void *userDa // we are no longer on our first item first = FALSE; - } // end if, first + } // see if this is a file, and therefore a possible save file if( !(item.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ) @@ -1303,15 +1303,15 @@ void GameState::iterateSaveFiles( IterateSaveFileCallback callback, void *userDa // call the callback callback( filename, userData ); - } // end if, a save file + } - } // end if + } // on to the next file if( FindNextFile( hFile, &item ) == 0 ) done = TRUE; - } // end while + } // close search resources FindClose( hFile ); @@ -1319,7 +1319,7 @@ void GameState::iterateSaveFiles( IterateSaveFileCallback callback, void *userDa // restore the current directory SetCurrentDirectory( currentDirectory ); -} // end iterateSaveFiles +} // ------------------------------------------------------------------------------------------------ /** Save game to xfer or load game using xfer */ @@ -1391,7 +1391,7 @@ void GameState::xferSaveData( Xfer *xfer, SnapshotType which ) // end this block xfer->endBlock(); - } // end try + } catch( ... ) { @@ -1399,17 +1399,17 @@ void GameState::xferSaveData( Xfer *xfer, SnapshotType which ) blockName.str(), xfer->getIdentifier().str() )); throw; - } // end catch + } - } // end if + } - } // end for, all snapshots + } // write an end of file token AsciiString eofToken = SAVE_FILE_EOF; xfer->xferAsciiString( &eofToken ); - } // end if, save + } else { DEBUG_LOG(("GameState::xferSaveData() - not XFER_SAVE")); @@ -1432,7 +1432,7 @@ void GameState::xferSaveData( Xfer *xfer, SnapshotType which ) // all done done = TRUE; - } // end if + } else { @@ -1454,7 +1454,7 @@ void GameState::xferSaveData( Xfer *xfer, SnapshotType which ) // continue with while loop reading block tokens continue; - } // end if + } try { @@ -1468,7 +1468,7 @@ void GameState::xferSaveData( Xfer *xfer, SnapshotType which ) // read block end xfer->endBlock(); - } // end try + } catch( ... ) { @@ -1476,15 +1476,15 @@ void GameState::xferSaveData( Xfer *xfer, SnapshotType which ) blockInfo->blockName.str(), xfer->getIdentifier().str() )); throw; - } // end catch + } - } // end else, valid data block token + } - } // end while, not done + } - } // end else, load + } -} // end xferSaveData +} // ------------------------------------------------------------------------------------------------ /** Add a snapshot to the post process list for later */ @@ -1499,7 +1499,7 @@ void GameState::addPostProcessSnapshot( Snapshot *snapshot ) DEBUG_CRASH(( "GameState::addPostProcessSnapshot - invalid parameters" )); return; - } // end if + } /* // @@ -1518,15 +1518,15 @@ void GameState::addPostProcessSnapshot( Snapshot *snapshot ) DEBUG_CRASH(( "GameState::addPostProcessSnapshot - snapshot is already in list!" )); return; - } // end if + } - } // end for, it + } */ // add to the list m_snapshotPostProcessList.push_back( snapshot ); -} // end addPostProcessSnapshot +} // ------------------------------------------------------------------------------------------------ /** Post process entry point after all game data has been xferd from disk */ @@ -1549,7 +1549,7 @@ void GameState::gameStatePostProcessLoad( void ) // do processing snapshot->loadPostProcess(); - } // end for + } // clear the snapshot post process list as we are now done with it m_snapshotPostProcessList.clear(); @@ -1557,7 +1557,7 @@ void GameState::gameStatePostProcessLoad( void ) // evil... must ensure this is updated prior to the script engine running the first time. ThePartitionManager->update(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ /** Xfer method for the game state itself @@ -1586,7 +1586,7 @@ void GameState::xfer( Xfer *xfer ) // mission map name xfer->xferAsciiString( &saveGameInfo->missionMapName ); - } // end if + } // current system time SYSTEMTIME systemTime; @@ -1633,9 +1633,9 @@ void GameState::xfer( Xfer *xfer ) p++; // skip the '\' we're on saveGameInfo->mapLabel.set( p ); - } // end else + } - } // end if + } // xfer map label xfer->xferAsciiString( &saveGameInfo->mapLabel ); @@ -1654,7 +1654,7 @@ void GameState::xfer( Xfer *xfer ) xfer->xferInt( &saveGameInfo->missionNumber ); - } // end if + } else { @@ -1666,6 +1666,6 @@ void GameState::xfer( Xfer *xfer ) saveGameInfo->missionNumber = CampaignManager::INVALID_MISSION_NUMBER; xfer->xferInt( &saveGameInfo->missionNumber ); - } // end else + } -} // end xfer +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp index 137fef6e1de..5b542dbea1d 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp @@ -53,7 +53,7 @@ GameStateMap *TheGameStateMap = NULL; GameStateMap::GameStateMap( void ) { -} // end GameStateMap +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -66,7 +66,7 @@ GameStateMap::~GameStateMap( void ) // clearScratchPadMaps(); -} // end ~GameStateMap +} // ------------------------------------------------------------------------------------------------ /** Embed the pristine map into the xfer stream */ @@ -82,7 +82,7 @@ static void embedPristineMap( AsciiString map, Xfer *xfer ) DEBUG_CRASH(( "embedPristineMap - Error opening source file '%s'", map.str() )); throw SC_INVALID_DATA; - } // end if + } // how big is the map file Int fileSize = file->seek( 0, File::END ); @@ -98,7 +98,7 @@ static void embedPristineMap( AsciiString map, Xfer *xfer ) DEBUG_CRASH(( "embedPristineMap - Unable to allocate buffer for file '%s'", map.str() )); throw SC_INVALID_DATA; - } // end if + } // copy the file to the buffer if( file->read( buffer, fileSize ) != fileSize ) @@ -107,7 +107,7 @@ static void embedPristineMap( AsciiString map, Xfer *xfer ) DEBUG_CRASH(( "embeddPristineMap - Error reading from file '%s'", map.str() )); throw SC_INVALID_DATA; - } // end if + } // close the BIG file file->close(); @@ -121,7 +121,7 @@ static void embedPristineMap( AsciiString map, Xfer *xfer ) // delete the buffer delete [] buffer; -} // end embedPristineMap +} // ------------------------------------------------------------------------------------------------ /** Embed an "in use" map into the xfer stream. An "in use" map is one that has already @@ -138,7 +138,7 @@ static void embedInUseMap( AsciiString map, Xfer *xfer ) DEBUG_CRASH(( "embedInUseMap - Unable to open file '%s'", map.str() )); throw SC_INVALID_DATA; - } // end if + } // how big is the file fseek( fp, 0, SEEK_END ); @@ -155,7 +155,7 @@ static void embedInUseMap( AsciiString map, Xfer *xfer ) DEBUG_CRASH(( "embedInUseMap - Unable to allocate buffer for file '%s'", map.str() )); throw SC_INVALID_DATA; - } // end if + } // read the entire file if( fread( buffer, 1, fileSize, fp ) != fileSize ) @@ -164,7 +164,7 @@ static void embedInUseMap( AsciiString map, Xfer *xfer ) DEBUG_CRASH(( "embedInUseMap - Error reading from file '%s'", map.str() )); throw SC_INVALID_DATA; - } // end if + } // embed file into xfer stream xfer->beginBlock(); @@ -177,7 +177,7 @@ static void embedInUseMap( AsciiString map, Xfer *xfer ) // delete buffer delete [] buffer; -} // embedInUseMap +} // ------------------------------------------------------------------------------------------------ /** Extract the map from the xfer stream and save as a file with filename 'mapToSave' */ @@ -194,7 +194,7 @@ static void extractAndSaveMap( AsciiString mapToSave, Xfer *xfer ) DEBUG_CRASH(( "extractAndSaveMap - Unable to open file '%s'", mapToSave.str() )); throw SC_INVALID_DATA; - } // en + } // read data size from file dataSize = xfer->beginBlock(); @@ -207,7 +207,7 @@ static void extractAndSaveMap( AsciiString mapToSave, Xfer *xfer ) DEBUG_CRASH(( "extractAndSaveMap - Unable to allocate buffer for file '%s'", mapToSave.str() )); throw SC_INVALID_DATA; - } // end if + } // read map file xfer->xferUser( buffer, dataSize ); @@ -219,7 +219,7 @@ static void extractAndSaveMap( AsciiString mapToSave, Xfer *xfer ) DEBUG_CRASH(( "extractAndSaveMap - Error writing to file '%s'", mapToSave.str() )); throw SC_INVALID_DATA; - } // end if + } // close the new file fclose( fp ); @@ -230,7 +230,7 @@ static void extractAndSaveMap( AsciiString mapToSave, Xfer *xfer ) // delete the buffer delete [] buffer; -} // end extractAndSaveMap +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -299,7 +299,7 @@ void GameStateMap::xfer( Xfer *xfer ) // firstSave = TRUE; - } // end if + } // save the pristine name // For cross-machine compatibility, we always write @@ -316,7 +316,7 @@ void GameStateMap::xfer( Xfer *xfer ) xfer->xferInt( &gameMode); } - } // end if, save + } else { @@ -348,7 +348,7 @@ void GameStateMap::xfer( Xfer *xfer ) TheGameLogic->setGameMode((GameMode)gameMode); } - } // end else, load + } // map data if( xfer->getXferMode() == XFER_SAVE ) @@ -363,7 +363,7 @@ void GameStateMap::xfer( Xfer *xfer ) embedPristineMap( saveGameInfo->pristineMapName, xfer ); - } // end if, first save + } else { @@ -374,9 +374,9 @@ void GameStateMap::xfer( Xfer *xfer ) // embedInUseMap( saveGameInfo->saveGameMapName, xfer ); - } // end else + } - } // end if, save + } else { @@ -386,7 +386,7 @@ void GameStateMap::xfer( Xfer *xfer ) // extractAndSaveMap( saveGameInfo->saveGameMapName, xfer ); - } // end else + } // // it's important that early in the load process, we xfer the object ID counter @@ -444,7 +444,7 @@ void GameStateMap::xfer( Xfer *xfer ) TheGameLogic->setLoadingSave( FALSE ); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Delete any scratch pad maps in the save directory. Scratch pad maps are maps that @@ -486,7 +486,7 @@ void GameStateMap::clearScratchPadMaps( void ) // we are no longer on our first item first = FALSE; - } // end if, first + } // see if this is a file, and therefore a possible .map file if( !(item.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ) @@ -497,7 +497,7 @@ void GameStateMap::clearScratchPadMaps( void ) if( c && stricmp( c, ".map" ) == 0 ) fileToDelete.set( item.cFileName ); // we want to delete this one - } // end if + } // // find the next file before we delete this one, this is probably not necessary @@ -511,7 +511,7 @@ void GameStateMap::clearScratchPadMaps( void ) if( fileToDelete.isEmpty() == FALSE ) DeleteFile( fileToDelete.str() ); - } // end while + } // close search resources FindClose( hFile ); @@ -519,4 +519,4 @@ void GameStateMap::clearScratchPadMaps( void ) // restore our directory to the current directory SetCurrentDirectory( currentDirectory ); -} // end clearScratchPadMaps +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/Snapshot.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/Snapshot.cpp index 30f9750b251..74a34e89374 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/Snapshot.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/Snapshot.cpp @@ -37,7 +37,7 @@ Snapshot::Snapshot( void ) { -} // end Snapshot +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -53,4 +53,4 @@ Snapshot::~Snapshot( void ) // // TheGameState->notifySnapshotDeleted(); -} // end ~Snapshot +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp index 20d1702fcc5..2cf279dd14d 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp @@ -62,14 +62,14 @@ Upgrade::Upgrade( const UpgradeTemplate *upgradeTemplate ) m_next = NULL; m_prev = NULL; -} // end Upgrade +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- Upgrade::~Upgrade( void ) { -} // end ~Upgrade +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -77,7 +77,7 @@ Upgrade::~Upgrade( void ) void Upgrade::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -95,7 +95,7 @@ void Upgrade::xfer( Xfer *xfer ) // status xfer->xferUser( &m_status, sizeof( UpgradeStatusType ) ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -103,7 +103,7 @@ void Upgrade::xfer( Xfer *xfer ) void Upgrade::loadPostProcess( void ) { -} // end loadPostProcess +} /////////////////////////////////////////////////////////////////////////////////////////////////// // UPGRADE TEMPLATE /////////////////////////////////////////////////////////////////////////////// @@ -142,14 +142,14 @@ UpgradeTemplate::UpgradeTemplate( void ) m_buttonImage = NULL; m_academyClassificationType = ACT_NONE; -} // end UpgradeTemplate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- UpgradeTemplate::~UpgradeTemplate( void ) { -} // end ~UpgradeTemplate +} //------------------------------------------------------------------------------------------------- /** Calculate the time it takes (in logic frames) for a player to build this UpgradeTemplate */ @@ -166,7 +166,7 @@ Int UpgradeTemplate::calcTimeToBuild( Player *player ) const ///@todo modify this by power state of player return m_buildTime * LOGICFRAMES_PER_SECOND; -} // end calcTimeToBuild +} //------------------------------------------------------------------------------------------------- /** Calculate the cost takes this player to build this upgrade */ @@ -177,7 +177,7 @@ Int UpgradeTemplate::calcCostToBuild( Player *player ) const ///@todo modify this by any player handicaps return m_cost; -} // end calcCostToBuild +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -229,7 +229,7 @@ UpgradeCenter::UpgradeCenter( void ) m_nextTemplateMaskBit = 0; buttonImagesCached = FALSE; -} // end UpgradeCenter +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -250,9 +250,9 @@ UpgradeCenter::~UpgradeCenter( void ) // set head to next element m_upgradeList = next; - } // end while + } -} // end ~UpgradeCenter +} //------------------------------------------------------------------------------------------------- /** Upgrade center initialization */ @@ -328,7 +328,7 @@ UpgradeTemplate *UpgradeCenter::firstUpgradeTemplate( void ) return m_upgradeList; -} // end firstUpgradeTemplate +} //------------------------------------------------------------------------------------------------- /** Find upgrade matching name key */ @@ -354,7 +354,7 @@ const UpgradeTemplate *UpgradeCenter::findUpgrade( const AsciiString& name ) con return findUpgradeByKey( TheNameKeyGenerator->nameToKey( name ) ); -} // end findUpgrade +} //------------------------------------------------------------------------------------------------- /** Allocate a new upgrade template */ @@ -387,7 +387,7 @@ UpgradeTemplate *UpgradeCenter::newUpgrade( const AsciiString& name ) // return new upgrade return newUpgrade; -} // end newUnlinkedUpgrade +} //------------------------------------------------------------------------------------------------- /** Link an upgrade to our list */ @@ -406,7 +406,7 @@ void UpgradeCenter::linkUpgrade( UpgradeTemplate *upgrade ) m_upgradeList->friend_setPrev( upgrade ); m_upgradeList = upgrade; -} // end linkUpgrade +} //------------------------------------------------------------------------------------------------- /** Unlink an upgrade from our list */ @@ -425,7 +425,7 @@ void UpgradeCenter::unlinkUpgrade( UpgradeTemplate *upgrade ) else m_upgradeList = upgrade->friend_getNext(); -} // end unlinkUpgrade +} //------------------------------------------------------------------------------------------------- /** does this player have all the necessary things to make this upgrade */ @@ -453,7 +453,7 @@ Bool UpgradeCenter::canAffordUpgrade( Player *player, const UpgradeTemplate *upg return TRUE; // all is well -} // end canAffordUpgrade +} //------------------------------------------------------------------------------------------------- /** generate a list of upgrade names for WorldBuilder */ @@ -467,7 +467,7 @@ std::vector UpgradeCenter::getUpgradeNames( void ) const return upgradeNames; -} // end getUpgradeNames +} //------------------------------------------------------------------------------------------------- /** Parse an upgrade definition */ @@ -486,7 +486,7 @@ void UpgradeCenter::parseUpgradeDefinition( INI *ini ) // allocate a new item upgrade = TheUpgradeCenter->newUpgrade( name ); - } // end if + } // sanity DEBUG_ASSERTCRASH( upgrade, ("parseUpgradeDefinition: Unable to allocate upgrade '%s'", name.str()) ); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/TerrainTypes.cpp b/GeneralsMD/Code/GameEngine/Source/Common/TerrainTypes.cpp index 6cc025d213a..a07589b32c9 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/TerrainTypes.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/TerrainTypes.cpp @@ -63,14 +63,14 @@ TerrainType::TerrainType( void ) m_restrictConstruction = FALSE; m_next = NULL; -} // end TerrainType +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- TerrainType::~TerrainType( void ) { -} // end ~TerrainType +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -83,7 +83,7 @@ TerrainTypeCollection::TerrainTypeCollection( void ) m_terrainList = NULL; -} // end TerrainTypeCollection +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -104,9 +104,9 @@ TerrainTypeCollection::~TerrainTypeCollection( void ) // set the new head of the type list m_terrainList = temp; - } // end while + } -} // end ~TerrainTypeCollection +} //------------------------------------------------------------------------------------------------- /** Find a terrain type given the name */ @@ -121,12 +121,12 @@ TerrainType *TerrainTypeCollection::findTerrain( AsciiString name ) if( terrain->getName() == name ) return terrain; - } // end for terrain + } // not found return NULL; -} // end findTerrain +} //------------------------------------------------------------------------------------------------- /** Allocate a new type, assign the name, and tie to type list */ @@ -149,7 +149,7 @@ TerrainType *TerrainTypeCollection::newTerrain( AsciiString name ) terrain->friend_setClass( defaultTerrain->getClass() ); terrain->friend_setBlendEdge( defaultTerrain->isBlendEdge() ); - } // end if + } */ // assign a name @@ -162,4 +162,4 @@ TerrainType *TerrainTypeCollection::newTerrain( AsciiString name ) // return the new terrain return terrain; -} // end newTerrain +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/DrawModule.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/DrawModule.cpp index 9e1a875c68c..b875346fdcd 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/DrawModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/DrawModule.cpp @@ -42,7 +42,7 @@ void DrawModule::crc( Xfer *xfer ) // extend base class DrawableModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -60,7 +60,7 @@ void DrawModule::xfer( Xfer *xfer ) // extend base class DrawableModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -71,5 +71,5 @@ void DrawModule::loadPostProcess( void ) // extend base class DrawableModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/Module.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/Module.cpp index 52421895056..0607cddd1d4 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/Module.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/Module.cpp @@ -69,7 +69,7 @@ Module::~Module() { -} // end ~Module +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -77,7 +77,7 @@ Module::~Module() void Module::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -92,7 +92,7 @@ void Module::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** load post process */ @@ -100,7 +100,7 @@ void Module::xfer( Xfer *xfer ) void Module::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -116,14 +116,14 @@ ObjectModule::ObjectModule( Thing *thing, const ModuleData* moduleData ) : Modul m_object = AsObject(thing); DEBUG_ASSERTCRASH( m_object, ("Thing passed to ObjectModule is not an Object!") ); -} // end ObjectModule +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- ObjectModule::~ObjectModule( void ) { -} // end ~ObjectModule +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -134,7 +134,7 @@ void ObjectModule::crc( Xfer *xfer ) // extend base class Module::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -152,7 +152,7 @@ void ObjectModule::xfer( Xfer *xfer ) // extend base class Module::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** load post process */ @@ -163,7 +163,7 @@ void ObjectModule::loadPostProcess( void ) // extend base class Module::loadPostProcess(); -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -179,14 +179,14 @@ DrawableModule::DrawableModule( Thing *thing, const ModuleData* moduleData ) : M m_drawable = AsDrawable(thing); DEBUG_ASSERTCRASH( m_drawable, ("Thing passed to DrawableModule is not a Drawable!") ); -} // end ~DrawableModule +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- DrawableModule::~DrawableModule( void ) { -} // end ~DrawableModule +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -197,7 +197,7 @@ void DrawableModule::crc( Xfer *xfer ) // extend base class Module::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -215,7 +215,7 @@ void DrawableModule::xfer( Xfer *xfer ) // extend base class Module::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** load post process */ @@ -226,7 +226,7 @@ void DrawableModule::loadPostProcess( void ) // extend base class Module::loadPostProcess(); -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp index d9e1a6fd681..fcd6a411b40 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp @@ -559,7 +559,7 @@ void ModuleFactory::init( void ) addModule( SwayClientUpdate ); addModule( BeaconClientUpdate ); -} // end init +} //------------------------------------------------------------------------------------------------- Int ModuleFactory::findModuleInterfaceMask(const AsciiString& name, ModuleType type) @@ -682,7 +682,7 @@ Module *ModuleFactory::newModule( Thing *thing, const AsciiString& name, const M return NULL; -} // end newModule +} //------------------------------------------------------------------------------------------------- /** Add a module template to our list of templates */ diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/Thing.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/Thing.cpp index e7025811388..89c917c3775 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/Thing.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/Thing.cpp @@ -60,7 +60,7 @@ Thing::Thing( const ThingTemplate *thingTemplate ) DEBUG_CRASH(( "no template" )); return; - } // end if + } m_template = thingTemplate; #if defined(RTS_DEBUG) @@ -384,4 +384,4 @@ void Thing::transformPoint( const Coord3D *in, Coord3D *out ) out->y = vectorOut.Y; out->z = vectorOut.Z; -} // end transformPoint +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp index a568199b338..f7dc54fb5a6 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp @@ -74,7 +74,7 @@ void ThingFactory::freeDatabase( void ) m_templateHashMap.clear(); -} // end freeDatabase +} //------------------------------------------------------------------------------------------------- /** add the thing template passed in, into the databse */ @@ -93,7 +93,7 @@ void ThingFactory::addTemplate( ThingTemplate *tmplate ) // Add it to the hash table. m_templateHashMap[tmplate->getName()] = tmplate; -} // end addTemplate +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC METHODS @@ -111,7 +111,7 @@ ThingFactory::ThingFactory() #else m_templateHashMap.reserve( TEMPLATE_HASH_SIZE ); #endif -} // end ThingFactory +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -121,7 +121,7 @@ ThingFactory::~ThingFactory() // free all the template data freeDatabase(); -} // end ~ThingFactory +} //------------------------------------------------------------------------------------------------- /** Create a new template with name 'name' and add to our template list */ @@ -142,7 +142,7 @@ ThingTemplate *ThingFactory::newTemplate( const AsciiString& name ) *newTemplate = *defaultT; newTemplate->setCopiedFromDefault(); - } // end if + } // give template a unique identifier newTemplate->friend_setTemplateID( m_nextTemplateID++ ); @@ -192,7 +192,7 @@ ThingTemplate* ThingFactory::newOverride( ThingTemplate *thingTemplate ) // return the newly created override for us to set values with etc return newTemplate; -} // end newOverride +} //------------------------------------------------------------------------------------------------- /** Init */ @@ -200,7 +200,7 @@ ThingTemplate* ThingFactory::newOverride( ThingTemplate *thingTemplate ) void ThingFactory::init( void ) { -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset */ @@ -238,7 +238,7 @@ void ThingFactory::reset( void ) t = nextT; } -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update */ @@ -246,7 +246,7 @@ void ThingFactory::reset( void ) void ThingFactory::update( void ) { -} // end update +} //------------------------------------------------------------------------------------------------- /** Return the template with the matching database name */ @@ -298,7 +298,7 @@ ThingTemplate *ThingFactory::findTemplateInternal( const AsciiString& name, Bool } return NULL; -} // end getTemplate +} //============================================================================= Object *ThingFactory::newObject( const ThingTemplate *tmplate, Team *team, ObjectStatusMaskType statusBits ) @@ -359,7 +359,7 @@ Drawable *ThingFactory::newDrawable(const ThingTemplate *tmplate, DrawableStatus return draw; -} // end newDrawableByType +} #if defined(RTS_DEBUG) || defined(DEBUG_CRASHING) AsciiString TheThingTemplateBeingParsedName; @@ -540,10 +540,10 @@ void ThingFactory::postProcessLoad() } #endif - } // end for + } #ifdef CHECK_THING_NAMES dumpMissingStringNames(); exit(0); #endif -} // end postProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp index 64585bb4247..9ed058a318e 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp @@ -286,7 +286,7 @@ const ModuleInfo::Nugget *ModuleInfo::getNuggetWithTag( const AsciiString& tag ) // no match return NULL; -} // end isTagPresent +} // ------------------------------------------------------------------------------------------------ /** Add this module info to the thing template */ @@ -324,7 +324,7 @@ void ModuleInfo::addModuleInfo(ThingTemplate *thingTemplate, // srj sez: prevent people from ignoring this. throw INI_INVALID_DATA; - } // end if + } nugget = thingTemplate->getDrawModuleInfo().getNuggetWithTag( moduleTag ); if( nugget != NULL ) @@ -342,7 +342,7 @@ void ModuleInfo::addModuleInfo(ThingTemplate *thingTemplate, // srj sez: prevent people from ignoring this. throw INI_INVALID_DATA; - } // end if + } nugget = thingTemplate->getClientUpdateModuleInfo().getNuggetWithTag( moduleTag ); if( nugget != NULL ) @@ -359,7 +359,7 @@ void ModuleInfo::addModuleInfo(ThingTemplate *thingTemplate, nugget->first.str()) ); // srj sez: prevent people from ignoring this. throw INI_INVALID_DATA; - } // end if + } #endif diff --git a/GeneralsMD/Code/GameEngine/Source/Common/UserPreferences.cpp b/GeneralsMD/Code/GameEngine/Source/Common/UserPreferences.cpp index 8c3d93f6031..15535d94d50 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/UserPreferences.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/UserPreferences.cpp @@ -143,7 +143,7 @@ Bool UserPreferences::load(AsciiString fname) continue; (*this)[key] = val; - } // end while + } fclose(fp); return true; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Color.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Color.cpp index e8335dd8481..bfb45ab2c81 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Color.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Color.cpp @@ -96,7 +96,7 @@ void GameGetColorComponents( Color color, *green = (color & 0x0000FF00) >> 8; *blue = (color & 0x000000FF); -} // end GameGetColorComponents +} //Put on ice until later M Lorenzen //void GameGetColorComponentsWithCheatSpy( Color color, @@ -148,5 +148,5 @@ Color GameDarkenColor( Color color, Int percent ) return GameMakeColor(r,g,b,a); -}// end GameDarkenColor +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp index 604c6b1e8e3..899f09220a0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp @@ -94,7 +94,7 @@ void INI::parseCredits( INI *ini ) // parse the ini definition ini->initFromINI( TheCredits, TheCredits->getFieldParse() ); -} // end parseCommandButtonDefinition +} CreditsLine::CreditsLine() diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp index ddcf06e95bc..7e29edcd799 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp @@ -185,7 +185,7 @@ void Display::setWidth( UnsignedInt width ) if( TheMouse ) TheMouse->setMouseLimits(); -} // end setWidth +} // Display::setHeight ========================================================= /** Set the height of the display */ @@ -200,7 +200,7 @@ void Display::setHeight( UnsignedInt height ) if( TheMouse ) TheMouse->setMouseLimits(); -} // end setHeight +} //============================================================================ // Display::playLogoMovie diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/DisplayString.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/DisplayString.cpp index a67a98954e6..95d14f36809 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/DisplayString.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/DisplayString.cpp @@ -79,7 +79,7 @@ DisplayString::DisplayString( void ) m_next = NULL; m_prev = NULL; -} // end DisplayString +} // DisplayString::~DisplayString ============================================== /** */ @@ -90,7 +90,7 @@ DisplayString::~DisplayString( void ) // free any data reset(); -} // end ~DisplayString +} // DisplayString::setText ===================================================== /** Copy the text to this instance */ @@ -105,7 +105,7 @@ void DisplayString::setText( UnicodeString text ) // our text has now changed notifyTextChanged(); -} // end setText +} // DisplayString::reset ======================================================= /** Free and reset all the data for this string, effectively making this @@ -119,7 +119,7 @@ void DisplayString::reset( void ) // no font m_font = NULL; -} // end reset +} // DisplayString::removeLastChar ============================================== /** Remove the last character from the string text */ @@ -131,7 +131,7 @@ void DisplayString::removeLastChar( void ) // our text has now changed notifyTextChanged(); -} // end removeLastChar +} // DisplayString::truncateBy ================================================== /** Remove the last charCount characters from the string text */ @@ -143,7 +143,7 @@ void DisplayString::truncateBy( const Int charCount ) // our text has now changed notifyTextChanged(); -} // end truncateBy +} // DisplayString::truncateTo ================================================== /** Remove the last characters from the string text so it's at the most @@ -156,7 +156,7 @@ void DisplayString::truncateTo( const Int maxLength ) // our text has now changed notifyTextChanged(); -} // end truncateTo +} // DisplayString::appendChar ================================================== /** Append character to the end of the string */ @@ -168,5 +168,5 @@ void DisplayString::appendChar( WideChar c ) // text has now changed notifyTextChanged(); -} // end appendchar +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/DisplayStringManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/DisplayStringManager.cpp index 11f5177dcfd..d29ad7c208d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/DisplayStringManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/DisplayStringManager.cpp @@ -46,7 +46,7 @@ DisplayStringManager::DisplayStringManager( void ) m_stringList = NULL; m_currentCheckpoint = NULL; -} // end DisplayStringManager +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -59,7 +59,7 @@ DisplayStringManager::~DisplayStringManager( void ) // assert( m_stringList == NULL ); -} // end ~DisplayStringManager +} //------------------------------------------------------------------------------------------------- /** Link a display string to the master list */ @@ -77,7 +77,7 @@ void DisplayStringManager::link( DisplayString *string ) m_stringList = string; -} // end link +} //------------------------------------------------------------------------------------------------- /** Unlink a display string from the master list */ @@ -98,6 +98,6 @@ void DisplayStringManager::unLink( DisplayString *string ) assert( string == m_stringList ); m_stringList = string->m_next; - } // end else + } -} // end unLink +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index 8393a5880bc..9769bade42b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -222,7 +222,7 @@ static const char *drawableIconIndexToName( DrawableIconType iconIndex ) return TheDrawableIconNames[ iconIndex ]; -} // end drawableIconIndexToName +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -237,7 +237,7 @@ static DrawableIconType drawableIconNameToIndex( const char *iconName ) return ICON_INVALID; -} // end drawableIconNameToIndex +} // ------------------------------------------------------------------------------------------------ // constants @@ -419,7 +419,7 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatus statusBit assert( 0 ); return; - } // end if + } m_instance.Make_Identity(); m_instanceIsIdentity = true; @@ -524,7 +524,7 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatus statusBit startAmbientSound(); } -} // end Drawable +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -600,9 +600,9 @@ void Drawable::onDestroy( void ) for( Module** m = m_modules[ i ]; m && *m; ++m ) (*m)->onDelete(); - } // end for i + } -} // end onDestroy +} //------------------------------------------------------------------------------------------------- Bool Drawable::isVisible() @@ -1017,7 +1017,7 @@ void Drawable::onSelected() } } -} // end onSelected +} //------------------------------------------------------------------------------------------------- /** Gathering point for all things besides actual selection that must happen on deselection */ @@ -1131,7 +1131,7 @@ void Drawable::setEffectiveOpacity( Real pulseFactor, Real explicitOpacity /* = Real pulseAmount = pulseMargin * pf; m_effectiveStealthOpacity = m_stealthOpacity + pulseAmount; -} ///< get alpha/opacity value used to override defaults when drawing. +} @@ -1217,7 +1217,7 @@ void Drawable::updateDrawable( void ) (*dm)->setTerrainDecalOpacity(m_decalOpacity); } - }//end if (*dm) + } } else m_decalOpacity = 0; @@ -1478,19 +1478,19 @@ void Drawable::calcPhysicsXformThrust( const Locomotor *locomotor, PhysicsXformI m_locoInfo->m_pitch += WOBBLE_RATE; m_locoInfo->m_yaw += WOBBLE_RATE; - } // end if + } else { m_locoInfo->m_pitch += (WOBBLE_RATE / 2.0f); m_locoInfo->m_yaw += (WOBBLE_RATE / 2.0f); - } // end else + } if( m_locoInfo->m_pitch >= MAX_WOBBLE ) m_locoInfo->m_wobble = -1.0f; - } // end if + } else { @@ -1500,23 +1500,23 @@ void Drawable::calcPhysicsXformThrust( const Locomotor *locomotor, PhysicsXformI m_locoInfo->m_pitch -= WOBBLE_RATE; m_locoInfo->m_yaw -= WOBBLE_RATE; - } // end if + } else { m_locoInfo->m_pitch -= (WOBBLE_RATE / 2.0f); m_locoInfo->m_yaw -= (WOBBLE_RATE / 2.0f); - } // end else + } if( m_locoInfo->m_pitch <= MIN_WOBBLE ) m_locoInfo->m_wobble = 1.0f; - } // end else + } info.m_totalPitch = m_locoInfo->m_pitch; info.m_totalYaw = m_locoInfo->m_yaw; - } // end if, wobble exists + } if( THRUST_ROLL ) { @@ -1524,7 +1524,7 @@ void Drawable::calcPhysicsXformThrust( const Locomotor *locomotor, PhysicsXformI m_locoInfo->m_roll += THRUST_ROLL; info.m_totalRoll = m_locoInfo->m_roll; - } // end if + } } @@ -2711,7 +2711,7 @@ static Bool computeHealthRegion( const Drawable *draw, IRegion2D& region ) return TRUE; -} // end computeHealthRegion +} // ------------------------------------------------------------------------------------------------ @@ -3665,14 +3665,14 @@ void Drawable::drawDisabled(const IRegion2D* healthBarRegion) screen.y = healthBarRegion->hi.y - (frameHeight + barHeight); getIconInfo()->m_icon[ ICON_DISABLED ]->draw( screen.x, screen.y, frameWidth, frameHeight ); - } // end if - } // end if + } + } else { // delete icon if necessary killIcon(ICON_DISABLED); - } // end if + } } @@ -3720,7 +3720,7 @@ void Drawable::drawConstructPercent( const IRegion2D *healthBarRegion ) // record this percent as our last displayed so we don't un-necessarily rebuild the string m_lastConstructDisplayed = obj->getConstructionPercent(); - } // end if + } // get center position in drawable ICoord2D screen; @@ -3739,7 +3739,7 @@ void Drawable::drawConstructPercent( const IRegion2D *healthBarRegion ) screen.x -= (m_constructDisplayString->getWidth() / 2); m_constructDisplayString->draw( screen.x, screen.y, color, dropColor ); -} // end drawConstructPercent +} //------------------------------------------------------------------------------------------------- /** Draw caption */ @@ -3775,7 +3775,7 @@ void Drawable::drawCaption( const IRegion2D *healthBarRegion ) Color dropColor = GameMakeColor( 0, 0, 0, 255 ); m_captionDisplayString->draw( screen.x, screen.y, color, dropColor ); -} // end drawCaption +} // ------------------------------------------------------------------------------------------------ /** Draw any veterency markers that should be displayed */ @@ -3827,7 +3827,7 @@ void Drawable::drawVeterancy( const IRegion2D *healthBarRegion ) // draw the image TheDisplay->drawImage(image, screenCenter.x + 1, screenCenter.y + 1, screenCenter.x + 1 + vetBoxWidth, screenCenter.y + 1 + vetBoxHeight); -} // end drawVeterancy +} // ------------------------------------------------------------------------------------------------ /** Draw health bar information for drawable */ @@ -3944,9 +3944,9 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion) TheDisplay->drawFillRect( healthBarRegion->lo.x + 1, healthBarRegion->lo.y + 1, (healthBoxWidth - 2) * healthRatio, healthBoxHeight - 2, color ); - } // end if + } -} // end drawHealthBar +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -4129,7 +4129,7 @@ void Drawable::setID( DrawableID id ) m_ambientSound->m_event.setDrawableID(m_id); } -} // end setID +} // ------------------------------------------------------------------------------------------------ /** Return drawable ID, this ID is only good on the client */ @@ -4142,7 +4142,7 @@ DrawableID Drawable::getID( void ) const return m_id; -} // end get ID +} //------------------------------------------------------------------------------------------------- void Drawable::friend_bindToObject( Object *obj ) ///< bind this drawable to an object ID @@ -4748,7 +4748,7 @@ void Drawable::preloadAssets( TimeOfDay timeOfDay ) for( Module** m = m_modules[i]; m && *m; ++m ) (*m)->preloadAssets( timeOfDay ); -} // end preloadAssets +} //------------------------------------------------------------------------------------------------- // Simply searches for the first occurrence of a specified client update module. @@ -4775,7 +4775,7 @@ ClientUpdateModule* Drawable::findClientUpdateModule( NameKeyType key ) void Drawable::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer the drawable modules @@ -4838,9 +4838,9 @@ void Drawable::xferDrawableModules( Xfer *xfer ) // end data block xfer->endBlock(); - } // end for, m + } - } // end if, save + } else { // read each module @@ -4861,9 +4861,9 @@ void Drawable::xferDrawableModules( Xfer *xfer ) module = *m; break; // exit for m - } // end if + } - } // end for, m + } // new block of data Int dataSize = xfer->beginBlock(); @@ -4883,25 +4883,25 @@ void Drawable::xferDrawableModules( Xfer *xfer ) // skip this data in the file xfer->skip( dataSize ); - } // end if + } else { // xfer the data into this module xfer->xferSnapshot( module ); - } // end else + } // end of data block xfer->endBlock(); - } // end for j + } - } // end else, load + } - } // end for curModuleType + } -} // end xferDrawableModules +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -4946,7 +4946,7 @@ void Drawable::xfer( Xfer *xfer ) if( xfer->getXferMode() == XFER_LOAD ) replaceModelConditionFlags( m_conditionState, TRUE ); - } // end if + } if( version >= 3 ) { @@ -4983,7 +4983,7 @@ void Drawable::xfer( Xfer *xfer ) // xfer xfer->xferSnapshot( m_selectionFlashEnvelope ); - } // end if + } // color tint envelope Bool colFlash = (m_colorTintEnvelope != NULL); @@ -4998,7 +4998,7 @@ void Drawable::xfer( Xfer *xfer ) // xfer xfer->xferSnapshot( m_colorTintEnvelope ); - } // end if + } // terrain decal type TerrainDecalType decal = getTerrainDecalType(); @@ -5041,10 +5041,10 @@ void Drawable::xfer( Xfer *xfer ) getTemplate()->getName().str(), m_object->getTemplate()->getName().str() )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } else { @@ -5060,11 +5060,11 @@ void Drawable::xfer( Xfer *xfer ) #endif throw SC_INVALID_DATA; - } // end if + } - } // end else + } - } // end if + } // particle @@ -5194,7 +5194,7 @@ void Drawable::xfer( Xfer *xfer ) if( xfer->getXferMode() == XFER_LOAD ) replaceModelConditionFlags( m_conditionState, TRUE ); - } // end if + } // expiration date xfer->xferUnsignedInt( &m_expirationDate ); @@ -5238,9 +5238,9 @@ void Drawable::xfer( Xfer *xfer ) // icon data xfer->xferSnapshot( getIconInfo()->m_icon[ i ] ); - } // end for, i + } - } // end if, save + } else { Int i; @@ -5272,7 +5272,7 @@ void Drawable::xfer( Xfer *xfer ) DEBUG_CRASH(( "Drawable::xfer - Unknown icon template '%s'", iconTemplateName.str() )); throw SC_INVALID_DATA; - } // end if + } // create icon getIconInfo()->m_icon[ iconIndex ] = newInstance(Anim2D)( animTemplate, TheAnim2DCollection ); @@ -5280,9 +5280,9 @@ void Drawable::xfer( Xfer *xfer ) // icon data xfer->xferSnapshot( getIconInfo()->m_icon[ iconIndex ] ); - } // end for, i + } - } // end else, load + } if( xfer->getXferMode() == XFER_LOAD ) { @@ -5405,7 +5405,7 @@ void Drawable::xfer( Xfer *xfer ) } } } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -5435,7 +5435,7 @@ void Drawable::loadPostProcess( void ) stopAmbientSound(); } -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- const Locomotor* Drawable::getLocomotor() const @@ -5608,7 +5608,7 @@ void TintEnvelope::update(void) void TintEnvelope::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -5644,7 +5644,7 @@ void TintEnvelope::xfer( Xfer *xfer ) // state xfer->xferByte( &m_envState ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load Post Process */ @@ -5652,5 +5652,5 @@ void TintEnvelope::xfer( Xfer *xfer ) void TintEnvelope::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/AnimatedParticleSysBoneClientUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/AnimatedParticleSysBoneClientUpdate.cpp index 3a8a429c8db..26d7b115fc3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/AnimatedParticleSysBoneClientUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/AnimatedParticleSysBoneClientUpdate.cpp @@ -100,7 +100,7 @@ void AnimatedParticleSysBoneClientUpdate::crc( Xfer *xfer ) // extend base class ClientUpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -119,7 +119,7 @@ void AnimatedParticleSysBoneClientUpdate::xfer( Xfer *xfer ) ClientUpdateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -130,4 +130,4 @@ void AnimatedParticleSysBoneClientUpdate::loadPostProcess( void ) // extend base class ClientUpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp index 2778c87dfcb..338b0cc82ec 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp @@ -150,7 +150,7 @@ void BeaconClientUpdate::hideBeacon( void ) if( system ) system->stop(); - } // end if + } // DEBUG_LOG(("in hideBeacon(): draw=%d, m_particleSystemID=%d", draw, m_particleSystemID)); @@ -192,7 +192,7 @@ void BeaconClientUpdate::crc( Xfer *xfer ) // extend base class ClientUpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -216,7 +216,7 @@ void BeaconClientUpdate::xfer( Xfer *xfer ) // last radar pulse xfer->xferUnsignedInt( &m_lastRadarPulse ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -227,4 +227,4 @@ void BeaconClientUpdate::loadPostProcess( void ) // extend base class ClientUpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp index 945e31b3228..0b234535fcc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp @@ -145,7 +145,7 @@ void SwayClientUpdate::crc( Xfer *xfer ) // extend base class ClientUpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -184,7 +184,7 @@ void SwayClientUpdate::xfer( Xfer *xfer ) // swaying xfer->xferBool( &m_swaying ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -197,4 +197,4 @@ void SwayClientUpdate::loadPostProcess( void ) updateSway(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 42b35f3d5b2..25eeec1304f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -228,7 +228,7 @@ void ControlBar::populatePurchaseScience( Player* player ) { // hide window on interface m_sciencePurchaseWindowsRank1[ i ]->winHide( TRUE ); - } // end if + } else { // make sure the window is not hidden @@ -273,9 +273,9 @@ void ControlBar::populatePurchaseScience( Player* player ) m_sciencePurchaseWindowsRank1[ i ]->winHide(TRUE); } } - } // end else + } - } // end for + } for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_3; i++ ) { @@ -288,7 +288,7 @@ void ControlBar::populatePurchaseScience( Player* player ) { // hide window on interface m_sciencePurchaseWindowsRank3[ i ]->winHide( TRUE ); - } // end if + } else { // make sure the window is not hidden @@ -336,9 +336,9 @@ void ControlBar::populatePurchaseScience( Player* player ) m_sciencePurchaseWindowsRank3[ i ]->winHide(TRUE); } - } // end else + } - } // end for + } for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_8; i++ ) { @@ -351,7 +351,7 @@ void ControlBar::populatePurchaseScience( Player* player ) { // hide window on interface m_sciencePurchaseWindowsRank8[ i ]->winHide( TRUE ); - } // end if + } else { // make sure the window is not hidden @@ -394,9 +394,9 @@ void ControlBar::populatePurchaseScience( Player* player ) m_sciencePurchaseWindowsRank8[ i ]->winHide(TRUE); } - } // end else + } - } // end for + } GameWindow *win = NULL; @@ -544,14 +544,14 @@ void CommandButton::parseCommand( INI* ini, void *instance, void *store, const v *command = (GUICommandType)i; return; - } // end if + } - } // end for i + } // if we're here the command was not found throw INI_INVALID_DATA; -} // end parseCommand +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -822,7 +822,7 @@ void CommandSet::parseCommandButton( INI* ini, void *instance, void *store, cons ini->getLineNum(), ini->getFilename().str(), token )); throw INI_INVALID_DATA; - } // end if + } // get the index to store the command at, and the command array itself const CommandButton **buttonArray = (const CommandButton **)store; @@ -835,7 +835,7 @@ void CommandSet::parseCommandButton( INI* ini, void *instance, void *store, cons // save it buttonArray[ buttonIndex ] = commandButton; -} // end parseCommand +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -872,7 +872,7 @@ void CommandSet::friend_addToList(CommandSet** listHead) CommandSet::~CommandSet( void ) { -} // end ~CommandSet +} /////////////////////////////////////////////////////////////////////////////////////////////////// // ControlBar ///////////////////////////////////////////////////////////////////////////////////// @@ -984,7 +984,7 @@ ControlBar::ControlBar( void ) m_consecutiveDirtyFrames = 0; #endif -} // end ControlBar +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1029,7 +1029,7 @@ ControlBar::~ControlBar( void ) deleteInstance(m_commandSets); m_commandSets = set; - } // end while + } // destroy all our command button definitions CommandButton *button; @@ -1039,7 +1039,7 @@ ControlBar::~ControlBar( void ) deleteInstance(m_commandButtons); m_commandButtons = button; - } // end while + } if(m_buildToolTipLayout) { m_buildToolTipLayout->destroyWindows(); @@ -1062,7 +1062,7 @@ ControlBar::~ControlBar( void ) m_rightHUDCameoWindow->winSetUserData(NULL); } -} // end ~ControlBar +} void ControlBarPopupDescriptionUpdateFunc( WindowLayout *layout, void *param ); //------------------------------------------------------------------------------------------------- @@ -1157,7 +1157,7 @@ void ControlBar::init( void ) - } // end for i + } for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_1; i++ ) @@ -1167,7 +1167,7 @@ void ControlBar::init( void ) m_sciencePurchaseWindowsRank1[ i ] = TheWindowManager->winGetWindowFromId( m_contextParent[ CP_PURCHASE_SCIENCE ], id ); m_sciencePurchaseWindowsRank1[ i ]->winSetStatus( WIN_STATUS_USE_OVERLAY_STATES ); - } // end for i + } for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_3; i++ ) { windowName.format( "GeneralsExpPoints.wnd:ButtonRank3Number%d", i ); @@ -1175,7 +1175,7 @@ void ControlBar::init( void ) m_sciencePurchaseWindowsRank3[ i ] = TheWindowManager->winGetWindowFromId( m_contextParent[ CP_PURCHASE_SCIENCE ], id ); m_sciencePurchaseWindowsRank3[ i ]->winSetStatus( WIN_STATUS_USE_OVERLAY_STATES ); - } // end for i + } for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_8; i++ ) { @@ -1184,7 +1184,7 @@ void ControlBar::init( void ) m_sciencePurchaseWindowsRank8[ i ] = TheWindowManager->winGetWindowFromId( m_contextParent[ CP_PURCHASE_SCIENCE ], id ); m_sciencePurchaseWindowsRank8[ i ]->winSetStatus( WIN_STATUS_USE_OVERLAY_STATES ); - } // end for i + } // keep a pointer to the window making up the right HUD display id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:RightHUD" ); @@ -1307,7 +1307,7 @@ void ControlBar::init( void ) switchToContext( CB_CONTEXT_NONE, NULL ); } -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset the context sensitive control bar GUI */ @@ -1395,7 +1395,7 @@ void ControlBar::reset( void ) m_lastFlashedAtPointValue = -1; m_genStarFlash = TRUE; -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update phase, we can track if our selected object is destroyed, update button @@ -1567,7 +1567,7 @@ void ControlBar::update( void ) updateContextMultiSelect(); return; - } // end if + } // if nothing is selected get out of here except if we're in the Purchase science context... that requires // us to not have anything selected @@ -1578,7 +1578,7 @@ void ControlBar::update( void ) DEBUG_ASSERTCRASH( m_currContext == CB_CONTEXT_NONE, ("ControlBar::update no selection, but not we're not showing the default NONE context") ); return; - } // end if + } @@ -1592,7 +1592,7 @@ void ControlBar::update( void ) switchToContext( CB_CONTEXT_NONE, NULL ); return; - } // end if + } switch( m_currContext ) { @@ -1626,11 +1626,11 @@ void ControlBar::update( void ) updateContextOCLTimer(); break; - } // end switch + } -} // end update +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1644,7 +1644,7 @@ void ControlBar::onDrawableSelected( Drawable *draw ) TheInGameUI->setGUICommand( NULL ); -} // end onDrawableSelected +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1667,7 +1667,7 @@ void ControlBar::onDrawableDeselected( Drawable *draw ) // TheInGameUI->placeBuildAvailable( NULL, NULL ); -} // end onDrawableDeselected +} //------------------------------------------------------------------------------------------------- @@ -1895,7 +1895,7 @@ void ControlBar::evaluateContextUI( void ) switchToContext( CB_CONTEXT_UNDER_CONSTRUCTION, drawToEvaluateFor ); contextSelected = TRUE; - } // end else if + } // check for a regular switch to the appropriate context if( contextSelected == FALSE ) @@ -1917,7 +1917,7 @@ void ControlBar::evaluateContextUI( void ) if( obj->isLocallyControlled() == TRUE || relationship == NEUTRAL ) switchToContext( CB_CONTEXT_STRUCTURE_INVENTORY, drawToEvaluateFor ); - } // end else if + } else if( update ) { switchToContext( CB_CONTEXT_OCL_TIMER, drawToEvaluateFor ); @@ -1927,18 +1927,18 @@ void ControlBar::evaluateContextUI( void ) switchToContext( CB_CONTEXT_COMMAND, drawToEvaluateFor ); - } // end else if + } else if (obj->getControllingPlayer()->getPlayerTemplate()->getBeaconTemplate().compare(obj->getTemplate()->getName()) == 0) { switchToContext( CB_CONTEXT_BEACON, drawToEvaluateFor ); } else switchToContext( CB_CONTEXT_NONE, drawToEvaluateFor ); - } // end else + } - } // end else + } -} // end evaluateContextUI +} //------------------------------------------------------------------------------------------------- /** Find a command button of the given name if present */ @@ -1952,7 +1952,7 @@ CommandButton *ControlBar::findNonConstCommandButton( const AsciiString& name ) return NULL; // not found -} // end findCommandButton +} //------------------------------------------------------------------------------------------------- /** Allocate a new command button, assign name, and tie to list */ @@ -1973,7 +1973,7 @@ CommandButton *ControlBar::newCommandButton( const AsciiString& name ) // return the new button return newButton; -} // end newCommandButton +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2018,7 +2018,7 @@ CommandButton *ControlBar::newCommandButtonOverride( CommandButton *buttonToOver if (ini->getLoadType() == INI_LOAD_CREATE_OVERRIDES) { commandSet->markAsOverride(); } - } // end if + } else if( ini->getLoadType() != INI_LOAD_CREATE_OVERRIDES ) { //Holy crap, this sucks to debug!!! @@ -2041,7 +2041,7 @@ CommandButton *ControlBar::newCommandButtonOverride( CommandButton *buttonToOver // parse the ini definition ini->initFromINI( commandSet, commandSet->friend_getFieldParse() ); -} // end parseCommandSetDefinition +} //------------------------------------------------------------------------------------------------- /** Find existing command set by name */ @@ -2093,7 +2093,7 @@ CommandSet *ControlBar::newCommandSet( const AsciiString& name ) // return the newly created set return set; -} // end newCommandSet +} //------------------------------------------------------------------------------------------------- /** Create an overridden command set. */ @@ -2128,7 +2128,7 @@ CBCommandStatus ControlBar::processContextSensitiveButtonClick( GameWindow *butt // call command processing method return processCommandUI( button, gadgetMessage ); -} // end processContextSensitiveButtonClick +} //------------------------------------------------------------------------------------------------- /** Process a button click for the context sensitive GUI */ @@ -2140,7 +2140,7 @@ CBCommandStatus ControlBar::processContextSensitiveButtonTransition( GameWindow // call command processing method return processCommandTransitionUI( button, gadgetMessage ); -} // end processContextSensitiveButtonClick +} //------------------------------------------------------------------------------------------------- @@ -2224,7 +2224,7 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) break; - } // end none + } //--------------------------------------------------------------------------------------------- case CB_CONTEXT_COMMAND: @@ -2257,17 +2257,17 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) m_contextParent[ CP_BUILD_QUEUE ]->winHide( FALSE ); populateBuildQueue( obj ); setPortraitByObject( NULL ); - } // end if + } else { setPortraitByObject( obj ); } - } // end if + } break; - } // end command + } //--------------------------------------------------------------------------------------------- case CB_CONTEXT_STRUCTURE_INVENTORY: @@ -2288,7 +2288,7 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) break; - } // end inventory + } //--------------------------------------------------------------------------------------------- case CB_CONTEXT_BEACON: @@ -2310,7 +2310,7 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) break; - } // end beacon + } //--------------------------------------------------------------------------------------------- case CB_CONTEXT_UNDER_CONSTRUCTION: @@ -2331,7 +2331,7 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) break; - } // end under construction + } //--------------------------------------------------------------------------------------------- case CB_CONTEXT_OCL_TIMER: @@ -2352,7 +2352,7 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) break; - } // end under construction + } //--------------------------------------------------------------------------------------------- case CB_CONTEXT_MULTI_SELECT: @@ -2374,7 +2374,7 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) break; - } // end multi select + } case CB_CONTEXT_OBSERVER_LIST: { @@ -2393,7 +2393,7 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) populateObserverList(); break; - } // end multi select + } //--------------------------------------------------------------------------------------------- default: @@ -2402,14 +2402,14 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) DEBUG_ASSERTCRASH( 0, ("ControlBar::switchToContext, unknown context '%d'", context) ); break; - } // end default + } - } // end switch + } // save our context m_currContext = context; -} // end switchToContext +} void ControlBar::setCommandBarBorder( GameWindow *button, CommandButtonMappedBorderType type) { @@ -2463,7 +2463,7 @@ void ControlBar::setControlCommand( GameWindow *button, const CommandButton *com DEBUG_ASSERTCRASH( 0, ("setControlCommand: Window is not a button") ); return; - } // end if + } // sanity if( commandButton == NULL ) @@ -2472,7 +2472,7 @@ void ControlBar::setControlCommand( GameWindow *button, const CommandButton *com DEBUG_ASSERTCRASH( 0, ("setControlCommand: NULL commandButton passed in") ); return; - } // end if + } // // set the button gadget control to be a normal button or a check like button if @@ -2530,7 +2530,7 @@ void ControlBar::setControlCommand( GameWindow *button, const CommandButton *com } GadgetButtonSetAltSound(button, "GUICommandBarClick"); -} // end setControlCommand +} //------------------------------------------------------------------------------------------------- void CommandButton::cacheButtonImage() @@ -2574,12 +2574,12 @@ void ControlBar::setControlCommand( const AsciiString& buttonWindowName, GameWin DEBUG_ASSERTCRASH( 0, ("setControlCommand: Unable to find window '%s'", buttonWindowName.str()) ); return; - } // end if + } // call the workhorse setControlCommand( win, commandButton ); -} // end setControlCommand +} //------------------------------------------------------------------------------------------------- /** show/hide the portrait window image */ @@ -2597,7 +2597,7 @@ void ControlBar::setPortraitByImage( const Image *image ) for(Int i = 0; i < MAX_UPGRADE_CAMEO_UPGRADES; ++i) m_rightHUDUpgradeCameos[i]->winHide(TRUE); - } // end if + } else { m_rightHUDWindow->winSetStatus( WIN_STATUS_IMAGE ); @@ -2610,7 +2610,7 @@ void ControlBar::setPortraitByImage( const Image *image ) } -} // end setPortraitByImage +} //------------------------------------------------------------------------------------------------- /** show/hide the portrait image by object. We like to use this method as opposed to the @@ -2700,7 +2700,7 @@ void ControlBar::setPortraitByObject( Object *obj ) } - } // end if + } else { m_rightHUDUnitSelectParent->winHide(TRUE); @@ -2713,7 +2713,7 @@ void ControlBar::setPortraitByObject( Object *obj ) GadgetButtonDrawOverlayImage( m_rightHUDCameoWindow, NULL ); } -} // end setPortraitByObject +} // ------------------------------------------------------------------------------------------------ /** Show a rally point marker at the world location specified. If no location is specified @@ -2897,11 +2897,11 @@ void ControlBar::updateBuildQueueDisabledImages( const Image *image ) buttonName.format( "ControlBar.wnd:ButtonQueue%02d", i + 1 ); buildQueueIDs[ i ] = TheNameKeyGenerator->nameToKey( buttonName ); - } // end for i + } idsInitialized = TRUE; - } // end if + } // get window pointers to all the buttons for the build queue for( i = 0; i < MAX_BUILD_QUEUE_BUTTONS; i++ ) @@ -2913,7 +2913,7 @@ void ControlBar::updateBuildQueueDisabledImages( const Image *image ) GadgetButtonSetDisabledImage( m_queueData[ i ].control, image ); - } // end for i + } } @@ -3295,7 +3295,7 @@ void ControlBar::initSpecialPowershortcutBar( Player *player) id = TheNameKeyGenerator->nameToKey( windowName.str() ); m_specialPowerShortcutButtonParents[ i ] = TheWindowManager->winGetWindowFromId( m_specialPowerShortcutParent, id ); - } // end for i + } } @@ -3338,7 +3338,7 @@ void ControlBar::populateSpecialPowerShortcut( Player *player) // hide window on interface //m_specialPowerShortcutButtons[ i ]->winHide( TRUE ); - } // end if + } else { @@ -3493,7 +3493,7 @@ void ControlBar::populateSpecialPowerShortcut( Player *player) } } } - } // end if + } else if( commandButton->getCommandType() == GUI_COMMAND_SELECT_ALL_UNITS_OF_TYPE ) { //Make sure we actually have an object of type that we want to be able to select. @@ -3516,9 +3516,9 @@ void ControlBar::populateSpecialPowerShortcut( Player *player) GadgetButtonSetAltSound(m_specialPowerShortcutButtons[ currentButton ], "GUIGenShortcutClick"); currentButton++; - } // end else + } - } // end for i + } if(m_contextParent[ CP_MASTER ] && !m_contextParent[ CP_MASTER ]->winIsHidden() && m_specialPowerShortcutParent->winIsHidden()) { showSpecialPowerShortcut(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp index 6f62f956557..ea517dce44d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp @@ -81,14 +81,14 @@ void ControlBar::populateBeacon( Object *beacon ) if (buttonWin) buttonWin->winHide(TRUE); } -} // end populateBeacon +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- void ControlBar::updateContextBeacon( void ) { -} // end updateContextBeacon +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -103,4 +103,4 @@ WindowMsgHandledType BeaconWindowInput( GameWindow *window, UnsignedInt msg, return MSG_IGNORED; -} // end InGameChatInput +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp index 91f10176893..0d1e4f7c0e9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp @@ -98,7 +98,7 @@ void ControlBar::populateInvDataCallback( Object *obj, void *userData ) data->transport->getTemplate()->getName().str()) ); return; - } // end if + } // get the window control that we're going to put our smiling faces in GameWindow *control = data->controls[ data->currIndex ]; @@ -127,7 +127,7 @@ void ControlBar::populateInvDataCallback( Object *obj, void *userData ) // enable the control control->winEnable( TRUE ); -} // end populateInvDataCallback +} //------------------------------------------------------------------------------------------------- /** Transports have an extra special manipulation of the user interface. They get to look @@ -224,9 +224,9 @@ void ControlBar::doTransportInventoryUI( Object *transport, const CommandSet *co // setControlCommand( m_commandWindows[ i ], commandButton ); - } // end if + } - } // end for i + } // After Every change to the m_commandWIndows, we need to show fill in the missing blanks with the images // removed from multiplayer branch @@ -247,7 +247,7 @@ void ControlBar::doTransportInventoryUI( Object *transport, const CommandSet *co data.transport = transport; contain->iterateContained( populateInvDataCallback, &data, FALSE ); - } // end if + } // // save the last recorded inventory count so we know when we have to redo the gui when @@ -255,7 +255,7 @@ void ControlBar::doTransportInventoryUI( Object *transport, const CommandSet *co // m_lastRecordedInventoryCount = contain->getContainCount(); -} // end doTransportInventoryUI +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -288,7 +288,7 @@ void ControlBar::populateCommand( Object *obj ) // nothing left to do return; - } // end if + } // transports do extra special things with the user interface buttons if( obj->getContain() && obj->getContain()->isDisplayedOnControlBar() ) @@ -311,7 +311,7 @@ void ControlBar::populateCommand( Object *obj ) // hide window on interface m_commandWindows[ i ]->winHide( TRUE ); - } // end if + } else { @@ -469,13 +469,13 @@ void ControlBar::populateCommand( Object *obj ) } } - } // end if + } - } // end else + } - } // end else + } - } // end for i + } // After Every change to the m_commandWIndows, we need to show fill in the missing blanks with the images // removed from multiplayer branch @@ -496,7 +496,7 @@ void ControlBar::populateCommand( Object *obj ) // showRallyPoint( exit->getRallyPoint() ); - } // end if + } // // to avoid a one frame delay where windows may become enabled/disabled, run the update @@ -504,7 +504,7 @@ void ControlBar::populateCommand( Object *obj ) // updateContextCommand(); -} // end populateCommand +} //------------------------------------------------------------------------------------------------- /** reset transport data */ @@ -519,9 +519,9 @@ void ControlBar::resetContainData( void ) m_containData[ i ].control = NULL; m_containData[ i ].objectID = INVALID_ID; - } // end for i + } -} // end resetTransportData +} //------------------------------------------------------------------------------------------------- /** reset the build queue data we use to die queue entires to control */ @@ -538,9 +538,9 @@ void ControlBar::resetBuildQueueData( void ) m_queueData[ i ].productionID = PRODUCTIONID_INVALID; m_queueData[ i ].upgradeToResearch = NULL; - } // end for i + } -} // end resetBuildQueue +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -568,11 +568,11 @@ void ControlBar::populateBuildQueue( Object *producer ) buttonName.format( "ControlBar.wnd:ButtonQueue%02d", i + 1 ); buildQueueIDs[ i ] = TheNameKeyGenerator->nameToKey( buttonName ); - } // end for i + } idsInitialized = TRUE; - } // end if + } // get window pointers to all the buttons for the build queue for( i = 0; i < MAX_BUILD_QUEUE_BUTTONS; i++ ) @@ -595,7 +595,7 @@ void ControlBar::populateBuildQueue( Object *producer ) //Clear any potential veterancy rank, or else we'll see it when it's empty! GadgetButtonDrawOverlayImage( m_queueData[ i ].control, NULL ); - } // end for i + } // step through each object being built and set the image data for the buttons ProductionUpdateInterface *pu = producer->getProductionUpdateInterface(); @@ -645,7 +645,7 @@ void ControlBar::populateBuildQueue( Object *producer ) // image = TheMappedImageCollection->findImageByName( production->getProductionObject()->getInventoryImageName( INV_IMAGE_DISABLED ) ); // GadgetButtonSetDisabledImage( m_queueData[ windowIndex ].control, image ); - } // end if + } else { const UpgradeTemplate *ut = production->getProductionUpgrade(); @@ -674,12 +674,12 @@ void ControlBar::populateBuildQueue( Object *producer ) // image = TheMappedImageCollection->findImageByName( ut->getQueueImageName( UpgradeTemplate::UPGRADE_DISABLED ) ); // GadgetButtonSetDisabledImage( m_queueData[ windowIndex ].control, image ); - } // end else + } // we have filled up this window now windowIndex++; - } // end for + } // // save the count of things being produced in the build queue, when it changes we will @@ -687,7 +687,7 @@ void ControlBar::populateBuildQueue( Object *producer ) // m_displayedQueueCount = pu->getProductionCount(); -} // end populateBuildQueue +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -715,7 +715,7 @@ void ControlBar::updateContextCommand( void ) // re-evaluate the UI because something has changed evaluateContextUI(); - } // end if, transport + } // get production update for those objects that have one ProductionUpdateInterface *pu = obj ? obj->getProductionUpdateInterface() : NULL; @@ -739,9 +739,9 @@ void ControlBar::updateContextCommand( void ) m_contextParent[ CP_BUILD_QUEUE ]->winHide( FALSE ); populateBuildQueue( obj ); - } // end if + } - } // end if + } else { @@ -754,9 +754,9 @@ void ControlBar::updateContextCommand( void ) // show the portrait image setPortraitByObject( obj ); - } // end if + } - } // end else + } // update a visible production queue if( m_contextParent[ CP_BUILD_QUEUE ]->winIsHidden() == FALSE ) @@ -795,11 +795,11 @@ void ControlBar::updateContextCommand( void ) GadgetButtonDrawInverseClock(win,produce->getPercentComplete(), m_buildUpClockColor); - } // end if + } - } // end if + } - } // end if + } // evaluate each command on whether or not it should be enabled for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) @@ -892,9 +892,9 @@ void ControlBar::updateContextCommand( void ) else GadgetCheckLikeButtonSetVisualCheck( win, FALSE ); - } // end if + } - } // end for i + } // After Every change to the m_commandWIndows, we need to show fill in the missing blanks with the images // removed from multiplayer branch @@ -903,7 +903,7 @@ void ControlBar::updateContextCommand( void ) // // if we have a build tooltip layout, update it with the new data. // repopulateBuildTooltipLayout(); -} // end updatecontextCommand +} //------------------------------------------------------------------------------------------------- const Image* ControlBar::calculateVeterancyOverlayForThing( const ThingTemplate *thingTemplate ) @@ -1529,5 +1529,5 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com // all is well with the command return COMMAND_AVAILABLE; -} // end getCommandAvailability +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp index 3610afa598f..c2dfc1d823a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp @@ -111,7 +111,7 @@ CBCommandStatus ControlBar::processCommandTransitionUI( GameWindow *control, Gad switchToContext( CB_CONTEXT_NONE, NULL ); return CBC_COMMAND_NOT_USED; - } // end if + } return CBC_COMMAND_USED; @@ -146,7 +146,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, switchToContext( CB_CONTEXT_NONE, NULL ); return CBC_COMMAND_NOT_USED; - } // end if + } // sanity if( control == NULL ) @@ -270,7 +270,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // end dozer construct + } case GUI_COMMAND_SPECIAL_POWER_CONSTRUCT_FROM_SHORTCUT: @@ -361,7 +361,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // end dozer construct + } @@ -383,7 +383,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // end cancel dozer construction + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_UNIT_BUILD: @@ -443,7 +443,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, factory->getTemplate()->getName().str()) ); break; - } // end if + } // get a new production id to assign to this ProductionID productionID = pu->requestUniqueUnitID(); @@ -456,7 +456,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // end build unit + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_CANCEL_UNIT_BUILD: @@ -475,7 +475,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, DEBUG_ASSERTCRASH( 0, ("Control not found in build queue data") ); break; - } // end if + } // sanity if( m_queueData[ i ].type != PRODUCTION_UNIT ) @@ -499,7 +499,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // end cancel unit build + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_PLAYER_UPGRADE: @@ -535,7 +535,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // command player upgrade + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_OBJECT_UPGRADE: @@ -580,7 +580,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // end object upgrade + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_CANCEL_UPGRADE: @@ -599,7 +599,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, DEBUG_ASSERTCRASH( 0, ("Control not found in build queue data") ); break; - } // end if + } // sanity if( m_queueData[ i ].type != PRODUCTION_UPGRADE ) @@ -621,7 +621,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // end cancel upgrade + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_ATTACK_MOVE: @@ -711,7 +711,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, m_containData[ i ].objectID = INVALID_ID; break; // exit case - } // end if + } //what if container is subdued... assert a logic failure, perhaps? @@ -721,7 +721,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // end transport exit + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_EVACUATE: @@ -735,14 +735,14 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, } break; - } // end evacuate + } // -------------------------------------------------------------------------------------------- case GUI_COMMAND_EXECUTE_RAILED_TRANSPORT: { TheMessageStream->appendMessage( GameMessage::MSG_EXECUTE_RAILED_TRANSPORT ); break; - } // end execute railed transport + } // -------------------------------------------------------------------------------------------- case GUI_COMMAND_HACK_INTERNET: @@ -757,7 +757,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, { break; - } // end set rally point + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_SELL: @@ -767,7 +767,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, TheMessageStream->appendMessage( GameMessage::MSG_SELL ); break; - } // end sell + } // -------------------------------------------------------------------------------------------- case GUI_COMMAND_TOGGLE_OVERCHARGE: @@ -776,7 +776,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, TheMessageStream->appendMessage( GameMessage::MSG_TOGGLE_OVERCHARGE ); break; - } // end overcharge + } #ifdef ALLOW_SURRENDER // ------------------------------------------------------------------------------------------------ @@ -786,7 +786,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, TheMessageStream->appendMessage( GameMessage::MSG_RETURN_TO_PRISON ); break; - } // end return to prison + } #endif //--------------------------------------------------------------------------------------------- @@ -795,7 +795,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // end delete beacon + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_GUARD: @@ -833,7 +833,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // end fire weapon + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_SPECIAL_POWER_FROM_SHORTCUT: @@ -852,7 +852,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, msg->appendObjectIDArgument( obj->getID() ); break; - } // end special weapon + } case GUI_COMMAND_SPECIAL_POWER: { @@ -863,7 +863,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, msg->appendObjectIDArgument( INVALID_ID ); // no specific source break; - } // end special weapon + } //--------------------------------------------------------------------------------------------- case GUI_COMMAND_PURCHASE_SCIENCE: @@ -896,7 +896,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; - } // end pick specialized science + } //--------------------------------------------------------------------------------------------- default: @@ -904,9 +904,9 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, DEBUG_ASSERTCRASH( 0, ("Unknown command '%d'", commandButton->getCommandType()) ); return CBC_COMMAND_NOT_USED; - } // end switch + } return CBC_COMMAND_USED; -} // end processCommandUI +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp index b74a3e9ff93..93cdc2c13c9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp @@ -57,7 +57,7 @@ void ControlBar::resetCommonCommandData( void ) GadgetButtonDrawOverlayImage( m_commandWindows[ i ], NULL ); } -} // end resetCommonCommandData +} //------------------------------------------------------------------------------------------------- /** add the common commands of this drawable to the common command set */ @@ -99,11 +99,11 @@ void ControlBar::addCommonCommands( Drawable *draw, Bool firstDrawable ) // removed from multiplayer branch //showCommandMarkers(); - } // end for i + } return; - } // end if + } // @@ -136,11 +136,11 @@ void ControlBar::addCommonCommands( Drawable *draw, Bool firstDrawable ) // set the command into the control setControlCommand( m_commandWindows[ i ], command ); - } // end if + } - } // end for i + } - } // end if + } else { @@ -189,15 +189,15 @@ void ControlBar::addCommonCommands( Drawable *draw, Bool firstDrawable ) m_commandWindows[ i ]->winHide( TRUE ); } - } // end if + } - } // end else + } // After Every change to the m_commandWIndows, we need to show fill in the missing blanks with the images // removed from multiplayer branch //showCommandMarkers(); -} // end addCommonCommands +} //------------------------------------------------------------------------------------------------- /** Populate the visible command bar with commands that are common to all the objects @@ -276,18 +276,18 @@ void ControlBar::populateMultiSelect( void ) portraitObj = draw->getObject(); portraitSet = TRUE; - } // end if + } else if( draw->getTemplate()->getSelectedPortraitImage() != portrait ) portrait = NULL; - } // end if + } - } // end for, drawble id iterator + } // set the portrait image setPortraitByObject( portraitObj ); -} // end populateMultiSelect +} //------------------------------------------------------------------------------------------------- /** Update logic for the multi select context sensitive GUI */ @@ -390,9 +390,9 @@ void ControlBar::updateContextMultiSelect( void ) if( availability == COMMAND_AVAILABLE || availability == COMMAND_ACTIVE ) objectsThatCanDoCommand[ i ]++; - } // end for i + } - } // end for, selected drawables + } // // for each command, if any objects can do the command we enable the window, otherwise @@ -417,11 +417,11 @@ void ControlBar::updateContextMultiSelect( void ) else m_commandWindows[ i ]->winEnable( FALSE ); - } // end for i + } // After Every change to the m_commandWIndows, we need to show fill in the missing blanks with the images // removed from multiplayer branch //showCommandMarkers(); -} // end updateContextMultiSelect +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp index 8bd06a5abb8..0215fafaf17 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp @@ -71,7 +71,7 @@ void ControlBar::updateOCLTimerTextDisplay( UnsignedInt totalSeconds, Real perce // record this as the last time displayed m_displayedOCLTimerSeconds = totalSeconds; -} // end updateOCLTimerTextDisplay +} //------------------------------------------------------------------------------------------------- /** Populate the interface for an OCL Timer context. */ @@ -120,7 +120,7 @@ void ControlBar::populateOCLTimer( Object *creatorObject ) // showRallyPoint( exit->getRallyPoint() ); - } // end if + } } else { @@ -133,7 +133,7 @@ void ControlBar::populateOCLTimer( Object *creatorObject ) // set the portrait for the thing being constructed setPortraitByObject( creatorObject ); -} // end populateUnderConstruction +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -153,4 +153,4 @@ void ControlBar::updateContextOCLTimer( void ) if( m_displayedOCLTimerSeconds != seconds ) updateOCLTimerTextDisplay( seconds, percent ); -} // end updatecontextUnderConstruction +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp index 659aa59a260..13c55c43158 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp @@ -142,7 +142,7 @@ WindowMsgHandledType ControlBarObserverSystem( GameWindow *window, UnsignedInt m { break; - } // end create + } //--------------------------------------------------------------------------------------------- case GBM_MOUSE_ENTERING: @@ -191,17 +191,17 @@ WindowMsgHandledType ControlBarObserverSystem( GameWindow *window, UnsignedInt m break; - } // end button selected + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end ControlBarSystem +} //----------------------------------------------------------------------------- // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp index 85c537bb419..86dffd96f97 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp @@ -236,7 +236,7 @@ void INI::parseControlBarResizerDefinition( INI* ini ) // // parse the ini definition // ini->initFromINI( rWin, resizer->getFieldParse()); // -} // end parseMappedImage +} //----------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp index 4dd7770dc1e..0b44683b660 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp @@ -691,7 +691,7 @@ void ControlBarScheme::addAnimation( ControlBarSchemeAnimation *schemeAnim ) return; } m_animations.push_back( schemeAnim ); -}// addAnimation +} // // Add an image to the proper layer list @@ -713,7 +713,7 @@ void ControlBarScheme::addImage( ControlBarSchemeImage *schemeImage ) } m_layer[schemeImage->m_layer].push_back(schemeImage); -}// addImage +} // // Update the position of the image that's animating diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp index 6b703fa8383..0728475c572 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp @@ -163,7 +163,7 @@ void ControlBar::populateStructureInventory( Object *building ) m_commandWindows[ i ]->winHide( TRUE ); - } // end for i + } // show the window m_commandWindows[ EVACUATE_ID ]->winHide( FALSE ); @@ -193,7 +193,7 @@ void ControlBar::populateStructureInventory( Object *building ) // m_lastRecordedInventoryCount = contain->getContainCount(); -} // end populateStructureInventory +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -216,7 +216,7 @@ void ControlBar::updateContextStructureInventory( void ) TheInGameUI->deselectDrawable( draw ); return; - } // end if + } // // if the object being displayed in the interface has a different count than we last knew @@ -230,5 +230,5 @@ void ControlBar::updateContextStructureInventory( void ) if( m_lastRecordedInventoryCount != contain->getContainCount() ) populateStructureInventory( source ); -} // end updateContextStructureInventory +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp index 215110e3446..22cad30689c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp @@ -62,7 +62,7 @@ void ControlBar::updateConstructionTextDisplay( Object *obj ) // record this as the last percentage displayed m_displayedConstructPercent = obj->getConstructionPercent(); -} // end updateConstructionTextDisplay +} //------------------------------------------------------------------------------------------------- /** Populate the interface for an under construction context. */ @@ -99,7 +99,7 @@ void ControlBar::populateUnderConstruction( Object *objectUnderConstruction ) showRallyPoint( exit->getRallyPoint() ); -} // end populateUnderConstruction +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -114,10 +114,10 @@ void ControlBar::updateContextUnderConstruction( void ) evaluateContextUI(); return; - } // end if + } // if the construction percent has changed since what was last shown to the user update the text if( m_displayedConstructPercent != obj->getConstructionPercent() ) updateConstructionTextDisplay( obj ); -} // end updatecontextUnderConstruction +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp index 2f4e764ee4a..4086a47cb79 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp @@ -128,7 +128,7 @@ WindowMsgHandledType LeftHUDInput( GameWindow *window, UnsignedInt msg, // Groovy TheMouse->setCursor(cur); - } // end if + } return MSG_HANDLED; } @@ -187,7 +187,7 @@ WindowMsgHandledType LeftHUDInput( GameWindow *window, UnsignedInt msg, else TheMouse->setCursor( Mouse::CROSS ); - } // end if + } else { // Else we are not super targeting, so we have to try to refresh the move cursor. @@ -212,11 +212,11 @@ WindowMsgHandledType LeftHUDInput( GameWindow *window, UnsignedInt msg, TheMouse->setCursor(cur); } - } // end if + } break; - } // end case mouse position + } // ------------------------------------------------------------------------ case GWM_RIGHT_UP:// Here to eat @@ -283,7 +283,7 @@ WindowMsgHandledType LeftHUDInput( GameWindow *window, UnsignedInt msg, // do the command TheGameClient->evaluateContextCommand( NULL, &world, CommandTranslator::DO_COMMAND ); - } // end if + } else if( command && command->getCommandType() == GUI_COMMAND_ATTACK_MOVE) { // Attack move has changed from a modifier to a command, so it moves up here. @@ -315,25 +315,25 @@ WindowMsgHandledType LeftHUDInput( GameWindow *window, UnsignedInt msg, // Play the unit voice response pickAndPlayUnitVoiceResponse(drawableList, GameMessage::MSG_DO_MOVETO); - } // end else + } } break; - } // end left down + } // ------------------------------------------------------------------------ default: return MSG_IGNORED; - } // end switch( msg ) + } TheInGameUI->clearAttackMoveToMode(); return MSG_HANDLED; -} // end LeftHUDInput +} //------------------------------------------------------------------------------------------------- /** Input procedure for the control bar */ @@ -344,7 +344,7 @@ WindowMsgHandledType ControlBarInput( GameWindow *window, UnsignedInt msg, return MSG_IGNORED; -} // end ControlBarInput +} void ToggleQuitMenu(void); //------------------------------------------------------------------------------------------------- /** System callback for the control bar parent */ @@ -366,7 +366,7 @@ WindowMsgHandledType ControlBarSystem( GameWindow *window, UnsignedInt msg, break; - } // end create + } //--------------------------------------------------------------------------------------------- case GBM_MOUSE_ENTERING: @@ -454,7 +454,7 @@ WindowMsgHandledType ControlBarSystem( GameWindow *window, UnsignedInt msg, } break; - } // end button selected + } //--------------------------------------------------------------------------------------------- case GEM_EDIT_DONE: @@ -479,17 +479,17 @@ WindowMsgHandledType ControlBarSystem( GameWindow *window, UnsignedInt msg, } } break; - } // end edit done + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end ControlBarSystem +} extern void showReplayControls( void ); extern void hideReplayControls( void ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp index e2c5f9caf3f..8ecca02cc89 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp @@ -332,7 +332,7 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton, } } } - } //End overcharge special case + } //Special case: When building units & buildings, the CanMakeType determines reasons for not being able to buy stuff. else if( thingTemplate ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp index e34de5cc713..6c0e5b3ff61 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp @@ -361,19 +361,19 @@ WindowMsgHandledType DiplomacyInput( GameWindow *window, UnsignedInt msg, HideDiplomacy(); return MSG_HANDLED; //return MSG_IGNORED; - } // end escape + } - } // end switch( key ) + } return MSG_HANDLED; - } // end char + } } return MSG_IGNORED; -} // end DiplomacyInput +} //------------------------------------------------------------------------------------------------- WindowMsgHandledType DiplomacySystem( GameWindow *window, UnsignedInt msg, @@ -392,7 +392,7 @@ WindowMsgHandledType DiplomacySystem( GameWindow *window, UnsignedInt msg, //if (focus) //TheWindowManager->winSetGrabWindow( chatTextEntry ); break; - } // end focus change + } //--------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -402,7 +402,7 @@ WindowMsgHandledType DiplomacySystem( GameWindow *window, UnsignedInt msg, *(Bool *)mData2 = FALSE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -442,17 +442,17 @@ WindowMsgHandledType DiplomacySystem( GameWindow *window, UnsignedInt msg, } break; - } // end button selected + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end DiplomacySystem +} void PopulateInGameDiplomacyPopup( void ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp index 4fa83bd7583..aae7aa75b42 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp @@ -186,7 +186,7 @@ static GameWindow *gogoExMessageBox(Int x, Int y, Int width, Int height, Unsigne parent->winBringToTop(); return parent; -}// gogoExMessageBox +} GameWindow *ExMessageBoxYesNo (UnicodeString titleString,UnicodeString bodyString, void *userData, MessageBoxFunc yesCallback, MessageBoxFunc noCallback) @@ -242,7 +242,7 @@ WindowMsgHandledType ExtendedMessageBoxSystem( GameWindow *window, UnsignedInt m window->winSetUserData( NULL ); break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -254,7 +254,7 @@ WindowMsgHandledType ExtendedMessageBoxSystem( GameWindow *window, UnsignedInt m break; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -273,36 +273,36 @@ WindowMsgHandledType ExtendedMessageBoxSystem( GameWindow *window, UnsignedInt m { if (MsgBoxCallbacks->okCallback) ret = MsgBoxCallbacks->okCallback(MsgBoxCallbacks->userData); - } // end if + } else if( controlID == buttonYesID ) { if (MsgBoxCallbacks->yesCallback) ret = MsgBoxCallbacks->yesCallback(MsgBoxCallbacks->userData); - } // end else if + } else if( controlID == buttonNoID ) { if (MsgBoxCallbacks->noCallback) ret = MsgBoxCallbacks->noCallback(MsgBoxCallbacks->userData); - } // end else if + } else if( controlID == buttonCancelID ) { if (MsgBoxCallbacks->cancelCallback) ret = MsgBoxCallbacks->cancelCallback(MsgBoxCallbacks->userData); - } // end else if + } if (ret == MB_RETURN_CLOSE) TheWindowManager->winDestroy(window); break; - } // end selected + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end ExtendedMessageBoxSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp index 2434b2f29f6..956cd45fc29 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp @@ -93,19 +93,19 @@ WindowMsgHandledType GeneralsExpPointsInput( GameWindow *window, UnsignedInt msg TheControlBar->hidePurchaseScience(); return MSG_HANDLED; //return MSG_IGNORED; - } // end escape + } - } // end switch( key ) + } return MSG_HANDLED; - } // end char + } } return MSG_HANDLED; -} // end DiplomacyInput +} @@ -125,7 +125,7 @@ WindowMsgHandledType GeneralsExpPointsSystem( GameWindow *window, UnsignedInt ms //if (focus) //TheWindowManager->winSetGrabWindow( chatTextEntry ); break; - } // end focus change + } //--------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -135,7 +135,7 @@ WindowMsgHandledType GeneralsExpPointsSystem( GameWindow *window, UnsignedInt ms *(Bool *)mData2 = FALSE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -151,17 +151,17 @@ WindowMsgHandledType GeneralsExpPointsSystem( GameWindow *window, UnsignedInt ms TheControlBar->processContextSensitiveButtonClick( control, (GadgetGameMessage)msg ); break; - } // end button selected + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GeneralsExpPointsSystem +} //----------------------------------------------------------------------------- // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp index 0d37e96a283..7f81c8b0e4f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp @@ -51,7 +51,7 @@ WindowMsgHandledType IMECandidateWindowInput( GameWindow *window, UnsignedInt ms return MSG_HANDLED; -} // end IMECandidateInput +} //------------------------------------------------------------------------------------------------- /** System callback for the IME Candidate widnow */ @@ -81,11 +81,11 @@ WindowMsgHandledType IMECandidateWindowSystem( GameWindow *window, UnsignedInt m default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end IMECandidateWidnowSystem +} // IMECandidateDraw ================================================================ /** Draw function for the IME candidate window */ @@ -120,7 +120,7 @@ void IMECandidateTextAreaDraw( GameWindow *window, WinInstanceData *instData ) textColor = window->winGetDisabledTextColor(); textBorder = window->winGetDisabledTextBorderColor(); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -129,7 +129,7 @@ void IMECandidateTextAreaDraw( GameWindow *window, WinInstanceData *instData ) textSelectColor = window->winGetHiliteTextColor(); textSelectBorder = window->winGetHiliteTextBorderColor(); - } // end else if, hilited + } else { @@ -138,7 +138,7 @@ void IMECandidateTextAreaDraw( GameWindow *window, WinInstanceData *instData ) textColor = window->winGetEnabledTextColor(); textBorder = window->winGetEnabledTextBorderColor(); - } // end else, just enabled + } { @@ -250,21 +250,21 @@ void IMECandidateMainDraw( GameWindow *window, WinInstanceData *instData ) backColor = window->winGetDisabledColor( 0 ); backBorder = window->winGetDisabledBorderColor( 0 ); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { backColor = window->winGetHiliteColor( 0 ); backBorder = window->winGetHiliteBorderColor( 0 ); - } // end else if, hilited + } else { backColor = window->winGetEnabledColor( 0 ); backBorder = window->winGetEnabledBorderColor( 0 ); - } // end else, just enabled + } // draw the back border if( backBorder != WIN_COLOR_UNDEFINED ) @@ -276,7 +276,7 @@ void IMECandidateMainDraw( GameWindow *window, WinInstanceData *instData ) end.y = start.y + size.y; TheWindowManager->winOpenRect( backBorder, borderWidth, start.x, start.y, end.x, end.y ); - } // end if + } // draw the filled back if( backColor != WIN_COLOR_UNDEFINED ) @@ -288,6 +288,6 @@ void IMECandidateMainDraw( GameWindow *window, WinInstanceData *instData ) end.y = start.y + size.y - 2; TheWindowManager->winFillRect( backColor, 0, start.x, start.y, end.x, end.y ); - } // end if + } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp index 3d31eadadd1..fe25b22dcb8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp @@ -284,19 +284,19 @@ WindowMsgHandledType InGameChatInput( GameWindow *window, UnsignedInt msg, HideInGameChat(); return MSG_HANDLED; //return MSG_IGNORED; - } // end escape + } - } // end switch( key ) + } return MSG_HANDLED; - } // end char + } } return MSG_IGNORED; -} // end InGameChatInput +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -312,7 +312,7 @@ WindowMsgHandledType InGameChatSystem( GameWindow *window, UnsignedInt msg, //if (focus) //TheWindowManager->winSetGrabWindow( chatTextEntry ); break; - } // end focus change + } //--------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -322,7 +322,7 @@ WindowMsgHandledType InGameChatSystem( GameWindow *window, UnsignedInt msg, *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } //--------------------------------------------------------------------------------------------- case GEM_EDIT_DONE: @@ -332,7 +332,7 @@ WindowMsgHandledType InGameChatSystem( GameWindow *window, UnsignedInt msg, break; - } // end button selected + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -347,15 +347,15 @@ WindowMsgHandledType InGameChatSystem( GameWindow *window, UnsignedInt msg, } break; - } // end button selected + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end InGameChatSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp index 39ae8fe2fa1..3c00ffacffd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp @@ -168,18 +168,18 @@ WindowMsgHandledType InGamePopupMessageInput( GameWindow *window, UnsignedInt ms TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonOk, buttonOkID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; @@ -200,14 +200,14 @@ WindowMsgHandledType InGamePopupMessageSystem( GameWindow *window, UnsignedInt m break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { break; - } // end case + } //---------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -219,7 +219,7 @@ WindowMsgHandledType InGamePopupMessageSystem( GameWindow *window, UnsignedInt m break; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: { @@ -238,7 +238,7 @@ WindowMsgHandledType InGamePopupMessageSystem( GameWindow *window, UnsignedInt m default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ChallengeMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ChallengeMenu.cpp index bf2197e795c..6939dfb1def 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ChallengeMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ChallengeMenu.cpp @@ -515,18 +515,18 @@ WindowMsgHandledType ChallengeMenuInput( GameWindow *window, UnsignedInt msg, Wi TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonBack, buttonBackID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp index 20625dbc27f..5c186977f17 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp @@ -104,7 +104,7 @@ void CreditsMenuInit( WindowLayout *layout, void *userData ) TheAudio->addAudioEvent( &event ); -} // end CreditsMenuInit +} //------------------------------------------------------------------------------------------------- /** single player menu shutdown method */ @@ -124,7 +124,7 @@ void CreditsMenuShutdown( WindowLayout *layout, void *userData ) TheAudio->removeAudioEvent( AHSV_StopTheMusicFade ); -} // end CreditsMenuShutdown +} //------------------------------------------------------------------------------------------------- /** single player menu update method */ @@ -142,7 +142,7 @@ void CreditsMenuUpdate( WindowLayout *layout, void *userData ) else TheShell->pop(); -} // end CreditsMenuUpdate +} //------------------------------------------------------------------------------------------------- /** Replay menu input callback */ @@ -176,22 +176,22 @@ WindowMsgHandledType CreditsMenuInput( GameWindow *window, UnsignedInt msg, TheShell->pop(); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end CreditsMenuInput +} //------------------------------------------------------------------------------------------------- /** single player menu window system callback */ @@ -210,7 +210,7 @@ WindowMsgHandledType CreditsMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -218,7 +218,7 @@ WindowMsgHandledType CreditsMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -230,20 +230,20 @@ WindowMsgHandledType CreditsMenuSystem( GameWindow *window, UnsignedInt msg, return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: { break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end CreditsMenuSystem +} //----------------------------------------------------------------------------- // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp index e8c5af74405..6b54a96540a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp @@ -118,7 +118,7 @@ static void SetDifficultyRadioButton( void ) } } - } // if (TheScriptEngine) + } } @@ -152,7 +152,7 @@ void DifficultySelectInit( WindowLayout *layout, void *userData ) parent->winBringToTop(); TheWindowManager->winSetModal(parent); -} // end SkirmishMapSelectMenuInit +} //------------------------------------------------------------------------------------------------- @@ -206,7 +206,7 @@ WindowMsgHandledType DifficultySelectInput( GameWindow *window, UnsignedInt msg, return MSG_IGNORED; -} // end SkirmishMapSelectMenuInput +} //------------------------------------------------------------------------------------------------- /** MapSelect menu window system callback */ @@ -223,14 +223,14 @@ WindowMsgHandledType DifficultySelectSystem( GameWindow *window, UnsignedInt msg { break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -242,7 +242,7 @@ WindowMsgHandledType DifficultySelectSystem( GameWindow *window, UnsignedInt msg return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -294,12 +294,12 @@ WindowMsgHandledType DifficultySelectSystem( GameWindow *window, UnsignedInt msg break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DisconnectWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DisconnectWindow.cpp index a1f0798e0f6..1bf0b3dff28 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DisconnectWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DisconnectWindow.cpp @@ -119,13 +119,13 @@ void ShowDisconnectWindow( void ) // show it disconnectMenuLayout->hide( FALSE ); - } // end if + } else { disconnectMenuLayout->hide( FALSE ); - } // end else + } buttonVotePlayer1Window->winEnable(TRUE); buttonVotePlayer2Window->winEnable(TRUE); @@ -141,7 +141,7 @@ void ShowDisconnectWindow( void ) GadgetListBoxAddEntryText(textDisplayWindow, TheGameText->fetch("GUI:InternetDisconnectionMenuBody1"), GameMakeColor(255,255,255,255), -1); -} // end ToggleQuitMenu +} //------------------------------------------------------ /** Hide the Disconnect Screen */ @@ -162,15 +162,15 @@ void HideDisconnectWindow( void ) // show it disconnectMenuLayout->hide( TRUE ); - } // end if + } else { disconnectMenuLayout->hide( TRUE ); - } // end else + } -} // end ToggleQuitMenu +} //------------------------------------------------------------------------------------------------- /** Input callback for the control bar parent */ @@ -181,7 +181,7 @@ WindowMsgHandledType DisconnectControlInput( GameWindow *window, UnsignedInt msg return MSG_IGNORED; -} // end DisconnectControlInput +} //------------------------------------------------------------------------------------------------- /** System callback for the control bar parent */ @@ -227,7 +227,7 @@ WindowMsgHandledType DisconnectControlSystem( GameWindow *window, UnsignedInt ms break; - } // end button selected + } case GEM_EDIT_DONE: { @@ -255,7 +255,7 @@ WindowMsgHandledType DisconnectControlSystem( GameWindow *window, UnsignedInt ms TheDisconnectMenu->sendChat(txtInput); } - }// if ( controlID == textEntryChatID ) + } break; } @@ -263,9 +263,9 @@ WindowMsgHandledType DisconnectControlSystem( GameWindow *window, UnsignedInt ms default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end ControlBarSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp index 44bed1f0eaa..fe3c8b25ccf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp @@ -268,7 +268,7 @@ void DownloadMenuInit( WindowLayout *layout, void *userData ) } TheDownloadManager = NEW DownloadManagerMunkee; -} // end DownloadMenuInit +} //------------------------------------------------------------------------------------------------- /** menu shutdown method */ @@ -289,7 +289,7 @@ void DownloadMenuShutdown( WindowLayout *layout, void *userData ) progressBarMunkee = NULL; parent = NULL; -} // end DownloadMenuShutdown +} //------------------------------------------------------------------------------------------------- /** menu update method */ @@ -322,7 +322,7 @@ void DownloadMenuUpdate( WindowLayout *layout, void *userData ) GadgetStaticTextSetText(staticTextTime, timeString); } -} // end DownloadMenuUpdate +} //------------------------------------------------------------------------------------------------- /** menu input callback */ @@ -360,22 +360,22 @@ WindowMsgHandledType DownloadMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)button, buttonID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end DownloadMenuInput +} //------------------------------------------------------------------------------------------------- /** menu window system callback */ @@ -393,14 +393,14 @@ WindowMsgHandledType DownloadMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { break; - } // end case + } //---------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -412,7 +412,7 @@ WindowMsgHandledType DownloadMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: { @@ -423,17 +423,17 @@ WindowMsgHandledType DownloadMenuSystem( GameWindow *window, UnsignedInt msg, { HandleCanceledDownload(); closeDownloadWindow(); - } // end if + } break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end DownloadMenuSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp index b2249457fe4..4a73d6838a7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp @@ -189,6 +189,6 @@ WindowMsgHandledType EstablishConnectionsControlSystem(GameWindow *window, Unsig } break; } - } // end switch + } return MSG_HANDLED; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp index 6b301d5d4ad..d08fba47c68 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp @@ -234,7 +234,7 @@ void GameInfoWindowInit( WindowLayout *layout, void *userData ) GadgetStaticTextSetText(staticTextMapName,UnicodeString::TheEmptyString); GadgetListBoxReset(listBoxPlayers); -} // end MapSelectMenuInit +} //------------------------------------------------------------------------------------------------- @@ -256,7 +256,7 @@ WindowMsgHandledType GameInfoWindowSystem( GameWindow *window, UnsignedInt msg, break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -264,7 +264,7 @@ WindowMsgHandledType GameInfoWindowSystem( GameWindow *window, UnsignedInt msg, break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -276,15 +276,15 @@ WindowMsgHandledType GameInfoWindowSystem( GameWindow *window, UnsignedInt msg, return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end MapSelectMenuSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp index c99d054e84d..65251735690 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp @@ -468,7 +468,7 @@ void KeyboardOptionsMenuShutdown( WindowLayout *layout, void *userData ) void KeyboardOptionsMenuUpdate( WindowLayout *layout, void *userData ) { -} // end OptionsMenuUpdate +} //------------------------------------------------------------------------------------------------- /** Options menu input callback */ @@ -506,22 +506,22 @@ WindowMsgHandledType KeyboardOptionsMenuInput( GameWindow *window, UnsignedInt m TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)button, buttonID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end KeyboardOptionsMenuInput +} //------------------------------------------------------------------------------------------------- /** options menu window system callback */ @@ -538,7 +538,7 @@ WindowMsgHandledType KeyboardOptionsMenuSystem( GameWindow *window, UnsignedInt break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -546,7 +546,7 @@ WindowMsgHandledType KeyboardOptionsMenuSystem( GameWindow *window, UnsignedInt break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -558,7 +558,7 @@ WindowMsgHandledType KeyboardOptionsMenuSystem( GameWindow *window, UnsignedInt return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- case GCM_SELECTED: @@ -593,7 +593,7 @@ WindowMsgHandledType KeyboardOptionsMenuSystem( GameWindow *window, UnsignedInt } break; - } // end selected + } // --------------------------------------------------------------------------------------------- case GLM_SELECTED: @@ -635,13 +635,13 @@ WindowMsgHandledType KeyboardOptionsMenuSystem( GameWindow *window, UnsignedInt break; } - } // end if + } - } // end selected + } break; - } // end case + } // --------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -655,7 +655,7 @@ WindowMsgHandledType KeyboardOptionsMenuSystem( GameWindow *window, UnsignedInt // go back one screen TheShell->pop(); - } // end if + } else if( controlID == buttonAssignID ) { // check grammar in text field @@ -688,16 +688,16 @@ WindowMsgHandledType KeyboardOptionsMenuSystem( GameWindow *window, UnsignedInt break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end KeyboardOptionsMenuSystem +} // KeyboardTextEntryInput ======================================================= /** Handle input for text entry field */ @@ -1007,7 +1007,7 @@ WindowMsgHandledType KeyboardTextEntryInput( GameWindow *window, UnsignedInt msg GEM_UPDATE_TEXT, (WindowMsgData)window, 0 ); - } // end if + } } } break; @@ -1102,7 +1102,7 @@ WindowMsgHandledType KeyboardTextEntryInput( GameWindow *window, UnsignedInt msg }*/ - } // end switch( mData1 ) + } break; @@ -1153,10 +1153,10 @@ WindowMsgHandledType KeyboardTextEntryInput( GameWindow *window, UnsignedInt msg default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetTextEntryInput +} 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 54b164691d6..d686c7130e7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp @@ -395,7 +395,7 @@ void StartPressed(void) } } -}//void StartPressed(void) +} void LANEnableStartButton(Bool enabled) { @@ -949,7 +949,7 @@ void LanGameOptionsMenuInit( WindowLayout *layout, void *userData ) // animate controls //TheShell->registerWithAnimateManager(buttonBack, WIN_ANIMATION_SLIDE_RIGHT, TRUE, 1); -}// void LanGameOptionsMenuInit( WindowLayout *layout, void *userData ) +} //------------------------------------------------------------------------------------------------- /** Update options on screen */ @@ -1021,7 +1021,7 @@ static void shutdownComplete( WindowLayout *layout ) LANnextScreen = NULL; -} // end if +} //------------------------------------------------------------------------------------------------- /** Lan Game Options menu shutdown method */ @@ -1041,7 +1041,7 @@ void LanGameOptionsMenuShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } TheShell->reverseAnimatewindow(); TheTransitionHandler->reverse("LanGameOptionsFade"); @@ -1058,7 +1058,7 @@ void LanGameOptionsMenuShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheShell->shutdownComplete( layout ); */ -} // void LanGameOptionsMenuShutdown( WindowLayout *layout, void *userData ) +} //------------------------------------------------------------------------------------------------- /** Lan Game Options menu update method */ @@ -1068,7 +1068,7 @@ void LanGameOptionsMenuUpdate( WindowLayout * layout, void *userData) if(LANisShuttingDown && TheShell->isAnimFinished() && TheTransitionHandler->isFinished()) shutdownComplete(layout); //TheLAN->update(); // this is handled in the lobby -}// void LanGameOptionsMenuUpdate( WindowLayout * layout, void *userData) +} //------------------------------------------------------------------------------------------------- /** Lan Game Options menu input callback */ @@ -1100,15 +1100,15 @@ WindowMsgHandledType LanGameOptionsMenuInput( GameWindow *window, UnsignedInt ms { TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonBack, buttonBackID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape - } // end switch( key ) - } // end char - } // end switch( msg ) + } + } + } + } return MSG_IGNORED; -}//WindowMsgHandledType LanGameOptionsMenuInput( GameWindow *window, UnsignedInt msg, +} //------------------------------------------------------------------------------------------------- @@ -1124,7 +1124,7 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m case GWM_CREATE: { break; - } // case GWM_DESTROY: + } //------------------------------------------------------------------------------------------------- case GWM_DESTROY: { @@ -1132,7 +1132,7 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m windowMap->winSetUserData(NULL); break; - } // case GWM_DESTROY: + } //------------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: { @@ -1141,7 +1141,7 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } //------------------------------------------------------------------------------------------------- case GCM_SELECTED: { @@ -1209,7 +1209,7 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m } } break; - }// case GCM_SELECTED: + } //------------------------------------------------------------------------------------------------- case GBM_SELECTED: { @@ -1229,7 +1229,7 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m TheLAN->RequestGameLeave(); //TheShell->pop(); - } //if ( controlID == buttonBack ) + } else if ( controlID == buttonEmoteID ) { // read the user's input @@ -1241,7 +1241,7 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m // Echo the user's input to the chat window if (!txtInput.isEmpty()) TheLAN->RequestChat(txtInput, LANAPIInterface::LANCHAT_EMOTE); - } //if ( controlID == buttonEmote ) + } else if ( controlID == buttonSelectMapID ) { //buttonBack->winEnable( false ); @@ -1318,7 +1318,7 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m } break; - }// case GBM_SELECTED: + } //------------------------------------------------------------------------------------------------- case GBM_SELECTED_RIGHT: { @@ -1378,15 +1378,15 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m if (!txtInput.isEmpty()) TheLAN->RequestChat(txtInput, LANAPIInterface::LANCHAT_NORMAL); - }// if ( controlID == textEntryChatID ) + } break; } //------------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}//WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt msg, +} //------------------------------------------------------------------------------------------------- /** Utility FUnction used as a bridge from other windows to this one */ @@ -1415,7 +1415,7 @@ void PostToLanGameOptions( PostToLanGameType post ) TheLAN->RequestGameOptions(GenerateGameOptionsString(), true); break; - } //------------------------------------------------------------------------------------------------- + } case MAP_BACK: { //buttonBack->winEnable( true ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp index 5e0f12fcb8e..59a4d7a7862 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp @@ -522,7 +522,7 @@ void LanLobbyMenuInit( WindowLayout *layout, void *userData ) // //TheShell->registerWithAnimateManager(buttonOptions, WIN_ANIMATION_SLIDE_LEFT, TRUE, 1); // TheShell->registerWithAnimateManager(buttonBack, WIN_ANIMATION_SLIDE_RIGHT, TRUE, 1); -} // GameLobbyMenuInit +} //------------------------------------------------------------------------------------------------- /** This is called when a shutdown is complete for this menu */ @@ -545,7 +545,7 @@ static void shutdownComplete( WindowLayout *layout ) LANnextScreen = NULL; -} // end if +} //------------------------------------------------------------------------------------------------- /** Lan Lobby menu shutdown method */ @@ -582,13 +582,13 @@ void LanLobbyMenuShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } TheShell->reverseAnimatewindow(); TheTransitionHandler->reverse("LanLobbyFade"); //if( shellmapOn) // TheShell->showShellMap(TRUE); -} // LanLobbyMenuShutdown +} //------------------------------------------------------------------------------------------------- @@ -630,7 +630,7 @@ void LanLobbyMenuUpdate( WindowLayout * layout, void *userData) } -}// LanLobbyMenuUpdate +} //------------------------------------------------------------------------------------------------- /** Lan Lobby menu input callback */ @@ -665,21 +665,21 @@ WindowMsgHandledType LanLobbyMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonBack, buttonBackID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// LanLobbyMenuInput +} //------------------------------------------------------------------------------------------------- /** Lan Lobby menu window system callback */ @@ -697,13 +697,13 @@ WindowMsgHandledType LanLobbyMenuSystem( GameWindow *window, UnsignedInt msg, { SignalUIInteraction(SHELL_SCRIPT_HOOK_LAN_OPENED); break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { SignalUIInteraction(SHELL_SCRIPT_HOOK_LAN_CLOSED); break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -712,7 +712,7 @@ WindowMsgHandledType LanLobbyMenuSystem( GameWindow *window, UnsignedInt msg, *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } case GLM_DOUBLE_CLICKED: { if (LANbuttonPushed) @@ -774,12 +774,12 @@ WindowMsgHandledType LanLobbyMenuSystem( GameWindow *window, UnsignedInt msg, TheLAN = NULL; //TheTransitionHandler->reverse("LanLobbyFade"); - } //if ( controlID == buttonBack ) + } else if ( controlID == buttonHostID ) { TheLAN->RequestGameCreate( UnicodeString(L""), FALSE); - }//else if ( controlID == buttonHostID ) + } else if ( controlID == buttonClearID ) { GadgetTextEntrySetText(textEntryPlayerName, UnicodeString::TheEmptyString); @@ -810,7 +810,7 @@ WindowMsgHandledType LanLobbyMenuSystem( GameWindow *window, UnsignedInt msg, GadgetListBoxAddEntryText(listboxChatWindow, TheGameText->fetch("LAN:ErrorNoGameSelected") , chatSystemColor, -1, 0); } - } //else if ( controlID == buttonJoinID ) + } else if ( controlID == buttonEmoteID ) { // read the user's input @@ -824,7 +824,7 @@ WindowMsgHandledType LanLobbyMenuSystem( GameWindow *window, UnsignedInt msg, // TheLAN->RequestChat(txtInput, LANAPIInterface::LANCHAT_EMOTE); TheLAN->RequestChat(txtInput, LANAPIInterface::LANCHAT_NORMAL); } - } //if ( controlID == buttonEmote ) + } else if (controlID == buttonDirectConnectID) { TheLAN->RequestLobbyLeave( false ); @@ -832,7 +832,7 @@ WindowMsgHandledType LanLobbyMenuSystem( GameWindow *window, UnsignedInt msg, } break; - }// case GBM_SELECTED: + } case GEM_UPDATE_TEXT: { @@ -878,9 +878,9 @@ WindowMsgHandledType LanLobbyMenuSystem( GameWindow *window, UnsignedInt msg, // Put the whitespace-free version in the box GadgetTextEntrySetText( textEntryPlayerName, txtInput ); - }// if ( controlID == textEntryPlayerNameID ) + } break; - }//case GEM_UPDATE_TEXT: + } case GEM_EDIT_DONE: { if (LANbuttonPushed) @@ -905,7 +905,7 @@ WindowMsgHandledType LanLobbyMenuSystem( GameWindow *window, UnsignedInt msg, if (!txtInput.isEmpty()) TheLAN->RequestChat(txtInput, LANAPIInterface::LANCHAT_NORMAL); - }// if ( controlID == textEntryChatID ) + } /* else if ( controlID == textEntryPlayerNameID ) { @@ -922,14 +922,14 @@ WindowMsgHandledType LanLobbyMenuSystem( GameWindow *window, UnsignedInt msg, // Put the whitespace-free version in the box GadgetTextEntrySetText( textEntryPlayerName, txtInput ); - }// if ( controlID == textEntryPlayerNameID ) + } */ break; } default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// LanLobbyMenuSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp index c995529c962..5d9c13ab825 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp @@ -174,7 +174,7 @@ void LanMapSelectMenuInit( WindowLayout *layout, void *userData ) TheMapCache->updateCache(); populateMapListbox( mapList, usesSystemMapDir, TRUE, TheLAN->GetMyGame()->getMap() ); } -} // end LanMapSelectMenuInit +} //------------------------------------------------------------------------------------------------- /** MapSelect menu shutdown method */ @@ -189,7 +189,7 @@ void LanMapSelectMenuShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheShell->shutdownComplete( layout ); -} // end LanMapSelectMenuShutdown +} //------------------------------------------------------------------------------------------------- /** MapSelect menu update method */ @@ -197,7 +197,7 @@ void LanMapSelectMenuShutdown( WindowLayout *layout, void *userData ) void LanMapSelectMenuUpdate( WindowLayout *layout, void *userData ) { -} // end LanMapSelectMenuUpdate +} //------------------------------------------------------------------------------------------------- /** Map select menu input callback */ @@ -235,22 +235,22 @@ WindowMsgHandledType LanMapSelectMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)button, buttonID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end LanMapSelectMenuInput +} //------------------------------------------------------------------------------------------------- /** MapSelect menu window system callback */ @@ -273,7 +273,7 @@ WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -282,7 +282,7 @@ WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -294,7 +294,7 @@ WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- case GLM_DOUBLE_CLICKED: @@ -354,7 +354,7 @@ WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg NullifyControls(); showLANGameOptionsUnderlyingGUIElements(TRUE); PostToLanGameOptions( MAP_BACK ); - } // end if + } else if ( controlID == buttonOK ) { Int selected = -1; @@ -406,12 +406,12 @@ WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg showLANGameOptionsUnderlyingGUIElements(TRUE); PostToLanGameOptions(SEND_GAME_OPTS); - } // end if - } // end else if + } + } break; - } // end selected + } case GLM_SELECTED: { @@ -459,8 +459,8 @@ WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end LanMapSelectMenuSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp index 2a5f0ea68c5..533a54853ae 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp @@ -363,7 +363,7 @@ static void shutdownComplete( WindowLayout *layout ) // our shutdown is complete TheShell->shutdownComplete( layout ); -} // end if +} @@ -676,7 +676,7 @@ void MainMenuInit( WindowLayout *layout, void *userData ) TheWindowManager->winSetFocus( parentMainMenu ); -} // end MainMenuInit +} //------------------------------------------------------------------------------------------------- /** Main menu shutdown method */ @@ -706,14 +706,14 @@ void MainMenuShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } if (!startGame) TheShell->reverseAnimatewindow(); //TheShell->reverseAnimatewindow(); // if(localAnimateWindowManager && dropDown != DROPDOWN_NONE) // localAnimateWindowManager->reverseAnimateWindow(); -} // end MainMenuShutdown +} extern Bool DontShowMainMenu; @@ -966,7 +966,7 @@ void MainMenuUpdate( WindowLayout *layout, void *userData ) // if(winVidManager) // winVidManager->update(); -} // end MainMenuUpdate +} //------------------------------------------------------------------------------------------------- /** Main menu input callback */ @@ -1010,7 +1010,7 @@ WindowMsgHandledType MainMenuInput( GameWindow *window, UnsignedInt msg, } } - } // end char + } break; case GWM_CHAR: { @@ -1025,14 +1025,14 @@ WindowMsgHandledType MainMenuInput( GameWindow *window, UnsignedInt msg, return MSG_HANDLED; } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end MainMenuInput +} void PrintOffsetsFromControlBarParent( void ); //------------------------------------------------------------------------------------------------- /** Main menu window system callback */ @@ -1051,7 +1051,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, { ghttpStartup(); break; - } // end case + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -1062,7 +1062,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, StopAsyncDNSCheck(); // kill off the async DNS check thread in case it is still running break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -1074,7 +1074,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_MOUSE_ENTERING: { @@ -1340,7 +1340,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, TheTransitionHandler->remove("MainMenuDefaultMenu"); TheTransitionHandler->reverse("MainMenuDefaultMenuBack"); TheTransitionHandler->setGroup("MainMenuSinglePlayerMenu"); - } // end if + } else if( controlID == buttonSingleBackID ) { if(campaignSelected || dontAllowTransitions) @@ -1351,7 +1351,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, TheTransitionHandler->reverse("MainMenuSinglePlayerMenuBack"); TheTransitionHandler->setGroup("MainMenuDefaultMenu"); dontAllowTransitions = TRUE; - } // end if + } else if( controlID == buttonMultiBackID ) { if(dontAllowTransitions) @@ -1362,7 +1362,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, TheTransitionHandler->remove("MainMenuMultiPlayerMenu"); TheTransitionHandler->reverse("MainMenuMultiPlayerMenuReverse"); TheTransitionHandler->setGroup("MainMenuDefaultMenu"); - } // end if + } else if( controlID == buttonLoadReplayBackID ) { if(dontAllowTransitions) @@ -1373,7 +1373,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, TheTransitionHandler->remove("MainMenuLoadReplayMenu"); TheTransitionHandler->reverse("MainMenuLoadReplayMenuBack"); TheTransitionHandler->setGroup("MainMenuDefaultMenu"); - } // end if + } else if( control == buttonCredits ) { @@ -1473,7 +1473,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, // localAnimateWindowManager->reverseAnimateWindow(); dropDown = DROPDOWN_NONE; - } // end else if + } else if( controlID == networkID ) { if(dontAllowTransitions) @@ -1485,7 +1485,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, TheShell->push( AsciiString("Menus/LanLobbyMenu.wnd") ); TheScriptEngine->signalUIInteract(TheShellHookNames[SHELL_SCRIPT_HOOK_MAIN_MENU_NETWORK_SELECTED]); - } // end else if + } else if( controlID == optionsID ) { if(dontAllowTransitions) @@ -1500,7 +1500,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, optLayout->runInit(); optLayout->hide(FALSE); optLayout->bringForward(); - } // end else if + } else if( controlID == worldBuilderID ) { #if defined RTS_DEBUG @@ -1534,7 +1534,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, // //#endif - } // end else if + } else if(controlID == buttonChallengeID) { if(campaignSelected || dontAllowTransitions) @@ -1656,7 +1656,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, // layout->bringForward(); // setupGameStart(TheCampaignManager->getCurrentMap()); - }// end else if + } else if(controlID == buttonEasyID) { if(dontAllowTransitions) @@ -1691,17 +1691,17 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end selected + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end MainMenuSystem +} void diffReverseSide( void ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp index e709ea90ff1..291e94ed4e9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp @@ -104,7 +104,7 @@ static void shutdownComplete( WindowLayout *layout ) // our shutdown is complete TheShell->shutdownComplete( layout ); -} // end if +} void SetDifficultyRadioButton( void ) { @@ -151,7 +151,7 @@ void SetDifficultyRadioButton( void ) } } - } // if (TheScriptEngine) + } } //------------------------------------------------------------------------------------------------- @@ -208,7 +208,7 @@ void MapSelectMenuInit( WindowLayout *layout, void *userData ) GadgetRadioSetSelection( radioButtonSystemMaps, FALSE ); else GadgetRadioSetSelection( radioButtonUserMaps, FALSE ); -} // end MapSelectMenuInit +} //------------------------------------------------------------------------------------------------- /** MapSelect menu shutdown method */ @@ -226,12 +226,12 @@ void MapSelectMenuShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } if (!startGame) TheShell->reverseAnimatewindow(); -} // end MapSelectMenuShutdown +} //------------------------------------------------------------------------------------------------- /** MapSelect menu update method */ @@ -247,7 +247,7 @@ void MapSelectMenuUpdate( WindowLayout *layout, void *userData ) shutdownComplete(layout); -} // end MapSelectMenuUpdate +} //------------------------------------------------------------------------------------------------- /** Map select menu input callback */ @@ -287,22 +287,22 @@ WindowMsgHandledType MapSelectMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)button, buttonID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end MapSelectMenuInput +} //------------------------------------------------------------------------------------------------- /** MapSelect menu window system callback */ @@ -332,7 +332,7 @@ WindowMsgHandledType MapSelectMenuSystem( GameWindow *window, UnsignedInt msg, radioButtonHardAI = TheNameKeyGenerator->nameToKey( AsciiString("MapSelectMenu.wnd:RadioButtonHardAI") ); break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -340,7 +340,7 @@ WindowMsgHandledType MapSelectMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -352,7 +352,7 @@ WindowMsgHandledType MapSelectMenuSystem( GameWindow *window, UnsignedInt msg, return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -402,7 +402,7 @@ WindowMsgHandledType MapSelectMenuSystem( GameWindow *window, UnsignedInt msg, TheShell->pop(); buttonPushed = true; - } // end if + } else if( controlID == buttonOK ) { @@ -424,9 +424,9 @@ WindowMsgHandledType MapSelectMenuSystem( GameWindow *window, UnsignedInt msg, DEBUG_ASSERTCRASH(mapFname, ("No map item data")); if (mapFname) setupGameStart(mapFname); - } // end if + } - } // end else if + } else if( controlID == radioButtonEasyAI) { s_AIDiff = DIFFICULTY_EASY; @@ -441,7 +441,7 @@ WindowMsgHandledType MapSelectMenuSystem( GameWindow *window, UnsignedInt msg, } break; - } // end selected + } case GLM_DOUBLE_CLICKED: { if (buttonPushed) @@ -469,8 +469,8 @@ WindowMsgHandledType MapSelectMenuSystem( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end MapSelectMenuSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp index 23c14e232b3..75900159d62 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp @@ -349,7 +349,7 @@ void NetworkDirectConnectInit( WindowLayout *layout, void *userData ) TheTransitionHandler->setGroup("NetworkDirectConnectFade"); -} // NetworkDirectConnectInit +} //------------------------------------------------------------------------------------------------- /** This is called when a shutdown is complete for this menu */ @@ -365,7 +365,7 @@ static void shutdownComplete( WindowLayout *layout ) // our shutdown is complete TheShell->shutdownComplete( layout ); -} // end if +} //------------------------------------------------------------------------------------------------- /** WOL Welcome Menu shutdown method */ @@ -382,12 +382,12 @@ void NetworkDirectConnectShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } TheShell->reverseAnimatewindow(); TheTransitionHandler->reverse("NetworkDirectConnectFade"); -} // NetworkDirectConnectShutdown +} //------------------------------------------------------------------------------------------------- @@ -398,7 +398,7 @@ void NetworkDirectConnectUpdate( WindowLayout * layout, void *userData) // We'll only be successful if we've requested to if(isShuttingDown && TheShell->isAnimFinished() && TheTransitionHandler->isFinished()) shutdownComplete(layout); -}// NetworkDirectConnectUpdate +} //------------------------------------------------------------------------------------------------- /** WOL Welcome Menu input callback */ @@ -433,21 +433,21 @@ WindowMsgHandledType NetworkDirectConnectInput( GameWindow *window, UnsignedInt TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonBack, buttonBackID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// NetworkDirectConnectInput +} //------------------------------------------------------------------------------------------------- /** WOL Welcome Menu window system callback */ @@ -465,12 +465,12 @@ WindowMsgHandledType NetworkDirectConnectSystem( GameWindow *window, UnsignedInt { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -479,7 +479,7 @@ WindowMsgHandledType NetworkDirectConnectSystem( GameWindow *window, UnsignedInt *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } case GBM_SELECTED: { @@ -504,7 +504,7 @@ WindowMsgHandledType NetworkDirectConnectSystem( GameWindow *window, UnsignedInt buttonPushed = true; LANbuttonPushed = true; TheShell->pop(); - } //if ( controlID == buttonBack ) + } else if (controlID == buttonHostID) { HostDirectConnectGame(); @@ -514,7 +514,7 @@ WindowMsgHandledType NetworkDirectConnectSystem( GameWindow *window, UnsignedInt JoinDirectConnectGame(); } break; - }// case GBM_SELECTED: + } case GEM_EDIT_DONE: { @@ -523,7 +523,7 @@ WindowMsgHandledType NetworkDirectConnectSystem( GameWindow *window, UnsignedInt default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// NetworkDirectConnectSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index 9c75900ab9b..d853fd78cbe 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -2071,7 +2071,7 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) TheWindowManager->winSetModal(parent); ignoreSelected = FALSE; -} // end OptionsMenuInit +} //------------------------------------------------------------------------------------------------- /** options menu shutdown method */ @@ -2095,7 +2095,7 @@ void OptionsMenuShutdown( WindowLayout *layout, void *userData ) TheShell->shutdownComplete( layout ); */ -} // end OptionsMenuShutdown +} //------------------------------------------------------------------------------------------------- /** options menu update method */ @@ -2103,7 +2103,7 @@ void OptionsMenuShutdown( WindowLayout *layout, void *userData ) void OptionsMenuUpdate( WindowLayout *layout, void *userData ) { -} // end OptionsMenuUpdate +} //------------------------------------------------------------------------------------------------- /** Options menu input callback */ @@ -2141,22 +2141,22 @@ WindowMsgHandledType OptionsMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)button, buttonID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end OptionsMenuInput +} //------------------------------------------------------------------------------------------------- /** options menu window system callback */ @@ -2185,7 +2185,7 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -2193,7 +2193,7 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -2205,7 +2205,7 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- case GCM_SELECTED: @@ -2255,7 +2255,7 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, DestroyOptionsLayout(); } - } // end if + } else if (controlID == buttonAccept ) { saveOptions(); @@ -2369,13 +2369,13 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, } break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end OptionsMenuSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp index a516d03d3d4..281d6d2b32f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp @@ -72,7 +72,7 @@ void PopupCommunicatorInit( WindowLayout *layout, void *userData ) buttonOkID = TheNameKeyGenerator->nameToKey( AsciiString("PopupCommunicator.wnd:ButtonOk") ); buttonOk = TheWindowManager->winGetWindowFromId( parent, buttonOkID ); -} // end PopupCommunicatorInit +} //------------------------------------------------------------------------------------------------- /** Popup Communicator shutdown method */ @@ -80,7 +80,7 @@ void PopupCommunicatorInit( WindowLayout *layout, void *userData ) void PopupCommunicatorShutdown( WindowLayout *layout, void *userData ) { -} // end PopupCommunicatorShutdown +} //------------------------------------------------------------------------------------------------- /** Popup Communicator update method */ @@ -88,7 +88,7 @@ void PopupCommunicatorShutdown( WindowLayout *layout, void *userData ) void PopupcommunicatorUpdate( WindowLayout *layout, void *userData ) { -} // end PopupCommunicatorUpdate +} //------------------------------------------------------------------------------------------------- /** Popup Communicator input callback */ @@ -123,22 +123,22 @@ WindowMsgHandledType PopupCommunicatorInput( GameWindow *window, UnsignedInt msg TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonOk, buttonOkID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end PopupCommunicatorInput +} //------------------------------------------------------------------------------------------------- /** Popup Communicator window system callback */ @@ -156,14 +156,14 @@ WindowMsgHandledType PopupCommunicatorSystem( GameWindow *window, UnsignedInt ms break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { break; - } // end case + } //---------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -175,7 +175,7 @@ WindowMsgHandledType PopupCommunicatorSystem( GameWindow *window, UnsignedInt ms break; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: { @@ -191,16 +191,16 @@ WindowMsgHandledType PopupCommunicatorSystem( GameWindow *window, UnsignedInt ms deleteInstance(popupCommunicatorLayout); popupCommunicatorLayout = NULL; } - } // end if + } break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp index 7aa5266ad58..31262bf0629 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp @@ -414,18 +414,18 @@ WindowMsgHandledType PopupHostGameInput( GameWindow *window, UnsignedInt msg, Wi TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonCancel, buttonCancelID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; @@ -445,7 +445,7 @@ WindowMsgHandledType PopupHostGameSystem( GameWindow *window, UnsignedInt msg, W break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { @@ -453,7 +453,7 @@ WindowMsgHandledType PopupHostGameSystem( GameWindow *window, UnsignedInt msg, W break; - } // end case + } //---------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -465,7 +465,7 @@ WindowMsgHandledType PopupHostGameSystem( GameWindow *window, UnsignedInt msg, W break; - } // end input + } //---------------------------------------------------------------------------------------------- case GEM_UPDATE_TEXT: @@ -493,9 +493,9 @@ WindowMsgHandledType PopupHostGameSystem( GameWindow *window, UnsignedInt msg, W // Put the whitespace-free version in the box GadgetTextEntrySetText( textEntryGameName, txtInput ); - }// if ( controlID == textEntryPlayerNameID ) + } break; - }//case GEM_UPDATE_TEXT: + } //--------------------------------------------------------------------------------------------- case GCM_SELECTED: { @@ -518,7 +518,7 @@ WindowMsgHandledType PopupHostGameSystem( GameWindow *window, UnsignedInt msg, W } } break; - } // case GCM_SELECTED + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -551,7 +551,7 @@ WindowMsgHandledType PopupHostGameSystem( GameWindow *window, UnsignedInt msg, W default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp index c4ad9bd91e1..8a3dca46bc9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp @@ -140,18 +140,18 @@ WindowMsgHandledType PopupJoinGameInput( GameWindow *window, UnsignedInt msg, Wi GameSpyCloseOverlay(GSOVERLAY_GAMEPASSWORD); SetLobbyAttemptHostJoin( FALSE ); parentPopup = NULL; - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; @@ -171,14 +171,14 @@ WindowMsgHandledType PopupJoinGameSystem( GameWindow *window, UnsignedInt msg, W break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { break; - } // end case + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -204,7 +204,7 @@ WindowMsgHandledType PopupJoinGameSystem( GameWindow *window, UnsignedInt msg, W break; - } // end input + } //--------------------------------------------------------------------------------------------- case GEM_EDIT_DONE: { @@ -230,7 +230,7 @@ WindowMsgHandledType PopupJoinGameSystem( GameWindow *window, UnsignedInt msg, W default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp index 76d79a96ec2..2ef346abe7b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp @@ -301,18 +301,18 @@ WindowMsgHandledType PopupLadderSelectInput( GameWindow *window, UnsignedInt msg break; } - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; @@ -341,7 +341,7 @@ WindowMsgHandledType PopupLadderSelectSystem( GameWindow *window, UnsignedInt ms case GWM_CREATE: { break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { @@ -350,7 +350,7 @@ WindowMsgHandledType PopupLadderSelectSystem( GameWindow *window, UnsignedInt ms listboxLadderDetails = NULL; CustomMatchHideHostPopup(FALSE); break; - } // end case + } //---------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -359,7 +359,7 @@ WindowMsgHandledType PopupLadderSelectSystem( GameWindow *window, UnsignedInt ms if( mData1 == TRUE ) *(Bool *)mData2 = TRUE; break; - } // end input + } //---------------------------------------------------------------------------------------------- case GBM_SELECTED: { @@ -429,7 +429,7 @@ WindowMsgHandledType PopupLadderSelectSystem( GameWindow *window, UnsignedInt ms setPasswordMode(PASS_NONE); } break; - } // end input + } //--------------------------------------------------------------------------------------------- case GLM_SELECTED: @@ -445,7 +445,7 @@ WindowMsgHandledType PopupLadderSelectSystem( GameWindow *window, UnsignedInt ms updateLadderDetails(selID, staticTextLadderName, listboxLadderDetails); break; - } // end GLM_DOUBLE_CLICKED + } //--------------------------------------------------------------------------------------------- case GLM_DOUBLE_CLICKED: @@ -479,7 +479,7 @@ WindowMsgHandledType PopupLadderSelectSystem( GameWindow *window, UnsignedInt ms default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; @@ -613,7 +613,7 @@ WindowMsgHandledType RCGameDetailsMenuSystem( GameWindow *window, UnsignedInt ms ladderInfoID = NAMEKEY("RCGameDetailsMenu.wnd:ButtonLadderDetails"); buttonOkID = NAMEKEY("PopupLadderDetails.wnd:ButtonOk"); break; - } // case GWM_DESTROY: + } case GGM_CLOSE: { @@ -625,7 +625,7 @@ WindowMsgHandledType RCGameDetailsMenuSystem( GameWindow *window, UnsignedInt ms case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GBM_SELECTED: { @@ -673,6 +673,6 @@ WindowMsgHandledType RCGameDetailsMenuSystem( GameWindow *window, UnsignedInt ms default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp index c712371c0d4..a3c3dc9d1e4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp @@ -1334,7 +1334,7 @@ void GameSpyPlayerInfoOverlayInit( WindowLayout *layout, void *userData ) } //TheWindowManager->winSetModal(parent); -} // GameSpyPlayerInfoOverlayInit +} //------------------------------------------------------------------------------------------------- /** Overlay shutdown method */ @@ -1348,7 +1348,7 @@ void GameSpyPlayerInfoOverlayShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete isOverlayActive = false; -} // GameSpyPlayerInfoOverlayShutdown +} //------------------------------------------------------------------------------------------------- @@ -1359,7 +1359,7 @@ void GameSpyPlayerInfoOverlayUpdate( WindowLayout * layout, void *userData) if (raiseMessageBox) RaiseGSMessageBox(); raiseMessageBox = false; -}// GameSpyPlayerInfoOverlayUpdate +} //------------------------------------------------------------------------------------------------- /** Overlay input callback */ @@ -1392,21 +1392,21 @@ WindowMsgHandledType GameSpyPlayerInfoOverlayInput( GameWindow *window, Unsigned TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonClose, buttonCloseID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// GameSpyPlayerInfoOverlayInput +} void messageBoxYes( void ); //------------------------------------------------------------------------------------------------- /** Overlay window system callback */ @@ -1424,12 +1424,12 @@ WindowMsgHandledType GameSpyPlayerInfoOverlaySystem( GameWindow *window, Unsigne { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -1438,7 +1438,7 @@ WindowMsgHandledType GameSpyPlayerInfoOverlaySystem( GameWindow *window, Unsigne *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } case GBM_SELECTED: { GameWindow *control = (GameWindow *)mData1; @@ -1514,15 +1514,15 @@ WindowMsgHandledType GameSpyPlayerInfoOverlaySystem( GameWindow *window, Unsigne } break; - }// case GBM_SELECTED: + } default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// GameSpyPlayerInfoOverlaySystem +} static void messageBoxYes( void ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp index 460cdadd509..3f0dfd11da0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp @@ -102,7 +102,7 @@ static void closeSaveMenu( GameWindow *window ) if( layout ) layout->hide( TRUE ); -} // end closeSaveMenu +} //------------------------------------------------------------------------------------------------- /** Initialize the SaveLoad menu */ @@ -151,7 +151,7 @@ void PopupReplayInit( WindowLayout *layout, void *userData ) control->winEnable( FALSE ); } -} // end SaveLoadMenuInit +} //------------------------------------------------------------------------------------------------- /** SaveLoad menu shutdown method */ @@ -160,7 +160,7 @@ void PopupReplayShutdown( WindowLayout *layout, void *userData ) { parent = NULL; -} // end SaveLoadMenuShutdown +} //------------------------------------------------------------------------------------------------- /** SaveLoad menu update method */ @@ -184,7 +184,7 @@ void PopupReplayUpdate( WindowLayout *layout, void *userData ) s_fileSavePopupStartTime = 0; } } -} // end SaveLoadMenuUpdate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -216,18 +216,18 @@ WindowMsgHandledType PopupReplayInput( GameWindow *window, UnsignedInt msg, Wind TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)button, buttonBackKey ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; } @@ -348,14 +348,14 @@ WindowMsgHandledType PopupReplaySystem( GameWindow *window, UnsignedInt msg, break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { break; - } // end case + } //---------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -367,7 +367,7 @@ WindowMsgHandledType PopupReplaySystem( GameWindow *window, UnsignedInt msg, break; - } // end input + } // -------------------------------------------------------------------------------------------- case GLM_SELECTED: @@ -396,7 +396,7 @@ WindowMsgHandledType PopupReplaySystem( GameWindow *window, UnsignedInt msg, break; - } // end selected + } //--------------------------------------------------------------------------------------------- case GEM_EDIT_DONE: @@ -416,7 +416,7 @@ WindowMsgHandledType PopupReplaySystem( GameWindow *window, UnsignedInt msg, break; - } // end selected + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: { @@ -443,11 +443,11 @@ WindowMsgHandledType PopupReplaySystem( GameWindow *window, UnsignedInt msg, closeSaveMenu( window ); ScoreScreenEnableControls(TRUE); - } // end if + } break; - } // end selected + } case GEM_UPDATE_TEXT: { @@ -478,7 +478,7 @@ WindowMsgHandledType PopupReplaySystem( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp index dda280fe729..a93d7338ee4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp @@ -121,7 +121,7 @@ static void updateMenuActions( void ) GameWindow *buttonDelete = TheWindowManager->winGetWindowFromId( NULL, buttonDeleteKey ); buttonDelete->winEnable( selectedGameInfo != NULL ); -} // end updateMenuActions +} //------------------------------------------------------------------------------------------------- /** Initialize the SaveLoad menu */ @@ -180,7 +180,7 @@ void SaveLoadMenuInit( WindowLayout *layout, void *userData ) // update the availability of the menu buttons updateMenuActions(); -} // end SaveLoadMenuInit +} //------------------------------------------------------------------------------------------------- /** Initialize the SaveLoad menu */ @@ -249,7 +249,7 @@ void SaveLoadMenuFullScreenInit( WindowLayout *layout, void *userData ) if(parent) parent->winHide(TRUE); isShuttingDown = false; -} // end SaveLoadMenuInit +} //------------------------------------------------------------------------------------------------- /** SaveLoad menu shutdown method */ @@ -265,12 +265,12 @@ void SaveLoadMenuShutdown( WindowLayout *layout, void *userData ) TheShell->shutdownComplete( layout ); return; - } //end if + } // our shutdown is complete TheTransitionHandler->reverse("SaveLoadMenuFade"); isShuttingDown = TRUE; -} // end SaveLoadMenuShutdown +} //------------------------------------------------------------------------------------------------- /** SaveLoad menu update method */ @@ -301,7 +301,7 @@ void SaveLoadMenuUpdate( WindowLayout *layout, void *userData ) if(isShuttingDown && TheShell->isAnimFinished()&& TheTransitionHandler->isFinished()) TheShell->shutdownComplete( layout ); -} // end SaveLoadMenuUpdate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -343,18 +343,18 @@ WindowMsgHandledType SaveLoadMenuInput( GameWindow *window, UnsignedInt msg, Win TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)button, buttonBackKey ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; } @@ -379,7 +379,7 @@ static AvailableGameInfo *getSelectedSaveFileInfo( GameWindow *window ) return selectedGameInfo; -} // end getSelectedSaveFileInfo +} // ---------------------------------------------------con------------------------------------------ // ------------------------------------------------------------------------------------------------ // close the save/load menu @@ -422,7 +422,7 @@ static void doLoadGame( void ) TheShell->showShell(TRUE); } -} // end doLoadGame +} // ------------------------------------------------------------------------------------------------ /** Close the save/load menu */ @@ -439,7 +439,7 @@ static void closeSaveMenu( GameWindow *window ) else TheShell->hideShell(); -} // end closeSaveMenu +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -472,12 +472,12 @@ static void setEditDescription( GameWindow *editControl ) defaultDesc.truncateBy(4); } - } // end else + } // set into edit control GadgetTextEntrySetText( editControl, defaultDesc ); -} // end setEditDescription +} //---------------------------------------------------------------------------------------------- static void processLoadButtonPress(GameWindow *window) @@ -498,7 +498,7 @@ static void processLoadButtonPress(GameWindow *window) closeSaveMenu( window ); doLoadGame(); - } // end if + } else { @@ -513,9 +513,9 @@ static void processLoadButtonPress(GameWindow *window) // show the load confirm dialog loadConfirm->winHide( FALSE ); - } // end else + } - } // end if + } } //------------------------------------------------------------------------------------------------- @@ -534,14 +534,14 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { break; - } // end case + } //---------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -553,7 +553,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end input + } //---------------------------------------------------------------------------------------------- case GLM_DOUBLE_CLICKED: @@ -591,7 +591,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end selected + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -602,7 +602,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, if( controlID == buttonLoadKey ) { processLoadButtonPress(window); - } // end if + } else if( controlID == buttonSaveKey ) { @@ -637,7 +637,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, TheWindowManager->winSetFocus(editDesc); - } // end if + } else { @@ -653,7 +653,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, //GameWindow *overwriteConfirm = TheWindowManager->winGetWindowFromId( parent, NAMEKEY( "PopupSaveLoad.wnd:OverwriteConfirmParent" ) ); overwriteConfirm->winHide( FALSE ); - } // end else + } } else if( controlID == buttonDeleteKey ) @@ -681,9 +681,9 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, //GameWindow *deleteConfirm = TheWindowManager->winGetWindowFromId( parent, NAMEKEY( "PopupSaveLoad.wnd:DeleteConfirmParent" ) ); deleteConfirm->winHide( FALSE ); - } // end if + } - } // end else if + } else if( controlID == buttonBackKey ) { if(isPopup) @@ -696,7 +696,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, TheShell->pop(); } - } // end if + } else if( controlID == buttonDeleteConfirm || controlID == buttonDeleteCancel ) { //GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( parent, NAMEKEY( "PopupSaveLoad.wnd:ListboxGames" ) ); @@ -720,7 +720,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, // repopulate the listbox TheGameState->populateSaveGameListbox( listboxGames, currentLayoutType ); - } // end if + } // hide the confirm dialog //GameWindow *deleteConfirm = TheWindowManager->winGetWindowFromId( parent, NAMEKEY( "PopupSaveLoad.wnd:DeleteConfirmParent" ) ); @@ -734,7 +734,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, buttonFrame->winEnable( TRUE ); updateMenuActions(); - } // end if + } else if( controlID == buttonOverwriteCancel || controlID == buttonOverwriteConfirm ) { //GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( parent, NAMEKEY( "PopupSaveLoad.wnd:ListboxGames" ) ); @@ -796,7 +796,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, GameWindow *editDesc = TheWindowManager->winGetWindowFromId( saveDesc, NAMEKEY( "PopupSaveLoad.wnd:EntryDesc" ) ); setEditDescription( editDesc ); */ - } // end if + } else if( controlID == buttonOverwriteCancel ) { //GameWindow *buttonFrame = TheWindowManager->winGetWindowFromId( parent, NAMEKEY( "PopupSaveLoad.wnd:MenuButtonFrame" ) ); @@ -806,9 +806,9 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, updateMenuActions(); listboxGames->winEnable( TRUE ); - } // end else if + } - } // end else if + } else if( controlID == buttonSaveDescConfirm ) { @@ -855,7 +855,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, filename = selectedGameInfo->filename; TheGameState->saveGame( filename, desc, fileType ); - } // end else if + } else if( controlID == buttonSaveDescCancel ) { @@ -872,7 +872,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, buttonFrame->winEnable( TRUE ); updateMenuActions(); - } // end else if + } else if( controlID == buttonLoadConfirm || controlID == buttonLoadCancel ) { @@ -902,16 +902,16 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, doLoadGame(); } - } // end else if + } break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp index 7f1d075e08b..d247d840867 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp @@ -445,7 +445,7 @@ void ToggleQuitMenu() TheInGameUI->setQuitMenuVisible(isVisible); -} // end ToggleQuitMenu +} //------------------------------------------------------------------------------------------------- /** Quit menu window system callback */ @@ -462,7 +462,7 @@ WindowMsgHandledType QuitMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -470,7 +470,7 @@ WindowMsgHandledType QuitMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end case + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -509,14 +509,14 @@ WindowMsgHandledType QuitMenuSystem( GameWindow *window, UnsignedInt msg, else if( controlID == buttonExit ) { quitConfirmationWindow = QuitMessageBoxYesNo(TheGameText->fetch("GUI:QuitPopupTitle"), TheGameText->fetch("GUI:QuitPopupMessage"),/*quitCallback*/exitQuitMenu,noExitQuitMenu); - } // end if + } else if( controlID == buttonReturn ) { // hide this menu ToggleQuitMenu(); - } // end else if + } else if( buttonOptions == controlID ) { WindowLayout *optLayout = TheShell->getOptionsLayout(TRUE); @@ -546,17 +546,17 @@ WindowMsgHandledType QuitMenuSystem( GameWindow *window, UnsignedInt msg, TheGameText->fetch("GUI:RestartConfirmation"), /*quitCallback*/restartMissionMenu,noExitQuitMenu); } - } // end else if + } break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end QuitMenuSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp index f033d9d9e91..16e68dea3f5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp @@ -378,7 +378,7 @@ void ReplayMenuInit( WindowLayout *layout, void *userData ) win->winHide(TRUE); isShuttingDown = FALSE; -} // end ReplayMenuInit +} //------------------------------------------------------------------------------------------------- /** single player menu shutdown method */ @@ -394,12 +394,12 @@ void ReplayMenuShutdown( WindowLayout *layout, void *userData ) TheShell->shutdownComplete( layout ); return; - } //end if + } // our shutdown is complete TheTransitionHandler->reverse("ReplayMenuFade"); isShuttingDown = TRUE; -} // end ReplayMenuShutdown +} //------------------------------------------------------------------------------------------------- /** single player menu update method */ @@ -427,7 +427,7 @@ void ReplayMenuUpdate( WindowLayout *layout, void *userData ) if(isShuttingDown && TheShell->isAnimFinished()&& TheTransitionHandler->isFinished()) TheShell->shutdownComplete( layout ); -} // end ReplayMenuUpdate +} //------------------------------------------------------------------------------------------------- /** Replay menu input callback */ @@ -462,22 +462,22 @@ WindowMsgHandledType ReplayMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonBack, buttonBackID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end ReplayMenuInput +} void reallyLoadReplay(void) { @@ -564,7 +564,7 @@ WindowMsgHandledType ReplayMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -572,7 +572,7 @@ WindowMsgHandledType ReplayMenuSystem( GameWindow *window, UnsignedInt msg, break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -584,7 +584,7 @@ WindowMsgHandledType ReplayMenuSystem( GameWindow *window, UnsignedInt msg, return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- case GLM_DOUBLE_CLICKED: { @@ -652,14 +652,14 @@ WindowMsgHandledType ReplayMenuSystem( GameWindow *window, UnsignedInt msg, filename = GetReplayFilenameFromListbox(listboxReplayFiles, selected); loadReplay(filename); } - } // end else if + } else if( controlID == buttonBackID ) { // thou art directed to return to thy known solar system immediately! TheShell->pop(); - } // end else if + } else if( controlID == buttonDeleteID ) { Int selected; @@ -685,14 +685,14 @@ WindowMsgHandledType ReplayMenuSystem( GameWindow *window, UnsignedInt msg, MessageBoxYesNo(TheGameText->fetch("GUI:CopyReplay"), TheGameText->fetch("GUI:AreYouSureCopy"), copyReplayFlag, NULL); } break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end ReplayMenuSystem +} void deleteReplay( void ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp index 6f2d0af10bf..033e400dc51 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp @@ -482,22 +482,22 @@ WindowMsgHandledType ScoreScreenInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonOk, buttonOkID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end MainMenuInput +} static Bool showReplayButtonContinue() { @@ -531,7 +531,7 @@ WindowMsgHandledType ScoreScreenSystem( GameWindow *window, UnsignedInt msg, *(Bool *)mData2 = TRUE; break; - } // end input + } // -------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -605,7 +605,7 @@ WindowMsgHandledType ScoreScreenSystem( GameWindow *window, UnsignedInt msg, if(TheLAN) TheLAN->RequestChat(txtInput, LANAPIInterface::LANCHAT_EMOTE); //add the gamespy chat request here - } //if ( controlID == buttonEmote ) + } for(Int i = 0; i < MAX_SLOTS; ++i) { AsciiString name; @@ -664,7 +664,7 @@ WindowMsgHandledType ScoreScreenSystem( GameWindow *window, UnsignedInt msg, TheLAN->RequestChat(txtInput, LANAPIInterface::LANCHAT_NORMAL); //add the gamespy chat request here - }// if ( controlID == textEntryChatID ) + } break; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp index e63bcb175ac..34c5c94fc06 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp @@ -54,7 +54,7 @@ static void shutdownComplete( WindowLayout *layout ) // our shutdown is complete TheShell->shutdownComplete( layout ); -} // end if +} //------------------------------------------------------------------------------------------------- /** Initialize the single player menu */ @@ -89,7 +89,7 @@ void SinglePlayerMenuInit( WindowLayout *layout, void *userData ) //TheShell->registerWithAnimateManager(parent, WIN_ANIMATION_SLIDE_TOP, TRUE); -} // end SinglePlayerMenuInit +} //------------------------------------------------------------------------------------------------- /** single player menu shutdown method */ @@ -106,11 +106,11 @@ void SinglePlayerMenuShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } TheShell->reverseAnimatewindow(); -} // end SinglePlayerMenuShutdown +} //------------------------------------------------------------------------------------------------- /** single player menu update method */ @@ -122,7 +122,7 @@ void SinglePlayerMenuUpdate( WindowLayout *layout, void *userData ) if(isShuttingDown && TheShell->isAnimFinished()) shutdownComplete(layout); -} // end SinglePlayerMenuUpdate +} //------------------------------------------------------------------------------------------------- /** SinglePlayer menu input callback */ @@ -162,22 +162,22 @@ WindowMsgHandledType SinglePlayerMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)button, buttonID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end SinglePlayerMenuInput +} //------------------------------------------------------------------------------------------------- /** single player menu window system callback */ @@ -203,7 +203,7 @@ WindowMsgHandledType SinglePlayerMenuSystem( GameWindow *window, UnsignedInt msg break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -211,7 +211,7 @@ WindowMsgHandledType SinglePlayerMenuSystem( GameWindow *window, UnsignedInt msg break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -223,7 +223,7 @@ WindowMsgHandledType SinglePlayerMenuSystem( GameWindow *window, UnsignedInt msg return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -240,11 +240,11 @@ WindowMsgHandledType SinglePlayerMenuSystem( GameWindow *window, UnsignedInt msg TheShell->push( AsciiString( "Menus/MapSelectMenu.wnd" ) ); buttonPushed = true; - } // end if + } else if( controlID == buttonLoad ) { - } // end else if + } else if( controlID == buttonBack ) { @@ -252,16 +252,16 @@ WindowMsgHandledType SinglePlayerMenuSystem( GameWindow *window, UnsignedInt msg TheShell->pop(); buttonPushed = true; - } // end else if + } break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end SinglePlayerMenuSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp index 7de6f851ce7..713198f60de 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp @@ -548,7 +548,7 @@ static void startPressed(void) CheckForCDAtGameStart( reallyDoStart ); } -}//void startPressed(void) +} ///////////////////////////////////////////////////// // MapSelectorTooltip - shows tooltips for the tech buildings @@ -1432,7 +1432,7 @@ void SkirmishGameOptionsMenuInit( WindowLayout *layout, void *userData ) if(win) win->winHide(TRUE); buttonPushed = FALSE; -}// void SkirmishGameOptionsMenuInit( WindowLayout *layout, void *userData ) +} //------------------------------------------------------------------------------------------------- /** This is called when a shutdown is complete for this menu */ @@ -1456,7 +1456,7 @@ static void shutdownComplete( WindowLayout *layout ) //LANnextScreen = NULL; -} // end if +} //------------------------------------------------------------------------------------------------- /** Skirmish Game Options menu shutdown method */ @@ -1475,7 +1475,7 @@ void SkirmishGameOptionsMenuShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } TheShell->reverseAnimatewindow(); @@ -1486,7 +1486,7 @@ void SkirmishGameOptionsMenuShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheTransitionHandler->reverse("SkirmishGameOptionsMenuFade"); -} // void SkirmishGameOptionsMenuShutdown( WindowLayout *layout, void *userData ) +} //------------------------------------------------------------------------------------------------- /** Skirmish Game Options menu update method */ @@ -1521,7 +1521,7 @@ void SkirmishGameOptionsMenuUpdate( WindowLayout * layout, void *userData) if(TheShell->isAnimFinished() && TheTransitionHandler->isFinished()) TheShell->shutdownComplete( layout ); -}// void SkirmishGameOptionsMenuUpdate( WindowLayout * layout, void *userData) +} //------------------------------------------------------------------------------------------------- /** Skirmish Game Options menu input callback */ @@ -1551,16 +1551,16 @@ WindowMsgHandledType SkirmishGameOptionsMenuInput( GameWindow *window, UnsignedI { TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonExit, buttonExitID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape - } // end switch( key ) - } // end char + } + } + } break; - } // end switch( msg ) + } return MSG_IGNORED; -}//WindowMsgHandledType SkirmishGameOptionsMenuInput( GameWindow *window, UnsignedInt msg, +} //------------------------------------------------------------------------------------------------- @@ -1576,7 +1576,7 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned case GWM_CREATE: { break; - } // case GWM_DESTROY: + } //------------------------------------------------------------------------------------------------- case GWM_DESTROY: { @@ -1584,7 +1584,7 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned windowMap->winSetUserData(NULL); break; - } // case GWM_DESTROY: + } //------------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: { @@ -1593,7 +1593,7 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } //------------------------------------------------------------------------------------------------- case GCM_SELECTED: { @@ -1628,7 +1628,7 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned sandboxOk = FALSE; skirmishUpdateSlotList(); break; - }// case GCM_SELECTED: + } //------------------------------------------------------------------------------------------------- case GSM_SLIDER_TRACK: { @@ -1665,7 +1665,7 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned delete TheSkirmishGameInfo; TheSkirmishGameInfo = NULL; - } //if ( controlID == buttonBack ) + } // else if ( controlID == buttonResetFPSID ) // { // static NameKeyType sliderGameSpeedID = TheNameKeyGenerator->nameToKey( AsciiString( "SkirmishGameOptionsMenu.wnd:SliderGameSpeed" ) ); @@ -1744,7 +1744,7 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned } } break; - }// case GBM_SELECTED: + } //------------------------------------------------------------------------------------------------- case GBM_SELECTED_RIGHT: { @@ -1796,7 +1796,7 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned //------------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp index 7daa39e7c60..aef88201ba7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp @@ -317,7 +317,7 @@ void SkirmishMapSelectMenuInit( WindowLayout *layout, void *userData ) mapList->winSetTooltipFunc(mapListTooltipFunc); } -} // end SkirmishMapSelectMenuInit +} //------------------------------------------------------------------------------------------------- /** MapSelect menu shutdown method */ @@ -333,7 +333,7 @@ void SkirmishMapSelectMenuShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheShell->shutdownComplete( layout ); -} // end LanMapSelectMenuShutdown +} //------------------------------------------------------------------------------------------------- /** MapSelect menu update method */ @@ -341,7 +341,7 @@ void SkirmishMapSelectMenuShutdown( WindowLayout *layout, void *userData ) void SkirmishMapSelectMenuUpdate( WindowLayout *layout, void *userData ) { -} // end SkirmishMapSelectMenuUpdate +} //------------------------------------------------------------------------------------------------- /** Map select menu input callback */ @@ -379,22 +379,22 @@ WindowMsgHandledType SkirmishMapSelectMenuInput( GameWindow *window, UnsignedInt TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)button, buttonID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end SkirmishMapSelectMenuInput +} //------------------------------------------------------------------------------------------------- /** MapSelect menu window system callback */ @@ -411,7 +411,7 @@ WindowMsgHandledType SkirmishMapSelectMenuSystem( GameWindow *window, UnsignedIn { break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -419,7 +419,7 @@ WindowMsgHandledType SkirmishMapSelectMenuSystem( GameWindow *window, UnsignedIn NullifyControls(); break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -431,7 +431,7 @@ WindowMsgHandledType SkirmishMapSelectMenuSystem( GameWindow *window, UnsignedIn return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- case GLM_DOUBLE_CLICKED: @@ -539,7 +539,7 @@ WindowMsgHandledType SkirmishMapSelectMenuSystem( GameWindow *window, UnsignedIn //TheShell->pop(); //do you need this ?? //PostToLanGameOptions( MAP_BACK ); - } // end if + } else if ( controlID == buttonOK ) { @@ -602,18 +602,18 @@ WindowMsgHandledType SkirmishMapSelectMenuSystem( GameWindow *window, UnsignedIn } //TheShell->pop(); - } // end if - } // end else if + } + } break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end SkirmishMapSelectMenuSystem*/ +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp index 9ed80880b5c..3884014da89 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp @@ -547,7 +547,7 @@ void HandleBuddyResponses( void ) if( TheAudio ) { TheAudio->addAudioEvent( &buddyMsgAudio ); - } // end if + } UnicodeString snippet = message.m_message; snippet.truncateTo(11); @@ -678,7 +678,7 @@ void showNotificationBox( AsciiString nick, UnicodeString message) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } } @@ -760,7 +760,7 @@ void WOLBuddyOverlayInit( WindowLayout *layout, void *userData ) isOverlayActive = true; updateBuddyInfo(); -} // WOLBuddyOverlayInit +} //------------------------------------------------------------------------------------------------- /** WOL Buddy Overlay shutdown method */ @@ -779,7 +779,7 @@ void WOLBuddyOverlayShutdown( WindowLayout *layout, void *userData ) InitBuddyControls(BUDDY_RESETALL_CRAP); -} // WOLBuddyOverlayShutdown +} //------------------------------------------------------------------------------------------------- @@ -789,7 +789,7 @@ void WOLBuddyOverlayUpdate( WindowLayout * layout, void *userData) { if (!TheGameSpyBuddyMessageQueue || !TheGameSpyBuddyMessageQueue->isConnected()) GameSpyCloseOverlay(GSOVERLAY_BUDDY); -}// WOLBuddyOverlayUpdate +} //------------------------------------------------------------------------------------------------- /** WOL Buddy Overlay input callback */ @@ -822,21 +822,21 @@ WindowMsgHandledType WOLBuddyOverlayInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonHide, buttonHideID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// WOLBuddyOverlayInput +} //------------------------------------------------------------------------------------------------- /** WOL Buddy Overlay window system callback */ @@ -857,12 +857,12 @@ WindowMsgHandledType WOLBuddyOverlaySystem( GameWindow *window, UnsignedInt msg, { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -871,7 +871,7 @@ WindowMsgHandledType WOLBuddyOverlaySystem( GameWindow *window, UnsignedInt msg, *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } case GLM_RIGHT_CLICKED: { GameWindow *control = (GameWindow *)mData1; @@ -984,7 +984,7 @@ WindowMsgHandledType WOLBuddyOverlaySystem( GameWindow *window, UnsignedInt msg, */ } break; - }// case GBM_SELECTED: + } case GLM_DOUBLE_CLICKED: { /* @@ -1092,10 +1092,10 @@ WindowMsgHandledType WOLBuddyOverlaySystem( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// WOLBuddyOverlaySystem +} WindowMsgHandledType PopupBuddyNotificationSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 ) @@ -1105,12 +1105,12 @@ WindowMsgHandledType PopupBuddyNotificationSystem( GameWindow *window, UnsignedI case GWM_CREATE: { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GBM_SELECTED: { @@ -1127,10 +1127,10 @@ WindowMsgHandledType PopupBuddyNotificationSystem( GameWindow *window, UnsignedI default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// PopupBuddyNotificationSystem +} /* static NameKeyType buttonAcceptBuddyID = NAMEKEY_INVALID; @@ -1221,7 +1221,7 @@ void RequestBuddyAdd(Int profileID, AsciiString nick) if( TheAudio ) { TheAudio->addAudioEvent( &buddyMsgAudio ); - } // end if + } lastNotificationWasStatus = FALSE; numOnlineInNotification = 0; @@ -1238,13 +1238,13 @@ WindowMsgHandledType WOLBuddyOverlayRCMenuSystem( GameWindow *window, UnsignedIn { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { rcMenu = NULL; break; - } // case GWM_DESTROY: + } case GGM_CLOSE: { @@ -1387,7 +1387,7 @@ WindowMsgHandledType WOLBuddyOverlayRCMenuSystem( GameWindow *window, UnsignedIn default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp index 518b490ab75..6f7a31ca0bc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp @@ -84,7 +84,7 @@ void WOLCustomScoreScreenInit( WindowLayout *layout, void *userData ) // Set Keyboard to Main Parent TheWindowManager->winSetFocus( parentWOLCustomScore ); -} // WOLCustomScoreScreenInit +} //------------------------------------------------------------------------------------------------- /** WOL Status Menu shutdown method */ @@ -96,7 +96,7 @@ void WOLCustomScoreScreenShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheShell->shutdownComplete( layout ); -} // WOLCustomScoreScreenShutdown +} //------------------------------------------------------------------------------------------------- @@ -108,7 +108,7 @@ void WOLCustomScoreScreenUpdate( WindowLayout * layout, void *userData) if (WOL::TheWOL) WOL::TheWOL->update(); */ -}// WOLCustomScoreScreenUpdate +} //------------------------------------------------------------------------------------------------- /** WOL Status Menu input callback */ @@ -141,21 +141,21 @@ WindowMsgHandledType WOLCustomScoreScreenInput( GameWindow *window, UnsignedInt TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonDisconnect, buttonDisconnectID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// WOLCustomScoreScreenInput +} //------------------------------------------------------------------------------------------------- /** WOL Status Menu window system callback */ @@ -172,12 +172,12 @@ WindowMsgHandledType WOLCustomScoreScreenSystem( GameWindow *window, UnsignedInt { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -186,7 +186,7 @@ WindowMsgHandledType WOLCustomScoreScreenSystem( GameWindow *window, UnsignedInt *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } case GBM_SELECTED: { @@ -201,7 +201,7 @@ WindowMsgHandledType WOLCustomScoreScreenSystem( GameWindow *window, UnsignedInt WOL::TheWOL->addCommand( WOL::WOLCOMMAND_RESET ); // don't display an error, log out, or anything } - } //if ( controlID == buttonDisconnect ) + } else if ( controlID == buttonLobbyID ) { if (WOL::TheWOL->getState() != WOL::WOLAPI_FATAL_ERROR) @@ -214,10 +214,10 @@ WindowMsgHandledType WOLCustomScoreScreenSystem( GameWindow *window, UnsignedInt else { } - } //if ( controlID == buttonDisconnect ) + } */ break; - }// case GBM_SELECTED: + } case GEM_EDIT_DONE: { @@ -226,7 +226,7 @@ WindowMsgHandledType WOLCustomScoreScreenSystem( GameWindow *window, UnsignedInt default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// WOLCustomScoreScreenSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp index d26d0c58d8d..f45b61e0f18 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp @@ -956,7 +956,7 @@ static void StartPressed(void) TheGameSpyPeerMessageQueue->addRequest(req); } -}//void StartPressed(void) +} //------------------------------------------------------------------------------------------------- /** Update options on screen */ @@ -1499,7 +1499,7 @@ void WOLGameSetupMenuInit( WindowLayout *layout, void *userData ) TheWindowManager->winSetFocus( textEntryChat ); raiseMessageBoxes = true; TheTransitionHandler->setGroup("GameSpyGameOptionsMenuFade"); -}// void WOLGameSetupMenuInit( WindowLayout *layout, void *userData ) +} //------------------------------------------------------------------------------------------------- /** This is called when a shutdown is complete for this menu */ @@ -1537,7 +1537,7 @@ static void shutdownComplete( WindowLayout *layout ) nextScreen = NULL; -} // end if +} //------------------------------------------------------------------------------------------------- /** GameSpy Game Options menu shutdown method */ @@ -1571,13 +1571,13 @@ void WOLGameSetupMenuShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } TheShell->reverseAnimatewindow(); RaiseGSMessageBox(); TheTransitionHandler->reverse("GameSpyGameOptionsMenuFade"); -} // void WOLGameSetupMenuShutdown( WindowLayout *layout, void *userData ) +} static void fillPlayerInfo(const PeerResponse *resp, PlayerInfo *info) { @@ -2429,7 +2429,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) } -}// void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) +} //------------------------------------------------------------------------------------------------- /** Lan Game Options menu input callback */ @@ -2474,16 +2474,16 @@ WindowMsgHandledType WOLGameSetupMenuInput( GameWindow *window, UnsignedInt msg, { TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonBack, buttonBackID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape - } // end switch( key ) - } // end char - } // end switch( msg ) + } + } + } + } */ return MSG_IGNORED; -}//WindowMsgHandledType WOLGameSetupMenuInput( GameWindow *window, UnsignedInt msg, +} // Slash commands ------------------------------------------------------------------------- @@ -2587,7 +2587,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg { buttonCommunicatorID = NAMEKEY("GameSpyGameOptionsMenu.wnd:ButtonCommunicator"); break; - } // case GWM_DESTROY: + } //------------------------------------------------------------------------------------------------- case GWM_DESTROY: { @@ -2595,7 +2595,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg windowMap->winSetUserData(NULL); break; - } // case GWM_DESTROY: + } //------------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: { @@ -2604,7 +2604,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } //------------------------------------------------------------------------------------------------- case GCM_SELECTED: { @@ -2681,7 +2681,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg } } break; - }// case GCM_SELECTED: + } //------------------------------------------------------------------------------------------------- case GBM_SELECTED: { @@ -2708,7 +2708,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg nextScreen = "Menus/WOLCustomLobby.wnd"; TheShell->pop(); - } //if ( controlID == buttonBack ) + } else if ( controlID == buttonCommunicatorID ) { GameSpyToggleOverlay( GSOVERLAY_BUDDY ); @@ -2725,7 +2725,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg // Echo the user's input to the chat window if (!txtInput.isEmpty()) TheGameSpyInfo->sendChat(txtInput, FALSE, NULL); // 'emote' button is now carriage-return - } //if ( controlID == buttonEmote ) + } else if ( controlID == buttonSelectMapID ) { WOLMapSelectLayout = TheWindowManager->winCreateLayout( "Menus/WOLMapSelectMenu.wnd" ); @@ -2811,7 +2811,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg break; - }// case GBM_SELECTED: + } //------------------------------------------------------------------------------------------------- case GBM_SELECTED_RIGHT: { @@ -2874,14 +2874,14 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg } } - }// if ( controlID == textEntryChatID ) + } break; } //------------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}//WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg, +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp index 0196c5bded5..8ae9cee8f42 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp @@ -81,7 +81,7 @@ void WOLLadderScreenInit( WindowLayout *layout, void *userData ) // set keyboard focus to main parent TheWindowManager->winSetFocus( parentWindow ); -} // end ReplayMenuInit +} //------------------------------------------------------------------------------------------------- /** single player menu shutdown method */ @@ -100,7 +100,7 @@ void WOLLadderScreenShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheShell->shutdownComplete( layout ); -} // end ReplayMenuShutdown +} //------------------------------------------------------------------------------------------------- /** single player menu update method */ @@ -108,7 +108,7 @@ void WOLLadderScreenShutdown( WindowLayout *layout, void *userData ) void WOLLadderScreenUpdate( WindowLayout *layout, void *userData ) { -} // end ReplayMenuUpdate +} //------------------------------------------------------------------------------------------------- /** Replay menu input callback */ @@ -143,22 +143,22 @@ WindowMsgHandledType WOLLadderScreenInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonBack, buttonBackID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end ReplayMenuInput +} //------------------------------------------------------------------------------------------------- /** single player menu window system callback */ @@ -177,7 +177,7 @@ WindowMsgHandledType WOLLadderScreenSystem( GameWindow *window, UnsignedInt msg, break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -185,7 +185,7 @@ WindowMsgHandledType WOLLadderScreenSystem( GameWindow *window, UnsignedInt msg, break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -197,7 +197,7 @@ WindowMsgHandledType WOLLadderScreenSystem( GameWindow *window, UnsignedInt msg, return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: { @@ -210,16 +210,16 @@ WindowMsgHandledType WOLLadderScreenSystem( GameWindow *window, UnsignedInt msg, // thou art directed to return to thy known solar system immediately! TheShell->pop(); - } // end else if + } break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end ReplayMenuSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp index 6d6f6af4fcf..7f4c1d74d24 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp @@ -721,7 +721,7 @@ void WOLLobbyMenuInit( WindowLayout *layout, void *userData ) win->winHide(TRUE); DontShowMainMenu = TRUE; -} // WOLLobbyMenuInit +} //------------------------------------------------------------------------------------------------- /** This is called when a shutdown is complete for this menu */ @@ -744,7 +744,7 @@ static void shutdownComplete( WindowLayout *layout ) nextScreen = NULL; -} // end if +} //------------------------------------------------------------------------------------------------- /** WOL Lobby Menu shutdown method */ @@ -789,7 +789,7 @@ void WOLLobbyMenuShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } TheShell->reverseAnimatewindow(); DontShowMainMenu = FALSE; @@ -797,7 +797,7 @@ void WOLLobbyMenuShutdown( WindowLayout *layout, void *userData ) RaiseGSMessageBox(); TheTransitionHandler->reverse("WOLCustomLobbyFade"); -} // WOLLobbyMenuShutdown +} static void fillPlayerInfo(const PeerResponse *resp, PlayerInfo *info) { @@ -1326,7 +1326,7 @@ void WOLLobbyMenuUpdate( WindowLayout * layout, void *userData) refreshGameList(); #endif } -}// WOLLobbyMenuUpdate +} //------------------------------------------------------------------------------------------------- /** WOL Lobby Menu input callback */ @@ -1361,21 +1361,21 @@ WindowMsgHandledType WOLLobbyMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonBack, buttonBackID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// WOLLobbyMenuInput +} //static void doSliderTrack(GameWindow *control, Int val) //{ @@ -1446,13 +1446,13 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, // sliderChatAdjustID = NAMEKEY("WOLCustomLobby.wnd:SliderChatAdjust"); break; - } // case GWM_DESTROY: + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } //--------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -1462,7 +1462,7 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } //--------------------------------------------------------------------------------------------- case GLM_SELECTED: @@ -1499,7 +1499,7 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, { RefreshGameInfoListBox(GetGameListBox(), GetGameInfoListBox()); } - } //if ( controlID == GetGameListBoxID() ) + } break; } @@ -1530,7 +1530,7 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, nextScreen = "Menus/WOLWelcomeMenu.wnd"; TheShell->pop(); - } //if ( controlID == buttonBack ) + } else if ( controlID == buttonRefreshID ) { // Added 2/17/03 added the game refresh button @@ -1652,7 +1652,7 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, } break; - }// case GBM_SELECTED: + } //--------------------------------------------------------------------------------------------- case GCM_SELECTED: @@ -1689,7 +1689,7 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, } } } - } // case GCM_SELECTED + } break; //--------------------------------------------------------------------------------------------- @@ -1714,7 +1714,7 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, } } break; - }// case GLM_DOUBLE_CLICKED: + } //--------------------------------------------------------------------------------------------- case GLM_RIGHT_CLICKED: @@ -1871,7 +1871,7 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// WOLLobbyMenuSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp index 0935010e647..b46a715edc2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp @@ -86,7 +86,7 @@ void WOLLocaleSelectInit( WindowLayout *layout, void *userData ) // Set Keyboard to Main Parent TheWindowManager->winSetFocus( parentLocaleSelect ); TheWindowManager->winSetModal( parentLocaleSelect ); -} // WOLLocaleSelectInit +} //------------------------------------------------------------------------------------------------- /** WOL Status Menu shutdown method */ @@ -100,7 +100,7 @@ void WOLLocaleSelectShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheShell->shutdownComplete( layout ); -} // WOLLocaleSelectShutdown +} //------------------------------------------------------------------------------------------------- @@ -109,7 +109,7 @@ void WOLLocaleSelectShutdown( WindowLayout *layout, void *userData ) void WOLLocaleSelectUpdate( WindowLayout * layout, void *userData) { -}// WOLLocaleSelectUpdate +} //------------------------------------------------------------------------------------------------- /** WOL Status Menu input callback */ @@ -129,10 +129,10 @@ WindowMsgHandledType WOLLocaleSelectInput( GameWindow *window, UnsignedInt msg, // ---------------------------------------------------------------------------------------- // don't let key fall through anywhere else return MSG_HANDLED; - } // end char - } // end switch( msg ) + } + } return MSG_IGNORED; -}// WOLLocaleSelectInput +} //Int getRegistryNicknameOffset(AsciiString nick); /// @todo: mdc remove this once we can save ini pref files //------------------------------------------------------------------------------------------------- @@ -151,12 +151,12 @@ WindowMsgHandledType WOLLocaleSelectSystem( GameWindow *window, UnsignedInt msg, { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -165,7 +165,7 @@ WindowMsgHandledType WOLLocaleSelectSystem( GameWindow *window, UnsignedInt msg, *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } case GBM_SELECTED: { @@ -213,9 +213,9 @@ WindowMsgHandledType WOLLocaleSelectSystem( GameWindow *window, UnsignedInt msg, TheGameSpyPSMessageQueue->addResponse(newResp); } CheckReOpenPlayerInfo(); - } //if ( controlID == buttonDisconnect ) + } break; - }// case GBM_SELECTED: + } case GEM_EDIT_DONE: { @@ -224,7 +224,7 @@ WindowMsgHandledType WOLLocaleSelectSystem( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// WOLLocaleSelectSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp index d9128f9fd02..5420b577234 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp @@ -364,7 +364,7 @@ static void shutdownComplete( WindowLayout *layout ) nextScreen = NULL; -} // end if +} // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// @@ -726,7 +726,7 @@ void WOLLoginMenuInit( WindowLayout *layout, void *userData ) } TheTransitionHandler->setGroup("GameSpyLoginProfileFade"); -} // WOLLoginMenuInit +} //------------------------------------------------------------------------------------------------- /** WOL Login Menu shutdown method */ @@ -754,12 +754,12 @@ void WOLLoginMenuShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } TheShell->reverseAnimatewindow(); TheTransitionHandler->reverse("GameSpyLoginProfileFade"); -} // WOLLoginMenuShutdown +} // this is used to check if we've got all the pings @@ -899,7 +899,7 @@ void WOLLoginMenuUpdate( WindowLayout * layout, void *userData) SetUpGameSpy( motd.str(), config.str() ); } -}// WOLLoginMenuUpdate +} //------------------------------------------------------------------------------------------------- /** WOL Login Menu input callback */ @@ -934,21 +934,21 @@ WindowMsgHandledType WOLLoginMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonBack, buttonBackID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// WOLLoginMenuInput +} static Bool isNickOkay(UnicodeString nick) { @@ -1034,12 +1034,12 @@ WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, case GWM_CREATE: { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -1048,7 +1048,7 @@ WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } // someone typed in a combo box. Clear password (or fill it in if the typed name matches a known login name) case GCM_UPDATE_TEXT: @@ -1215,7 +1215,7 @@ WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, buttonPushed = true; TearDownGameSpy(); TheShell->pop(); - } //if ( controlID == buttonBack ) + } #ifdef ALLOW_NON_PROFILED_LOGIN else if ( controlID == buttonUseAccountID ) { @@ -1223,14 +1223,14 @@ WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, nextScreen = "Menus/GameSpyLoginProfile.wnd"; TheShell->pop(); //TheShell->push( "Menus/GameSpyLoginProfile.wnd" ); - } //if ( controlID == buttonUseAccount ) + } else if ( controlID == buttonDontUseAccountID ) { buttonPushed = true; nextScreen = "Menus/GameSpyLoginQuick.wnd"; TheShell->pop(); //TheShell->push( "Menus/GameSpyLoginQuick.wnd" ); - } //if ( controlID == buttonDontUseAccount ) + } #endif // ALLOW_NON_PROFILED_LOGIN else if ( controlID == buttonCreateAccountID ) { @@ -1320,7 +1320,7 @@ WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, TheShell->pop(); } #endif // ALLOW_NON_PROFILED_LOGIN - } //if ( controlID == buttonCreateAccount ) + } else if ( controlID == buttonLoginID ) { AsciiString login, password, email; @@ -1428,7 +1428,7 @@ WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, } #endif // ALLOW_NON_PROFILED_LOGIN - } //if ( controlID == buttonLogin ) + } else if ( controlID == buttonTOSID ) { parentTOS->winHide(FALSE); @@ -1500,7 +1500,7 @@ WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, buttonBack->winEnable(TRUE); } break; - }// case GBM_SELECTED: + } case GEM_EDIT_DONE: { @@ -1522,16 +1522,16 @@ WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, munkee.removeLastChar(); GadgetTextEntrySetText( textEntryLoginName, munkee ); } - }// if ( controlID == textEntryLoginNameID ) + } break; - }//case GEM_UPDATE_TEXT: + } */ default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// WOLLoginMenuSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp index c66687f81a5..903b5ac166e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp @@ -192,7 +192,7 @@ void WOLMapSelectMenuInit( WindowLayout *layout, void *userData ) populateMapListbox( mapList, usesSystemMapDir, TRUE, TheGameSpyGame->getMap() ); } -} // end WOLMapSelectMenuInit +} //------------------------------------------------------------------------------------------------- /** MapSelect menu shutdown method */ @@ -207,7 +207,7 @@ void WOLMapSelectMenuShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheShell->shutdownComplete( layout ); -} // end WOLMapSelectMenuShutdown +} //------------------------------------------------------------------------------------------------- /** MapSelect menu update method */ @@ -223,7 +223,7 @@ void WOLMapSelectMenuUpdate( WindowLayout *layout, void *userData ) // No update because the game setup screen is up at the same // time and it does the update for us... -} // end WOLMapSelectMenuUpdate +} //------------------------------------------------------------------------------------------------- /** Map select menu input callback */ @@ -261,22 +261,22 @@ WindowMsgHandledType WOLMapSelectMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)button, buttonID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -} // end WOLMapSelectMenuInput +} void WOLPositionStartSpots( void ); //------------------------------------------------------------------------------------------------- @@ -294,7 +294,7 @@ WindowMsgHandledType WOLMapSelectMenuSystem( GameWindow *window, UnsignedInt msg { break; - } // end create + } //--------------------------------------------------------------------------------------------- case GWM_DESTROY: @@ -302,7 +302,7 @@ WindowMsgHandledType WOLMapSelectMenuSystem( GameWindow *window, UnsignedInt msg NullifyControls(); break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -314,7 +314,7 @@ WindowMsgHandledType WOLMapSelectMenuSystem( GameWindow *window, UnsignedInt msg return MSG_HANDLED; - } // end input + } //--------------------------------------------------------------------------------------------- case GLM_DOUBLE_CLICKED: @@ -400,7 +400,7 @@ WindowMsgHandledType WOLMapSelectMenuSystem( GameWindow *window, UnsignedInt msg } WOLPositionStartSpots(); - } // end if + } else if ( controlID == radioButtonSystemMapsID ) { if (TheMapCache) @@ -471,19 +471,19 @@ WindowMsgHandledType WOLMapSelectMenuSystem( GameWindow *window, UnsignedInt msg WOLPositionStartSpots(); - } // end if + } - } // end else if + } break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end WOLMapSelectMenuSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp index 5b75c668db9..d4b1d978ff3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp @@ -71,7 +71,7 @@ void WOLMessageWindowInit( WindowLayout *layout, void *userData ) // Set Keyboard to Main Parent TheWindowManager->winSetFocus( parentWOLMessageWindow ); -} // WOLMessageWindowInit +} //------------------------------------------------------------------------------------------------- /** WOLMessage Window shutdown method */ @@ -84,7 +84,7 @@ void WOLMessageWindowShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheShell->shutdownComplete( layout ); -} // WOLMessageWindowShutdown +} //------------------------------------------------------------------------------------------------- @@ -97,7 +97,7 @@ void WOLMessageWindowUpdate( WindowLayout * layout, void *userData) WOL::TheWOL->update(); */ -}// WOLMessageWindowUpdate +} //------------------------------------------------------------------------------------------------- /** WOLMessage Window input callback */ @@ -130,21 +130,21 @@ WindowMsgHandledType WOLMessageWindowInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonCancel, buttonCancelID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// WOLMessageWindowInput +} //------------------------------------------------------------------------------------------------- /** WOLMessage Window window system callback */ @@ -162,12 +162,12 @@ WindowMsgHandledType WOLMessageWindowSystem( GameWindow *window, UnsignedInt msg { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -176,12 +176,12 @@ WindowMsgHandledType WOLMessageWindowSystem( GameWindow *window, UnsignedInt msg *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } case GBM_SELECTED: { break; - }// case GBM_SELECTED: + } case GEM_EDIT_DONE: { @@ -190,7 +190,7 @@ WindowMsgHandledType WOLMessageWindowSystem( GameWindow *window, UnsignedInt msg default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// WOLMessageWindowSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp index 7e2a29dab3a..683499078cc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp @@ -85,7 +85,7 @@ void WOLQMScoreScreenInit( WindowLayout *layout, void *userData ) //progressLayout = TheShell->top(); -} // WOLQMScoreScreenInit +} //------------------------------------------------------------------------------------------------- /** WOL Status Menu shutdown method */ @@ -101,7 +101,7 @@ void WOLQMScoreScreenShutdown( WindowLayout *layout, void *userData ) //progressLayout = NULL; -} // WOLQMScoreScreenShutdown +} //------------------------------------------------------------------------------------------------- @@ -113,7 +113,7 @@ void WOLQMScoreScreenUpdate( WindowLayout * layout, void *userData) if (WOL::TheWOL) WOL::TheWOL->update(); */ -}// WOLQMScoreScreenUpdate +} //------------------------------------------------------------------------------------------------- /** WOL Status Menu input callback */ @@ -146,21 +146,21 @@ WindowMsgHandledType WOLQMScoreScreenInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonDisconnect, buttonDisconnectID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// WOLQMScoreScreenInput +} //------------------------------------------------------------------------------------------------- /** WOL Status Menu window system callback */ @@ -178,12 +178,12 @@ WindowMsgHandledType WOLQMScoreScreenSystem( GameWindow *window, UnsignedInt msg { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -192,7 +192,7 @@ WindowMsgHandledType WOLQMScoreScreenSystem( GameWindow *window, UnsignedInt msg *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } case GBM_SELECTED: { @@ -208,7 +208,7 @@ WindowMsgHandledType WOLQMScoreScreenSystem( GameWindow *window, UnsignedInt msg WOL::TheWOL->addCommand( WOL::WOLCOMMAND_RESET ); // don't display an error, log out, or anything } - } //if ( controlID == buttonDisconnect ) + } else if ( controlID == buttonQuickmatchID ) { //TheShell->pop(); @@ -221,10 +221,10 @@ WindowMsgHandledType WOLQMScoreScreenSystem( GameWindow *window, UnsignedInt msg } } - } //if ( controlID == buttonDisconnect ) + } */ break; - }// case GBM_SELECTED: + } case GEM_EDIT_DONE: { @@ -233,7 +233,7 @@ WindowMsgHandledType WOLQMScoreScreenSystem( GameWindow *window, UnsignedInt msg default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// WOLQMScoreScreenSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp index 650976f0f0e..d7cc5eaf0aa 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp @@ -895,7 +895,7 @@ void WOLQuickMatchMenuInit( WindowLayout *layout, void *userData ) UpdateStartButton(); TheTransitionHandler->setGroup("WOLQuickMatchMenuFade"); isInInit= FALSE; -} // WOLQuickMatchMenuInit +} //------------------------------------------------------------------------------------------------- /** This is called when a shutdown is complete for this menu */ @@ -918,7 +918,7 @@ static void shutdownComplete( WindowLayout *layout ) nextScreen = NULL; -} // end if +} //------------------------------------------------------------------------------------------------- /** WOL Quick Match Menu shutdown method */ @@ -945,13 +945,13 @@ void WOLQuickMatchMenuShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } TheShell->reverseAnimatewindow(); TheTransitionHandler->reverse("WOLQuickMatchMenuFade"); RaiseGSMessageBox(); -} // WOLQuickMatchMenuShutdown +} #ifdef PERF_TEST @@ -1459,7 +1459,7 @@ void WOLQuickMatchMenuUpdate( WindowLayout * layout, void *userData) } #endif // PERF_TEST } -}// WOLQuickMatchMenuUpdate +} //------------------------------------------------------------------------------------------------- /** WOL Quick Match Menu input callback */ @@ -1495,21 +1495,21 @@ WindowMsgHandledType WOLQuickMatchMenuInput( GameWindow *window, UnsignedInt msg TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonBack, buttonBackID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// WOLQuickMatchMenuInput +} //------------------------------------------------------------------------------------------------- /** WOL Quick Match Menu window system callback */ @@ -1527,12 +1527,12 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -1541,7 +1541,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } case GCM_SELECTED: { @@ -1593,7 +1593,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms UpdateStartButton(); } break; - } // case GCM_SELECTED + } case GBM_SELECTED: { @@ -1824,7 +1824,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms TheGameSpyInfo->leaveGroupRoom(); nextScreen = "Menus/WOLWelcomeMenu.wnd"; TheShell->pop(); - } //if ( controlID == buttonBack ) + } else if ( controlID == buttonSelectAllMapsID ) { Int numMaps = GadgetListBoxGetNumEntries(listboxMapSelect); @@ -1834,7 +1834,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms GadgetListBoxSetItemData(listboxMapSelect, (void *)1, i); GadgetListBoxAddEntryText(listboxMapSelect, GadgetListBoxGetText(listboxMapSelect, i, 1), GameSpyColor[GSCOLOR_MAP_SELECTED], i, 1); } - } //if ( controlID == buttonSelectAllMapsID ) + } else if ( controlID == buttonSelectNoMapsID ) { Int numMaps = GadgetListBoxGetNumEntries(listboxMapSelect); @@ -1844,9 +1844,9 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms GadgetListBoxSetItemData(listboxMapSelect, (void *)0, i); GadgetListBoxAddEntryText(listboxMapSelect, GadgetListBoxGetText(listboxMapSelect, i, 1), GameSpyColor[GSCOLOR_MAP_UNSELECTED], i, 1); } - } //if ( controlID == buttonSelectNoMapsID ) + } break; - }// case GBM_SELECTED: + } case GLM_SELECTED: { @@ -1877,7 +1877,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms } UpdateStartButton(); break; - }// case GLM_SELECTED + } case GEM_EDIT_DONE: { @@ -1886,7 +1886,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// WOLQuickMatchMenuSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp index 3d44fd0c614..80404ac8c3d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp @@ -76,7 +76,7 @@ void WOLStatusMenuInit( WindowLayout *layout, void *userData ) //progressLayout = TheShell->top(); //WOL::raiseWOLMessageBox(); -} // WOLStatusMenuInit +} //------------------------------------------------------------------------------------------------- /** WOL Status Menu shutdown method */ @@ -93,7 +93,7 @@ void WOLStatusMenuShutdown( WindowLayout *layout, void *userData ) //progressLayout = NULL; //WOL::raiseWOLMessageBox(); -} // WOLStatusMenuShutdown +} //------------------------------------------------------------------------------------------------- @@ -103,7 +103,7 @@ void WOLStatusMenuUpdate( WindowLayout * layout, void *userData) { //if (WOL::TheWOL) //WOL::TheWOL->update(); -}// WOLStatusMenuUpdate +} //------------------------------------------------------------------------------------------------- /** WOL Status Menu input callback */ @@ -136,21 +136,21 @@ WindowMsgHandledType WOLStatusMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonDisconnect, buttonDisconnectID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// WOLStatusMenuInput +} //------------------------------------------------------------------------------------------------- /** WOL Status Menu window system callback */ @@ -168,12 +168,12 @@ WindowMsgHandledType WOLStatusMenuSystem( GameWindow *window, UnsignedInt msg, { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -182,7 +182,7 @@ WindowMsgHandledType WOLStatusMenuSystem( GameWindow *window, UnsignedInt msg, *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } case GBM_SELECTED: { @@ -198,10 +198,10 @@ WindowMsgHandledType WOLStatusMenuSystem( GameWindow *window, UnsignedInt msg, WOL::TheWOL->addCommand( WOL::WOLCOMMAND_RESET ); // don't display an error, log out, or anything } - } //if ( controlID == buttonDisconnect ) + } */ break; - }// case GBM_SELECTED: + } case GEM_EDIT_DONE: { @@ -210,7 +210,7 @@ WindowMsgHandledType WOLStatusMenuSystem( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// WOLStatusMenuSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp index 05c84eba2cf..ea664211b22 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp @@ -203,7 +203,7 @@ static void shutdownComplete( WindowLayout *layout ) nextScreen = NULL; -} // end if +} //------------------------------------------------------------------------------------------------- /** Handle Num Players Online data */ @@ -364,8 +364,8 @@ void HandleOverallStats( const char* szHTTPStats, unsigned len ) s_winStats.insert(std::make_pair( side, percent )); //x DEBUG_LOG(("Added win percent: %s, %d", side.str(), percent)); - } //for i -} //HandleOverallStats + } +} //called only from WOLWelcomeMenuInit to set %win stats @@ -387,8 +387,8 @@ static void updateOverallStats(void) pWin = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY(wndName) ); GadgetCheckBoxSetText( pWin, percStr ); //x DEBUG_LOG(("Initialized win percent: %s -> %s %f=%s", wndName.str(), it->first.str(), it->second, percStr.str() )); - } //for -} //updateOverallStats + } +} //------------------------------------------------------------------------------------------------- @@ -561,7 +561,7 @@ void WOLWelcomeMenuInit( WindowLayout *layout, void *userData ) raiseMessageBoxes = TRUE; TheTransitionHandler->setGroup("WOLWelcomeMenuFade"); -} // WOLWelcomeMenuInit +} //------------------------------------------------------------------------------------------------- /** WOL Welcome Menu shutdown method */ @@ -585,14 +585,14 @@ void WOLWelcomeMenuShutdown( WindowLayout *layout, void *userData ) shutdownComplete( layout ); return; - } //end if + } TheShell->reverseAnimatewindow(); TheTransitionHandler->reverse("WOLWelcomeMenuFade"); RaiseGSMessageBox(); -} // WOLWelcomeMenuShutdown +} //------------------------------------------------------------------------------------------------- @@ -693,7 +693,7 @@ void WOLWelcomeMenuUpdate( WindowLayout * layout, void *userData) } } -}// WOLWelcomeMenuUpdate +} //------------------------------------------------------------------------------------------------- /** WOL Welcome Menu input callback */ @@ -728,21 +728,21 @@ WindowMsgHandledType WOLWelcomeMenuInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonBack, buttonBackID ); - } // end if + } // don't let key fall through anywhere else return MSG_HANDLED; - } // end escape + } - } // end switch( key ) + } - } // end char + } - } // end switch( msg ) + } return MSG_IGNORED; -}// WOLWelcomeMenuInput +} //------------------------------------------------------------------------------------------------- /** WOL Welcome Menu window system callback */ @@ -760,12 +760,12 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, { break; - } // case GWM_DESTROY: + } case GWM_DESTROY: { break; - } // case GWM_DESTROY: + } case GWM_INPUT_FOCUS: { @@ -774,7 +774,7 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, *(Bool *)mData2 = TRUE; return MSG_HANDLED; - }//case GWM_INPUT_FOCUS: + } case GBM_SELECTED: { @@ -821,7 +821,7 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, TheWOLGame = NULL; **/ - } //if ( controlID == buttonBack ) + } else if (controlID == buttonOptionsID) { GameSpyOpenOverlay( GSOVERLAY_OPTIONS ); @@ -839,7 +839,7 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, nextScreen = "Menus/WOLQuickMatchMenu.wnd"; TheShell->pop(); } - }// else if + } else if (controlID == buttonMyInfoID ) { SetLookAtPlayer(TheGameSpyInfo->getLocalProfileID(), TheGameSpyInfo->getLocalName()); @@ -859,7 +859,7 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, TheWOL->setState( WOL::WOLAPI_LOBBY ); TheWOL->addCommand( WOL::WOLCOMMAND_REFRESH_CHANNELS ); */ - }// else if + } else if (controlID == buttonBuddiesID) { GameSpyToggleOverlay( GSOVERLAY_BUDDY ); @@ -886,7 +886,7 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, TheShell->push(AsciiString("Menus/WOLLadderScreen.wnd")); } break; - }// case GBM_SELECTED: + } case GEM_EDIT_DONE: { @@ -895,7 +895,7 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - }//Switch + } return MSG_HANDLED; -}// WOLWelcomeMenuSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp index f4a47517a2f..3307ecb7391 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp @@ -113,7 +113,7 @@ WindowMsgHandledType MessageBoxSystem( GameWindow *window, UnsignedInt msg, window->winSetUserData( NULL ); break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -125,7 +125,7 @@ WindowMsgHandledType MessageBoxSystem( GameWindow *window, UnsignedInt msg, break; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -146,39 +146,39 @@ WindowMsgHandledType MessageBoxSystem( GameWindow *window, UnsignedInt msg, TheWindowManager->winDestroy(window); - } // end if + } else if( controlID == buttonYesID ) { if (MsgBoxCallbacks->yesCallback) MsgBoxCallbacks->yesCallback(); TheWindowManager->winDestroy(window); - } // end else if + } else if( controlID == buttonNoID ) { if (MsgBoxCallbacks->noCallback) MsgBoxCallbacks->noCallback(); TheWindowManager->winDestroy(window); - } // end else if + } else if( controlID == buttonCancelID ) { if (MsgBoxCallbacks->cancelCallback) MsgBoxCallbacks->cancelCallback(); TheWindowManager->winDestroy(window); - } // end else if + } break; - } // end selected + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end MessageBoxSystem +} //------------------------------------------------------------------------------------------------- /** Message Box window system callback */ //------------------------------------------------------------------------------------------------- @@ -197,7 +197,7 @@ WindowMsgHandledType QuitMessageBoxSystem( GameWindow *window, UnsignedInt msg, window->winSetUserData( NULL ); break; - } // end case + } // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: @@ -209,7 +209,7 @@ WindowMsgHandledType QuitMessageBoxSystem( GameWindow *window, UnsignedInt msg, break; - } // end input + } //--------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -230,36 +230,36 @@ WindowMsgHandledType QuitMessageBoxSystem( GameWindow *window, UnsignedInt msg, TheWindowManager->winDestroy(window); - } // end if + } else if( controlID == buttonYesID ) { if (MsgBoxCallbacks->yesCallback) MsgBoxCallbacks->yesCallback(); TheWindowManager->winDestroy(window); - } // end else if + } else if( controlID == buttonNoID ) { if (MsgBoxCallbacks->noCallback) MsgBoxCallbacks->noCallback(); TheWindowManager->winDestroy(window); - } // end else if + } else if( controlID == buttonCancelID ) { if (MsgBoxCallbacks->cancelCallback) MsgBoxCallbacks->cancelCallback(); TheWindowManager->winDestroy(window); - } // end else if + } break; - } // end selected + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end MessageBoxSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp index fac7026d7c1..2e43f2c65ac 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp @@ -43,7 +43,7 @@ WindowMsgHandledType ReplayControlInput( GameWindow *window, UnsignedInt msg, return MSG_IGNORED; -} // end MapSelectMenuInput +} //------------------------------------------------------------------------------------------------- /** System callback for the control bar parent */ @@ -60,15 +60,15 @@ WindowMsgHandledType ReplayControlSystem( GameWindow *window, UnsignedInt msg, break; - } // end button selected + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end ControlBarSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp index 1d9f58873ee..e7ad2ba128d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp @@ -93,10 +93,10 @@ WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, mData1 ); //TheWindowManager->winSetFocus( window ); - } // end if + } break; - } // end mouse entering + } // ------------------------------------------------------------------------ case GWM_MOUSE_LEAVING: @@ -110,10 +110,10 @@ WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, GBM_MOUSE_LEAVING, (WindowMsgData)window, mData1 ); - } // end if + } break; - } // end mouse leaving + } // ------------------------------------------------------------------------ case GWM_LEFT_DRAG: @@ -123,7 +123,7 @@ WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, (WindowMsgData)window, mData1 ); break; - } // end left drag + } // ------------------------------------------------------------------------ case GWM_LEFT_DOWN: @@ -131,7 +131,7 @@ WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, break; - } // end left down + } // ------------------------------------------------------------------------ case GWM_LEFT_UP: @@ -152,14 +152,14 @@ WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, break; - } // end left up and left click + } // ------------------------------------------------------------------------ case GWM_RIGHT_DOWN: { break; - } // end right down + } //------------------------------------------------------------------------- case GWM_RIGHT_UP: @@ -178,7 +178,7 @@ WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, return MSG_IGNORED; } break; - } // end right up or right click + } // ------------------------------------------------------------------------ case GWM_CHAR: @@ -201,10 +201,10 @@ WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, GBM_SELECTED, (WindowMsgData)window, 0 ); - } //end if + } break; - } // end enter/space + } // -------------------------------------------------------------------- case KEY_DOWN: @@ -216,7 +216,7 @@ WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winNextTab(window); break; - } // end down, right, tab + } // -------------------------------------------------------------------- case KEY_UP: @@ -227,7 +227,7 @@ WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, TheWindowManager->winPrevTab(window); break; - } // end up, left + } // -------------------------------------------------------------------- default: @@ -235,13 +235,13 @@ WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, return MSG_IGNORED; - } // end default + } - } // end switch + } break; - } // end char msg + } // ------------------------------------------------------------------------ default: @@ -249,13 +249,13 @@ WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, return MSG_IGNORED; - } // end default + } - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetCheckBoxInput +} // GadgetCheckBoxSystem ======================================================= /** Handle system messages for check box */ @@ -303,11 +303,11 @@ WindowMsgHandledType GadgetCheckBoxSystem( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - } // end switch msg + } return MSG_HANDLED; -} // end GadgetCheckBoxSystem +} // GadgetCheckBoxSetText ====================================================== /** Set the text for the control */ @@ -321,7 +321,7 @@ void GadgetCheckBoxSetText( GameWindow *g, UnicodeString text ) TheWindowManager->winSendSystemMsg( g, GGM_SET_LABEL, (WindowMsgData)&text, 0 ); -} // end GadgetCheckBoxSetText +} // GadgetCheckBoxSetChecked ============================================ //============================================================================= diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp index 498842715a4..6854d7bcc60 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp @@ -122,11 +122,11 @@ WindowMsgHandledType GadgetComboBoxInput( GameWindow *window, UnsignedInt msg, default: return TheWindowManager->winSendInputMsg( editBox, GWM_CHAR, mData1, mData2 ); - } // end switch( mData1 ) + } break; - } // end case char + } // ------------------------------------------------------------------------ case GWM_WHEEL_DOWN: @@ -134,14 +134,14 @@ WindowMsgHandledType GadgetComboBoxInput( GameWindow *window, UnsignedInt msg, break; - } // end wheel down + } // ------------------------------------------------------------------------ case GWM_WHEEL_UP: { break; - } // end wheel up + } // ------------------------------------------------------------------------ case GWM_LEFT_UP: @@ -158,7 +158,7 @@ WindowMsgHandledType GadgetComboBoxInput( GameWindow *window, UnsignedInt msg, if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } GameWindow *listBox = GadgetComboBoxGetListBox(window); if (listBox) @@ -212,14 +212,14 @@ WindowMsgHandledType GadgetComboBoxInput( GameWindow *window, UnsignedInt msg, } } break; - } // end left click, left up + } // ------------------------------------------------------------------------ case GWM_RIGHT_UP: { break; - } // end right up, right click + } /* // ------------------------------------------------------------------------ @@ -236,11 +236,11 @@ WindowMsgHandledType GadgetComboBoxInput( GameWindow *window, UnsignedInt msg, 0 ); TheWindowManager->winSetFocus( window ); - } // end if + } break; - } // end mouse entering + } // ------------------------------------------------------------------------ case GWM_MOUSE_LEAVING: @@ -254,11 +254,11 @@ WindowMsgHandledType GadgetComboBoxInput( GameWindow *window, UnsignedInt msg, GBM_MOUSE_LEAVING, (WindowMsgData)window, 0 ); - } // end if + } break; - } // end mouse leaving + } */ // ------------------------------------------------------------------------ @@ -281,11 +281,11 @@ WindowMsgHandledType GadgetComboBoxInput( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - } // end switch msg + } return MSG_HANDLED; -} // end GadgetComboBoxInput +} // HideListBox ================================================================ /** Called to close the listbox if it is opened */ @@ -325,7 +325,7 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, instData->setText(*(UnicodeString*)mData1); break; - } // end set lavel + } // ------------------------------------------------------------------------ case GCM_GET_TEXT: @@ -333,7 +333,7 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, if(comboData->editBox) *(UnicodeString*)mData2 = GadgetTextEntryGetText(comboData->editBox); break; - } // end Get text + } // ------------------------------------------------------------------------ case GCM_SET_TEXT: @@ -342,7 +342,7 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, GadgetTextEntrySetText(comboData->editBox,*(const UnicodeString*)mData1); break; - } // end set text + } case GEM_UPDATE_TEXT: { @@ -399,7 +399,7 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, *(Int *)mData2 = -1; } break; - } //case GCM_GET_SELECTION: + } // ------------------------------------------------------------------------ // Set the User Data for the specified listbox element case GCM_SET_ITEM_DATA: @@ -463,7 +463,7 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, break; - } // end left drag + } // ------------------------------------------------------------------------ case GCM_DEL_ALL: @@ -476,7 +476,7 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, //HideListBox(window); break; - } // end delete all + } // ------------------------------------------------------------------------ case GCM_DEL_ENTRY: @@ -484,14 +484,14 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, break; - } // end delete entry + } // ------------------------------------------------------------------------ case GGM_CLOSE: { HideListBox(window); break; - } // end delete entry + } // ------------------------------------------------------------------------ case GCM_ADD_ENTRY: @@ -550,7 +550,7 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, } return( (WindowMsgHandledType) addedIndex ); - } // end add entry + } // ------------------------------------------------------------------------ @@ -587,7 +587,7 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, } break; - } // end resized + } // ------------------------------------------------------------------------ @@ -599,7 +599,7 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, window->winSetUserData(NULL); comboData = NULL; break; - } // end destroy + } // ------------------------------------------------------------------------ case GWM_INPUT_FOCUS: @@ -628,7 +628,7 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, *(Bool*)mData2 = TRUE; break; - } // end input focus + } case GBM_SELECTED: @@ -699,11 +699,11 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetListBoxSystem +} // GadgetComboBoxSetColors ==================================================== /** Set the colors for a Combo box, note that this will also automatically @@ -800,7 +800,7 @@ void GadgetComboBoxSetColors( GameWindow *comboBox, hiliteSelectedItemColor, hiliteSelectedItemBorderColor ); } -} // end GadgetComboBoxSetColors +} // GadgetComboBoxSetIsEditable ================================================ /** Sets up the Text Entry gadget as editable or not */ @@ -830,7 +830,7 @@ void GadgetComboBoxSetIsEditable(GameWindow *comboBox, Bool isEditable ) // BitSet(status, WIN_STATUS_NO_FOCUS); editBox->winSetStatus(status); } -}//void GadgetComboBoxSetIsEditable(GameWindow *comboBox, Int maxChars ) +} // GadgetComboBoxSetIsAsciiOnly ================================================== /** Get the text the Combo Box */ @@ -877,7 +877,7 @@ void GadgetComboBoxSetMaxChars( GameWindow *comboBox, Int maxChars ) comboData->maxChars = maxChars; comboData->entryData->maxTextLen = maxChars; -}//void GadgetComboBoxSetMaxChars( GameWindow *comboBox, Int maxChars ) +} // GadgetComboBoxSetMaxDisplay ================================================ /** Sets the MaxDisplay variable to the new Max Display */ @@ -887,7 +887,7 @@ void GadgetComboBoxSetMaxDisplay( GameWindow *comboBox, Int maxDisplay ) ComboBoxData *comboData = (ComboBoxData *)comboBox->winGetUserData(); comboData->maxDisplay = maxDisplay; -}//void GadgetComboBoxSetMaxDisplay( GameWindow *comboBox, Int maxDisplay ); +} // GadgetComboBoxGetText ======================================================= /** Get the text the Combo Box */ @@ -1103,5 +1103,5 @@ Int GadgetComboBoxGetLength( GameWindow *combobox ) return comboboxData->entryCount; return 0; -} // end GadgetListBoxGetListLength +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp index fd06752e575..2f9bfdb0616 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp @@ -94,7 +94,7 @@ WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedIn 0 ); //TheWindowManager->winSetFocus( window ); - } // end if + } if(window->winGetChild() && BitIsSet(window->winGetChild()->winGetStyle(),GWS_PUSH_BUTTON) ) { @@ -104,7 +104,7 @@ WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedIn break; - } // end mouse entering + } // ------------------------------------------------------------------------ case GWM_MOUSE_LEAVING: @@ -118,7 +118,7 @@ WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedIn GBM_MOUSE_LEAVING, (WindowMsgData)window, 0 ); - } // end if + } if(window->winGetChild() && BitIsSet(window->winGetChild()->winGetStyle(),GWS_PUSH_BUTTON) ) { WinInstanceData *instDataChild = window->winGetChild()->winGetInstanceData(); @@ -127,7 +127,7 @@ WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedIn break; - } // end mouse leaving + } // ------------------------------------------------------------------------ case GWM_LEFT_DRAG: @@ -174,7 +174,7 @@ WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedIn if( clickPos > mousex - x ) clickPos = mousex - x; - } // end if + } else { @@ -182,7 +182,7 @@ WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedIn if( clickPos < mousex - x ) clickPos = mousex - x; - } // end else + } // keep it all valid to the window if( clickPos > x + size.x - childSize.x / 2 ) @@ -194,7 +194,7 @@ WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedIn TheWindowManager->winSendSystemMsg( window, GGM_LEFT_DRAG, 0, mData1 ); break; - } // end left up, left click + } // ------------------------------------------------------------------------ case GWM_CHAR: @@ -221,9 +221,9 @@ WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedIn // Translate to window coords child->winSetPosition( (Int)((s->position - s->minVal) * s->numTicks), HORIZONTAL_SLIDER_THUMB_POSITION ); - } // end if + } - } // if key down + } break; @@ -248,7 +248,7 @@ WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedIn } - } // end if key down + } break; @@ -271,11 +271,11 @@ WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedIn default: return MSG_IGNORED; - } // end switch( mData1 ) + } break; - } // end char + } // ------------------------------------------------------------------------ default: @@ -285,7 +285,7 @@ WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedIn return MSG_HANDLED; -} // end GadgetHorizontalSliderInput +} // GadgetHorizontalSliderSystem =============================================== /** Handle system messages for horizontal slider */ @@ -332,7 +332,7 @@ WindowMsgHandledType GadgetHorizontalSliderSystem( GameWindow *window, UnsignedI s->position ); break; - } // end if + } else if( mousex < x + HORIZONTAL_SLIDER_THUMB_WIDTH/2) { @@ -345,7 +345,7 @@ WindowMsgHandledType GadgetHorizontalSliderSystem( GameWindow *window, UnsignedI s->position ); break; - } // end else if + } if( childCenter.x < x + childSize.x / 2 ) { @@ -386,7 +386,7 @@ WindowMsgHandledType GadgetHorizontalSliderSystem( GameWindow *window, UnsignedI break; - } // end left drag + } // ------------------------------------------------------------------------ case GSM_SET_SLIDER: @@ -405,7 +405,7 @@ WindowMsgHandledType GadgetHorizontalSliderSystem( GameWindow *window, UnsignedI child->winSetPosition( newPos , HORIZONTAL_SLIDER_THUMB_POSITION ); break; - } // end set slider + } // ------------------------------------------------------------------------ case GSM_SET_MIN_MAX: @@ -423,7 +423,7 @@ WindowMsgHandledType GadgetHorizontalSliderSystem( GameWindow *window, UnsignedI child->winSetPosition( 0, HORIZONTAL_SLIDER_THUMB_POSITION ); break; - } // end set min max + } // ------------------------------------------------------------------------ case GWM_CREATE: @@ -454,7 +454,7 @@ WindowMsgHandledType GadgetHorizontalSliderSystem( GameWindow *window, UnsignedI *(Bool*)mData2 = TRUE; break; - } // end focus msg + } // ------------------------------------------------------------------------ case GGM_RESIZED: @@ -468,13 +468,13 @@ WindowMsgHandledType GadgetHorizontalSliderSystem( GameWindow *window, UnsignedI break; - } // end resized + } default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetHorizontalSliderSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp index 75076a9cc3b..282a270c077 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp @@ -108,7 +108,7 @@ static void doAudioFeedback(GameWindow *window) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } } } @@ -278,7 +278,7 @@ static void adjustDisplay( GameWindow *window, Int adjustment, 0 ); } -} // end adjustDisplay +} // computeTotalHeight ========================================================= /** Compute Total Height and fill in listHeight values */ @@ -311,8 +311,8 @@ static void computeTotalHeight( GameWindow *window ) DisplayString *displayString = (DisplayString *)list->listData[i].cell[j].data; if(displayString) displayString->getSize( NULL, &cellHeight ); - }//else - }//if + } + } else if(list->listData[i].cell[j].cellType == LISTBOX_IMAGE) { if(list->listData[i].cell[j].height > 0) @@ -322,7 +322,7 @@ static void computeTotalHeight( GameWindow *window ) } if(cellHeight > tempHeight) tempHeight = cellHeight; - }//for + } list->listData[i].height = tempHeight; height += (list->listData[i].height + 1); list->listData[i].listHeight = height; @@ -383,7 +383,7 @@ static Int addImageEntry( const Image *image, Color color, Int row, Int column, return (row); -}// static Int addImageEntry( Image image, Int column, GameWindow *window) +} // startingRow will get moved to startingRow+1, etc. This assumes there is space!!!!! static Int moveRowsDown(ListboxData *list, Int startingRow) @@ -529,7 +529,7 @@ static Int addEntry( UnicodeString *string, Int color, Int row, Int column, Game } return (row); -} // end addEntry +} // PUBLIC DATA //////////////////////////////////////////////////////////////// @@ -573,11 +573,11 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, GLM_DOUBLE_CLICKED, (WindowMsgData)window, list->selectPos ); - } // end if + } break; - } // end enter or space + } // -------------------------------------------------------------------- case KEY_DOWN: @@ -624,11 +624,11 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, GLM_SELECTED, (WindowMsgData)window, list->selectPos ); - } // end if + } break; - } // end key down + } // -------------------------------------------------------------------- case KEY_UP: @@ -675,7 +675,7 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, break; - } // end key up + } // -------------------------------------------------------------------- case KEY_RIGHT: @@ -752,11 +752,11 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, return MSG_IGNORED; } - } // end switch( mData1 ) + } break; - } // end case char + } // ------------------------------------------------------------------------ case GWM_WHEEL_DOWN: @@ -769,7 +769,7 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, break; - } // end wheel down + } // ------------------------------------------------------------------------ case GWM_WHEEL_UP: @@ -780,7 +780,7 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, adjustDisplay( window, -1, TRUE ); break; - } // end wheel up + } // ------------------------------------------------------------------------ case GWM_LEFT_UP: @@ -858,7 +858,7 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, break; - } // end left click, left up + } // ------------------------------------------------------------------------ case GWM_RIGHT_DOWN: @@ -913,7 +913,7 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, (WindowMsgData)&rc ); break; - } // end right up, right click + } // ------------------------------------------------------------------------ case GWM_MOUSE_ENTERING: @@ -929,11 +929,11 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, 0 ); //TheWindowManager->winSetFocus( window ); - } // end if + } break; - } // end mouse entering + } // ------------------------------------------------------------------------ case GWM_MOUSE_LEAVING: @@ -947,11 +947,11 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, GBM_MOUSE_LEAVING, (WindowMsgData)window, 0 ); - } // end if + } break; - } // end mouse leaving + } // ------------------------------------------------------------------------ case GWM_LEFT_DRAG: @@ -973,11 +973,11 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - } // end switch msg + } return MSG_HANDLED; -} // end GadgetListBoxInput +} // GadgetListBoxMultiInput ==================================================== /** Handle input for multiple selection list box */ @@ -1009,7 +1009,7 @@ WindowMsgHandledType GadgetListBoxMultiInput( GameWindow *window, UnsignedInt ms } break; - } // end char + } // ------------------------------------------------------------------------ case GWM_LEFT_UP: @@ -1078,7 +1078,7 @@ WindowMsgHandledType GadgetListBoxMultiInput( GameWindow *window, UnsignedInt ms selectPos ); break; - } // end left up, left click + } // ------------------------------------------------------------------------ case GWM_RIGHT_UP: @@ -1169,7 +1169,7 @@ WindowMsgHandledType GadgetListBoxMultiInput( GameWindow *window, UnsignedInt ms (WindowMsgData)&rc ); break; - } // end right up, right click + } // ------------------------------------------------------------------------ case GWM_WHEEL_DOWN: @@ -1207,11 +1207,11 @@ WindowMsgHandledType GadgetListBoxMultiInput( GameWindow *window, UnsignedInt ms 0 ); //TheWindowManager->winSetFocus( window ); - } // end if + } break; - } // end mouse entering + } // ------------------------------------------------------------------------ case GWM_MOUSE_LEAVING: @@ -1225,11 +1225,11 @@ WindowMsgHandledType GadgetListBoxMultiInput( GameWindow *window, UnsignedInt ms GBM_MOUSE_LEAVING, (WindowMsgData)window, 0 ); - } // end if + } break; - } // end mouse leaving + } // ------------------------------------------------------------------------ case GWM_LEFT_DRAG: @@ -1251,11 +1251,11 @@ WindowMsgHandledType GadgetListBoxMultiInput( GameWindow *window, UnsignedInt ms default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetListBoxMultiInput +} // GadgetListBoxSystem ======================================================== /** Handle system messages for list box */ @@ -1275,7 +1275,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, instData->setText(*(UnicodeString*)mData1); break; - } // end set lavel + } // ------------------------------------------------------------------------ case GLM_GET_TEXT: @@ -1315,7 +1315,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, break; - } // end selected + } // ------------------------------------------------------------------------ case GGM_LEFT_DRAG: @@ -1334,7 +1334,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, break; - } // end left drag + } // ------------------------------------------------------------------------ case GLM_DEL_ALL: @@ -1388,7 +1388,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, adjustDisplay( window, 0, TRUE ); break; - } // end delete all + } // ------------------------------------------------------------------------ case GLM_DEL_ENTRY: @@ -1445,7 +1445,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, computeTotalHeight( window ); break; - } // end delete entry + } // ------------------------------------------------------------------------ case GLM_ADD_ENTRY: @@ -1535,20 +1535,20 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, i++; - } // end while + } - } // end if + } else { if( row == list->selectPos ) list->selectPos = -1; } - } // end success + } return((WindowMsgHandledType) addedIndex ); - } // end add entry + } // ------------------------------------------------------------------------ case GLM_TOGGLE_MULTI_SELECTION: @@ -1601,7 +1601,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, break; - } // end toggle multi-select + } // ------------------------------------------------------------------------ case GLM_SET_SELECTION: @@ -1685,9 +1685,9 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, adjustDisplay( window, 0, TRUE ); - } // end else if + } - } // end else + } TheWindowManager->winSendSystemMsg( window->winGetOwner(), GLM_SELECTED, @@ -1695,7 +1695,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, list->selectPos ); break; - } // end set selection + } // ------------------------------------------------------------------------ case GLM_SCROLL_BUFFER: @@ -1785,7 +1785,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, break; - } // end scroll buffer + } // ------------------------------------------------------------------------ case GLM_GET_SELECTION: @@ -1798,7 +1798,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, break; - } // end get selection + } // ------------------------------------------------------------------------ case GLM_SET_UP_BUTTON: @@ -1886,8 +1886,8 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, list->slider->winGetSize( &sliderSize.x, &sliderSize.y ); list->columnWidth[0] -= sliderSize.x; - } // end if - }// if + } + } else { if( !list->columnWidthPercentage ) @@ -1903,17 +1903,17 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, list->slider->winGetSize( &sliderSize.x, &sliderSize.y ); totalWidth -= sliderSize.x; - } // end if + } for(Int i = 0; i < list->columns; i++ ) { list->columnWidth[i] = list->columnWidthPercentage[i] * totalWidth / 100; - }// for - }// else + } + } //reset the total height computeTotalHeight(window); break; - } // end resized + } // ------------------------------------------------------------------------ case GLM_UPDATE_DISPLAY: @@ -1933,7 +1933,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, adjustDisplay( window, 0, TRUE ); break; - } // end update display + } // ------------------------------------------------------------------------ case GWM_DESTROY: @@ -1981,7 +1981,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, break; - } // end destroy + } // ------------------------------------------------------------------------ case GWM_INPUT_FOCUS: @@ -2005,7 +2005,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, *(Bool*)mData2 = TRUE; break; - } // end input focus + } // ------------------------------------------------------------------------ case GSM_SLIDER_TRACK: { @@ -2021,7 +2021,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, adjustDisplay( window, 0, FALSE ); break; - } // end slider track + } // ------------------------------------------------------------------------ case GLM_SET_ITEM_DATA: { @@ -2032,7 +2032,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, list->listData[pos->y].cell[pos->x].userData = data; break; - }//case GLM_SET_ITEM_DATA: + } // ------------------------------------------------------------------------ case GLM_GET_ITEM_DATA: { @@ -2044,17 +2044,17 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, *data = list->listData[pos->y].cell[pos->x].userData; break; - }//case GLM_GET_ITEM_DATA: + } default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetListBoxSystem +} // GadgetListBoxSetColors ===================================================== /** Set the colors for a list box, note that this will also automatically @@ -2156,9 +2156,9 @@ void GadgetListBoxSetColors( GameWindow *listbox, GadgetButtonSetHiliteSelectedColor( downButton, GadgetSliderGetHiliteSelectedThumbColor( slider ) ); GadgetButtonSetHiliteSelectedBorderColor( downButton, GadgetSliderGetHiliteSelectedThumbBorderColor( slider ) ); - } // end if + } -} // end GadgetListBoxSetColors +} // GadgetListBoxGetText ======================================================= /** Get the text for a list box entry */ @@ -2167,7 +2167,7 @@ UnicodeString GadgetListBoxGetText( GameWindow *listbox, Int row, Int column) { Color color; return GadgetListBoxGetTextAndColor( listbox,&color,row,column ); -} // end GadgetListBoxGetText +} // GadgetListBoxGetText ======================================================= /** Get the text for a list box entry */ @@ -2195,7 +2195,7 @@ UnicodeString GadgetListBoxGetTextAndColor( GameWindow *listbox, Color *color, I //return UnicodeString::TheEmptyString; -} // end GadgetListBoxGetText +} // GadgetListBoxAddEntryText ================================================== /** Add a new string entry into the listbox at the insert position */ @@ -2236,7 +2236,7 @@ Int GadgetListBoxAddEntryText( GameWindow *listbox, } return (index); -} // end GadgetListBoxAddEntry +} // GadgetListBoxAddEntryImage ================================================= /** Add a new string entry into the listbox at the insert position */ @@ -2258,7 +2258,7 @@ Int GadgetListBoxAddEntryImage( GameWindow *listbox, const Image *image, /// @TODO: Don't do this type cast! index = (Int) TheWindowManager->winSendSystemMsg( listbox, GLM_ADD_ENTRY, (WindowMsgData)&addInfo, color ); return (index); -} // end GadgetListBoxAddEntryImage +} Int GadgetListBoxAddEntryImage( GameWindow *listbox, const Image *image, Int row, Int column, @@ -2298,9 +2298,9 @@ void GadgetListBoxSetFont( GameWindow *g, GameFont *font ) dString->setFont( font ); } } - } // end for i + } -} // end GadgetListBoxSetFont +} // GadgetListboxCreateScrollbar =============================================== /** Create the scroll bar using a slider and two buttons for a listbox */ @@ -2411,7 +2411,7 @@ void GadgetListboxCreateScrollbar( GameWindow *listbox ) // we now have all the scrollbar parts, this better be set :) listData->scrollBar = TRUE; -} // end GadgetListBoxCreateScrollbar +} // GadgetListBoxAddMultiSelect ================================================ /** Enable multi selections for a listbox @@ -2439,7 +2439,7 @@ void GadgetListBoxAddMultiSelect( GameWindow *listbox ) listboxData->listData = NULL; return; - } // end if + } memset( listboxData->selections, -1, listboxData->listLength * sizeof(Int) ); @@ -2450,7 +2450,7 @@ void GadgetListBoxAddMultiSelect( GameWindow *listbox ) // adjust the input procedure for the listbox listbox->winSetInputFunc( GadgetListBoxMultiInput ); -} // end GadgetListBoxEnableMultiSelect +} // GadgetListBoxRemoveMultiSelect ============================================= /** Remove multi select capability from a listbox */ @@ -2465,14 +2465,14 @@ void GadgetListBoxRemoveMultiSelect( GameWindow *listbox ) delete[]( listData->selections ); listData->selections = NULL; - } // end if + } listData->multiSelect = FALSE; // adjust the input procedure for the listbox listbox->winSetInputFunc( GadgetListBoxInput ); -} // end GadgetListBoxRemoveMultiSelect +} // GadgetListBoxSetListLength ================================================= /** Set OR reset the list length data contained in the listboxData @@ -2571,7 +2571,7 @@ void GadgetListBoxSetListLength( GameWindow *listbox, Int newLength ) assert( 0 ); return; - } // end if + } // adjust the selection array for multi select listboxes if( listboxData->multiSelect ) @@ -2580,9 +2580,9 @@ void GadgetListBoxSetListLength( GameWindow *listbox, Int newLength ) GadgetListBoxRemoveMultiSelect( listbox ); GadgetListBoxAddMultiSelect( listbox ); - } // end if + } -} // end GadgetListBoxSetListLength +} // GadgetListBoxGetListLength ================================================= /** Get the list length data contained in the listboxData @@ -2599,7 +2599,7 @@ Int GadgetListBoxGetListLength( GameWindow *listbox ) { return 1; } -} // end GadgetListBoxGetListLength +} // GadgetListBoxGetNumEntries ================================================= /** Get the list length data contained in the listboxData @@ -2615,7 +2615,7 @@ Int GadgetListBoxGetNumEntries( GameWindow *listbox ) return listboxData->endPos; return 0; -} // end GadgetListBoxGetNumEntries +} //------------------------------------------------------------------------------------------------- /** Get the selected item(s) of a listbox. For a single select listbox the parameter @@ -2634,7 +2634,7 @@ void GadgetListBoxGetSelected( GameWindow *listbox, Int *selectList ) // get selected indeces via system message TheWindowManager->winSendSystemMsg( listbox, GLM_GET_SELECTION, 0, (WindowMsgData)selectList ); -} // end GadgetListBoxGetSelected +} //------------------------------------------------------------------------------------------------- /** Set the selected item of a listbox. The parameter is a single integer. If @@ -2650,7 +2650,7 @@ void GadgetListBoxSetSelected( GameWindow *listbox, Int selectIndex ) // set selected index via system message TheWindowManager->winSendSystemMsg( listbox, GLM_SET_SELECTION, (WindowMsgData)(&selectIndex), 1 ); -} // end GadgetListBoxSetSelected +} //------------------------------------------------------------------------------------------------- /** Set the selected item of a listbox. */ @@ -2677,7 +2677,7 @@ void GadgetListBoxReset( GameWindow *listbox ) // reset via system message TheWindowManager->winSendSystemMsg( listbox, GLM_DEL_ALL, 0, 0 ); -} // end GadgetListBoxReset +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2690,7 +2690,7 @@ void GadgetListBoxSetItemData( GameWindow *listbox, void *data, Int row, Int col if (listbox) TheWindowManager->winSendSystemMsg( listbox, GLM_SET_ITEM_DATA, (WindowMsgData)&pos, (WindowMsgData)data); -}// void GadgetListBoxSetItemData( Int index, void *data ) +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2755,7 +2755,7 @@ void GadgetListBoxSetBottomVisibleEntry( GameWindow *window, Int newPos ) int prevPos = GadgetListBoxGetBottomVisibleEntry( window ); adjustDisplay(window, newPos - prevPos + 1, true); -} // void GadgetListBoxSetTopVisibleEntry( GameWindow *window, Int newPos ) +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2769,7 +2769,7 @@ Int GadgetListBoxGetTopVisibleEntry( GameWindow *window ) return 0; return getListboxTopEntry(listData); -} // Int GadgetListBoxGetTopVisibleEntry( GameWindow *window ) +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2785,7 +2785,7 @@ void GadgetListBoxSetTopVisibleEntry( GameWindow *window, Int newPos ) int prevPos = GadgetListBoxGetTopVisibleEntry( window ); adjustDisplay(window, newPos - prevPos, true); -} // void GadgetListBoxSetTopVisibleEntry( GameWindow *window, Int newPos ) +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2798,7 +2798,7 @@ void GadgetListBoxSetAudioFeedback( GameWindow *listbox, Bool enable ) return; listboxData->audioFeedback = enable; -} // end GadgetListBoxSetAudioFeedback +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2811,7 +2811,7 @@ Int GadgetListBoxGetNumColumns( GameWindow *listbox ) return 0; return listboxData->columns; -} // end GadgetListBoxGetNumColumns +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2826,5 +2826,5 @@ Int GadgetListBoxGetColumnWidth( GameWindow *listbox, Int column ) return 0; return listboxData->columnWidth[column]; -} // end GadgetListBoxGetNumColumns +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp index a22403636dc..03ee59c7373 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp @@ -94,17 +94,17 @@ WindowMsgHandledType GadgetProgressBarSystem( GameWindow *window, UnsignedInt ms break; - } // end set progress + } // ------------------------------------------------------------------------ default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end GadgetProgressBarSystem +} // GadgetProgressBarSetProgress =============================================== /** send progress system message to Progress Bar */ @@ -115,4 +115,4 @@ void GadgetProgressBarSetProgress( GameWindow *g, Int progress ) return; TheWindowManager->winSendSystemMsg( g, GPM_SET_PROGRESS, progress, 0); -} // end GadgetProgressBarSetProgress +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetPushButton.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetPushButton.cpp index 085675f680b..e4803b9a3d7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetPushButton.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetPushButton.cpp @@ -113,7 +113,7 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, } break; - } // end mouse entering + } // ------------------------------------------------------------------------ case GWM_MOUSE_LEAVING: @@ -143,7 +143,7 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, } break; - } // end mouse leaving + } // ------------------------------------------------------------------------ case GWM_LEFT_DRAG: @@ -153,7 +153,7 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, (WindowMsgData)window, mData1 ); break; - } // end left drag + } // ------------------------------------------------------------------------ case GWM_LEFT_DOWN: @@ -168,7 +168,7 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } // // for 'check-like' buttons we have "dual state", we flip the selected status @@ -184,14 +184,14 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, BitSet( instData->m_state, WIN_STATE_SELECTED ); - } // end if + } else { // just select as normal BitSet( instData->m_state, WIN_STATE_SELECTED ); - } // end else + } if (buttonTriggersOnMouseDown(window)) { TheWindowManager->winSendSystemMsg( instData->getOwner(), GBM_SELECTED, @@ -199,7 +199,7 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, } break; - } // end left down + } //------------------------------------------------------------------------- case GWM_LEFT_UP: @@ -232,7 +232,7 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, break; - } // end left up or left click + } // ------------------------------------------------------------------------ case GWM_RIGHT_DOWN: @@ -251,7 +251,7 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } // // for 'check-like' buttons we have "dual state", we flip the selected status @@ -269,14 +269,14 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, TheWindowManager->winSendSystemMsg( instData->getOwner(), GBM_SELECTED_RIGHT, (WindowMsgData)window, mData1 ); - } // end if + } else { // just select as normal BitSet( instData->m_state, WIN_STATE_SELECTED ); - } // end else + } } else @@ -285,7 +285,7 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, return MSG_IGNORED; } break; - } // end right down + } //------------------------------------------------------------------------- case GWM_RIGHT_UP: @@ -325,7 +325,7 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, break; - } // end right up or right click + } // ------------------------------------------------------------------------ case GWM_CHAR: @@ -375,21 +375,21 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, TheWindowManager->winSendSystemMsg( instData->getOwner(), GBM_SELECTED, (WindowMsgData)window, mData1 ); - } // end if + } else { // just select as normal BitSet( instData->m_state, WIN_STATE_SELECTED ); - } // end else + } - } // end else + } break; - } // end handle enter and space button + } // -------------------------------------------------------------------- case KEY_DOWN: @@ -401,7 +401,7 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, TheWindowManager->winNextTab(window); break; - } // end key down, right or tab + } // -------------------------------------------------------------------- case KEY_UP: @@ -412,27 +412,27 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, TheWindowManager->winPrevTab(window); break; - } // end key up or left + } // -------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch on char + } break; - } // end character message + } // ------------------------------------------------------------------------ default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetPushButtonInput +} // GadgetPushButtonSystem ===================================================== /** Handle system messages for push button */ @@ -486,11 +486,11 @@ WindowMsgHandledType GadgetPushButtonSystem( GameWindow *window, UnsignedInt msg default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetPushButtonSystem +} // ------------------------------------------------------------------------------------------------ /** Set the visual status of a button to make it looked checked/unchecked ... DO NOT send @@ -515,7 +515,7 @@ void GadgetCheckLikeButtonSetVisualCheck( GameWindow *g, Bool checked ) DEBUG_CRASH(( "GadgetCheckLikeButtonSetVisualCheck: Window is not 'CHECK-LIKE'" )); return; - } // end if + } // set or clear the 'pushed' state if( instData ) @@ -526,9 +526,9 @@ void GadgetCheckLikeButtonSetVisualCheck( GameWindow *g, Bool checked ) else BitClear( instData->m_state, WIN_STATE_SELECTED ); - } // end if + } -} // end GadgetCheckLikeButtonSetVisualCheck +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -547,7 +547,7 @@ Bool GadgetCheckLikeButtonIsChecked( GameWindow *g ) // we just hold this "check like dual state thingie" using the selected state return BitIsSet( instData->m_state, WIN_STATE_SELECTED ); -} // end GadgetCheckLikeButtonIsChecked +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -575,7 +575,7 @@ void GadgetButtonEnableCheckLike( GameWindow *g, Bool makeCheckLike, Bool initia else BitClear( instData->m_state, WIN_STATE_SELECTED ); -} // end GadgetButtonEnableCheckLike +} // GadgetButtonSetText ======================================================== /** Set the text for a push button */ @@ -589,7 +589,7 @@ void GadgetButtonSetText( GameWindow *g, UnicodeString text ) TheWindowManager->winSendSystemMsg( g, GGM_SET_LABEL, (WindowMsgData)&text, 0 ); -} // end GadgetButtonSetText +} PushButtonData * getNewPushButtonData( void ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp index b6049923580..069081ba498 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp @@ -86,9 +86,9 @@ static void doRadioUnselect( GameWindow *window, Int group, Int screen, BitClear( instData->m_state, WIN_STATE_SELECTED ); - } // end if + } - } // end if + } // recursively call on all my children GameWindow *child; @@ -96,7 +96,7 @@ static void doRadioUnselect( GameWindow *window, Int group, Int screen, for( child = window->winGetChild(); child; child = child->winGetNext() ) doRadioUnselect( child, group, screen, except ); -} // end doRadioUnselect +} // unselectOtherRadioOfGroup ================================================== /** Go through the entire window system, including child windows and @@ -113,7 +113,7 @@ static void unselectOtherRadioOfGroup( Int group, Int screen, window = window->winGetNext() ) doRadioUnselect( window, group, screen, except ); -} // end unselectOtherRadioOfGroup +} // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -142,11 +142,11 @@ WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg mData1 ); //TheWindowManager->winSetFocus( window ); - } // end if + } break; - } // end mouse enter + } // ------------------------------------------------------------------------ case GWM_MOUSE_LEAVING: @@ -160,11 +160,11 @@ WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg GBM_MOUSE_LEAVING, (WindowMsgData)window, mData1 ); - } // end if + } break; - } // end mouse leaving + } // ------------------------------------------------------------------------ case GWM_LEFT_DRAG: @@ -174,7 +174,7 @@ WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg (WindowMsgData)window, mData1 ); break; - } // end left drag + } // ------------------------------------------------------------------------ case GWM_LEFT_DOWN: @@ -182,7 +182,7 @@ WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg break; - } // end down + } // ------------------------------------------------------------------------ case GWM_LEFT_UP: @@ -207,18 +207,18 @@ WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg // this button is now selected BitSet( instData->m_state, WIN_STATE_SELECTED ); - } // end if, not selected + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) == FALSE ) { // this up click was not meant for this button return MSG_IGNORED; - } // end else if + } break; - } // end left up or click + } // ------------------------------------------------------------------------ case GWM_CHAR: @@ -252,9 +252,9 @@ WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg // this button is now selected BitSet( instData->m_state, WIN_STATE_SELECTED ); - } // end if, not selected + } - } // end key down + } break; @@ -268,7 +268,7 @@ WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg window->winNextTab(); break; - } // end down, right, or tab + } // -------------------------------------------------------------------- case KEY_UP: @@ -279,7 +279,7 @@ WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg window->winPrevTab(); break; - } // end up, left + } // -------------------------------------------------------------------- default: @@ -287,13 +287,13 @@ WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg return MSG_IGNORED; - } // end default + } - } // end switch( mData1 ) + } break; - } // end char messsage + } // ------------------------------------------------------------------------ default: @@ -301,13 +301,13 @@ WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg return MSG_IGNORED; - } // end default + } - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetRadioButtonInput +} // GadgetRadioButtonSystem ==================================================== /** Handle system messages for radio button */ @@ -335,7 +335,7 @@ WindowMsgHandledType GadgetRadioButtonSystem( GameWindow *window, UnsignedInt ms GBM_SELECTED, (WindowMsgData)window, 0 ); - } // end if + } // // unselect any windows in the system (including children) that @@ -348,11 +348,11 @@ WindowMsgHandledType GadgetRadioButtonSystem( GameWindow *window, UnsignedInt ms // this button is now selected BitSet( instData->m_state, WIN_STATE_SELECTED ); - } // end if + } break; - } // end set selection + } // ------------------------------------------------------------------------ case GGM_SET_LABEL: @@ -361,7 +361,7 @@ WindowMsgHandledType GadgetRadioButtonSystem( GameWindow *window, UnsignedInt ms window->winSetText( *(UnicodeString*)mData1 ); break; - } // end set label + } // ------------------------------------------------------------------------ case GWM_CREATE: @@ -376,7 +376,7 @@ WindowMsgHandledType GadgetRadioButtonSystem( GameWindow *window, UnsignedInt ms break; - } // end destroy + } // ------------------------------------------------------------------------ case GWM_INPUT_FOCUS: @@ -393,16 +393,16 @@ WindowMsgHandledType GadgetRadioButtonSystem( GameWindow *window, UnsignedInt ms *(Bool*)mData2 = TRUE; break; - } // end focus + } default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetRadioButtonSystem +} // GadgetRadioSetText ========================================================= /** Set the text for the control */ @@ -416,7 +416,7 @@ void GadgetRadioSetText( GameWindow *g, UnicodeString text ) TheWindowManager->winSendSystemMsg( g, GGM_SET_LABEL, (WindowMsgData)&text, 0 ); -} // end GadgetRadioSetText +} // GadgetRadioSetGroup ======================================================== /** Set the group number for a radio button, only one radio button of @@ -429,7 +429,7 @@ void GadgetRadioSetGroup( GameWindow *g, Int group, Int screen ) radioData->group = group; radioData->screen = screen; -} // end GadgetRadioSetGroup +} // GadgetRadioSetText ========================================================= @@ -444,5 +444,5 @@ void GadgetRadioSetSelection( GameWindow *g, Bool sendMsg ) TheWindowManager->winSendSystemMsg( g, GBM_SET_SELECTION, (WindowMsgData)&sendMsg, 0 ); -} // end GadgetRadioSetText +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp index 6ee1e051523..f9755e4c4a6 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp @@ -110,7 +110,7 @@ WindowMsgHandledType GadgetStaticTextInput( GameWindow *window, UnsignedInt msg, return MSG_HANDLED; -} // end GadgetStaticTextInput +} // GadgetStaticTextSystem ===================================================== /** Handle system messages for text field */ @@ -130,7 +130,7 @@ WindowMsgHandledType GadgetStaticTextSystem( GameWindow *window, UnsignedInt msg *(UnicodeString*)mData2 = tData->text->getText(); break; - } // end get label + } // ------------------------------------------------------------------------ case GGM_SET_LABEL: @@ -144,7 +144,7 @@ WindowMsgHandledType GadgetStaticTextSystem( GameWindow *window, UnsignedInt msg break; - } // end set label + } // ------------------------------------------------------------------------ case GWM_CREATE: @@ -164,15 +164,15 @@ WindowMsgHandledType GadgetStaticTextSystem( GameWindow *window, UnsignedInt msg break; - } // end destroy + } default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetStaticTextSystem +} // GadgetStaticTextSetText ==================================================== /** Set the text for a static text control */ @@ -183,7 +183,7 @@ void GadgetStaticTextSetText( GameWindow *window, UnicodeString text ) return; TheWindowManager->winSendSystemMsg( window, GGM_SET_LABEL, (WindowMsgData)&text, 0 ); -} // end GadgetStaticTextSetText +} UnicodeString GadgetStaticTextGetText( GameWindow *window ) { @@ -221,6 +221,6 @@ void GadgetStaticTextSetFont( GameWindow *g, GameFont *font ) if( dString ) dString->setFont( font ); - } // end if + } -} // end GadgetStaticTextSetFont +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp index 63988e71127..17f471c5837 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp @@ -124,7 +124,7 @@ WindowMsgHandledType GadgetTabControlInput( GameWindow *tabControl, UnsignedInt return MSG_HANDLED; -} // end GadgetTabControlInput +} // GadgetTabControlSystem ==================================================== /** Handle system messages for TabControl */ @@ -147,7 +147,7 @@ WindowMsgHandledType GadgetTabControlSystem( GameWindow *tabControl, UnsignedInt break; - } // end destroy + } case GGM_RESIZED: {//On resize, we need to upkeep the pane sizes and tabs since they are bound to us @@ -170,11 +170,11 @@ WindowMsgHandledType GadgetTabControlSystem( GameWindow *tabControl, UnsignedInt default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetTabControlSystem +} void GadgetTabControlComputeTabRegion( GameWindow *tabControl )///< Recalc the tab positions based on userData { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp index a156332de7d..0a7dee2a9df 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp @@ -247,12 +247,12 @@ WindowMsgHandledType GadgetTextEntryInput( GameWindow *window, UnsignedInt msg, GEM_UPDATE_TEXT, (WindowMsgData)window, 0 ); - } // end if + } } } break; - } // end switch( mData1 ) + } break; @@ -303,11 +303,11 @@ WindowMsgHandledType GadgetTextEntryInput( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetTextEntryInput +} // GadgetTextEntrySystem ====================================================== /** Handle system messages for entry field */ @@ -344,7 +344,7 @@ WindowMsgHandledType GadgetTextEntrySystem( GameWindow *window, UnsignedInt msg, break; - } // end set text + } // ------------------------------------------------------------------------ case GWM_CREATE: @@ -410,11 +410,11 @@ WindowMsgHandledType GadgetTextEntrySystem( GameWindow *window, UnsignedInt msg, default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetTextEntrySystem +} /** @todo we might want to do something like this if we use IME for language * support in this product */ @@ -559,9 +559,9 @@ void GadgetTextEntrySetFont( GameWindow *g, GameFont *font ) if( dString ) dString->setFont( font ); - } // end if + } -} // end GadgetTextEntrySetFont +} // GadgetTextEntryGetText ======================================================= /** Get the text for a Text entry */ @@ -581,4 +581,4 @@ UnicodeString GadgetTextEntryGetText( GameWindow *textentry ) TheWindowManager->winSendSystemMsg( textentry, GEM_GET_TEXT, 0, (WindowMsgData)&result ); return result; -} // end GadgetListBoxGetText +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp index 714ea51bb9d..334dc3f4b71 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp @@ -154,7 +154,7 @@ WindowMsgHandledType GadgetVerticalSliderInput( GameWindow *window, UnsignedInt if( clickPos > mousey - y ) clickPos = mousey - y; - } // end if + } else { @@ -162,7 +162,7 @@ WindowMsgHandledType GadgetVerticalSliderInput( GameWindow *window, UnsignedInt if( clickPos < mousey - y ) clickPos = mousey - y; - } // end else + } // keep pos valid on window if( clickPos > y + size.y - childSize.y / 2 ) @@ -246,20 +246,20 @@ WindowMsgHandledType GadgetVerticalSliderInput( GameWindow *window, UnsignedInt default: return MSG_IGNORED; - } // end switch( mData1 ) + } break; - } // end char + } default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetVerticalSliderInput +} // GadgetVerticalSliderSystem ================================================= /** Handle system messages for vertical slider */ @@ -318,7 +318,7 @@ WindowMsgHandledType GadgetVerticalSliderSystem( GameWindow *window, UnsignedInt s->position ); break; - } // end if + } else if( mousey < y ) { @@ -332,7 +332,7 @@ WindowMsgHandledType GadgetVerticalSliderSystem( GameWindow *window, UnsignedInt s->position ); break; - } // end else if + } if( childCenter.y <= y + childSize.y / 2 ) { @@ -456,14 +456,14 @@ WindowMsgHandledType GadgetVerticalSliderSystem( GameWindow *window, UnsignedInt break; - } // end resized + } default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; -} // end GadgetVerticalSliderSystem +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp index c5fc3271c63..e5d304912aa 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp @@ -55,7 +55,7 @@ void FontLibrary::linkFont( GameFont *font ) // increment linked count m_count++; -} // end linkFont +} //------------------------------------------------------------------------------------------------- /** Unlink a font from the font list */ @@ -78,7 +78,7 @@ void FontLibrary::unlinkFont( GameFont *font ) DEBUG_CRASH(( "Font '%s' not found in library", font->nameString.str() )); return; - } // end if + } // scan for the font pointing to the one we're going to unlink for( other = m_fontList; other; other = other->next ) @@ -100,7 +100,7 @@ void FontLibrary::unlinkFont( GameFont *font ) // we now have one less font on the list m_count--; -} // end unlinkFont +} //------------------------------------------------------------------------------------------------- /** Delete all font data, DO NOT throw an exception ... the destructor uses this */ @@ -125,9 +125,9 @@ void FontLibrary::deleteAllFonts( void ) // delete the font list element deleteInstance(font); - } // end while + } -} // deleteAllFonts +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -141,7 +141,7 @@ FontLibrary::FontLibrary( void ) m_fontList = NULL; m_count = 0; -} // end FontLibrary +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -151,7 +151,7 @@ FontLibrary::~FontLibrary( void ) // delete all font data deleteAllFonts(); -} // end ~FontLibrary +} //------------------------------------------------------------------------------------------------- /** Initialize what we need to in the font library */ @@ -159,7 +159,7 @@ FontLibrary::~FontLibrary( void ) void FontLibrary::init( void ) { -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset the fonts for this font library */ @@ -170,7 +170,7 @@ void FontLibrary::reset( void ) // delete all font data deleteAllFonts(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Get a font from our list, if we don't have that font loaded we will @@ -190,7 +190,7 @@ GameFont *FontLibrary::getFont( AsciiString name, Int pointSize, Bool bold ) ) return font; // found - } // end for font + } // font not found, allocate a new font element font = newInstance(GameFont); @@ -200,7 +200,7 @@ GameFont *FontLibrary::getFont( AsciiString name, Int pointSize, Bool bold ) DEBUG_CRASH(( "getFont: Unable to allocate new font list element" )); return NULL; - } // end if + } // copy font data over to new element font->nameString = name; @@ -217,7 +217,7 @@ GameFont *FontLibrary::getFont( AsciiString name, Int pointSize, Bool bold ) deleteInstance(font); return NULL; - } // end if + } // tie font into list linkFont( font ); @@ -225,4 +225,4 @@ GameFont *FontLibrary::getFont( AsciiString name, Int pointSize, Bool bold ) // all is done and loaded return font; -} // end getFont +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp index 1e248386c5e..e90622bb259 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp @@ -117,7 +117,7 @@ GameWindow::GameWindow( void ) m_editData = NULL; -} // end GameWindow +} // GameWindow::~GameWindow ==================================================== //============================================================================= @@ -134,7 +134,7 @@ GameWindow::~GameWindow( void ) unlinkFromTransitionWindows(); -} // end ~GameWindow +} // GameWindow::linkTransitionWindow ============================================ //============================================================================= @@ -143,7 +143,7 @@ void GameWindow::linkTransitionWindow( TransitionWindow* transitionWindow ) m_transitionWindows.push_back(transitionWindow); -} // end linkTransitionWindow +} // GameWindow::unlinkTransitionWindow ========================================= //============================================================================= @@ -162,7 +162,7 @@ void GameWindow::unlinkTransitionWindow( TransitionWindow* transitionWindow ) ++it; } -} // end unlinkTransitionWindow +} // GameWindow::unlinkFromTransitionWindows ========================================= //============================================================================= @@ -175,7 +175,7 @@ void GameWindow::unlinkFromTransitionWindows( void ) m_transitionWindows.pop_back(); } -} // end unlinkFromTransitionWindows +} // GameWindow::normalizeWindowRegion ========================================== /** Puts the upper left corner in the window's region.lo field */ @@ -191,7 +191,7 @@ void GameWindow::normalizeWindowRegion( void ) m_region.lo.x = m_region.hi.x; m_region.hi.x = temp; - } // end if + } if( m_region.lo.y > m_region.hi.y ) { @@ -200,9 +200,9 @@ void GameWindow::normalizeWindowRegion( void ) m_region.lo.y = m_region.hi.y; m_region.hi.y = temp; - } // end if + } -} // end normalizeWindowRegion +} // GameWindow::findFirstLeaf ================================================== /** Returns the first leaf of the branch */ @@ -221,7 +221,7 @@ GameWindow *GameWindow::findFirstLeaf( void ) return leaf; -} // end findFirstLeaf +} // GameWindow::findLastLeaf =================================================== /** Returns the last leaf of the branch */ @@ -243,11 +243,11 @@ GameWindow *GameWindow::findLastLeaf( void ) while( leaf->m_next ) leaf = leaf->m_next; - } // end while + } return leaf; -} // end findLastLeaf +} // GameWindow::findPrevLeaf =================================================== /** Returns the prev leaf of the tree */ @@ -270,11 +270,11 @@ GameWindow *GameWindow::findPrevLeaf( void ) while( leaf->m_next ) leaf = leaf->m_next; - } // end while + } return leaf; - } // end if + } else { @@ -297,24 +297,24 @@ GameWindow *GameWindow::findPrevLeaf( void ) while( leaf->m_next ) leaf = leaf->m_next; - } // end while + } return leaf; - } // end if + } - } // end while + } if( leaf ) return leaf->findLastLeaf(); else return NULL; - } // end else + } return NULL; -} // end findPrevLeaf +} // GameWindow::findNextLeaf =================================================== /** Returns the next leaf of the tree */ @@ -334,7 +334,7 @@ GameWindow *GameWindow::findNextLeaf( void ) WIN_STATUS_TAB_STOP ) ) return leaf; - } // end if + } else { @@ -351,20 +351,20 @@ GameWindow *GameWindow::findNextLeaf( void ) BitIsSet( leaf->m_status, WIN_STATUS_TAB_STOP ) ) return leaf; - } // end if + } - } // end while + } if( leaf ) return leaf->findFirstLeaf(); else return NULL; - } // end else + } return NULL; -} // end findNextLeav +} // GameWindow::winNextTab ===================================================== /** Go to next window in tab chain */ @@ -399,7 +399,7 @@ Int GameWindow::winNextTab( void ) */ return WIN_ERR_OK; -} // end WinNextTab +} // GameWindow::winPrevTab ===================================================== /** Go to previous window in tab chain */ @@ -422,7 +422,7 @@ Int GameWindow::winPrevTab( void ) newTab = findFirstLeaf( newTab ); firstTry = FALSE; - } // end if + } else newTab = findNextLeaf( newTab ); @@ -436,7 +436,7 @@ Int GameWindow::winPrevTab( void ) return WIN_ERR_OK; -} // end WinPrevTab +} // GameWindow::winBringToTop ================================================== /** Bring this window to the top of the window list, if we have a parent @@ -454,7 +454,7 @@ Int GameWindow::winBringToTop( void ) TheWindowManager->addWindowToParent( this, parent ); // TheWindowManager->addWindowToParentAtEnd( this, parent ); - } // end if + } else { @@ -469,7 +469,7 @@ Int GameWindow::winBringToTop( void ) TheWindowManager->unlinkWindow( this ); TheWindowManager->linkWindow( this ); - } // end else + } // // if the window is part of a screen layout, move it to the top @@ -488,11 +488,11 @@ Int GameWindow::winBringToTop( void ) saveLayout->removeWindow( this ); saveLayout->addWindow( this ); - } // end if + } return WIN_ERR_OK; -} // end winBringToTop +} // GameWindow::winActivate ==================================================== /** Pop window to top of window list AND activate it */ @@ -512,7 +512,7 @@ Int GameWindow::winActivate( void ) return WIN_ERR_OK; -} // end WinActivate +} // GameWindow::winSetPosition ================================================= /** Set the window's position */ @@ -530,7 +530,7 @@ Int GameWindow::winSetPosition( Int x, Int y ) return WIN_ERR_OK; -} // end WinSetPosition +} // WinGetPosition ============================================================= /** Get the window's postion */ @@ -547,7 +547,7 @@ Int GameWindow::winGetPosition( Int *x, Int *y ) return WIN_ERR_OK; -} // end WinGetPosition +} // WinSetCursorPosition ============================================================= /** Set the window's cursor postion */ @@ -559,7 +559,7 @@ Int GameWindow::winSetCursorPosition( Int x, Int y ) return WIN_ERR_OK; -} // end WinSetCursorPosition +} // WinGetCursorPosition ============================================================= /** Get the window's cursor postion */ @@ -578,7 +578,7 @@ Int GameWindow::winGetCursorPosition( Int *x, Int *y ) return WIN_ERR_OK; -} // end WinGetPosition +} // GameWindow::winGetScreenPosition =========================================== /** Get the window's postion in screen coordinates */ @@ -597,11 +597,11 @@ Int GameWindow::winGetScreenPosition( Int *x, Int *y ) *y += parent->m_region.lo.y; parent = parent->m_parent; - } // end while + } return WIN_ERR_OK; -} // end WinGetScreenPosition +} // GameWindow::winGetRegion =================================================== /** Get the window region */ @@ -614,7 +614,7 @@ Int GameWindow::winGetRegion( IRegion2D *region ) return WIN_ERR_OK; -} // end winGetRegion +} // GameWindow::winPointInWindow =============================================== /** Check to see if the given point is inside the window. Will @@ -633,7 +633,7 @@ Bool GameWindow::winPointInWindow( Int x, Int y ) return FALSE; -} // end WinPointInWindow +} // GameWindow::winSetSize ===================================================== /** Set the window's size */ @@ -653,7 +653,7 @@ Int GameWindow::winSetSize( Int width, Int height ) return WIN_ERR_OK; -} // end WinSetSize +} // GameWindow::winGetSize ===================================================== /** Get the window's size */ @@ -670,7 +670,7 @@ Int GameWindow::winGetSize( Int *width, Int *height ) return WIN_ERR_OK; -} // end WinGetSize +} // GameWindow::winEnable ====================================================== /** Enable or disable a window based on the enable parameter. @@ -691,11 +691,11 @@ Int GameWindow::winEnable( Bool enable ) for( child = m_child; child; child = child->m_next) child->winEnable( enable ); - } // end if + } return WIN_ERR_OK; -} // end WinEnable +} // GameWindow::winGetEnabled ====================================================== /** Enable or disable a window based on the enable parameter. @@ -705,7 +705,7 @@ Bool GameWindow::winGetEnabled( void ) { return BitIsSet( m_status, WIN_STATUS_ENABLED ); -} // end winGetEnabled +} // GameWindow::winHide ======================================================== /** Hide or show a window based on the hide parameter. @@ -730,17 +730,17 @@ Int GameWindow::winHide( Bool hide ) // notify the window manger we are hiding TheWindowManager->windowHiding( this ); - } // end if + } else { BitClear( m_status, WIN_STATUS_HIDDEN ); - } // end else + } return WIN_ERR_OK; -} // end WinHide +} // GameWindow::winIsHidden ==================================================== /** Am I hidden? */ @@ -750,7 +750,7 @@ Bool GameWindow::winIsHidden( void ) return BitIsSet( m_status, WIN_STATUS_HIDDEN ); -} // end WinIsHidden +} // GameWindow::winSetStatus =================================================== /** Allows the user to directly set a window's status flags. */ @@ -765,7 +765,7 @@ UnsignedInt GameWindow::winSetStatus( UnsignedInt status ) return oldStatus; -} // end WinSetStatus +} // GameWindow::winClearStatus ================================================= /** Allows the user to directly clear a window's status flags. */ @@ -779,7 +779,7 @@ UnsignedInt GameWindow::winClearStatus( UnsignedInt status ) return oldStatus; -} // end WinClearStatus +} // GameWindow::winGetStatus =================================================== /** Returns a window's status flags. */ @@ -789,7 +789,7 @@ UnsignedInt GameWindow::winGetStatus( void ) return m_status; -} // end WinGetStatus +} // GameWindow::winGetStyle ==================================================== /** Returns a window's style flags. */ @@ -799,7 +799,7 @@ UnsignedInt GameWindow::winGetStyle( void ) return m_instData.m_style; -} // end WinGetStyle +} // GameWindow::winSetHiliteState ============================================== /** Set whether window is highlighted or not */ @@ -812,7 +812,7 @@ void GameWindow::winSetHiliteState( Bool state ) else BitClear( m_instData.m_state, WIN_STATE_HILITED ); -} // end WinSetHiliteState +} // GameWindow::winSetDrawOffset =============================================== /** Set offset for drawing images */ @@ -823,7 +823,7 @@ void GameWindow::winSetDrawOffset( Int x, Int y ) m_instData.m_imageOffset.x = x; m_instData.m_imageOffset.y = y; -} // end WinSetDrawOffset +} // GameWindow::winGetDrawOffset =============================================== /** Get offset for drawing images */ @@ -838,7 +838,7 @@ void GameWindow::winGetDrawOffset( Int *x, Int *y ) *x = m_instData.m_imageOffset.x; *y = m_instData.m_imageOffset.y; -} // end WinGetDrawOffset +} // GameWindow::winSetText ===================================================== /** Sets the text in a window */ @@ -850,7 +850,7 @@ Int GameWindow::winSetText( UnicodeString newText ) return WIN_ERR_OK; -} // end WinSetText +} // GameWindow::winGetText ===================================================== /** Get text from a window ... this works for static text windows and @@ -861,7 +861,7 @@ UnicodeString GameWindow::winGetText( void ) // return the contents of our text field return m_instData.getText(); -} // end WinGetText +} // GameWindow::winGetTextLength ===================================================== //============================================================================= @@ -870,7 +870,7 @@ Int GameWindow::winGetTextLength() // return the contents of our text field return m_instData.getTextLength(); -} // end WinGetText +} // GameWindow::winGetFont ===================================================== /** Get the font being used by this window */ @@ -880,7 +880,7 @@ GameFont *GameWindow::winGetFont( void ) return m_instData.getFont(); -} // end WinGetFont +} // GameWindow::winSetFont ===================================================== /** Set font for text in this window */ @@ -912,9 +912,9 @@ void GameWindow::winSetFont( GameFont *font ) if( dString ) dString->setFont( font ); - } // end else + } -} // end WinSetFont +} // GameWindow::winSetEnabledTextColors ======================================== /** Set the text colors for the enabled state */ @@ -928,7 +928,7 @@ void GameWindow::winSetEnabledTextColors( Color color, Color borderColor ) GadgetComboBoxSetEnabledTextColors(this, color, borderColor ); -} // end winSetEnabledTextColors +} // GameWindow::winSetDisabledTextColors ======================================= /** Set the text colors for the disabled state */ @@ -942,7 +942,7 @@ void GameWindow::winSetDisabledTextColors( Color color, Color borderColor ) if( BitIsSet( m_instData.getStyle(), GWS_COMBO_BOX ) ) GadgetComboBoxSetDisabledTextColors( this, color, borderColor ); -} // end winSetDisabledTextColors +} // GameWindow::winSetHiliteTextColors ========================================= /** Set the text colors for the Hilite state */ @@ -956,7 +956,7 @@ void GameWindow::winSetHiliteTextColors( Color color, Color borderColor ) if( BitIsSet( m_instData.getStyle(), GWS_COMBO_BOX ) ) GadgetComboBoxSetHiliteTextColors( this, color, borderColor ); -} // end winSetHiliteTextColors +} // GameWindow::winSetIMECompositeTextColors ========================================= /** Set the text colors for the IME Composite state */ @@ -969,7 +969,7 @@ void GameWindow::winSetIMECompositeTextColors( Color color, Color borderColor ) if( BitIsSet( m_instData.getStyle(), GWS_COMBO_BOX ) ) GadgetComboBoxSetIMECompositeTextColors( this, color, borderColor ); -} // end winSetIMECompositeTextColors +} // GameWindow::winGetEnabledTextColor ========================================= /** Get the enabled text color */ @@ -979,7 +979,7 @@ Color GameWindow::winGetEnabledTextColor( void ) return m_instData.m_enabledText.color; -} // end winGetEnabledTextColor +} // GameWindow::winGetEnabledTextBorderColor =================================== /** Get the enabled text color */ @@ -989,7 +989,7 @@ Color GameWindow::winGetEnabledTextBorderColor( void ) return m_instData.m_enabledText.borderColor; -} // end winGetEnabledTextBorderColor +} // GameWindow::winGetDisabledTextColor ======================================== /** Get the disabled text color */ @@ -999,7 +999,7 @@ Color GameWindow::winGetDisabledTextColor( void ) return m_instData.m_disabledText.color; -} // end winGetDisabledTextColor +} // GameWindow::winGetDisabledTextBorderColor ================================== /** Get the disabled text color */ @@ -1009,7 +1009,7 @@ Color GameWindow::winGetDisabledTextBorderColor( void ) return m_instData.m_disabledText.borderColor; -} // end winGetEnabledTextBorderColor +} // GameWindow::winGetIMECompositeTextColor ========================================== /** Get the IME composite text color */ @@ -1019,7 +1019,7 @@ Color GameWindow::winGetIMECompositeTextColor( void ) return m_instData.m_imeCompositeText.color; -} // end winGetIMECompositeTextColor +} // GameWindow::winGetIMECompositeBorderColor ========================================== /** Get the IME composite border color */ @@ -1029,7 +1029,7 @@ Color GameWindow::winGetIMECompositeBorderColor( void ) return m_instData.m_imeCompositeText.borderColor; -} // end winGetIMECompositeBorderColor +} // GameWindow::winGetHiliteTextColor ========================================== /** Get the hilite text color */ @@ -1039,7 +1039,7 @@ Color GameWindow::winGetHiliteTextColor( void ) return m_instData.m_hiliteText.color; -} // end winGetHiliteTextColor +} // GameWindow::winGetHiliteTextBorderColor ==================================== /** Get the hilite text color */ @@ -1049,7 +1049,7 @@ Color GameWindow::winGetHiliteTextBorderColor( void ) return m_instData.m_hiliteText.borderColor; -} // end winGetHiliteTextBorderColor +} // GameWindow::winSetInstanceData ============================================= /** Sets the window's instance data which includes parameters @@ -1083,7 +1083,7 @@ Int GameWindow::winSetInstanceData( WinInstanceData *data ) return WIN_ERR_OK; -} // end WinSetInstanceData +} // GameWindow::winGetInstanceData ============================================= /** Return pointer to the instance data for this window */ @@ -1093,7 +1093,7 @@ WinInstanceData *GameWindow::winGetInstanceData( void ) return &m_instData; -} // end WinGetInstanceData +} // GameWindow::winGetUserData ================================================= /** Return the user data stored */ @@ -1103,7 +1103,7 @@ void *GameWindow::winGetUserData( void ) return m_userData; -} // end WinGetUserData +} // GameWindow::winSetUserData ================================================= /** Set the user data stored */ @@ -1113,7 +1113,7 @@ void GameWindow::winSetUserData( void *data ) m_userData = data; -} // end WinSetUserData +} // GameWindow::winSetTooltip ================================================== /** Sets the window's tooltip text */ @@ -1123,7 +1123,7 @@ void GameWindow::winSetTooltip( UnicodeString tip ) m_instData.setTooltipText( tip ); -} // end WinSetTooltip +} // GameWindow::winSetWindowId ================================================= /** Sets the window's id */ @@ -1135,7 +1135,7 @@ Int GameWindow::winSetWindowId( Int id ) return WIN_ERR_OK; -} // end WinSetWindowId +} // GameWindow::winGetWindowId ================================================= /** Gets the window's id */ @@ -1145,7 +1145,7 @@ Int GameWindow::winGetWindowId( void ) return m_instData.m_id; -} // end WinGetWindowId +} // GameWindow::winSetParent =================================================== /** Sets this window's parent */ @@ -1182,7 +1182,7 @@ Int GameWindow::winSetParent( GameWindow *parent ) return WIN_ERR_OK; -} // end WinSetParent +} // GameWindow::winGetParent =================================================== /** Gets the window's parent */ @@ -1192,7 +1192,7 @@ GameWindow *GameWindow::winGetParent( void ) return m_parent; -} // end WinGetParent +} // GameWindow::winIsChild ===================================================== /** Determins if a window is a child/grand-child of a parent */ @@ -1209,11 +1209,11 @@ Bool GameWindow::winIsChild( GameWindow *child ) // set up tree child = child->m_parent; - } // end while + } return FALSE; -} // end WinIsChild +} // GameWindow::winGetChild ==================================================== /** Get the child window of this window */ @@ -1223,7 +1223,7 @@ GameWindow *GameWindow::winGetChild( void ) return m_child; -} // end WinGetChild +} // GameWindow::winSetOwner ==================================================== /** Sets the window's owner */ @@ -1238,7 +1238,7 @@ Int GameWindow::winSetOwner( GameWindow *owner ) return WIN_ERR_OK; -} // end WinSetOwner +} // GameWindow::winGetOwner ==================================================== /** Gets the window's owner */ @@ -1248,7 +1248,7 @@ GameWindow *GameWindow::winGetOwner( void ) return m_instData.getOwner(); -} // end winGetOwner +} // GameWindow::winSetNext ===================================================== /** Set next pointer */ @@ -1258,7 +1258,7 @@ void GameWindow::winSetNext( GameWindow *next ) m_next = next; -} // end winSetNext +} // GameWindow::winGetNext ===================================================== /** Gets the next window */ @@ -1268,7 +1268,7 @@ GameWindow *GameWindow::winGetNext( void ) return m_next; -} // end winGetNext +} // GameWindow::winSetPrev ===================================================== /** Set prev pointer */ @@ -1278,7 +1278,7 @@ void GameWindow::winSetPrev( GameWindow *prev ) m_prev = prev; -} // end winSetPrev +} // GameWindow::winGetPrev ===================================================== /** Get the previous window */ @@ -1288,7 +1288,7 @@ GameWindow *GameWindow::winGetPrev( void ) return m_prev; -} // end winGetPrev +} // GameWindow::winSetNextInLayout ============================================= /** Set next window in layout */ @@ -1350,7 +1350,7 @@ Int GameWindow::winSetSystemFunc( GameWinSystemFunc system ) return WIN_ERR_OK; -} // end WinSetSystemFunc +} // GameWindow::winSetInputFunc ================================================ /** Sets the window's input callback functions. */ @@ -1365,7 +1365,7 @@ Int GameWindow::winSetInputFunc( GameWinInputFunc input ) return WIN_ERR_OK; -} // end WinSetInputFunc +} // GameWindow::winSetDrawFunc ================================================= /** Sets the window's redraw callback functions. */ @@ -1380,7 +1380,7 @@ Int GameWindow::winSetDrawFunc( GameWinDrawFunc draw ) return WIN_ERR_OK; -} // end WinSetDrawFunc +} // GameWindow::winSetTooltipFunc ============================================== /** Sets a window's tooltip callback */ @@ -1392,7 +1392,7 @@ Int GameWindow::winSetTooltipFunc( GameWinTooltipFunc tooltip ) return WIN_ERR_OK; -} // end WinSetTooltipFunc +} // GameWindow::winSetCallbacks ================================================ /** Sets the window's input, tooltip, and redraw callback functions. */ @@ -1408,7 +1408,7 @@ Int GameWindow::winSetCallbacks( GameWinInputFunc input, return WIN_ERR_OK; -} // end WinSetCallbacks +} // GameWindow::winDrawWindow ================================================== /** Draws the default background for the specified window. */ @@ -1421,7 +1421,7 @@ Int GameWindow::winDrawWindow( void ) return WIN_ERR_OK; -} // end WinDrawWindow +} // GameWindow::winPointInChild ================================================ /** Given a window and the mouse coordinates, return the child @@ -1447,7 +1447,7 @@ GameWindow *GameWindow::winPointInChild( Int x, Int y, Bool ignoreEnableCheck, B origin.y += parent->m_region.lo.y; parent = parent->m_parent; - } // end while + } if( x >= origin.x && x <= origin.x + child->m_size.x && y >= origin.y && y <= origin.y + child->m_size.y ) @@ -1471,12 +1471,12 @@ GameWindow *GameWindow::winPointInChild( Int x, Int y, Bool ignoreEnableCheck, B } } - } // end for child + } // not in any children, must be in parent return this; -} // end WinPointInChild +} // GameWindow::winPointInAnyChild ============================================= /** Find the child in which the cursor resides; regardless of @@ -1501,7 +1501,7 @@ GameWindow *GameWindow::winPointInAnyChild( Int x, Int y, Bool ignoreHidden, Boo origin.y += parent->m_region.lo.y; parent = parent->m_parent; - } // end while + } if( x >= origin.x && x <= origin.x + child->m_size.x && y >= origin.y && y <= origin.y + child->m_size.y ) @@ -1510,14 +1510,14 @@ GameWindow *GameWindow::winPointInAnyChild( Int x, Int y, Bool ignoreHidden, Boo if( !(ignoreHidden == TRUE && BitIsSet( child->m_status, WIN_STATUS_HIDDEN )) ) return child->winPointInChild( x, y, ignoreEnableCheck ); - } // end if + } - } // end for child + } // not in any children, must be in parent return this; -} // end WinPointInAnyChild +} // // In release builds the default input and system functions are optimized @@ -1537,7 +1537,7 @@ WindowMsgHandledType GameWinDefaultInput( GameWindow *window, UnsignedInt msg, return MSG_IGNORED; -} // end GameWinDefaultInput +} ///< Input that blocks all (mouse) input like a wall, instead of passing like it wasn't there WindowMsgHandledType GameWinBlockInput( GameWindow *window, UnsignedInt msg, @@ -1563,7 +1563,7 @@ WindowMsgHandledType GameWinBlockInput( GameWindow *window, UnsignedInt msg, return MSG_HANDLED; -} // end GameWinBlockInput +} // GameWinDefaultSystem ======================================================= /** The default system callback. Currently does nothing. */ @@ -1574,7 +1574,7 @@ WindowMsgHandledType GameWinDefaultSystem( GameWindow *window, UnsignedInt msg, return MSG_IGNORED; -} // end GameWinDefaultSystem +} // GameWinDefaultTooltip ====================================================== /** Default tooltip callback */ @@ -1585,7 +1585,7 @@ void GameWinDefaultTooltip( GameWindow *window, { return; -} // end GameWinDefaultTooltip +} // GameWinDefaultDraw ========================================================= /** Default draw, does nothing */ @@ -1595,7 +1595,7 @@ void GameWinDefaultDraw( GameWindow *window, WinInstanceData *instData ) return; -} // end GameWinDefaultDraw +} // GameWindow::winSetEnabledImage ============================================= /** Set an enabled image into the draw data for the enabled state */ @@ -1611,12 +1611,12 @@ Int GameWindow::winSetEnabledImage( Int index, const Image *image ) assert( 0 ); return WIN_ERR_INVALID_PARAMETER; - } // end if + } m_instData.m_enabledDrawData[ index ].image = image; return WIN_ERR_OK; -} // end winSetEnabledImage +} // GameWindow::winSetEnabledColor ============================================= /** set color for enabled state at index */ @@ -1632,12 +1632,12 @@ Int GameWindow::winSetEnabledColor( Int index, Color color ) assert( 0 ); return WIN_ERR_INVALID_PARAMETER; - } // end if + } m_instData.m_enabledDrawData[ index ].color = color; return WIN_ERR_OK; -} // end winSetEnabledColor +} // GameWindow::winSetEnabledBorderColor ======================================= /** set border color for state at this index */ @@ -1653,12 +1653,12 @@ Int GameWindow::winSetEnabledBorderColor( Int index, Color color ) assert( 0 ); return WIN_ERR_INVALID_PARAMETER; - } // end if + } m_instData.m_enabledDrawData[ index ].borderColor = color; return WIN_ERR_OK; -} // end winSetEnabledBorderColor +} // GameWindow::winSetDisabledImage ============================================ /** Set an disabled image into the draw data for the disabled state */ @@ -1674,12 +1674,12 @@ Int GameWindow::winSetDisabledImage( Int index, const Image *image ) assert( 0 ); return WIN_ERR_INVALID_PARAMETER; - } // end if + } m_instData.m_disabledDrawData[ index ].image = image; return WIN_ERR_OK; -} // end winSetDisabledImage +} // GameWindow::winSetDisabledColor ============================================ /** set color for disabled state at index */ @@ -1695,12 +1695,12 @@ Int GameWindow::winSetDisabledColor( Int index, Color color ) assert( 0 ); return WIN_ERR_INVALID_PARAMETER; - } // end if + } m_instData.m_disabledDrawData[ index ].color = color; return WIN_ERR_OK; -} // end winSetDisabledColor +} // GameWindow::winSetDisabledBorderColor ====================================== /** set border color for state at this index */ @@ -1716,12 +1716,12 @@ Int GameWindow::winSetDisabledBorderColor( Int index, Color color ) assert( 0 ); return WIN_ERR_INVALID_PARAMETER; - } // end if + } m_instData.m_disabledDrawData[ index ].borderColor = color; return WIN_ERR_OK; -} // end winSetDisabledBorderColor +} // GameWindow::winSetHiliteImage ============================================== /** Set an hilite image into the draw data for the hilite state */ @@ -1737,12 +1737,12 @@ Int GameWindow::winSetHiliteImage( Int index, const Image *image ) assert( 0 ); return WIN_ERR_INVALID_PARAMETER; - } // end if + } m_instData.m_hiliteDrawData[ index ].image = image; return WIN_ERR_OK; -} // end winSetHiliteImage +} // GameWindow::winSetHiliteColor ============================================== /** set color for hilite state at index */ @@ -1758,12 +1758,12 @@ Int GameWindow::winSetHiliteColor( Int index, Color color ) assert( 0 ); return WIN_ERR_INVALID_PARAMETER; - } // end if + } m_instData.m_hiliteDrawData[ index ].color = color; return WIN_ERR_OK; -} // end winSetHiliteColor +} // GameWindow::winSetHiliteBorderColor ======================================== /** set border color for state at this index */ @@ -1779,12 +1779,12 @@ Int GameWindow::winSetHiliteBorderColor( Int index, Color color ) assert( 0 ); return WIN_ERR_INVALID_PARAMETER; - } // end if + } m_instData.m_hiliteDrawData[ index ].borderColor = color; return WIN_ERR_OK; -} // end winSetHiliteBorderColor +} // GameWindow::winGetInputFunc ================================================ //============================================================================= @@ -1793,7 +1793,7 @@ GameWinInputFunc GameWindow::winGetInputFunc( void ) return m_input; -} // end winGetInputFunc +} // GameWindow::winGetSystemFunc =============================================== //============================================================================= @@ -1802,7 +1802,7 @@ GameWinSystemFunc GameWindow::winGetSystemFunc( void ) return m_system; -} // end winGetSystemFunc +} // GameWindow::winGetTooltipFunc ============================================== //============================================================================= @@ -1811,7 +1811,7 @@ GameWinTooltipFunc GameWindow::winGetTooltipFunc( void ) return m_tooltip; -} // end winGetTooltipFunc +} // GameWindow::winGetDrawFunc ================================================= //============================================================================= @@ -1820,7 +1820,7 @@ GameWinDrawFunc GameWindow::winGetDrawFunc( void ) return m_draw; -} // end winGetDrawFunc +} // GameWindow::winSetEditData ================================================= //============================================================================= @@ -1829,7 +1829,7 @@ void GameWindow::winSetEditData( GameWindowEditData *editData ) m_editData = editData; -} // end winSetEditData +} // GameWindow::winGetEditData ================================================= //============================================================================= @@ -1838,4 +1838,4 @@ GameWindowEditData *GameWindow::winGetEditData( void ) return m_editData; -} // end winGetEditData +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp index a5ff3774c48..ed965acaecd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp @@ -80,7 +80,7 @@ void GameWindowManager::winDrawImage( const Image *image, Int startX, Int startY TheDisplay->drawImage( image, startX, startY, endX, endY, color ); -} // end WinDrawImage +} // GameWindowManager::winFillRect ============================================= /** draw filled rect, coords are absolute screen coords */ @@ -94,7 +94,7 @@ void GameWindowManager::winFillRect( Color color, Real width, endX - startX, endY - startY, color ); -} // end WinFillRect +} // GameWindowManager::winOpenRect ============================================= /** draw rect outline, coords are absolute screen coords */ @@ -108,7 +108,7 @@ void GameWindowManager::winOpenRect( Color color, Real width, endX - startX, endY - startY, width, color ); -} // end WinOpenRect +} // GameWindowManager::winDrawLine ============================================= /** draw line, coords are absolute screen coords */ @@ -120,7 +120,7 @@ void GameWindowManager::winDrawLine( Color color, Real width, TheDisplay->drawLine( startX, startY, endX, endY, width, color ); -} // end WinDrawLine +} // GameWindowManager::winFindImage ============================================ /** Given an image name, return an image loc to that image information. @@ -136,7 +136,7 @@ const Image *GameWindowManager::winFindImage( const char *name ) return NULL; -} // end WinFindImage +} // GameWindowManager::winMakeColor ============================================ /** Given RGBA, make a color, you can change color representation for your @@ -150,7 +150,7 @@ Color GameWindowManager::winMakeColor( UnsignedByte red, return GameMakeColor( red, green, blue, alpha ); -} // end WinMakeColor +} // GameWindowManager::winFormatText =========================================== /** draw text to the screen */ @@ -161,7 +161,7 @@ void GameWindowManager::winFormatText( GameFont *font, UnicodeString text, Color /// @todo make all display string rendering go through here! -} // end WinFormatText +} // GameWindowManager::winGetTextSize ========================================== /** get the extent size of text */ @@ -178,7 +178,7 @@ void GameWindowManager::winGetTextSize( GameFont *font, UnicodeString text, if( height ) *height = 0; -} // end WinGetTextSize +} // GameWindowManager::winFontHeight =========================================== /** Return the font height in pixels */ @@ -188,7 +188,7 @@ Int GameWindowManager::winFontHeight( GameFont *font ) return font->height; -} // end WinFontHeight +} // GameWindowManager::winIsDigit ============================================== /** You implementation of whether or not character is a digit */ @@ -198,7 +198,7 @@ Int GameWindowManager::winIsDigit( Int c ) return GameIsDigit( c ); -} // end WinIsDigit +} // GameWindowManager::winIsAscii ============================================== /** You implementation of whether or not character is ascii */ @@ -208,7 +208,7 @@ Int GameWindowManager::winIsAscii( Int c ) return GameIsAscii( c ); -} // end WinIsDigit +} // GameWindowManager::winIsAlNum ============================================== /** Your implementation of whether or not character is alpha numeric */ @@ -218,7 +218,7 @@ Int GameWindowManager::winIsAlNum( Int c ) return GameIsAlNum( c ); -} // end WinIsAlNum +} // GameWindowManager::winFindFont ============================================= /** Get a font */ @@ -234,5 +234,5 @@ GameFont *GameWindowManager::winFindFont( AsciiString fontName, return NULL; -} // end WinFindFont +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp index ddc1dbaf726..354c8207714 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp @@ -120,9 +120,9 @@ void GameWindowManager::processDestroyList( void ) // free the memory deleteInstance(doDestroy); - } // end for + } -} // end processDestroyList +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -146,11 +146,11 @@ WindowMsgHandledType PassSelectedButtonsToParentSystem( GameWindow *window, Unsi if( parent ) return TheWindowManager->winSendSystemMsg( parent, msg, mData1, mData2 ); - } // end if + } return MSG_IGNORED; -} // end PassSelectedButtonsToParentSystem +} //------------------------------------------------------------------------------------------------- /** Generic function to simply propagate only button press messages to parent and let it deal with it */ @@ -171,7 +171,7 @@ WindowMsgHandledType PassMessagesToParentSystem( GameWindow *window, UnsignedInt return MSG_IGNORED; -} // end PassSelectedButtonsToParentSystem +} //------------------------------------------------------------------------------------------------- @@ -194,7 +194,7 @@ GameWindowManager::GameWindowManager( void ) m_cursorBitmap = NULL; m_captureFlags = 0; -} // end GameWindowManger +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -207,7 +207,7 @@ GameWindowManager::~GameWindowManager( void ) if(TheTransitionHandler) delete TheTransitionHandler; TheTransitionHandler = NULL; -} // end ~GameWindowManager +} //------------------------------------------------------------------------------------------------- /** Initialize the game window manager system */ @@ -218,7 +218,7 @@ void GameWindowManager::init( void ) TheTransitionHandler = NEW GameWindowTransitionsHandler; TheTransitionHandler->load(); TheTransitionHandler->init(); -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset window system */ @@ -231,7 +231,7 @@ void GameWindowManager::reset( void ) if(TheTransitionHandler) TheTransitionHandler->reset(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update cycle for game widnow manager */ @@ -243,7 +243,7 @@ void GameWindowManager::update( void ) processDestroyList(); if(TheTransitionHandler) TheTransitionHandler->update(); -} // end update +} //------------------------------------------------------------------------------------------------- /** Puts a window at the head of the window list */ @@ -295,7 +295,7 @@ void GameWindowManager::linkWindow( GameWindow *window ) } } -} // end linkWindow +} //------------------------------------------------------------------------------------------------- /** Insert the window ahead of the the 'aheadOf' window. 'aheadOf' can @@ -317,7 +317,7 @@ void GameWindowManager::insertWindowAheadOf( GameWindow *window, linkWindow( window ); return; - } // end if + } // get parent of aheadOf GameWindow *aheadOfParent = aheadOf->winGetParent(); @@ -339,7 +339,7 @@ void GameWindowManager::insertWindowAheadOf( GameWindow *window, aheadOf->m_prev = window; window->m_next = aheadOf; - } // end if + } else { @@ -355,9 +355,9 @@ void GameWindowManager::insertWindowAheadOf( GameWindow *window, window->m_parent = aheadOfParent; - } // end else + } -} // end insertWindowAheadOf +} //------------------------------------------------------------------------------------------------- /** Takes a window off the window list */ @@ -378,7 +378,7 @@ void GameWindowManager::unlinkWindow( GameWindow *window ) else m_windowList = window->m_next; -} // end unlinkWindow +} //------------------------------------------------------------------------------------------------- /** Takes a child window off its parent's window list */ @@ -415,12 +415,12 @@ void GameWindowManager::unlinkChildWindow( GameWindow *window ) } - } // end else + } // remove the parent reference from this window window->m_parent = NULL; -} // end unlinkChildWindow +} //------------------------------------------------------------------------------------------------- /** Check window and parents to see if this window is enabled */ @@ -448,7 +448,7 @@ Bool GameWindowManager::isEnabled( GameWindow *win ) return TRUE; -} // end isEnabled +} //------------------------------------------------------------------------------------------------- /** Check window and parents to see if this window is hidden */ @@ -476,7 +476,7 @@ Bool GameWindowManager::isHidden( GameWindow *win ) return FALSE; -} // end isHidden +} //------------------------------------------------------------------------------------------------- // Adds a child window to its parent. @@ -500,7 +500,7 @@ void GameWindowManager::addWindowToParent( GameWindow *window, } -} // end addWindowToParent +} //------------------------------------------------------------------------------------------------- /** Add a child window to the parent, put place it at the end of the @@ -528,16 +528,16 @@ void GameWindowManager::addWindowToParentAtEnd( GameWindow *window, last->m_next = window; window->m_prev = last; - } // end if + } else parent->m_child = window; // assign the parent to the window window->m_parent = parent; - } // end if + } -} // end addWindowToParentAtEnd +} //------------------------------------------------------------------------------------------------- /** this gets called from winHide() when a window hides itself */ @@ -566,7 +566,7 @@ void GameWindowManager::windowHiding( GameWindow *window ) for( child = window->winGetChild(); child; child = child->winGetNext() ) windowHiding( child ); -} // end windowHiding +} //------------------------------------------------------------------------------------------------- /** Hide all windows in a certain range of id's (inclusive) */ @@ -585,9 +585,9 @@ void GameWindowManager::hideWindowsInRange( GameWindow *baseWindow, if( window ) window->winHide( hideFlag ); - } // end for i + } -} // end hideWindowsInRange +} //------------------------------------------------------------------------------------------------- // Enable all windows in a certain range of id's (inclusive) @@ -606,9 +606,9 @@ void GameWindowManager::enableWindowsInRange( GameWindow *baseWindow, if( window ) window->winEnable( enableFlag ); - } // end for i + } -} // end enableWindowsInRange +} //------------------------------------------------------------------------------------------------- /** Captures the mouse capture. */ @@ -623,7 +623,7 @@ Int GameWindowManager::winCapture( GameWindow *window ) return WIN_ERR_OK; -} // end WinCapture +} //------------------------------------------------------------------------------------------------- /** Releases the mouse capture. */ @@ -636,7 +636,7 @@ Int GameWindowManager::winRelease( GameWindow *window ) return WIN_ERR_OK; -} // end WinRelease +} //------------------------------------------------------------------------------------------------- /** Returns the current mouse captor. */ @@ -646,7 +646,7 @@ GameWindow *GameWindowManager::winGetCapture( void ) return m_mouseCaptor; -} // end WinGetCapture +} //------------------------------------------------------------------------------------------------- /** Gets the window pointer from its id */ @@ -669,13 +669,13 @@ GameWindow *GameWindowManager::winGetWindowFromId( GameWindow *window, Int id ) if( child ) return child; - } // end else if + } - } // end for + } return NULL; -} // end WinGetWindowFromId +} //------------------------------------------------------------------------------------------------- /** Gets the Window List Pointer */ @@ -685,7 +685,7 @@ GameWindow *GameWindowManager::winGetWindowList( void ) return m_windowList; -} // end winGetWindowList +} //------------------------------------------------------------------------------------------------- /** Send a system message to the specified window */ @@ -704,7 +704,7 @@ WindowMsgHandledType GameWindowManager::winSendSystemMsg( GameWindow *window, return window->m_system( window, msg, mData1, mData2 ); -} // end winSendSystemMsg +} //------------------------------------------------------------------------------------------------- /** Send a system message to the specified window */ @@ -723,7 +723,7 @@ WindowMsgHandledType GameWindowManager::winSendInputMsg( GameWindow *window, return window->m_input( window, msg, mData1, mData2 ); -} // end winSendInputMsg +} //------------------------------------------------------------------------------------------------- /** Get the current input focus */ @@ -733,7 +733,7 @@ GameWindow *GameWindowManager::winGetFocus( void ) return m_keyboardFocus; -} // end WinGetFocus +} //------------------------------------------------------------------------------------------------- /** Set the current input focus */ @@ -775,7 +775,7 @@ Int GameWindowManager::winSetFocus( GameWindow *window ) break; } - } // end if + } // If new window doesn't want focus, set focus to NULL if( wantsFocus == FALSE ) @@ -783,7 +783,7 @@ Int GameWindowManager::winSetFocus( GameWindow *window ) return WIN_ERR_OK; -} // end WinSetFocus +} //------------------------------------------------------------------------------------------------- /** Process key press through the GUI. */ @@ -814,15 +814,15 @@ WinInputReturnCode GameWindowManager::winProcessKey( UnsignedByte key, returnCode = WIN_INPUT_NOT_USED; // oops, it wasn't used after all break; - } // end if + } - } // end while + } - } // end if + } return returnCode; -} // end winProcessKey +} //------------------------------------------------------------------------------------------------- /** Process a single mouse event through the window system */ @@ -883,9 +883,9 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms win = win->winGetParent(); - } // end while + } - } // end if + } else { @@ -893,11 +893,11 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms if( winSendInputMsg( m_mouseCaptor, msg, packedMouseCoords, 0 ) == MSG_HANDLED ) returnCode = WIN_INPUT_USED; - } // end else + } - } // end if + } - } // end if, mouse captor window present + } else { @@ -925,7 +925,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms clearGrabWindow = TRUE; break; - } // end left up + } // -------------------------------------------------------------------- case MOUSE_EVENT_NONE: @@ -981,20 +981,20 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms m_grabWindow->winSetPosition( newRegion.lo.x, newRegion.lo.y ); - } // end if, draggable window + } // Send mouse drag message winSendInputMsg( m_grabWindow, msg, packedMouseCoords, 0 ); break; - } // end mouse event none or left drag + } - } // end switch + } // mark event handled returnCode = WIN_INPUT_USED; - } // end if, m_grabWindow + } else { @@ -1014,7 +1014,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms // check below and !hidden if( window == NULL ) window = findWindowUnderMouse(toolTipWindow, mousePos, WIN_STATUS_BELOW, WIN_STATUS_HIDDEN); - } // end else, no modal head + } if( window ) if( BitIsSet( window->m_status, WIN_STATUS_NO_INPUT ) ) @@ -1047,7 +1047,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms if( tempWin == NULL ) break; - } // end while + } // First check to see if m_loneWindow is set if so, close the window @@ -1084,16 +1084,16 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms // WinActivate( tempWin ); m_grabWindow = tempWin; - } // end if + } // event is used returnCode = WIN_INPUT_USED; - } // end if, tempWin + } - } // end if + } - } // end if( window ) + } if( toolTipWindow == NULL ) { @@ -1101,7 +1101,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms if( isHidden( window ) == FALSE ) toolTipWindow = window; - } // end if + } // if tooltips are on set them into the window Bool tooltipsOn = TRUE; @@ -1121,7 +1121,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms else if( toolTipWindow->m_instData.getTooltipTextLength() ) TheMouse->setCursorTooltip( toolTipWindow->m_instData.getTooltipText(), toolTipWindow->m_instData.m_tooltipDelay ); - } // end if + } else { @@ -1134,13 +1134,13 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms // objectTooltip = TRUE; - } // end else + } - } // end if + } - } // end if grabWindow not present + } - } // end else (mouseCaptor) + } // // check if new current window is different from the last @@ -1161,7 +1161,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms m_currMouseRgn = window; - } // end if + } // clear grabWindow if necessary if( clearGrabWindow == TRUE ) @@ -1170,11 +1170,11 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms m_grabWindow = NULL; clearGrabWindow = FALSE; - } // end if + } return returnCode; -} // end winProcessMouseEvent +} bool GameWindowManager::isMouseWithinWindow(GameWindow* window, const ICoord2D* mousePos, unsigned int requiredStatusMask, unsigned int forbiddenStatusMask) { @@ -1256,11 +1256,11 @@ Int GameWindowManager::drawWindow( GameWindow *window ) !BitIsSet( window->m_status, WIN_STATUS_SEE_THRU ) ) window->winDrawBorder(); - } // end if + } return WIN_ERR_OK; -} // end drawWindow +} //------------------------------------------------------------------------------------------------- /** Draw the GUI in reverse order to correlate with clicking priority */ @@ -1299,7 +1299,7 @@ void GameWindowManager::winRepaint( void ) if(TheTransitionHandler) TheTransitionHandler->draw(); -} // end WinRepaint +} //------------------------------------------------------------------------------------------------- /** Dump information about all the windows for resource problems */ @@ -1320,7 +1320,7 @@ void GameWindowManager::dumpWindow( GameWindow *window ) return; #endif -} // end dumpWindow +} //------------------------------------------------------------------------------------------------- /** Create a new window by setting up its parameters and callbacks. */ @@ -1351,7 +1351,7 @@ GameWindow *GameWindowManager::winCreate( GameWindow *parent, return NULL; - } // endif + } // If this is a child window add it to the parent's window list if( parent ) @@ -1390,7 +1390,7 @@ GameWindow *GameWindowManager::winCreate( GameWindow *parent, return window; -} // end WinCreate +} //------------------------------------------------------------------------------------------------- /** Take a window and its children off the top level list and free @@ -1458,7 +1458,7 @@ Int GameWindowManager::winDestroy( GameWindow *window ) return WIN_ERR_OK; -} // winDestroy +} //------------------------------------------------------------------------------------------------- /** Destroy all windows on the window list IMMEDIATELY */ @@ -1481,14 +1481,14 @@ Int GameWindowManager::winDestroyAll( void ) winDestroy( win ); - } // end for + } // Destroy All Windows just added to destroy list processDestroyList(); return WIN_ERR_OK; -} // end WinDestroyAll +} //------------------------------------------------------------------------------------------------- /** Sets selected window into a modal state. This window will get @@ -1522,7 +1522,7 @@ Int GameWindowManager::winSetModal( GameWindow *window ) return WIN_ERR_OK; -} // end WinSetModal +} //------------------------------------------------------------------------------------------------- /** pops window off of the modal stack. If this window is not the top @@ -1544,7 +1544,7 @@ Int GameWindowManager::winUnsetModal( GameWindow *window ) window->winGetWindowId() )); return WIN_ERR_GENERAL_FAILURE; - } // end if + } // remove from top of list next = m_modalHead->next; @@ -1553,7 +1553,7 @@ Int GameWindowManager::winUnsetModal( GameWindow *window ) return WIN_ERR_OK; -} // end WinUnsetModal +} //------------------------------------------------------------------------------------------------- /** Get the grabbed window */ @@ -1563,7 +1563,7 @@ GameWindow *GameWindowManager::winGetGrabWindow( void ) return m_grabWindow; -} // end WinGetGrabWindow +} //------------------------------------------------------------------------------------------------- /** Explicitly set the grab window */ @@ -1573,7 +1573,7 @@ void GameWindowManager::winSetGrabWindow( GameWindow *window ) m_grabWindow = window; -} // end winSetGrabWindow +} //------------------------------------------------------------------------------------------------- /** Explicitly set the grab window */ @@ -1587,7 +1587,7 @@ void GameWindowManager::winSetLoneWindow( GameWindow *window ) TheWindowManager->winSendSystemMsg( m_loneWindow, GGM_CLOSE, 0, 0 ); m_loneWindow = window; -} // end winSetGrabWindow +} //------------------------------------------------------------------------------------------------- /** Create a Modal Message Box */ @@ -1768,7 +1768,7 @@ GameWindow *GameWindowManager::gogoMessageBox(Int x, Int y, Int width, Int heigh //Changed By Chris return trueParent; -}// gogoMessageBox +} //------------------------------------------------------------------------------------------------- /** Create a button GUI control */ @@ -1791,7 +1791,7 @@ GameWindow *GameWindowManager::gogoGadgetPushButton( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // create the button window button = TheWindowManager->winCreate( parent, status, @@ -1805,7 +1805,7 @@ GameWindow *GameWindowManager::gogoGadgetPushButton( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // assign input function button->winSetInputFunc( GadgetPushButtonInput ); @@ -1835,7 +1835,7 @@ GameWindow *GameWindowManager::gogoGadgetPushButton( GameWindow *parent, return button; -} // end gogoGadgetPushButton +} //------------------------------------------------------------------------------------------------- /** Create a checkbox UI element */ @@ -1859,7 +1859,7 @@ GameWindow *GameWindowManager::gogoGadgetCheckbox( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // create the button window checkbox = TheWindowManager->winCreate( parent, status, @@ -1873,7 +1873,7 @@ GameWindow *GameWindowManager::gogoGadgetCheckbox( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // assign input function checkbox->winSetInputFunc( GadgetCheckBoxInput ); @@ -1900,7 +1900,7 @@ GameWindow *GameWindowManager::gogoGadgetCheckbox( GameWindow *parent, return checkbox; -} // end gogoGadgetCheckbox +} //------------------------------------------------------------------------------------------------- /** Create a radio button GUI element */ @@ -1926,7 +1926,7 @@ GameWindow *GameWindowManager::gogoGadgetRadioButton( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // create the button window radioButton = TheWindowManager->winCreate( parent, status, @@ -1940,7 +1940,7 @@ GameWindow *GameWindowManager::gogoGadgetRadioButton( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // allocate and store the radio button user data radioData = NEW RadioButtonData; @@ -1972,7 +1972,7 @@ GameWindow *GameWindowManager::gogoGadgetRadioButton( GameWindow *parent, return radioButton; -} // end gogoGadgetRadioButton +} //------------------------------------------------------------------------------------------------- /** Create a tab control GUI element */ @@ -1998,7 +1998,7 @@ GameWindow *GameWindowManager::gogoGadgetTabControl( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // create the tab control window tabControl = TheWindowManager->winCreate( parent, status, @@ -2012,7 +2012,7 @@ GameWindow *GameWindowManager::gogoGadgetTabControl( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // allocate and store the tab control user data tabData = NEW TabControlData; @@ -2043,7 +2043,7 @@ GameWindow *GameWindowManager::gogoGadgetTabControl( GameWindow *parent, return tabControl; -} // end gogoGadgetTabControl +} //------------------------------------------------------------------------------------------------- /** Create a list box GUI control */ @@ -2070,7 +2070,7 @@ GameWindow *GameWindowManager::gogoGadgetListBox( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // create the listbox listbox = winCreate( parent, status, x, y, width, height, @@ -2083,7 +2083,7 @@ GameWindow *GameWindowManager::gogoGadgetListBox( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // allocate the listbox data, copy template data over and set it into box listboxData = NEW ListboxData; @@ -2158,8 +2158,8 @@ GameWindow *GameWindowManager::gogoGadgetListBox( GameWindow *parent, listboxData->slider->winGetSize( &sliderSize.x, &sliderSize.y ); listboxData->columnWidth[0] -= (sliderSize.x + 2); - } // end if - }// if + } + } else { if( !listboxData->columnWidthPercentage ) @@ -2176,18 +2176,18 @@ GameWindow *GameWindowManager::gogoGadgetListBox( GameWindow *parent, listboxData->slider->winGetSize( &sliderSize.x, &sliderSize.y ); totalWidth -= (sliderSize.x + 2); - } // end if + } for(Int i = 0; i < listboxData->columns; i++ ) { listboxData->columnWidth[i] = listboxData->columnWidthPercentage[i] * totalWidth / 100; - }// for - }// else + } + } // assign the default images/colors assignDefaultGadgetLook( listbox, defaultFont, defaultVisual ); return listbox; -} // end gogoGadgetListBox +} //------------------------------------------------------------------------------------------------- /** Does all generic window creation, calls appropriate slider create @@ -2226,7 +2226,7 @@ GameWindow *GameWindowManager::gogoGadgetSlider( GameWindow *parent, else slider->winSetDrawFunc( getHorizontalSliderDrawFunc() ); - } // end if + } else if ( BitIsSet( instData->getStyle(), GWS_VERT_SLIDER ) ) { @@ -2241,7 +2241,7 @@ GameWindow *GameWindowManager::gogoGadgetSlider( GameWindow *parent, else slider->winSetDrawFunc( getVerticalSliderDrawFunc() ); - } // end else if + } else { @@ -2249,7 +2249,7 @@ GameWindow *GameWindowManager::gogoGadgetSlider( GameWindow *parent, assert( 0 ); return NULL; - } // end else + } // sanity if( slider == NULL ) @@ -2259,7 +2259,7 @@ GameWindow *GameWindowManager::gogoGadgetSlider( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // set the owner to the parent, or if no parent it will be itself slider->winSetOwner( parent ); @@ -2312,7 +2312,7 @@ GameWindow *GameWindowManager::gogoGadgetSlider( GameWindow *parent, return slider; -} // end gogoGadgetSlider +} //------------------------------------------------------------------------------------------------- /** Create a Combo Box GUI element */ @@ -2338,7 +2338,7 @@ GameWindow *GameWindowManager::gogoGadgetComboBox( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // create the listbox comboBox = winCreate( parent, status, x, y, width, height, @@ -2351,7 +2351,7 @@ GameWindow *GameWindowManager::gogoGadgetComboBox( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // begin here @@ -2542,7 +2542,7 @@ GameWindow *GameWindowManager::gogoGadgetProgressBar( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // create the button window progressBar = TheWindowManager->winCreate( parent, status, @@ -2556,7 +2556,7 @@ GameWindow *GameWindowManager::gogoGadgetProgressBar( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // // assign draw function, the draw functions must actually be implemented @@ -2575,7 +2575,7 @@ GameWindow *GameWindowManager::gogoGadgetProgressBar( GameWindow *parent, return progressBar; -} // end gogoGadgetProgressBar +} //------------------------------------------------------------------------------------------------- /** Does all generic window creation, calls appropriate text field create @@ -2640,11 +2640,11 @@ GameWindow *GameWindowManager::gogoGadgetStaticText( GameWindow *parent, if( text.getLength() ) GadgetStaticTextSetText( textWin, text ); - } // end if + } return textWin; -} // end gogoGadetStaticText +} //------------------------------------------------------------------------------------------------- /** Does all generic window creation, calls appropriate entry field create @@ -2670,7 +2670,7 @@ GameWindow *GameWindowManager::gogoGadgetTextEntry( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // create the window entry = winCreate( parent, status, x, y, width, height, @@ -2682,7 +2682,7 @@ GameWindow *GameWindowManager::gogoGadgetTextEntry( GameWindow *parent, assert( 0 ); return NULL; - } // end if + } // set owner of this control entry->winSetOwner( parent ); @@ -2777,9 +2777,9 @@ GameWindow *GameWindowManager::gogoGadgetTextEntry( GameWindow *parent, winDestroy( entry ); return NULL; - } // end if + } - } // end, korean or japanese + } // assign the default images/colors assignDefaultGadgetLook( entry, defaultFont, defaultVisual ); @@ -2791,7 +2791,7 @@ GameWindow *GameWindowManager::gogoGadgetTextEntry( GameWindow *parent, return entry; -} // end gogoGadgetTextEntry +} //------------------------------------------------------------------------------------------------- /** Use this method to assign the default images/colors to gadgets as @@ -2898,7 +2898,7 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - } // end if + } else if( BitIsSet( instData->getStyle(), GWS_CHECK_BOX ) ) { @@ -2947,7 +2947,7 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - } // end else if + } else if( BitIsSet( instData->getStyle(), GWS_RADIO_BUTTON ) ) { @@ -2996,7 +2996,7 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - } // end else if + } else if( BitIsSet( instData->getStyle(), GWS_HORZ_SLIDER ) ) { @@ -3058,7 +3058,7 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, GadgetSliderSetHiliteSelectedThumbBorderColor( gadget, GadgetSliderGetHiliteColor( gadget ) ); - } // end if + } else if( BitIsSet( instData->getStyle(), GWS_VERT_SLIDER ) ) { // enabled @@ -3118,7 +3118,7 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, GadgetSliderSetHiliteSelectedThumbColor( gadget, GadgetSliderGetHiliteBorderColor( gadget ) ); GadgetSliderSetHiliteSelectedThumbBorderColor( gadget, GadgetSliderGetHiliteColor( gadget ) ); - } // end else if + } else if( BitIsSet( instData->getStyle(), GWS_SCROLL_LISTBOX ) ) { ListboxData *listboxData = (ListboxData *)gadget->winGetUserData(); @@ -3223,9 +3223,9 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, GadgetButtonSetHiliteImage( downButton, winFindImage( "VSliderLargeDownButtonHilite" ) ); GadgetButtonSetHiliteSelectedImage( downButton, winFindImage( "VSliderLargeDownButtonHiliteSelected" ) ); - } // end if + } - } // end else if + } else if( BitIsSet( instData->getStyle(), GWS_COMBO_BOX ) ) { // ComboBoxData *comboBoxData = (ComboBoxData *)gadget->winGetUserData(); @@ -3403,9 +3403,9 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, GadgetButtonSetHiliteImage( downButton, winFindImage( "VSliderLargeDownButtonHilite" ) ); GadgetButtonSetHiliteSelectedImage( downButton, winFindImage( "VSliderLargeDownButtonHiliteSelected" ) ); - } // end if + } } - } // end else if + } else if( BitIsSet( instData->getStyle(), GWS_PROGRESS_BAR ) ) { @@ -3451,7 +3451,7 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, GadgetProgressBarSetHiliteBarImageCenter( gadget, winFindImage( "ProgressBarHiliteBarRepeatingCenter" ) ); GadgetProgressBarSetHiliteBarImageSmallCenter( gadget, winFindImage( "ProgressBarHiliteBarSmallRepeatingCenter" ) ); - } // end else if + } else if( BitIsSet( instData->getStyle(), GWS_STATIC_TEXT ) ) { @@ -3476,7 +3476,7 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - } // end else if + } else if( BitIsSet( instData->getStyle(), GWS_ENTRY_FIELD ) ) { @@ -3510,9 +3510,9 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - } // end else if + } -} // end assignDefaultGadgetLook +} //------------------------------------------------------------------------------------------------- /** Given a text label, retreive the real localized text associated @@ -3530,7 +3530,7 @@ UnicodeString GameWindowManager::winTextLabelToText( AsciiString label ) tmp.translate(label); return tmp; -} // end winTextLabelToText +} //------------------------------------------------------------------------------------------------- /** find the top window at the given coordinates */ @@ -3573,8 +3573,8 @@ GameWindow *GameWindowManager::getWindowUnderCursor( Int x, Int y, Bool ignoreEn window = window->winPointInChild( x, y, ignoreEnabled ); break; // exit for } - } // end if - } // end for window + } + } // check !above, below and hidden if( window == NULL ) @@ -3597,7 +3597,7 @@ GameWindow *GameWindowManager::getWindowUnderCursor( Int x, Int y, Bool ignoreEn } } } - } // end if, window == NULL + } // check below and !hidden if( window == NULL ) @@ -3619,8 +3619,8 @@ GameWindow *GameWindowManager::getWindowUnderCursor( Int x, Int y, Bool ignoreEn } } } - } // end if - } // end else, no modal head + } + } if( window ) { @@ -3971,7 +3971,7 @@ Bool GameWindowManager::initTestGUI( void ) return TRUE; -} // end initTestGUI +} void GameWindowManager::winNextTab( GameWindow *window ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp index 3579223a30a..21c42bd748c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp @@ -218,7 +218,7 @@ static Bool parseBitFlag( const char *flagString, UnsignedInt *bits, return FALSE; -} // end parseBitFlag +} // parseBitString ============================================================= /** Given a character string of the form 'A+B+C+D', parse the @@ -245,7 +245,7 @@ static void parseBitString( const char *inBuffer, UnsignedInt *bits, const char } } -} // end parseBitString +} // readUntilSemicolon ========================================================= //============================================================================= @@ -291,7 +291,7 @@ static void readUntilSemicolon( File *fp, char *buffer, int maxBufLen ) buffer[ maxBufLen - 1 ] = '\000'; -} // end readUntilSemicolon +} // scanBool =================================================================== //============================================================================= @@ -302,7 +302,7 @@ static Int scanBool( const char *source, Bool& val ) val = (Bool)temp; return ret; -} // end scanBool +} // scanShort ================================================================== //============================================================================= @@ -313,7 +313,7 @@ static Int scanShort( const char *source, Short& val ) val = (Short)temp; return ret; -} // end scanShort +} // scanInt ==================================================================== //============================================================================= @@ -322,7 +322,7 @@ static Int scanInt( const char *source, Int& val ) Int ret = sscanf( source, "%d", &val ); // not strictly necessary to wrap this, but it's more consistent return ret; -} // end scanInt +} // scanUnsignedInt ============================================================ //============================================================================= @@ -331,7 +331,7 @@ static Int scanUnsignedInt( const char *source, UnsignedInt& val ) Int ret = sscanf( source, "%d", &val ); // not strictly necessary to wrap this, but it's more consistent return ret; -} // end scanUnsignedInt +} // resetWindowStack =========================================================== //============================================================================= @@ -341,7 +341,7 @@ static void resetWindowStack( void ) memset( windowStack, 0, sizeof( windowStack ) ); stackPtr = windowStack; -} // end resetWindowStack +} // resetWindowDefaults ======================================================== //============================================================================= @@ -356,7 +356,7 @@ static void resetWindowDefaults( void ) defTextColor = 0; defFont = 0; -} // end resetWindowDefaults +} // peekWindow ================================================================= //============================================================================= @@ -367,7 +367,7 @@ static GameWindow *peekWindow( void ) return *(stackPtr - 1); -} // end peekWindow +} // popWindow ================================================================== //============================================================================= @@ -380,7 +380,7 @@ static GameWindow *popWindow( void ) return *stackPtr; -} // end popWindow +} // pushWindow ================================================================= //============================================================================= @@ -393,11 +393,11 @@ static void pushWindow( GameWindow *window ) DEBUG_LOG(( "pushWindow: Warning, stack overflow" )); return; - } // end if + } *stackPtr++ = window; -} // end pushWindow +} // parseColor ================================================================= /** Parse a color entry and store it in the value pointed to by the @@ -421,7 +421,7 @@ static Bool parseColor( Color *color, char *buffer ) return TRUE; -} // end parseColor +} // parseDefaultColor ========================================================== /** Parse a default color entry and store it in the value pointed to by @@ -442,13 +442,13 @@ static Bool parseDefaultColor( Color *color, File *inFile, char *buffer ) *color = WIN_COLOR_UNDEFINED; - } // end if + } else parseColor( color, buffer ); return TRUE; -} // end parseDefaultColor +} // parseDefaultFont =========================================================== /** Parse the default font */ @@ -471,7 +471,7 @@ static Bool parseDefaultFont( GameFont *font, File *inFile, char *buffer ) return TRUE; -} // end parseDefaultFont +} // parseTooltip =============================================================== /** Parse the tooltip field */ @@ -486,7 +486,7 @@ static Bool parseTooltip( const char *token, WinInstanceData *instData, instData->setTooltipText( tooltip ); return TRUE; -} // end parseTooltip +} // parseScreenRect ============================================================ /** Parse the screen rect entry which tells us the position and size @@ -549,14 +549,14 @@ static Bool parseScreenRect( const char *token, char *buffer, *x = screenRegion.lo.x - parentScreenPos.x; *y = screenRegion.lo.y - parentScreenPos.y; - } // end if + } else { *x = screenRegion.lo.x; *y = screenRegion.lo.y; - } // end else + } // save our width and height from the adjusted screen region locations *width = screenRegion.hi.x - screenRegion.lo.x; @@ -564,7 +564,7 @@ static Bool parseScreenRect( const char *token, char *buffer, return TRUE; -} // end parseScreenRect +} // parseImageOffset =========================================================== /** Parse the image draw offset */ @@ -582,7 +582,7 @@ static Bool parseImageOffset( const char *token, WinInstanceData *instData, return TRUE; -} // end parseImageOffset +} // parseFont ================================================================== /** Parse the font field */ @@ -625,11 +625,11 @@ static Bool parseFont( const char *token, WinInstanceData *instData, if( font ) instData->m_font = font; - } // end if + } return TRUE; -} // end parseFont +} // parseName ================================================================= /** Parse the NAME field */ @@ -656,7 +656,7 @@ static Bool parseName( const char *token, WinInstanceData *instData, return TRUE; -} // end parseName +} // parseStatus ================================================================ /** Parse the STATUS field */ @@ -670,7 +670,7 @@ static Bool parseStatus( const char *token, WinInstanceData *instData, return TRUE; -} // end parseStatus +} // parseStyle ================================================================= /** Parse the STYLE field */ @@ -684,7 +684,7 @@ static Bool parseStyle( const char *token, WinInstanceData *instData, return TRUE; -} // end parseStyle +} // parseSystemCallback ======================================================== /** Parse the system method callback for a window */ @@ -711,7 +711,7 @@ static Bool parseSystemCallback( const char *token, WinInstanceData *instData, return TRUE; -} // end parseSystemCallback +} // parseInputCallback ========================================================= /** Parse the Input method callback for a window */ @@ -738,7 +738,7 @@ static Bool parseInputCallback( const char *token, WinInstanceData *instData, return TRUE; -} // end parseInputCallback +} // parseTooltipCallback ======================================================= /** Parse the Tooltip method callback for a window */ @@ -765,7 +765,7 @@ static Bool parseTooltipCallback( const char *token, WinInstanceData *instData, return TRUE; -} // end parseTooltipCallback +} // parseDrawCallback ========================================================== /** Parse the Draw method callback for a window */ @@ -792,7 +792,7 @@ static Bool parseDrawCallback( const char *token, WinInstanceData *instData, return TRUE; -} // end parseDrawCallback +} // parseHeaderTemplate ========================================================== /** Parse the Draw method callback for a window */ @@ -818,7 +818,7 @@ static Bool parseHeaderTemplate( const char *token, WinInstanceData *instData, return TRUE; -} // end parseDrawCallback +} // parseListboxData =========================================================== /** Parse listbox data entry */ @@ -894,7 +894,7 @@ static Bool parseListboxData( const char *token, WinInstanceData *instData, // " return TRUE; -} // end parseListboxData +} // parseComboBoxData =========================================================== /** Parse Combo Box data entry */ @@ -928,7 +928,7 @@ static Bool parseComboBoxData( const char *token, WinInstanceData *instData, return TRUE; -}//parseComboBoxData +} // parseSliderData ============================================================ /** Parse slider data entry */ @@ -952,7 +952,7 @@ static Bool parseSliderData( const char *token, WinInstanceData *instData, return TRUE; -} // end parseSliderData +} // parseRadioButtonData ======================================================= /** Parse radio button data entry */ @@ -971,7 +971,7 @@ static Bool parseRadioButtonData( const char *token, WinInstanceData *instData, return TRUE; -} // end parseRadioButtonData +} // parseTooltipText =========================================================== @@ -998,14 +998,14 @@ static Bool parseTooltipText( const char *token, WinInstanceData *instData, assert( 0 ); return FALSE; - } // end if + } instData->m_tooltipString.set(c); instData->setTooltipText(TheGameText->fetch(c)); return TRUE; -} // end parseTooltipText +} // parseTooltipDelay ======================================================= /** Parse the tooltip delay */ @@ -1023,7 +1023,7 @@ static Bool parseTooltipDelay( const char *token, WinInstanceData *instData, return TRUE; -} // end parseTooltipDelay +} // parseText ================================================================== @@ -1048,13 +1048,13 @@ static Bool parseText( const char *token, WinInstanceData *instData, assert( 0 ); return FALSE; - } // end if + } instData->m_textLabelString = c; return TRUE; -} // end parseText +} // parseTextColor ============================================================= /** Parse text color entries for enabled, disabled, and hilite with @@ -1087,7 +1087,7 @@ static Bool parseTextColor( const char *token, WinInstanceData *instData, assert( 0 ); return FALSE; - } // end else + } // color if( first == TRUE ) @@ -1117,11 +1117,11 @@ static Bool parseTextColor( const char *token, WinInstanceData *instData, scanUnsignedInt( c, a ); textData->borderColor = GameMakeColor( r, g, b, a ); - } // end if + } return TRUE; -} // end parseTextColor +} // parseStaticTextData ======================================================== /** Parse static text data entry */ @@ -1147,7 +1147,7 @@ static Bool parseStaticTextData( const char *token, WinInstanceData *instData, return TRUE; -} // end parseStaticTextDAta +} // parseTextEntryData ========================================================= /** Parse text entry data entry */ @@ -1186,7 +1186,7 @@ static Bool parseTextEntryData( const char *token, WinInstanceData *instData, return TRUE; -} // end parseStaticTextDAta +} // parseTabControlData ========================================================= /** Parse tab control data entry */ @@ -1315,7 +1315,7 @@ static Bool parseDrawData( const char *token, WinInstanceData *instData, assert( 0 ); return FALSE; - } // end else + } // IMAGE: X if( first == TRUE ) @@ -1353,11 +1353,11 @@ static Bool parseDrawData( const char *token, WinInstanceData *instData, scanUnsignedInt( c, a ); drawData->borderColor = GameMakeColor( r, g, b, a ); - } // end for i + } return TRUE; -} // end parseDrawData +} // getDataTemplate ============================================================ /** Given a window type style string return the address of a static @@ -1425,7 +1425,7 @@ void *getDataTemplate( char *type ) return data; -} // end getDataTemplate +} // parseData ================================================================== // @@ -1579,7 +1579,7 @@ static Bool parseData( void **data, char *type, char *buffer ) return TRUE; -} // end parseData +} // setWindowText ============================================================== /** Set the default text for a window or gadget control */ @@ -1611,7 +1611,7 @@ static void setWindowText( GameWindow *window, AsciiString textLabel ) else window->winSetText( theText ); -} // end setWindowText +} // createGadget =============================================================== /** Create a gadget based on the 'type' parm */ @@ -1710,9 +1710,9 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledSliderThumbDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteSliderThumbDrawData[ i ]; - } // end for i + } - } //end if + } } else if( !strcmp( type, "HORZSLIDER" ) ) @@ -1742,9 +1742,9 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledSliderThumbDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteSliderThumbDrawData[ i ]; - } // end for i + } - } //end if + } } else if( !strcmp( type, "SCROLLLISTBOX" ) ) @@ -1775,9 +1775,9 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledUpButtonDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteUpButtonDrawData[ i ]; - } // end for i + } - } // end if + } GameWindow *downButton = GadgetListBoxGetDownButton( window ); if( downButton ) @@ -1791,9 +1791,9 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledDownButtonDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteDownButtonDrawData[ i ]; - } // end for i + } - } // end if + } GameWindow *slider = GadgetListBoxGetSlider( window ); if( slider ) @@ -1807,7 +1807,7 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledSliderDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteSliderDrawData[ i ]; - } // end for i + } // do the slider thumb GameWindow *thumb = slider->winGetChild(); @@ -1822,11 +1822,11 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledSliderThumbDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteSliderThumbDrawData[ i ]; - } // end for i + } - } //end if + } - } // end if + } } else if( !strcmp( type, "COMBOBOX" ) ) @@ -1877,8 +1877,8 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledDropDownButtonDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteDropDownButtonDrawData[ i ]; - } // end for i - } // end if + } + } GameWindow *editBox = GadgetComboBoxGetEditBox( window ); if( editBox ) @@ -1892,8 +1892,8 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledEditBoxDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteEditBoxDrawData[ i ]; - } // end for i - } // end if + } + } GameWindow *listBox = GadgetComboBoxGetListBox( window ); @@ -1908,7 +1908,7 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledListBoxDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteListBoxDrawData[ i ]; - } // end for i + } GameWindow *upButton = GadgetListBoxGetUpButton( listBox ); @@ -1923,9 +1923,9 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledUpButtonDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteUpButtonDrawData[ i ]; - } // end for i + } - } // end if + } GameWindow *downButton = GadgetListBoxGetDownButton( listBox ); if( downButton ) @@ -1939,9 +1939,9 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledDownButtonDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteDownButtonDrawData[ i ]; - } // end for i + } - } // end if + } GameWindow *slider = GadgetListBoxGetSlider( listBox ); if( slider ) @@ -1955,7 +1955,7 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledSliderDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteSliderDrawData[ i ]; - } // end for i + } // do the slider thumb GameWindow *thumb = slider->winGetChild(); @@ -1970,11 +1970,11 @@ static GameWindow *createGadget( char *type, instData->m_disabledDrawData[ i ] = disabledSliderThumbDrawData[ i ]; instData->m_hiliteDrawData[ i ] = hiliteSliderThumbDrawData[ i ]; - } // end for i + } - } //end if + } - } // end if + } } } else if( !strcmp( type, "ENTRYFIELD" ) ) @@ -2013,7 +2013,7 @@ static GameWindow *createGadget( char *type, return window; -} // end createGadget +} // createWindow =============================================================== // Create a user window or a gadget depending on the 'type' parm @@ -2050,7 +2050,7 @@ static GameWindow *createWindow( char *type, window->winSetInstanceData( instData ); window->winSetWindowId( id ); - } // end if + } } else if( !strcmp( type, "TABPANE" ) ) @@ -2067,7 +2067,7 @@ static GameWindow *createWindow( char *type, window->winSetInstanceData( instData ); window->winSetWindowId( id ); - } // end if + } } @@ -2088,7 +2088,7 @@ static GameWindow *createWindow( char *type, // set id window->winSetWindowId( id ); - } // end if + } } @@ -2116,9 +2116,9 @@ static GameWindow *createWindow( char *type, editData->tooltipCallbackString = theTooltipString; editData->drawCallbackString = theDrawString; - } // end if + } - } // end if + } if( window ) { @@ -2126,7 +2126,7 @@ static GameWindow *createWindow( char *type, // set any text read from the textLabel setWindowText( window, instData->m_textLabelString ); - } // end if + } // If there is a parent window, send it the SCRIPT_CREATE message if( window && parent ) @@ -2134,7 +2134,7 @@ static GameWindow *createWindow( char *type, return window; -} // end createWindow +} // parseChildWindows ========================================================== /** Parse window descriptions until an extra end is encountered indicating @@ -2233,7 +2233,7 @@ static Bool parseChildWindows( GameWindow *window, } - } // end while( TRUE ) + } // Pop the current window off the stack lastWindow = popWindow(); @@ -2251,7 +2251,7 @@ static Bool parseChildWindows( GameWindow *window, return TRUE; -} // end parseChildWindows +} // lookup table for parsing functions static GameWindowParse gameWindowFieldList[] = @@ -2343,12 +2343,12 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) if( parent ) { parent->winGetSize( &parentSize.x, &parentSize.y ); - } // end if + } else { parentSize.x = TheDisplay->getWidth(); parentSize.y = TheDisplay->getHeight(); - } // end else + } // Initialize the instance data to the defaults /// @todo need to support enabled/disabled/hilite text colors here @@ -2418,7 +2418,7 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) break; } - } // end for + } if( parse->parse == NULL ) { @@ -2474,7 +2474,7 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) window = NULL; goto cleanupAndExit; - } // end if + } } else @@ -2485,9 +2485,9 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) } - } // end if + } - } // end while( TRUE ) + } cleanupAndExit: @@ -2502,7 +2502,7 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) return window; -} // end parseWindow +} //================================================================================================= //================================================================================================= @@ -2525,7 +2525,7 @@ Bool parseInit( const char *token, char *buffer, UnsignedInt version, WindowLayo return TRUE; // success -} // end parseInit +} //------------------------------------------------------------------------------------------------- /** Parse update for layout file */ @@ -2544,7 +2544,7 @@ Bool parseUpdate( const char *token, char *buffer, UnsignedInt version, WindowLa return TRUE; // success -} // end parseUpdate +} //------------------------------------------------------------------------------------------------- /** Parse shutdown for layout file */ @@ -2563,7 +2563,7 @@ Bool parseShutdown( const char *token, char *buffer, UnsignedInt version, Window return TRUE; // success -} // end parseShutdown +} static LayoutScriptParse layoutScriptTable[] = { @@ -2626,15 +2626,15 @@ Bool parseLayoutBlock( File *inFile, char *buffer, UnsignedInt version, WindowLa break; // exit for - } // end if + } - } // end for parse + } - } // end while + } return TRUE; -} // end parseLayoutBlock +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -2658,12 +2658,12 @@ WindowLayout *GameWindowManager::winCreateLayout( AsciiString filename ) deleteInstance(layout); return NULL; - } // end if + } // return loaded layout return layout; -} // end winCreateLayout +} /** Free up the memory used by static strings. Normally this memory is freed by the string destructor but we do it here to make the @@ -2756,9 +2756,9 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, DEBUG_LOG(( "WinCreateFromScript: Error parsing layout block" )); return FALSE; - } // end if + } - } // end if + } else { @@ -2767,7 +2767,7 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, scriptInfo.updateNameString = "[None]"; scriptInfo.shutdownNameString = "[None]"; - } // end else + } while( TRUE ) { @@ -2869,9 +2869,9 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, scriptInfo.windows.push_back(window); - } // end else if + } - } // end while( TRUE ) + } // close the file inFile->close(); @@ -2884,5 +2884,5 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, // return the first window created return firstWindow; -} // end WinCreateFromScript +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp index fc3f37a4643..f3db5f8cf6c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp @@ -134,7 +134,7 @@ void FlashTransition::update( Int frame ) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } } FALLTHROUGH; @@ -294,7 +294,7 @@ void ButtonFlashTransition::update( Int frame ) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } m_drawState = frame; } @@ -805,7 +805,7 @@ void ScaleUpTransition::update( Int frame ) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } } FALLTHROUGH; @@ -928,7 +928,7 @@ void ScoreScaleUpTransition::update( Int frame ) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } } FALLTHROUGH; @@ -1069,7 +1069,7 @@ void MainMenuScaleUpTransition::update( Int frame ) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } } if(frame > MAINMENUSCALEUPTRANSITION_START && frame < MAINMENUSCALEUPTRANSITION_END) { @@ -1190,7 +1190,7 @@ void MainMenuMediumScaleUpTransition::update( Int frame ) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } } if(m_win) m_win->winHide(TRUE); @@ -1417,7 +1417,7 @@ void TextTypeTransition::update( Int frame ) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } if(m_isForward) { m_partialText.concat(m_fullText.getCharAt(frame - 1)); @@ -1561,7 +1561,7 @@ void CountUpTransition::update( Int frame ) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } m_currentValue +=m_countState; if(m_currentValue > m_intValue) m_currentValue = m_intValue; @@ -2023,7 +2023,7 @@ void ReverseSoundTransition::update( Int frame ) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } } break; @@ -2140,7 +2140,7 @@ void PushButtonImageDrawThree(GameWindow *window, Int alpha ) end.x, end.y,color ); start.x += centerImage->getImageWidth(); - } // end for i + } // we will draw the image but clip the parts we don't want to show IRegion2D reg; @@ -2227,7 +2227,7 @@ static void drawTypeText( GameWindow *window, DisplayString *str) textPos.y = origin.y + (size.y / 2) - (textHeight / 2); str->setClipRegion(&clipRegion); str->draw( textPos.x, textPos.y, textColor, textDropColor ); - } // end if + } else { @@ -2237,7 +2237,7 @@ static void drawTypeText( GameWindow *window, DisplayString *str) str->setClipRegion(&clipRegion); str->draw( textPos.x, textPos.y, textColor, textDropColor ); - } // end else + } -} // end drawStaticTextText +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp index ad7947f766a..deffd88ce55 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp @@ -92,7 +92,7 @@ void INI::parseHeaderTemplateDefinition( INI *ini ) // allocate a new item hTemplate = TheHeaderTemplateManager->newHeaderTemplate( name ); - } // end if + } else { DEBUG_CRASH(( "[LINE: %d in '%s'] Duplicate header Template %s found!", ini->getLineNum(), ini->getFilename().str(), name.str() )); @@ -100,7 +100,7 @@ void INI::parseHeaderTemplateDefinition( INI *ini ) // parse the ini definition ini->initFromINI( hTemplate, TheHeaderTemplateManager->getFieldParse() ); -} // end parseCommandButtonDefinition +} HeaderTemplate::HeaderTemplate( void ) : m_font(NULL), diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp index 2edbec54aa5..c5415ba7d53 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp @@ -55,7 +55,7 @@ Shell::Shell( void ) { construct(); -} // end Shell +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -63,7 +63,7 @@ Shell::~Shell( void ) { deconstruct(); -} // end ~Shell +} //------------------------------------------------------------------------------------------------- void Shell::construct( void ) @@ -123,7 +123,7 @@ void Shell::deconstruct( void ) deleteInstance(m_saveLoadMenuLayout); m_saveLoadMenuLayout = NULL; - } //end if + } // delete the replay save menu if present if( m_popupReplayLayout ) @@ -133,7 +133,7 @@ void Shell::deconstruct( void ) deleteInstance(m_popupReplayLayout); m_popupReplayLayout = NULL; - } //end if + } // delete the options menu if present. if (m_optionsLayout != NULL) { @@ -156,7 +156,7 @@ void Shell::init( void ) if( m_schemeManager ) m_schemeManager->init(); -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset the shell system to a clean state just as though init had @@ -174,7 +174,7 @@ void Shell::reset( void ) m_animateWindowManager->reset(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update shell system cycle. All windows are updated that are on the stack, starting @@ -200,7 +200,7 @@ void Shell::update( void ) DEBUG_ASSERTCRASH( m_screenStack[ i ], ("Top of shell stack is NULL!") ); m_screenStack[ i ]->runUpdate( NULL ); - } // end for i + } if(TheGlobalData->m_shellMapOn && m_shellMapOn &&m_background) { @@ -218,9 +218,9 @@ void Shell::update( void ) // mark last time we ran the updates lastUpdate = now; - } // end if + } -} // end update +} //------------------------------------------------------------------------------------------------- namespace @@ -288,11 +288,11 @@ WindowLayout *Shell::findScreenByFilename( AsciiString filename ) if( screen && filename.compareNoCase(screen->getFilename()) == 0 ) return screen; - } // end for i + } return NULL; -} // end findScreenByFilename +} //------------------------------------------------------------------------------------------------- WindowLayout *Shell::getScreenLayout( Int index ) const @@ -317,7 +317,7 @@ void Shell::hide( Bool hide ) if (TheIMEManager) TheIMEManager->detatch(); -} // end hide +} //------------------------------------------------------------------------------------------------- /** Push layout onto shell */ @@ -348,7 +348,7 @@ void Shell::push( AsciiString filename, Bool shutdownImmediate ) filename.str(), MAX_SHELL_STACK )); return; - } // end if + } // set a push as pending with the layout name passed in m_pendingPush = TRUE; @@ -369,19 +369,19 @@ void Shell::push( AsciiString filename, Bool shutdownImmediate ) // run the shutdown currentTop->runShutdown( &shutdownImmediate ); - } // end if + } else { // just call shutdownComplete() which will immediately cause the push to happen shutdownComplete( NULL ); - } // end else + } // if (TheIMEManager) // TheIMEManager->detatch(); -} // end push +} //------------------------------------------------------------------------------------------------- /** Pop top layout of the stack. Note that we don't actually do the pop right here, @@ -421,7 +421,7 @@ void Shell::pop( void ) if (TheIMEManager) TheIMEManager->detatch(); -} // end pop +} //------------------------------------------------------------------------------------------------- /** When you need to immediately pop a screen off the stack use this method. It @@ -459,7 +459,7 @@ void Shell::popImmediate( void ) if (TheIMEManager) TheIMEManager->detatch(); -} // end popImmediate +} //------------------------------------------------------------------------------------------------- /** Run the initialize function for the top of the stack just as though it was pushed @@ -528,7 +528,7 @@ void Shell::showShell( Bool runInit ) push( AsciiString("Menus/MainMenu.wnd") ); } m_isShellActive = TRUE; -} // end showShell +} void Shell::showShellMap(Bool useShellMap ) { @@ -593,7 +593,7 @@ void Shell::hideShell( void ) layout->runShutdown( &immediatePop ); - } // end if + } if (TheIMEManager) TheIMEManager->detatch(); @@ -601,7 +601,7 @@ void Shell::hideShell( void ) // Mark that the shell is no longer up. m_isShellActive = FALSE; -} // end hideShell +} //------------------------------------------------------------------------------------------------- /** Return the top layout on the stack */ @@ -616,7 +616,7 @@ WindowLayout *Shell::top( void ) // top layout is at count index return m_screenStack[ m_screenCount - 1 ]; -} // end top +} // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////////////////////////// //------------------------------------------------------------------------------------------------- @@ -636,12 +636,12 @@ void Shell::linkScreen( WindowLayout *screen ) DEBUG_CRASH(( "No room in shell stack for screen" )); return; - } // end if + } // add to array at top index m_screenStack[ m_screenCount++ ] = screen; -} // end linkScreen +} //------------------------------------------------------------------------------------------------- /** Remove screen from our list */ @@ -660,7 +660,7 @@ void Shell::unlinkScreen( WindowLayout *screen ) if( m_screenStack[ m_screenCount - 1 ] == screen ) m_screenStack[ --m_screenCount ] = NULL; -} // end unlinkScreen +} //------------------------------------------------------------------------------------------------- /** Actually do the work for a push */ @@ -686,7 +686,7 @@ void Shell::doPush( AsciiString layoutFile ) newScreen->bringForward(); -} // end doPush +} //------------------------------------------------------------------------------------------------- /** Actually do the work for a pop */ @@ -721,7 +721,7 @@ void Shell::doPop( Bool impendingPush ) if (TheIMEManager) TheIMEManager->detatch(); -} // end doPop +} //------------------------------------------------------------------------------------------------- /** This is called when a layout has finished its shutdown process. Layouts are @@ -754,7 +754,7 @@ void Shell::shutdownComplete( WindowLayout *screen, Bool impendingPush ) m_pendingPush = FALSE; m_pendingPushName.set( "" ); - } // end if + } else if( m_pendingPop ) { @@ -764,7 +764,7 @@ void Shell::shutdownComplete( WindowLayout *screen, Bool impendingPush ) // no more pending pop for you! m_pendingPop = FALSE; - } // end else if + } if(m_clearBackground) { @@ -778,7 +778,7 @@ void Shell::shutdownComplete( WindowLayout *screen, Bool impendingPush ) } -} // end shutdownComplete +} void Shell::registerWithAnimateManager( GameWindow *win, AnimTypes animType, Bool needsToFinish, UnsignedInt delayMS) @@ -857,7 +857,7 @@ WindowLayout *Shell::getSaveLoadMenuLayout( void ) // return the layout return m_saveLoadMenuLayout; -} // end getSaveLoadMenuLayout +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -874,7 +874,7 @@ WindowLayout *Shell::getPopupReplayLayout( void ) // return the layout return m_popupReplayLayout; -} // end getSaveLoadMenuLayout +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -891,7 +891,7 @@ WindowLayout *Shell::getOptionsLayout( Bool create ) // return the layout return m_optionsLayout; -} // end getOptionsLayout +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp index bde8ca62deb..34040c28779 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp @@ -98,7 +98,7 @@ void INI::parseShellMenuSchemeDefinition( INI *ini ) // parse the ini definition ini->initFromINI( SMScheme, SMSchemeManager->getFieldParse() ); -} // end parseCommandButtonDefinition +} ShellMenuSchemeLine::ShellMenuSchemeLine( void ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WinInstanceData.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WinInstanceData.cpp index 7290b965aa8..ec03e263dcb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WinInstanceData.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WinInstanceData.cpp @@ -79,7 +79,7 @@ WinInstanceData::WinInstanceData( void ) m_videoBuffer = NULL; init(); -} // end WinInstanceData +} // WinInstanceData::~WinInstanceData ========================================== //============================================================================= @@ -94,7 +94,7 @@ WinInstanceData::~WinInstanceData( void ) m_videoBuffer = NULL; //Video Buffer needs to be clean up by the control that is in charge of the video. -} // end ~WinInstanceData +} // WinInstanceData::init ====================================================== /** Set initial values for instance data if desired */ @@ -119,7 +119,7 @@ void WinInstanceData::init( void ) m_hiliteDrawData[ i ].color = WIN_COLOR_UNDEFINED; m_hiliteDrawData[ i ].borderColor = WIN_COLOR_UNDEFINED; - } // end for i + } // initialize text colors m_enabledText.color = WIN_COLOR_UNDEFINED; @@ -150,19 +150,19 @@ void WinInstanceData::init( void ) TheDisplayStringManager->freeDisplayString( m_text ); m_text = NULL; - } // end if + } if( m_tooltip ) { TheDisplayStringManager->freeDisplayString( m_tooltip ); m_tooltip = NULL; - } // end if + } m_videoBuffer = NULL; -} // end init +} // WinInstanceData::setTooltipText ============================================ //============================================================================= @@ -177,7 +177,7 @@ void WinInstanceData::setTooltipText( UnicodeString tip ) // set text m_tooltip->setText( tip ); -} // end setTooltipText +} // WinInstanceData:setText ==================================================== /** Set the text for this window instance data */ @@ -193,7 +193,7 @@ void WinInstanceData::setText( UnicodeString text ) // set the text m_text->setText( text ); -} // end set text +} // WinInstanceData:setText ==================================================== /** Set the text for this window instance data */ diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp index 08b62bbe698..dffd3936fca 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp @@ -51,7 +51,7 @@ WindowLayout::WindowLayout( void ) m_update = NULL; m_shutdown = NULL; -} // end WindowLayout +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -66,7 +66,7 @@ WindowLayout::~WindowLayout( void ) DEBUG_ASSERTCRASH( m_windowList == NULL, ("Window layout being destroyed still has window references") ); DEBUG_ASSERTCRASH( m_windowTail == NULL, ("Window layout being destroyed still has window references") ); -} // end ~WindowLayout +} //------------------------------------------------------------------------------------------------- /** Set the hidden/visible status of all the windows in this layout */ @@ -81,12 +81,12 @@ void WindowLayout::hide( Bool hide ) window->winHide( hide ); - } // end for window + } // save the new visible state of the system m_hidden = hide; -} // end hide +} //------------------------------------------------------------------------------------------------- /** Add window to this layout */ @@ -120,9 +120,9 @@ void WindowLayout::addWindow( GameWindow *window ) // we gots another window now m_windowCount++; - } // end if + } -} // end addWindow +} //------------------------------------------------------------------------------------------------- /** Remove window from this layout */ @@ -158,9 +158,9 @@ void WindowLayout::removeWindow( GameWindow *window ) // we lost one sir! m_windowCount--; - } // end if + } -} // end removeWindow +} //------------------------------------------------------------------------------------------------- /** Destroy all the windows in a layout */ @@ -178,9 +178,9 @@ void WindowLayout::destroyWindows( void ) // destroy window in window system TheWindowManager->winDestroy( window ); - } // end while + } -} // end destroyWindows +} //------------------------------------------------------------------------------------------------- /** Create the windows using the .wnd file script and load all windows into @@ -211,7 +211,7 @@ Bool WindowLayout::load( AsciiString filename ) DEBUG_LOG(( "WindowLayout::load - Unable to load layout file '%s'", filename.str() )); return FALSE; - } // end if + } // // add windows loaded from .wnd file to the layout, via info.windows. @@ -236,7 +236,7 @@ Bool WindowLayout::load( AsciiString filename ) // add window to this layout addWindow( window ); - } // end for window + } */ // copy filename @@ -249,7 +249,7 @@ Bool WindowLayout::load( AsciiString filename ) return TRUE; // success -} // end load +} //------------------------------------------------------------------------------------------------- /** Bring all windows in this layout forward */ @@ -276,9 +276,9 @@ void WindowLayout::bringForward( void ) window->winBringToTop(); countLeft--; - } // end for window + } -} // end bringForward +} // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////////////////////////// @@ -295,4 +295,4 @@ GameWindow *WindowLayout::findWindow( GameWindow *window ) return NULL; // window not found -} // end findWindow +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp index 5d680cac0aa..f579ff7dea7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -237,7 +237,7 @@ GameClient::~GameClient() delete TheSnowManager; TheSnowManager = NULL; -} // end ~GameClient +} //------------------------------------------------------------------------------------------------- /** Initialize resources for the game client */ @@ -347,7 +347,7 @@ void GameClient::init( void ) TheWindowManager->setName("TheWindowManager"); // TheWindowManager->initTestGUI(); - } // end if + } // create the IME manager TheIMEManager = CreateIMEManagerInterface(); @@ -404,7 +404,7 @@ void GameClient::init( void ) TheMouse->setPosition( 0, 0 ); TheMouse->setMouseLimits(); TheMouse->setName("TheMouse"); - } // end if + } // create the video player TheVideoPlayer = createVideoPlayer(); @@ -442,7 +442,7 @@ void GameClient::init( void ) TheGraphDraw = new GraphDraw; #endif -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset the game client for a new game */ @@ -480,7 +480,7 @@ void GameClient::reset( void ) // TheSuperHackers @fix Mauller 13/04/2025 Reset the drawable id so it does not keep growing over the lifetime of the game. m_nextDrawableID = (DrawableID)1; -} // end reset +} /** ----------------------------------------------------------------------------------------------- * Return a new unique object id. @@ -505,7 +505,7 @@ void GameClient::registerDrawable( Drawable *draw ) // add the drawable to the master list draw->prependToList( &m_drawableList ); -} // end registerDrawable +} /** ----------------------------------------------------------------------------------------------- * Redraw all views, update the GUI, play sound effects, etc. @@ -596,7 +596,7 @@ void GameClient::update( void ) TheKeyboard->UPDATE(); TheKeyboard->createStreamMessages(); - } // end if + } // Update the Eva stuff TheEva->UPDATE(); @@ -607,7 +607,7 @@ void GameClient::update( void ) TheMouse->UPDATE(); TheMouse->createStreamMessages(); - } // end if + } if (TheInGameUI->isCameraTrackingDrawable()) @@ -728,7 +728,7 @@ void GameClient::update( void ) TheParticleSystemManager->setLocalPlayerIndex(localPlayerIndex); // TheParticleSystemManager->update(); - } // end if + } // update the terrain visuals { @@ -763,7 +763,7 @@ void GameClient::update( void ) // update the in game UI TheInGameUI->UPDATE(); } -} // end update +} void GameClient::step() { @@ -848,7 +848,7 @@ void GameClient::destroyDrawable( Drawable *draw ) DEBUG_ASSERTCRASH( obj->getDrawable() == draw, ("Object/Drawable pointer mismatch!") ); obj->friend_bindToDrawable( NULL ); - } // end if + } // remove the drawable from our hash of drawables removeDrawableFromLookupTable( draw ); @@ -876,7 +876,7 @@ void GameClient::addDrawableToLookupTable(Drawable *draw ) m_drawableVector[ newID ] = draw; -} // end addDrawableToLookupTable +} // ------------------------------------------------------------------------------------------------ /** Remove drawable from lookup table of fast id searching */ @@ -893,7 +893,7 @@ void GameClient::removeDrawableFromLookupTable( Drawable *draw ) // m_drawableHash.erase( draw->getID() ); m_drawableVector[ draw->getID() ] = NULL; -} // end removeDrawableFromLookupTable +} //------------------------------------------------------------------------------------------------- /** Load a map into the game interface */ @@ -908,7 +908,7 @@ Bool GameClient::loadMap( AsciiString mapName ) return TRUE; -} // end loadMap +} //------------------------------------------------------------------------------------------------- /** Unload a map from the game interface */ @@ -917,7 +917,7 @@ void GameClient::unloadMap( AsciiString mapName ) assert( 0 ); // who calls this? -} // end unloadMap +} //------------------------------------------------------------------------------------------------- void GameClient::setTimeOfDay( TimeOfDay tod ) @@ -1024,7 +1024,7 @@ GameMessage::Type GameClient::evaluateContextCommand( Drawable *draw, else return GameMessage::MSG_INVALID; -} // end evaluateContextCommand +} //------------------------------------------------------------------------------------------------- /** Get the ray effect data for a drawable */ @@ -1033,7 +1033,7 @@ void GameClient::getRayEffectData( Drawable *draw, RayEffectData *effectData ) TheRayEffects->getRayEffectData( draw, effectData ); -} // end getRayEffectData +} //------------------------------------------------------------------------------------------------- /** remove the drawble from the ray effects sytem if present */ @@ -1042,7 +1042,7 @@ void GameClient::removeFromRayEffects( Drawable *draw ) TheRayEffects->deleteRayEffect( draw ); -} // end removeFromRayEffects +} /** frees all shadow resources used by this module - used by Options screen.*/ void GameClient::releaseShadows(void) @@ -1102,9 +1102,9 @@ void GameClient::preloadAssets( TimeOfDay timeOfDay ) // destroy the drawable TheGameClient->destroyDrawable( draw ); - } // end if + } - } // end for + } GlobalMemoryStatus(&after); DEBUG_LOG(("Preloading memory dwAvailPageFile %d --> %d : %d", @@ -1213,7 +1213,7 @@ void GameClient::preloadAssets( TimeOfDay timeOfDay ) // preloadTextureNamesGlobalHack2 = preloadTextureNamesGlobalHack; // preloadTextureNamesGlobalHack.clear(); -} // end preloadAssets +} // ------------------------------------------------------------------------------------------------ /** Given a string name, find the drawable TOC entry (if any) associated with it */ @@ -1227,7 +1227,7 @@ GameClient::DrawableTOCEntry *GameClient::findTOCEntryByName( AsciiString name ) return NULL; -} // end findTOCEntryByname +} // ------------------------------------------------------------------------------------------------ /** Given a drawable TOC identifier, find the drawable TOC if any */ @@ -1241,7 +1241,7 @@ GameClient::DrawableTOCEntry *GameClient::findTOCEntryById( UnsignedShort id ) return NULL; -} // end findTOCEntryById +} // ------------------------------------------------------------------------------------------------ /** Add an drawable TOC entry */ @@ -1254,7 +1254,7 @@ void GameClient::addTOCEntry( AsciiString name, UnsignedShort id ) tocEntry.id = id; m_drawableTOC.push_back( tocEntry ); -} // end addTOCEntry +} // ------------------------------------------------------------------------------------------------ static Bool shouldSaveDrawable(const Drawable* draw) @@ -1309,7 +1309,7 @@ void GameClient::xferDrawableTOC( Xfer *xfer ) // add this entry to the TOC addTOCEntry( draw->getTemplate()->getName(), ++tocCount ); - } // end for obj + } // xfer entries in the TOC xfer->xferUnsignedInt( &tocCount ); @@ -1329,9 +1329,9 @@ void GameClient::xferDrawableTOC( Xfer *xfer ) // xfer the paired id xfer->xferUnsignedShort( &tocEntry->id ); - } // end for + } - } // end if + } else { AsciiString templateName; @@ -1353,11 +1353,11 @@ void GameClient::xferDrawableTOC( Xfer *xfer ) // add this to the TOC addTOCEntry( templateName, id ); - } // end for i + } - } // end else + } -} // end xferDrawableTOC +} // ------------------------------------------------------------------------------------------------ /** Xfer method for Game Client @@ -1423,7 +1423,7 @@ void GameClient::xfer( Xfer *xfer ) DEBUG_CRASH(( "GameClient::xfer - Drawable TOC entry not found for '%s'", draw->getTemplate()->getName().str() )); throw SC_INVALID_DATA; - } // end if + } // xfer toc id entry xfer->xferUnsignedShort( &tocEntry->id ); @@ -1441,9 +1441,9 @@ void GameClient::xfer( Xfer *xfer ) // end data block xfer->endBlock(); - } // end for, draw + } - } // end if, save + } else { UnsignedShort tocID; @@ -1465,7 +1465,7 @@ void GameClient::xfer( Xfer *xfer ) DEBUG_CRASH(( "GameClient::xfer - No TOC entry match for id '%d'", tocID )); throw SC_INVALID_DATA; - } // end if + } // read data block size dataSize = xfer->beginBlock(); @@ -1480,7 +1480,7 @@ void GameClient::xfer( Xfer *xfer ) xfer->skip( dataSize ); continue; - } // end if + } // read the object ID this drawable is attached to (if any) xfer->xferObjectID( &objectID ); @@ -1501,7 +1501,7 @@ void GameClient::xfer( Xfer *xfer ) objectID, thingTemplate->getName().str() )); throw SC_INVALID_DATA; - } // end if + } // get the drawable from the object draw = object->getDrawable(); @@ -1512,7 +1512,7 @@ void GameClient::xfer( Xfer *xfer ) object->getTemplate()->getName().str(), object->getID() )); throw SC_INVALID_DATA; - } // end if + } // srj sez: some objects (eg, diguised bombtrucks) may have an "abnormal" drawable. so check. // @@ -1529,7 +1529,7 @@ void GameClient::xfer( Xfer *xfer ) TheGameLogic->bindObjectAndDrawable(object, draw); } - } // end if + } else { @@ -1547,9 +1547,9 @@ void GameClient::xfer( Xfer *xfer ) thingTemplate->getName().str() )); throw SC_INVALID_DATA; - } // end if + } - } // end else + } // xfer the drawable data xfer->xferSnapshot( draw ); @@ -1557,9 +1557,9 @@ void GameClient::xfer( Xfer *xfer ) // end block (not necessary since this is a no-op but symettrically nice) xfer->endBlock(); - } // end for, i + } - } // end else, load + } // xfer the in-game mission briefing history list if (version >= 2) @@ -1593,7 +1593,7 @@ void GameClient::xfer( Xfer *xfer ) } } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1611,7 +1611,7 @@ void GameClient::loadPostProcess( void ) if( draw->getID() >= m_nextDrawableID ) m_nextDrawableID = (DrawableID)((UnsignedInt)draw->getID() + 1); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -1619,4 +1619,4 @@ void GameClient::loadPostProcess( void ) void GameClient::crc( Xfer *xfer ) { -} // end crc +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClientDispatch.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClientDispatch.cpp index f102c9db736..31e2bacf0fa 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClientDispatch.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClientDispatch.cpp @@ -53,4 +53,4 @@ GameMessageDisposition GameClientMessageDispatcher::translateGameMessage(const G //((GameMessage *)msg)->getCommandAsString(), TheGameClient->getFrame())); return DESTROY_MESSAGE; -} // end clientMessageDispatcher +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp index e5b183298b2..c0b69ec7ee9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp @@ -104,7 +104,7 @@ void INI::parseLanguageDefinition( INI *ini ) { DEBUG_ASSERTCRASH(TheGlobalLanguageData, ("INI::parseLanguageDefinition - TheGlobalLanguage Data is not around, please create it before trying to parse the ini file.")); return; - } // end if + } // parse the ini weapon definition ini->initFromINI( TheGlobalLanguageData, TheGlobalLanguageDataFieldParseTable ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index a54d6876e9a..e2711b6e1d9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -344,7 +344,7 @@ Real SuperweaponInfo::getHeight() const void InGameUI::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -526,7 +526,7 @@ void InGameUI::xfer( Xfer *xfer ) void InGameUI::loadPostProcess( void ) { -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -964,7 +964,7 @@ InGameUI::InGameUI() m_moveHint[ i ].sourceID = 0; m_moveHint[ i ].frame = 0; - } // end for i + } for( i = 0; i < MAX_BUILD_PROGRESS; i++ ) { @@ -973,7 +973,7 @@ InGameUI::InGameUI() m_buildProgress[ i ].m_percentComplete = 0.0f; m_buildProgress[ i ].m_control = NULL; - } // end for i + } m_pendingGUICommand = NULL; @@ -1002,7 +1002,7 @@ InGameUI::InGameUI() m_uiMessages[ i ].timestamp = 0; m_uiMessages[ i ].color = 0; - } // end for i + } m_replayWindow = NULL; m_messagesOn = TRUE; @@ -1086,7 +1086,7 @@ InGameUI::InGameUI() m_soloNexusSelectedDrawableID = INVALID_DRAWABLE_ID; -} // end InGameUI +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1219,7 +1219,7 @@ void InGameUI::init( void ) setDrawRMBScrollAnchor(TheGlobalData->m_drawScrollAnchor); setMoveRMBScrollAnchor(TheGlobalData->m_moveScrollAnchor); -} // end init +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1425,7 +1425,7 @@ void InGameUI::evaluateSoloNexus( Drawable *newlyAddedDrawable ) return; } - } // end for + } } @@ -1477,9 +1477,9 @@ void InGameUI::handleBuildPlacements( void ) const Real snapRadians = DEG_TO_RADF(45); angle = WWMath::Round(angle / snapRadians) * snapRadians; } - } // end if + } - } // end if + } else { const MouseIO *mouseIO = TheMouse->getMouseStatus(); @@ -1487,7 +1487,7 @@ void InGameUI::handleBuildPlacements( void ) // location is the mouse position loc = mouseIO->pos; - } // end else + } // set the location and angle of the place icon /**@todo this whole orientation vector thing is LAME! Must replace, all I want to @@ -1538,7 +1538,7 @@ void InGameUI::handleBuildPlacements( void ) } else { TheTerrainVisual->removeFactionBibDrawable(m_placeIcon[0]); } - } // end if + } @@ -1587,7 +1587,7 @@ void InGameUI::handleBuildPlacements( void ) m_placeIcon[ i ] = TheThingFactory->newDrawable( m_pendingPlaceType, DRAWABLE_STATUS_NO_STATE_PARTICLES ); - } // end for i + } // // destroy any drawables that we're not using anymore because a previous @@ -1600,7 +1600,7 @@ void InGameUI::handleBuildPlacements( void ) TheGameClient->destroyDrawable( m_placeIcon[ i ] ); m_placeIcon[ i ] = NULL; - } // end for i + } // // march down each drawable and set the position based on its position in the @@ -1618,13 +1618,13 @@ void InGameUI::handleBuildPlacements( void ) // set the drawable angle m_placeIcon[ i ]->setOrientation( angle ); - } // end for i + } - } // end if + } - } // end if + } -} // end handleBuildPlacements +} //------------------------------------------------------------------------------------------------- /** Pre-draw phase of the in game ui */ @@ -1644,7 +1644,7 @@ void InGameUI::preDraw( void ) // draw world animations updateAndDrawWorldAnimations(); -} // end preDraw +} //------------------------------------------------------------------------------------------------- /** Update the in game user interface */ @@ -1717,9 +1717,9 @@ void InGameUI::update( void ) if( a == 0 ) removeMessageAtIndex( i ); - } // end if + } - } // end for i + } // // Update the Military Subtitle display @@ -1861,7 +1861,7 @@ void InGameUI::update( void ) GadgetStaticTextSetText( moneyWin, buffer ); lastMoney = currentMoney; - } // end if + } moneyWin->winHide(FALSE); powerWin->winHide(FALSE); } @@ -1913,7 +1913,7 @@ void InGameUI::update( void ) } -} // end update +} //------------------------------------------------------------------------------------------------- void InGameUI::registerWindowLayout( WindowLayout *layout ) @@ -2007,7 +2007,7 @@ void InGameUI::reset( void ) m_moveHint[ i ].sourceID = 0; m_moveHint[ i ].frame = 0; - } // end for i + } m_waypointMode = false; m_forceAttackMode = false; @@ -2021,7 +2021,7 @@ void InGameUI::reset( void ) m_tooltipsDisabledUntil = 0; UpdateDiplomacyBriefingText(AsciiString::TheEmptyString, TRUE); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Free any resources we used for our messages */ @@ -2045,9 +2045,9 @@ void InGameUI::freeMessageResources( void ) // set timestamp to zero m_uiMessages[ i ].timestamp = 0; - } // end for i + } -} // end freeMessageResources +} void InGameUI::freeCustomUiResources( void ) { @@ -2089,7 +2089,7 @@ void InGameUI::message( AsciiString stringManagerLabel, ... ) { DEBUG_CRASH(("InGameUI::message failed with code:%d", result)); } -} // end +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2130,7 +2130,7 @@ void InGameUI::message( UnicodeString format, ... ) { DEBUG_CRASH(("InGameUI::message failed with code:%d", result)); } -} // end message +} //------------------------------------------------------------------------------------------------- /** Interface for display text messages to the user */ @@ -2157,7 +2157,7 @@ void InGameUI::messageColor( const RGBColor *rgbColor, UnicodeString format, ... { DEBUG_CRASH(("InGameUI::messageColor failed with code:%d", result)); } -} // end message +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2205,7 +2205,7 @@ void InGameUI::addMessageText( const UnicodeString& formattedMessage, const RGBC else m_uiMessages[ 0 ].color = color2; -} // end addFormattedMessage +} //------------------------------------------------------------------------------------------------- /** Remove the message on screen at index i */ @@ -2219,7 +2219,7 @@ void InGameUI::removeMessageAtIndex( Int i ) m_uiMessages[ i ].displayString = NULL; m_uiMessages[ i ].timestamp = 0; -} // end removeMessageAtIndex +} //------------------------------------------------------------------------------------------------- /** An area selection is occurring, start graphical "hint". */ @@ -2981,11 +2981,11 @@ void InGameUI::setGUICommand( const CommandButton *command ) m_mouseMode = MOUSEMODE_DEFAULT; return; - } // end if + } m_mouseMode = MOUSEMODE_GUI_COMMAND; - } // end if + } else { m_mouseMode = MOUSEMODE_DEFAULT; @@ -3016,7 +3016,7 @@ void InGameUI::setGUICommand( const CommandButton *command ) m_mouseModeCursor = TheMouse->getMouseCursor(); -} // end setGUICommand +} //------------------------------------------------------------------------------------------------- /** Get the pending gui command */ @@ -3045,10 +3045,10 @@ void InGameUI::destroyPlacementIcons( void ) } m_placeIcon[ i ] = NULL; - } // end for i + } TheTerrainVisual->removeAllBibs(); -} // end destroyPlacementIcons +} //------------------------------------------------------------------------------------------------- /** User has clicked on a built item that requires placement in the world. We will @@ -3142,7 +3142,7 @@ void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildD DEBUG_ASSERTCRASH( m_placeIcon[ 0 ] == NULL, ("placeBuildAvailable, build icon array is not empty!") ); m_placeIcon[ 0 ] = draw; - } // end if + } else { if (m_mouseMode == MOUSEMODE_BUILD_PLACE) @@ -3168,11 +3168,11 @@ void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildD } } - } // end else + } - } // end if + } -} // end placeBuildAvailable +} //------------------------------------------------------------------------------------------------- /** Return the thing we're attempting to place */ @@ -3189,7 +3189,7 @@ ObjectID InGameUI::getPendingPlaceSourceObjectID( void ) return m_pendingPlaceSourceObjectID; -} // end getPendingPlaceSourceObjectID +} //------------------------------------------------------------------------------------------------- /** Start the angle selection interface for selecting building angles when placing them */ @@ -3205,11 +3205,11 @@ void InGameUI::setPlacementStart( const ICoord2D *start ) m_placeAnchorEnd = *start; m_placeAnchorInProgress = TRUE; - } // end if + } else m_placeAnchorInProgress = FALSE; -} // end setPlacementStart +} //------------------------------------------------------------------------------------------------- /** Set the end anchor for the angle build interface */ @@ -3220,7 +3220,7 @@ void InGameUI::setPlacementEnd( const ICoord2D *end ) if( end ) m_placeAnchorEnd = *end; -} // end setPlacementEnd +} //------------------------------------------------------------------------------------------------- /** Is the angle selection interface for placing building at angles up? */ @@ -3230,7 +3230,7 @@ Bool InGameUI::isPlacementAnchored( void ) return m_placeAnchorInProgress; -} // end isPlacementAnchored +} //------------------------------------------------------------------------------------------------- /** Get the start and end anchor points for the building angle selection interface */ @@ -3243,7 +3243,7 @@ void InGameUI::getPlacementPoints( ICoord2D *start, ICoord2D *end ) if( end ) *end = m_placeAnchorEnd; -} // end getPlacementPoints +} //------------------------------------------------------------------------------------------------- /** Return the angle of the drawable at the cursor if any */ @@ -3256,7 +3256,7 @@ Real InGameUI::getPlacementAngle( void ) return 0.0f; -} // end getPlacementAngle +} //------------------------------------------------------------------------------------------------- /** Mark given Drawable as "selected". */ @@ -3284,9 +3284,9 @@ void InGameUI::selectDrawable( Drawable *draw ) // the control needs to update its context sensitive display now TheControlBar->onDrawableSelected( draw ); - } // end if + } -} // end selectDrawable +} //------------------------------------------------------------------------------------------------- /** Clear "selected" status of Drawable. */ @@ -3323,9 +3323,9 @@ void InGameUI::deselectDrawable( Drawable *draw ) // the control needs to update its context sensitive display now TheControlBar->onDrawableDeselected( draw ); - } // end if + } -} // end deselectDrawable +} //------------------------------------------------------------------------------------------------- /** Clear all drawables' "select" status */ @@ -3344,7 +3344,7 @@ void InGameUI::deselectAllDrawables( Bool postMsg ) // do the deselection TheInGameUI->deselectDrawable( draw ); - } // end while + } // keep our list all tidy m_selectedDrawables.clear(); @@ -3405,7 +3405,7 @@ Drawable *InGameUI::getFirstSelectedDrawable( void ) return m_selectedDrawables.front(); -} // end getFirstSelectedDrawable +} //------------------------------------------------------------------------------------------------- /** Return true if the selected ID is in the drawable list */ @@ -3419,11 +3419,11 @@ Bool InGameUI::isDrawableSelected( DrawableID idToCheck ) const if( (*it)->getID() == idToCheck ) return TRUE; - } // end for + } return FALSE; -} // end isDrawableSelected +} //------------------------------------------------------------------------------------------------- /** Return true if all of the given objects are selected */ @@ -3438,7 +3438,7 @@ Bool InGameUI::areAllObjectsSelected(const std::vector& objectsToCheck) return TRUE; -} // end areAllObjectsSelected +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -3458,11 +3458,11 @@ Bool InGameUI::isAnySelectedKindOf( KindOfType kindOf ) const if( draw && draw->isKindOf( kindOf ) ) return TRUE; - } // end for, it + } return FALSE; // no selected objects are of the kind of type -} // end isAnySelectedKindOf +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -3482,11 +3482,11 @@ Bool InGameUI::isAllSelectedKindOf( KindOfType kindOf ) const if( draw && draw->isKindOf( kindOf ) == FALSE ) return FALSE; // not all objects are of the kind of type - } // end for, it + } return TRUE; // all objects have this kindof bit set in them -} // end isAllSelectedKindOf +} //------------------------------------------------------------------------------------------------- /** Set the input enabled/disabled */ @@ -3580,11 +3580,11 @@ void InGameUI::postDraw( void ) GameFont *font = m_uiMessages[ i ].displayString->getFont(); y += font->height; - } //end if + } - } // end for i + } - } // end if + } if( m_militarySubtitle ) { @@ -3932,7 +3932,7 @@ void InGameUI::postDraw( void ) //draw superweapon ready multipliers TheControlBar->drawSpecialPowerShortcutMultiplierText(); -} // end postDraw +} //------------------------------------------------------------------------------------------------- /** Expire a hint of the specified type with the corresponding hint index */ @@ -3950,7 +3950,7 @@ void InGameUI::expireHint( HintType type, UnsignedInt hintIndex ) m_moveHint[ hintIndex ].sourceID = 0; m_moveHint[ hintIndex ].frame = 0; - } // end if + } else { @@ -3958,9 +3958,9 @@ void InGameUI::expireHint( HintType type, UnsignedInt hintIndex ) DEBUG_CRASH(("undefined hint type")); return; - } // end else + } -} // end expireHint +} //------------------------------------------------------------------------------------------------- /** Create the control user interface GUI */ @@ -3977,7 +3977,7 @@ void InGameUI::createControlBar( void ) window->winHide( TRUE ); */ -} // end createControlBar +} //------------------------------------------------------------------------------------------------- /** Create the replay control GUI */ @@ -3994,7 +3994,7 @@ void InGameUI::createReplayControl( void ) window->winHide( TRUE ); */ -} // end createReplayControl +} // ------------------------------------------------------------------------------------------------ // InGameUI::playMovie @@ -4157,9 +4157,9 @@ void InGameUI::displayCantBuildMessage( LegalBuildCode lbc ) TheInGameUI->message( "GUI:CantBuildThere" ); break; - } // end switch + } -} // end displayCantBuildMessage +} // ------------------------------------------------------------------------------------------------ // InGameUI::militarySubtitle @@ -4368,7 +4368,7 @@ CanAttackResult InGameUI::getCanSelectedObjectsAttack( ActionType action, const } - } // end for + } if( count > 0 ) { @@ -4519,7 +4519,7 @@ Bool InGameUI::canSelectedObjectsDoAction( ActionType action, const Object *obje ++qualify; } - } // end for + } //If the rule is all must qualify, do the check now and return success //only if all the selected units qualified. @@ -5377,7 +5377,7 @@ WorldAnimationData::WorldAnimationData( void ) m_options = WORLD_ANIM_NO_OPTIONS; m_zRisePerSecond = 0.0f; -} // end WorldAnimationData +} // ------------------------------------------------------------------------------------------------ /** Add a 2D animation at a spot in the world */ @@ -5412,7 +5412,7 @@ void InGameUI::addWorldAnimation( Anim2DTemplate *animTemplate, // add to list m_worldAnimationList.push_front( wad ); -} // end addWorldAnimation +} // ------------------------------------------------------------------------------------------------ /** Delete all world animations */ @@ -5434,9 +5434,9 @@ void InGameUI::clearWorldAnimations( void ) it = m_worldAnimationList.erase( it ); - } // end for + } -} // end clearWorldAnimations +} static const UnsignedInt FRAMES_BEFORE_EXPIRE_TO_FADE = LOGICFRAMES_PER_SECOND * 1; // ------------------------------------------------------------------------------------------------ @@ -5471,13 +5471,13 @@ void InGameUI::updateAndDrawWorldAnimations( void ) it = m_worldAnimationList.erase( it ); continue; - } // end if + } // update the Z value if( wad->m_zRisePerSecond ) wad->m_worldPos.z += wad->m_zRisePerSecond / LOGICFRAMES_PER_SECOND; - } // end if + } // // don't bother going forward with the draw process if this location is shrouded for @@ -5490,7 +5490,7 @@ void InGameUI::updateAndDrawWorldAnimations( void ) ++it; continue; - } // end if + } // update translucency value if( BitIsSet( wad->m_options, WORLD_ANIM_FADE_ON_EXPIRE ) ) @@ -5505,9 +5505,9 @@ void InGameUI::updateAndDrawWorldAnimations( void ) Real alpha = INT_TO_REAL( framesTillExpire ) / INT_TO_REAL( FRAMES_BEFORE_EXPIRE_TO_FADE ); wad->m_anim->setAlpha( alpha ); - } // end if + } - } // end if + } // project the point to screen space ICoord2D screen; @@ -5528,14 +5528,14 @@ void InGameUI::updateAndDrawWorldAnimations( void ) // draw the animation wad->m_anim->draw( screen.x, screen.y, width, height ); - } // end if + } // go to the next element in the list ++it; - } // end for + } -} // end updateAndDrawWorldAnimations +} Object *InGameUI::findIdleWorker( Object *obj) @@ -5849,13 +5849,13 @@ WindowMsgHandledType IdleWorkerSystem( GameWindow *window, UnsignedInt msg, } break; - } // end button selected + } //--------------------------------------------------------------------------------------------- default: return MSG_IGNORED; - } // end switch( msg ) + } return MSG_HANDLED; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp index 32f28462328..5aa73b077da 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp @@ -66,20 +66,20 @@ void Keyboard::createStreamMessages( void ) msg = TheMessageStream->appendMessage( GameMessage::MSG_RAW_KEY_DOWN ); DEBUG_ASSERTCRASH( msg, ("Unable to append key down message to stream") ); - } // end if + } else if( BitIsSet( key->state, KEY_STATE_UP ) ) { msg = TheMessageStream->appendMessage( GameMessage::MSG_RAW_KEY_UP ); DEBUG_ASSERTCRASH( msg, ("Unable to append key up message to stream") ); - } // end else if + } else { DEBUG_CRASH(( "Unknown key state when creating msg stream" )); - } // end else + } // fill out message arguments if( msg ) @@ -91,9 +91,9 @@ void Keyboard::createStreamMessages( void ) // next key please key++; - } // end while + } -} // end createStreamMessages +} //------------------------------------------------------------------------------------------------- /** update all our key state data */ @@ -122,7 +122,7 @@ void Keyboard::updateKeys( void ) resetKeys(); index = 0; - } // end if + } } while( m_keys[ index ].key == KEY_LOST ); @@ -166,11 +166,11 @@ void Keyboard::updateKeys( void ) // translateKey( m_keys[ index ].key ); - } // end else if + } index++; - } // end while + } // check for key repeats checkKeyRepeat(); @@ -187,11 +187,11 @@ void Keyboard::updateKeys( void ) // next key index++; - } // end while + } - } // end if + } -} // end updateKeys +} //------------------------------------------------------------------------------------------------- /** check key repeat sequences, TRUE is returned if repeat is occurring */ @@ -239,15 +239,15 @@ Bool Keyboard::checkKeyRepeat( void ) retVal = TRUE; break; // exit for key - } // end if + } - } // end if, key down + } - } // end for key + } return retVal; -} // end checkKeyRepeat +} //------------------------------------------------------------------------------------------------- /** Initialize the keyboard key-names array */ @@ -268,7 +268,7 @@ void Keyboard::initKeyNames( void ) m_keyNames[ i ].shifted = L'\0'; m_keyNames[ i ].shifted2 = L'\0'; - } // end for i + } m_shift2Key = KEY_NONE; @@ -674,9 +674,9 @@ void Keyboard::initKeyNames( void ) m_shift2Key = KEY_RALT; break; - } // end switch( Language ) + } -} // end initKeyNames +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC PROTOTYPES ////////////////////////////////////////////////////////////////////////////// @@ -695,14 +695,14 @@ Keyboard::Keyboard( void ) memset( m_keyNames, 0, sizeof( m_keyNames ) ); m_inputFrame = 0; -} // end Keyboard +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- Keyboard::~Keyboard( void ) { -} // end ~Keyboard +} //------------------------------------------------------------------------------------------------- /** Initialzie the keyboard */ @@ -716,7 +716,7 @@ void Keyboard::init( void ) // first input frame m_inputFrame = 0; -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset keyboard system */ @@ -724,7 +724,7 @@ void Keyboard::init( void ) void Keyboard::reset( void ) { -} // end reset +} //------------------------------------------------------------------------------------------------- /** Called once per frame to gather key data input */ @@ -738,7 +738,7 @@ void Keyboard::update( void ) // update the key data updateKeys(); -} // end update +} //------------------------------------------------------------------------------------------------- /** Reset the state data for the keys, we likely want to do this when @@ -755,7 +755,7 @@ void Keyboard::resetKeys( void ) m_modifiers |= KEY_STATE_CAPSLOCK; } -} // end resetKeys +} //------------------------------------------------------------------------------------------------- /** get the first key in our current state of the keyboard */ @@ -763,7 +763,7 @@ void Keyboard::resetKeys( void ) KeyboardIO *Keyboard::getFirstKey( void ) { return &m_keys[ 0 ]; -} // end getFirstKey +} //------------------------------------------------------------------------------------------------- /** return the key status for the specified key */ @@ -771,7 +771,7 @@ KeyboardIO *Keyboard::getFirstKey( void ) UnsignedByte Keyboard::getKeyStatusData( UnsignedByte key ) { return m_keyStatus[ key ].status; -} // end getKeyStatusData +} //------------------------------------------------------------------------------------------------- /** Get the key state data as a Bool for the specified key */ @@ -779,7 +779,7 @@ UnsignedByte Keyboard::getKeyStatusData( UnsignedByte key ) Bool Keyboard::getKeyStateBit( UnsignedByte key, Int bit ) { return (m_keyStatus[ key ].state & bit) ? 1 : 0; -} // end getKeyStateBit +} //------------------------------------------------------------------------------------------------- /** return the sequence data for the given key */ @@ -787,7 +787,7 @@ Bool Keyboard::getKeyStateBit( UnsignedByte key, Int bit ) UnsignedInt Keyboard::getKeySequenceData( UnsignedByte key ) { return m_keyStatus[ key ].sequence; -} // end getKeySequenceData +} //------------------------------------------------------------------------------------------------- /** set the key status data */ @@ -795,7 +795,7 @@ UnsignedInt Keyboard::getKeySequenceData( UnsignedByte key ) void Keyboard::setKeyStatusData( UnsignedByte key, KeyboardIO::StatusType data ) { m_keyStatus[ key ].status = data; -} // end setKeyStatusData +} //------------------------------------------------------------------------------------------------- /** set the key state data */ @@ -803,7 +803,7 @@ void Keyboard::setKeyStatusData( UnsignedByte key, KeyboardIO::StatusType data ) void Keyboard::setKeyStateData( UnsignedByte key, UnsignedByte data ) { m_keyStatus[ key ].state = data; -} // end setKeyStateData +} //------------------------------------------------------------------------------------------------- /** This routine must be called with every character to @@ -933,8 +933,8 @@ WideChar Keyboard::translateKey( WideChar keyCode ) } return( m_keyNames[ubKeyCode ].stdKey ); - } // end switch( ubKeyCode ) -} // end translateKey + } +} //------------------------------------------------------------------------------------------------- /** returns true if any shift state is pressed */ @@ -946,7 +946,7 @@ Bool Keyboard::isShift() return TRUE; } return FALSE; -} // end isShift() +} //------------------------------------------------------------------------------------------------- /** returns true if any control state is pressed */ @@ -958,7 +958,7 @@ Bool Keyboard::isCtrl() return TRUE; } return FALSE; -} // end isCtrl() +} //------------------------------------------------------------------------------------------------- /** returns true if any shift state is pressed */ @@ -970,7 +970,7 @@ Bool Keyboard::isAlt() return TRUE; } return FALSE; -} // end isAlt() +} WideChar Keyboard::getPrintableKey( UnsignedByte key, Int state ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp index 49c0fb54cd6..6c88f78929e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp @@ -152,7 +152,7 @@ void Mouse::moveMouse( Int x, Int y, Int relOrAbs ) else if( m_currMouse.pos.y < m_minY ) m_currMouse.pos.y = m_minY; -} // end moveMouse +} //------------------------------------------------------------------------------------------------- /** Get the current information for the mouse from the device */ @@ -184,7 +184,7 @@ void Mouse::updateMouseData( ) busy = FALSE; - } // end if + } if( index > 0 ) m_eventsThisFrame = index - 1; @@ -194,7 +194,7 @@ void Mouse::updateMouseData( ) if( index != 0 ) m_deadInputFrame = m_inputFrame; -} // end updateMouseData +} //------------------------------------------------------------------------------------------------- /** Combine mouse events into the main mouse variables */ @@ -369,7 +369,7 @@ void Mouse::processMouseEvent( Int index ) m_prevMouse = m_currMouse; -} // end processMouseEvent +} //------------------------------------------------------------------------------------------------- /** Check for mouse drag */ @@ -398,7 +398,7 @@ void Mouse::checkForDrag( void ) m_currMouse.middleEvent = GWM_MIDDLE_DRAG; } -} // end checkForDrag +} //------------------------------------------------------------------------------------------------- @@ -555,7 +555,7 @@ Mouse::Mouse( void ) m_captureBlockReasonBits = (1 << CursorCaptureBlockReason_NoInit) | (1 << CursorCaptureBlockReason_NoGame); DEBUG_LOG(("Mouse::Mouse: m_blockCaptureReason=CursorCaptureBlockReason_NoInit|CursorCaptureBlockReason_NoGame")); -} // end Mouse +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -569,7 +569,7 @@ Mouse::~Mouse( void ) TheDisplayStringManager->freeDisplayString( m_cursorTextDisplayString ); m_cursorTextDisplayString = NULL; -} // end ~Mouse +} /**Had to move this out of main init() because I need this data to properly initialize the Win32 version of the mouse (by preloading resources before D3D device is created).*/ @@ -618,7 +618,7 @@ void Mouse::init( void ) initCapture(); -} // end init +} //------------------------------------------------------------------------------------------------- /** Tell mouse system display resolution changed. */ @@ -648,7 +648,7 @@ void Mouse::mouseNotifyResolutionChange( void ) m_tooltipDisplayString->setWordWrap(120); -} // end reset +} //------------------------------------------------------------------------------------------------- void Mouse::onGameModeChanged(GameMode prev, GameMode next) @@ -693,7 +693,7 @@ void Mouse::reset( void ) blockCapture(CursorCaptureBlockReason_NoInit); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update the states of the mouse position and buttons */ @@ -707,7 +707,7 @@ void Mouse::update( void ) // update the mouse data updateMouseData( ); -} // end update +} //------------------------------------------------------------------------------------------------- /** Given the current state of this input device, turn the raw input @@ -795,7 +795,7 @@ void Mouse::createStreamMessages( void ) msg->appendIntegerArgument( TheKeyboard->getModifierFlags() ); break; - } // end switch + } msg = NULL; switch( m_currMouse.middleEvent ) @@ -830,7 +830,7 @@ void Mouse::createStreamMessages( void ) msg->appendIntegerArgument( TheKeyboard->getModifierFlags() ); break; - } // end switch + } msg = NULL; switch( m_currMouse.rightEvent ) @@ -865,7 +865,7 @@ void Mouse::createStreamMessages( void ) msg->appendIntegerArgument( TheKeyboard->getModifierFlags() ); break; - } // end switch + } // wheel pos msg = NULL; @@ -875,10 +875,10 @@ void Mouse::createStreamMessages( void ) msg->appendPixelArgument( m_currMouse.pos ); msg->appendIntegerArgument( m_currMouse.wheelPos / 120 ); // wheel delta msg->appendIntegerArgument( TheKeyboard->getModifierFlags() ); - } // end if + } - } // end for -} // end createStreamMessages + } +} //------------------------------------------------------------------------------------------------- /** Set the string to display at the cursor for the tooltip */ @@ -955,7 +955,7 @@ void Mouse::setCursorTooltip( UnicodeString tooltip, Int delay, const RGBColor * m_tooltipBackColor = m_tooltipColorBackground; } -} // end setCursorTooltip +} // ------------------------------------------------------------------------------------------------ /** Set the text for the mouse cursor ... note that this is *NOT* the tooltip text we @@ -979,7 +979,7 @@ void Mouse::setMouseText( UnicodeString text, if( dropColor ) m_cursorTextDropColor = *dropColor; -} // end setMouseText +} //------------------------------------------------------------------------------------------------- /** Move the mouse to the position */ @@ -990,7 +990,7 @@ void Mouse::setPosition( Int x, Int y ) m_currMouse.pos.x = x; m_currMouse.pos.y = y; -} // end setPosition +} //------------------------------------------------------------------------------------------------- /** This default implementation of SetMouseLimits will just set the limiting @@ -1013,9 +1013,9 @@ void Mouse::setMouseLimits( void ) m_maxX = TheDisplay->getWidth(); m_maxY = TheDisplay->getHeight(); - } // end if + } -} // end setMouseLimits +} // ------------------------------------------------------------------------------------------------ void Mouse::setCursorCaptureMode(CursorCaptureMode mode) @@ -1207,10 +1207,10 @@ void Mouse::drawTooltip( void ) UnsignedInt now = timeGetTime(); m_highlightPos = (width*(now-m_highlightUpdateStart))/m_tooltipFillTime; } - } // end if + } -} // end drawTooltip +} // ------------------------------------------------------------------------------------------------ /** Draw the cursor text at the mouse position. Note that this is *NOT* the tooltip text */ @@ -1243,7 +1243,7 @@ void Mouse::drawCursorText( void ) y = m_currMouse.pos.y - height / 2; m_cursorTextDisplayString->draw( x, y, color, dropColor ); -} // end drawCursorText +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1348,9 +1348,9 @@ void Mouse::setCursor( MouseCursor cursor ) else setMouseText( UnicodeString( L"" ), NULL, NULL ); - } // end if + } -} // end setCursor +} //------------------------------------------------------------------------------------------------- /** Parse MouseCursor entry */ diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Line2D.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Line2D.cpp index 9f703ab63fa..97ae6059942 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Line2D.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Line2D.cpp @@ -128,7 +128,7 @@ Bool ClipLine2D( ICoord2D *p1, ICoord2D *p2, ICoord2D *c1, ICoord2D *c2, *c2 = *p2; return TRUE; - } // end if + } // Both points outside window? if (clipCode1 & clipCode2) @@ -224,7 +224,7 @@ Bool ClipLine2D( ICoord2D *p1, ICoord2D *p2, ICoord2D *c1, ICoord2D *c2, x2 >= clipLeft && x2 <= clipRight && y2 >= clipTop && y2 <= clipBottom); -} // end ClipLine2D +} // This solution uses the diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp index dfce46a46bc..5f4c3285bcf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp @@ -976,7 +976,7 @@ typedef MapDisplayToFileNameList::iterator MapDisplayToFileNameListIter; } return selectionIndex; -} // end loadMapListbox +} //------------------------------------------------------------------------------------------------- /** Load the listbox with all the map files available to play */ @@ -1017,7 +1017,7 @@ Bool isValidMap( AsciiString mapName, Bool isMultiplayer ) } return FALSE; -} // end isValidMap +} //------------------------------------------------------------------------------------------------- /** Find a valid map */ @@ -1095,7 +1095,7 @@ static void copyFromBigToDir( const AsciiString& infile, const AsciiString& outf { DEBUG_CRASH(( "copyFromBigToDir - Error opening source file '%s'", infile.str() )); throw SC_INVALID_DATA; - } // end if + } // how big is the map file Int fileSize = file->seek( 0, File::END ); @@ -1110,14 +1110,14 @@ static void copyFromBigToDir( const AsciiString& infile, const AsciiString& outf { DEBUG_CRASH(( "copyFromBigToDir - Unable to allocate buffer for file '%s'", infile.str() )); throw SC_INVALID_DATA; - } // end if + } // copy the file to the buffer if( file->read( buffer, fileSize ) < fileSize ) { DEBUG_CRASH(( "copyFromBigToDir - Error reading from file '%s'", infile.str() )); throw SC_INVALID_DATA; - } // end if + } // close the BIG file file->close(); @@ -1127,13 +1127,13 @@ static void copyFromBigToDir( const AsciiString& infile, const AsciiString& outf { DEBUG_CRASH(( "copyFromBigToDir - Error writing to file '%s'", outfile.str() )); throw SC_INVALID_DATA; - } // end if + } filenew->close(); // delete the buffer delete [] buffer; -} // end embedPristineMap +} Image *getMapPreviewImage( AsciiString mapName ) { @@ -1344,5 +1344,5 @@ void findDrawPositions( Int startX, Int startY, Int width, Int height, Region3D lr->x += startX; lr->y += startY; -} // end findDrawPositions +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 545fc87835e..a6b9e2d19d9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -358,7 +358,7 @@ static CanAttackResult canObjectForceAttack( Object *obj, const Object *victim, } } - } // end if spawnsRweapons + } return result; @@ -831,7 +831,7 @@ void pickAndPlayUnitVoiceResponse( const DrawableList *list, GameMessage::Type m break; } - }//next drawable in list + } @@ -1043,7 +1043,7 @@ GameMessage::Type CommandTranslator::issueMoveToLocationCommand( const Coord3D * else movemsg->appendLocationArgument( *pos ); - } // end if + } } // only make sounds if we really did the command messages @@ -1052,7 +1052,7 @@ GameMessage::Type CommandTranslator::issueMoveToLocationCommand( const Coord3D * PickAndPlayInfo info; info.m_drawTarget = drawableInWay; pickAndPlayUnitVoiceResponse( TheInGameUI->getAllSelectedDrawables(), GameMessage::MSG_DO_MOVETO, &info ); - } // end if + } if(TheStatsCollector) TheStatsCollector->incrementMoveCount(); @@ -1088,7 +1088,7 @@ GameMessage::Type CommandTranslator::createAttackMessage( Drawable *draw, attackmsg->appendObjectIDArgument( other->getObject()->getID() ); // must pass object IDs to logic - } // end if + } // return the message type created return msgType; @@ -1147,7 +1147,7 @@ GameMessage::Type CommandTranslator::issueAttackCommand( Drawable *target, // if we have a stats collector, inrement the stats if(TheStatsCollector) TheStatsCollector->incrementAttackCount(); - } // end if + } } else { @@ -1172,7 +1172,7 @@ GameMessage::Type CommandTranslator::issueAttackCommand( Drawable *target, info.m_air = targetObj->isUsingAirborneLocomotor(); info.m_drawTarget = target; pickAndPlayUnitVoiceResponse( TheInGameUI->getAllSelectedDrawables(), msgType, &info ); - } // end if + } // return the actual message type created return msgType; @@ -1444,7 +1444,7 @@ GameMessage::Type CommandTranslator::createEnterMessage( Drawable *enter, enterMsg->appendObjectIDArgument( INVALID_ID ); // 0 means current "selection team" of this player enterMsg->appendObjectIDArgument( enter->getObject()->getID() ); - } // end if + } else { DEBUG_CRASH(("Shouldn't get here. jkmcd")); @@ -1453,7 +1453,7 @@ GameMessage::Type CommandTranslator::createEnterMessage( Drawable *enter, // return the type of the message used return msgType; -} // end createEnterMessage +} //==================================================================================== CommandTranslator::CommandTranslator() : @@ -1582,7 +1582,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, //a position interaction. draw = NULL; obj = NULL; - } // end if + } // If the thing is a mine, and is locally controlled, then we should issue a moveto to its location. if (obj && obj->isLocallyControlled() && obj->isKindOf(KINDOF_MINE)) { @@ -1798,7 +1798,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage->appendObjectIDArgument( objectID ); } - } // if a special power + } else if( command && (command->getCommandType() == GUI_COMMAND_SPECIAL_POWER_CONSTRUCT || command->getCommandType() == GUI_COMMAND_SPECIAL_POWER_CONSTRUCT_FROM_SHORTCUT) ) { @@ -1841,9 +1841,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, gameMsg->appendIntegerArgument( SPECIAL_INVALID ); gameMsg->appendObjectIDArgument( INVALID_ID ); // no specific source - } // end if + } - } // end if + } else { @@ -1851,7 +1851,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, msgType = GameMessage::MSG_DO_SPECIAL_POWER_OVERRIDE_DESTINATION_HINT; hintMessage = TheMessageStream->appendMessage( msgType ); - } // end else + } } // ******************************************************************************************** @@ -1872,9 +1872,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, pickAndPlayUnitVoiceResponse( TheInGameUI->getAllSelectedDrawables(), GameMessage::MSG_RESUME_CONSTRUCTION ); - } // end if + } - } // end if + } else { @@ -1883,9 +1883,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendObjectIDArgument( obj->getID() ); - } // end else + } - } // end else if + } // ******************************************************************************************** else if( draw && !TheInGameUI->isInForceAttackMode() && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_DOCK_AT, @@ -1910,7 +1910,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, // only make sounds if we really did the command messages pickAndPlayUnitVoiceResponse(TheInGameUI->getAllSelectedDrawables(), GameMessage::MSG_DOCK); - } // end if + } } else @@ -1942,9 +1942,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, pickAndPlayUnitVoiceResponse( TheInGameUI->getAllSelectedDrawables(), GameMessage::MSG_DO_REPAIR ); - } // end if + } - } // end if + } else { @@ -1953,9 +1953,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendObjectIDArgument( obj->getID() ); - } // end else + } - } // end else if + } // ******************************************************************************************** else if( draw && !TheInGameUI->isInForceAttackMode() && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_GET_REPAIRED_AT, obj, InGameUI::SELECTION_ANY ) ) @@ -1976,9 +1976,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, pickAndPlayUnitVoiceResponse( TheInGameUI->getAllSelectedDrawables(), GameMessage::MSG_GET_REPAIRED ); - } // end if + } - } // end if + } else { @@ -1987,9 +1987,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendObjectIDArgument( obj->getID() ); - } // end else + } - } // end else if + } // ******************************************************************************************** else if( draw && !TheInGameUI->isInForceAttackMode() && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_GET_HEALED_AT, obj, InGameUI::SELECTION_ANY ) ) @@ -2008,9 +2008,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, pickAndPlayUnitVoiceResponse( TheInGameUI->getAllSelectedDrawables(), GameMessage::MSG_GET_HEALED ); - } // end if + } - } // end if + } else { @@ -2019,9 +2019,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage = TheMessageStream->appendMessage( msgType); hintMessage->appendObjectIDArgument( obj->getID() ); - } // end else + } - } // end else if + } // ******************************************************************************************** else if( draw && draw->getObject() && !TheInGameUI->isInForceAttackMode() && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_HIJACK_VEHICLE, @@ -2036,7 +2036,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, // I must add a test to keep him from actually entering an enemy vehicle (contained)... Lorenzen msgType = createEnterMessage( draw, type ); - } // end if + } else { @@ -2044,9 +2044,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendObjectIDArgument( draw->getObject()->getID() ); - } // end else + } - } // end else if + } // ******************************************************************************************** else if( draw && !TheInGameUI->isInForceAttackMode() && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_CONVERT_OBJECT_TO_CARBOMB, obj, InGameUI::SELECTION_ANY ) ) @@ -2058,7 +2058,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, // issue the command (convert to carbomb is nearly identical to enter) msgType = createEnterMessage( draw, type ); - } // end if + } else { @@ -2066,7 +2066,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendObjectIDArgument( obj->getID() ); - } // end else + } } // ******************************************************************************************** else if( draw && draw->getObject() && !TheInGameUI->isInForceAttackMode() && @@ -2078,15 +2078,15 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, if( type == DO_COMMAND || type == EVALUATE_ONLY ) { msgType = createEnterMessage( draw, type ); - } // end if + } else { msgType = GameMessage::MSG_SABOTAGE_HINT; hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendObjectIDArgument( draw->getObject()->getID() ); - } // end else + } - } // end else if + } // ******************************************************************************************** else if( draw && !TheInGameUI->isInForceAttackMode() && canSelectionSalvage(obj) ) { @@ -2106,7 +2106,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, msg->appendLocationArgument(*obj->getPosition()); } - } // end else if + } // ******************************************************************************************** else if( draw && !TheInGameUI->isInForceAttackMode() && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_ENTER_OBJECT, obj, InGameUI::SELECTION_ANY, true ) ) @@ -2118,16 +2118,16 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, // issue the command msgType = createEnterMessage( draw, type ); - } // end if + } else { msgType = GameMessage::MSG_ENTER_HINT; hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendObjectIDArgument( obj->getID() ); - } // end else + } - } // end else if + } // ******************************************************************************************** else if( draw && (result = TheInGameUI->getCanSelectedObjectsAttack( InGameUI::ACTIONTYPE_ATTACK_OBJECT, obj, InGameUI::SELECTION_ANY, TheInGameUI->isInForceAttackMode() )) == ATTACKRESULT_POSSIBLE ) { @@ -2138,7 +2138,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, // issue the attack order msgType = issueAttackCommand( draw, type ); - } // end if + } else { @@ -2147,9 +2147,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendObjectIDArgument( obj->getID() ); - } // end else + } - } // end else if + } // ******************************************************************************************** else if( draw && result == ATTACKRESULT_POSSIBLE_AFTER_MOVING ) { @@ -2159,7 +2159,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, // issue the attack order msgType = issueAttackCommand( draw, type ); - } // end if + } else { @@ -2168,7 +2168,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendObjectIDArgument( obj->getID() ); - } // end else + } } // ******************************************************************************************** @@ -2215,7 +2215,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, } } } - } // end else if + } // ******************************************************************************************** else if( draw && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_DISABLE_VEHICLE_VIA_HACKING, obj, InGameUI::SELECTION_ANY ) ) { @@ -2251,7 +2251,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage->appendObjectIDArgument( obj->getID() ); } - } // end else if + } // ******************************************************************************************** else if( draw && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_STEAL_CASH_VIA_HACKING, obj, InGameUI::SELECTION_ANY ) ) { @@ -2279,7 +2279,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, } } } - } // end if + } else { msgType = GameMessage::MSG_HACK_HINT; @@ -2287,7 +2287,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage->appendObjectIDArgument( obj->getID() ); } - } // end else if + } // ******************************************************************************************** else if( draw && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_DISABLE_BUILDING_VIA_HACKING, obj, InGameUI::SELECTION_ANY ) ) { @@ -2315,14 +2315,14 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, } } } - } // end if + } else { msgType = GameMessage::MSG_HACK_HINT; hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendObjectIDArgument( obj->getID() ); } - } // end else if + } #ifdef ALLOW_SURRENDER // ******************************************************************************************** else if( draw && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_PICK_UP_PRISONER, obj, InGameUI::SELECTION_ANY ) ) @@ -2334,7 +2334,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, // issue the command msgType = issueAttackCommand( draw, type, GUICOMMANDMODE_PICK_UP_PRISONER ); - } // end if + } else { @@ -2342,9 +2342,9 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendObjectIDArgument( obj->getID() ); - } // end else + } - } // end else if + } #endif // ******************************************************************************************** else if ( !draw && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_SET_RALLY_POINT, NULL, InGameUI::SELECTION_ALL, FALSE )) @@ -2375,7 +2375,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, msgType = GameMessage::MSG_IMPOSSIBLE_ATTACK_HINT; hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendLocationArgument( *pos ); - } // end else if + } // ******************************************************************************************** else @@ -2439,7 +2439,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, if ( draw == NULL ) msgType = issueMoveToLocationCommand( pos, drawableInWay, type ); - } // end if + } else { if( !validQuickPath ) @@ -2465,16 +2465,16 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, hintMessage = TheMessageStream->appendMessage( msgType ); hintMessage->appendLocationArgument( *pos ); - } // end else + } - } // end else + } - } // end if + } // return the message type return msgType; -} // end evaluateContextCommand +} // ------------------------------------------------------------------------------------------------ @@ -2737,7 +2737,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage disp = DESTROY_MESSAGE; break; - } // end select previous unit + } //----------------------------------------------------------------------------------------- case GameMessage::MSG_META_SELECT_NEXT_WORKER: @@ -2847,7 +2847,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage disp = DESTROY_MESSAGE; break; - } // end select next worker + } //----------------------------------------------------------------------------------------- case GameMessage::MSG_META_SELECT_PREV_WORKER: @@ -2965,7 +2965,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage disp = DESTROY_MESSAGE; break; - } // end select previous worker + } //----------------------------------------------------------------------------------------- case GameMessage::MSG_META_SELECT_NEXT_IDLE_WORKER: @@ -3032,12 +3032,12 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if( TheRadar->getLastEventLoc( &lastEvent ) ) TheTacticalView->lookAt( &lastEvent ); - } // end if + } disp = DESTROY_MESSAGE; break; - } // end view last radar event + } //----------------------------------------------------------------------------------------- case GameMessage::MSG_META_SELECT_ALL: @@ -3141,7 +3141,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage break; */ - } // end select all + } //----------------------------------------------------------------------------------------- case GameMessage::MSG_META_SCATTER: @@ -3445,7 +3445,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage : TheGameText->FETCH_OR_SUBSTITUTE("GUI:FF_OFF", L"Fast Forward is off") ); } - } // end if + } disp = DESTROY_MESSAGE; break; @@ -3523,13 +3523,13 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage else TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugSpecialPowerDelaysOff", L"Special Power (Superweapon) Delay is OFF") ); - } // end if + } disp = DESTROY_MESSAGE; } break; - } // end toggle special power delays + } //-------------------------------------------------------------------------------------- case GameMessage::MSG_CHEAT_SWITCH_TEAMS: { @@ -3668,7 +3668,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } break; - } // end clear message text + } #endif @@ -3871,7 +3871,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage // Do not eat this message, as it will do something itself at HintSpy break; - } // end case GameMessage::MSG_MOUSEOVER_LOCATION_HINT + } //----------------------------------------------------------------------------- case GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_DOWN: @@ -3953,7 +3953,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage Drawable *draw = TheTacticalView->pickDrawable(&msg->getArgument(0)->pixelRegion.lo, TheInGameUI->isInForceAttackMode(), (PickType) pickType); - + // TheSuperHackers @bugfix Stubbjax 07/08/2025 Prevent dead units blocking positional context commands Object* obj = draw ? draw->getObject() : NULL; if (!obj || (obj->isEffectivelyDead() && !obj->isKindOf(KINDOF_ALWAYS_SELECTABLE))) @@ -4032,7 +4032,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage Drawable *draw = TheTacticalView->pickDrawable(&msg->getArgument(0)->pixelRegion.lo, TheInGameUI->isInForceAttackMode(), (PickType) pickType); - + // TheSuperHackers @bugfix Stubbjax 07/08/2025 Prevent dead units blocking positional context commands Object* obj = draw ? draw->getObject() : NULL; if (!obj || (obj->isEffectivelyDead() && !obj->isKindOf(KINDOF_ALWAYS_SELECTABLE))) @@ -4053,7 +4053,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } break; - } // end case GameMessage::MSG_MOUSE_LEFT_CLICK + } @@ -4281,7 +4281,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage disp = DESTROY_MESSAGE; break; - } // end clear message text + } //------------------------------------------------------------------------------- DEMO MESSAGES //----------------------------------------------------------------------------------------- @@ -5288,7 +5288,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage else TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugCameraZoomLimitOff", L"Camera Zoom Limit is OFF") ); - } // end if + } disp = DESTROY_MESSAGE; break; @@ -5310,12 +5310,12 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage else TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugSpecialPowerDelaysOff", L"Special Power (Superweapon) Delay is OFF") ); - } // end if + } disp = DESTROY_MESSAGE; break; - } // end toggle special power delays + } #ifdef ALLOW_SURRENDER //------------------------------------------------------------------------------- DEMO MESSAGES @@ -5556,12 +5556,12 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage #endif // DUMP_PERF_STATS - } // end switch( msg->type ) + } return disp; -} // end CommandTranslator +} static Bool isSystemMessage( const GameMessage *msg ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/GUICommandTranslator.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/GUICommandTranslator.cpp index 5eb5297699d..6ca366293ae 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/GUICommandTranslator.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/GUICommandTranslator.cpp @@ -100,12 +100,12 @@ static Object *validUnderCursor( const ICoord2D *mouse, const CommandButton *com if (!command->isValidObjectTarget(player, pickObj)) pickObj = NULL; - } // end if + } return pickObj; -} // end validUnderCursor +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -132,7 +132,7 @@ static CommandStatus doFireWeaponCommand( const CommandButton *command, const IC // get object id sourceID = draw->getObject()->getID(); - } // end if + } // create message and send to the logic GameMessage *msg; @@ -155,7 +155,7 @@ static CommandStatus doFireWeaponCommand( const CommandButton *command, const IC msg->appendObjectIDArgument( targetID ); - } // end if + } else if( BitIsSet( command->getOptions(), COMMAND_OPTION_NEED_OBJECT_TARGET ) ) { @@ -180,9 +180,9 @@ static CommandStatus doFireWeaponCommand( const CommandButton *command, const IC msg->appendObjectIDArgument( target->getID() ); msg->appendIntegerArgument( command->getMaxShotsToFire() ); - } // end if + } - } // end else + } else { msg = TheMessageStream->appendMessage( GameMessage::MSG_DO_WEAPON ); @@ -195,11 +195,11 @@ static CommandStatus doFireWeaponCommand( const CommandButton *command, const IC // command->m_name.str()) ); //return COMMAND_COMPLETE; - } // end else + } return COMMAND_COMPLETE; -} // end fire weapon +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -325,7 +325,7 @@ static CommandStatus doSetRallyPointCommand( const CommandButton *command, const return COMMAND_COMPLETE; -} // end doSetRallyPointCommand +} //------------------------------------------------------------------------------------------------- /** Do the beacon placement command */ @@ -347,7 +347,7 @@ static CommandStatus doPlaceBeacon( const CommandButton *command, const ICoord2D return COMMAND_COMPLETE; -} // end doPlaceBeacon +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -378,7 +378,7 @@ GameMessageDisposition GUICommandTranslator::translateGameMessage(const GameMess break; - } // end left mouse down + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_MOUSE_LEFT_DOUBLE_CLICK: @@ -405,7 +405,7 @@ GameMessageDisposition GUICommandTranslator::translateGameMessage(const GameMess pickAndPlayUnitVoiceResponse( TheInGameUI->getAllSelectedDrawables(), GameMessage::MSG_DO_WEAPON_AT_LOCATION, &info ); break; - } // end fire weapon command + } //--------------------------------------------------------------------------------------- @@ -456,7 +456,7 @@ GameMessageDisposition GUICommandTranslator::translateGameMessage(const GameMess return KEEP_MESSAGE; break; - } // end special power + } case GUI_COMMAND_ATTACK_MOVE: { @@ -470,7 +470,7 @@ GameMessageDisposition GUICommandTranslator::translateGameMessage(const GameMess commandStatus = doSetRallyPointCommand( command, &mouse ); break; - } // end set rally point + } //--------------------------------------------------------------------------------------- case GUICOMMANDMODE_PLACE_BEACON: @@ -478,9 +478,9 @@ GameMessageDisposition GUICommandTranslator::translateGameMessage(const GameMess commandStatus = doPlaceBeacon( command, &mouse ); break; - } // end set rally point + } - } // end switch + } // used the input disp = DESTROY_MESSAGE; @@ -491,13 +491,13 @@ GameMessageDisposition GUICommandTranslator::translateGameMessage(const GameMess TheInGameUI->setPreventLeftClickDeselectionInAlternateMouseModeForOneClick( TRUE ); TheInGameUI->setGUICommand( NULL ); } - } // end if + } break; - } // end left mouse up + } - } // end switch + } // If we're destroying the message, it means we used it. Therefore, destroy the current // attack move instruction as well. @@ -507,6 +507,6 @@ GameMessageDisposition GUICommandTranslator::translateGameMessage(const GameMess return disp; -} // end translateMessage +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp index c584a0eef0f..1497d2ffdbd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp @@ -183,7 +183,7 @@ Bool HotKeyManager::executeHotKey( const AsciiString& keyIn ) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } return TRUE; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index 59d73005c19..459b694a27e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -710,24 +710,24 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage done = true; break; } - } // if airborne found + } // if we're back to the first, quit if (d == first) break; - } // while - } // end plane lock + } + } disp = DESTROY_MESSAGE; break; } #endif // #if defined(RTS_DEBUG) - } // end switch + } return disp; -} // end LookAtTranslator +} void LookAtTranslator::resetModes() { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp index c7bba8ea455..34508b20aa6 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp @@ -93,7 +93,7 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess TheInGameUI->placeBuildAvailable( NULL, NULL ); break; - } // end if + } // set this location as the placement anchor TheInGameUI->setPlacementStart( &mouse ); @@ -130,14 +130,14 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess // display a message to the user as to why you can't build there TheInGameUI->displayCantBuildMessage( lbc ); - } // end if + } else { // start placement anchor TheInGameUI->setPlacementStart(&mouse); - } // end else + } */ // used the input @@ -275,14 +275,14 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess TheTacticalView->screenToTerrain( &anchorEnd, &worldEnd ); placeMsg->appendLocationArgument( worldEnd ); - } // end if + } pickAndPlayUnitVoiceResponse( TheInGameUI->getAllSelectedDrawables(), placeMsg->getType() ); // get out of pending placement mode, this will also clear the arrow anchor status TheInGameUI->placeBuildAvailable( NULL, NULL ); - } // end if, location legal to build at + } else { // can't place, display why @@ -300,7 +300,7 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess // unhook the anchor so they can try again TheInGameUI->setPlacementStart( NULL ); - } // end else + } // used the input disp = DESTROY_MESSAGE; @@ -340,7 +340,7 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess TheInGameUI->setPlacementEnd(&mouse); disp = DESTROY_MESSAGE; - } // end if + } } break; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp index 18442b79c37..35da9a457bc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp @@ -106,7 +106,7 @@ struct SFWRec { SFWRec *info = (SFWRec *)userData; return info->translator->selectFriends(draw, info->createTeamMsg, info->dragSelecting) != 0; -} // end selectFriendsWrapper +} /*friend*/ Bool killThemKillThemAllWrapper( Drawable *draw, void *userData ) { @@ -207,7 +207,7 @@ Bool CanSelectDrawable( const Drawable *draw, Bool dragSelecting ) //Now we can select anything that is selectable. return TRUE; -} // end canSelect +} //----------------------------------------------------------------------------- static Bool canSelectWrapper( Drawable *draw, void *userData ) @@ -321,11 +321,11 @@ Bool SelectionTranslator::selectFriends( Drawable *draw, GameMessage *createTeam return true; // selected - } // end if + } return false; // not selected -} // end selectFriends +} //----------------------------------------------------------------------------- @@ -359,7 +359,7 @@ Bool SelectionTranslator::killThemKillThemAll( Drawable *draw, GameMessage *kill } } return false; -} // end selectFriends +} //----------------------------------------------------------------------------- /** diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp index fa058a2988d..f646e26079c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp @@ -141,11 +141,11 @@ static GameWindowMessage rawMouseToWindowMessage( const GameMessage *msg ) gwm = GWM_WHEEL_DOWN; break; - } // end switch + } return gwm; -} // end rawMouseToWindowMessage +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -249,7 +249,7 @@ GameMessageDisposition WindowTranslator::translateGameMessage(const GameMessage break; - } // end, raw mouse position + } // ------------------------------------------------------------------------ case GameMessage::MSG_RAW_MOUSE_LEFT_DRAG: @@ -275,7 +275,7 @@ GameMessageDisposition WindowTranslator::translateGameMessage(const GameMessage break; - } // end drag mouse + } // ------------------------------------------------------------------------ case GameMessage::MSG_RAW_MOUSE_WHEEL: @@ -300,7 +300,7 @@ GameMessageDisposition WindowTranslator::translateGameMessage(const GameMessage break; - } // end mouse wheel + } // ------------------------------------------------------------------------ case GameMessage::MSG_RAW_KEY_DOWN: @@ -336,13 +336,13 @@ GameMessageDisposition WindowTranslator::translateGameMessage(const GameMessage break; - } // end key messages + } // ------------------------------------------------------------------------ default: break; - } // end switch( msg->getType() ) + } // remove event from the stream if the return code specifies to do so // If TheShell doesn't exist, then well, we're not in RTS, we're in GUIEdit diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp index 0ae9f087d96..a18ffdb8e71 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp @@ -271,7 +271,7 @@ UnsignedInt getPickTypesForContext( Bool forceAttackMode ) return types; -} // end getPickTypesForContext +} //------------------------------------------------------------------------------------------------- UnsignedInt getPickTypesForCurrentSelection( Bool forceAttackMode ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp index 413340cb4f5..e1da99a4b09 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp @@ -59,7 +59,7 @@ Anim2DTemplate::Anim2DTemplate( AsciiString name ) m_randomizeStartFrame = FALSE; m_nextTemplate = NULL; -} // end Anim2DTemplate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -70,7 +70,7 @@ Anim2DTemplate::~Anim2DTemplate( void ) if( m_images ) delete [] m_images; -} // end ~Anim2DTemplate +} // ------------------------------------------------------------------------------------------------ /** Field parse table for 2D animation templates */ @@ -110,12 +110,12 @@ void Anim2DTemplate::parseNumImages( INI *ini, void *instance, void *store, cons animTemplate->getName().str(), minimumFrames )); throw INI_INVALID_DATA; - } // end if + } // allocate the image array animTemplate->allocateImages( (UnsignedShort)numFrames ); -} // end parseNumImages +} // ------------------------------------------------------------------------------------------------ /** Allocate the image array for an animation template and store the number of frames we have */ @@ -133,7 +133,7 @@ void Anim2DTemplate::allocateImages( UnsignedShort numFrames ) for( Int i = 0; i < m_numFrames; ++i ) m_images[ i ] = NULL; -} // end allocateImages +} // ------------------------------------------------------------------------------------------------ /** Parsing a single image definition for an animation */ @@ -153,7 +153,7 @@ void Anim2DTemplate::parseImage( INI *ini, void *instance, void *store, const vo //DEBUG_CRASH(( "Anim2DTemplate::parseImage - Image not found" )); //throw INI_INVALID_DATA; - } // end if + } // // assign the image to the animation template list of images ... note since we've pre-allocated @@ -165,7 +165,7 @@ void Anim2DTemplate::parseImage( INI *ini, void *instance, void *store, const vo Anim2DTemplate *animTemplate = (Anim2DTemplate *)instance; animTemplate->storeImage( image ); -} // end parseImage +} // ------------------------------------------------------------------------------------------------ /** This will parse the image sequence of an animation. You can use this as a shortcut to @@ -193,7 +193,7 @@ void Anim2DTemplate::parseImage( INI *ini, void *instance, void *store, const vo animTemplate->getName().str() )); throw INI_INVALID_DATA; - } // end if + } // // the image storage has already been allocated, all we have to do now is count from @@ -219,14 +219,14 @@ void Anim2DTemplate::parseImage( INI *ini, void *instance, void *store, const vo imageName.str(), animTemplate->getName().str() )); throw INI_INVALID_DATA; - } // end if + } // store the image in the next free frame animTemplate->storeImage( image ); - } // end if + } -} // end parseImageSequence +} // ------------------------------------------------------------------------------------------------ /** Store the image at the next open image slot for the animation */ @@ -248,16 +248,16 @@ void Anim2DTemplate::storeImage( const Image *image ) m_images[ i ] = image; return; - } // end if + } - } // end for i + } // if we got here we tried to store an image in an array that was too small DEBUG_CRASH(( "Anim2DTemplate::storeImage - Unable to store image '%s' into animation '%s' because the animation is setup to only support '%d' image frames", image->getName().str(), getName().str(), m_numFrames )); throw INI_INVALID_DATA; -} // end storeImage +} // ------------------------------------------------------------------------------------------------ /** Return the Image* for the frame number requested */ @@ -278,16 +278,16 @@ const Image* Anim2DTemplate::getFrame( UnsignedShort frameNumber ) const frameNumber, getName().str() )); return NULL; - } // end if + } else { // return the image frame return m_images[ frameNumber ]; - } // end else + } -} // end getFrame +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -339,7 +339,7 @@ Anim2D::Anim2D( Anim2DTemplate *animTemplate, Anim2DCollection *collectionSystem m_collectionSystem->registerAnimation( this ); -} // end Anim2D +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -350,7 +350,7 @@ Anim2D::~Anim2D( void ) if( m_collectionSystem ) m_collectionSystem->unRegisterAnimation( this ); -} // end ~Anim2D +} // ------------------------------------------------------------------------------------------------ /** Set the current animation frame */ @@ -377,7 +377,7 @@ void Anim2D::setCurrentFrame( UnsignedShort frame ) // record the frame of this update to our current frame m_lastUpdateFrame = TheGameLogic->getFrame(); -} // end setCurrentFrame +} // ------------------------------------------------------------------------------------------------ /** Randomize the current frame */ @@ -391,7 +391,7 @@ void Anim2D::randomizeCurrentFrame( void ) // set the current frame to a random frame setCurrentFrame( GameClientRandomValue( 0, m_template->getNumFrames() - 1 ) ); -} // end randomizeCurrentFrame +} // ------------------------------------------------------------------------------------------------ /** Reset this animation instance to the "start" of the animation */ @@ -425,9 +425,9 @@ void Anim2D::reset( void ) m_template->getAnimMode(), m_template->getName().str() )); break; - } // end switch, animation mode + } -} // end reset +} // ------------------------------------------------------------------------------------------------ /** This is called after we are drawn ... if sufficient time has passed since our last @@ -458,7 +458,7 @@ void Anim2D::tryNextFrame( void ) setStatus( ANIM_2D_STATUS_COMPLETE ); break; - } // end once + } // ------------------------------------------------------------------------------------------- case ANIM_2D_ONCE_BACKWARDS: @@ -470,7 +470,7 @@ void Anim2D::tryNextFrame( void ) setStatus( ANIM_2D_STATUS_COMPLETE ); break; - } // end once backwards + } // ------------------------------------------------------------------------------------------- case ANIM_2D_LOOP: @@ -482,7 +482,7 @@ void Anim2D::tryNextFrame( void ) setCurrentFrame( m_currentFrame + 1 ); break; - } // end loop + } // ------------------------------------------------------------------------------------------- case ANIM_2D_LOOP_BACKWARDS: @@ -494,7 +494,7 @@ void Anim2D::tryNextFrame( void ) setCurrentFrame( m_maxFrame ); break; - } // end loop backwards + } // ------------------------------------------------------------------------------------------- case ANIM_2D_PING_PONG: @@ -513,15 +513,15 @@ void Anim2D::tryNextFrame( void ) setCurrentFrame( m_currentFrame + 1 ); clearStatus( ANIM_2D_STATUS_REVERSED ); - } // end if + } else { setCurrentFrame( m_currentFrame - 1 ); - } // end else + } - } // end if + } else { @@ -535,19 +535,19 @@ void Anim2D::tryNextFrame( void ) setCurrentFrame( m_currentFrame - 1 ); setStatus( ANIM_2D_STATUS_REVERSED ); - } // end if + } else { setCurrentFrame( m_currentFrame + 1 ); - } // end else + } - } // end else + } break; - } // end ping pong / ping pong backwards + } // ------------------------------------------------------------------------------------------- default: @@ -557,13 +557,13 @@ void Anim2D::tryNextFrame( void ) m_template->getAnimMode(), m_template->getName().str() )); break; - } // end default + } - } // end switch + } - } // end if + } -} // end tryNextFrame +} // ------------------------------------------------------------------------------------------------ /** Set status bit */ @@ -574,7 +574,7 @@ void Anim2D::setStatus( UnsignedByte statusBits ) // set the bits BitSet( m_status, statusBits ); -} // end setStatus +} // ------------------------------------------------------------------------------------------------ /** Clear status bit */ @@ -585,7 +585,7 @@ void Anim2D::clearStatus( UnsignedByte statusBits ) // clear bits BitClear( m_status, statusBits ); -} // end clearStatus +} // ------------------------------------------------------------------------------------------------ /** Return the "natural" width of the image for our current frame */ @@ -599,7 +599,7 @@ UnsignedInt Anim2D::getCurrentFrameWidth( void ) const return 0; -} // end getCurrentFrameWidth +} // ------------------------------------------------------------------------------------------------ /** Return the "natural" height of the image for our current frame */ @@ -613,7 +613,7 @@ UnsignedInt Anim2D::getCurrentFrameHeight( void ) const return 0; -} // end getCurrentFrameHeight +} // ------------------------------------------------------------------------------------------------ /** Draw an Anim2D using the natural width and height of the image data */ @@ -643,7 +643,7 @@ void Anim2D::draw( Int x, Int y ) if( m_collectionSystem == NULL && BitIsSet( m_status, ANIM_2D_STATUS_FROZEN ) == FALSE ) tryNextFrame(); -} // end draw +} // ------------------------------------------------------------------------------------------------ /** Drawing an Anim2D using a forced width and height */ @@ -671,7 +671,7 @@ void Anim2D::draw( Int x, Int y, Int width, Int height ) if( m_collectionSystem == NULL && BitIsSet( m_status, ANIM_2D_STATUS_FROZEN ) == FALSE ) tryNextFrame(); -} // end draw +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -707,7 +707,7 @@ void Anim2D::xfer( Xfer *xfer ) // alpha xfer->xferReal( &m_alpha ); -} // end xfer +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -720,7 +720,7 @@ Anim2DCollection::Anim2DCollection( void ) m_templateList = NULL; m_instanceList = NULL; -} // end Anim2DCollection +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -744,9 +744,9 @@ Anim2DCollection::~Anim2DCollection( void ) // set the head of our list to the next template m_templateList = nextTemplate; - } // end while + } -} // end ~Anim2DCollection +} // ------------------------------------------------------------------------------------------------ /** Initialize 2D animation collection */ @@ -757,7 +757,7 @@ void Anim2DCollection::init( void ) ini.loadFileDirectory( "Data\\INI\\Animation2D", INI_LOAD_OVERWRITE, NULL ); -} // end init +} // ------------------------------------------------------------------------------------------------ /** System update phase */ @@ -774,9 +774,9 @@ void Anim2DCollection::update( void ) if( BitIsSet( anim->getStatus(), ANIM_2D_STATUS_FROZEN ) == FALSE ) anim->tryNextFrame(); - } // end for, anim + } -} // end update +} // ------------------------------------------------------------------------------------------------ /** Search the template list for a template with a matching name */ @@ -793,11 +793,11 @@ Anim2DTemplate *Anim2DCollection::findTemplate( const AsciiString& name ) if( animTemplate->getName() == name ) return animTemplate; - } // end for + } return NULL; // template not found -} // end findTemplate +} //------------------------------------------------------------------------------------------------- Anim2DTemplate* Anim2DCollection::getNextTemplate( Anim2DTemplate *animTemplate ) const @@ -825,7 +825,7 @@ Anim2DTemplate *Anim2DCollection::newTemplate( const AsciiString& name ) // return the new template return animTemplate; -} // end newTemplate +} // ------------------------------------------------------------------------------------------------ /** Register animation instance with us. When an animation instance is registered it can @@ -851,7 +851,7 @@ void Anim2DCollection::registerAnimation( Anim2D *anim ) m_instanceList->m_collectionSystemPrev = anim; m_instanceList = anim; -} // end registerAnimation +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -874,5 +874,5 @@ void Anim2DCollection::unRegisterAnimation( Anim2D *anim ) else m_instanceList = anim->m_collectionSystemNext; -} // end unRegisterAnimation +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp index c9b6790ee38..f2f096f8414 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp @@ -110,7 +110,7 @@ void INI::parseCampaignDefinition( INI *ini ) // parse the ini definition ini->initFromINI( campaign, TheCampaignManager->getFieldParse() ); -} // end parseCampaignDefinition +} //----------------------------------------------------------------------------- Campaign::Campaign( void ): @@ -489,7 +489,7 @@ void CampaignManager::xfer( Xfer *xfer ) m_xferChallengeGeneralsPlayerTemplateNum = playerTemplateNum; } -} // end xfer +} void CampaignManager::loadPostProcess( void ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp index df13d4e7a6d..7f4dbc8ffcb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp @@ -88,12 +88,12 @@ void Image::parseImageCoords( INI* ini, void *instance, void *store, const void* { uvCoords.lo.x /= (Real)textureSize->x; uvCoords.hi.x /= (Real)textureSize->x; - } // end if + } if( textureSize->y ) { uvCoords.lo.y /= (Real)textureSize->y; uvCoords.hi.y /= (Real)textureSize->y; - } // end if + } // store the uv coords theImage->setUV( &uvCoords ); @@ -104,7 +104,7 @@ void Image::parseImageCoords( INI* ini, void *instance, void *store, const void* imageSize.y = bottom - top; theImage->setImageSize( &imageSize ); -} // end parseImageCoord +} //------------------------------------------------------------------------------------------------- /** Parse the image status line */ @@ -129,9 +129,9 @@ void Image::parseImageStatus( INI* ini, void *instance, void *store, const void* imageSize.y = theImage->getImageWidth(); // note it's width not height theImage->setImageSize( &imageSize ); - } // end if + } -} // end parseImageStatus +} // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// ImageCollection *TheMappedImageCollection = NULL; ///< mapped images @@ -155,14 +155,14 @@ Image::Image( void ) m_rawTextureData = NULL; m_status = IMAGE_STATUS_NONE; -} // end Image +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- Image::~Image( void ) { -} // end ~Image +} //------------------------------------------------------------------------------------------------- /** Set a status bit into the existing status, return the previous status @@ -175,7 +175,7 @@ UnsignedInt Image::setStatus( UnsignedInt bit ) BitSet( m_status, bit ); return prevStatus; -} // end setStatus +} //------------------------------------------------------------------------------------------------- /** Clear a status bit from the existing status, return the previous @@ -188,7 +188,7 @@ UnsignedInt Image::clearStatus( UnsignedInt bit ) BitClear( m_status, bit ); return prevStatus; -} // end clearStatus +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -198,7 +198,7 @@ UnsignedInt Image::clearStatus( UnsignedInt bit ) //------------------------------------------------------------------------------------------------- ImageCollection::ImageCollection( void ) { -} // end ImageCollection +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -206,7 +206,7 @@ ImageCollection::~ImageCollection( void ) { for (std::map::iterator i=m_imageMap.begin();i!=m_imageMap.end();++i) deleteInstance(i->second); -} // end ~ImageCollection +} //------------------------------------------------------------------------------------------------- /** adds the given image to the collection, transfers ownership to this object */ @@ -214,7 +214,7 @@ ImageCollection::~ImageCollection( void ) void ImageCollection::addImage( Image *image ) { m_imageMap[TheNameKeyGenerator->nameToLowercaseKey(image->getName())]=image; -} // end newImage +} //------------------------------------------------------------------------------------------------- /** Find an image given the image name */ @@ -223,7 +223,7 @@ const Image *ImageCollection::findImageByName( const AsciiString& name ) { std::map::iterator i=m_imageMap.find(TheNameKeyGenerator->nameToLowercaseKey(name)); return i==m_imageMap.end()?NULL:i->second; -} // end findImageByName +} //------------------------------------------------------------------------------------------------- /** Load this image collection with all the images specified in the INI files @@ -256,4 +256,4 @@ void ImageCollection::load( Int textureSize ) ini.loadDirectory("Data\\INI\\MappedImages\\HandCreated", INI_LOAD_OVERWRITE, NULL ); -} // end load +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp index cca49907287..9f43b153211 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -88,7 +88,7 @@ ParticleInfo::ParticleInfo( void ) m_particleUpTowardsEmitter = FALSE; // -} // end ParticleInfo +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -96,7 +96,7 @@ ParticleInfo::ParticleInfo( void ) void ParticleInfo::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -154,7 +154,7 @@ void ParticleInfo::xfer( Xfer *xfer ) xfer->xferReal( &m_alphaKey[ i ].value ); xfer->xferUnsignedInt( &m_alphaKey[ i ].frame ); - } // end for, i + } // color keys for( i = 0; i < MAX_KEYFRAMES; ++i ) @@ -163,7 +163,7 @@ void ParticleInfo::xfer( Xfer *xfer ) xfer->xferRGBColor( &m_colorKey[ i ].color ); xfer->xferUnsignedInt( &m_colorKey[ i ].frame ); - } // end for, i + } // color scale xfer->xferReal( &m_colorScale ); @@ -174,7 +174,7 @@ void ParticleInfo::xfer( Xfer *xfer ) // wind randomness xfer->xferReal( &m_windRandomness ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -182,7 +182,7 @@ void ParticleInfo::xfer( Xfer *xfer ) void ParticleInfo::loadPostProcess( void ) { -} // end loadPostProcess +} /** Load post process */ // ------------------------------------------------------------------------------------------------ @@ -507,9 +507,9 @@ void Particle::doWindMotion( void ) systemPos.y += objPos->y; systemPos.z += objPos->z; - } // end if + } - } // end if + } else if( DrawableID attachedDraw = m_system->getAttachedDrawable() ) { Drawable *draw = TheGameClient->findDrawableByID( attachedDraw ); @@ -522,9 +522,9 @@ void Particle::doWindMotion( void ) systemPos.y += drawPos->y; systemPos.z += drawPos->z; - } // end if + } - } // end else if + } // // compute a vector from the system position in the world to the particle ... we will use @@ -559,9 +559,9 @@ void Particle::doWindMotion( void ) m_pos.x += (Cos( windAngle ) * windForceStrength); m_pos.y += (Sin( windAngle ) * windForceStrength); - } // end if + } -} // doWindMotion +} // ------------------------------------------------------------------------------------------------ /** Get priority of a particle ... which is the priority of it's attached system */ @@ -621,7 +621,7 @@ Bool Particle::isInvisible( void ) void Particle::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -680,7 +680,7 @@ void Particle::xfer( Xfer *xfer ) ParticleSystemID systemUnderControlID = m_systemUnderControl ? m_systemUnderControl->getSystemID() : INVALID_PARTICLE_SYSTEM_ID; xfer->xferUser( &systemUnderControlID, sizeof( ParticleSystemID ) ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -710,11 +710,11 @@ void Particle::loadPostProcess( void ) DEBUG_CRASH(( "Particle::loadPostProcess - Unable to find system under control pointer" )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } -} // end loadPostProcess +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -769,7 +769,7 @@ void ParticleSystemInfo::tintAllColors( Color tintColor ) m_colorKey[ key ].color.blue *= (Real)(rgb.blue ) / 255.0f; } -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ @@ -778,7 +778,7 @@ void ParticleSystemInfo::tintAllColors( Color tintColor ) void ParticleSystemInfo::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -848,7 +848,7 @@ void ParticleSystemInfo::xfer( Xfer *xfer ) xfer->xferUser( &m_alphaKey[ i ].var, sizeof( GameClientRandomVariable ) ); xfer->xferUnsignedInt( &m_alphaKey[ i ].frame ); - } // end for, i + } // color keys for( i = 0; i < MAX_KEYFRAMES; ++i ) @@ -857,7 +857,7 @@ void ParticleSystemInfo::xfer( Xfer *xfer ) xfer->xferRGBColor( &m_colorKey[ i ].color ); xfer->xferUnsignedInt( &m_colorKey[ i ].frame ); - } // end for, i + } // color scale xfer->xferUser( &m_colorScale, sizeof( GameClientRandomVariable ) ); @@ -925,7 +925,7 @@ void ParticleSystemInfo::xfer( Xfer *xfer ) xfer->xferUser( &m_emissionVelocity.outward.otherSpeed, sizeof( GameClientRandomVariable ) ); break; - } // end switch, m_emissionVelocityType + } // emission volume type xfer->xferUser( &m_emissionVolumeType, sizeof( EmissionVolumeType ) ); @@ -961,7 +961,7 @@ void ParticleSystemInfo::xfer( Xfer *xfer ) xfer->xferReal( &m_emissionVolume.cylinder.length ); break; - } // end switch, m_emissionVolumeType + } // is emission volume hollow xfer->xferBool( &m_isEmissionVolumeHollow ); @@ -1011,7 +1011,7 @@ void ParticleSystemInfo::xfer( Xfer *xfer ) // wind motion moving to end angle xfer->xferByte( &m_windMotionMovingToEndAngle ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1019,7 +1019,7 @@ void ParticleSystemInfo::xfer( Xfer *xfer ) void ParticleSystemInfo::loadPostProcess( void ) { -} // end loadPostProcess +} /////////////////////////////////////////////////////////////////////////////////////////////////// // ParticleSystem ///////////////////////////////////////////////////////////////////////////////// @@ -1167,9 +1167,9 @@ ParticleSystem::ParticleSystem( const ParticleSystemTemplate *sysTemplate, setSlave( slaveSystem ); m_slaveSystem->setMaster( this ); - } // end if + } - } // end if + } m_attachedSystemName = sysTemplate->m_attachedSystemName; m_particleCount = 0; @@ -1195,7 +1195,7 @@ ParticleSystem::~ParticleSystem() m_slaveSystem->setMaster( NULL ); setSlave( NULL ); - } // end if + } // tell any master system that *we* are going away if( m_masterSystem ) @@ -1205,7 +1205,7 @@ ParticleSystem::~ParticleSystem() m_masterSystem->setSlave( NULL ); setMaster( NULL ); - } // end if + } // destroy all particles "in the air" @@ -1233,7 +1233,7 @@ void ParticleSystem::setMaster( ParticleSystem *master ) m_masterSystem = master; m_masterSystemID = master ? master->getSystemID() : INVALID_PARTICLE_SYSTEM_ID; -} // end set Master +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1243,7 +1243,7 @@ void ParticleSystem::setSlave( ParticleSystem *slave ) m_slaveSystem = slave; m_slaveSystemID = slave ? slave->getSystemID() : INVALID_PARTICLE_SYSTEM_ID; -} // end setSlave +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1720,7 +1720,7 @@ Particle *ParticleSystem::createParticle( const ParticleInfo *info, return NULL; } - } // end if + } Particle *p = newInstance(Particle)( this, info ); return p; @@ -2041,9 +2041,9 @@ Bool ParticleSystem::update( Int localPlayerIndex ) m_burstDelayLeft--; } - } // end if stopped check - } // end if system lifetime check - } // end if is destroyed + } + } + } // // Update all particles in the system @@ -2166,9 +2166,9 @@ void ParticleSystem::updateWindMotion( void ) GameClientRandomValueReal( m_windMotionEndAngleMin, m_windMotionEndAngleMax ); - } // end if + } - } // end if + } else { @@ -2194,13 +2194,13 @@ void ParticleSystem::updateWindMotion( void ) GameClientRandomValueReal( m_windMotionEndAngleMin, m_windMotionEndAngleMax ); - } // end if + } - } // end else + } break; - } // end case + } // -------------------------------------------------------------------------------------------- case ParticleSystemInfo::WIND_MOTION_CIRCULAR: @@ -2221,7 +2221,7 @@ void ParticleSystem::updateWindMotion( void ) break; - } // end case + } // --------------------------------------------------------------------------------------------- default: @@ -2229,11 +2229,11 @@ void ParticleSystem::updateWindMotion( void ) break; - } // end default + } - } // end if + } -} // end updateWindMotion +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -2388,7 +2388,7 @@ void ParticleSystem::setControlParticle( Particle *p ) void ParticleSystem::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -2500,9 +2500,9 @@ void ParticleSystem::xfer( Xfer *xfer ) // write particle information xfer->xferSnapshot( particle ); - } // end for, particle + } - } // end if, save + } else { ParticlePriorityType priority = getPriority(); @@ -2522,11 +2522,11 @@ void ParticleSystem::xfer( Xfer *xfer ) // read in the particle data xfer->xferSnapshot( particle ); - } // end for i + } - } // end else, load + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -2548,7 +2548,7 @@ void ParticleSystem::loadPostProcess( void ) DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_slaveSystem is not NULL but should be" )); throw SC_INVALID_DATA; - } // end if + } // assign system m_slaveSystem = TheParticleSystemManager->findParticleSystem( m_slaveSystemID ); @@ -2560,9 +2560,9 @@ void ParticleSystem::loadPostProcess( void ) DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_slaveSystem is NULL or destroyed" )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } // reconnect master pointers if needed if( m_masterSystemID != INVALID_PARTICLE_SYSTEM_ID ) @@ -2575,7 +2575,7 @@ void ParticleSystem::loadPostProcess( void ) DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_masterSystem is not NULL but should be" )); throw SC_INVALID_DATA; - } // end if + } // assign system m_masterSystem = TheParticleSystemManager->findParticleSystem( m_masterSystemID ); @@ -2587,11 +2587,11 @@ void ParticleSystem::loadPostProcess( void ) DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_masterSystem is NULL or destroyed" )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } -} // end loadPostProcess +} /////////////////////////////////////////////////////////////////////////////////////////////////// // ParticleSystemTemplate ///////////////////////////////////////////////////////////////////////// @@ -2766,7 +2766,7 @@ void ParticleSystemTemplate::parseRandomRGBColor( INI* ini, void *instance, if( colors[j][i] < -255 || colors[j][i] > 255 ) throw INI_INVALID_DATA; - } // end for i + } } // assign the color components to the "RGBColor" pointer at 'store' @@ -2841,7 +2841,7 @@ ParticleSystemManager::ParticleSystemManager( void ) m_allParticlesHead[ i ] = NULL; m_allParticlesTail[ i ] = NULL; - } // end for, i + } } @@ -2879,7 +2879,7 @@ void ParticleSystemManager::init( void ) m_allParticlesHead[ i ] = NULL; m_allParticlesTail[ i ] = NULL; - } // end for, i + } } @@ -2907,7 +2907,7 @@ void ParticleSystemManager::reset( void ) m_allParticlesHead[ i ] = NULL; m_allParticlesTail[ i ] = NULL; - } // end for, i + } m_particleCount = 0; m_fieldParticleCount = 0; @@ -3004,7 +3004,7 @@ ParticleSystem *ParticleSystemManager::findParticleSystem( ParticleSystemID id ) return NULL; -} // end findParticleSystem +} // ------------------------------------------------------------------------------------------------ /** destroy the particle system with the given id (if it still exists) */ @@ -3236,7 +3236,7 @@ void ParticleSystemManager::preloadAssets( TimeOfDay timeOfDay ) void ParticleSystemManager::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -3286,10 +3286,10 @@ void ParticleSystemManager::xfer( Xfer *xfer ) // write system data xfer->xferSnapshot( system ); - } // end for, it + } DEBUG_ASSERTCRASH(systemCount==0, ("Mismatch in write count.")); - } // end if, save + } else { const ParticleSystemTemplate *systemTemplate; @@ -3313,7 +3313,7 @@ void ParticleSystemManager::xfer( Xfer *xfer ) systemName.str() )); throw SC_INVALID_DATA; - } // end if + } // create system system = createParticleSystem( systemTemplate, FALSE ); @@ -3325,16 +3325,16 @@ void ParticleSystemManager::xfer( Xfer *xfer ) systemName.str() )); throw SC_INVALID_DATA; - } // end if + } // read system data xfer->xferSnapshot( system ); - } // end for, i + } - } // end else, load + } -} // end particleSystemManager +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -3342,7 +3342,7 @@ void ParticleSystemManager::xfer( Xfer *xfer ) void ParticleSystemManager::loadPostProcess( void ) { -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ /** Output particle system statistics to the screen diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/RayEffect.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/RayEffect.cpp index fe22b204554..8a8922db187 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/RayEffect.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/RayEffect.cpp @@ -56,13 +56,13 @@ RayEffectData *RayEffectSystem::findEntry( const Drawable *draw ) effectData = &m_effectData[ i ]; break; // exit for i - } // end if + } - } // end for i + } return effectData; -} // end findEntry +} // PUBLIC METHODS ///////////////////////////////////////////////////////////////////////////////// @@ -73,14 +73,14 @@ RayEffectSystem::RayEffectSystem( void ) init(); -} // end RayEffectSystem +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- RayEffectSystem::~RayEffectSystem( void ) { -} // end ~RayEffectSystem +} //------------------------------------------------------------------------------------------------- /** initialize the system */ @@ -96,9 +96,9 @@ void RayEffectSystem::init( void ) m_effectData[ i ].startLoc.zero(); m_effectData[ i ].endLoc.zero(); - } // end for i + } -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset */ @@ -109,7 +109,7 @@ void RayEffectSystem::reset( void ) // nothing dynamic going on here, just initialize it init(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** add a ray effect entry for this drawable */ @@ -139,9 +139,9 @@ void RayEffectSystem::addRayEffect( const Drawable *draw, effectData = &m_effectData[ i ]; break; // exit for - } // end if + } - } // end for i + } // if no free slots we can't do it if( effectData == NULL ) @@ -173,9 +173,9 @@ void RayEffectSystem::deleteRayEffect( const Drawable *draw ) // remove the data for this entry effectData->draw = NULL; - } // end if + } -} // end deleteRayEffect +} //------------------------------------------------------------------------------------------------- /** given a drawable, if it is in the ray effect system list retrieve @@ -198,7 +198,7 @@ void RayEffectSystem::getRayEffectData( const Drawable *draw, // data has been found, copy to parameter *effectData = *entry; - } // end effectData + } -} // end getRayEffectData +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Terrain/TerrainRoads.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Terrain/TerrainRoads.cpp index a352c248de5..8fefd60313f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Terrain/TerrainRoads.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Terrain/TerrainRoads.cpp @@ -115,7 +115,7 @@ const FieldParse TerrainRoadType::m_terrainBridgeFieldParseTable[] = DEBUG_CRASH(( "Expected Damage/Repair transition keyword" )); throw INI_INVALID_DATA; - } // end else + } // get body damage state token = ini->getNextSubToken( "ToState" ); @@ -135,7 +135,7 @@ const FieldParse TerrainRoadType::m_terrainBridgeFieldParseTable[] = DEBUG_CRASH(( "Effect number max on bridge transitions is '%d'", MAX_BRIDGE_BODY_FX )); throw INI_INVALID_DATA; - } // end if + } // read the string token = ini->getNextSubToken( "OCL" ); @@ -144,7 +144,7 @@ const FieldParse TerrainRoadType::m_terrainBridgeFieldParseTable[] = else theInstance->friend_setRepairedToOCLString( state, effectNum, AsciiString( token ) ); -} // end parseTransitionToOCL +} // ------------------------------------------------------------------------------------------------ /** In the form of @@ -171,7 +171,7 @@ const FieldParse TerrainRoadType::m_terrainBridgeFieldParseTable[] = DEBUG_CRASH(( "Expected Damage/Repair transition keyword" )); throw INI_INVALID_DATA; - } // end else + } // get body damage state token = ini->getNextSubToken( "ToState" ); @@ -191,7 +191,7 @@ const FieldParse TerrainRoadType::m_terrainBridgeFieldParseTable[] = DEBUG_CRASH(( "Effect number max on bridge transitions is '%d'", MAX_BRIDGE_BODY_FX )); throw INI_INVALID_DATA; - } // end if + } // read the string token = ini->getNextSubToken( "FX" ); @@ -200,7 +200,7 @@ const FieldParse TerrainRoadType::m_terrainBridgeFieldParseTable[] = else theInstance->friend_setRepairedToFXString( state, effectNum, AsciiString( token ) ); -} // end parseTransitionToFX +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -219,14 +219,14 @@ TerrainRoadType::TerrainRoadType( void ) m_transitionEffectsHeight = 0.0f; m_numFXPerType = 0; -} // end TerrainRoadType +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- TerrainRoadType::~TerrainRoadType( void ) { -} // end ~TerrainRoadType +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -242,7 +242,7 @@ TerrainRoadCollection::TerrainRoadCollection( void ) m_idCounter = 1; ///< MUST start this at 1. -} // end TerrainRoadCollection +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -263,7 +263,7 @@ TerrainRoadCollection::~TerrainRoadCollection( void ) // set the new head of the list m_roadList = temp; - } // end while + } // delete all bridges in the list while( m_bridgeList ) @@ -278,9 +278,9 @@ TerrainRoadCollection::~TerrainRoadCollection( void ) // set the new head of the list m_bridgeList = temp; - } // end while + } -} // end ~TerrainRoadCollection +} //------------------------------------------------------------------------------------------------- /** Find road with matching name */ @@ -295,12 +295,12 @@ TerrainRoadType *TerrainRoadCollection::findRoad( AsciiString name ) if( road->getName() == name ) return road; - } // end for road + } // not found return NULL; -} // end findRoad +} //------------------------------------------------------------------------------------------------- /** Find bridge with matching name */ @@ -315,12 +315,12 @@ TerrainRoadType *TerrainRoadCollection::findBridge( AsciiString name ) if( bridge->getName() == name ) return bridge; - } // end for bridge + } // not found return NULL; -} // end findBridge +} //------------------------------------------------------------------------------------------------- /** Search the roads AND bridge lists for the name */ @@ -334,7 +334,7 @@ TerrainRoadType *TerrainRoadCollection::findRoadOrBridge( AsciiString name ) else return findBridge( name ); -} // end findRoadOrBridge +} //------------------------------------------------------------------------------------------------- /** Allocate a new road, set the name, and link to the road list */ @@ -361,7 +361,7 @@ TerrainRoadType *TerrainRoadCollection::newRoad( AsciiString name ) road->friend_setRoadWidth( defaultRoad->getRoadWidth() ); road->friend_setRoadWidthInTexture( defaultRoad->getRoadWidthInTexture() ); - } // end if + } // link to list road->friend_setNext( m_roadList ); @@ -370,7 +370,7 @@ TerrainRoadType *TerrainRoadCollection::newRoad( AsciiString name ) // return the new road return road; -} // end newRoad +} //------------------------------------------------------------------------------------------------- /** Allocate a new bridge */ @@ -419,11 +419,11 @@ TerrainRoadType *TerrainRoadCollection::newBridge( AsciiString name ) bridge->friend_setRepairedToOCLString( (BodyDamageType)state, i, bridge->getDamageToOCLString( (BodyDamageType)state, i ) ); bridge->friend_setRepairedToFXString( (BodyDamageType)state, i, bridge->getDamageToOCLString( (BodyDamageType)state, i ) ); - } // end for i + } - } // end for + } - } // end if + } // link to list bridge->friend_setNext( m_bridgeList ); @@ -432,7 +432,7 @@ TerrainRoadType *TerrainRoadCollection::newBridge( AsciiString name ) // return the new bridge return bridge; -} // end newBridge +} //------------------------------------------------------------------------------------------------- /** Return next road in list */ @@ -443,7 +443,7 @@ TerrainRoadType *TerrainRoadCollection::nextRoad( TerrainRoadType *road ) DEBUG_ASSERTCRASH( road->isBridge() == FALSE, ("nextRoad: road not a road") ); return road->friend_getNext(); -} // end nextRoad +} //------------------------------------------------------------------------------------------------- /** Return next bridge in list */ @@ -454,5 +454,5 @@ TerrainRoadType *TerrainRoadCollection::nextBridge( TerrainRoadType *bridge ) DEBUG_ASSERTCRASH( bridge->isBridge() == TRUE, ("nextBridge, bridge is not a bridge") ); return bridge->friend_getNext(); -} // end nextBridge +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Terrain/TerrainVisual.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Terrain/TerrainVisual.cpp index 1294a2a9c6d..e61d844d611 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Terrain/TerrainVisual.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Terrain/TerrainVisual.cpp @@ -47,14 +47,14 @@ TerrainVisual *TheTerrainVisual = NULL; TerrainVisual::TerrainVisual() { -} // end TerrainVisual +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- TerrainVisual::~TerrainVisual() { -} // end ~TerrainVisual +} //------------------------------------------------------------------------------------------------- /** initialize the device independent functionality of the visual terrain */ @@ -62,7 +62,7 @@ TerrainVisual::~TerrainVisual() void TerrainVisual::init( void ) { -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset */ @@ -72,7 +72,7 @@ void TerrainVisual::reset( void ) m_filenameString.clear(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update */ @@ -80,7 +80,7 @@ void TerrainVisual::reset( void ) void TerrainVisual::update( void ) { // All the interesting stuff happens in load. jba. -} // end update +} //------------------------------------------------------------------------------------------------- /** device independent implementation for common terrain visual systems */ @@ -96,7 +96,7 @@ Bool TerrainVisual::load( AsciiString filename ) return TRUE;; // success -} // end load +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -104,7 +104,7 @@ Bool TerrainVisual::load( AsciiString filename ) void TerrainVisual::crc( Xfer *xfer ) { -} // end CRC +} // ------------------------------------------------------------------------------------------------ /** Xfer @@ -119,7 +119,7 @@ void TerrainVisual::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -127,7 +127,7 @@ void TerrainVisual::xfer( Xfer *xfer ) void TerrainVisual::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp index 58b615b06b8..3a50a19d039 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp @@ -247,7 +247,7 @@ void View::getScreenCornerWorldPointsAtZ( Coord3D *topLeft, Coord3D *topRight, screenToWorldAtZ( &screenBottomLeft, bottomLeft, z ); screenToWorldAtZ( &screenBottomRight, bottomRight, z ); -} // end getScreenCornerWorldPointsAtZ +} // ------------------------------------------------------------------------------------------------ /** Xfer method for a view */ @@ -273,4 +273,4 @@ void View::xfer( Xfer *xfer ) xfer->xferReal( &viewPos.z ); lookAt( &viewPos ); -} // end xfer +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Water.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Water.cpp index 9f17472f4b8..2e2cd7b4e7a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Water.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Water.cpp @@ -122,13 +122,13 @@ WaterSetting::WaterSetting( void ) m_uScrollPerMs = 0.0f; m_vScrollPerMs = 0.0f; -} // end WaterSetting +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- WaterSetting::~WaterSetting( void ) { -} // end WaterSetting +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp index d6770eef4c2..2fc67e38501 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp @@ -433,7 +433,7 @@ void AI::parseAiDataDefinition( INI* ini ) // parse the ini weapon definition ini->initFromINI( TheAI->m_aiData, TheAIFieldParseTable ); - } // end if + } } @@ -985,7 +985,7 @@ void TAiData::crc( Xfer *xfer ) xfer->xferBool( &m_enableRepulsors ); CRCGEN_LOG(("CRC after AI TAiData for frame %d is 0x%8.8X", TheGameLogic->getFrame(), ((XferCRC *)xfer)->getCRC())); -} // end crc +} //----------------------------------------------------------------------------- void TAiData::xfer( Xfer *xfer ) @@ -996,13 +996,13 @@ void TAiData::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} //----------------------------------------------------------------------------- void TAiData::loadPostProcess( void ) { -} // end loadPostProcess +} //----------------------------------------------------------------------------- void AI::crc( Xfer *xfer ) @@ -1031,7 +1031,7 @@ void AI::crc( Xfer *xfer ) } } -} // end crc +} //----------------------------------------------------------------------------- void AI::xfer( Xfer *xfer ) @@ -1042,12 +1042,12 @@ void AI::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} //----------------------------------------------------------------------------- void AI::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp index 39cbd8b84e1..de1045340d7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp @@ -92,7 +92,7 @@ void AIDockMachine::halt() void AIDockMachine::crc( Xfer *xfer ) { StateMachine::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -105,7 +105,7 @@ void AIDockMachine::xfer( Xfer *xfer ) StateMachine::xfer(xfer); xfer->xferInt(&m_approachPosition); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -113,7 +113,7 @@ void AIDockMachine::xfer( Xfer *xfer ) void AIDockMachine::loadPostProcess( void ) { StateMachine::loadPostProcess(); -} // end loadPostProcess +} // State transition conditions ---------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -158,7 +158,7 @@ void AIDockApproachState::xfer( Xfer *xfer ) AIInternalMoveToState::xfer(xfer); } -} // end xfer +} //---------------------------------------------------------------------------------------------- /** diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp index 88c205969e0..755cb89ef4d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp @@ -2517,9 +2517,9 @@ void AIGroup::groupExecuteRailedTransport( CommandSourceType cmdSource ) if( ai ) ai->aiExecuteRailedTransport( cmdSource ); - } // end for i + } -} // end groupExecuteRailedTransport +} ///< life altering state change, if this AI can do it void AIGroup::groupGoProne( const DamageInfo *damageInfo, CommandSourceType cmdSource ) @@ -2874,9 +2874,9 @@ void AIGroup::groupToggleOvercharge( CommandSourceType cmdSource ) if( obi ) obi->toggle(); - } // end for + } - } // end for, i + } } @@ -2899,7 +2899,7 @@ void AIGroup::groupPickUpPrisoner( Object *prisoner, enum CommandSourceType cmdS if( ai ) ai->aiPickUpPrisoner( prisoner, cmdSource ); - } // end for, i + } } #endif @@ -2923,7 +2923,7 @@ void AIGroup::groupReturnToPrison( Object *prison, enum CommandSourceType cmdSou if( ai ) ai->aiReturnPrisoners( prison, cmdSource ); - } // end for, i + } } #endif @@ -2946,7 +2946,7 @@ void AIGroup::groupCombatDrop( Object *target, const Coord3D &pos, CommandSource if( ai ) ai->aiCombatDrop( target, pos, cmdSource ); - } // end for, i + } } @@ -2966,7 +2966,7 @@ void AIGroup::groupDoCommandButton( const CommandButton *commandButton, CommandS source = *i; source->doCommandButton( commandButton, cmdSource ); - } // end for, i + } } @@ -2986,7 +2986,7 @@ void AIGroup::groupDoCommandButtonAtPosition( const CommandButton *commandButton source = *i; source->doCommandButtonAtPosition( commandButton, pos, cmdSource ); - } // end for, i + } } //------------------------------------------------------------------------------------- @@ -3005,7 +3005,7 @@ void AIGroup::groupDoCommandButtonUsingWaypoints( const CommandButton *commandBu source = *i; source->doCommandButtonUsingWaypoints( commandButton, way, cmdSource ); - } // end for, i + } } //------------------------------------------------------------------------------------- @@ -3024,7 +3024,7 @@ void AIGroup::groupDoCommandButtonAtObject( const CommandButton *commandButton, source = *i; source->doCommandButtonAtObject( commandButton, obj, cmdSource ); - } // end for, i + } } @@ -3340,7 +3340,7 @@ void AIGroup::crc( Xfer *xfer ) xfer->xferUnsignedInt( &m_id ); CRCGEN_LOG(("CRC after AI AIGroup m_id (%d) for frame %d is 0x%8.8X", m_id, TheGameLogic->getFrame(), ((XferCRC *)xfer)->getCRC())); -} // end crc +} //----------------------------------------------------------------------------- void AIGroup::xfer( Xfer *xfer ) @@ -3351,10 +3351,10 @@ void AIGroup::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} //----------------------------------------------------------------------------- void AIGroup::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp index 8f10974100a..1b17fa4c9cd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp @@ -310,7 +310,7 @@ Bool AIGuardMachine::lookForInnerTarget(void) // ------------------------------------------------------------------------------------------------ void AIGuardMachine::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -340,14 +340,14 @@ void AIGuardMachine::xfer( Xfer *xfer ) } } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIGuardMachine::loadPostProcess( void ) { -} // end loadPostProcess +} //-- AIGuardInnerState ---------------------------------------------------------------------------- // ------------------------------------------------------------------------------------------------ @@ -355,7 +355,7 @@ void AIGuardMachine::loadPostProcess( void ) // ------------------------------------------------------------------------------------------------ void AIGuardInnerState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -367,7 +367,7 @@ void AIGuardInnerState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -375,7 +375,7 @@ void AIGuardInnerState::xfer( Xfer *xfer ) void AIGuardInnerState::loadPostProcess( void ) { onEnter(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ AIGuardInnerState::~AIGuardInnerState(void) @@ -486,7 +486,7 @@ void AIGuardInnerState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void AIGuardOuterState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -498,7 +498,7 @@ void AIGuardOuterState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -506,7 +506,7 @@ void AIGuardOuterState::xfer( Xfer *xfer ) void AIGuardOuterState::loadPostProcess( void ) { AIGuardOuterState onEnter(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ AIGuardOuterState::~AIGuardOuterState(void) @@ -609,7 +609,7 @@ void AIGuardOuterState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void AIGuardReturnState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -622,14 +622,14 @@ void AIGuardReturnState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUnsignedInt(&m_nextReturnScanTime); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIGuardReturnState::loadPostProcess( void ) { -} // end loadPostProcess +} //-------------------------------------------------------------------------------------- StateReturnType AIGuardReturnState::onEnter( void ) @@ -685,7 +685,7 @@ void AIGuardReturnState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void AIGuardIdleState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -698,14 +698,14 @@ void AIGuardIdleState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUnsignedInt(&m_nextEnemyScanTime); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIGuardIdleState::loadPostProcess( void ) { -} // end loadPostProcess +} //-------------------------------------------------------------------------------------- StateReturnType AIGuardIdleState::onEnter( void ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuardRetaliate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuardRetaliate.cpp index ccd1c7b3833..896d25c32e5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuardRetaliate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuardRetaliate.cpp @@ -303,7 +303,7 @@ Bool AIGuardRetaliateMachine::lookForInnerTarget(void) // ------------------------------------------------------------------------------------------------ void AIGuardRetaliateMachine::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -322,14 +322,14 @@ void AIGuardRetaliateMachine::xfer( Xfer *xfer ) xfer->xferObjectID(&m_nemesisToAttack); xfer->xferCoord3D(&m_positionToGuard); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIGuardRetaliateMachine::loadPostProcess( void ) { -} // end loadPostProcess +} //-- AIGuardRetaliateInnerState ---------------------------------------------------------------------------- // ------------------------------------------------------------------------------------------------ @@ -337,7 +337,7 @@ void AIGuardRetaliateMachine::loadPostProcess( void ) // ------------------------------------------------------------------------------------------------ void AIGuardRetaliateInnerState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -349,7 +349,7 @@ void AIGuardRetaliateInnerState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -357,7 +357,7 @@ void AIGuardRetaliateInnerState::xfer( Xfer *xfer ) void AIGuardRetaliateInnerState::loadPostProcess( void ) { onEnter(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ AIGuardRetaliateInnerState::~AIGuardRetaliateInnerState(void) @@ -460,7 +460,7 @@ void AIGuardRetaliateInnerState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void AIGuardRetaliateOuterState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -472,7 +472,7 @@ void AIGuardRetaliateOuterState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -480,7 +480,7 @@ void AIGuardRetaliateOuterState::xfer( Xfer *xfer ) void AIGuardRetaliateOuterState::loadPostProcess( void ) { AIGuardRetaliateOuterState onEnter(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ AIGuardRetaliateOuterState::~AIGuardRetaliateOuterState(void) @@ -568,7 +568,7 @@ void AIGuardRetaliateOuterState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void AIGuardRetaliateReturnState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -581,14 +581,14 @@ void AIGuardRetaliateReturnState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUnsignedInt(&m_nextReturnScanTime); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIGuardRetaliateReturnState::loadPostProcess( void ) { -} // end loadPostProcess +} //-------------------------------------------------------------------------------------- StateReturnType AIGuardRetaliateReturnState::onEnter( void ) @@ -638,7 +638,7 @@ void AIGuardRetaliateReturnState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void AIGuardRetaliateIdleState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -651,14 +651,14 @@ void AIGuardRetaliateIdleState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUnsignedInt(&m_nextEnemyScanTime); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIGuardRetaliateIdleState::loadPostProcess( void ) { -} // end loadPostProcess +} //-------------------------------------------------------------------------------------- StateReturnType AIGuardRetaliateIdleState::onEnter( void ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 91bceb08347..6f21aa37042 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -268,7 +268,7 @@ Path::~Path( void ) // ------------------------------------------------------------------------------------------------ void Path::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -380,14 +380,14 @@ void Path::xfer( Xfer *xfer ) TheAI->pathfinder()->setDebugPath(this); } #endif -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void Path::loadPostProcess( void ) { -} // end loadPostProcess +} /** * Create a new node at the head of the path @@ -3936,11 +3936,11 @@ void Pathfinder::removeWallPiece(Object *wallPiece) // all done return; - } // end if + } - } // end for, i + } -} // end removeWallPiece +} /** * Checks if a point is on the wall. @@ -4318,11 +4318,11 @@ void Pathfinder::internal_classifyObjectFootprint( Object *obj, Bool insert ) if (cellBounds.hi.yxferInt(&m_cumulativeCellsAllocated); CRCDEBUG_LOG(("m_cumulativeCellsAllocated: %8.8X", ((XferCRC *)xfer)->getCRC())); -} // end crc +} //----------------------------------------------------------------------------- void Pathfinder::xfer( Xfer *xfer ) @@ -11140,10 +11140,10 @@ void Pathfinder::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} //----------------------------------------------------------------------------- void Pathfinder::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp index 0defac3a397..6820d988c6c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp @@ -501,7 +501,7 @@ Object *AIPlayer::buildStructureNow(const ThingTemplate *bldgPlan, BuildListInfo exitInterface->setRallyPoint(&rallyPoint); } } - } // bldg built + } return bldg; } @@ -690,7 +690,7 @@ Object *AIPlayer::buildStructureWithDozer(const ThingTemplate *bldgPlan, BuildLi bldgName.concat(" - Building started."); TheScriptEngine->AppendDebugMessage(bldgName, false); } - } // bldg built + } TheTerrainVisual->removeAllBibs(); // isLocationLegalToBuild adds bib feedback, turn it off. jba. return bldg; } @@ -804,7 +804,7 @@ void AIPlayer::processBaseBuilding( void ) m_frameLastBuildingBuilt = TheGameLogic->getFrame(); // only build one building per delay loop break; - } // bldg built + } #else // force delay between rebuilds @@ -839,12 +839,12 @@ void AIPlayer::processBaseBuilding( void ) m_frameLastBuildingBuilt = TheGameLogic->getFrame(); // only build one building per delay loop break; - } // bldg built - } // have money - } // rebuild delay ok + } + } + } #endif - } // building missing - } // is buildable + } + } } } } @@ -1038,7 +1038,7 @@ Bool AIPlayer::isLocationSafe(const Coord3D *pos, const ThingTemplate *tthing ) } return true; -} // isSupplySourceSafe +} // ------------------------------------------------------------------------------------------------ @@ -1407,7 +1407,7 @@ Bool AIPlayer::startTraining( WorkOrder *order, Bool busyOK, AsciiString teamNam } return true; } - } // end if + } return FALSE; @@ -1446,9 +1446,9 @@ Object *AIPlayer::findFactory(const ThingTemplate *thing, Bool busyOK) Bool busy = pu->getProductionCount()>0; if (!busy) return factory; // found a not busy factory. if (busyOK) busyFactory = factory; - } // end if + } - } // end for + } // We didn't find an idle factory, so return the busy one. if (busyOK) return busyFactory; return NULL; @@ -1842,8 +1842,8 @@ void AIPlayer::buildUpgrade(const AsciiString &upgrade) TheScriptEngine->AppendDebugMessage( msg, false); return; } - } // end if - } // end for + } + } AsciiString msg = TheNameKeyGenerator->keyToName(m_player->getPlayerNameKey()); msg.concat(" lacks factory to build upgrade "); @@ -3297,7 +3297,7 @@ Object * AIPlayer::findDozer( const Coord3D *pos ) void AIPlayer::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -3340,9 +3340,9 @@ void AIPlayer::xfer( Xfer *xfer ) // xfer it xfer->xferSnapshot( teamInQueue ); - } // end for, iterate team build queue + } - } // end if, save + } else { @@ -3353,7 +3353,7 @@ void AIPlayer::xfer( Xfer *xfer ) DEBUG_CRASH(( "AIPlayer::xfer - TeamBuildQueue head is not NULL, you should delete it or something before loading a new list" )); throw SC_INVALID_DATA; - } // end if + } // ready all data for( UnsignedShort i = 0; i < teamBuildQueueCount; ++i ) @@ -3368,12 +3368,12 @@ void AIPlayer::xfer( Xfer *xfer ) // xfer data xfer->xferSnapshot( teamInQueue ); - } // end for, i + } // the list was loaded in reverse order, reverse the list so it's in the same order as before reverse_TeamBuildQueue(); - } // end else, load + } // team ready queue count UnsignedShort teamReadyQueueCount = 0; @@ -3399,9 +3399,9 @@ void AIPlayer::xfer( Xfer *xfer ) // xfer data xfer->xferSnapshot( teamReadyQueue ); - } // end for, iterate team ready queue + } - } // end if, save + } else { @@ -3412,7 +3412,7 @@ void AIPlayer::xfer( Xfer *xfer ) DEBUG_CRASH(( "AIPlayer::xfer - TeamReadyQueue head is not NULL, you should delete it or something before loading a new list" )); throw SC_INVALID_DATA; - } // end if + } // read all data for( UnsignedShort i = 0; i < teamReadyQueueCount; ++i ) @@ -3427,12 +3427,12 @@ void AIPlayer::xfer( Xfer *xfer ) // xfer data xfer->xferSnapshot( teamInQueue ); - } // end for, i + } // reverse the list since it was loaded in reverse order due to the prepend reverse_TeamReadyQueue(); - } // end else, load + } // xfer player index ... this is really just for sanity PlayerIndex playerIndex = m_player->getPlayerIndex(); @@ -3443,7 +3443,7 @@ void AIPlayer::xfer( Xfer *xfer ) DEBUG_CRASH(( "AIPlayer::xfer - player index mismatch" )); throw SC_INVALID_DATA; - } // end if + } // xfer the rest of the ai player data (it's pretty straight forward) xfer->xferBool( &m_readyToBuildTeam ); @@ -3473,7 +3473,7 @@ void AIPlayer::xfer( Xfer *xfer ) xfer->xferBool( &m_dozerIsRepairing ); xfer->xferInt( &m_bridgeTimer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -3481,7 +3481,7 @@ void AIPlayer::xfer( Xfer *xfer ) void AIPlayer::loadPostProcess( void ) { -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -3605,7 +3605,7 @@ void TeamInQueue::disband() void TeamInQueue::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -3638,9 +3638,9 @@ void TeamInQueue::xfer( Xfer *xfer ) // xfer work order data xfer->xferSnapshot( workOrder ); - } // end for + } - } // end if, save + } else { @@ -3651,7 +3651,7 @@ void TeamInQueue::xfer( Xfer *xfer ) DEBUG_CRASH(( "TeamInQueue::xfer - m_workOrders should be NULL but isn't. Perhaps you should blow it away before loading" )); throw SC_INVALID_DATA; - } // end if + } // load all work orders for( UnsignedShort i = 0; i < workOrderCount; ++i ) @@ -3673,14 +3673,14 @@ void TeamInQueue::xfer( Xfer *xfer ) last->m_next = workOrder; - } // end else + } // load work order data xfer->xferSnapshot( workOrder ); - } // end for, i + } - } // end else, load + } // xfer the rest of the team in queue data xfer->xferBool( &m_priorityBuild ); @@ -3694,7 +3694,7 @@ void TeamInQueue::xfer( Xfer *xfer ) xfer->xferBool( &m_reinforcement ); xfer->xferObjectID( &m_reinforcementID ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -3702,7 +3702,7 @@ void TeamInQueue::xfer( Xfer *xfer ) void TeamInQueue::loadPostProcess( void ) { -} // end loadPostProcess +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -3713,7 +3713,7 @@ void TeamInQueue::loadPostProcess( void ) WorkOrder::~WorkOrder() { -} // end WorkOrder +} // ------------------------------------------------------------------------------------------------ /** Verify factoryID still refers to an active object */ @@ -3732,7 +3732,7 @@ void WorkOrder::validateFactory( Player *thisPlayer ) m_factoryID = INVALID_ID; } -} // end validateFactory +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -3740,7 +3740,7 @@ void WorkOrder::validateFactory( Player *thisPlayer ) void WorkOrder::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -3776,7 +3776,7 @@ void WorkOrder::xfer( Xfer *xfer ) // is resource gatherer xfer->xferBool( &m_isResourceGatherer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -3784,7 +3784,7 @@ void WorkOrder::xfer( Xfer *xfer ) void WorkOrder::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index 08454e38ca5..1a9aa51f7e9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp @@ -265,7 +265,7 @@ void AISkirmishPlayer::processBaseBuilding( void ) } m_frameLastBuildingBuilt = TheGameLogic->getFrame(); // only build one building per delay loop - } // bldg built + } #else // force delay between rebuilds @@ -300,9 +300,9 @@ void AISkirmishPlayer::processBaseBuilding( void ) m_frameLastBuildingBuilt = TheGameLogic->getFrame(); // only build one building per delay loop break; - } // bldg built - } // have money - } // rebuild delay ok + } + } + } #endif } } @@ -339,7 +339,7 @@ Bool AISkirmishPlayer::startTraining( WorkOrder *order, Bool busyOK, AsciiString } return true; } - } // end if + } return FALSE; @@ -1182,7 +1182,7 @@ Bool AISkirmishPlayer::computeSuperweaponTarget(const SpecialPowerTemplate *powe void AISkirmishPlayer::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1224,7 +1224,7 @@ void AISkirmishPlayer::xfer( Xfer *xfer ) // right flank right defense angle xfer->xferReal( &m_curRightFlankRightDefenseAngle ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1232,5 +1232,5 @@ void AISkirmishPlayer::xfer( Xfer *xfer ) void AISkirmishPlayer::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 8c30b6ae81c..9cccaf8b2c1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -232,7 +232,7 @@ static Bool isSamePosition( const Coord3D *ourPos, const Coord3D *prevTargetPos, void AttackStateMachine::crc( Xfer *xfer ) { StateMachine::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -244,7 +244,7 @@ void AttackStateMachine::xfer( Xfer *xfer ) xfer->xferVersion( &v, cv ); StateMachine::xfer(xfer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -252,7 +252,7 @@ void AttackStateMachine::xfer( Xfer *xfer ) void AttackStateMachine::loadPostProcess( void ) { StateMachine::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- static Bool inWeaponRangeObject(State *thisState, void* userData); @@ -473,7 +473,7 @@ AIRappelState::AIRappelState( StateMachine *machine ) : State( machine, "AIRappe // ------------------------------------------------------------------------------------------------ void AIRappelState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -488,14 +488,14 @@ void AIRappelState::xfer( Xfer *xfer ) xfer->xferReal(&m_rappelRate); xfer->xferReal(&m_destZ); xfer->xferBool(&m_targetIsBldg); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIRappelState::loadPostProcess( void ) { -} // end loadPostProcess +} //----------------------------------------------------------------------------------------------------------- StateReturnType AIRappelState::onEnter() { @@ -741,7 +741,7 @@ AIStateMachine::~AIStateMachine() void AIStateMachine::crc( Xfer *xfer ) { StateMachine::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -807,7 +807,7 @@ void AIStateMachine::xfer( Xfer *xfer ) } xfer->xferUnsignedInt(&m_temporaryStateFramEnd); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -815,7 +815,7 @@ void AIStateMachine::xfer( Xfer *xfer ) void AIStateMachine::loadPostProcess( void ) { StateMachine::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- /** @@ -1275,7 +1275,7 @@ AIIdleState::AIIdleState( StateMachine *machine, AIIdleState::AIIdleTargetingTyp // ------------------------------------------------------------------------------------------------ void AIIdleState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1290,14 +1290,14 @@ void AIIdleState::xfer( Xfer *xfer ) xfer->xferUnsignedShort(&m_initialSleepOffset); xfer->xferBool(&m_shouldLookForTargets); xfer->xferBool(&m_inited); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIIdleState::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------- /** * Stake out our space. @@ -1457,7 +1457,7 @@ StateReturnType AIIdleState::update() m_initialSleepOffset = oldSleepOffset; } } - } // end if, should look for targets + } return STATE_SLEEP(timeToSleep); } @@ -1543,7 +1543,7 @@ void AIDeadState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void AIInternalMoveToState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1563,7 +1563,7 @@ void AIInternalMoveToState::xfer( Xfer *xfer ) xfer->xferUnsignedInt(&m_pathTimestamp); xfer->xferUnsignedInt(&m_blockedRepathTimestamp); xfer->xferBool(&m_adjustDestinations); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1571,7 +1571,7 @@ void AIInternalMoveToState::xfer( Xfer *xfer ) void AIInternalMoveToState::loadPostProcess( void ) { startMoveSound(); -} // end loadPostProcess +} Bool AIInternalMoveToState::getAdjustsDestination() const { @@ -1961,7 +1961,7 @@ class AIAttackMoveStateMachine : public StateMachine void AIAttackMoveStateMachine::crc( Xfer *xfer ) { StateMachine::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1973,7 +1973,7 @@ void AIAttackMoveStateMachine::xfer( Xfer *xfer ) xfer->xferVersion( &v, cv ); StateMachine::xfer(xfer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1981,7 +1981,7 @@ void AIAttackMoveStateMachine::xfer( Xfer *xfer ) void AIAttackMoveStateMachine::loadPostProcess( void ) { StateMachine::loadPostProcess(); -} // end loadPostProcess +} //----------------------------------------------------------------------------------------------------------- AIAttackMoveStateMachine::AIAttackMoveStateMachine(Object *owner, AsciiString name) : StateMachine(owner, name) @@ -2197,7 +2197,7 @@ void AIMoveOutOfTheWayState::onExit( StateExitType status ) void AIMoveAndTightenState::crc( Xfer *xfer ) { AIInternalMoveToState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -2213,7 +2213,7 @@ void AIMoveAndTightenState::xfer( Xfer *xfer ) AIInternalMoveToState::xfer(xfer); xfer->xferInt(&m_okToRepathTimes); xfer->xferBool(&m_checkForPath); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -2221,7 +2221,7 @@ void AIMoveAndTightenState::xfer( Xfer *xfer ) void AIMoveAndTightenState::loadPostProcess( void ) { AIInternalMoveToState::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIMoveAndTightenState::onEnter() @@ -2511,7 +2511,7 @@ Bool AIAttackApproachTargetState::computePath() void AIAttackApproachTargetState::crc( Xfer *xfer ) { AIInternalMoveToState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -2532,7 +2532,7 @@ void AIAttackApproachTargetState::xfer( Xfer *xfer ) xfer->xferBool(&m_isAttackingObject); xfer->xferBool(&m_stopIfInRange); xfer->xferBool(&m_isInitialApproach); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -2541,7 +2541,7 @@ void AIAttackApproachTargetState::loadPostProcess( void ) { // extend base class AIInternalMoveToState::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIAttackApproachTargetState::onEnter() @@ -2900,7 +2900,7 @@ Bool AIAttackPursueTargetState::computePath() void AIAttackPursueTargetState::crc( Xfer *xfer ) { AIInternalMoveToState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -2921,7 +2921,7 @@ void AIAttackPursueTargetState::xfer( Xfer *xfer ) xfer->xferBool(&m_isAttackingObject); xfer->xferBool(&m_stopIfInRange); xfer->xferBool(&m_isInitialApproach); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -2930,7 +2930,7 @@ void AIAttackPursueTargetState::loadPostProcess( void ) { // extend base class AIInternalMoveToState::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIAttackPursueTargetState::onEnter() @@ -3136,7 +3136,7 @@ Bool AIPickUpCrateState::computePath() void AIPickUpCrateState::crc( Xfer *xfer ) { AIInternalMoveToState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -3154,7 +3154,7 @@ void AIPickUpCrateState::xfer( Xfer *xfer ) xfer->xferInt(&m_delayCounter); xfer->xferCoord3D(&m_goalPosition); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -3163,7 +3163,7 @@ void AIPickUpCrateState::loadPostProcess( void ) { // extend base class AIInternalMoveToState::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIPickUpCrateState::onEnter() @@ -3214,7 +3214,7 @@ StateReturnType AIPickUpCrateState::update() void AIFollowPathState::crc( Xfer *xfer ) { AIInternalMoveToState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -3231,7 +3231,7 @@ void AIFollowPathState::xfer( Xfer *xfer ) xfer->xferInt(&m_index); xfer->xferBool(&m_adjustFinal); xfer->xferBool(&m_adjustFinalOverride); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -3239,7 +3239,7 @@ void AIFollowPathState::xfer( Xfer *xfer ) void AIFollowPathState::loadPostProcess( void ) { AIInternalMoveToState::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIFollowPathState::onEnter() @@ -3416,7 +3416,7 @@ StateReturnType AIFollowPathState::update() void AIMoveAndEvacuateState::crc( Xfer *xfer ) { AIInternalMoveToState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -3431,7 +3431,7 @@ void AIMoveAndEvacuateState::xfer( Xfer *xfer ) AIInternalMoveToState::xfer(xfer); xfer->xferCoord3D(&m_origin); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -3439,7 +3439,7 @@ void AIMoveAndEvacuateState::xfer( Xfer *xfer ) void AIMoveAndEvacuateState::loadPostProcess( void ) { AIInternalMoveToState::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIMoveAndEvacuateState::onEnter() @@ -3522,7 +3522,7 @@ AIAttackMoveToState::~AIAttackMoveToState() // ------------------------------------------------------------------------------------------------ void AIAttackMoveToState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -3542,14 +3542,14 @@ void AIAttackMoveToState::xfer( Xfer *xfer ) xfer->xferInt(&m_retryCount); } xfer->xferSnapshot(m_attackMoveMachine); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIAttackMoveToState::loadPostProcess( void ) { -} // end loadPostProcess +} #ifdef STATE_MACHINE_DEBUG //---------------------------------------------------------------------------------------------------------- @@ -3685,7 +3685,7 @@ StateReturnType AIAttackMoveToState::update() void AIMoveAndDeleteState::crc( Xfer *xfer ) { AIInternalMoveToState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -3700,7 +3700,7 @@ void AIMoveAndDeleteState::xfer( Xfer *xfer ) AIInternalMoveToState::xfer(xfer); xfer->xferBool(&m_appendGoalPosition); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -3708,7 +3708,7 @@ void AIMoveAndDeleteState::xfer( Xfer *xfer ) void AIMoveAndDeleteState::loadPostProcess( void ) { AIInternalMoveToState::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIMoveAndDeleteState::onEnter() @@ -3954,7 +3954,7 @@ void AIFollowWaypointPathState::computeGoal(Bool useGroupOffsets) void AIFollowWaypointPathState::crc( Xfer *xfer ) { AIInternalMoveToState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -3992,7 +3992,7 @@ void AIFollowWaypointPathState::xfer( Xfer *xfer ) } xfer->xferBool(&m_appendGoalPosition); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -4000,7 +4000,7 @@ void AIFollowWaypointPathState::xfer( Xfer *xfer ) void AIFollowWaypointPathState::loadPostProcess( void ) { AIInternalMoveToState::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIFollowWaypointPathState::onEnter() @@ -4253,7 +4253,7 @@ StateReturnType AIFollowWaypointPathState::update() void AIFollowWaypointPathExactState::crc( Xfer *xfer ) { AIInternalMoveToState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -4275,7 +4275,7 @@ void AIFollowWaypointPathExactState::xfer( Xfer *xfer ) { m_lastWaypoint = TheTerrainLogic->getWaypointByID(id); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -4283,7 +4283,7 @@ void AIFollowWaypointPathExactState::xfer( Xfer *xfer ) void AIFollowWaypointPathExactState::loadPostProcess( void ) { AIInternalMoveToState::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIFollowWaypointPathExactState::onEnter() @@ -4387,7 +4387,7 @@ AIAttackFollowWaypointPathState::~AIAttackFollowWaypointPathState() // ------------------------------------------------------------------------------------------------ void AIAttackFollowWaypointPathState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -4403,14 +4403,14 @@ void AIAttackFollowWaypointPathState::xfer( Xfer *xfer ) AIFollowWaypointPathState::xfer( xfer ); xfer->xferSnapshot(m_attackFollowMachine); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIAttackFollowWaypointPathState::loadPostProcess( void ) { -} // end loadPostProcess +} #ifdef STATE_MACHINE_DEBUG //---------------------------------------------------------------------------------------------------------- @@ -4521,7 +4521,7 @@ void AIAttackFollowWaypointPathState ::onExit( StateExitType status ) void AIWanderState::crc( Xfer *xfer ) { AIFollowWaypointPathState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -4537,7 +4537,7 @@ void AIWanderState::xfer( Xfer *xfer ) xfer->xferInt(&m_waitFrames); xfer->xferInt(&m_timer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -4545,7 +4545,7 @@ void AIWanderState::xfer( Xfer *xfer ) void AIWanderState::loadPostProcess( void ) { AIFollowWaypointPathState::loadPostProcess(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -4643,7 +4643,7 @@ void AIWanderState::onExit( StateExitType status ) void AIWanderInPlaceState::crc( Xfer *xfer ) { AIInternalMoveToState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -4660,7 +4660,7 @@ void AIWanderInPlaceState::xfer( Xfer *xfer ) xfer->xferCoord3D(&m_origin); xfer->xferInt(&m_waitFrames); xfer->xferInt(&m_timer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** LoadPostProcess */ @@ -4668,7 +4668,7 @@ void AIWanderInPlaceState::xfer( Xfer *xfer ) void AIWanderInPlaceState::loadPostProcess( void ) { AIInternalMoveToState::loadPostProcess(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ StateReturnType AIWanderInPlaceState::onEnter() @@ -4753,7 +4753,7 @@ void AIWanderInPlaceState::onExit( StateExitType status ) void AIPanicState::crc( Xfer *xfer ) { AIFollowWaypointPathState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -4769,7 +4769,7 @@ void AIPanicState::xfer( Xfer *xfer ) xfer->xferInt(&m_waitFrames); xfer->xferInt(&m_timer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -4777,7 +4777,7 @@ void AIPanicState::xfer( Xfer *xfer ) void AIPanicState::loadPostProcess( void ) { AIFollowWaypointPathState::loadPostProcess(); -} // end loadPostProcess +} /** * Panic and run screaming along a waypoint path. @@ -4878,7 +4878,7 @@ void AIPanicState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void AIAttackAimAtTargetState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -4893,14 +4893,14 @@ void AIAttackAimAtTargetState::xfer( Xfer *xfer ) xfer->xferBool(&m_canTurnInPlace); xfer->xferBool(&m_setLocomotor); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIAttackAimAtTargetState::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIAttackAimAtTargetState::onEnter() @@ -5396,7 +5396,7 @@ AIAttackState::~AIAttackState() // ------------------------------------------------------------------------------------------------ void AIAttackState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -5426,7 +5426,7 @@ void AIAttackState::xfer( Xfer *xfer ) AttackExitConditionsInterface* m_attackParameters; ///< these are not owned by this, and will not be deleted on destruction Bool m_isForceAttacking */ -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -5440,7 +5440,7 @@ void AIAttackState::loadPostProcess( void ) } Object* source = getMachineOwner(); m_lockedWeaponOnEnter = source->isCurWeaponLocked() ? source->getCurrentWeapon() : NULL; -} // end loadPostProcess +} #ifdef STATE_MACHINE_DEBUG //---------------------------------------------------------------------------------------------------------- @@ -5748,7 +5748,7 @@ class AIAttackThenIdleStateMachine : public StateMachine void AIAttackThenIdleStateMachine::crc( Xfer *xfer ) { StateMachine::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -5760,7 +5760,7 @@ void AIAttackThenIdleStateMachine::xfer( Xfer *xfer ) xfer->xferVersion( &v, cv ); StateMachine::xfer(xfer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -5768,7 +5768,7 @@ void AIAttackThenIdleStateMachine::xfer( Xfer *xfer ) void AIAttackThenIdleStateMachine::loadPostProcess( void ) { StateMachine::loadPostProcess(); -} // end loadPostProcess +} //----------------------------------------------------------------------------------------------------------- AIAttackThenIdleStateMachine::AIAttackThenIdleStateMachine(Object *owner, AsciiString name) : StateMachine(owner, name) @@ -5802,7 +5802,7 @@ AIAttackSquadState::~AIAttackSquadState() // ------------------------------------------------------------------------------------------------ void AIAttackSquadState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -5826,14 +5826,14 @@ void AIAttackSquadState::xfer( Xfer *xfer ) if (hasMachine) { xfer->xferSnapshot(m_attackSquadMachine); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIAttackSquadState::loadPostProcess( void ) { -} // end loadPostProcess +} #ifdef STATE_MACHINE_DEBUG //---------------------------------------------------------------------------------------------------------- @@ -6036,7 +6036,7 @@ AIDockState::~AIDockState() // ------------------------------------------------------------------------------------------------ void AIDockState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -6060,14 +6060,14 @@ void AIDockState::xfer( Xfer *xfer ) xfer->xferSnapshot(m_dockMachine); } xfer->xferBool(&m_usingPrecisionMovement); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIDockState::loadPostProcess( void ) { -} // end loadPostProcess +} #ifdef STATE_MACHINE_DEBUG //---------------------------------------------------------------------------------------------------------- @@ -6188,7 +6188,7 @@ StateReturnType AIDockState::update() void AIEnterState::crc( Xfer *xfer ) { AIInternalMoveToState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -6203,7 +6203,7 @@ void AIEnterState::xfer( Xfer *xfer ) AIInternalMoveToState::xfer(xfer); xfer->xferObjectID(&m_entryToClear); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -6211,7 +6211,7 @@ void AIEnterState::xfer( Xfer *xfer ) void AIEnterState::loadPostProcess( void ) { AIInternalMoveToState::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIEnterState::onEnter() @@ -6396,7 +6396,7 @@ StateReturnType AIEnterState::update() // ------------------------------------------------------------------------------------------------ void AIExitState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -6409,14 +6409,14 @@ void AIExitState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferObjectID(&m_entryToClear); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIExitState::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIExitState::onEnter() @@ -6511,7 +6511,7 @@ void AIExitState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void AIExitInstantlyState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -6524,14 +6524,14 @@ void AIExitInstantlyState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferObjectID(&m_entryToClear); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIExitInstantlyState::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIExitInstantlyState::onEnter() @@ -6628,7 +6628,7 @@ AsciiString AIGuardState::getName( ) const // ------------------------------------------------------------------------------------------------ void AIGuardState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -6652,14 +6652,14 @@ void AIGuardState::xfer( Xfer *xfer ) xfer->xferSnapshot(m_guardMachine); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIGuardState::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- @@ -6785,7 +6785,7 @@ AsciiString AIGuardRetaliateState::getName( ) const // ------------------------------------------------------------------------------------------------ void AIGuardRetaliateState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -6811,14 +6811,14 @@ void AIGuardRetaliateState::xfer( Xfer *xfer ) xfer->xferSnapshot(m_guardRetaliateMachine); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIGuardRetaliateState::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- @@ -6924,7 +6924,7 @@ AsciiString AITunnelNetworkGuardState::getName( ) const // ------------------------------------------------------------------------------------------------ void AITunnelNetworkGuardState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -6948,14 +6948,14 @@ void AITunnelNetworkGuardState::xfer( Xfer *xfer ) xfer->xferSnapshot(m_guardMachine); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AITunnelNetworkGuardState::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- @@ -7050,7 +7050,7 @@ AIHuntState::~AIHuntState() // ------------------------------------------------------------------------------------------------ void AIHuntState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -7075,14 +7075,14 @@ void AIHuntState::xfer( Xfer *xfer ) } xfer->xferUnsignedInt(&m_nextEnemyScanTime); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIHuntState::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- //Is our hunt state in an attack sub-state? @@ -7257,7 +7257,7 @@ AIAttackAreaState::~AIAttackAreaState() // ------------------------------------------------------------------------------------------------ void AIAttackAreaState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -7282,14 +7282,14 @@ void AIAttackAreaState::xfer( Xfer *xfer ) } xfer->xferUnsignedInt(&m_nextEnemyScanTime); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AIAttackAreaState::loadPostProcess( void ) { -} // end loadPostProcess +} #ifdef STATE_MACHINE_DEBUG //---------------------------------------------------------------------------------------------------------- @@ -7391,7 +7391,7 @@ StateReturnType AIAttackAreaState::update() // ------------------------------------------------------------------------------------------------ void AIFaceState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -7404,7 +7404,7 @@ void AIFaceState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferBool(&m_canTurnInPlace); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -7412,7 +7412,7 @@ void AIFaceState::xfer( Xfer *xfer ) void AIFaceState::loadPostProcess( void ) { // empty. jba. -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType AIFaceState::onEnter() diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp index 08ce3b24e3d..10de7dd7659 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp @@ -263,7 +263,7 @@ Bool AITNGuardMachine::lookForInnerTarget(void) // ------------------------------------------------------------------------------------------------ void AITNGuardMachine::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -282,14 +282,14 @@ void AITNGuardMachine::xfer( Xfer *xfer ) xfer->xferObjectID(&m_nemesisToAttack); xfer->xferCoord3D(&m_positionToGuard); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AITNGuardMachine::loadPostProcess( void ) { -} // end loadPostProcess +} //-- AITNGuardInnerState ---------------------------------------------------------------------------- // ------------------------------------------------------------------------------------------------ @@ -297,7 +297,7 @@ void AITNGuardMachine::loadPostProcess( void ) // ------------------------------------------------------------------------------------------------ void AITNGuardInnerState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -309,7 +309,7 @@ void AITNGuardInnerState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -317,7 +317,7 @@ void AITNGuardInnerState::xfer( Xfer *xfer ) void AITNGuardInnerState::loadPostProcess( void ) { onEnter(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ AITNGuardInnerState::~AITNGuardInnerState(void) @@ -441,7 +441,7 @@ void AITNGuardInnerState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void AITNGuardOuterState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -453,7 +453,7 @@ void AITNGuardOuterState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -461,7 +461,7 @@ void AITNGuardOuterState::xfer( Xfer *xfer ) void AITNGuardOuterState::loadPostProcess( void ) { AITNGuardOuterState onEnter(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ AITNGuardOuterState::~AITNGuardOuterState(void) @@ -545,7 +545,7 @@ void AITNGuardOuterState::onExit( StateExitType status ) void AITNGuardReturnState::crc( Xfer *xfer ) { AIEnterState::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -560,7 +560,7 @@ void AITNGuardReturnState::xfer( Xfer *xfer ) AIEnterState::xfer(xfer); xfer->xferUnsignedInt(&m_nextReturnScanTime); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -568,7 +568,7 @@ void AITNGuardReturnState::xfer( Xfer *xfer ) void AITNGuardReturnState::loadPostProcess( void ) { AIEnterState::loadPostProcess(); -} // end loadPostProcess +} //-------------------------------------------------------------------------------------- StateReturnType AITNGuardReturnState::onEnter( void ) @@ -651,7 +651,7 @@ void AITNGuardReturnState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void AITNGuardIdleState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -664,14 +664,14 @@ void AITNGuardIdleState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUnsignedInt(&m_nextEnemyScanTime); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void AITNGuardIdleState::loadPostProcess( void ) { -} // end loadPostProcess +} //-------------------------------------------------------------------------------------- StateReturnType AITNGuardIdleState::onEnter( void ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/Squad.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/Squad.cpp index 92d4e180864..738ef5f3514 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/Squad.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/Squad.cpp @@ -193,7 +193,7 @@ void Squad::aiGroupFromSquad(AIGroup* aiGroupToFill) void Squad::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -226,9 +226,9 @@ void Squad::xfer( Xfer *xfer ) objectID = *it; xfer->xferObjectID( &objectID ); - } // end for, it + } - } // end if, save + } else { @@ -239,7 +239,7 @@ void Squad::xfer( Xfer *xfer ) DEBUG_CRASH(( "Squad::xfer - m_objectsCached should be emtpy, but is not" )); throw SC_INVALID_DATA; - } // end of + } // read all items for( UnsignedShort i = 0; i < objectCount; ++i ) @@ -251,11 +251,11 @@ void Squad::xfer( Xfer *xfer ) // put on list m_objectIDs.push_back( objectID ); - } // end for, i + } - } // end else, load + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -263,4 +263,4 @@ void Squad::xfer( Xfer *xfer ) void Squad::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp index 5fbfb0b38e5..3e9d267f984 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp @@ -143,7 +143,7 @@ StateReturnType TurretStateMachine::setState(StateID newStateID) // ------------------------------------------------------------------------------------------------ void TurretStateMachine::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -154,14 +154,14 @@ void TurretStateMachine::xfer( Xfer *xfer ) XferVersion v = cv; xfer->xferVersion( &v, cv ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void TurretStateMachine::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------- @@ -329,7 +329,7 @@ TurretAI::~TurretAI() // ------------------------------------------------------------------------------------------------ void TurretAI::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -369,7 +369,7 @@ void TurretAI::xfer( Xfer *xfer ) if (version >= 2) xfer->xferUnsignedInt(&m_sleepUntil); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -380,7 +380,7 @@ void TurretAI::loadPostProcess( void ) if (victim) { m_victimInitialTeam = victim->getTeam(); } -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- Bool TurretAI::friend_turnTowardsAngle(Real desiredAngle, Real rateModifier, Real relThresh) @@ -738,7 +738,7 @@ UpdateSleepTime TurretAI::updateTurretAI() subMachineSleep = UPDATE_SLEEP_NONE; } - } // if enabled or recentering + } m_sleepUntil = now + subMachineSleep; @@ -1253,7 +1253,7 @@ void TurretAIRecenterTurretState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void TurretAIIdleState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1266,14 +1266,14 @@ void TurretAIIdleState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUnsignedInt(&m_nextIdleScan); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void TurretAIIdleState::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- void TurretAIIdleState::resetIdleScan() @@ -1287,7 +1287,6 @@ void TurretAIIdleState::resetIdleScan() StateReturnType TurretAIIdleState::onEnter() { AIUpdateInterface *ai = getMachineOwner()->getAIUpdateInterface(); - // ai doesn't exist if the object was just created this frame. if (ai) { ai->resetNextMoodCheckTime(); @@ -1331,7 +1330,7 @@ StateReturnType TurretAIIdleState::update() // ------------------------------------------------------------------------------------------------ void TurretAIIdleScanState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1344,14 +1343,14 @@ void TurretAIIdleScanState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferReal(&m_desiredAngle); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void TurretAIIdleScanState::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType TurretAIIdleScanState::onEnter() @@ -1406,7 +1405,7 @@ void TurretAIIdleScanState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void TurretAIHoldTurretState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1419,14 +1418,14 @@ void TurretAIHoldTurretState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUnsignedInt(&m_timestamp); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void TurretAIHoldTurretState::loadPostProcess( void ) { -} // end loadPostProcess +} //---------------------------------------------------------------------------------------------------------- StateReturnType TurretAIHoldTurretState::onEnter() diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp index 7ccf26fbed0..02c72545945 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp @@ -513,7 +513,7 @@ Bool PolygonTrigger::isValid(void) const void PolygonTrigger::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -542,7 +542,7 @@ void PolygonTrigger::xfer( Xfer *xfer ) // xfer point xfer->xferICoord3D( point ); - } // end for, i + } // bounds xfer->xferIRegion2D( &m_bounds ); @@ -553,7 +553,7 @@ void PolygonTrigger::xfer( Xfer *xfer ) // bounds need update xfer->xferBool( &m_boundsNeedsUpdate ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -561,4 +561,4 @@ void PolygonTrigger::xfer( Xfer *xfer ) void PolygonTrigger::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp index a0a9f243ddd..cb2f9db9521 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp @@ -842,7 +842,7 @@ Bool SidesList::validateSides() void SidesList::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -866,7 +866,7 @@ void SidesList::xfer( Xfer *xfer ) DEBUG_CRASH(( "SidesList::xfer - The sides list size has changed, this was not supposed to happen, you must version this method and figure out how to translate between old and new versions now" )); throw SC_INVALID_DATA; - } // end if + } // side data ScriptList *scriptList; @@ -885,13 +885,13 @@ void SidesList::xfer( Xfer *xfer ) DEBUG_CRASH(( "SidesList::xfer - script list missing/present mismatch" )); throw SC_INVALID_DATA; - } // end if + } if( scriptListPresent ) xfer->xferSnapshot( scriptList ); - } // end for i + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -899,7 +899,7 @@ void SidesList::xfer( Xfer *xfer ) void SidesList::loadPostProcess( void ) { -} // end loadPostProcess +} /* ********* BuildListInfo class ****************************/ /** @@ -1010,7 +1010,7 @@ BuildListInfo *BuildListInfo::duplicate(void) void BuildListInfo::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1052,7 +1052,7 @@ void BuildListInfo::xfer( Xfer *xfer ) xfer->xferInt(&m_currentGatherers); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1060,7 +1060,7 @@ void BuildListInfo::xfer( Xfer *xfer ) void BuildListInfo::loadPostProcess( void ) { -} // end loadPostProcess +} /* ********* TeamsInfoRec class ****************************/ TeamsInfoRec::TeamsInfoRec() : diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp index 78ca76dea59..ef2c21ac4ac 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp @@ -86,14 +86,14 @@ m_biDirectional(biDirectional) for (i=0; inewObject( towerTemplate, bridge->getTeam() ); @@ -169,7 +169,7 @@ Object *Bridge::createTower( Coord3D *worldPos, DEBUG_CRASH(( "Bridge::createTower - Unknown bridge tower type '%d'", towerType )); return NULL; - } // end switch + } // set the position and angle tower->setPosition( worldPos ); @@ -193,7 +193,7 @@ Object *Bridge::createTower( Coord3D *worldPos, // save our position type bridgeTowerInterface->setTowerType( towerType ); - } // end if + } // if the bridge is indestructible, so is this tower BodyModuleInterface *bridgeBody = bridge->getBodyModule(); @@ -203,12 +203,12 @@ Object *Bridge::createTower( Coord3D *worldPos, towerBody->setIndestructible( TRUE ); - } // end if + } // return the newly created tower return tower; -} // end createTower +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -310,17 +310,17 @@ m_bridgeInfo(theInfo) pos.y -= v.y*offset; break; - } // end switch + } tower = createTower( &pos, type, towerTemplate, bridge ); // store the tower object ID m_bridgeInfo.towerObjectID[ i ] = tower->getID(); - } // end for, i + } #endif m_next = NULL; -} // end Bridge +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -423,7 +423,7 @@ Bridge::Bridge(Object *bridgeObj) pos.y -= v.y*offset; break; - } // end switch + } tower = createTower( &pos, type, towerTemplate, bridgeObj ); if( tower ) { @@ -431,17 +431,17 @@ Bridge::Bridge(Object *bridgeObj) m_bridgeInfo.towerObjectID[ i ] = tower->getID(); } - } // end for, i + } m_next = NULL; -} // end Bridge +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- Bridge::~Bridge() { -} // end ~Bridge +} //------------------------------------------------------------------------------------------------- @@ -542,7 +542,7 @@ Bool LineInRegion( const Coord2D *p1, const Coord2D *p2, const Region2D *clipReg if ((clipCode1 | clipCode2) == 0) { return TRUE; - } // end if + } // Both points outside window? if (clipCode1 & clipCode2) @@ -626,7 +626,7 @@ Bool LineInRegion( const Coord2D *p1, const Coord2D *p2, const Region2D *clipReg x2 >= clipLeft && x2 <= clipRight && y2 >= clipTop && y2 <= clipBottom); -} // end LineInRegion +} static Bool PointInRegion2D( const Coord3D *pt, const Region2D *clipRegion ) { @@ -973,7 +973,7 @@ TerrainLogic::TerrainLogic() m_waterToUpdate[ i ].damageAmount = 0.0f; m_waterToUpdate[ i ].currentHeight = 0.0f; - } // end for i + } m_numWaterToUpdate = 0; m_waypointListHead = NULL; @@ -984,7 +984,7 @@ TerrainLogic::TerrainLogic() m_mapDY = 0; -} // end TerrainLogic +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -993,7 +993,7 @@ TerrainLogic::~TerrainLogic() reset(); // just in case -} // end ~TerrainLogic +} //------------------------------------------------------------------------------------------------- /** Init */ @@ -1001,7 +1001,7 @@ TerrainLogic::~TerrainLogic() void TerrainLogic::init( void ) { -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset */ @@ -1014,7 +1014,7 @@ void TerrainLogic::reset( void ) PolygonTrigger::deleteTriggers(); m_numWaterToUpdate = 0; -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update */ @@ -1058,14 +1058,14 @@ void TerrainLogic::update( void ) if( currentHeight + changePerFrame >= targetHeight ) finalTransition = TRUE; - } // end if + } else { if( currentHeight + changePerFrame <= targetHeight ) finalTransition = TRUE; - } // end else + } if( finalTransition == TRUE ) { @@ -1085,7 +1085,7 @@ void TerrainLogic::update( void ) m_waterToUpdate[ i ] = m_waterToUpdate[ j ]; m_numWaterToUpdate -= 1; - } // end if + } else { @@ -1107,13 +1107,13 @@ void TerrainLogic::update( void ) // update actual water setWaterHeight( water, currentHeight, damageAmount, FALSE ); - } // end else + } - } // end for i + } - } // end if + } -} // end update +} //------------------------------------------------------------------------------------------------- /** newMap */ @@ -1139,7 +1139,7 @@ void TerrainLogic::newMap( Bool saveGame ) enable = TRUE; enableWaterGrid( enable ); -} // end newMap +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1170,7 +1170,7 @@ void TerrainLogic::enableWaterGrid( Bool enable ) waterSettingIndex = i; break; // exit for i - } // end if + } // // no exact map name (including path) was found, try to look for a match in just the @@ -1203,9 +1203,9 @@ void TerrainLogic::enableWaterGrid( Bool enable ) waterSettingIndex = i; break; // exit for i - } // end if + } - } // end for i + } // check for no match found if( waterSettingIndex == -1 ) @@ -1215,7 +1215,7 @@ void TerrainLogic::enableWaterGrid( Bool enable ) TheGlobalData->m_mapName.str() )); return; - } // end if + } TheTerrainVisual->setWaterGridHeightClamps( NULL, TheGlobalData->m_vertexWaterHeightClampLow[ waterSettingIndex ], @@ -1235,12 +1235,12 @@ void TerrainLogic::enableWaterGrid( Bool enable ) TheGlobalData->m_vertexWaterAttenuationC[ waterSettingIndex ], TheGlobalData->m_vertexWaterAttenuationRange[ waterSettingIndex ] ); - } // end if + } // notify the terrain visual of the change TheTerrainVisual->enableWaterGrid( enable ); -} // end enableWaterGrid +} //------------------------------------------------------------------------------------------------- /** device independent terrain logic load. If query is true, we are just loading it to get @@ -1316,7 +1316,7 @@ Bool TerrainLogic::loadMap( AsciiString filename, Bool query ) return TRUE; // success -} // end load +} //------------------------------------------------------------------------------------------------- /** Reads in the waypoint chunk */ @@ -1437,7 +1437,7 @@ Real TerrainLogic::getGroundHeight( Real x, Real y, Coord3D* normal ) const return 0; -} // end getHight +} //------------------------------------------------------------------------------------------------- /** default get height for terrain logic */ @@ -1449,7 +1449,7 @@ Real TerrainLogic::getLayerHeight( Real x, Real y, PathfindLayerEnum layer, Coor return 0; -} // end getLayerHeight +} //------------------------------------------------------------------------------------------------- /** default isCliffCell for terrain logic */ @@ -1459,7 +1459,7 @@ Bool TerrainLogic::isCliffCell( Real x, Real y) const return false; -} // end isCliffCell +} //------------------------------------------------------------------------------------------------- void makeAlignToNormalMatrix( Real angle, const Coord3D& pos, const Coord3D& normal, Matrix3D& mtx) @@ -2010,7 +2010,7 @@ void TerrainLogic::deleteBridge( Bridge *bridge ) m_bridgeListHead = bridge->getNext(); - } // end if + } else { @@ -2029,11 +2029,11 @@ void TerrainLogic::deleteBridge( Bridge *bridge ) otherBridge->setNext( bridge->getNext() ); break; // exit for - } // end if + } - } // end for, otherBridge + } - } // end else + } // delete object associated with bridge if present BridgeInfo bridgeInfo; @@ -2047,7 +2047,7 @@ void TerrainLogic::deleteBridge( Bridge *bridge ) // delete the bridge in question deleteInstance(bridge); -} // end deleteBridge +} //------------------------------------------------------------------------------------------------- /** Returns the ground aligned point on the bounding box closest to the given point*/ @@ -2205,11 +2205,11 @@ const WaterHandle* TerrainLogic::getWaterHandle( Real x, Real y ) waterZ = pTrig->getPoint( 0 )->z; waterHandle = pTrig->getWaterHandle(); - } // end if + } - } // end if + } - } // end for + } /**@todo: Remove this after we have all water types included in water triggers. For now do special check for water grid mesh. */ @@ -2229,13 +2229,13 @@ const WaterHandle* TerrainLogic::getWaterHandle( Real x, Real y ) waterZ = meshZ; waterHandle = &m_gridWaterHandle; - } // end if + } - } // end if + } return waterHandle; -} // end getWaterHandle +} // ------------------------------------------------------------------------------------------------ /** Get water handle by name assigned from the editor */ @@ -2255,7 +2255,7 @@ const WaterHandle* TerrainLogic::getWaterHandleByName( AsciiString name ) return NULL; -} // end getWaterHandleByName +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -2276,7 +2276,7 @@ Real TerrainLogic::getWaterHeight( const WaterHandle *water ) DEBUG_CRASH(( "TerrainLogic::getWaterHeight( WaterHandle *water ) - water is a grid handle, cannot make this query" )); return 0.0f; - } // end if + } // sanity DEBUG_ASSERTCRASH( water->m_polygon != NULL, ("getWaterHeight: polygon trigger in water handle is NULL") ); @@ -2284,7 +2284,7 @@ Real TerrainLogic::getWaterHeight( const WaterHandle *water ) // return the height of the water using the polygon trigger return water->m_polygon->getPoint( 0 )->z; -} // end getWaterHeight +} // ------------------------------------------------------------------------------------------------ /** Set the water height. If the water rises, then any objects that now find themselves @@ -2319,7 +2319,7 @@ void TerrainLogic::setWaterHeight( const WaterHandle *water, Real height, Real d transform.Set_Z_Translation( height ); TheTerrainVisual->setWaterTransform( &transform ); - } // end if + } else { @@ -2339,10 +2339,10 @@ void TerrainLogic::setWaterHeight( const WaterHandle *water, Real height, Real d newPoint.z = height; water->m_polygon->setPoint( newPoint, i ); - } // end for + } height = getWaterHeight(water); - } // end else + } // find the bounding rectangle of this water area Region3D affectedRegion; @@ -2356,7 +2356,7 @@ void TerrainLogic::setWaterHeight( const WaterHandle *water, Real height, Real d // do the pathfind remapping TheAI->pathfinder()->forceMapRecalculation(); - } // end if + } // // if the water height has risen, we need apply water damage to things that are now @@ -2401,13 +2401,13 @@ void TerrainLogic::setWaterHeight( const WaterHandle *water, Real height, Real d damageInfo.in.m_amount = damageAmount; obj->attemptDamage( &damageInfo ); - } // end if + } - } // end for obj + } - } // end if, water has risen + } -} // end setWaterHeight +} // ------------------------------------------------------------------------------------------------ /** Change the height of a water table over time */ @@ -2425,7 +2425,7 @@ void TerrainLogic::changeWaterHeightOverTime( const WaterHandle *water, DEBUG_CRASH(( "Only '%d' simultaneous water table changes are supported", MAX_DYNAMIC_WATER )); return; - } // end if + } // sanity if( water == NULL ) @@ -2450,9 +2450,9 @@ void TerrainLogic::changeWaterHeightOverTime( const WaterHandle *water, // --i; - } // end if + } - } // end for i + } // get the current height of the water Real currentHeight = getWaterHeight( water ); @@ -2468,7 +2468,7 @@ void TerrainLogic::changeWaterHeightOverTime( const WaterHandle *water, // we now have one more entry to update ++m_numWaterToUpdate; -} // end chanageWaterHeightOverTime +} // ------------------------------------------------------------------------------------------------ /** Find the axis aligned bounding region around a water table */ @@ -2526,9 +2526,9 @@ void TerrainLogic::findAxisAlignedBoundingRect( const WaterHandle *water, Region if( v.Y > region->hi.y ) region->hi.y = v.Y; - } // end for i + } - } // end if + } else { @@ -2557,11 +2557,11 @@ void TerrainLogic::findAxisAlignedBoundingRect( const WaterHandle *water, Region if( p->z > region->hi.z ) region->hi.z = p->z; - } // end for i + } - } // end else + } -} // end findAxisAlignedBoundingRect +} void TerrainLogic::setActiveBoundary(Int newActiveBoundary) { @@ -2845,9 +2845,9 @@ void TerrainLogic::flattenTerrain(Object *obj) } } - } // cylinder + } break; - } // switch + } } @@ -2897,8 +2897,8 @@ void TerrainLogic::createCraterInTerrain(Object *obj) TheTerrainVisual->setRawMapHeight( &gridPos, targetHeight ); } - } // next j - } // next i + } + } } @@ -2914,7 +2914,7 @@ void TerrainLogic::createCraterInTerrain(Object *obj) void TerrainLogic::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer @@ -2956,7 +2956,7 @@ void TerrainLogic::xfer( Xfer *xfer ) Int triggerID = m_waterToUpdate[ i ].waterTable->m_polygon->getID(); xfer->xferInt( &triggerID ); - } // end if, save + } else if (xfer->getXferMode() == XFER_LOAD) { @@ -2975,7 +2975,7 @@ void TerrainLogic::xfer( Xfer *xfer ) triggerID )); throw SC_INVALID_DATA; - } // end if + } // set water handle m_waterToUpdate[ i ].waterTable = poly->getWaterHandle(); @@ -2987,9 +2987,9 @@ void TerrainLogic::xfer( Xfer *xfer ) DEBUG_CRASH(( "TerrainLogic::xfer - Polygon trigger to use for water handle has no water handle!" )); throw SC_INVALID_DATA; - } // end if + } - } // end else, load + } // change per frame xfer->xferReal( &m_waterToUpdate[ i ].changePerFrame ); @@ -3003,11 +3003,11 @@ void TerrainLogic::xfer( Xfer *xfer ) // current height xfer->xferReal( &m_waterToUpdate[ i ].currentHeight ); - } // end for, i + } - } // end if + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -3027,5 +3027,5 @@ void TerrainLogic::loadPostProcess( void ) pBridge = pNext; } -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/AutoHealBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/AutoHealBehavior.cpp index fbd61fcb9dd..ef29ea4f27d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/AutoHealBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/AutoHealBehavior.cpp @@ -283,7 +283,7 @@ UpdateSleepTime AutoHealBehavior::update( void ) } } } - } // end for obj + } return UPDATE_SLEEP( d->m_singleBurst ? UPDATE_SLEEP_FOREVER : d->m_healingDelay ); } @@ -329,7 +329,7 @@ void AutoHealBehavior::crc( Xfer *xfer ) // extend base class UpgradeMux::upgradeMuxCRC( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -359,7 +359,7 @@ void AutoHealBehavior::xfer( Xfer *xfer ) // stopped xfer->xferBool( &m_stopped ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -373,4 +373,4 @@ void AutoHealBehavior::loadPostProcess( void ) // extend base class UpgradeMux::upgradeMuxLoadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BattleBusSlowDeathBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BattleBusSlowDeathBehavior.cpp index fe065b5489f..07458c0103a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BattleBusSlowDeathBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BattleBusSlowDeathBehavior.cpp @@ -70,7 +70,7 @@ BattleBusSlowDeathBehaviorModuleData::BattleBusSlowDeathBehaviorModuleData( void m_percentDamageToPassengers = 0.0f; m_emptyHulkDestructionDelay = 0; -} // end BattleBusSlowDeathBehaviorModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -97,7 +97,7 @@ BattleBusSlowDeathBehaviorModuleData::BattleBusSlowDeathBehaviorModuleData( void p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -113,14 +113,14 @@ BattleBusSlowDeathBehavior::BattleBusSlowDeathBehavior( Thing *thing, const Modu m_isInFirstDeath = FALSE; m_groundCheckFrame = 0; m_penaltyDeathFrame = 0; -} // end BattleBusSlowDeathBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ BattleBusSlowDeathBehavior::~BattleBusSlowDeathBehavior( void ) { -} // end ~BattleBusSlowDeathBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -130,7 +130,7 @@ void BattleBusSlowDeathBehavior::onDie( const DamageInfo *damageInfo ) m_isInFirstDeath = FALSE; // and clear this incase we died while in the alternate death SlowDeathBehavior::onDie(damageInfo); -} // end onDie +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -181,7 +181,7 @@ void BattleBusSlowDeathBehavior::beginSlowDeath( const DamageInfo *damageInfo ) SlowDeathBehavior::beginSlowDeath( damageInfo ); } -} // end beginSlowDeath +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -270,7 +270,7 @@ UpdateSleepTime BattleBusSlowDeathBehavior::update( void ) return UPDATE_SLEEP(EMPTY_HULK_CHECK_DELAY);// Stay awake regardless } } -} // end update +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -281,7 +281,7 @@ void BattleBusSlowDeathBehavior::crc( Xfer *xfer ) // extend base class SlowDeathBehavior::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -307,7 +307,7 @@ void BattleBusSlowDeathBehavior::xfer( Xfer *xfer ) xfer->xferUnsignedInt( &m_penaltyDeathFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -318,4 +318,4 @@ void BattleBusSlowDeathBehavior::loadPostProcess( void ) // extend base class SlowDeathBehavior::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BehaviorModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BehaviorModule.cpp index a9a3980dbf1..6effee30f6f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BehaviorModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BehaviorModule.cpp @@ -41,7 +41,7 @@ void BehaviorModule::crc( Xfer *xfer ) // call base class ObjectModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -59,7 +59,7 @@ void BehaviorModule::xfer( Xfer *xfer ) // call base class ObjectModule::xfer( xfer ); -} // xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -70,4 +70,4 @@ void BehaviorModule::loadPostProcess( void ) // call base class ObjectModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp index eb696e770b7..c4213866b62 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp @@ -62,7 +62,7 @@ BridgeBehaviorModuleData::BridgeBehaviorModuleData( void ) m_lateralScaffoldSpeed = 1.0f; m_verticalScaffoldSpeed = 1.0f; -} // end BridgeBehaviorModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -75,7 +75,7 @@ BridgeBehaviorModuleData::~BridgeBehaviorModuleData( void ) // clear the ocl list m_ocl.clear(); -} // end ~BridgeBehaviorModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -94,7 +94,7 @@ BridgeBehaviorModuleData::~BridgeBehaviorModuleData( void ) p.add( dataFieldParse ); -} // end buildFieldParse +} // ------------------------------------------------------------------------------------------------ /** Parse time and location info in the form of: @@ -112,7 +112,7 @@ static void parseTimeAndLocationInfo( INI *ini, void *instance, DEBUG_CRASH(( "Expected 'Delay' token, found '%s'", token )); throw INI_INVALID_DATA; - } // end if + } // delay value ini->parseDurationUnsignedInt( ini, instance, &timeAndLocationInfo->delay, NULL ); @@ -129,14 +129,14 @@ static void parseTimeAndLocationInfo( INI *ini, void *instance, DEBUG_CRASH(( "Expected 'Bone' token, found '%s'", token )); throw INI_INVALID_DATA; - } // end if + } // read bone name and store timeAndLocationInfo->boneName = ini->getNextAsciiString(); - } // end if + } -} // end parseTimeAndLocationInfo +} //------------------------------------------------------------------------------------------------- // ------------------------------------------------------------------------------------------------ @@ -162,7 +162,7 @@ static void parseTimeAndLocationInfo( INI *ini, void *instance, DEBUG_CRASH(( "Expected 'FX' token, found '%s'", token )); throw INI_INVALID_DATA; - } // end if + } // fx list name and store as pointer FXList *fx; @@ -177,7 +177,7 @@ static void parseTimeAndLocationInfo( INI *ini, void *instance, // put on list bridgeFXList->push_back( item ); -} // end parseFX +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -203,7 +203,7 @@ static void parseTimeAndLocationInfo( INI *ini, void *instance, DEBUG_CRASH(( "Expected 'OCL' token, found '%s'", token )); throw INI_INVALID_DATA; - } // end if + } // fx list name and store as pointer ObjectCreationList *ocl; @@ -218,7 +218,7 @@ static void parseTimeAndLocationInfo( INI *ini, void *instance, // put on list bridgeOCLList->push_back( item ); -} // end parseOCL +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -249,17 +249,17 @@ BridgeBehavior::BridgeBehavior( Thing *thing, const ModuleData *moduleData ) m_repairToOCL[ bodyState ][ i ] = NULL; m_repairToFX[ bodyState ][ i ] = NULL; - } // end for i + } // these don't need initialization, they have constructors // m_damageToSound[ bodyState ] = ??? // m_repairToSound[ bodyState ] = ??? - } // end for, bodyState + } m_deathFrame = 0; -} // end BridgeBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -280,9 +280,9 @@ BridgeBehavior::~BridgeBehavior( void ) if( tower ) TheGameLogic->destroyObject( tower ); - } // end for i + } -} // end ~BridgeBehavior +} // ------------------------------------------------------------------------------------------------ /** Get bridge behavior interface */ @@ -303,12 +303,12 @@ BridgeBehavior::~BridgeBehavior( void ) if( bbi ) return bbi; - } // end for, bmi + } // interface not found return NULL; -} // end getBridgeBehaviorInterfaceFromObject +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -318,7 +318,7 @@ void BridgeBehavior::onDelete( void ) // clear the list of scaffold objects m_scaffoldObjectIDList.clear(); -} // end onDelete +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -369,7 +369,7 @@ void BridgeBehavior::resolveFX( void ) if( name.isEmpty() == FALSE && m_repairToFX[ bodyState ][ i ] == NULL ) DEBUG_CRASH(( "FX list '%s' not found", name.str() )); - } // end for i + } // audio sounds name = bridgeTemplate->getDamageToSoundString( (BodyDamageType)bodyState ); @@ -380,12 +380,12 @@ void BridgeBehavior::resolveFX( void ) m_repairToSound[ bodyState ].setEventName( name ); m_repairToSound[ bodyState ].setObjectID( us->getID() ); - } // end for, bodyState + } // fx are now "resolved" m_fxResolved = TRUE; -} // end resolveFX +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -399,7 +399,7 @@ void BridgeBehavior::setTower( BridgeTowerType towerType, Object *tower ) DEBUG_CRASH(( "BridgeBehavior::setTower - Invalid tower type index '%d'", towerType )); return; - } // end if + } // store it if( tower ) @@ -407,7 +407,7 @@ void BridgeBehavior::setTower( BridgeTowerType towerType, Object *tower ) else m_towerID[ towerType ] = INVALID_ID; -} // end setTower +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -421,12 +421,12 @@ ObjectID BridgeBehavior::getTowerID( BridgeTowerType towerType ) DEBUG_CRASH(( "BridgeBehavior::setTower - Invalid tower type index '%d'", towerType )); return INVALID_ID; - } // end if + } // return the stored ID return m_towerID[ towerType ]; -} // end getTowerID +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -464,13 +464,13 @@ void BridgeBehavior::onDamage( DamageInfo *damageInfo ) towerDamage.in.m_deathType = damageInfo->in.m_deathType; tower->attemptDamage( &towerDamage ); - } // end if + } - } // end for i + } - } // end if + } -} // end onDamage +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -502,13 +502,13 @@ void BridgeBehavior::onHealing( DamageInfo *damageInfo ) BodyModuleInterface *towerBody = tower->getBodyModule(); tower->attemptHealing(healingPercentage * towerBody->getMaxHealth(), getObject()); - } // end if + } - } // end for i + } - } // end if + } -} // end onHealing +} // ------------------------------------------------------------------------------------------------ /** Pick a random surface spot on the bridge surface */ @@ -557,7 +557,7 @@ void BridgeBehavior::getRandomSurfacePosition( TerrainRoadType *bridgeTemplate, // pos->z += GameLogicRandomValueReal( 0.0f, bridgeTemplate->getTransitionEffectsHeight() ); -} // end getRandomSurfacePosition +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -591,7 +591,7 @@ void BridgeBehavior::doAreaEffects( TerrainRoadType *bridgeTemplate, getRandomSurfacePosition( bridgeTemplate, bridgeInfo, &pos ); FXList::doFXPos( fx, &pos ); - } // end if + } // pick spot in the bridge area and do OCL if( ocl ) @@ -600,11 +600,11 @@ void BridgeBehavior::doAreaEffects( TerrainRoadType *bridgeTemplate, getRandomSurfacePosition( bridgeTemplate, bridgeInfo, &pos ); ObjectCreationList::create( ocl, getObject(), &pos, NULL, INVALID_ANGLE ); - } // end if + } - } // end for i + } -} // end doAreaEffects +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -641,7 +641,7 @@ void BridgeBehavior::onBodyDamageStateChange( const DamageInfo* damageInfo, DEBUG_CRASH(( "BridgeBehavior - Unable to find bridge" )); return; - } // end if + } // get the bridge template name AsciiString bridgeTemplateName = bridge->getBridgeTemplateName(); @@ -673,7 +673,7 @@ void BridgeBehavior::onBodyDamageStateChange( const DamageInfo* damageInfo, for( Int i = 0; i < MAX_BRIDGE_BODY_FX; i++ ) doAreaEffects( bridgeTemplate, bridge, m_repairToOCL[ newState ][ i ], m_repairToFX[ newState ][ i ] ); - } // end if + } else { @@ -683,7 +683,7 @@ void BridgeBehavior::onBodyDamageStateChange( const DamageInfo* damageInfo, for( Int i = 0; i < MAX_BRIDGE_BODY_FX; i++ ) doAreaEffects( bridgeTemplate, bridge, m_damageToOCL[ newState ][ i ], m_damageToFX[ newState ][ i ] ); - } // end else + } // update bridge damage states ///@todo this should be re-written, there no need for this looping bridge examination @@ -699,7 +699,7 @@ void BridgeBehavior::onBodyDamageStateChange( const DamageInfo* damageInfo, if( oldState == BODY_RUBBLE || newState == BODY_RUBBLE ) TheRadar->queueTerrainRefresh(); -} // end onBodyDamageStateChange +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -766,9 +766,9 @@ UpdateSleepTime BridgeBehavior::update( void ) // launch the fx list FXList::doFXPos( (*fxIt).fx, &pos ); - } // end if + } - } // end for, fxIt + } // see if there are any ocl visuals we need to execute BridgeOCLList::const_iterator oclIt; @@ -804,7 +804,7 @@ UpdateSleepTime BridgeBehavior::update( void ) // launch the effects just using the parent object for location info ObjectCreationList::create( (*oclIt).ocl, us, NULL ); - } // endif + } else { @@ -814,9 +814,9 @@ UpdateSleepTime BridgeBehavior::update( void ) // launch the fx list ObjectCreationList::create( (*oclIt).ocl, us, &pos, NULL, INVALID_ANGLE ); - } // end else + } - } // end if, bone name not empty + } else { @@ -829,17 +829,17 @@ UpdateSleepTime BridgeBehavior::update( void ) // launch the fx list ObjectCreationList::create( (*oclIt).ocl, us, &pos, NULL, INVALID_ANGLE ); - } // end else + } - } // end if + } - } // end for, oclIt + } - } // end if + } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -855,7 +855,7 @@ void BridgeBehavior::onDie( const DamageInfo *damageInfo ) if( tower ) tower->kill(); - } // end for, i + } // we need to handle anything that was on top of us now that we've been destroyed handleObjectsOnBridgeOnDie(); @@ -863,7 +863,7 @@ void BridgeBehavior::onDie( const DamageInfo *damageInfo ) // we have now died, record the death frame m_deathFrame = TheGameLogic->getFrame(); -} // end onDie +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -947,11 +947,11 @@ void BridgeBehavior::handleObjectsOnBridgeOnDie( void ) else other->kill(); - } // end for, other + } - } // end if, terrainBridge + } -} // end handleObjectsOnBridgeDie +} // ------------------------------------------------------------------------------------------------ /** Set all the position, angle, and speed data we need to for a single scaffold object */ @@ -1013,7 +1013,7 @@ void BridgeBehavior::setScaffoldData( Object *obj, Real verticalSpeed = modData->m_verticalScaffoldSpeed; scaffoldBehavior->setVerticalSpeed( verticalSpeed ); -} // end setScaffoldData +} // ------------------------------------------------------------------------------------------------ /** Start the bridge repair scaffolding. If we already have scaffolding this call @@ -1047,7 +1047,7 @@ void BridgeBehavior::createScaffolding( void ) DEBUG_CRASH(( "Unable to find bridge scaffold template" )); return; - } // end if + } // get thing template for scaffold support object AsciiString scaffoldSupportObjectName = bridgeTemplate->getScaffoldSupportObjectName(); @@ -1058,7 +1058,7 @@ void BridgeBehavior::createScaffolding( void ) DEBUG_CRASH(( "Unable to find bridge support scaffold template" )); return; - } // end if + } // how much space is going to be between each of the scaffold objects at their final positions Real spacing = scaffoldTemplate->getTemplateGeometryInfo().getMajorRadius() * 2.0f; @@ -1201,7 +1201,7 @@ void BridgeBehavior::createScaffolding( void ) // off to the next layer offset -= scaffoldSupportHeight; - } // end while + } // // now create the object from the "right" side of the bridge ... but note that @@ -1266,11 +1266,11 @@ void BridgeBehavior::createScaffolding( void ) // off to the next layer offset -= scaffoldSupportHeight; - } // end while + } - } // end if + } - } // end for i + } // scaffolding is now present m_scaffoldPresent = TRUE; @@ -1278,7 +1278,7 @@ void BridgeBehavior::createScaffolding( void ) // when scaffolding is present, a bridge cannot be used TheAI->pathfinder()->changeBridgeState( bridge->getLayer(), FALSE ); -} // end createScaffolding +} // ------------------------------------------------------------------------------------------------ /** Remove the bridge scaffolding. If we don't have any then this call is ignored */ @@ -1309,7 +1309,7 @@ void BridgeBehavior::removeScaffolding( void ) // reverse the motion scaffoldBehavior->reverseMotion(); - } // end for, it + } // clear our scaffold object list m_scaffoldObjectIDList.clear(); @@ -1328,9 +1328,9 @@ void BridgeBehavior::removeScaffolding( void ) if( bridge ) TheAI->pathfinder()->changeBridgeState( bridge->getLayer(), TRUE ); - } // end if + } -} // end removeScaffolding +} // ------------------------------------------------------------------------------------------------ /** Is any of the scaffolding in motion */ @@ -1358,12 +1358,12 @@ Bool BridgeBehavior::isScaffoldInMotion( void ) if( bsbi->getCurrentMotion() != STM_STILL ) return TRUE; - } // end for + } // not in motion return FALSE; -} // end isScaffoldInMotion +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -1374,7 +1374,7 @@ void BridgeBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1404,7 +1404,7 @@ void BridgeBehavior::xfer( Xfer *xfer ) // set new object ID in bridge info to us bridge->setBridgeObjectID( us->getID() ); - } // end if + } // xfer the tower object ids for( Int i = 0; i < BRIDGE_MAX_TOWERS; ++i ) @@ -1423,7 +1423,7 @@ void BridgeBehavior::xfer( Xfer *xfer ) for( Int i = 0; i < BRIDGE_MAX_TOWERS; ++i ) bridge->setTowerObjectID( m_towerID[ i ], (BridgeTowerType)i ); - } // end if + } // scaffold present flag xfer->xferBool( &m_scaffoldPresent ); @@ -1444,9 +1444,9 @@ void BridgeBehavior::xfer( Xfer *xfer ) scaffoldObjectID = *it; xfer->xferObjectID( &scaffoldObjectID ); - } // end for + } - } // end if, save + } else { @@ -1462,14 +1462,14 @@ void BridgeBehavior::xfer( Xfer *xfer ) // put on list m_scaffoldObjectIDList.push_back( scaffoldObjectID ); - } // end for i + } - } // end load + } // death frame xfer->xferUnsignedInt( &m_deathFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1480,4 +1480,4 @@ void BridgeBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp index 05e970b8874..aa3be3bdb92 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp @@ -49,14 +49,14 @@ BridgeScaffoldBehavior::BridgeScaffoldBehavior( Thing *thing, const ModuleData * m_lateralSpeed = 1.0f; m_verticalSpeed = 1.0f; -} // end BridgeScaffoldBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ BridgeScaffoldBehavior::~BridgeScaffoldBehavior( void ) { -} // end ~BridgeScaffoldBehavior +} // ------------------------------------------------------------------------------------------------ /** Set all of the target positions that we're care about as a moving scaffold object */ @@ -70,7 +70,7 @@ void BridgeScaffoldBehavior::setPositions( const Coord3D *createPos, m_riseToPos = *riseToPos; m_buildPos = *buildPos; -} // end setPositions +} // ------------------------------------------------------------------------------------------------ /** Set us moving to the right target position for the requested motion type */ @@ -101,9 +101,9 @@ void BridgeScaffoldBehavior::setMotion( ScaffoldTargetMotion targetMotion ) m_targetPos = m_createPos; break; - } // end switch + } -} // end setMotion +} // ------------------------------------------------------------------------------------------------ /** Whatever our current state of motion is, reverse it */ @@ -134,9 +134,9 @@ void BridgeScaffoldBehavior::reverseMotion( void ) setMotion( STM_RISE ); break; - } // end switch + } -} // end reverseMotion +} // ------------------------------------------------------------------------------------------------ /** The update method */ @@ -196,7 +196,7 @@ UpdateSleepTime BridgeScaffoldBehavior::update( void ) DEBUG_CRASH(("Unhandled case in BridgeScaffoldBehavior::update()")); return UPDATE_SLEEP_NONE; - } // end switch + } // adjust speed so it's slower at the end of motion Coord3D speedVector; @@ -262,11 +262,11 @@ UpdateSleepTime BridgeScaffoldBehavior::update( void ) TheGameLogic->destroyObject( us ); break; - } // end case + } - } // end switch + } - } // end if + } // set the new position us->setPosition( &newPos ); @@ -274,7 +274,7 @@ UpdateSleepTime BridgeScaffoldBehavior::update( void ) // do not sleep return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** STATIC MEMBER: @@ -297,12 +297,12 @@ BridgeScaffoldBehaviorInterface *BridgeScaffoldBehavior::getBridgeScaffoldBehavi if( bridgeScaffoldInterface ) return bridgeScaffoldInterface; - } // end for bmi + } // interface not found return NULL; -} // end getBridgeScaffoldBehaviorInterfaceFromObject +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -313,7 +313,7 @@ void BridgeScaffoldBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -352,7 +352,7 @@ void BridgeScaffoldBehavior::xfer( Xfer *xfer ) // current target pos xfer->xferCoord3D( &m_targetPos ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -363,4 +363,4 @@ void BridgeScaffoldBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp index 512b6b7af0d..df9bad98f79 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp @@ -48,14 +48,14 @@ BridgeTowerBehavior::BridgeTowerBehavior( Thing *thing, const ModuleData *module m_bridgeID = INVALID_ID; -} // end BridgeTowerBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ BridgeTowerBehavior::~BridgeTowerBehavior( void ) { -} // end ~BridgeTowerBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -67,7 +67,7 @@ void BridgeTowerBehavior::setBridge( Object *bridge ) else m_bridgeID = bridge->getID(); -} // end setBridge +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -76,7 +76,7 @@ ObjectID BridgeTowerBehavior::getBridgeID( void ) return m_bridgeID; -} // end getBridge +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -85,7 +85,7 @@ void BridgeTowerBehavior::setTowerType( BridgeTowerType type ) m_type = type; -} // end setTowerType +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -114,7 +114,7 @@ void BridgeTowerBehavior::onDamage( DamageInfo *damageInfo ) if( bridgeInterface ) break; - } // end for bmi + } DEBUG_ASSERTCRASH( bridgeInterface != NULL, ("BridgeTowerBehavior::onDamage - no 'BridgeBehaviorInterface' found") ); if( bridgeInterface ) { @@ -145,9 +145,9 @@ void BridgeTowerBehavior::onDamage( DamageInfo *damageInfo ) towerDamage.in.m_deathType = damageInfo->in.m_deathType; tower->attemptDamage( &towerDamage ); - } // end if + } - } // end for i + } // // damage bridge object, but make sure it's done through the bridge interface @@ -162,11 +162,11 @@ void BridgeTowerBehavior::onDamage( DamageInfo *damageInfo ) bridgeDamage.in.m_deathType = damageInfo->in.m_deathType; bridge->attemptDamage( &bridgeDamage ); - } // end if + } - } // end if + } -} // end onDamage +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -195,7 +195,7 @@ void BridgeTowerBehavior::onHealing( DamageInfo *damageInfo ) if( bridgeInterface ) break; - } // end for bmi + } DEBUG_ASSERTCRASH( bridgeInterface != NULL, ("BridgeTowerBehavior::onHealing - no 'BridgeBehaviorInterface' found") ); if( bridgeInterface ) { @@ -220,9 +220,9 @@ void BridgeTowerBehavior::onHealing( DamageInfo *damageInfo ) BodyModuleInterface *towerBody = tower->getBodyModule(); tower->attemptHealing(healingPercentage * towerBody->getMaxHealth(), getObject()); - } // end if + } - } // end for i + } // // heal bridge object, but make sure it's done through the bridge interface @@ -231,11 +231,11 @@ void BridgeTowerBehavior::onHealing( DamageInfo *damageInfo ) BodyModuleInterface *bridgeBody = bridge->getBodyModule(); bridge->attemptHealing(healingPercentage * bridgeBody->getMaxHealth(), getObject()); - } // end if + } - } // end if + } -} // end onHealing +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -244,7 +244,7 @@ void BridgeTowerBehavior::onBodyDamageStateChange( const DamageInfo* damageInfo, BodyDamageType newState ) { -} // end onBodyDamageStateChange +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -256,7 +256,7 @@ void BridgeTowerBehavior::onDie( const DamageInfo *damageInfo ) if( bridge ) bridge->kill(); -} // end onDie +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -281,12 +281,12 @@ BridgeTowerBehaviorInterface *BridgeTowerBehavior::getBridgeTowerBehaviorInterfa if( bridgeTowerInterface ) return bridgeTowerInterface; - } // end for bmi + } // interface not found return NULL; -} // getBridgeTowerBehaviorInterfaceFromObject +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -297,7 +297,7 @@ void BridgeTowerBehavior::crc( Xfer *xfer ) // extend base class BehaviorModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -321,7 +321,7 @@ void BridgeTowerBehavior::xfer( Xfer *xfer ) // xfer tower type xfer->xferUser( &m_type, sizeof( BridgeTowerType ) ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -332,4 +332,4 @@ void BridgeTowerBehavior::loadPostProcess( void ) // extend base class BehaviorModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BunkerBusterBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BunkerBusterBehavior.cpp index 409bf6a9777..bfed83b3a9c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BunkerBusterBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BunkerBusterBehavior.cpp @@ -63,7 +63,7 @@ BunkerBusterBehaviorModuleData::BunkerBusterBehaviorModuleData( void ) m_shockwaveWeaponTemplate = NULL; m_occupantDamageWeaponTemplate = NULL; -} // end BunkerBusterBehaviorModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -87,7 +87,7 @@ BunkerBusterBehaviorModuleData::BunkerBusterBehaviorModuleData( void ) p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -103,14 +103,14 @@ BunkerBusterBehavior::BunkerBusterBehavior( Thing *thing, const ModuleData *modD m_victimID = INVALID_ID; m_upgradeRequired = NULL; -} // end BunkerBusterBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ BunkerBusterBehavior::~BunkerBusterBehavior( void ) { -} // end ~BunkerBusterBehavior +} @@ -121,7 +121,7 @@ void BunkerBusterBehavior::onObjectCreated( void ) // convert module upgrade name to a pointer m_upgradeRequired = TheUpgradeCenter->findUpgrade( modData->m_upgradeRequired ); -} // end onObjectCreated +} // ------------------------------------------------------------------------------------------------ @@ -158,7 +158,7 @@ UpdateSleepTime BunkerBusterBehavior::update( void ) return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** The death callback */ @@ -240,7 +240,7 @@ void BunkerBusterBehavior::bustTheBunker( void ) TheWeaponStore->createAndFireTempWeapon(modData->m_shockwaveWeaponTemplate, objectForFX, objectForFX->getPosition()); -} // end onDie +} // ------------------------------------------------------------------------------------------------ @@ -260,7 +260,7 @@ void BunkerBusterBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -278,7 +278,7 @@ void BunkerBusterBehavior::xfer( Xfer *xfer ) // extend base class UpdateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -289,4 +289,4 @@ void BunkerBusterBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp index 2e9ff8b3076..f583474594d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp @@ -365,7 +365,7 @@ void CountermeasuresBehavior::crc( Xfer *xfer ) // extend base class UpgradeMux::upgradeMuxCRC( xfer ); -} // end crc +} //------------------------------------------------------------------------------------------------ /** Xfer method @@ -397,7 +397,7 @@ void CountermeasuresBehavior::xfer( Xfer *xfer ) xfer->xferUnsignedInt( &m_nextVolleyFrame ); } -} // end xfer +} //------------------------------------------------------------------------------------------------ /** Load post process */ @@ -411,6 +411,6 @@ void CountermeasuresBehavior::loadPostProcess( void ) // extend base class UpgradeMux::upgradeMuxLoadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp index ee4f0be8449..6e33cbb152f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp @@ -496,8 +496,8 @@ Bool DumbProjectileBehavior::projectileHandleCollision( Object *other ) thingToKill->kill(); ++numKilled; } - } // next contained item - } // if items + } + } if (numKilled > 0) { @@ -511,7 +511,7 @@ Bool DumbProjectileBehavior::projectileHandleCollision( Object *other ) return true; } - } // if a garrisonable thing + } } } @@ -718,7 +718,7 @@ void DumbProjectileBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -771,16 +771,16 @@ void DumbProjectileBehavior::xfer( Xfer *xfer ) weaponTemplateName.str() )); throw SC_INVALID_DATA; - } // end if + } - } // end else + } - } // end if + } // lifespan frame xfer->xferUnsignedInt( &m_lifespanFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -791,4 +791,4 @@ void DumbProjectileBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDamagedBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDamagedBehavior.cpp index aec3d991743..642bb12282b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDamagedBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDamagedBehavior.cpp @@ -269,7 +269,7 @@ void FireWeaponWhenDamagedBehavior::crc( Xfer *xfer ) // extend upgrade mux UpgradeMux::upgradeMuxCRC( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -340,7 +340,7 @@ void FireWeaponWhenDamagedBehavior::xfer( Xfer *xfer ) if( weaponPresent ) xfer->xferSnapshot( m_continuousWeaponRubble ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -354,4 +354,4 @@ void FireWeaponWhenDamagedBehavior::loadPostProcess( void ) // extend upgrade mux UpgradeMux::upgradeMuxLoadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDeadBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDeadBehavior.cpp index 47a87c5e11e..f7e2522e6a6 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDeadBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDeadBehavior.cpp @@ -125,7 +125,7 @@ void FireWeaponWhenDeadBehavior::crc( Xfer *xfer ) // extend upgrade mux UpgradeMux::upgradeMuxCRC( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -146,7 +146,7 @@ void FireWeaponWhenDeadBehavior::xfer( Xfer *xfer ) // extend upgrade mux UpgradeMux::upgradeMuxXfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -160,4 +160,4 @@ void FireWeaponWhenDeadBehavior::loadPostProcess( void ) // extend upgrade mux UpgradeMux::upgradeMuxLoadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp index f70fdaf1eb4..2c6a6031844 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp @@ -1202,7 +1202,7 @@ UpdateSleepTime FlightDeckBehavior::update() DEBUG_CRASH( ("MSG_QUEUE_UNIT_CREATE: Producer '%s' doesn't have a unit production interface", getObject()->getTemplate()->getName().str()) ); break; - } // end if + } DEBUG_ASSERTCRASH( m_thingTemplate != NULL, ("flightdeck has a null thingtemplate... no jets for you!") ); if( !pu->getProductionCount() && now >= m_nextAllowedProductionFrame && m_thingTemplate != NULL ) { @@ -1514,7 +1514,7 @@ void FlightDeckBehavior::crc( Xfer *xfer ) // extend base class AIUpdateInterface::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1551,9 +1551,9 @@ void FlightDeckBehavior::xfer( Xfer *xfer ) { // object in this space xfer->xferObjectID( &((*it).m_objectInSpace) ); // This is the one thing not regenerated by buildInfo - } // end for, it + } - } // end if, save + } else if( xfer->getXferMode() == XFER_LOAD ) { ObjectID objectID; @@ -1573,11 +1573,11 @@ void FlightDeckBehavior::xfer( Xfer *xfer ) (*it).m_objectInSpace = objectID; //validateAssignments(); ++it; - } // end if + } - } // end for, i + } - } // end else, load + } // runways count and info UnsignedByte runwaysCount = m_runways.size(); @@ -1594,9 +1594,9 @@ void FlightDeckBehavior::xfer( Xfer *xfer ) xfer->xferObjectID( &((*it).m_inUseByForTakeoff ) ); xfer->xferObjectID( &((*it).m_inUseByForLanding ) ); - } // end for, it + } - } // end if, save + } else if( xfer->getXferMode() == XFER_LOAD ) { // read all elements @@ -1621,11 +1621,11 @@ void FlightDeckBehavior::xfer( Xfer *xfer ) (*it).m_inUseByForLanding = inUseByForLanding; ++it; - } // end if + } - } // end for, i + } - } // end else, load + } // healees UnsignedByte healCount = m_healing.size(); @@ -1642,9 +1642,9 @@ void FlightDeckBehavior::xfer( Xfer *xfer ) xfer->xferObjectID( &((*it).m_gettingHealedID) ); xfer->xferUnsignedInt( &((*it).m_healStartFrame) ); - } // end for, it + } - } // end if, save + } else if( xfer->getXferMode() == XFER_LOAD ) { // read all elements @@ -1658,9 +1658,9 @@ void FlightDeckBehavior::xfer( Xfer *xfer ) xfer->xferUnsignedInt( &info.m_healStartFrame ); m_healing.push_back(info); - } // end for, i + } - } // end else, load + } xfer->xferUnsignedInt( &m_nextHealFrame ); xfer->xferUnsignedInt( &m_nextCleanupFrame ); @@ -1699,7 +1699,7 @@ void FlightDeckBehavior::xfer( Xfer *xfer ) } } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1719,5 +1719,5 @@ void FlightDeckBehavior::loadPostProcess( void ) // make sure we are awake... old save games let us sleep //setWakeFrame(getObject(), UPDATE_SLEEP_NONE); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp index bb1ed8fe698..406ba28d0a9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp @@ -508,7 +508,7 @@ void GenerateMinefieldBehavior::crc( Xfer *xfer ) // extend base class UpgradeMux::upgradeMuxCRC( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -547,9 +547,9 @@ void GenerateMinefieldBehavior::xfer( Xfer *xfer ) { // object in this space xfer->xferObjectID( &(*it) ); - } // end for, it + } - } // end if, save + } else if( xfer->getXferMode() == XFER_LOAD ) { ObjectID objectID; @@ -564,10 +564,10 @@ void GenerateMinefieldBehavior::xfer( Xfer *xfer ) xfer->xferObjectID( &objectID ); m_mineList.push_back(objectID); - } // end for, i - } // end else, load + } + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -581,4 +581,4 @@ void GenerateMinefieldBehavior::loadPostProcess( void ) // extend base class UpgradeMux::upgradeMuxLoadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GrantStealthBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GrantStealthBehavior.cpp index 1e023454b7c..9a133be27bf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GrantStealthBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GrantStealthBehavior.cpp @@ -210,7 +210,7 @@ void GrantStealthBehavior::crc( Xfer *xfer ) UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -235,7 +235,7 @@ void GrantStealthBehavior::xfer( Xfer *xfer ) // Timer safety xfer->xferReal( &m_currentScanRadius ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -247,4 +247,4 @@ void GrantStealthBehavior::loadPostProcess( void ) UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp index 466bb71f54c..58dda092bf6 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp @@ -183,7 +183,7 @@ void InstantDeathBehavior::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -201,7 +201,7 @@ void InstantDeathBehavior::xfer( Xfer *xfer ) // extend base class DieModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -212,4 +212,4 @@ void InstantDeathBehavior::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp index 984889ab1e5..99ad68ba082 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp @@ -75,7 +75,7 @@ JetSlowDeathBehaviorModuleData::JetSlowDeathBehaviorModuleData( void ) m_pitchRate = 0.0f; m_fallHowFast = 0.0f; -} // end JetSlowDeathBehaviorModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -117,7 +117,7 @@ JetSlowDeathBehaviorModuleData::JetSlowDeathBehaviorModuleData( void ) p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -133,14 +133,14 @@ JetSlowDeathBehavior::JetSlowDeathBehavior( Thing *thing, const ModuleData *modu m_timerOnGroundFrame = 0; m_rollRate = 0.0f; -} // end JetSlowDeathBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ JetSlowDeathBehavior::~JetSlowDeathBehavior( void ) { -} // end ~JetSlowDeathBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -162,18 +162,18 @@ void JetSlowDeathBehavior::onDie( const DamageInfo *damageInfo ) // destroy object TheGameLogic->destroyObject( us ); - } // end if + } else { // extend base class for slow death and begin the slow death behavior SlowDeathBehavior::onDie( damageInfo ); - } // end else + } getObject()->clearStatus( MAKE_OBJECT_STATUS_MASK( OBJECT_STATUS_DECK_HEIGHT_OFFSET ) ); -} // end onDie +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -202,7 +202,7 @@ void JetSlowDeathBehavior::beginSlowDeath( const DamageInfo *damageInfo ) m_deathLoopSound.setObjectID( us->getID() ); m_deathLoopSound.setPlayingHandle( TheAudio->addAudioEvent( &m_deathLoopSound ) ); - } // end if + } // initialize our roll rate to that defined as the initial value in the module data m_rollRate = modData->m_rollRate; @@ -214,7 +214,7 @@ void JetSlowDeathBehavior::beginSlowDeath( const DamageInfo *damageInfo ) // do not allow the jet to turn anymore locomotor->setMaxTurnRate( 0.0f ); -} // end beginSlowDeath +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -300,7 +300,7 @@ UpdateSleepTime JetSlowDeathBehavior::update( void ) if( physics ) physics->setPitchRate( modData->m_pitchRate ); - } // end if + } // timers for the secondary effect if( m_timerDeathFrame != 0 && @@ -314,9 +314,9 @@ UpdateSleepTime JetSlowDeathBehavior::update( void ) // clear the death frame timer since we've already executed the event now m_timerDeathFrame = 0; - } //end if + } - } // end if + } else { // we are on the ground, pay attention to the final explosion timers @@ -330,13 +330,13 @@ UpdateSleepTime JetSlowDeathBehavior::update( void ) // we're all done now TheGameLogic->destroyObject( us ); - } // end if + } - } // end else + } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -347,7 +347,7 @@ void JetSlowDeathBehavior::crc( Xfer *xfer ) // extend base class SlowDeathBehavior::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -374,7 +374,7 @@ void JetSlowDeathBehavior::xfer( Xfer *xfer ) // roll rate xfer->xferReal( &m_rollRate ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -385,4 +385,4 @@ void JetSlowDeathBehavior::loadPostProcess( void ) // extend base class SlowDeathBehavior::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp index 9bfb8a9ed61..9f899d20393 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp @@ -626,7 +626,7 @@ void MinefieldBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -673,7 +673,7 @@ void MinefieldBehavior::xfer( Xfer *xfer ) DEBUG_CRASH(( "MinefieldBehavior::xfer - MAX_IMMUNITY has changed size, you must version this code and then you can remove this error message" )); throw SC_INVALID_DATA; - } // end if + } for( UnsignedByte i = 0; i < maxImmunity; ++i ) { @@ -683,12 +683,12 @@ void MinefieldBehavior::xfer( Xfer *xfer ) // collide time xfer->xferUnsignedInt( &m_immunes[ i ].collideTime ); - } // end for, i + } if( xfer->getXferMode() == XFER_LOAD ) m_detonators.clear(); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -699,4 +699,4 @@ void MinefieldBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/NeutonBlastBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/NeutonBlastBehavior.cpp index 8c1c58f0e49..247dbabd3c1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/NeutonBlastBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/NeutonBlastBehavior.cpp @@ -166,7 +166,7 @@ void NeutronBlastBehavior::crc( Xfer *xfer ) UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -184,7 +184,7 @@ void NeutronBlastBehavior::xfer( Xfer *xfer ) // extend base class UpdateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -196,4 +196,4 @@ void NeutronBlastBehavior::loadPostProcess( void ) UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/OverchargeBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/OverchargeBehavior.cpp index 5c5ce355296..069a2818e32 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/OverchargeBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/OverchargeBehavior.cpp @@ -52,7 +52,7 @@ OverchargeBehaviorModuleData::OverchargeBehaviorModuleData( void ) m_healthPercentToDrainPerSecond = 0.0f; m_notAllowedWhenHealthBelowPercent = 0.0f; -} // end OverchargeBehaviorModuleData +} //------------------------------------------------------------------------------------------------- // ------------------------------------------------------------------------------------------------ @@ -70,7 +70,7 @@ OverchargeBehaviorModuleData::OverchargeBehaviorModuleData( void ) p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -87,14 +87,14 @@ OverchargeBehavior::OverchargeBehavior( Thing *thing, const ModuleData* moduleDa // start off sleeping forever until we become active setWakeFrame( getObject(), UPDATE_SLEEP_FOREVER ); -} // end OverchargeBehavior +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- OverchargeBehavior::~OverchargeBehavior( void ) { -} // end ~OverchargeBehavior +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -135,25 +135,25 @@ UpdateSleepTime OverchargeBehavior::update( void ) // do radar event TheRadar->createEvent( us->getPosition(), RADAR_EVENT_INFORMATION ); - } // end of + } // do nothing else return UPDATE_SLEEP_NONE; - } // end if + } - } // end if + } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------- void OverchargeBehavior::onDamage( DamageInfo *damageInfo ) { -} // end onDie +} // ------------------------------------------------------------------------------------------------ /** Flip the state of our 'overcharge-ness' */ @@ -164,7 +164,7 @@ void OverchargeBehavior::toggle( void ) // just toggle using enable() enable( !m_overchargeActive ); -} // end toggle +} // ------------------------------------------------------------------------------------------------ /** Enable or disable an overcharge */ @@ -199,9 +199,9 @@ void OverchargeBehavior::enable( Bool enable ) // sleep forever setWakeFrame( us, UPDATE_SLEEP_FOREVER ); - } // end if + } - } // end if + } else { @@ -229,11 +229,11 @@ void OverchargeBehavior::enable( Bool enable ) // need to update every frame now setWakeFrame( us, UPDATE_SLEEP_NONE ); - } // end if + } - } // end else + } -} // end enable +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -251,7 +251,7 @@ void OverchargeBehavior::onDelete( void ) m_overchargeActive = FALSE; -} // end onDelete +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -273,7 +273,7 @@ void OverchargeBehavior::onCapture( Player *oldOwner, Player *newOwner ) if( newOwner ) newOwner->addPowerBonus( getObject() ); -} // end onCapture +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -284,7 +284,7 @@ void OverchargeBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -305,7 +305,7 @@ void OverchargeBehavior::xfer( Xfer *xfer ) // overcharge active xfer->xferBool( &m_overchargeActive ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -320,4 +320,4 @@ void OverchargeBehavior::loadPostProcess( void ) if( m_overchargeActive && getObject()->getControllingPlayer() ) getObject()->getControllingPlayer()->addPowerBonus( getObject() ); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/POWTruckBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/POWTruckBehavior.cpp index 096b27c0cbf..5b08d4aae8e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/POWTruckBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/POWTruckBehavior.cpp @@ -48,7 +48,7 @@ POWTruckBehaviorModuleData::POWTruckBehaviorModuleData( void ) { -} // end POWTruckBehaviorModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -65,7 +65,7 @@ POWTruckBehaviorModuleData::POWTruckBehaviorModuleData( void ) p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -77,14 +77,14 @@ POWTruckBehavior::POWTruckBehavior( Thing *thing, const ModuleData *moduleData ) : OpenContain( thing, moduleData ) { -} // end POWTruckBehavior +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- POWTruckBehavior::~POWTruckBehavior( void ) { -} // end ~POWTruckBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -112,7 +112,7 @@ void POWTruckBehavior::onCollide( Object *other, const Coord3D *loc, const Coord // pick up the prisoner powTruckAI->loadPrisoner( other ); -} // end onCollide +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -123,7 +123,7 @@ void POWTruckBehavior::crc( Xfer *xfer ) // extend base class OpenContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -141,7 +141,7 @@ void POWTruckBehavior::xfer( Xfer *xfer ) // extend base class OpenContain::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -152,6 +152,6 @@ void POWTruckBehavior::loadPostProcess( void ) // extend base class OpenContain::loadPostProcess(); -} // end loadPostProcess +} #endif diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp index ffaa1f3bcca..436770d9fbe 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp @@ -927,7 +927,7 @@ void ParkingPlaceBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -969,9 +969,9 @@ void ParkingPlaceBehavior::xfer( Xfer *xfer ) // reserved for exit xfer->xferBool( &((*it).m_reservedForExit) ); - } // end for, it + } - } // end if, save + } else if( xfer->getXferMode() == XFER_LOAD ) { ObjectID objectID; @@ -997,11 +997,11 @@ void ParkingPlaceBehavior::xfer( Xfer *xfer ) (*it).m_reservedForExit = reservedForExit; ++it; - } // end if + } - } // end for, i + } - } // end else, load + } // runways cound and info UnsignedByte runwaysCount = m_runways.size(); @@ -1019,9 +1019,9 @@ void ParkingPlaceBehavior::xfer( Xfer *xfer ) xfer->xferObjectID( &((*it).m_nextInLineForTakeoff) ); xfer->xferBool( &((*it).m_wasInLine) ); - } // end for, it + } - } // end if, save + } else if( xfer->getXferMode() == XFER_LOAD ) { // read all elements @@ -1048,11 +1048,11 @@ void ParkingPlaceBehavior::xfer( Xfer *xfer ) (*it).m_wasInLine = wasInLine; ++it; - } // end if + } - } // end for, i + } - } // end else, load + } // healees UnsignedByte healCount = m_healing.size(); @@ -1069,9 +1069,9 @@ void ParkingPlaceBehavior::xfer( Xfer *xfer ) xfer->xferObjectID( &((*it).m_gettingHealedID) ); xfer->xferUnsignedInt( &((*it).m_healStartFrame) ); - } // end for, it + } - } // end if, save + } else if( xfer->getXferMode() == XFER_LOAD ) { // read all elements @@ -1085,9 +1085,9 @@ void ParkingPlaceBehavior::xfer( Xfer *xfer ) xfer->xferUnsignedInt( &info.m_healStartFrame ); m_healing.push_back(info); - } // end for, i + } - } // end else, load + } if (version >= 2) { @@ -1108,7 +1108,7 @@ void ParkingPlaceBehavior::xfer( Xfer *xfer ) } } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1123,4 +1123,4 @@ void ParkingPlaceBehavior::loadPostProcess( void ) // make sure we are awake... old save games let us sleep //setWakeFrame(getObject(), UPDATE_SLEEP_NONE); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp index 89d7270f567..45224c07061 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp @@ -198,7 +198,7 @@ void PoisonedBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -230,7 +230,7 @@ void PoisonedBehavior::xfer( Xfer *xfer ) xfer->xferUser(&m_deathType, sizeof(m_deathType)); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -241,4 +241,4 @@ void PoisonedBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PrisonBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PrisonBehavior.cpp index 62c8b468f93..52d2c248abb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PrisonBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PrisonBehavior.cpp @@ -74,14 +74,14 @@ PrisonVisual::PrisonVisual( void ) m_drawableID = INVALID_DRAWABLE_ID; m_next = NULL; -} // end PrisonVisual +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ PrisonVisual::~PrisonVisual( void ) { -} // end ~PrisonVisual +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -94,7 +94,7 @@ PrisonBehaviorModuleData::PrisonBehaviorModuleData( void ) m_showPrisoners = FALSE; -} // end PrisonBehaviorModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -113,7 +113,7 @@ PrisonBehaviorModuleData::PrisonBehaviorModuleData( void ) p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -127,14 +127,14 @@ PrisonBehavior::PrisonBehavior( Thing *thing, const ModuleData *moduleData ) m_visualList = NULL; -} // end PrisonBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ PrisonBehavior::~PrisonBehavior( void ) { -} // end ~PrisonBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -160,9 +160,9 @@ void PrisonBehavior::onDelete( void ) deleteInstance(m_visualList); m_visualList = visual; - } // end while + } -} // end onDelete +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -180,7 +180,7 @@ void PrisonBehavior::onContaining( Object *obj, Bool wasSelected ) if( modData->m_showPrisoners ) addVisual( obj ); -} // end onContaining +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -198,7 +198,7 @@ void PrisonBehavior::onRemoving( Object *obj ) // extend functionality OpenContain::onRemoving( obj ); -} // end onRemoving +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE //////////////////////////////////////////////////////////////////////////////////////// @@ -253,7 +253,7 @@ void PrisonBehavior::pickVisualLocation( Coord3D *pos ) if( yardPositions[ i ].y > yardRegion.hi.y ) yardRegion.hi.y = yardPositions[ i ].y; - } // end for i + } // // now that we have a yard region, the default visual position will be in the middle @@ -282,16 +282,16 @@ void PrisonBehavior::pickVisualLocation( Coord3D *pos ) pickedLocation = loc; break; // exit for i - } // end if + } - } // end for i + } - } // end if + } // return the location picked *pos = pickedLocation; -} // end pickVisualLocation +} // ------------------------------------------------------------------------------------------------ /** Add prisoner visual to the prison yard */ @@ -329,7 +329,7 @@ void PrisonBehavior::addVisual( Object *obj ) visual->m_next = m_visualList; m_visualList = visual; -} // end addVisual +} // ------------------------------------------------------------------------------------------------ /** Remove prisoner visual from the prison yard */ @@ -367,19 +367,19 @@ void PrisonBehavior::removeVisual( Object *obj ) break; // exit for - } // end if + } // keep a pointer to the previous element prevVisual = visual; - } // end for + } // find the drawable visual and destroy it Drawable *draw = TheGameClient->findDrawableByID( drawableID ); if( draw ) TheGameClient->destroyDrawable( draw ); -} // end removeVisual +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -390,7 +390,7 @@ void PrisonBehavior::crc( Xfer *xfer ) // extend base class OpenContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -427,9 +427,9 @@ void PrisonBehavior::xfer( Xfer *xfer ) // drawable id xfer->xferDrawableID( &visual->m_drawableID ); - } // end for, visual + } - } // end if, save + } else { @@ -440,7 +440,7 @@ void PrisonBehavior::xfer( Xfer *xfer ) DEBUG_CRASH(( "PrisonBehavior::xfer - the visual list should be empty but is not" )); throw SC_INVALID_DATA; - } // end if + } // read each item for( UnsignedShort i = 0; i < visualCount; ++i ) @@ -457,11 +457,11 @@ void PrisonBehavior::xfer( Xfer *xfer ) // read drawable id xfer->xferDrawableID( &visual->m_drawableID ); - } // end for, i + } - } // end else, load + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -472,7 +472,7 @@ void PrisonBehavior::loadPostProcess( void ) // extend base class OpenContain::loadPostProcess(); -} // end loadPostProcess +} #endif diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaCenterBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaCenterBehavior.cpp index e6dc09f813d..1b19fe88949 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaCenterBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaCenterBehavior.cpp @@ -51,7 +51,7 @@ PropagandaCenterBehaviorModuleData::PropagandaCenterBehaviorModuleData( void ) m_brainwashDuration = 0; -} // end PropagandaCenterBehaviorModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -69,7 +69,7 @@ PropagandaCenterBehaviorModuleData::PropagandaCenterBehaviorModuleData( void ) p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -84,14 +84,14 @@ PropagandaCenterBehavior::PropagandaCenterBehavior( Thing *thing, const ModuleDa m_brainwashingSubjectID = INVALID_ID; m_brainwashingSubjectStartFrame = 0; -} // end PropagandaCenterBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ PropagandaCenterBehavior::~PropagandaCenterBehavior( void ) { -} // end ~PropagandaCenterBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -119,14 +119,14 @@ void PropagandaCenterBehavior::onDelete( void ) // return this object under the control of the original owner obj->restoreOriginalTeam(); - } // end if + } - } // end for + } // clear the list m_brainwashedList.clear(); -} // end onDelete +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -178,13 +178,13 @@ UpdateSleepTime PropagandaCenterBehavior::update( void ) // exit the prison exitObjectViaDoor( brainwashingSubject, exitDoor ); - } // end if + } - } // end if + } - } // end if, + } - } // end if + } // if we have no brainwashing subject, hook one up if we have people inside us if( m_brainwashingSubjectID == INVALID_ID ) @@ -202,14 +202,14 @@ UpdateSleepTime PropagandaCenterBehavior::update( void ) m_brainwashingSubjectID = obj->getID(); m_brainwashingSubjectStartFrame = TheGameLogic->getFrame(); - } // end if + } - } // end if + } - } // end if + } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -223,12 +223,12 @@ void PropagandaCenterBehavior::onRemoving( Object *obj ) m_brainwashingSubjectID = INVALID_ID; m_brainwashingSubjectStartFrame = 0; - } // end if + } // extend functionality PrisonBehavior::onRemoving( obj ); -} // end onRemoving +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -239,7 +239,7 @@ void PropagandaCenterBehavior::crc( Xfer *xfer ) // extend base class PrisonBehavior::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -266,7 +266,7 @@ void PropagandaCenterBehavior::xfer( Xfer *xfer ) // brainwashed list size and data xfer->xferSTLObjectIDList( &m_brainwashedList ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -277,6 +277,6 @@ void PropagandaCenterBehavior::loadPostProcess( void ) // extend base class PrisonBehavior::loadPostProcess(); -} // end loadPostProcess +} #endif diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp index 315b3925144..2d22c471237 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp @@ -85,7 +85,7 @@ PropagandaTowerBehaviorModuleData::PropagandaTowerBehaviorModuleData( void ) m_upgradedPulseFX = NULL; m_affectsSelf = FALSE; -} // end PropagandaTowerBehaviorModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -108,7 +108,7 @@ PropagandaTowerBehaviorModuleData::PropagandaTowerBehaviorModuleData( void ) p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -126,14 +126,14 @@ PropagandaTowerBehavior::PropagandaTowerBehavior( Thing *thing, const ModuleData m_insideList = NULL; setWakeFrame( getObject(), UPDATE_SLEEP_NONE ); -} // end PropagandaTowerBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ PropagandaTowerBehavior::~PropagandaTowerBehavior( void ) { -} // end ~PropagandaTowerBehavior +} // ------------------------------------------------------------------------------------------------ /** Module is being deleted */ @@ -144,7 +144,7 @@ void PropagandaTowerBehavior::onDelete( void ) // remove any benefits from anybody in our area of influence removeAllInfluence(); -} // end onDelete +} // ------------------------------------------------------------------------------------------------ /** Resolve */ @@ -156,7 +156,7 @@ void PropagandaTowerBehavior::onObjectCreated( void ) // convert module upgrade name to a pointer m_upgradeRequired = TheUpgradeCenter->findUpgrade( modData->m_upgradeRequired ); -} // end onObjectCreated +} // ------------------------------------------------------------------------------------------------ void PropagandaTowerBehavior::onCapture( Player *oldOwner, Player *newOwner ) @@ -225,7 +225,7 @@ UpdateSleepTime PropagandaTowerBehavior::update( void ) doScan(); m_lastScanFrame = currentFrame; - } // end if + } // go through any objects in our area of influence and do the effect logic on them Object *obj; @@ -248,7 +248,7 @@ UpdateSleepTime PropagandaTowerBehavior::update( void ) // record this element as the previous one found in the list prev = curr; - } // end if + } else { @@ -262,13 +262,13 @@ UpdateSleepTime PropagandaTowerBehavior::update( void ) m_insideList = curr->next; deleteInstance(curr); - } // end else + } - } // end for, curr + } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** The death callback */ @@ -279,7 +279,7 @@ void PropagandaTowerBehavior::onDie( const DamageInfo *damageInfo ) // remove any benefits from anybody in our area of influence removeAllInfluence(); -} // end onDie +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -308,7 +308,7 @@ void PropagandaTowerBehavior::effectLogic( Object *obj, Bool giving, obj->setWeaponBonusCondition( WEAPONBONUSCONDITION_SUBLIMINAL ); } - } // hasdamageweapon + } // grant health to this object as well @@ -331,9 +331,9 @@ void PropagandaTowerBehavior::effectLogic( Object *obj, Bool giving, // obj->attemptHealing(amount, getObject()); // the regular way to give healing... obj->attemptHealingFromSoleBenefactor( amount, getObject(), modData->m_scanDelayInFrames );//the non-stacking way - } // end if + } - } // end if + } else { @@ -341,9 +341,9 @@ void PropagandaTowerBehavior::effectLogic( Object *obj, Bool giving, obj->clearWeaponBonusCondition( WEAPONBONUSCONDITION_ENTHUSIASTIC ); obj->clearWeaponBonusCondition( WEAPONBONUSCONDITION_SUBLIMINAL ); - } // end else + } -} // end effectLogic +} // ------------------------------------------------------------------------------------------------ /** Remove all influence from objects we've given bonuses to */ @@ -361,7 +361,7 @@ void PropagandaTowerBehavior::removeAllInfluence( void ) if( obj ) effectLogic( obj, FALSE, getPropagandaTowerBehaviorModuleData() ); - } // end for + } // delete the list of objects under our influence while( m_insideList ) @@ -371,9 +371,9 @@ void PropagandaTowerBehavior::removeAllInfluence( void ) deleteInstance(m_insideList); m_insideList = o; - } // end while + } -} // end removeAllInfluence +} // ------------------------------------------------------------------------------------------------ /** Do a scan */ @@ -401,7 +401,7 @@ void PropagandaTowerBehavior::doScan( void ) upgradePresent = player->hasUpgradeComplete( m_upgradeRequired ); break; - } // end player upgrade + } // ------------------------------------------------------------------------------------------ case UPGRADE_TYPE_OBJECT: @@ -410,7 +410,7 @@ void PropagandaTowerBehavior::doScan( void ) upgradePresent = us->hasUpgrade( m_upgradeRequired ); break; - } // end object upgrade + } // ------------------------------------------------------------------------------------------ default: @@ -420,11 +420,11 @@ void PropagandaTowerBehavior::doScan( void ) m_upgradeRequired->getUpgradeType() )); break; - } // end default + } - } // end switch + } - } // end if + } Bool doFX = TRUE; @@ -508,7 +508,7 @@ void PropagandaTowerBehavior::doScan( void ) newEntry->next = newInsideList; newInsideList = newEntry; - } // end for obj + } // // now that we have a list of objects that are in our area of influence, look through @@ -533,9 +533,9 @@ void PropagandaTowerBehavior::doScan( void ) if( obj ) effectLogic( obj, FALSE, modData ); - } // end if + } - } // end for + } // delete the inside list we have recoreded ObjectTracker *next; @@ -546,12 +546,12 @@ void PropagandaTowerBehavior::doScan( void ) deleteInstance(m_insideList); m_insideList = next; - } // end while + } // set the new inside list to the one we're recording m_insideList = newInsideList; -} // end doScan +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -562,7 +562,7 @@ void PropagandaTowerBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -599,9 +599,9 @@ void PropagandaTowerBehavior::xfer( Xfer *xfer ) // object id xfer->xferObjectID( &trackerEntry->objectID ); - } // end for + } - } // end if, save + } else { @@ -612,7 +612,7 @@ void PropagandaTowerBehavior::xfer( Xfer *xfer ) DEBUG_CRASH(( "PropagandaTowerBehavior::xfer - m_insideList should be empty but is not" )); throw SC_INVALID_DATA; - } // end if + } // read all entries for( UnsignedShort i = 0; i < insideCount; ++i ) @@ -626,11 +626,11 @@ void PropagandaTowerBehavior::xfer( Xfer *xfer ) // read object id xfer->xferObjectID( &trackerEntry->objectID ); - } // end for i + } - } // end else, load + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -641,4 +641,4 @@ void PropagandaTowerBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/RebuildHoleBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/RebuildHoleBehavior.cpp index 32e61a1fc97..aa3e3f1cb86 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/RebuildHoleBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/RebuildHoleBehavior.cpp @@ -51,7 +51,7 @@ RebuildHoleBehaviorModuleData::RebuildHoleBehaviorModuleData( void ) m_workerRespawnDelay = 0.0f; m_holeHealthRegenPercentPerSecond = 0.1f; -} // end RebuildHoleBehaviorModuleData +} //------------------------------------------------------------------------------------------------- // ------------------------------------------------------------------------------------------------ @@ -70,7 +70,7 @@ RebuildHoleBehaviorModuleData::RebuildHoleBehaviorModuleData( void ) p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -89,7 +89,7 @@ RebuildHoleBehavior::RebuildHoleBehavior( Thing *thing, const ModuleData* module m_workerTemplate = NULL; m_rebuildTemplate = NULL; -} // end RebuildHoleBehavior +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -107,7 +107,7 @@ RebuildHoleBehavior::~RebuildHoleBehavior( void ) } } -} // end ~RebuildHoleBehavior +} // ------------------------------------------------------------------------------------------------ /** we need to start all the timers and ID ties to make a new worker at the correct time */ @@ -136,7 +136,7 @@ void RebuildHoleBehavior::newWorkerRespawnProcess( Object *existingWorker ) // getObject()->maskObject( FALSE ); -} // end newWorkerRespawnProcess +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -153,7 +153,7 @@ void RebuildHoleBehavior::startRebuildProcess( const ThingTemplate *rebuild, Obj Object *worker = TheGameLogic->findObjectByID(m_workerID); newWorkerRespawnProcess( worker ); //Kill the worker if we have one. -} /// end startRebuildProcess +} //---------------------------------------------------------------------------------------------- @@ -198,7 +198,7 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) if( worker == NULL ) newWorkerRespawnProcess( NULL ); - } // end if + } // if we have a reconstructing object built, get the actual object pointer if( m_reconstructingID != 0 ) @@ -215,9 +215,9 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) { newWorkerRespawnProcess( worker ); m_reconstructingID = INVALID_ID; - } // end if + } - } // end if + } // see if it's time for us to spawn a worker if( worker == NULL && m_workerWaitCounter > 0 ) @@ -290,13 +290,13 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) transferBombs( reconstructing ); - } // end if + } - } // end if, worker + } - } // end if, time to spawn a worker + } - } // end if, check for working respawn + } // holes get auto-healed when they're sittin around BodyModuleInterface *body = hole->getBodyModule(); @@ -312,7 +312,7 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) healingInfo.in.m_deathType = DEATH_NONE; body->attemptHealing( &healingInfo ); - } // end if + } // when re-construction is complete, we remove this hole and worker if( reconstructing && !reconstructing->getStatusBits().test( OBJECT_STATUS_UNDER_CONSTRUCTION ) ) @@ -327,11 +327,11 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) // make the hole go away TheGameLogic->destroyObject( hole ); - } // end if + } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------- @@ -354,7 +354,7 @@ void RebuildHoleBehavior::onDie( const DamageInfo *damageInfo ) // destroy us TheGameLogic->destroyObject( obj ); -} // end onDie +} // ------------------------------------------------------------------------------------------------ /** Helper method to get interface given an object */ @@ -373,13 +373,13 @@ void RebuildHoleBehavior::onDie( const DamageInfo *damageInfo ) if( rhbi ) break; // exit for - } // end for i + } - } // end if, obj + } return rhbi; -} // end getRebuildHoleBehaviorInterfaceFromObject +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -390,7 +390,7 @@ void RebuildHoleBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -439,13 +439,13 @@ void RebuildHoleBehavior::xfer( Xfer *xfer ) workerName.str() )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } else m_workerTemplate = NULL; - } // end if + } // rebuild template AsciiString rebuildName = m_rebuildTemplate ? m_rebuildTemplate->getName() : AsciiString::TheEmptyString; @@ -464,15 +464,15 @@ void RebuildHoleBehavior::xfer( Xfer *xfer ) rebuildName.str() )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } else m_rebuildTemplate = NULL; - } // end if + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -483,4 +483,4 @@ void RebuildHoleBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp index 929148faafe..d646f9ce27b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp @@ -533,7 +533,7 @@ void SlowDeathBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -566,7 +566,7 @@ void SlowDeathBehavior::xfer( Xfer *xfer ) // flags xfer->xferUnsignedInt( &m_flags ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -577,4 +577,4 @@ void SlowDeathBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp index 4d0253b1f2a..b1e4b46fa95 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp @@ -127,9 +127,9 @@ void SpawnBehavior::onDelete() if( obj && obj->isEffectivelyDead() == FALSE ) TheGameLogic->destroyObject( obj ); - } // end for, it + } - } // end if + } } @@ -185,9 +185,9 @@ void SpawnBehavior::onDie( const DamageInfo *damageInfo ) if( obj && obj->isEffectivelyDead() == FALSE ) obj->kill(); - } // end for, it + } - } // end if + } } @@ -558,9 +558,9 @@ static void findClosestOrphan( Object *obj, void *userData ) orphanData->m_closest = obj; orphanData->m_closestDistSq = distSq; - } // end if + } -} // findClosestOrphan +} // ------------------------------------------------------------------------------------------------ Object *SpawnBehavior::reclaimOrphanSpawn( void ) @@ -936,7 +936,7 @@ void SpawnBehavior::computeAggregateStates(void) spawnCount++; } - } // next iter + } @@ -971,7 +971,7 @@ void SpawnBehavior::computeAggregateStates(void) teamMsg->appendObjectIDArgument( currentSpawn->getID() ); } } - } // next iter + } } // if somebody is selected then I sure need to be! if ( ! obj->getDrawable()->isSelected()) @@ -1065,7 +1065,7 @@ void SpawnBehavior::crc( Xfer *xfer ) // extend base class BehaviorModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1108,11 +1108,11 @@ void SpawnBehavior::xfer( Xfer *xfer ) DEBUG_CRASH(( "SpawnBehavior::xfer - Unable to find template '%s'", name.str() )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } - } // end if + } // one shot countdown xfer->xferInt( &m_oneShotCountdown ); @@ -1143,7 +1143,7 @@ void SpawnBehavior::xfer( Xfer *xfer ) // self tasking spawn count xfer->xferUnsignedInt( &m_selfTaskingSpawnCount ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1154,4 +1154,4 @@ void SpawnBehavior::loadPostProcess( void ) // extend base class BehaviorModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp index 0668e7c6cb0..aa3921e906b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp @@ -146,7 +146,7 @@ void SupplyWarehouseCripplingBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -170,7 +170,7 @@ void SupplyWarehouseCripplingBehavior::xfer( Xfer *xfer ) // next healing frame xfer->xferUnsignedInt( &m_nextHealingFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -181,4 +181,4 @@ void SupplyWarehouseCripplingBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/TechBuildingBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/TechBuildingBehavior.cpp index 22ff8bc3ffb..6f98771bbd3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/TechBuildingBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/TechBuildingBehavior.cpp @@ -61,7 +61,7 @@ TechBuildingBehaviorModuleData::TechBuildingBehaviorModuleData( void ) p.add( dataFieldParse ); -} // end buildFieldParse +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -129,7 +129,7 @@ void TechBuildingBehavior::onDie( const DamageInfo *damageInfo ) us->clearModelConditionState( MODELCONDITION_CAPTURED ); us->setTeam( ThePlayerList->getNeutralPlayer()->getDefaultTeam() ); -} // end onDie +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -142,7 +142,7 @@ void TechBuildingBehavior::onCapture( Player *oldOwner, Player *newOwner ) // wake up next frame so we can re-evaluate our captured status setWakeFrame( getObject(), UPDATE_SLEEP_NONE ); -} // end onCapture +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -152,7 +152,7 @@ void TechBuildingBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -167,7 +167,7 @@ void TechBuildingBehavior::xfer( Xfer *xfer ) // extend base class UpdateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -177,5 +177,5 @@ void TechBuildingBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp index 2f9a62f1398..0808282786e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp @@ -89,7 +89,7 @@ class BodyParticleSystem : public MemoryPoolObject BodyParticleSystem::~BodyParticleSystem( void ) { -} // end ~BodyParticleSystem +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -196,7 +196,7 @@ void ActiveBody::onDelete( void ) // delete all particle systems deleteAllParticleSystems(); -} // end onDelete +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -467,10 +467,10 @@ void ActiveBody::attemptDamage( DamageInfo *damageInfo ) ++numKilled; thingToKill->getControllingPlayer()->getAcademyStats()->recordClearedGarrisonedBuilding(); } - } // next contained item + } - } // if items - } // if a garrisonable thing + } + } alreadyHandled = TRUE; allowModifier = FALSE; break; @@ -1036,16 +1036,16 @@ void ActiveBody::createParticleSystems( const AsciiString &boneBaseName, usedBoneIndices[ j ] = TRUE; break; // exit for j - } // end if + } else { // we won't use this index, increment count until we find a suitable index to use ++count; - } // end else + } - } // end for, j + } // sanity DEBUG_ASSERTCRASH( j != numBones, @@ -1068,11 +1068,11 @@ void ActiveBody::createParticleSystems( const AsciiString &boneBaseName, newEntry->m_next = m_particleSystems; m_particleSystems = newEntry; - } // end if + } - } // end for, i + } -} // end createParticleSystems +} // ------------------------------------------------------------------------------------------------ /** Delete all the body particle systems */ @@ -1099,9 +1099,9 @@ void ActiveBody::deleteAllParticleSystems( void ) // set the body systems head to the next m_particleSystems = nextBodySystem; - } // end while + } -} // end deleteAllParticleSystems +} // ------------------------------------------------------------------------------------------------ /* This function is called on state changes only. Body Type or Aflameness. */ @@ -1140,7 +1140,7 @@ void ActiveBody::updateBodyParticleSystems( void ) // we get to make more of them all too countModifier = 2; - } // end if + } else { @@ -1155,7 +1155,7 @@ void ActiveBody::updateBodyParticleSystems( void ) // we make just the normal amount of these countModifier = 1; - } // end else + } // // remove any particle systems we have currently in the list in favor of any new ones @@ -1196,7 +1196,7 @@ void ActiveBody::updateBodyParticleSystems( void ) createParticleSystems( TheGlobalData->m_autoAflameParticlePrefix, aflameTemplate, TheGlobalData->m_autoAflameParticleMax * countModifier ); -} // end updatebodyParticleSystems +} //------------------------------------------------------------------------------------------------- /** Simple changing of the health value, it does *NOT* track any transition @@ -1241,7 +1241,7 @@ void ActiveBody::internalChangeHealth( Real delta ) if( !getObject()->getStatusBits().test( OBJECT_STATUS_UNDER_CONSTRUCTION ) ) evaluateVisualCondition(); - } // end if + } // mark the bit according to our health. (if our AI is dead but our health improves, it will // still re-flag this bit in the AIDeadState every frame.) @@ -1335,7 +1335,7 @@ BodyDamageType ActiveBody::getDamageState() const Real ActiveBody::getMaxHealth() const { return m_maxHealth; -} ///< return max health +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1363,7 +1363,7 @@ Bool ActiveBody::hasAnySubdualDamage() const Real ActiveBody::getInitialHealth() const { return m_initialHealth; -} // return initial health +} // ------------------------------------------------------------------------------------------------ @@ -1395,15 +1395,15 @@ void ActiveBody::setIndestructible( Bool indestructible ) if( body ) body->setIndestructible( indestructible ); - } // end if + } - } // end for, i + } - } // end if + } - } // end if + } -} // end setIndestructible +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1521,7 +1521,7 @@ void ActiveBody::crc( Xfer *xfer ) // extend base class BodyModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1601,9 +1601,9 @@ void ActiveBody::xfer( Xfer *xfer ) // write particle system ID xfer->xferUser( &system->m_particleSystemID, sizeof( ParticleSystemID ) ); - } // end for, system + } - } // end if, save + } else { ParticleSystemID particleSystemID; @@ -1615,7 +1615,7 @@ void ActiveBody::xfer( Xfer *xfer ) DEBUG_CRASH(( "ActiveBody::xfer - m_particleSystems should be empty, but is not" )); throw SC_INVALID_DATA; - } // end if + } // read all data elements BodyParticleSystem *newEntry; @@ -1631,14 +1631,14 @@ void ActiveBody::xfer( Xfer *xfer ) newEntry->m_next = m_particleSystems; // the list will be reversed, but we don't care m_particleSystems = newEntry; - } // end for, i + } - } // end else, load + } // armor set flags m_curArmorSetFlags.xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1649,4 +1649,4 @@ void ActiveBody::loadPostProcess( void ) // extend base class BodyModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/BodyModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/BodyModule.cpp index 7e86e786348..7171b5b2820 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/BodyModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/BodyModule.cpp @@ -41,7 +41,7 @@ void BodyModule::crc( Xfer *xfer ) // call base class BehaviorModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -62,7 +62,7 @@ void BodyModule::xfer( Xfer *xfer ) // damage scalar xfer->xferReal( &m_damageScalar ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -73,4 +73,4 @@ void BodyModule::loadPostProcess( void ) // call base class BehaviorModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/HighlanderBody.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/HighlanderBody.cpp index a4a4d884afa..e66b4cf258c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/HighlanderBody.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/HighlanderBody.cpp @@ -69,7 +69,7 @@ void HighlanderBody::crc( Xfer *xfer ) // extend base class ActiveBody::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -87,7 +87,7 @@ void HighlanderBody::xfer( Xfer *xfer ) // extend base class ActiveBody::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -98,4 +98,4 @@ void HighlanderBody::loadPostProcess( void ) // extend base class ActiveBody::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/HiveStructureBody.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/HiveStructureBody.cpp index 5bdddbc3a80..d0f32cfca44 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/HiveStructureBody.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/HiveStructureBody.cpp @@ -143,7 +143,7 @@ void HiveStructureBody::crc( Xfer *xfer ) // extend parent class StructureBody::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ImmortalBody.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ImmortalBody.cpp index 22fb9572af2..b9986180282 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ImmortalBody.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ImmortalBody.cpp @@ -74,7 +74,7 @@ void ImmortalBody::crc( Xfer *xfer ) // extend base class ActiveBody::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -92,7 +92,7 @@ void ImmortalBody::xfer( Xfer *xfer ) // extend base class ActiveBody::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -103,4 +103,4 @@ void ImmortalBody::loadPostProcess( void ) // extend base class ActiveBody::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/InactiveBody.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/InactiveBody.cpp index abf22a5e48c..bdbb6959100 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/InactiveBody.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/InactiveBody.cpp @@ -47,14 +47,14 @@ InactiveBody::InactiveBody( Thing *thing, const ModuleData* moduleData ) : BodyModule( thing, moduleData ), m_dieCalled(false) { getObject()->setEffectivelyDead(true); -} // end InactiveBody +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- InactiveBody::~InactiveBody( void ) { -} // end ~InactiveBody +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -146,7 +146,7 @@ Real InactiveBody::getHealth() const // Inactive bodies have no health to get return 0.0f; -} // end getHealth +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -171,7 +171,7 @@ void InactiveBody::crc( Xfer *xfer ) // extend base class BodyModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -189,7 +189,7 @@ void InactiveBody::xfer( Xfer *xfer ) // base class BodyModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -200,6 +200,6 @@ void InactiveBody::loadPostProcess( void ) // extend base class BodyModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/StructureBody.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/StructureBody.cpp index 06941ae0376..a7f2dca3d0e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/StructureBody.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/StructureBody.cpp @@ -45,14 +45,14 @@ StructureBody::StructureBody( Thing *thing, const ModuleData* moduleData ) m_constructorObjectID = INVALID_ID; -} // end StructureBody +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- StructureBody::~StructureBody( void ) { -} // end ~StructureBody +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -62,7 +62,7 @@ void StructureBody::setConstructorObject( Object *obj ) if( obj ) m_constructorObjectID = obj->getID(); -} // end setConstructorObject +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -73,7 +73,7 @@ void StructureBody::crc( Xfer *xfer ) // extend base class ActiveBody::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -94,7 +94,7 @@ void StructureBody::xfer( Xfer *xfer ) // constructor object id xfer->xferObjectID( &m_constructorObjectID ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -105,4 +105,4 @@ void StructureBody::loadPostProcess( void ) // extend base class ActiveBody::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/UndeadBody.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/UndeadBody.cpp index cea8d3990db..05b968d3223 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/UndeadBody.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/UndeadBody.cpp @@ -154,7 +154,7 @@ void UndeadBody::crc( Xfer *xfer ) // extend base class ActiveBody::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -174,7 +174,7 @@ void UndeadBody::xfer( Xfer *xfer ) xfer->xferBool(&m_isSecondLife); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -185,4 +185,4 @@ void UndeadBody::loadPostProcess( void ) // extend base class ActiveBody::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CollideModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CollideModule.cpp index 13950eb4a5f..f802c789f2f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CollideModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CollideModule.cpp @@ -41,7 +41,7 @@ void CollideModule::crc( Xfer *xfer ) // extend base class BehaviorModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -57,7 +57,7 @@ void CollideModule::xfer( Xfer *xfer ) // call base class BehaviorModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -68,4 +68,4 @@ void CollideModule::loadPostProcess( void ) // call base class BehaviorModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToCarBombCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToCarBombCrateCollide.cpp index b032053d063..f24acb94b38 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToCarBombCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToCarBombCrateCollide.cpp @@ -168,7 +168,7 @@ void ConvertToCarBombCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -186,7 +186,7 @@ void ConvertToCarBombCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -197,4 +197,4 @@ void ConvertToCarBombCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToHijackedVehicleCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToHijackedVehicleCrateCollide.cpp index 8e6e00b6afb..37b68a4df9e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToHijackedVehicleCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToHijackedVehicleCrateCollide.cpp @@ -205,7 +205,7 @@ Bool ConvertToHijackedVehicleCrateCollide::executeCrateBehavior( Object *other ) targetCanEject = TRUE; break; } - } // end for dmi + } if ( ! targetCanEject ) { @@ -262,7 +262,7 @@ void ConvertToHijackedVehicleCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -280,7 +280,7 @@ void ConvertToHijackedVehicleCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -291,4 +291,4 @@ void ConvertToHijackedVehicleCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp index 22d9d56d29f..4336c64cce5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp @@ -247,7 +247,7 @@ void CrateCollide::crc( Xfer *xfer ) // extend base class CollideModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -265,7 +265,7 @@ void CrateCollide::xfer( Xfer *xfer ) // extend base class CollideModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -276,4 +276,4 @@ void CrateCollide::loadPostProcess( void ) // extend base class CollideModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/HealCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/HealCrateCollide.cpp index b1743b622ce..2a3b19f97d5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/HealCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/HealCrateCollide.cpp @@ -73,7 +73,7 @@ void HealCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -91,7 +91,7 @@ void HealCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -102,5 +102,5 @@ void HealCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/MoneyCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/MoneyCrateCollide.cpp index 73961619bfd..8d57834c7a9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/MoneyCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/MoneyCrateCollide.cpp @@ -103,7 +103,7 @@ void MoneyCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -121,7 +121,7 @@ void MoneyCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -132,4 +132,4 @@ void MoneyCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageCommandCenterCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageCommandCenterCrateCollide.cpp index 2fc703da7ac..b7614abc94c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageCommandCenterCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageCommandCenterCrateCollide.cpp @@ -162,7 +162,7 @@ void SabotageCommandCenterCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -180,7 +180,7 @@ void SabotageCommandCenterCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -191,4 +191,4 @@ void SabotageCommandCenterCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageFakeBuilding.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageFakeBuilding.cpp index 21bf2364013..8554948faa3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageFakeBuilding.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageFakeBuilding.cpp @@ -157,7 +157,7 @@ void SabotageFakeBuildingCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -175,7 +175,7 @@ void SabotageFakeBuildingCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -186,4 +186,4 @@ void SabotageFakeBuildingCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageInternetCenterCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageInternetCenterCrateCollide.cpp index df18ecc399a..487b4906340 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageInternetCenterCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageInternetCenterCrateCollide.cpp @@ -200,7 +200,7 @@ void SabotageInternetCenterCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -218,7 +218,7 @@ void SabotageInternetCenterCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -229,4 +229,4 @@ void SabotageInternetCenterCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageMilitaryFactoryCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageMilitaryFactoryCrateCollide.cpp index 87f92e413ea..cb51ddda27f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageMilitaryFactoryCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageMilitaryFactoryCrateCollide.cpp @@ -157,7 +157,7 @@ void SabotageMilitaryFactoryCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -175,7 +175,7 @@ void SabotageMilitaryFactoryCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -186,4 +186,4 @@ void SabotageMilitaryFactoryCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotagePowerPlantCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotagePowerPlantCrateCollide.cpp index 40536c1c5b0..cd95755e30e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotagePowerPlantCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotagePowerPlantCrateCollide.cpp @@ -159,7 +159,7 @@ void SabotagePowerPlantCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -177,7 +177,7 @@ void SabotagePowerPlantCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -188,4 +188,4 @@ void SabotagePowerPlantCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSuperweaponCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSuperweaponCrateCollide.cpp index c22f36463f2..637df26f7b5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSuperweaponCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSuperweaponCrateCollide.cpp @@ -162,7 +162,7 @@ void SabotageSuperweaponCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -180,7 +180,7 @@ void SabotageSuperweaponCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -191,4 +191,4 @@ void SabotageSuperweaponCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyCenterCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyCenterCrateCollide.cpp index 6f3e9be2f6a..0a951bf3a02 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyCenterCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyCenterCrateCollide.cpp @@ -190,7 +190,7 @@ void SabotageSupplyCenterCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -208,7 +208,7 @@ void SabotageSupplyCenterCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -219,4 +219,4 @@ void SabotageSupplyCenterCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyDropzoneCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyDropzoneCrateCollide.cpp index 85ad2e9cb35..416cc5c2c31 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyDropzoneCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyDropzoneCrateCollide.cpp @@ -201,7 +201,7 @@ void SabotageSupplyDropzoneCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -219,7 +219,7 @@ void SabotageSupplyDropzoneCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -230,4 +230,4 @@ void SabotageSupplyDropzoneCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SalvageCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SalvageCrateCollide.cpp index 05b8ee457fb..420c6dbcc6c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SalvageCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SalvageCrateCollide.cpp @@ -268,7 +268,7 @@ void SalvageCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -286,7 +286,7 @@ void SalvageCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -297,4 +297,4 @@ void SalvageCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ShroudCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ShroudCrateCollide.cpp index cbb3348d69e..0f75dba0014 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ShroudCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ShroudCrateCollide.cpp @@ -73,7 +73,7 @@ void ShroudCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -91,7 +91,7 @@ void ShroudCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -102,4 +102,4 @@ void ShroudCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/UnitCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/UnitCrateCollide.cpp index 01df6fa5799..df7eb3613ad 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/UnitCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/UnitCrateCollide.cpp @@ -100,7 +100,7 @@ void UnitCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -118,7 +118,7 @@ void UnitCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -129,4 +129,4 @@ void UnitCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/VeterancyCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/VeterancyCrateCollide.cpp index 549aa27e29e..752e4f7c9a3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/VeterancyCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/VeterancyCrateCollide.cpp @@ -178,7 +178,7 @@ void VeterancyCrateCollide::crc( Xfer *xfer ) // extend base class CrateCollide::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -196,7 +196,7 @@ void VeterancyCrateCollide::xfer( Xfer *xfer ) // extend base class CrateCollide::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -207,4 +207,4 @@ void VeterancyCrateCollide::loadPostProcess( void ) // extend base class CrateCollide::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/FireWeaponCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/FireWeaponCollide.cpp index 40d1271de99..e0c2ecd1d24 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/FireWeaponCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/FireWeaponCollide.cpp @@ -120,7 +120,7 @@ void FireWeaponCollide::crc( Xfer *xfer ) // extend base class CollideModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -148,19 +148,19 @@ void FireWeaponCollide::xfer( Xfer *xfer ) ("FireWeaponCollide::xfer - m_collideWeapon present mismatch") ); xfer->xferSnapshot( m_collideWeapon ); - } // end else + } else { DEBUG_ASSERTCRASH( m_collideWeapon == NULL, ("FireWeaponCollide::Xfer - m_collideWeapon missing mismatch" )); - } // end else + } // ever fired xfer->xferBool( &m_everFired ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -171,4 +171,4 @@ void FireWeaponCollide::loadPostProcess( void ) // extend base class CollideModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/SquishCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/SquishCollide.cpp index 53c58b70d58..75d122ca47f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/SquishCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/SquishCollide.cpp @@ -138,7 +138,7 @@ void SquishCollide::crc( Xfer *xfer ) // extend base class CollideModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -156,7 +156,7 @@ void SquishCollide::xfer( Xfer *xfer ) // extend base class CollideModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -167,4 +167,4 @@ void SquishCollide::loadPostProcess( void ) // extend base class CollideModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/CaveContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/CaveContain.cpp index 8e0e304563e..ca9be06c82f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/CaveContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/CaveContain.cpp @@ -188,7 +188,7 @@ void CaveContain::onRemoving( Object *obj ) draw->clearModelConditionState( MODELCONDITION_GARRISONED ); } - } // end if + } } Bool CaveContain::isValidContainerFor(const Object* obj, Bool checkCapacity) const @@ -374,7 +374,7 @@ void CaveContain::crc( Xfer *xfer ) // extend base class OpenContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -414,15 +414,15 @@ void CaveContain::xfer( Xfer *xfer ) DEBUG_CRASH(( "CaveContain::xfer - Unable to find original team by id" )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } else m_originalTeam = NULL; - } // end if + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -433,4 +433,4 @@ void CaveContain::loadPostProcess( void ) // extend base class OpenContain::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp index 22751355f8d..1c5f42ca762 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp @@ -76,7 +76,7 @@ GarrisonContainModuleData::GarrisonContainModuleData( void ) m_isEnclosingContainer = TRUE; ///< a sensible default for a garrison container... few exceptions, firebase is one m_initialRoster.count = 0; -} // end if +} //----------------------------------------------------------------------------- inline Real calcDistSqr(const Coord3D& a, const Coord3D& b) @@ -118,15 +118,15 @@ Int GarrisonContain::findClosestFreeGarrisonPointIndex( Int conditionIndex, closestDistSq = distSq; closestIndex = i; - } // end if + } - } // end if + } - } // end for i + } return closestIndex; -} // end findClosestFreeGarrisonPointIndex +} // ------------------------------------------------------------------------------------------------ /** Given the object, return the garrison point index the object is placed at ... if any */ @@ -144,7 +144,7 @@ Int GarrisonContain::getObjectGarrisonPointIndex( Object *obj ) return GARRISON_INDEX_INVALID; -} // end getObjectGarrisonPointIndex +} // ------------------------------------------------------------------------------------------------ /** Put the object at the specified garrison point by index */ @@ -164,7 +164,7 @@ void GarrisonContain::putObjectAtGarrisonPoint( Object *obj, DEBUG_CRASH(( "GarrisionContain::putObjectAtGarrisionPoint - Invalid arguments" )); return; - } // end if + } // make sure this point is empty if( m_garrisonPointData[ pointIndex ].object != NULL ) @@ -174,7 +174,7 @@ void GarrisonContain::putObjectAtGarrisonPoint( Object *obj, pointIndex )); return; - } // end if + } // get the position we're going to use Coord3D pos = m_garrisonPoint[ conditionIndex ][ pointIndex ]; @@ -212,9 +212,9 @@ void GarrisonContain::putObjectAtGarrisonPoint( Object *obj, if (containerDrawable) draw->setFullyObscuredByShroud(containerDrawable->getFullyObscuredByShroud()); - } // end if + } - } // end if + } /* UnicodeString msg; @@ -225,7 +225,7 @@ msg.format( L"Added object '%S'(%d) to point '%d'", TheInGameUI->message( msg ); */ -} // end putObjectAtGarrisonPoint +} // ------------------------------------------------------------------------------------------------ /** Given the current state of the structure, return the condition index we are to use @@ -266,11 +266,11 @@ Int GarrisonContain::findConditionIndex( void ) bodyDamage )); break; - } // end switch + } return index; -} // end findConditionIndex +} //------------------------------------------------------------------------------------------------- //The weapon system would like to perform a range check assuming the object is placed in the @@ -421,7 +421,7 @@ void GarrisonContain::putObjectAtBestGarrisonPoint( Object *obj, Object *target, // put it here putObjectAtGarrisonPoint( obj, target ? target->getID() : INVALID_ID, conditionIndex, placeIndex ); -} // end putObjectAtBestGarrisonPoint +} // ------------------------------------------------------------------------------------------------ /** Remove the object from the garrison point position and replace at the center of the building */ @@ -455,11 +455,11 @@ void GarrisonContain::removeObjectFromGarrisonPoint( Object *obj, Int index ) removeIndex = i; break; - } // end if + } - } // end for i + } - } // end if + } // validate the index slot to remove if( removeIndex < 0 || removeIndex >= MAX_GARRISON_POINTS ) @@ -471,7 +471,7 @@ void GarrisonContain::removeObjectFromGarrisonPoint( Object *obj, Int index ) // return; - } // end if + } // remove from this spot m_garrisonPointData[ removeIndex ].object = NULL; @@ -497,7 +497,7 @@ msg.format( L"Removed object '%S'(%d) from point '%d'", TheInGameUI->message( msg ); */ -} // end removeObjectFromGarrisonPoint +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -524,7 +524,7 @@ GarrisonContain::GarrisonContain( Thing *thing, const ModuleData *moduleData ) : for( j = 0; j < MAX_GARRISON_POINT_CONDITIONS; ++j ) m_garrisonPoint[ j ][ i ].zero(); - } // end for i + } m_rallyValid = FALSE; m_exitRallyPoint.zero(); @@ -535,14 +535,14 @@ GarrisonContain::GarrisonContain( Thing *thing, const ModuleData *moduleData ) : m_stationPointList.clear(); -} // end GarrisonContain +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- GarrisonContain::~GarrisonContain( void ) { -} // end ~GarrisonContain +} //------------------------------------------------------------------------------------------------- /** can this container contain this kind of object? @@ -623,11 +623,11 @@ void GarrisonContain::removeInvalidObjectsFromGarrisonPoints( void ) removeObjectFromGarrisonPoint( obj, i ); } - } // end if + } - } // end for i + } -} // end removeInvalidObjectsFromGarrisonPoints +} // ------------------------------------------------------------------------------------------------ /** Are there any objects in the center that have now obtained targets and need to move to @@ -666,11 +666,11 @@ void GarrisonContain::addValidObjectsToGarrisonPoints( void ) else if( victimPos ) putObjectAtBestGarrisonPoint( obj, NULL, victimPos ); - } // end if + } - } // end for it + } -} // end addValidObjectsToGarrisonPoints +} // ------------------------------------------------------------------------------------------------ /** Every frame this method is called. It keeps any of the attacking units at any of the @@ -742,9 +742,9 @@ void GarrisonContain::trackTargets( void ) // place at the new index putObjectAtGarrisonPoint( obj, victim ? victim->getID() : INVALID_ID, conditionIndex, newIndex ); - } // end if, new index is closer + } - } // end if, possible closer index was found + } // // we are now either at a new garrison fire point, or we have remained at our @@ -761,17 +761,17 @@ void GarrisonContain::trackTargets( void ) // orient the effect object towards the victim position m_garrisonPointData[ ourIndex ].effect->setOrientation( v.toAngle() ); - } // end if + } - } // end if, victim present + } - } // end if, ai + } - } // end if, we're at a garrison point + } - } // end for it + } -} // end trackTargets +} // ------------------------------------------------------------------------------------------------ /** Remove all the objects at garrison points back to the center and redeploy them among the @@ -818,11 +818,11 @@ void GarrisonContain::redeployOccupants( void ) if( index != GARRISON_INDEX_INVALID ) m_garrisonPointData[ index ].placeFrame = garrisonPointDataCopy[ i ].placeFrame; - } // end if + } - } // end for i + } -} // end redeployOccupants +} // ------------------------------------------------------------------------------------------------ /** Do any effects during an update cycle that we need to */ @@ -873,13 +873,13 @@ void GarrisonContain::updateEffects( void ) m_garrisonPointData[ garrisonIndex ].lastEffectFrame = currentFrame; } - } // end if + } - } // end if, object is at garrision point + } - } // end if, object shot last frame + } - } // end for containment iterator + } // remove any firing effects for time that has passed for( Int i = 0; i < MAX_GARRISON_POINTS; ++i ) @@ -896,11 +896,11 @@ void GarrisonContain::updateEffects( void ) // clear the last effect frame m_garrisonPointData[ i ].lastEffectFrame = 0; - } // end if + } - } // end for i + } -} // end updateEffects +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -934,9 +934,9 @@ UpdateSleepTime GarrisonContain::update( void ) #define HUGE_FRAME_IN_FUTURE (LOGICFRAMES_PER_SECOND * 1000) contained->setSafeOcclusionFrame( TheGameLogic->getFrame() + HUGE_FRAME_IN_FUTURE ); - } // end if + } - } // end for, it + } // Lorenzen changed, 6/11/03, so that garrisoncontains that are not enclosing will keep units at their assigned stations, // rather than Bamphing them all over the building as they fire. @@ -964,7 +964,7 @@ UpdateSleepTime GarrisonContain::update( void ) } return UPDATE_SLEEP_NONE; -} // end update +} @@ -1037,7 +1037,7 @@ void GarrisonContain::positionObjectsAtStationGarrisonPoints() DEBUG_ASSERTCRASH( foundHisSpot, ("GarrisonContain::positionObjectsAtStationGarrisonPoints found something terribly wrong... \nthere is either a station point shortage, or some other bug.")); } - } // end for, it + } } @@ -1166,7 +1166,7 @@ void GarrisonContain::healSingleObject( Object *obj, Real framesForFullHeal) // set max health body->attemptHealing( &healInfo ); - } // end if + } else { // @@ -1179,7 +1179,7 @@ void GarrisonContain::healSingleObject( Object *obj, Real framesForFullHeal) // do the healing body->attemptHealing( &healInfo ); - } // end else + } } //------------------------------------------------------------------------------------------------- @@ -1386,7 +1386,7 @@ void GarrisonContain::loadGarrisonPoints( void ) // restore the original condition flags draw->replaceModelConditionFlags( originalFlags ); - } // end if, draw + } // garrison points are now initialized m_garrisonPointsInitialized = TRUE; @@ -1401,7 +1401,7 @@ void GarrisonContain::loadGarrisonPoints( void ) -} // end loadGarrisonPoints +} // ------------------------------------------------------------------------------------------------ /** Validate any exit rally point that has been chosen (if any). If it's not valid, @@ -1425,7 +1425,7 @@ void GarrisonContain::validateRallyPoint( void ) if( ThePartitionManager->findPositionAround( &m_exitRallyPoint, &options, &result ) == FALSE ) m_rallyValid = FALSE; - } // end if + } // if no rally point is present, try to find one if( m_rallyValid == FALSE ) @@ -1441,9 +1441,9 @@ void GarrisonContain::validateRallyPoint( void ) m_rallyValid = ThePartitionManager->findPositionAround( getObject()->getPosition(), &options, &m_exitRallyPoint ); - } // end if + } -} // end validateRallyPoint +} @@ -1480,14 +1480,14 @@ void GarrisonContain::removeAllContained( Bool exposeStealthUnits ) // validate the current rally point is still a good one, or pick a new one validateRallyPoint(); - } // end if + } // call the base class to extend functionality and do the actual removal OpenContain::removeAllContained( exposeStealthUnits ); recalcApparentControllingPlayer(); -} // end removeAllContained +} // ------------------------------------------------------------------------------------------------ /** 'exitObj' is one of the things we contain, it needs to 'exit' us */ @@ -1644,7 +1644,7 @@ void GarrisonContain::onContaining( Object *obj, Bool wasSelected ) TheInGameUI->deselectDrawable( draw ); -} // end onContaining +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1694,7 +1694,7 @@ void GarrisonContain::onRemoving( Object *obj ) draw->clearModelConditionState( MODELCONDITION_GARRISONED ); } - } // end if + } else if( getStealthUnitsContained() != getContainCount() ) { m_hideGarrisonedStateFromNonallies = false; @@ -1705,7 +1705,7 @@ void GarrisonContain::onRemoving( Object *obj ) obj->setSafeOcclusionFrame(TheGameLogic->getFrame()+obj->getTemplate()->getOcclusionDelay()); recalcApparentControllingPlayer(); -} // end onRemoving +} // ------------------------------------------------------------------------------------------------ /** A GarrisonContain always lets people shoot out */ @@ -1719,7 +1719,7 @@ Bool GarrisonContain::isPassengerAllowedToFire( ObjectID id ) const return TRUE; -} // end isPassengerAllowedToFire +} // ------------------------------------------------------------------------------------------------ /** A Mobile garrison keeps its occupants with it when it moves */ @@ -1789,7 +1789,7 @@ void GarrisonContain::crc( Xfer *xfer ) // extend base class OpenContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1824,13 +1824,13 @@ void GarrisonContain::xfer( Xfer *xfer ) DEBUG_CRASH(( "GarrisonContain::xfer - Unable to find original team by id" )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } else m_originalTeam = NULL; - } // end if + } xfer->xferBool( &m_hideGarrisonedStateFromNonallies ); @@ -1862,7 +1862,7 @@ void GarrisonContain::xfer( Xfer *xfer ) DrawableID drawableID = draw ? draw->getID() : INVALID_DRAWABLE_ID; xfer->xferDrawableID( &drawableID ); - } // end if, save + } else { @@ -1896,11 +1896,11 @@ void GarrisonContain::xfer( Xfer *xfer ) m_garrisonPointData[ i ].lastEffectFrame = lastEffectFrame; m_garrisonPointData[ i ].effectID = drawableID; - } // end if + } - } // end else, load + } - } // end for i + } // garrison points in use xfer->xferInt( &m_garrisonPointsInUse ); @@ -1917,7 +1917,7 @@ void GarrisonContain::xfer( Xfer *xfer ) // exit rally point xfer->xferCoord3D( &m_exitRallyPoint ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1943,9 +1943,9 @@ void GarrisonContain::loadPostProcess( void ) DEBUG_CRASH(( "GarrisonContain::loadPostProcess - Unable to find object for point data" )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } else m_garrisonPointData[ i ].object = NULL; @@ -1960,15 +1960,15 @@ void GarrisonContain::loadPostProcess( void ) DEBUG_CRASH(( "GarrisonContain::loadPostProcess - Unable to find effect for point data" )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } else m_garrisonPointData[ i ].effect = NULL; - } // end for i + } -} // end loadPostProcess +} @@ -2046,7 +2046,7 @@ void GarrisonContain::loadStationGarrisonPoints( void ) ("GarrisonContain::update - You have specified this garrisonContain as mobile,\n yet you want station garrison point placement bones... \n what are you thinking?") ); } -} // end loadStationGarrisonPoints +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/HealContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/HealContain.cpp index 54f107d858c..a508f0cee19 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/HealContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/HealContain.cpp @@ -48,7 +48,7 @@ HealContainModuleData::HealContainModuleData( void ) m_framesForFullHeal = 0; -} // end HealContainModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -65,7 +65,7 @@ HealContainModuleData::HealContainModuleData( void ) p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -77,14 +77,14 @@ HealContain::HealContain( Thing *thing, const ModuleData *moduleData ) : OpenContain( thing, moduleData ) { -} // end HealContain +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ HealContain::~HealContain( void ) { -} // end ~HealContain +} // ------------------------------------------------------------------------------------------------ /** Per frame update */ @@ -123,13 +123,13 @@ UpdateSleepTime HealContain::update( void ) ExitDoorType exitDoor = reserveDoorForExit(obj->getTemplate(), obj); if (exitDoor != DOOR_NONE_AVAILABLE) exitObjectViaDoor( obj, exitDoor ); - } // end if + } - } // end for, it + } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** Do the healing for a single object for a single frame. */ @@ -160,7 +160,7 @@ Bool HealContain::doHeal( Object *obj, UnsignedInt framesForFullHeal ) // we're done healing doneHealing = TRUE; - } // end if + } else { @@ -174,12 +174,12 @@ Bool HealContain::doHeal( Object *obj, UnsignedInt framesForFullHeal ) // do the healing body->attemptHealing( &healInfo ); - } // end else + } // return if we're done healing return doneHealing; -} // end doHeal +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -190,7 +190,7 @@ void HealContain::crc( Xfer *xfer ) // extend base class OpenContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -208,7 +208,7 @@ void HealContain::xfer( Xfer *xfer ) // extend base class OpenContain::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -219,4 +219,4 @@ void HealContain::loadPostProcess( void ) // extend base class OpenContain::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/HelixContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/HelixContain.cpp index 44688a5e3f1..690970f749c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/HelixContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/HelixContain.cpp @@ -182,7 +182,7 @@ void HelixContain::createPayload() contain->enableLoadSounds( TRUE ); - } // endif contain + } m_payloadCreated = TRUE; @@ -409,7 +409,7 @@ void HelixContain::onContaining( Object *obj, Bool wasSelected ) -} // end onContaining +} void HelixContain::onRemoving( Object *obj ) { @@ -420,7 +420,7 @@ void HelixContain::onRemoving( Object *obj ) obj->clearWeaponBonusCondition( WEAPONBONUSCONDITION_GARRISONED ); obj->clearDisabled( DISABLED_HELD ); -} // end onRemoving +} @@ -440,7 +440,7 @@ void HelixContain::crc( Xfer *xfer ) // extend base class TransportContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -462,7 +462,7 @@ void HelixContain::xfer( Xfer *xfer ) TransportContain::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -473,4 +473,4 @@ void HelixContain::loadPostProcess( void ) // extend base class TransportContain::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/InternetHackContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/InternetHackContain.cpp index 06a9a6d25e7..a917bc31b74 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/InternetHackContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/InternetHackContain.cpp @@ -94,7 +94,7 @@ void InternetHackContain::crc( Xfer *xfer ) // extend base class TransportContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -112,7 +112,7 @@ void InternetHackContain::xfer( Xfer *xfer ) // extend base class TransportContain::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -123,4 +123,4 @@ void InternetHackContain::loadPostProcess( void ) // extend base class TransportContain::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/MobNexusContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/MobNexusContain.cpp index 2a178026ea7..3bcf07de4e5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/MobNexusContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/MobNexusContain.cpp @@ -221,7 +221,7 @@ void MobNexusContain::onContaining( Object *rider, Bool wasSelected ) if( draw ) draw->setModelConditionState( MODELCONDITION_LOADED ); - } // end if + } } @@ -289,7 +289,7 @@ void MobNexusContain::onRemoving( Object *rider ) if( draw ) draw->clearModelConditionState( MODELCONDITION_LOADED ); - } // end if + } if (getObject()->isAboveTerrain()) { @@ -462,7 +462,7 @@ void MobNexusContain::crc( Xfer *xfer ) // extend base class OpenContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -483,7 +483,7 @@ void MobNexusContain::xfer( Xfer *xfer ) // extra slots in use xfer->xferInt( &m_extraSlotsInUse ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -494,4 +494,4 @@ void MobNexusContain::loadPostProcess( void ) // extend base class OpenContain::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp index 8ebfd653b70..32c6de3a19f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp @@ -80,7 +80,7 @@ OpenContainModuleData::OpenContainModuleData( void ) m_allowAlliesInside = TRUE; m_allowEnemiesInside = TRUE; m_allowNeutralInside = TRUE; -} // end OpenContainModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -150,7 +150,7 @@ OpenContain::OpenContain( Thing *thing, const ModuleData* moduleData ) : UpdateM for( Int i = 0; i < MAX_FIRE_POINTS; i++ ) { m_firePoints[ i ].Make_Identity(); - } // end for i + } } @@ -162,7 +162,7 @@ Int OpenContain::getContainMax( void ) const return modData->m_containMax; -} // end getContainMax +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -430,9 +430,9 @@ void OpenContain::removeAllContained( Bool exposeStealthUnits ) // note that this invalidates the iterator! removeFromContainViaIterator( it, exposeStealthUnits ); - } // end while + } -} // end removeAllContained +} //------------------------------------------------------------------------------------------------- /** Kill all contained objects in the contained list */ @@ -465,7 +465,7 @@ void OpenContain::killAllContained( void ) } } -} // end killAllContained +} //-------------------------------------------------------------------------------------------------------- /** Force all contained objects in the contained list to exit, and kick them in the pants on the way out*/ @@ -492,12 +492,12 @@ void OpenContain::harmAndForceExitAllContained( DamageInfo *info ) //Fix is to reset the list. it = m_containList.begin(); - } // end while + } DEBUG_ASSERTCRASH( m_containListSize == 0, ("harmAndForceExitAllContained just made a booboo, list size != zero.") ); -} // end harmAndForceExitAllContained +} //------------------------------------------------------------------------------------------------- @@ -732,14 +732,14 @@ void OpenContain::scatterToNearbyPosition(Object* rider) ai->ignoreObstacle(theContainer); ai->aiMoveToPosition( &pos, CMD_FROM_AI ); - } // end if + } else { // no ai, just set position at the target pos rider->setPosition( &pos ); - } // end else + } } //------------------------------------------------------------------------------------------------- @@ -925,14 +925,14 @@ Bool OpenContain::isValidContainerFor(const Object* obj, Bool checkCapacity) con obj->getTemplate()->getName().str() )); return FALSE; - } // end switch + } if( relationshipRestricted == TRUE ) return FALSE; // all is well return true; -} // end isValidContainerFor +} // ------------------------------------------------------------------------------------------------ /** @@ -1198,7 +1198,7 @@ void OpenContain::monitorConditionChanges( void ) m_conditionState = currCondition; } -} // end monitorConditionChanges +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1226,7 +1226,7 @@ void OpenContain::redeployOccupants( void ) putObjAtNextFirePoint( *it ); } -} // end redeployOccupants +} //------------------------------------------------------------------------------------------------- /** Place the object at the 3D position of the next fire point to use */ @@ -1251,7 +1251,7 @@ void OpenContain::putObjAtNextFirePoint( Object *obj ) if( m_firePointSize == 0 ) m_noFirePointsInArt = TRUE; - } // end if + } // // if there are no fire points in the art we just put the object at the center @@ -1264,7 +1264,7 @@ void OpenContain::putObjAtNextFirePoint( Object *obj ) obj->setPosition( pos ); return; - } // end if + } // get the position Matrix3D matrix; @@ -1302,7 +1302,7 @@ void OpenContain::putObjAtNextFirePoint( Object *obj ) if( m_firePointNext >= m_firePointSize ) m_firePointNext = 0; -} // end putObjAtNextFirePoint +} //------------------------------------------------------------------------------------------------- /** @@ -1665,7 +1665,7 @@ void OpenContain::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1697,9 +1697,9 @@ void OpenContain::xfer( Xfer *xfer ) objectID = (*it)->getID(); xfer->xferObjectID( &objectID ); - } // end for, it + } - } // end if, save + } else { @@ -1723,7 +1723,7 @@ void OpenContain::xfer( Xfer *xfer ) throw SC_INVALID_DATA; #endif - } // end if + } // contain list size xfer->xferUnsignedInt( &m_containListSize ); @@ -1738,9 +1738,9 @@ void OpenContain::xfer( Xfer *xfer ) // put on list for later processing once objects are loaded m_xferContainIDList.push_back( objectID ); - } // end for, i + } - } // end else, load + } // player entered mask xfer->xferUser( &m_playerEnteredMask, sizeof( PlayerMaskType ) ); @@ -1800,9 +1800,9 @@ void OpenContain::xfer( Xfer *xfer ) enterExitType = (*it).second; xfer->xferUser( &enterExitType, sizeof( ObjectEnterExitType ) ); - } // end for, it + } - } // end if, save + } else { @@ -1813,7 +1813,7 @@ void OpenContain::xfer( Xfer *xfer ) DEBUG_CRASH(( "OpenContain::xfer - m_objectEnterExitInfo should be empty, but is not" )); throw SC_INVALID_DATA; - } // end if + } // read all data items for( UnsignedShort i = 0; i < enterExitCount; ++i ) @@ -1828,9 +1828,9 @@ void OpenContain::xfer( Xfer *xfer ) // assign m_objectEnterExitInfo[ objectID ] = enterExitType; - } // end for, i + } - } // end else, load + } // which exit path xfer->xferInt( &m_whichExitPath ); @@ -1842,7 +1842,7 @@ void OpenContain::xfer( Xfer *xfer ) } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1861,7 +1861,7 @@ void OpenContain::loadPostProcess( void ) DEBUG_CRASH(( "OpenContain::loadPostProcess - Contain list should be empty before load but is not" )); throw SC_INVALID_DATA; - } // end if + } // turn the contained id list into actual object pointers in the contain list Object *obj; @@ -1879,7 +1879,7 @@ void OpenContain::loadPostProcess( void ) DEBUG_CRASH(( "OpenContain::loadPostProcess - Unable to find object to put on contain list" )); throw SC_INVALID_DATA; - } // end if + } // put object on list m_containList.push_back( obj ); @@ -1891,7 +1891,7 @@ void OpenContain::loadPostProcess( void ) // record in the object who we are contained by obj->friend_setContainedBy( us ); - } // end for, idIt + } // sanity DEBUG_ASSERTCRASH( m_containListSize == m_containList.size(), @@ -1900,4 +1900,4 @@ void OpenContain::loadPostProcess( void ) // clear the list as we don't need it anymore m_xferContainIDList.clear(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp index 7d503599c4d..bea14449cf3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp @@ -148,7 +148,7 @@ void OverlordContain::createPayload() contain->enableLoadSounds( TRUE ); - } // endif contain + } m_payloadCreated = TRUE; @@ -598,7 +598,7 @@ void OverlordContain::crc( Xfer *xfer ) // extend base class TransportContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -619,7 +619,7 @@ void OverlordContain::xfer( Xfer *xfer ) // redirection activated xfer->xferBool( &m_redirectionActivated ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -630,4 +630,4 @@ void OverlordContain::loadPostProcess( void ) // extend base class TransportContain::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp index 1b0769ffc19..3e2072123d7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp @@ -700,7 +700,7 @@ void ParachuteContain::crc( Xfer *xfer ) // extend base class OpenContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -772,7 +772,7 @@ void ParachuteContain::xfer( Xfer *xfer ) // opened xfer->xferBool( &m_opened ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -783,4 +783,4 @@ void ParachuteContain::loadPostProcess( void ) // extend base class OpenContain::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/RailedTransportContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/RailedTransportContain.cpp index 3fb8fa361e5..f04a7911d92 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/RailedTransportContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/RailedTransportContain.cpp @@ -51,7 +51,7 @@ static RailedTransportDockUpdateInterface *getRailedTransportDockUpdateInterface return rtdui; -} // end getRailedTransportDockUpdateInterface +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -59,14 +59,14 @@ RailedTransportContain::RailedTransportContain( Thing *thing, const ModuleData * : TransportContain( thing, moduleData ) { -} // end RailedTransportContain +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ RailedTransportContain::~RailedTransportContain( void ) { -} // end ~RailedTransportContain +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -83,9 +83,9 @@ void RailedTransportContain::onRemoving( Object *obj ) if( dui ) dui->setDockOpen( TRUE ); - } // end if + } -} // end onRemoving +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -101,7 +101,7 @@ Bool RailedTransportContain::isSpecificRiderFreeToExit( Object *obj ) // we can now exit, note we're not extending the base class cause *we* handle it all return TRUE; -} // end isSpecificRiderFreeToExit +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -115,7 +115,7 @@ void RailedTransportContain::exitObjectViaDoor( Object *newObj, ExitDoorType exi // tell the railed dock to exit ONE object, this one rtdui->unloadSingleObject( newObj ); -} // end exitObjectViaDoor +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -126,7 +126,7 @@ void RailedTransportContain::crc( Xfer *xfer ) // extend base class TransportContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -144,7 +144,7 @@ void RailedTransportContain::xfer( Xfer *xfer ) // extend base class TransportContain::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -155,4 +155,4 @@ void RailedTransportContain::loadPostProcess( void ) // extend base class TransportContain::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/RiderChangeContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/RiderChangeContain.cpp index d42bdd83030..36e02589a76 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/RiderChangeContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/RiderChangeContain.cpp @@ -449,7 +449,7 @@ void RiderChangeContain::crc( Xfer *xfer ) // extend base class TransportContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -476,7 +476,7 @@ void RiderChangeContain::xfer( Xfer *xfer ) // frame exit not busy xfer->xferUnsignedInt( &m_frameExitNotBusy ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -487,4 +487,4 @@ void RiderChangeContain::loadPostProcess( void ) // extend base class TransportContain::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp index 404fb4915ad..9950dc5c18c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp @@ -259,7 +259,7 @@ void TransportContain::letRidersUpgradeWeaponSet( void ) } } } - }//end if rider + } } } @@ -299,7 +299,7 @@ void TransportContain::onContaining( Object *rider, Bool wasSelected ) if( draw ) draw->setModelConditionState( MODELCONDITION_LOADED ); - } // end if + } if ( getTransportContainModuleData()->m_armedRidersUpgradeWeaponSet ) letRidersUpgradeWeaponSet(); @@ -381,7 +381,7 @@ void TransportContain::onRemoving( Object *rider ) if( draw ) draw->clearModelConditionState( MODELCONDITION_LOADED ); - } // end if + } if (getObject()->isAboveTerrain()) { @@ -658,7 +658,7 @@ void TransportContain::crc( Xfer *xfer ) // extend base class OpenContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -685,7 +685,7 @@ void TransportContain::xfer( Xfer *xfer ) // frame exit not busy xfer->xferUnsignedInt( &m_frameExitNotBusy ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -696,4 +696,4 @@ void TransportContain::loadPostProcess( void ) // extend base class OpenContain::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp index fe8ae0cedc0..6d639e77baf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp @@ -140,9 +140,9 @@ void TunnelContain::harmAndForceExitAllContained( DamageInfo *info ) removeFromContain( obj, true ); obj->attemptDamage( info ); it = (*fullList).begin(); - } // end while + } -} // end removeAllContained +} //------------------------------------------------------------------------------------------------- @@ -369,14 +369,14 @@ void TunnelContain::scatterToNearbyPosition(Object* obj) ai->ignoreObstacle(theContainer); ai->aiMoveToPosition( &pos, CMD_FROM_AI ); - } // end if + } else { // no ai, just set position at the target pos obj->setPosition( &pos ); - } // end else + } } //------------------------------------------------------------------------------------------------- @@ -569,7 +569,7 @@ void TunnelContain::crc( Xfer *xfer ) // extend base class OpenContain::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -593,7 +593,7 @@ void TunnelContain::xfer( Xfer *xfer ) // Currently registered with owning player xfer->xferBool( &m_isCurrentlyRegistered ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -604,4 +604,4 @@ void TunnelContain::loadPostProcess( void ) // extend base class OpenContain::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/CreateModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/CreateModule.cpp index dc6d2da77e8..c4708aa0f06 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/CreateModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/CreateModule.cpp @@ -39,14 +39,14 @@ CreateModule::CreateModule( Thing *thing, const ModuleData* moduleData ) m_needToRunOnBuildComplete(TRUE) { -} // end createModule +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ CreateModule::~CreateModule() { -} // end ~CreateModule +} //------------------------------------------------------------------------------------------------- /** CRC */ @@ -57,7 +57,7 @@ void CreateModule::crc( Xfer *xfer ) // extend base class BehaviorModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -78,7 +78,7 @@ void CreateModule::xfer( Xfer *xfer ) // need to run on build complete xfer->xferBool( &m_needToRunOnBuildComplete ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -89,6 +89,6 @@ void CreateModule::loadPostProcess( void ) // extend base class BehaviorModule::loadPostProcess(); -} // ene loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp index 45c4fd1bd9b..1e3ea73df56 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp @@ -68,14 +68,14 @@ void GrantUpgradeCreateModuleData::buildFieldParse(MultiIniFieldParse& p) //------------------------------------------------------------------------------------------------- GrantUpgradeCreate::GrantUpgradeCreate( Thing *thing, const ModuleData* moduleData ) : CreateModule( thing, moduleData ) { -} // end GrantUpgradeCreate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- GrantUpgradeCreate::~GrantUpgradeCreate( void ) { -} // end ~GrantUpgradeCreate +} //------------------------------------------------------------------------------------------------- /** The create callback. */ @@ -111,7 +111,7 @@ void GrantUpgradeCreate::onCreate( void ) } } -} // end onCreate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -139,7 +139,7 @@ void GrantUpgradeCreate::onBuildComplete( void ) { getObject()->giveUpgrade( upgradeTemplate ); } -} // end onBuildComplete +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -150,7 +150,7 @@ void GrantUpgradeCreate::crc( Xfer *xfer ) // extend base class CreateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -168,7 +168,7 @@ void GrantUpgradeCreate::xfer( Xfer *xfer ) // extend base class CreateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -179,4 +179,4 @@ void GrantUpgradeCreate::loadPostProcess( void ) // extend base class CreateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/LockWeaponCreate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/LockWeaponCreate.cpp index 2faaa5aa722..dff66a0c40c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/LockWeaponCreate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/LockWeaponCreate.cpp @@ -66,21 +66,21 @@ void LockWeaponCreateModuleData::buildFieldParse(MultiIniFieldParse& p) //------------------------------------------------------------------------------------------------- LockWeaponCreate::LockWeaponCreate( Thing *thing, const ModuleData* moduleData ) : CreateModule( thing, moduleData ) { -} // end GrantUpgradeCreate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- LockWeaponCreate::~LockWeaponCreate( void ) { -} // end ~GrantUpgradeCreate +} //------------------------------------------------------------------------------------------------- /** The create callback. */ //------------------------------------------------------------------------------------------------- void LockWeaponCreate::onCreate( void ) { -} // end onCreate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -91,7 +91,7 @@ void LockWeaponCreate::onBuildComplete( void ) Object *me = getObject(); WeaponSlotType slot = getLockWeaponCreateModuleData()->m_slotToLock; me->setWeaponLock( slot, LOCKED_PERMANENTLY ); -} // end onBuildComplete +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -102,7 +102,7 @@ void LockWeaponCreate::crc( Xfer *xfer ) // extend base class CreateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -120,7 +120,7 @@ void LockWeaponCreate::xfer( Xfer *xfer ) // extend base class CreateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -131,4 +131,4 @@ void LockWeaponCreate::loadPostProcess( void ) // extend base class CreateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/PreorderCreate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/PreorderCreate.cpp index 9b520c5563e..fb142f1f08b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/PreorderCreate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/PreorderCreate.cpp @@ -77,7 +77,7 @@ void PreorderCreate::crc( Xfer *xfer ) // extend base class CreateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -95,7 +95,7 @@ void PreorderCreate::xfer( Xfer *xfer ) // extend base class CreateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -106,4 +106,4 @@ void PreorderCreate::loadPostProcess( void ) // extend base class CreateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/SpecialPowerCreate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/SpecialPowerCreate.cpp index 3b9405fce08..eb8f3ab1842 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/SpecialPowerCreate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/SpecialPowerCreate.cpp @@ -81,7 +81,7 @@ void SpecialPowerCreate::crc( Xfer *xfer ) // extend base class CreateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -99,7 +99,7 @@ void SpecialPowerCreate::xfer( Xfer *xfer ) // extend base class CreateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -110,4 +110,4 @@ void SpecialPowerCreate::loadPostProcess( void ) // extend base class CreateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/SupplyCenterCreate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/SupplyCenterCreate.cpp index 6e35b9c1caa..b800eada0d0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/SupplyCenterCreate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/SupplyCenterCreate.cpp @@ -87,7 +87,7 @@ void SupplyCenterCreate::crc( Xfer *xfer ) // extend base class CreateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -105,7 +105,7 @@ void SupplyCenterCreate::xfer( Xfer *xfer ) // extend base class CreateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -116,4 +116,4 @@ void SupplyCenterCreate::loadPostProcess( void ) // extend base class CreateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/SupplyWarehouseCreate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/SupplyWarehouseCreate.cpp index b24ab76c3fa..61d81dfd73f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/SupplyWarehouseCreate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/SupplyWarehouseCreate.cpp @@ -78,7 +78,7 @@ void SupplyWarehouseCreate::crc( Xfer *xfer ) // extend base class CreateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -96,7 +96,7 @@ void SupplyWarehouseCreate::xfer( Xfer *xfer ) // extend base class CreateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -107,4 +107,4 @@ void SupplyWarehouseCreate::loadPostProcess( void ) // extend base class CreateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp index 10095d8a285..d2ccb89c4ed 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp @@ -107,7 +107,7 @@ void VeterancyGainCreate::crc( Xfer *xfer ) // extend base class CreateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -125,7 +125,7 @@ void VeterancyGainCreate::xfer( Xfer *xfer ) // extend base class CreateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -136,4 +136,4 @@ void VeterancyGainCreate::loadPostProcess( void ) // extend base class CreateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/BoneFXDamage.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/BoneFXDamage.cpp index 29e0ca38799..7a6a90a8caf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/BoneFXDamage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/BoneFXDamage.cpp @@ -42,14 +42,14 @@ BoneFXDamage::BoneFXDamage( Thing *thing, const ModuleData* moduleData ) : DamageModule( thing, moduleData ) { -} // end BoneFXDamage +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- BoneFXDamage::~BoneFXDamage( void ) { -} // end ~BoneFXDamage +} //------------------------------------------------------------------------------------------------- void BoneFXDamage::onObjectCreated() @@ -75,7 +75,7 @@ void BoneFXDamage::onBodyDamageStateChange( const DamageInfo *damageInfo, if (bfxu) bfxu->changeBodyDamageState(oldState, newState); -} // end onBodyDamageStateChange +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -86,7 +86,7 @@ void BoneFXDamage::crc( Xfer *xfer ) // extend base class DamageModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -104,7 +104,7 @@ void BoneFXDamage::xfer( Xfer *xfer ) // extend base class DamageModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -115,4 +115,4 @@ void BoneFXDamage::loadPostProcess( void ) // extend base class DamageModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/DamageModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/DamageModule.cpp index 102c1ff3372..248d470d3a0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/DamageModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/DamageModule.cpp @@ -41,7 +41,7 @@ void DamageModule::crc( Xfer *xfer ) // extend base class BehaviorModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -57,7 +57,7 @@ void DamageModule::xfer( Xfer *xfer ) // call base class BehaviorModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -68,4 +68,4 @@ void DamageModule::loadPostProcess( void ) // call base class BehaviorModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp index 4207aa4f16f..d5d5d961ebf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp @@ -69,9 +69,9 @@ TransitionDamageFXModuleData::TransitionDamageFXModuleData( void ) m_particleSystem[ i ][ j ].locInfo.locType = FX_DAMAGE_LOC_TYPE_COORD; m_particleSystem[ i ][ j ].locInfo.randomBone = FALSE; - } // end for j + } - } // end for i + } m_damageFXTypes = DAMAGE_TYPE_FLAGS_NONE; m_damageFXTypes.flip(); @@ -80,7 +80,7 @@ TransitionDamageFXModuleData::TransitionDamageFXModuleData( void ) m_damageParticleTypes = DAMAGE_TYPE_FLAGS_NONE; m_damageParticleTypes.flip(); -} // end TransitionDamageFXModuleData +} //------------------------------------------------------------------------------------------------- /** Parse fx location info ... that is a named bone or a coord3d position */ @@ -108,12 +108,12 @@ static void parseFXLocInfo( INI *ini, void *instance, FXLocInfo *locInfo ) DEBUG_CRASH(( "parseFXLocInfo: Bone name not followed by RandomBone specifier\nPress IGNORE to see which INI file and line # is incorrect." )); throw INI_INVALID_DATA; - } // end if + } // parse the Bool definition ini->parseBool( ini, instance, &locInfo->randomBone, NULL ); - } // end if + } else if( stricmp( token, "loc" ) == 0 ) { @@ -123,16 +123,16 @@ static void parseFXLocInfo( INI *ini, void *instance, FXLocInfo *locInfo ) locInfo->loc.z = ini->scanReal( ini->getNextSubToken("Z") ); locInfo->locType = FX_DAMAGE_LOC_TYPE_COORD; - } // end else + } else { // error throw INI_INVALID_DATA; - } // end else + } -} // end parseFXLocInfo +} //------------------------------------------------------------------------------------------------- /** In the form of: @@ -155,12 +155,12 @@ void TransitionDamageFXModuleData::parseFXList( INI *ini, void *instance, // error throw INI_INVALID_DATA; - } // end if + } // parse the fx list name ini->parseFXList( ini, instance, &info->fx, NULL ); -} // end parseFXList +} //------------------------------------------------------------------------------------------------- /** In the form of: @@ -183,12 +183,12 @@ void TransitionDamageFXModuleData::parseObjectCreationList( INI *ini, void *inst // error throw INI_INVALID_DATA; - } // end if + } // parse the ocl name ini->parseObjectCreationList( ini, instance, store, &info->ocl ); -} // end parseObjectCreationList +} //------------------------------------------------------------------------------------------------- /** In the form of: @@ -211,12 +211,12 @@ void TransitionDamageFXModuleData::parseParticleSystem( INI *ini, void *instance // error throw INI_INVALID_DATA; - } // end if + } // parse the particle system name ini->parseParticleSystemTemplate( ini, instance, store, &info->particleSysTemplate ); -} // end parseParticleSystem +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -229,14 +229,14 @@ TransitionDamageFX::TransitionDamageFX( Thing *thing, const ModuleData* moduleDa for( j = 0; j < DAMAGE_MODULE_MAX_FX; j++ ) m_particleSystemID[ i ][ j ] = INVALID_PARTICLE_SYSTEM_ID; -} // end TransitionDamageFX +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- TransitionDamageFX::~TransitionDamageFX( void ) { -} // end ~TransitionDamageFX +} /* //------------------------------------------------------------------------------------------------- @@ -249,7 +249,7 @@ void TransitionDamageFX::onDelete( void ) // particle system will automatically delete itself when the object is destroyed // -} // end onDelete +} */ //------------------------------------------------------------------------------------------------- @@ -278,7 +278,7 @@ static Coord3D getLocalEffectPos( const FXLocInfo *locInfo, Drawable *draw ) // return the position retrieved return pos; - } // end if + } else { const Int MAX_BONES = 32; @@ -296,13 +296,13 @@ static Coord3D getLocalEffectPos( const FXLocInfo *locInfo, Drawable *draw ) Int pick = GameLogicRandomValue( 0, boneCount - 1 ); return positions[ pick ]; - } // end else + } - } // end if + } else return locInfo->loc; -} // end getLocalEffectPos +} //------------------------------------------------------------------------------------------------- /** Switching damage states */ @@ -330,9 +330,9 @@ void TransitionDamageFX::onBodyDamageStateChange( const DamageInfo* damageInfo, TheParticleSystemManager->destroyParticleSystemByID( m_particleSystemID[ oldState ][ i ] ); m_particleSystemID[ oldState ][ i ] = INVALID_PARTICLE_SYSTEM_ID; - } // end if + } - } // end for i + } // // when we are transitioning to a "worse" state we will play a set of effects for that @@ -361,9 +361,9 @@ void TransitionDamageFX::onBodyDamageStateChange( const DamageInfo* damageInfo, getObject()->convertBonePosToWorldPos( &pos, NULL, &pos, NULL ); FXList::doFXPos( modData->m_fxList[ newState ][ i ].fx, &pos ); - } // end if + } - } // end if + } // do any object creation list for our new state if( damageSource && modData->m_OCL[ newState ][ i ].ocl ) @@ -378,9 +378,9 @@ void TransitionDamageFX::onBodyDamageStateChange( const DamageInfo* damageInfo, ObjectCreationList::create( modData->m_OCL[ newState ][ i ].ocl, getObject(), &pos, damageSource->getPosition(), INVALID_ANGLE ); - } // end if + } - } // end if + } // get the template of the system to create pSystemT = modData->m_particleSystem[ newState ][ i ].particleSysTemplate; @@ -413,17 +413,17 @@ void TransitionDamageFX::onBodyDamageStateChange( const DamageInfo* damageInfo, // save the id of this particle system so we can remove it later if it still exists m_particleSystemID[ newState ][ i ] = pSystem->getSystemID(); - } // end if + } - } // end if + } - } // end if + } - } // end for i + } - } // end if + } -} // end onBodyDamageStateChange +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -434,7 +434,7 @@ void TransitionDamageFX::crc( Xfer *xfer ) // extend base class DamageModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -455,7 +455,7 @@ void TransitionDamageFX::xfer( Xfer *xfer ) // particle systems ids xfer->xferUser( m_particleSystemID, sizeof( ParticleSystemID ) * BODYDAMAGETYPE_COUNT * DAMAGE_MODULE_MAX_FX ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -466,4 +466,4 @@ void TransitionDamageFX::loadPostProcess( void ) // extend base class DamageModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Destroy/DestroyModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Destroy/DestroyModule.cpp index 6c264cb2cfe..fb82997cf48 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Destroy/DestroyModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Destroy/DestroyModule.cpp @@ -38,14 +38,14 @@ DestroyModule::DestroyModule( Thing *thing, const ModuleData* moduleData ) : BehaviorModule( thing, moduleData ) { -} // end DestroyModule +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ DestroyModule::~DestroyModule( void ) { -} // end ~DestroyModule +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -56,7 +56,7 @@ void DestroyModule::crc( Xfer *xfer ) // extend base class BehaviorModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -74,7 +74,7 @@ void DestroyModule::xfer( Xfer *xfer ) // extend base class BehaviorModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -85,5 +85,5 @@ void DestroyModule::loadPostProcess( void ) // extend base class BehaviorModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateCrateDie.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateCrateDie.cpp index c26b5a15f14..b382f05151e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateCrateDie.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateCrateDie.cpp @@ -261,7 +261,7 @@ void CreateCrateDie::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -279,7 +279,7 @@ void CreateCrateDie::xfer( Xfer *xfer ) // extend base class DieModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -290,4 +290,4 @@ void CreateCrateDie::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateObjectDie.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateObjectDie.cpp index 9216be409db..8d581305257 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateObjectDie.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateObjectDie.cpp @@ -141,7 +141,7 @@ void CreateObjectDie::onDie( const DamageInfo * damageInfo ) } -} // end onDie +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -152,7 +152,7 @@ void CreateObjectDie::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -170,7 +170,7 @@ void CreateObjectDie::xfer( Xfer *xfer ) // extend base class DieModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -181,4 +181,4 @@ void CreateObjectDie::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CrushDie.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CrushDie.cpp index 7a32ec7e31f..74ee743970d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CrushDie.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CrushDie.cpp @@ -216,7 +216,7 @@ void CrushDie::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -234,7 +234,7 @@ void CrushDie::xfer( Xfer *xfer ) // extend base class DieModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -245,4 +245,4 @@ void CrushDie::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/DamDie.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/DamDie.cpp index decf931b23a..f0e645b9213 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/DamDie.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/DamDie.cpp @@ -48,7 +48,7 @@ DamDieModuleData::DamDieModuleData( void ) { -} // end DamDieModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -64,7 +64,7 @@ DamDieModuleData::DamDieModuleData( void ) // // p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -76,14 +76,14 @@ DamDie::DamDie( Thing *thing, const ModuleData *moduleData ) :DieModule( thing, moduleData ) { -} // end DamDie +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ DamDie::~DamDie( void ) { -} // end ~DamDie +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -104,9 +104,9 @@ void DamDie::onDie( const DamageInfo *damageInfo ) // clear any disabled status of the water wave obj->clearDisabled( DISABLED_DEFAULT ); - } // end for, obj + } -} // end onDie +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -117,7 +117,7 @@ void DamDie::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -135,7 +135,7 @@ void DamDie::xfer( Xfer *xfer ) // extend base class DieModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -146,4 +146,4 @@ void DamDie::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/DestroyDie.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/DestroyDie.cpp index 5ec3aea6af8..80197ba6d59 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/DestroyDie.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/DestroyDie.cpp @@ -68,7 +68,7 @@ void DestroyDie::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -86,7 +86,7 @@ void DestroyDie::xfer( Xfer *xfer ) // extend base class DieModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -97,4 +97,4 @@ void DestroyDie::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/DieModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/DieModule.cpp index 37daea3055a..879387e6a6f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/DieModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/DieModule.cpp @@ -94,7 +94,7 @@ void DieModule::crc( Xfer *xfer ) // extend base class BehaviorModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -110,7 +110,7 @@ void DieModule::xfer( Xfer *xfer ) // call base class BehaviorModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -121,4 +121,4 @@ void DieModule::loadPostProcess( void ) // call base class BehaviorModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/EjectPilotDie.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/EjectPilotDie.cpp index 90660b7cc4d..449ca9d49e7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/EjectPilotDie.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/EjectPilotDie.cpp @@ -120,7 +120,7 @@ void EjectPilotDie::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -138,7 +138,7 @@ void EjectPilotDie::xfer( Xfer *xfer ) // extend base class DieModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -149,4 +149,4 @@ void EjectPilotDie::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/FXListDie.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/FXListDie.cpp index 573ff4f6d19..2560e4c332d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/FXListDie.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/FXListDie.cpp @@ -105,7 +105,7 @@ void FXListDie::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -123,7 +123,7 @@ void FXListDie::xfer( Xfer *xfer ) // extend base class DieModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -134,4 +134,4 @@ void FXListDie::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/KeepObjectDie.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/KeepObjectDie.cpp index 69c37b8a651..1a348ed2704 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/KeepObjectDie.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/KeepObjectDie.cpp @@ -70,7 +70,7 @@ void KeepObjectDie::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -88,7 +88,7 @@ void KeepObjectDie::xfer( Xfer *xfer ) // extend base class DieModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -99,4 +99,4 @@ void KeepObjectDie::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/RebuildHoleExposeDie.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/RebuildHoleExposeDie.cpp index 7c0db2f43dc..c3150e1cb3c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/RebuildHoleExposeDie.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/RebuildHoleExposeDie.cpp @@ -72,7 +72,7 @@ RebuildHoleExposeDieModuleData::RebuildHoleExposeDieModuleData() p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -84,14 +84,14 @@ RebuildHoleExposeDie::RebuildHoleExposeDie( Thing *thing, const ModuleData* modu : DieModule( thing, moduleData ) { -} // end RebuildHoleExposeDie +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- RebuildHoleExposeDie::~RebuildHoleExposeDie( void ) { -} // end ~RebuildHoleExposeDie +} //------------------------------------------------------------------------------------------------- /** The die callback. */ @@ -181,9 +181,9 @@ void RebuildHoleExposeDie::onDie( const DamageInfo *damageInfo ) } } - } // end if + } -} // end onDie +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -194,7 +194,7 @@ void RebuildHoleExposeDie::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -212,7 +212,7 @@ void RebuildHoleExposeDie::xfer( Xfer *xfer ) // extend base class DieModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -223,4 +223,4 @@ void RebuildHoleExposeDie::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/SpecialPowerCompletionDie.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/SpecialPowerCompletionDie.cpp index 51d96fff22a..8570a5edb2c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/SpecialPowerCompletionDie.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/SpecialPowerCompletionDie.cpp @@ -93,7 +93,7 @@ void SpecialPowerCompletionDie::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -117,7 +117,7 @@ void SpecialPowerCompletionDie::xfer( Xfer *xfer ) // creator set xfer->xferBool( &m_creatorSet ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -128,4 +128,4 @@ void SpecialPowerCompletionDie::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/UpgradeDie.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/UpgradeDie.cpp index e81bd728104..00378322d55 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/UpgradeDie.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/UpgradeDie.cpp @@ -95,7 +95,7 @@ void UpgradeDie::crc( Xfer *xfer ) // extend base class DieModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -113,7 +113,7 @@ void UpgradeDie::xfer( Xfer *xfer ) // extend base class DieModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -124,4 +124,4 @@ void UpgradeDie::loadPostProcess( void ) // extend base class DieModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp index c3a69c5aaf0..4eebcdd51fa 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp @@ -230,7 +230,7 @@ void ExperienceTracker::crc( Xfer *xfer ) { xfer->xferInt( &m_currentExperience ); xfer->xferUser( &m_currentLevel, sizeof( VeterancyLevel ) ); -} // end crc +} //----------------------------------------------------------------------------- /** Xfer method @@ -261,11 +261,11 @@ void ExperienceTracker::xfer( Xfer *xfer ) // experience scalar xfer->xferReal( &m_experienceScalar ); -} // end xfer +} //----------------------------------------------------------------------------- void ExperienceTracker::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/FiringTracker.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/FiringTracker.cpp index e7904cbebf5..2c188099f82 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/FiringTracker.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/FiringTracker.cpp @@ -349,7 +349,7 @@ void FiringTracker::crc( Xfer *xfer ) // object helper base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -376,7 +376,7 @@ void FiringTracker::xfer( Xfer *xfer ) // frame to start cooldown xfer->xferUnsignedInt( &m_frameToStartCooldown ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -387,4 +387,4 @@ void FiringTracker::loadPostProcess( void ) // object helper back class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp index 751b4594786..9a70ce7bc81 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp @@ -53,7 +53,7 @@ m_partitionData(NULL) { m_parentPosition.zero(); // End Initializations -} // end Object +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -68,7 +68,7 @@ GhostObject::~GhostObject() void GhostObject::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -101,9 +101,9 @@ void GhostObject::xfer( Xfer *xfer ) DEBUG_CRASH(( "GhostObject::xfer - Unable to connect m_parentObject" )); throw INI_INVALID_DATA; - } // end if + } - } // end if + } // parent geometry type xfer->xferUser( &m_parentGeometryType, sizeof( GeometryType ) ); @@ -127,7 +127,7 @@ void GhostObject::xfer( Xfer *xfer ) ///@todo write me ---> !!!!! // PartitionData *m_partitionData; ///< our PartitionData -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -135,7 +135,7 @@ void GhostObject::xfer( Xfer *xfer ) void GhostObject::loadPostProcess( void ) { -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -198,7 +198,7 @@ void GhostObjectManager::restorePartitionData(void) void GhostObjectManager::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method: @@ -216,7 +216,7 @@ void GhostObjectManager::xfer( Xfer *xfer ) // local player xfer->xferInt( &m_localPlayer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -224,4 +224,4 @@ void GhostObjectManager::xfer( Xfer *xfer ) void GhostObjectManager::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectDefectionHelper.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectDefectionHelper.cpp index e88ae8950d1..62452b8046f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectDefectionHelper.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectDefectionHelper.cpp @@ -136,7 +136,7 @@ void ObjectDefectionHelper::crc( Xfer *xfer ) // object helper crc ObjectHelper::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -166,7 +166,7 @@ void ObjectDefectionHelper::xfer( Xfer *xfer ) // do defector fx xfer->xferBool( &m_doDefectorFX ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -177,4 +177,4 @@ void ObjectDefectionHelper::loadPostProcess( void ) // object helper base class ObjectHelper::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectHelper.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectHelper.cpp index 1b1891ae697..39683f41572 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectHelper.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectHelper.cpp @@ -40,7 +40,7 @@ ObjectHelper::~ObjectHelper( void ) { -} // end ~ObjectHelper +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -67,7 +67,7 @@ void ObjectHelper::crc( Xfer *xfer ) // update module crc UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /* Xfer method @@ -85,7 +85,7 @@ void ObjectHelper::xfer( Xfer *xfer ) // update module xfer UpdateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -96,4 +96,4 @@ void ObjectHelper::loadPostProcess( void ) // update module post process UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectRepulsorHelper.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectRepulsorHelper.cpp index b0b908a7f61..dcfdebe262d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectRepulsorHelper.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectRepulsorHelper.cpp @@ -60,7 +60,7 @@ void ObjectRepulsorHelper::crc( Xfer *xfer ) // object helper crc ObjectHelper::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -78,7 +78,7 @@ void ObjectRepulsorHelper::xfer( Xfer *xfer ) // object helper base class ObjectHelper::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -89,5 +89,5 @@ void ObjectRepulsorHelper::loadPostProcess( void ) // object helper base class ObjectHelper::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectSMCHelper.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectSMCHelper.cpp index 8731ee16c5d..f646d56d9be 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectSMCHelper.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectSMCHelper.cpp @@ -60,7 +60,7 @@ void ObjectSMCHelper::crc( Xfer *xfer ) // object helper crc ObjectHelper::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -78,7 +78,7 @@ void ObjectSMCHelper::xfer( Xfer *xfer ) // object helper base class ObjectHelper::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -89,5 +89,5 @@ void ObjectSMCHelper::loadPostProcess( void ) // object helper base class ObjectHelper::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectWeaponStatusHelper.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectWeaponStatusHelper.cpp index 5c4e8b56ab1..ef46a8abaeb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectWeaponStatusHelper.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectWeaponStatusHelper.cpp @@ -48,7 +48,7 @@ void ObjectWeaponStatusHelper::crc( Xfer *xfer ) // object helper crc ObjectHelper::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -66,7 +66,7 @@ void ObjectWeaponStatusHelper::xfer( Xfer *xfer ) // object helper base class ObjectHelper::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -77,4 +77,4 @@ void ObjectWeaponStatusHelper::loadPostProcess( void ) // object helper base class ObjectHelper::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/StatusDamageHelper.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/StatusDamageHelper.cpp index 6075a94c1c6..be3f7e6e15e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/StatusDamageHelper.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/StatusDamageHelper.cpp @@ -101,7 +101,7 @@ void StatusDamageHelper::crc( Xfer *xfer ) // object helper crc ObjectHelper::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -122,7 +122,7 @@ void StatusDamageHelper::xfer( Xfer *xfer ) xfer->xferUser( &m_statusToHeal, sizeof(ObjectStatusTypes) );// an enum xfer->xferUnsignedInt( &m_frameToHeal ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -133,5 +133,5 @@ void StatusDamageHelper::loadPostProcess( void ) // object helper base class ObjectHelper::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/SubdualDamageHelper.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/SubdualDamageHelper.cpp index 47a7a0c3e96..2f50597c8a6 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/SubdualDamageHelper.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/SubdualDamageHelper.cpp @@ -94,7 +94,7 @@ void SubdualDamageHelper::crc( Xfer *xfer ) // object helper crc ObjectHelper::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -114,7 +114,7 @@ void SubdualDamageHelper::xfer( Xfer *xfer ) xfer->xferUnsignedInt( &m_healingStepCountdown ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -125,5 +125,5 @@ void SubdualDamageHelper::loadPostProcess( void ) // object helper base class ObjectHelper::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/TempWeaponBonusHelper.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/TempWeaponBonusHelper.cpp index 7a37433a473..0bd0a027681 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/TempWeaponBonusHelper.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/TempWeaponBonusHelper.cpp @@ -115,7 +115,7 @@ void TempWeaponBonusHelper::crc( Xfer *xfer ) // object helper crc ObjectHelper::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -136,7 +136,7 @@ void TempWeaponBonusHelper::xfer( Xfer *xfer ) xfer->xferUser( &m_currentBonus, sizeof(WeaponBonusConditionType) );// an enum xfer->xferUnsignedInt( &m_frameToRemove ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -147,5 +147,5 @@ void TempWeaponBonusHelper::loadPostProcess( void ) // object helper base class ObjectHelper::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp index 6963b5168ba..a4d84a7684c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp @@ -596,7 +596,7 @@ LocomotorTemplate *LocomotorStore::newOverride( LocomotorTemplate *locoTemplate // return the newly created override for us to set values with etc return newTemplate; -} // end newOverride +} //------------------------------------------------------------------------------------------------- /*static*/ void LocomotorStore::parseLocomotorTemplateDefinition(INI* ini) @@ -731,7 +731,7 @@ Locomotor::~Locomotor() void Locomotor::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -766,7 +766,7 @@ void Locomotor::xfer( Xfer *xfer ) xfer->xferReal(&m_angleOffset); xfer->xferReal(&m_offsetIncrement); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -774,7 +774,7 @@ void Locomotor::xfer( Xfer *xfer ) void Locomotor::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- void Locomotor::startMove(void) @@ -2648,7 +2648,7 @@ LocomotorSet::~LocomotorSet() void LocomotorSet::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -2715,7 +2715,7 @@ void LocomotorSet::xfer( Xfer *xfer ) void LocomotorSet::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- void LocomotorSet::xferSelfAndCurLocoPtr(Xfer *xfer, Locomotor** loco) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp index 1bf3f7f0c8f..f48cd78ec02 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -256,7 +256,7 @@ Object::Object( const ThingTemplate *tt, const ObjectStatusMaskType &objectStatu assert( 0 ); return; - } // end if + } // Object's set of these persist for the life of the object. m_partitionLastLook = newInstance(SightingInfo); @@ -505,7 +505,7 @@ Object::Object( const ThingTemplate *tt, const ObjectStatusMaskType &objectStatu // emit message announcing object's creation TheGameLogic->sendObjectCreated( this ); -} // end Object +} //------------------------------------------------------------------------------------------------- /** Emit message announcing object's creation @@ -754,7 +754,7 @@ void Object::onDestroy() //Have to remove ourself from looking as well. RebuildHoleWorkers definately hit here. handlePartitionCellMaintenance(); -} // end onDestroy +} //============================================================================= //============================================================================= @@ -1020,7 +1020,7 @@ void Object::setStatus( ObjectStatusMaskType objectStatus, Bool set ) TheGameLogic->destroyObject(them); } } - }// next object + } if (m_partitionData) m_partitionData->makeDirty(true); @@ -1194,9 +1194,9 @@ void Object::topple( const Coord3D *toppleDirection, Real toppleSpeed, UnsignedI // apply the topple force toppleUpdate->applyTopplingForce( toppleDirection, toppleSpeed, options ); - } // end if + } -} // end topple +} //============================================================================= void Object::setArmorSetFlag(ArmorSetType ast) @@ -1956,7 +1956,7 @@ void Object::kill( DamageType damageType, DeathType deathType ) DEBUG_ASSERTCRASH(!damageInfo.out.m_noEffect, ("Attempting to kill an unKillable object (InactiveBody?)")); -} // end kill +} //------------------------------------------------------------------------------------------------- /** Restore max health to this Object */ @@ -2570,7 +2570,7 @@ ExitInterface *Object::getObjectExitInterface() const return exitInterface; -} // end getObjectExitInterface +} //------------------------------------------------------------------------------------------------- /** Checks the object against trigger areas when the position changes. */ @@ -2760,7 +2760,7 @@ void Object::setID( ObjectID id ) // add new id to lookup table TheGameLogic->addObjectToLookupTable( this ); -} // end setID +} // ------------------------------------------------------------------------------------------------ Real Object::calculateHeightAboveTerrain(void) const @@ -3336,7 +3336,7 @@ void Object::maskObject( Bool mask ) if (mask) TheGameLogic->deselectObject(this, ~getControllingPlayer()->getPlayerMask(), TRUE); -} // end maskObject +} //------------------------------------------------------------------------------------------------- /* @@ -3980,7 +3980,7 @@ void Object::crc( Xfer *xfer ) } } -} // end crc +} //------------------------------------------------------------------------------------------------- /** Object xfer implemtation @@ -4053,7 +4053,7 @@ void Object::xfer( Xfer *xfer ) // change the ID of the drawable attached to be the same ID as it was when it was saved draw->setID( drawableID ); - } // end if + } // internal name xfer->xferAsciiString( &m_name ); @@ -4285,9 +4285,9 @@ void Object::xfer( Xfer *xfer ) // end data block xfer->endBlock(); - } // end for, it + } - } // end if, save + } else { AsciiString otherModuleIdentifier; @@ -4311,7 +4311,7 @@ void Object::xfer( Xfer *xfer ) break; } - } // end for, moduleIt + } // start of a new block Int dataSize = xfer->beginBlock(); @@ -4331,21 +4331,21 @@ void Object::xfer( Xfer *xfer ) // skip this data in the file xfer->skip( dataSize ); - } // end if + } else { // xfer the data into this module xfer->xferSnapshot( module ); - } // end else + } // end block xfer->endBlock(); - } // end for, i module count recorded in file + } - } // end else, load + } if ( version >= 3 ) @@ -4403,7 +4403,7 @@ void Object::xfer( Xfer *xfer ) else m_isReceivingDifficultyBonus = FALSE; -} // end xfer +} //------------------------------------------------------------------------------------------------- /** Object load game post process phase */ @@ -4415,7 +4415,7 @@ void Object::loadPostProcess() else m_containedBy = NULL; -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- /** Does this object have this upgrade */ @@ -4427,7 +4427,7 @@ Bool Object::hasUpgrade( const UpgradeTemplate *upgradeT ) const return TRUE; } return FALSE; -} // end hasUpgrade +} //------------------------------------------------------------------------------------------------- /** Is this object capable of having this upgrade */ @@ -4457,7 +4457,7 @@ Bool Object::affectedByUpgrade( const UpgradeTemplate *upgradeT ) const } return FALSE; -} // end affectedByUpgrade +} //------------------------------------------------------------------------------------------------- /** Give this upgrade to this object */ @@ -4474,7 +4474,7 @@ void Object::giveUpgrade( const UpgradeTemplate *upgradeT ) // updateUpgradeModules(); } -} // end giveUpgrade +} //------------------------------------------------------------------------------------------------- /** Remove this upgrade from this object */ @@ -4532,7 +4532,7 @@ void Object::onCapture( Player *oldOwner, Player *newOwner ) } } -} // end onCapture +} //------------------------------------------------------------------------------------------------- /// Object level events that need to happen upon game death @@ -5540,7 +5540,7 @@ void Object::doCommandButtonAtObject( const CommandButton *commandButton, Object if (!obj) return; #endif - + if( commandButton->getSpecialPowerTemplate() ) { CommandOption commandOptions = (CommandOption)(commandButton->getOptions() | COMMAND_FIRED_BY_SCRIPT); @@ -5822,11 +5822,11 @@ ProductionUpdateInterface* Object::getProductionUpdateInterface( void ) if( pui ) return pui; - } // end for + } return NULL; -} // end getProductionUpdateInterface +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -5842,7 +5842,7 @@ DockUpdateInterface *Object::getDockUpdateInterface( void ) return NULL; -} // end getDockUpdateInterface +} // ------------------------------------------------------------------------------------------------ // Search our special power modules for a specific one. @@ -5898,7 +5898,7 @@ SpawnBehaviorInterface* Object::getSpawnBehaviorInterface() const } } return NULL; -} // end getSpawnBehaviorInterfaceFromObject +} // ------------------------------------------------------------------------------------------------ ProjectileUpdateInterface* Object::getProjectileUpdateInterface() const @@ -5929,7 +5929,7 @@ SpecialPowerUpdateInterface* Object::findSpecialPowerWithOverridableDestinationA return spInterface; } } - } // end for + } return NULL; } @@ -5948,7 +5948,7 @@ SpecialPowerUpdateInterface* Object::findSpecialPowerWithOverridableDestination( return spInterface; } } - } // end for + } return NULL; } @@ -5969,7 +5969,7 @@ SpecialAbilityUpdate* Object::findSpecialAbilityUpdate( SpecialPowerType type ) return spUpdate; } } - } // end for + } return NULL; } @@ -6269,7 +6269,7 @@ RadarPriorityType Object::getRadarPriority( void ) const priority = RADAR_PRIORITY_STRUCTURE; - } // end if + } // Carbombs will show up as units regardless of their default priority if ( testStatus( OBJECT_STATUS_IS_CARBOMB ) ) @@ -6279,7 +6279,7 @@ RadarPriorityType Object::getRadarPriority( void ) const // return the priority we're going to use return priority; -} // end getRadarPriority +} // ------------------------------------------------------------------------------------------------ AIGroup *Object::getGroup(void) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectTypes.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectTypes.cpp index 1353c5be0a9..ed071ac211a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectTypes.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectTypes.cpp @@ -169,9 +169,9 @@ void ObjectTypes::xfer(Xfer *xfer) // write type name xfer->xferAsciiString( &(*it) ); - } // end for, it + } - } // end if, save + } else { @@ -182,7 +182,7 @@ void ObjectTypes::xfer(Xfer *xfer) DEBUG_CRASH(( "ObjectTypes::xfer - m_objectTypes vector should be emtpy but is not!" )); throw SC_INVALID_DATA; - } // end if + } // read all data AsciiString typeName; @@ -195,9 +195,9 @@ void ObjectTypes::xfer(Xfer *xfer) // put on vector m_objectTypes.push_back( typeName ); - } // end for, i + } - } // end else, load + } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index 260d7f19102..94a148555e4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -1512,7 +1512,7 @@ void PartitionCell::crc( Xfer *xfer ) xfer->xferUser(&m_cellX, sizeof(m_cellX)); xfer->xferUser(&m_cellY, sizeof(m_cellY)); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1528,7 +1528,7 @@ void PartitionCell::xfer( Xfer *xfer ) // xfer shroud data xfer->xferUser( &m_shroudLevel, sizeof( ShroudLevel ) * MAX_PLAYER_COUNT ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1536,7 +1536,7 @@ void PartitionCell::xfer( Xfer *xfer ) void PartitionCell::loadPostProcess( void ) { -} // end loadPostProcess +} //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- @@ -1662,9 +1662,8 @@ ObjectShroudStatus PartitionData::getShroudedStatus(Int playerIndex) else if( shroudedCells + foggedCells == m_coiInUseCount ) { m_shroudedness[playerIndex] = OBJECTSHROUD_FOGGED; //object is visible but fogged. - if (m_object && m_ghostObject) + if (m_object && m_ghostObject) //object does not exist for modules holding only GhostObjects { - //object does not exist for modules holding only GhostObjects //fogged but may not be visible if faction unit or faction building that has not been seen before Player *player=ThePlayerList->getNthPlayer(playerIndex); if (player->getRelationship(m_object->getTeam()) == NEUTRAL) @@ -1672,9 +1671,8 @@ ObjectShroudStatus PartitionData::getShroudedStatus(Int playerIndex) if (!m_object->isKindOf(KINDOF_IMMOBILE)) m_shroudedness[playerIndex] = OBJECTSHROUD_SHROUDED; } - else - { //Not neutral - //enemy unit will always be shrouded unless it's a building that's already been seen by the player. Fogged Mines are also always + else //Not neutral + { //enemy unit will always be shrouded unless it's a building that's already been seen by the player. Fogged Mines are also always //shroued no matter what. if (!(m_object->isKindOf(KINDOF_IMMOBILE) && m_everSeenByPlayer[playerIndex]) || m_object->isKindOf(KINDOF_MINE)) m_shroudedness[playerIndex] = OBJECTSHROUD_SHROUDED; @@ -1691,8 +1689,7 @@ ObjectShroudStatus PartitionData::getShroudedStatus(Int playerIndex) } } else if( shroudedCells == 0 && foggedCells == 0 ) - { //no cell I use has anything - //Record that this object was seen by the player. This info will be used to show fogged enemy faction buildings. + { //Record that this object was seen by the player. This info will be used to show fogged enemy faction buildings. m_everSeenByPlayer[playerIndex] = true; m_shroudedness[playerIndex] = OBJECTSHROUD_CLEAR; if (m_ghostObject && m_shroudednessPrevious[playerIndex] == OBJECTSHROUD_FOGGED) @@ -2594,7 +2591,7 @@ PartitionManager::~PartitionManager() shutdown(); -} // end ~PartitionManager +} //----------------------------------------------------------------------------- #ifdef PM_CACHE_TERRAIN_HEIGHT @@ -2859,7 +2856,7 @@ void PartitionManager::update() } } #endif // defined(RTS_DEBUG) -} // end update +} //------------------------------------------------------------------------------ void PartitionManager::registerObject( Object* object ) @@ -2874,7 +2871,7 @@ void PartitionManager::registerObject( Object* object ) DEBUG_LOG(( "Object '%s' already registered with partition manager", object->getTemplate()->getName().str() )); return; - } // end if + } // allocate a new module of partition data PartitionData *mod = newInstance( PartitionData ); @@ -2948,7 +2945,7 @@ void PartitionManager::registerGhostObject( GhostObject* object) { DEBUG_LOG(( "GhostObject already registered with partition manager")); return; - } // end if + } // allocate a new module of partition data PartitionData *mod = newInstance( PartitionData ); @@ -3374,9 +3371,9 @@ Object *PartitionManager::getClosestObjects( foundAny = true; } - } // next coi - } // next cell in this radius - } // next radius + } + } + } #else // not FASTER_GCO @@ -3810,7 +3807,7 @@ Bool PartitionManager::tryPosition( const Coord3D *center, else if( isUnderwater == TRUE && layer == LAYER_GROUND ) return FALSE; - } // end if + } // object checks if( BitIsSet( options->flags, FPF_IGNORE_ALL_OBJECTS ) == FALSE ) @@ -3860,7 +3857,7 @@ Bool PartitionManager::tryPosition( const Coord3D *center, them->isKindOf( KINDOF_STRUCTURE ) ) continue; - } // end if, relationship checks + } // // if we have a source that must path to the destination we will ignore that too @@ -3875,9 +3872,9 @@ Bool PartitionManager::tryPosition( const Coord3D *center, // oops, we have overlapped something return FALSE; - } // end for, them + } - } // end if + } // // finally ... if sourceToPathDest is valid ... the source object must be able to @@ -3894,13 +3891,13 @@ Bool PartitionManager::tryPosition( const Coord3D *center, &pos ) == FALSE ) return FALSE; - } // end if + } // save result and return TRUE for position found *result = pos; return TRUE; -} // end tryPosition +} // // the following determines how fast we expand our concentric ring search for the @@ -3983,14 +3980,14 @@ Bool PartitionManager::findPositionAround( const Coord3D *center, if( tryPosition( center, dist, startAngle - angleSpacing * i, options, result ) == TRUE ) return TRUE; - } // end if + } - } // end for, dist + } // no position was able to be found return FALSE; -} // end findPositionAround +} //----------------------------------------------------------------------------- // This is the main accessor of the shroud system. At this level, allies are taken @@ -4610,7 +4607,7 @@ void PartitionManager::crc( Xfer *xfer ) m_cells[i].crc(xfer); } -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -4642,7 +4639,7 @@ void PartitionManager::xfer( Xfer *xfer ) DEBUG_CRASH(( "Partition cell size has changed, this save game file is invalid" )); throw SC_INVALID_DATA; - } // end if + } // cell count Int totalCellCount = m_totalCellCount; @@ -4656,7 +4653,7 @@ void PartitionManager::xfer( Xfer *xfer ) totalCellCount, m_totalCellCount )); throw SC_INVALID_DATA; - } // end if + } // xfer each cell information PartitionCell *cell; @@ -4669,7 +4666,7 @@ void PartitionManager::xfer( Xfer *xfer ) // xfer the data for this cell xfer->xferSnapshot( cell ); - } // end for i + } // when loading tell the partition manager to rethink and refresh all shroud information if( xfer->getXferMode() == XFER_LOAD ) @@ -4681,7 +4678,7 @@ void PartitionManager::xfer( Xfer *xfer ) // refresh the shroud for the local player which will update the radar and everything refreshShroudForLocalPlayer(); - } // end if + } if( version >= 2 ) { @@ -4724,7 +4721,7 @@ void PartitionManager::xfer( Xfer *xfer ) // Version 1 save games will just not have any SightingInfos in the queue to be undone. } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -4732,7 +4729,7 @@ void PartitionManager::xfer( Xfer *xfer ) void PartitionManager::loadPostProcess( void ) { -} // end loadPostProcess +} //----------------------------------------------------------------------------- Real PartitionManager::getGroundOrStructureHeight(Real posx, Real posy) @@ -5838,7 +5835,7 @@ Bool SightingInfo::isInvalid() const void SightingInfo::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -5865,7 +5862,7 @@ void SightingInfo::xfer( Xfer *xfer ) // how much xfer->xferUnsignedInt( &m_data ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -5873,11 +5870,11 @@ void SightingInfo::xfer( Xfer *xfer ) void SightingInfo::loadPostProcess() { -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ SightingInfo::~SightingInfo() { -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/BaikonurLaunchPower.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/BaikonurLaunchPower.cpp index 4493a3a590a..7d24f7ef659 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/BaikonurLaunchPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/BaikonurLaunchPower.cpp @@ -69,7 +69,7 @@ BaikonurLaunchPowerModuleData::BaikonurLaunchPowerModuleData( void ) }; p.add(dataFieldParse); -} // end buildFieldParse +} // ------------------------------------------------------------------------------------------------ @@ -130,7 +130,7 @@ void BaikonurLaunchPower::crc( Xfer *xfer ) // extend base class SpecialPowerModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -148,7 +148,7 @@ void BaikonurLaunchPower::xfer( Xfer *xfer ) // extend base class SpecialPowerModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -159,4 +159,4 @@ void BaikonurLaunchPower::loadPostProcess( void ) // extend base class SpecialPowerModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashBountyPower.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashBountyPower.cpp index bfcb3815458..61d9d19215b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashBountyPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashBountyPower.cpp @@ -110,7 +110,7 @@ static void parseBountyUpgradePair( INI* ini, void * /*instance*/, void *store, }; p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -121,14 +121,14 @@ static void parseBountyUpgradePair( INI* ini, void * /*instance*/, void *store, CashBountyPower::CashBountyPower( Thing *thing, const ModuleData* moduleData ) : SpecialPowerModule( thing, moduleData ) { -} // end CashBountyPower +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- CashBountyPower::~CashBountyPower() { -} // end ~CashBountyPower +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -188,7 +188,7 @@ void CashBountyPower::crc( Xfer *xfer ) // extend base class SpecialPowerModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -206,7 +206,7 @@ void CashBountyPower::xfer( Xfer *xfer ) // extend base class SpecialPowerModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -217,4 +217,4 @@ void CashBountyPower::loadPostProcess( void ) // extend base class SpecialPowerModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashHackSpecialPower.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashHackSpecialPower.cpp index 904269ee705..9b13ab071d1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashHackSpecialPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashHackSpecialPower.cpp @@ -74,7 +74,7 @@ static void parseCashHackUpgradePair( INI* ini, void * /*instance*/, void *store }; p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -86,14 +86,14 @@ CashHackSpecialPower::CashHackSpecialPower( Thing *thing, const ModuleData *modu : SpecialPowerModule( thing, moduleData ) { -} // end CashHackSpecialPower +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ CashHackSpecialPower::~CashHackSpecialPower( void ) { -} // end ~CashHackSpecialPower +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -187,7 +187,7 @@ void CashHackSpecialPower::crc( Xfer *xfer ) // extend base class SpecialPowerModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -205,7 +205,7 @@ void CashHackSpecialPower::xfer( Xfer *xfer ) // extend base class SpecialPowerModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -216,4 +216,4 @@ void CashHackSpecialPower::loadPostProcess( void ) // extend base class SpecialPowerModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CleanupAreaPower.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CleanupAreaPower.cpp index 3533c1ecec0..b708a9dc687 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CleanupAreaPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CleanupAreaPower.cpp @@ -69,7 +69,7 @@ void CleanupAreaPowerModuleData::buildFieldParse(MultiIniFieldParse& p) }; p.add(dataFieldParse); -} // end buildFieldParse +} //------------------------------------------------------------------------------------------------- CleanupAreaPower::CleanupAreaPower( Thing *thing, const ModuleData* moduleData ) : SpecialPowerModule( thing, moduleData ) @@ -113,7 +113,7 @@ void CleanupAreaPower::crc( Xfer *xfer ) // extend base class SpecialPowerModule::crc( xfer ); -} // end crc +} //------------------------------------------------------------------------------------------------- // Xfer method @@ -131,7 +131,7 @@ void CleanupAreaPower::xfer( Xfer *xfer ) // extend base class SpecialPowerModule::xfer( xfer ); -} // end xfer +} //------------------------------------------------------------------------------------------------- void CleanupAreaPower::loadPostProcess( void ) @@ -140,4 +140,4 @@ void CleanupAreaPower::loadPostProcess( void ) // extend base class SpecialPowerModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DefectorSpecialPower.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DefectorSpecialPower.cpp index fd092c61fa1..7785463f104 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DefectorSpecialPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DefectorSpecialPower.cpp @@ -48,7 +48,7 @@ DefectorSpecialPowerModuleData::DefectorSpecialPowerModuleData( void ) m_fatCursorRadius = 0.0f; -} // end DefectorSpecialPowerModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -66,7 +66,7 @@ DefectorSpecialPowerModuleData::DefectorSpecialPowerModuleData( void ) }; p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -78,14 +78,14 @@ DefectorSpecialPower::DefectorSpecialPower( Thing *thing, const ModuleData *modu : SpecialPowerModule( thing, moduleData ) { -} // end DefectorSpecialPower +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ DefectorSpecialPower::~DefectorSpecialPower( void ) { -} // end ~DefectorSpecialPower +} // ------------------------------------------------------------------------------------------------ @@ -143,7 +143,7 @@ void DefectorSpecialPower::crc( Xfer *xfer ) // extend base class SpecialPowerModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -161,7 +161,7 @@ void DefectorSpecialPower::xfer( Xfer *xfer ) // extend base class SpecialPowerModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -172,4 +172,4 @@ void DefectorSpecialPower::loadPostProcess( void ) // extend base class SpecialPowerModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DemoralizeSpecialPower.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DemoralizeSpecialPower.cpp index 21fec093891..aabd918061f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DemoralizeSpecialPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DemoralizeSpecialPower.cpp @@ -54,7 +54,7 @@ DemoralizeSpecialPowerModuleData::DemoralizeSpecialPowerModuleData( void ) m_maxDurationInFrames = 0; m_fxList = NULL; -} // end DemoralizeSpecialPowerModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -75,7 +75,7 @@ void DemoralizeSpecialPowerModuleData::buildFieldParse( MultiIniFieldParse &p ) }; p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -87,14 +87,14 @@ DemoralizeSpecialPower::DemoralizeSpecialPower( Thing *thing, const ModuleData * : SpecialPowerModule( thing, moduleData ) { -} // end DemoralizeSpecialPower +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ DemoralizeSpecialPower::~DemoralizeSpecialPower( void ) { -} // end ~DemoralizeSpecialPower +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -140,7 +140,7 @@ void DemoralizeSpecialPower::doSpecialPowerAtLocation( const Coord3D *loc, Real if( range > modData->m_maxRange ) range = modData->m_maxRange; - } // end if + } // scan the objects in the area range and demoralize them PartitionFilterRelationship filter1( source, PartitionFilterRelationship::ALLOW_ENEMIES | @@ -164,7 +164,7 @@ void DemoralizeSpecialPower::doSpecialPowerAtLocation( const Coord3D *loc, Real if( ai ) ai->setDemoralized( duration ); - } // end for obj + } // play an effect at the destination location if( modData->m_fxList ) @@ -173,9 +173,9 @@ void DemoralizeSpecialPower::doSpecialPowerAtLocation( const Coord3D *loc, Real // execute FX FXList::doFXPos( modData->m_fxList, loc ); - } // end if + } -} // end doSpecialPowerAtLocation +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -187,7 +187,7 @@ void DemoralizeSpecialPower::doSpecialPowerAtObject( const Object *obj, Real ang if( obj ) doSpecialPowerAtLocation( obj->getPosition(), angle, commandOptions ); -} // end doSpecialPowerAtObject +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -198,7 +198,7 @@ void DemoralizeSpecialPower::crc( Xfer *xfer ) // extend base class SpecialPowerModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -216,7 +216,7 @@ void DemoralizeSpecialPower::xfer( Xfer *xfer ) // extend base class SpecialPowerModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -227,7 +227,7 @@ void DemoralizeSpecialPower::loadPostProcess( void ) // extend base class SpecialPowerModule::loadPostProcess(); -} // end loadPostProcess +} #endif // #ifdef ALLOW_DEMORALIZE diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/FireWeaponPower.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/FireWeaponPower.cpp index f61f58eb405..14444f0f840 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/FireWeaponPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/FireWeaponPower.cpp @@ -76,7 +76,7 @@ FireWeaponPowerModuleData::FireWeaponPowerModuleData( void ) }; p.add(dataFieldParse); -} // end buildFieldParse +} // ------------------------------------------------------------------------------------------------ @@ -185,7 +185,7 @@ void FireWeaponPower::crc( Xfer *xfer ) // extend base class SpecialPowerModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -203,7 +203,7 @@ void FireWeaponPower::xfer( Xfer *xfer ) // extend base class SpecialPowerModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -214,4 +214,4 @@ void FireWeaponPower::loadPostProcess( void ) // extend base class SpecialPowerModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp index 0c186b87d13..f628c976474 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp @@ -262,7 +262,7 @@ void OCLSpecialPower::crc( Xfer *xfer ) // extend base class SpecialPowerModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -280,7 +280,7 @@ void OCLSpecialPower::xfer( Xfer *xfer ) // extend base class SpecialPowerModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -291,5 +291,5 @@ void OCLSpecialPower::loadPostProcess( void ) // extend base class SpecialPowerModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialAbility.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialAbility.cpp index 8ad3f6b121d..5a1ab0a88dc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialAbility.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialAbility.cpp @@ -46,14 +46,14 @@ SpecialAbility::SpecialAbility( Thing *thing, const ModuleData *moduleData ) : SpecialPowerModule( thing, moduleData ) { -} // end SpecialAbility +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ SpecialAbility::~SpecialAbility( void ) { -} // end ~SpecialAbility +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -105,7 +105,7 @@ void SpecialAbility::crc( Xfer *xfer ) // extend base class SpecialPowerModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -123,7 +123,7 @@ void SpecialAbility::xfer( Xfer *xfer ) // extend base class SpecialPowerModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -134,4 +134,4 @@ void SpecialAbility::loadPostProcess( void ) // extend base class SpecialPowerModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp index 05cbc6449c6..60f36ff172e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp @@ -65,7 +65,7 @@ SpecialPowerModuleData::SpecialPowerModuleData() m_startsPaused = FALSE; m_scriptedSpecialPowerOnly = FALSE; -} // end SpecialPowerModuleData +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -84,7 +84,7 @@ SpecialPowerModuleData::SpecialPowerModuleData() }; p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -142,7 +142,7 @@ SpecialPowerModule::SpecialPowerModule( Thing *thing, const ModuleData *moduleDa } -} // end SpecialPowerModule +} //------------------------------------------------------------------------------------------------- const AudioEventRTS& SpecialPowerModule::getInitiateSound() const @@ -162,7 +162,7 @@ SpecialPowerModule::~SpecialPowerModule() getObject()->getID(), getSpecialPowerModuleData()->m_specialPowerTemplate ); -} // end ~SpecialPowerModule +} //------------------------------------------------------------------------------------------------- void SpecialPowerModule::setReadyFrame( UnsignedInt frame ) @@ -241,7 +241,7 @@ ScienceType SpecialPowerModule::getRequiredScience( void ) const { return getSpecialPowerModuleData()->m_specialPowerTemplate->getRequiredScience(); -} // end ~SpecialPowerModule +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -249,7 +249,7 @@ const SpecialPowerTemplate * SpecialPowerModule::getSpecialPowerTemplate( void ) { return getSpecialPowerModuleData()->m_specialPowerTemplate; -} // end ~SpecialPowerModule +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -257,7 +257,7 @@ AsciiString SpecialPowerModule::getPowerName( void ) const { return getSpecialPowerModuleData()->m_specialPowerTemplate->getName(); -} // end ~SpecialPowerModule +} //------------------------------------------------------------------------------------------------- /** Is this module designed for the power identier template passed in? */ @@ -280,7 +280,7 @@ Bool SpecialPowerModule::isModuleForPower( const SpecialPowerTemplate *specialPo //We don't match templates. return FALSE; -} // end canExecutePower +} //------------------------------------------------------------------------------------------------- /** Is this special power ready to use */ @@ -308,7 +308,7 @@ Bool SpecialPowerModule::isReady() const return (m_pausedCount == 0) && (TheGameLogic->getFrame() >= m_availableOnFrame); -} // end isReady +} //------------------------------------------------------------------------------------------------- /** Get the percentage ready a special power is to use @@ -659,7 +659,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) soundAtLocation.setPlayerIndex(getObject()->getControllingPlayer()->getPlayerIndex()); TheAudio->addAudioEvent( &soundAtLocation ); - } // end if + } } @@ -787,7 +787,7 @@ void SpecialPowerModule::pauseCountdown( Bool pause ) m_availableOnFrame += (TheGameLogic->getFrame() - m_pausedOnFrame); } } -} // end pauseCountdown +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -824,7 +824,7 @@ void SpecialPowerModule::crc( Xfer *xfer ) // extend base class BehaviorModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -854,7 +854,7 @@ void SpecialPowerModule::xfer( Xfer *xfer ) // paused percent xfer->xferReal( &m_pausedPercent ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -888,4 +888,4 @@ void SpecialPowerModule::loadPostProcess( void ) -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpyVisionSpecialPower.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpyVisionSpecialPower.cpp index 5bc7525469a..75f1252e97a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpyVisionSpecialPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpyVisionSpecialPower.cpp @@ -62,7 +62,7 @@ void SpyVisionSpecialPowerModuleData::buildFieldParse( MultiIniFieldParse &p ) }; p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -135,7 +135,7 @@ void SpyVisionSpecialPower::crc( Xfer *xfer ) // extend base class SpecialPowerModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -153,7 +153,7 @@ void SpyVisionSpecialPower::xfer( Xfer *xfer ) // extend base class SpecialPowerModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -164,4 +164,4 @@ void SpyVisionSpecialPower::loadPostProcess( void ) // extend base class SpecialPowerModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index 26a5c3c32f4..d118b3b409a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -2087,7 +2087,7 @@ Bool AIUpdateInterface::isPathAvailable( const Coord3D *destination ) const return TheAI->pathfinder()->clientSafeQuickDoesPathExist( m_locomotorSet, myPos, destination ); -} // end isPathAvailable +} //------------------------------------------------------------------------------------------------- /** Is there a path (computed using the less accurate but quick method ) @@ -2104,7 +2104,7 @@ Bool AIUpdateInterface::isQuickPathAvailable( const Coord3D *destination ) const return TheAI->pathfinder()->clientSafeQuickDoesPathExistForUI( m_locomotorSet, myPos, destination ); -} // end isQuickPathAvailable +} @@ -2582,7 +2582,7 @@ void AIUpdateInterface::joinTeam( void ) getStateMachine()->setState( state ); } -} // end joinTeam +} //------------------------------------------------------------------------------------------------- Bool AIUpdateInterface::isAllowedToRespondToAiCommands(const AICommandParms* parms) const @@ -4721,7 +4721,7 @@ void AIUpdateInterface::evaluateMoraleBonus( void ) } } - } // end for + } #ifdef ALLOW_DEMORALIZE // if we are are not demoralized we can have horde and nationalism effects @@ -4744,7 +4744,7 @@ void AIUpdateInterface::evaluateMoraleBonus( void ) { us->setWeaponBonusCondition( WEAPONBONUSCONDITION_HORDE ); - } // end if + } else us->clearWeaponBonusCondition( WEAPONBONUSCONDITION_HORDE ); @@ -4763,7 +4763,7 @@ void AIUpdateInterface::evaluateMoraleBonus( void ) - } // end if + } #ifdef ALLOW_DEMORALIZE else { @@ -4783,7 +4783,7 @@ void AIUpdateInterface::evaluateMoraleBonus( void ) us->clearWeaponBonusCondition( WEAPONBONUSCONDITION_NATIONALISM ); us->clearWeaponBonusCondition( WEAPONBONUSCONDITION_FANATICISM ); - } // end else + } #endif /* @@ -4793,7 +4793,7 @@ void AIUpdateInterface::evaluateMoraleBonus( void ) TheInGameUI->message( msg ); */ -} // end evaluateMoraleBonus +} #ifdef ALLOW_DEMORALIZE // ------------------------------------------------------------------------------------------------ @@ -4813,7 +4813,7 @@ void AIUpdateInterface::setDemoralized( UnsignedInt durationInFrames ) // evaluate demoralization, nationalism, and horde effect as they are all intertwined evaluateMoraleBonus(); - } // end if + } } #endif @@ -5011,7 +5011,7 @@ void AIUpdateInterface::crc( Xfer *x ) CRCGEN_LOG(("AIUpdateInterface::crc() end - %8.8X", ((XferCRC *)x)->getCRC())); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -5235,7 +5235,7 @@ void AIUpdateInterface::xfer( Xfer *xfer ) } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -5272,7 +5272,7 @@ void AIUpdateInterface::loadPostProcess( void ) } } -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp index 3a246d418b3..313911ed4c9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp @@ -487,7 +487,7 @@ void AssaultTransportAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} //------------------------------------------------------------------------------------------------- /** Xfer method @@ -523,7 +523,7 @@ void AssaultTransportAIUpdate::xfer( Xfer *xfer ) xfer->xferBool( &m_isAttackMove ); xfer->xferBool( &m_isAttackObject ); -} // end xfer +} //------------------------------------------------------------------------------------------------- /** Load post process */ @@ -532,5 +532,5 @@ void AssaultTransportAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index 0fbc8e82953..733188b8f54 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -1352,7 +1352,7 @@ void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms) void ChinookAIUpdate::crc( Xfer *xfer ) { SupplyTruckAIUpdate::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1381,7 +1381,7 @@ void ChinookAIUpdate::xfer( Xfer *xfer ) xfer->xferCoord3D( &m_originalPos ); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1389,7 +1389,7 @@ void ChinookAIUpdate::xfer( Xfer *xfer ) void ChinookAIUpdate::loadPostProcess( void ) { SupplyTruckAIUpdate::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp index 0c223545976..f45c9109430 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp @@ -405,7 +405,7 @@ void DeliverPayloadAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -494,7 +494,7 @@ void DeliverPayloadAIUpdate::xfer( Xfer *xfer ) } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -503,7 +503,7 @@ void DeliverPayloadAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -540,7 +540,7 @@ DeliverPayloadStateMachine::~DeliverPayloadStateMachine() void DeliverPayloadStateMachine::crc( Xfer *xfer ) { StateMachine::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -552,7 +552,7 @@ void DeliverPayloadStateMachine::xfer( Xfer *xfer ) xfer->xferVersion( &v, cv ); StateMachine::xfer(xfer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -560,7 +560,7 @@ void DeliverPayloadStateMachine::xfer( Xfer *xfer ) void DeliverPayloadStateMachine::loadPostProcess( void ) { StateMachine::loadPostProcess(); -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- /*static*/ Bool DeliverPayloadStateMachine::isOffMap( State *thisState, void* userData ) @@ -639,7 +639,7 @@ StateReturnType ApproachState::update() // ------------------------------------------------------------------------------------------------ void DeliveringState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -653,14 +653,14 @@ void DeliveringState::xfer( Xfer *xfer ) xfer->xferUnsignedInt(&m_dropDelayLeft); xfer->xferBool(&m_didOpen); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void DeliveringState::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- @@ -929,7 +929,7 @@ void DeliveringState::onExit( StateExitType ) // Close the doors // ------------------------------------------------------------------------------------------------ void ConsiderNewApproachState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -942,14 +942,14 @@ void ConsiderNewApproachState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferInt(&m_numberEntriesToState); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void ConsiderNewApproachState::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- @@ -1041,7 +1041,7 @@ void ConsiderNewApproachState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void RecoverFromOffMapState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1054,14 +1054,14 @@ void RecoverFromOffMapState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUnsignedInt(&m_reEntryFrame); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void RecoverFromOffMapState::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeployStyleAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeployStyleAIUpdate.cpp index 9158012c4ef..843d4d54698 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeployStyleAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeployStyleAIUpdate.cpp @@ -421,7 +421,7 @@ void DeployStyleAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -485,7 +485,7 @@ void DeployStyleAIUpdate::xfer( Xfer *xfer ) m_state = READY_TO_MOVE; } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -494,5 +494,5 @@ void DeployStyleAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp index 6b6dd3f85dd..ff5e8c5fdb5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp @@ -113,14 +113,14 @@ DozerActionPickActionPosState::DozerActionPickActionPosState( StateMachine *mach m_task = task; m_failedAttempts = 0; -} // end DozerActionPickActionPosState +} // ------------------------------------------------------------------------------------------------ /** CRC */ // ------------------------------------------------------------------------------------------------ void DozerActionPickActionPosState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -134,14 +134,14 @@ void DozerActionPickActionPosState::xfer( Xfer *xfer ) xfer->xferUser(&m_task, sizeof(m_task)); xfer->xferInt(&m_failedAttempts); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void DozerActionPickActionPosState::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- /** Pick a position around the target */ @@ -179,7 +179,7 @@ StateReturnType DozerActionPickActionPosState::update( void ) // exit with failure return STATE_FAILURE; - } // end if + } // pick a location to move to Coord3D goalPos; @@ -213,7 +213,7 @@ StateReturnType DozerActionPickActionPosState::update( void ) // if ai. goalPos = *goalObject->getPosition(); - } // end if + } // // we only ignore the goal object when we did the point selection in this more @@ -221,7 +221,7 @@ StateReturnType DozerActionPickActionPosState::update( void ) // ai->ignoreObstacle( goalObject ); - } // end if + } // set goal position and object machine->setGoalObject( goalObject ); @@ -231,7 +231,7 @@ StateReturnType DozerActionPickActionPosState::update( void ) return STATE_SUCCESS; -} // end update +} //------------------------------------------------------------------------------------------------- /** Dozer moves to the action position */ @@ -263,7 +263,7 @@ EMPTY_DTOR(DozerActionMoveToActionPosState) // ------------------------------------------------------------------------------------------------ void DozerActionMoveToActionPosState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -276,14 +276,14 @@ void DozerActionMoveToActionPosState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUser(&m_task, sizeof(m_task)); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void DozerActionMoveToActionPosState::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- /** We are supposed to be on route to our action position now, see when we get there or @@ -355,11 +355,11 @@ StateReturnType DozerActionMoveToActionPosState::update( void ) MAKE_MODELCONDITION_MASK(MODELCONDITION_AWAITING_CONSTRUCTION), MAKE_MODELCONDITION_MASK2(MODELCONDITION_PARTIALLY_CONSTRUCTED, MODELCONDITION_ACTIVELY_BEING_CONSTRUCTED)); - } // end if + } return STATE_SUCCESS; - } // end if + } // if we're in the idle state fail our move @@ -370,7 +370,7 @@ StateReturnType DozerActionMoveToActionPosState::update( void ) return STATE_CONTINUE; -} // end update +} //------------------------------------------------------------------------------------------------- /** Dozer does the "action" */ @@ -411,7 +411,7 @@ EMPTY_DTOR(DozerActionDoActionState) // ------------------------------------------------------------------------------------------------ void DozerActionDoActionState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -425,14 +425,14 @@ void DozerActionDoActionState::xfer( Xfer *xfer ) xfer->xferUser(&m_task, sizeof(m_task)); xfer->xferUnsignedInt(&m_enterFrame); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void DozerActionDoActionState::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- /** Entering the do action state */ @@ -456,7 +456,7 @@ StateReturnType DozerActionDoActionState::onEnter( void ) return STATE_CONTINUE; -} // end onEnter +} //------------------------------------------------------------------------------------------------- /** Do the action */ @@ -508,7 +508,7 @@ StateReturnType DozerActionDoActionState::update( void ) // we're now moving to the dock location dozerAI->setBuildSubTask( DOZER_MOVING_TO_BUILD_DOCK_LOCATION ); - } // end if + } // if we're moving to the build dock location, when we become idle we are there if( dozerAI->getBuildSubTask() == DOZER_MOVING_TO_BUILD_DOCK_LOCATION ) @@ -520,7 +520,7 @@ StateReturnType DozerActionDoActionState::update( void ) // from the building itself) dozerAI->startBuildingSound( goalObject->getTemplate()->getPerUnitSound( "UnderConstruction" ), goalObject->getID() ); } - } // end if + } // only do the build if we've moved into the dock position if( dozerAI->getBuildSubTask() == DOZER_DO_BUILD_AT_DOCK ) @@ -601,7 +601,7 @@ StateReturnType DozerActionDoActionState::update( void ) create->onBuildComplete(); } - } // end if + } // Creation is another valid and essential time to call this. This building now Looks. goalObject->handlePartitionCellMaintenance(); @@ -625,7 +625,7 @@ StateReturnType DozerActionDoActionState::update( void ) objectName.format( format, goalObject->getTemplate()->getName().str() ); - } // end if + } UnicodeString msg; msg.format( format.str(), objectName.str() ); @@ -638,7 +638,7 @@ StateReturnType DozerActionDoActionState::update( void ) /// make radar neat-o attention grabber event at build location TheRadar->createEvent( goalObject->getPosition(), RADAR_EVENT_CONSTRUCTION ); - } // end if + } // this will allow us to exit the state machine with success complete = TRUE; @@ -653,13 +653,13 @@ StateReturnType DozerActionDoActionState::update( void ) TheAI->pathfinder()->adjustToPossibleDestination(dozer, ai->getLocomotorSet(), &pos); ai->aiMoveToPosition( &pos, CMD_FROM_AI ); - } // end if + } - } // end if + } break; - } // end build + } //--------------------------------------------------------------------------------------------- case DOZER_TASK_REPAIR: @@ -676,7 +676,7 @@ StateReturnType DozerActionDoActionState::update( void ) // we're now complete complete = TRUE; - } // end if + } else { Bool canHeal = TRUE; @@ -704,7 +704,7 @@ StateReturnType DozerActionDoActionState::update( void ) if( bbi->isScaffoldInMotion() == TRUE ) canHeal = FALSE; - } // end if + } // do healing if( canHeal ) @@ -730,15 +730,15 @@ StateReturnType DozerActionDoActionState::update( void ) - } // end if + } - } // end else + } // play a repairing sound break; - } // end repair + } //--------------------------------------------------------------------------------------------- case DOZER_TASK_FORTIFY: @@ -747,7 +747,7 @@ StateReturnType DozerActionDoActionState::update( void ) /// @todo write me break; - } // end fortify + } //--------------------------------------------------------------------------------------------- default: @@ -756,9 +756,9 @@ StateReturnType DozerActionDoActionState::update( void ) DEBUG_CRASH(( "Unknown task for the dozer action do action state" )); return STATE_FAILURE; - } // end default + } - } // end switch + } // if we're complete with the task we exit success if( complete == TRUE ) @@ -775,14 +775,14 @@ StateReturnType DozerActionDoActionState::update( void ) // we're done return STATE_SUCCESS; - } // end if + } // just continue sitting here for a while getMachineOwner()->clearWeaponSetFlag(WEAPONSET_MINE_CLEARING_DETAIL);// no mine clearing fun while I'm on the job return STATE_CONTINUE; -} // end update +} //------------------------------------------------------------------------------------------------- /** The Dozer action state machine */ @@ -831,7 +831,7 @@ DozerActionStateMachine::DozerActionStateMachine( Object *owner, DozerTask task // ------------------------------------------------------------------------------------------------ void DozerActionStateMachine::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -844,14 +844,14 @@ void DozerActionStateMachine::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUser(&m_task, sizeof(m_task)); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void DozerActionStateMachine::loadPostProcess( void ) { -} // end loadPostProcess +} /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -900,7 +900,7 @@ static Object *findObjectToRepair( Object *dozer ) closestRepairTarget = obj; closestRepairTargetDistSqr = ThePartitionManager->getDistanceSquared( dozer, obj, FROM_CENTER_2D ); - } // end if + } else { @@ -912,15 +912,15 @@ static Object *findObjectToRepair( Object *dozer ) closestRepairTarget = obj; closestRepairTargetDistSqr = distSqr; - } // end if + } - } // end else + } - } // end for obj + } return closestRepairTarget; -} // end findObjectToRepair +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -945,7 +945,7 @@ static Object *findMine( Object *dozer ) Object* mine = ThePartitionManager->getClosestObject(dozer, dozerAI->getBoredRange(), FROM_CENTER_2D, filters); return mine; -} // end findMine +} //------------------------------------------------------------------------------------------------- /** Available primary Dozer states */ @@ -997,7 +997,7 @@ EMPTY_DTOR(DozerPrimaryIdleState) // ------------------------------------------------------------------------------------------------ void DozerPrimaryIdleState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1012,14 +1012,14 @@ void DozerPrimaryIdleState::xfer( Xfer *xfer ) xfer->xferUnsignedInt(&m_idleTooLongTimestamp); xfer->xferInt(&m_idlePlayerNumber); xfer->xferBool(&m_isMarkedAsIdle); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void DozerPrimaryIdleState::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- @@ -1040,7 +1040,7 @@ StateReturnType DozerPrimaryIdleState::onEnter( void ) return STATE_CONTINUE; -} // end onEnter +} //------------------------------------------------------------------------------------------------- /** Upon exiting the dozer primary idle state */ @@ -1136,11 +1136,11 @@ StateReturnType DozerPrimaryIdleState::update( void ) } - } // end if + } return STATE_CONTINUE; -} // end update +} //------------------------------------------------------------------------------------------------- /** Dozer action state */ @@ -1185,7 +1185,7 @@ inline DozerActionState::~DozerActionState( void ) { deleteInstance(m_actionMach // ------------------------------------------------------------------------------------------------ void DozerActionState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1199,14 +1199,14 @@ void DozerActionState::xfer( Xfer *xfer ) xfer->xferUser(&m_task, sizeof(m_task)); xfer->xferSnapshot(m_actionMachine); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void DozerActionState::loadPostProcess( void ) { -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ @@ -1233,7 +1233,7 @@ StateReturnType DozerActionState::onEnter( void ) return STATE_CONTINUE; -} // end onEnter +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1249,7 +1249,7 @@ void DozerActionState::onExit( StateExitType status ) DozerAIInterface *dozerAI = dozer->getAIUpdateInterface()->getDozerAIInterface(); dozerAI->setCurrentTask( DOZER_TASK_INVALID ); -} // end onExit +} //------------------------------------------------------------------------------------------------- /** Dozer primary going home state */ @@ -1291,14 +1291,14 @@ DozerPrimaryStateMachine::DozerPrimaryStateMachine( Object *owner ) : StateMachi defineState( DOZER_PRIMARY_FORTIFY, newInstance(DozerActionState)( this, DOZER_TASK_FORTIFY ), DOZER_PRIMARY_IDLE, DOZER_PRIMARY_IDLE ); defineState( DOZER_PRIMARY_GO_HOME, newInstance(DozerPrimaryGoingHomeState)( this ), DOZER_PRIMARY_IDLE, DOZER_PRIMARY_IDLE ); -} // end DozerPrimaryStateMachine +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- DozerPrimaryStateMachine::~DozerPrimaryStateMachine( void ) { -} // end ~DozerPrimaryStateMachine +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -1306,7 +1306,7 @@ DozerPrimaryStateMachine::~DozerPrimaryStateMachine( void ) void DozerPrimaryStateMachine::crc( Xfer *xfer ) { StateMachine::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1318,7 +1318,7 @@ void DozerPrimaryStateMachine::xfer( Xfer *xfer ) xfer->xferVersion( &v, cv ); StateMachine::xfer(xfer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1326,7 +1326,7 @@ void DozerPrimaryStateMachine::xfer( Xfer *xfer ) void DozerPrimaryStateMachine::loadPostProcess( void ) { StateMachine::loadPostProcess(); -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1351,7 +1351,7 @@ Bool DozerPrimaryStateMachine::isBuildMostImportant( State *thisState, void* use DozerTask task = dozerAI->getMostRecentCommand(); return task == DOZER_TASK_BUILD; -} // end isBuildMostImportant +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1376,7 +1376,7 @@ Bool DozerPrimaryStateMachine::isRepairMostImportant( State *thisState, void* us DozerTask task = dozerAI->getMostRecentCommand(); return task == DOZER_TASK_REPAIR; -} // end isRepairMostImportant +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1401,7 +1401,7 @@ Bool DozerPrimaryStateMachine::isFortifyMostImportant( State *thisState, void* u DozerTask task = dozerAI->getMostRecentCommand(); return task == DOZER_TASK_FORTIFY; -} // end isFortifyMostImportat +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1416,7 +1416,7 @@ DozerAIUpdateModuleData::DozerAIUpdateModuleData( void ) m_boredTime = 0.0f; m_boredRange = 0.0f; -} // end DozerAIUpdateModuleData +} // ------------------------------------------------------------------------------------------------ void DozerAIUpdateModuleData::buildFieldParse( MultiIniFieldParse& p) @@ -1433,7 +1433,7 @@ void DozerAIUpdateModuleData::buildFieldParse( MultiIniFieldParse& p) p.add( dataFieldParse ); -} // end buildFieldParse +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1455,9 +1455,9 @@ DozerAIUpdate::DozerAIUpdate( Thing *thing, const ModuleData* moduleData ) : m_dockPoint[ i ][ j ].valid = FALSE; m_dockPoint[ i ][ j ].location.zero(); - } // end for j + } - } // end for i + } m_currentTask = DOZER_TASK_INVALID; m_buildSubTask = DOZER_SELECT_BUILD_DOCK_LOCATION; // irrelavant, but I want non-garbage value @@ -1469,7 +1469,7 @@ DozerAIUpdate::DozerAIUpdate( Thing *thing, const ModuleData* moduleData ) : m_dozerMachine = NULL; createMachines(); -} // end DozerAIUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1486,9 +1486,9 @@ DozerAIUpdate::~DozerAIUpdate( void ) m_task[ i ].m_targetObjectID = INVALID_ID; m_task[ i ].m_taskOrderFrame = 0; - } // end for i + } -} // end ~DozerAIUpdate +} // ------------------------------------------------------------------------------------------------ /** Create any sub machines we need to do all our behavior */ @@ -1502,9 +1502,9 @@ void DozerAIUpdate::createMachines( void ) m_dozerMachine = newInstance(DozerPrimaryStateMachine)( getObject() ); m_dozerMachine->initDefaultState(); - } // end if + } -} // end createMachines +} // ------------------------------------------------------------------------------------------------ /** Create the bridge scaffolding if necessary for the bridge that is attached to this tower */ @@ -1530,7 +1530,7 @@ void DozerAIUpdate::createBridgeScaffolding( Object *bridgeTower ) // tell the bridge to create scaffolding if necessary bbi->createScaffolding(); -} // end createBridgeScaffolding +} // ------------------------------------------------------------------------------------------------ /** Remove the bridge scaffolding from the bridge object that is attached to this tower */ @@ -1556,7 +1556,7 @@ void DozerAIUpdate::removeBridgeScaffolding( Object *bridgeTower ) // tell the bridge to end any scaffolding from repairing bbi->removeScaffolding(); -} // end removeBridgeScaffolding +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1609,7 +1609,7 @@ UpdateSleepTime DozerAIUpdate::update( void ) if( invalidTask == TRUE ) cancelTask( currentTask ); - } // end if + } else getObject()->setWeaponSetFlag(WEAPONSET_MINE_CLEARING_DETAIL);//maybe go clear some mines, if I feel like it @@ -1618,7 +1618,7 @@ UpdateSleepTime DozerAIUpdate::update( void ) return UPDATE_SLEEP_NONE; -} // end update +} //------------------------------------------------------------------------------------------------- /** The entry point of a construct command to the Dozer */ @@ -1658,7 +1658,7 @@ Object *DozerAIUpdate::construct( const ThingTemplate *what, // Just build it. The ai will validate, or cheat. jba. - } // end if + } else { @@ -1675,9 +1675,9 @@ Object *DozerAIUpdate::construct( const ThingTemplate *what, getObject(), NULL ) != LBC_OK ) return NULL; - } // end else + } - } // end if + } // // what will our initial status bits be, it is important to do this early @@ -1701,7 +1701,7 @@ Object *DozerAIUpdate::construct( const ThingTemplate *what, money->withdraw( what->calcCostToBuild( owningPlayer ) ); - } // end if + } // initialize object obj->setPosition( pos ); @@ -1736,7 +1736,7 @@ Object *DozerAIUpdate::construct( const ThingTemplate *what, return obj; -} // end construct +} // ------------------------------------------------------------------------------------------------ /** Given our current task and repair target, can we accept this as a new repair target */ @@ -1779,20 +1779,20 @@ Bool DozerAIUpdate::canAcceptNewRepair( Object *obj ) DEBUG_CRASH(( "Unable to find bridge tower interface on object" )); return FALSE; - } // end if + } // if they are part of the same bridge, ignore this repair command if( currentTowerInterface->getBridgeID() == newTowerInterface->getBridgeID() ) return FALSE; - } // end if + } - } // end if, currentRepair object exists + } // all is well return TRUE; -} // end canAcceptNewRepair +} // ------------------------------------------------------------------------------------------------ /** Issue an order for the Dozer to go repair the target 'obj' */ @@ -1847,7 +1847,7 @@ void DozerAIUpdate::privateRepair( Object *obj, CommandSourceType cmdSource ) // start the new task newTask( DOZER_TASK_REPAIR, obj ); -} // end repair +} // ------------------------------------------------------------------------------------------------ /** Resume construction on a building */ @@ -1866,7 +1866,7 @@ void DozerAIUpdate::privateResumeConstruction( Object *obj, CommandSourceType cm // start the new task for construction newTask( DOZER_TASK_BUILD, obj ); -} // end privateResumeConstruction +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2015,7 +2015,7 @@ void DozerAIUpdate::newTask( DozerTask task, Object *target ) m_dockPoint[ task ][ DOZER_DOCK_POINT_END ].valid = TRUE; m_dockPoint[ task ][ DOZER_DOCK_POINT_END ].location = position; - } // end if + } // set the new task target and the frame in which we got this order m_task[ task ].m_targetObjectID = target->getID(); @@ -2024,7 +2024,7 @@ void DozerAIUpdate::newTask( DozerTask task, Object *target ) // reset the dozer behavior so that it can re-evluate which task to continue working on m_dozerMachine->resetToDefaultState(); -} // end newTask +} //------------------------------------------------------------------------------------------------- /** Cancel a task and reset the dozer behavior state machine so that it can @@ -2040,7 +2040,7 @@ void DozerAIUpdate::cancelTask( DozerTask task ) // reset the machine to we can re-evaluate what we want to do m_dozerMachine->resetToDefaultState(); -} // end cancelTask +} //------------------------------------------------------------------------------------------------- /** Is there a given task waiting to be done */ @@ -2053,7 +2053,7 @@ Bool DozerAIUpdate::isTaskPending( DozerTask task ) return m_task[ task ].m_targetObjectID != 0 ? TRUE : FALSE; -} // end isTaskPending +} //------------------------------------------------------------------------------------------------- /** Is there any task pending */ @@ -2067,7 +2067,7 @@ Bool DozerAIUpdate::isAnyTaskPending( void ) return FALSE; -} // end isAnyTaskPending +} //------------------------------------------------------------------------------------------------- /** Get the target object of a given task */ @@ -2080,7 +2080,7 @@ ObjectID DozerAIUpdate::getTaskTarget( DozerTask task ) return m_task[ task ].m_targetObjectID; -} // end getTaskTarget +} //------------------------------------------------------------------------------------------------- /** Set a task as successfully completed */ @@ -2102,7 +2102,7 @@ void DozerAIUpdate::internalTaskComplete( DozerTask task ) for( Int i = 0; i < DOZER_NUM_DOCK_POINTS; i++ ) m_dockPoint[ task ][ i ].valid = FALSE; -} // end internalTaskComplete +} //------------------------------------------------------------------------------------------------- /** Clear a task from the Dozer for consideration, we can use this when a goal object becomes @@ -2132,7 +2132,7 @@ void DozerAIUpdate::internalCancelTask( DozerTask task ) AIUpdateInterface *ai = getObject()->getAIUpdateInterface(); ai->aiIdle( CMD_FROM_AI ); -} // end internalCancelTask +} // ------------------------------------------------------------------------------------------------ /** This method is called whenever a task is completed *OR* cancelled */ @@ -2149,7 +2149,7 @@ void DozerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) break; // do nothing, this is really no task - } // end invalid + } // -------------------------------------------------------------------------------------------- case DOZER_TASK_BUILD: @@ -2168,7 +2168,7 @@ void DozerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) // } break; - } // end build + } // -------------------------------------------------------------------------------------------- case DOZER_TASK_REPAIR: @@ -2207,7 +2207,7 @@ void DozerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) break; - } // end repair + } // -------------------------------------------------------------------------------------------- case DOZER_TASK_FORTIFY: @@ -2215,7 +2215,7 @@ void DozerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) break; - } // end fortify + } // -------------------------------------------------------------------------------------------- default: @@ -2224,11 +2224,11 @@ void DozerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) DEBUG_CRASH(( "internalTaskCompleteOrCancelled: Unknown Dozer task '%d'", task )); break; - } // end default + } - } // end switch( task ) + } -} // end internalTaskCompleteOrCancelled +} //------------------------------------------------------------------------------------------------- /** If we were building something, kill the active-construction flag on it */ @@ -2244,7 +2244,7 @@ void DozerAIUpdate::onDelete( void ) if( isTaskPending( (DozerTask)i ) ) cancelTask( (DozerTask)i ); - } // end for i + } for( i = 0; i < DOZER_NUM_TASKS; i++ ) { @@ -2277,15 +2277,15 @@ DozerTask DozerAIUpdate::getMostRecentCommand( void ) mostRecentTask = (DozerTask)i; mostRecentFrame = m_task[ i ].m_taskOrderFrame; - } // end if + } - } // end if + } - } // end for i + } return mostRecentTask; -} // end getMostRecentCommand +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -2307,7 +2307,7 @@ const Coord3D* DozerAIUpdate::getDockPoint( DozerTask task, DozerDockPoint point // no valid point has been set for this dock point on this task return NULL; -} // end getDockPoint +} // ------------------------------------------------------------------------------------------------ Real DozerAIUpdate::getRepairHealthPerSecond( void ) const @@ -2380,7 +2380,7 @@ void DozerAIUpdate::aiDoCommand(const AICommandParms* parms) privateRepair(parms->m_obj, parms->m_cmdSource); break; - } // end repair + } // -------------------------------------------------------------------------------------------- case AICMD_RESUME_CONSTRUCTION: @@ -2394,7 +2394,7 @@ void DozerAIUpdate::aiDoCommand(const AICommandParms* parms) privateResumeConstruction( parms->m_obj, parms->m_cmdSource ); break; - } // end resume construction + } // -------------------------------------------------------------------------------------------- default: @@ -2412,11 +2412,11 @@ void DozerAIUpdate::aiDoCommand(const AICommandParms* parms) m_dozerMachine->resetToDefaultState(); break; - } // end default + } - } // end switch + } -} // end aiDoCommand +} //------------------------------------------------------------------------------------------------ void DozerAIUpdate::startBuildingSound( const AudioEventRTS *sound, ObjectID constructionSiteID ) @@ -2440,7 +2440,7 @@ void DozerAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -2485,7 +2485,7 @@ void DozerAIUpdate::xfer( Xfer *xfer ) } xfer->xferUser(&m_buildSubTask, sizeof(m_buildSubTask)); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -2494,6 +2494,6 @@ void DozerAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp index d1bb8e19994..719302d0221 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp @@ -207,7 +207,7 @@ void HackInternetAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -227,7 +227,7 @@ void HackInternetAIUpdate::xfer( Xfer *xfer ) if (m_hasPendingCommand) { m_pendingCommand.doXfer(xfer); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -236,7 +236,7 @@ void HackInternetAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- @@ -264,7 +264,7 @@ HackInternetStateMachine::~HackInternetStateMachine() // ------------------------------------------------------------------------------------------------ void UnpackingState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -277,14 +277,14 @@ void UnpackingState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUnsignedInt(&m_framesRemaining); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void UnpackingState::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- StateReturnType UnpackingState::onEnter() @@ -353,7 +353,7 @@ void UnpackingState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void PackingState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -366,14 +366,14 @@ void PackingState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUnsignedInt(&m_framesRemaining); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void PackingState::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- StateReturnType PackingState::onEnter() @@ -429,7 +429,7 @@ void PackingState::onExit( StateExitType status ) // ------------------------------------------------------------------------------------------------ void HackInternetState::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -442,14 +442,14 @@ void HackInternetState::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); xfer->xferUnsignedInt(&m_framesRemaining); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void HackInternetState::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- StateReturnType HackInternetState::onEnter() diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp index 570abbcdc15..05452e14e0e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp @@ -2538,7 +2538,7 @@ void JetAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -2601,7 +2601,7 @@ void JetAIUpdate::xfer( Xfer *xfer ) } } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -2621,4 +2621,4 @@ void JetAIUpdate::loadPostProcess( void ) // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp index 5428dd3eef1..1f2e9db8c1f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp @@ -354,8 +354,8 @@ Bool MissileAIUpdate::projectileHandleCollision( Object *other ) thingToKill->kill(); ++numKilled; } - } // next contained item - } // if items + } + } if (numKilled > 0) { @@ -367,7 +367,7 @@ Bool MissileAIUpdate::projectileHandleCollision( Object *other ) return true; } - } // if a garrisonable thing + } } } @@ -836,7 +836,7 @@ void MissileAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -911,7 +911,7 @@ void MissileAIUpdate::xfer( Xfer *xfer ) if( version>= 6 ) xfer->xferBool( &m_isJammed ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -920,4 +920,4 @@ void MissileAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp index b40f550f88e..9b3cd0b5cf7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp @@ -58,7 +58,7 @@ POWTruckAIUpdateModuleData::POWTruckAIUpdateModuleData( void ) m_boredTimeInFrames = 0; m_hangAroundPrisonDistance = 0; -} // end POWTruckAIUpdateModuleData +} // ------------------------------------------------------------------------------------------------ void POWTruckAIUpdateModuleData::buildFieldParse( MultiIniFieldParse &p ) @@ -74,7 +74,7 @@ void POWTruckAIUpdateModuleData::buildFieldParse( MultiIniFieldParse &p ) p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC ///////////////////////////////////////////////////////////////////////////////////////// @@ -93,21 +93,21 @@ POWTruckAIUpdate::POWTruckAIUpdate( Thing *thing, const ModuleData *moduleData ) m_enteredWaitingFrame = 0; m_lastFindFrame = 0; -} // end POWTruckAIUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- POWTruckAIUpdate::~POWTruckAIUpdate( void ) { -} // end ~POWTruckAIUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- void POWTruckAIUpdate::onDelete( void ) { -} // end onDelete +} // ------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------- @@ -127,7 +127,7 @@ void POWTruckAIUpdate::aiDoCommand( const AICommandParms *parms ) // set our task to waiting setTask( POW_TRUCK_TASK_WAITING ); - } // end if + } switch( parms->m_cmd ) { @@ -139,7 +139,7 @@ void POWTruckAIUpdate::aiDoCommand( const AICommandParms *parms ) privatePickUpPrisoner( parms->m_obj, parms->m_cmdSource ); break; - } // end pick up prisoner + } // -------------------------------------------------------------------------------------------- case AICMD_RETURN_PRISONERS: @@ -148,7 +148,7 @@ void POWTruckAIUpdate::aiDoCommand( const AICommandParms *parms ) privateReturnPrisoners( parms->m_obj, parms->m_cmdSource ); break; - } // end return prisoners + } // -------------------------------------------------------------------------------------------- default: @@ -158,11 +158,11 @@ void POWTruckAIUpdate::aiDoCommand( const AICommandParms *parms ) AIUpdateInterface::aiDoCommand( parms ); break; - } // end default + } - } // end switch( parms->m_cmd ) + } -} // end aiDoCommand +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -201,11 +201,11 @@ UpdateSleepTime POWTruckAIUpdate::update( void ) DEBUG_CRASH(( "POWTruckAIUpdate::update - Unknown current task '%d'", m_currentTask )); break; - } // end switch, current task + } return UPDATE_SLEEP_NONE; -} // end update +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PROTECTED ////////////////////////////////////////////////////////////////////////////////////// @@ -227,7 +227,7 @@ void POWTruckAIUpdate::setTask( POWTruckTask task, Object *taskObject ) setTask( POW_TRUCK_TASK_WAITING ); return; - } // end if + } // when leaving the collecting target state, we need to do some bookeeping if( oldTask == POW_TRUCK_TASK_COLLECTING_TARGET ) @@ -236,7 +236,7 @@ void POWTruckAIUpdate::setTask( POWTruckTask task, Object *taskObject ) // target cleanup m_targetID = INVALID_ID; - } // end if + } // to be clean, when leaving the POW_TRUCK_TASK_RETURNING_PRISONERS state, clear out the prison ID we were watching if( oldTask == POW_TRUCK_TASK_RETURNING_PRISONERS ) @@ -253,26 +253,26 @@ void POWTruckAIUpdate::setTask( POWTruckTask task, Object *taskObject ) DEBUG_ASSERTCRASH( taskObject->getAIUpdateInterface(), ("POWTruckAIUpdate::setTask - '%s' has no ai module", taskObject->getTemplate()->getName().str()) ); - } // end if + } else if( task == POW_TRUCK_TASK_RETURNING_PRISONERS ) { // save ID of the prison we're going to m_prisonID = taskObject->getID(); - } // end else + } else if( task == POW_TRUCK_TASK_WAITING ) { // mark the frame and always go idle m_enteredWaitingFrame = TheGameLogic->getFrame(); - } // end else if + } // store the new current task m_currentTask = task; -} // end task +} // ------------------------------------------------------------------------------------------------ /** Set this unit into automatic or manual AI mode, when automatic the AI will look for @@ -285,7 +285,7 @@ void POWTruckAIUpdate::setAIMode( POWTruckAIMode mode ) // save the mode m_aiMode = mode; -} // end setAIModel +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -317,7 +317,7 @@ void POWTruckAIUpdate::privatePickUpPrisoner( Object *prisoner, CommandSourceTyp getCurLocomotor()->setUltraAccurate( TRUE ); aiMoveToObject( prisoner, CMD_FROM_AI ); -} // end privatePickUpPrisoner +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -344,7 +344,7 @@ void POWTruckAIUpdate::privateReturnPrisoners( Object *prison, CommandSourceType getCurLocomotor()->setUltraAccurate( TRUE ); aiDock( prison, cmdSource ); -} // end privateReturnPrisoners +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -376,7 +376,7 @@ void POWTruckAIUpdate::updateWaiting( void ) if( TheGameLogic->getFrame() - m_enteredWaitingFrame > modData->m_boredTimeInFrames ) setTask( POW_TRUCK_TASK_FIND_TARGET ); -} // updateWaiting +} static const UnsignedInt FIND_DELAY = LOGICFRAMES_PER_SECOND * 1; // ------------------------------------------------------------------------------------------------ @@ -410,7 +410,7 @@ void POWTruckAIUpdate::updateFindTarget( void ) doReturnPrisoners(); return; - } // end if + } // find closest target not already targeted for pickup by another POW truck Object *target = findBestTarget(); @@ -422,7 +422,7 @@ void POWTruckAIUpdate::updateFindTarget( void ) // send the pickup command ai->aiPickUpPrisoner( target, CMD_FROM_AI ); - } // end if + } else { @@ -432,9 +432,9 @@ void POWTruckAIUpdate::updateFindTarget( void ) else doReturnToPrison( NULL ); - } // end else + } -} // end updateFindTarget +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -454,7 +454,7 @@ void POWTruckAIUpdate::updateCollectingTarget( void ) return; - } // end if + } // we should never become idle while collecting a target, if we do, find a target Object *us = getObject(); @@ -467,7 +467,7 @@ void POWTruckAIUpdate::updateCollectingTarget( void ) else setTask( POW_TRUCK_TASK_WAITING ); - } // end if + } /* // @@ -487,12 +487,12 @@ void POWTruckAIUpdate::updateCollectingTarget( void ) // tell them to start moving to us targetAI->aiMoveToObject( us, CMD_FROM_AI ); - } // end if + } - } // end if + } */ -} // end updateCollectingTarget +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -526,7 +526,7 @@ static void putContainedInPrison( Object *obj, void *userData ) destContain->addToContain( obj ); } -} // end putContainedInPrison +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -547,13 +547,13 @@ void POWTruckAIUpdate::updateReturnPrisoners( void ) doReturnPrisoners(); return; - } // end if + } // we should not go idle, we should collide with the prison to return the prisoners if( ai->isIdle() ) doReturnPrisoners(); -} // end updateReturnPrisoners +} // ------------------------------------------------------------------------------------------------ /** Is the object 'target' a valid target for collection */ @@ -563,7 +563,7 @@ Bool POWTruckAIUpdate::validateTarget( const Object *target ) return TheActionManager->canPickUpPrisoner( getObject(), target, getLastCommandSource() ); -} // end validateTarget +} // ------------------------------------------------------------------------------------------------ /** Initiate a return prisoners contained in us to prison */ @@ -581,7 +581,7 @@ void POWTruckAIUpdate::doReturnPrisoners( void ) setTask( POW_TRUCK_TASK_WAITING ); return; - } // end if + } // start the prisoner return process Object *us = getObject(); @@ -590,7 +590,7 @@ void POWTruckAIUpdate::doReturnPrisoners( void ) us->getTemplate()->getName().str()) ); ai->aiReturnPrisoners( prison, CMD_FROM_AI ); -} // end doReturnPrisoners +} // ------------------------------------------------------------------------------------------------ /** Initate a return of our empty truck back near the closest prison */ @@ -624,7 +624,7 @@ void POWTruckAIUpdate::doReturnToPrison( Object *prison ) // dock us with the prison aiDock( prison, CMD_FROM_AI ); -} // end doReturnToPrison +} // ------------------------------------------------------------------------------------------------ /** Find the best prison for us to use given our current position */ @@ -641,7 +641,7 @@ Object *POWTruckAIUpdate::findBestPrison( void ) return prison; -} // end findBestPrison +} // ------------------------------------------------------------------------------------------------ /** Find the best prisoner for us to go pick up given our current situation */ @@ -693,15 +693,15 @@ Object *POWTruckAIUpdate::findBestTarget( void ) closestTarget = other; closestTargetDistSq = distSq; - } // end if + } - } // end if + } - } // end for other + } return closestTarget; -} // end findBestTarget +} // ------------------------------------------------------------------------------------------------ /** We are chosing to pass a structure through the iterate function to unload the @@ -755,7 +755,7 @@ static void putPrisonersInPrison( Object *obj, void *userData ) prisonUnloadData->bounty += TheGlobalData->m_prisonBountyMultiplier * obj->getTemplate()->calcCostToBuild( prisonerOwningPlayer ); -} // end putPrisonersInPrison +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -815,16 +815,16 @@ void POWTruckAIUpdate::unloadPrisonersToPrison( Object *prison ) moneyString.format( TheGameText->fetch( "GUI:AddCash" ), prisonUnloadData.bounty ); TheInGameUI->addFloatingText( moneyString, &pos, moneyColor ); - } // end if + } - } // end if + } - } // end if + } // set our state to waiting and become idle setTask( POW_TRUCK_TASK_WAITING ); -} // end unloadPrisonersToPrison +} // ------------------------------------------------------------------------------------------------ /** We have arrived at a prisoner to load into us ... do it */ @@ -850,7 +850,7 @@ void POWTruckAIUpdate::loadPrisoner( Object *prisoner ) doReturnPrisoners(); return; - } // end if + } // add object to our containment contain->addToContain( prisoner ); @@ -870,7 +870,7 @@ void POWTruckAIUpdate::loadPrisoner( Object *prisoner ) else setTask( POW_TRUCK_TASK_WAITING ); -} // end loadPrisoner +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -879,7 +879,7 @@ void POWTruckAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -903,7 +903,7 @@ void POWTruckAIUpdate::xfer( Xfer *xfer ) xfer->xferUnsignedInt(&m_enteredWaitingFrame); xfer->xferUnsignedInt(&m_lastFindFrame); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -912,6 +912,6 @@ void POWTruckAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} #endif diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailedTransportAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailedTransportAIUpdate.cpp index e0bf1a9934d..c36d0ccb062 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailedTransportAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailedTransportAIUpdate.cpp @@ -45,7 +45,7 @@ static const Int INVALID_PATH = -1; RailedTransportAIUpdateModuleData::RailedTransportAIUpdateModuleData( void ) { -} // end RailedTransportAIUpdateModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -61,7 +61,7 @@ void RailedTransportAIUpdateModuleData::buildFieldParse( MultiIniFieldParse &p ) p.add( dataFieldParse ); -} // end buildFieldParse +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -76,19 +76,19 @@ RailedTransportAIUpdate::RailedTransportAIUpdate( Thing *thing, const ModuleData m_path[ i ].startWaypointID = 0; m_path[ i ].endWaypointID = 0; - } // end for i + } m_numPaths = 0; m_currentPath = INVALID_PATH; m_waypointDataLoaded = FALSE; -} // end RailedTransportAIUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- RailedTransportAIUpdate::~RailedTransportAIUpdate( void ) { -} // end ~RailedTransportAIUpdate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -118,14 +118,14 @@ void RailedTransportAIUpdate::loadWaypointData( void ) m_path[ i ].endWaypointID = end->getID(); m_numPaths++; - } // end if + } - } // end for i + } // waypoint data is loaded m_waypointDataLoaded = TRUE; -} // end loadWaypointData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -163,11 +163,11 @@ void RailedTransportAIUpdate::pickAndMoveToInitialLocation( void ) closestPath = i; closestEndWaypoint = waypoint; - } // end if + } - } // end if + } - } // end for i + } // a path must have been found DEBUG_ASSERTCRASH( closestPath != INVALID_PATH, @@ -183,7 +183,7 @@ void RailedTransportAIUpdate::pickAndMoveToInitialLocation( void ) // we are now "in transit" setInTransit( TRUE ); -} // end pickAndMoveToInitialLocation +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -245,18 +245,18 @@ UpdateSleepTime RailedTransportAIUpdate::update( void ) // we are no longer in transit setInTransit( FALSE ); - } // end if + } } else { setInTransit( FALSE ); } - } // end if + } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------- @@ -276,7 +276,7 @@ void RailedTransportAIUpdate::aiDoCommand( const AICommandParms *parms ) // call the default do command AIUpdateInterface::aiDoCommand( parms ); -} // end aiDoCommand +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE //////////////////////////////////////////////////////////////////////////////////////// @@ -296,7 +296,7 @@ void RailedTransportAIUpdate::setInTransit( Bool inTransit ) // no longer in transit m_inTransit = inTransit; -} // end setInTransit +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -332,7 +332,7 @@ void RailedTransportAIUpdate::privateExecuteRailedTransport( CommandSourceType c // we are now in transit setInTransit( TRUE ); -} // end privateExecuteRailedTransport +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -365,7 +365,7 @@ void RailedTransportAIUpdate::privateEvacuate( Int exposeStealthUnits, CommandSo // start the manual undocking process rtdui->unloadAll(); -} // end privateEvacuate +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -374,7 +374,7 @@ void RailedTransportAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -404,7 +404,7 @@ void RailedTransportAIUpdate::xfer( Xfer *xfer ) xfer->xferInt(&m_currentPath); xfer->xferBool(&m_waypointDataLoaded); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -413,4 +413,4 @@ void RailedTransportAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp index b82e7adc268..4551ebea2e1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp @@ -92,7 +92,7 @@ RailroadBehaviorModuleData::RailroadBehaviorModuleData( void ) m_braking = 0.99f; m_friction = 0.97f; m_waitAtStationTime = 150; -} // end RailroadBehaviorModuleData +} //------------------------------------------------------------------------------------------------- @@ -162,7 +162,7 @@ RailroadBehavior::RailroadBehavior( Thing *thing, const ModuleData *moduleData ) m_conductorState = m_isLocomotive ? ACCELERATE : COAST; -} // end RailroadBehavior +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -180,7 +180,7 @@ RailroadBehavior::~RailroadBehavior( void ) } -} // end ~RailroadBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -416,7 +416,7 @@ void RailroadBehavior::onCollide( Object *other, const Coord3D *loc, const Coord -} // end RailroadBehavior:: on collide +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -630,7 +630,7 @@ void RailroadBehavior::loadTrackData( void ) } } -} // end loadTrackData +} @@ -846,7 +846,7 @@ UpdateSleepTime RailroadBehavior::update( void ) return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------- @@ -1512,7 +1512,7 @@ void RailroadBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1598,7 +1598,7 @@ void RailroadBehavior::xfer( Xfer *xfer ) } -} // end xfer +} @@ -1640,7 +1640,7 @@ void RailroadBehavior::loadPostProcess( void ) m_whistleSound.setObjectID( getObject()->getID() ) ; m_clicketyClackSound.setObjectID( getObject()->getID() ) ; -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp index 9a338836d93..67acd3c6c1e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp @@ -251,7 +251,7 @@ void SupplyTruckAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -272,7 +272,7 @@ void SupplyTruckAIUpdate::xfer( Xfer *xfer ) xfer->xferInt(&m_numberBoxes); xfer->xferBool(&m_forcePending); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -281,7 +281,7 @@ void SupplyTruckAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} //---------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------- @@ -448,7 +448,7 @@ SupplyTruckStateMachine::~SupplyTruckStateMachine() void SupplyTruckStateMachine::crc( Xfer *xfer ) { StateMachine::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -460,7 +460,7 @@ void SupplyTruckStateMachine::xfer( Xfer *xfer ) xfer->xferVersion( &v, cv ); StateMachine::xfer(xfer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -468,7 +468,7 @@ void SupplyTruckStateMachine::xfer( Xfer *xfer ) void SupplyTruckStateMachine::loadPostProcess( void ) { StateMachine::loadPostProcess(); -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp index b55a17bdb45..31ebfcc3b87 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp @@ -204,7 +204,7 @@ void TransportAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -220,7 +220,7 @@ void TransportAIUpdate::xfer( Xfer *xfer ) // extend base class AIUpdateInterface::xfer(xfer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -229,4 +229,4 @@ void TransportAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WanderAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WanderAIUpdate.cpp index 7d5d19fb7c0..6587f880301 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WanderAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WanderAIUpdate.cpp @@ -66,7 +66,7 @@ UpdateSleepTime WanderAIUpdate::update( void ) //return (mine < ret) ? mine : ret; /// @todo srj -- someday, make sleepy. for now, must not sleep. return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -75,7 +75,7 @@ void WanderAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -91,7 +91,7 @@ void WanderAIUpdate::xfer( Xfer *xfer ) // extend base class AIUpdateInterface::xfer(xfer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -100,4 +100,4 @@ void WanderAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp index 851678b76cb..f95c09ba4c7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp @@ -288,12 +288,12 @@ UpdateSleepTime WorkerAIUpdate::update( void ) if( invalidTask == TRUE ) cancelTask( currentTask ); - } // end if + } // update dozer behavior m_dozerMachine->updateStateMachine(); - } // end if + } else { m_supplyTruckStateMachine->updateStateMachine(); @@ -360,7 +360,7 @@ Object *WorkerAIUpdate::construct( const ThingTemplate *what, getObject(), NULL ) != LBC_OK ) return NULL; - } // end if + } else { @@ -377,9 +377,9 @@ Object *WorkerAIUpdate::construct( const ThingTemplate *what, getObject(), NULL ) != LBC_OK ) return NULL; - } // end else + } - } // end if + } // what will our initial status bits ObjectStatusMaskType statusBits = MAKE_OBJECT_STATUS_MASK( OBJECT_STATUS_UNDER_CONSTRUCTION ); @@ -403,7 +403,7 @@ Object *WorkerAIUpdate::construct( const ThingTemplate *what, money->withdraw( what->calcCostToBuild( owningPlayer ) ); - } // end if + } // // set a bit that this object is under construction, it is important to do this early @@ -511,20 +511,20 @@ Bool WorkerAIUpdate::canAcceptNewRepair( Object *obj ) DEBUG_CRASH(( "Unable to find bridge tower interface on object" )); return FALSE; - } // end if + } // if they are part of the same bridge, ignore this repair command if( currentTowerInterface->getBridgeID() == newTowerInterface->getBridgeID() ) return FALSE; - } // end if + } - } // end if, currentRepair object exists + } // all is well return TRUE; -} // end canAcceptNewRepair +} //---------------------------------------------------------------------------------------- void WorkerAIUpdate::privateIdle(CommandSourceType cmdSource) @@ -579,7 +579,7 @@ void WorkerAIUpdate::privateRepair( Object *obj, CommandSourceType cmdSource ) // start the new task newTask( DOZER_TASK_REPAIR, obj ); -} // end privateRepair +} // ------------------------------------------------------------------------------------------------ /** Resume construction on a building */ @@ -598,7 +598,7 @@ void WorkerAIUpdate::privateResumeConstruction( Object *obj, CommandSourceType c // start the new task for construction newTask( DOZER_TASK_BUILD, obj ); -} // end privateResumeConstruction +} //------------------------------------------------------------------------------------------------- /** Issue and order to the dozer */ @@ -652,7 +652,7 @@ void WorkerAIUpdate::newTask( DozerTask task, Object* target ) m_dockPoint[ task ][ DOZER_DOCK_POINT_END ].valid = TRUE; m_dockPoint[ task ][ DOZER_DOCK_POINT_END ].location = position; - } // end if, build task + } // set the new task target and the frame in which we got this order m_task[ task ].m_targetObjectID = target->getID(); @@ -806,7 +806,7 @@ void WorkerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) break; // do nothing, this is really no task - } // end invalid + } // -------------------------------------------------------------------------------------------- case DOZER_TASK_BUILD: @@ -825,7 +825,7 @@ void WorkerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) // } break; - } // end build + } // -------------------------------------------------------------------------------------------- case DOZER_TASK_REPAIR: @@ -844,11 +844,11 @@ void WorkerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) if( obj->isKindOf( KINDOF_BRIDGE_TOWER ) ) removeBridgeScaffolding( obj ); - } // end if + } break; - } // end repair + } // -------------------------------------------------------------------------------------------- case DOZER_TASK_FORTIFY: @@ -856,7 +856,7 @@ void WorkerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) break; - } // end fortify + } // -------------------------------------------------------------------------------------------- default: @@ -865,9 +865,9 @@ void WorkerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) DEBUG_CRASH(( "internalTaskCompleteOrCancelled: Unknown Dozer task '%d'", task )); break; - } // end default + } - } // end switch( task ) + } } @@ -885,7 +885,7 @@ void WorkerAIUpdate::onDelete( void ) if( isTaskPending( (DozerTask)i ) ) cancelTask( (DozerTask)i ); - } // end for i + } for( i = 0; i < DOZER_NUM_TASKS; i++ ) { @@ -940,7 +940,7 @@ const Coord3D* WorkerAIUpdate::getDockPoint( DozerTask task, DozerDockPoint poin // no valid point has been set for this dock point on this task return NULL; -} // end getDockPoint +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -980,7 +980,7 @@ void WorkerAIUpdate::aiDoCommand(const AICommandParms* parms) privateRepair(parms->m_obj, parms->m_cmdSource); break; - } // end repair + } // -------------------------------------------------------------------------------------------- case AICMD_RESUME_CONSTRUCTION: @@ -994,7 +994,7 @@ void WorkerAIUpdate::aiDoCommand(const AICommandParms* parms) privateResumeConstruction( parms->m_obj, parms->m_cmdSource ); break; - } // end resume construction + } // -------------------------------------------------------------------------------------------- default: @@ -1012,9 +1012,9 @@ void WorkerAIUpdate::aiDoCommand(const AICommandParms* parms) m_dozerMachine->resetToDefaultState(); break; - } // end default + } - } // end switch + } if (isClearingMines() && m_numberBoxes > 0 ) { @@ -1198,7 +1198,7 @@ WorkerStateMachine::~WorkerStateMachine() void WorkerStateMachine::crc( Xfer *xfer ) { StateMachine::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1210,7 +1210,7 @@ void WorkerStateMachine::xfer( Xfer *xfer ) xfer->xferVersion( &v, cv ); StateMachine::xfer(xfer); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1218,7 +1218,7 @@ void WorkerStateMachine::xfer( Xfer *xfer ) void WorkerStateMachine::loadPostProcess( void ) { StateMachine::loadPostProcess(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1344,7 +1344,7 @@ void WorkerAIUpdate::createBridgeScaffolding( Object *bridgeTower ) // tell the bridge to create scaffolding if necessary bbi->createScaffolding(); -} // end createBridgeScaffolding +} // ------------------------------------------------------------------------------------------------ /** Remove the bridge scaffolding from the bridge object that is attached to this tower */ @@ -1370,7 +1370,7 @@ void WorkerAIUpdate::removeBridgeScaffolding( Object *bridgeTower ) // tell the bridge to end any scaffolding from repairing bbi->removeScaffolding(); -} // end removeBridgeScaffolding +} //------------------------------------------------------------------------------------------------ void WorkerAIUpdate::startBuildingSound( const AudioEventRTS *sound, ObjectID constructionSiteID ) @@ -1406,7 +1406,7 @@ void WorkerAIUpdate::crc( Xfer *xfer ) { // extend base class AIUpdateInterface::crc(xfer); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1463,7 +1463,7 @@ void WorkerAIUpdate::xfer( Xfer *xfer ) //-------------------------- xfer Worker info xfer->xferSnapshot(m_workerMachine); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1472,4 +1472,4 @@ void WorkerAIUpdate::loadPostProcess( void ) { // extend base class AIUpdateInterface::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AnimationSteeringUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AnimationSteeringUpdate.cpp index fb1ffc4798e..c1eac1a9090 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AnimationSteeringUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AnimationSteeringUpdate.cpp @@ -145,7 +145,7 @@ void AnimationSteeringUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp index e646593c741..e0818a99209 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp @@ -160,7 +160,7 @@ void AssistedTargetingUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -178,7 +178,7 @@ void AssistedTargetingUpdate::xfer( Xfer *xfer ) // extend base class UpdateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -193,4 +193,4 @@ void AssistedTargetingUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AutoDepositUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AutoDepositUpdate.cpp index 1ec26624c7d..315a00d3a48 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AutoDepositUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AutoDepositUpdate.cpp @@ -97,7 +97,7 @@ void parseUpgradePair( INI *ini, void *instance, void *store, const void *userDa std::list * theList = (std::list*)store; theList->push_back(info); -} // end parseFactionObjectCreationList +} //----------------------------------------------------------------------------- // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -250,7 +250,7 @@ void AutoDepositUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -277,7 +277,7 @@ void AutoDepositUpdate::xfer( Xfer *xfer ) xfer->xferBool(&m_initialized); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -288,4 +288,4 @@ void AutoDepositUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AutoFindHealingUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AutoFindHealingUpdate.cpp index 42cba5e76ac..aacb8a3e7b3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AutoFindHealingUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AutoFindHealingUpdate.cpp @@ -179,7 +179,7 @@ Object* AutoFindHealingUpdate::scanClosestTarget() closestDistSqr = fDistSqr; continue; } - } // end for, other + } return bestTarget; } @@ -193,7 +193,7 @@ void AutoFindHealingUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -214,7 +214,7 @@ void AutoFindHealingUpdate::xfer( Xfer *xfer ) // next scan frames xfer->xferInt( &m_nextScanFrames ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -225,4 +225,4 @@ void AutoFindHealingUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BaseRenerateUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BaseRenerateUpdate.cpp index 09ad61d82ea..d377442337b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BaseRenerateUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BaseRenerateUpdate.cpp @@ -143,7 +143,7 @@ UpdateSleepTime BaseRegenerateUpdate::update( void ) return UPDATE_SLEEP(HEAL_RATE); } -} // end update +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -154,7 +154,7 @@ void BaseRegenerateUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -172,7 +172,7 @@ void BaseRegenerateUpdate::xfer( Xfer *xfer ) // extend base class UpdateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -183,4 +183,4 @@ void BaseRegenerateUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp index 31e4988270c..0ba1f277435 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp @@ -193,7 +193,7 @@ void BattlePlanUpdate::onDelete() obj = TheGameLogic->findObjectByID( m_visionObjectID ); if( obj ) TheGameLogic->destroyObject( obj ); - } // end if + } // If we get destroyed, then make sure we remove our bonus! // srj sez: we can't do this in the dtor because our team @@ -437,9 +437,9 @@ void BattlePlanUpdate::createVisionObject() // set the shroud clearing range visionObject->setShroudClearingRange( obj->getGeometryInfo().getBoundingSphereRadius() ); - } // end if + } -} // end createVisionObject +} //------------------------------------------------------------------------------------------------- void BattlePlanUpdate::setStatus( TransitionStatus newStatus ) @@ -871,7 +871,7 @@ void BattlePlanUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} //------------------------------------------------------------------------------------------------ // Xfer method @@ -925,7 +925,7 @@ void BattlePlanUpdate::xfer( Xfer *xfer ) // vision object data xfer->xferObjectID( &m_visionObjectID ); -} // end xfer +} //------------------------------------------------------------------------------------------------ void BattlePlanUpdate::loadPostProcess( void ) @@ -934,4 +934,4 @@ void BattlePlanUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BoneFXUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BoneFXUpdate.cpp index 3092c39d3b5..3c227e03403 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BoneFXUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BoneFXUpdate.cpp @@ -127,16 +127,16 @@ static void parseFXLocInfo( INI *ini, void *instance, BoneLocInfo *locInfo ) // save bone name and location type locInfo->boneName = ini->getNextToken(); - } // end if + } else { // error throw INI_INVALID_DATA; - } // end else + } -} // end parseFXLocInfo +} //------------------------------------------------------------------------------------------------- /** Parse a random delay. This is a number pair, where the numbers are a min and max time in miliseconds. */ @@ -180,7 +180,7 @@ void BoneFXUpdateModuleData::parseFXList( INI *ini, void *instance, // error throw INI_INVALID_DATA; - } // end if + } ini->parseBool( ini, instance, &info->onlyOnce, NULL); @@ -194,12 +194,12 @@ void BoneFXUpdateModuleData::parseFXList( INI *ini, void *instance, // error throw INI_INVALID_DATA; - } // end if + } // parse the fx list name ini->parseFXList( ini, instance, &info->fx, NULL ); -} // end parseFXList +} //------------------------------------------------------------------------------------------------- /** In the form of: @@ -222,7 +222,7 @@ void BoneFXUpdateModuleData::parseObjectCreationList( INI *ini, void *instance, // error throw INI_INVALID_DATA; - } // end if + } ini->parseBool( ini, instance, &info->onlyOnce, NULL ); @@ -236,12 +236,12 @@ void BoneFXUpdateModuleData::parseObjectCreationList( INI *ini, void *instance, // error throw INI_INVALID_DATA; - } // end if + } // parse the ocl name ini->parseObjectCreationList( ini, instance, &info->ocl, NULL ); -} // end parseObjectCreationList +} //------------------------------------------------------------------------------------------------- /** In the form of: @@ -264,7 +264,7 @@ void BoneFXUpdateModuleData::parseParticleSystem( INI *ini, void *instance, // error throw INI_INVALID_DATA; - } // end if + } ini->parseBool( ini, instance, &info->onlyOnce, NULL ); @@ -278,12 +278,12 @@ void BoneFXUpdateModuleData::parseParticleSystem( INI *ini, void *instance, // error throw INI_INVALID_DATA; - } // end if + } // parse the particle system name ini->parseParticleSystemTemplate( ini, instance, &info->particleSysTemplate, NULL ); -} // end parseParticleSystem +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -559,7 +559,7 @@ void BoneFXUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -591,9 +591,9 @@ void BoneFXUpdate::xfer( Xfer *xfer ) systemID = *it; xfer->xferUser( &systemID, sizeof( ParticleSystemID ) ); - } // end for + } - } // end if, save + } else { @@ -604,7 +604,7 @@ void BoneFXUpdate::xfer( Xfer *xfer ) DEBUG_CRASH(( "BoneFXUpdate::xfer - m_particleSystemIDs should be empty but is not" )); throw SC_INVALID_DATA; - } // end if + } // read all data for( UnsignedShort i = 0; i < particleSystemCount; ++i ) @@ -616,9 +616,9 @@ void BoneFXUpdate::xfer( Xfer *xfer ) // put at end of vector m_particleSystemIDs.push_back( systemID ); - } // end for, i + } - } // end else + } // next fx frame xfer->xferUser( m_nextFXFrame, sizeof( Int ) * BODYDAMAGETYPE_COUNT * BONE_FX_MAX_BONES ); @@ -647,7 +647,7 @@ void BoneFXUpdate::xfer( Xfer *xfer ) // active xfer->xferBool( &m_active ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -658,4 +658,4 @@ void BoneFXUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CheckpointUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CheckpointUpdate.cpp index b8cd0984f80..9d87a76f4e4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CheckpointUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CheckpointUpdate.cpp @@ -141,7 +141,7 @@ UpdateSleepTime CheckpointUpdate::update() } } - }// end if change + } GeometryInfo geom = obj->getGeometryInfo(); @@ -164,7 +164,7 @@ UpdateSleepTime CheckpointUpdate::update() obj->setGeometryInfo( geom ); - } // end if draw + } return UPDATE_SLEEP_NONE; @@ -179,7 +179,7 @@ void CheckpointUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -209,7 +209,7 @@ void CheckpointUpdate::xfer( Xfer *xfer ) // enemy scan delay xfer->xferUnsignedInt( &m_enemyScanDelay ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -220,4 +220,4 @@ void CheckpointUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CleanupHazardUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CleanupHazardUpdate.cpp index 33588fa5340..82633a38927 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CleanupHazardUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CleanupHazardUpdate.cpp @@ -318,7 +318,7 @@ void CleanupHazardUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -357,7 +357,7 @@ void CleanupHazardUpdate::xfer( Xfer *xfer ) // move range xfer->xferReal( &m_moveRange ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -368,4 +368,4 @@ void CleanupHazardUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CommandButtonHuntUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CommandButtonHuntUpdate.cpp index d27bb259757..3ed8abdbdc0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CommandButtonHuntUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CommandButtonHuntUpdate.cpp @@ -400,7 +400,7 @@ void CommandButtonHuntUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -448,17 +448,17 @@ void CommandButtonHuntUpdate::xfer( Xfer *xfer ) m_commandButton = button; break; // exit for, i - } // end if + } - } // end for, i + } - } // end if, commandSet + } - } // end if, command button name present + } - } // end if, loading + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -469,4 +469,4 @@ void CommandButtonHuntUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DeletionUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DeletionUpdate.cpp index c2ca1816761..e6726621abb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DeletionUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DeletionUpdate.cpp @@ -115,7 +115,7 @@ void DeletionUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -136,7 +136,7 @@ void DeletionUpdate::xfer( Xfer *xfer ) // die frame xfer->xferUnsignedInt( &m_dieFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -147,4 +147,4 @@ void DeletionUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DemoTrapUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DemoTrapUpdate.cpp index 7be67aea3da..b648854f493 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DemoTrapUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DemoTrapUpdate.cpp @@ -283,7 +283,7 @@ void DemoTrapUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -307,7 +307,7 @@ void DemoTrapUpdate::xfer( Xfer *xfer ) // detonated xfer->xferBool( &m_detonated ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -318,4 +318,4 @@ void DemoTrapUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp index c0c5cae13a5..35d0b965db4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp @@ -61,7 +61,7 @@ DockUpdateModuleData::DockUpdateModuleData( void ) p.add(dataFieldParse); -} // end buildFieldParse +} DockUpdate::DockUpdate( Thing *thing, const ModuleData* moduleData ) : UpdateModule( thing, moduleData ) { @@ -555,7 +555,7 @@ void DockUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -631,7 +631,7 @@ void DockUpdate::xfer( Xfer *xfer ) // dock open xfer->xferBool( &m_dockOpen ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -642,5 +642,5 @@ void DockUpdate::loadPostProcess( void ) // call base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/PrisonDockUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/PrisonDockUpdate.cpp index 5022afa47c2..a9c89baebbd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/PrisonDockUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/PrisonDockUpdate.cpp @@ -45,14 +45,14 @@ PrisonDockUpdate::PrisonDockUpdate( Thing *thing, const ModuleData* moduleData ) : DockUpdate( thing, moduleData ) { -} // end PrisonDockUpdate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ PrisonDockUpdate::~PrisonDockUpdate( void ) { -} // end ~PrisonDockUpdate +} // ------------------------------------------------------------------------------------------------ /** Do the action while docked @@ -84,7 +84,7 @@ Bool PrisonDockUpdate::action( Object *docker, Object *drone ) // end docking return FALSE; -} // end action +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -95,7 +95,7 @@ void PrisonDockUpdate::crc( Xfer *xfer ) // extend base class DockUpdate::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -113,7 +113,7 @@ void PrisonDockUpdate::xfer( Xfer *xfer ) // extend base class DockUpdate::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -124,6 +124,6 @@ void PrisonDockUpdate::loadPostProcess( void ) // extend base class DockUpdate::loadPostProcess(); -} // end loadPostProcess +} #endif diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp index 321b615a758..7b60683819f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp @@ -53,7 +53,7 @@ RailedTransportDockUpdateModuleData::RailedTransportDockUpdateModuleData( void ) m_pullInsideDurationInFrames = 0; m_pushOutsideDurationInFrames = 0; m_toleranceDistance = 50.0f; -} // end RailedTransportDockUpdateModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -73,7 +73,7 @@ RailedTransportDockUpdateModuleData::RailedTransportDockUpdateModuleData( void ) p.add( dataFieldParse ); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -91,14 +91,14 @@ RailedTransportDockUpdate::RailedTransportDockUpdate( Thing *thing, const Module m_pushOutsideDistancePerFrame = 0.0f; m_unloadCount = UNLOAD_ALL; -} // end RailedTransportDockUpdate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ RailedTransportDockUpdate::~RailedTransportDockUpdate( void ) { -} // end ~RailedTransportDockUpdate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -117,7 +117,7 @@ UpdateSleepTime RailedTransportDockUpdate::update( void ) doPushOutDocking(); return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** The dock action callback, return FALSE when done docking */ @@ -171,11 +171,11 @@ Bool RailedTransportDockUpdate::action( Object *docker, Object *drone ) docker->setOrientation( angleVector.toAngle() ); } - } // end if + } return TRUE; -} // end action +} // ------------------------------------------------------------------------------------------------ /** Is clear to enter the railed transport */ @@ -196,7 +196,7 @@ Bool RailedTransportDockUpdate::isClearToEnter( Object const *docker ) const return TRUE; -} // end isClearToEnter +} // ------------------------------------------------------------------------------------------------ /** Is anything currently loading or unloading */ @@ -209,7 +209,7 @@ Bool RailedTransportDockUpdate::isLoadingOrUnloading( void ) return FALSE; -} // end isLoadingOrUnloading +} // ------------------------------------------------------------------------------------------------ /** Start the unload process */ @@ -225,7 +225,7 @@ void RailedTransportDockUpdate::unloadAll( void ) m_unloadCount = UNLOAD_ALL; unloadNext(); -} // end manualUnload +} // ------------------------------------------------------------------------------------------------ /** Unload a single individual only */ @@ -237,7 +237,7 @@ void RailedTransportDockUpdate::unloadSingleObject( Object *obj ) m_unloadCount = 1; unloadNext(); -} // end unloadSingleObject +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -323,13 +323,13 @@ void RailedTransportDockUpdate::doPullInDocking( void ) // no object is docking now m_dockingObjectID = INVALID_ID; - } // end if + } - } // end if + } - } // end if + } -} // end doPullInDocking +} // ------------------------------------------------------------------------------------------------ /** If we have an object recorded as being pushed out of us then do that here */ @@ -348,7 +348,7 @@ void RailedTransportDockUpdate::doPushOutDocking( void ) unloadNext(); return; - } // end if + } // pull it if( unloader ) @@ -417,18 +417,18 @@ void RailedTransportDockUpdate::doPushOutDocking( void ) us->convertBonePosToWorldPos( &finalPos, NULL, &finalPos, NULL ); unloaderAI->aiMoveToPosition( &finalPos, CMD_FROM_AI ); - } // end if + } // unload the next object unloadNext(); - } // end if + } - } // end if + } - } // end if, m_unloadingID + } -} // end doPushOutDocking +} // ------------------------------------------------------------------------------------------------ /** Iterate callback for the finding the first contained object */ @@ -444,7 +444,7 @@ static void getFirstContain( Object *obj, void *userData ) // assign this as the first object found *firstContain = obj; -} // end getFirstContain +} // ------------------------------------------------------------------------------------------------ /** Start the next object contained by us as "unloading and coming out" */ @@ -515,9 +515,9 @@ void RailedTransportDockUpdate::unloadNext( void ) if( m_unloadCount != UNLOAD_ALL ) --m_unloadCount; - } // end if + } -} // end unloadNext +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -528,7 +528,7 @@ void RailedTransportDockUpdate::crc( Xfer *xfer ) // extend base class DockUpdate::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -561,7 +561,7 @@ void RailedTransportDockUpdate::xfer( Xfer *xfer ) // unload count xfer->xferInt( &m_unloadCount ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -572,4 +572,4 @@ void RailedTransportDockUpdate::loadPostProcess( void ) // extend base class DockUpdate::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RepairDockUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RepairDockUpdate.cpp index c6d599d22be..555cb334f68 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RepairDockUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RepairDockUpdate.cpp @@ -42,7 +42,7 @@ RepairDockUpdateModuleData::RepairDockUpdateModuleData( void ) m_framesForFullHeal = 1.0f; // 1 frame, instant heal by default (keeps away from divide by 0's) -} // end RepairDockUpdateModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -59,7 +59,7 @@ RepairDockUpdateModuleData::RepairDockUpdateModuleData( void ) p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -74,14 +74,14 @@ RepairDockUpdate::RepairDockUpdate( Thing *thing, const ModuleData* moduleData ) m_lastRepair = INVALID_ID; m_healthToAddPerFrame = 0.0f; -} // end RepairDockUpdate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ RepairDockUpdate::~RepairDockUpdate( void ) { -} // end ~RepairDockUpdate +} // ------------------------------------------------------------------------------------------------ /** Do the action while docked @@ -120,7 +120,7 @@ Bool RepairDockUpdate::action( Object *docker, Object *drone ) // m_healthToAddPerFrame = (body->getMaxHealth() - body->getHealth()) / modData->m_framesForFullHeal; - } // end if + } // if we're at max health we're done if( body->getHealth() >= body->getMaxHealth() ) @@ -132,7 +132,7 @@ Bool RepairDockUpdate::action( Object *docker, Object *drone ) // returning false will complete the docking process return FALSE; - } // end if + } // give us some health buddy DamageInfo healingInfo; @@ -151,7 +151,7 @@ Bool RepairDockUpdate::action( Object *docker, Object *drone ) // stay docked return TRUE; -} // end action +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -162,7 +162,7 @@ void RepairDockUpdate::crc( Xfer *xfer ) // extend base class DockUpdate::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -186,7 +186,7 @@ void RepairDockUpdate::xfer( Xfer *xfer ) // health to add per frame xfer->xferReal( &m_healthToAddPerFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -197,4 +197,4 @@ void RepairDockUpdate::loadPostProcess( void ) // extend base class DockUpdate::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyCenterDockUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyCenterDockUpdate.cpp index 02aa586428d..26bbc126197 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyCenterDockUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyCenterDockUpdate.cpp @@ -60,7 +60,7 @@ SupplyCenterDockUpdateModuleData::SupplyCenterDockUpdateModuleData( void ) p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -184,7 +184,7 @@ void SupplyCenterDockUpdate::crc( Xfer *xfer ) // extend base class DockUpdate::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -202,7 +202,7 @@ void SupplyCenterDockUpdate::xfer( Xfer *xfer ) // extend base class DockUpdate::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -213,4 +213,4 @@ void SupplyCenterDockUpdate::loadPostProcess( void ) // extend base class DockUpdate::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyWarehouseDockUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyWarehouseDockUpdate.cpp index 9c502149982..873e33c8342 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyWarehouseDockUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyWarehouseDockUpdate.cpp @@ -62,7 +62,7 @@ SupplyWarehouseDockUpdateModuleData::SupplyWarehouseDockUpdateModuleData( void ) p.add(dataFieldParse); -} // end buildFieldParse +} // ------------------------------------------------------------------------------------------------ @@ -187,7 +187,7 @@ void SupplyWarehouseDockUpdate::crc( Xfer *xfer ) // extend base class DockUpdate::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -208,7 +208,7 @@ void SupplyWarehouseDockUpdate::xfer( Xfer *xfer ) // boxes stored xfer->xferInt( &m_boxesStored ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -226,4 +226,4 @@ void SupplyWarehouseDockUpdate::loadPostProcess( void ) if( draw ) draw->updateDrawableSupplyStatus( modData->m_startingBoxesData, m_boxesStored ); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicGeometryInfoUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicGeometryInfoUpdate.cpp index 0b10d0b422f..d725fad8f9b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicGeometryInfoUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicGeometryInfoUpdate.cpp @@ -129,7 +129,7 @@ UpdateSleepTime DynamicGeometryInfoUpdate::update( void ) m_started = TRUE; - } // end if + } // Either we've been running, or we just started right now. Doesn't matter. const DynamicGeometryInfoUpdateModuleData *data = getDynamicGeometryInfoUpdateModuleData(); @@ -171,16 +171,16 @@ UpdateSleepTime DynamicGeometryInfoUpdate::update( void ) m_finalMajorRadius = data->m_initialMajorRadius; m_finalMinorRadius = data->m_initialMinorRadius; - } // end if + } else { // no switch needed ... we're all done m_finished = TRUE; - } // end else + } - } // end if, time active is longer than transition time + } return UPDATE_SLEEP_NONE; } @@ -194,7 +194,7 @@ void DynamicGeometryInfoUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -251,7 +251,7 @@ void DynamicGeometryInfoUpdate::xfer( Xfer *xfer ) // final minor radius xfer->xferReal( &m_finalMinorRadius ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -262,4 +262,4 @@ void DynamicGeometryInfoUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp index 7445e59a735..b7934fe544d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp @@ -337,7 +337,7 @@ void DynamicShroudClearingRangeUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -378,7 +378,7 @@ void DynamicShroudClearingRangeUpdate::xfer( Xfer *xfer ) xfer->xferReal( &m_nativeClearingRange ); xfer->xferReal( &m_currentClearingRange ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -389,4 +389,4 @@ void DynamicShroudClearingRangeUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp index 08cb5644287..8d754fa1b04 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp @@ -365,7 +365,7 @@ void EMPUpdate::doDisableAttack( void ) void EMPUpdate::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -380,7 +380,7 @@ void EMPUpdate::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -388,7 +388,7 @@ void EMPUpdate::xfer( Xfer *xfer ) void EMPUpdate::loadPostProcess( void ) { -} // end loadPostProcess +} /// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -531,7 +531,7 @@ void LeafletDropBehavior::doDisableAttack( void ) void LeafletDropBehavior::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -548,7 +548,7 @@ void LeafletDropBehavior::xfer( Xfer *xfer ) xfer->xferUnsignedInt( &m_startFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -556,7 +556,7 @@ void LeafletDropBehavior::xfer( Xfer *xfer ) void LeafletDropBehavior::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EnemyNearUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EnemyNearUpdate.cpp index b6dc8cd7229..cc8cd4da39b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EnemyNearUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EnemyNearUpdate.cpp @@ -115,7 +115,7 @@ void EnemyNearUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -139,7 +139,7 @@ void EnemyNearUpdate::xfer( Xfer *xfer ) // enemy near xfer->xferBool( &m_enemyNear ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -150,4 +150,4 @@ void EnemyNearUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp index ed9b377512a..68921559bc0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp @@ -214,7 +214,7 @@ void FireOCLAfterWeaponCooldownUpdate::crc( Xfer *xfer ) // extend base class UpgradeMux::upgradeMuxCRC( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -244,7 +244,7 @@ void FireOCLAfterWeaponCooldownUpdate::xfer( Xfer *xfer ) // start frame xfer->xferUnsignedInt( &m_startFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -258,4 +258,4 @@ void FireOCLAfterWeaponCooldownUpdate::loadPostProcess( void ) // extend base class UpgradeMux::upgradeMuxLoadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireSpreadUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireSpreadUpdate.cpp index 529068a5793..7af491687e0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireSpreadUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireSpreadUpdate.cpp @@ -188,7 +188,7 @@ void FireSpreadUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -206,7 +206,7 @@ void FireSpreadUpdate::xfer( Xfer *xfer ) // extend base class UpdateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -217,4 +217,4 @@ void FireSpreadUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp index cce8ab80f95..321a27deb50 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp @@ -135,7 +135,7 @@ void FireWeaponUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -159,7 +159,7 @@ void FireWeaponUpdate::xfer( Xfer *xfer ) if ( version >= 2 ) xfer->xferUnsignedInt( &m_initialDelayFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -170,4 +170,4 @@ void FireWeaponUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FirestormDynamicGeometryInfoUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FirestormDynamicGeometryInfoUpdate.cpp index 7d96c316100..db6f3d6fa20 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FirestormDynamicGeometryInfoUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FirestormDynamicGeometryInfoUpdate.cpp @@ -155,9 +155,9 @@ UpdateSleepTime FirestormDynamicGeometryInfoUpdate::update( void ) sys->setPosition( &pos ); m_myParticleSystemID[ i ] = sys->getSystemID(); - } // end if + } - } // end for i + } // do the FX list FXList::doFXObj( modData->m_fxList, getObject() ); @@ -189,18 +189,18 @@ UpdateSleepTime FirestormDynamicGeometryInfoUpdate::update( void ) else if( type == ParticleSystemInfo::EmissionVolumeType::CYLINDER ) sys->setEmissionVolumeCylinderRadius( getObject()->getGeometryInfo().getMajorRadius() ); - } // end if + } else { // this system not found (it probably died)... stop trying to find it in the future m_myParticleSystemID[ i ] = INVALID_PARTICLE_SYSTEM_ID; - } // end else + } - } // end if + } - } // end for, i + } // when we first start running backward ... make a scorch mark if( m_switchedDirections == TRUE && m_scorchPlaced == FALSE ) @@ -209,7 +209,7 @@ UpdateSleepTime FirestormDynamicGeometryInfoUpdate::update( void ) TheGameClient->addScorch( getObject()->getPosition(), modData->m_scorchSize, SCORCH_1 ); m_scorchPlaced = TRUE; - } // end if + } // scan and do some damage every once in a while if( TheGameLogic->getFrame() - m_lastDamageFrame >= modData->m_delayBetweenDamageFrames ) @@ -218,7 +218,7 @@ UpdateSleepTime FirestormDynamicGeometryInfoUpdate::update( void ) doDamageScan(); m_lastDamageFrame = TheGameLogic->getFrame(); - } // end if + } return UPDATE_SLEEP_NONE; } @@ -263,11 +263,11 @@ void FirestormDynamicGeometryInfoUpdate::doDamageScan( void ) // do damage other->attemptDamage( &damageInfo ); - } // end for, other + } - } // end if, an boundingCircle radius exists + } -} // end doDamageScan +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -278,7 +278,7 @@ void FirestormDynamicGeometryInfoUpdate::crc( Xfer *xfer ) // extend base class DynamicGeometryInfoUpdate::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -308,7 +308,7 @@ void FirestormDynamicGeometryInfoUpdate::xfer( Xfer *xfer ) // last damage frame xfer->xferUnsignedInt( &m_lastDamageFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -319,4 +319,4 @@ void FirestormDynamicGeometryInfoUpdate::loadPostProcess( void ) // extend base class DynamicGeometryInfoUpdate::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp index e84371d8178..b2bc9ffd2db 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp @@ -276,7 +276,7 @@ void FlammableUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -312,7 +312,7 @@ void FlammableUpdate::xfer( Xfer *xfer ) // last flame damage dealt xfer->xferUnsignedInt( &m_lastFlameDamageDealt ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -323,4 +323,4 @@ void FlammableUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FloatUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FloatUpdate.cpp index 01724723b9d..d54554c6807 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FloatUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FloatUpdate.cpp @@ -49,7 +49,7 @@ FloatUpdateModuleData::FloatUpdateModuleData( void ) m_enabled = FALSE; -} // end FloatUpdateModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -65,7 +65,7 @@ FloatUpdateModuleData::FloatUpdateModuleData( void ) }; p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -80,14 +80,14 @@ FloatUpdate::FloatUpdate( Thing *thing, const ModuleData *moduleData ) // save our initial enabled status based on INI settings m_enabled = ((FloatUpdateModuleData *)moduleData)->m_enabled; -} // end FloatUpdate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ FloatUpdate::~FloatUpdate( void ) { -} // end ~FloatUpdate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -134,7 +134,7 @@ UpdateSleepTime FloatUpdate::update( void ) } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -145,7 +145,7 @@ void FloatUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -166,7 +166,7 @@ void FloatUpdate::xfer( Xfer *xfer ) // enabled xfer->xferBool( &m_enabled ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -177,4 +177,4 @@ void FloatUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HeightDieUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HeightDieUpdate.cpp index 3afc30cbd2b..39040095827 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HeightDieUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HeightDieUpdate.cpp @@ -55,7 +55,7 @@ HeightDieUpdateModuleData::HeightDieUpdateModuleData( void ) m_snapToGroundOnDeath = FALSE; m_initialDelay = 0; -} // end HeightDieUpdateModuleData +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -78,7 +78,7 @@ void HeightDieUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -97,14 +97,14 @@ HeightDieUpdate::HeightDieUpdate( Thing *thing, const ModuleData* moduleData ) m_earliestDeathFrame = UINT_MAX; // m_lastPosition = *thing->getPosition(); -} // end HeightDieUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- HeightDieUpdate::~HeightDieUpdate( void ) { -} // end ~HeightDieUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -128,7 +128,7 @@ UpdateSleepTime HeightDieUpdate::update( void ) // get outta here return UPDATE_SLEEP_NONE; - } // end if + } // get the module data const HeightDieUpdateModuleData *modData = getHeightDieUpdateModuleData(); @@ -146,7 +146,7 @@ UpdateSleepTime HeightDieUpdate::update( void ) if( pos->z >= m_lastPosition.z ) directionOK = FALSE; - } // end fi + } // get the terrain height Real terrainHeightAtPos = TheTerrainLogic->getGroundHeight( pos->x, pos->y ); @@ -203,7 +203,7 @@ UpdateSleepTime HeightDieUpdate::update( void ) if( thisHeight > tallestHeight ) tallestHeight = thisHeight; - } // end for obj + } // // our target height is either the height above the terrain as specified by the INI @@ -213,7 +213,7 @@ UpdateSleepTime HeightDieUpdate::update( void ) if( tallestHeight > modData->m_targetHeightAboveTerrain ) targetHeight = tallestHeight + terrainHeightAtPos; - } // end if + } // if we are below the target height ... DIE! if( pos->z < targetHeight && directionOK ) @@ -238,9 +238,9 @@ UpdateSleepTime HeightDieUpdate::update( void ) // we have died ... don't do this again m_hasDied = TRUE; - } // end if + } - } // end if + } // // if our height is below the destroy attached particles height above the terrain, clean @@ -255,14 +255,14 @@ UpdateSleepTime HeightDieUpdate::update( void ) // don't do this again m_particlesDestroyed = TRUE; - } // end if + } // save our current position as the last position we monitored m_lastPosition = *pos; return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -273,7 +273,7 @@ void HeightDieUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -307,7 +307,7 @@ void HeightDieUpdate::xfer( Xfer *xfer ) else m_earliestDeathFrame = 0; -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -318,4 +318,4 @@ void HeightDieUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp index 670678a344f..3c76df26090 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp @@ -94,7 +94,7 @@ HelicopterSlowDeathBehaviorModuleData::HelicopterSlowDeathBehaviorModuleData( vo m_delayFromGroundToFinalDeath = 0; m_maxBraking = 99999.0f; -} // end HelicopterSlowDeathBehaviorModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -137,7 +137,7 @@ HelicopterSlowDeathBehaviorModuleData::HelicopterSlowDeathBehaviorModuleData( vo p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// // Helicopter slow death update /////////////////////////////////////////////////////////////////// @@ -165,14 +165,14 @@ HelicopterSlowDeathBehavior::HelicopterSlowDeathBehavior( Thing *thing, const Mo m_bladeFlyOffFrame = 0; m_hitGroundFrame = 0; -} // end HelicopterSlowDeathBehavior +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- HelicopterSlowDeathBehavior::~HelicopterSlowDeathBehavior( void ) { -} // end ~HelicopterSlowDeathBehavior +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -250,27 +250,27 @@ void HelicopterSlowDeathBehavior::beginSlowDeath( const DamageInfo *damageInfo ) if( draw->getPristineBonePositions( modData->m_attachParticleBone.str(), 0, &pos, NULL, 1 ) ) pSys->setPosition( &pos ); - } // end if + } - } // end if + } else { // use location coord specified ... it will be zero if not given which is center of obj anyway pSys->setPosition( &modData->m_attachParticleLoc ); - } // end else + } // attach the particle system to the object pSys->attachToObject( getObject() ); - } // end if + } - } // end if + } -} // end beginSlowDeath +} @@ -328,9 +328,9 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) m_selfSpin = modData->m_maxSelfSpin; // cap at max m_selfSpinTowardsMax = FALSE; // now start changing spin towards min again - } // end if + } - } // end if + } else { @@ -342,14 +342,14 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) m_selfSpin = modData->m_minSelfSpin; // cap at min m_selfSpinTowardsMax = TRUE; // now start chaning spin towards max again - } // end if + } - } // end else + } // we have made a change to the self spinning m_lastSelfSpinUpdateFrame = TheGameLogic->getFrame(); - } // end if + } // get the physics update module PhysicsBehavior *physics = copter->getPhysics(); @@ -390,7 +390,7 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) draw->getPristineBonePositions( modData->m_bladeBone.str(), 0, &bladePos, NULL, 1 ); draw->convertBonePosToWorldPos( &bladePos, NULL, &bladePos, NULL ); - } // end if + } // create the blades flying through the air // const ObjectCreationList *ocl = TheObjectCreationListStore->findObjectCreationList( "OCL_ComancheBlades" ); @@ -408,11 +408,11 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) if( modData->m_oclEjectPilot && copter->getVeterancyLevel() > LEVEL_REGULAR ) EjectPilotDie::ejectPilot( modData->m_oclEjectPilot, copter, NULL ); - } // end if + } - } // endif + } - } // end if, not on ground + } @@ -465,7 +465,7 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) // Stop the sound from playing. TheAudio->removeAudioEvent(m_deathSound.getPlayingHandle()); - } // end if + } } // if we're on the ground, see if it's time for our final boom @@ -485,16 +485,16 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) rubble->setTransformMatrix( copter->getTransformMatrix() ); - } // end if + } // destroy the copter finally TheGameLogic->destroyObject( copter ); - } // end if + } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -505,7 +505,7 @@ void HelicopterSlowDeathBehavior::crc( Xfer *xfer ) // extend base class SlowDeathBehavior::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -547,7 +547,7 @@ void HelicopterSlowDeathBehavior::xfer( Xfer *xfer ) // hit ground frame xfer->xferUnsignedInt( &m_hitGroundFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -558,4 +558,4 @@ void HelicopterSlowDeathBehavior::loadPostProcess( void ) // extend base class SlowDeathBehavior::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp index d835a1ae729..758cdb490e1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp @@ -146,14 +146,14 @@ UpdateSleepTime HijackerUpdate::update( void ) } - }// end if (! hostVehicleHasEjection) + } setTargetObject( NULL ); setIsInVehicle( FALSE ); setUpdate( FALSE ); m_wasTargetAirborne = false; - }// end if( target ) + } } else // not in vehicle @@ -210,7 +210,7 @@ void HijackerUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -243,7 +243,7 @@ void HijackerUpdate::xfer( Xfer *xfer ) // was target airborne xfer->xferBool( &m_wasTargetAirborne ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -258,4 +258,4 @@ void HijackerUpdate::loadPostProcess( void ) Object *obj = TheGameLogic->findObjectByID( m_targetID ); setTargetObject( obj ); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp index a518a00ed73..c11bab3b160 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp @@ -213,7 +213,7 @@ void HordeUpdate::joinOrLeaveHorde(SimpleObjectIterator *iter, Bool join) else DEBUG_CRASH(( "HordeUpdate::joinOrLeaveHorde - We (%s) must have an AI to benefit from horde", getObject()->getTemplate()->getName().str() )); - } // end if + } } break; @@ -398,7 +398,7 @@ void HordeUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -422,7 +422,7 @@ void HordeUpdate::xfer( Xfer *xfer ) // has flag xfer->xferBool( &m_hasFlag ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -433,4 +433,4 @@ void HordeUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp index 781ac3d6e6c..130ba9f0b1a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp @@ -465,7 +465,7 @@ void LaserUpdate::crc( Xfer *xfer ) // extend base class ClientUpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -505,7 +505,7 @@ void LaserUpdate::xfer( Xfer *xfer ) xfer->xferAsciiString(&m_parentBoneName); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -516,4 +516,4 @@ void LaserUpdate::loadPostProcess( void ) // extend base class ClientUpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LifetimeUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LifetimeUpdate.cpp index f721b668f08..ef567bc3233 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LifetimeUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LifetimeUpdate.cpp @@ -101,7 +101,7 @@ void LifetimeUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -122,7 +122,7 @@ void LifetimeUpdate::xfer( Xfer *xfer ) // die frame xfer->xferUnsignedInt( &m_dieFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -133,4 +133,4 @@ void LifetimeUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp index fe9fa9d17e3..e1c641345f3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp @@ -295,7 +295,7 @@ void MissileLauncherBuildingUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -325,7 +325,7 @@ void MissileLauncherBuildingUpdate::xfer( Xfer *xfer ) // timeout frame xfer->xferUnsignedInt( &m_timeoutFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -336,4 +336,4 @@ void MissileLauncherBuildingUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MobMemberSlavedUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MobMemberSlavedUpdate.cpp index 53a7ab8703e..f513c6ba9a3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MobMemberSlavedUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MobMemberSlavedUpdate.cpp @@ -410,7 +410,7 @@ void MobMemberSlavedUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -452,7 +452,7 @@ void MobMemberSlavedUpdate::xfer( Xfer *xfer ) // catch up crisis timer xfer->xferUnsignedInt( &m_catchUpCrisisTimer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -463,4 +463,4 @@ void MobMemberSlavedUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cpp index 06d965504a0..0d3999b2c72 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cpp @@ -67,11 +67,11 @@ NeutronMissileSlowDeathBehaviorModuleData::NeutronMissileSlowDeathBehaviorModule m_blastInfo[ i ].toppleSpeed = 0.0f; m_blastInfo[ i ].pushForceMag = 0.0f; - } // end for i + } m_scorchSize = 0.0f; m_fxList = NULL; -} // end NeutronMissileSlowDeathBehaviorModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -180,7 +180,7 @@ NeutronMissileSlowDeathBehaviorModuleData::NeutronMissileSlowDeathBehaviorModule p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -201,16 +201,16 @@ NeutronMissileSlowDeathBehavior::NeutronMissileSlowDeathBehavior( Thing *thing, m_completedBlasts[ i ] = FALSE; m_completedScorchBlasts[ i ] = FALSE; - } // end for i + } -} // end NeutronMissileSlowDeathBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ NeutronMissileSlowDeathBehavior::~NeutronMissileSlowDeathBehavior( void ) { -} // end ~NeutronMissileSlowDeathBehavior +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -245,7 +245,7 @@ UpdateSleepTime NeutronMissileSlowDeathBehavior::update( void ) m_activationFrame = currFrame; FXList::doFXPos( modData->m_fxList, &pos ); - } // end if + } // see if it's time for any explosions for( Int i = 0; i < MAX_NEUTRON_BLASTS; i++ ) @@ -266,7 +266,7 @@ UpdateSleepTime NeutronMissileSlowDeathBehavior::update( void ) // mark this blast as complete now m_completedBlasts[ i ] = TRUE; - } // end if + } // has the time for a scorch blast come if( m_completedScorchBlasts[ i ] == FALSE && @@ -279,13 +279,13 @@ UpdateSleepTime NeutronMissileSlowDeathBehavior::update( void ) // mark this scorch blast as complete now m_completedScorchBlasts[ i ] = TRUE; - } // end if + } - } // end for i + } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** Do a single blast for the bomb */ @@ -356,7 +356,7 @@ void NeutronMissileSlowDeathBehavior::doBlast( const BlastInfo *blastInfo ) if( damageInfo.in.m_amount < blastInfo->minDamage ) damageInfo.in.m_amount = blastInfo->minDamage; - } // end else + } // do actual damage if( damageInfo.in.m_amount ) @@ -372,9 +372,9 @@ void NeutronMissileSlowDeathBehavior::doBlast( const BlastInfo *blastInfo ) TheGameClient->addScorch( missilePos, modData->m_scorchSize, SCORCH_1 ); m_scorchPlaced = TRUE; - } // end if + } - } // end if + } /* // apply a small force to the object from the shockwave center @@ -397,14 +397,14 @@ void NeutronMissileSlowDeathBehavior::doBlast( const BlastInfo *blastInfo ) // apply the force physics->applyForce( &physicsForce ); - } // end if, physics + } */ - } // end for, other + } - } // end if, an outer radius exists + } -} // end doBlast +} // ------------------------------------------------------------------------------------------------ /** Do a scorch blast event ... this doesn't do actual damage, but it "scorches" things */ @@ -453,13 +453,13 @@ void NeutronMissileSlowDeathBehavior::doScorchBlast( const BlastInfo *blastInfo if( draw ) draw->setShadowsEnabled( FALSE ); - } // end if + } - } // end for, other + } - } // end if, outer radius exists + } -} // end doScorchBlast +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -470,7 +470,7 @@ void NeutronMissileSlowDeathBehavior::crc( Xfer *xfer ) // extend base class SlowDeathBehavior::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -500,7 +500,7 @@ void NeutronMissileSlowDeathBehavior::xfer( Xfer *xfer ) DEBUG_CRASH(( "NeutronMissileSlowDeathBehavior::xfer - Size of MAX_NEUTRON_BLASTS has changed, you must version this xfer code and then you can remove this error message" )); throw SC_INVALID_DATA; - } // end if + } // completed blasts UnsignedByte i; @@ -514,7 +514,7 @@ void NeutronMissileSlowDeathBehavior::xfer( Xfer *xfer ) // scorch placed xfer->xferBool( &m_scorchPlaced ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -525,4 +525,4 @@ void NeutronMissileSlowDeathBehavior::loadPostProcess( void ) // extend base class SlowDeathBehavior::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileUpdate.cpp index 19a7c09ee0c..44d1a83f931 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileUpdate.cpp @@ -538,7 +538,7 @@ void NeutronMissileUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -622,13 +622,13 @@ void NeutronMissileUpdate::xfer( Xfer *xfer ) DEBUG_CRASH(( "NeutronMissileUpdate::xfer - Unable to find particle system '%s'", name.str() )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } - } // end if + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -639,4 +639,4 @@ void NeutronMissileUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp index 15848d5192e..e8e5d1346f1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp @@ -72,7 +72,7 @@ void parseFactionObjectCreationList( INI *ini, void *instance, void *store, cons OCLUpdateModuleData::FactionOCLList * theList = (OCLUpdateModuleData::FactionOCLList*)store; theList->push_back(info); -} // end parseFactionObjectCreationList +} //------------------------------------------------------------------------------------------------- OCLUpdateModuleData::OCLUpdateModuleData() @@ -287,7 +287,7 @@ void OCLUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -317,7 +317,7 @@ void OCLUpdate::xfer( Xfer *xfer ) // current owning player color xfer->xferInt( &m_currentPlayerColor ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -328,4 +328,4 @@ void OCLUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp index 0fa1d31edad..359874cc9c3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp @@ -1389,7 +1389,7 @@ void ParticleUplinkCannonUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1518,7 +1518,7 @@ void ParticleUplinkCannonUpdate::xfer( Xfer *xfer ) m_orbitToTargetLaserRadius.xfer( xfer ); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1552,4 +1552,4 @@ void ParticleUplinkCannonUpdate::loadPostProcess( void ) } #endif -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp index b126820f9c9..e13f5fbe5d3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp @@ -815,7 +815,7 @@ UpdateSleepTime PhysicsBehavior::update() { obj->setTransformMatrix(&mtx); } - } // if not held + } // reset the acceleration for accumulation next frame m_accel.zero(); @@ -1760,7 +1760,7 @@ Bool PhysicsBehavior::checkForOverlapCollision(Object *other) crusheeOther->attemptDamage( &damageInfo ); } - } // if crushable + } return true; } @@ -1820,7 +1820,7 @@ void PhysicsBehavior::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1900,7 +1900,7 @@ void PhysicsBehavior::xfer( Xfer *xfer ) // mag of current vel xfer->xferReal( &m_velMag ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1911,4 +1911,4 @@ void PhysicsBehavior::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PilotFindVehicleUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PilotFindVehicleUpdate.cpp index 43e6d72f6c2..fcf555c705c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PilotFindVehicleUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PilotFindVehicleUpdate.cpp @@ -190,7 +190,7 @@ void PilotFindVehicleUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -211,7 +211,7 @@ void PilotFindVehicleUpdate::xfer( Xfer *xfer ) // did move to base xfer->xferBool( &m_didMoveToBase ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -222,4 +222,4 @@ void PilotFindVehicleUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp index 630d280cefe..e1424a2da39 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp @@ -328,7 +328,7 @@ Object* PointDefenseLaserUpdate::scanClosestTarget() bestTargetOutOfRange[index] = other; } } - } // end for, other + } if( bestTargetInRange[ 0 ] ) { @@ -377,7 +377,7 @@ void PointDefenseLaserUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -407,7 +407,7 @@ void PointDefenseLaserUpdate::xfer( Xfer *xfer ) // next shot available in frames xfer->xferInt( &m_nextShotAvailableInFrames ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -418,4 +418,4 @@ void PointDefenseLaserUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PowerPlantUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PowerPlantUpdate.cpp index 9af725da7d9..2ebb32b23d2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PowerPlantUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PowerPlantUpdate.cpp @@ -46,7 +46,7 @@ PowerPlantUpdateModuleData::PowerPlantUpdateModuleData( void ) m_rodsExtendTime = 0; -} // end PowerPlantUpdateModuleData +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -61,14 +61,14 @@ PowerPlantUpdate::PowerPlantUpdate( Thing *thing, const ModuleData *moduleData ) m_extended = FALSE; setWakeFrame(getObject(), UPDATE_SLEEP_FOREVER); -} // end PowerPlantUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- PowerPlantUpdate::~PowerPlantUpdate( void ) { -} // end PowerPlantUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -101,7 +101,7 @@ void PowerPlantUpdate::extendRods( Bool extend ) setWakeFrame(getObject(), UPDATE_SLEEP_FOREVER); } -} // end PowerPlantUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -115,7 +115,7 @@ UpdateSleepTime PowerPlantUpdate::update( void ) m_extended = TRUE; return UPDATE_SLEEP_FOREVER; -} // end update +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -126,7 +126,7 @@ void PowerPlantUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -147,7 +147,7 @@ void PowerPlantUpdate::xfer( Xfer *xfer ) // extend complete xfer->xferBool( &m_extended ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -158,4 +158,4 @@ void PowerPlantUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/DefaultProductionExitUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/DefaultProductionExitUpdate.cpp index 4783455df1b..7c9dea87d5a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/DefaultProductionExitUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/DefaultProductionExitUpdate.cpp @@ -186,7 +186,7 @@ void DefaultProductionExitUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -210,7 +210,7 @@ void DefaultProductionExitUpdate::xfer( Xfer *xfer ) // rally point exists xfer->xferBool( &m_rallyPointExists ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -221,4 +221,4 @@ void DefaultProductionExitUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp index f01bb5d0a6f..34fefceea99 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp @@ -306,7 +306,7 @@ void QueueProductionExitUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -339,7 +339,7 @@ void QueueProductionExitUpdate::xfer( Xfer *xfer ) // current burst count xfer->xferUnsignedInt( &m_currentBurstCount ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -350,4 +350,4 @@ void QueueProductionExitUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SpawnPointProductionExitUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SpawnPointProductionExitUpdate.cpp index 71fe264075b..136c5a89f4e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SpawnPointProductionExitUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SpawnPointProductionExitUpdate.cpp @@ -197,7 +197,7 @@ void SpawnPointProductionExitUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -227,7 +227,7 @@ void SpawnPointProductionExitUpdate::xfer( Xfer *xfer ) // spawn point occupants xfer->xferUser( &m_spawnPointOccupier, sizeof( ObjectID ) * MAX_SPAWN_POINTS ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -238,4 +238,4 @@ void SpawnPointProductionExitUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SupplyCenterProductionExitUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SupplyCenterProductionExitUpdate.cpp index cf513263ff0..a54de4dc730 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SupplyCenterProductionExitUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SupplyCenterProductionExitUpdate.cpp @@ -210,7 +210,7 @@ void SupplyCenterProductionExitUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -234,7 +234,7 @@ void SupplyCenterProductionExitUpdate::xfer( Xfer *xfer ) // rally point exists xfer->xferBool( &m_rallyPointExists ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -245,4 +245,4 @@ void SupplyCenterProductionExitUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp index 04ebe32fcc6..37a5ee02bce 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp @@ -163,14 +163,14 @@ ProductionEntry::ProductionEntry( void ) m_productionQuantityProduced = 0; m_productionQuantityTotal = 0; // -} // end ProductionEntry +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- ProductionEntry::~ProductionEntry( void ) { -} // end ~ProductionEntry +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -199,7 +199,7 @@ ProductionUpdate::ProductionUpdate( Thing *thing, const ModuleData* moduleData ) m_flagsDirty = FALSE; m_specialPowerConstructionCommandButton = NULL; -} // end ProductionUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -216,9 +216,9 @@ ProductionUpdate::~ProductionUpdate( void ) // TheSuperHackers @fix Mauller 13/04/2025 Delete instance of production item deleteInstance(production); - } // end while + } -} // end ~ProductionUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -321,7 +321,7 @@ Bool ProductionUpdate::queueUpgrade( const UpgradeTemplate *upgrade ) return TRUE; // queued -} // end queueUpgrade +} //------------------------------------------------------------------------------------------------- /** Cancel an upgrade being produced here */ @@ -352,7 +352,7 @@ void ProductionUpdate::cancelUpgrade( const UpgradeTemplate *upgrade ) production->m_upgradeToResearch == upgrade ) break; - } // end for + } // sanity, entry not found if( production == NULL ) @@ -375,7 +375,7 @@ void ProductionUpdate::cancelUpgrade( const UpgradeTemplate *upgrade ) if( upgrade->getUpgradeType() == UPGRADE_TYPE_PLAYER ) player->removeUpgrade( upgrade ); -} // end cancelUpgrade +} //------------------------------------------------------------------------------------------------- /** Queue the prodcution of a unit. Returns TRUE if unit was added to queue, FALSE if it @@ -456,7 +456,7 @@ Bool ProductionUpdate::queueCreateUnit( const ThingTemplate *unitType, Productio return TRUE; // unit queued -} // end queueMakeUnit +} //------------------------------------------------------------------------------------------------- /** Cancel the construction of the unit with the matching production ID */ @@ -486,11 +486,11 @@ void ProductionUpdate::cancelUnitCreate( ProductionID productionID ) return; - } // end if + } - } // end for + } -} // end cancelUnitCreate +} //------------------------------------------------------------------------------------------------- /** Cancel all production of type unitType */ @@ -515,18 +515,18 @@ void ProductionUpdate::cancelAllUnitsOfType( const ThingTemplate *unitType) // advance production = temp; - } // end if + } else { // advance production = production->m_next; - } // end else + } - } // end for + } -} // end cancelAllUnitsOfType +} //------------------------------------------------------------------------------------------------- /** Update the door behavior */ @@ -560,9 +560,9 @@ void ProductionUpdate::updateDoors() m_setFlags.set( theWaitingOpenFlags[i] ); m_flagsDirty = TRUE; - } // end if + } - } // end if + } else if( m_doors[i].m_doorWaitOpenFrame ) { @@ -580,9 +580,9 @@ void ProductionUpdate::updateDoors() m_setFlags.set( theClosingFlags[i] ); m_flagsDirty = TRUE; - } // end if + } - } // end if + } else if( m_doors[i].m_doorClosedFrame && !m_doors[i].m_holdOpen ) { @@ -597,9 +597,9 @@ void ProductionUpdate::updateDoors() m_setFlags.set( theClosingFlags[i], false ); m_flagsDirty = TRUE; - } // end if + } - } // end else if + } } } @@ -635,9 +635,9 @@ UpdateSleepTime ProductionUpdate::update( void ) m_setFlags.set( MODELCONDITION_CONSTRUCTION_COMPLETE, false ); m_flagsDirty = TRUE; - } // end if + } - } // end if + } // if we have dirty bits that need to be set and cleared, do it here all at once if( m_flagsDirty == TRUE ) @@ -652,7 +652,7 @@ UpdateSleepTime ProductionUpdate::update( void ) m_setFlags.clear(); m_flagsDirty = FALSE; - } // end if + } // if nothing in the queue get outta here if( production == NULL ) @@ -683,7 +683,7 @@ UpdateSleepTime ProductionUpdate::update( void ) return UPDATE_SLEEP_NONE; - } // end if + } // // you can disallow types of units on the fly in scripts, so if there is something @@ -700,9 +700,9 @@ UpdateSleepTime ProductionUpdate::update( void ) cancelUnitCreate(production->getProductionID()); return UPDATE_SLEEP_NONE; - } // end if + } - } // end if + } // increase the frames we've been under production for production->m_framesUnderConstruction++; @@ -772,14 +772,14 @@ UpdateSleepTime ProductionUpdate::update( void ) m_setFlags.set( theOpeningFlags[exitDoor] ); m_flagsDirty = TRUE; - } // end if + } // if the door is waiting-open, keep it there else if( door->m_doorWaitOpenFrame != 0 ) { door->m_doorWaitOpenFrame = now; - } // end else if + } // if the door is closing, for now, pop it to waiting open else if( door->m_doorClosedFrame != 0 ) { @@ -794,9 +794,9 @@ UpdateSleepTime ProductionUpdate::update( void ) m_setFlags.set( theWaitingOpenFlags[exitDoor] ); m_flagsDirty = TRUE; - } // end else + } - } // end if, has door animation + } // we now go into the construction complete condition for a while if( m_constructionCompleteFrame == 0 ) @@ -806,7 +806,7 @@ UpdateSleepTime ProductionUpdate::update( void ) m_setFlags.set( MODELCONDITION_CONSTRUCTION_COMPLETE ); m_flagsDirty = TRUE; - } // end if + } // // make a new object, note that for production buildings that have door @@ -859,11 +859,11 @@ UpdateSleepTime ProductionUpdate::update( void ) // This is last so the voice check can easily check for "first" guy production->oneProductionSuccessful(); - } // end if, door open or no door animation ... make the object + } - } // end, if we got a door reservation + } - } //end of trying to exit all the things we were planning on attempting + } if( production->getProductionQuantityRemaining() == 0 ) { @@ -874,7 +874,7 @@ UpdateSleepTime ProductionUpdate::update( void ) deleteInstance(production); } - } // end if we found an exit interface + } else { @@ -889,9 +889,9 @@ UpdateSleepTime ProductionUpdate::update( void ) // delete the production entry deleteInstance(production); - } // end else + } - } // end if, production unit + } else if( production->m_type == PRODUCTION_UPGRADE ) { const UpgradeTemplate *upgrade = production->m_upgradeToResearch; @@ -937,7 +937,7 @@ UpdateSleepTime ProductionUpdate::update( void ) sound.setObjectID( us->getID() ); TheAudio->addAudioEvent( &sound ); - } // end if + } // update the upgrade status in the player or give the upgrade to the object if( upgrade->getUpgradeType() == UPGRADE_TYPE_PLAYER ) @@ -976,12 +976,12 @@ UpdateSleepTime ProductionUpdate::update( void ) // delete the production entry deleteInstance(production); - } // end else, production upgrade + } - } // end if, production is 100% complete + } return UPDATE_SLEEP_NONE; -} // end update +} //------------------------------------------------------------------------------------------------- /** Add the production entry to the *END* of the production queue list */ @@ -1000,7 +1000,7 @@ void ProductionUpdate::addToProductionQueue( ProductionEntry *production ) m_productionQueueTail->m_next = production; production->m_prev = m_productionQueueTail; - } // end if + } // this production entry is now the new tail at the end of the list m_productionQueueTail = production; @@ -1020,11 +1020,11 @@ void ProductionUpdate::addToProductionQueue( ProductionEntry *production ) m_setFlags.set( MODELCONDITION_ACTIVELY_CONSTRUCTING ); m_flagsDirty = TRUE; - } // end if + } - } // end if + } -} // end addToProductionQueue +} //------------------------------------------------------------------------------------------------- /** Remove the production entry from the production queue list */ @@ -1069,9 +1069,9 @@ void ProductionUpdate::removeFromProductionQueue( ProductionEntry *production ) m_setFlags.set( MODELCONDITION_ACTIVELY_CONSTRUCTING, false ); m_flagsDirty = TRUE; - } // end if + } - } // end if + } /* // Debugging @@ -1089,7 +1089,7 @@ void ProductionUpdate::removeFromProductionQueue( ProductionEntry *production ) } */ -} // end removeFromProductionQueue +} //------------------------------------------------------------------------------------------------- /** Is the upgrade already in the production queue. Note that you can only have one @@ -1106,7 +1106,7 @@ Bool ProductionUpdate::isUpgradeInQueue( const UpgradeTemplate *upgrade ) const return FALSE; // not in queue -} // end isUpgradeInQueue +} // ------------------------------------------------------------------------------------------------ /** count number of units with matching unit type in the production queue */ @@ -1123,7 +1123,7 @@ UnsignedInt ProductionUpdate::countUnitTypeInQueue( const ThingTemplate *unitTyp return count; -} // end countUnitTypeInQueue +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1156,10 +1156,10 @@ void ProductionUpdate::cancelAndRefundAllProduction( void ) // unknown production type DEBUG_CRASH(( "ProductionUpdate::cancelAndRefundAllProduction - Unknown production type '%d'", m_productionQueue->getProductionType() )); return; - } // end else - } // end if + } + } } -} // end cancelAndRefundAllProduction +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1197,13 +1197,13 @@ void ProductionUpdate::setHoldDoorOpen(ExitDoorType exitDoor, Bool holdIt) if( pui ) return pui; - } // end for, bmi + } // interface not found return NULL; -} // end getProductionUpdateInterfaceFromObject +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -1214,7 +1214,7 @@ void ProductionUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1276,9 +1276,9 @@ void ProductionUpdate::xfer( Xfer *xfer ) // exit door xfer->xferInt( (Int*)&production->m_exitDoor ); - } // end for + } - } // end if, save + } else { AsciiString name; @@ -1290,7 +1290,7 @@ void ProductionUpdate::xfer( Xfer *xfer ) DEBUG_CRASH(( "ProductionUpdate::xfer - m_productionQueue is not empty, but should be" )); throw SC_INVALID_DATA; - } // end if + } // read each element for( UnsignedShort i = 0; i < productionCount; ++i ) @@ -1310,7 +1310,7 @@ void ProductionUpdate::xfer( Xfer *xfer ) m_productionQueueTail->m_next = production; production->m_prev = m_productionQueueTail; - } // end if + } // this production entry is now the new tail at the end of the list m_productionQueueTail = production; @@ -1330,9 +1330,9 @@ void ProductionUpdate::xfer( Xfer *xfer ) DEBUG_CRASH(( "ProductionUpdate::xfer - Cannot find template '%s'", name.str() )); throw SC_INVALID_DATA; - } // end if + } - } // end if, unit production + } else { @@ -1343,9 +1343,9 @@ void ProductionUpdate::xfer( Xfer *xfer ) DEBUG_CRASH(( "ProductionUpdate::xfer - Cannot find upgrade '%s'", name.str() )); throw SC_INVALID_DATA; - } // end if + } - } // end else, upgrade production + } // production ID xfer->xferUser( &production->m_productionID, sizeof( ProductionID ) ); @@ -1365,9 +1365,9 @@ void ProductionUpdate::xfer( Xfer *xfer ) // exit door xfer->xferInt( (Int*)&production->m_exitDoor ); - } // end for, i + } - } // end else, load + } // unique id xfer->xferUser( &m_uniqueID, sizeof( ProductionID ) ); @@ -1390,7 +1390,7 @@ void ProductionUpdate::xfer( Xfer *xfer ) // flags dirty xfer->xferBool( &m_flagsDirty ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1401,4 +1401,4 @@ void ProductionUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProjectileStreamUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProjectileStreamUpdate.cpp index 8cafa97a56f..8b237f7b529 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProjectileStreamUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProjectileStreamUpdate.cpp @@ -216,7 +216,7 @@ void ProjectileStreamUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -254,7 +254,7 @@ void ProjectileStreamUpdate::xfer( Xfer *xfer ) xfer->xferCoord3D( &m_targetPosition ); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -265,4 +265,4 @@ void ProjectileStreamUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProneUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProneUpdate.cpp index aef5a330874..965cc60a928 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProneUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProneUpdate.cpp @@ -127,7 +127,7 @@ void ProneUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -148,7 +148,7 @@ void ProneUpdate::xfer( Xfer *xfer ) // prone frames xfer->xferInt( &m_proneFrames ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -159,5 +159,5 @@ void ProneUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/RadarUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/RadarUpdate.cpp index 7a40bb6c9f3..0df3fb5d373 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/RadarUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/RadarUpdate.cpp @@ -44,7 +44,7 @@ RadarUpdateModuleData::RadarUpdateModuleData( void ) m_radarExtendTime = 0.0f; -} // end RadarUpdateModuleData +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -60,14 +60,14 @@ RadarUpdate::RadarUpdate( Thing *thing, const ModuleData *moduleData ) m_extendDoneFrame = 0; m_extendComplete = FALSE; -} // end RadarUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- RadarUpdate::~RadarUpdate( void ) { -} // end RadarUpdate +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -86,7 +86,7 @@ void RadarUpdate::extendRadar( void ) //Change this to make the radar active after extension... m_radarActive = true; -} // end extendRadar +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -116,11 +116,11 @@ UpdateSleepTime RadarUpdate::update( void ) draw->clearAndSetModelConditionState( MODELCONDITION_RADAR_EXTENDING, MODELCONDITION_RADAR_UPGRADED ); - } // end if + } return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -131,7 +131,7 @@ void RadarUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -158,7 +158,7 @@ void RadarUpdate::xfer( Xfer *xfer ) // radar active xfer->xferBool( &m_radarActive ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -169,5 +169,5 @@ void RadarUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/RadiusDecalUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/RadiusDecalUpdate.cpp index 5ec8773e7e3..240096c1d55 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/RadiusDecalUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/RadiusDecalUpdate.cpp @@ -90,7 +90,7 @@ void RadiusDecalUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -113,7 +113,7 @@ void RadiusDecalUpdate::xfer( Xfer *xfer ) xfer->xferBool(&m_killWhenNoLongerAttacking); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -124,4 +124,4 @@ void RadiusDecalUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp index 781f08954af..ecac7d8c51c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp @@ -754,7 +754,7 @@ void SlavedUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -787,7 +787,7 @@ void SlavedUpdate::xfer( Xfer *xfer ) // repairing xfer->xferBool( &m_repairing ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -798,5 +798,5 @@ void SlavedUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SmartBombTargetHomingUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SmartBombTargetHomingUpdate.cpp index 6cc2bf70e92..af4de02c9a2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SmartBombTargetHomingUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SmartBombTargetHomingUpdate.cpp @@ -119,7 +119,7 @@ void SmartBombTargetHomingUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -138,7 +138,7 @@ void SmartBombTargetHomingUpdate::xfer( Xfer *xfer ) UpdateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -149,4 +149,4 @@ void SmartBombTargetHomingUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp index a02c0c15a15..052f912ad05 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp @@ -1997,7 +1997,7 @@ void SpecialAbilityUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -2060,7 +2060,7 @@ void SpecialAbilityUpdate::xfer( Xfer *xfer ) // capture flash phase xfer->xferReal( &m_captureFlashPhase ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -2071,4 +2071,4 @@ void SpecialAbilityUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialPowerUpdateModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialPowerUpdateModule.cpp index a53d21d91d4..daeb46a355b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialPowerUpdateModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialPowerUpdateModule.cpp @@ -85,7 +85,7 @@ void SpecialPowerUpdateModule::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} //------------------------------------------------------------------------------------------------ /** Xfer method @@ -102,7 +102,7 @@ void SpecialPowerUpdateModule::xfer( Xfer *xfer ) // extend base class UpdateModule::xfer( xfer ); -} // end xfer +} //------------------------------------------------------------------------------------------------ /** Load post process */ @@ -113,4 +113,4 @@ void SpecialPowerUpdateModule::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipDeploymentUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipDeploymentUpdate.cpp index f070493f514..2b52bfe668c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipDeploymentUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipDeploymentUpdate.cpp @@ -296,7 +296,7 @@ void SpectreGunshipDeploymentUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -316,7 +316,7 @@ void SpectreGunshipDeploymentUpdate::xfer( Xfer *xfer ) UpdateModule::xfer( xfer ); xfer->xferObjectID( &m_gunshipID ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -326,4 +326,4 @@ void SpectreGunshipDeploymentUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipUpdate.cpp index 1dbdaca4340..9205b1c68c3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipUpdate.cpp @@ -487,7 +487,7 @@ UpdateSleepTime SpectreGunshipUpdate::update() } - } // endif status == ORBITING || INSERTING + } if ( m_status == GUNSHIP_STATUS_ORBITING ) @@ -504,7 +504,7 @@ UpdateSleepTime SpectreGunshipUpdate::update() disengageAndDepartAO( gunship ); - }//endif escapeframe + } else { @@ -608,7 +608,7 @@ UpdateSleepTime SpectreGunshipUpdate::update() } - }//endif frame modulator + } @@ -662,10 +662,10 @@ UpdateSleepTime SpectreGunshipUpdate::update() } } - }// end else + } - }//not orbiting + } else if ( m_status == GUNSHIP_STATUS_DEPARTING ) { if ( isPointOffMap( *gunship->getPosition() ) ) @@ -681,7 +681,7 @@ UpdateSleepTime SpectreGunshipUpdate::update() } } - } // endif gunship + } else if ( m_status != GUNSHIP_STATUS_IDLE ) { //OH MY GOODNESS, THE GUNSHIP MUST HAVE GOTTEN SHOT DOWN! @@ -845,7 +845,7 @@ void SpectreGunshipUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -899,7 +899,7 @@ void SpectreGunshipUpdate::xfer( Xfer *xfer ) xfer->xferObjectID( &m_gattlingID ); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -910,4 +910,4 @@ void SpectreGunshipUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpyVisionUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpyVisionUpdate.cpp index 89987ceaff9..1dccc75c9fc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpyVisionUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpyVisionUpdate.cpp @@ -233,7 +233,7 @@ void SpyVisionUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -262,7 +262,7 @@ void SpyVisionUpdate::xfer( Xfer *xfer ) xfer->xferUnsignedInt( &m_disabledUntilFrame ); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -273,4 +273,4 @@ void SpyVisionUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp index eb3973f0d0a..99bac7d88ea 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp @@ -255,9 +255,9 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) { TheEva->setShouldPlay( message ); } - } // end if + } - } // end if + } // for the unit being revealed, do some UI feedback if( ThePlayerList->getLocalPlayer() == them->getControllingPlayer() && @@ -291,11 +291,11 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) { TheEva->setShouldPlay( message ); } - } // end if + } - } // end if + } - } // end if, them was not previously detected + } // updateRate PLUS 1 is necessary to ensure it stays detected 'till we are called again... stealth->markAsDetected(data->m_updateRate + 1); @@ -326,7 +326,7 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) } } - }//end if them has stealthupdate + } else // perhaps they are garrisoning something stealthy, eh? { ContainModuleInterface *contain = them->getContain(); @@ -413,7 +413,7 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) } - } // end if doIRFX + } return UPDATE_SLEEP(data->m_updateRate); @@ -429,7 +429,7 @@ void StealthDetectorUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -450,7 +450,7 @@ void StealthDetectorUpdate::xfer( Xfer *xfer ) // enabled xfer->xferBool( &m_enabled ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -461,4 +461,4 @@ void StealthDetectorUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp index f4c3feae1e1..81aa722ebb2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp @@ -607,7 +607,7 @@ UpdateSleepTime StealthUpdate::update( void ) if( wasHidden && draw ) draw->setDrawableHidden( TRUE ); - } // end if + } Object *self = getObject(); Object *stealthOwner = calcStealthOwner(); @@ -1132,7 +1132,7 @@ void StealthUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -1185,11 +1185,11 @@ void StealthUpdate::xfer( Xfer *xfer ) DEBUG_CRASH(( "StealthUpdate::xfer - Unknown template '%s'", name.str() )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } - } // end if + } // disguise transition frames xfer->xferUnsignedInt( &m_disguiseTransitionFrames ); @@ -1208,7 +1208,7 @@ void StealthUpdate::xfer( Xfer *xfer ) xfer->xferUnsignedInt( &m_framesGranted ); } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1229,4 +1229,4 @@ void StealthUpdate::loadPostProcess( void ) if( isDisguised() ) m_xferRestoreDisguise = TRUE; -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp index 110845f66ad..6204fe6aa5e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp @@ -294,7 +294,7 @@ void StickyBombUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -321,7 +321,7 @@ void StickyBombUpdate::xfer( Xfer *xfer ) //Next frame that a ping sound will play. xfer->xferUnsignedInt( &m_nextPingFrame ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -332,4 +332,4 @@ void StickyBombUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp index a526289b16c..fad84d6aafa 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp @@ -361,7 +361,7 @@ void StructureCollapseUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -394,7 +394,7 @@ void StructureCollapseUpdate::xfer( Xfer *xfer ) // current height xfer->xferReal( &m_currentHeight ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -405,4 +405,4 @@ void StructureCollapseUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp index 9e628d2de3d..a2dac82fd43 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp @@ -571,7 +571,7 @@ void StructureToppleUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -616,7 +616,7 @@ void StructureToppleUpdate::xfer( Xfer *xfer ) // delay burst location xfer->xferCoord3D( &m_delayBurstLocation ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -627,4 +627,4 @@ void StructureToppleUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/TensileFormationUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/TensileFormationUpdate.cpp index 17ec5d81a78..b5c5495a877 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/TensileFormationUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/TensileFormationUpdate.cpp @@ -88,7 +88,7 @@ TensileFormationUpdateModuleData::TensileFormationUpdateModuleData( void ) m_enabled = FALSE; -} // end TensileFormationUpdateModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -105,7 +105,7 @@ TensileFormationUpdateModuleData::TensileFormationUpdateModuleData( void ) }; p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -149,14 +149,14 @@ TensileFormationUpdate::TensileFormationUpdate( Thing *thing, const ModuleData * -} // end TensileFormationUpdate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ TensileFormationUpdate::~TensileFormationUpdate( void ) { -} // end ~TensileFormationUpdate +} @@ -374,7 +374,7 @@ UpdateSleepTime TensileFormationUpdate::update( void ) return UPDATE_SLEEP_NONE; -} // end update +} @@ -440,7 +440,7 @@ void TensileFormationUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -461,7 +461,7 @@ void TensileFormationUpdate::xfer( Xfer *xfer ) // enabled xfer->xferBool( &m_enabled ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -472,4 +472,4 @@ void TensileFormationUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp index c76d7dbae21..d5ae658c0f1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp @@ -330,7 +330,7 @@ UpdateSleepTime ToppleUpdate::update() obj->setOrientation(obj->getOrientation()); } - } // if kill when toppled + } if (d->m_killStumpWhenToppled) { @@ -403,7 +403,7 @@ void ToppleUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -451,7 +451,7 @@ void ToppleUpdate::xfer( Xfer *xfer ) // stump id xfer->xferObjectID( &m_stumpID ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -462,4 +462,4 @@ void ToppleUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/UpdateModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/UpdateModule.cpp index f86893de2b3..6509fb22a5e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/UpdateModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/UpdateModule.cpp @@ -92,7 +92,7 @@ void UpdateModule::crc( Xfer *xfer ) // extend base class BehaviorModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -178,7 +178,7 @@ void UpdateModule::xfer( Xfer *xfer ) m_indexInLogic = -1; } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -189,7 +189,7 @@ void UpdateModule::loadPostProcess( void ) // extned base class BehaviorModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp index a6968336613..5cc52daca66 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp @@ -74,7 +74,7 @@ WaveGuideUpdateModuleData::WaveGuideUpdateModuleData( void ) m_damageAmount = 0.0f; m_toppleForce = 0.0f; -} // end WaveGuideUpdateModuleData +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -106,7 +106,7 @@ WaveGuideUpdateModuleData::WaveGuideUpdateModuleData( void ) p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -138,16 +138,16 @@ WaveGuideUpdate::WaveGuideUpdate( Thing *thing, const ModuleData *moduleData ) for( Int j = 0; j < MAX_SHAPE_EFFECTS; j++ ) m_shapeEffects[ i ][ j ] = INVALID_PARTICLE_SYSTEM_ID; - } // end for i + } -} // end WaveGuideUpdate +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ WaveGuideUpdate::~WaveGuideUpdate( void ) { -} // end ~WaveGuideUpdate +} // ------------------------------------------------------------------------------------------------ /** Start the waveguide moving along its waypoint path, bringing water destruction and havok @@ -182,7 +182,7 @@ Bool WaveGuideUpdate::startMoving( void ) DEBUG_CRASH(( "WaveGuideUpdate::startMoving - The waypoint path cannot have multiple link choices at any node" )); return FALSE; - } // end if + } // set our destination location to this waypoint position m_finalDestination = *verify->getLocation(); @@ -190,7 +190,7 @@ Bool WaveGuideUpdate::startMoving( void ) // on to the next verify = verify->getLink( 0 ); - } // end while + } // there must be at least one link Waypoint *next = waypoint->getLink( 0 ); @@ -200,7 +200,7 @@ Bool WaveGuideUpdate::startMoving( void ) DEBUG_CRASH(( "WaveGuideUpdate:startMoving - There must be a linked waypoint path to follow" )); return FALSE; - } // end if + } // get vector from next waypoint to first waypoint Coord2D v; @@ -234,13 +234,13 @@ Bool WaveGuideUpdate::startMoving( void ) // ai->setPathExtraDistance( PATH_EXTRA_DISTANCE ); - } // end if + } - } // endif + } return TRUE; // all is well -} // end startMoving +} // ------------------------------------------------------------------------------------------------ /** The wave guide has started moving ... this is called once */ @@ -273,7 +273,7 @@ Bool WaveGuideUpdate::initWaveGuide( void ) particleSys->attachToObject( getObject() ); m_shapeEffects[ i ][ 0 ] = particleSys->getSystemID(); - } // end if + } // create spray 2 effect particleSys = TheParticleSystemManager->createParticleSystem( wave2 ); @@ -284,7 +284,7 @@ Bool WaveGuideUpdate::initWaveGuide( void ) particleSys->attachToObject( getObject() ); m_shapeEffects[ i ][ 1 ] = particleSys->getSystemID(); - } // end if + } // create spray 3 every few points across the wave if( i % 5 == 0 ) @@ -298,15 +298,15 @@ Bool WaveGuideUpdate::initWaveGuide( void ) particleSys->attachToObject( getObject() ); m_shapeEffects[ i ][ 2 ] = particleSys->getSystemID(); - } // end if + } - } // end if + } - } // end if + } return TRUE; // all is well -} // end initWaveGuide +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -342,9 +342,9 @@ void WaveGuideUpdate::computeWaveShapePoints( void ) m_shapePoints[ m_shapePointCount ].z = 0.0f; m_shapePointCount++; - } // end for width + } -} // end computeWaveShapePoints +} // ------------------------------------------------------------------------------------------------ /** Given the current position and orientation of the wave guide, transform all the wave @@ -365,9 +365,9 @@ void WaveGuideUpdate::transformWaveShape( void ) m_transformedShapePoints[ i ].z = TheTerrainLogic->getGroundHeight( m_transformedShapePoints[ i ].x, m_transformedShapePoints[ i ].y ); - } // end for i + } -} // end transformWaveShape +} // ------------------------------------------------------------------------------------------------ /** Update phase for the effects that make up the front shape of the wave */ @@ -406,15 +406,15 @@ void WaveGuideUpdate::doShapeEffects( void ) pos.z = m_transformedShapePoints[ i ].z; particleSys->setPosition( &pos ); - } // end if + } - } // end if + } - } // end for j + } - } // end for i + } -} // end doShapeEffects +} // ------------------------------------------------------------------------------------------------ /** Given all our sample points, make the wave go */ @@ -439,9 +439,9 @@ void WaveGuideUpdate::doWaterMotion( void ) modData->m_preferredHeight ); - } // end for i + } -} // end doWaterMotion +} // ------------------------------------------------------------------------------------------------ /** Any points in our wave that are on the shoreline that are close enough to the effect @@ -476,7 +476,7 @@ void WaveGuideUpdate::doShoreEffects( void ) // transform the point waveGuide->transformPoint( &effectPoints[ i ], &effectPoints[ i ] ); - } // end for i + } // // go across the shape of our wave ... when we detect a transition from underground to @@ -513,12 +513,12 @@ void WaveGuideUpdate::doShoreEffects( void ) if( particleSystem ) particleSystem->setPosition( prevPoint ); - } // end if + } // we are now 'above' underWater = FALSE; - } // end if + } else { @@ -533,16 +533,16 @@ void WaveGuideUpdate::doShoreEffects( void ) if( particleSystem ) particleSystem->setPosition( point ); - } // end if + } // we are now 'under' underWater = TRUE; - } // end else + } - } // end for i + } -} // end doShoreEffects +} // ------------------------------------------------------------------------------------------------ /** Do damage to things that have fallen victim in the path of this enourmous wave */ @@ -638,7 +638,7 @@ void WaveGuideUpdate::doDamage( void ) particleSystem->setPosition( &pos ); particleSystem->attachToObject( waveGuide ); - } // end if + } // this object is now wet obj->setStatus( MAKE_OBJECT_STATUS_MASK( OBJECT_STATUS_WET ) ); @@ -671,7 +671,7 @@ void WaveGuideUpdate::doDamage( void ) draw->setModelConditionState( MODELCONDITION_FLOODED ); draw->setShadowsEnabled( FALSE ); - } // end if + } // // Temp demo hack, replace bridges destroyed with the special destroyed bridge art @@ -700,7 +700,7 @@ void WaveGuideUpdate::doDamage( void ) v.y = bridgeInfo.to.y - bridgeInfo.from.y; angle = v.toAngle(); - } // end if + } // put new bridge looking object in the world newBridge->setPosition( obj->getPosition() ); @@ -734,24 +734,24 @@ void WaveGuideUpdate::doDamage( void ) particleSystem->setLocalTransform( &transform ); - } // end if + } // destroy the old bridge and bridge object TheTerrainLogic->deleteBridge( oldBridge ); - } // end if + } - } // end if + } - } // end if + } - } // end if + } - } // end for obj + } - } // end for i + } -} // end doDamage +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -797,12 +797,12 @@ UpdateSleepTime WaveGuideUpdate::update( void ) TheGameLogic->destroyObject( getObject() ); return UPDATE_SLEEP_NONE; - } // end if + } // we are now in motion m_initialized = TRUE; - } // end if + } // every half second we try to play a random spash sound if( TheGameLogic->getFrame() - m_splashSoundFrame > LOGICFRAMES_PER_SECOND / 2.0f ) @@ -817,8 +817,8 @@ UpdateSleepTime WaveGuideUpdate::update( void ) AudioEventRTS randomSplash(modData->m_randomSplashSound); randomSplash.setObjectID(waveGuide->getID()); TheAudio->addAudioEvent(&randomSplash); - } // end if - } // end if + } + } // // transform the wave shape points once for the current position ... we have this array @@ -850,7 +850,7 @@ UpdateSleepTime WaveGuideUpdate::update( void ) return UPDATE_SLEEP_NONE; - } // end if + } // do wavefront effects doShapeEffects(); @@ -866,7 +866,7 @@ UpdateSleepTime WaveGuideUpdate::update( void ) return UPDATE_SLEEP_NONE; -} // end update +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -877,7 +877,7 @@ void WaveGuideUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -922,7 +922,7 @@ void WaveGuideUpdate::xfer( Xfer *xfer ) // final destination xfer->xferCoord3D( &m_finalDestination ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -933,4 +933,4 @@ void WaveGuideUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WeaponBonusUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WeaponBonusUpdate.cpp index 4a6e35f34c4..08846f94134 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WeaponBonusUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WeaponBonusUpdate.cpp @@ -174,7 +174,7 @@ void WeaponBonusUpdate::crc( Xfer *xfer ) // extend base class UpdateModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -192,7 +192,7 @@ void WeaponBonusUpdate::xfer( Xfer *xfer ) // extend base class UpdateModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -203,4 +203,4 @@ void WeaponBonusUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ActiveShroudUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ActiveShroudUpgrade.cpp index 0564aa7b62b..5cde26c65fa 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ActiveShroudUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ActiveShroudUpgrade.cpp @@ -41,7 +41,7 @@ ActiveShroudUpgradeModuleData::ActiveShroudUpgradeModuleData( void ) m_newShroudRange = 0.0f; -} // end SpecialPowerModuleData +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -56,7 +56,7 @@ ActiveShroudUpgradeModuleData::ActiveShroudUpgradeModuleData( void ) }; p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -68,14 +68,14 @@ ActiveShroudUpgrade::ActiveShroudUpgrade( Thing *thing, const ModuleData* module UpgradeModule( thing, moduleData ) { -} // end ActiveShroudUpgrade +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- ActiveShroudUpgrade::~ActiveShroudUpgrade( void ) { -} // end ~ActiveShroudUpgrade +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -87,7 +87,7 @@ void ActiveShroudUpgrade::upgradeImplementation( void ) getObject()->setShroudRange( getActiveShroudUpgradeModuleData()->m_newShroudRange ); getObject()->handlePartitionCellMaintenance();// To shroud where I am without waiting. } -} // end upgradeImplementation +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -98,7 +98,7 @@ void ActiveShroudUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -116,7 +116,7 @@ void ActiveShroudUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -127,4 +127,4 @@ void ActiveShroudUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ArmorUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ArmorUpgrade.cpp index a4e6a853fda..2a828e28073 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ArmorUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ArmorUpgrade.cpp @@ -113,7 +113,7 @@ void ArmorUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -131,7 +131,7 @@ void ArmorUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -142,4 +142,4 @@ void ArmorUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp index 484df68cc7c..049b358cc0d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp @@ -111,7 +111,7 @@ void CommandSetUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -129,7 +129,7 @@ void CommandSetUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -140,4 +140,4 @@ void CommandSetUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CostModifierUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CostModifierUpgrade.cpp index 626c5f91b37..6512f7b5f42 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CostModifierUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CostModifierUpgrade.cpp @@ -78,7 +78,7 @@ CostModifierUpgradeModuleData::CostModifierUpgradeModuleData( void ) m_kindOf = KINDOFMASK_NONE; m_percentage = 0; -} // end CostModifierUpgradeModuleData +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -94,7 +94,7 @@ CostModifierUpgradeModuleData::CostModifierUpgradeModuleData( void ) }; p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -106,14 +106,14 @@ CostModifierUpgrade::CostModifierUpgrade( Thing *thing, const ModuleData* module UpgradeModule( thing, moduleData ) { -} // end CostModifierUpgrade +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- CostModifierUpgrade::~CostModifierUpgrade( void ) { -} // end ~CostModifierUpgrade +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -132,7 +132,7 @@ void CostModifierUpgrade::onDelete( void ) // this upgrade module is now "not upgraded" setUpgradeExecuted(FALSE); -} // end onDelete +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -150,16 +150,16 @@ void CostModifierUpgrade::onCapture( Player *oldOwner, Player *newOwner ) oldOwner->removeKindOfProductionCostChange(getCostModifierUpgradeModuleData()->m_kindOf,getCostModifierUpgradeModuleData()->m_percentage ); setUpgradeExecuted(FALSE); - } // end if + } if( newOwner ) { newOwner->addKindOfProductionCostChange(getCostModifierUpgradeModuleData()->m_kindOf,getCostModifierUpgradeModuleData()->m_percentage ); setUpgradeExecuted(TRUE); - } // end if + } -} // end onCapture +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -170,7 +170,7 @@ void CostModifierUpgrade::upgradeImplementation( void ) // update the player with another TypeOfProductionCostChange player->addKindOfProductionCostChange(getCostModifierUpgradeModuleData()->m_kindOf,getCostModifierUpgradeModuleData()->m_percentage ); -} // end upgradeImplementation +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -181,7 +181,7 @@ void CostModifierUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -199,7 +199,7 @@ void CostModifierUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -210,4 +210,4 @@ void CostModifierUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ExperienceScalarUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ExperienceScalarUpgrade.cpp index 055335ca973..b301693dd14 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ExperienceScalarUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ExperienceScalarUpgrade.cpp @@ -57,7 +57,7 @@ void ExperienceScalarUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p) p.add(dataFieldParse); -} // end buildFieldParse +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -95,7 +95,7 @@ void ExperienceScalarUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -113,7 +113,7 @@ void ExperienceScalarUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -124,4 +124,4 @@ void ExperienceScalarUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/GrantScienceUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/GrantScienceUpgrade.cpp index d527d45e8c9..7e0f4094b70 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/GrantScienceUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/GrantScienceUpgrade.cpp @@ -107,7 +107,7 @@ void GrantScienceUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -125,7 +125,7 @@ void GrantScienceUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -136,4 +136,4 @@ void GrantScienceUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/LocomotorSetUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/LocomotorSetUpgrade.cpp index 23dad7fd2b7..f470690b93e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/LocomotorSetUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/LocomotorSetUpgrade.cpp @@ -65,7 +65,7 @@ void LocomotorSetUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -83,7 +83,7 @@ void LocomotorSetUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -94,4 +94,4 @@ void LocomotorSetUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/MaxHealthUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/MaxHealthUpgrade.cpp index 91609494c0b..bc623c6a5e0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/MaxHealthUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/MaxHealthUpgrade.cpp @@ -61,7 +61,7 @@ void MaxHealthUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p) p.add(dataFieldParse); -} // end buildFieldParse +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -100,7 +100,7 @@ void MaxHealthUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -118,7 +118,7 @@ void MaxHealthUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -129,4 +129,4 @@ void MaxHealthUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ModelConditionUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ModelConditionUpgrade.cpp index 3886dc09122..c738cbd8fe2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ModelConditionUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ModelConditionUpgrade.cpp @@ -87,7 +87,7 @@ void ModelConditionUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -105,7 +105,7 @@ void ModelConditionUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -116,4 +116,4 @@ void ModelConditionUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ObjectCreationUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ObjectCreationUpgrade.cpp index 72e3f330156..b59f7fe65a4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ObjectCreationUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ObjectCreationUpgrade.cpp @@ -45,7 +45,7 @@ ObjectCreationUpgradeModuleData::ObjectCreationUpgradeModuleData( void ) m_ocl = NULL; -} // end SpecialPowerModuleData +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -60,7 +60,7 @@ ObjectCreationUpgradeModuleData::ObjectCreationUpgradeModuleData( void ) }; p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -72,20 +72,20 @@ ObjectCreationUpgrade::ObjectCreationUpgrade( Thing *thing, const ModuleData* mo UpgradeModule( thing, moduleData ) { -} // end ObjectCreationUpgrade +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- ObjectCreationUpgrade::~ObjectCreationUpgrade( void ) { -} // end ~ObjectCreationUpgrade +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- void ObjectCreationUpgrade::onDelete( void ) { -} // end onDelete +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -107,7 +107,7 @@ void ObjectCreationUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -125,7 +125,7 @@ void ObjectCreationUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -136,4 +136,4 @@ void ObjectCreationUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/PassengersFireUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/PassengersFireUpgrade.cpp index e4ed41004ee..0f259c11fff 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/PassengersFireUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/PassengersFireUpgrade.cpp @@ -74,7 +74,7 @@ void PassengersFireUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -92,7 +92,7 @@ void PassengersFireUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -103,4 +103,4 @@ void PassengersFireUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/PowerPlantUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/PowerPlantUpgrade.cpp index 884f40b6211..9bb58a2043b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/PowerPlantUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/PowerPlantUpgrade.cpp @@ -45,14 +45,14 @@ PowerPlantUpgrade::PowerPlantUpgrade( Thing *thing, const ModuleData* moduleData UpgradeModule( thing, moduleData ) { -} // end PowerPlantUpgrade +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- PowerPlantUpgrade::~PowerPlantUpgrade( void ) { -} // end ~PowerPlantUpgrade +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -71,7 +71,7 @@ void PowerPlantUpgrade::onDelete( void ) // this upgrade module is now "not upgraded" setUpgradeExecuted(FALSE); -} // end onDelete +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -103,7 +103,7 @@ void PowerPlantUpgrade::onCapture( Player *oldOwner, Player *newOwner ) } -} // end onCapture +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -125,7 +125,7 @@ void PowerPlantUpgrade::upgradeImplementation( void ) ppui->extendRods(TRUE); } -} // end upgradeImplementation +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -136,7 +136,7 @@ void PowerPlantUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -154,7 +154,7 @@ void PowerPlantUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -176,4 +176,4 @@ void PowerPlantUpgrade::loadPostProcess( void ) player->addPowerBonus(getObject()); } -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/RadarUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/RadarUpgrade.cpp index 2b56a0485cd..9d925cc5f01 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/RadarUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/RadarUpgrade.cpp @@ -58,14 +58,14 @@ RadarUpgrade::RadarUpgrade( Thing *thing, const ModuleData* moduleData ) : UpgradeModule( thing, moduleData ) { -} // end RadarUpgrade +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- RadarUpgrade::~RadarUpgrade( void ) { -} // end ~RadarUpgrade +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -89,7 +89,7 @@ void RadarUpgrade::onDelete( void ) // this upgrade module is now "not upgraded" setUpgradeExecuted(FALSE); -} // end onDelete +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -112,16 +112,16 @@ void RadarUpgrade::onCapture( Player *oldOwner, Player *newOwner ) oldOwner->removeRadar( md->m_isDisableProof ); setUpgradeExecuted(FALSE); - } // end if + } if( newOwner ) { newOwner->addRadar( md->m_isDisableProof ); setUpgradeExecuted(TRUE); - } // end if + } -} // end onCapture +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -140,7 +140,7 @@ void RadarUpgrade::upgradeImplementation( void ) if( radarUpdate ) radarUpdate->extendRadar(); -} // end upgradeImplementation +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -151,7 +151,7 @@ void RadarUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -169,7 +169,7 @@ void RadarUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -180,4 +180,4 @@ void RadarUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ReplaceObjectUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ReplaceObjectUpgrade.cpp index 9f56af1d0e5..2d25eb67e43 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ReplaceObjectUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ReplaceObjectUpgrade.cpp @@ -148,7 +148,7 @@ void ReplaceObjectUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -166,7 +166,7 @@ void ReplaceObjectUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -177,4 +177,4 @@ void ReplaceObjectUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/StatusBitsUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/StatusBitsUpgrade.cpp index 7e0f54b16b8..d9a2dc5f95f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/StatusBitsUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/StatusBitsUpgrade.cpp @@ -116,7 +116,7 @@ void StatusBitsUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -134,7 +134,7 @@ void StatusBitsUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -145,4 +145,4 @@ void StatusBitsUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/StealthUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/StealthUpgrade.cpp index 7077c360fa6..62465ae884b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/StealthUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/StealthUpgrade.cpp @@ -74,7 +74,7 @@ void StealthUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -92,7 +92,7 @@ void StealthUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -103,4 +103,4 @@ void StealthUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/SubObjectsUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/SubObjectsUpgrade.cpp index f1e38a66587..002b59123b4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/SubObjectsUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/SubObjectsUpgrade.cpp @@ -136,7 +136,7 @@ void SubObjectsUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} //------------------------------------------------------------------------------------------------ // Xfer method @@ -154,7 +154,7 @@ void SubObjectsUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} //------------------------------------------------------------------------------------------------ void SubObjectsUpgrade::loadPostProcess( void ) @@ -163,4 +163,4 @@ void SubObjectsUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/UnpauseSpecialPowerUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/UnpauseSpecialPowerUpgrade.cpp index 28ba976b867..135f71b26a5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/UnpauseSpecialPowerUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/UnpauseSpecialPowerUpgrade.cpp @@ -57,7 +57,7 @@ UnpauseSpecialPowerUpgradeModuleData::UnpauseSpecialPowerUpgradeModuleData( void }; p.add(dataFieldParse); -} // end buildFieldParse +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -102,7 +102,7 @@ void UnpauseSpecialPowerUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -120,7 +120,7 @@ void UnpauseSpecialPowerUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -131,4 +131,4 @@ void UnpauseSpecialPowerUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/UpgradeModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/UpgradeModule.cpp index 2d266dabd40..314cb8ee26e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/UpgradeModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/UpgradeModule.cpp @@ -45,7 +45,7 @@ void UpgradeModule::crc( Xfer *xfer ) // extned base class UpgradeMux::upgradeMuxCRC( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -64,7 +64,7 @@ void UpgradeModule::xfer( Xfer *xfer ) // extend base class UpgradeMux::upgradeMuxXfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -78,7 +78,7 @@ void UpgradeModule::loadPostProcess( void ) // extend base class UpgradeMux::upgradeMuxLoadPostProcess(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/WeaponBonusUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/WeaponBonusUpgrade.cpp index 630bf11bee2..1457b628acf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/WeaponBonusUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/WeaponBonusUpgrade.cpp @@ -101,7 +101,7 @@ void WeaponBonusUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -119,7 +119,7 @@ void WeaponBonusUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -130,4 +130,4 @@ void WeaponBonusUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/WeaponSetUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/WeaponSetUpgrade.cpp index be1578bc6db..0bbcd1f6c4d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/WeaponSetUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/WeaponSetUpgrade.cpp @@ -65,7 +65,7 @@ void WeaponSetUpgrade::crc( Xfer *xfer ) // extend base class UpgradeModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -83,7 +83,7 @@ void WeaponSetUpgrade::xfer( Xfer *xfer ) // extend base class UpgradeModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -94,4 +94,4 @@ void WeaponSetUpgrade::loadPostProcess( void ) // extend base class UpgradeModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index 7e5d78dacee..ac0d20bad34 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -337,7 +337,7 @@ WeaponTemplate::~WeaponTemplate() void WeaponTemplate::reset( void ) { m_historicDamage.clear(); -} // end reset +} //------------------------------------------------------------------------------------------------- /*static*/ void WeaponTemplate::parseWeaponBonusSet( INI* ini, void *instance, void * /*store*/, const void* /*userData*/ ) @@ -447,7 +447,7 @@ void WeaponTemplate::postProcessLoad() m_projectileDetonationOCLNames[i].clear(); } -} // end postProcessLoad +} //------------------------------------------------------------------------------------------------- Real WeaponTemplate::getAttackRange(const WeaponBonus& bonus) const @@ -1251,9 +1251,9 @@ void WeaponTemplate::dealDamageInternal(ObjectID sourceID, ObjectID victimID, co // add AFTER checking for historic stuff m_historicDamage.push_back( HistoricWeaponDamageInfo(frameNow, *pos) ); - } // end else + } - } // if historic bonuses + } //DEBUG_LOG(("WeaponTemplate::dealDamageInternal: dealing damage %s at frame %d",m_name.str(),TheGameLogic->getFrame())); @@ -1675,7 +1675,7 @@ void WeaponStore::postProcessLoad() wt->postProcessLoad(); } -} // end postProcessLoad +} //------------------------------------------------------------------------------------------------- /*static*/ void WeaponStore::parseWeaponTemplateDefinition(INI* ini) @@ -3307,7 +3307,7 @@ void Weapon::crc( Xfer *xfer ) } #endif // DEBUG_CRC - } // end for, it + } // pitch limited xfer->xferBool( &m_pitchLimited ); @@ -3337,7 +3337,7 @@ void Weapon::crc( Xfer *xfer ) } #endif // DEBUG_CRC -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer @@ -3420,9 +3420,9 @@ void Weapon::xfer( Xfer *xfer ) intData = *it; xfer->xferInt( &intData ); - } // end for, it + } - } // end if, save + } else { @@ -3435,9 +3435,9 @@ void Weapon::xfer( Xfer *xfer ) xfer->xferInt( &intData ); m_scatterTargetsUnused.push_back( intData ); - } // end for, i + } - } // end else, load + } // pitch limited xfer->xferBool( &m_pitchLimited ); @@ -3445,7 +3445,7 @@ void Weapon::xfer( Xfer *xfer ) // leech weapon range active xfer->xferBool( &m_leechWeaponRangeActive ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp index 957c2cb5447..0e92431fd34 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp @@ -199,7 +199,7 @@ WeaponSet::~WeaponSet() void WeaponSet::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -288,7 +288,7 @@ void WeaponSet::xfer( Xfer *xfer ) void WeaponSet::loadPostProcess( void ) { -} // end loadPostProcess +} //------------------------------------------------------------------------------------------------- void WeaponSet::updateWeaponSet(const Object* obj) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp index fbb6142233f..710b49eeeea 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp @@ -131,14 +131,14 @@ ScriptActions::ScriptActions() m_suppressNewWindows = FALSE; m_unnamedUnit = AsciiString::TheEmptyString; -} // end ScriptActions +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- ScriptActions::~ScriptActions() { reset(); // just in case. -} // end ~ScriptActions +} //------------------------------------------------------------------------------------------------- /** Init */ @@ -148,7 +148,7 @@ void ScriptActions::init( void ) reset(); -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset */ @@ -158,7 +158,7 @@ void ScriptActions::reset( void ) m_suppressNewWindows = FALSE; closeWindows(FALSE); // Close victory or defeat windows. -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update */ @@ -166,7 +166,7 @@ void ScriptActions::reset( void ) void ScriptActions::update( void ) { // Empty for now. jba. -} // end update +} //------------------------------------------------------------------------------------------------- @@ -594,7 +594,7 @@ void ScriptActions::doCreateReinforcements(const AsciiString& team, const AsciiS obj->setOrientation(0.0f); - } // end if + } } if (obj) pos.y += 2*obj->getGeometryInfo().getMajorRadius(); } @@ -1032,7 +1032,7 @@ void ScriptActions::doCreateObject(const AsciiString& objectName, const AsciiStr } - } // end if + } } else { DEBUG_LOG(("WARNING - ThingTemplate '%s' not found.", thingName.str())); } @@ -1219,7 +1219,7 @@ void ScriptActions::createUnitOnTeamAt(const AsciiString& unitName, const AsciiS Coord3D destination = *way->getLocation(); obj->setPosition(&destination); } - } // end if + } } else { DEBUG_LOG(("WARNING - ThingTemplate '%s' not found.", objType.str())); } @@ -2215,7 +2215,7 @@ void ScriptActions::doTeamHuntWithCommandButton(const AsciiString& teamName, con msg.concat("' requires CommandButtonHuntUpdate in .ini definition to hunt with "); msg.concat(ability); TheScriptEngine->AppendDebugMessage(msg, false); - } // end if + } } break; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp index c19249fd9b2..bbf8cdb293f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp @@ -124,14 +124,14 @@ static TransportStatus *s_transportStatuses; ScriptConditions::ScriptConditions() { -} // end ScriptConditions +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- ScriptConditions::~ScriptConditions() { reset(); // just in case. -} // end ~ScriptConditions +} //------------------------------------------------------------------------------------------------- /** Init */ @@ -141,7 +141,7 @@ void ScriptConditions::init( void ) reset(); -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset */ @@ -152,7 +152,7 @@ void ScriptConditions::reset( void ) deleteInstance(s_transportStatuses); s_transportStatuses = NULL; // Empty for now. jba. -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update */ @@ -161,7 +161,7 @@ void ScriptConditions::update( void ) { // Empty for now. jba -} // end update +} //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index 5c77b99f168..09867526097 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -226,9 +226,9 @@ void AttackPriorityInfo::reset( void ) delete m_priorityMap; m_priorityMap = NULL; - } // end if + } -} // end reset +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -236,7 +236,7 @@ void AttackPriorityInfo::reset( void ) void AttackPriorityInfo::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -273,7 +273,7 @@ void AttackPriorityInfo::xfer( Xfer *xfer ) for( it = m_priorityMap->begin(); it != m_priorityMap->end(); ++it ) ++priorityMapCount; - } // end if + } xfer->xferUnsignedShort( &priorityMapCount ); // priority map @@ -306,16 +306,16 @@ void AttackPriorityInfo::xfer( Xfer *xfer ) priority = (*it).second; xfer->xferInt( &priority ); - } // end for i + } // sanity DEBUG_ASSERTCRASH( count == priorityMapCount, ("AttackPriorityInfo::xfer - Mismatch in priority map size. Size() method returned '%d' but actual iteration count was '%d'", priorityMapCount, count) ); - } // end if + } - } // end if, save + } else { @@ -333,7 +333,7 @@ void AttackPriorityInfo::xfer( Xfer *xfer ) thingTemplateName.str() )); throw SC_INVALID_DATA; - } // end if + } // read priority xfer->xferInt( &priority ); @@ -341,11 +341,11 @@ void AttackPriorityInfo::xfer( Xfer *xfer ) // set priority (this will allocate the map on the first call as well) setPriority( thingTemplate, priority ); - } // end for + } - } // end else, load + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -353,7 +353,7 @@ void AttackPriorityInfo::xfer( Xfer *xfer ) void AttackPriorityInfo::loadPostProcess( void ) { -} // end loadPostProcess +} // ScriptEngine class static const FieldParse TheTemplateFieldParseTable[] = @@ -474,7 +474,7 @@ m_ChooseVictimAlwaysUsesNormal(false) // By default, difficulty should be normal. setGlobalDifficulty(DIFFICULTY_NORMAL); -} // end ScriptEngine +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -519,7 +519,7 @@ ScriptEngine::~ScriptEngine() } #endif -} // end ~ScriptEngine +} //------------------------------------------------------------------------------------------------- /** Init */ @@ -5263,7 +5263,7 @@ void ScriptEngine::init( void ) reset(); -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset */ @@ -5429,7 +5429,7 @@ void ScriptEngine::reset( void ) // clear topple directions m_toppleDirections.clear(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** newMap */ @@ -5498,7 +5498,7 @@ void ScriptEngine::newMap( void ) m_fadeFramesDecrease = FRAMES_TO_FADE_IN_AT_START; m_curFadeValue = 0.0f; -} // end newMap +} //------------------------------------------------------------------------------------------------- /** Update */ @@ -5641,7 +5641,7 @@ void ScriptEngine::update( void ) _updateVTune(); #endif -} // end update +} //------------------------------------------------------------------------------------------------- /** getStats */ @@ -5699,7 +5699,7 @@ AsciiString ScriptEngine::getStats(Real *curTimePtr, Real *script1Time, Real *sc #endif #endif return msg; -} // end getStats +} //------------------------------------------------------------------------------------------------- /** startQuickEndGameTimer */ @@ -5707,7 +5707,7 @@ AsciiString ScriptEngine::getStats(Real *curTimePtr, Real *script1Time, Real *sc void ScriptEngine::startQuickEndGameTimer( void ) { m_endGameTimer = 1; -} // end startQuickEndGameTimer +} //------------------------------------------------------------------------------------------------- /** startEndGameTimer */ @@ -5715,7 +5715,7 @@ void ScriptEngine::startQuickEndGameTimer( void ) void ScriptEngine::startEndGameTimer( void ) { m_endGameTimer = FRAMES_TO_SHOW_WIN_LOSE_MESSAGE; -} // end startEndGameTimer +} //------------------------------------------------------------------------------------------------- /** startCloseWindowTimer */ @@ -5723,7 +5723,7 @@ void ScriptEngine::startEndGameTimer( void ) void ScriptEngine::startCloseWindowTimer( void ) { m_closeWindowTimer = FRAMES_TO_SHOW_WIN_LOSE_MESSAGE; -} // end startCloseWindowTimer +} //------------------------------------------------------------------------------------------------- /** updateFades */ @@ -5753,7 +5753,7 @@ void ScriptEngine::updateFades( void ) } // time is up. m_fade = FADE_NONE; -} // end updateFades +} //------------------------------------------------------------------------------------------------- /** getCurrentPlayer */ @@ -5763,7 +5763,7 @@ Player *ScriptEngine::getCurrentPlayer(void) if (m_currentPlayer==NULL) AppendDebugMessage("***Unexpected NULL player:***", false); return m_currentPlayer; -} // end getCurrentPlayer +} //------------------------------------------------------------------------------------------------- /** clearFlag */ @@ -5782,7 +5782,7 @@ void ScriptEngine::clearFlag(const AsciiString &name) } } } -} // end clearFlag +} //------------------------------------------------------------------------------------------------- /** clearTeamFlags */ @@ -5798,7 +5798,7 @@ void ScriptEngine::clearTeamFlags(void) clearFlag("GLA Team is Building"); clearFlag("GLA Inf Team is Building"); -} // end clearTeamFlags +} //------------------------------------------------------------------------------------------------- /** getSkirmishEnemyPlayer */ @@ -5994,7 +5994,7 @@ Team * ScriptEngine::getTeamNamed(const AsciiString& teamName) } } return theTeamProto->getFirstItemIn_TeamInstanceList(); -} // end getTeamNamed +} //------------------------------------------------------------------------------------------------- /** getUnitNamed */ @@ -6082,7 +6082,7 @@ void ScriptEngine::runScript(const AsciiString& scriptName, Team *pThisTeam) // m_callingTeam is restored automatically via LatchRestore m_conditionTeam = m_conditionTeam; m_currentPlayer = savPlayer; -} // end runScript +} //------------------------------------------------------------------------------------------------- @@ -6127,7 +6127,7 @@ void ScriptEngine::runObjectScript(const AsciiString& scriptName, Object *pThisO } } m_callingObject = pSavCallingObject; -} // end runScript +} //------------------------------------------------------------------------------------------------- @@ -7688,7 +7688,7 @@ void ScriptEngine::executeScripts( Script *pScriptHead ) } executeScript(pCurScript); } -} // end update +} //------------------------------------------------------------------------------------------------- @@ -7701,7 +7701,7 @@ const ActionTemplate * ScriptEngine::getActionTemplate( Int ndx ) DEBUG_ASSERTCRASH (!m_actionTemplates[ndx].getName().isEmpty(), ("Need to initialize action enum=%d.", ndx)); return &m_actionTemplates[ndx]; -} // end getActionTemplate +} //------------------------------------------------------------------------------------------------- /** Gets the ui and parameter template for a script condition */ @@ -7712,7 +7712,7 @@ const ConditionTemplate * ScriptEngine::getConditionTemplate( Int ndx ) if (ndx <0 || ndx >= Condition::NUM_ITEMS) ndx = 0; DEBUG_ASSERTCRASH (!m_conditionTemplates[ndx].getName().isEmpty(), ("Need to initialize Condition enum=%d.", ndx)); return &m_conditionTemplates[ndx]; -} // end getConditionTemplate +} //------------------------------------------------------------------------------------------------- /** Fills the named object cache initally. */ @@ -8153,7 +8153,7 @@ SequentialScript::SequentialScript() : m_teamToExecOn(NULL), void SequentialScript::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -8185,9 +8185,9 @@ void SequentialScript::xfer( Xfer *xfer ) teamID )); throw SC_INVALID_DATA; - } // end if + } - } // end if + } // object id xfer->xferObjectID( &m_objectID ); @@ -8201,7 +8201,7 @@ void SequentialScript::xfer( Xfer *xfer ) scriptName = m_scriptToExecuteSequentially->getName(); xfer->xferAsciiString( &scriptName ); - } // end if, save + } else { @@ -8218,7 +8218,7 @@ void SequentialScript::xfer( Xfer *xfer ) DEBUG_ASSERTCRASH( m_scriptToExecuteSequentially != NULL, ("SequentialScript::xfer - m_scriptToExecuteSequentially is NULL but should not be") ); - } // end else, load + } // current instruction xfer->xferInt( &m_currentInstruction ); @@ -8232,7 +8232,7 @@ void SequentialScript::xfer( Xfer *xfer ) // dont advance instruction xfer->xferBool( &m_dontAdvanceInstruction ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -8240,7 +8240,7 @@ void SequentialScript::xfer( Xfer *xfer ) void SequentialScript::loadPostProcess( void ) { -} // end loadPostProcess +} #ifdef NOT_IN_USE //----SequentialScriptStatus Stuff ---------------------------------------------------------------- @@ -8250,7 +8250,7 @@ void SequentialScript::loadPostProcess( void ) void SequentialScriptStatus::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -8274,7 +8274,7 @@ void SequentialScriptStatus::xfer( Xfer *xfer ) // is executing sequentially xfer->xferBool( &m_isExecutingSequentially ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ // Load post process */ @@ -8282,7 +8282,7 @@ void SequentialScriptStatus::xfer( Xfer *xfer ) void SequentialScriptStatus::loadPostProcess( void ) { -} // end loadPostProcess +} #endif //----Particle Editor Stuff------------------------------------------------------------------------ @@ -8537,7 +8537,7 @@ void ScriptEngine::AdjustDebugVariableData(const AsciiString& variableName, Int void ScriptEngine::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Version Info: @@ -8571,9 +8571,9 @@ static void xferListAsciiString( Xfer *xfer, ListAsciiString *list ) string = *it; xfer->xferAsciiString( &string ); - } // end for, it + } - } // end if, save + } else { @@ -8584,7 +8584,7 @@ static void xferListAsciiString( Xfer *xfer, ListAsciiString *list ) DEBUG_CRASH(( "xferListAsciiString - list should be empty upon loading but is not" )); throw SC_INVALID_DATA; - } // end if + } // read each string for( UnsignedShort i = 0; i < count; ++i ) @@ -8596,11 +8596,11 @@ static void xferListAsciiString( Xfer *xfer, ListAsciiString *list ) // put on list list->push_back( string ); - } // end for, i + } - } // end else, load + } -} // end xferListAsciiString +} // ------------------------------------------------------------------------------------------------ /** Version Info: @@ -8640,9 +8640,9 @@ static void xferListAsciiStringUINT( Xfer *xfer, ListAsciiStringUINT *list ) unsignedIntData = it->second; xfer->xferUnsignedInt( &unsignedIntData ); - } // end for, it + } - } // end if, save + } else { PairAsciiStringUINT newPair; @@ -8654,7 +8654,7 @@ static void xferListAsciiStringUINT( Xfer *xfer, ListAsciiStringUINT *list ) DEBUG_CRASH(( "xferListAsciiStringUINT - list should be empty upon loading but is not" )); throw SC_INVALID_DATA; - } // end if + } // read each string for( UnsignedShort i = 0; i < count; ++i ) @@ -8671,11 +8671,11 @@ static void xferListAsciiStringUINT( Xfer *xfer, ListAsciiStringUINT *list ) newPair.second = unsignedIntData; list->push_back( newPair ); - } // end for, i + } - } // end else, load + } -} // end xferListAsciiStringUINT +} // ------------------------------------------------------------------------------------------------ /** Version Info: @@ -8715,9 +8715,9 @@ static void xferListAsciiStringObjectID( Xfer *xfer, ListAsciiStringObjectID *li objectID = it->second; xfer->xferObjectID( &objectID ); - } // end for, it + } - } // end if, save + } else { AsciiStringObjectIDPair newPair; @@ -8729,7 +8729,7 @@ static void xferListAsciiStringObjectID( Xfer *xfer, ListAsciiStringObjectID *li DEBUG_CRASH(( "xferListAsciiStringObjectID - list should be empty upon loading but is not" )); throw SC_INVALID_DATA; - } // end if + } // read each string for( UnsignedShort i = 0; i < count; ++i ) @@ -8746,11 +8746,11 @@ static void xferListAsciiStringObjectID( Xfer *xfer, ListAsciiStringObjectID *li newPair.second = objectID; list->push_back( newPair ); - } // end for, i + } - } // end else, load + } -} // end xferListAsciiStringObjectID +} // ------------------------------------------------------------------------------------------------ /** Version Info: @@ -8790,9 +8790,9 @@ static void xferListAsciiStringCoord3D( Xfer *xfer, ListAsciiStringCoord3D *list coord = it->second; xfer->xferCoord3D( &coord ); - } // end for, it + } - } // end if, save + } else { AsciiStringCoord3DPair newPair; @@ -8804,7 +8804,7 @@ static void xferListAsciiStringCoord3D( Xfer *xfer, ListAsciiStringCoord3D *list DEBUG_CRASH(( "xferListAsciiStringCoord3D - list should be empty upon loading but is not" )); throw SC_INVALID_DATA; - } // end if + } // read each string for( UnsignedShort i = 0; i < count; ++i ) @@ -8821,11 +8821,11 @@ static void xferListAsciiStringCoord3D( Xfer *xfer, ListAsciiStringCoord3D *list newPair.second = coord; list->push_back( newPair ); - } // end for, i + } - } // end else, load + } -} // ene xferListAsciiStringCoord3D +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -8872,9 +8872,9 @@ void ScriptEngine::xfer( Xfer *xfer ) // xfer data xfer->xferSnapshot( sequentialScript ); - } // end for, it + } - } // end if, save + } else { @@ -8885,7 +8885,7 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - m_sequentialScripts should be empty but is not" )); throw SC_INVALID_DATA; - } // end if + } // read each entry for( UnsignedShort i = 0; i < sequentialScriptCount; ++i ) @@ -8900,9 +8900,9 @@ void ScriptEngine::xfer( Xfer *xfer ) // xfer data xfer->xferSnapshot( sequentialScript ); - } // end for i + } - } // end else, load + } // counters UnsignedShort countersSize = m_numCounters; @@ -8913,7 +8913,7 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - MAX_COUNTERS has changed size, need to version this" )); throw SC_INVALID_DATA; - } // end if + } for( i = 0; i < countersSize; ++i ) { @@ -8926,7 +8926,7 @@ void ScriptEngine::xfer( Xfer *xfer ) // countdown timer xfer->xferBool( &m_counters[ i ].isCountdownTimer ); - } // end for, i + } // num counters xfer->xferInt( &m_numCounters ); @@ -8940,7 +8940,7 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - MAX_FLAGS has changed size, need to version this" )); throw SC_INVALID_DATA; - } // end if + } for( i = 0; i < flagsSize; ++i ) { @@ -8950,7 +8950,7 @@ void ScriptEngine::xfer( Xfer *xfer ) // name xfer->xferAsciiString( &m_flags[ i ].name ); - } // end for i + } // num flags xfer->xferInt( &m_numFlags ); @@ -8964,14 +8964,14 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - MAX_ATTACK_PRIORITIES size has changed, need to version this" )); throw SC_INVALID_DATA; - } // end if + } for( i = 0; i < attackPriorityInfoSize; ++i ) { // xfer each data xfer->xferSnapshot( &m_attackPriorityInfo[ i ] ); - } // end for i + } // num attack info xfer->xferInt( &m_numAttackInfo ); @@ -9003,9 +9003,9 @@ void ScriptEngine::xfer( Xfer *xfer ) objectID = obj ? obj->getID() : INVALID_ID; xfer->xferObjectID( &objectID ); - } // end for i + } - } // end if, save + } else { NamedRequest req; @@ -9032,16 +9032,16 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - Unable to find object by ID for m_namedObjects" )); throw SC_INVALID_DATA; - } // end if + } // assign req.first = namedObjectName; req.second = obj; m_namedObjects.push_back( req ); - } // end for, i + } - } // end else, load + } // first update xfer->xferBool( &m_firstUpdate ); @@ -9091,7 +9091,7 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - MAX_PLAYER_COUNT has changed, m_triggeredSpecialPowers size is now different and we must version this" )); throw SC_INVALID_DATA; - } // end if + } for( i = 0; i < triggeredSpecialPowersSize; ++i ) xferListAsciiStringObjectID( xfer, &m_triggeredSpecialPowers[ i ] ); @@ -9104,7 +9104,7 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - MAX_PLAYER_COUNT has changed, m_midwaySpecialPowers size is now different and we must version this" )); throw SC_INVALID_DATA; - } // end if + } for( i = 0; i < midwaySpecialPowersSize; ++i ) xferListAsciiStringObjectID( xfer, &m_midwaySpecialPowers[ i ] ); @@ -9117,7 +9117,7 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - MAX_PLAYER_COUNT has changed, m_finishedSpecialPowers size is now different and we must version this" )); throw SC_INVALID_DATA; - } // end if + } for( i = 0; i < finishedSpecialPowersSize; ++i ) xferListAsciiStringObjectID( xfer, &m_finishedSpecialPowers[ i ] ); @@ -9130,7 +9130,7 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - MAX_PLAYER_COUNT has changed, m_completedUpgrades size is now different and we must version this" )); throw SC_INVALID_DATA; - } // end if + } for( i = 0; i < completedUpgradesSize; ++i ) xferListAsciiStringObjectID( xfer, &m_completedUpgrades[ i ] ); @@ -9143,7 +9143,7 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - MAX_PLAYER_COUNT has changed, m_acquiredSciences size is now different and we must version this" )); throw SC_INVALID_DATA; - } // end if + } for( i = 0; i < acquiredSciencesSize; ++i ) xfer->xferScienceVec( &m_acquiredSciences[ i ] ); @@ -9195,9 +9195,9 @@ void ScriptEngine::xfer( Xfer *xfer ) // player name xfer->xferAsciiString( &it->m_playerName ); - } // end for, it + } - } // end if, save + } else { @@ -9208,7 +9208,7 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - m_namedReveals should be empty but is not!" )); throw SC_INVALID_DATA; - } // end if + } // read all entries NamedReveal reveal; @@ -9230,9 +9230,9 @@ void ScriptEngine::xfer( Xfer *xfer ) // put on list m_namedReveals.push_back( reveal ); - } // end for, i + } - } // end else, load + } // all object type lists size UnsignedShort allObjectTypesCount = m_allObjectTypeLists.size(); @@ -9254,9 +9254,9 @@ void ScriptEngine::xfer( Xfer *xfer ) // save object types xfer->xferSnapshot( objectTypes ); - } // end for, it + } - } // end if, save + } else { @@ -9267,7 +9267,7 @@ void ScriptEngine::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptEngine::xfer - m_allObjectTypeLists should be empty but is not!" )); throw SC_INVALID_DATA; - } // end if + } // read all data ObjectTypes *objectTypes; @@ -9283,11 +9283,11 @@ void ScriptEngine::xfer( Xfer *xfer ) // put on list m_allObjectTypeLists.push_back( objectTypes ); - } // end for, i + } - } // end else, load + } - } // end if, version 2 + } if (version >= 3) { xfer->xferBool(&m_objectsShouldReceiveDifficultyBonus); @@ -9322,7 +9322,7 @@ void ScriptEngine::xfer( Xfer *xfer ) m_curFadeValue = 0.0f; } } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -9341,7 +9341,7 @@ void ScriptEngine::loadPostProcess( void ) TheAudio->addAudioEvent(&event); } -} // end loadPostProcess +} //#if defined(RTS_DEBUG) void ScriptEngine::debugVictory( void ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp index e5967963f3f..66d9780e829 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp @@ -260,7 +260,7 @@ void ScriptList::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptList::xfer - Script list count has changed, attempting to recover.")); // throw SC_INVALID_DATA; try to recover. jba. - } // end if + } // all script data here for( script = getScript(); script; script = script->getNext() ) { @@ -289,7 +289,7 @@ void ScriptList::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptList::xfer - Script group count has changed, attempting to recover.")); - } // end if + } // all script group data for( scriptGroup = getScriptGroup(); scriptGroup; scriptGroup = scriptGroup->getNext() ) { @@ -670,7 +670,7 @@ ScriptGroup::~ScriptGroup(void) void ScriptGroup::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -703,7 +703,7 @@ void ScriptGroup::xfer( Xfer *xfer ) DEBUG_CRASH(( "ScriptGroup::xfer - Script list count has changed, attempting to recover.")); // throw SC_INVALID_DATA; try to recover. jba. - } // end if + } // xfer script data for( script = getScript(); script; script = script->getNext() ) { @@ -720,7 +720,7 @@ void ScriptGroup::xfer( Xfer *xfer ) } } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -728,7 +728,7 @@ void ScriptGroup::xfer( Xfer *xfer ) void ScriptGroup::loadPostProcess( void ) { -} // end loadPostProcess +} /** ScriptGroup::duplicate - Creates a full, "deep" copy of ScriptGroup. @@ -948,7 +948,7 @@ Script::~Script(void) void Script::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -968,7 +968,7 @@ void Script::xfer( Xfer *xfer ) xfer->xferBool( &active ); setActive( active ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -976,7 +976,7 @@ void Script::xfer( Xfer *xfer ) void Script::loadPostProcess( void ) { -} // end loadPostProcess +} /** Script::duplicate - Creates a full, "deep" copy of script. Condition list and action diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CaveSystem.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CaveSystem.cpp index 82f8ad6490f..219b62addb0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CaveSystem.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CaveSystem.cpp @@ -156,9 +156,9 @@ void CaveSystem::xfer( Xfer *xfer ) tracker = *it; xfer->xferSnapshot( tracker ); - } // end + } - } // end if, save + } else { @@ -169,7 +169,7 @@ void CaveSystem::xfer( Xfer *xfer ) DEBUG_CRASH(( "CaveSystem::xfer - m_tunnelTrackerVector should be empty but is not" )); throw SC_INVALID_DATA; - } // end if + } // read each item for( UnsignedShort i = 0; i < count; ++i ) @@ -184,10 +184,10 @@ void CaveSystem::xfer( Xfer *xfer ) // put in vector m_tunnelTrackerVector.push_back( tracker ); - } // end for, i + } - } // end else, laod + } -} // end xfer +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/Damage.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/Damage.cpp index 16050a756bb..2ed63aab601 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/Damage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/Damage.cpp @@ -111,7 +111,7 @@ void DamageInfo::xfer( Xfer *xfer ) // xfer output xfer->xferSnapshot( &out ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -170,7 +170,7 @@ void DamageInfoInput::xfer( Xfer *xfer ) } } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -194,5 +194,5 @@ void DamageInfoOutput::xfer( Xfer *xfer ) // no effect xfer->xferBool( &m_noEffect ); -} // end xfer +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 80ebd4559e9..d635b27a9dd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -329,7 +329,7 @@ void GameLogic::destroyAllObjectsImmediate() processDestroyList(); DEBUG_ASSERTCRASH( m_objList == NULL, ("destroyAllObjectsImmediate: Object list not cleared") ); -} // end destroyAllObjectsImmediate +} //------------------------------------------------------------------------------------------------- /**GameLogic class destructor, the destruction order should mirror the @@ -514,7 +514,7 @@ void GameLogic::reset( void ) TheWeatherSetting = (WeatherSetting*) ws->deleteOverrides(); m_rankPointsToAddAtGameStart = 0; -} // end reset +} static Object * placeObjectAtPosition(Int slotNum, AsciiString objectTemplateName, Coord3D& pos, Player *pPlayer, const PlayerTemplate *pTemplate) @@ -1037,14 +1037,14 @@ static void populateRandomStartPosition( GameInfo *game ) farthestIndex = posIdx; } } - } //for posInx + } DEBUG_ASSERTCRASH(farthestIndex >= 0, ("Couldn't find a farthest spot!")); slot->setStartPos(farthestIndex); taken[farthestIndex] = TRUE; if( team > -1 ) teamPosIdx[team] = farthestIndex; //remember where this team is - } //pick farthest + } else //team already has a starting position { //pick position closest to team Real closestDist = FLT_MAX; @@ -1057,13 +1057,13 @@ static void populateRandomStartPosition( GameInfo *game ) closestDist = dist; closestIdx = n; } - } //for n + } DEBUG_ASSERTCRASH( closestDist < FLT_MAX, ("Couldn't find a closest starting positon!")); slot->setStartPos(closestIdx); taken[closestIdx] = TRUE; } } - } //for i + } #endif // 0 // now go back & assign observer spots @@ -1108,7 +1108,7 @@ void GameLogic::updateLoadProgress( Int progress ) if( m_loadScreen ) m_loadScreen->update( progress ); -} // end updateLoadProgress +} // ------------------------------------------------------------------------------------------------ /** Delete the load screen */ @@ -1122,9 +1122,9 @@ void GameLogic::deleteLoadScreen( void ) delete m_loadScreen; m_loadScreen = NULL; - } // end if + } -} // end deleteLoadScreen +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1176,7 +1176,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) DEBUG_CRASH(( "FATAL SAVE/LOAD ERROR! - Setting a pristine map name that refers to a map in the save directory. The pristine map should always refer to the ORIGINAL map in the Maps directory, if the pristine map string is corrupt then map.ini files will not load correctly." )); - } // end if + } if( m_startNewGame == FALSE ) { @@ -1206,7 +1206,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) } - } // end if + } m_rankLevelLimit = 1000; // this is reset every game. setDefaults( loadingSaveGame ); @@ -1756,9 +1756,9 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) // in the map object properties. // update this object instance with properties from the map object obj->updateObjValuesFromMapProperties( pMapObj->getProperties() ); - } // end if + } - } // for, loading bridge map objects + } // update the loadscreen updateLoadProgress(LOAD_PROGRESS_POST_BRIDGE_LOAD); @@ -1961,7 +1961,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) team->setActive(); TheAI->pathfinder()->addObjectToPathfindMap( obj ); - } // end if + } if(timeGetTime() > timer + 500) { @@ -1971,9 +1971,9 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) timer = timeGetTime(); } - } // for, loading map objects + } - } // end if, not loading save game + } #ifdef DUMP_PERF_STATS GetPrecisionTimer(&endTime64); @@ -2424,7 +2424,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) } -} // end startNewGame +} //----------------------------------------------------------------------------------------- static void findAndSelectCommandCenter(Object *obj, void* alreadyFound) @@ -2664,7 +2664,7 @@ void GameLogic::processCommandList( CommandList *list ) } } -} // end processCommandList +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -3923,7 +3923,7 @@ void GameLogic::addObjectToLookupTable( Object *obj ) m_objVector[ newID ] = obj; -} // end addObjectToLookupTable +} // ------------------------------------------------------------------------------------------------ /** Remove object from the ID lookup table */ @@ -3940,7 +3940,7 @@ void GameLogic::removeObjectFromLookupTable( Object *obj ) // m_objHash.erase( obj->getID() ); m_objVector[ obj->getID() ] = NULL; -} // end removeObjectFromLookupTable +} // ------------------------------------------------------------------------------------------------ /** Given an object, register it with the GameLogic and give it a unique ID. */ @@ -4065,7 +4065,7 @@ void GameLogic::destroyObject( Object *obj ) } -} // end destroyObject +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -4631,7 +4631,7 @@ void GameLogic::getAIMetricsStatistics( UnsignedInt *numAI, UnsignedInt *numMovi void GameLogic::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Given a string name, find the object TOC entry (if any) associated with it */ @@ -4645,7 +4645,7 @@ GameLogic::ObjectTOCEntry *GameLogic::findTOCEntryByName( AsciiString name ) return NULL; -} // end findTOCEntryByname +} // ------------------------------------------------------------------------------------------------ /** Given a object TOC identifier, find the object TOC if any */ @@ -4659,7 +4659,7 @@ GameLogic::ObjectTOCEntry *GameLogic::findTOCEntryById( UnsignedShort id ) return NULL; -} // end findTOCEntryById +} // ------------------------------------------------------------------------------------------------ /** Add an object TOC entry */ @@ -4672,7 +4672,7 @@ void GameLogic::addTOCEntry( AsciiString name, UnsignedShort id ) tocEntry.id = id; m_objectTOC.push_back( tocEntry ); -} // end addTOCEntry +} // ------------------------------------------------------------------------------------------------ /** Xfer object table of contents */ @@ -4708,7 +4708,7 @@ void GameLogic::xferObjectTOC( Xfer *xfer ) // add this entry to the TOC addTOCEntry( obj->getTemplate()->getName(), ++tocCount ); - } // end for obj + } // xfer entries in the TOC xfer->xferUnsignedInt( &tocCount ); @@ -4728,9 +4728,9 @@ void GameLogic::xferObjectTOC( Xfer *xfer ) // xfer the paired id xfer->xferUnsignedShort( &tocEntry->id ); - } // end for + } - } // end if + } else { AsciiString templateName; @@ -4752,11 +4752,11 @@ void GameLogic::xferObjectTOC( Xfer *xfer ) // add this to the TOC addTOCEntry( templateName, id ); - } // end for i + } - } // end else + } -} // end xferObjectTOC +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -4803,21 +4803,21 @@ void GameLogic::prepareLogicForObjectLoad( void ) destroyObject( oldTower ); } - } // end for, i + } // destroy the old bridge object destroyObject( oldObject ); - } // end if, bridge + } else if( obj->isKindOf( KINDOF_WALK_ON_TOP_OF_WALL ) ) { // destroy walk on top of wall things too destroyObject( obj ); - } // end else if + } - } // end for, obj + } // process the destruction of these objects immediately before we proceed with the load process processDestroyList(); @@ -4827,7 +4827,7 @@ void GameLogic::prepareLogicForObjectLoad( void ) ("GameLogic::prepareLogicForObjectLoad - There are still objects loaded in the engine, but it should be empty (Top is '%s')", getFirstObject()->getTemplate()->getName().str()) ); -} // end prepareLogicForObjectLoad +} // ------------------------------------------------------------------------------------------------ /** Load/Save game logic to xfer @@ -4891,7 +4891,7 @@ void GameLogic::xfer( Xfer *xfer ) DEBUG_CRASH(( "GameLogic::xfer - Object TOC entry not found for '%s'", obj->getTemplate()->getName().str() )); throw SC_INVALID_DATA; - } // end if + } // transfer TOC id entry xfer->xferUnsignedShort( &tocEntry->id ); @@ -4905,9 +4905,9 @@ void GameLogic::xfer( Xfer *xfer ) // end a block of data xfer->endBlock(); - } // end for + } - } // end if, save + } else { Team *defaultTeam = ThePlayerList->getNeutralPlayer()->getDefaultTeam(); @@ -4931,7 +4931,7 @@ void GameLogic::xfer( Xfer *xfer ) DEBUG_CRASH(( "GameLogic::xfer - No TOC entry match for id '%d'", tocID )); throw SC_INVALID_DATA; - } // end if + } // a block of data has begun objectDataSize = xfer->beginBlock(); @@ -4946,7 +4946,7 @@ void GameLogic::xfer( Xfer *xfer ) xfer->skip( objectDataSize ); continue; - } // end if + } // create new object obj = TheThingFactory->newObject( thingTemplate, defaultTeam ); @@ -4961,9 +4961,9 @@ void GameLogic::xfer( Xfer *xfer ) if( obj->isKindOf( KINDOF_WALK_ON_TOP_OF_WALL ) ) TheAI->pathfinder()->addWallPiece( obj ); - } // end for, i + } - } // end else + } // campaign info xfer->xferSnapshot( TheCampaignManager ); @@ -5002,7 +5002,7 @@ void GameLogic::xfer( Xfer *xfer ) sanityTriggerCount, triggerCount )); throw SC_INVALID_DATA; - } // end if + } // xfer each of the polygon triggers if( xfer->getXferMode() == XFER_SAVE ) @@ -5019,9 +5019,9 @@ void GameLogic::xfer( Xfer *xfer ) // xfer polygon data xfer->xferSnapshot( poly ); - } // end for, poly + } - } // end if, save + } else { Int triggerID; @@ -5044,12 +5044,12 @@ void GameLogic::xfer( Xfer *xfer ) triggerID )); throw SC_INVALID_DATA; - } // end if + } // xfer polygon data xfer->xferSnapshot( poly ); - } // end for, i + } // // force a recalculation of the pathfinding cause some of these polygon triggers @@ -5058,9 +5058,9 @@ void GameLogic::xfer( Xfer *xfer ) // TheAI->pathfinder()->newMap(); - } // end else, load + } - } // end if, version >= 3 + } // note that version=4 is the same as version=3 if (version >= 5) @@ -5167,7 +5167,7 @@ void GameLogic::xfer( Xfer *xfer ) { m_superweaponRestriction = 0; } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process entry point */ @@ -5240,13 +5240,13 @@ void GameLogic::loadPostProcess( void ) u->friend_setIndexInLogic(m_sleepyUpdates.size() - 1); } - } // end for, u + } - } // end for, obj + } // re-sort the priority queue all at once now that all modules are on it remakeSleepyUpdate(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index cb534d5914d..03722719892 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -165,11 +165,11 @@ static void doSetRallyPoint( Object *obj, const Coord3D& pos ) rallyNotSet.setPlayerIndex(obj->getControllingPlayer()->getPlayerIndex()); TheAudio->addAudioEvent(&rallyNotSet); - } // end if + } return; - } // end if + } // feedback to the player if( isLocalPlayer ) @@ -192,7 +192,7 @@ static void doSetRallyPoint( Object *obj, const Coord3D& pos ) if( draw && draw->isSelected() ) TheControlBar->markUIDirty(); - } // end if + } // if this object has a ProductionExitUpdate interface, we are setting a rally point ExitInterface *exitInterface = obj->getObjectExitInterface(); @@ -338,7 +338,7 @@ void GameLogic::prepareNewGame( GameMode gameMode, GameDifficulty diff, Int rank m_startNewGame = FALSE; -} // end prepareNewGame +} //------------------------------------------------------------------------------------------------- /** This message handles dispatches object command messages to the @@ -448,7 +448,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end new game + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_CLEAR_GAME_DATA: @@ -471,7 +471,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) TheGameLogic->clearGameData(); break; - } // end clear game data + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_META_BEGIN_PATH_BUILD: @@ -561,7 +561,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end GameMessage::MSG_COMBATDROP_AT_OBJECT + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_COMBATDROP_AT_LOCATION: @@ -584,7 +584,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end GameMessage::MSG_COMBATDROP_AT_LOCATION + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_WEAPON_AT_OBJECT: @@ -606,10 +606,10 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // lock it just till the weapon is empty or the attack is "done" if (currentlySelectedGroup->setWeaponLockForGroup( weaponSlot, LOCKED_TEMPORARILY )) currentlySelectedGroup->groupAttackObject( targetObject, maxShotsToFire, CMD_FROM_PLAYER ); - } // end if, command for group + } break; - } // end do weapon at object + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_SWITCH_WEAPONS: @@ -661,11 +661,11 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) currentlySelectedGroup->groupAttackPosition( &targetLoc, maxShotsToFire, CMD_FROM_PLAYER ); - } // end if, command for group + } break; - } //end do weapon at location + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_SPECIAL_POWER: @@ -701,7 +701,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) } break; - } // end do special + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_SPECIAL_POWER_AT_LOCATION: @@ -746,7 +746,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) } break; - } // end do special at location + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_SPECIAL_POWER_AT_OBJECT: @@ -788,7 +788,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) } break; - } // end do special at object + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_ATTACKMOVETO: @@ -1016,7 +1016,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end GameMessage::MSG_ENTER + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_EXIT: @@ -1051,7 +1051,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end GameMessage::MSG_EXIT + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_EVACUATE: @@ -1078,11 +1078,11 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // no, this is bad, don't do here, do when POSTING message // pickAndPlayUnitVoiceResponse( TheInGameUI->getAllSelectedDrawables(), GameMessage::MSG_EVACUATE ); - } // end if, command for group + } break; - } // end GameMessage::MSG_EVACUATE + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_EXECUTE_RAILED_TRANSPORT: @@ -1094,7 +1094,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end GameMessage::MSG_EXECUTE_RAILED_TRANSPORT + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_INTERNET_HACK: @@ -1123,7 +1123,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end get repaired + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_DOCK: @@ -1140,7 +1140,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end get repaired + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_GET_HEALED: @@ -1157,7 +1157,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end get repaired + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_REPAIR: @@ -1177,7 +1177,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end get repaired + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_RESUME_CONSTRUCTION: @@ -1201,7 +1201,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end resume construction + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_SPECIAL_POWER_OVERRIDE_DESTINATION: @@ -1232,7 +1232,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end GameMessage::MSG_DO_SPECIAL_POWER_OVERRIDE_DESTINATION + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_ATTACK_OBJECT: @@ -1254,7 +1254,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end GameMessage::MSG_DO_ATTACK_OBJECT + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_FORCE_ATTACK_OBJECT: @@ -1274,7 +1274,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end GameMessage::MSG_DO_FORCE_ATTACK_OBJECT + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_FORCE_ATTACK_GROUND: @@ -1313,7 +1313,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end GameMessage::MSG_DO_FORCE_ATTACK_GROUND + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_QUEUE_UPGRADE: @@ -1327,7 +1327,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end queue upgrade + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_CANCEL_UPGRADE: @@ -1357,7 +1357,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end cancel upgrade + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_QUEUE_UNIT_CREATE: @@ -1387,14 +1387,14 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) producer->getTemplate()->getName().str()) ); break; - } // end if + } // queue the build pu->queueCreateUnit( whatToCreate, productionID ); break; - } // end GameMessage::MSG_QUEUE_UNIT_CREATE + } //------------------------------------------------------------------------------------------------- case GameMessage::MSG_CANCEL_UNIT_CREATE: @@ -1424,7 +1424,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end GameMessage::MSG_CANCEL_UNIT_CREATE + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DOZER_CONSTRUCT: @@ -1453,7 +1453,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) TheBuildAssistant->buildObjectNow( constructorObject, place, &loc, angle, constructorObject->getControllingPlayer() ); - } // end if + } else { Coord3D locEnd; @@ -1465,7 +1465,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) TheBuildAssistant->buildObjectLineNow( constructorObject, place, &loc, &locEnd, angle, constructorObject->getControllingPlayer() ); - } // end else + } // place the sound for putting a building down @@ -1479,7 +1479,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end build start + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DOZER_CANCEL_CONSTRUCT: @@ -1519,7 +1519,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end cancel dozer construction + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_SELL: @@ -1531,7 +1531,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end sell + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_TOGGLE_OVERCHARGE: @@ -1543,7 +1543,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end toggle overcharge + } #ifdef ALLOW_SURRENDER // -------------------------------------------------------------------------------------------- @@ -1558,11 +1558,11 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) if( currentlySelectedGroup ) currentlySelectedGroup->groupPickUpPrisoner( prisoner, CMD_FROM_PLAYER ); - } // end if + } break; - } // end pick up prisoner + } #endif #ifdef ALLOW_SURRENDER @@ -1576,7 +1576,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end return to prison + } #endif //--------------------------------------------------------------------------------------------- @@ -1606,7 +1606,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end build start + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_REMOVE_FROM_SELECTED_GROUP: @@ -1630,7 +1630,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end MSG_REMOVE_FROM_SELECTED_GROUP + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DESTROY_SELECTED_GROUP: @@ -1643,7 +1643,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end build start + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_SELECTED_GROUP_COMMAND: @@ -1651,7 +1651,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end selected group command + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_PLACE_BEACON: @@ -1746,7 +1746,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) TheAudio->addAudioEvent(&aSound); } break; - } // end beacon placement + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_REMOVE_BEACON: @@ -1811,7 +1811,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) #endif } break; - } // end beacon removal + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_SET_BEACON_TEXT: @@ -1842,7 +1842,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) } } break; - } // end beacon text + } // -------------------------------------------------------------------------------------------- case GameMessage::MSG_SELF_DESTRUCT: @@ -1911,7 +1911,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) } } break; - } // end beacon text + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_CREATE_TEAM0: @@ -1934,7 +1934,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) player->processCreateTeamGameMessage(msg->getType() - GameMessage::MSG_CREATE_TEAM0, msg); break; - } // end create team command + } case GameMessage::MSG_SELECT_TEAM0: case GameMessage::MSG_SELECT_TEAM1: @@ -2032,7 +2032,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) } break; - } // end CRC message + } //--------------------------------------------------------------------------------------------- case GameMessage::MSG_PURCHASE_SCIENCE: @@ -2047,9 +2047,9 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) break; - } // end pick specialized science + } - } // end switch + } #if RETAIL_COMPATIBLE_AIGROUP // TheSuperHackers @bugfix xezon 28/06/2025 This hack avoids crashing when players are selected during Replay playback. @@ -2086,4 +2086,4 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) #endif } -} // end logicMessageDispatches +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameInfo.cpp index 935b23ebe1a..e9371c842df 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameInfo.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameInfo.cpp @@ -211,7 +211,7 @@ void GameSlot::setState( SlotState state, UnicodeString name, UnsignedInt IP ) reset(); m_state = state; m_name = name; - }// state == SLOT_PLAYER + } else { m_state = state; @@ -1306,7 +1306,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) } newSlot[i].setNATBehavior(NATType); DEBUG_LOG(("ParseAsciiStringToGameInfo - NAT behavior is %X", NATType)); - }// case 'H': + } break; case 'C': { @@ -1347,7 +1347,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) DEBUG_LOG(("ParseAsciiStringToGameInfo - Unknown AI, quitting")); } break; - }//switch(*rawSlot.str()+1) + } //Read color index slotValue = strtok_r(NULL,",",&slotPos); @@ -1433,19 +1433,19 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) newSlot[i].setTeamNumber(team); //DEBUG_LOG(("ParseAsciiStringToGameInfo - team number is %d", team)); - }//case 'C': + } break; case 'O': { newSlot[i].setState( SLOT_OPEN ); //DEBUG_LOG(("ParseAsciiStringToGameInfo - Slot is open")); - }// case 'O': + } break; case 'X': { newSlot[i].setState( SLOT_CLOSED ); //DEBUG_LOG(("ParseAsciiStringToGameInfo - Slot is closed")); - }// case 'X': + } break; default: { @@ -1510,7 +1510,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) // ------------------------------------------------------------------------------------------------ void SkirmishGameInfo::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method */ @@ -1615,13 +1615,13 @@ void SkirmishGameInfo::xfer( Xfer *xfer ) m_startingCash = TheGlobalData->m_defaultStartingCash; } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ // ------------------------------------------------------------------------------------------------ void SkirmishGameInfo::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp index 8eb5fc7cf36..b4959d3f80f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp @@ -255,7 +255,7 @@ void GameSpyInfo::addChat( PlayerInfo p, UnicodeString msg, Bool isPublic, Bool if( TheAudio ) { TheAudio->addAudioEvent( &privMsgAudio ); - } // end if + } } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpyOverlay.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpyOverlay.cpp index 9f64130e770..3e0be7b1907 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpyOverlay.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpyOverlay.cpp @@ -214,7 +214,7 @@ void GameSpyOpenOverlay( GSOverlayType overlay ) if( TheAudio ) { TheAudio->addAudioEvent( &buttonClick ); - } // end if + } } if (overlayLayouts[overlay]) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp index c0013fade9e..91d7690fa9f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp @@ -425,7 +425,7 @@ void LANAPI::update( void ) // Mark it as read m_transport->m_inBuffer[i].length = 0; } - } // End message handling + } if(LANbuttonPushed) return; // Send out periodic I'm Here messages @@ -1024,7 +1024,7 @@ void LANAPI::RequestSlotList( void ) sendMessage(&reply); OnSlotList(LANAPIInterface::RET_OK, m_currentGame); -} // void LANAPI::RequestSlotList( void ) +} */ void LANAPI::RequestSetName( UnicodeString newName ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp index 647c00ec832..e3523cc4e1d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp @@ -109,14 +109,14 @@ void LANAPI::OnAccept( UnsignedInt playerIP, Bool status ) else m_currentGame->getLANSlot(i)->unAccept(); break; - }// if - }// for + } + } if (i != MAX_SLOTS ) { RequestGameOptions( GenerateGameOptionsString(), false ); lanUpdateSlotList(); } - }//if + } else { //i'm not the host but if the accept came from the host... @@ -127,7 +127,7 @@ void LANAPI::OnAccept( UnsignedInt playerIP, Bool status ) OnChat(UnicodeString(L"SYSTEM"), m_localIP, text, LANCHAT_SYSTEM); } } -}// void LANAPI::OnAccept( UnicodeString player, Bool status ) +} void LANAPI::OnHasMap( UnsignedInt playerIP, Bool status ) { @@ -140,8 +140,8 @@ void LANAPI::OnHasMap( UnsignedInt playerIP, Bool status ) { m_currentGame->getLANSlot(i)->setMapAvailability( status ); break; - }// if - }// for + } + } if (i != MAX_SLOTS ) { UnicodeString mapDisplayName; @@ -169,8 +169,8 @@ void LANAPI::OnHasMap( UnsignedInt playerIP, Bool status ) } lanUpdateSlotList(); } - }//if -}// void LANAPI::OnHasMap( UnicodeString player, Bool status ) + } +} void LANAPI::OnGameStartTimer( Int seconds ) { @@ -591,7 +591,7 @@ void LANAPI::OnGameList( LANGameInfo *gameList ) { LANDisplayGameList(listboxGames, gameList); } -}//void LANAPI::OnGameList( LANGameInfo *gameList ) +} void LANAPI::OnGameCreate( ReturnType ret ) { @@ -622,7 +622,7 @@ void LANAPI::OnGameCreate( ReturnType ret ) } } -}//void OnGameCreate( ReturnType ret ) +} void LANAPI::OnPlayerList( LANPlayer *playerList ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetCommandMsg.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetCommandMsg.cpp index cb6eaeb5acd..72f51f4d11d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetCommandMsg.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetCommandMsg.cpp @@ -161,7 +161,7 @@ static Int indexFromMask(UnsignedInt mask) player = ThePlayerList->getNthPlayer( i ); if( player && player->getPlayerMask() == mask ) return i; - } // end for i + } return -1; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetPacket.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetPacket.cpp index 60d71ab5e82..776ad7eb02b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetPacket.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetPacket.cpp @@ -362,7 +362,7 @@ UnsignedInt NetPacket::GetGameCommandSize(NetCommandMsg *msg) { GameMessageArgumentDataType type = arg->getType(); switch (type) { - + case ARGUMENTDATATYPE_INTEGER: msglen += arg->getArgCount() * sizeof(Int); break; diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/Transport.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/Transport.cpp index 0d5c7970c9a..6163107d414 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/Transport.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/Transport.cpp @@ -243,7 +243,7 @@ Bool Transport::doSend() { //DEBUG_LOG(("Transport::doSend returning FALSE")); } } - } // for (i=0; igetZoom(); m_reconstructViewBox = FALSE; -} // end reconstructViewBox +} //------------------------------------------------------------------------------------------------- /** Convert radar position to actual pixel coord */ @@ -241,7 +241,7 @@ void W3DRadar::radarToPixel( const ICoord2D *radar, ICoord2D *pixel, // note the "inverted" y here to orient the way our world looks with +x=right and -y=down pixel->y = ((RADAR_CELL_HEIGHT - 1 - radar->y) * radarHeight / RADAR_CELL_HEIGHT) + radarUpperLeftY; -} // end radarToPixel +} //------------------------------------------------------------------------------------------------- @@ -360,7 +360,7 @@ void W3DRadar::drawViewBox( Int pixelX, Int pixelY, Int width, Int height ) TheDisplay->drawLine( clipStart.x, clipStart.y, clipEnd.x, clipEnd.y, lineWidth, bottomColor, topColor ); -} // end drawViewBox +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -435,7 +435,7 @@ void W3DRadar::drawSingleBeaconEvent( Int pixelX, Int pixelY, Int width, Int hei a = REAL_TO_UNSIGNEDBYTE( (Real)a * (1.0f - (Real)(currentFrame - event->fadeFrame) / (Real)(event->dieFrame - event->fadeFrame) ) ); - } // end if + } startColor = GameMakeColor( r, g, b, a ); // color 2 ------------------ @@ -449,7 +449,7 @@ void W3DRadar::drawSingleBeaconEvent( Int pixelX, Int pixelY, Int width, Int hei a = REAL_TO_UNSIGNEDBYTE( (Real)a * (1.0f - (Real)(currentFrame - event->fadeFrame) / (Real)(event->dieFrame - event->fadeFrame) ) ); - } // end if + } endColor = GameMakeColor( r, g, b, a ); // draw the lines @@ -534,7 +534,7 @@ void W3DRadar::drawSingleGenericEvent( Int pixelX, Int pixelY, Int width, Int he a = REAL_TO_UNSIGNEDBYTE( (Real)a * (1.0f - (Real)(currentFrame - event->fadeFrame) / (Real)(event->dieFrame - event->fadeFrame) ) ); - } // end if + } startColor = GameMakeColor( r, g, b, a ); // color 2 ------------------ @@ -548,7 +548,7 @@ void W3DRadar::drawSingleGenericEvent( Int pixelX, Int pixelY, Int width, Int he a = REAL_TO_UNSIGNEDBYTE( (Real)a * (1.0f - (Real)(currentFrame - event->fadeFrame) / (Real)(event->dieFrame - event->fadeFrame) ) ); - } // end if + } endColor = GameMakeColor( r, g, b, a ); // draw the lines @@ -580,7 +580,7 @@ void W3DRadar::drawEvents( Int pixelX, Int pixelY, Int width, Int height ) static AudioEventRTS eventSound("RadarEvent"); TheAudio->addAudioEvent( &eventSound ); - } // end if + } m_event[ i ].soundPlayed = TRUE; @@ -589,11 +589,11 @@ void W3DRadar::drawEvents( Int pixelX, Int pixelY, Int width, Int height ) else drawSingleGenericEvent( pixelX, pixelY, width, height, i ); - } // end if + } - } // end for i + } -} // end drawEvents +} //------------------------------------------------------------------------------------------------- @@ -711,7 +711,7 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text a = REAL_TO_UNSIGNEDBYTE( (alphaScale * (255.0f - minAlpha)) + minAlpha ); c = GameMakeColor( r, g, b, a ); - } // end if + } @@ -732,10 +732,10 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text if( legalRadarPoint( radarPoint.x, radarPoint.y ) ) surface->DrawPixel( radarPoint.x, radarPoint.y, c ); - } // end for + } REF_PTR_RELEASE(surface); -} // end renderObjectList +} //------------------------------------------------------------------------------------------------- /** Shade the color passed in using the height parameter to lighten and darken it. Colors @@ -775,7 +775,7 @@ void W3DRadar::interpolateColorForHeight( RGBColor *color, colorTarget.green = color->green + (1.0f - color->green) * howBright; colorTarget.blue = color->blue + (1.0f - color->blue) * howBright; - } // end if + } else // interpolate darker { @@ -787,7 +787,7 @@ void W3DRadar::interpolateColorForHeight( RGBColor *color, colorTarget.green = color->green + (0.0f - color->green) * howDark; colorTarget.blue = color->blue + (0.0f - color->blue) * howDark; - } // end else + } // interpolate toward the target color color->red = color->red + (colorTarget.red - color->red) * t; @@ -808,7 +808,7 @@ void W3DRadar::interpolateColorForHeight( RGBColor *color, if( color->blue > 1.0f ) color->blue = 1.0f; -} // end interpolateColorForHeight +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC METHODS ///////////////////////////////////////////////////////////////////////////////// @@ -843,9 +843,9 @@ W3DRadar::W3DRadar( void ) m_viewBox[ i ].x = 0; m_viewBox[ i ].y = 0; - } // end for + } -} // end W3DRadar +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -855,7 +855,7 @@ W3DRadar::~W3DRadar( void ) // delete resources used for the W3D radar deleteResources(); -} // end ~W3DRadar +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -953,7 +953,7 @@ void W3DRadar::init( void ) size.y = m_textureHeight; m_shroudImage->setImageSize( &size ); -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset the radar to the initial empty state ready for new data */ @@ -987,7 +987,7 @@ void W3DRadar::reset( void ) //gs Dude, it's called CLEARshroud. It needs to clear the shroud. clearShroud(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update */ @@ -998,7 +998,7 @@ void W3DRadar::update( void ) // extend base class Radar::update(); -} // end update +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1050,7 +1050,7 @@ void W3DRadar::newMap( TerrainLogic *terrain ) // build terrain texture buildTerrainTexture( terrain ); -} // end newMap +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1104,9 +1104,9 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain ) if( body->getDamageState() != BODY_RUBBLE ) workingBridge = TRUE; - } // end if + } - } // end if + } // create a color based on the Z height of the map Real waterZ; @@ -1153,15 +1153,15 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain ) sampleColor.blue += color.blue; samples++; - } // end if + } - } // end if + } - } // end for i + } - } // end if + } - } // end for j + } // prevent divide by zeros if( samples == 0 ) @@ -1172,7 +1172,7 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain ) color.green = sampleColor.green / (Real)samples; color.blue = sampleColor.blue / (Real)samples; - } // end if + } else // regular terrain ... { const Int samplesAway = 1; // how many "tiles" from the center tile we will sample away @@ -1226,7 +1226,7 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain ) getTerrainAverageZ(), m_mapExtent.hi.z, m_mapExtent.lo.z ); - } // end if + } else { @@ -1237,7 +1237,7 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain ) interpolateColorForHeight( &color, worldPoint.z, getTerrainAverageZ(), m_mapExtent.hi.z, m_mapExtent.lo.z ); - } // end else + } // add color to our samples sampleColor.red += color.red; @@ -1245,13 +1245,13 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain ) sampleColor.blue += color.blue; samples++; - } // end if + } - } // end for i + } - } // end if + } - } // end for j + } // prevent divide by zeros if( samples == 0 ) @@ -1262,7 +1262,7 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain ) color.green = sampleColor.green / (Real)samples; color.blue = sampleColor.blue / (Real)samples; - } // end else + } // // draw the pixel for the terrain at this point, note that because of the orientation @@ -1278,14 +1278,14 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain ) color.blue * 255, 255 ) ); - } // end for x + } - } // end for y + } // all done with the surface REF_PTR_RELEASE(surface); -} // end buildTerrainTexture +} // ------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------- @@ -1414,7 +1414,7 @@ void W3DRadar::draw( Int pixelX, Int pixelY, Int width, Int height ) TheDisplay->drawLine(pixelX, ul.y, pixelX + width, ul.y, 1, lineColor); TheDisplay->drawLine(pixelX, lr.y + 1, pixelX + width, lr.y + 1, 1, lineColor); - } // end if + } else { @@ -1424,7 +1424,7 @@ void W3DRadar::draw( Int pixelX, Int pixelY, Int width, Int height ) TheDisplay->drawLine(ul.x, pixelY, ul.x, pixelY + height, 1, lineColor); TheDisplay->drawLine(lr.x + 1, pixelY, lr.x + 1, pixelY + height, 1, lineColor); - } // end else + } // draw the terrain texture TheDisplay->drawImage( m_terrainImage, ul.x, ul.y, lr.x, lr.y ); @@ -1442,7 +1442,7 @@ void W3DRadar::draw( Int pixelX, Int pixelY, Int width, Int height ) renderObjectList( getObjectList(), m_overlayTexture ); renderObjectList( getLocalObjectList(), m_overlayTexture, TRUE ); - } // end if + } // draw the overlay image TheDisplay->drawImage( m_overlayImage, ul.x, ul.y, lr.x, lr.y ); @@ -1475,7 +1475,7 @@ void W3DRadar::draw( Int pixelX, Int pixelY, Int width, Int height ) // draw the view region on top of the radar reconstructing if necessary drawViewBox( ul.x, ul.y, scaledWidth, scaledHeight ); -} // end draw +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1488,7 +1488,7 @@ void W3DRadar::refreshTerrain( TerrainLogic *terrain ) // rebuild the entire terrain texture buildTerrainTexture( terrain ); -} // end refreshTerrain +} @@ -1595,7 +1595,7 @@ void W3DRadar::refreshTerrain( TerrainLogic *terrain ) a = REAL_TO_UNSIGNEDBYTE( (alphaScale * (255.0f - minAlpha)) + minAlpha ); c = GameMakeColor( r, g, b, a ); - } // end if + } @@ -1619,10 +1619,10 @@ void W3DRadar::refreshTerrain( TerrainLogic *terrain ) - } // end for + } REF_PTR_RELEASE(surface); -} // end renderObjectList +} * diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/Thing/W3DModuleFactory.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/Thing/W3DModuleFactory.cpp index 5f66ef65c2c..0e51ce61537 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/Thing/W3DModuleFactory.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/Thing/W3DModuleFactory.cpp @@ -79,4 +79,4 @@ void W3DModuleFactory::init( void ) addModule( W3DTreeDraw ); addModule( W3DPropDraw ); -} // end init +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/Thing/W3DThingFactory.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/Thing/W3DThingFactory.cpp index 484d1d8c1b0..01526472393 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/Thing/W3DThingFactory.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/Thing/W3DThingFactory.cpp @@ -37,12 +37,12 @@ W3DThingFactory::W3DThingFactory( void ) { -} // end W3DThingFactory +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- W3DThingFactory::~W3DThingFactory( void ) { -} // end ~W3DThingFactory +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/W3DConvert.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/W3DConvert.cpp index e949e85ce9d..bb98bdc9fa9 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/W3DConvert.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/W3DConvert.cpp @@ -90,7 +90,7 @@ void W3DLogicalScreenToPixelScreen( Real logX, Real logY, *screenX = REAL_TO_INT((screenWidth * (logX + 1.0f)) / 2.0f); *screenY = REAL_TO_INT((screenHeight * (-logY + 1.0f)) / 2.0f); -} // end W3DLogicalScreenToPixelScreen +} //============================================================================= // PixelScreenToW3DLogicalScreen @@ -107,4 +107,4 @@ void PixelScreenToW3DLogicalScreen( Int screenX, Int screenY, *logX = ((2.0f * screenX) / (Real)screenWidth) - 1.0f; *logY = -(((2.0f * screenY) / (Real)screenHeight) - 1.0f); -} // end PixelScreenToW3DLogicalScreen +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp index 98e714b0baf..93b9f9cf1fb 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp @@ -2602,7 +2602,7 @@ void BaseHeightMapRenderObjClass::renderShoreLines(CameraClass *pCamera) indexCount +=6; } } - }//lock and fill ib/vb + } if (indexCount > 0 && vertexCount > 0) { @@ -2614,7 +2614,7 @@ void BaseHeightMapRenderObjClass::renderShoreLines(CameraClass *pCamera) vertexCount=0; indexCount=0; - }//for all shore tiles + } //Disable writes to destination alpha DX8Wrapper::Set_DX8_Render_State(D3DRS_COLORWRITEENABLE,D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_RED); @@ -2814,9 +2814,9 @@ void BaseHeightMapRenderObjClass::renderShoreLinesSorted(CameraClass *pCamera) vertexCount +=4; indexCount +=6; shoreInfo++; //advance to next tile. - }//looping over tiles in column + } lastRenderedTile=0; - }//looping over all visible columns. + } flushVertexBuffer0: drawStartX = x; //record how far we've moved so far isDone = x >= drawEdgeX; @@ -2935,14 +2935,14 @@ void BaseHeightMapRenderObjClass::renderShoreLinesSorted(CameraClass *pCamera) vertexCount +=4; indexCount +=6; shoreInfo++; //advance to next tile. - }//looping over tiles in row + } lastRenderedTile=0; - }//looping over all visible rows. + } flushVertexBuffer1: drawStartY = y; //record how far we've moved so far isDone = y >= drawEdgeY; } - }//lock and fill ib/vb + } if (indexCount > 0 && vertexCount > 0) { @@ -2954,7 +2954,7 @@ void BaseHeightMapRenderObjClass::renderShoreLinesSorted(CameraClass *pCamera) vertexCount=0; indexCount=0; - }//for all shore tiles + } //Disable writes to destination alpha DX8Wrapper::Set_DX8_Render_State(D3DRS_COLORWRITEENABLE,D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_RED); @@ -2992,7 +2992,7 @@ void BaseHeightMapRenderObjClass::renderTrees(CameraClass * camera) void BaseHeightMapRenderObjClass::crc( Xfer *xfer ) { // empty. jba [8/11/2003] -} // end CRC +} // ------------------------------------------------------------------------------------------------ /** Xfer @@ -3011,7 +3011,7 @@ void BaseHeightMapRenderObjClass::xfer( Xfer *xfer ) xfer->xferSnapshot( m_propBuffer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -3019,5 +3019,5 @@ void BaseHeightMapRenderObjClass::xfer( Xfer *xfer ) void BaseHeightMapRenderObjClass::loadPostProcess( void ) { // empty. jba [8/11/2003] -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDebrisDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDebrisDraw.cpp index de6497d1376..dc32633ad00 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDebrisDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDebrisDraw.cpp @@ -270,7 +270,7 @@ void W3DDebrisDraw::crc( Xfer *xfer ) // extend base class DrawModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -320,7 +320,7 @@ void W3DDebrisDraw::xfer( Xfer *xfer ) // final stop xfer->xferBool( &m_finalStop ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -331,4 +331,4 @@ void W3DDebrisDraw::loadPostProcess( void ) // extend base class DrawModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp index 5b13ead8c30..471494eab85 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp @@ -170,7 +170,7 @@ void W3DDefaultDraw::crc( Xfer *xfer ) // extend base class DrawModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -188,7 +188,7 @@ void W3DDefaultDraw::xfer( Xfer *xfer ) // extend base class DrawModule::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -199,4 +199,4 @@ void W3DDefaultDraw::loadPostProcess( void ) // extend base class DrawModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDependencyModelDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDependencyModelDraw.cpp index 825b5995add..8582b2e5b1b 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDependencyModelDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDependencyModelDraw.cpp @@ -160,7 +160,7 @@ void W3DDependencyModelDraw::crc( Xfer *xfer ) // extend base class W3DModelDraw::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -181,7 +181,7 @@ void W3DDependencyModelDraw::xfer( Xfer *xfer ) // Dependency status xfer->xferBool( &m_dependencyCleared ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -192,6 +192,6 @@ void W3DDependencyModelDraw::loadPostProcess( void ) // extend base class W3DModelDraw::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DLaserDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DLaserDraw.cpp index 857b5954faf..5fa25f6e275 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DLaserDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DLaserDraw.cpp @@ -209,9 +209,9 @@ W3DLaserDraw::W3DLaserDraw( Thing *thing, const ModuleData* moduleData ) : } - } // end for i + } - } //end segment loop + } } @@ -231,7 +231,7 @@ W3DLaserDraw::~W3DLaserDraw( void ) // delete line REF_PTR_RELEASE( m_line3D[ i ] ); - } // end for i + } delete [] m_line3D; // TheSuperHackers @fix Mauller 11/03/2025 Free reference counted material @@ -431,7 +431,7 @@ void W3DLaserDraw::crc( Xfer *xfer ) // extend base class DrawModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -452,7 +452,7 @@ void W3DLaserDraw::xfer( Xfer *xfer ) // Kris says there is no data to save for these, go ask him. // m_selfDirty is not saved, is runtime only -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -465,4 +465,4 @@ void W3DLaserDraw::loadPostProcess( void ) m_selfDirty = true; // so we update the first time after reload -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp index 9ecbb5deec1..9a17a70d603 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp @@ -844,7 +844,7 @@ void ModelConditionInfo::validateWeaponBarrelInfo() const CRCDEBUG_LOG(("validateWeaponBarrelInfo() - model name %s (unadorned) found nothing", m_modelName.str())); BONEPOS_LOG(("validateWeaponBarrelInfo() - model name %s (unadorned) found nothing", m_modelName.str())); } - } // if empty + } DEBUG_ASSERTCRASH(!(m_modelName.isNotEmpty() && m_weaponBarrelInfoVec[wslot].empty()), ("*** ASSET ERROR: No fx bone named '%s' found in model %s!",fxBoneName.str(),m_modelName.str())); } @@ -2458,7 +2458,7 @@ void W3DModelDraw::handleClientTurretPositioning() } } } - } // next tslot + } } @@ -2711,12 +2711,12 @@ Bool W3DModelDraw::updateBonesForClientParticleSystems() sys->setSkipParentXfrm(true); } - }// next praticle system + } // m_renderObject->Set_Transform(originalTransform); - }// end if Drawable + } return TRUE; @@ -3205,7 +3205,7 @@ void W3DModelDraw::setSelectable(Bool selectable) current &= ~PICK_TYPE_SELECTABLE; } m_renderObject->Set_Collision_Type(current); - } // end if + } } //------------------------------------------------------------------------------------------------- @@ -4020,7 +4020,7 @@ void W3DModelDraw::crc( Xfer *xfer ) // extend base class DrawModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -4068,9 +4068,9 @@ void W3DModelDraw::xfer( Xfer *xfer ) weaponRecoilInfo.m_recoilRate = (*it).m_recoilRate; xfer->xferReal( &weaponRecoilInfo.m_recoilRate ); - } // end for, it + } - } // end if, save + } else { @@ -4093,11 +4093,11 @@ void W3DModelDraw::xfer( Xfer *xfer ) // stuff it in the vector m_weaponRecoilInfoVec[ i ].push_back( weaponRecoilInfo ); - } // end for, j + } - } // end else, load + } - } // end for, i + } // sub object vector UnsignedByte subObjectCount = m_subObjectVec.size(); @@ -4118,9 +4118,9 @@ void W3DModelDraw::xfer( Xfer *xfer ) hideShowSubObjInfo.hide = (*it).hide; xfer->xferBool( &hideShowSubObjInfo.hide ); - } // end for, it + } - } // end if, save + } else { @@ -4140,9 +4140,9 @@ void W3DModelDraw::xfer( Xfer *xfer ) // stuff in vector m_subObjectVec.push_back( hideShowSubObjInfo ); - } // end for, i + } - } // end else, load + } // animation if( version >= 2 ) @@ -4184,9 +4184,9 @@ void W3DModelDraw::xfer( Xfer *xfer ) Real percent = frame / INT_TO_REAL( anim->Get_Num_Frames()-1 ); xfer->xferReal( &percent ); - } // end if, anim + } - } // end if + } else { @@ -4194,9 +4194,9 @@ void W3DModelDraw::xfer( Xfer *xfer ) Bool present = FALSE; xfer->xferBool( &present ); - } // end else + } - } // end if, save + } else { @@ -4245,21 +4245,21 @@ void W3DModelDraw::xfer( Xfer *xfer ) // set animation data hlod->Set_Animation( anim, frame, curMode ); - } // end if, anim + } - } // end if + } - } // end if + } - } // end else, load + } - } // end if, version with animation info + } // when loading, update the sub objects if we have any if( xfer->getXferMode() == XFER_LOAD && m_subObjectVec.empty() == FALSE ) updateSubObjects(); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -4270,7 +4270,7 @@ void W3DModelDraw::loadPostProcess( void ) // extend base class DrawModule::loadPostProcess(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordAircraftDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordAircraftDraw.cpp index 8aba0a4de3c..fb3d7795d56 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordAircraftDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordAircraftDraw.cpp @@ -135,7 +135,7 @@ void W3DOverlordAircraftDraw::crc( Xfer *xfer ) // extend base class W3DModelDraw::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -153,7 +153,7 @@ void W3DOverlordAircraftDraw::xfer( Xfer *xfer ) // extend base class W3DModelDraw::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -164,4 +164,4 @@ void W3DOverlordAircraftDraw::loadPostProcess( void ) // extend base class W3DModelDraw::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp index 530d8682a18..0a4c356cc0a 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp @@ -119,7 +119,7 @@ void W3DOverlordTankDraw::crc( Xfer *xfer ) // extend base class W3DTankDraw::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -137,7 +137,7 @@ void W3DOverlordTankDraw::xfer( Xfer *xfer ) // extend base class W3DTankDraw::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -148,4 +148,4 @@ void W3DOverlordTankDraw::loadPostProcess( void ) // extend base class W3DTankDraw::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTruckDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTruckDraw.cpp index 471cb67dbb6..e748a8e167c 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTruckDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTruckDraw.cpp @@ -119,7 +119,7 @@ void W3DOverlordTruckDraw::crc( Xfer *xfer ) // extend base class W3DTruckDraw::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -137,7 +137,7 @@ void W3DOverlordTruckDraw::xfer( Xfer *xfer ) // extend base class W3DTruckDraw::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -148,4 +148,4 @@ void W3DOverlordTruckDraw::loadPostProcess( void ) // extend base class W3DTruckDraw::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPoliceCarDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPoliceCarDraw.cpp index 3077e89ca07..5dd2dcf89e8 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPoliceCarDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPoliceCarDraw.cpp @@ -62,11 +62,11 @@ W3DDynamicLight *W3DPoliceCarDraw::createDynamicLight( void ) light->Set_Position( Vector3( 0.0f, 0.0f, 0.0f ) ); light->Set_Far_Attenuation_Range( 5, 15 ); - } // end if + } return light; -} // end createDynamicSearchLight +} // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -92,7 +92,7 @@ W3DPoliceCarDraw::~W3DPoliceCarDraw( void ) m_light->setDecayRange(); m_light->setDecayColor(); m_light = NULL; - } // end if + } } @@ -165,7 +165,7 @@ void W3DPoliceCarDraw::crc( Xfer *xfer ) // extend base class W3DTruckDraw::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -185,7 +185,7 @@ void W3DPoliceCarDraw::xfer( Xfer *xfer ) // John A says there is no data for these to save -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -196,4 +196,4 @@ void W3DPoliceCarDraw::loadPostProcess( void ) // extend base class W3DTruckDraw::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DProjectileStreamDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DProjectileStreamDraw.cpp index 42a41738f61..6aa69be1c09 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DProjectileStreamDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DProjectileStreamDraw.cpp @@ -230,7 +230,7 @@ void W3DProjectileStreamDraw::crc( Xfer *xfer ) // extend base class DrawModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -250,7 +250,7 @@ void W3DProjectileStreamDraw::xfer( Xfer *xfer ) // Graham says there is no data that needs saving here -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -261,4 +261,4 @@ void W3DProjectileStreamDraw::loadPostProcess( void ) // extend base class DrawModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPropDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPropDraw.cpp index f04c0102894..1347418903d 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPropDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPropDraw.cpp @@ -72,7 +72,7 @@ W3DPropDraw::W3DPropDraw( Thing *thing, const ModuleData* moduleData ) : DrawMod m_propAdded(false) { -} // end W3DPropDraw +} //------------------------------------------------------------------------------------------------- @@ -122,7 +122,7 @@ void W3DPropDraw::crc( Xfer *xfer ) // extend base class DrawModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -142,7 +142,7 @@ void W3DPropDraw::xfer( Xfer *xfer ) // no data to save here, nobody will ever notice -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -153,4 +153,4 @@ void W3DPropDraw::loadPostProcess( void ) // extend base class DrawModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DRopeDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DRopeDraw.cpp index c8c22c956f3..8a9bd6ba630 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DRopeDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DRopeDraw.cpp @@ -222,7 +222,7 @@ void W3DRopeDraw::crc( Xfer *xfer ) // extend base class DrawModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -282,7 +282,7 @@ void W3DRopeDraw::xfer( Xfer *xfer ) tossSegments(); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -293,4 +293,4 @@ void W3DRopeDraw::loadPostProcess( void ) // extend base class DrawModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp index d52e4eb2bbb..08d5abe3f70 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp @@ -103,7 +103,7 @@ void W3DScienceModelDraw::crc( Xfer *xfer ) // extend base class W3DModelDraw::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -121,7 +121,7 @@ void W3DScienceModelDraw::xfer( Xfer *xfer ) // extend base class W3DModelDraw::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -132,6 +132,6 @@ void W3DScienceModelDraw::loadPostProcess( void ) // extend base class W3DModelDraw::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DSupplyDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DSupplyDraw.cpp index 4ff176da1e1..bde8a4caddc 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DSupplyDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DSupplyDraw.cpp @@ -119,7 +119,7 @@ void W3DSupplyDraw::crc( Xfer *xfer ) // extend base class W3DModelDraw::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -139,7 +139,7 @@ void W3DSupplyDraw::xfer( Xfer *xfer ) // Graham says there's no data to save here -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -150,6 +150,6 @@ void W3DSupplyDraw::loadPostProcess( void ) // extend base class W3DModelDraw::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp index f1dd1ae0205..eb59745dd98 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp @@ -418,7 +418,7 @@ void W3DTankDraw::crc( Xfer *xfer ) // extend base class W3DModelDraw::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -438,7 +438,7 @@ void W3DTankDraw::xfer( Xfer *xfer ) // John A and Mark W say there is no data to save here -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -453,4 +453,4 @@ void W3DTankDraw::loadPostProcess( void ) tossEmitters(); createEmitters(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp index 0be4df71f72..94b43a54b7c 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp @@ -751,7 +751,7 @@ void W3DTankTruckDraw::crc( Xfer *xfer ) // extend base class W3DModelDraw::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -771,7 +771,7 @@ void W3DTankTruckDraw::xfer( Xfer *xfer ) // John A and Mark W say there is no data to save here -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -785,4 +785,4 @@ void W3DTankTruckDraw::loadPostProcess( void ) // toss any existing ones (no need to re-create; we'll do that on demand) tossEmitters(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTracerDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTracerDraw.cpp index 32c3c27a917..8398f8c0ece 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTracerDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTracerDraw.cpp @@ -61,7 +61,7 @@ W3DTracerDraw::W3DTracerDraw( Thing *thing, const ModuleData* moduleData ) : Dra m_speedInDistPerFrame = 1.0f; m_theTracer = NULL; -} // end W3DTracerDraw +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -160,7 +160,7 @@ void W3DTracerDraw::crc( Xfer *xfer ) // extend base class DrawModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -180,7 +180,7 @@ void W3DTracerDraw::xfer( Xfer *xfer ) // no data to save here, nobody will ever notice -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -191,4 +191,4 @@ void W3DTracerDraw::loadPostProcess( void ) // extend base class DrawModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTreeDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTreeDraw.cpp index c361998f713..44b4317164e 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTreeDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTreeDraw.cpp @@ -113,7 +113,7 @@ W3DTreeDraw::W3DTreeDraw( Thing *thing, const ModuleData* moduleData ) : DrawMod m_treeAdded(false) { -} // end W3DTreeDraw +} //------------------------------------------------------------------------------------------------- @@ -165,7 +165,7 @@ void W3DTreeDraw::crc( Xfer *xfer ) // extend base class DrawModule::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -185,7 +185,7 @@ void W3DTreeDraw::xfer( Xfer *xfer ) // no data to save here, nobody will ever notice -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -196,5 +196,5 @@ void W3DTreeDraw::loadPostProcess( void ) // extend base class DrawModule::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp index cca3ce92f22..12a52f8da16 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp @@ -642,7 +642,7 @@ void W3DTruckDraw::crc( Xfer *xfer ) // extend base class W3DModelDraw::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -662,7 +662,7 @@ void W3DTruckDraw::xfer( Xfer *xfer ) // John A and Mark W say there is no data to save here -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -676,4 +676,4 @@ void W3DTruckDraw::loadPostProcess( void ) // toss any existing ones (no need to re-create; we'll do that on demand) tossEmitters(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp index 4f66682e87f..81a998a7f17 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp @@ -53,7 +53,7 @@ void W3DCameoMovieDraw( GameWindow *window, WinInstanceData *instData ) TheDisplay->drawVideoBuffer( video, pos.x, pos.y, pos.x + size.x, pos.y + size.y ); } -} // end W3DLeftHUDDraw +} //------------------------------------------------------------------------------------------------- @@ -83,10 +83,10 @@ void W3DLeftHUDDraw( GameWindow *window, WinInstanceData *instData ) // draw the radar on the screen now TheRadar->draw( pos.x + 1, pos.y + 1, size.x - 2, size.y - 2 ); - } // end else if + } -} // end W3DLeftHUDDraw +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -97,7 +97,7 @@ void W3DRightHUDDraw( GameWindow *window, WinInstanceData *instData ) if( BitIsSet(window->winGetStatus(), WIN_STATUS_IMAGE )) W3DGameWinDefaultDraw( window, instData ); -} // end W3DRightHUDDraw +} Real logN(Real value, Real logBase) { @@ -214,7 +214,7 @@ void W3DPowerDraw( GameWindow *window, WinInstanceData *instData ) end.x, end.y ); start.x += centerBar->getImageWidth(); - } // end for i + } // we will draw the image but clip the parts we don't want to show IRegion2D reg; @@ -389,7 +389,7 @@ void W3DPowerDrawA( GameWindow *window, WinInstanceData *instData ) end.x, end.y ); start.x += centerBar->getImageWidth(); - } // end for i + } // we will draw the image but clip the parts we don't want to show IRegion2D reg; @@ -565,7 +565,7 @@ void W3DCommandBarGenExpDraw( GameWindow *window, WinInstanceData *instData ) end.x, end.y ); start.y += centerBar->getImageHeight(); - } // end for i + } // we will draw the image but clip the parts we don't want to show IRegion2D reg; @@ -676,7 +676,7 @@ void W3DNoDraw( GameWindow *window, WinInstanceData *instData ) // draw the default stuff // W3DGameWinDefaultDraw( window, instData ); -} // end W3DRightHUDDraw +} void drawSkinnyBorder( Int x, Int y, Int width, Int height); void W3DDrawMapPreview( GameWindow *window, WinInstanceData *instData) @@ -720,7 +720,7 @@ void W3DDrawMapPreview( GameWindow *window, WinInstanceData *instData) TheDisplay->drawLine(pixelX, ul.y, pixelX + width, ul.y, 1, lineColor); TheDisplay->drawLine(pixelX, lr.y + 1, pixelX + width, lr.y + 1, 1, lineColor); - } // end if + } else { @@ -730,7 +730,7 @@ void W3DDrawMapPreview( GameWindow *window, WinInstanceData *instData) TheDisplay->drawLine(ul.x, pixelY, ul.x, pixelY + height, 1, lineColor); TheDisplay->drawLine(lr.x + 1, pixelY, lr.x + 1, pixelY + height, 1, lineColor); - } // end else + } if(!BitIsSet(window->winGetStatus(), WIN_STATUS_IMAGE) || !window->winGetEnabledImage(0)) TheDisplay->drawFillRect(ul.x, ul.y, lr.x -ul.x, lr.y-ul.y, lineColor); @@ -978,7 +978,7 @@ void W3DCommandBarHelpPopupDraw( GameWindow *window, WinInstanceData *instData ) end.x, end.y ); start.y += centerBar->getImageHeight(); - } // end for i + } // we will draw the image but clip the parts we don't want to show IRegion2D reg; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMOTD.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMOTD.cpp index 9d6c66b0a81..656b3d6183a 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMOTD.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMOTD.cpp @@ -95,7 +95,7 @@ WindowMsgHandledType MOTDSystem( GameWindow *window, UnsignedInt msg, break; - } // end create + } // ------------------------------------------------------------------------ case GWM_DESTROY: @@ -103,7 +103,7 @@ WindowMsgHandledType MOTDSystem( GameWindow *window, UnsignedInt msg, break; - } // end case + } // ------------------------------------------------------------------------ case GBM_SELECTED: @@ -116,14 +116,14 @@ WindowMsgHandledType MOTDSystem( GameWindow *window, UnsignedInt msg, break; - } // end selected + } default: return MSG_IGNORED; - } // end switch + } return MSG_HANDLED; -} // end MOTDSystem +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp index 346bc44faca..15f06725100 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp @@ -594,7 +594,7 @@ void W3DMainMenuButtonDropShadowDraw( GameWindow *window, } - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -613,7 +613,7 @@ void W3DMainMenuButtonDropShadowDraw( GameWindow *window, } - } // end else if, hilited and enabled + } else { @@ -632,7 +632,7 @@ void W3DMainMenuButtonDropShadowDraw( GameWindow *window, } - } // end else, enabled only + } // sanity, we need to have these images to make it look right if( leftImage == NULL || rightImage == NULL || @@ -696,7 +696,7 @@ void W3DMainMenuButtonDropShadowDraw( GameWindow *window, end.x, end.y ); start.x += centerImage->getImageWidth(); - } // end for i + } // we will draw the image but clip the parts we don't want to show IRegion2D reg; @@ -772,7 +772,7 @@ void W3DMainMenuButtonDropShadowDraw( GameWindow *window, } // TheDisplay->enableClipping(FALSE); -} // end W3DGadgetPushButtonImageDraw +} // drawButtonText ============================================================= @@ -801,17 +801,17 @@ static void drawText( GameWindow *window, WinInstanceData *instData ) { textColor = window->winGetDisabledTextColor(); dropColor = window->winGetDisabledTextBorderColor(); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { textColor = window->winGetHiliteTextColor(); dropColor = window->winGetHiliteTextBorderColor(); - } // end else if, hilited + } else { textColor = window->winGetEnabledTextColor(); dropColor = window->winGetEnabledTextBorderColor(); - } // end enabled only + } // set our font to that of our parent if not the same if( text->getFont() != window->winGetFont() ) @@ -827,7 +827,7 @@ static void drawText( GameWindow *window, WinInstanceData *instData ) // draw it text->draw( textPos.x, textPos.y, textColor, dropColor ); -} // end drawButtonText +} // W3DMainMenuRandomTextDraw ================================================== /** Specialized drawing function for the random text */ @@ -887,7 +887,7 @@ void W3DThinBorderDraw( GameWindow *window, WinInstanceData *instData ) end.y = begin.y + size.y; TheWindowManager->winDrawImage( image, begin.x, begin.y, end.x, end.y ); - } // end if + } // get window position // TheDisplay->drawOpenRect(start.x - 1, start.y - 1, size.x + 2, size.y + 2, 1, BrownishColor); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp index cabcd57f070..eeb266b2087 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp @@ -86,17 +86,17 @@ static void drawCheckBoxText( GameWindow *window, WinInstanceData *instData ) { textColor = window->winGetDisabledTextColor(); dropColor = window->winGetDisabledTextBorderColor(); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { textColor = window->winGetHiliteTextColor(); dropColor = window->winGetHiliteTextBorderColor(); - } // end else if, hilited + } else { textColor = window->winGetEnabledTextColor(); dropColor = window->winGetEnabledTextBorderColor(); - } // end enabled only + } // set our font to that of our parent if not the same if( text->getFont() != window->winGetFont() ) @@ -112,7 +112,7 @@ static void drawCheckBoxText( GameWindow *window, WinInstanceData *instData ) // draw it text->draw( textPos.x, textPos.y, textColor, dropColor ); -} // end drawCheckBoxText +} // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// @@ -162,7 +162,7 @@ void W3DGadgetCheckBoxDraw( GameWindow *window, WinInstanceData *instData ) boxBorder = GadgetCheckBoxGetDisabledUncheckedBoxBorderColor( window ); } - } // end if + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -182,7 +182,7 @@ void W3DGadgetCheckBoxDraw( GameWindow *window, WinInstanceData *instData ) boxBorder = GadgetCheckBoxGetHiliteUncheckedBoxBorderColor( window ); } - } // end else if + } else { @@ -202,7 +202,7 @@ void W3DGadgetCheckBoxDraw( GameWindow *window, WinInstanceData *instData ) boxBorder = GadgetCheckBoxGetEnabledUncheckedBoxBorderColor( window ); } - } // end else + } // draw background border start.x = origin.x; @@ -237,13 +237,13 @@ void W3DGadgetCheckBoxDraw( GameWindow *window, WinInstanceData *instData ) TheWindowManager->winDrawLine( boxColor, WIN_DRAW_LINE_WIDTH, start.x, end.y, end.x, start.y ); - } // end if + } // draw the button text if( instData->getTextLength() ) drawCheckBoxText( window, instData ); -} // end W3DGadgetCheckBoxDraw +} // W3DGadgetCheckBoxImageDraw ================================================= /** Draw check box with user supplied images */ @@ -283,7 +283,7 @@ void W3DGadgetCheckBoxImageDraw( GameWindow *window, WinInstanceData *instData ) else boxImage = GadgetCheckBoxGetDisabledUncheckedBoxImage( window ); - } // end if + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -296,7 +296,7 @@ void W3DGadgetCheckBoxImageDraw( GameWindow *window, WinInstanceData *instData ) else boxImage = GadgetCheckBoxGetHiliteUncheckedBoxImage( window ); - } // end else if + } else { @@ -309,7 +309,7 @@ void W3DGadgetCheckBoxImageDraw( GameWindow *window, WinInstanceData *instData ) else boxImage = GadgetCheckBoxGetEnabledUncheckedBoxImage( window ); - } // end else + } // draw background image // if( backgroundImage ) @@ -327,10 +327,10 @@ void W3DGadgetCheckBoxImageDraw( GameWindow *window, WinInstanceData *instData ) TheWindowManager->winDrawImage( boxImage, start.x, start.y, end.x, end.y ); - } // end if + } // draw the text if( instData->getTextLength() ) drawCheckBoxText( window, instData ); -} // end W3DGadgetCheckBoxImageDraw +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DComboBox.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DComboBox.cpp index 34ea6bf93f0..cedb743a628 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DComboBox.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DComboBox.cpp @@ -102,21 +102,21 @@ void W3DGadgetComboBoxDraw( GameWindow *window, WinInstanceData *instData ) border = GadgetComboBoxGetDisabledBorderColor( window ); titleColor = window->winGetDisabledTextColor(); titleBorder = window->winGetDisabledTextBorderColor(); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { background = GadgetComboBoxGetHiliteColor( window ); border = GadgetComboBoxGetHiliteBorderColor( window ); titleColor = window->winGetHiliteTextColor(); titleBorder = window->winGetHiliteTextBorderColor(); - } // end else if, hilited + } else { background = GadgetComboBoxGetEnabledColor( window ); border = GadgetComboBoxGetEnabledBorderColor( window ); titleColor = window->winGetEnabledTextColor(); titleBorder = window->winGetEnabledTextBorderColor(); - } // end else, enabled + } // Draw the title if( title && title->getTextLength() ) @@ -132,7 +132,7 @@ void W3DGadgetComboBoxDraw( GameWindow *window, WinInstanceData *instData ) y += fontHeight + 1; height -= fontHeight + 1; - } // end if + } // draw the back border if( border != WIN_COLOR_UNDEFINED ) @@ -145,7 +145,7 @@ void W3DGadgetComboBoxDraw( GameWindow *window, WinInstanceData *instData ) x + 1, y + 1, x + width - 1, y + height - 1 ); -} // end W3DGadgetComboBoxDraw +} // W3DGadgetComboBoxImageDraw ================================================== /** Draw combo box with user supplied images */ @@ -200,7 +200,7 @@ void W3DGadgetComboBoxImageDraw( GameWindow *window, WinInstanceData *instData ) start.x, start.y, end.x, end.y ); - } // end if + } // Draw the title if( title && title->getTextLength() ) @@ -216,8 +216,8 @@ void W3DGadgetComboBoxImageDraw( GameWindow *window, WinInstanceData *instData ) y += TheWindowManager->winFontHeight( instData->getFont() ); height -= TheWindowManager->winFontHeight( instData->getFont() ) + 1; - } // end if + } -} // end W3DGadgetComboBoxImageDraw +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp index 292166ccb7c..adc27efe9df 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp @@ -88,21 +88,21 @@ void W3DGadgetHorizontalSliderDraw( GameWindow *window, WinInstanceData *instDat backBorder = GadgetSliderGetDisabledBorderColor( window ); backColor = GadgetSliderGetDisabledColor( window ); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { backBorder = GadgetSliderGetHiliteBorderColor( window ); backColor = GadgetSliderGetHiliteColor( window ); - } // end else if, hilited + } else { backBorder = GadgetSliderGetEnabledBorderColor( window ); backColor = GadgetSliderGetEnabledColor( window ); - } // end else, enabled + } // draw background border and rect over whole control if( backBorder != WIN_COLOR_UNDEFINED ) @@ -115,7 +115,7 @@ void W3DGadgetHorizontalSliderDraw( GameWindow *window, WinInstanceData *instDat TheWindowManager->winOpenRect( backBorder, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } if( backColor != WIN_COLOR_UNDEFINED ) { @@ -126,10 +126,10 @@ void W3DGadgetHorizontalSliderDraw( GameWindow *window, WinInstanceData *instDat TheWindowManager->winFillRect( backColor, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } -} // end W3DGadgetHorizontalSliderDraw +} // W3DGadgetHorizontalSliderImageDraw ========================================= /** Draw horizontal slider with user supplied images */ @@ -354,7 +354,7 @@ void W3DGadgetHorizontalSliderImageDrawA( GameWindow *window, // centerImageRight = centerImageLeft = GadgetSliderGetDisabledImageCenter( window ); // smallCenterImageRight = smallCenterImageLeft = GadgetSliderGetDisabledImageSmallCenter( window ); - } // end if, disabled + } else //if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -368,7 +368,7 @@ void W3DGadgetHorizontalSliderImageDrawA( GameWindow *window, centerImageRight = GadgetSliderGetEnabledImageCenter( window ); smallCenterImageRight = GadgetSliderGetEnabledImageSmallCenter( window ); - } // end else, enabled + } // sanity, we need to have these images to make it look right if( leftImageLeft == NULL || rightImageLeft == NULL || @@ -431,7 +431,7 @@ void W3DGadgetHorizontalSliderImageDrawA( GameWindow *window, end.x, end.y ); start.x += centerImageLeft->getImageWidth(); - } // end for i + } // // how many small repeating pieces will fit in the gap from where the @@ -455,7 +455,7 @@ void W3DGadgetHorizontalSliderImageDrawA( GameWindow *window, end.x, end.y ); start.x += smallCenterImageLeft->getImageWidth(); - } // end for i + } // draw left end start.x = origin.x + xOffset; @@ -475,5 +475,5 @@ void W3DGadgetHorizontalSliderImageDrawA( GameWindow *window, TheWindowManager->winDrawImage(rightImageRight, start.x, start.y, end.x, end.y); TheDisplay->enableClipping(FALSE); -} // end W3DGadgetHorizontalSliderImageDraw +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp index 2d07e922515..ff3ee8a701c 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp @@ -132,7 +132,7 @@ static void drawHiliteBar( const Image *left, const Image *right, end.x, end.y ); start.x += center->getImageWidth(); - } // end for i + } // // how many small repeating pieces will fit in the gap from where the @@ -160,9 +160,9 @@ static void drawHiliteBar( const Image *left, const Image *right, end.x, end.y ); start.x += smallCenter->getImageWidth(); - } // end for i + } - } // end if + } TheDisplay->enableClipping(FALSE); // draw left end start.x = startX + xOffset; @@ -176,7 +176,7 @@ static void drawHiliteBar( const Image *left, const Image *right, end.y = start.y + barWindowSize.y; TheWindowManager->winDrawImage(right, start.x, start.y, end.x, end.y); -} // end drawHiliteBar +} // drawListBoxText ============================================================ /** Draw the text for a listbox */ @@ -270,7 +270,7 @@ static void drawListBoxText( GameWindow *window, WinInstanceData *instData, center = GadgetListBoxGetDisabledSelectedItemImageCenter( window ); smallCenter = GadgetListBoxGetDisabledSelectedItemImageSmallCenter( window ); - } // end if + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -279,7 +279,7 @@ static void drawListBoxText( GameWindow *window, WinInstanceData *instData, center = GadgetListBoxGetHiliteSelectedItemImageCenter( window ); smallCenter = GadgetListBoxGetHiliteSelectedItemImageSmallCenter( window ); - } // end else if + } else { @@ -288,7 +288,7 @@ static void drawListBoxText( GameWindow *window, WinInstanceData *instData, center = GadgetListBoxGetEnabledSelectedItemImageCenter( window ); smallCenter = GadgetListBoxGetEnabledSelectedItemImageSmallCenter( window ); - } // end else + } // draw select image across area @@ -309,7 +309,7 @@ static void drawListBoxText( GameWindow *window, WinInstanceData *instData, if( left && right && center && smallCenter ) drawHiliteBar( left, right, center, smallCenter, start.x + 1, start.y, end.x , end.y ); - } // end if, use images + } else { Color selectColor = WIN_COLOR_UNDEFINED, @@ -319,17 +319,17 @@ static void drawListBoxText( GameWindow *window, WinInstanceData *instData, { selectColor = GadgetListBoxGetDisabledSelectedItemColor( window ); selectBorder = GadgetListBoxGetDisabledSelectedItemBorderColor( window ); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { selectColor = GadgetListBoxGetHiliteSelectedItemColor( window ); selectBorder = GadgetListBoxGetHiliteSelectedItemBorderColor( window ); - } // end else if, hilited + } else { selectColor = GadgetListBoxGetEnabledSelectedItemColor( window ); selectBorder = GadgetListBoxGetEnabledSelectedItemBorderColor( window ); - } // end else, enabled + } // draw border @@ -375,9 +375,9 @@ static void drawListBoxText( GameWindow *window, WinInstanceData *instData, start.x, start.y, end.x, end.y ); - } // end else, draw selection with colors + } - } // end if + } @@ -440,8 +440,8 @@ static void drawListBoxText( GameWindow *window, WinInstanceData *instData, drawY, textColor, dropColor ); - }//else - }// if + } + } else if(cells[j].cellType == LISTBOX_IMAGE && cells[j].data) { Int width, height; @@ -473,10 +473,10 @@ static void drawListBoxText( GameWindow *window, WinInstanceData *instData, offsetX, offsetY, offsetX + width, offsetY + height,cells[j].color ); - }//else + } columnX = columnX + list->columnWidth[j]; - }// for - }//if + } + } drawY += listLineHeight; @@ -486,7 +486,7 @@ static void drawListBoxText( GameWindow *window, WinInstanceData *instData, // TheWindowManager->winSetClipRegion( clipRegion.lo.x, clipRegion.lo.y, // clipRegion.hi.x, clipRegion.hi.y ); -} // end drawListBoxText +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -521,21 +521,21 @@ void W3DGadgetListBoxDraw( GameWindow *window, WinInstanceData *instData ) border = GadgetListBoxGetDisabledBorderColor( window ); titleColor = window->winGetDisabledTextColor(); titleBorder = window->winGetDisabledTextBorderColor(); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { background = GadgetListBoxGetHiliteColor( window ); border = GadgetListBoxGetHiliteBorderColor( window ); titleColor = window->winGetHiliteTextColor(); titleBorder = window->winGetHiliteTextBorderColor(); - } // end else if, hilited + } else { background = GadgetListBoxGetEnabledColor( window ); border = GadgetListBoxGetEnabledBorderColor( window ); titleColor = window->winGetEnabledTextColor(); titleBorder = window->winGetEnabledTextBorderColor(); - } // end else, enabled + } // Draw the title if( title && title->getTextLength() ) @@ -551,7 +551,7 @@ void W3DGadgetListBoxDraw( GameWindow *window, WinInstanceData *instData ) y += fontHeight + 1; height -= fontHeight + 1; - } // end if + } // draw the back border if( border != WIN_COLOR_UNDEFINED ) @@ -572,14 +572,14 @@ void W3DGadgetListBoxDraw( GameWindow *window, WinInstanceData *instData ) list->slider->winGetSize( &sliderSize.x, &sliderSize.y ); width -= (sliderSize.x +3); - } // end if + } // draw the text drawListBoxText( window, instData, x, y + 4 , width, height-4, TRUE ); -} // end W3DGadgetListBoxDraw +} // W3DGadgetListBoxImageDraw ================================================== /** Draw list box with user supplied images */ @@ -609,7 +609,7 @@ void W3DGadgetListBoxImageDraw( GameWindow *window, WinInstanceData *instData ) list->slider->winGetSize( &sliderSize.x, &sliderSize.y ); width -= sliderSize.x; - } // end if + } // get the image if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) @@ -644,7 +644,7 @@ void W3DGadgetListBoxImageDraw( GameWindow *window, WinInstanceData *instData ) start.x, start.y, end.x, end.y ); - } // end if + } // Draw the title if( title && title->getTextLength() ) @@ -660,12 +660,12 @@ void W3DGadgetListBoxImageDraw( GameWindow *window, WinInstanceData *instData ) y += TheWindowManager->winFontHeight( instData->getFont() ); height -= TheWindowManager->winFontHeight( instData->getFont() ) + 1; - } // end if + } // draw the listbox text drawListBoxText( window, instData, x, y+4, width, height-4, TRUE ); -} // end W3DGadgetListBoxImageDraw +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp index efde54c1cc2..22ed2957ee2 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp @@ -89,21 +89,21 @@ void W3DGadgetProgressBarDraw( GameWindow *window, WinInstanceData *instData ) backBorder = GadgetProgressBarGetDisabledBorderColor( window ); barColor = GadgetProgressBarGetDisabledBarColor( window ); barBorder = GadgetProgressBarGetDisabledBarBorderColor( window ); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { backColor = GadgetProgressBarGetHiliteColor( window ); backBorder = GadgetProgressBarGetHiliteBorderColor( window ); barColor = GadgetProgressBarGetHiliteBarColor( window ); barBorder = GadgetProgressBarGetHiliteBarBorderColor( window ); - } // end else if, hilited + } else { backColor = GadgetProgressBarGetEnabledColor( window ); backBorder = GadgetProgressBarGetEnabledBorderColor( window ); barColor = GadgetProgressBarGetEnabledBarColor( window ); barBorder = GadgetProgressBarGetEnabledBarBorderColor( window ); - } // end else, enabled + } // draw background border if( backBorder != WIN_COLOR_UNDEFINED ) @@ -116,7 +116,7 @@ void W3DGadgetProgressBarDraw( GameWindow *window, WinInstanceData *instData ) TheWindowManager->winOpenRect( backBorder, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } // draw background fill if( backColor != WIN_COLOR_UNDEFINED ) @@ -129,7 +129,7 @@ void W3DGadgetProgressBarDraw( GameWindow *window, WinInstanceData *instData ) TheWindowManager->winFillRect( backColor, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } // draw the progress so far if( progress ) @@ -149,7 +149,7 @@ void W3DGadgetProgressBarDraw( GameWindow *window, WinInstanceData *instData ) start.x, start.y, end.x, end.y ); } - } // end if + } // draw bar fill if( barColor != WIN_COLOR_UNDEFINED ) @@ -171,13 +171,13 @@ void W3DGadgetProgressBarDraw( GameWindow *window, WinInstanceData *instData ) TheWindowManager->winDrawLine(GameMakeColor(200,200,200,255),WIN_DRAW_LINE_WIDTH, start.x, start.y, start.x, end.y); } - } // end if + } - } // end if + } -} // end W3DGadgetProgressBarDraw +} // W3DGadgetProgressBarImageDraw ============================================== /** Draw Progress Bar with user supplied images */ @@ -254,7 +254,7 @@ void W3DGadgetProgressBarImageDraw( GameWindow *window, WinInstanceData *instDat //backSmallCenter = GadgetProgressBarGetDisabledImageSmallCenter( window ); //barSmallCenter = GadgetProgressBarGetDisabledBarImageSmallCenter( window ); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -267,7 +267,7 @@ void W3DGadgetProgressBarImageDraw( GameWindow *window, WinInstanceData *instDat //backSmallCenter = GadgetProgressBarGetHiliteImageSmallCenter( window ); //barSmallCenter = GadgetProgressBarGetHiliteBarImageSmallCenter( window ); - } // end else if, hilited + } else { @@ -280,7 +280,7 @@ void W3DGadgetProgressBarImageDraw( GameWindow *window, WinInstanceData *instDat //backSmallCenter = GadgetProgressBarGetEnabledImageSmallCenter( window ); //barSmallCenter = GadgetProgressBarGetEnabledBarImageSmallCenter( window ); - } // end else, enabled + } // sanity if( backLeft == NULL || backRight == NULL || @@ -325,7 +325,7 @@ void W3DGadgetProgressBarImageDraw( GameWindow *window, WinInstanceData *instDat end.x, end.y ); start.x += backCenter->getImageWidth(); - } // end for i + } // // how many small repeating pieces will fit in the gap from where the @@ -398,7 +398,7 @@ void W3DGadgetProgressBarImageDraw( GameWindow *window, WinInstanceData *instDat end.x, end.y ); start.x += barCenter->getImageWidth(); - } // end for i + } start.x = origin.x + 10 + barCenter->getImageWidth() * pieces; //pieces = (size.x - barWindowSize.x -20) / barRight->getImageWidth(); //Changed By Saad for flashing grey piece @@ -412,6 +412,6 @@ void W3DGadgetProgressBarImageDraw( GameWindow *window, WinInstanceData *instDat end.x, end.y ); start.x += barRight->getImageWidth(); - } // end for i + } -} // end W3DGadgetProgressBarImageDraw +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp index ffc9b4ca9b6..dbb3c3e54be 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp @@ -101,17 +101,17 @@ static void drawButtonText( GameWindow *window, WinInstanceData *instData ) { textColor = window->winGetDisabledTextColor(); dropColor = window->winGetDisabledTextBorderColor(); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { textColor = window->winGetHiliteTextColor(); dropColor = window->winGetHiliteTextBorderColor(); - } // end else if, hilited + } else { textColor = window->winGetEnabledTextColor(); dropColor = window->winGetEnabledTextBorderColor(); - } // end enabled only + } // set our font to that of our parent if not the same if( text->getFont() != window->winGetFont() ) @@ -136,7 +136,7 @@ static void drawButtonText( GameWindow *window, WinInstanceData *instData ) // draw it text->draw( textPos.x, textPos.y, textColor, dropColor ); -} // end drawButtonText +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -172,7 +172,7 @@ void W3DGadgetPushButtonDraw( GameWindow *window, WinInstanceData *instData ) border = GadgetButtonGetDisabledBorderColor( window ); } - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -187,7 +187,7 @@ void W3DGadgetPushButtonDraw( GameWindow *window, WinInstanceData *instData ) border = GadgetButtonGetHiliteBorderColor( window ); } - } // end else if, hilited and enabled + } else { @@ -202,7 +202,7 @@ void W3DGadgetPushButtonDraw( GameWindow *window, WinInstanceData *instData ) border = GadgetButtonGetEnabledBorderColor( window ); } - } // end else, enabled only + } // compute draw position start.x = origin.x; @@ -217,7 +217,7 @@ void W3DGadgetPushButtonDraw( GameWindow *window, WinInstanceData *instData ) TheWindowManager->winOpenRect( border, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } if( color != WIN_COLOR_UNDEFINED ) { @@ -230,7 +230,7 @@ void W3DGadgetPushButtonDraw( GameWindow *window, WinInstanceData *instData ) TheWindowManager->winFillRect( color, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } // draw the button text if( instData->getTextLength() ) @@ -271,7 +271,7 @@ void W3DGadgetPushButtonDraw( GameWindow *window, WinInstanceData *instData ) } } -} // end W3DGadgetPushButtonDraw +} @@ -334,7 +334,7 @@ void W3DGadgetPushButtonImageDrawOne( GameWindow *window, else image = GadgetButtonGetDisabledImage( window ); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -343,13 +343,13 @@ void W3DGadgetPushButtonImageDrawOne( GameWindow *window, else image = GadgetButtonGetHiliteImage( window ); - } // end else if, hilited and enabled + } else { if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) ) image = GadgetButtonGetHiliteSelectedImage( window ); - } // end else, enabled only + } } @@ -394,7 +394,7 @@ void W3DGadgetPushButtonImageDrawOne( GameWindow *window, } } TheDisplay->drawImage( image, start.x, start.y, end.x, end.y, colorMultiplier, drawMode ); - } // end if + } // draw the button text if( instData->getTextLength() ) @@ -481,7 +481,7 @@ void W3DGadgetPushButtonImageDrawOne( GameWindow *window, } } } -} // end W3DGadgetPushButtonImageDraw +} void W3DGadgetPushButtonImageDrawThree(GameWindow *window, WinInstanceData *instData ) @@ -523,7 +523,7 @@ void W3DGadgetPushButtonImageDrawThree(GameWindow *window, WinInstanceData *inst } - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -542,7 +542,7 @@ void W3DGadgetPushButtonImageDrawThree(GameWindow *window, WinInstanceData *inst } - } // end else if, hilited and enabled + } else { @@ -561,7 +561,7 @@ void W3DGadgetPushButtonImageDrawThree(GameWindow *window, WinInstanceData *inst } - } // end else, enabled only + } // sanity, we need to have these images to make it look right if( leftImage == NULL || rightImage == NULL || @@ -623,7 +623,7 @@ void W3DGadgetPushButtonImageDrawThree(GameWindow *window, WinInstanceData *inst end.x, end.y ); start.x += centerImage->getImageWidth(); - } // end for i + } // we will draw the image but clip the parts we don't want to show IRegion2D reg; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp index 901edd97100..f3dd9dde95e 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp @@ -86,17 +86,17 @@ static void drawRadioButtonText( GameWindow *window, WinInstanceData *instData ) { textColor = window->winGetDisabledTextColor(); dropColor = window->winGetDisabledTextBorderColor(); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { textColor = window->winGetHiliteTextColor(); dropColor = window->winGetHiliteTextBorderColor(); - } // end else if, hilited + } else { textColor = window->winGetEnabledTextColor(); dropColor = window->winGetEnabledTextBorderColor(); - } // end enabled only + } // set our font to that of our parent if not the same if( text->getFont() != window->winGetFont() ) @@ -112,7 +112,7 @@ static void drawRadioButtonText( GameWindow *window, WinInstanceData *instData ) // draw it text->draw( textPos.x, textPos.y, textColor, dropColor ); -} // end drawRadioButtonText +} // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// @@ -162,7 +162,7 @@ void W3DGadgetRadioButtonDraw( GameWindow *window, WinInstanceData *instData ) boxBorder = GadgetRadioGetDisabledUncheckedBoxBorderColor( window ); } - } // end if + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -182,7 +182,7 @@ void W3DGadgetRadioButtonDraw( GameWindow *window, WinInstanceData *instData ) boxBorder = GadgetRadioGetHiliteUncheckedBoxBorderColor( window ); } - } // end else if + } else { @@ -202,7 +202,7 @@ void W3DGadgetRadioButtonDraw( GameWindow *window, WinInstanceData *instData ) boxBorder = GadgetRadioGetEnabledUncheckedBoxBorderColor( window ); } - } // end else + } // draw background border start.x = origin.x; @@ -259,7 +259,7 @@ void W3DGadgetRadioButtonDraw( GameWindow *window, WinInstanceData *instData ) -} // end W3DGadgetRadioButtonDraw +} void W3DGadgetRadioButtonImageDraw( GameWindow *window, @@ -295,7 +295,7 @@ void W3DGadgetRadioButtonImageDraw( GameWindow *window, centerImage = GadgetRadioGetDisabledUncheckedBoxImage( window ); rightImage = GadgetRadioGetDisabledCheckedBoxImage( window ); - } // end if + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { // hilited background @@ -303,7 +303,7 @@ void W3DGadgetRadioButtonImageDraw( GameWindow *window, centerImage = GadgetRadioGetHiliteUncheckedBoxImage( window ); rightImage = GadgetRadioGetHiliteCheckedBoxImage( window ); - } // end else if + } else { // enabled background @@ -311,7 +311,7 @@ void W3DGadgetRadioButtonImageDraw( GameWindow *window, centerImage = GadgetRadioGetEnabledUncheckedBoxImage( window ); rightImage = GadgetRadioGetEnabledCheckedBoxImage( window ); - } // end else + } // sanity, we need to have these images to make it look right if( leftImage == NULL || centerImage == NULL || @@ -363,7 +363,7 @@ void W3DGadgetRadioButtonImageDraw( GameWindow *window, start.x, start.y, end.x, end.y ); start.x += centerImage->getImageWidth(); - } // end for i + } TheDisplay->enableClipping(FALSE); // draw left end @@ -383,5 +383,5 @@ void W3DGadgetRadioButtonImageDraw( GameWindow *window, drawRadioButtonText( window, instData ); -} // end W3DGadgetHorizontalSliderImageDraw +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp index 57df8250abf..2c837c45747 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp @@ -138,7 +138,7 @@ static void drawStaticTextText( GameWindow *window, WinInstanceData *instData, text->setClipRegion(&clipRegion); text->draw( textPos.x, textPos.y, textColor, textDropColor ); -} // end drawStaticTextText +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -166,7 +166,7 @@ void W3DGadgetStaticTextDraw( GameWindow *window, WinInstanceData *instData ) textColor = window->winGetDisabledTextColor(); textOutlineColor = window->winGetDisabledTextBorderColor(); - } // end if, disabled + } else { @@ -175,7 +175,7 @@ void W3DGadgetStaticTextDraw( GameWindow *window, WinInstanceData *instData ) textColor = window->winGetEnabledTextColor(); textOutlineColor = window->winGetEnabledTextBorderColor(); - } // end else, enabled + } // draw the back border if( backBorder != WIN_COLOR_UNDEFINED ) @@ -188,7 +188,7 @@ void W3DGadgetStaticTextDraw( GameWindow *window, WinInstanceData *instData ) TheWindowManager->winOpenRect( backBorder, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } // draw the back fill area if( backColor != WIN_COLOR_UNDEFINED ) @@ -200,7 +200,7 @@ void W3DGadgetStaticTextDraw( GameWindow *window, WinInstanceData *instData ) end.y = start.y + size.y - 2; TheWindowManager->winFillRect( backColor, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } // draw the text if( tData->text && (textColor != WIN_COLOR_UNDEFINED) ) @@ -208,7 +208,7 @@ void W3DGadgetStaticTextDraw( GameWindow *window, WinInstanceData *instData ) -} // end W3DGadgetStaticTextDraw +} // W3DGadgetStaticTextImageDraw =============================================== /** Draw colored text field with user supplied images */ @@ -232,7 +232,7 @@ void W3DGadgetStaticTextImageDraw( GameWindow *window, WinInstanceData *instData textColor = window->winGetDisabledTextColor(); textOutlineColor = window->winGetDisabledTextBorderColor(); - } // end if, disabled + } else { @@ -240,7 +240,7 @@ void W3DGadgetStaticTextImageDraw( GameWindow *window, WinInstanceData *instData textColor = window->winGetEnabledTextColor(); textOutlineColor = window->winGetEnabledTextBorderColor(); - } // end else, enabled + } // draw the back image if( image ) @@ -252,7 +252,7 @@ void W3DGadgetStaticTextImageDraw( GameWindow *window, WinInstanceData *instData end.y = start.y + size.y; TheWindowManager->winDrawImage( image, start.x, start.y, end.x, end.y ); - } // end if + } // draw the text if( tData->text && (textColor != WIN_COLOR_UNDEFINED) ) @@ -260,5 +260,5 @@ void W3DGadgetStaticTextImageDraw( GameWindow *window, WinInstanceData *instData -} // end W3DGadgetStaticTextImageDraw +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp index 4626725d820..6ea10bd26a0 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp @@ -378,7 +378,7 @@ void W3DGadgetTabControlDraw( GameWindow *tabControl, WinInstanceData *instData } } -} // end W3DGadgetTabControlDraw +} // W3DGadgetRadioButtonImageDraw ============================================== /** Draw tabs with user supplied images */ @@ -649,4 +649,4 @@ void W3DGadgetTabControlImageDraw( GameWindow *tabControl, } } -} // end W3DGadgetTabControlImageDraw +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp index 83d5880c173..9a34a5ee159 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp @@ -204,7 +204,7 @@ static void drawTextEntryText( GameWindow *window, WinInstanceData *instData, cursorPos + 2, origin.y + size.y - 3 ); window->winSetCursorPosition( cursorPos + 2 - origin.x, 0 ); -} // end drawTextEntryText +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -238,7 +238,7 @@ void W3DGadgetTextEntryDraw( GameWindow *window, WinInstanceData *instData ) backColor = GadgetTextEntryGetDisabledColor( window ); backBorder = GadgetTextEntryGetDisabledBorderColor( window ); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -249,7 +249,7 @@ void W3DGadgetTextEntryDraw( GameWindow *window, WinInstanceData *instData ) backColor = GadgetTextEntryGetHiliteColor( window ); backBorder = GadgetTextEntryGetHiliteBorderColor( window ); - } // end else if, hilited + } else { @@ -260,7 +260,7 @@ void W3DGadgetTextEntryDraw( GameWindow *window, WinInstanceData *instData ) backColor = GadgetTextEntryGetEnabledColor( window ); backBorder = GadgetTextEntryGetEnabledBorderColor( window ); - } // end else, just enabled + } // draw the back border if( backBorder != WIN_COLOR_UNDEFINED ) @@ -273,7 +273,7 @@ void W3DGadgetTextEntryDraw( GameWindow *window, WinInstanceData *instData ) TheWindowManager->winOpenRect( backBorder, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } // draw the filled back if( backColor != WIN_COLOR_UNDEFINED ) @@ -286,7 +286,7 @@ void W3DGadgetTextEntryDraw( GameWindow *window, WinInstanceData *instData ) TheWindowManager->winFillRect( backColor, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } // draw the text Int fontHeight = TheWindowManager->winFontHeight( instData->getFont() ); @@ -306,7 +306,7 @@ void W3DGadgetTextEntryDraw( GameWindow *window, WinInstanceData *instData ) -} // end W3DGadgetTextEntryDraw +} // W3DGadgetTextEntryImageDraw ================================================ /** Draw horizontal slider with user supplied images */ @@ -345,7 +345,7 @@ void W3DGadgetTextEntryImageDraw( GameWindow *window, WinInstanceData *instData centerImage = GadgetTextEntryGetDisabledImageCenter( window ); smallCenterImage = GadgetTextEntryGetDisabledImageSmallCenter( window ); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -358,7 +358,7 @@ void W3DGadgetTextEntryImageDraw( GameWindow *window, WinInstanceData *instData centerImage = GadgetTextEntryGetHiliteImageCenter( window ); smallCenterImage = GadgetTextEntryGetHiliteImageSmallCenter( window ); - } // end else if, hilited + } else { @@ -371,7 +371,7 @@ void W3DGadgetTextEntryImageDraw( GameWindow *window, WinInstanceData *instData centerImage = GadgetTextEntryGetEnabledImageCenter( window ); smallCenterImage = GadgetTextEntryGetEnabledImageSmallCenter( window ); - } // end else, just enabled + } // get image sizes for the ends ICoord2D leftSize, rightSize; @@ -409,7 +409,7 @@ void W3DGadgetTextEntryImageDraw( GameWindow *window, WinInstanceData *instData end.x, end.y ); start.x += centerImage->getImageWidth(); - } // end for i + } // // how many small repeating pieces will fit in the gap from where the @@ -428,7 +428,7 @@ void W3DGadgetTextEntryImageDraw( GameWindow *window, WinInstanceData *instData end.x, end.y ); start.x += smallCenterImage->getImageWidth(); - } // end for i + } // draw left end start.x = origin.x + xOffset; @@ -460,4 +460,4 @@ void W3DGadgetTextEntryImageDraw( GameWindow *window, WinInstanceData *instData -} // end W3DGadgetTextEntryImageDraw +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp index b599c3355bb..56545f26a05 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp @@ -89,21 +89,21 @@ void W3DGadgetVerticalSliderDraw( GameWindow *window, backBorder = GadgetSliderGetDisabledBorderColor( window ); backColor = GadgetSliderGetDisabledColor( window ); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { backBorder = GadgetSliderGetHiliteBorderColor( window ); backColor = GadgetSliderGetHiliteColor( window ); - } // end else if, hilited + } else { backBorder = GadgetSliderGetEnabledBorderColor( window ); backColor = GadgetSliderGetEnabledColor( window ); - } // end else, enabled + } // draw background border and rect over whole control if( backBorder != WIN_COLOR_UNDEFINED ) @@ -116,7 +116,7 @@ void W3DGadgetVerticalSliderDraw( GameWindow *window, TheWindowManager->winOpenRect( backBorder, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } if( backColor != WIN_COLOR_UNDEFINED ) { @@ -127,11 +127,11 @@ void W3DGadgetVerticalSliderDraw( GameWindow *window, TheWindowManager->winFillRect( backColor, WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, end.y ); - } // end if + } -} // end W3DGadgetVerticalSliderDraw +} // W3DGadgetVerticalSliderImageDraw =========================================== /** Draw vertical slider with user supplied images */ @@ -161,7 +161,7 @@ void W3DGadgetVerticalSliderImageDraw( GameWindow *window, centerImage = GadgetSliderGetDisabledImageCenter( window ); smallCenterImage = GadgetSliderGetDisabledImageSmallCenter( window ); - } // end if, disabled + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { @@ -170,7 +170,7 @@ void W3DGadgetVerticalSliderImageDraw( GameWindow *window, centerImage = GadgetSliderGetHiliteImageCenter( window ); smallCenterImage = GadgetSliderGetHiliteImageSmallCenter( window ); - } // end else if, hilited + } else { @@ -179,7 +179,7 @@ void W3DGadgetVerticalSliderImageDraw( GameWindow *window, centerImage = GadgetSliderGetEnabledImageCenter( window ); smallCenterImage = GadgetSliderGetEnabledImageSmallCenter( window ); - } // end else, enabled + } // sanity, we need to have these images to make it look right if( topImage == NULL || bottomImage == NULL || @@ -241,7 +241,7 @@ void W3DGadgetVerticalSliderImageDraw( GameWindow *window, start.y += centerImage->getImageHeight(); end.y += centerImage->getImageHeight(); - } // end for i + } // // how many small repeating pieces will fit in the gap from where the @@ -260,7 +260,7 @@ void W3DGadgetVerticalSliderImageDraw( GameWindow *window, start.y += smallCenterImage->getImageHeight(); end.y += smallCenterImage->getImageHeight(); - } // end for i + } // draw top end start.x = origin.x + xOffset; @@ -276,6 +276,6 @@ void W3DGadgetVerticalSliderImageDraw( GameWindow *window, } -} // end W3DGadgetVerticalSliderImageDraw +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp index e2e72f80141..1a72300927c 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp @@ -96,7 +96,7 @@ Bool W3DFontLibrary::loadFontData( GameFont *font ) DEBUG_ASSERTCRASH(fontChar, ("Missing or Corrupted Font. Pleas see log for details")); return FALSE; - } // end if + } // assign font data font->fontData = fontChar; @@ -122,7 +122,7 @@ Bool W3DFontLibrary::loadFontData( GameFont *font ) // all done and loaded return TRUE; -} // end loadFont +} // W3DFontLibrary::releaseFontData ============================================ /** Release font data */ @@ -141,7 +141,7 @@ void W3DFontLibrary::releaseFontData( GameFont *font ) font->fontData = NULL; } -} // end releaseFontData +} // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp index bfffd1b0d70..2f512c94b85 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp @@ -253,7 +253,7 @@ void W3DGameWindow::blitBorderRect( Int x, Int y, Int width, Int height ) TheDisplay->drawImage( borderPieces[ BORDER_CORNER_LR ], x, y, x + size, y + size ); -} // end blitBorderRect +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -272,14 +272,14 @@ W3DGameWindow::W3DGameWindow( void ) m_needPolyDraw = FALSE; m_newTextPos = FALSE; -} // end W3DGameWindow +} // W3DGameWindow::~W3DGameWindow ============================================== //============================================================================= W3DGameWindow::~W3DGameWindow( void ) { -} // end ~W3DGameWindow +} // W3DGameWinDefaultDraw ====================================================== /** The default redraw callback. Draws the background using either @@ -330,9 +330,9 @@ void W3DGameWinDefaultDraw( GameWindow *window, WinInstanceData *instData ) end.y = start.y + size.y; TheWindowManager->winDrawImage( image, start.x, start.y, end.x, end.y ); - } // end if + } - } // end if + } else { Color color, borderColor; @@ -344,21 +344,21 @@ void W3DGameWinDefaultDraw( GameWindow *window, WinInstanceData *instData ) color = window->winGetDisabledColor( 0 ); borderColor = window->winGetDisabledBorderColor( 0 ); - } // end if + } else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) { color = window->winGetHiliteColor( 0 ); borderColor = window->winGetHiliteBorderColor( 0 ); - } // end else if + } else { color = window->winGetEnabledColor( 0 ); borderColor = window->winGetEnabledBorderColor( 0 ); - } // end else + } // // draw the border at the edges @@ -376,7 +376,7 @@ void W3DGameWinDefaultDraw( GameWindow *window, WinInstanceData *instData ) origin.x + size.x - borderWidth, origin.y + size.y - borderWidth ); - } // end else + } // if we have a video buffer, draw the video buffer if ( instData->m_videoBuffer ) @@ -388,7 +388,7 @@ void W3DGameWinDefaultDraw( GameWindow *window, WinInstanceData *instData ) TheDisplay->drawVideoBuffer( instData->m_videoBuffer, pos.x, pos.y, pos.x + size.x, pos.y + size.y ); } -} // end W3DGameWinDefaultDraw +} // W3DGameWindow::winDrawBorder =============================================== //============================================================================= @@ -486,7 +486,7 @@ void W3DGameWindow::winDrawBorder( void ) child->winGetSize( &size.x, &size.y ); sliderAdjustment = size.y; - } // end if + } if( m_instData.getTextLength() ) labelAdjustment = 4; @@ -511,13 +511,13 @@ void W3DGameWindow::winDrawBorder( void ) found = TRUE; break; - } // end switch + } - } // end if + } - } // end for i + } -} // end WinDrawBorder +} // W3DGameWindow::winSetFont ================================================== /** Set the font for a widow */ @@ -534,7 +534,7 @@ void W3DGameWindow::winSetFont( GameFont *font ) // this is a visual change m_needPolyDraw = TRUE; -} // end WinSetFont +} // W3DGameWindow::winSetText ================================================== /** Set the text for window */ @@ -553,7 +553,7 @@ Int W3DGameWindow::winSetText( UnicodeString newText ) return WIN_ERR_OK; -} // end WinSetText +} // W3DGameWindow::winSetPosition ============================================== /** Set window position */ @@ -576,7 +576,7 @@ Int W3DGameWindow::winSetPosition( Int x, Int y ) return WIN_ERR_OK; -} // end WinSetPosition +} // W3DGameWindow::getTextSize ================================================= /** Get the size of the text in our inst data */ @@ -590,7 +590,7 @@ void W3DGameWindow::getTextSize( Int *width, Int *height ) if( height ) *height = extents.Y; -} // end getTextSize +} // W3DGameWindow::getTextLoc ================================================== // Set our text rendering location */ @@ -611,9 +611,9 @@ void W3DGameWindow::setTextLoc( Int x, Int y ) m_textPos.y = y; m_newTextPos = TRUE; - } // end if + } -} // end setTextLoc +} // W3DGameWindow::drawText ==================================================== /** Draw the text in our 2d sentence renderer */ @@ -629,7 +629,7 @@ void W3DGameWindow::drawText( Color color ) m_newTextPos = FALSE; needDraw = TRUE; - } // end if + } // if color switch, set new color if( m_currTextColor != color ) @@ -638,7 +638,7 @@ void W3DGameWindow::drawText( Color color ) m_currTextColor = color; needDraw = TRUE; - } // end if + } // draw the quads if needed if( needDraw || m_needPolyDraw ) @@ -654,10 +654,10 @@ void W3DGameWindow::drawText( Color color ) m_needPolyDraw = FALSE; - } // end if + } // do the render m_textRenderer.Render(); -} // end drawText +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindowManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindowManager.cpp index f25c3a12682..dd0bbb4b757 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindowManager.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindowManager.cpp @@ -43,14 +43,14 @@ W3DGameWindowManager::W3DGameWindowManager( void ) { -} // end W3DGameWindowManager +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- W3DGameWindowManager::~W3DGameWindowManager( void ) { -} // end ~W3DGameWindowManager +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -60,5 +60,5 @@ void W3DGameWindowManager::init( void ) // extend GameWindowManager::init(); -} // end init +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp index b86f7f0c23f..027b2683231 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp @@ -2377,9 +2377,9 @@ void HeightMapRenderObjClass::renderExtraBlendTiles(void) ib += 6; vertexCount +=4; indexCount +=6; - }//tile has 3rd blend layer and is visible - } //for all extre blend tiles - }//unlock vertex buffer + } + } + } if (vertexCount) { diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp index 60c825480af..3bfb20da09f 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp @@ -241,7 +241,7 @@ void W3DProjectedShadowManager::reset( void ) m_W3DShadowTextureManager->freeAllTextures(); -} // end Reset +} Bool W3DProjectedShadowManager::init( void ) { @@ -1415,17 +1415,17 @@ Int W3DProjectedShadowManager::renderShadows(RenderInfoClass & rinfo) rinfo.Pop_Material_Pass(); projectionCount++; //keep track of number of shadow projections } - }//robj - }//di - } // end for drawmodule - } // end for obj + } + } + } + } } - }//shadow is enabled + } } flushDecals(lastShadowDecalTexture,lastShadowType); //make sure there are not any unrendered decals left over. TheDX8MeshRenderer.Flush(); //draw all the shadow receiving objects - }//rendering shadows + } if (m_decalList) { //keep track of active decal texture so we can render all decals at once. @@ -1453,7 +1453,7 @@ Int W3DProjectedShadowManager::renderShadows(RenderInfoClass & rinfo) queueDecal(shadow); //only draw shadow if casting object is visible projectionCount++; } - }//shadow is enabled + } } flushDecals(lastShadowDecalTexture,lastShadowType); //make sure there are not any unrendered decals left over. @@ -1806,7 +1806,7 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S return NULL; //could not create the shadow texture } shadowType=SHADOW_PROJECTION; - }//SHADOW_PROJECTION + } } else { //no shadow info, assume user wants a projected shadow @@ -2042,7 +2042,7 @@ void W3DProjectedShadowManager::removeShadow (W3DProjectedShadow *shadow) delete shadow; return; } - } // end for + } } //search for this shadow @@ -2068,7 +2068,7 @@ void W3DProjectedShadowManager::removeShadow (W3DProjectedShadow *shadow) delete shadow; return; } - } // end for + } } void W3DProjectedShadowManager::removeAllShadows(void) @@ -2086,7 +2086,7 @@ void W3DProjectedShadowManager::removeAllShadows(void) next_shadow = cur_shadow->m_next; cur_shadow->m_next = NULL; delete cur_shadow; - } // end for + } next_shadow=m_decalList; cur_shadow=NULL; @@ -2096,7 +2096,7 @@ void W3DProjectedShadowManager::removeAllShadows(void) next_shadow = cur_shadow->m_next; cur_shadow->m_next = NULL; delete cur_shadow; - } // end for + } } #if defined(RTS_DEBUG) diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp index 82c5b366baf..1087aef6b74 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp @@ -366,7 +366,7 @@ class W3DShadowGeometryMesh // in our current geometry. W3DShadowGeometry *m_parentGeometry; // mesh hierarchy containing this mesh. -}; //end of meshInfo +}; #ifdef DO_TERRAIN_SHADOW_VOLUMES @@ -860,7 +860,7 @@ W3DShadowGeometryMesh::W3DShadowGeometryMesh( void ) m_numPolyNeighbors = 0; m_parentVerts = NULL; m_polygonNormals = NULL; -} // end W3DShadowGeometry +} // ~W3DShadowGeometry ============================================================ // ============================================================================ @@ -874,7 +874,7 @@ W3DShadowGeometryMesh::~W3DShadowGeometryMesh( void ) if (m_polygonNormals) delete [] m_polygonNormals; -} // end ~W3DShadowGeometry +} // GetPolyNeighbor ============================================================ // Return the poly neighbor structure at the given index @@ -893,11 +893,11 @@ if (!m_polyNeighbors) { assert( 0 ); return NULL; - } // en dif + } return &m_polyNeighbors[ polyIndex ]; -} // end GetPolyNeighbor +} // buildPolygonNeighbors ====================================================== // Whenever we set a new geometry we want to build some information about @@ -930,7 +930,7 @@ void W3DShadowGeometryMesh::buildPolygonNeighbors( void ) return; // nothing to see here people, move along - } // end if + } // // in the event that this geometry can deform on the fly or we are @@ -949,7 +949,7 @@ void W3DShadowGeometryMesh::buildPolygonNeighbors( void ) if( allocateNeighbors( numPolys ) == FALSE ) return; - } // end if + } // // initialize all polygon neighbor information to none and assign our @@ -965,7 +965,7 @@ void W3DShadowGeometryMesh::buildPolygonNeighbors( void ) for( j = 0; j < MAX_POLYGON_NEIGHBORS; j++ ) m_polyNeighbors[ i ].neighbor[ j ].neighborIndex = NO_NEIGHBOR; - } // end for i + } // assign polygon data for each of our polygons for( i = 0; i < m_numPolyNeighbors; i++ ) @@ -1035,7 +1035,7 @@ void W3DShadowGeometryMesh::buildPolygonNeighbors( void ) index1=index2=-1; continue; } - } // end if + } if( index1 != -1 && index2 != -1 ) { // @@ -1055,7 +1055,7 @@ void W3DShadowGeometryMesh::buildPolygonNeighbors( void ) break; // exit for a - } // end if + } // // error condition, if our counter a is at the max number @@ -1079,13 +1079,13 @@ void W3DShadowGeometryMesh::buildPolygonNeighbors( void ) // DEBUG_ASSERTCRASH(a != MAX_POLYGON_NEIGHBORS,(errorText)); } - } // end if + } - } // end for j + } - } // end for i + } -} // end buildPolygonNeighbors +} // allocateNeighbors ========================================================== // Allocate storage for the polygon neighbors and record its size @@ -1106,14 +1106,14 @@ Bool W3DShadowGeometryMesh::allocateNeighbors( Int numPolys ) assert( 0 ); return FALSE; - } // end if + } // list is now acutally allocated m_numPolyNeighbors = numPolys; return TRUE; // success! -} // end allocateNeighbors +} // deleteNeighbors ============================================================ // Delete all polygon neighbor storage and information @@ -1129,13 +1129,13 @@ void W3DShadowGeometryMesh::deleteNeighbors( void ) m_polyNeighbors = NULL; m_numPolyNeighbors = 0; - } // end if + } // sanity error checking assert( m_numPolyNeighbors == 0 ); assert( m_polyNeighbors == NULL ); -} // end deleteNeighbors +} //#include "Common/ThingTemplate.h" @@ -1682,9 +1682,9 @@ W3DVolumetricShadow::W3DVolumetricShadow( void ) m_objectXformHistory[ i ][j].Make_Identity(); m_lightPosHistory[ i ][j] = Vector3(0,0,0); } - } // end for i + } -} // end W3DVolumetricShadow +} // ~W3DVolumetricShadow ==================================================================== // W3DVolumetricShadow destructor @@ -1715,7 +1715,7 @@ W3DVolumetricShadow::~W3DVolumetricShadow( void ) m_geometry=NULL; m_robj=NULL; -} // end ~W3DVolumetricShadow +} void W3DVolumetricShadow::SetGeometry( W3DShadowGeometry *geometry ) { @@ -1752,13 +1752,13 @@ void W3DVolumetricShadow::SetGeometry( W3DShadowGeometry *geometry ) if( allocateSilhouette(i, numNewVertices ) == FALSE ) return; - } // end if + } } // assign the new geometry, possible over an old geometry m_geometry = geometry; -} // end SetGeometry +} /**Called once per frame for each object, when necessary it will reconstruct the shadow volume for this shadow from the silhouette of the geometry @@ -1836,9 +1836,9 @@ void W3DVolumetricShadow::Update() // update delay time lastTime = currentTime; - } // end if + } -} // end Update +} /** Update shadow volumes belonging to all meshes of this shadow caster. * Use zoffset to extend shadows below object's base by given amount. @@ -1921,8 +1921,8 @@ void W3DVolumetricShadow::updateVolumes(Real zoffset) } } } - } // end for j - } // end for, i + } + } } /*floorZ is the assumed ground height below the model. The code will try to extrude shadows just long enough to hit this point in order @@ -2190,7 +2190,7 @@ void W3DVolumetricShadow::updateMeshVolume(Int meshIndex, Int lightIndex, const sphere.Center -= objectCenter; m_shadowVolume[ lightIndex ][meshIndex]->setBoundingSphere(sphere); m_shadowVolume[ lightIndex ][meshIndex]->setVisibleState(Geometry::STATE_VISIBLE); //this volume needs rendering. - }//end if inside view frustum + } else if (m_shadowVolume[ lightIndex ][meshIndex]) { //outside view frustum, shadow wasn't updated. @@ -2200,7 +2200,7 @@ void W3DVolumetricShadow::updateMeshVolume(Int meshIndex, Int lightIndex, const m_shadowVolume[ lightIndex ][meshIndex]->setBoundingSphere(sphere); m_shadowVolume[ lightIndex ][meshIndex]->setVisibleState(Geometry::STATE_INVISIBLE); } - } // end if + } else { //not reconstructing volume, so don't know if visible or not. if (m_shadowVolume[ lightIndex ][meshIndex]) @@ -2239,9 +2239,9 @@ void W3DVolumetricShadow::addSilhouetteEdge(Int meshIndex, PolyNeighbor *visible neighborIndex = i; break; // exit for - } // end if + } - } // end for i + } // get the three vertex indices of "visible" geomMesh->GetPolygonIndex( visible->myIndex, visibleIndexList ); @@ -2267,7 +2267,7 @@ void W3DVolumetricShadow::addSilhouetteEdge(Int meshIndex, PolyNeighbor *visible edgeStart = visibleIndexList[ 1 ]; edgeEnd = visibleIndexList[ 2 ]; - } // end if + } else if( (visibleIndexList[ 1 ] != visible->neighbor[ neighborIndex ].neighborEdgeIndex[ 0 ]) && (visibleIndexList[ 1 ] != @@ -2278,7 +2278,7 @@ void W3DVolumetricShadow::addSilhouetteEdge(Int meshIndex, PolyNeighbor *visible edgeStart = visibleIndexList[ 2 ]; edgeEnd = visibleIndexList[ 0 ]; - } // end if + } else { @@ -2286,12 +2286,12 @@ void W3DVolumetricShadow::addSilhouetteEdge(Int meshIndex, PolyNeighbor *visible edgeStart = visibleIndexList[ 0 ]; edgeEnd = visibleIndexList[ 1 ]; - } // end if + } // add to silhouette edge list addSilhouetteIndices(meshIndex, edgeStart, edgeEnd ); -} // end addSilhouetteEdge +} // addNeighborlessEdges ======================================================= // Given a polygon neighbor information, it has been determined that this @@ -2346,11 +2346,11 @@ void W3DVolumetricShadow::addNeighborlessEdges(Int meshIndex, PolyNeighbor *us ) addEdge = FALSE; break; // exit for j, no need to search on - } // end if + } - } // end if + } - } // end for j + } // add the edge if no neighbors have that edge if( addEdge == TRUE ) @@ -2358,11 +2358,11 @@ void W3DVolumetricShadow::addNeighborlessEdges(Int meshIndex, PolyNeighbor *us ) addSilhouetteIndices(meshIndex, edgeStart, edgeEnd ); - } // end if + } - } // end for i + } -} // end addNeighborlessEdges +} // addSilhouetteIndices ======================================================= // Add these two indices to the silhouette data @@ -2379,7 +2379,7 @@ void W3DVolumetricShadow::addSilhouetteIndices(Int meshIndex, Short edgeStart, S assert( m_numSilhouetteIndices[meshIndex] < m_maxSilhouetteEntries[meshIndex] ); m_silhouetteIndex[meshIndex][ m_numSilhouetteIndices[meshIndex]++ ] = edgeEnd; -} // end if +} // buildSilhouette ============================================================ // Given a light position, and our polygon neighbor information this will @@ -2442,7 +2442,7 @@ void W3DVolumetricShadow::buildSilhouette(Int meshIndex, Vector3 *lightPosObject if( Vector3::Dot_Product( lightVector, normal ) < 0.0f ) BitSet( polyNeighbor->status, POLY_VISIBLE ); - } // end for i + } // // check all our polys using our poly neighbors, where one poly neighbor @@ -2482,7 +2482,7 @@ void W3DVolumetricShadow::buildSilhouette(Int meshIndex, Vector3 *lightPosObject if( BitIsSet( otherNeighbor->status, POLY_PROCESSED ) ) continue; // for j - } // end if + } // // finally, if our own visible status is different from our @@ -2501,16 +2501,16 @@ void W3DVolumetricShadow::buildSilhouette(Int meshIndex, Vector3 *lightPosObject visibleNeighborless = TRUE; - } // end if + } else if( BitIsSet( otherNeighbor->status, POLY_VISIBLE ) == FALSE ) { // "we" are visible and "they" are not addSilhouetteEdge(meshIndex, polyNeighbor, otherNeighbor ); - } // end if + } - } // end if + } else if( otherNeighbor != NULL && BitIsSet( otherNeighbor->status, POLY_VISIBLE ) ) { @@ -2518,9 +2518,9 @@ void W3DVolumetricShadow::buildSilhouette(Int meshIndex, Vector3 *lightPosObject // "they" are visible and "we" are not addSilhouetteEdge(meshIndex, otherNeighbor, polyNeighbor ); - } // end else + } - } // end for j + } // // if this polygon is visible, add any edges that are not @@ -2531,7 +2531,7 @@ void W3DVolumetricShadow::buildSilhouette(Int meshIndex, Vector3 *lightPosObject addNeighborlessEdges(meshIndex, polyNeighbor ); - } // end if + } // // this polyNeighbor is now considered "processed", any other @@ -2540,12 +2540,12 @@ void W3DVolumetricShadow::buildSilhouette(Int meshIndex, Vector3 *lightPosObject // BitSet( polyNeighbor->status, POLY_PROCESSED ); - } // end for i + } //record number of edge indices contrinuted by this mesh m_numIndicesPerMesh[meshIndex]=m_numSilhouetteIndices[meshIndex]-meshEdgeStart; -} // end buildSilhouette +} // constructVolume ============================================================ // Given a fresh new geometry class called "shadowVolume" to hold the actual @@ -2584,7 +2584,7 @@ void W3DVolumetricShadow::constructVolume( Vector3 *lightPosObject,Real shadowEx assert( 0 ); return; - } // end if + } // get the geometry struct we're storing the actual shadow volume data in shadowVolume = m_shadowVolume[ volumeIndex ][meshIndex]; @@ -2596,7 +2596,7 @@ void W3DVolumetricShadow::constructVolume( Vector3 *lightPosObject,Real shadowEx assert( 0 ); return; - } // end if + } // step through each of the silhouette pairs vertexCount = 0; @@ -2780,7 +2780,7 @@ void W3DVolumetricShadow::constructVolume( Vector3 *lightPosObject,Real shadowEx shadowVolume->SetNumActivePolygon(polygonCount); shadowVolume->SetNumActiveVertex(vertexCount); -} // end constructVolume +} // constructVolumeVB ========================================================== // Given a fresh new geometry class called "shadowVolume" to hold the actual @@ -2824,7 +2824,7 @@ void W3DVolumetricShadow::constructVolumeVB( Vector3 *lightPosObject,Real shadow assert( 0 ); return; - } // end if + } // get the geometry struct we're storing the actual shadow volume data in shadowVolume = m_shadowVolume[ volumeIndex ][meshIndex]; @@ -2836,7 +2836,7 @@ void W3DVolumetricShadow::constructVolumeVB( Vector3 *lightPosObject,Real shadow assert( 0 ); return; - } // end if + } //*****************************************************************************************/ //Do an initial pass through silhouette data to determine the actual vertex/polygon counts. @@ -2939,7 +2939,7 @@ void W3DVolumetricShadow::constructVolumeVB( Vector3 *lightPosObject,Real shadow maxStripLength=__max(maxStripLength,stripLength); #endif } - } //initial pass to determine vertex/polygon counts. + } //*********************************************************************************************** DEBUG_ASSERTCRASH(m_shadowVolumeVB[ volumeIndex ][meshIndex] == NULL,("Updating Existing Static Vertex Buffer Shadow")); @@ -3121,7 +3121,7 @@ void W3DVolumetricShadow::constructVolumeVB( Vector3 *lightPosObject,Real shadow } // DEBUG_ASSERTLOG(polygonCount == vertexCount, ("WARNING***Shadow volume mesh not optimal: %s",m_geometry->Get_Name())); -} // end constructVolume +} // allocateShadowVolume ======================================================= // Allocate a space for us to construct the shadow volume in @@ -3139,7 +3139,7 @@ Bool W3DVolumetricShadow::allocateShadowVolume( Int volumeIndex, Int meshIndex ) assert( 0 ); return FALSE; - } // end if + } if ((shadowVolume = m_shadowVolume[ volumeIndex ][meshIndex]) == 0) { @@ -3158,7 +3158,7 @@ Bool W3DVolumetricShadow::allocateShadowVolume( Int volumeIndex, Int meshIndex ) m_shadowVolumeCount[meshIndex]--; return FALSE; - } // end if + } // assign to list m_shadowVolume[ volumeIndex ][meshIndex] = shadowVolume; @@ -3201,12 +3201,12 @@ Bool W3DVolumetricShadow::allocateShadowVolume( Int volumeIndex, Int meshIndex ) delete shadowVolume; return FALSE; - } // end if + } } return TRUE; // success -} // end allocateShadowVolume +} // deleteShadowVolume ========================================================= // Free all resources allocated to the shadow volume(s) @@ -3222,7 +3222,7 @@ void W3DVolumetricShadow::deleteShadowVolume( Int volumeIndex ) assert( 0 ); return; - } // end if + } // delete it! for (Int meshIndex=0; meshIndexRelease(); } -} // end resetShadowVolume +} // allocateSilhouette ========================================================= // Allocate space for new silhouette storage, the number of vertices passed @@ -3302,7 +3302,7 @@ Bool W3DVolumetricShadow::allocateSilhouette(Int meshIndex, Int numVertices ) assert( 0 ); return FALSE; - } // end if + } // set our list to empty just to be clean m_numSilhouetteIndices[meshIndex] = 0; @@ -3312,7 +3312,7 @@ Bool W3DVolumetricShadow::allocateSilhouette(Int meshIndex, Int numVertices ) return TRUE; // success -} // end allocateSilhouette +} // deleteSilhouette =========================================================== // Delete all silhouette data and memory allocated @@ -3325,7 +3325,7 @@ void W3DVolumetricShadow::deleteSilhouette( Int meshIndex ) m_silhouetteIndex[meshIndex] = NULL; m_numSilhouetteIndices[meshIndex] = 0; -} // end deletesilhouette +} // resetSilhouette ============================================================ // Resets the silhouette to empty, it does NOT free any of the memory @@ -3336,7 +3336,7 @@ void W3DVolumetricShadow::resetSilhouette( Int meshIndex ) m_numSilhouetteIndices[meshIndex] = 0; -} // end resetSilhouette +} // renderStencilShadows ======================================================= // The stencil buffer now has our shadow information in it, take that @@ -3407,7 +3407,7 @@ void W3DVolumetricShadowManager::renderStencilShadows( void ) // turn off the stencil buffer m_pDev->SetRenderState( D3DRS_STENCILENABLE, FALSE ); -} // end renderStencilShadows +} void W3DVolumetricShadowManager::renderShadows( Bool forceStencilFill ) { @@ -3545,7 +3545,7 @@ void W3DVolumetricShadowManager::renderShadows( Bool forceStencilFill ) numRenderedShadows++; } } - } // end for + } // Set vertex format to that used by static shadow volumes m_pDev->SetVertexShader(W3DBufferManager::getDX8Format(W3DBufferManager::VBM_FVF_XYZ)); @@ -3640,7 +3640,7 @@ void W3DVolumetricShadowManager::renderShadows( Bool forceStencilFill ) DX8Wrapper::Invalidate_Cached_Render_States(); } -} // end RenderShadows +} /** This class will manage shadow geometry for each render object. Shadow geometry may be the same as render geometry but doesn't need to be. This allows lower LOD versions of @@ -3700,7 +3700,7 @@ void W3DVolumetricShadowManager::invalidateCachedLightPositions(void) shadow->setLightPosHistory(i,meshIndex,vec); } } - } // end for + } } // W3DVolumetricShadowManager ============================================================= @@ -3714,7 +3714,7 @@ W3DVolumetricShadowManager::W3DVolumetricShadowManager( void ) TheW3DBufferManager = NEW W3DBufferManager; -} // end ShadowManager +} // ~W3DVolumetricShadowManager ============================================================ // ============================================================================ @@ -3729,7 +3729,7 @@ W3DVolumetricShadowManager::~W3DVolumetricShadowManager( void ) //all shadows should be freed up at this point but check anyway assert(m_shadowList==NULL); -} // end ~W3DVolumetricShadowManager +} /** Releases all W3D/D3D assets before a reset.. */ void W3DVolumetricShadowManager::ReleaseResources(void) @@ -3792,7 +3792,7 @@ Bool W3DVolumetricShadowManager::ReAcquireResources(void) Bool W3DVolumetricShadowManager::init( void ) { return TRUE; -} // end Init +} // Reset ====================================================================== // Reset our list of shadows to empty @@ -3804,7 +3804,7 @@ void W3DVolumetricShadowManager::reset( void ) m_W3DShadowGeometryManager->Free_All_Geoms(); TheW3DBufferManager->freeAllBuffers(); -} // end Reset +} // addShadow ================================================================== // Add the shadows for this hierarchy to the shadow management for @@ -3886,7 +3886,7 @@ void W3DVolumetricShadowManager::removeShadow(W3DVolumetricShadow *shadow) delete shadow; break; } - } // end for + } } /** removeAllShadows =========================================================== @@ -3906,7 +3906,7 @@ void W3DVolumetricShadowManager::removeAllShadows(void) next_shadow = cur_shadow->m_next; cur_shadow->m_next = NULL; delete cur_shadow; - } // end for + } } W3DShadowGeometryManager::W3DShadowGeometryManager(void) diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp index eabf51a20a7..8a2062cce14 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp @@ -867,7 +867,7 @@ static RenderObjClass* createTower( SimpleSceneClass *scene, case BRIDGE_TOWER_TO_RIGHT: towerPos = bridgeInfo->toRight; break; default: return NULL; - } // end switch + } // set the Z position to that of the terrain towerPos.z = TheTerrainRenderObject->getHeightMapHeight( towerPos.x, towerPos.y, NULL); @@ -952,7 +952,7 @@ static void updateTowerPos( RenderObjClass* tower, case BRIDGE_TOWER_TO_RIGHT: towerPos = bridgeInfo->toRight; break; default: return; - } // end switch + } // set the position of the tower render object to the position in the world Matrix3D transform; @@ -1033,7 +1033,7 @@ void W3DBridgeBuffer::worldBuilderUpdateBridgeTowers( W3DAssetManager *assetMana towerRenderObj = createTower( scene, assetManager, pMapObj, (BridgeTowerType)j, &bridgeInfo ); created = TRUE; - } // end if + } // sanity DEBUG_ASSERTCRASH( towerRenderObj != NULL, ("worldBuilderUpdateBridgeTowers: unable to create tower for bridge '%s'", @@ -1046,11 +1046,11 @@ void W3DBridgeBuffer::worldBuilderUpdateBridgeTowers( W3DAssetManager *assetMana if( created ) REF_PTR_RELEASE( towerRenderObj ); - } // end for j + } - } // end if + } - } // end for i + } // skip the 2nd map object representing the second half of the bridgef pMapObj = pMapObj2; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index f73d5af2214..cadeda72099 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -410,7 +410,7 @@ W3DDisplay::W3DDisplay() for (i = 0; i < DisplayStringCount; i++) m_displayStrings[i] = NULL; -} // end W3DDisplay +} // W3DDisplay::~W3DDisplay ==================================================== /** */ @@ -440,7 +440,7 @@ W3DDisplay::~W3DDisplay() delete m_2DRender; m_2DRender = NULL; - } // end if + } // // delete all our views now since they are W3D views and we need to @@ -470,7 +470,7 @@ W3DDisplay::~W3DDisplay() delete TheW3DFileSystem; TheW3DFileSystem = NULL; -} // end ~W3DDisplay +} // TheSuperHackers @tweak valeronm 20/03/2025 No longer filters resolutions by a 4:3 aspect ratio. inline Bool isResolutionSupported(const ResolutionDescClass &res) @@ -573,7 +573,7 @@ void W3DDisplay::setWidth( UnsignedInt width ) // of the screen with (width,height) at the lower right m_2DRender->Set_Coordinate_Range( RectClass( 0, 0, getWidth(), getHeight() ) ); -} // end set width +} // W3DDisplay::setHeight ====================================================== /** Set height of display */ @@ -588,7 +588,7 @@ void W3DDisplay::setHeight( UnsignedInt height ) // of the screen with (width,height) at the lower right m_2DRender->Set_Coordinate_Range( RectClass( 0, 0, getWidth(), getHeight() ) ); -} // end set height +} // W3DDisplay::initAssets ===================================================== /** */ @@ -596,7 +596,7 @@ void W3DDisplay::setHeight( UnsignedInt height ) void W3DDisplay::initAssets( void ) { -} // end initAssets +} // W3DDisplay::init3DScene ==================================================== /** */ @@ -604,7 +604,7 @@ void W3DDisplay::initAssets( void ) void W3DDisplay::init3DScene( void ) { -} // end init3DScene +} // W3DDisplay::init2DScene ==================================================== /** This is the 2D scene, you can use it to draw on a 2D plane over the @@ -613,7 +613,7 @@ void W3DDisplay::init3DScene( void ) void W3DDisplay::init2DScene( void ) { -} // end init2DScene +} // W3DDisplay::init =========================================================== /** Initialize or re-initialize the W3D display system. Here we need to @@ -635,7 +635,7 @@ void W3DDisplay::init( void ) /// @todo W3DDisplay needs RE-init logic! return; - } // end if + } // Override the W3D File system TheW3DFileSystem = NEW W3DFileSystem; @@ -846,7 +846,7 @@ void W3DDisplay::init( void ) { m_debugDisplayCallback = StatDebugDisplay; } -} // end init +} // W3DDisplay::reset =========================================================== /** Reset the W3D display system. Here we need to @@ -982,7 +982,7 @@ void W3DDisplay::gatherDebugStats( void ) } } - } // end if + } if (m_benchmarkDisplayString == NULL) { @@ -1498,7 +1498,7 @@ void W3DDisplay::gatherDebugStats( void ) //Render ALL modelcondition statii - } // end if + } m_displayStrings[ SelectedInfo ]->setText( unibuffer ); } @@ -1533,7 +1533,7 @@ void W3DDisplay::drawDebugStats( void ) y += h; } -} // end drawDebugStats +} // W3DDisplay::drawFPSStats ================================================= /** Draw the FPS on the screen */ @@ -1577,7 +1577,7 @@ void W3DDisplay::drawCurrentDebugDisplay( void ) m_debugDisplayCallback( m_debugDisplay, m_debugDisplayUserData, NULL ); } } -} // end drawCurrentDebugDisplay +} // W3DDisplay::calculateTerrainLOD ================================================= /** Calculates an adequately speedy terrain Level Of Detail. */ @@ -1992,7 +1992,7 @@ void W3DDisplay::draw( void ) goto AGAIN; } #endif -} // end draw +} #define LETTER_BOX_FADE_TIME 1000.0f ///1000 ms. @@ -2185,7 +2185,7 @@ void W3DDisplay::drawLine( Int startX, Int startY, lineWidth, lineColor ); m_2DRender->Render(); -} // end drawLine +} // W3DDisplay::drawLine ======================================================= /** draw a line on the display in pixel coordinates with the specified color */ @@ -2203,7 +2203,7 @@ void W3DDisplay::drawLine( Int startX, Int startY, lineWidth, lineColor1, lineColor2 ); m_2DRender->Render(); -} // end drawLine +} // W3DDisplay::drawOpenRect =================================================== @@ -2256,7 +2256,7 @@ void W3DDisplay::drawOpenRect( Int startX, Int startY, Int width, Int height, m_2DRender->Render(); } -} // end drawOpenRect +} // W3DDisplay::drawFillRect =================================================== //============================================================================= @@ -2274,7 +2274,7 @@ void W3DDisplay::drawFillRect( Int startX, Int startY, Int width, Int height, // render it now! m_2DRender->Render(); -} // end drawFillRect +} void W3DDisplay::drawRectClock(Int startX, Int startY, Int width, Int height, Int percent, UnsignedInt color) { @@ -2768,14 +2768,14 @@ void W3DDisplay::drawImage( const Image *image, Int startX, Int startY, Vector2( uv_rect.Left, uv_rect.Top ), color ); - } // end if + } else { // just draw as normal m_2DRender->Add_Quad( screen_rect, uv_rect, color ); - } // end else + } m_2DRender->Render(); @@ -2784,7 +2784,7 @@ void W3DDisplay::drawImage( const Image *image, Int startX, Int startY, if (doAlphaReset) m_2DRender->Enable_Alpha(true); -} // end drawImage +} //============================================================================ // W3DDisplay::createVideoBuffer @@ -2903,7 +2903,7 @@ void W3DDisplay::setClipRegion( IRegion2D *region ) m_clipRegion = *region; m_isClippedEnabled = TRUE; -} // end setClipRegion +} //============================================================================= /* we don't really need to override this call, since we will soon be called to @@ -3267,9 +3267,9 @@ void W3DDisplay::preloadModelAssets( AsciiString model ) nameWithExtension.format( "%s.w3d", model.str() ); m_assetManager->Load_3D_Assets( nameWithExtension.str() ); - } // end if + } -} // end preloadModelAssets +} //------------------------------------------------------------------------------------------------- /** Preload using the W3D asset manager the texture referenced by the string parameter */ @@ -3281,9 +3281,9 @@ void W3DDisplay::preloadTextureAssets( AsciiString texture ) { TextureClass *theTexture = m_assetManager->Get_Texture( texture.str() ); theTexture->Release_Ref();//release reference - } // end if + } -} // end preloadModelAssets +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp index 44c32a43fd6..1636c46f247 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp @@ -95,7 +95,7 @@ W3DDisplayString::W3DDisplayString( void ) m_hotKeyPos.y = 0; m_hotKeyColor = GameMakeColor(255,255,255,255); -} // end W3DDisplayString +} // W3DDisplayString::~W3DDisplayString ======================================== /** */ @@ -103,7 +103,7 @@ W3DDisplayString::W3DDisplayString( void ) W3DDisplayString::~W3DDisplayString( void ) { -} // end ~W3DDisplayString +} // W3DDisplayString::textChanged ============================================== /** This method automatically gets called from some methods in the display @@ -142,7 +142,7 @@ void W3DDisplayString::notifyTextChanged( void ) m_textRenderer.Reset(); m_textRendererHotKey.Reset(); -} // end notifyTextChanged +} // W3DDisplayString::Draw ===================================================== /** Draw the text at the specified location in in the specified colors @@ -186,7 +186,7 @@ void W3DDisplayString::draw( Int x, Int y, Color color, Color dropColor, Int xDr m_textChanged = FALSE; needNewPolys = TRUE; - } // end if + } // // if our position has changed, or our colors have chagned, or our @@ -224,7 +224,7 @@ void W3DDisplayString::draw( Int x, Int y, Color color, Color dropColor, Int xDr m_textRendererHotKey.Render(); } - } // end if + } // render the text m_textRenderer.Render(); @@ -233,7 +233,7 @@ void W3DDisplayString::draw( Int x, Int y, Color color, Color dropColor, Int xDr if( TheGameClient ) usingResources( TheGameClient->getFrame() ); -} // end draw +} // W3DDisplayString::getSize ================================================== /** Get the render size width and height of the string in this instance @@ -248,7 +248,7 @@ void W3DDisplayString::getSize( Int *width, Int *height ) if( height ) *height = m_size.y; -} // end getSize +} // DisplayString::appendChar ================================================== /** Get text with up to charPos characters, -1 = all characters */ @@ -307,7 +307,7 @@ void W3DDisplayString::setFont( GameFont *font ) // set flag telling us the font has changed since last render m_fontChanged = TRUE; -} // end setFont +} // W3DDisplayString::setClipRegion ============================================ /** Set the clipping region for the text */ @@ -337,9 +337,9 @@ void W3DDisplayString::setClipRegion( IRegion2D *region ) m_clipRegion.lo.y, m_clipRegion.hi.x, m_clipRegion.hi.y ) ); - } // end if + } -} // end setClipRegion +} // W3DDisplayString::computeExtents =========================================== /** Update the width and height of our string */ @@ -355,7 +355,7 @@ void W3DDisplayString::computeExtents( void ) m_size.x = 0; m_size.y = 0; - } // end if + } else { @@ -363,9 +363,9 @@ void W3DDisplayString::computeExtents( void ) m_size.x = extents.X; m_size.y = extents.Y; - } // end else + } -} // end computeExtents +} // W3DDisplayString::setWordWrap =========================================== /** Set the wordwrap of the m_textRenderer */ @@ -375,7 +375,7 @@ void W3DDisplayString::setWordWrap( Int wordWrap ) // set the Word Wrap if(m_textRenderer.Set_Wrapping_Width(wordWrap)) notifyTextChanged(); -}// void setWordWrap( Int wordWrap ) +} void W3DDisplayString::setUseHotkey( Bool useHotkey, Color hotKeyColor ) { @@ -393,4 +393,4 @@ void W3DDisplayString::setWordWrapCentered( Bool isCentered ) // set the Word Wrap if( m_textRenderer.Set_Word_Wrap_Centered(isCentered) ) notifyTextChanged(); -}// void setWordWrap( Int wordWrap ) +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp index 7d4d0388859..dc945b22e79 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp @@ -120,7 +120,7 @@ DisplayString *W3DDisplayStringManager::newDisplayString( void ) assert( 0 ); return NULL; - } // end if + } // assign a default font if (TheGlobalLanguageData && TheGlobalLanguageData->m_defaultDisplayStringFont.name.isNotEmpty()) @@ -139,7 +139,7 @@ DisplayString *W3DDisplayStringManager::newDisplayString( void ) // return our new string return newString; -} // end newDisplayString +} //------------------------------------------------------------------------------------------------- /** Remove a display string from the master list and delete the data */ @@ -162,7 +162,7 @@ void W3DDisplayStringManager::freeDisplayString( DisplayString *string ) // free data deleteInstance(string); -} // end freeDisplayString +} //------------------------------------------------------------------------------------------------- /** Update method for our display string Manager ... if it's been too @@ -217,16 +217,16 @@ void W3DDisplayStringManager::update( void ) // string->m_lastResourceFrame = 0; - } // end if + } // move to next string string = static_cast(string->next()); - } // end while + } // reset the starting point for our next search m_currentCheckpoint = string; -} // end update +} //------------------------------------------------------------------------------------------------- DisplayString *W3DDisplayStringManager::getGroupNumeralString( Int numeral ) diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp index 134a24f6d32..23e043019aa 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp @@ -191,7 +191,7 @@ char const * GameFileClass::Set_Name( char const *filename ) sprintf(m_filePath,localizedPathFormat, GetRegistryLanguage().str()); strcat( m_filePath, filename ); - } // end if + } // We need to be able to grab images from a localization dir, because Art has a fetish for baked-in text. Munkee. if( isImageFileType(fileType) ) @@ -200,7 +200,7 @@ char const * GameFileClass::Set_Name( char const *filename ) sprintf(m_filePath,localizedPathFormat, GetRegistryLanguage().str()); strcat( m_filePath, filename ); - } // end else if + } // see if the file exists m_fileExists = TheFileSystem->doesFileExist( m_filePath ); @@ -217,14 +217,14 @@ char const * GameFileClass::Set_Name( char const *filename ) strcpy( m_filePath, W3D_DIR_PATH ); strcat( m_filePath, filename ); - } // end if + } else if( isImageFileType(fileType) ) { strcpy( m_filePath, TGA_DIR_PATH ); strcat( m_filePath, filename ); - } // end else if + } else strcpy( m_filePath, filename ); @@ -245,19 +245,19 @@ char const * GameFileClass::Set_Name( char const *filename ) strcpy( m_filePath, LEGACY_W3D_DIR_PATH ); strcat( m_filePath, filename ); - } // end if + } else if( isImageFileType(fileType) ) { strcpy( m_filePath, LEGACY_TGA_DIR_PATH ); strcat( m_filePath, filename ); - } // end else if + } // see if the file exists m_fileExists = TheFileSystem->doesFileExist( m_filePath ); - } // end if + } #endif @@ -273,19 +273,19 @@ char const * GameFileClass::Set_Name( char const *filename ) strcpy( m_filePath, TEST_W3D_DIR_PATH ); strcat( m_filePath, filename ); - } // end if + } else if( isImageFileType(fileType) ) { strcpy( m_filePath, TEST_TGA_DIR_PATH ); strcat( m_filePath, filename ); - } // end else if + } // see if the file exists m_fileExists = TheFileSystem->doesFileExist( m_filePath ); - } // end if + } #endif // We allow the user to load their own images for various assets (like the control bar) @@ -297,19 +297,19 @@ char const * GameFileClass::Set_Name( char const *filename ) //strcpy( m_filePath, USER_W3D_DIR_PATH ); strcat( m_filePath, filename ); - } // end if + } if( isImageFileType(fileType) ) { sprintf(m_filePath,USER_TGA_DIR_PATH, TheGlobalData->getPath_UserData().str()); //strcpy( m_filePath, USER_TGA_DIR_PATH ); strcat( m_filePath, filename ); - } // end else if + } // see if the file exists m_fileExists = TheFileSystem->doesFileExist( m_filePath ); - } // end if + } // We Need to be able to "temporarily copy over the map preview for whichever directory it came from @@ -321,12 +321,12 @@ char const * GameFileClass::Set_Name( char const *filename ) //strcpy( m_filePath, USER_TGA_DIR_PATH ); strcat( m_filePath, filename ); - } // end else if + } // see if the file exists m_fileExists = TheFileSystem->doesFileExist( m_filePath ); - } // end if + } return m_filename; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp index fa7c0883eba..0260c36f9b8 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp @@ -64,14 +64,14 @@ W3DGameClient::W3DGameClient() { -} // end W3DGameClient +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- W3DGameClient::~W3DGameClient() { -} // end ~W3DGameClient +} //------------------------------------------------------------------------------------------------- /** Initialize resources for the w3d game client */ @@ -82,7 +82,7 @@ void W3DGameClient::init( void ) // extending initialization routine GameClient::init(); -} // end init +} //------------------------------------------------------------------------------------------------- /** Per frame udpate, note we are extending functionality */ @@ -93,7 +93,7 @@ void W3DGameClient::update( void ) // call base GameClient::update(); -} // end update +} //------------------------------------------------------------------------------------------------- /** Reset this device client system. Note we are extending reset functionality from @@ -105,7 +105,7 @@ void W3DGameClient::reset( void ) // call base class GameClient::reset(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** allocate a new drawable using the thing template for initialization. @@ -162,9 +162,9 @@ void W3DGameClient::createRayEffectByTemplate( const Coord3D *start, // add this ray effect to the list of ray effects TheRayEffects->addRayEffect( draw, start, end ); - } // end if + } -} // end createRayEffectByTemplate +} //------------------------------------------------------------------------------------------------- /** Tell all the drawables what time of day it is now */ @@ -183,7 +183,7 @@ void W3DGameClient::setTimeOfDay( TimeOfDay tod ) //tell the display to update its lighting TheDisplay->setTimeOfDay( tod ); -} // end setTimeOfDay +} //------------------------------------------------------------------------------------------------- @@ -193,7 +193,7 @@ void W3DGameClient::setTeamColor(Int red, Int green, Int blue) W3DStatusCircle::setColor(red, green, blue); -} // end setTeamColor +} //------------------------------------------------------------------------------------------------- /** temporary entry point for adjusting LOD for development testing. */ @@ -217,7 +217,7 @@ void W3DGameClient::adjustLOD( Int adj ) TheTerrainRenderObject->setTextureLOD( TheWritableGlobalData->m_textureReductionFactor ); } -} // end adjustLOD +} //------------------------------------------------------------------------------------------------- /** Tell the terrain that an object moved, so it can knock down trees or crush grass @@ -229,6 +229,6 @@ void W3DGameClient::notifyTerrainObjectMoved(Object *obj) TheTerrainRenderObject->unitMoved(obj); } -} // end setTimeOfDay +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp index 8c884054d0d..7fc6c62f5fd 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp @@ -273,12 +273,12 @@ W3DInGameUI::W3DInGameUI() m_moveHintRenderObj[ i ] = NULL; m_moveHintAnim[ i ] = NULL; - } // end for i + } m_buildingPlacementAnchor = NULL; m_buildingPlacementArrow = NULL; -} // end W3DInGameUI +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -293,12 +293,12 @@ W3DInGameUI::~W3DInGameUI() REF_PTR_RELEASE( m_moveHintRenderObj[ i ] ); REF_PTR_RELEASE( m_moveHintAnim[ i ] ); - } // end for i + } REF_PTR_RELEASE( m_buildingPlacementAnchor ); REF_PTR_RELEASE( m_buildingPlacementArrow ); -} // end ~W3DInGameUI +} // loadText =================================================================== /** Load text from the file */ @@ -326,12 +326,12 @@ static void loadText( char *filename, GameWindow *listboxText ) if (line.isEmpty()) line = UnicodeString(L" "); GadgetListBoxAddEntryText(listboxText, line, color, -1, -1); - } // end while + } // close the file fclose( fp ); -} // end loadText +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -355,10 +355,10 @@ void W3DInGameUI::init( void ) // hide it for now motd->winHide( TRUE ); - } // end if + } */ -} // end init +} //------------------------------------------------------------------------------------------------- /** Update in game UI */ @@ -369,7 +369,7 @@ void W3DInGameUI::update( void ) // call base InGameUI::update(); -} // end update +} //------------------------------------------------------------------------------------------------- /** Reset the in game ui */ @@ -380,7 +380,7 @@ void W3DInGameUI::reset( void ) // call base InGameUI::reset(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Draw member for the W3D implemenation of the game user interface */ @@ -413,9 +413,9 @@ void W3DInGameUI::draw( void ) // draw placement angle selection if needed drawPlaceAngle( view ); - } // end for view + } - } // end if + } // repaint all our windows @@ -439,7 +439,7 @@ void W3DInGameUI::draw( void ) } #endif -} // end draw +} //------------------------------------------------------------------------------------------------- /** draw 2d selection region on screen */ @@ -456,7 +456,7 @@ void W3DInGameUI::drawSelectionRegion( void ) width, color ); -} // end drawSelectionRegion +} //------------------------------------------------------------------------------------------------- /** Draw the visual feedback for clicking in the world and telling units @@ -501,7 +501,7 @@ void W3DInGameUI::drawMoveHints( View *view ) DEBUG_CRASH(("unable to create hint")); return; - } // end if + } // asign render objects to GUI data m_moveHintRenderObj[ i ] = hint; @@ -511,7 +511,7 @@ void W3DInGameUI::drawMoveHints( View *view ) REF_PTR_RELEASE(m_moveHintAnim[i]); m_moveHintAnim[i] = anim; - } // end if, create render objects + } // show the render object if hidden if( m_moveHintRenderObj[ i ]->Is_Hidden() == 1 ) { @@ -560,8 +560,8 @@ void W3DInGameUI::drawMoveHints( View *view ) // draw the line TheDisplay->drawLine( start.x, start.y, end.x, end.y, width, color ); - } // end if - } // end if + } + } #endif } @@ -575,11 +575,11 @@ void W3DInGameUI::drawMoveHints( View *view ) W3DDisplay::m_3DScene->Remove_Render_Object( m_moveHintRenderObj[ i ] ); } - } // end else + } - } // end for i + } -} // end drawMoveHints +} //------------------------------------------------------------------------------------------------- /** Draw visual back for clicking to attack a unit in the world */ @@ -587,7 +587,7 @@ void W3DInGameUI::drawMoveHints( View *view ) void W3DInGameUI::drawAttackHints( View *view ) { -} // end drawAttackHints +} //------------------------------------------------------------------------------------------------- /** Draw the angle selection for placing building if needed */ @@ -729,5 +729,5 @@ void W3DInGameUI::drawPlaceAngle( View *view ) //start.y = o.y * size + p.y * (size/2.0f) + end.y; //TheDisplay->drawLine( start.x, start.y, end.x, end.y, width, color ); -} // end drawPlaceAngle +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp index 7599f92e0c7..b9c75e78378 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp @@ -104,7 +104,7 @@ W3DMouse::W3DMouse( void ) m_camera = NULL; m_drawing = FALSE; -} // end Win32Mouse +} W3DMouse::~W3DMouse( void ) { @@ -121,7 +121,7 @@ W3DMouse::~W3DMouse( void ) thread.Stop(); -} // end Win32Mouse +} void W3DMouse::initPolygonAssets(void) { @@ -343,7 +343,7 @@ void W3DMouse::init( void ) thread.Execute(); thread.Set_Priority(0); -} // end int +} //------------------------------------------------------------------------------------------------- /** Reset */ @@ -354,7 +354,7 @@ void W3DMouse::reset( void ) // extend Win32Mouse::reset(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Super basic simplistic cursor */ @@ -468,7 +468,7 @@ void W3DMouse::setCursor( MouseCursor cursor ) // save current cursor m_currentCursor = cursor; -} // end setCursor +} extern HWND ApplicationHWnd; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp index 65cfb526f6e..8920c2338d0 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp @@ -363,7 +363,7 @@ void W3DParticleSystemManager::doParticles(RenderInfoClass &rinfo) */ - }// next system + } /// @todo lorenzen sez: this should be debug only: TheParticleSystemManager->setOnScreenParticleCount(m_onScreenParticleCount); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DPropBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DPropBuffer.cpp index 30c9f6296f2..2f09ca61b2e 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DPropBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DPropBuffer.cpp @@ -392,7 +392,7 @@ void W3DPropBuffer::drawProps(RenderInfoClass &rinfo) void W3DPropBuffer::crc( Xfer *xfer ) { // empty. jba [8/11/2003] -} // end CRC +} // ------------------------------------------------------------------------------------------------ /** Xfer @@ -408,7 +408,7 @@ void W3DPropBuffer::xfer( Xfer *xfer ) xfer->xferVersion( &version, currentVersion ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -416,5 +416,5 @@ void W3DPropBuffer::xfer( Xfer *xfer ) void W3DPropBuffer::loadPostProcess( void ) { // empty. jba [8/11/2003] -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp index 9e69bd9b1b7..80b8b6e5438 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp @@ -1621,7 +1621,7 @@ void W3DRoadBuffer::addMapObjects() curRoad.m_scale = road->getRoadWidth(); curRoad.m_uniqueID = road->getID(); found = TRUE; - } // end if + } #ifdef LOAD_TEST_ASSETS const Real DEFAULT_SCALE = 30; if (!found) { @@ -3140,9 +3140,9 @@ void W3DRoadBuffer::allocateRoadBuffers(void) m_maxUID = id; #endif // LOAD_TEST_ASSETS - } // end if + } - } // end for road + } #ifdef LOAD_TEST_ASSETS while (iSet_Diffuse( restore ); - } // next light + } temp = lightEnv.Get_Equivalent_Ambient(); Vector3::Add(sumTint, temp, &temp ); @@ -815,12 +815,12 @@ void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, I rinfo.Pop_Override_Flags(); rinfo.Pop_Material_Pass(); } - }//drawInfo exists so rendering a drawable. + } else { robj->Render(rinfo); } - }//drawable or robj is not hidden + } rinfo.light_environment = NULL; if (doExtraMaterialPop) //check if there is an extra material on the stack from the add'l material effect. @@ -1187,7 +1187,7 @@ void RTS3DScene::Customized_Render( RenderInfoClass &rinfo ) { TheParticleSystemManager->queueParticleRender(); } -} // end Customized_Renderer +} /**Convert a player index to a color index, we use this because color indices are assigned in left-right binary flipped fashion so as not to occupy lower bits unless @@ -1312,7 +1312,7 @@ void renderStenciledPlayerColor( UnsignedInt color, UnsignedInt stencilRef, Bool if (oldColorWriteEnable != 0x12345678) DX8Wrapper::Set_DX8_Render_State(D3DRS_COLORWRITEENABLE,oldColorWriteEnable); -} // end renderStencilShadows +} #define MAX_VISIBLE_OCCLUDED_PLAYER_OBJECTS 512 //maximum number of occluded objects permitted per player void RTS3DScene::flushOccludedObjectsIntoStencil(RenderInfoClass & rinfo) @@ -1708,7 +1708,7 @@ void RTS3DScene::doRender( CameraClass * cam ) DRAW(); m_camera = NULL; -} // end Customized_Render +} //============================================================================= // RTS3DScene::draw @@ -1725,7 +1725,7 @@ void RTS3DScene::draw( ) WW3D::Render( this, m_camera ); -} // end Customized_Render +} /////////////////////////////////////////////////////////////////////////////// @@ -1742,7 +1742,7 @@ RTS2DScene::RTS2DScene() setName("RTS2DScene"); m_status = NEW_REF( W3DStatusCircle, () ); Add_Render_Object( m_status ); -} // end RTS2DScene +} //============================================================================= // RTS2DScene::~RTS2DScene @@ -1753,7 +1753,7 @@ RTS2DScene::~RTS2DScene() { this->Remove_Render_Object(m_status); REF_PTR_RELEASE(m_status); -} // end ~RTS2DScene +} //============================================================================= // RTS2DScene::Custimized_Render @@ -1766,7 +1766,7 @@ void RTS2DScene::Customized_Render( RenderInfoClass &rinfo ) // call simple scene class renderer SimpleSceneClass::Customized_Render( rinfo ); -} // end Customized_Render +} //============================================================================= // RTS2DScene::doRender @@ -1780,7 +1780,7 @@ void RTS2DScene::doRender( CameraClass * cam ) DRAW(); m_camera = NULL; -} // end Customized_Render +} //============================================================================= // RTS2DScene::draw @@ -1797,7 +1797,7 @@ void RTS2DScene::draw( ) WW3D::Render( this, m_camera ); -} // end Customized_Render +} @@ -1812,7 +1812,7 @@ void RTS2DScene::draw( ) //============================================================================= RTS3DInterfaceScene::RTS3DInterfaceScene() { -} // end RTS3DInterfaceScene +} //============================================================================= // RTS3DInterfaceScene::~RTS3DInterfaceScene @@ -1821,7 +1821,7 @@ RTS3DInterfaceScene::RTS3DInterfaceScene() //============================================================================= RTS3DInterfaceScene::~RTS3DInterfaceScene() { -} // end ~RTS3DInterfaceScene +} //============================================================================= // RTS3DInterfaceScene::Custimized_Render @@ -1834,7 +1834,7 @@ void RTS3DInterfaceScene::Customized_Render( RenderInfoClass &rinfo ) // call simple scene class renderer SimpleSceneClass::Customized_Render( rinfo ); -} // end Customized_Render +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp index 24a64db0f0c..b487858291d 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp @@ -1756,7 +1756,7 @@ Int TerrainShader2Stage::set(Int pass) DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_ADDRESSU, D3DTADDRESS_WRAP); DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_ADDRESSV, D3DTADDRESS_WRAP); - } //ST_TERRAIN_BASE_NOISE12 + } else { //only 1 noise or cloud texture // Now setup the texture pipeline. @@ -2476,7 +2476,7 @@ Int RoadShader2Stage::set(Int pass) DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_COLOROP, D3DTOP_DISABLE ); DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE ); } - } //pass 0 + } else { //pass 1, apply additional noise pass Matrix4x4 curView; @@ -2993,7 +2993,7 @@ ChipsetType W3DShaderManager::getChipset( void ) if (maxTextures >= 8 && pixelShaderVersion >= 2.0f) chip=DC_GENERIC_PIXEL_SHADER_2_0; } - } //D3D8 interface and device exist. + } return chip; } @@ -3432,7 +3432,7 @@ Int FlatTerrainShader2Stage::set(Int pass) DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_ADDRESSU, D3DTADDRESS_WRAP); DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_ADDRESSV, D3DTADDRESS_WRAP); DX8Wrapper::_Get_D3D_Device8()->SetTexture(1, W3DShaderManager::getShaderTexture(3)->Peek_D3D_Texture()); - } //ST_TERRAIN_BASE_NOISE12 + } else { //only 1 noise or cloud texture // Now setup the texture pipeline. diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp index 293a5d23201..83a391b5d78 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp @@ -491,11 +491,11 @@ TerrainTracksRenderObjClass *TerrainTracksRenderObjClassSystem::bindTrack( Rende mod->init(computeTrackSpacing(renderObject),length,texturename); mod->m_bound=true; m_TerrainTracksScene->Add_Render_Object( mod); - } // end if + } return mod; -} //end bindTrack +} //============================================================================= //TerrainTracksRenderObjClassSystem::unbindTrack @@ -658,7 +658,7 @@ void TerrainTracksRenderObjClassSystem::init( SceneClass *TerrainTracksScene ) assert( 0 ); return; - } // end if + } // allocate our modules for this system for( i = 0; i < numModules; i++ ) @@ -673,7 +673,7 @@ void TerrainTracksRenderObjClassSystem::init( SceneClass *TerrainTracksScene ) assert( 0 ); return; - } // end if + } mod->m_prevSystem = NULL; mod->m_nextSystem = m_freeModules; @@ -681,9 +681,9 @@ void TerrainTracksRenderObjClassSystem::init( SceneClass *TerrainTracksScene ) m_freeModules->m_prevSystem = mod; m_freeModules = mod; - } // end for i + } -} // end init +} //============================================================================= // TerrainTracksRenderObjClassSystem::shutdown @@ -705,7 +705,7 @@ void TerrainTracksRenderObjClassSystem::shutdown( void ) releaseTrack(mod); mod = nextMod; - } // end while + } // free all attached things and used modules @@ -719,13 +719,13 @@ void TerrainTracksRenderObjClassSystem::shutdown( void ) REF_PTR_RELEASE (m_freeModules); m_freeModules = nextMod; - } // end while + } REF_PTR_RELEASE(m_indexBuffer); REF_PTR_RELEASE(m_vertexMaterialClass); REF_PTR_RELEASE(m_vertexBuffer); -} // end shutdown +} //============================================================================= // TerrainTracksRenderObjClassSystem::update @@ -778,7 +778,7 @@ void TerrainTracksRenderObjClassSystem::update() releaseTrack(mod); } mod = nextMod; - } // end while + } } @@ -878,13 +878,12 @@ Try improving the fit to vertical surfaces like cliffs. verts->diffuse=diffuseLight | ( REAL_TO_INT(distanceFade*255.0f) <<24); verts++; - }//for - }// mod has edges to render + } + } mod = mod->m_nextSystem; - } //while (mod) - }//edges to flush + } + } - //there are some edges to render in pool. //draw the filled vertex buffers if (m_edgesToFlush >= 2) { @@ -927,7 +926,7 @@ void TerrainTracksRenderObjClassSystem::Reset(void) releaseTrack(mod); mod = nextMod; - } // end while + } // free all attached things and used modules @@ -951,7 +950,7 @@ void TerrainTracksRenderObjClassSystem::clearTracks(void) mod->m_totalEdgesAdded=0; mod = mod->m_nextSystem; - } // end while + } m_edgesToFlush=0; } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp index d9162e42e48..2814b9397ce 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp @@ -180,7 +180,7 @@ W3DTerrainVisual::W3DTerrainVisual() -} // end W3DTerrainVisual +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -217,7 +217,7 @@ W3DTerrainVisual::~W3DTerrainVisual() #ifdef DO_SEISMIC_SIMULATIONS REF_PTR_RELEASE( m_clientHeightMap ); #endif -} // end ~W3DTerrainVisual +} //------------------------------------------------------------------------------------------------- /** init */ @@ -294,7 +294,7 @@ void W3DTerrainVisual::init( void ) m_seismicSimulationList.clear(); #endif -} // end init +} //------------------------------------------------------------------------------------------------- /** reset */ @@ -336,7 +336,7 @@ void W3DTerrainVisual::reset( void ) m_seismicSimulationList.clear(); #endif -} // end reset +} //------------------------------------------------------------------------------------------------- /** update */ @@ -355,7 +355,7 @@ void W3DTerrainVisual::update( void ) m_waterRenderObject->update(); -} // end update +} #ifdef DO_SEISMIC_SIMULATIONS @@ -571,7 +571,7 @@ Bool W3DTerrainVisual::load( AsciiString filename ) REF_PTR_RELEASE( m_terrainRenderObject ); return FALSE; - } // end if + } if( m_terrainRenderObject == NULL ) return FALSE; @@ -704,7 +704,7 @@ Bool W3DTerrainVisual::load( AsciiString filename ) return TRUE; // success -} // end load +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -718,7 +718,7 @@ void W3DTerrainVisual::enableWaterGrid( Bool enable ) if( m_waterRenderObject ) m_waterRenderObject->enableWaterGrid( enable ); -} // end enableWaterGrid +} //------------------------------------------------------------------------------------------------- /** intersect the ray with the terrain, if a hit occurs TRUE is returned @@ -750,14 +750,14 @@ Bool W3DTerrainVisual::intersectTerrain( Coord3D *rayStart, result->y = point.Y; result->z = point.Z; - } // end if + } - } // end if + } // return hit result return hit; -} // end intersectTerrain +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -772,7 +772,7 @@ void W3DTerrainVisual::getTerrainColorAt( Real x, Real y, RGBColor *pColor ) m_logicHeightMap->getTerrainColorAt( x, y, pColor ); #endif -} // end getTerrainColorAt +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -786,13 +786,13 @@ TerrainType *W3DTerrainVisual::getTerrainTile( Real x, Real y ) { AsciiString tileName = m_clientHeightMap->getTerrainNameAt( x, y ); tile = TheTerrainTypes->findTerrain( tileName ); - } // end if + } #else if( m_logicHeightMap ) { AsciiString tileName = m_logicHeightMap->getTerrainNameAt( x, y ); tile = TheTerrainTypes->findTerrain( tileName ); - } // end if + } #endif @@ -800,7 +800,7 @@ TerrainType *W3DTerrainVisual::getTerrainTile( Real x, Real y ) return tile; -} // end getTerrainTile +} // ------------------------------------------------------------------------------------------------ /** set min/max height values allowed in water grid pointed to by waterTable */ @@ -812,7 +812,7 @@ void W3DTerrainVisual::setWaterGridHeightClamps( const WaterHandle *waterTable, if( m_waterRenderObject ) m_waterRenderObject->setGridHeightClamps( minZ, maxZ ); -} // end setWaterGridHeightClamps +} // ------------------------------------------------------------------------------------------------ /** adjust fallof parameters for grid change method */ @@ -824,7 +824,7 @@ void W3DTerrainVisual::setWaterAttenuationFactors( const WaterHandle *waterTable if( m_waterRenderObject ) m_waterRenderObject->setGridChangeAttenuationFactors( a, b, c, range ); -} // end setWaterAttenuationFactors +} // ------------------------------------------------------------------------------------------------ /** set the water table position and orientation in world space */ @@ -836,7 +836,7 @@ void W3DTerrainVisual::setWaterTransform( const WaterHandle *waterTable, if( m_waterRenderObject ) m_waterRenderObject->setGridTransform( angle, x, y, z ); -} // end setWaterTransform +} // ------------------------------------------------------------------------------------------------ /** set water table transform by matrix */ @@ -847,7 +847,7 @@ void W3DTerrainVisual::setWaterTransform( const Matrix3D *transform ) if( m_waterRenderObject ) m_waterRenderObject->setGridTransform( transform ); -} // end setWaterTransform +} // ------------------------------------------------------------------------------------------------ /** get the water transform matrix */ @@ -858,7 +858,7 @@ void W3DTerrainVisual::getWaterTransform( const WaterHandle *waterTable, Matrix3 if( m_waterRenderObject ) m_waterRenderObject->getGridTransform( transform ); -} // end getWaterTransform +} // ------------------------------------------------------------------------------------------------ /** water grid resolution spacing */ @@ -870,7 +870,7 @@ void W3DTerrainVisual::setWaterGridResolution( const WaterHandle *waterTable, if( m_waterRenderObject ) m_waterRenderObject->setGridResolution( gridCellsX, gridCellsY, cellSize ); -} // end setWaterGridResolution +} // ------------------------------------------------------------------------------------------------ /** get water grid resolution spacing */ @@ -882,7 +882,7 @@ void W3DTerrainVisual::getWaterGridResolution( const WaterHandle *waterTable, if( m_waterRenderObject ) m_waterRenderObject->getGridResolution( gridCellsX, gridCellsY, cellSize ); -} // end getWaterGridResolution +} // ------------------------------------------------------------------------------------------------ /** adjust the water grid in world coords by the delta */ @@ -893,7 +893,7 @@ void W3DTerrainVisual::changeWaterHeight( Real x, Real y, Real delta ) if( m_waterRenderObject ) m_waterRenderObject->changeGridHeight( x, y, delta ); -} // end changeWaterHeight +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -904,7 +904,7 @@ void W3DTerrainVisual::addWaterVelocity( Real worldX, Real worldY, if( m_waterRenderObject ) m_waterRenderObject->addVelocity( worldX, worldY, velocity, preferredHeight ); -} // end addWaterVelocity +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1178,7 +1178,7 @@ void W3DTerrainVisual::crc( Xfer *xfer ) // extend base class TerrainVisual::crc( xfer ); -} // end CRC +} // ------------------------------------------------------------------------------------------------ /** Xfer @@ -1208,7 +1208,7 @@ void W3DTerrainVisual::xfer( Xfer *xfer ) DEBUG_CRASH(( "W3DTerrainVisual::xfer - m_isWaterGridRenderingEnabled mismatch" )); throw SC_INVALID_DATA; - } // end if + } // xfer grid data if enabled if( gridEnabled ) @@ -1229,7 +1229,7 @@ void W3DTerrainVisual::xfer( Xfer *xfer ) width, getGridWidth() )); throw SC_INVALID_DATA; - } // end if + } if( height != getGridHeight() ) { @@ -1237,11 +1237,11 @@ void W3DTerrainVisual::xfer( Xfer *xfer ) height, getGridHeight() )); throw SC_INVALID_DATA; - } // end if + } // write data for each grid - } // end if + } */ // Write out the terrain height data. @@ -1288,7 +1288,7 @@ void W3DTerrainVisual::xfer( Xfer *xfer ) -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1299,5 +1299,5 @@ void W3DTerrainVisual::loadPostProcess( void ) // extend base class TerrainVisual::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp index b7959b77634..1404824d72e 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp @@ -1943,7 +1943,7 @@ void W3DTreeBuffer::updateTopplingTree(TTree *tree) void W3DTreeBuffer::crc( Xfer *xfer ) { // empty. jba [8/11/2003] -} // end CRC +} // ------------------------------------------------------------------------------------------------ /** Xfer @@ -2034,7 +2034,7 @@ void W3DTreeBuffer::xfer( Xfer *xfer ) } } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -2042,7 +2042,7 @@ void W3DTreeBuffer::xfer( Xfer *xfer ) void W3DTreeBuffer::loadPostProcess( void ) { // empty. jba [8/11/2003] -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 4206775cfc7..3e3a6c042a5 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -182,7 +182,7 @@ W3DView::W3DView() m_shakerAngles.Y =0.0f; m_shakerAngles.Z =0.0f; -} // end W3DView +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -192,7 +192,7 @@ W3DView::~W3DView() REF_PTR_RELEASE( m_2DCamera ); REF_PTR_RELEASE( m_3DCamera ); -} // end ~W3DView +} //------------------------------------------------------------------------------------------------- /** Sets the height of the viewport, while maintaining original camera perspective. */ @@ -663,7 +663,7 @@ void W3DView::init( void ) m_scrollAmountCutoff = TheGlobalData->m_scrollAmountCutoff; -} // end init +} //------------------------------------------------------------------------------------------------- const Coord3D& W3DView::get3DCameraPosition() const @@ -702,7 +702,7 @@ static void drawDrawable( Drawable *draw, void *userData ) draw->draw(); -} // end drawDrawable +} // ------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------- @@ -768,7 +768,7 @@ static void drawContainedDrawable( Object *obj, void *userData ) if( draw ) drawDrawableExtents( draw, userData ); -} // end drawContainedDrawable +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -818,11 +818,11 @@ static void drawDrawableExtents( Drawable *draw, void *userData ) z += draw->getDrawableGeometryInfo().getMaxHeightAbovePosition(); - } // end for i + } break; - } // end case box + } //--------------------------------------------------------------------------------------------- case GEOMETRY_SPHERE: // not quite right, but close enough @@ -838,7 +838,7 @@ static void drawDrawableExtents( Drawable *draw, void *userData ) // next time 'round, draw the top of the cylinder center.z += draw->getDrawableGeometryInfo().getMaxHeightAbovePosition(); - } // end for i + } // draw centerline ICoord2D start, end; @@ -850,9 +850,9 @@ static void drawDrawableExtents( Drawable *draw, void *userData ) break; - } // case CYLINDER + } - } // end switch + } // draw any extents for things that are contained by this Object *obj = draw->getObject(); @@ -863,9 +863,9 @@ static void drawDrawableExtents( Drawable *draw, void *userData ) if( contain ) contain->iterateContained( drawContainedDrawable, userData, FALSE ); - } // end if + } -} // end drawDrawableExtents +} void drawAudioLocations( Drawable *draw, void *userData ); @@ -879,7 +879,7 @@ static void drawContainedAudioLocations( Object *obj, void *userData ) if( draw ) drawAudioLocations( draw, userData ); -} // end drawContainedAudio +} //------------------------------------------------------------------------------------------------- @@ -896,7 +896,7 @@ static void drawAudioLocations( Drawable *draw, void *userData ) if( contain ) contain->iterateContained( drawContainedAudioLocations, userData, FALSE ); - } // end if + } const ThingTemplate * thingTemplate = draw->getTemplate(); @@ -1024,7 +1024,7 @@ static void drawablePostDraw( Drawable *draw, void *userData ) TheGameClient->incrementRenderedObjectCount(); -} // end drawablePostDraw +} //------------------------------------------------------------------------------------------------- // Display AI debug visuals @@ -1434,7 +1434,7 @@ void W3DView::getAxisAlignedViewRegion(Region3D &axisAlignedRegion) if( box[ i ].y > axisAlignedRegion.hi.y ) axisAlignedRegion.hi.y = box[ i ].y; - } // end for i + } // low and high regions will be based of the extent of the map Region3D mapExtent; @@ -1697,7 +1697,7 @@ void W3DView::draw( void ) } } - } // end if, show debug AI + } #if defined(RTS_DEBUG) if( TheGlobalData->m_debugCamera ) @@ -1811,7 +1811,7 @@ void W3DView::setSnapMode( CameraLockType lockType, Real lockDist ) //------------------------------------------------------------------------------------------------- // Scroll the view by the given delta in SCREEN COORDINATES, this interface // assumes we will be scrolling along the X,Y plane -// +// // TheSuperHackers @bugfix Now rotates the view plane on the Z axis only to properly discard the // camera pitch. The aspect ratio also no longer modifies the vertical scroll speed. //------------------------------------------------------------------------------------------------- @@ -1858,9 +1858,9 @@ void W3DView::scrollBy( Coord2D *delta ) // set new camera position setCameraTransform(); - } // end if + } -} // end scrollBy +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -1953,7 +1953,7 @@ void W3DView::setHeightAboveGround(Real z) if (m_heightAboveGround > m_maxHeightAboveGround) m_heightAboveGround = m_maxHeightAboveGround; - } // end if + } m_doingMoveCameraOnWaypointPath = false; m_CameraArrivedAtWaypointOnPathFlag = false; @@ -2076,10 +2076,10 @@ View::WorldToScreenReturn W3DView::worldToScreenTriReturn( const Coord3D *w, ICo return WTS_INSIDE_FRUSTUM; - } // end if + } return WTS_INVALID; -} // end worldToScreenTriReturn +} //------------------------------------------------------------------------------------------------- /** Using the W3D camera translate the screen coord to world coord */ @@ -2094,9 +2094,9 @@ void W3DView::screenToWorld( const ICoord2D *s, Coord3D *w ) if( m_3DCamera ) { DEBUG_CRASH(("implement me")); - } // end if + } -} // end screenToWorld +} //------------------------------------------------------------------------------------------------- /** all the drawables in the view, that fall within the 2D screen region @@ -2140,7 +2140,7 @@ Int W3DView::iterateDrawablesInRegion( IRegion2D *screenRegion, normalizedRegion.hi.x = ((Real)(screenRegion->hi.x - m_originX) / (Real)getWidth()) * 2.0f - 1.0f; normalizedRegion.hi.y = -(((Real)(screenRegion->lo.y - m_originY) / (Real)getHeight()) * 2.0f - 1.0f); - } // end if + } Drawable *onlyDrawableToTest = NULL; @@ -2191,10 +2191,10 @@ Int W3DView::iterateDrawablesInRegion( IRegion2D *screenRegion, inside = TRUE; - } // end if + } } - } //end else + } // if inside do the callback and count up if( inside ) @@ -2203,17 +2203,17 @@ Int W3DView::iterateDrawablesInRegion( IRegion2D *screenRegion, if( callback( draw, userData ) ) ++count; - } // end if + } // If onlyDrawableToTest, then we should bail out now. if (onlyDrawableToTest != NULL) break; - } // end for draw + } return count; -} // end iterateDrawablesInRegion +} //------------------------------------------------------------------------------------------------- /** cast a ray from the screen coords into the scene and return a drawable @@ -2272,7 +2272,7 @@ Drawable *W3DView::pickDrawable( const ICoord2D *screen, Bool forceAttack, PickT return draw; -} // end pickDrawable +} //------------------------------------------------------------------------------------------------- /** convert a pixel (x,y) to a location in the world on the terrain. @@ -2319,7 +2319,7 @@ void W3DView::screenToTerrain( const ICoord2D *screen, Coord3D *world ) // get the point of intersection according to W3D intersection = result.ContactPoint; - } // end if + } // Pick bridges. Vector3 bridgePt; @@ -2337,7 +2337,7 @@ void W3DView::screenToTerrain( const ICoord2D *screen, Coord3D *world ) req.second = (*world); m_locationRequests.push_back(req); // Insert this request at the end, requires no extra copies -} // end screenToTerrain +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -2376,7 +2376,7 @@ void W3DView::lookAt( const Coord3D *o ) pos.x = result.ContactPoint.X; pos.y = result.ContactPoint.Y; - } // end if + } } pos.z = 0; setPosition(&pos); @@ -3333,7 +3333,7 @@ void W3DView::screenToWorldAtZ( const ICoord2D *s, Coord3D *w, Real z ) w->y = Vector3::Find_Y_At_Z( z, rayStart, rayEnd ); w->z = z; -} // end screenToWorldAtZ +} void W3DView::cameraEnableSlaveMode(const AsciiString & objectName, const AsciiString & boneName) { diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp index b68fa4c0c4c..773674e713b 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp @@ -524,7 +524,7 @@ void W3DWaypointBuffer::drawWaypoints(RenderInfoClass &rinfo) m_line->Set_Points( numPoints, points ); m_line->Render( localRinfo ); - }// end if exit interface + } } } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp index 2567cffcb46..e157bfa7a93 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp @@ -527,7 +527,7 @@ HRESULT WaterRenderObjClass::initBumpMap(LPDIRECT3DTEXTURE8 *pTex, TextureClass pTex[0]->UnlockRect(level); surf->Unlock(); REF_PTR_RELEASE (surf); - }//for each level + } #else surf=pBumpSource->Get_Surface_Level(); @@ -1164,14 +1164,14 @@ void WaterRenderObjClass::reset( void ) // on to the next one pData++; - } // end for i + } - } // end for j + } // mesh data is no longer in motion m_meshInMotion = FALSE; - } // end if, water type 3 + } if (m_waterTrackSystem) m_waterTrackSystem->reset(); @@ -1285,32 +1285,32 @@ void WaterRenderObjClass::update( void ) pData->height = pData->preferredHeight; pData->velocity = 0.0f; - } // end if + } else { // there is still motion in the mesh, we need to process next frame m_meshInMotion = TRUE; - } // end else + } - } // end if + } // on to the next one pData++; - } // end for i + } - } // end for j + } - } // end if + } // mark the last logic frame we processed on lastLogicFrame = currLogicFrame; - } // end if, a logic frame has passed + } -} // end update +} //------------------------------------------------------------------------------------------------- @@ -1710,12 +1710,12 @@ void WaterRenderObjClass::Render(RenderInfoClass & rinfo) ShaderClass::Invalidate(); //reset shading system so it forces full state set. renderWater(); - } //WATER_TYPE_1 + } break; default: break; - }//switch + } if (TheGlobalData && TheGlobalData->m_drawSkyBox) { //center skybox around camera @@ -2529,7 +2529,7 @@ void WaterRenderObjClass::addVelocity( Real worldX, Real worldY, } - } // end if, water type is 3 + } } @@ -2691,11 +2691,11 @@ Real WaterRenderObjClass::getWaterHeight(Real x, Real y) waterZ = pTrig->getPoint( 0 )->z; waterHandle = pTrig->getWaterHandle(); - } // end if + } - } // end if + } - } // end for + } if (waterHandle) return waterHandle->m_polygon->getPoint( 0 )->z; @@ -3431,7 +3431,7 @@ void WaterRenderObjClass::renderSkyBody(Matrix3D *mat) void WaterRenderObjClass::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer @@ -3455,7 +3455,7 @@ void WaterRenderObjClass::xfer( Xfer *xfer ) DEBUG_CRASH(( "WaterRenderObjClass::xfer - cells X mismatch" )); throw SC_INVALID_DATA; - } // end if + } // grid cells Y Int cellsY = m_gridCellsY; @@ -3466,7 +3466,7 @@ void WaterRenderObjClass::xfer( Xfer *xfer ) DEBUG_CRASH(( "WaterRenderObjClass::xfer - cells Y mismatch" )); throw SC_INVALID_DATA; - } // end if + } // xfer each of the mesh data points for( UnsignedInt i = 0; i < m_meshDataSize; ++i ) @@ -3484,9 +3484,9 @@ void WaterRenderObjClass::xfer( Xfer *xfer ) // preferred height xfer->xferUnsignedByte( &m_meshData[ i ].preferredHeight ); - } // end for, i + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -3494,6 +3494,6 @@ void WaterRenderObjClass::xfer( Xfer *xfer ) void WaterRenderObjClass::loadPostProcess( void ) { -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp index aa755f5936e..8911bd9e8c5 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp @@ -544,7 +544,7 @@ WaterTracksObj *WaterTracksRenderSystem::bindTrack(waveType type) } mod->m_bound=true; - } // end if + } #ifdef SYNC_WAVES nextmod=m_usedModules; @@ -553,11 +553,11 @@ WaterTracksObj *WaterTracksRenderSystem::bindTrack(waveType type) { nextmod->m_elapsedMs=nextmod->m_initTimeOffset; nextmod=nextmod->m_nextSystem; - } // end while + } #endif return mod; -} //end bindTrack +} //============================================================================= //WaterTracksRenderSystem::unbindTrack @@ -731,7 +731,7 @@ void WaterTracksRenderSystem::init(void) assert( 0 ); return; - } // end if + } // allocate our modules for this system for( i = 0; i < numModules; i++ ) @@ -746,7 +746,7 @@ void WaterTracksRenderSystem::init(void) assert( 0 ); return; - } // end if + } mod->m_prevSystem = NULL; mod->m_nextSystem = m_freeModules; @@ -754,9 +754,9 @@ void WaterTracksRenderSystem::init(void) m_freeModules->m_prevSystem = mod; m_freeModules = mod; - } // end for i + } -} // end init +} void WaterTracksRenderSystem::reset(void) { @@ -772,7 +772,7 @@ void WaterTracksRenderSystem::reset(void) releaseTrack(mod); mod = nextMod; - } // end while + } // free all attached things and used modules @@ -799,7 +799,7 @@ void WaterTracksRenderSystem::shutdown( void ) releaseTrack(mod); mod = nextMod; - } // end while + } // free all attached things and used modules @@ -813,13 +813,13 @@ void WaterTracksRenderSystem::shutdown( void ) delete m_freeModules; m_freeModules = nextMod; - } // end while + } REF_PTR_RELEASE(m_indexBuffer); REF_PTR_RELEASE(m_vertexMaterialClass); REF_PTR_RELEASE(m_vertexBuffer); -} // end shutdown +} //============================================================================= // WaterTracksRenderSystem::update @@ -846,7 +846,7 @@ void WaterTracksRenderSystem::update() } mod = nextMod; - } // end while + } } @@ -938,7 +938,7 @@ Try improving the fit to vertical surfaces like cliffs. m_batchStart = vertsRendered; //advance past vertices already in buffer mod = mod->m_nextSystem; - } //while (mod) + } DX8Wrapper::Set_DX8_Render_State(D3DRS_ZBIAS,0); @@ -960,7 +960,7 @@ WaterTracksObj *WaterTracksRenderSystem::findTrack(Vector2 &start, Vector2 &end, mod->m_type == type) return mod; mod = mod->m_nextSystem; - } //while (mod) + } return NULL; } void WaterTracksRenderSystem::saveTracks(void) @@ -995,7 +995,7 @@ void WaterTracksRenderSystem::saveTracks(void) trackCount++; } umod=umod->m_nextSystem; - } // end while + } fwrite(&trackCount,sizeof(trackCount),1,fp); fclose(fp); } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp index 10914d02bd8..32c9bcbc9f8 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp @@ -2492,7 +2492,7 @@ void WorldHeightMap::setupAlphaTiles(void) case K_RDIAG : blendInfo.rightDiagonal = true; break; case K_LLDIAG : blendInfo.leftDiagonal = true; blendInfo.longDiagonal = true; break; case K_LRDIAG : blendInfo.rightDiagonal = true; blendInfo.longDiagonal = true; break; - } // end of case. + } m_alphaTiles[k] = new TileData; TileData *pTile = m_alphaTiles[k]; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index 0caca397b62..77dbb878533 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -138,7 +138,7 @@ void W3DRenderObjectSnapshot::update(RenderObjClass *robj, DrawableInfo *drawInf HAnimClass *hanim=((HLodClass *)robj)->Peek_Animation_And_Info(frame,numFrames,mode,mult); m_robj->Set_Animation(hanim,frame); disableUVAnimations(m_robj); - } //HLOD + } } else m_robj=robj; @@ -171,7 +171,7 @@ W3DRenderObjectSnapshot::W3DRenderObjectSnapshot(RenderObjClass *robj, DrawableI void W3DRenderObjectSnapshot::crc( Xfer *xfer ) { -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -220,7 +220,7 @@ void W3DRenderObjectSnapshot::xfer( Xfer *xfer ) subObjectName.set( subObject->Get_Name() ); xfer->xferAsciiString( &subObjectName ); - } // end if, save + } else { @@ -230,7 +230,7 @@ void W3DRenderObjectSnapshot::xfer( Xfer *xfer ) // find this sub object on the object subObject = m_robj->Get_Sub_Object_By_Name( subObjectName.str() ); - } // end else load + } // // NOTE that the remainder of this xfer code works on a sub object only *if* @@ -263,18 +263,18 @@ void W3DRenderObjectSnapshot::xfer( Xfer *xfer ) if( subObject->Class_ID() == RenderObjClass::CLASSID_HLOD ) ((HLodClass *)subObject)->Friend_Set_Hierarchy_Valid( TRUE ); - } // end if + } // release reference to sub object if( subObject ) REF_PTR_RELEASE( subObject ); - } // end for, i + } // tell W3D that the transforms for our sub objects are all OK cause we've done them ourselves m_robj->Set_Sub_Object_Transforms_Dirty( FALSE ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -282,7 +282,7 @@ void W3DRenderObjectSnapshot::xfer( Xfer *xfer ) void W3DRenderObjectSnapshot::loadPostProcess( void ) { -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -601,7 +601,7 @@ void W3DGhostObject::crc( Xfer *xfer ) // extend base class GhostObject::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer method @@ -638,7 +638,7 @@ void W3DGhostObject::xfer( Xfer *xfer ) if( drawableID != INVALID_DRAWABLE_ID && m_drawableInfo.m_drawable == NULL ) DEBUG_CRASH(( "W3DGhostObject::xfer - Unable to find drawable for ghost object" )); - } // end if + } // // no need to mess with this "circular" back into itself pointer to the ghost object @@ -663,7 +663,7 @@ void W3DGhostObject::xfer( Xfer *xfer ) // on to the next snapshot objectSnapshot = objectSnapshot->m_next; - } // end while + } // xfer the snapshot count at this index xfer->xferUnsignedByte( &snapshotCount ); @@ -678,7 +678,7 @@ void W3DGhostObject::xfer( Xfer *xfer ) DEBUG_CRASH(( "W3DGhostObject::xfer - m_parentShapshots[ %d ] has data present but the count from the xfer stream is empty", i )); throw INI_INVALID_DATA; - } // end if + } // xfer each of the snapshots at this index Real scale; @@ -710,9 +710,9 @@ void W3DGhostObject::xfer( Xfer *xfer ) // onto the next objectSnapshot = objectSnapshot->m_next; - } // end while + } - } // end if, save + } else { RenderObjClass *renderObject; @@ -750,11 +750,11 @@ void W3DGhostObject::xfer( Xfer *xfer ) // add snapshot to the scene objectSnapshot->addToScene(); - } // end for, j + } - } // end else, load + } - } // end for, i + } // // since there is a snapshot for this object, there cannot be a regular object/drawable @@ -797,11 +797,11 @@ void W3DGhostObject::xfer( Xfer *xfer ) status = m_partitionData->friend_getShroudednessPrevious( playerIndex ); xfer->xferUser( &status, sizeof( ObjectShroudStatus ) ); - } // end if, snapshot list here exists + } - } // end for, i + } - } // end if, save + } else { UnsignedByte i; @@ -821,11 +821,11 @@ void W3DGhostObject::xfer( Xfer *xfer ) xfer->xferUser( &status, sizeof( ObjectShroudStatus ) ); m_partitionData->friend_setShroudednessPrevious( playerIndex, status ); - } // end for, i + } - } // end else load + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -836,7 +836,7 @@ void W3DGhostObject::loadPostProcess( void ) // extend base class GhostObject::loadPostProcess(); -} // end loadPostProcess +} // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -945,9 +945,9 @@ GhostObject *W3DGhostObjectManager::addGhostObject(Object *object, PartitionData ("W3DGhostObjectManager::addGhostObject - Duplicate ghost object detected\n") ); sanity = sanity->m_nextSystem; - } // end while + } - } // end if + } #endif W3DGhostObject *mod = m_freeModules; @@ -1133,7 +1133,7 @@ void W3DGhostObjectManager::crc( Xfer *xfer ) // extend base class GhostObjectManager::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer Method @@ -1179,9 +1179,9 @@ void W3DGhostObjectManager::xfer( Xfer *xfer ) // write out ghost object data xfer->xferSnapshot( w3dGhostObject ); - } // end for, ghostObject + } - } // end if, saving + } else { @@ -1224,7 +1224,7 @@ void W3DGhostObjectManager::xfer( Xfer *xfer ) object->getTemplate()->getName().str()) ); object->friend_getPartitionData()->friend_setGhostObject( ghostObject ); - } // end if + } else { @@ -1234,16 +1234,16 @@ void W3DGhostObjectManager::xfer( Xfer *xfer ) // register ghost object object with partition system and fill out partition data ThePartitionManager->registerGhostObject( ghostObject ); - } // end else + } // read ghost object data xfer->xferSnapshot( ghostObject ); - } // end for, i + } - } // end else, loading + } -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -1254,4 +1254,4 @@ void W3DGhostObjectManager::loadPostProcess( void ) // extend base class GhostObjectManager::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp index 650275c42df..08a24c78514 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp @@ -49,7 +49,7 @@ m_mapMinZ(0), m_mapMaxZ(1) { m_mapData = NULL; -} // end W3DTerrainLogic +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -58,7 +58,7 @@ W3DTerrainLogic::~W3DTerrainLogic() // free terrain data -} // end W3DTerrainLogic +} //------------------------------------------------------------------------------------------------- /** Device DEPENDENT implementation init details for logical terrain */ @@ -73,7 +73,7 @@ void W3DTerrainLogic::init( void ) m_mapMinZ = 0; m_mapMaxZ = 1; -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset */ @@ -86,7 +86,7 @@ void W3DTerrainLogic::reset( void ) m_mapMinZ = 0; m_mapMaxZ = 1; WorldHeightMap::freeListOfMapObjects(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** newMap */ @@ -96,7 +96,7 @@ void W3DTerrainLogic::newMap( Bool saveGame ) TheTerrainRenderObject->loadRoadsAndBridges( this, saveGame ); TerrainLogic::newMap( saveGame ); -} // end update +} //------------------------------------------------------------------------------------------------- /** Update */ @@ -104,7 +104,7 @@ void W3DTerrainLogic::newMap( Bool saveGame ) void W3DTerrainLogic::update( void ) { TerrainLogic::update(); -} // end update +} //------------------------------------------------------------------------------------------------- /** Device DEPENDENT implementation for load details of logical terrain. @@ -187,7 +187,7 @@ Bool W3DTerrainLogic::loadMap( AsciiString filename , Bool query ) return TRUE; // success -} // end load +} //------------------------------------------------------------------------------------------------- /** Get the 3D extent of the terrain in world coordinates */ @@ -294,7 +294,7 @@ Real W3DTerrainLogic::getGroundHeight( Real x, Real y, Coord3D* normal ) const return 0; } #endif -} // end getHight +} //------------------------------------------------------------------------------------------------- /** Get the height considering the layer. */ @@ -348,7 +348,7 @@ Real W3DTerrainLogic::getLayerHeight( Real x, Real y, PathfindLayerEnum layer, C return height; #endif -} // end getLayerHeight +} //------------------------------------------------------------------------------------------------- /** W3D isCliffCell for terrain logic */ @@ -359,7 +359,7 @@ Bool W3DTerrainLogic::isCliffCell( Real x, Real y) const // W3DTerrainLogic shouldn't depend on TheTerrainRenderObject! return TheTerrainRenderObject->isCliffCell(x,y); -} // end isCliffCell +} // ------------------------------------------------------------------------------------------------ /** CRC */ @@ -370,7 +370,7 @@ void W3DTerrainLogic::crc( Xfer *xfer ) // extend base class TerrainLogic::crc( xfer ); -} // end crc +} // ------------------------------------------------------------------------------------------------ /** Xfer @@ -388,7 +388,7 @@ void W3DTerrainLogic::xfer( Xfer *xfer ) // extend base class TerrainLogic::xfer( xfer ); -} // end xfer +} // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -399,4 +399,4 @@ void W3DTerrainLogic::loadPostProcess( void ) // extend base class TerrainLogic::loadPostProcess(); -} // end loadPostProcess +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp index 109bdb302fb..02597c45675 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp @@ -65,7 +65,7 @@ void Win32GameEngine::init( void ) // extending functionality GameEngine::init(); -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset the system */ @@ -76,7 +76,7 @@ void Win32GameEngine::reset( void ) // extending functionality GameEngine::reset(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update the game engine by updating the GameClient and @@ -122,7 +122,7 @@ void Win32GameEngine::update( void ) // allow windows to perform regular windows maintenance stuff like msgs serviceWindowsOS(); -} // end update +} //------------------------------------------------------------------------------------------------- /** This function may be called from within this application to let @@ -163,7 +163,7 @@ void Win32GameEngine::serviceWindowsOS( void ) DispatchMessage( &msg ); TheMessageTime = 0; - } // end while + } -} // end ServiceWindowsOS +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp index de06fa3d777..027a95f479d 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp @@ -107,7 +107,7 @@ static void printReturnCode( char *label, HRESULT hr ) } -} // end printReturnCode +} //------------------------------------------------------------------------------------------------- /** create our interface to the direct input keybard */ @@ -130,7 +130,7 @@ void DirectInputKeyboard::openKeyboard( void ) closeKeyboard(); return; - } // end if + } // obtain an interface to the system keyboard device hr = m_pDirectInput->CreateDevice( GUID_SysKeyboard, @@ -144,7 +144,7 @@ void DirectInputKeyboard::openKeyboard( void ) closeKeyboard(); return; - } // end if + } // set the data format for the keyboard hr = m_pKeyboardDevice->SetDataFormat( &c_dfDIKeyboard ); @@ -156,7 +156,7 @@ void DirectInputKeyboard::openKeyboard( void ) closeKeyboard(); return; - } // end if + } /// @todo Check the cooperative level of keyboard for NT, 2000, DX8 etc ... // set the cooperative level for the keyboard, must be non-exclusive for @@ -174,7 +174,7 @@ void DirectInputKeyboard::openKeyboard( void ) closeKeyboard(); return; - } // end if + } // set the keyboard buffer size DIPROPDWORD prop; @@ -192,7 +192,7 @@ void DirectInputKeyboard::openKeyboard( void ) closeKeyboard(); return; - } // end if + } // acquire the keyboard hr = m_pKeyboardDevice->Acquire(); @@ -205,11 +205,11 @@ void DirectInputKeyboard::openKeyboard( void ) // closeKeyboard(); return; - } // end if + } DEBUG_LOG(( "OK - Keyboard initialized successfully." )); -} // end openKeyboard +} //------------------------------------------------------------------------------------------------- /** close the direct input keyboard */ @@ -225,7 +225,7 @@ void DirectInputKeyboard::closeKeyboard( void ) m_pKeyboardDevice = NULL; DEBUG_LOG(( "OK - Keyboard deviced closed" )); - } // end if + } if( m_pDirectInput ) { @@ -233,11 +233,11 @@ void DirectInputKeyboard::closeKeyboard( void ) m_pDirectInput = NULL; DEBUG_LOG(( "OK - Keyboard direct input interface closed" )); - } // end if + } DEBUG_LOG(( "OK - Keyboard shutdown complete" )); -} // end closeKeyboard +} //------------------------------------------------------------------------------------------------- /** Get a single keyboard event from direct input */ @@ -296,9 +296,9 @@ void DirectInputKeyboard::getKey( KeyboardIO *key ) break; - } // end, got the keyboard back OK + } - } // end switch + } return; @@ -306,7 +306,7 @@ void DirectInputKeyboard::getKey( KeyboardIO *key ) default: return; - } // end switch( hr ) + } // no keys returned if( num == 0 ) @@ -328,9 +328,9 @@ void DirectInputKeyboard::getKey( KeyboardIO *key ) // set status as unused (unprocessed) key->status = KeyboardIO::STATUS_UNUSED; - } // end if, we have a DI keyboard device + } -} // end getKey +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -354,7 +354,7 @@ DirectInputKeyboard::DirectInputKeyboard( void ) m_modifiers &= ~KEY_STATE_CAPSLOCK; } -} // end DirectInputKeyboard +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -364,7 +364,7 @@ DirectInputKeyboard::~DirectInputKeyboard( void ) // close keyboard and release all resource closeKeyboard(); -} // end ~DirectInputKeyboard +} //------------------------------------------------------------------------------------------------- /** initialize the keyboard */ @@ -378,7 +378,7 @@ void DirectInputKeyboard::init( void ) // open the direct input keyboard openKeyboard(); -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset keyboard system */ @@ -389,7 +389,7 @@ void DirectInputKeyboard::reset( void ) // extend functionality Keyboard::reset(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** called once per frame to update the keyboard state */ @@ -409,10 +409,10 @@ void DirectInputKeyboard::update( void ) m_pKeyboardDevice->GetDeviceData( sizeof( DIDEVICEOBJECTDATA ), NULL, &items, 0 ); - } // end if + } */ -} // end update +} //------------------------------------------------------------------------------------------------- /** Return TRUE if the caps lock key is down/hilighted */ @@ -422,4 +422,4 @@ Bool DirectInputKeyboard::getCapsState( void ) return BitIsSet( GetKeyState( VK_CAPITAL ), 0X01); -} // end getCapsState +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp index d6414f4e3d1..e5b195fe6c1 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp @@ -59,7 +59,7 @@ void DirectInputMouse::openMouse( void ) closeMouse(); return; - } // end if + } // create a device for the system mouse hr = m_pDirectInput->CreateDevice( GUID_SysMouse, @@ -73,7 +73,7 @@ void DirectInputMouse::openMouse( void ) closeMouse(); return; - } // end if + } // set the data format for the mouse hr = m_pMouseDevice->SetDataFormat( &c_dfDIMouse ); @@ -85,7 +85,7 @@ void DirectInputMouse::openMouse( void ) closeMouse(); return; - } // end if + } // set the mouse cooperative level hr = m_pMouseDevice->SetCooperativeLevel( ApplicationHWnd, @@ -99,7 +99,7 @@ void DirectInputMouse::openMouse( void ) closeMouse(); return; - } // end if + } // set the mouse buffer size DIPROPDWORD prop; @@ -117,7 +117,7 @@ void DirectInputMouse::openMouse( void ) closeMouse(); return; - } // end if + } // acquire the mouse hr = m_pMouseDevice->Acquire(); @@ -129,7 +129,7 @@ void DirectInputMouse::openMouse( void ) closeMouse(); return; - } // end if + } // get some information about the mouse DIDEVCAPS diDevCaps; @@ -141,7 +141,7 @@ void DirectInputMouse::openMouse( void ) DEBUG_LOG(( "WARNING - openMouse: Cann't get capabilities of mouse for button setup" )); - } // end if + } else { @@ -153,11 +153,11 @@ void DirectInputMouse::openMouse( void ) DEBUG_LOG(( "OK - Mouse info: Buttons = '%d', Force Feedback = '%s', Axes = '%d'", m_numButtons, m_forceFeedback ? "Yes" : "No", m_numAxes )); - } // end else + } DEBUG_LOG(( "OK - Mouse initialized successfully" )); -} // end openMouse +} //------------------------------------------------------------------------------------------------- /** Release any resources for our direct input mouse */ @@ -174,7 +174,7 @@ void DirectInputMouse::closeMouse( void ) m_pMouseDevice = NULL; DEBUG_LOG(( "OK - Mouse device closed" )); - } // end if + } // release our direct input interface for the mouse if( m_pDirectInput ) @@ -184,11 +184,11 @@ void DirectInputMouse::closeMouse( void ) m_pDirectInput = NULL; DEBUG_LOG(( "OK - Mouse direct input interface closed" )); - } // end if + } DEBUG_LOG(( "OK - Mouse shutdown complete" )); -} // end closeMouse +} //------------------------------------------------------------------------------------------------- /** Get a single mouse event from the device */ @@ -254,7 +254,7 @@ UnsignedByte DirectInputMouse::getMouseEvent( MouseIO *result, Bool flush ) default: break; - } // end switch + } break; } @@ -264,13 +264,13 @@ UnsignedByte DirectInputMouse::getMouseEvent( MouseIO *result, Bool flush ) // DBGPRINTF(("GetMouseEvent: GetDeviceData Error: %X.\r\n", hr )); break; - } // end switch + } - } // end if + } return mouseResult; -} // end getMouseEvent +} //------------------------------------------------------------------------------------------------- /** Map the direct input codes to our own mouse format */ @@ -312,7 +312,7 @@ void DirectInputMouse::mapDirectInputMouse( MouseIO *mouse, break; } -} // end mapDirectInputMouse +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -326,7 +326,7 @@ DirectInputMouse::DirectInputMouse( void ) m_pDirectInput = NULL; m_pMouseDevice = NULL; -} // end DirectInputMouse +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -337,7 +337,7 @@ DirectInputMouse::~DirectInputMouse( void ) closeMouse(); // ShowCursor( TRUE ); -} // end ~DirectInputMouse +} //------------------------------------------------------------------------------------------------- /** Initialize the direct input mouse device */ @@ -359,7 +359,7 @@ void DirectInputMouse::init( void ) SetCursorPos( p.x, p.y ); // ShowCursor( FALSE ); -} // end init +} //------------------------------------------------------------------------------------------------- /** Reset direct input mouse */ @@ -370,7 +370,7 @@ void DirectInputMouse::reset( void ) // extend Mouse::reset(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update the mouse position and button data, this is called once per @@ -396,7 +396,7 @@ void DirectInputMouse::update( void ) ScreenToClient( ApplicationHWnd, &p ); moveMouse( p.x, p.y, MOUSE_MOVE_ABSOLUTE ); -} // end update +} //------------------------------------------------------------------------------------------------- /** Set the limits which the mouse is allowed to move around in. We @@ -428,9 +428,9 @@ void DirectInputMouse::setMouseLimits( void ) // keep the cursor clipped to these coords when running windowed ClipCursor( &windowRect ); - } // end if + } -} // end setMouseLimits +} //------------------------------------------------------------------------------------------------- /** set the cursor position for windows OS */ @@ -450,7 +450,7 @@ void DirectInputMouse::setPosition( Int x, Int y ) // set the window mouse SetCursorPos( p.x, p.y ); -} // end setPosition +} //------------------------------------------------------------------------------------------------- /** Super basic simplistic cursor */ @@ -485,12 +485,12 @@ void DirectInputMouse::setCursor( MouseCursor cursor ) SetCursor( LoadCursor( NULL, IDC_CROSS ) ); break; - } // end switch + } // save current cursor m_currentCursor = cursor; -} // end setCursor +} //------------------------------------------------------------------------------------------------- /** Capture the mouse to our application */ @@ -500,7 +500,7 @@ void DirectInputMouse::capture( void ) SetCapture( ApplicationHWnd ); -} // end capture +} //------------------------------------------------------------------------------------------------- /** Release the mouse capture for our app window */ @@ -510,4 +510,4 @@ void DirectInputMouse::releaseCapture( void ) ReleaseCapture(); -} // end releaseCapture +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp index 97f7840770e..9b89deba00d 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp @@ -75,7 +75,7 @@ UnsignedByte Win32Mouse::getMouseEvent( MouseIO *result, Bool flush ) // got event OK and all done with this one return MOUSE_OK; -} // end getMouseEvent +} //------------------------------------------------------------------------------------------------- /** Translate a win32 mouse event to our own event info */ @@ -118,7 +118,7 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) result->pos.y = HIWORD( lParam ); break; - } // end left button down + } // ------------------------------------------------------------------------ case WM_LBUTTONUP: @@ -130,7 +130,7 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) result->pos.y = HIWORD( lParam ); break; - } // end left button up + } // ------------------------------------------------------------------------ case WM_LBUTTONDBLCLK: @@ -142,7 +142,7 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) result->pos.y = HIWORD( lParam ); break; - } // end left button double click + } // ------------------------------------------------------------------------ case WM_MBUTTONDOWN: @@ -154,7 +154,7 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) result->pos.y = HIWORD( lParam ); break; - } // end middle button down + } // ------------------------------------------------------------------------ case WM_MBUTTONUP: @@ -166,7 +166,7 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) result->pos.y = HIWORD( lParam ); break; - } // end middle button up + } // ------------------------------------------------------------------------ case WM_MBUTTONDBLCLK: @@ -178,7 +178,7 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) result->pos.y = HIWORD( lParam ); break; - } // end middle button double click + } // ------------------------------------------------------------------------ case WM_RBUTTONDOWN: @@ -190,7 +190,7 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) result->pos.y = HIWORD( lParam ); break; - } // end right button down + } // ------------------------------------------------------------------------ case WM_RBUTTONUP: @@ -202,7 +202,7 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) result->pos.y = HIWORD( lParam ); break; - } // end right button up + } // ------------------------------------------------------------------------ case WM_RBUTTONDBLCLK: @@ -214,7 +214,7 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) result->pos.y = HIWORD( lParam ); break; - } // end right button double click + } // ------------------------------------------------------------------------ case WM_MOUSEMOVE: @@ -224,7 +224,7 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) result->pos.y = HIWORD( lParam ); break; - } // end mouse move + } // ------------------------------------------------------------------------ case 0x020A: // WM_MOUSEWHEEL @@ -242,7 +242,7 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) result->pos.y = p.y; break; - } // end mouse wheel + } // ------------------------------------------------------------------------ default: @@ -252,11 +252,11 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) msg, wParam, lParam )); return; - } // end default + } - } // end switch on message at event index in buffer + } -} // end translateEvent +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -278,7 +278,7 @@ Win32Mouse::Win32Mouse( void ) cursorResources[i][j]=NULL; m_directionFrame=0; //points up. m_lostFocus = FALSE; -} // end Win32Mouse +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -288,7 +288,7 @@ Win32Mouse::~Win32Mouse( void ) // remove our global reference that was for the WndProc() only TheWin32Mouse = NULL; -} // end ~Win32Mouse +} //------------------------------------------------------------------------------------------------- /** Initialize our device */ @@ -306,7 +306,7 @@ void Win32Mouse::init( void ) // m_inputMovesAbsolute = TRUE; -} // end int +} //------------------------------------------------------------------------------------------------- /** Reset */ @@ -317,7 +317,7 @@ void Win32Mouse::reset( void ) // extend Mouse::reset(); -} // end reset +} //------------------------------------------------------------------------------------------------- /** Update, called once per frame */ @@ -328,7 +328,7 @@ void Win32Mouse::update( void ) // extend Mouse::update(); -} // end update +} //------------------------------------------------------------------------------------------------- /** Add a window message event along with its WPARAM and LPARAM parameters @@ -356,7 +356,7 @@ void Win32Mouse::addWin32Event( UINT msg, WPARAM wParam, LPARAM lParam, DWORD ti if( m_nextFreeIndex >= Mouse::NUM_MOUSE_EVENTS ) m_nextFreeIndex = 0; -} // end addWin32Event +} extern HINSTANCE ApplicationHInstance; @@ -440,12 +440,12 @@ void Win32Mouse::setCursor( MouseCursor cursor ) else { SetCursor(cursorResources[cursor][m_directionFrame]); - } // end switch + } // save current cursor m_currentWin32Cursor=m_currentCursor = cursor; -} // end setCursor +} //------------------------------------------------------------------------------------------------- /** Capture the mouse to our application */ @@ -477,7 +477,7 @@ void Win32Mouse::capture( void ) onCursorCaptured(true); } -} // end capture +} //------------------------------------------------------------------------------------------------- /** Release the mouse capture for our app window */ @@ -490,4 +490,4 @@ void Win32Mouse::releaseCapture( void ) onCursorCaptured(false); } -} // end releaseCapture +} diff --git a/GeneralsMD/Code/Libraries/Include/Lib/BaseType.h b/GeneralsMD/Code/Libraries/Include/Lib/BaseType.h index 7d8ec0176f1..7d6ac66d7e9 100644 --- a/GeneralsMD/Code/Libraries/Include/Lib/BaseType.h +++ b/GeneralsMD/Code/Libraries/Include/Lib/BaseType.h @@ -216,7 +216,7 @@ inline Real Coord2D::toAngle( void ) const c = 1.0f; return y < 0.0f ? -ACos(c) : ACos(c); -} // end toAngle +} struct ICoord2D { diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp index 83054de0859..ae773e36076 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp @@ -587,13 +587,13 @@ void DX8FVFCategoryContainer::Change_Polygon_Renderer_Texture( prl.Add(rem); } poly_it.Next(); - } // while - } //if src_texture==texture + } + } else // quit loop if we've got a texture change if (foundtexture) break; src_it.Next(); - } // while + } PolyRemoverListIterator prli(&prl); @@ -678,12 +678,12 @@ void DX8FVFCategoryContainer::Change_Polygon_Renderer_Material( prl.Add(rem); } poly_it.Next(); - } // while - } // if + } + } else if (foundtexture) break; src_it.Next(); - } // while + } PolyRemoverListIterator prli(&prl); @@ -1405,8 +1405,8 @@ void DX8SkinFVFCategoryContainer::Render(void) renderedVertexCount += mesh_vertex_count; mesh = mesh->Peek_Next_Visible_Skin(); - } //while - }//lock + } + } SNAPSHOT_SAY(("Set vb: %x ib: %x",&vb.FVF_Info(),index_buffer)); @@ -1425,7 +1425,7 @@ void DX8SkinFVFCategoryContainer::Render(void) } Render_Procedural_Material_Passes(); - }//while + } //remove all the rendered data from queues for (unsigned pass=0;pass end[-1]) { - // end[-1] has the largest element std::swap(begin[0], end[-1]); } if (begin[1] > begin[0]) { - // begin[0] has the middle element and begin[1] has the smallest element std::swap(begin[1], begin[0]); } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp index fd88ad00cc1..14aa8203cd6 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp @@ -1175,7 +1175,7 @@ void WW3D::Add_Frame_Time(float milliseconds) return; } #endif - + FractionalSyncMs -= integralSyncMs; Sync(SyncTime + integralSyncMs); } diff --git a/GeneralsMD/Code/Main/WinMain.cpp b/GeneralsMD/Code/Main/WinMain.cpp index 320e1e071dc..2fd5e3f8048 100644 --- a/GeneralsMD/Code/Main/WinMain.cpp +++ b/GeneralsMD/Code/Main/WinMain.cpp @@ -407,7 +407,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, break; - } // end set focus + } //------------------------------------------------------------------------- case WM_MOVE: @@ -489,7 +489,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, } break; - } // end case activate + } //------------------------------------------------------------------------- case WM_KEYDOWN: @@ -506,14 +506,14 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, PostQuitMessage( 0 ); break; - } // end VK_ESCAPE + } - } // end switch + } return 0; - } // end WM_KEYDOWN + } //------------------------------------------------------------------------- case WM_LBUTTONDOWN: @@ -534,7 +534,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, return 0; - } // end WM_LBUTTONDOWN + } //------------------------------------------------------------------------- case 0x020A: // WM_MOUSEWHEEL @@ -553,7 +553,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, return 0; - } // end WM_MOUSEWHEEL + } //------------------------------------------------------------------------- @@ -574,7 +574,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, return 0; - } // end WM_MOUSEMOVE + } //------------------------------------------------------------------------- case WM_SETCURSOR: @@ -646,7 +646,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, break; } #endif - } // end switch + } } catch (...) @@ -672,7 +672,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, return DefWindowProc( hWnd, message, wParam, lParam ); -} // end WndProc +} // initializeAppWindows ======================================================= /** Register windows class and create application windows. */ @@ -752,7 +752,7 @@ static Bool initializeAppWindows( HINSTANCE hInstance, Int nCmdShow, Bool runWin return true; // success -} // end initializeAppWindow +} // Necessary to allow memory managers and such to have useful critical sections static CriticalSection critSec1, critSec2, critSec3, critSec4, critSec5; @@ -928,7 +928,7 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, return exitcode; -} // end WinMain +} // CreateGameEngine =========================================================== /** Create the Win32 game engine we're going to use */ @@ -944,4 +944,4 @@ GameEngine *CreateGameEngine( void ) return engine; -} // end CreateGameEngine +} diff --git a/GeneralsMD/Code/Tools/GUIEdit/Include/EditWindow.h b/GeneralsMD/Code/Tools/GUIEdit/Include/EditWindow.h index 204fc62eb10..9d00b582fa9 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Include/EditWindow.h +++ b/GeneralsMD/Code/Tools/GUIEdit/Include/EditWindow.h @@ -186,7 +186,7 @@ class EditWindow IRegion2D m_clipRegion; ///< the clipping region for images Bool m_isClippedEnabled; ///setUnsaved( TRUE ); -} // end SaveCallbacks +} // setCurrentWindow =========================================================== /** Set the window passed in as the active window for editing */ @@ -196,10 +196,10 @@ static void setCurrentWindow( GameWindow *window, HWND dialog ) else name = noNameWindowString; - } // end if + } SetWindowText( GetDlgItem( dialog, STATIC_WINDOW ), name.str() ); -} // end setCurrentWindow +} // loadUserWindows ============================================================ /** Given the window list passed in, load the list box passed with the @@ -235,12 +235,12 @@ static void loadUserWindows( HWND listbox, GameWindow *root ) // check the children loadUserWindows( listbox, root->winGetChild() ); - } // end if + } // check the rest of the list loadUserWindows( listbox, root->winGetNext() ); -} // end loadUserWindows +} //------------------------------------------------------------------------------------------------- /** save the layout callbacks */ @@ -265,7 +265,7 @@ static void saveLayoutCallbacks( HWND dialog ) SendDlgItemMessage( dialog, COMBO_SHUTDOWN, CB_GETLBTEXT, sel, (LPARAM)buffer ); TheEditor->setLayoutShutdown( AsciiString(buffer) ); -} // end saveLayoutCallbacks +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -303,7 +303,7 @@ BOOL CALLBACK CallbackEditorDialogProc( HWND hWndDialog, UINT message, return TRUE; - } // end init dialog + } // ------------------------------------------------------------------------ case WM_COMMAND: @@ -347,13 +347,13 @@ BOOL CALLBACK CallbackEditorDialogProc( HWND hWndDialog, UINT message, break; - } // end case selection change + } - } // end switch + } break; - } // end window listbox + } // -------------------------------------------------------------------- case IDOK: @@ -371,20 +371,20 @@ BOOL CALLBACK CallbackEditorDialogProc( HWND hWndDialog, UINT message, break; - } // end ok + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end CallbackEditorDialogProc +} diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CheckBoxProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CheckBoxProperties.cpp index 6ddfc86446d..d1751313cb6 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CheckBoxProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CheckBoxProperties.cpp @@ -160,12 +160,12 @@ static LRESULT CALLBACK checkBoxPropertiesCallback( HWND hWndDialog, GadgetCheckBoxSetHiliteCheckedBoxColor( window, info->color ); GadgetCheckBoxSetHiliteCheckedBoxBorderColor( window, info->borderColor ); - } // end if + } DestroyWindow( hWndDialog ); break; - } // end OK + } // -------------------------------------------------------------------- case IDCANCEL: @@ -174,13 +174,13 @@ static LRESULT CALLBACK checkBoxPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -189,15 +189,15 @@ static LRESULT CALLBACK checkBoxPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end checkBoxPropertiesCallback +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -284,7 +284,7 @@ HWND InitCheckBoxPropertiesDialog( GameWindow *window ) return dialog; -} // end InitCheckBoxPropertiesDialog +} diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ColorDialog.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ColorDialog.cpp index ae2ba9bf923..c60c72551df 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ColorDialog.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ColorDialog.cpp @@ -119,7 +119,7 @@ HSVColorReal rgbToHSV( RGBColorReal rgbColor ) // calculate hue if (saturation == 0) { hue = 0; // hue is really undefined - } // end if + } else { // chromatic case, determine hue Real delta = max - min; @@ -134,7 +134,7 @@ HSVColorReal rgbToHSV( RGBColorReal rgbColor ) if (hue < 0) hue += 360; // make sure hue is non negative - } // end else, chromatic case, determine hue + } // set and return an HSVColor hsvColor.hue = hue; @@ -155,7 +155,7 @@ HSVColorReal rgbToHSV( RGBColorReal rgbColor ) return hsvColor; -} // end rgbToHSV +} // hsvToRGB =================================================================== // Converts the HSV colors passed in to RGB values @@ -181,13 +181,13 @@ RGBColorReal hsvToRGB( HSVColorReal hsvColor ) if( hue == 0.0f ) { // achromatic color ... there is no hue red = green = blue = value; - } // end if, achromatic color .. there is no hue + } else { DEBUG_LOG(( "HSVToRGB error, hue should be undefined" )); - } // end else + } - } // end if + } else { @@ -230,9 +230,9 @@ RGBColorReal hsvToRGB( HSVColorReal hsvColor ) green = p; blue = q; break; - } // end switch (i) + } - } // end else, chromatic case + } // store and return and RGB color rgbColor.red = red; @@ -242,7 +242,7 @@ RGBColorReal hsvToRGB( HSVColorReal hsvColor ) return rgbColor; -} // end hsvToRGB +} // FORWARD DECLARATIONS /////////////////////////////////////////////////////// BOOL CALLBACK SelectColorDlgProc( HWND hWnd, UINT uMsg, @@ -278,7 +278,7 @@ RGBColorInt *SelectColor( Int red, Int green, Int blue, Int alpha, else return NULL; -} // end SelectColor +} // SelectColorDlgProc ========================================================= /** Dialog procedure for color selector dialog */ @@ -345,7 +345,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, SetDlgItemInt (hWndDlg, LABEL_ALPHA, (Int) hsvColor.alpha, FALSE); - } // end if + } else { @@ -367,7 +367,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, SetDlgItemInt (hWndDlg, LABEL_ALPHA, selectedColor.alpha, FALSE); - } // end else + } // // move the window to the display position, but keep the whole @@ -377,7 +377,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, return TRUE; - } // end case WM_INITDIALOG + } // ------------------------------------------------------------------------ case WM_DRAWITEM: { @@ -411,7 +411,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, NULL, FALSE); rgbColor.blue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, NULL, FALSE); - } // end if + } else { hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, NULL, FALSE); @@ -427,7 +427,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, rgbColor.red *= 255; rgbColor.green *= 255; rgbColor.blue *= 255; - } // end else + } // create a new brush and select it into DC hBrushNew = CreateSolidBrush (RGB ((BYTE) rgbColor.red, @@ -448,7 +448,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, break; - } // end case BUTTON_PREVIEW + } // -------------------------------------------------------------------- // Draw the bar of either HUE or RED next to the scroll bar @@ -476,12 +476,12 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, rgbColor.red *= 255.0f; rgbColor.green *= 255.0f; rgbColor.blue *= 255.0f; - } // end if + } else { rgbColor.red = 0; rgbColor.green = 0; rgbColor.blue = 0; - } // end else + } // loop through each horizontal line available in the bar drawing // the correct color there @@ -500,16 +500,16 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, rgbColor.red *= 255; rgbColor.green *= 255; rgbColor.blue *= 255; - } // end if + } else { rgbColor.red += step; - } // end else + } - } // end for i + } break; - } // end case BUTTON_COLORBAR1 + } // -------------------------------------------------------------------- // Draw the bar of either SATURATION or GREEN next to the scroll bar @@ -538,12 +538,12 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, rgbColor.red *= 255; rgbColor.green *= 255; rgbColor.blue *= 255; - } // end if + } else { rgbColor.red = 0; rgbColor.green = 0; rgbColor.blue = 0; - } // end else + } // loop through each horizontal line available in the bar drawing // the correct color there @@ -562,16 +562,16 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, rgbColor.red *= 255; rgbColor.green *= 255; rgbColor.blue *= 255; - } // end if + } else { rgbColor.green += step; - } // end else + } - } // end for i + } break; - } // end case BUTTON_COLORBAR2 + } // -------------------------------------------------------------------- // Draw the bar of either VALUE or BLUE next to the scroll bar @@ -601,12 +601,12 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, rgbColor.red *= 255.0f; rgbColor.green *= 255.0f; rgbColor.blue *= 255.0f; - } // end if + } else { rgbColor.red = 0; rgbColor.green = 0; rgbColor.blue = 0; - } // end else + } // loop through each horizontal line available in the bar drawing // the correct color there @@ -625,22 +625,22 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, rgbColor.red *= 255; rgbColor.green *= 255; rgbColor.blue *= 255; - } // end if + } else { rgbColor.blue += step; - } // end else + } - } // end for i + } break; - } // end case BUTTON_COLORBAR3 + } - } // end switch + } return TRUE; - } // end case WM_DRAWITEM + } // ------------------------------------------------------------------------ // horizontal scrolling on the color bars @@ -676,34 +676,34 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, if (thumbPos > minPos) thumbPos--; break; - } // end case SB_LINELEFT + } case SB_PAGELEFT: { if (thumbPos - 45 >= minPos) thumbPos -= 45; else thumbPos = minPos; break; - } // end case SB_PAGELEFT + } case SB_LINERIGHT: { if (thumbPos < maxPos) thumbPos++; break; - } // end case SB_LINERIGHT + } case SB_PAGERIGHT: { if (thumbPos + 45 < maxPos) thumbPos += 45; else thumbPos = maxPos; break; - } // end case SB_PAGERIGHT + } case SB_THUMBTRACK: { thumbPos = nPos; break; - } // end case SB_THUBTRACK + } default: { return 0; - } // end default - } // end switch nScrollCode + } + } // set the new scrollbar position and the text with it SendMessage (hWndScroll, SBM_SETPOS, (WPARAM) thumbPos, (LPARAM) TRUE); @@ -730,7 +730,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, rgbColor.alpha = (Real) GetDlgItemInt( hWndDlg, LABEL_ALPHA, NULL, FALSE ); - } // end if + } else { hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, NULL, FALSE); @@ -749,7 +749,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, rgbColor.red *= 255; rgbColor.green *= 255; rgbColor.blue *= 255; - } // end else + } // store the color selectedColor.red = (Int) rgbColor.red; @@ -770,11 +770,11 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, UpdateWindow (hWndColorBar2); UpdateWindow (hWndColorBar3); - } // end if, color bar scroll message + } return 0; - } // end case WM_HSCROLL + } // ------------------------------------------------------------------------ case WM_COMMAND: { @@ -792,7 +792,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, EndDialog( hWndDlg, TRUE ); // color selected break; - } // end case IDOK + } // -------------------------------------------------------------------- case IDCANCEL: { @@ -800,7 +800,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, EndDialog( hWndDlg, FALSE ); // selection cancelled break; - } // end case IDCANCEL + } // -------------------------------------------------------------------- // Change from RGB mode to HSV mode and vice versa @@ -847,7 +847,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, SetWindowText (GetDlgItem (hWndDlg, BUTTON_RGB_HSV), "Switch to RGB"); - } // end if, switch to HSV + } else { // switch to RGB hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, NULL, FALSE); hsvColor.saturation = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, NULL, FALSE); @@ -885,20 +885,20 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, mode = MODE_RGB; - } // end else, switch to RGB + } // invalidate all the vertical color bars so they are redrawn InvalidateRect (hWndColorBar1, NULL, TRUE); InvalidateRect (hWndColorBar2, NULL, TRUE); InvalidateRect (hWndColorBar3, NULL, TRUE); - } // end case BUTTON_RGB_HSV + } - } // end switch (LOWORD (wParam)) + } return 0; - } // end case WM_COMMAND + } // ------------------------------------------------------------------------ // Only hide the window on a close rather than destroy it since it will @@ -911,6 +911,6 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, default: return 0; // for all messages that are not processed - } // end of switch (uMsg) + } -} // End of SelectColor +} diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ComboBoxProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ComboBoxProperties.cpp index 28681774ed9..e15c2950e2a 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ComboBoxProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ComboBoxProperties.cpp @@ -164,7 +164,7 @@ static LRESULT CALLBACK comboBoxPropertiesCallback( HWND hWndDialog, break; - } // end case subcontrol color + } // -------------------------------------------------------------------- case IDOK: @@ -405,7 +405,7 @@ static LRESULT CALLBACK comboBoxPropertiesCallback( HWND hWndDialog, GadgetButtonSetHiliteSelectedColor( upButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( upButton, info->borderColor ); - } // end if + } // down button GameWindow *downButton = GadgetListBoxGetDownButton( listBox ); @@ -445,7 +445,7 @@ static LRESULT CALLBACK comboBoxPropertiesCallback( HWND hWndDialog, GadgetButtonSetHiliteSelectedColor( downButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( downButton, info->borderColor ); - } // end if + } // slider GameWindow *slider = GadgetListBoxGetSlider( listBox ); @@ -532,8 +532,8 @@ static LRESULT CALLBACK comboBoxPropertiesCallback( HWND hWndDialog, GadgetSliderSetHiliteSelectedThumbColor( slider, info->color ); GadgetSliderSetHiliteSelectedThumbBorderColor( slider, info->borderColor ); - } // end if - } // end if (listBox) + } + } // save specific list data ComboBoxData *comboData = (ComboBoxData *)window->winGetUserData(); @@ -551,12 +551,12 @@ static LRESULT CALLBACK comboBoxPropertiesCallback( HWND hWndDialog, GadgetComboBoxSetMaxDisplay( window, newMaxDisplay ); - } // end if + } DestroyWindow( hWndDialog ); break; - } // end OK + } // -------------------------------------------------------------------- case IDCANCEL: @@ -565,13 +565,13 @@ static LRESULT CALLBACK comboBoxPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -580,15 +580,15 @@ static LRESULT CALLBACK comboBoxPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end comboBoxPropertiesCallback +} /////////////////////////////////////////////////////////////////////////////// @@ -758,7 +758,7 @@ HWND InitComboBoxPropertiesDialog( GameWindow *window ) borderColor = GadgetButtonGetHiliteSelectedBorderColor( upButton ); StoreImageAndColor( COMBOBOX_LISTBOX_UP_BUTTON_HILITE_PUSHED, image, color, borderColor ); - } // end if + } // -------------------------------------------------------------------------- GameWindow *downButton = GadgetListBoxGetDownButton( listBox ); @@ -798,7 +798,7 @@ HWND InitComboBoxPropertiesDialog( GameWindow *window ) borderColor = GadgetButtonGetHiliteSelectedBorderColor( downButton ); StoreImageAndColor( COMBOBOX_LISTBOX_DOWN_BUTTON_HILITE_PUSHED, image, color, borderColor ); - } // end if + } GameWindow *slider = GadgetListBoxGetSlider( listBox ); if( slider ) @@ -882,7 +882,7 @@ HWND InitComboBoxPropertiesDialog( GameWindow *window ) borderColor = GadgetSliderGetHiliteSelectedThumbBorderColor( slider ); StoreImageAndColor( COMBOBOX_LISTBOX_SLIDER_THUMB_HILITE_PUSHED, image, color, borderColor ); - } // end if + } GameWindow *dropDownButton = GadgetComboBoxGetDropDownButton( window ); if ( dropDownButton ) @@ -977,7 +977,7 @@ HWND InitComboBoxPropertiesDialog( GameWindow *window ) return dialog; -} // end InitComboBoxPropertiesDialog +} diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GenericProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GenericProperties.cpp index dc8604bf045..fdd1812bccb 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GenericProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GenericProperties.cpp @@ -136,11 +136,11 @@ static LRESULT CALLBACK genericPropertiesCallback( HWND hWndDialog, // we have taken care of it return TRUE; - } // end if + } return FALSE; - } // end draw item + } // ------------------------------------------------------------------------ case WM_COMMAND: @@ -182,13 +182,13 @@ static LRESULT CALLBACK genericPropertiesCallback( HWND hWndDialog, SetControlColor( controlID, newGameColor ); InvalidateRect( hWndControl, NULL, TRUE ); - } // end if + } - } // end if + } break; - } // end color buttons + } // -------------------------------------------------------------------- case IDOK: @@ -239,12 +239,12 @@ static LRESULT CALLBACK genericPropertiesCallback( HWND hWndDialog, color = GameMakeColor( rgbColor->red, rgbColor->green, rgbColor->blue, rgbColor->alpha ); window->winSetHiliteBorderColor( 0, color ); - } // end if + } DestroyWindow( hWndDialog ); break; - } // end OK + } // -------------------------------------------------------------------- case IDCANCEL: @@ -253,13 +253,13 @@ static LRESULT CALLBACK genericPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -268,15 +268,15 @@ static LRESULT CALLBACK genericPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end genericPropertiesCallback +} // InitCallbackCombos ========================================================= /** load the callbacks combo boxes with the functions that the user cal @@ -300,7 +300,7 @@ void InitCallbackCombos( HWND dialog, GameWindow *window ) { SendMessage( combo, CB_ADDSTRING, 0, (LPARAM)entry->name ); entry++; - } // end while + } SendMessage( combo, CB_INSERTSTRING, 0, (LPARAM)GUIEDIT_NONE_STRING ); // select the current function of the window in the combo if present @@ -318,7 +318,7 @@ void InitCallbackCombos( HWND dialog, GameWindow *window ) { SendMessage( combo, CB_ADDSTRING, 0, (LPARAM)entry->name ); entry++; - } // end while + } SendMessage( combo, CB_INSERTSTRING, 0, (LPARAM)GUIEDIT_NONE_STRING ); // select the current function of the window in the combo if present @@ -336,7 +336,7 @@ void InitCallbackCombos( HWND dialog, GameWindow *window ) { SendMessage( combo, CB_ADDSTRING, 0, (LPARAM)entry->name ); entry++; - } // end while + } SendMessage( combo, CB_INSERTSTRING, 0, (LPARAM)GUIEDIT_NONE_STRING ); // select the current function of the window in the combo if present @@ -354,13 +354,13 @@ void InitCallbackCombos( HWND dialog, GameWindow *window ) { SendMessage( combo, CB_ADDSTRING, 0, (LPARAM)entry->name ); entry++; - } // end while + } entry = TheFunctionLexicon->getTable( FunctionLexicon::TABLE_GAME_WIN_DEVICEDRAW ); while( entry && entry ->key != NAMEKEY_INVALID ) { SendMessage( combo, CB_ADDSTRING, 0, (LPARAM)entry->name ); entry++; - } // end while + } SendMessage( combo, CB_INSERTSTRING, 0, (LPARAM)GUIEDIT_NONE_STRING ); // select the current function of the window in the combo if present @@ -417,7 +417,7 @@ void InitCallbackCombos( HWND dialog, GameWindow *window ) name = TheEditor->getLayoutShutdown(); SendMessage( combo, CB_SELECTSTRING, -1, (LPARAM)name.str() ); -} // end InitCallbackCombos +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -479,7 +479,7 @@ HWND InitUserWinPropertiesDialog( GameWindow *window ) return dialog; -} // end InitUserWinPropertiesDialog +} diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GridSettings.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GridSettings.cpp index 2d079590d1a..e6bb26af6ce 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GridSettings.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GridSettings.cpp @@ -96,7 +96,7 @@ static void initGridSettings( HWND hWndDialog ) RGBColorInt *color = TheEditor->getGridColor(); gridColor = *color; -} // end initGridSettings +} // GridSettingsDialogProc ===================================================== /** Dialog procedure for grid settings dialog */ @@ -116,7 +116,7 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, initGridSettings( hWndDialog ); return TRUE; - } // end init dialog + } // ------------------------------------------------------------------------ case WM_DRAWITEM: @@ -158,11 +158,11 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, // we have taken care of it return TRUE; - } // end if + } return FALSE; - } // end draw item + } // ------------------------------------------------------------------------ case WM_COMMAND: @@ -196,13 +196,13 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, gridColor = *newColor; InvalidateRect( hWndControl, NULL, TRUE ); - } // end if + } - } // end if + } break; - } // end color buttons + } // -------------------------------------------------------------------- case IDOK: @@ -229,7 +229,7 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, break; - } // end ok + } // -------------------------------------------------------------------- case IDCANCEL: @@ -238,13 +238,13 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, EndDialog( hWndDialog, FALSE ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -253,13 +253,13 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, EndDialog( hWndDialog, FALSE ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end GridSettingsDialogProc +} diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp index d385426023f..882aa666182 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp @@ -135,7 +135,7 @@ static void addScrollbar( GameWindow *listbox ) info = TheDefaultScheme->getImageAndColor( LISTBOX_UP_BUTTON_HILITE_PUSHED ); GadgetButtonSetHiliteSelectedImage( upButton, info->image ); - } // end if + } GameWindow *downButton = GadgetListBoxGetDownButton( listbox ); if( downButton ) @@ -156,7 +156,7 @@ static void addScrollbar( GameWindow *listbox ) info = TheDefaultScheme->getImageAndColor( LISTBOX_DOWN_BUTTON_HILITE_PUSHED ); GadgetButtonSetHiliteSelectedImage( downButton, info->image ); - } // end if + } GameWindow *slider = GadgetListBoxGetSlider( listbox ); if( slider ) @@ -211,9 +211,9 @@ static void addScrollbar( GameWindow *listbox ) info = TheDefaultScheme->getImageAndColor( LISTBOX_SLIDER_THUMB_HILITE_PUSHED ); GadgetSliderSetHiliteSelectedThumbImage( slider, info->image ); - } // end if, slider + } -} // end addScrollbar +} // removeScrollbar ============================================================ /** Remove all scrollbar constructs froma listbox that has it already */ @@ -237,7 +237,7 @@ static void removeScrollbar( GameWindow *listbox ) // remove the scrollbar flag from the listbox data listData->scrollBar = FALSE; -} // end removeScrollbar +} // resizeMaxItems ============================================================= /** Change the max items that a listbox can accomodate */ @@ -248,7 +248,7 @@ static void resizeMaxItems( GameWindow *listbox, UnsignedInt newMaxItems ) -} // end resizeMaxItems +} // listboxPropertiesCallback ================================================== /** Dialog callback for properties */ @@ -326,7 +326,7 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, break; - } // end case subcontrol color + } // -------------------------------------------------------------------- case IDOK: @@ -432,7 +432,7 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, GadgetButtonSetHiliteSelectedColor( upButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( upButton, info->borderColor ); - } // end if + } // down button GameWindow *downButton = GadgetListBoxGetDownButton( window ); @@ -472,7 +472,7 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, GadgetButtonSetHiliteSelectedColor( downButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( downButton, info->borderColor ); - } // end if + } // slider GameWindow *slider = GadgetListBoxGetSlider( window ); @@ -559,7 +559,7 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, GadgetSliderSetHiliteSelectedThumbColor( slider, info->color ); GadgetSliderSetHiliteSelectedThumbBorderColor( slider, info->borderColor ); - } // end if + } // save specific list data ListboxData *listData = (ListboxData *)window->winGetUserData(); @@ -647,12 +647,12 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, } listData->columns = newColumns; - } // end if + } DestroyWindow( hWndDialog ); break; - } // end OK + } // -------------------------------------------------------------------- case IDCANCEL: @@ -661,13 +661,13 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -676,15 +676,15 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end listboxPropertiesCallback +} /////////////////////////////////////////////////////////////////////////////// @@ -804,7 +804,7 @@ HWND InitListboxPropertiesDialog( GameWindow *window ) borderColor = GadgetButtonGetHiliteSelectedBorderColor( upButton ); StoreImageAndColor( LISTBOX_UP_BUTTON_HILITE_PUSHED, image, color, borderColor ); - } // end if + } // -------------------------------------------------------------------------- GameWindow *downButton = GadgetListBoxGetDownButton( window ); @@ -844,7 +844,7 @@ HWND InitListboxPropertiesDialog( GameWindow *window ) borderColor = GadgetButtonGetHiliteSelectedBorderColor( downButton ); StoreImageAndColor( LISTBOX_DOWN_BUTTON_HILITE_PUSHED, image, color, borderColor ); - } // end if + } GameWindow *slider = GadgetListBoxGetSlider( window ); if( slider ) @@ -928,7 +928,7 @@ HWND InitListboxPropertiesDialog( GameWindow *window ) borderColor = GadgetSliderGetHiliteSelectedThumbBorderColor( slider ); StoreImageAndColor( LISTBOX_SLIDER_THUMB_HILITE_PUSHED, image, color, borderColor ); - } // end if + } // init listbox specific property section ListboxData *listData = (ListboxData *)window->winGetUserData(); @@ -968,7 +968,7 @@ HWND InitListboxPropertiesDialog( GameWindow *window ) return dialog; -} // end InitListboxPropertiesDialog +} diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/NewLayoutDialog.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/NewLayoutDialog.cpp index d9bc0f7035f..d325a3aa938 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/NewLayoutDialog.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/NewLayoutDialog.cpp @@ -77,7 +77,7 @@ static void initNewLayoutDialog( HWND hWndDialog ) // set default keyboard focus SetFocus( GetDlgItem( hWndDialog, IDOK ) ); -} // end initNewLayoutDialog +} // NewLayoutDialogProc ======================================================== /** Dialog procedure for the new layout dialog when starting an entire @@ -98,7 +98,7 @@ LRESULT CALLBACK NewLayoutDialogProc( HWND hWndDialog, UINT message, initNewLayoutDialog( hWndDialog ); return FALSE; - } // end init dialog + } // ------------------------------------------------------------------------ case WM_COMMAND: @@ -119,7 +119,7 @@ LRESULT CALLBACK NewLayoutDialogProc( HWND hWndDialog, UINT message, break; - } // end ok + } // -------------------------------------------------------------------- case IDCANCEL: @@ -128,13 +128,13 @@ LRESULT CALLBACK NewLayoutDialogProc( HWND hWndDialog, UINT message, EndDialog( hWndDialog, FALSE ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -143,13 +143,13 @@ LRESULT CALLBACK NewLayoutDialogProc( HWND hWndDialog, UINT message, EndDialog( hWndDialog, FALSE ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end NewLayoutDialogProc +} diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ProgressBarProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ProgressBarProperties.cpp index 004730dfa16..32c8ae17323 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ProgressBarProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ProgressBarProperties.cpp @@ -181,12 +181,12 @@ static LRESULT CALLBACK progressBarPropertiesCallback( HWND hWndDialog, info = GetStateInfo( PROGRESS_BAR_HILITE_BAR_SMALL_CENTER ); GadgetProgressBarSetHiliteBarImageSmallCenter( window, info->image ); - } // end if + } DestroyWindow( hWndDialog ); break; - } // end OK + } // -------------------------------------------------------------------- case IDCANCEL: @@ -195,13 +195,13 @@ static LRESULT CALLBACK progressBarPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -210,15 +210,15 @@ static LRESULT CALLBACK progressBarPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end progressBarPropertiesCallback +} /////////////////////////////////////////////////////////////////////////////// @@ -327,7 +327,7 @@ HWND InitProgressBarPropertiesDialog( GameWindow *window ) return dialog; -} // end InitProgressBarPropertiesDialog +} diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/PushButtonProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/PushButtonProperties.cpp index 2e56482ddaf..065b7822544 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/PushButtonProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/PushButtonProperties.cpp @@ -151,12 +151,12 @@ static LRESULT CALLBACK pushButtonPropertiesCallback( HWND hWndDialog, if( IsDlgButtonChecked( hWndDialog, CHECK_RIGHT_CLICK ) ) window->winSetStatus( bit ); - } // end if + } DestroyWindow( hWndDialog ); break; - } // end OK + } // -------------------------------------------------------------------- case IDCANCEL: @@ -165,13 +165,13 @@ static LRESULT CALLBACK pushButtonPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -180,15 +180,15 @@ static LRESULT CALLBACK pushButtonPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end pushButtonPropertiesCallback +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -260,7 +260,7 @@ HWND InitPushButtonPropertiesDialog( GameWindow *window ) return dialog; -} // end InitPushButtonPropertiesDialog +} diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp index 4e193f1cccc..1c55f06a580 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp @@ -111,7 +111,7 @@ static LRESULT CALLBACK radioButtonPropertiesCallback( HWND hWndDialog, SetDlgItemInt( hWndDialog, COMBO_GROUP, 0, FALSE ); break; - } // end clear group + } // -------------------------------------------------------------------- case IDOK: @@ -181,12 +181,12 @@ static LRESULT CALLBACK radioButtonPropertiesCallback( HWND hWndDialog, Int screen = TheNameKeyGenerator->nameToKey( AsciiString(TheEditor->getSaveFilename()) ); GadgetRadioSetGroup( window, group, screen ); - } // end if + } DestroyWindow( hWndDialog ); break; - } // end OK + } // -------------------------------------------------------------------- case IDCANCEL: @@ -195,13 +195,13 @@ static LRESULT CALLBACK radioButtonPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -210,15 +210,15 @@ static LRESULT CALLBACK radioButtonPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end radioButtonPropertiesCallback +} /////////////////////////////////////////////////////////////////////////////// @@ -252,7 +252,7 @@ static void loadExistingGroupsCombo( HWND combo, GameWindow *window ) if( SendMessage( combo, CB_FINDSTRINGEXACT, -1, (LPARAM)buffer ) == CB_ERR ) SendMessage( combo, CB_ADDSTRING, 0, (LPARAM)buffer ); - } // end if + } // search our children GameWindow *child; @@ -262,7 +262,7 @@ static void loadExistingGroupsCombo( HWND combo, GameWindow *window ) // search the next in line loadExistingGroupsCombo( combo, window->winGetNext() ); -} // end loadExistingGroupsCombo +} // InitRadioButtonPropertiesDialog ============================================ /** Bring up the radio button properties dialog */ @@ -355,7 +355,7 @@ HWND InitRadioButtonPropertiesDialog( GameWindow *window ) return dialog; -} // end InitRadioButtonPropertiesDialog +} diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp index f795bec1115..23ec57af6e8 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp @@ -127,7 +127,7 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, StoreColor( VSLIDER_THUMB_HILITE, info->color, info->borderColor ); StoreColor( VSLIDER_THUMB_HILITE_PUSHED, info->borderColor, info->color ); - } // end if, vertical slider + } else { @@ -143,11 +143,11 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, StoreColor( HSLIDER_THUMB_HILITE, info->color, info->borderColor ); StoreColor( HSLIDER_THUMB_HILITE_PUSHED, info->borderColor, info->color ); - } // end else horizontal slider + } break; - } // end case subcontrol color + } // -------------------------------------------------------------------- case IDOK: @@ -175,7 +175,7 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, info = GetStateInfo( VSLIDER_ENABLED_BOTTOM ); GadgetSliderSetEnabledImageBottom( window, info->image ); - } // end if + } else { info = GetStateInfo( HSLIDER_ENABLED_LEFT ); @@ -185,7 +185,7 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, info = GetStateInfo( HSLIDER_ENABLED_RIGHT ); GadgetSliderSetEnabledImageRight( window, info->image ); - } // end else + } info = GetStateInfo( vert ? VSLIDER_ENABLED_CENTER : HSLIDER_ENABLED_CENTER ); GadgetSliderSetEnabledImageCenter( window, info->image ); @@ -203,7 +203,7 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, info = GetStateInfo( VSLIDER_DISABLED_BOTTOM ); GadgetSliderSetDisabledImageBottom( window, info->image ); - } // end if + } else { info = GetStateInfo( HSLIDER_DISABLED_LEFT ); @@ -213,7 +213,7 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, info = GetStateInfo( HSLIDER_DISABLED_RIGHT ); GadgetSliderSetDisabledImageRight( window, info->image ); - } // end else + } info = GetStateInfo( vert ? VSLIDER_DISABLED_CENTER : HSLIDER_DISABLED_CENTER ); GadgetSliderSetDisabledImageCenter( window, info->image ); @@ -231,7 +231,7 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, info = GetStateInfo( VSLIDER_HILITE_BOTTOM ); GadgetSliderSetHiliteImageBottom( window, info->image ); - } // end if + } else { info = GetStateInfo( HSLIDER_HILITE_LEFT ); @@ -241,7 +241,7 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, info = GetStateInfo( HSLIDER_HILITE_RIGHT ); GadgetSliderSetHiliteImageRight( window, info->image ); - } // end else + } info = GetStateInfo( vert ? VSLIDER_HILITE_CENTER : HSLIDER_HILITE_CENTER ); GadgetSliderSetHiliteImageCenter( window, info->image ); @@ -298,14 +298,14 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, MessageBox( NULL, "Slider min greated than max, the values were swapped", "Warning", MB_OK | MB_ICONINFORMATION ); - } // end if + } - } // end if + } DestroyWindow( hWndDialog ); break; - } // end OK + } // -------------------------------------------------------------------- case IDCANCEL: @@ -314,13 +314,13 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -329,15 +329,15 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end sliderPropertiesCallback +} /////////////////////////////////////////////////////////////////////////////// @@ -478,7 +478,7 @@ HWND InitSliderPropertiesDialog( GameWindow *window ) return dialog; -} // end InitSliderPropertiesDialog +} diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/StaticTextProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/StaticTextProperties.cpp index 1e5d0b92aaf..2cf73abfe8e 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/StaticTextProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/StaticTextProperties.cpp @@ -112,7 +112,7 @@ static LRESULT CALLBACK staticTextPropertiesCallback( HWND hWndDialog, SetDlgItemText( hWndDialog, BUTTON_CENTERED, "No" ); break; - } // end centered + } // -------------------------------------------------------------------- case IDOK: @@ -151,12 +151,12 @@ static LRESULT CALLBACK staticTextPropertiesCallback( HWND hWndDialog, TextData *textData = (TextData *)window->winGetUserData(); textData->centered = currCentered; - } // end if + } DestroyWindow( hWndDialog ); break; - } // end OK + } // -------------------------------------------------------------------- case IDCANCEL: @@ -165,13 +165,13 @@ static LRESULT CALLBACK staticTextPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -180,15 +180,15 @@ static LRESULT CALLBACK staticTextPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end staticTextPropertiesCallback +} /////////////////////////////////////////////////////////////////////////////// @@ -251,7 +251,7 @@ HWND InitStaticTextPropertiesDialog( GameWindow *window ) return dialog; -} // end InitStaticTextPropertiesDialog +} diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TabControlProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TabControlProperties.cpp index 004a4fdcf75..cefcb7b591e 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TabControlProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TabControlProperties.cpp @@ -343,12 +343,12 @@ static LRESULT CALLBACK tabControlPropertiesCallback( HWND hWndDialog, GadgetTabControlShowSubPane( tabControl, tabData->activeTab ); GadgetTabControlUpdatePaneNames( tabControl ); - } // end if + } DestroyWindow( hWndDialog ); break; - } // end OK + } // -------------------------------------------------------------------- case IDCANCEL: @@ -357,13 +357,13 @@ static LRESULT CALLBACK tabControlPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -372,15 +372,15 @@ static LRESULT CALLBACK tabControlPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end tabControlPropertiesCallback +} /////////////////////////////////////////////////////////////////////////////// @@ -616,7 +616,7 @@ HWND InitTabControlPropertiesDialog( GameWindow *tabControl ) return dialog; -} // end InitTabControlPropertiesDialog +} diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TextEntryProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TextEntryProperties.cpp index e668d35428e..3d9ef8bd4dd 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TextEntryProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TextEntryProperties.cpp @@ -160,28 +160,28 @@ static LRESULT CALLBACK textEntryPropertiesCallback( HWND hWndDialog, entryData->alphaNumericalOnly = TRUE; entryData->numericalOnly = FALSE; - } // end if + } else if( IsDlgButtonChecked( hWndDialog, RADIO_NUMBERS ) ) { entryData->alphaNumericalOnly = FALSE; entryData->numericalOnly = TRUE; - } // end else if + } else { entryData->alphaNumericalOnly = FALSE; entryData->numericalOnly = FALSE; - } // end else + } - } // end if + } DestroyWindow( hWndDialog ); break; - } // end OK + } // -------------------------------------------------------------------- case IDCANCEL: @@ -190,13 +190,13 @@ static LRESULT CALLBACK textEntryPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); break; - } // end cancel + } - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -205,15 +205,15 @@ static LRESULT CALLBACK textEntryPropertiesCallback( HWND hWndDialog, DestroyWindow( hWndDialog ); return 0; - } // end close + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end textEntryPropertiesCallback +} /////////////////////////////////////////////////////////////////////////////// @@ -304,7 +304,7 @@ HWND InitTextEntryPropertiesDialog( GameWindow *window ) return dialog; -} // end InitTextEntryPropertiesDialog +} diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp index 01a22522bc6..b53ed8a602c 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp @@ -105,11 +105,11 @@ LRESULT CALLBACK EditWindow::editProc( HWND hWnd, UINT message, if( timerID == TIMER_EDIT_WINDOW_PULSE ) TheEditWindow->updatePulse(); - } // end if + } return 0; - } // end timer + } //------------------------------------------------------------------------- case WM_MOUSEMOVE: @@ -124,7 +124,7 @@ LRESULT CALLBACK EditWindow::editProc( HWND hWnd, UINT message, TheEditWindow->mouseEvent( message, wParam, lParam ); return 0; - } // end mouse events + } // ------------------------------------------------------------------------ case WM_COMMAND: @@ -281,17 +281,17 @@ LRESULT CALLBACK EditWindow::editProc( HWND hWnd, UINT message, InitPropertiesDialog( window, pos.x, pos.y ); break; - } // end switch + } break; - } // end new window + } - } // end switch on control id + } return 0; - } // end command + } // ------------------------------------------------------------------------ default: @@ -299,13 +299,13 @@ LRESULT CALLBACK EditWindow::editProc( HWND hWnd, UINT message, break; - } // end default + } - } // end switch( message ) + } return DefWindowProc( hWnd, message, wParam, lParam ); -} // end editProc +} // EditWindow::registerEditWindowClass ======================================== /** Register a class with the windows OS for an edit window */ @@ -336,7 +336,7 @@ void EditWindow::registerEditWindowClass( void ) if( atom != 0 ) m_classRegistered = TRUE; -} // end registerEditWindowClass +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -391,7 +391,7 @@ EditWindow::EditWindow( void ) m_clipRegion.hi.y = 0; m_isClippedEnabled = FALSE; -} // end EditWindow +} // EditWindow::~EditWindow ==================================================== /** */ @@ -402,7 +402,7 @@ EditWindow::~EditWindow( void ) // call the shutdown shutdown(); -} // end ~EditWindow +} // EditWindow::init =========================================================== /** Initialize the edit window */ @@ -472,7 +472,7 @@ void EditWindow::init( UnsignedInt clientWidth, UnsignedInt clientHeight ) shutdown(); return; - } // end if + } // create asset manager m_assetManager = new WW3DAssetManager; @@ -485,7 +485,7 @@ void EditWindow::init( UnsignedInt clientWidth, UnsignedInt clientHeight ) // set a timer for updating visual pulse drawing SetTimer( m_editWindowHWnd, TIMER_EDIT_WINDOW_PULSE, 5, NULL ); -} // end init +} // EditWindow::shutdown ======================================================= /** Shutdown edit window */ @@ -519,7 +519,7 @@ void EditWindow::shutdown( void ) UnregisterClass( m_className, TheEditor->getInstance() ); m_classRegistered = FALSE; -} // EditWindowShutdown +} // EditWindow::updatePulse ==================================================== /** Update pulse from timer message */ @@ -537,15 +537,15 @@ void EditWindow::updatePulse( void ) m_pulse += stepSize; if( m_pulse >= pulseMax ) dir = 0; - } // end if + } else { m_pulse -= stepSize; if( m_pulse <= pulseMin ) dir = 1; - } // end else + } -} // end updatePulse +} // EditWindow::mouseEvent ===================================================== /** A mouse event has occurred from our window procedure */ @@ -588,7 +588,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, if( GetFocus() != TheEditor->getWindowHandle() ) SetFocus( TheEditor->getWindowHandle() ); - } // end if + } // // if we're in test mode just pump all input through to the @@ -601,7 +601,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, return; - } // end if + } // // If we're in the keyboard move, ignore the mouse @@ -635,7 +635,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, // update destination for drag move m_dragMoveDest = mouse; - } // end if + } else if( m_dragSelecting ) { @@ -643,14 +643,14 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, m_selectRegion.hi.x = x; m_selectRegion.hi.y = y; - } // end else if + } else if( m_resizingWindow ) { // save the position of our mouse for resizing m_resizeDest = mouse; - } // end else if + } else { @@ -660,11 +660,11 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, // TheEditWindow->handleResizeAvailable( x, y ); - } // end else + } break; - } // end mouse move + } // ------------------------------------------------------------------------ case WM_LBUTTONDOWN: @@ -704,7 +704,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, m_resizeOrigin = mouse; m_resizeDest = mouse; - } // end if + } else { GameWindow *window = TheEditor->getWindowAtPos( x, y ); @@ -728,7 +728,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, // select this window TheEditor->selectWindow( window ); - } // end if + } else { @@ -754,12 +754,12 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, // change to drag move mode and switch cursor TheEditor->setMode( MODE_DRAG_MOVE ); - } // end if + } - } // end else + } - } // end if + } else { @@ -770,13 +770,13 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, m_selectRegion.hi.x = x; m_selectRegion.hi.y = y; - } // end else + } - } // end if + } break; - } // end left button down + } // ------------------------------------------------------------------------ case WM_LBUTTONUP: @@ -796,7 +796,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, // go back to normal mode TheEditor->setMode( MODE_EDIT ); - } // end if + } else if( m_dragSelecting ) { @@ -806,7 +806,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, // stop a drag selection if in progress m_dragSelecting = FALSE; - } // end else + } else if( m_resizingWindow ) { GameWindow *window = TheEditor->getFirstSelected(); @@ -838,11 +838,11 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, m_resizingWindow = FALSE; TheEditor->setMode( MODE_EDIT ); - } // end resizing window + } break; - } // end left button up + } // ------------------------------------------------------------------------ case WM_MBUTTONDOWN: @@ -850,7 +850,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, break; - } // end middle button down + } // ------------------------------------------------------------------------ case WM_MBUTTONUP: @@ -858,7 +858,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, break; - } // end middle button up + } // ------------------------------------------------------------------------ case WM_RBUTTONDOWN: @@ -886,21 +886,21 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, // select this window TheEditor->selectWindow( window ); - } // end if + } else { // no window here, clear selections anyway TheEditor->clearSelections(); - } // end else + } // open right click menu TheEditWindow->openPopupMenu( clickPos.x, clickPos.y ); break; - } // end right button down + } // ------------------------------------------------------------------------ case WM_RBUTTONUP: @@ -908,7 +908,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, break; - } // end right button up + } // ------------------------------------------------------------------------ default: @@ -916,11 +916,11 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, break; - } // end default + } - } // end switch on widnows message + } -} // end mouseEvent +} // EditWindow::inCornerTolerance ============================================== /** If the 'dest' point is within 'tolerance' distance to the 'source' @@ -952,7 +952,7 @@ Bool EditWindow::inCornerTolerance( ICoord2D *dest, ICoord2D *source, return FALSE; -} // end inCornerTolerance +} // EditWindow::inLineTolerance ================================================ /** If the 'dest' point is within the region defined around the @@ -983,7 +983,7 @@ Bool EditWindow::inLineTolerance( ICoord2D *dest, return FALSE; -} // end inLineTolerance +} // EditWindow::handleResizeAvailable ========================================== /** Given the mouse position, if it is close enough to a corner of a @@ -1018,7 +1018,7 @@ void EditWindow::handleResizeAvailable( Int mouseX, Int mouseY ) TheEditor->setMode( MODE_RESIZE_TOP_LEFT ); return; - } // end if + } // check for around bottom right corner point.x = origin.x + size.x; @@ -1029,7 +1029,7 @@ void EditWindow::handleResizeAvailable( Int mouseX, Int mouseY ) TheEditor->setMode( MODE_RESIZE_BOTTOM_RIGHT ); return; - } // end if + } // check for around top right corner point.x = origin.x + size.x; @@ -1040,7 +1040,7 @@ void EditWindow::handleResizeAvailable( Int mouseX, Int mouseY ) TheEditor->setMode( MODE_RESIZE_TOP_RIGHT ); return; - } // end if + } // check for around bottom left corner point.x = origin.x; @@ -1051,7 +1051,7 @@ void EditWindow::handleResizeAvailable( Int mouseX, Int mouseY ) TheEditor->setMode( MODE_RESIZE_BOTTOM_LEFT ); return; - } // end if + } ICoord2D lineStart, lineEnd; @@ -1065,7 +1065,7 @@ void EditWindow::handleResizeAvailable( Int mouseX, Int mouseY ) TheEditor->setMode( MODE_RESIZE_TOP ); return; - } // end if + } // check for along bottom edge lineStart.x = origin.x; @@ -1078,7 +1078,7 @@ void EditWindow::handleResizeAvailable( Int mouseX, Int mouseY ) TheEditor->setMode( MODE_RESIZE_BOTTOM ); return; - } // end if + } // check for along left edge lineStart = origin; @@ -1090,7 +1090,7 @@ void EditWindow::handleResizeAvailable( Int mouseX, Int mouseY ) TheEditor->setMode( MODE_RESIZE_LEFT ); return; - } // end if + } // check for along right edge lineStart.x = origin.x + size.x; @@ -1103,12 +1103,12 @@ void EditWindow::handleResizeAvailable( Int mouseX, Int mouseY ) TheEditor->setMode( MODE_RESIZE_RIGHT ); return; - } // end if + } // we are not resizing anything at all, set us to normal mode TheEditor->setMode( MODE_EDIT ); -} // end handleResizeAvailable +} // EditWindow::drawSeeThruOutlines ============================================ /** Draw an outline for a window that is see thru so we can still work @@ -1134,7 +1134,7 @@ void EditWindow::drawSeeThruOutlines( GameWindow *windowList, Color c ) // draw a box on the window drawOpenRect( pos.x, pos.y, size.x, size.y, 1, c ); - } // end if + } // check window children GameWindow *child; @@ -1144,7 +1144,7 @@ void EditWindow::drawSeeThruOutlines( GameWindow *windowList, Color c ) // go to siblings drawSeeThruOutlines( windowList->winGetNext(), c ); -} // end drawSeeThruOutlines +} // EditWindow::drawHiddenOutlines ============================================= /** Draw an outline for a window that is hidden so we can still work @@ -1170,7 +1170,7 @@ void EditWindow::drawHiddenOutlines( GameWindow *windowList, Color c ) hidden = TRUE; parent = parent->winGetParent(); - } // end while + } if( BitIsSet( windowList->winGetStatus(), WIN_STATUS_HIDDEN ) ) hidden = TRUE; if( hidden ) @@ -1185,7 +1185,7 @@ void EditWindow::drawHiddenOutlines( GameWindow *windowList, Color c ) // draw a box on the window drawOpenRect( pos.x, pos.y, size.x, size.y, 2, c ); - } // end if + } // check window children GameWindow *child; @@ -1195,7 +1195,7 @@ void EditWindow::drawHiddenOutlines( GameWindow *windowList, Color c ) // go to siblings drawHiddenOutlines( windowList->winGetNext(), c ); -} // end drawHiddenOutlines +} // EditWindow::drawUIback ===================================================== /** Draw any visual feedback to the user about selection boxes or windows @@ -1235,7 +1235,7 @@ void EditWindow::drawUIFeedback( void ) drawOpenRect( m_selectRegion.lo.x, m_selectRegion.lo.y, width, height, selectBoxWidth, selectBoxColor ); - } // end if + } // draw select lines on selected windows select = TheEditor->getSelectList(); @@ -1260,7 +1260,7 @@ void EditWindow::drawUIFeedback( void ) // go to next selection select = select->next; - } // end while + } // // if we're drag moving, draw outlines of all the windows in the @@ -1320,7 +1320,7 @@ void EditWindow::drawUIFeedback( void ) safeLoc.x += parentOrigin.x; safeLoc.y += parentOrigin.y; - } // end if + } // draw outline of window at what would be the drag move destination drawOpenRect( safeLoc.x, safeLoc.y, size.x, size.y, @@ -1330,9 +1330,9 @@ void EditWindow::drawUIFeedback( void ) // go to next selection select = select->next; - } // end while + } - } // end if + } // if resizing a window draw that resize representation if( m_resizingWindow ) @@ -1368,13 +1368,13 @@ void EditWindow::drawUIFeedback( void ) loc.x += parentOrigin.x; loc.y += parentOrigin.y; - } // end if + } // draw a box for the window at its new location outlineColor = GameMakeColor( m_pulse, m_pulse, m_pulse, 255 ); drawOpenRect( loc.x, loc.y, size.x, size.y, outlineWidth, outlineColor ); - } // end if + } // draw lines around any drag source and drag targets in the hierarchy view GameWindow *dragSource = TheHierarchyView->getDragWindow(); @@ -1390,7 +1390,7 @@ void EditWindow::drawUIFeedback( void ) // draw box drawOpenRect( origin.x, origin.y, size.x, size.y, 2, dragColor ); - } // end if + } // drag target GameWindow *dragTarget = TheHierarchyView->getDragTarget(); @@ -1405,9 +1405,9 @@ void EditWindow::drawUIFeedback( void ) // draw box drawOpenRect( origin.x, origin.y, size.x, size.y, 2, dragColor ); - } // end if + } -} // end drawUIFeedback +} // EditWindow::drawGrid ======================================================= /** Draw the grid */ @@ -1455,15 +1455,15 @@ void EditWindow::drawGrid( void ) // TheDisplay->drawLine( x, y, x + 1, y + 1, 1, 0xFFFFFFFF ); - } // end for x + } - } // end for y + } */ // release the dc // ReleaseDC( getWindowHandle(), hdc ); -} // end drawGrid +} // EditWindow::draw =========================================================== /** Draw the edit window */ @@ -1493,7 +1493,7 @@ void EditWindow::draw( void ) // render is all done! WW3D::End_Render(); -} // end draw +} // EditWindow::setSize ======================================================== /** The edit window should now be logically consider this size */ @@ -1511,7 +1511,7 @@ void EditWindow::setSize( ICoord2D *size ) TheDisplay->setWidth( m_size.x ); TheDisplay->setHeight( m_size.y ); - } // end if + } // set the extents for our 2D renderer if( m_2DRender ) @@ -1520,7 +1520,7 @@ void EditWindow::setSize( ICoord2D *size ) m_size.x, m_size.y ) ); -} // end setSize +} // EditWindow::openPopupMenu ================================================== /** Open the new control menu that comes up when the user right clicks @@ -1544,7 +1544,7 @@ void EditWindow::openPopupMenu( Int x, Int y ) EnableMenuItem( subMenu, POPUP_MENU_PROPERTIES, MF_GRAYED ); EnableMenuItem( subMenu, POPUP_MENU_BRING_TO_TOP, MF_GRAYED ); - } // end if + } else { @@ -1552,7 +1552,7 @@ void EditWindow::openPopupMenu( Int x, Int y ) EnableMenuItem( subMenu, POPUP_MENU_PROPERTIES, MF_ENABLED ); EnableMenuItem( subMenu, POPUP_MENU_BRING_TO_TOP, MF_ENABLED ); - } // end else + } // // open up right mouse track menu, note that we have to translate the @@ -1568,7 +1568,7 @@ void EditWindow::openPopupMenu( Int x, Int y ) m_popupMenuClickPos.x = x; m_popupMenuClickPos.y = y; -} // end openPopupMenu +} // EditWindow::drawLine ======================================================= /** draw a line on the display in pixel coordinates with the specified color */ @@ -1584,7 +1584,7 @@ void EditWindow::drawLine( Int startX, Int startY, lineWidth, lineColor ); m_2DRender->Render(); -} // end drawLIne +} // EditWindow::drawOpenRect =================================================== /** draw a rect border on the display in pixel coordinates with the @@ -1604,7 +1604,7 @@ void EditWindow::drawOpenRect( Int startX, Int startY, // render it now! m_2DRender->Render(); -} // end drawOpenRect +} // EditWindow::drawFillRect =================================================== /** draw a filled rect on the display in pixel coords with the @@ -1624,7 +1624,7 @@ void EditWindow::drawFillRect( Int startX, Int startY, // render it now! m_2DRender->Render(); -} // end drawFillRect +} // EditWindow::drawImage ====================================================== /** draw an image fit within the screen coordinates */ @@ -1713,18 +1713,18 @@ void EditWindow::drawImage( const Image *image, Vector2( uv_rect.Left, uv_rect.Top ), color ); - } // end if + } else { // just draw as normal m_2DRender->Add_Quad( screen_rect, uv_rect, color ); - } // end else + } m_2DRender->Render(); -} // end drawImage +} // EditWindow::getBackgroundColor ============================================= /** Get the background color for the edit window */ @@ -1734,7 +1734,7 @@ RGBColorReal EditWindow::getBackgroundColor( void ) return m_backgroundColor; -} // end getBackgroundColor +} // EditWindow::setBackgroundColor ============================================= /** Set the background color for the edit window */ @@ -1744,7 +1744,7 @@ void EditWindow::setBackgroundColor( RGBColorReal color ) m_backgroundColor = color; -} // end setBackgroundColor +} // EditWindow::notifyWindowDeleted ============================================ /** A window has been deleted from the editor and the editor is now @@ -1767,7 +1767,7 @@ void EditWindow::notifyWindowDeleted( GameWindow *window ) m_resizingWindow = FALSE; TheEditor->setMode( MODE_EDIT ); - } // end if + } // null out picked window if needed if( m_pickedWindow == window ) @@ -1779,4 +1779,4 @@ void EditWindow::notifyWindowDeleted( GameWindow *window ) // TheEditor->setMode( MODE_EDIT ); -} // end notifyWindowDeleted +} diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp index 65ba591a26e..cb20781306c 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp @@ -153,7 +153,7 @@ char *GUIEdit::saveAsDialog( void ) else return NULL; -} // end saveAsDialog +} // GUIEdit::openDialog ======================================================== /** Bring up the standard windows browser open dialog and return @@ -195,7 +195,7 @@ char *GUIEdit::openDialog( void ) else return NULL; -} // end openDialog +} // GUIEdit::setUnsaved ======================================================== /** Set the current contents of the editor as either saved or unsaved, @@ -224,7 +224,7 @@ void GUIEdit::setUnsaved( Bool unsaved ) sprintf( title, "GUIEdit: %s *", filename ); SetWindowText( m_appHWnd, title ); - } // end if + } //else if( m_unsaved == TRUE && unsaved == FALSE ) else { @@ -234,12 +234,12 @@ void GUIEdit::setUnsaved( Bool unsaved ) sprintf( title, "GUIEdit: %s", filename ); SetWindowText( m_appHWnd, title ); - } // end else + } // save the new state we're in m_unsaved = unsaved; -} // end setUnsaved +} // GUIEdit::setSaveFile ======================================================= /** Set our member variables for the full path and filename passed in @@ -260,7 +260,7 @@ void GUIEdit::setSaveFile( const char *fullPathAndFilename ) ptr = strrchr( fullPathAndFilename, '\\' ) + 1; strcpy( m_saveFilename, ptr ); -} // end setSaveFile +} // GUIEdit::validateParentForCreate =========================================== /** This method is used when creating new windows and gadgets, if a @@ -283,11 +283,11 @@ Bool GUIEdit::validateParentForCreate( GameWindow *parent ) "Illegal Parent", MB_OK ); return FALSE; - } // end if + } return TRUE; // ok -} // end validateParentForCreate +} // GUIEdit::findSelectionEntry ================================================ /** Find selection entry for this window */ @@ -311,11 +311,11 @@ WindowSelectionEntry *GUIEdit::findSelectionEntry( GameWindow *window ) // next entry entry = entry->next; - } // end while + } return NULL; // not found -} // end findSelectionEntry +} // GUIEdit::normalizeRegion =================================================== /** Normalize the region so that lo and hi are actually lo and hi */ @@ -334,7 +334,7 @@ void GUIEdit::normalizeRegion( IRegion2D *region ) region->hi = region->lo; region->lo = temp; - } // end if + } else { @@ -342,9 +342,9 @@ void GUIEdit::normalizeRegion( IRegion2D *region ) region->hi.x = region->lo.x; region->lo.x = temp.x; - } // end else + } - } // end if + } else if( region->hi.y < region->lo.y ) { @@ -352,9 +352,9 @@ void GUIEdit::normalizeRegion( IRegion2D *region ) region->hi.y = region->lo.y; region->lo.y = temp.y; - } // end if + } -} // end normalizeRegion +} // GUIEdit::selectWindowsInRegion ============================================= /** Select all the windows that are fully in the region */ @@ -393,14 +393,14 @@ void GUIEdit::selectWindowsInRegion( IRegion2D *region ) // add to selection list selectWindow( window ); - } // end if + } // go to next window window = window->winGetNext(); - } // end while + } -} // end selectWindowsInRegion +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -438,7 +438,7 @@ GUIEdit::GUIEdit( void ) m_layoutInitString = GUIEDIT_NONE_STRING; m_layoutUpdateString = GUIEDIT_NONE_STRING; m_layoutShutdownString = GUIEDIT_NONE_STRING; -} // end GUIEdit +} // GUIEdit::~GUIEdit ========================================================== /** */ @@ -468,7 +468,7 @@ GUIEdit::~GUIEdit( void ) // all the shutdown routine shutdown(); -} // end ~GUIEdit +} // GUIEdit::init ============================================================== /** Initialize all the GUI edit data */ @@ -618,7 +618,7 @@ void GUIEdit::init( void ) // { // TheIMEManager->init(); // } -} // end init +} // GUIEdit::shutdown ========================================================== /** Shutdown our GUI edit application */ @@ -713,7 +713,7 @@ void GUIEdit::shutdown( void ) TheKeyboard = NULL; -} // end shutdown +} // GUIEdit::update ============================================================ /** Update method for our GUI edit application */ @@ -733,7 +733,7 @@ void GUIEdit::update( void ) TheMessageStream->propagateMessages(); TheCommandList->reset(); - } // end if + } // update the window manager itself TheWindowManager->update(); @@ -741,7 +741,7 @@ void GUIEdit::update( void ) // draw the edit window TheEditWindow->draw(); -} // end update +} // GUIEdit::writeConfigFile =================================================== /** Write the guiedit config file */ @@ -759,7 +759,7 @@ Bool GUIEdit::writeConfigFile( const char *filename ) assert( 0 ); return FALSE; - } // end if + } // version fprintf( fp, "GUIEdit Config file version '%d'\n", GUIEDIT_CONFIG_VERSION ); @@ -796,7 +796,7 @@ Bool GUIEdit::writeConfigFile( const char *filename ) return TRUE; -} // end writeConfigFile +} // GUIEdit::readConfigFile ==================================================== /** Read the guiedit config file */ @@ -861,7 +861,7 @@ Bool GUIEdit::readConfigFile( const char *filename ) return TRUE; -} // end readConfigFile +} // GUIEdit::readFontFile ====================================================== /** Read the font file defintitions and load them */ @@ -904,7 +904,7 @@ void GUIEdit::readFontFile( const char *filename ) fontBuffer[ index++ ] = c; c = fgetc( fp ); - } // end while + } fontBuffer[ index ] = '\0'; c = fgetc( fp ); // the end quite itself @@ -921,14 +921,14 @@ void GUIEdit::readFontFile( const char *filename ) fontBuffer, size, bold ); MessageBox( m_appHWnd, buffer, "Cannot Load Font", MB_OK ); - } // end if + } - } // end for i + } // close the file fclose( fp ); -} // end readFontFile +} // GUIEdit::writeFontFile ===================================================== /** If we can, write a file containing a definition of all the fonts @@ -958,12 +958,12 @@ void GUIEdit::writeFontFile( const char *filename ) { fprintf( fp, "AVAILABLEFONT = \"%s\" Size: %d Bold: %d\n", font->nameString.str(), font->pointSize, font->bold ); - } // end for + } // close the file fclose( fp ); -} // end writeFontFile +} // GUIEdit::setMode =========================================================== /** Set a new mode for the editor */ @@ -983,7 +983,7 @@ void GUIEdit::setMode( EditMode mode ) TheMessageStream->removeTranslator( transID ); transID = 0; - } // end if + } // assign new mode m_mode = mode; @@ -1072,9 +1072,9 @@ void GUIEdit::setMode( EditMode mode ) statusMessage( STATUS_MODE, "Drag right to resize" ); break; - } // end switch + } -} // end setMode +} // GUIEdit::setCursor ========================================================= /** Set the cursor to the specified type */ @@ -1121,12 +1121,12 @@ void GUIEdit::setCursor( CursorType type ) identifier = IDC_WAIT; break; - } // end switchType + } // set the new cursor SetCursor( LoadCursor( NULL, identifier ) ); -} // end setCursor +} // pointInChild =============================================================== /** Given a mouse position, get the topmost window at that location. We needed @@ -1155,19 +1155,19 @@ static GameWindow *pointInChild( Int x, Int y , GameWindow *win) origin.y += tempRegion.lo.y; parent = parent->winGetParent(); - } // end while + } child->winGetSize(&tempX,&tempY); if( x >= origin.x && x <= origin.x + tempX && y >= origin.y && y <= origin.y + tempY && BitIsSet( child->winGetStatus(), WIN_STATUS_HIDDEN ) == FALSE) return child->winPointInChild( x, y ); - } // end for child + } // not in any children, must be in parent return win; -} // end pointInChild +} // pointInAnyChild ============================================================ /** Given a mouse position, get the topmost window at that location. We needed @@ -1196,7 +1196,7 @@ static GameWindow *pointInAnyChild( Int x, Int y, Bool ignoreHidden, GameWindow origin.y += tempRegion.lo.y; parent = parent->winGetParent(); - } // end while + } child->winGetSize(&tempX,&tempY); if( x >= origin.x && x <= origin.x + tempX && y >= origin.y && y <= origin.y + tempY ) @@ -1205,14 +1205,14 @@ static GameWindow *pointInAnyChild( Int x, Int y, Bool ignoreHidden, GameWindow if( !(ignoreHidden == TRUE && BitIsSet( child->winGetStatus(), WIN_STATUS_HIDDEN )) ) return pointInChild( x, y , child); - } // end if + } - } // end for child + } // not in any children, must be in parent return win; -} // end pointInAnyChild +} // GUIEdit::getWindowAtPos ==================================================== /** Given a mouse position, get the topmost window at that location */ @@ -1238,9 +1238,9 @@ GameWindow *GUIEdit::getWindowAtPos( Int x, Int y ) pick = pointInAnyChild( x, y, FALSE, window ); break; // exit for - } // end if + } - } // end for + } // // gadget controls are just composed of generic windows and buttons, @@ -1287,7 +1287,7 @@ GameWindow *GUIEdit::getWindowAtPos( Int x, Int y ) GWS_SCROLL_LISTBOX ) ) pick = grandParent; - } // end if + } //must check to see of the parent of a scroll box is a combo box if(BitIsSet(pick->winGetStyle(), GWS_SCROLL_LISTBOX)) @@ -1296,15 +1296,15 @@ GameWindow *GUIEdit::getWindowAtPos( Int x, Int y ) if( grandParent && BitIsSet( grandParent->winGetStyle(), GWS_COMBO_BOX)) pick = grandParent; } - } // end if + } - } // end if + } - } // end if + } return pick; -} // end getWindowAtPos +} // GUIEdit::clipCreationParamsToParent ======================================== /** when creating child windows we don't want them to exist outside the @@ -1362,7 +1362,7 @@ void GUIEdit::clipCreationParamsToParent( GameWindow *parent, *width = newWidth; *height= newHeight; -} // end clipcreationParamsToParent +} /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// @@ -1383,9 +1383,9 @@ void GUIEdit::deleteAllWindows( void ) deleteWindow( window ); window = next; - } // end while + } -} // end deleteAllWindows +} // GUIEdit::removeWindowCleanup =============================================== /** This is called on each window before it is deleted or removed from @@ -1423,7 +1423,7 @@ void GUIEdit::removeWindowCleanup( GameWindow *window ) for( child = window->winGetChild(); child; child = child->winGetNext() ) removeWindowCleanup( child ); -} // end removeWindowCleanup +} // GUIEdit::deleteWindow ====================================================== /** Delete the window from the editor */ @@ -1440,7 +1440,7 @@ void GUIEdit::deleteWindow( GameWindow *window ) // we've changed contents setUnsaved( TRUE ); -} // end deleteWindow +} // GUIEdit::newWindow ========================================================= /** Create a new window of the specified type. This is the single creation @@ -1523,11 +1523,11 @@ GameWindow *GUIEdit::newWindow( UnsignedInt windowStyle, MB_OK | MB_ICONERROR ); break; - } // end switch + } return window; -} // end newWindow +} // GUIEdit::newUserWindow ===================================================== /** Create a new window at the given location */ @@ -1585,7 +1585,7 @@ GameWindow *GUIEdit::newUserWindow( GameWindow *parent, Int x, Int y, return window; -} // end newUserWindow +} // GUIEdit::newPushButton ===================================================== /** Create a new push button */ @@ -1667,7 +1667,7 @@ GameWindow *GUIEdit::newPushButton( GameWindow *parent, // set default font window->winSetFont( TheDefaultScheme->getFont() ); - } // end if + } // contents have changed setUnsaved( TRUE ); @@ -1677,7 +1677,7 @@ GameWindow *GUIEdit::newPushButton( GameWindow *parent, return window; -} // end newPushButton +} // GUIEdit::newCheckBox ======================================================= /** Create a new check box */ @@ -1772,7 +1772,7 @@ GameWindow *GUIEdit::newCheckBox( GameWindow *parent, // set default font window->winSetFont( TheDefaultScheme->getFont() ); - } // end if + } // contents have changed setUnsaved( TRUE ); @@ -1782,7 +1782,7 @@ GameWindow *GUIEdit::newCheckBox( GameWindow *parent, return window; -} // end newCheckBox +} // GUIEdit::newRadioButton ==================================================== /** Create a new radio button */ @@ -1880,7 +1880,7 @@ GameWindow *GUIEdit::newRadioButton( GameWindow *parent, // set default font window->winSetFont( TheDefaultScheme->getFont() ); - } // end if + } // contents have changed setUnsaved( TRUE ); @@ -1890,7 +1890,7 @@ GameWindow *GUIEdit::newRadioButton( GameWindow *parent, return window; -} // end newRadioButton +} // GUIEdit::newTabControl ==================================================== /** Create a tab control gadget */ @@ -2078,7 +2078,7 @@ GameWindow *GUIEdit::newTabControl( GameWindow *parent, GadgetTabControlSetHiliteColorBackground( window, info->color ); GadgetTabControlSetHiliteBorderColorBackground( window, info->borderColor ); - } // end if + } // contents have changed setUnsaved( TRUE ); @@ -2088,7 +2088,7 @@ GameWindow *GUIEdit::newTabControl( GameWindow *parent, return window; -} // end newTabControl +} // GUIEdit::newHorizontalSlider =============================================== /** Create a new horizontal slider*/ @@ -2199,7 +2199,7 @@ GameWindow *GUIEdit::newHorizontalSlider( GameWindow *parent, // set default font window->winSetFont( TheDefaultScheme->getFont() ); - } // end if + } // contents have changed setUnsaved( TRUE ); @@ -2209,7 +2209,7 @@ GameWindow *GUIEdit::newHorizontalSlider( GameWindow *parent, return window; -} // end newHorizontalSlider +} // GUIEdit::newVerticlaSlider ================================================= /** Create a new vertical slider */ @@ -2320,7 +2320,7 @@ GameWindow *GUIEdit::newVerticalSlider( GameWindow *parent, // set default font window->winSetFont( TheDefaultScheme->getFont() ); - } // end if + } // contents have changed setUnsaved( TRUE ); @@ -2330,7 +2330,7 @@ GameWindow *GUIEdit::newVerticalSlider( GameWindow *parent, return window; -} // end newVerticalSlider +} // GUIEdit::newProgressBar ==================================================== /** Create a new progress bar */ @@ -2455,7 +2455,7 @@ GameWindow *GUIEdit::newProgressBar( GameWindow *parent, // set default font window->winSetFont( TheDefaultScheme->getFont() ); - } // end if + } // contents have changed setUnsaved( TRUE ); @@ -2465,7 +2465,7 @@ GameWindow *GUIEdit::newProgressBar( GameWindow *parent, return window; -} // end newProgressBar +} // GUIEdit::newListbox ======================================================== /** Create a new list box */ @@ -2709,7 +2709,7 @@ GameWindow *GUIEdit::newComboBox( GameWindow *parent, GadgetButtonSetHiliteSelectedColor( upButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( upButton, info->borderColor ); - } // end if + } GameWindow *downButton = GadgetListBoxGetDownButton( listBox ); if( downButton ) @@ -2742,7 +2742,7 @@ GameWindow *GUIEdit::newComboBox( GameWindow *parent, GadgetButtonSetHiliteSelectedColor( downButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( downButton, info->borderColor ); - } // end if + } GameWindow *slider = GadgetListBoxGetSlider( listBox ); if( slider ) @@ -2814,7 +2814,7 @@ GameWindow *GUIEdit::newComboBox( GameWindow *parent, GadgetSliderSetHiliteSelectedThumbBorderColor( slider, info->borderColor ); } - } //end listbox if + } GameWindow *dropDownButton = GadgetComboBoxGetDropDownButton( window ); if( dropDownButton ) { @@ -2846,7 +2846,7 @@ GameWindow *GUIEdit::newComboBox( GameWindow *parent, GadgetButtonSetHiliteSelectedColor( dropDownButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( dropDownButton, info->borderColor ); - } // end if + } Color color, border; @@ -2869,7 +2869,7 @@ GameWindow *GUIEdit::newComboBox( GameWindow *parent, // set default font window->winSetFont( TheDefaultScheme->getFont() ); - }// end if + } // contents have changed setUnsaved( TRUE ); @@ -2880,7 +2880,7 @@ GameWindow *GUIEdit::newComboBox( GameWindow *parent, return window; -} // end newComboBox +} // GUIEdit::newListbox ======================================================== /** Create a new list box */ @@ -3010,7 +3010,7 @@ GameWindow *GUIEdit::newListbox( GameWindow *parent, GadgetButtonSetHiliteSelectedColor( upButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( upButton, info->borderColor ); - } // end if + } GameWindow *downButton = GadgetListBoxGetDownButton( window ); if( downButton ) @@ -3043,7 +3043,7 @@ GameWindow *GUIEdit::newListbox( GameWindow *parent, GadgetButtonSetHiliteSelectedColor( downButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( downButton, info->borderColor ); - } // end if + } GameWindow *slider = GadgetListBoxGetSlider( window ); if( slider ) @@ -3114,7 +3114,7 @@ GameWindow *GUIEdit::newListbox( GameWindow *parent, GadgetSliderSetHiliteSelectedThumbColor( slider, info->color ); GadgetSliderSetHiliteSelectedThumbBorderColor( slider, info->borderColor ); - } // end if, slider + } Color color, border; @@ -3133,7 +3133,7 @@ GameWindow *GUIEdit::newListbox( GameWindow *parent, // set default font window->winSetFont( TheDefaultScheme->getFont() ); - } // end if + } // contents have changed setUnsaved( TRUE ); @@ -3143,7 +3143,7 @@ GameWindow *GUIEdit::newListbox( GameWindow *parent, return window; -} // end newListbox +} // GUIEdit::newTextEntry ====================================================== /** Create a new text entry */ @@ -3239,7 +3239,7 @@ GameWindow *GUIEdit::newTextEntry( GameWindow *parent, // set default font window->winSetFont( TheDefaultScheme->getFont() ); - } // end if + } // contents have changed setUnsaved( TRUE ); @@ -3249,7 +3249,7 @@ GameWindow *GUIEdit::newTextEntry( GameWindow *parent, return window; -} // end newTextEntry +} // GUIEdit::newStaticText ===================================================== /** Create a new static text*/ @@ -3327,7 +3327,7 @@ GameWindow *GUIEdit::newStaticText( GameWindow *parent, // set default font window->winSetFont( TheDefaultScheme->getFont() ); - } // end if + } // contents have changed setUnsaved( TRUE ); @@ -3337,7 +3337,7 @@ GameWindow *GUIEdit::newStaticText( GameWindow *parent, return window; -} // end newStaticText +} // GUIEdit::createStatusBar =================================================== /** Create a status bar at the bottom of the editor */ @@ -3371,11 +3371,11 @@ void GUIEdit::createStatusBar( void ) sizes[ i ] = (i + 1) * (width / STATUS_NUM_PARTS); - } // end for i + } sizes[ STATUS_NUM_PARTS - 1 ] = -1; // right edge SendMessage( m_statusBarHWnd, SB_SETPARTS, STATUS_NUM_PARTS, (LPARAM)sizes ); -} // end createStatusBar +} // GUIEdit::statusMessage ===================================================== /** Set a message in the status bar */ @@ -3391,12 +3391,12 @@ void GUIEdit::statusMessage( StatusPart part, const char *message ) assert( 0 ); return; - } // end if + } if( m_statusBarHWnd ) SendMessage( m_statusBarHWnd, SB_SETTEXT, part, (LPARAM)message ); -} // end statusMessage +} // GUIEdit::createToolbar ===================================================== /** Create the toolbar for the editor */ @@ -3404,7 +3404,7 @@ void GUIEdit::statusMessage( StatusPart part, const char *message ) void GUIEdit::createToolbar( void ) { -} // end createToolbar +} /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// @@ -3429,7 +3429,7 @@ Bool GUIEdit::newLayout( void ) return TRUE; -} // end newLayout +} // GUIEdit::menuExit ========================================================== /** The user clicked on exit in the menu and wishes to exit the editor */ @@ -3465,9 +3465,9 @@ Bool GUIEdit::menuExit( void ) "File not saved. If you continue to exit all data will be LOST!", "File Not Saved", MB_OK ); - } // end if + } - } // end if + } // ask them if they really want to quit result = MessageBox( m_appHWnd, "Exit GUIEdit?", "Really Quit?", MB_YESNO ); @@ -3476,7 +3476,7 @@ Bool GUIEdit::menuExit( void ) return TRUE; -} // end menuExit +} // GUIEdit::menuNew =========================================================== /** file->new menu option */ @@ -3516,11 +3516,11 @@ Bool GUIEdit::menuNew( void ) if( result == IDNO ) return TRUE; // they chose to proceed anyway, no error - } // end if + } - } // end if + } - } // end if + } // reset the layout in the editor strcpy( m_savePathAndFilename, "" ); @@ -3530,7 +3530,7 @@ Bool GUIEdit::menuNew( void ) return TRUE; -} // end menuNew +} // GUIEdit::stripNameDecorations ============================================== /** Strip name decorations of the entire tree of windows */ @@ -3564,9 +3564,9 @@ void GUIEdit::stripNameDecorations( GameWindow *root ) // put the name only in the decoration field instData->m_decoratedNameString = nameOnly; - } // end if + } - } // end if + } // strip from children GameWindow *child; @@ -3576,7 +3576,7 @@ void GUIEdit::stripNameDecorations( GameWindow *root ) // onto the next stripNameDecorations( root->winGetNext() ); -} // end stripNameDecorations +} //============================================================================= /** After a load, we will restore default callbacks to all user windows @@ -3598,7 +3598,7 @@ void GUIEdit::revertDefaultCallbacks( GameWindow *root ) root->winSetTooltipFunc( TheWindowManager->getDefaultTooltip() ); root->winSetDrawFunc( TheWindowManager->getDefaultDraw() ); - } // end if + } // do the children revertDefaultCallbacks( root->winGetChild() ); @@ -3606,7 +3606,7 @@ void GUIEdit::revertDefaultCallbacks( GameWindow *root ) // do the next window revertDefaultCallbacks( root->winGetNext() ); -} // end revertDefaultCallbacks +} // GUIEdit::menuOpen ========================================================== /** User has clicked on file->open */ @@ -3647,11 +3647,11 @@ Bool GUIEdit::menuOpen( void ) if( result == IDNO ) return TRUE; // they chose to proceed anyway, no error - } // end if + } - } // end if + } - } // end if + } // open the standard window file browser filePath = openDialog(); @@ -3706,7 +3706,7 @@ Bool GUIEdit::menuOpen( void ) return TRUE; -} // end menuOpen +} // GUIEdit::menuSave ========================================================== /** file->save menu option */ @@ -3727,17 +3727,17 @@ Bool GUIEdit::menuSave( void ) // our contents are now considered "unchanged" setUnsaved( FALSE ); - } // end if + } else { MessageBox( m_appHWnd, "Layout not saved!", "Error", MB_OK ); - } // end else + } return success; -} // end menuSave +} // GUIEdit::menuSaveAs ======================================================== /** file->saveAs menu option */ @@ -3765,17 +3765,17 @@ Bool GUIEdit::menuSaveAs( void ) // our contents are now considered "unchanged" setUnsaved( FALSE ); - } // end if + } else { MessageBox( m_appHWnd, "Layout not saved!", "Error", MB_OK ); - } // end else + } return success; -} // end menuSaveAs +} // GUIEdit::menuCopy ========================================================== /** Copy selected windows into clipboard */ @@ -3793,7 +3793,7 @@ Bool GUIEdit::menuCopy( void ) "No Windows Selected", MB_OK ); return TRUE; - } // end if + } // // cut the selected windows out of the current window system, and @@ -3803,7 +3803,7 @@ Bool GUIEdit::menuCopy( void ) return TRUE; -} // end menuCopy +} // GUIEdit::menuPaste ========================================================= /** Paste contents of clipboard into current layout */ @@ -3814,7 +3814,7 @@ Bool GUIEdit::menuPaste( void ) TheGUIEditWindowManager->pasteClipboard(); return TRUE; -} // end menuPaste +} // GUIEdit::menuCut =========================================================== /** Cut selected windows into the clipboard */ @@ -3832,7 +3832,7 @@ Bool GUIEdit::menuCut( void ) "No Windows Selected", MB_OK ); return TRUE; - } // end if + } // // cut the selected windows out of the current window system, and @@ -3842,7 +3842,7 @@ Bool GUIEdit::menuCut( void ) return TRUE; -} // end menuCut +} /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// @@ -3866,7 +3866,7 @@ Bool GUIEdit::isWindowSelected( GameWindow *window ) else return FALSE; -} // end isWindowSelected +} // GUIEdit::selectWindow ====================================================== /** Add window to selection list */ @@ -3892,7 +3892,7 @@ void GUIEdit::selectWindow( GameWindow *window ) assert( 0 ); return; - } // end if + } // fill out information and tie to head of list entry->window = window; @@ -3906,7 +3906,7 @@ void GUIEdit::selectWindow( GameWindow *window ) if( selectionCount() == 1 ) TheHierarchyView->selectWindow( window ); -} // end selectWindow +} // GUIEdit::unSelectWindow ==================================================== /** Remove window from the selection list */ @@ -3935,9 +3935,9 @@ void GUIEdit::unSelectWindow( GameWindow *window ) // delete the entry delete entry; - } // end if + } -} // end unSelectWindow +} // GUIEdit::clearSelections =================================================== /** Clear the entire selection list */ @@ -3948,7 +3948,7 @@ void GUIEdit::clearSelections( void ) while( m_selectList ) unSelectWindow( m_selectList->window ); -} // end clearSelections +} // GUIEdit::selectionCount ==================================================== /** How many items are selected */ @@ -3965,11 +3965,11 @@ Int GUIEdit::selectionCount( void ) count++; select = select->next; - } // end while + } return count; -} // end selectionCount +} // GUIEdit::notifyNewWindow =================================================== /** The passed in window has just been added into the GUI layout. It @@ -4003,9 +4003,9 @@ void GUIEdit::notifyNewWindow( GameWindow *window ) for( child = window->winGetChild(); child; child = child->winGetNext() ) notifyNewWindow( child ); - } // end if + } -} // end notifyNewWindow +} // GUIEdit::deleteSelected ==================================================== /** Delete the windows in the selection list */ @@ -4031,7 +4031,7 @@ void GUIEdit::deleteSelected( void ) assert( 0 ); return; - } // end if + } // fill out the delete list for( i = 0, select = m_selectList; i < count; i++, select = select->next ) @@ -4044,7 +4044,7 @@ void GUIEdit::deleteSelected( void ) // free memory for the delete list delete [] deleteList; -} // end deleteSelected +} // GUIEdit::bringSelectedToTop ================================================ /** Bring the selected windows to the top so they draw on top of @@ -4074,7 +4074,7 @@ void GUIEdit::bringSelectedToTop( void ) assert( 0 ); return; - } // end if + } // take the snapshot Int i; @@ -4092,12 +4092,12 @@ void GUIEdit::bringSelectedToTop( void ) // update the hierarchy to have the new window on the top TheHierarchyView->bringWindowToTop( snapshot[ i ] ); - } // end for i + } // delete the snapshot list delete [] snapshot; -} // end bringSelectedToTop +} // GUIEdit::dragMoveSelectedWindows =========================================== /** Move all the windows in the selection list from a drag move, note @@ -4142,10 +4142,10 @@ void GUIEdit::dragMoveSelectedWindows( ICoord2D *dragOrigin, // goto next selected window select = select->next; - } // end while + } -} // end dragMoveSelectedWindows +} // GUIEdit::getSelectList ===================================================== /** Return the selection list */ @@ -4155,7 +4155,7 @@ WindowSelectionEntry *GUIEdit::getSelectList( void ) return m_selectList; -} // end getSelectList +} // GUIEdit::getFirstSelected ================================================== /** Get the first GameWindow * from the selection list */ @@ -4168,7 +4168,7 @@ GameWindow *GUIEdit::getFirstSelected( void ) return NULL; -} // end getFirstSelected +} // GUIEdit::computeSafeLocation =============================================== /** If we attempt to move the window to the given (x,y) it may result @@ -4215,7 +4215,7 @@ void GUIEdit::computeSafeLocation( GameWindow *window, else if( region.hi.y + dy > parentSize.y ) dy = parentSize.y - region.hi.y; - } // end else if, parent + } // Move the window, but keep it completely visible within screen boundaries IRegion2D newRegion; @@ -4246,7 +4246,7 @@ void GUIEdit::computeSafeLocation( GameWindow *window, *safeX = newRegion.lo.x; *safeY = newRegion.lo.y; -} // end computeSafeLocation +} // GUIEdit::computeSafeSizeLocation =========================================== /** Like the method computeSafeLocation, this method also takes into @@ -4281,7 +4281,7 @@ void GUIEdit::computeSafeSizeLocation( GameWindow *window, parent->winGetScreenPosition( &parentLoc.x, &parentLoc.y ); parent->winGetSize( &parentSize.x, &parentSize.y ); - } // end if + } // upper left corner must be in screen or in parent topLeftLimit.x = 0; // screen top left @@ -4309,7 +4309,7 @@ void GUIEdit::computeSafeSizeLocation( GameWindow *window, bottomRightLimit.x = parentLoc.x + parentSize.x; bottomRightLimit.y = parentLoc.y + parentSize.y; - } // end if + } if( newX + newWidth > bottomRightLimit.x ) newWidth = bottomRightLimit.x - newX; if( newY + newHeight > bottomRightLimit.y ) @@ -4326,7 +4326,7 @@ void GUIEdit::computeSafeSizeLocation( GameWindow *window, *safeY = *safeY - parentLoc.y; } -} // end computeSafeSizeLocation +} // GUIEdit::computeResizeLocation ============================================= /** Given the current resize drag mode, the selected window to resize, @@ -4513,7 +4513,7 @@ void GUIEdit::computeResizeLocation( EditMode resizeMode, break; - } // end switch( resizeMode ) + } // to finalize the size we must now clip to any parent or the screen computeSafeSizeLocation( window, @@ -4522,7 +4522,7 @@ void GUIEdit::computeResizeLocation( EditMode resizeMode, &resultLoc->x, &resultLoc->y, &resultSize->x, &resultSize->y ); -} // end computeResizeLocation +} // GUIEdit::moveWindowTo ====================================================== /** Move the window passed into the the absolute position (x,y), @@ -4537,7 +4537,7 @@ void GUIEdit::moveWindowTo( GameWindow *window, Int x, Int y ) // we've now made a change TheEditor->setUnsaved( TRUE ); -} // end moveWindowTo +} // GUIEdit::windowIsGadget ==================================================== /** Return TRUE if this window is one of our predefined gadtet types */ @@ -4551,7 +4551,7 @@ Bool GUIEdit::windowIsGadget( GameWindow *window ) return BitIsSet( window->winGetStyle(), GWS_GADGET_WINDOW ); -} // end windowIsGadget +} // GUIEdit::gridSnapLocation ================================================== /** Given the source input point, return in 'snapped' the closest grid @@ -4567,7 +4567,7 @@ void GUIEdit::gridSnapLocation( ICoord2D *source, ICoord2D *snapped ) snapped->x = (source->x / m_gridResolution) * m_gridResolution; snapped->y = (source->y / m_gridResolution) * m_gridResolution; -} // end gridSnapLocation +} // GUIEdit::checkMenuItem ===================================================== /** Check the menu item from the guiedit main menu */ @@ -4583,7 +4583,7 @@ void GUIEdit::checkMenuItem( Int item ) // check it CheckMenuItem( menu, item, MF_CHECKED ); -} // end checkMenuItem +} // GUIEdit::unCheckMenuItem =================================================== /** Un-check the menu item from the guiedit main menu */ @@ -4599,7 +4599,7 @@ void GUIEdit::unCheckMenuItem( Int item ) // check it CheckMenuItem( menu, item, MF_UNCHECKED ); -} // end unCheckMenuItem +} // GUIEdit::isNameDuplicate =================================================== /** Is the name passed in found as the name of any window in in the @@ -4630,7 +4630,7 @@ Bool GUIEdit::isNameDuplicate( GameWindow *root, GameWindow *ignore, AsciiString // check the next window in the list return isNameDuplicate( root->winGetNext(), ignore, name ); -} // end isNameDuplicate +} // GUIEdit::loadGUIEditFontLibrary ============================================ /** Load the set of fonts that we will make available to users in @@ -4653,7 +4653,7 @@ void GUIEdit::loadGUIEditFontLibrary( FontLibrary *library ) library->getFont( times, 10, FALSE ); library->getFont( times, 10, TRUE ); -} // end loadGUIEditFontLibrary +} // GUIEdit::setShowHiddenOutlines ============================================= //============================================================================= @@ -4667,7 +4667,7 @@ void GUIEdit::setShowHiddenOutlines( Bool show ) else CheckMenuItem( GetMenu( m_appHWnd ), MENU_SHOW_HIDDEN_OUTLINES, MF_UNCHECKED ); -} // end setShowHiddenOutlines +} // GUIEdit::setShowSeeThruOutlines ============================================ //============================================================================= @@ -4681,5 +4681,5 @@ void GUIEdit::setShowSeeThruOutlines( Bool show ) else CheckMenuItem( GetMenu( m_appHWnd ), MENU_SHOW_SEE_THRU_OUTLINES, MF_UNCHECKED ); -} // end setShowSeeThruOutlines +} diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditDisplay.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditDisplay.cpp index b322b245cdc..e72b810841a 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditDisplay.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditDisplay.cpp @@ -72,7 +72,7 @@ GUIEditDisplay::GUIEditDisplay( void ) { -} // end GUIEditDisplay +} // GUIEditDisplay::~GUIEditDisplay ============================================ /** */ @@ -80,7 +80,7 @@ GUIEditDisplay::GUIEditDisplay( void ) GUIEditDisplay::~GUIEditDisplay( void ) { -} // end ~GUIEditDisplay +} // GUIEditDisplay::drawLine =================================================== /** draw a line on the display in pixel coordinates with the specified color */ @@ -92,7 +92,7 @@ void GUIEditDisplay::drawLine( Int startX, Int startY, TheEditWindow->drawLine( startX, startY, endX, endY, lineWidth, lineColor ); -} // end drawLIne +} // GUIEditDisplay::drawOpenRect =============================================== /** draw a rect border on the display in pixel coordinates with the @@ -106,7 +106,7 @@ void GUIEditDisplay::drawOpenRect( Int startX, Int startY, TheEditWindow->drawOpenRect( startX, startY, width, height, lineWidth, lineColor ); -} // end drawOpenRect +} // GUIEditDisplay::drawFillRect =============================================== /** draw a filled rect on the display in pixel coords with the @@ -121,7 +121,7 @@ void GUIEditDisplay::drawFillRect( Int startX, Int startY, width, height, color ); -} // end drawFillRect +} // GUIEditDisplay::drawImage ================================================== /** draw an image fit within the screen coordinates */ @@ -138,7 +138,7 @@ void GUIEditDisplay::drawImage( const Image *image, color ); -} // end drawImage +} // GUIEditDisplay::setClipRegion ============================================== /** sets clipping rectangle for 2D drawing operations */ diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp index 57f549a5b81..005c618f7b5 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp @@ -70,11 +70,11 @@ Bool GUIEditWindowManager::isWindowInClipboard( GameWindow *window, if( window == other ) return TRUE; // found - } // end for window + } return FALSE; // not found -} // end isWindowInClipboard +} //------------------------------------------------------------------------------------------------- /** Add the window to clipboard list */ @@ -97,7 +97,7 @@ void GUIEditWindowManager::linkToClipboard( GameWindow *window, (*list)->winSetPrev( window ); *list = window; -} // end linkToClipboard +} //------------------------------------------------------------------------------------------------- /** Unlink window from the clipboard list */ @@ -125,7 +125,7 @@ void GUIEditWindowManager::unlinkFromClipboard( GameWindow *window, else *list = next; -} // end unlinkFromClipboard +} //------------------------------------------------------------------------------------------------- /** Remove selection entries for child windows that also have ANY of @@ -157,7 +157,7 @@ void GUIEditWindowManager::removeSupervisedChildSelections( void ) parentSelected = TRUE; parent = parent->winGetParent(); - } // end while + } // // if there is a parent selected then we can remove this @@ -166,9 +166,9 @@ void GUIEditWindowManager::removeSupervisedChildSelections( void ) if( parentSelected == TRUE ) TheEditor->unSelectWindow( window ); - } // end for select + } -} // end removeSupervisedChildSelections +} //------------------------------------------------------------------------------------------------- /** Traverse the selected window list, any child windows we encounter @@ -206,11 +206,11 @@ void GUIEditWindowManager::orphanSelectedChildren( void ) // window->winSetPosition( pos.x, pos.y ); - } // end if, we had a parent + } - } // end for select + } -} // end orphanSelectedChildren +} */ /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -228,7 +228,7 @@ GUIEditWindowManager::GUIEditWindowManager( void ) m_copySpacing = 8; m_numCopiesPasted = 0; -} // end GUIEditWindowManager +} //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -241,7 +241,7 @@ GUIEditWindowManager::~GUIEditWindowManager( void ) // free all data on the clipboard resetClipboard(); -} // end ~GUIEditWindowManager +} //------------------------------------------------------------------------------------------------- /** initialize the system */ @@ -252,7 +252,7 @@ void GUIEditWindowManager::init( void ) // extending functionality W3DGameWindowManager::init(); -} // end init +} //------------------------------------------------------------------------------------------------- /** Destroy a game window */ @@ -275,12 +275,12 @@ Int GUIEditWindowManager::winDestroy( GameWindow *window ) // set the edit data to NULL in the window window->winSetEditData( NULL ); - } // end if + } // call our base class functionality return W3DGameWindowManager::winDestroy( window ); -} // end winDestroy +} //------------------------------------------------------------------------------------------------- /** Create a new window by setting up its parameters and callbacks. */ @@ -310,11 +310,11 @@ GameWindow *GUIEditWindowManager::winCreate( GameWindow *parent, // attach edit data to window window->winSetEditData( editData ); - } // end if + } return window; -} // end winCreate +} //------------------------------------------------------------------------------------------------- /** Destroy all windows in the clipboard */ @@ -346,7 +346,7 @@ void GUIEditWindowManager::resetClipboard( void ) // winDestroy( window ); - } // end for window + } // immediately process the destroyed windows just to be clean here processDestroyList(); @@ -355,7 +355,7 @@ void GUIEditWindowManager::resetClipboard( void ) m_clipboard = NULL; m_numCopiesPasted = 0; -} // end resetClipboard +} //------------------------------------------------------------------------------------------------- /** Is the clipboard empty */ @@ -368,7 +368,7 @@ Bool GUIEditWindowManager::isClipboardEmpty( void ) return FALSE; -} // end isClipboardEmtpy +} //------------------------------------------------------------------------------------------------- /** Remove the selected windows from the current layout and put them into @@ -395,7 +395,7 @@ void GUIEditWindowManager::cutSelectedToClipboard( void ) if( m_clipboard ) TheEditor->deleteSelected(); -} // end cutSelectedToClipboard +} //------------------------------------------------------------------------------------------------- /** Given the current window in a list pointed to by 'root', if that @@ -440,14 +440,14 @@ void GUIEditWindowManager::duplicateSelected( GameWindow *root ) pos.y += parentPos.y; duplicate->winSetPosition( pos.x, pos.y ); - } // end if + } // add window to the clipboard linkToClipboard( duplicate, &m_clipboard ); - } // end if + } - } // end if + } else { @@ -457,12 +457,12 @@ void GUIEditWindowManager::duplicateSelected( GameWindow *root ) // duplicateSelected( root->winGetChild() ); - } // end else + } // move on to the next window duplicateSelected( root->winGetNext() ); -} // end duplicateSelected +} //------------------------------------------------------------------------------------------------- /** Copy the selected windows to the clipboard */ @@ -487,7 +487,7 @@ void GUIEditWindowManager::copySelectedToClipboard( void ) // duplicateSelected( m_windowList ); -} // end copySelectedToClipboard +} //------------------------------------------------------------------------------------------------- /** Take the string representation of the name of the window passed in, @@ -518,7 +518,7 @@ void GUIEditWindowManager::incrementName( GameWindow *window ) strcat( name, "1" ); goto cleanup; - } // end if + } // // start from the end of the string and back up to the start picking @@ -540,16 +540,16 @@ void GUIEditWindowManager::incrementName( GameWindow *window ) hasNumberSuffix = TRUE; numberBuffer[ j-- ] = c; - } // end if + } else { numberStartIndex = i + 1; break; // exit for i - } // end else + } - } // end for i + } // // if we have a number suffix change it to a number, increment it, and @@ -577,24 +577,24 @@ void GUIEditWindowManager::incrementName( GameWindow *window ) name[ i + numberStartIndex ] = numberBuffer[ i ]; charsAdded++; - } // end if + } } name[ numberStartIndex + charsAdded ] = 0; // terminate at end of new string - } // end if + } else { // no number at end, easy ... just append a number '1' strcat( name, "1" ); - } // end else + } cleanup: instData->m_decoratedNameString = name; -} // end incrementName +} //------------------------------------------------------------------------------------------------- /** Validate the names for all the windows and child windows in the copy @@ -644,9 +644,9 @@ void GUIEditWindowManager::validateClipboardNames( GameWindow *root ) MessageBox( TheEditor->getWindowHandle(), buffer, "Error Mapping Names", MB_OK ); nameOK = TRUE; - } // end if + } - } // end if + } // validate our children names GameWindow *child; @@ -656,7 +656,7 @@ void GUIEditWindowManager::validateClipboardNames( GameWindow *root ) // validate the next window in the list validateClipboardNames( root->winGetNext() ); -} // end validateClipboardNames +} //------------------------------------------------------------------------------------------------- /** Paste the contents of the clipboard into the window world */ @@ -676,7 +676,7 @@ void GUIEditWindowManager::pasteClipboard( void ) MB_OK ); return; - } // end if + } // create a duplicate of everything in the clipboard assert( m_clipboardDup == NULL ); @@ -727,7 +727,7 @@ void GUIEditWindowManager::pasteClipboard( void ) // notify the hierarchy of the new window added TheHierarchyView->addWindow( window, HIERARCHY_ADD_AT_TOP ); - } // end for window + } // the clipboard duplicate list is only for the act of pasting assert( m_clipboardDup == NULL ); @@ -754,13 +754,13 @@ void GUIEditWindowManager::pasteClipboard( void ) // notify the editor that each of the windows was created TheEditor->notifyNewWindow( window ); - } // end while + } // if we did in fact paste a window then our file contents have changed if( firstWindow ) TheEditor->setUnsaved( TRUE ); -} // end pasteClipboard +} //------------------------------------------------------------------------------------------------- /** Convinience funtion to copy the Draw state info for a given instance */ @@ -828,7 +828,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, source->winGetFont(), FALSE ); - } // end if + } else if( BitIsSet( style, GWS_RADIO_BUTTON ) ) { RadioButtonData *radioData = (RadioButtonData *)source->winGetUserData(); @@ -849,7 +849,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, source->winGetFont(), FALSE ); - } // end else if + } else if( BitIsSet( style, GWS_CHECK_BOX ) ) { @@ -864,7 +864,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, source->winGetFont(), FALSE ); - } // end else if + } else if( BitIsSet( style, GWS_HORZ_SLIDER | GWS_VERT_SLIDER ) ) { SliderData *sliderData = (SliderData *)source->winGetUserData(); @@ -913,11 +913,11 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, &sourceInstData->m_hiliteDrawData, sizeof( WinDrawData ) * MAX_DRAW_DATA ); - } // end if + } - } // end if + } - } // end else if + } else if( BitIsSet( style, GWS_COMBO_BOX ) ) { ComboBoxData *comboData = (ComboBoxData *)source->winGetUserData(); @@ -1033,7 +1033,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, &sourceInstData->m_hiliteDrawData, sizeof( WinDrawData ) * MAX_DRAW_DATA ); - } // if + } // down button GameWindow *downButton = comboData->listboxData->downButton; @@ -1055,7 +1055,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, &sourceInstData->m_hiliteDrawData, sizeof( WinDrawData ) * MAX_DRAW_DATA ); - } // if + } // slider GameWindow *slider = comboData->listboxData->slider; @@ -1097,15 +1097,15 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, &sourceInstData->m_hiliteDrawData, sizeof( WinDrawData ) * MAX_DRAW_DATA ); - } // end if + } - } // if + } - } // if + } - } // end if + } - } // end else if + } else if( BitIsSet( style, GWS_SCROLL_LISTBOX ) ) { ListboxData *listData = (ListboxData *)source->winGetUserData(); @@ -1185,7 +1185,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, &sourceInstData->m_hiliteDrawData, sizeof( WinDrawData ) * MAX_DRAW_DATA ); - } // if + } // down button GameWindow *downButton = listData->downButton; @@ -1207,7 +1207,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, &sourceInstData->m_hiliteDrawData, sizeof( WinDrawData ) * MAX_DRAW_DATA ); - } // if + } // slider GameWindow *slider = listData->slider; @@ -1249,13 +1249,13 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, &sourceInstData->m_hiliteDrawData, sizeof( WinDrawData ) * MAX_DRAW_DATA ); - } // end if + } - } // if + } - } // end if + } - } // end else if + } else if( BitIsSet( style, GWS_ENTRY_FIELD ) ) { EntryData *entryData = (EntryData *)source->winGetUserData(); @@ -1280,7 +1280,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, source->winGetFont(), FALSE ); - } // end else if + } else if( BitIsSet( style, GWS_STATIC_TEXT ) ) { TextData *textData = (TextData *)source->winGetUserData(); @@ -1300,7 +1300,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, source->winGetFont(), FALSE ); - } // end else if + } else if( BitIsSet( style, GWS_PROGRESS_BAR ) ) { @@ -1315,7 +1315,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, source->winGetFont(), FALSE ); - } // end else if + } else if( BitIsSet( style, GWS_USER_WINDOW ) ) { @@ -1329,7 +1329,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, NULL, &instDataCopy ); - } // end else if + } else { @@ -1340,7 +1340,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, memset( &instDataCopy, 0, sizeof( instDataCopy ) ); // see comment below return NULL; - } // end else + } // sanity if( duplicate == NULL ) @@ -1352,7 +1352,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, memset( &instDataCopy, 0, sizeof( instDataCopy ) ); // see comment below return NULL; - } // end if + } // // since we're using the real window system here to create things, we @@ -1376,7 +1376,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, *editData = *sourceEditData; // memcpy( editData, sourceEditData, sizeof( GameWindowEditData ) ); - } // end if + } // // duplicate all the children for the window, except if this window @@ -1391,7 +1391,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, for( child = source->winGetChild(); child; child = child->winGetNext() ) duplicateWindow( child, duplicate ); - } // end if + } // // the inst data copy was literally a copy, now it's going to go out of @@ -1403,7 +1403,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, // return the duped window return duplicate; -} // end duplicateWindow +} //------------------------------------------------------------------------------------------------- /** Create a duplicate everything on the clipboard list and put it @@ -1435,9 +1435,9 @@ void GUIEditWindowManager::createClipboardDuplicate( void ) if( duplicate ) linkToClipboard( duplicate, &m_clipboardDup ); - } // end for + } -} // end createClipboardDuplicate +} //------------------------------------------------------------------------------------------------- /** Make the 'target' a child of the 'parent' */ @@ -1473,7 +1473,7 @@ void GUIEditWindowManager::makeChildOf( GameWindow *target, target->winSetPosition( screenPos.x, screenPos.y ); return; - } // end if + } // check to see if this is already out parent, nothing to do if( prevParent == parent ) @@ -1489,7 +1489,7 @@ void GUIEditWindowManager::makeChildOf( GameWindow *target, MB_OK ); return; - } // end if + } // get the target screen position before the move to child ICoord2D screenPosBeforeMove; @@ -1528,7 +1528,7 @@ void GUIEditWindowManager::makeChildOf( GameWindow *target, // move the target TheEditor->moveWindowTo( target, safeLoc.x, safeLoc.y ); -} // end makeChildOf +} //------------------------------------------------------------------------------------------------- /** Move the 'windowToMove' to be just in front of the 'aheadOf' window @@ -1570,14 +1570,14 @@ void GUIEditWindowManager::moveAheadOf( GameWindow *windowToMove, // windowToMove->winSetPosition( pos.x, pos.y ); - } // end if + } else { // just take off the main list unlinkWindow( windowToMove ); - } // end else + } // insert the window at the specified location insertWindowAheadOf( windowToMove, aheadOf ); @@ -1613,5 +1613,5 @@ void GUIEditWindowManager::moveAheadOf( GameWindow *windowToMove, // move the target TheEditor->moveWindowTo( windowToMove, safeLoc.x, safeLoc.y ); -} // end moveAheadOf +} diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp index ac60e73cbea..4cf2cc128ba 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp @@ -107,7 +107,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, return 0; - } // end move + } // ------------------------------------------------------------------------ case WM_SIZE: @@ -141,13 +141,13 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, width - (border * 2), (height - border) - p.y, TRUE ); - } // end if + } - } // end if + } return 0; - } // end size + } // ------------------------------------------------------------------------ case WM_MOUSEMOVE: @@ -191,13 +191,13 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, else SetCursor( LoadCursor( NULL, IDC_NO ) ); - } // end if + } - } // end if + } return 0; - } // end mouse move + } // ------------------------------------------------------------------------ case WM_LBUTTONUP: @@ -270,21 +270,21 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, clearDragWindow = FALSE; TheHierarchyView->setPopupTarget( overWindow ); - } // end if + } else { // our only option is to move the window here TheGUIEditWindowManager->moveAheadOf( dragWindow, overWindow ); - } // end else + } // we've made a change now TheEditor->setUnsaved( TRUE ); - } // end if + } - } // end if + } // window has been dragged and operation complete if( clearDragWindow ) @@ -293,7 +293,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, TheHierarchyView->setDragWindow( NULL ); TheHierarchyView->setDragTarget( NULL ); - } // end if + } // release window capture ReleaseCapture(); @@ -301,11 +301,11 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, // set the cursor back to normal SetCursor( LoadCursor( NULL, IDC_ARROW ) ); - } // end if, drag in progress + } return 0; - } // end left button up + } // ------------------------------------------------------------------------ case WM_RBUTTONUP: @@ -352,11 +352,11 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, ClientToScreen( hWndDialog, &screen ); TrackPopupMenuEx( subMenu, 0, screen.x, screen.y, hWndDialog, NULL ); - } // end if + } return 0; - } // end right button up + } // ------------------------------------------------------------------------ case WM_NOTIFY: @@ -396,11 +396,11 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, if( window ) TheEditor->selectWindow( window ); - } // end if + } break; - } // end selection changed + } // ---------------------------------------------------------------- case NM_DBLCLK: @@ -436,11 +436,11 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, GetCursorPos( &screen ); TrackPopupMenuEx( subMenu, 0, screen.x, screen.y, hWndDialog, NULL ); - } // end if + } break; - } // end double click + } // ---------------------------------------------------------------- case TVN_BEGINDRAG: @@ -460,17 +460,17 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, break; - } // end begin left mouse drag + } - } // end switch + } - } // end hierarchy + } - } // end switch + } return 0; - } // end notify + } // ------------------------------------------------------------------------ case WM_COMMAND: @@ -499,7 +499,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, break; - } // end hierarchy move window in heirarchy + } // -------------------------------------------------------------------- case HIERARCHY_MAKE_CHILD_HERE: @@ -518,7 +518,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, break; - } // end hierarchy, make child of + } // -------------------------------------------------------------------- case HIERARCHY_POPUP_MOVE: @@ -545,7 +545,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, break; - } // end move + } // -------------------------------------------------------------------- case HIERARCHY_POPUP_DELETE: @@ -557,7 +557,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, break; - } // end delete + } // -------------------------------------------------------------------- case HIERARCHY_POPUP_PROPERTIES: @@ -572,11 +572,11 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, ScreenToClient( TheEditWindow->getWindowHandle(), &p ); InitPropertiesDialog( target, p.x, p.y ); - } // end if + } break; - } // end properties + } // -------------------------------------------------------------------- case IDOK: @@ -586,19 +586,19 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, case IDCANCEL: break; - } // end switch( LOWORD( wParam ) ) + } return 0; - } // end of WM_COMMAND + } // ------------------------------------------------------------------------ default: return 0; - } // end of switch + } -} // end dialogProc +} // HierarchyView::findItemEntry =============================================== /** Workhorse to find the tree item anywhere in the tree with the @@ -637,14 +637,14 @@ HTREEITEM HierarchyView::findItemEntry( HTREEITEM node, GameWindow *window ) if( found ) return found; - } // end if + } // not there, check the siblings return findItemEntry( TreeView_GetNextItem( m_tree, node, TVGN_NEXT ), window ); #endif -} // end findItemEntry +} // HierarchyView::findTreeEntry =============================================== /** Find the game window entry in the hierarchy tree, if found the @@ -660,7 +660,7 @@ HTREEITEM HierarchyView::findTreeEntry( GameWindow *window ) // get root and search from there return findItemEntry( TreeView_GetRoot( m_tree ), window ); -} // end findTreeEntry +} // HierarchyView::addWindowToTree ============================================= /** Add a single window to the hierarchy tree */ @@ -709,13 +709,13 @@ void HierarchyView::addWindowToTree( GameWindow *window, assert( 0 ); return; - } // end if + } #if USE_FAST_FIND_ITEM m_treeHash[window] = newItem; #endif - } // end if, not in already + } // // add children if requested, but not on gadgets no matter what becuase @@ -728,14 +728,14 @@ void HierarchyView::addWindowToTree( GameWindow *window, for( child = window->winGetChild(); child; child = child->winGetNext() ) addWindowToTree( child, newItem, HIERARCHY_ADD_AT_BOTTOM, TRUE, TRUE ); - } // end if + } // add siblings if requested if( addSiblings ) addWindowToTree( window->winGetNext(), treeParent, option, addChildren, addSiblings ); -} // end addWindowToTree +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -755,7 +755,7 @@ HierarchyView::HierarchyView( void ) m_dragTarget = NULL; m_popupTarget = NULL; -} // end HierarchyView +} // HierarchyView::~HierarchyView ============================================== /** */ @@ -766,7 +766,7 @@ HierarchyView::~HierarchyView( void ) // call the shutdown shutdown(); -} // end ~HierarchyView +} // HierarchyView::init ========================================================= /** Create the control palette */ @@ -809,7 +809,7 @@ void HierarchyView::init( void ) // keep a handle to the tree m_tree = GetDlgItem( m_dialog, TREE_HIERARCHY ); -} // end init +} // HierarchyView::reset ======================================================= /** Reset everything about our hierarchy view */ @@ -825,7 +825,7 @@ void HierarchyView::reset( void ) m_treeHash.clear(); #endif -} // end reset +} // HierarchyView::shutdown ==================================================== /** Destroy the control palette and all data associated with it */ @@ -838,7 +838,7 @@ void HierarchyView::shutdown( void ) m_dialog = NULL; m_tree = NULL; -} // end shutdown +} // HierarchyView::getWindowTreeName =========================================== /** Given a window, return a string representation for that window in @@ -894,11 +894,11 @@ char *HierarchyView::getWindowTreeName( GameWindow *window ) strcat( buffer, ": " ); strcat( buffer, instData->m_decoratedNameString.str() ); - } // end if + } return buffer; -} // end getWindowTreeName +} // HierarchyView::addWindow =================================================== /** Add a window to the hierarchy view AND any of it's children */ @@ -927,7 +927,7 @@ void HierarchyView::addWindow( GameWindow *window, HierarchyOption option ) // InvalidateRect( m_tree, NULL, TRUE ); -} // end addWindow +} // HierarchyView::removeWindow ================================================ /** Remove the window from the hierarchy tree view */ @@ -968,7 +968,7 @@ void HierarchyView::removeWindow( GameWindow *window ) m_treeHash.erase(find); #endif -} // end removeWindow +} // HierarchyView::bringWindowToTop ============================================ /** Bring the window to the top of its parent list in the hierarchy @@ -990,7 +990,7 @@ void HierarchyView::bringWindowToTop( GameWindow *window ) assert( 0 ); return; - } // end if + } // remove the entry from the tree removeWindow( window ); @@ -1001,7 +1001,7 @@ void HierarchyView::bringWindowToTop( GameWindow *window ) // add the window as a child of the parent entry at the top of it's list addWindowToTree( window, itemParent, HIERARCHY_ADD_AT_TOP, TRUE, FALSE ); -} // end bringWindowToTop +} // HierarchyView::updateWindowName ============================================ /** A window name may have been updated, reconstruct its hierarchy @@ -1023,7 +1023,7 @@ void HierarchyView::updateWindowName( GameWindow *window ) assert( 0 ); return; - } // end if + } // setup the item to modify in the tree TVITEM modify; @@ -1034,7 +1034,7 @@ void HierarchyView::updateWindowName( GameWindow *window ) // modify the item TreeView_SetItem( m_tree, &modify ); -} // end updateWindowName +} // HierarchyView::getDialogPos ================================================ /** Get the dialog position as recorded from the static */ @@ -1048,7 +1048,7 @@ void HierarchyView::getDialogPos( ICoord2D *pos ) *pos = dialogPos; -} // end getDialogPos +} // HierarchyView::getDialogSize =============================================== /** Get the dialog size as recorded from the static */ @@ -1062,7 +1062,7 @@ void HierarchyView::getDialogSize( ICoord2D *size ) *size = dialogSize; -} // end getDialogSize +} // HierarchyView::setDialogPos ================================================ /** */ @@ -1077,7 +1077,7 @@ void HierarchyView::setDialogPos( ICoord2D *pos ) MoveWindow( m_dialog, dialogPos.x, dialogPos.y, dialogSize.x, dialogSize.y, TRUE ); -} // end setDialogPos +} // HierarchyView::setDialogSize =============================================== /** */ @@ -1092,7 +1092,7 @@ void HierarchyView::setDialogSize( ICoord2D *size ) MoveWindow( m_dialog, dialogPos.x, dialogPos.y, dialogSize.x, dialogSize.y, TRUE ); -} // end setDialogSize +} // HierarchyView::moveWindowAheadOf =========================================== /** Move the window hierarchy representation to be just ahead of the @@ -1116,7 +1116,7 @@ void HierarchyView::moveWindowAheadOf( GameWindow *window, addWindow( window, HIERARCHY_ADD_AT_TOP ); return; - } // end if + } // get the hierarchy item of the aheadOf window HTREEITEM aheadOfItem = findTreeEntry( aheadOf ); @@ -1127,7 +1127,7 @@ void HierarchyView::moveWindowAheadOf( GameWindow *window, assert( 0 ); return; - } // end iof + } // // get the parent item we will be inserting the new entry at, a parent @@ -1163,7 +1163,7 @@ void HierarchyView::moveWindowAheadOf( GameWindow *window, assert( 0 ); return; - } // end if + } // // add ALL the children of this window as well, do not worry about @@ -1175,9 +1175,9 @@ void HierarchyView::moveWindowAheadOf( GameWindow *window, addWindowToTree( child, newItem, HIERARCHY_ADD_AT_BOTTOM, TRUE, TRUE ); - } // end if + } -} // end moveWindowAheadOf +} // HierarchyView::moveWindowChildOf =========================================== /** Move the hierarchy entry for window so that it is now the first @@ -1200,7 +1200,7 @@ void HierarchyView::moveWindowChildOf( GameWindow *window, GameWindow *parent ) addWindow( window, HIERARCHY_ADD_AT_TOP ); return; - } // end if + } // find the entry of the parent HTREEITEM parentItem = findTreeEntry( parent ); @@ -1211,13 +1211,13 @@ void HierarchyView::moveWindowChildOf( GameWindow *window, GameWindow *parent ) assert( 0 ); return; - } // end if + } // add the window as child of the parent at the top, dont forget to // also add the children of the window too! addWindowToTree( window, parentItem, HIERARCHY_ADD_AT_TOP, TRUE, FALSE ); -} // end moveWindowChildOf +} // HierarchyView::treePointToItem ============================================= /** Given the location (x,y) in TREE COORDINATES, correlate that to @@ -1234,7 +1234,7 @@ HTREEITEM HierarchyView::treePointToItem( Int x, Int y ) hitTest.flags = TVHT_ONITEM; return TreeView_HitTest( TheHierarchyView->getTreeHandle(), &hitTest ); -} // end treePointToItem +} // HierarchyView::getWindowFromItem =========================================== /** Get the game window we stored as the user data lParam in the tree @@ -1260,7 +1260,7 @@ GameWindow *HierarchyView::getWindowFromItem( HTREEITEM treeItem ) return window; -} // end getWindowFromItem +} // HierarchyView::selectWindow ================================================ /** Select the tree item */ @@ -1277,7 +1277,7 @@ void HierarchyView::selectWindow( GameWindow *window ) TreeView_SelectItem( m_tree, item ); TreeView_Expand( m_tree, item, 0 ); -} // end selectWindow +} // HierarchyView::validateDragDropOperation =================================== /** Return TRUE if the drag drop operation of source onto target @@ -1301,12 +1301,12 @@ Bool HierarchyView::validateDragDropOperation( GameWindow *source, return FALSE; other = other->winGetParent(); - } // end while + } // everything is ok return TRUE; -} // end validateDragDropOperation +} diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/LayoutScheme.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/LayoutScheme.cpp index a3b8925acc9..4d28f1331dd 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/LayoutScheme.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/LayoutScheme.cpp @@ -137,7 +137,7 @@ static void loadSchemeDataToDialog( HWND hWndDialog ) info->color, info->borderColor ); - } // end for i + } // switch to the generic state SwitchToState( GENERIC_ENABLED, hWndDialog ); @@ -156,7 +156,7 @@ static void loadSchemeDataToDialog( HWND hWndDialog ) SendDlgItemMessage( hWndDialog, COMBO_FONT, CB_RESETCONTENT, 0, 0 ); LoadFontCombo( GetDlgItem( hWndDialog, COMBO_FONT ), theScheme->getFont() ); -} // end loadSchemeDataToDialog +} // saveData =================================================================== //============================================================================= @@ -179,7 +179,7 @@ static void saveData( HWND hWndDialog ) info->color, info->borderColor ); - } // end for i + } // save default text colors theScheme->setEnabledTextColor( GetPropsEnabledTextColor() ); @@ -192,7 +192,7 @@ static void saveData( HWND hWndDialog ) // save the font theScheme->setFont( GetSelectedFontFromCombo( GetDlgItem( hWndDialog, COMBO_FONT ) ) ); -} // end saveData +} // saveAsDialog =============================================================== /** Bring up the standard windows browser save as dialog and return @@ -234,7 +234,7 @@ char *saveAsDialog( void ) else return NULL; -} // end saveAsDialog +} // openDialog ================================================================= /** Bring up the standard windows browser open dialog and return @@ -276,7 +276,7 @@ char *openDialog( void ) else return NULL; -} // end openDialog +} // layoutSchemeCallback ======================================================= /** Dialog callback for layout scheme dialog */ @@ -307,7 +307,7 @@ static LRESULT CALLBACK layoutSchemeCallback( HWND hWndDialog, loadSchemeDataToDialog( hWndDialog ); break; - } // end init dialog + } // ------------------------------------------------------------------------ case WM_COMMAND: @@ -355,7 +355,7 @@ static LRESULT CALLBACK layoutSchemeCallback( HWND hWndDialog, break; - } // end apply scheme + } // -------------------------------------------------------------------- case BUTTON_SAVE: @@ -370,11 +370,11 @@ static LRESULT CALLBACK layoutSchemeCallback( HWND hWndDialog, SetDlgItemText( hWndDialog, STATIC_CURRENT_SCHEME, theScheme->getSchemeFilename() ); - } // end if + } break; - } // end save + } // -------------------------------------------------------------------- case BUTTON_LOAD: @@ -391,20 +391,20 @@ static LRESULT CALLBACK layoutSchemeCallback( HWND hWndDialog, // load the dialog engine and items with the current data of the scheme loadSchemeDataToDialog( hWndDialog ); - } // end if + } else { MessageBox( TheEditor->getWindowHandle(), "Unable to open scheme file.", "Error", MB_OK ); - } // end else + } - } // end if + } break; - } // end load + } // -------------------------------------------------------------------- case IDOK: @@ -421,17 +421,17 @@ static LRESULT CALLBACK layoutSchemeCallback( HWND hWndDialog, EndDialog( hWndDialog, FALSE ); break; - } // end switch + } break; - } // end command + } - } // end switch, message + } return 0; -} // end layoutSchemeCallback +} // LayoutScheme::applyPropertyTablesToWindow ================================== /** apply the image and color info stored in the state identifer tables @@ -478,7 +478,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetButtonSetHiliteSelectedColor( root, info->color ); GadgetButtonSetHiliteSelectedBorderColor( root, info->borderColor ); - } // end if + } else if( BitIsSet( root->winGetStyle(), GWS_RADIO_BUTTON ) ) { @@ -521,7 +521,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetRadioSetHiliteCheckedBoxColor( root, info->color ); GadgetRadioSetHiliteCheckedBoxBorderColor( root, info->borderColor ); - } // end else if + } else if( BitIsSet( root->winGetStyle(), GWS_CHECK_BOX ) ) { @@ -564,7 +564,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetCheckBoxSetHiliteCheckedBoxColor( root, info->color ); GadgetCheckBoxSetHiliteCheckedBoxBorderColor( root, info->borderColor ); - } // end else if + } else if( BitIsSet( root->winGetStyle(), GWS_VERT_SLIDER ) ) { @@ -628,7 +628,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetSliderSetHiliteSelectedThumbColor( root, info->color ); GadgetSliderSetHiliteSelectedThumbBorderColor( root, info->borderColor ); - } // end else if + } else if( BitIsSet( root->winGetStyle(), GWS_HORZ_SLIDER ) ) { @@ -692,7 +692,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetSliderSetHiliteSelectedThumbColor( root, info->color ); GadgetSliderSetHiliteSelectedThumbBorderColor( root, info->borderColor ); - } // end else if + } else if( BitIsSet( root->winGetStyle(), GWS_SCROLL_LISTBOX ) ) { @@ -772,7 +772,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetButtonSetHiliteSelectedColor( upButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( upButton, info->borderColor ); - } // end if + } GameWindow *downButton = GadgetListBoxGetDownButton( root ); if( downButton ) @@ -805,7 +805,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetButtonSetHiliteSelectedColor( downButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( downButton, info->borderColor ); - } // end if + } GameWindow *slider = GadgetListBoxGetSlider( root ); if( slider ) @@ -871,9 +871,9 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetSliderSetHiliteSelectedThumbColor( slider, info->color ); GadgetSliderSetHiliteSelectedThumbBorderColor( slider, info->borderColor ); - } // end if + } - } // end else if + } else if( BitIsSet( root->winGetStyle(), GWS_COMBO_BOX ) ) { info = GetStateInfo( COMBOBOX_ENABLED ); @@ -950,7 +950,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetButtonSetHiliteSelectedImage( dropDownButton, info->image ); GadgetButtonSetHiliteSelectedColor( dropDownButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( dropDownButton, info->borderColor ); - }// end if + } GameWindow *editBox = GadgetComboBoxGetEditBox( root ); if ( editBox ) @@ -987,7 +987,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetTextEntrySetHiliteImageCenter( editBox, info->image ); info = GetStateInfo( COMBOBOX_EDIT_BOX_HILITE_SMALL_CENTER ); GadgetTextEntrySetHiliteImageSmallCenter( editBox, info->image ); - } // end if + } GameWindow *listBox = GadgetComboBoxGetListBox( root ); if( listBox ) @@ -1068,7 +1068,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetButtonSetHiliteSelectedColor( upButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( upButton, info->borderColor ); - } // end if + } GameWindow *downButton = GadgetListBoxGetDownButton( listBox ); if( downButton ) @@ -1101,7 +1101,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetButtonSetHiliteSelectedColor( downButton, info->color ); GadgetButtonSetHiliteSelectedBorderColor( downButton, info->borderColor ); - } // end if + } GameWindow *slider = GadgetListBoxGetSlider( listBox ); if( slider ) @@ -1167,9 +1167,9 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetSliderSetHiliteSelectedThumbColor( slider, info->color ); GadgetSliderSetHiliteSelectedThumbBorderColor( slider, info->borderColor ); - } // end if - }// end if (combo listbox) - }// end if + } + } + } else if( BitIsSet( root->winGetStyle(), GWS_ENTRY_FIELD ) ) { @@ -1206,7 +1206,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) info = GetStateInfo( TEXT_ENTRY_HILITE_SMALL_CENTER ); GadgetTextEntrySetHiliteImageSmallCenter( root, info->image ); - } // end else if + } else if( BitIsSet( root->winGetStyle(), GWS_STATIC_TEXT ) ) { @@ -1225,7 +1225,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) GadgetStaticTextSetHiliteColor( root, info->color ); GadgetStaticTextSetHiliteBorderColor( root, info->borderColor ); - } // end else if + } else if( BitIsSet( root->winGetStyle(), GWS_PROGRESS_BAR ) ) { @@ -1292,7 +1292,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) info = GetStateInfo( PROGRESS_BAR_HILITE_BAR_SMALL_CENTER ); GadgetProgressBarSetHiliteBarImageSmallCenter( root, info->image ); - } // end else if + } else if( BitIsSet( root->winGetStyle(), GWS_TAB_CONTROL ) ) { info = GetStateInfo( TC_TAB_0_ENABLED ); @@ -1454,7 +1454,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) root->winSetHiliteColor( 0, info->color ); root->winSetHiliteBorderColor( 0, info->borderColor ); - } // end else + } // // apply changes to children of this window, unless this @@ -1469,7 +1469,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) // force an update of the edit window TheEditWindow->draw(); -} // end applyPropertyTablesToWindow +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -1491,7 +1491,7 @@ LayoutScheme::LayoutScheme( void ) m_hiliteText.borderColor = GAME_COLOR_UNDEFINED; m_font = NULL; -} // end LayoutScheme +} // LayoutScheme::~LayoutScheme ================================================ /** */ @@ -1511,11 +1511,11 @@ LayoutScheme::~LayoutScheme( void ) m_imageAndColorTable[ i ].stateNameBuffer = NULL; m_imageAndColorTable[ i ].stateName = NULL; - } // end if + } - } // end for i + } -} // end ~LayoutScheme +} // LayoutScheme::init ========================================================= /** Init */ @@ -1541,7 +1541,7 @@ void LayoutScheme::init( void ) m_imageAndColorTable[ i ].stateName = m_imageAndColorTable[ i ].stateNameBuffer; strcpy(m_imageAndColorTable[ i ].stateNameBuffer, info->stateName ); - } // end for i + } // assign a default set of colors UnsignedByte alpha = 255; @@ -2149,7 +2149,7 @@ void LayoutScheme::init( void ) // default font m_font = TheWindowManager->winFindFont( AsciiString("Times New Roman"), 14, FALSE ); -} // end init +} // LayoutScheme::openDialog =================================================== /** Bring up the layout scheme dialog box */ @@ -2166,7 +2166,7 @@ void LayoutScheme::openDialog( void ) theScheme = NULL; -} // end openDialog +} // LayoutScheme::findEntry ==================================================== /** Find the entry for the state */ @@ -2182,7 +2182,7 @@ ImageAndColorInfo *LayoutScheme::findEntry( StateIdentifier id ) assert( 0 ); return NULL; - } // end if + } // search the state table for( Int i = 0; i < NUM_STATE_IDENTIFIERS; i++ ) @@ -2191,11 +2191,11 @@ ImageAndColorInfo *LayoutScheme::findEntry( StateIdentifier id ) if( m_imageAndColorTable[ i ].stateID == id ) return &m_imageAndColorTable[ i ]; - } // end for i + } return NULL; // not found -} // end findEntry +} // LayoutScheme::getImageAndColor ============================================= /** Get the color and color info for the state */ @@ -2211,12 +2211,12 @@ ImageAndColorInfo *LayoutScheme::getImageAndColor( StateIdentifier id ) assert( 0 ); return NULL; - } // end if + } // return the entry for the state return findEntry( id ); -} // end getImageAndColor +} // LayoutScheme::storeImageAndColor =========================================== /** Store the image and colors of the specific state in our own data array */ @@ -2233,7 +2233,7 @@ void LayoutScheme::storeImageAndColor( StateIdentifier id, const Image *image, assert( 0 ); return; - } // end if + } // store the info ImageAndColorInfo *entry = findEntry( id ); @@ -2244,9 +2244,9 @@ void LayoutScheme::storeImageAndColor( StateIdentifier id, const Image *image, entry->color = color; entry->borderColor = borderColor; - } // en dif + } -} // end storeImageAndColor +} // LayoutScheme::saveScheme =================================================== /** Save the scheme to the filename provided */ @@ -2267,7 +2267,7 @@ Bool LayoutScheme::saveScheme( char *filename ) "Unable to open scheme for for saving. Read only?", "Save Error", MB_OK ); return FALSE; - } // end if + } // save the filename we're using now setSchemeFilename( filename ); @@ -2321,14 +2321,14 @@ Bool LayoutScheme::saveScheme( char *filename ) i, info->image ? info->image->getName().str() : "NONE", colorR, colorG, colorB, colorA, bColorR, bColorG, bColorB, bColorA ); - } // end for i + } // close the file fclose( fp ); return TRUE; -} // end saveScheme +} // LayoutScheme::loadScheme =================================================== /** Load the layout scheme into this class instance */ @@ -2359,7 +2359,7 @@ Bool LayoutScheme::loadScheme( char *filename ) "Old layout version, cannot open.", "Old File", MB_OK ); return FALSE; - } // end if + } } // default text colors @@ -2405,7 +2405,7 @@ Bool LayoutScheme::loadScheme( char *filename ) fontBuffer[ index++ ] = c; c = fgetc( fp ); - } // end while + } fontBuffer[ index ] = '\0'; c = fgetc( fp ); // the end quite itself @@ -2438,7 +2438,7 @@ Bool LayoutScheme::loadScheme( char *filename ) GameMakeColor( colorR, colorG, colorB, colorA ), GameMakeColor( bColorR, bColorG, bColorB, bColorA ) ); } - } // end for i + } } // close the file @@ -2446,5 +2446,5 @@ Bool LayoutScheme::loadScheme( char *filename ) return TRUE; -} // end loadScheme +} diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp index 8603ab94d21..e1ebb9c55ee 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp @@ -437,7 +437,7 @@ void InitPropertiesDialog( GameWindow *window, Int x, Int y ) assert( 0 ); return; - } // end if + } // save the window we're working with TheEditor->setPropertyTarget( window ); @@ -448,7 +448,7 @@ void InitPropertiesDialog( GameWindow *window, Int x, Int y ) // PositionWindowOnScreen( dialog, screen.x, screen.y ); -} // end InitPropertiesDialog +} // LoadFontCombo ============================================================== /** Load the font combo with fonts currently available */ @@ -486,7 +486,7 @@ void LoadFontCombo( HWND comboBox, GameFont *currFont ) // attach pointer to font at combo index SendMessage( comboBox, CB_SETITEMDATA, index, (DWORD)font ); - } // end for font + } // add a "[None]" at the top index SendMessage( comboBox, CB_INSERTSTRING, 0, (LPARAM)"[None]" ); @@ -497,7 +497,7 @@ void LoadFontCombo( HWND comboBox, GameFont *currFont ) SendMessage( comboBox, CB_SETCURSEL, 0, 0 ); - } // end if + } else { Int count; @@ -518,13 +518,13 @@ void LoadFontCombo( HWND comboBox, GameFont *currFont ) SendMessage( comboBox, CB_SETCURSEL, i, 0 ); break; // exit for i - } // end if + } - } // end for i + } - } // end else + } -} // end LoadFontCombo +} // GetSelectedFontFromCombo =================================================== /** Based on the combo box selection return the game font associated @@ -548,7 +548,7 @@ GameFont *GetSelectedFontFromCombo( HWND combo ) // get the font from the selected item return (GameFont *)SendMessage( combo, CB_GETITEMDATA, selected, 0 ); -} // end GetSelectedFontFromCombo +} // saveFontSelection ========================================================== /** Save the font from the currently selected item in the font dialog */ @@ -565,7 +565,7 @@ static void saveFontSelection( HWND combo, GameWindow *window ) font = GetSelectedFontFromCombo( combo ); window->winSetFont( font ); -} // end saveFontSelection +} // saveHeaderSelection ======================================================== /** Save the Header from the currently selected item in the font dialog */ @@ -592,7 +592,7 @@ static void saveHeaderSelection( HWND comboBox, GameWindow *window ) // return the image loc that matches the string window->winGetInstanceData()->m_headerTemplateName.set(buffer); -} // end ComboBoxSelectionToImage +} // loadTooltipTextLabel ============================================================== /** Load the edit control with the window text label */ @@ -611,7 +611,7 @@ static void loadTooltipTextLabel( HWND edit, GameWindow *window ) WinInstanceData *instData = window->winGetInstanceData(); SendMessage( edit, WM_SETTEXT, 0, (LPARAM)instData->m_tooltipString.str() ); -} // end loadTooltipTextLabel +} // loadTooltipDelayTextLabel ============================================================== /** Load the edit control with the window text label */ @@ -630,7 +630,7 @@ static void loadTooltipDelayTextLabel( HWND dialog, HWND edit, GameWindow *windo // WinInstanceData *instData = window->winGetInstanceData(); // SetDlgItemInt( dialog, edit, instData->m_tooltipDelay, TRUE ); -} // end loadTooltipDelayTextLabel +} // saveTooltipTextLabel ============================================================== /** Save the text label entry */ @@ -649,7 +649,7 @@ static void saveTooltipTextLabel( HWND edit, GameWindow *window ) instData->m_tooltipString.set(buffer); instData->setTooltipText(TheGameText->fetch(buffer) ); -} // end saveTooltipTextLabel +} // saveTooltipTextLabel ============================================================== /** Save the text label entry */ @@ -664,7 +664,7 @@ static void saveTooltipDelayTextLabel(HWND dialog, HWND edit, GameWindow *window // instData->m_tooltipDelay = GetDlgItemInt( dialog, edit, NULL, TRUE ); -} // end saveTooltipDelayTextLabel +} // loadTextLabel ============================================================== @@ -683,7 +683,7 @@ static void loadTextLabel( HWND edit, GameWindow *window ) // load the text WinInstanceData *instData = window->winGetInstanceData(); SendMessage( edit, WM_SETTEXT, 0, (LPARAM)instData->m_textLabelString.str() ); -} // end loadTextLabel +} // saveTextLabel ============================================================== /** Save the text label entry */ @@ -722,7 +722,7 @@ static void saveTextLabel( HWND edit, GameWindow *window ) else window->winSetText( text ); -} // end saveTextLavel +} // LoadTextStateCombo ========================================================= /** Load the text state combo */ @@ -756,7 +756,7 @@ void LoadTextStateCombo( HWND comboBox, currTextIndex = 0; SendMessage( comboBox, CB_SETCURSEL, currTextIndex, 0 ); -} // end LoadTextStateCombo +} // LoadStateCombo ============================================================= /** Load the state combo box passed in based on the window type @@ -786,11 +786,11 @@ void LoadStateCombo( UnsignedInt style, HWND comboBox ) // set the state identifier as the item data of this entry SendMessage( comboBox, CB_SETITEMDATA, index, entry->stateID ); - } // end if + } - } // end for entry + } -} // end LoadStateCombo +} // CommonDialogInitialize ===================================================== /** Called from all dialog initializations */ @@ -885,7 +885,7 @@ void CommonDialogInitialize( GameWindow *window, HWND dialog ) -} // end CommonDialogInitialize +} // validateName =============================================================== /** Validate a name before saving it into a window. All window names @@ -907,7 +907,7 @@ static Bool validateName( GameWindow *root, GameWindow *exception, char *name ) MessageBox( TheEditor->getWindowHandle(), buffer, "Illegal Character", MB_OK ); return FALSE; - } // end if + } // if this root window is not the exception window compare name if( root != exception ) @@ -922,10 +922,10 @@ static Bool validateName( GameWindow *root, GameWindow *exception, char *name ) MessageBox( TheEditor->getWindowHandle(), buffer, "Duplicate Name", MB_OK ); return FALSE; - } // end if + } - } // end if + } // check our children GameWindow *child; @@ -936,7 +936,7 @@ static Bool validateName( GameWindow *root, GameWindow *exception, char *name ) // check the next window in the list return validateName( root->winGetNext(), exception, name ); -} // end validateName +} // adjustGadgetDrawMethods ==================================================== /** Based on the WIN_STATUS_IMAGE, set the draw callbacks to the @@ -987,12 +987,12 @@ static void adjustGadgetDrawMethods( Bool useImages, GameWindow *window ) assert( 0 ); return; - } // end else + } // set the image status bit window->winSetStatus( WIN_STATUS_IMAGE ); - } // end if, image set + } else { @@ -1025,20 +1025,20 @@ static void adjustGadgetDrawMethods( Bool useImages, GameWindow *window ) assert( 0 ); return; - } // end else + } // clear the image bit window->winClearStatus( WIN_STATUS_IMAGE ); - } // end else, image not set - }//end if window is gadget + } + } // adjust any child gadgets GameWindow *child; for( child = window->winGetChild(); child; child = child->winGetNext() ) adjustGadgetDrawMethods( useImages, child ); -} // end adjustGadgetDrawMethods +} // SaveCommonDialogProperties ================================================= /** Save properties common on all dialogs for all windows */ @@ -1159,7 +1159,7 @@ Bool SaveCommonDialogProperties( HWND dialog, GameWindow *window ) return TRUE; -} // end SaveCommonDialogProperties +} // LoadImageListComboBox ====================================================== /** Load a combo box with image names from the GUI image collection @@ -1182,7 +1182,7 @@ void LoadImageListComboBox( HWND comboBox ) SendMessage( comboBox, CB_ADDSTRING, 0, (LPARAM)image->getName().str() ); - } // end for image + } // add a [NONE] at the top of the image lists SendMessage( comboBox, CB_INSERTSTRING, 0, (LPARAM)"[NONE]" ); @@ -1190,7 +1190,7 @@ void LoadImageListComboBox( HWND comboBox ) // select the [NONE] label SendMessage( comboBox, CB_SETCURSEL, 0, 0 ); -} // end LoadImageListComboBox +} // LoadHeaderTemplateListComboBox ============================================= /** Load a combo box with header template names @@ -1215,7 +1215,7 @@ void LoadHeaderTemplateListComboBox( HWND comboBox, AsciiString selected ) SendMessage( comboBox, CB_ADDSTRING, 0, (LPARAM)ht->m_name.str()); - } // end for image + } // add a [NONE] at the top of the image lists SendMessage( comboBox, CB_INSERTSTRING, 0, (LPARAM)"[NONE]" ); @@ -1227,7 +1227,7 @@ void LoadHeaderTemplateListComboBox( HWND comboBox, AsciiString selected ) SendMessage( comboBox, CB_SELECTSTRING, -1, (LPARAM)selected.str() ); -} // end LoadHeaderTemplateListComboBox +} // ComboBoxSelectionToImage =================================================== @@ -1261,7 +1261,7 @@ const Image *ComboBoxSelectionToImage( HWND comboBox ) // return the image loc that matches the string return TheMappedImageCollection->findImageByName( AsciiString( buffer ) ); -} // end ComboBoxSelectionToImage +} // GetControlColor ============================================================ /** Search the control color table and return the color for the @@ -1277,12 +1277,12 @@ RGBColorInt *GetControlColor( UnsignedInt controlID ) if( entry->controlID == controlID ) return &entry->color; - } // end for + } // not found return NULL; -} // end GetControlColor +} // SetControlColor ============================================================ /** Set the color in the table with the matching control ID */ @@ -1307,11 +1307,11 @@ void SetControlColor( UnsignedInt controlID, Color color ) entry->color.blue = blue; break; - } // end if + } - } // end for + } -} // end SetControlColor +} // GetStateInfo =============================================================== /** Get a image and color state entry */ @@ -1326,11 +1326,11 @@ ImageAndColorInfo *GetStateInfo( StateIdentifier id ) if( entry->stateID == id ) return entry; - } // end for entry + } return NULL; -} // end GetStateInfo +} // SwitchToState ============================================================== /** Switch the image and color combo box to specified state, invalidate @@ -1353,7 +1353,7 @@ void SwitchToState( StateIdentifier id, HWND dialog ) assert( 0 ); return; - } // end if + } // select the string in the state combo box SendMessage( stateBox, CB_SELECTSTRING, -1, (LPARAM)info->stateName ); @@ -1371,7 +1371,7 @@ void SwitchToState( StateIdentifier id, HWND dialog ) InvalidateRect( colorButton, NULL, TRUE ); InvalidateRect( borderColorButton, NULL, TRUE ); -} // end SwitchToState +} // StoreImageAndColor ========================================================= /** Store the image and colors in the table */ @@ -1392,11 +1392,11 @@ void StoreImageAndColor( StateIdentifier id, const Image *image, entry->borderColor = borderColor; break; // exit for - } // end if + } - } // end for + } -} // end StoreImageAndColor +} // StoreColor ================================================================= /** Store the colors in the table */ @@ -1415,11 +1415,11 @@ void StoreColor( StateIdentifier id, Color color, Color borderColor ) entry->borderColor = borderColor; break; // exit for - } // end if + } - } // end for + } -} // end StoreColor +} // GetCurrentStateInfo ======================================================== /** Get the info on the current state selected in the state combo */ @@ -1440,7 +1440,7 @@ ImageAndColorInfo *GetCurrentStateInfo( HWND dialog ) return GetStateInfo( stateID ); -} // end GetCurrentStateInfo +} // PositionWindowOnScreen ===================================================== /** Position the window on the screen, but keep the window completely @@ -1480,7 +1480,7 @@ void PositionWindowOnScreen( HWND window, Int x, Int y ) // show the window ShowWindow( window, SW_SHOW ); -} // end PositionWindowOnScreen +} // HandleCommonDialogMessages ================================================= /** Handle any messages common to all controls on all property dialogs */ @@ -1513,7 +1513,7 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, else color = info->borderColor; - } // end if + } else if( controlID == BUTTON_TEXT_COLOR || controlID == BUTTON_TEXT_BORDER_COLOR ) { TextDrawData textDraw = textDrawData[ currTextIndex ]; @@ -1523,7 +1523,7 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, else color = textDraw.borderColor; - } // end else if + } if( color != GAME_COLOR_UNDEFINED ) { @@ -1539,7 +1539,7 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, *returnCode = FALSE; break; - } // end if + } // get the color info GameGetColorComponents( color, &r, &g, &b, &a ); @@ -1566,12 +1566,12 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, used = TRUE; break; - } // end if + } *returnCode = FALSE; break; - } // end draw item + } // ------------------------------------------------------------------------ case WM_COMMAND: @@ -1598,11 +1598,11 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, newState = (StateIdentifier)SendMessage( hWndControl, CB_GETITEMDATA, selected, 0 ); SwitchToState( newState, hWndDialog ); - } // end if + } used = TRUE; break; - } // end state + } // -------------------------------------------------------------------- case COMBO_TEXT_STATE: @@ -1619,11 +1619,11 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, InvalidateRect( GetDlgItem( hWndDialog, BUTTON_TEXT_COLOR ), NULL, TRUE ); InvalidateRect( GetDlgItem( hWndDialog, BUTTON_TEXT_BORDER_COLOR ), NULL, TRUE ); - } // end if + } used = TRUE; break; - } // end text state + } // -------------------------------------------------------------------- case COMBO_IMAGE: @@ -1638,12 +1638,12 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, StoreImageAndColor( info->stateID, newImage, info->color, info->borderColor ); - } // end if + } used = TRUE; break; - } // end image + } // -------------------------------------------------------------------- case BUTTON_COLOR: @@ -1698,25 +1698,25 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, // invalidate the color preview InvalidateRect( hWndControl, NULL, TRUE ); - } // end if + } used = TRUE; break; - } // end color buttons + } - } // end switch( LOWORD( wParam ) ) + } *returnCode = 0; break; - } // end of WM_COMMAND + } - } // end of switch + } return used; -} // end HandleCommonDialogMessages +} // GetProprsEnabledTextColor ================================================== //============================================================================= diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp index 442336e4605..42f29d89c43 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp @@ -88,7 +88,7 @@ static void fileNewLine( FILE *fp ) fprintf( fp, "\n" ); fflush( fp ); -} // end fileNewLine +} // writeBufferToFile ========================================================== /** Write the contents of the buffer to the file */ @@ -106,7 +106,7 @@ static void writeBufferToFile( FILE *fp, char *buffer ) // fflush( fp ); -} // end writeBufferToFile +} // clearBufferToSpaces ======================================================== /** Clear the buffer to all spaces */ @@ -118,7 +118,7 @@ static void clearBufferToSpaces( void ) for( i = 0; i < BUFFER_SIZE; i++ ) buffer[ i ] = ' '; -} // end clearBufferToSpaces +} // saveType =================================================================== /** Save type of window */ @@ -159,7 +159,7 @@ static Bool saveType( GameWindow *window, FILE *fp, Int dataIndent ) return TRUE; -} // end saveType +} // savePosition =============================================================== /** Save window position data */ @@ -192,7 +192,7 @@ static Bool savePosition( GameWindow *window, FILE *fp, Int dataIndent ) return TRUE; -} // end savePosition +} // saveName =================================================================== // Save name */ @@ -207,7 +207,7 @@ static Bool saveName( GameWindow *window, FILE *fp, Int dataIndent ) return TRUE; -} // end saveName +} // saveStatus ================================================================= /** Save status information */ @@ -236,10 +236,10 @@ static Bool saveStatus( GameWindow *window, FILE *fp, Int dataIndent ) strcat( buffer, WindowStatusNames[ i ] ); bitWritten = TRUE; - } // end + } i++; - } // end while + } // if no bits written write NONE in the file if( bitWritten == FALSE ) @@ -251,7 +251,7 @@ static Bool saveStatus( GameWindow *window, FILE *fp, Int dataIndent ) return TRUE; -} // end saveStatus +} // saveStyle ================================================================== /** Save style information */ @@ -280,10 +280,10 @@ static Bool saveStyle( GameWindow *window, FILE *fp, Int dataIndent ) strcat( buffer, WindowStyleNames[ i ] ); bitWritten = TRUE; - } // end + } i++; - } // end while + } // if no bits written write NONE in the file if( bitWritten == FALSE ) @@ -295,7 +295,7 @@ static Bool saveStyle( GameWindow *window, FILE *fp, Int dataIndent ) return TRUE; -} // end saveStyle +} // saveCallbacks ============================================================== /** Save string representations of the window function callbacks into @@ -341,7 +341,7 @@ static Bool saveCallbacks( GameWindow *window, FILE *fp, Int dataIndent ) return TRUE; -} // end saveCallbacks +} // saveHeaderTemplate ========================================================= /** Save HeaderTemplate for a window */ @@ -376,7 +376,7 @@ static Bool saveFont( GameWindow *window, FILE *fp, Int dataIndent ) return TRUE; -} // end saveFont +} // saveTooltipText =================================================================== /** Save the text for a window */ @@ -391,11 +391,11 @@ static Bool saveTooltipText( GameWindow *window, FILE *fp, Int dataIndent ) sprintf( &buffer[ dataIndent ], "TOOLTIPTEXT = \"%s\";\n", instData->m_tooltipString.str() ); writeBufferToFile( fp, buffer ); - } // end if + } return TRUE; -} // end saveTooltipText +} // saveTooltipDelay =================================================================== /** Save the delay for a window */ @@ -414,7 +414,7 @@ static Bool saveTooltipDelay( GameWindow *window, FILE *fp, Int dataIndent ) return TRUE; -} // end saveTooltipText +} // saveText =================================================================== /** Save the text for a window */ @@ -430,11 +430,11 @@ static Bool saveText( GameWindow *window, FILE *fp, Int dataIndent ) sprintf( &buffer[ dataIndent ], "TEXT = \"%s\";\n", instData->m_textLabelString.str() ); writeBufferToFile( fp, buffer ); - } // end if + } return TRUE; -} // end saveText +} // saveTextColor ============================================================== /** Save the text colors for enabled, disable, and hilite with @@ -477,11 +477,11 @@ static Bool saveTextColor( GameWindow *window, FILE *fp, Int dataIndent ) r, g, b, a, br, bg, bb, ba ); writeBufferToFile( fp, buffer ); - } // end for i + } return TRUE; -} // end saveTextColor +} // tokenIsEnabledData ========================================================= /** Token refers to enabled draw data */ @@ -502,7 +502,7 @@ static Bool tokenIsEnabledData( const char *token ) return FALSE; -} // end tokenIsEnabledData +} // tokenIsDisabledData ======================================================== /** Token refers to Disabled draw data */ @@ -522,7 +522,7 @@ static Bool tokenIsDisabledData( const char *token ) return FALSE; -} // end tokenIsDisabledData +} // tokenIsHiliteData ========================================================== /** Token refers to Hilite draw data */ @@ -542,7 +542,7 @@ static Bool tokenIsHiliteData( const char *token ) return FALSE; -} // end tokenIsHiliteData +} // saveDrawData =============================================================== /** Save the draw data array */ @@ -581,7 +581,7 @@ static Bool saveDrawData( const char *token, GameWindow *window, assert( 0 ); return FALSE; - } // end else + } image = drawData->image; GameGetColorComponents( drawData->color, &r, &g, &b, &a ); @@ -599,11 +599,11 @@ static Bool saveDrawData( const char *token, GameWindow *window, writeBufferToFile( fp, buffer ); - } // end for i + } return TRUE; -} // end saveDrawData +} // saveListboxData ============================================================ /** Save listbox data to the file */ @@ -621,7 +621,7 @@ static Bool saveListboxData( GameWindow *window, FILE *fp, Int dataIndent ) assert( 0 ); return FALSE; - } // end if + } sprintf( &buffer[ dataIndent ], "LISTBOXDATA = LENGTH: %d,\n", listData->listLength ); writeBufferToFile( fp, buffer ); @@ -656,7 +656,7 @@ static Bool saveListboxData( GameWindow *window, FILE *fp, Int dataIndent ) saveDrawData( "LISTBOXDISABLEDUPBUTTONDRAWDATA", listData->upButton, fp, dataIndent ); saveDrawData( "LISTBOXHILITEUPBUTTONDRAWDATA", listData->upButton, fp, dataIndent ); - } // end if + } // save down button draw data for listbox if( listData->downButton ) @@ -666,7 +666,7 @@ static Bool saveListboxData( GameWindow *window, FILE *fp, Int dataIndent ) saveDrawData( "LISTBOXDISABLEDDOWNBUTTONDRAWDATA", listData->downButton, fp, dataIndent ); saveDrawData( "LISTBOXHILITEDOWNBUTTONDRAWDATA", listData->downButton, fp, dataIndent ); - } // end if + } // save the slider draw data on the listbox if( listData->slider ) @@ -683,13 +683,13 @@ static Bool saveListboxData( GameWindow *window, FILE *fp, Int dataIndent ) saveDrawData( "SLIDERTHUMBDISABLEDDRAWDATA", thumb, fp, dataIndent ); saveDrawData( "SLIDERTHUMBHILITEDRAWDATA", thumb, fp, dataIndent ); - } // end if + } - } // end if + } return TRUE; -} // end saveListboxData +} // saveComboBoxData ============================================================ /** Save Combo Box data to the file */ @@ -707,7 +707,7 @@ static Bool saveComboBoxData( GameWindow *window, FILE *fp, Int dataIndent ) assert( 0 ); return FALSE; - } // end if + } sprintf( &buffer[ dataIndent ], "COMBOBOXDATA = ISEDITABLE: %d,\n", comboData->isEditable ); writeBufferToFile( fp, buffer ); @@ -728,7 +728,7 @@ static Bool saveComboBoxData( GameWindow *window, FILE *fp, Int dataIndent ) saveDrawData( "COMBOBOXDROPDOWNBUTTONDISABLEDDRAWDATA", comboData->dropDownButton, fp, dataIndent ); saveDrawData( "COMBOBOXDROPDOWNBUTTONHILITEDRAWDATA", comboData->dropDownButton, fp, dataIndent ); - } // end if + } if( comboData->editBox ) { @@ -737,7 +737,7 @@ static Bool saveComboBoxData( GameWindow *window, FILE *fp, Int dataIndent ) saveDrawData( "COMBOBOXEDITBOXDISABLEDDRAWDATA", comboData->editBox, fp, dataIndent ); saveDrawData( "COMBOBOXEDITBOXHILITEDRAWDATA", comboData->editBox, fp, dataIndent ); - } // end if + } if(comboData->listBox) { @@ -755,7 +755,7 @@ static Bool saveComboBoxData( GameWindow *window, FILE *fp, Int dataIndent ) saveDrawData( "LISTBOXDISABLEDUPBUTTONDRAWDATA", listData->upButton, fp, dataIndent ); saveDrawData( "LISTBOXHILITEUPBUTTONDRAWDATA", listData->upButton, fp, dataIndent ); - } // end if + } // save down button draw data for listbox if( listData->downButton ) @@ -765,7 +765,7 @@ static Bool saveComboBoxData( GameWindow *window, FILE *fp, Int dataIndent ) saveDrawData( "LISTBOXDISABLEDDOWNBUTTONDRAWDATA", listData->downButton, fp, dataIndent ); saveDrawData( "LISTBOXHILITEDOWNBUTTONDRAWDATA", listData->downButton, fp, dataIndent ); - } // end if + } // save the slider draw data on the listbox if( listData->slider ) @@ -782,13 +782,13 @@ static Bool saveComboBoxData( GameWindow *window, FILE *fp, Int dataIndent ) saveDrawData( "SLIDERTHUMBDISABLEDDRAWDATA", thumb, fp, dataIndent ); saveDrawData( "SLIDERTHUMBHILITEDRAWDATA", thumb, fp, dataIndent ); - } // end if + } - } // end if - }// end if + } + } return TRUE; -} // end saveComboBoxData +} // saveRadioButtonData ======================================================== @@ -807,14 +807,14 @@ static Bool saveRadioButtonData( GameWindow *window, FILE *fp, Int dataIndent ) assert( 0 ); return FALSE; - } // end if + } sprintf( &buffer[ dataIndent ], "RADIOBUTTONDATA = GROUP: %d;\n", radioData->group ); writeBufferToFile( fp, buffer ); return TRUE; -} // end saveRadioButtonData +} // saveSliderData ============================================================= /** Save slider specific data */ @@ -832,7 +832,7 @@ static Bool saveSliderData( GameWindow *window, FILE *fp, Int dataIndent ) assert( 0 ); return FALSE; - } // end if + } sprintf( &buffer[ dataIndent ], "SLIDERDATA = MINVALUE: %d,\n", sliderData->minVal ); writeBufferToFile( fp, buffer ); @@ -848,11 +848,11 @@ static Bool saveSliderData( GameWindow *window, FILE *fp, Int dataIndent ) saveDrawData( "SLIDERTHUMBDISABLEDDRAWDATA", thumb, fp, dataIndent ); saveDrawData( "SLIDERTHUMBHILITEDRAWDATA", thumb, fp, dataIndent ); - } // end if + } return TRUE; -} // end saveSliderData +} // saveStaticTextData ========================================================= /** Save static text data entry */ @@ -870,14 +870,14 @@ static Bool saveStaticTextData( GameWindow *window, FILE *fp, Int dataIndent ) assert( 0 ); return FALSE; - } // end if + } sprintf( &buffer[ dataIndent ], "STATICTEXTDATA = CENTERED: %d;\n", textData->centered ); writeBufferToFile( fp, buffer ); return TRUE; -} // end saveStaticTextData +} // saveTextEntryData ========================================================== /** Save static text data entry */ @@ -895,7 +895,7 @@ static Bool saveTextEntryData( GameWindow *window, FILE *fp, Int dataIndent ) assert( 0 ); return FALSE; - } // end if + } sprintf( &buffer[ dataIndent ], "TEXTENTRYDATA = MAXLEN: %d,\n", entryData->maxTextLen ); writeBufferToFile( fp, buffer ); @@ -910,7 +910,7 @@ static Bool saveTextEntryData( GameWindow *window, FILE *fp, Int dataIndent ) return TRUE; -} // end saveTextEntryData +} // saveTabControlData ========================================================== /** Save tab control entry */ @@ -928,7 +928,7 @@ static Bool saveTabControlData( GameWindow *window, FILE *fp, Int dataIndent ) assert( 0 ); return FALSE; - } // end if + } sprintf( &buffer[ dataIndent ], "TABCONTROLDATA = TABORIENTATION: %d,\n", tabControlData->tabOrientation ); writeBufferToFile( fp, buffer ); @@ -982,7 +982,7 @@ static Bool saveGadgetData( GameWindow *window, FILE *fp, Int dataIndent ) return TRUE; -} // end saveGadgetData +} // saveWindow ================================================================= /** Save a single window and any of its child windows. Note that child @@ -1058,22 +1058,22 @@ static Bool saveWindow( FILE *fp, GameWindow *window, Int indent ) // previous child child = child->winGetPrev(); - } // end while + } // all children saved sprintf( &buffer[ dataIndent ], "ENDALLCHILDREN\n" ); writeBufferToFile( fp, buffer ); - } // end if, children present + } - } // end if + } else { // save specific gadget data saveGadgetData( window, fp, dataIndent ); - } // end else + } // end of window definition sprintf( &buffer[ indent ], "END\n" ); @@ -1081,7 +1081,7 @@ static Bool saveWindow( FILE *fp, GameWindow *window, Int indent ) return success; -} // end saveWindow +} // GUIEdit::validateNames ===================================================== /** Stored in the m_decorated field for each window is a name given @@ -1108,7 +1108,7 @@ void GUIEdit::validateNames( GameWindow *root, char *filename, Bool *valid ) *valid = FALSE; return; - } // end if + } // check this name for too long WinInstanceData *instData = root->winGetInstanceData(); @@ -1122,7 +1122,7 @@ void GUIEdit::validateNames( GameWindow *root, char *filename, Bool *valid ) strcat( offendingNames, "\n"); *valid = FALSE; - } // end if + } // check for a duplicate filename if( TheEditor->isNameDuplicate( TheWindowManager->winGetWindowList(), @@ -1136,7 +1136,7 @@ void GUIEdit::validateNames( GameWindow *root, char *filename, Bool *valid ) strcat( offendingNames, "\n" ); *valid = FALSE; - } // end if + } //You only call this on the first child since the call right after it will handle siblings (depth first) GameWindow *child = root->winGetChild(); @@ -1145,7 +1145,7 @@ void GUIEdit::validateNames( GameWindow *root, char *filename, Bool *valid ) // onto the next window validateNames( root->winGetNext(), filename, valid ); -} // end validateNames +} // GUIEdit::updateRadioScreenIdentifiers ====================================== /** update all radio button screen identifiers with the new identifier */ @@ -1164,7 +1164,7 @@ void GUIEdit::updateRadioScreenIdentifiers( GameWindow *window, Int screenID ) GadgetRadioSetGroup( window, radioData->group, screenID ); - } // end if + } // check our children GameWindow *child; @@ -1174,7 +1174,7 @@ void GUIEdit::updateRadioScreenIdentifiers( GameWindow *window, Int screenID ) // check the next one updateRadioScreenIdentifiers( window->winGetNext(), screenID ); -} // end updateRadioScreenIdentifiers +} //------------------------------------------------------------------------------------------------- /** Write layout block for a window file */ @@ -1193,7 +1193,7 @@ static void writeLayoutBlock( FILE *fp ) // end marker fprintf( fp, "ENDLAYOUTBLOCK\n" ); -} // end writeLayoutBlock +} // GUIEdit::saveData ========================================================== /** Save all our data to the file specified in filePath, which is a full @@ -1232,7 +1232,7 @@ Bool GUIEdit::saveData( char *filePathAndFilename, char *filename ) MessageBox( TheEditor->getWindowHandle(), offendingNames, "Window Name Error", MB_OK ); return FALSE; - } // end if + } // update all radio button screen identifiers with the filename updateRadioScreenIdentifiers( TheWindowManager->winGetWindowList(), @@ -1270,14 +1270,14 @@ Bool GUIEdit::saveData( char *filePathAndFilename, char *filename ) break; window = window->winGetPrev(); - } // end while + } // close the file fclose( fp ); return success; -} // end saveData +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/WinMain.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/WinMain.cpp index c437f00fd9c..4a1a529a61b 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/WinMain.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/WinMain.cpp @@ -128,7 +128,7 @@ static BOOL initInstance( HINSTANCE hInstance, int nCmdShow ) return TRUE; -} // end initInstance +} // registerClass ============================================================== // @@ -165,7 +165,7 @@ static ATOM registerClass(HINSTANCE hInstance) return RegisterClassEx( &wcex ); -} // registerClass +} /////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -254,11 +254,11 @@ Int APIENTRY WinMain(HINSTANCE hInstance, TranslateMessage( &msg ); DispatchMessage( &msg ); - } // end if + } - } // end while + } - } // end if + } else { @@ -266,9 +266,9 @@ Int APIENTRY WinMain(HINSTANCE hInstance, TheEditor->update(); Sleep(1); - } // end else + } - } // end while + } // shutdown GUIEdit data delete TheEditor; @@ -278,7 +278,7 @@ Int APIENTRY WinMain(HINSTANCE hInstance, return msg.wParam; -} // end WinMain +} // WndProc ==================================================================== // @@ -307,7 +307,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, SetFocus( hWnd ); return 0; - } // end move mouse + } // ------------------------------------------------------------------------ case WM_COMMAND: @@ -394,7 +394,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, else TheEditor->setMode( MODE_EDIT ); - } // end if + } break; // -------------------------------------------------------------------- @@ -424,9 +424,9 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, color.alpha = (Real)newColor->alpha / 255.0f; TheEditWindow->setBackgroundColor( color ); - } // end if + } - } // end if + } break; @@ -439,7 +439,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, TheDefaultScheme->openDialog(); break; - } // end scheme + } // -------------------------------------------------------------------- case MENU_ABOUT: @@ -449,7 +449,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, hWnd, (DLGPROC)AboutCallback ); break; - } // end about + } // -------------------------------------------------------------------- @@ -458,13 +458,13 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, return DefWindowProc( hWnd, message, wParam, lParam ); - } // end default + } - } // end switch( controlID ) + } return 0; - } // end command + } // ------------------------------------------------------------------------ case WM_CLOSE: @@ -474,7 +474,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, TheEditor->menuExit(); return 0; - } // end close + } // ------------------------------------------------------------------------ case WM_KEYDOWN: @@ -498,7 +498,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, TheEditor->clearSelections(); break; - } // end escape + } // -------------------------------------------------------------------- case VK_DELETE: @@ -509,7 +509,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, TheEditor->deleteSelected(); break; - } // end delete + } // -------------------------------------------------------------------- case VK_LEFT: @@ -550,7 +550,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, } break; - } // end Left + } // -------------------------------------------------------------------- case VK_RIGHT: { @@ -590,7 +590,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, } break; - } // end RIGHT + } // -------------------------------------------------------------------- case VK_UP: { @@ -631,7 +631,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, } break; - } // end Up + } // -------------------------------------------------------------------- case VK_DOWN: { @@ -671,7 +671,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, } break; - } // end Down + } // -------------------------------------------------------------------- case VK_RETURN: @@ -689,13 +689,13 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, TheEditor->setMode( MODE_EDIT ); } break; - }// end Enter + } - } // end switch( virtualKey ) + } return 0; - } // end key down + } // ------------------------------------------------------------------------ case WM_SIZE: @@ -723,13 +723,13 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, barY = height - barHeight; MoveWindow( statusBar, barX, barY, barWidth, barHeight, TRUE ); - } // end if + } - } // end if + } return 0; - } // end size + } // ------------------------------------------------------------------------ case WM_PAINT: @@ -741,7 +741,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, EndPaint(hWnd, &ps); break; - } // end paint + } // ------------------------------------------------------------------------ case WM_DESTROY: @@ -750,7 +750,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, PostQuitMessage(0); break; - } // end destroy + } // ------------------------------------------------------------------------ default: @@ -758,13 +758,13 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, return DefWindowProc(hWnd, message, wParam, lParam); - } // end default + } - } // end switch( message ) + } return DefWindowProc( hWnd, message, wParam, lParam ); -} // end WndProc +} // AboutCallback ============================================================== /** Mesage handler for about box. */ @@ -788,5 +788,5 @@ LRESULT CALLBACK AboutCallback( HWND hDlg, UINT message, } return FALSE; -} // end AboutCallback +} diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/BlendMaterial.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/BlendMaterial.cpp index 0bcc189e34a..170b9ca18b3 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/BlendMaterial.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/BlendMaterial.cpp @@ -201,7 +201,7 @@ void BlendMaterial::addTerrain(const char *pPath, Int terrainNdx, HTREEITEM pare parent = findOrAdd( parent, "**EVAL**" ); strcpy(buffer, pPath); doAdd = true; - } // end if + } // Int tilesPerRow = TEXTURE_WIDTH/(2*TILE_PIXEL_EXTENT+TILE_OFFSET); // Int availableTiles = 4 * tilesPerRow * tilesPerRow; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/BuildList.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/BuildList.cpp index a453e60840f..7b20f601c0d 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/BuildList.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/BuildList.cpp @@ -631,7 +631,7 @@ void BuildList::GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, lo // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void BuildList::PopSliderChanged(const long sliderID, long theVal) @@ -659,7 +659,7 @@ void BuildList::PopSliderChanged(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void BuildList::PopSliderFinished(const long sliderID, long theVal) @@ -673,7 +673,7 @@ void BuildList::PopSliderFinished(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/CameraOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/CameraOptions.cpp index 59a7d9b6716..87f1177d619 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/CameraOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/CameraOptions.cpp @@ -262,7 +262,7 @@ void CameraOptions::GetPopSliderInfo(const long sliderID, long *pMin, long *pMax // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void CameraOptions::PopSliderChanged(const long sliderID, long theVal) @@ -278,7 +278,7 @@ void CameraOptions::PopSliderChanged(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void CameraOptions::PopSliderFinished(const long sliderID, long theVal) @@ -291,7 +291,7 @@ void CameraOptions::PopSliderFinished(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/EditObjectParameter.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/EditObjectParameter.cpp index e12eb4d9cd5..25af1e3b6ee 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/EditObjectParameter.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/EditObjectParameter.cpp @@ -87,7 +87,7 @@ BOOL EditObjectParameter::OnInitDialog() { addObject(tTemplate); - } // end for tTemplate + } addObjectLists(); @@ -137,9 +137,9 @@ void EditObjectParameter::addObject( const ThingTemplate *thingTemplate ) parent = findOrAdd( parent, EditorSortingNames[ i ] ); break; // exit for - } // end if + } - } // end for i + } if( i == ES_NUM_SORTING_TYPES ) parent = findOrAdd( parent, "UNSORTED" ); @@ -147,7 +147,7 @@ void EditObjectParameter::addObject( const ThingTemplate *thingTemplate ) // the leaf name is the name of the template leafName = thingTemplate->getName().str(); - } // end if + } // add to the tree view if( leafName ) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/EditParameter.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/EditParameter.cpp index bfaf5d21d9d..bd2dc55f5cf 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/EditParameter.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/EditParameter.cpp @@ -1351,7 +1351,7 @@ void EditParameter::readFontFile( const char *filename ) fontBuffer[ index++ ] = c; fp->read(&c, 1); - } // end while + } fontBuffer[ index ] = '\0'; fp->read(&c, 1); @@ -1372,15 +1372,15 @@ void EditParameter::readFontFile( const char *filename ) fontBuffer, size, bold ); //MessageBox( m_appHWnd, buffer, "Cannot Load Font", MB_OK ); - } // end if + } - } // end for i + } // close the file fp->close(); fp = NULL; -} // end readFontFile +} Bool EditParameter::loadWaypoints(CComboBox *pCombo, AsciiString match) { diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/FeatherOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/FeatherOptions.cpp index 4f5050fc070..831e11d0531 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/FeatherOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/FeatherOptions.cpp @@ -172,7 +172,7 @@ void FeatherOptions::GetPopSliderInfo(const long sliderID, long *pMin, long *pMa default: DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void FeatherOptions::PopSliderChanged(const long sliderID, long theVal) @@ -207,7 +207,7 @@ void FeatherOptions::PopSliderChanged(const long sliderID, long theVal) default: break; - } // switch + } } void FeatherOptions::PopSliderFinished(const long sliderID, long theVal) @@ -221,7 +221,7 @@ void FeatherOptions::PopSliderFinished(const long sliderID, long theVal) default: DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/FenceOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/FenceOptions.cpp index e90c14c4b1d..b4fcc6e7349 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/FenceOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/FenceOptions.cpp @@ -161,7 +161,7 @@ BOOL FenceOptions::OnInitDialog() Color cc = tTemplate->getDisplayColor(); pMap->setColor(cc); - } // end for tTemplate + } CWnd *pWnd = GetDlgItem(IDC_OBJECT_HEIGHT_EDIT); @@ -278,9 +278,9 @@ void FenceOptions::addObject( MapObject *mapObject, const char *pPath, const cha parent = findOrAdd( parent, EditorSortingNames[ i ] ); break; // exit for - } // end if + } - } // end for i + } if( i == ES_NUM_SORTING_TYPES ) parent = findOrAdd( parent, "UNSORTED" ); @@ -288,7 +288,7 @@ void FenceOptions::addObject( MapObject *mapObject, const char *pPath, const cha // the leaf name is the name of the template leafName = thingTemplate->getName().str(); - } // end if + } // add to the tree view if( leafName ) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp index dc15ec522a8..31a8dbbc33f 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp @@ -775,7 +775,7 @@ void GlobalLightOptions::GetPopSliderInfo(const long sliderID, long *pMin, long // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void GlobalLightOptions::PopSliderChanged(const long sliderID, long theVal) @@ -822,7 +822,7 @@ void GlobalLightOptions::PopSliderChanged(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void GlobalLightOptions::PopSliderFinished(const long sliderID, long theVal) @@ -845,7 +845,7 @@ void GlobalLightOptions::PopSliderFinished(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/MapPreview.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/MapPreview.cpp index 16718436064..8fff753ebfc 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/MapPreview.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/MapPreview.cpp @@ -129,7 +129,7 @@ void MapPreview::interpolateColorForHeight( RGBColor *color, colorTarget.green = color->green + (1.0f - color->green) * howBright; colorTarget.blue = color->blue + (1.0f - color->blue) * howBright; - } // end if + } else // interpolate darker { @@ -141,7 +141,7 @@ void MapPreview::interpolateColorForHeight( RGBColor *color, colorTarget.green = color->green + (0.0f - color->green) * howDark; colorTarget.blue = color->blue + (0.0f - color->blue) * howDark; - } // end else + } // interpolate toward the target color color->red = color->red + (colorTarget.red - color->red) * t; @@ -162,7 +162,7 @@ void MapPreview::interpolateColorForHeight( RGBColor *color, if( color->blue > 1.0f ) color->blue = 1.0f; -} // end interpolateColorForHeight +} Bool MapPreview::mapPreviewToWorld(const ICoord2D *radar, Coord3D *world) { @@ -317,15 +317,15 @@ void MapPreview::buildMapPreviewTexture( CString tgaName ) sampleColor.blue += color.blue; samples++; - } // end if + } - } // end if + } - } // end for i + } - } // end if + } - } // end for j + } // prevent divide by zeros if( samples == 0 ) @@ -336,7 +336,7 @@ void MapPreview::buildMapPreviewTexture( CString tgaName ) color.green = sampleColor.green / (Real)samples; color.blue = sampleColor.blue / (Real)samples; - } // end if + } else // regular terrain ... { const Int samplesAway = 1; // how many "tiles" from the center tile we will sample away @@ -378,13 +378,13 @@ void MapPreview::buildMapPreviewTexture( CString tgaName ) sampleColor.blue += color.blue; samples++; - } // end if + } - } // end for i + } - } // end if + } - } // end for j + } // prevent divide by zeros if( samples == 0 ) @@ -395,7 +395,7 @@ void MapPreview::buildMapPreviewTexture( CString tgaName ) color.green = sampleColor.green / (Real)samples; color.blue = sampleColor.blue / (Real)samples; - } // end else + } // // draw the pixel for the terrain at this point, note that because of the orientation @@ -408,9 +408,9 @@ void MapPreview::buildMapPreviewTexture( CString tgaName ) // m_pixelBuffer[y][x]= 255 | (REAL_TO_INT(color.red *255) << 8) | (REAL_TO_INT(color.green *255) << 16) | REAL_TO_INT(color.blue * 255)<< 24; - } // end for x + } - } // end for y + } { Targa tga; tga.Header.Width = MAP_PREVIEW_WIDTH; @@ -421,7 +421,7 @@ void MapPreview::buildMapPreviewTexture( CString tgaName ) tga.Save(tgaName,TGAF_IMAGE, FALSE); } -} // end buildTerrainTexture +} diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp index f0609e662ea..bbd6c110b0a 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp @@ -211,7 +211,7 @@ void MeshMoldOptions::GetPopSliderInfo(const long sliderID, long *pMin, long *pM // uh-oh! DEBUG_CRASH(("Missing ID.")); break; - } // switch + } } void MeshMoldOptions::PopSliderChanged(const long sliderID, long theVal) @@ -246,7 +246,7 @@ void MeshMoldOptions::PopSliderChanged(const long sliderID, long theVal) default: DEBUG_CRASH(("Missing ID.")); break; - } // switch + } } void MeshMoldOptions::PopSliderFinished(const long sliderID, long theVal) @@ -262,7 +262,7 @@ void MeshMoldOptions::PopSliderFinished(const long sliderID, long theVal) default: DEBUG_CRASH(("Missing ID.")); break; - } // switch + } } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/MoundOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/MoundOptions.cpp index 13e80032942..f3f1eb9849a 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/MoundOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/MoundOptions.cpp @@ -212,7 +212,7 @@ void MoundOptions::GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void MoundOptions::PopSliderChanged(const long sliderID, long theVal) @@ -249,7 +249,7 @@ void MoundOptions::PopSliderChanged(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void MoundOptions::PopSliderFinished(const long sliderID, long theVal) @@ -266,7 +266,7 @@ void MoundOptions::PopSliderFinished(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp index be797e2540d..3e5e4f28130 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp @@ -252,7 +252,7 @@ BOOL ObjectOptions::OnInitDialog() Color cc = tTemplate->getDisplayColor(); pMap->setColor(cc); - } // end for tTemplate + } #if 0 // Lights are not working right now. { @@ -438,7 +438,7 @@ HTREEITEM ObjectOptions::_FindOrDont(const char* pLabel, HTREEITEM startPoint) } else { // add the first child, the others will be caught by the adding of the siblings itemsToEx.push_back(m_objectTreeView.GetChildItem(hItem)); - } // Always add the first sibling, if it exists + } if (m_objectTreeView.GetNextSiblingItem(hItem)) { itemsToEx.push_back(m_objectTreeView.GetNextSiblingItem(hItem)); @@ -496,9 +496,9 @@ void ObjectOptions::addObject( MapObject *mapObject, const char *pPath, parent = findOrAdd( parent, EditorSortingNames[ i ] ); break; // exit for - } // end if + } - } // end for i + } if( i == ES_NUM_SORTING_TYPES ) parent = findOrAdd( parent, "UNSORTED" ); @@ -506,7 +506,7 @@ void ObjectOptions::addObject( MapObject *mapObject, const char *pPath, // the leaf name is the name of the template leafName = thingTemplate->getName().str(); - } // end if + } else { @@ -532,9 +532,9 @@ void ObjectOptions::addObject( MapObject *mapObject, const char *pPath, buffer[ i ] = 0; leafName = buffer; - } // end if + } - } // end else if + } // add to the tree view if( leafName ) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp index b0002583ed7..754dd298bb0 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp @@ -173,7 +173,7 @@ BOOL PickUnitDialog::OnInitDialog() pMap = newInstance(MapObject)( loc, tTemplate->getName(), 0.0f, 0, NULL, tTemplate ); pMap->setNextMap( m_objectsList ); m_objectsList = pMap; - } // end for tTemplate + } CWnd *pWnd = GetDlgItem(IDC_OBJECT_HEIGHT_EDIT); if (pWnd) { @@ -323,9 +323,9 @@ void PickUnitDialog::addObject( MapObject *mapObject, const char *pPath, Int ind parent = findOrAdd( parent, EditorSortingNames[ i ] ); break; // exit for - } // end if + } - } // end for i + } if( i == ES_NUM_SORTING_TYPES ) parent = findOrAdd( parent, "UNSORTED" ); @@ -333,7 +333,7 @@ void PickUnitDialog::addObject( MapObject *mapObject, const char *pPath, Int ind // the leaf name is the name of the template leafName = thingTemplate->getName().str(); - } // end if + } else { @@ -359,9 +359,9 @@ void PickUnitDialog::addObject( MapObject *mapObject, const char *pPath, Int ind buffer[ i ] = 0; leafName = buffer; - } // end if + } - } // end else if + } // add to the tree view if( leafName ) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/RoadOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/RoadOptions.cpp index 2d9b07b825d..c6142d37c7b 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/RoadOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/RoadOptions.cpp @@ -237,7 +237,7 @@ BOOL RoadOptions::OnInitDialog() index++; m_numberOfRoads++; - } // end for raod + } // load roads from test assets #ifdef LOAD_TEST_ASSETS @@ -298,7 +298,7 @@ BOOL RoadOptions::OnInitDialog() index++; m_numberOfBridges++; - } // end for bridge + } m_currentRoadIndex = 1; setRoadTreeViewSelection(TVI_ROOT, m_currentRoadIndex); @@ -392,7 +392,7 @@ void RoadOptions::addRoad(char *pPath, Int terrainNdx, HTREEITEM parent) // do the add doAdd = TRUE; - } // end if + } #ifdef LOAD_TEST_ASSETS if (!doAdd && !strncmp(TEST_STRING, pPath, strlen(TEST_STRING))) { diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ScorchOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ScorchOptions.cpp index 1cc06fb3a94..dd802ca1cb9 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ScorchOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ScorchOptions.cpp @@ -176,7 +176,7 @@ void ScorchOptions::GetPopSliderInfo(const long sliderID, long *pMin, long *pMax // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void ScorchOptions::PopSliderChanged(const long sliderID, long theVal) @@ -197,7 +197,7 @@ void ScorchOptions::PopSliderChanged(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } m_updating = false; } @@ -212,7 +212,7 @@ void ScorchOptions::PopSliderFinished(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp index 38dd4588032..ea444f637a1 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp @@ -297,15 +297,15 @@ void TerrainMaterial::addTerrain(char *pPath, Int terrainNdx, HTREEITEM parent) parent = findOrAdd( parent, terrainTypeNames[ i ] ); break; // exit for - } // end if + } - } // end for i + } // set the name in the tree view to that of the entry strcpy( buffer, terrain->getName().str() ); doAdd = TRUE; - } // end if + } else if (!WorldHeightMapEdit::getTexClassIsBlendEdge(terrainNdx)) { @@ -329,7 +329,7 @@ void TerrainMaterial::addTerrain(char *pPath, Int terrainNdx, HTREEITEM parent) doAdd = TRUE; i++; } - } // end else + } Int tilesPerRow = TEXTURE_WIDTH/(2*TILE_PIXEL_EXTENT+TILE_OFFSET); Int availableTiles = 4 * tilesPerRow * tilesPerRow; @@ -425,7 +425,7 @@ void TerrainMaterial::GetPopSliderInfo(const long sliderID, long *pMin, long *pM break; default: break; - } // switch + } } @@ -445,7 +445,7 @@ void TerrainMaterial::PopSliderChanged(const long sliderID, long theVal) default: break; - } // switch + } } void TerrainMaterial::PopSliderFinished(const long sliderID, long theVal) @@ -456,7 +456,7 @@ void TerrainMaterial::PopSliderFinished(const long sliderID, long theVal) default: break; - } // switch + } } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainModal.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainModal.cpp index 227c5e8237c..ac4dfb619f8 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainModal.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainModal.cpp @@ -168,15 +168,15 @@ void TerrainModal::addTerrain(char *pPath, Int terrainNdx, HTREEITEM parent) parent = findOrAdd( parent, terrainTypeNames[ i ] ); break; // exit for - } // end if + } - } // end for i + } strcpy( buffer, terrain->getName().str() ); doAdd = TRUE; - } // end if + } else { @@ -202,7 +202,7 @@ void TerrainModal::addTerrain(char *pPath, Int terrainNdx, HTREEITEM parent) doAdd = TRUE; } - } // end else + } if (doAdd) { diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp index a0373e4e878..81f2b902cd7 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp @@ -261,7 +261,7 @@ void PopupSlider::New(CWnd *pParentWnd, long kind, pPopupSlider = NULL; } - } // catch + } gPopupSlider = pPopupSlider; // gPopupSlider will be deleted when its PostNcDestroy method is called @@ -386,7 +386,7 @@ BOOL PopupSlider::Create(const RECT& rect, CWnd* pParentWnd) } catch (...) { // don't rethrow retVal = FALSE; - } // catch + } return retVal; } @@ -579,7 +579,7 @@ void PopupSlider::OnMouseMove(UINT nFlags, CPoint point) if (mSliderOwner) { mSliderOwner->PopSliderChanged(mSliderID, m_curValue); } - } // if (PtInRect) + } } } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp index 41b219535bb..6256616cafc 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp @@ -407,7 +407,7 @@ void WorldHeightMapEdit::loadBaseImages(void) // load the terrain definition for the WorldBuilder to reference loadImagesFromTerrainType( terrain ); - } // end for + } } @@ -872,7 +872,7 @@ Int WorldHeightMapEdit::getTileIndexFromTerrainType( TerrainType *terrain ) // not found return -1; -} // end getTileIndexFromTerrainType +} Int WorldHeightMapEdit::allocateTiles(Int textureClass) { diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WaterOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WaterOptions.cpp index 4cda47998f7..ef8bb5f754e 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WaterOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WaterOptions.cpp @@ -360,7 +360,7 @@ void WaterOptions::GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void WaterOptions::PopSliderChanged(const long sliderID, long theVal) @@ -386,7 +386,7 @@ void WaterOptions::PopSliderChanged(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void WaterOptions::PopSliderFinished(const long sliderID, long theVal) @@ -401,7 +401,7 @@ void WaterOptions::PopSliderFinished(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/brushoptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/brushoptions.cpp index b9e7a58a06c..c5c73a54903 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/brushoptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/brushoptions.cpp @@ -212,7 +212,7 @@ void BrushOptions::GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void BrushOptions::PopSliderChanged(const long sliderID, long theVal) @@ -249,7 +249,7 @@ void BrushOptions::PopSliderChanged(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } void BrushOptions::PopSliderFinished(const long sliderID, long theVal) @@ -266,7 +266,7 @@ void BrushOptions::PopSliderFinished(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp index 0e2ee9efaa4..fe25fa7eee2 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp @@ -606,7 +606,7 @@ void MapObjectProps::GetPopSliderInfo(const long sliderID, long *pMin, long *pMa // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } /// Slider control @@ -654,7 +654,7 @@ void MapObjectProps::PopSliderChanged(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } /// Slider control @@ -678,7 +678,7 @@ void MapObjectProps::PopSliderFinished(const long sliderID, long theVal) // uh-oh! DEBUG_CRASH(("Slider message from unknown control")); break; - } // switch + } } @@ -1733,7 +1733,7 @@ void MapObjectProps::InitSound(void) soundComboBox->InsertString( 1, NO_SOUND_STRING ); } -} // end InitSound +} // Adds a series of Undoable's to the given MultipleUndoable which clears the diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp index 76e462da885..88667df1065 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -1069,7 +1069,7 @@ void WbView3d::updateFenceListObjects(MapObject *pObject) renderObj = m_assetManager->Create_Render_Obj( modelName.str(), scale, 0); - } // end if + } } if (renderObj) { @@ -1209,7 +1209,7 @@ void WbView3d::invalBuildListItemInView(BuildListInfo *pBuildToInval) shadowInfo.m_offsetY=tTemplate->getShadowOffsetY(); shadowObj=TheW3DShadowManager->addShadow(renderObj, &shadowInfo); } - } // end if + } } if (renderObj) { pBuild->setRenderObj(renderObj); @@ -1491,7 +1491,7 @@ void WbView3d::invalObjectInView(MapObject *pMapObjIn) shadowObj=TheW3DShadowManager->addShadow(renderObj, &shadowInfo); } } - } // end if + } } if (renderObj && !(pMapObj->getFlags() & FLAG_DONT_RENDER)) { @@ -1761,7 +1761,7 @@ Bool WbView3d::viewToDocCoords(CPoint curPt, Coord3D *newPt, Bool constrain) intersection = castResult.ContactPoint; m_curTrackingZ = intersection.Z; result = true; - } // end if + } } if (!result) { intersection.X = Vector3::Find_X_At_Z(m_curTrackingZ, rayLocation, rayDirectionPt); @@ -2624,7 +2624,7 @@ void WbView3d::drawLabels(HDC hdc) DeleteObject(pen); //delete new pen } #endif //DRAW_LIGHT_DIRECTION_RAYS - }//end for + } } else { if (!m_doLightFeedback) diff --git a/scripts/cpp/apply_code_formatting.py b/scripts/cpp/apply_code_formatting.py new file mode 100644 index 00000000000..aa223652f81 --- /dev/null +++ b/scripts/cpp/apply_code_formatting.py @@ -0,0 +1,66 @@ +# Created with python 3.11.4 + +# This script applies basic formatting and cleanups to the various CPP files. +# Just run it. + +import glob +import os + + +def apply_formatting(line: str) -> str: + # Strip useless comments behind scope end + scopeEndIndex = line.find('}') + if scopeEndIndex >= 0: + if scopeEndIndex == 0 or line[:scopeEndIndex].isspace(): + afterScopeIndex = scopeEndIndex + 1 + while afterScopeIndex < len(line) and line[afterScopeIndex] == ';': + afterScopeIndex += 1 + commentBeginIndex = line.find("//") + namespaceCommentBeginIndex = line.find("// namespace") + if commentBeginIndex >= 0 and namespaceCommentBeginIndex < 0: + if afterScopeIndex == commentBeginIndex or line[afterScopeIndex:commentBeginIndex].isspace(): + line = line[:commentBeginIndex] + + # remove trailing whitespace + line = line.rstrip() + line += "\n" + + return line + + +def main(): + current_dir = os.path.dirname(os.path.abspath(__file__)) + root_dir = os.path.join(current_dir, "..", "..") + root_dir = os.path.normpath(root_dir) + core_dir = os.path.join(root_dir, "Core") + generals_dir = os.path.join(root_dir, "Generals") + generalsmd_dir = os.path.join(root_dir, "GeneralsMD") + utility_dir = os.path.join(root_dir, "Dependencies", "Utility") + fileNames = [] + for ext in ["*.cpp", "*.h", "*.inl"]: + fileNames.extend(glob.glob(os.path.join(core_dir, '**', ext), recursive=True)) + fileNames.extend(glob.glob(os.path.join(generals_dir, '**', ext), recursive=True)) + fileNames.extend(glob.glob(os.path.join(generalsmd_dir, '**', ext), recursive=True)) + fileNames.extend(glob.glob(os.path.join(utility_dir, '**', ext), recursive=True)) + + for fileName in fileNames: + with open(fileName, 'r', encoding="cp1252") as file: + try: + lines = file.readlines() + except UnicodeDecodeError: + continue # Not good. + + with open(fileName, 'w', encoding="cp1252") as file: + for line in lines: + line = apply_formatting(line) + file.write(line) + if lines: + lastLine = lines[-1] + if lastLine and lastLine[-1] != '\n': + file.write("\n") # write new line to end of file + + return + + +if __name__ == "__main__": + main() diff --git a/scripts/cpp/remove_trailing_whitespace.py b/scripts/cpp/remove_trailing_whitespace.py deleted file mode 100644 index 1b8ed43e4a2..00000000000 --- a/scripts/cpp/remove_trailing_whitespace.py +++ /dev/null @@ -1,49 +0,0 @@ -# Created with python 3.11.4 - -# This script helps removing RTS_INTERNAL words from the various CPP files. -# Just run it. - -import glob -import os - - -def main(): - current_dir = os.path.dirname(os.path.abspath(__file__)) - root_dir = os.path.join(current_dir, "..", "..") - root_dir = os.path.normpath(root_dir) - core_dir = os.path.join(root_dir, "Core") - generals_dir = os.path.join(root_dir, "Generals") - generalsmd_dir = os.path.join(root_dir, "GeneralsMD") - fileNames = [] - fileNames.extend(glob.glob(os.path.join(core_dir, '**', '*.h'), recursive=True)) - fileNames.extend(glob.glob(os.path.join(core_dir, '**', '*.cpp'), recursive=True)) - fileNames.extend(glob.glob(os.path.join(core_dir, '**', '*.inl'), recursive=True)) - fileNames.extend(glob.glob(os.path.join(generals_dir, '**', '*.h'), recursive=True)) - fileNames.extend(glob.glob(os.path.join(generals_dir, '**', '*.cpp'), recursive=True)) - fileNames.extend(glob.glob(os.path.join(generals_dir, '**', '*.inl'), recursive=True)) - fileNames.extend(glob.glob(os.path.join(generalsmd_dir, '**', '*.h'), recursive=True)) - fileNames.extend(glob.glob(os.path.join(generalsmd_dir, '**', '*.cpp'), recursive=True)) - fileNames.extend(glob.glob(os.path.join(generalsmd_dir, '**', '*.inl'), recursive=True)) - - for fileName in fileNames: - with open(fileName, 'r', encoding="cp1252") as file: - try: - lines = file.readlines() - except UnicodeDecodeError: - continue # Not good. - - with open(fileName, 'w', encoding="cp1252") as file: - for line in lines: - line = line.rstrip() + "\n" # remove trailing whitespace - file.write(line) - - if lines: - lastLine = lines[-1] - if lastLine and lastLine[-1] != '\n': - file.write("\n") # write new line to end of file - - return - - -if __name__ == "__main__": - main() From 06c6b3b4698be36b9c6da3322966e9e05f25e38e Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 12 Sep 2025 17:13:17 +0200 Subject: [PATCH 068/343] refactor: Remove superfluous null tests before calls to delete, delete[] (#1560) --- .../Source/Common/Audio/GameAudio.cpp | 10 +- .../Common/System/ArchiveFileSystem.cpp | 5 +- .../Source/Common/System/RAMFile.cpp | 5 +- .../GameClient/GUI/WindowVideoManager.cpp | 22 +- .../Source/WWVegas/WW3D2/aabtree.cpp | 18 +- .../Source/WWVegas/WW3D2/agg_def.cpp | 6 +- .../Source/WWVegas/WW3D2/decalsys.cpp | 20 +- .../Source/WWVegas/WW3D2/distlod.cpp | 11 +- .../Source/WWVegas/WW3D2/dynamesh.cpp | 7 +- Core/Libraries/Source/WWVegas/WW3D2/hanim.cpp | 4 +- Core/Libraries/Source/WWVegas/WW3D2/hanim.h | 4 +- .../Libraries/Source/WWVegas/WW3D2/hcanim.cpp | 18 +- .../Source/WWVegas/WW3D2/hmdldef.cpp | 6 +- Core/Libraries/Source/WWVegas/WW3D2/htree.cpp | 13 +- .../Source/WWVegas/WW3D2/matinfo.cpp | 8 +- .../Source/WWVegas/WW3D2/meshdam.cpp | 12 +- .../Source/WWVegas/WW3D2/metalmap.cpp | 9 +- Core/Libraries/Source/WWVegas/WW3D2/pivot.h | 3 +- .../Source/WWVegas/WW3D2/polyinfo.cpp | 6 +- .../Source/WWVegas/WW3D2/predlod.cpp | 12 +- Core/Libraries/Source/WWVegas/WW3D2/proto.cpp | 2 +- .../Source/WWVegas/WW3D2/render2dsentence.cpp | 12 +- .../Source/WWVegas/WW3D2/ringobj.cpp | 10 +- .../Source/WWVegas/WW3D2/shattersystem.cpp | 9 +- .../Source/WWVegas/WW3D2/sphereobj.cpp | 14 +- .../Source/WWVegas/WW3D2/visrasterizer.cpp | 14 +- .../Source/WWVegas/WWAudio/SoundBuffer.cpp | 6 +- Core/Libraries/Source/WWVegas/WWAudio/Utils.h | 14 +- .../Source/WWVegas/WWDebug/wwmemlog.cpp | 7 +- .../Source/WWVegas/WWDebug/wwprofile.cpp | 1 - Core/Libraries/Source/WWVegas/WWLib/Vector.H | 2 +- .../Source/WWVegas/WWLib/bufffile.cpp | 12 +- Core/Libraries/Source/WWVegas/WWLib/hash.cpp | 6 +- .../Source/WWVegas/WWLib/hashtemplate.h | 6 +- .../Libraries/Source/WWVegas/WWLib/sharebuf.h | 6 +- .../Source/WWVegas/WWLib/simplevec.h | 20 +- Core/Libraries/Source/WWVegas/WWLib/uarray.h | 6 +- .../Source/WWVegas/WWMath/aabtreecull.cpp | 26 +- .../Source/WWVegas/WWMath/gridcull.cpp | 16 +- .../WWVegas/WWSaveLoad/definitionmgr.cpp | 28 +- .../Source/WWVegas/WWSaveLoad/parameterlist.h | 4 +- Core/Tools/Autorun/GameText.cpp | 15 +- Core/Tools/Autorun/Locale_API.cpp | 7 +- Core/Tools/Autorun/TTFont.cpp | 13 +- Core/Tools/Autorun/WSYS_RAMFile.cpp | 7 +- Core/Tools/Autorun/autorun.cpp | 32 +- Core/Tools/Babylon/BabylonDlg.cpp | 5 +- Core/Tools/Babylon/XLStuff.cpp | 36 +-- Core/Tools/Babylon/loadsave.cpp | 17 +- Core/Tools/ImagePacker/Source/ImageInfo.cpp | 12 +- Core/Tools/ImagePacker/Source/ImagePacker.cpp | 6 +- Core/Tools/ImagePacker/Source/TexturePage.cpp | 9 +- .../Launcher/Toolkit/Support/UString.cpp | 11 +- Core/Tools/Launcher/streamer.cpp | 4 +- Core/Tools/Launcher/wstring.cpp | 11 +- Core/Tools/W3DView/Utils.h | 13 +- Core/Tools/W3DView/W3DViewDoc.cpp | 6 +- Core/Tools/mangler/wlib/streamer.cpp | 4 +- Core/Tools/mangler/wlib/wstring.cpp | 3 +- Core/Tools/matchbot/main.cpp | 9 +- Core/Tools/matchbot/mydebug.cpp | 7 +- Core/Tools/matchbot/wlib/streamer.cpp | 4 +- Core/Tools/matchbot/wlib/wdebug.cpp | 7 +- Core/Tools/matchbot/wlib/wstring.cpp | 3 +- .../GameEngine/Include/Common/INIException.h | 4 +- .../GameEngine/Source/Common/GameEngine.cpp | 3 +- .../Source/Common/System/BuildAssistant.cpp | 12 +- .../Source/Common/System/CDManager.cpp | 5 +- .../Source/Common/System/DataChunk.cpp | 13 +- .../Common/System/SaveGame/GameStateMap.cpp | 6 +- .../GameEngine/Source/GameClient/Drawable.cpp | 7 +- .../GameClient/GUI/AnimateWindowManager.cpp | 24 +- .../GameClient/GUI/ControlBar/ControlBar.cpp | 22 +- .../GUI/ControlBar/ControlBarScheme.cpp | 15 +- .../ControlBarPopupDescription.cpp | 6 +- .../GameClient/GUI/GUICallbacks/Diplomacy.cpp | 4 +- .../GUI/GUICallbacks/Menus/CreditsMenu.cpp | 4 +- .../GUI/GUICallbacks/Menus/DownloadMenu.cpp | 14 +- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 8 +- .../GUI/GUICallbacks/Menus/ScoreScreen.cpp | 13 +- .../GUICallbacks/Menus/WOLBuddyOverlay.cpp | 8 +- .../GUICallbacks/Menus/WOLGameSetupMenu.cpp | 6 +- .../GUICallbacks/Menus/WOLQuickMatchMenu.cpp | 6 +- .../GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp | 6 +- .../GameClient/GUI/Gadget/GadgetListBox.cpp | 18 +- .../Source/GameClient/GUI/GameWindow.cpp | 6 +- .../GameClient/GUI/GameWindowManager.cpp | 4 +- .../GameClient/GUI/GameWindowTransitions.cpp | 8 +- .../Source/GameClient/GUI/HeaderTemplate.cpp | 6 +- .../Source/GameClient/GUI/IMEManager.cpp | 19 +- .../Source/GameClient/GUI/LoadScreen.cpp | 12 +- .../GameClient/GUI/Shell/ShellMenuScheme.cpp | 9 +- .../Source/GameClient/GameClient.cpp | 11 +- .../GameEngine/Source/GameClient/GameText.cpp | 28 +- .../GameEngine/Source/GameClient/InGameUI.cpp | 11 +- .../GameEngine/Source/GameClient/MapUtil.cpp | 22 +- .../Source/GameClient/System/Anim2D.cpp | 4 +- .../GameEngine/Source/GameLogic/AI/AI.cpp | 5 +- .../Source/GameLogic/AI/AIPathfind.cpp | 106 +++---- .../Source/GameLogic/Map/PolygonTrigger.cpp | 7 +- .../GameLogic/ScriptEngine/ScriptEngine.cpp | 12 +- .../Source/GameLogic/System/GameLogic.cpp | 22 +- .../Source/GameNetwork/ConnectionManager.cpp | 27 +- .../Source/GameNetwork/FirewallHelper.cpp | 16 +- .../Source/GameNetwork/FrameDataManager.cpp | 8 +- .../Source/GameNetwork/FrameMetrics.cpp | 19 +- .../Source/GameNetwork/GameSpy/LadderDefs.cpp | 6 +- .../Source/GameNetwork/GameSpy/LobbyUtils.cpp | 3 +- .../GameNetwork/GameSpy/MainMenuUtils.cpp | 53 ++-- .../Source/GameNetwork/GameSpy/PeerDefs.cpp | 50 +--- .../GameSpy/StagingRoomGameInfo.cpp | 26 +- .../GameSpy/Thread/BuddyThread.cpp | 3 +- .../GameSpy/Thread/GameResultsThread.cpp | 7 +- .../GameNetwork/GameSpy/Thread/PeerThread.cpp | 3 +- .../Thread/PersistentStorageThread.cpp | 3 +- .../GameNetwork/GameSpy/Thread/PingThread.cpp | 7 +- .../GameEngine/Source/GameNetwork/LANAPI.cpp | 3 +- .../Source/GameNetwork/LANAPICallbacks.cpp | 14 +- .../Source/GameNetwork/LANAPIhandlers.cpp | 1 - .../GameEngine/Source/GameNetwork/NAT.cpp | 20 +- .../Source/GameNetwork/NetCommandMsg.cpp | 18 +- .../GameNetwork/NetCommandWrapperList.cpp | 12 +- .../Source/GameNetwork/Transport.cpp | 10 +- .../Source/W3DDevice/GameClient/HeightMap.cpp | 56 ++-- .../GameClient/Shadow/W3DVolumetricShadow.cpp | 41 +-- .../W3DDevice/GameClient/W3DDebugIcons.cpp | 2 +- .../W3DDevice/GameClient/W3DRoadBuffer.cpp | 58 ++-- .../Source/W3DDevice/GameClient/W3DScene.cpp | 15 +- .../Source/W3DDevice/GameClient/W3DShroud.cpp | 23 +- .../W3DDevice/GameClient/W3DTerrainVisual.cpp | 14 +- .../W3DDevice/GameClient/Water/W3DWater.cpp | 6 +- .../W3DDevice/GameClient/WorldHeightMap.cpp | 49 ++-- .../Source/WWVegas/WW3D2/aabtreebuilder.cpp | 17 +- .../Source/WWVegas/WW3D2/aabtreebuilder.h | 6 +- .../Source/WWVegas/WW3D2/animobj.cpp | 12 +- .../Source/WWVegas/WW3D2/assetmgr.cpp | 10 +- .../Libraries/Source/WWVegas/WW3D2/assetmgr.h | 2 +- .../Source/WWVegas/WW3D2/dx8texman.cpp | 1 - .../Source/WWVegas/WW3D2/dx8wrapper.cpp | 6 +- .../Libraries/Source/WWVegas/WW3D2/hlod.cpp | 33 +-- .../Source/WWVegas/WW3D2/hmorphanim.cpp | 24 +- .../Source/WWVegas/WW3D2/hrawanim.cpp | 38 +-- .../Source/WWVegas/WW3D2/htreemgr.cpp | 6 +- .../Source/WWVegas/WW3D2/meshbuild.cpp | 12 +- .../Source/WWVegas/WW3D2/meshmdl.cpp | 38 +-- .../Source/WWVegas/WW3D2/meshmdlio.cpp | 7 +- .../Source/WWVegas/WW3D2/motchan.cpp | 37 +-- .../Source/WWVegas/WW3D2/part_buf.cpp | 262 ++++++----------- .../Source/WWVegas/WW3D2/part_emt.cpp | 76 ++--- .../Source/WWVegas/WW3D2/part_ldr.cpp | 20 +- .../Source/WWVegas/WW3D2/textureloader.cpp | 4 +- .../Code/Tools/GUIEdit/Source/GUIEdit.cpp | 22 +- .../Code/Tools/WorldBuilder/src/CUndoable.cpp | 10 +- .../Code/Tools/WorldBuilder/src/MainFrm.cpp | 4 +- .../Tools/WorldBuilder/src/WBPopupSlider.cpp | 6 +- .../Tools/WorldBuilder/src/WHeightMapEdit.cpp | 2 +- .../Code/Tools/WorldBuilder/src/wbview3d.cpp | 21 +- .../GameEngine/Include/Common/INIException.h | 4 +- .../GameEngine/Source/Common/GameEngine.cpp | 7 +- .../Source/Common/System/BuildAssistant.cpp | 12 +- .../Source/Common/System/CDManager.cpp | 5 +- .../Source/Common/System/DataChunk.cpp | 13 +- .../Common/System/SaveGame/GameStateMap.cpp | 7 +- .../GameEngine/Source/GameClient/Drawable.cpp | 7 +- .../GameClient/GUI/AnimateWindowManager.cpp | 24 +- .../GameClient/GUI/ControlBar/ControlBar.cpp | 22 +- .../GUI/ControlBar/ControlBarScheme.cpp | 15 +- .../ControlBarPopupDescription.cpp | 6 +- .../GameClient/GUI/GUICallbacks/Diplomacy.cpp | 4 +- .../GUI/GUICallbacks/Menus/ChallengeMenu.cpp | 6 +- .../GUI/GUICallbacks/Menus/CreditsMenu.cpp | 4 +- .../GUI/GUICallbacks/Menus/DownloadMenu.cpp | 14 +- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 8 +- .../GUI/GUICallbacks/Menus/ScoreScreen.cpp | 13 +- .../GUICallbacks/Menus/WOLBuddyOverlay.cpp | 8 +- .../GUICallbacks/Menus/WOLGameSetupMenu.cpp | 6 +- .../GUICallbacks/Menus/WOLQuickMatchMenu.cpp | 6 +- .../GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp | 6 +- .../GameClient/GUI/Gadget/GadgetListBox.cpp | 18 +- .../Source/GameClient/GUI/GameWindow.cpp | 6 +- .../GameClient/GUI/GameWindowManager.cpp | 4 +- .../GameClient/GUI/GameWindowTransitions.cpp | 8 +- .../Source/GameClient/GUI/HeaderTemplate.cpp | 6 +- .../Source/GameClient/GUI/IMEManager.cpp | 19 +- .../Source/GameClient/GUI/LoadScreen.cpp | 28 +- .../GameClient/GUI/Shell/ShellMenuScheme.cpp | 9 +- .../Source/GameClient/GameClient.cpp | 11 +- .../GameEngine/Source/GameClient/GameText.cpp | 28 +- .../GameEngine/Source/GameClient/InGameUI.cpp | 11 +- .../GameEngine/Source/GameClient/MapUtil.cpp | 22 +- .../Source/GameClient/System/Anim2D.cpp | 4 +- .../GameClient/System/CampaignManager.cpp | 7 +- .../GameEngine/Source/GameLogic/AI/AI.cpp | 5 +- .../Source/GameLogic/AI/AIPathfind.cpp | 106 +++---- .../Source/GameLogic/Map/PolygonTrigger.cpp | 7 +- .../GameLogic/ScriptEngine/ScriptEngine.cpp | 12 +- .../Source/GameLogic/System/GameLogic.cpp | 22 +- .../Source/GameNetwork/ConnectionManager.cpp | 27 +- .../Source/GameNetwork/FirewallHelper.cpp | 16 +- .../Source/GameNetwork/FrameDataManager.cpp | 8 +- .../Source/GameNetwork/FrameMetrics.cpp | 19 +- .../Source/GameNetwork/GameSpy/LadderDefs.cpp | 6 +- .../Source/GameNetwork/GameSpy/LobbyUtils.cpp | 3 +- .../GameNetwork/GameSpy/MainMenuUtils.cpp | 53 ++-- .../Source/GameNetwork/GameSpy/PeerDefs.cpp | 50 +--- .../GameSpy/StagingRoomGameInfo.cpp | 26 +- .../GameSpy/Thread/BuddyThread.cpp | 3 +- .../GameSpy/Thread/GameResultsThread.cpp | 7 +- .../GameNetwork/GameSpy/Thread/PeerThread.cpp | 3 +- .../Thread/PersistentStorageThread.cpp | 3 +- .../GameNetwork/GameSpy/Thread/PingThread.cpp | 7 +- .../GameEngine/Source/GameNetwork/LANAPI.cpp | 3 +- .../Source/GameNetwork/LANAPICallbacks.cpp | 14 +- .../Source/GameNetwork/LANAPIhandlers.cpp | 1 - .../GameEngine/Source/GameNetwork/NAT.cpp | 20 +- .../Source/GameNetwork/NetCommandMsg.cpp | 18 +- .../GameNetwork/NetCommandWrapperList.cpp | 12 +- .../Source/GameNetwork/Transport.cpp | 10 +- .../W3DDevice/GameClient/BaseHeightMap.cpp | 66 ++--- .../W3DDevice/GameClient/FlatHeightMap.cpp | 7 +- .../Source/W3DDevice/GameClient/HeightMap.cpp | 7 +- .../GameClient/Shadow/W3DVolumetricShadow.cpp | 41 +-- .../W3DDevice/GameClient/W3DDebugIcons.cpp | 2 +- .../W3DDevice/GameClient/W3DRoadBuffer.cpp | 58 ++-- .../Source/W3DDevice/GameClient/W3DScene.cpp | 15 +- .../Source/W3DDevice/GameClient/W3DShroud.cpp | 23 +- .../W3DDevice/GameClient/W3DTerrainVisual.cpp | 21 +- .../W3DDevice/GameClient/W3DTreeBuffer.cpp | 7 +- .../W3DDevice/GameClient/Water/W3DWater.cpp | 6 +- .../W3DDevice/GameClient/WorldHeightMap.cpp | 63 ++-- .../Source/WWVegas/WW3D2/aabtreebuilder.cpp | 17 +- .../Source/WWVegas/WW3D2/aabtreebuilder.h | 6 +- .../Source/WWVegas/WW3D2/animobj.cpp | 12 +- .../Source/WWVegas/WW3D2/assetmgr.cpp | 10 +- .../Libraries/Source/WWVegas/WW3D2/assetmgr.h | 2 +- .../Source/WWVegas/WW3D2/dx8texman.cpp | 1 - .../Source/WWVegas/WW3D2/dx8wrapper.cpp | 6 +- .../Libraries/Source/WWVegas/WW3D2/hlod.cpp | 33 +-- .../Source/WWVegas/WW3D2/hmorphanim.cpp | 24 +- .../Source/WWVegas/WW3D2/hrawanim.cpp | 38 +-- .../Source/WWVegas/WW3D2/htreemgr.cpp | 6 +- .../Source/WWVegas/WW3D2/meshbuild.cpp | 12 +- .../Source/WWVegas/WW3D2/meshmdl.cpp | 40 ++- .../Source/WWVegas/WW3D2/meshmdlio.cpp | 7 +- .../Source/WWVegas/WW3D2/motchan.cpp | 44 +-- .../Source/WWVegas/WW3D2/part_buf.cpp | 277 +++++++----------- .../Source/WWVegas/WW3D2/part_emt.cpp | 76 ++--- .../Source/WWVegas/WW3D2/part_ldr.cpp | 20 +- .../Source/WWVegas/WW3D2/textureloader.cpp | 6 +- .../Source/WWVegas/WW3D2/texturethumbnail.cpp | 9 +- .../Code/Tools/GUIEdit/Source/GUIEdit.cpp | 22 +- .../Code/Tools/WorldBuilder/src/CUndoable.cpp | 10 +- .../Tools/WorldBuilder/src/DrawObject.cpp | 8 +- .../Code/Tools/WorldBuilder/src/MainFrm.cpp | 16 +- .../Tools/WorldBuilder/src/WBPopupSlider.cpp | 6 +- .../Tools/WorldBuilder/src/WHeightMapEdit.cpp | 2 +- .../Code/Tools/WorldBuilder/src/wbview3d.cpp | 20 +- GeneralsMD/Code/Tools/wdump/chunk_d.cpp | 3 +- 258 files changed, 1544 insertions(+), 2750 deletions(-) diff --git a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp index ba1b90c8203..431283bbfee 100644 --- a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp +++ b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp @@ -203,8 +203,7 @@ AudioManager::~AudioManager() delete m_audioSettings; m_audioSettings = NULL; - if (m_savedValues) - delete [] m_savedValues; + delete [] m_savedValues; } //------------------------------------------------------------------------------------------------- @@ -1085,11 +1084,8 @@ AudioHandle AudioManager::allocateNewHandle( void ) //------------------------------------------------------------------------------------------------- void AudioManager::releaseAudioEventRTS( AudioEventRTS *&eventToRelease ) { - if( eventToRelease ) - { - delete eventToRelease; - eventToRelease = NULL; - } + delete eventToRelease; + eventToRelease = NULL; } //------------------------------------------------------------------------------------------------- diff --git a/Core/GameEngine/Source/Common/System/ArchiveFileSystem.cpp b/Core/GameEngine/Source/Common/System/ArchiveFileSystem.cpp index 35f70780987..06d76fffe10 100644 --- a/Core/GameEngine/Source/Common/System/ArchiveFileSystem.cpp +++ b/Core/GameEngine/Source/Common/System/ArchiveFileSystem.cpp @@ -110,10 +110,7 @@ ArchiveFileSystem::~ArchiveFileSystem() ArchiveFileMap::iterator iter = m_archiveFileMap.begin(); while (iter != m_archiveFileMap.end()) { ArchiveFile *file = iter->second; - if (file != NULL) { - delete file; - file = NULL; - } + delete file; iter++; } } diff --git a/Core/GameEngine/Source/Common/System/RAMFile.cpp b/Core/GameEngine/Source/Common/System/RAMFile.cpp index 474e59f906d..1ffb8fea553 100644 --- a/Core/GameEngine/Source/Common/System/RAMFile.cpp +++ b/Core/GameEngine/Source/Common/System/RAMFile.cpp @@ -216,10 +216,7 @@ Bool RAMFile::openFromArchive(File *archiveFile, const AsciiString& filename, In return FALSE; } - if (m_data != NULL) { - delete[] m_data; - m_data = NULL; - } + delete[] m_data; m_data = MSGNEW("RAMFILE") Char [size]; // pool[]ify m_size = size; diff --git a/Core/GameEngine/Source/GameClient/GUI/WindowVideoManager.cpp b/Core/GameEngine/Source/GameClient/GUI/WindowVideoManager.cpp index 4e534315993..4cfd36358bc 100644 --- a/Core/GameEngine/Source/GameClient/GUI/WindowVideoManager.cpp +++ b/Core/GameEngine/Source/GameClient/GUI/WindowVideoManager.cpp @@ -101,9 +101,10 @@ WindowVideo::~WindowVideo( void ) m_videoBuffer = NULL; if ( m_videoStream ) + { m_videoStream->close(); - m_videoStream = NULL; - + m_videoStream = NULL; + } } void WindowVideo::init( GameWindow *win, AsciiString movieName, @@ -140,8 +141,7 @@ WindowVideoManager::WindowVideoManager( void ) while(it != m_playingVideos.end()) { WindowVideo *winVid = it->second; - if(winVid) - delete winVid; + delete winVid; it++; } m_playingVideos.clear(); @@ -157,8 +157,7 @@ WindowVideoManager::~WindowVideoManager( void ) while(it != m_playingVideos.end()) { WindowVideo *winVid = it->second; - if(winVid) - delete winVid; + delete winVid; it++; } m_playingVideos.clear(); @@ -180,8 +179,7 @@ void WindowVideoManager::reset( void ) while(it != m_playingVideos.end()) { WindowVideo *winVid = it->second; - if(winVid) - delete winVid; + delete winVid; it++; } m_playingVideos.clear(); @@ -277,8 +275,10 @@ void WindowVideoManager::playMovie( GameWindow *win, AsciiString movieName, Wind videoBuffer = NULL; if ( videoStream ) + { videoStream->close(); - videoStream = NULL; + videoStream = NULL; + } return; } @@ -349,9 +349,7 @@ void WindowVideoManager::stopAndRemoveMovie( GameWindow *win ) if(it != m_playingVideos.end()) { WindowVideo *winVid = it->second; - if(winVid) - delete winVid; - winVid = NULL; + delete winVid; m_playingVideos.erase(it); } } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/aabtree.cpp b/Core/Libraries/Source/WWVegas/WW3D2/aabtree.cpp index d353ea9a743..ce077c29528 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/aabtree.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/aabtree.cpp @@ -211,18 +211,14 @@ AABTreeClass & AABTreeClass::operator = (const AABTreeClass & that) void AABTreeClass::Reset(void) { NodeCount = 0; - if (Nodes) { - delete[] Nodes; - Nodes = NULL; - } + delete[] Nodes; + Nodes = NULL; + PolyCount = 0; - if (PolyIndices) { - delete[] PolyIndices; - PolyIndices = NULL; - } - if (Mesh) { - Mesh = NULL; - } + delete[] PolyIndices; + PolyIndices = NULL; + + Mesh = NULL; } /*********************************************************************************************** diff --git a/Core/Libraries/Source/WWVegas/WW3D2/agg_def.cpp b/Core/Libraries/Source/WWVegas/WW3D2/agg_def.cpp index 1ebbfcf2029..9353b289781 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/agg_def.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/agg_def.cpp @@ -182,9 +182,7 @@ AggregateDefClass::Free_Subobject_List (void) // Delete all the stucture pointers contained in the subobject list for (int index = 0; index < m_SubobjectList.Count (); index ++) { W3dAggregateSubobjectStruct *pinfo = m_SubobjectList[index]; - if (pinfo) { - delete pinfo; - } + delete pinfo; } // Reset the lists contents @@ -883,7 +881,7 @@ AggregateLoaderClass::Load_W3D (ChunkLoadClass &chunk_load) // Error! Free the definition delete pdefinition; - pdefinition = NULL; + } else { // Success! Create a prototype from the definition diff --git a/Core/Libraries/Source/WWVegas/WW3D2/decalsys.cpp b/Core/Libraries/Source/WWVegas/WW3D2/decalsys.cpp index f6d8c2b40b9..6ea694d29d9 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/decalsys.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/decalsys.cpp @@ -329,10 +329,8 @@ MultiFixedPoolDecalSystemClass::MultiFixedPoolDecalSystemClass(const MultiFixedP MultiFixedPoolDecalSystemClass::~MultiFixedPoolDecalSystemClass(void) { - if (Pools) { - delete [] Pools; - Pools = 0; - } + delete [] Pools; + Pools = NULL; } // This clears the slot in addition to locking the generator, thus preventing any decal id @@ -463,25 +461,21 @@ void MultiFixedPoolDecalSystemClass::LogicalDecalClass::Clear(uint32 decal_id) */ MultiFixedPoolDecalSystemClass::LogicalDecalPoolClass::LogicalDecalPoolClass(void) : - Array(0), + Array(NULL), Size(0) { } MultiFixedPoolDecalSystemClass::LogicalDecalPoolClass::~LogicalDecalPoolClass(void) { - if (Array) { - delete [] Array; - Array = 0; - } + delete [] Array; + Array = NULL; } void MultiFixedPoolDecalSystemClass::LogicalDecalPoolClass::Initialize(uint32 size) { - if (Array) { - delete [] Array; - Array = 0; - } + delete [] Array; + Array = NULL; Size = size; assert(Size); diff --git a/Core/Libraries/Source/WWVegas/WW3D2/distlod.cpp b/Core/Libraries/Source/WWVegas/WW3D2/distlod.cpp index 420ed825fa9..d64078d3f8f 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/distlod.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/distlod.cpp @@ -242,15 +242,12 @@ DistLODDefClass::~DistLODDefClass(void) *=============================================================================================*/ void DistLODDefClass::Free(void) { - if (Name != NULL) { - delete[] Name; - Name = NULL; - } + delete[] Name; + Name = NULL; + if (Lods != NULL) { for (int i=0; i= 0); assert(boneindex < NumPivots); #ifdef LAZY_CAP_MTX_ALLOC - if (Pivot[boneindex].CapTransformPtr) - { - delete Pivot[boneindex].CapTransformPtr; - Pivot[boneindex].CapTransformPtr = NULL; - } + delete Pivot[boneindex].CapTransformPtr; + Pivot[boneindex].CapTransformPtr = NULL; #else Pivot[boneindex].IsCaptured = false; #endif diff --git a/Core/Libraries/Source/WWVegas/WW3D2/matinfo.cpp b/Core/Libraries/Source/WWVegas/WW3D2/matinfo.cpp index 599d0656850..7a413efd890 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/matinfo.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/matinfo.cpp @@ -175,12 +175,8 @@ MaterialRemapperClass::~MaterialRemapperClass(void) SrcMatInfo->Release_Ref(); DestMatInfo->Release_Ref(); - if (TextureRemaps) { - delete[] TextureRemaps; - } - if (VertexMaterialRemaps) { - delete[] VertexMaterialRemaps; - } + delete[] TextureRemaps; + delete[] VertexMaterialRemaps; } TextureClass * MaterialRemapperClass::Remap_Texture(TextureClass * src) diff --git a/Core/Libraries/Source/WWVegas/WW3D2/meshdam.cpp b/Core/Libraries/Source/WWVegas/WW3D2/meshdam.cpp index ff12300c092..410ea5f39df 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/meshdam.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/meshdam.cpp @@ -82,15 +82,11 @@ DamageClass::DamageClass(void): *=============================================================================================*/ DamageClass::~DamageClass(void) { - if (Verts != NULL) { - delete [] Verts; - Verts = NULL; - } + delete [] Verts; + Verts = NULL; - if (Colors != NULL) { - delete[] Colors; - Colors = NULL; - } + delete[] Colors; + Colors = NULL; } /*********************************************************************************************** diff --git a/Core/Libraries/Source/WWVegas/WW3D2/metalmap.cpp b/Core/Libraries/Source/WWVegas/WW3D2/metalmap.cpp index 5a91d8196ff..458ad970d15 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/metalmap.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/metalmap.cpp @@ -175,12 +175,11 @@ MetalMapManagerClass::~MetalMapManagerClass(void) REF_PTR_RELEASE(Textures[i]); } delete [] Textures; - Textures = 0; - } - if (MetalParameters) { - delete [] MetalParameters; - MetalParameters = 0; + Textures = NULL; } + + delete [] MetalParameters; + MetalParameters = NULL; } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/pivot.h b/Core/Libraries/Source/WWVegas/WW3D2/pivot.h index 1c87c8df954..df25b538fcb 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/pivot.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/pivot.h @@ -71,8 +71,7 @@ struct PivotClass ~PivotClass(void) { #ifdef LAZY_CAP_MTX_ALLOC - if (CapTransformPtr) - delete CapTransformPtr; + delete CapTransformPtr; #endif } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/polyinfo.cpp b/Core/Libraries/Source/WWVegas/WW3D2/polyinfo.cpp index 83aa76e4b3c..0e5751d1939 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/polyinfo.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/polyinfo.cpp @@ -62,8 +62,7 @@ void PolygonInfoClass::Set_Vertex_Material(VertexMaterialClass *vertexMaterial) void PolygonInfoClass::Set_Shader(ShaderClass *shader) { - if(Shader) - delete Shader; + delete Shader; // todo : update for refcounted shaders Shader = W3DNEW ShaderClass(* shader); @@ -78,8 +77,7 @@ PolygonInfoClass::~PolygonInfoClass() VertexMaterial->Release_Ref(); // todo : update for refcounted shaders - if(Shader) - delete Shader; + delete Shader; } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/predlod.cpp b/Core/Libraries/Source/WWVegas/WW3D2/predlod.cpp index aceaf7e1b84..dfe2a899629 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/predlod.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/predlod.cpp @@ -381,14 +381,12 @@ void PredictiveLODOptimizerClass::Free(void) { Clear(); - if (ObjectArray) { - delete [] ObjectArray; - ObjectArray = NULL; - ArraySize = 0; - } + delete [] ObjectArray; + ObjectArray = NULL; + ArraySize = 0; // Only the array number one has been allocated... - if (VisibleObjArray1) delete[] VisibleObjArray1; + delete[] VisibleObjArray1; VisibleObjArray1=NULL; VisibleObjArray2=NULL; VisibleObjArraySize = 0; @@ -398,7 +396,7 @@ void PredictiveLODOptimizerClass::AllocVisibleObjArrays(int num_objects) { if (VisibleObjArraySize::ID(T const & object) template void VectorClass::Clear(void) { - if (Vector && IsAllocated) { + if (IsAllocated) { delete[] Vector; Vector = 0; } diff --git a/Core/Libraries/Source/WWVegas/WWLib/bufffile.cpp b/Core/Libraries/Source/WWVegas/WWLib/bufffile.cpp index de68c393e32..cdb910a0eb2 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/bufffile.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/bufffile.cpp @@ -242,11 +242,9 @@ int BufferedFileClass::Seek(int pos, int dir) */ void BufferedFileClass::Reset_Buffer( void ) { - if ( Buffer != NULL ) { - delete [] Buffer; - Buffer = NULL; - BufferSize = 0; - BufferAvailable = 0; - BufferOffset = 0; - } + delete [] Buffer; + Buffer = NULL; + BufferSize = 0; + BufferAvailable = 0; + BufferOffset = 0; } diff --git a/Core/Libraries/Source/WWVegas/WWLib/hash.cpp b/Core/Libraries/Source/WWVegas/WWLib/hash.cpp index d819952acf9..b0350c15af6 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/hash.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/hash.cpp @@ -58,10 +58,8 @@ HashTableClass::HashTableClass( int size ) : HashTableClass::~HashTableClass( void ) { // If we need to, free the hash table - if ( HashTable != NULL) { - delete [] HashTable; - HashTable = NULL; - } + delete [] HashTable; + HashTable = NULL; } void HashTableClass::Reset( void ) diff --git a/Core/Libraries/Source/WWVegas/WWLib/hashtemplate.h b/Core/Libraries/Source/WWVegas/WWLib/hashtemplate.h index 80d640915e8..f3eeea5b919 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/hashtemplate.h +++ b/Core/Libraries/Source/WWVegas/WWLib/hashtemplate.h @@ -402,10 +402,8 @@ template inline HashTemplateClass inline HashTemplateClass::~HashTemplateClass() { - if (Hash) - delete[] Hash; - if (Table) - delete[] Table; + delete[] Hash; + delete[] Table; } // Get_Hash_Value specialization for StringClass. This is intended to be used diff --git a/Core/Libraries/Source/WWVegas/WWLib/sharebuf.h b/Core/Libraries/Source/WWVegas/WWLib/sharebuf.h index 61950b1d1b2..d3d3816f1df 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/sharebuf.h +++ b/Core/Libraries/Source/WWVegas/WWLib/sharebuf.h @@ -115,10 +115,8 @@ ShareBufferClass::ShareBufferClass(const ShareBufferClass & that) : template ShareBufferClass::~ShareBufferClass(void) { - if (Array) { - delete[] Array; - Array = NULL; - } + delete[] Array; + Array = NULL; } template diff --git a/Core/Libraries/Source/WWVegas/WWLib/simplevec.h b/Core/Libraries/Source/WWVegas/WWLib/simplevec.h index 04485232050..05fa5fe2ab9 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/simplevec.h +++ b/Core/Libraries/Source/WWVegas/WWLib/simplevec.h @@ -130,11 +130,9 @@ inline SimpleVecClass::SimpleVecClass(int size) : template inline SimpleVecClass::~SimpleVecClass(void) { - if (Vector != NULL) { - delete[] Vector; - Vector = NULL; - VectorMax = 0; - } + delete[] Vector; + Vector = NULL; + VectorMax = 0; } /*********************************************************************************************** @@ -194,11 +192,9 @@ inline bool SimpleVecClass::Resize(int newsize) /* ** Delete entire vector and reset counts */ + delete[] Vector; + Vector = NULL; VectorMax = 0; - if (Vector != NULL) { - delete[] Vector; - Vector = NULL; - } } return true; } @@ -330,10 +326,8 @@ inline SimpleDynVecClass::SimpleDynVecClass(int size) : template inline SimpleDynVecClass::~SimpleDynVecClass(void) { - if (Vector != NULL) { - delete[] Vector; - Vector = NULL; - } + delete[] Vector; + Vector = NULL; } /*********************************************************************************************** diff --git a/Core/Libraries/Source/WWVegas/WWLib/uarray.h b/Core/Libraries/Source/WWVegas/WWLib/uarray.h index d76d5265096..d601453cfcc 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/uarray.h +++ b/Core/Libraries/Source/WWVegas/WWLib/uarray.h @@ -155,10 +155,8 @@ UniqueArrayClass::UniqueArrayClass(int initial_size,int growth_rate,HashCalcu template UniqueArrayClass::~UniqueArrayClass(void) { - if (HashTable != NULL) { - delete[] HashTable; - HashTable = NULL; - } + delete[] HashTable; + HashTable = NULL; } diff --git a/Core/Libraries/Source/WWVegas/WWMath/aabtreecull.cpp b/Core/Libraries/Source/WWVegas/WWMath/aabtreecull.cpp index 9b38d853010..fe489fa1273 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/aabtreecull.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/aabtreecull.cpp @@ -133,10 +133,8 @@ AABTreeCullSystemClass::~AABTreeCullSystemClass(void) delete RootNode; // Delete indexed node pointer array - if (IndexedNodes) { - delete[] IndexedNodes; - IndexedNodes = NULL; - } + delete[] IndexedNodes; + IndexedNodes = NULL; } @@ -884,10 +882,9 @@ void AABTreeCullSystemClass::Save_Object_Linkage(ChunkSaveClass & csave,Cullable void AABTreeCullSystemClass::Re_Index_Nodes(void) { - if (IndexedNodes != NULL) { - delete[] IndexedNodes; - IndexedNodes = NULL; - } + delete[] IndexedNodes; + IndexedNodes = NULL; + NodeCount = Partition_Node_Count(); WWASSERT(NodeCount > 0); IndexedNodes = new AABTreeNodeClass *[NodeCount]; @@ -936,14 +933,11 @@ AABTreeNodeClass::~AABTreeNodeClass(void) WWASSERT(Object == NULL); // delete our children - if (Front) { - delete Front; - Front = NULL; - } - if (Back) { - delete Back; - Back = NULL; - } + delete Front; + Front = NULL; + + delete Back; + Back = NULL; } void AABTreeNodeClass::Compute_Bounding_Box(void) diff --git a/Core/Libraries/Source/WWVegas/WWMath/gridcull.cpp b/Core/Libraries/Source/WWVegas/WWMath/gridcull.cpp index 33b9138f4b7..b4289656c6f 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/gridcull.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/gridcull.cpp @@ -178,10 +178,8 @@ GridCullSystemClass::GridCullSystemClass(void) : *=============================================================================================*/ GridCullSystemClass::~GridCullSystemClass(void) { - if (Cells != NULL) { - delete Cells; - Cells = NULL; - } + delete Cells; + Cells = NULL; } @@ -470,9 +468,7 @@ void GridCullSystemClass::Re_Partition(const Vector3 & input_min,const Vector3 & OOCellDim.Y = 1.0f / CellDim.Y; OOCellDim.Z = 1.0f / CellDim.Z; - if (Cells != NULL) { - delete[] Cells; - } + delete[] Cells; Cells = W3DNEWARRAY CullableClass * [total_cell_count()]; memset(&(Cells[0]),0,total_cell_count() * sizeof(CullableClass *)); @@ -634,11 +630,7 @@ void GridCullSystemClass::Load(ChunkLoadClass & cload) OOCellDim.Y = 1.0f / CellDim.Y; OOCellDim.Z = 1.0f / CellDim.Z; - if (Cells != NULL) { - delete [] Cells; - Cells = NULL; - } - + delete [] Cells; Cells = W3DNEWARRAY CullableClass * [total_cell_count()]; memset(&(Cells[0]),0,total_cell_count() * sizeof(CullableClass *)); diff --git a/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionmgr.cpp b/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionmgr.cpp index cdd4ea46969..bf356fec0d3 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionmgr.cpp +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionmgr.cpp @@ -479,27 +479,21 @@ DefinitionMgrClass::Free_Definitions (void) DefinitionHash=NULL; } - // - // Free each of the definition objects - // - for (int index = 0; index < _DefinitionCount; index ++) { - DefinitionClass *definition = _SortedDefinitionArray[index]; - if (definition != NULL) { - delete definition; - } - } - // // Free the definition array // if (_SortedDefinitionArray != NULL) { + // + // Free each of the definition objects + // + for (int index = 0; index < _DefinitionCount; index ++) { + delete _SortedDefinitionArray[index]; + } delete [] _SortedDefinitionArray; + _SortedDefinitionArray = NULL; + _MaxDefinitionCount = 0; + _DefinitionCount = 0; } - - _SortedDefinitionArray = NULL; - _MaxDefinitionCount = 0; - _DefinitionCount = 0; - return ; } @@ -527,9 +521,7 @@ DefinitionMgrClass::Prepare_Definition_Array (void) // // Free the old array and start using the new array // - if (_SortedDefinitionArray != NULL) { - delete [] _SortedDefinitionArray; - } + delete [] _SortedDefinitionArray; _SortedDefinitionArray = new_array; _MaxDefinitionCount = new_size; } diff --git a/Core/Libraries/Source/WWVegas/WWSaveLoad/parameterlist.h b/Core/Libraries/Source/WWVegas/WWSaveLoad/parameterlist.h index 24daa98d2b2..bd94499512d 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/parameterlist.h +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/parameterlist.h @@ -148,9 +148,7 @@ ParameterListClass::Free_Parameters (void) // // Free the parameter object // - if (param != NULL) { - delete param; - } + delete param; } Delete_All(); diff --git a/Core/Tools/Autorun/GameText.cpp b/Core/Tools/Autorun/GameText.cpp index 9332136456c..f0989b1f4d7 100644 --- a/Core/Tools/Autorun/GameText.cpp +++ b/Core/Tools/Autorun/GameText.cpp @@ -340,18 +340,11 @@ void GameTextManager::init( void ) void GameTextManager::deinit( void ) { + delete [] m_stringInfo; + m_stringInfo = NULL; - if( m_stringInfo != NULL ) - { - delete [] m_stringInfo; - m_stringInfo = NULL; - } - - if( m_stringLUT != NULL ) - { - delete [] m_stringLUT; - m_stringLUT = NULL; - } + delete [] m_stringLUT; + m_stringLUT = NULL; m_textCount = 0; diff --git a/Core/Tools/Autorun/Locale_API.cpp b/Core/Tools/Autorun/Locale_API.cpp index 28c73f480d8..73aa3aafbfd 100644 --- a/Core/Tools/Autorun/Locale_API.cpp +++ b/Core/Tools/Autorun/Locale_API.cpp @@ -290,11 +290,8 @@ int Locale_Init ( int language, char *file ) void Locale_Restore ( void ) { - if (TheGameText) - { - delete TheGameText; - TheGameText = NULL; - } + delete TheGameText; + TheGameText = NULL; #if( USE_MULTI_FILE_FORMAT ) LOCALE_freetable(); diff --git a/Core/Tools/Autorun/TTFont.cpp b/Core/Tools/Autorun/TTFont.cpp index 491ce8157a1..5a818f2453b 100644 --- a/Core/Tools/Autorun/TTFont.cpp +++ b/Core/Tools/Autorun/TTFont.cpp @@ -1398,14 +1398,11 @@ FontManagerClass::FontManagerClass ( HDC hdc ) *=============================================================================================*/ FontManagerClass::~FontManagerClass ( void ) { - if ( TTButtonFontPtr != NULL ) { - delete TTButtonFontPtr; - TTButtonFontPtr = NULL; - } - if ( TTTextFontPtr != NULL ) { - delete TTTextFontPtr; - TTTextFontPtr = NULL; - } + delete TTButtonFontPtr; + TTButtonFontPtr = NULL; + + delete TTTextFontPtr; + TTTextFontPtr = NULL; } diff --git a/Core/Tools/Autorun/WSYS_RAMFile.cpp b/Core/Tools/Autorun/WSYS_RAMFile.cpp index 79d10c28866..804fafc41b5 100644 --- a/Core/Tools/Autorun/WSYS_RAMFile.cpp +++ b/Core/Tools/Autorun/WSYS_RAMFile.cpp @@ -198,11 +198,8 @@ Bool RAMFile::open( File *file ) void RAMFile::close( void ) { - if ( m_data ) - { - delete [] m_data; - m_data = NULL; - } + delete [] m_data; + m_data = NULL; File::close(); } diff --git a/Core/Tools/Autorun/autorun.cpp b/Core/Tools/Autorun/autorun.cpp index 11a5c8962d8..c36774fd19f 100644 --- a/Core/Tools/Autorun/autorun.cpp +++ b/Core/Tools/Autorun/autorun.cpp @@ -1138,10 +1138,9 @@ LRESULT MainWindow::Window_Proc( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM decision = DialogBox( Main::hInstance, _TEXT( "BitmapDialog" ), hWnd, Dialog_Box_Proc ); - if ( Args ) { - delete( Args ); - Args = NULL; - } + delete( Args ); + Args = NULL; + Stop_Sound_Playing(); MoveWindow( hWnd, 0, 0, 0, 0, TRUE ); @@ -2216,11 +2215,7 @@ void MainWindow::Create_Buttons( HWND hWnd, RECT *dlg_rect ) for ( i = 0; i < NUM_BUTTONS; i++ ) { - if ( ButtonList[i] ) - { - delete( ButtonList[i] ); - } - + delete( ButtonList[i] ); ButtonList[i] = NULL; ButtonSizes[i].left = x_pos; // X position. ButtonSizes[i].top = y_pos; // Y position. @@ -3976,10 +3971,8 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param if( end_dialog ) { for ( i = 0; i < NUM_BUTTONS; i++ ) { - if ( ButtonList[i] ) { - delete( ButtonList[i] ); - ButtonList[i] = NULL; - } + delete( ButtonList[i] ); + ButtonList[i] = NULL; } if ( hpal ) { DeleteObject( hpal ); @@ -4018,10 +4011,8 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param #if(BACKGROUND_BITMAP) for ( i = 0; i < NUM_BUTTONS; i++ ) { - if ( ButtonList[i] ) { - delete( ButtonList[i] ); - ButtonList[i] = NULL; - } + delete( ButtonList[i] ); + ButtonList[i] = NULL; } if ( hpal ) { DeleteObject( hpal ); @@ -4049,10 +4040,9 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param //----------------------------------------------------------------------- // Delete the arguments. //----------------------------------------------------------------------- - if ( Args ) { - delete( Args ); - Args = NULL; - } + delete( Args ); + Args = NULL; + KillTimer( window_handle, timer_id ); EndDialog( window_handle, w_param ); } diff --git a/Core/Tools/Babylon/BabylonDlg.cpp b/Core/Tools/Babylon/BabylonDlg.cpp index 2b73b8aca75..5f1480052d5 100644 --- a/Core/Tools/Babylon/BabylonDlg.cpp +++ b/Core/Tools/Babylon/BabylonDlg.cpp @@ -1138,10 +1138,7 @@ int CBabylonDlg::LoadStrFile ( TransDB *db, const char *filename, void (*cb) ( v db->ClearChanges (); - if ( label ) - { - delete label; - } + delete label; if ( file ) { diff --git a/Core/Tools/Babylon/XLStuff.cpp b/Core/Tools/Babylon/XLStuff.cpp index de276277cd7..59be38979c7 100644 --- a/Core/Tools/Babylon/XLStuff.cpp +++ b/Core/Tools/Babylon/XLStuff.cpp @@ -223,15 +223,8 @@ int PutSeparator ( int row ) range->ReleaseDispatch ( ); - if ( borders ) - { - delete borders ; - } - - if ( border ) - { - delete border ; - } + delete borders; + delete border; VariantClear ( &cell1 ); VariantClear ( &cell2 ); @@ -364,15 +357,8 @@ int PutSection ( int row, OLECHAR *title ) range->ReleaseDispatch ( ); - if ( borders ) - { - delete borders ; - } - - if ( border ) - { - delete border ; - } + delete borders; + delete border; VariantClear ( &cell1 ); VariantClear ( &cell2 ); @@ -475,17 +461,11 @@ void CloseExcel ( void ) { CloseWorkBook (); - if ( range ) - { - delete range; - range = NULL; - } + delete range; + range = NULL; - if ( ws ) - { - delete ws; - ws = NULL; - } + delete ws; + ws = NULL; if ( wbs ) { diff --git a/Core/Tools/Babylon/loadsave.cpp b/Core/Tools/Babylon/loadsave.cpp index 0f9c89a8afd..e3a7c30ebbd 100644 --- a/Core/Tools/Babylon/loadsave.cpp +++ b/Core/Tools/Babylon/loadsave.cpp @@ -583,20 +583,9 @@ int LoadMainDB(TransDB *db, const char *filename, void (*cb) (void) ) error: - if ( label ) - { - delete label; - } - - if ( text ) - { - delete text; - } - - if ( trans ) - { - delete trans; - } + delete label; + delete text; + delete trans; if ( iff ) { diff --git a/Core/Tools/ImagePacker/Source/ImageInfo.cpp b/Core/Tools/ImagePacker/Source/ImageInfo.cpp index 8f24927a8dc..46d483ac0cc 100644 --- a/Core/Tools/ImagePacker/Source/ImageInfo.cpp +++ b/Core/Tools/ImagePacker/Source/ImageInfo.cpp @@ -94,14 +94,8 @@ ImageInfo::ImageInfo( void ) ImageInfo::~ImageInfo( void ) { - // delete path name - if( m_path ) - delete [] m_path; - - if( m_filenameOnly ) - delete [] m_filenameOnly; - - if( m_filenameOnlyNoExt ) - delete [] m_filenameOnlyNoExt; + delete [] m_path; + delete [] m_filenameOnly; + delete [] m_filenameOnlyNoExt; } diff --git a/Core/Tools/ImagePacker/Source/ImagePacker.cpp b/Core/Tools/ImagePacker/Source/ImagePacker.cpp index 8e89774189d..470117db2db 100644 --- a/Core/Tools/ImagePacker/Source/ImagePacker.cpp +++ b/Core/Tools/ImagePacker/Source/ImagePacker.cpp @@ -605,8 +605,7 @@ void ImagePacker::resetImageDirectoryList( void ) void ImagePacker::resetImageList( void ) { - if( m_imageList ) - delete [] m_imageList; + delete [] m_imageList; m_imageList = NULL; m_imageCount = 0; @@ -1138,8 +1137,7 @@ ImagePacker::~ImagePacker( void ) resetPageList(); // delete our targa header loader - if( m_targa ) - delete m_targa; + delete m_targa; } diff --git a/Core/Tools/ImagePacker/Source/TexturePage.cpp b/Core/Tools/ImagePacker/Source/TexturePage.cpp index cee25e8341e..71d8775cb1c 100644 --- a/Core/Tools/ImagePacker/Source/TexturePage.cpp +++ b/Core/Tools/ImagePacker/Source/TexturePage.cpp @@ -875,16 +875,13 @@ TexturePage::~TexturePage( void ) { // delete the canvas - if( m_canvas ) - delete [] m_canvas; + delete [] m_canvas; // delete targa if present, this will NOT delete a user assigned image buffer - if( m_targa ) - delete m_targa; + delete m_targa; // delete the final image buffer if present - if( m_packedImage ) - delete [] m_packedImage; + delete [] m_packedImage; } diff --git a/Core/Tools/Launcher/Toolkit/Support/UString.cpp b/Core/Tools/Launcher/Toolkit/Support/UString.cpp index c8c09a0b7ee..12ccb8237f3 100644 --- a/Core/Tools/Launcher/Toolkit/Support/UString.cpp +++ b/Core/Tools/Launcher/Toolkit/Support/UString.cpp @@ -266,10 +266,7 @@ UString::UString(const UString& s) UString::~UString() { - if (mData != NULL) - { - delete mData; - } + delete mData; } @@ -1323,11 +1320,7 @@ bool UString::AllocString(UInt size) data[0] = 0; - if (mData != NULL) - { - delete mData; - } - + delete mData; mData = data; mCapacity = size; diff --git a/Core/Tools/Launcher/streamer.cpp b/Core/Tools/Launcher/streamer.cpp index 24a316123cb..061baad77db 100644 --- a/Core/Tools/Launcher/streamer.cpp +++ b/Core/Tools/Launcher/streamer.cpp @@ -43,8 +43,8 @@ Streamer::~Streamer() ///////// calling sync seems to cause crashes here on Win32 //sync(); ///////// - if (Buf) - delete[] Buf; + + delete[] Buf; } int Streamer::setOutputDevice(OutputDevice *device) diff --git a/Core/Tools/Launcher/wstring.cpp b/Core/Tools/Launcher/wstring.cpp index 0cf92d94499..cec002a6b64 100644 --- a/Core/Tools/Launcher/wstring.cpp +++ b/Core/Tools/Launcher/wstring.cpp @@ -151,9 +151,7 @@ bit8 Wstring::cat(const char *s) strcat(str, s); - // delete the old string. - if(oldStr) - delete[](oldStr); + delete[](oldStr); return(TRUE); } @@ -188,9 +186,7 @@ bit8 Wstring::cat(uint32 size, const char *s) strncat(str, s, size); - // delete the old string. - if(oldStr) - delete[](oldStr); + delete[](oldStr); return(TRUE); } @@ -309,8 +305,7 @@ void Wstring::removeSpaces(void) void Wstring::clear(void) { - if(str) - delete[](str); + delete[](str); str=NULL; } diff --git a/Core/Tools/W3DView/Utils.h b/Core/Tools/W3DView/Utils.h index c8346d6fb79..62e94105634 100644 --- a/Core/Tools/W3DView/Utils.h +++ b/Core/Tools/W3DView/Utils.h @@ -36,17 +36,8 @@ class RenderObjClass; // // Macros // -#define SAFE_DELETE(pobject) \ - if (pobject) { \ - delete pobject; \ - pobject = NULL; \ - } \ - -#define SAFE_DELETE_ARRAY(pobject) \ - if (pobject) { \ - delete [] pobject; \ - pobject = NULL; \ - } \ +#define SAFE_DELETE(pobject) { delete pobject; pobject = NULL; } +#define SAFE_DELETE_ARRAY(pobject) { delete [] pobject; pobject = NULL; } #define SAFE_ADD_REF(pobject) \ if (pobject) { \ diff --git a/Core/Tools/W3DView/W3DViewDoc.cpp b/Core/Tools/W3DView/W3DViewDoc.cpp index 054008126eb..19bd7530db1 100644 --- a/Core/Tools/W3DView/W3DViewDoc.cpp +++ b/Core/Tools/W3DView/W3DViewDoc.cpp @@ -197,10 +197,8 @@ CW3DViewDoc::CleanupResources (void) } // Was there a dazzle layer? - if (m_pDazzleLayer) { - delete m_pDazzleLayer; - m_pDazzleLayer = NULL; - } + delete m_pDazzleLayer; + m_pDazzleLayer = NULL; // Was there a valid scene object? if (m_pCBackObjectScene) diff --git a/Core/Tools/mangler/wlib/streamer.cpp b/Core/Tools/mangler/wlib/streamer.cpp index 24a316123cb..061baad77db 100644 --- a/Core/Tools/mangler/wlib/streamer.cpp +++ b/Core/Tools/mangler/wlib/streamer.cpp @@ -43,8 +43,8 @@ Streamer::~Streamer() ///////// calling sync seems to cause crashes here on Win32 //sync(); ///////// - if (Buf) - delete[] Buf; + + delete[] Buf; } int Streamer::setOutputDevice(OutputDevice *device) diff --git a/Core/Tools/mangler/wlib/wstring.cpp b/Core/Tools/mangler/wlib/wstring.cpp index 94e9f30de96..a19c9aaa002 100644 --- a/Core/Tools/mangler/wlib/wstring.cpp +++ b/Core/Tools/mangler/wlib/wstring.cpp @@ -265,8 +265,7 @@ void Wstring::removeSpaces(void) void Wstring::clear(void) { - if(str) - delete[](str); + delete[](str); strsize=0; str=NULL; } diff --git a/Core/Tools/matchbot/main.cpp b/Core/Tools/matchbot/main.cpp index fcbaa3f4707..2155fbc4e73 100644 --- a/Core/Tools/matchbot/main.cpp +++ b/Core/Tools/matchbot/main.cpp @@ -240,10 +240,11 @@ int main(int argc, char ** argv) exit( -1); } - if (s_generalsMatcher) - delete s_generalsMatcher; - if (s_generalsClientMatcher) - delete s_generalsClientMatcher; + delete s_generalsMatcher; + s_generalsMatcher = NULL; + + delete s_generalsClientMatcher; + s_generalsClientMatcher = NULL; return 0; } diff --git a/Core/Tools/matchbot/mydebug.cpp b/Core/Tools/matchbot/mydebug.cpp index 7a4da3ab8fd..3ad1e156e40 100644 --- a/Core/Tools/matchbot/mydebug.cpp +++ b/Core/Tools/matchbot/mydebug.cpp @@ -80,12 +80,7 @@ int MyMsgManager::ReplaceAllStreams(FileD * output_device, const char *device_fi MYDEBUGLOCK; delete(paranoid_ostream); - - if (output_device != NULL) - { - delete(output_device); - output_device = NULL; - } + delete(output_device); rename(device_filename, copy_filename); diff --git a/Core/Tools/matchbot/wlib/streamer.cpp b/Core/Tools/matchbot/wlib/streamer.cpp index 24a316123cb..061baad77db 100644 --- a/Core/Tools/matchbot/wlib/streamer.cpp +++ b/Core/Tools/matchbot/wlib/streamer.cpp @@ -43,8 +43,8 @@ Streamer::~Streamer() ///////// calling sync seems to cause crashes here on Win32 //sync(); ///////// - if (Buf) - delete[] Buf; + + delete[] Buf; } int Streamer::setOutputDevice(OutputDevice *device) diff --git a/Core/Tools/matchbot/wlib/wdebug.cpp b/Core/Tools/matchbot/wlib/wdebug.cpp index a7490a1bbb1..8dd5005ecbc 100644 --- a/Core/Tools/matchbot/wlib/wdebug.cpp +++ b/Core/Tools/matchbot/wlib/wdebug.cpp @@ -85,12 +85,7 @@ int MsgManager::ReplaceAllStreams(FileD * output_device, IN char *device_filenam delete(info_ostream); delete(warn_ostream); delete(error_ostream); - - if (output_device != NULL) - { - delete(output_device); - output_device = NULL; - } + delete(output_device); rename(device_filename, copy_filename); diff --git a/Core/Tools/matchbot/wlib/wstring.cpp b/Core/Tools/matchbot/wlib/wstring.cpp index 94e9f30de96..a19c9aaa002 100644 --- a/Core/Tools/matchbot/wlib/wstring.cpp +++ b/Core/Tools/matchbot/wlib/wstring.cpp @@ -265,8 +265,7 @@ void Wstring::removeSpaces(void) void Wstring::clear(void) { - if(str) - delete[](str); + delete[](str); strsize=0; str=NULL; } diff --git a/Generals/Code/GameEngine/Include/Common/INIException.h b/Generals/Code/GameEngine/Include/Common/INIException.h index afbbee3e821..5afca81bc13 100644 --- a/Generals/Code/GameEngine/Include/Common/INIException.h +++ b/Generals/Code/GameEngine/Include/Common/INIException.h @@ -45,8 +45,6 @@ class INIException ~INIException() { - if (mFailureMessage) { - delete [] mFailureMessage; - } + delete [] mFailureMessage; } }; diff --git a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp index fabdc0fc778..c2b324641c0 100644 --- a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp @@ -727,8 +727,7 @@ void GameEngine::reset( void ) if (deleteNetwork) { DEBUG_ASSERTCRASH(TheNetwork, ("Deleting NULL TheNetwork!")); - if (TheNetwork) - delete TheNetwork; + delete TheNetwork; TheNetwork = NULL; } if(background) diff --git a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index 82eca2cb91a..03ea8267ea5 100644 --- a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -118,15 +118,9 @@ BuildAssistant::BuildAssistant( void ) BuildAssistant::~BuildAssistant( void ) { - // delete build position array if we used it - if( m_buildPositions ) - { - - delete [] m_buildPositions; - m_buildPositions = NULL; - m_buildPositionSize = 0; - - } + delete [] m_buildPositions; + m_buildPositions = NULL; + m_buildPositionSize = 0; } diff --git a/Generals/Code/GameEngine/Source/Common/System/CDManager.cpp b/Generals/Code/GameEngine/Source/Common/System/CDManager.cpp index aa837d2a0b2..a5eee9f9a8d 100644 --- a/Generals/Code/GameEngine/Source/Common/System/CDManager.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/CDManager.cpp @@ -284,10 +284,7 @@ void CDManager::destroyAllDrives( void ) { node->remove(); CDDriveInterface *drive = (CDDriveInterface *) node->item(); - if ( drive ) - { - delete drive; - } + delete drive; } } diff --git a/Generals/Code/GameEngine/Source/Common/System/DataChunk.cpp b/Generals/Code/GameEngine/Source/Common/System/DataChunk.cpp index f3d8ff1c842..427770b7ccb 100644 --- a/Generals/Code/GameEngine/Source/Common/System/DataChunk.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/DataChunk.cpp @@ -44,10 +44,8 @@ CachedFileInputStream::CachedFileInputStream(void):m_buffer(NULL),m_size(0) CachedFileInputStream::~CachedFileInputStream(void) { - if (m_buffer) { - delete[] m_buffer; - m_buffer=NULL; - } + delete[] m_buffer; + m_buffer=NULL; } Bool CachedFileInputStream::open(AsciiString path) @@ -104,10 +102,9 @@ Bool CachedFileInputStream::open(AsciiString path) void CachedFileInputStream::close(void) { - if (m_buffer) { - delete[] m_buffer; - m_buffer=NULL; - } + delete[] m_buffer; + m_buffer=NULL; + m_pos=0; m_size=0; } diff --git a/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp b/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp index 604cd46a4ad..c10fc093f42 100644 --- a/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp @@ -414,10 +414,8 @@ void GameStateMap::xfer( Xfer *xfer ) } xfer->xferSnapshot(TheSkirmishGameInfo); } else { - if (TheSkirmishGameInfo) { - delete TheSkirmishGameInfo; - TheSkirmishGameInfo = NULL; - } + delete TheSkirmishGameInfo; + TheSkirmishGameInfo = NULL; } // diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index 63a4aaf3ec0..3fa3a88ece3 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -275,11 +275,8 @@ const Int MAX_ENABLED_MODULES = 16; //------------------------------------------------------------------------------------------------- /*static*/ void Drawable::killStaticImages() { - if( s_animationTemplates ) - { - delete[] s_animationTemplates; - s_animationTemplates = NULL; - } + delete[] s_animationTemplates; + s_animationTemplates = NULL; } //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp index ffdc44e8904..ddede34cb3b 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp @@ -137,22 +137,14 @@ AnimateWindowManager::AnimateWindowManager( void ) } AnimateWindowManager::~AnimateWindowManager( void ) { - if(m_slideFromRight) - delete m_slideFromRight; - if(m_slideFromRightFast) - delete m_slideFromRightFast; - if(m_slideFromLeft) - delete m_slideFromLeft; - if(m_slideFromTop) - delete m_slideFromTop; - if(m_slideFromTopFast) - delete m_slideFromTopFast; - if(m_slideFromBottom) - delete m_slideFromBottom; - if(m_spiral) - delete m_spiral; - if (m_slideFromBottomTimed) - delete m_slideFromBottomTimed; + delete m_slideFromRight; + delete m_slideFromRightFast; + delete m_slideFromLeft; + delete m_slideFromTop; + delete m_slideFromTopFast; + delete m_slideFromBottom; + delete m_spiral; + delete m_slideFromBottomTimed; m_slideFromRight = NULL; resetToRestPosition( ); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 65e27e967c6..5c1c11c9974 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -975,29 +975,25 @@ ControlBar::~ControlBar( void ) m_scienceLayout = NULL; } m_genArrow = NULL; - if(m_videoManager) - delete m_videoManager; - m_videoManager = NULL; + delete m_videoManager; + m_videoManager = NULL; - if(m_animateWindowManagerForGenShortcuts) - delete m_animateWindowManagerForGenShortcuts; + delete m_animateWindowManagerForGenShortcuts; m_animateWindowManagerForGenShortcuts = NULL; - if(m_animateWindowManager) - delete m_animateWindowManager; + + delete m_animateWindowManager; m_animateWindowManager = NULL; - if(m_generalsScreenAnimate) - delete m_generalsScreenAnimate; + delete m_generalsScreenAnimate; m_generalsScreenAnimate = NULL; - if( m_controlBarSchemeManager ) - delete m_controlBarSchemeManager; + delete m_controlBarSchemeManager; m_controlBarSchemeManager = NULL; -// if(m_controlBarResizer) -// delete m_controlBarResizer; +// delete m_controlBarResizer; // m_controlBarResizer = NULL; + // destroy all the command set definitions CommandSet *set; while( m_commandSets ) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp index b958f3f4404..b48d511c130 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp @@ -216,9 +216,7 @@ void ControlBarScheme::reset(void) while (it != m_layer[i].end()) { ControlBarSchemeImage *im = *it; - if( im ) - delete im; - im = NULL; + delete im; it ++; } m_layer[i].clear(); @@ -231,12 +229,7 @@ void ControlBarScheme::reset(void) while (it != m_animations.end()) { ControlBarSchemeAnimation *anim = *it; - if( anim ) - { - anim->m_animImage = NULL; - delete(anim); - } - anim = NULL; + delete anim; it ++; } m_animations.clear(); @@ -837,9 +830,7 @@ ControlBarSchemeManager::~ControlBarSchemeManager( void ) while (it != m_schemeList.end()) { ControlBarScheme *CBScheme = *it; - if( CBScheme ) - delete CBScheme; - CBScheme = NULL; + delete CBScheme; it ++; } m_schemeList.clear(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp index e217dc8d378..2376ed7b8ed 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp @@ -114,7 +114,7 @@ void ControlBarPopupDescriptionUpdateFunc( WindowLayout *layout, void *param ) { Bool wasFinished = theAnimateWindowManager->isFinished(); theAnimateWindowManager->update(); - if (theAnimateWindowManager && theAnimateWindowManager->isFinished() && !wasFinished && theAnimateWindowManager->isReversed()) + if (theAnimateWindowManager->isFinished() && !wasFinished && theAnimateWindowManager->isReversed()) { delete theAnimateWindowManager; theAnimateWindowManager = NULL; @@ -642,8 +642,8 @@ void ControlBar::deleteBuildTooltipLayout( void ) // m_buildToolTipLayout->destroyWindows(); // deleteInstance(m_buildToolTipLayout); // m_buildToolTipLayout = NULL; - if(theAnimateWindowManager) - delete theAnimateWindowManager; + + delete theAnimateWindowManager; theAnimateWindowManager = NULL; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp index 63d6d2a053f..f0ed71896ef 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp @@ -290,8 +290,8 @@ void ResetDiplomacy( void ) theLayout = NULL; } theWindow = NULL; - if (theAnimateWindowManager) - delete theAnimateWindowManager; + + delete theAnimateWindowManager; theAnimateWindowManager = NULL; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp index 4fe6a8dfbd9..f5c924b0fa1 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp @@ -80,8 +80,8 @@ static GameWindow *parentMainMenu = NULL; void CreditsMenuInit( WindowLayout *layout, void *userData ) { TheShell->showShellMap(FALSE); - if(TheCredits) - delete TheCredits; + + delete TheCredits; TheCredits = new CreditsManager; TheCredits->load(); TheCredits->init(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp index 86308d2ca56..13c0387fa23 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp @@ -262,10 +262,8 @@ void DownloadMenuInit( WindowLayout *layout, void *userData ) progressBarMunkee = TheWindowManager->winGetWindowFromId( parent, progressBarMunkeeID ); DEBUG_ASSERTCRASH(!TheDownloadManager, ("Download manager already exists")); - if (TheDownloadManager) - { - delete TheDownloadManager; - } + + delete TheDownloadManager; TheDownloadManager = NEW DownloadManagerMunkee; } @@ -276,11 +274,9 @@ void DownloadMenuInit( WindowLayout *layout, void *userData ) void DownloadMenuShutdown( WindowLayout *layout, void *userData ) { DEBUG_ASSERTCRASH(TheDownloadManager, ("No download manager")); - if (TheDownloadManager) - { - delete TheDownloadManager; - TheDownloadManager = NULL; - } + + delete TheDownloadManager; + TheDownloadManager = NULL; staticTextSize = NULL; staticTextTime = NULL; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index e5d8f047c50..af588896d77 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -2168,11 +2168,9 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, { // go back one screen //TheShell->pop(); - if (pref) - { - delete pref; - pref = NULL; - } + + delete pref; + pref = NULL; comboBoxLANIP = NULL; comboBoxOnlineIP = NULL; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp index b6f5dd70b98..f6190b0978c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp @@ -628,8 +628,10 @@ void PlayMovieAndBlock(AsciiString movieTitle) videoBuffer = NULL; if ( videoStream ) + { videoStream->close(); - videoStream = NULL; + videoStream = NULL; + } return; } @@ -666,11 +668,10 @@ void PlayMovieAndBlock(AsciiString movieTitle) } TheWritableGlobalData->m_loadScreenRender = FALSE; movieWindow->winGetInstanceData()->setVideoBuffer(NULL); - if (videoBuffer) - { - delete videoBuffer; - videoBuffer = NULL; - } + + delete videoBuffer; + videoBuffer = NULL; + if (videoStream) { videoStream->close(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp index 87d5a651ccb..d0495d7e927 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp @@ -1271,11 +1271,9 @@ WindowMsgHandledType WOLBuddyOverlayRCMenuSystem( GameWindow *window, UnsignedIn else if (rcData->m_itemType == ITEM_REQUEST) isRequest = TRUE; - if(rcData) - { - delete rcData; - rcData = NULL; - } + delete rcData; + rcData = NULL; + window->winSetUserData(NULL); //DEBUG_ASSERTCRASH(profileID > 0, ("Bad profile ID in user data!")); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp index 1490af33dfb..992aa30931d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp @@ -1198,10 +1198,8 @@ void WOLGameSetupMenuInit( WindowLayout *layout, void *userData ) } TheGameSpyInfo->setCurrentGroupRoom(0); - if (TheNAT != NULL) { - delete TheNAT; - TheNAT = NULL; - } + delete TheNAT; + TheNAT = NULL; nextScreen = NULL; buttonPushed = false; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp index 481b475b744..2c556656d7f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp @@ -741,10 +741,8 @@ void WOLQuickMatchMenuInit( WindowLayout *layout, void *userData ) isShuttingDown = false; raiseMessageBoxes = true; - if (TheNAT != NULL) { - delete TheNAT; - TheNAT = NULL; - } + delete TheNAT; + TheNAT = NULL; parentWOLQuickMatchID = NAMEKEY( "WOLQuickMatchMenu.wnd:WOLQuickMatchMenuParent" ); buttonBackID = NAMEKEY( "WOLQuickMatchMenu.wnd:ButtonBack" ); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp index 4a7396c3db5..32c5c799164 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp @@ -553,10 +553,8 @@ void WOLWelcomeMenuShutdown( WindowLayout *layout, void *userData ) { listboxInfo = NULL; - if (TheFirewallHelper != NULL) { - delete TheFirewallHelper; - TheFirewallHelper = NULL; - } + delete TheFirewallHelper; + TheFirewallHelper = NULL; isShuttingDown = TRUE; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp index c5f17f3bf0f..a2b8bc5f3f7 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp @@ -1968,10 +1968,8 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, } delete[]( list->listData ); - if( list->columnWidth ) - delete[]( list->columnWidth ); - if( list->columnWidthPercentage ) - delete[]( list->columnWidthPercentage ); + delete[]( list->columnWidth ); + delete[]( list->columnWidthPercentage ); if( list->multiSelect ) delete[]( list->selections ); @@ -2459,13 +2457,8 @@ void GadgetListBoxRemoveMultiSelect( GameWindow *listbox ) { ListboxData *listData = (ListboxData *)listbox->winGetUserData(); - if( listData->selections ) - { - - delete[]( listData->selections ); - listData->selections = NULL; - - } + delete[]( listData->selections ); + listData->selections = NULL; listData->multiSelect = FALSE; @@ -2556,8 +2549,7 @@ void GadgetListBoxSetListLength( GameWindow *listbox, Int newLength ) listboxData->listLength = newLength; - if( listboxData->listData ) - delete[]( listboxData->listData ); + delete[]( listboxData->listData ); listboxData->listData = newData; //reset the total height diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp index e3703cbfbe2..0f4eafeed60 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp @@ -124,12 +124,10 @@ GameWindow::GameWindow( void ) GameWindow::~GameWindow( void ) { - if( m_inputData ) - delete m_inputData; + delete m_inputData; m_inputData = NULL; - if( m_editData ) - delete m_editData; + delete m_editData; m_editData = NULL; unlinkFromTransitionWindows(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp index 34d40de2b08..71aaf02bd3e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp @@ -204,8 +204,8 @@ GameWindowManager::~GameWindowManager( void ) // destroy all windows winDestroyAll(); freeStaticStrings(); - if(TheTransitionHandler) - delete TheTransitionHandler; + + delete TheTransitionHandler; TheTransitionHandler = NULL; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp index 723224bd3db..3a86b422559 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp @@ -157,9 +157,8 @@ TransitionWindow::~TransitionWindow( void ) m_win->unlinkTransitionWindow(this); m_win = NULL; - if(m_transition) - delete m_transition; + delete m_transition; m_transition = NULL; } @@ -172,9 +171,7 @@ Bool TransitionWindow::init( void ) // if( !m_win ) // return FALSE; - if(m_transition) - delete m_transition; - + delete m_transition; m_transition = getTransitionForStyle( m_style ); m_transition->init(m_win); @@ -253,7 +250,6 @@ TransitionGroup::~TransitionGroup( void ) { TransitionWindow *tWin = *it; delete tWin; - tWin = NULL; it = m_transitionWindowList.erase(it); } } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp index 3ee1d101401..c974cbb59c3 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp @@ -124,11 +124,7 @@ HeaderTemplateManager::~HeaderTemplateManager( void ) while(it != m_headerTemplateList.end()) { HeaderTemplate *hTemplate = *it; - if(hTemplate) - { - hTemplate->m_font = NULL; - delete hTemplate; - } + delete hTemplate; it = m_headerTemplateList.erase(it); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp index 442595b22e6..6e2c250e2df 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp @@ -540,10 +540,7 @@ IMEManager::~IMEManager() TheWindowManager->winDestroy( m_statusWindow ); } - if ( m_candidateString ) - { - delete [] m_candidateString; - } + delete [] m_candidateString; detatch(); ImmAssociateContext( ApplicationHWnd, m_oldContext ); @@ -1321,11 +1318,8 @@ void IMEManager::closeCandidateList( Int candidateFlags ) TheWindowManager->winUnsetModal( m_candidateWindow ); } - if ( m_candidateString ) - { - delete [] m_candidateString; - m_candidateString = NULL; - } + delete [] m_candidateString; + m_candidateString = NULL; m_candidateCount = 0; @@ -1338,11 +1332,8 @@ void IMEManager::closeCandidateList( Int candidateFlags ) void IMEManager::updateCandidateList( Int candidateFlags ) { - if ( m_candidateString ) - { - delete [] m_candidateString; - m_candidateString = NULL; - } + delete [] m_candidateString; + m_candidateString = NULL; m_pageSize = 10; m_candidateCount = 0; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp index ad15cbdd932..6eb6da869ac 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp @@ -178,13 +178,15 @@ SinglePlayerLoadScreen::~SinglePlayerLoadScreen( void ) m_objectiveWin = NULL; for(Int i = 0; i < MAX_OBJECTIVE_LINES; ++i) m_objectiveLines[i] = NULL; - if(m_videoBuffer) - delete m_videoBuffer; + + delete m_videoBuffer; m_videoBuffer = NULL; if ( m_videoStream ) + { m_videoStream->close(); - m_videoStream = NULL; + m_videoStream = NULL; + } TheAudio->removeAudioEvent( m_ambientLoopHandle ); m_ambientLoopHandle = NULL; @@ -474,8 +476,10 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) m_videoBuffer = NULL; if ( m_videoStream ) + { m_videoStream->close(); - m_videoStream = NULL; + m_videoStream = NULL; + } return; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp index cddb8c76b96..afdd5038e3f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp @@ -136,8 +136,7 @@ ShellMenuScheme::~ShellMenuScheme( void ) { ShellMenuSchemeImage *image = *it; it = m_imageList.erase( it ); - if(image) - delete image; + delete image; } ShellMenuSchemeLineListIt lineIt = m_lineList.begin(); @@ -145,8 +144,7 @@ ShellMenuScheme::~ShellMenuScheme( void ) { ShellMenuSchemeLine *line = *lineIt; lineIt = m_lineList.erase( lineIt ); - if(line) - delete line; + delete line; } @@ -215,8 +213,7 @@ ShellMenuSchemeManager::~ShellMenuSchemeManager( void ) { ShellMenuScheme *scheme = *it; it = m_schemeList.erase( it ); - if(scheme) - delete scheme; + delete scheme; } } diff --git a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp index adecd04c4aa..f1012f7b59d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -122,11 +122,8 @@ GameClient::~GameClient() TheGraphDraw = NULL; #endif - if (TheDrawGroupInfo) - { - delete TheDrawGroupInfo; - TheDrawGroupInfo = NULL; - } + delete TheDrawGroupInfo; + TheDrawGroupInfo = NULL; // clear any drawable TOC we might have m_drawableTOC.clear(); @@ -142,8 +139,8 @@ GameClient::~GameClient() // DEBUG_LOG(("%s", preloadTextureNamesGlobalHack[oog])); //} //DEBUG_LOG(("End Texture files ------------------------------------------------")); - if(TheCampaignManager) - delete TheCampaignManager; + + delete TheCampaignManager; TheCampaignManager = NULL; // destroy all Drawables diff --git a/Generals/Code/GameEngine/Source/GameClient/GameText.cpp b/Generals/Code/GameEngine/Source/GameClient/GameText.cpp index 196e4a2d376..eb64468e56f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GameText.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GameText.cpp @@ -379,17 +379,11 @@ void GameTextManager::init( void ) void GameTextManager::deinit( void ) { - if( m_stringInfo != NULL ) - { - delete [] m_stringInfo; - m_stringInfo = NULL; - } + delete [] m_stringInfo; + m_stringInfo = NULL; - if( m_stringLUT != NULL ) - { - delete [] m_stringLUT; - m_stringLUT = NULL; - } + delete [] m_stringLUT; + m_stringLUT = NULL; m_textCount = 0; @@ -418,17 +412,11 @@ void GameTextManager::deinit( void ) void GameTextManager::reset( void ) { - if( m_mapStringInfo != NULL ) - { - delete [] m_mapStringInfo; - m_mapStringInfo = NULL; - } + delete [] m_mapStringInfo; + m_mapStringInfo = NULL; - if( m_mapStringLUT != NULL ) - { - delete [] m_mapStringLUT; - m_mapStringLUT = NULL; - } + delete [] m_mapStringLUT; + m_mapStringLUT = NULL; } diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index bd4247d6729..75d02e04c18 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -5587,14 +5587,9 @@ void InGameUI::recreateControlBar( void ) createControlBar(); - if(TheControlBar) - { - delete TheControlBar; - TheControlBar = NEW ControlBar; - TheControlBar->init(); - } - - + delete TheControlBar; + TheControlBar = NEW ControlBar; + TheControlBar->init(); } void InGameUI::refreshCustomUiResources(void) diff --git a/Generals/Code/GameEngine/Source/GameClient/MapUtil.cpp b/Generals/Code/GameEngine/Source/GameClient/MapUtil.cpp index c4c18921d96..d5b7885e7b0 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MapUtil.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MapUtil.cpp @@ -275,17 +275,12 @@ static Bool loadMap( AsciiString filename ) static void resetMap( void ) { - if (m_data) - { - delete[] m_data; - m_data = 0; - } + delete[] m_data; + m_data = NULL; + + delete m_waypoints; + m_waypoints = NULL; - if (m_waypoints) - { - delete m_waypoints; - m_waypoints = 0; - } m_techPositions.clear(); m_supplyPositions.clear(); } @@ -907,11 +902,8 @@ typedef MapDisplayToFileNameList::iterator MapDisplayToFileNameListIter; ++curNumPlayersInMap; } - if (battleHonors) - { - delete battleHonors; - battleHonors = NULL; - } + delete battleHonors; + battleHonors = NULL; GadgetListBoxSetSelected(listbox, &selectionIndex, 1); if (selectionIndex >= 0) diff --git a/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp b/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp index a77374eeccd..7467f28aa7e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp @@ -66,9 +66,7 @@ Anim2DTemplate::Anim2DTemplate( AsciiString name ) Anim2DTemplate::~Anim2DTemplate( void ) { - // delete the images - if( m_images ) - delete [] m_images; + delete [] m_images; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp index 88a1ef3a871..89cf29d84fa 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp @@ -367,10 +367,9 @@ void AI::update( void ) */ AI::~AI() { - if (m_pathfinder) { - delete m_pathfinder; - } + delete m_pathfinder; m_pathfinder = NULL; + while (m_aiData) { TAiData *cur = m_aiData; diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 93026c82810..0fa1a389c21 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -1945,22 +1945,17 @@ ZoneBlock::~ZoneBlock() void ZoneBlock::freeZones(void) { - if (m_groundCliffZones) { - delete [] m_groundCliffZones; - m_groundCliffZones = NULL; - } - if (m_groundWaterZones) { - delete [] m_groundWaterZones; - m_groundWaterZones = NULL; - } - if (m_groundRubbleZones) { - delete [] m_groundRubbleZones; - m_groundRubbleZones = NULL; - } - if (m_crusherZones) { - delete [] m_crusherZones; - m_crusherZones = NULL; - } + delete [] m_groundCliffZones; + m_groundCliffZones = NULL; + + delete [] m_groundWaterZones; + m_groundWaterZones = NULL; + + delete [] m_groundRubbleZones; + m_groundRubbleZones = NULL; + + delete [] m_crusherZones; + m_crusherZones = NULL; } /* Allocate zone equivalency arrays large enough to hold required entries. If the arrays are already @@ -2146,43 +2141,35 @@ PathfindZoneManager::~PathfindZoneManager() void PathfindZoneManager::freeZones() { - if (m_groundCliffZones) { - delete [] m_groundCliffZones; - m_groundCliffZones = NULL; - } - if (m_groundWaterZones) { - delete [] m_groundWaterZones; - m_groundWaterZones = NULL; - } - if (m_groundRubbleZones) { - delete [] m_groundRubbleZones; - m_groundRubbleZones = NULL; - } - if (m_terrainZones) { - delete [] m_terrainZones; - m_terrainZones = NULL; - } - if (m_crusherZones) { - delete [] m_crusherZones; - m_crusherZones = NULL; - } - if (m_hierarchicalZones) { - delete [] m_hierarchicalZones; - m_hierarchicalZones = NULL; - } + delete [] m_groundCliffZones; + m_groundCliffZones = NULL; + + delete [] m_groundWaterZones; + m_groundWaterZones = NULL; + + delete [] m_groundRubbleZones; + m_groundRubbleZones = NULL; + + delete [] m_terrainZones; + m_terrainZones = NULL; + + delete [] m_crusherZones; + m_crusherZones = NULL; + + delete [] m_hierarchicalZones; + m_hierarchicalZones = NULL; + m_zonesAllocated = 0; } void PathfindZoneManager::freeBlocks() { - if (m_blockOfZoneBlocks) { - delete [] m_blockOfZoneBlocks; - m_blockOfZoneBlocks = NULL; - } - if (m_zoneBlocks) { - delete [] m_zoneBlocks; - m_zoneBlocks = NULL; - } + delete [] m_blockOfZoneBlocks; + m_blockOfZoneBlocks = NULL; + + delete [] m_zoneBlocks; + m_zoneBlocks = NULL; + m_zoneBlockExtent.x = 0; m_zoneBlockExtent.y = 0; } @@ -2782,7 +2769,7 @@ PathfindLayer::~PathfindLayer() } /** - * Returns true if the layer is avaialble for use. + * Returns true if the layer is available for use. */ void PathfindLayer::reset(void) { @@ -2798,10 +2785,10 @@ void PathfindLayer::reset(void) delete [] m_layerCells; m_layerCells = NULL; } - if (m_blockOfMapCells) { - delete [] m_blockOfMapCells; - m_blockOfMapCells = NULL; - } + + delete [] m_blockOfMapCells; + m_blockOfMapCells = NULL; + m_width = 0; m_height = 0; m_xOrigin = 0; @@ -3396,14 +3383,11 @@ void Pathfinder::reset( void ) frameToShowObstacles = 0; DEBUG_LOG(("Pathfind cell is %d bytes, PathfindCellInfo is %d bytes", sizeof(PathfindCell), sizeof(PathfindCellInfo))); - if (m_blockOfMapCells) { - delete []m_blockOfMapCells; - m_blockOfMapCells = NULL; - } - if (m_map) { - delete [] m_map; - m_map = NULL; - } + delete [] m_blockOfMapCells; + m_blockOfMapCells = NULL; + + delete [] m_map; + m_map = NULL; Int i; for (i=0; i<=LAYER_LAST; i++) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp b/Generals/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp index e3f58bb3eaf..3d517224ab9 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp @@ -69,10 +69,9 @@ m_riverStart(0) */ PolygonTrigger::~PolygonTrigger(void) { - if (m_points) { - delete [] m_points; - m_points = NULL; - } + delete [] m_points; + m_points = NULL; + if (m_nextPolygonTrigger) { PolygonTrigger *cur = m_nextPolygonTrigger; PolygonTrigger *next; diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index 6713a1f1211..7ee2c1ec169 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -153,7 +153,7 @@ AttackPriorityInfo::AttackPriorityInfo() :m_defaultPriority(ATTACK_PRIORITY_DEFA //------------------------------------------------------------------------------------------------- AttackPriorityInfo::~AttackPriorityInfo() { - if (m_priorityMap) delete m_priorityMap; + delete m_priorityMap; m_priorityMap = NULL; } @@ -216,14 +216,8 @@ void AttackPriorityInfo::reset( void ) // go back to default priority m_defaultPriority = ATTACK_PRIORITY_DEFAULT; - // delete the priority map if present - if( m_priorityMap ) - { - - delete m_priorityMap; - m_priorityMap = NULL; - - } + delete m_priorityMap; + m_priorityMap = NULL; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 09edcd448d4..f1f2ee2086f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -475,11 +475,8 @@ void GameLogic::reset( void ) } m_forceGameStartByTimeOut = FALSE; - if(TheStatsCollector) - { - delete TheStatsCollector; - TheStatsCollector = NULL; - } + delete TheStatsCollector; + TheStatsCollector = NULL; // clear any table of contents we have m_objectTOC.clear(); @@ -974,13 +971,8 @@ void GameLogic::updateLoadProgress( Int progress ) void GameLogic::deleteLoadScreen( void ) { - if( m_loadScreen ) - { - - delete m_loadScreen; - m_loadScreen = NULL; - - } + delete m_loadScreen; + m_loadScreen = NULL; } @@ -1127,10 +1119,8 @@ void GameLogic::startNewGame( Bool saveGame ) } } else { if (m_gameMode == GAME_SINGLE_PLAYER) { - if (TheSkirmishGameInfo) { - delete TheSkirmishGameInfo; - TheSkirmishGameInfo = NULL; - } + delete TheSkirmishGameInfo; + TheSkirmishGameInfo = NULL; } } diff --git a/Generals/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/Generals/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp index ff864300cf8..3361ddf3503 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp @@ -201,10 +201,9 @@ void ConnectionManager::reset() // m_transport = new Transport; // } // m_transport->reset(); - if (m_transport != NULL) { - delete m_transport; - m_transport = NULL; - } + + delete m_transport; + m_transport = NULL; UnsignedInt i = 0; for (; i < (UnsignedInt)NUM_CONNECTIONS; ++i) { @@ -277,10 +276,7 @@ Bool ConnectionManager::isPlayerConnected( Int playerID ) } void ConnectionManager::attachTransport(Transport *transport) { - if (m_transport != NULL) { - delete m_transport; - m_transport = NULL; - } + delete m_transport; m_transport = transport; } @@ -1409,10 +1405,8 @@ void ConnectionManager::setLocalAddress(UnsignedInt ip, UnsignedInt port) { void ConnectionManager::initTransport() { DEBUG_ASSERTCRASH((m_transport == NULL), ("m_transport already exists when trying to init it.")); DEBUG_LOG(("ConnectionManager::initTransport - Initializing Transport")); - if (m_transport != NULL) { - delete m_transport; - m_transport = NULL; - } + + delete m_transport; m_transport = new Transport; m_transport->reset(); m_transport->init(m_localAddr, m_localPort); @@ -2147,7 +2141,7 @@ void ConnectionManager::sendFile(AsciiString path, UnsignedByte playerMask, Unsi compressedSize = CompressionManager::compressData(CompressionManager::getPreferredCompression(), buf, len, compressedBuf, compressedLen); - if (compressedBuf && !compressedSize) + if (!compressedSize) { delete[] compressedBuf; compressedBuf = NULL; @@ -2177,11 +2171,8 @@ void ConnectionManager::sendFile(AsciiString path, UnsignedByte playerMask, Unsi delete[] buf; buf = NULL; #ifdef COMPRESS_TARGAS - if (compressedBuf) - { - delete[] compressedBuf; - compressedBuf = NULL; - } + delete[] compressedBuf; + compressedBuf = NULL; #endif // COMPRESS_TARGAS DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("Sending file: '%s', len %d, to %X", path.str(), len, playerMask)); diff --git a/Generals/Code/GameEngine/Source/GameNetwork/FirewallHelper.cpp b/Generals/Code/GameEngine/Source/GameNetwork/FirewallHelper.cpp index 69af4ccbc11..fab68b6898e 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/FirewallHelper.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/FirewallHelper.cpp @@ -1557,10 +1557,8 @@ Bool FirewallHelperClass::openSpareSocket(UnsignedShort port) { void FirewallHelperClass::closeSpareSocket(UnsignedShort port) { for (Int i = 0; i < MAX_SPARE_SOCKETS; ++i) { if (m_spareSockets[i].port == port) { - if (m_spareSockets[i].udp != NULL) { - delete m_spareSockets[i].udp; - m_spareSockets[i].udp = NULL; - } + delete m_spareSockets[i].udp; + m_spareSockets[i].udp = NULL; m_spareSockets[i].port = 0; break; } @@ -1572,12 +1570,8 @@ void FirewallHelperClass::closeSpareSocket(UnsignedShort port) { */ void FirewallHelperClass::closeAllSpareSockets() { for (Int i = 0; i < MAX_SPARE_SOCKETS; ++i) { - if (m_spareSockets[i].port != 0) { - m_spareSockets[i].port = 0; - } - if (m_spareSockets[i].udp != NULL) { - delete (m_spareSockets[i].udp); - m_spareSockets[i].udp = NULL; - } + delete (m_spareSockets[i].udp); + m_spareSockets[i].udp = NULL; + m_spareSockets[i].port = 0; } } diff --git a/Generals/Code/GameEngine/Source/GameNetwork/FrameDataManager.cpp b/Generals/Code/GameEngine/Source/GameNetwork/FrameDataManager.cpp index d27ce890b63..68b17a8831f 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/FrameDataManager.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/FrameDataManager.cpp @@ -47,12 +47,8 @@ FrameDataManager::~FrameDataManager() { for (Int i = 0; i < FRAME_DATA_LENGTH; ++i) { m_frameData[i].reset(); } - - if (m_frameData) - { - delete[] m_frameData; - m_frameData = NULL; - } + delete[] m_frameData; + m_frameData = NULL; } /** diff --git a/Generals/Code/GameEngine/Source/GameNetwork/FrameMetrics.cpp b/Generals/Code/GameEngine/Source/GameNetwork/FrameMetrics.cpp index 818559733cd..133c9d49d43 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/FrameMetrics.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/FrameMetrics.cpp @@ -50,21 +50,14 @@ FrameMetrics::FrameMetrics() } FrameMetrics::~FrameMetrics() { - if (m_fpsList != NULL) { - delete m_fpsList; - m_fpsList = NULL; - } + delete m_fpsList; + m_fpsList = NULL; - if (m_latencyList != NULL) { - delete m_latencyList; - m_latencyList = NULL; - } + delete m_latencyList; + m_latencyList = NULL; - if (m_pendingLatencies) - { - delete[] m_pendingLatencies; - m_pendingLatencies = NULL; - } + delete[] m_pendingLatencies; + m_pendingLatencies = NULL; } void FrameMetrics::init() { diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/LadderDefs.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/LadderDefs.cpp index ef1e43f5438..6f80eb6497b 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/LadderDefs.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/LadderDefs.cpp @@ -236,11 +236,7 @@ static LadderInfo *parseLadder(AsciiString raw) } } - if (lad) - { - delete lad; - lad = NULL; - } + delete lad; return NULL; } diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp index 04e49e75f89..85fd05bb4f3 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp @@ -447,8 +447,7 @@ static void populateBuddyGames(void) static void clearBuddyGames(void) { - if (theBuddyGames) - delete theBuddyGames; + delete theBuddyGames; theBuddyGames = NULL; } diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/MainMenuUtils.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/MainMenuUtils.cpp index d84c449a9c6..829a489fc91 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/MainMenuUtils.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/MainMenuUtils.cpp @@ -220,16 +220,12 @@ static void startOnline( void ) DEBUG_ASSERTCRASH( !TheGameSpyPeerMessageQueue, ("TheGameSpyPeerMessageQueue exists!") ); DEBUG_ASSERTCRASH( !TheGameSpyInfo, ("TheGameSpyInfo exists!") ); SetUpGameSpy(MOTDBuffer, configBuffer); - if (MOTDBuffer) - { - delete[] MOTDBuffer; - MOTDBuffer = NULL; - } - if (configBuffer) - { - delete[] configBuffer; - configBuffer = NULL; - } + + delete[] MOTDBuffer; + MOTDBuffer = NULL; + + delete[] configBuffer; + configBuffer = NULL; #ifdef ALLOW_NON_PROFILED_LOGIN UserPreferences pref; @@ -320,12 +316,7 @@ static GHTTPBool motdCallback( GHTTPRequest request, GHTTPResult result, return GHTTPTrue; } - if (MOTDBuffer) - { - delete[] MOTDBuffer; - MOTDBuffer = NULL; - } - + delete[] MOTDBuffer; MOTDBuffer = NEW char[bufferLen]; memcpy(MOTDBuffer, buffer, bufferLen); MOTDBuffer[bufferLen-1] = 0; @@ -360,11 +351,8 @@ static GHTTPBool configCallback( GHTTPRequest request, GHTTPResult result, return GHTTPTrue; } - if (configBuffer) - { - delete[] configBuffer; - configBuffer = NULL; - } + delete[] configBuffer; + configBuffer = NULL; if (result != GHTTPSuccess || bufferLen < 100) { @@ -464,11 +452,8 @@ static GHTTPBool configHeadCallback( GHTTPRequest request, GHTTPResult result, onlineCancelWindow = NULL; } - if (configBuffer) - { - delete[] configBuffer; - configBuffer = NULL; - } + delete[] configBuffer; + configBuffer = NULL; AsciiString fname; fname.format("%sGeneralsOnline\\Config.txt", TheGlobalData->getPath_UserData().str()); @@ -579,16 +564,12 @@ void CancelPatchCheckCallback( void ) onlineCancelWindow = NULL; } queuedDownloads.clear(); - if (MOTDBuffer) - { - delete[] MOTDBuffer; - MOTDBuffer = NULL; - } - if (configBuffer) - { - delete[] configBuffer; - configBuffer = NULL; - } + + delete[] MOTDBuffer; + MOTDBuffer = NULL; + + delete[] configBuffer; + configBuffer = NULL; } /////////////////////////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp index e011a6fb3ec..fac98dedc3e 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp @@ -671,28 +671,17 @@ void TearDownGameSpy( void ) if (ThePinger) ThePinger->endThreads(); - if(TheRankPointValues) - { - delete TheRankPointValues; - TheRankPointValues = NULL; - } - if (TheGameSpyPSMessageQueue) - { - delete TheGameSpyPSMessageQueue; - TheGameSpyPSMessageQueue = NULL; - } + delete TheRankPointValues; + TheRankPointValues = NULL; - if (TheGameSpyBuddyMessageQueue) - { - delete TheGameSpyBuddyMessageQueue; - TheGameSpyBuddyMessageQueue = NULL; - } + delete TheGameSpyPSMessageQueue; + TheGameSpyPSMessageQueue = NULL; - if (TheGameSpyPeerMessageQueue) - { - delete TheGameSpyPeerMessageQueue; - TheGameSpyPeerMessageQueue = NULL; - } + delete TheGameSpyBuddyMessageQueue; + TheGameSpyBuddyMessageQueue = NULL; + + delete TheGameSpyPeerMessageQueue; + TheGameSpyPeerMessageQueue = NULL; if (TheGameSpyInfo) { @@ -705,23 +694,14 @@ void TearDownGameSpy( void ) TheGameSpyInfo = NULL; } - if (ThePinger) - { - delete ThePinger; - ThePinger = NULL; - } + delete ThePinger; + ThePinger = NULL; - if (TheLadderList) - { - delete TheLadderList; - TheLadderList = NULL; - } + delete TheLadderList; + TheLadderList = NULL; - if (TheGameSpyConfig) - { - delete TheGameSpyConfig; - TheGameSpyConfig = NULL; - } + delete TheGameSpyConfig; + TheGameSpyConfig = NULL; // make sure the notification box doesn't exist deleteNotificationBox(); diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp index c444c715529..be97354724b 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp @@ -535,10 +535,8 @@ void GameSpyStagingRoom::startGame(Int gameID) UnsignedInt localIP = TheGameSpyInfo->getInternalIP(); setLocalIP(localIP); - if (TheNAT != NULL) { - delete TheNAT; - TheNAT = NULL; - } + delete TheNAT; + TheNAT = NULL; // fill in GS-specific info Int numHumans = 0; @@ -801,10 +799,8 @@ void GameSpyStagingRoom::launchGame( void ) AsciiString userList; DEBUG_ASSERTCRASH(TheNetwork == NULL, ("For some reason TheNetwork isn't NULL at the start of this game. Better look into that.")); - if (TheNetwork != NULL) { - delete TheNetwork; - TheNetwork = NULL; - } + delete TheNetwork; + TheNetwork = NULL; // Time to initialize TheNetwork for this game. TheNetwork = NetworkInterface::createNetwork(); @@ -830,10 +826,10 @@ void GameSpyStagingRoom::launchGame( void ) if (!filesOk || TheMapCache->findMap(getMap()) == NULL) { DEBUG_LOG(("After transfer, we didn't really have the map. Bailing...")); - if (TheNetwork != NULL) { - delete TheNetwork; - TheNetwork = NULL; - } + + delete TheNetwork; + TheNetwork = NULL; + GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:CouldNotTransferMap")); void PopBackToLobby( void ); @@ -865,10 +861,8 @@ void GameSpyStagingRoom::launchGame( void ) sprintf(req.arg.status.locationString, "%s", WideCharStringToMultiByte(TheGameSpyGame->getGameName().str()).c_str()); TheGameSpyBuddyMessageQueue->addRequest(req); - if (TheNAT != NULL) { - delete TheNAT; - TheNAT = NULL; - } + delete TheNAT; + TheNAT = NULL; } void GameSpyStagingRoom::reset(void) diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp index 6f61847f95d..9c63a5612b7 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp @@ -181,8 +181,7 @@ void GameSpyBuddyMessageQueue::startThread( void ) void GameSpyBuddyMessageQueue::endThread( void ) { - if (m_thread) - delete m_thread; + delete m_thread; m_thread = NULL; } diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/GameResultsThread.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/GameResultsThread.cpp index a00893ea80a..f7ab74904b1 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/GameResultsThread.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/GameResultsThread.cpp @@ -130,11 +130,8 @@ void GameResultsQueue::endThreads( void ) { for (Int i=0; ifetch("GUI:CouldNotTransferMap"), LANCHAT_SYSTEM); return; } diff --git a/Generals/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp b/Generals/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp index f2a437f10b4..a492c2cfd1f 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp @@ -127,7 +127,6 @@ void LANAPI::handleGameAnnounce( LANMessage *msg, UnsignedInt senderIP ) // remove from list removeGame(game); delete game; - game = NULL; return; } RequestGameJoin(game, m_directConnectRemoteIP); diff --git a/Generals/Code/GameEngine/Source/GameNetwork/NAT.cpp b/Generals/Code/GameEngine/Source/GameNetwork/NAT.cpp index 5a3563b9cdc..e53dd8ffab5 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/NAT.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/NAT.cpp @@ -214,10 +214,9 @@ NATStateType NAT::update() { { m_NATState = NATSTATE_DONE; TheEstablishConnectionsMenu->endMenu(); - if (TheFirewallHelper != NULL) { - delete TheFirewallHelper; - TheFirewallHelper = NULL; - } + + delete TheFirewallHelper; + TheFirewallHelper = NULL; } } else if (m_NATState == NATSTATE_DOCONNECTIONPATHS) { if (allConnectionsDoneThisRound() == TRUE) { @@ -241,10 +240,9 @@ NATStateType NAT::update() { /* m_NATState = NATSTATE_DONE; TheEstablishConnectionsMenu->endMenu(); - if (TheFirewallHelper != NULL) { - delete TheFirewallHelper; - TheFirewallHelper = NULL; - } + + delete TheFirewallHelper; + TheFirewallHelper = NULL; */ } else { doThisConnectionRound(); @@ -277,10 +275,8 @@ NATStateType NAT::update() { TheFirewallHelper = NULL; } // we failed to connect, so we don't have to pass on the transport to the network. - if (m_transport != NULL) { - delete m_transport; - m_transport = NULL; - } + delete m_transport; + m_transport = NULL; } } return m_NATState; diff --git a/Generals/Code/GameEngine/Source/GameNetwork/NetCommandMsg.cpp b/Generals/Code/GameEngine/Source/GameNetwork/NetCommandMsg.cpp index 29b62d59958..c114cc3a9f4 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/NetCommandMsg.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/NetCommandMsg.cpp @@ -840,10 +840,8 @@ NetWrapperCommandMsg::NetWrapperCommandMsg() : NetCommandMsg() { } NetWrapperCommandMsg::~NetWrapperCommandMsg() { - if (m_data != NULL) { - delete m_data; - m_data = NULL; - } + delete m_data; + m_data = NULL; } UnsignedByte * NetWrapperCommandMsg::getData() { @@ -852,11 +850,7 @@ UnsignedByte * NetWrapperCommandMsg::getData() { void NetWrapperCommandMsg::setData(UnsignedByte *data, UnsignedInt dataLength) { - if (m_data != NULL) { - delete m_data; - m_data = NULL; - } - + delete m_data; m_data = NEW UnsignedByte[dataLength]; // pool[]ify memcpy(m_data, data, dataLength); m_dataLength = dataLength; @@ -917,10 +911,8 @@ NetFileCommandMsg::NetFileCommandMsg() : NetCommandMsg() { } NetFileCommandMsg::~NetFileCommandMsg() { - if (m_data != NULL) { - delete[] m_data; - m_data = NULL; - } + delete[] m_data; + m_data = NULL; } AsciiString NetFileCommandMsg::getRealFilename() diff --git a/Generals/Code/GameEngine/Source/GameNetwork/NetCommandWrapperList.cpp b/Generals/Code/GameEngine/Source/GameNetwork/NetCommandWrapperList.cpp index cfcaf09ff3d..15e136dcd7f 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/NetCommandWrapperList.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/NetCommandWrapperList.cpp @@ -57,15 +57,11 @@ NetCommandWrapperListNode::NetCommandWrapperListNode(NetWrapperCommandMsg *msg) } NetCommandWrapperListNode::~NetCommandWrapperListNode() { - if (m_chunksPresent != NULL) { - delete[] m_chunksPresent; - m_chunksPresent = NULL; - } + delete[] m_chunksPresent; + m_chunksPresent = NULL; - if (m_data != NULL) { - delete[] m_data; - m_data = NULL; - } + delete[] m_data; + m_data = NULL; } Bool NetCommandWrapperListNode::isComplete() { diff --git a/Generals/Code/GameEngine/Source/GameNetwork/Transport.cpp b/Generals/Code/GameEngine/Source/GameNetwork/Transport.cpp index c26ddd76a8d..fcccde22f9e 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/Transport.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/Transport.cpp @@ -104,8 +104,7 @@ Bool Transport::init( UnsignedInt ip, UnsignedShort port ) } // ------- Bind our port -------- - if (m_udpsock) - delete m_udpsock; + delete m_udpsock; m_udpsock = NEW UDP(); if (!m_udpsock) @@ -162,11 +161,8 @@ Bool Transport::init( UnsignedInt ip, UnsignedShort port ) void Transport::reset( void ) { - if (m_udpsock) - { - delete m_udpsock; - m_udpsock = NULL; - } + delete m_udpsock; + m_udpsock = NULL; if (m_winsockInit) { diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp index 22d09092521..c1f91b21208 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp @@ -1250,41 +1250,37 @@ void HeightMapRenderObjClass::drawScorches(void) HeightMapRenderObjClass::~HeightMapRenderObjClass(void) { freeMapResources(); - if (m_treeBuffer) { - delete m_treeBuffer; - m_treeBuffer = NULL; - } - if (m_bibBuffer) { - delete m_bibBuffer; - m_bibBuffer = NULL; - } + + delete m_treeBuffer; + m_treeBuffer = NULL; + + delete m_bibBuffer; + m_bibBuffer = NULL; + #ifdef TEST_CUSTOM_EDGING - if (m_customEdging) { - delete m_customEdging; - m_customEdging = NULL; - } + delete m_customEdging; + m_customEdging = NULL; #endif + #ifdef DO_ROADS - if (m_roadBuffer) { - delete m_roadBuffer; - m_roadBuffer = NULL; - } + delete m_roadBuffer; + m_roadBuffer = NULL; #endif - if (m_bridgeBuffer) { - delete m_bridgeBuffer; - } - if( m_waypointBuffer ) - { - delete m_waypointBuffer; - } - if (m_shroud) { - delete m_shroud; - } - if (m_extraBlendTilePositions) - delete [] m_extraBlendTilePositions; - if (m_shoreLineTilePositions) - delete [] m_shoreLineTilePositions; + delete m_bridgeBuffer; + m_bridgeBuffer = NULL; + + delete m_waypointBuffer; + m_waypointBuffer = NULL; + + delete m_shroud; + m_shroud = NULL; + + delete [] m_extraBlendTilePositions; + m_extraBlendTilePositions = NULL; + + delete [] m_shoreLineTilePositions; + m_shoreLineTilePositions = NULL; } //============================================================================= diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp index 51a4c7fff6c..72efdf7b6b9 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp @@ -151,14 +151,13 @@ struct Geometry return TRUE; } void Release(void) - { if (m_verts) - { delete [] m_verts; - m_verts=NULL; - } - if (m_indices) - { delete [] m_indices; - m_indices=NULL; - } + { + delete [] m_verts; + m_verts=NULL; + + delete [] m_indices; + m_indices=NULL; + m_numActivePolygon=m_numPolygon=0; m_numActiveVertex=m_numVertex=0; } @@ -766,11 +765,9 @@ W3DShadowGeometryMesh::~W3DShadowGeometryMesh( void ) { // remove our neighbor list information allocated deleteNeighbors(); - if (m_parentVerts) { - delete [] m_parentVerts; - } - if (m_polygonNormals) - delete [] m_polygonNormals; + + delete [] m_parentVerts; + delete [] m_polygonNormals; } @@ -1016,14 +1013,9 @@ void W3DShadowGeometryMesh::deleteNeighbors( void ) { // delete list - if( m_polyNeighbors ) - { - - delete [] m_polyNeighbors; - m_polyNeighbors = NULL; - m_numPolyNeighbors = 0; - - } + delete [] m_polyNeighbors; + m_polyNeighbors = NULL; + m_numPolyNeighbors = 0; // sanity error checking assert( m_numPolyNeighbors == 0 ); @@ -1594,8 +1586,8 @@ W3DVolumetricShadow::~W3DVolumetricShadow( void ) // free any shadow volume data for( i = 0; i < MAX_SHADOW_LIGHTS; i++ ) { for (j = 0; j < MAX_SHADOW_CASTER_MESHES; j++) - { if( m_shadowVolume[ i ][j] ) - delete m_shadowVolume[ i ][j]; + { + delete m_shadowVolume[i][j]; if( m_shadowVolumeVB[i][j]) TheW3DBufferManager->releaseSlot(m_shadowVolumeVB[i][j]); if( m_shadowVolumeIB[i][j]) @@ -3176,8 +3168,7 @@ Bool W3DVolumetricShadow::allocateSilhouette(Int meshIndex, Int numVertices ) void W3DVolumetricShadow::deleteSilhouette( Int meshIndex ) { - if( m_silhouetteIndex[meshIndex]) - delete [] m_silhouetteIndex[meshIndex]; + delete [] m_silhouetteIndex[meshIndex]; m_silhouetteIndex[meshIndex] = NULL; m_numSilhouetteIndices[meshIndex] = 0; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp index 6dc82354681..833b6da546e 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp @@ -99,7 +99,7 @@ Int W3DDebugIcons::m_numDebugIcons = 0; W3DDebugIcons::~W3DDebugIcons(void) { REF_PTR_RELEASE(m_vertexMaterialClass); - if (m_debugIcons) delete m_debugIcons; + delete m_debugIcons; m_debugIcons = NULL; m_numDebugIcons = 0; } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp index a2e634c6190..7043b7fed93 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp @@ -231,14 +231,11 @@ RoadSegment::RoadSegment(void) RoadSegment::~RoadSegment(void) { m_numVertex = 0; - if (m_vb) { - delete[] m_vb; - } - m_vb= NULL; + delete[] m_vb; + m_vb = NULL; + m_numIndex = 0; - if (m_ib) { - delete[] m_ib; - } + delete[] m_ib; m_ib = NULL; } @@ -251,15 +248,18 @@ RoadSegment::~RoadSegment(void) //============================================================================= void RoadSegment::SetVertexBuffer(VertexFormatXYZDUV1 *vb, Int numVertex) { - if (m_vb) { - delete[] m_vb; - m_vb = NULL; - m_numVertex = 0; - } + delete[] m_vb; + m_vb = NULL; + m_numVertex = 0; + Vector3 verts[MAX_SEG_VERTEX]; - if (numVertex<1 || numVertex > MAX_SEG_VERTEX) return; + if (numVertex<1 || numVertex > MAX_SEG_VERTEX) + return; + m_vb = NEW VertexFormatXYZDUV1[numVertex]; // pool[]ify - if (!m_vb) return; + if (!m_vb) + return; + m_numVertex = numVertex; memcpy(m_vb, vb, numVertex*sizeof(VertexFormatXYZDUV1)); Int i; @@ -279,14 +279,17 @@ void RoadSegment::SetVertexBuffer(VertexFormatXYZDUV1 *vb, Int numVertex) //============================================================================= void RoadSegment::SetIndexBuffer(UnsignedShort *ib, Int numIndex) { - if (m_ib) { - delete[] m_ib; - m_ib = NULL; - m_numIndex = 0; - } - if (numIndex < 1 || numIndex > MAX_SEG_INDEX) return; + delete[] m_ib; + m_ib = NULL; + m_numIndex = 0; + + if (numIndex < 1 || numIndex > MAX_SEG_INDEX) + return; + m_ib = NEW UnsignedShort[numIndex]; - if (!m_ib) return; + if (!m_ib) + return; + m_numIndex = numIndex; memcpy(m_ib, ib, numIndex*sizeof(UnsignedShort)); } @@ -3066,14 +3069,11 @@ W3DRoadBuffer::W3DRoadBuffer(void) : //============================================================================= void W3DRoadBuffer::freeRoadBuffers(void) { - if (m_roads) { - delete[] m_roads; - m_roads = NULL; - } - if (m_roadTypes) { - delete[] m_roadTypes; - m_roadTypes = NULL; - } + delete[] m_roads; + m_roads = NULL; + + delete[] m_roadTypes; + m_roadTypes = NULL; } //============================================================================= diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp index 72bb163ba04..48c5f4f5dac 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp @@ -203,17 +203,10 @@ RTS3DScene::~RTS3DScene() REF_PTR_RELEASE(m_heatVisionOnlyPass); - if (m_translucentObjectsBuffer) - delete [] m_translucentObjectsBuffer; - - if (m_nonOccludersOrOccludees) - delete [] m_nonOccludersOrOccludees; - - if (m_potentialOccludees) - delete [] m_potentialOccludees; - - if (m_potentialOccluders) - delete [] m_potentialOccluders; + delete [] m_translucentObjectsBuffer; + delete [] m_nonOccludersOrOccludees; + delete [] m_potentialOccludees; + delete [] m_potentialOccluders; for (i=0; iRelease(); - m_pSrcTexture=NULL; - if (m_finalFogData) - delete [] m_finalFogData; - if (m_currentFogData) - delete [] m_currentFogData; + + delete [] m_finalFogData; + delete [] m_currentFogData; + m_drawFogOfWar=FALSE; } @@ -199,14 +199,17 @@ void W3DShroud::reset() { //Free old shroud data since it may no longer fit new map. if (m_pSrcTexture) + { m_pSrcTexture->Release(); - m_pSrcTexture=NULL; - if (m_finalFogData) - delete [] m_finalFogData; + m_pSrcTexture=NULL; + } + + delete [] m_finalFogData; m_finalFogData=NULL; - if (m_currentFogData) - delete [] m_currentFogData; + + delete [] m_currentFogData; m_currentFogData=NULL; + m_clearDstTexture = TRUE; //always refill the destination texture after a reset } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp index 8b09244a7be..b18101069f9 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp @@ -78,17 +78,11 @@ W3DTerrainVisual::~W3DTerrainVisual() TheTerrainRenderObject = NULL; } - if (TheTerrainTracksRenderObjClassSystem) - { - delete TheTerrainTracksRenderObjClassSystem; - TheTerrainTracksRenderObjClassSystem=NULL; - } + delete TheTerrainTracksRenderObjClassSystem; + TheTerrainTracksRenderObjClassSystem=NULL; - if (TheW3DShadowManager) - { - delete TheW3DShadowManager; - TheW3DShadowManager=NULL; - } + delete TheW3DShadowManager; + TheW3DShadowManager=NULL; REF_PTR_RELEASE( m_waterRenderObject ); TheWaterRenderObj=NULL; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp index af8492bf79e..f267923d2ee 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp @@ -292,8 +292,7 @@ WaterRenderObjClass::~WaterRenderObjClass(void) SAFE_RELEASE( m_pBumpTexture2[i]); } - if (m_meshData) - delete [] m_meshData; + delete [] m_meshData; m_meshData = NULL; m_meshDataSize = 0; @@ -306,8 +305,7 @@ WaterRenderObjClass::~WaterRenderObjClass(void) TheWaterTransparency = NULL; ReleaseResources(); - if (m_waterTrackSystem) - delete m_waterTrackSystem; + delete m_waterTrackSystem; } //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp index 52c30c67350..212cac6adba 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp @@ -382,34 +382,27 @@ const ThingTemplate *MapObject::getThingTemplate( void ) const // WorldHeightMap::~WorldHeightMap(void) { - if (m_data) { - delete[](m_data); - m_data = NULL; - } - if (m_tileNdxes) { - delete[](m_tileNdxes); - m_tileNdxes = NULL; - } - if (m_blendTileNdxes) { - delete[](m_blendTileNdxes); - m_blendTileNdxes = NULL; - } - if (m_extraBlendTileNdxes) { - delete[](m_extraBlendTileNdxes); - m_extraBlendTileNdxes = NULL; - } - if (m_cliffInfoNdxes) { - delete[](m_cliffInfoNdxes); - m_cliffInfoNdxes = NULL; - } - if (m_cellFlipState) - { delete[](m_cellFlipState); - m_cellFlipState = NULL; - } - if (m_cellCliffState) - { delete[](m_cellCliffState); - m_cellCliffState = NULL; - } + delete[](m_data); + m_data = NULL; + + delete[](m_tileNdxes); + m_tileNdxes = NULL; + + delete[](m_blendTileNdxes); + m_blendTileNdxes = NULL; + + delete[](m_extraBlendTileNdxes); + m_extraBlendTileNdxes = NULL; + + delete[](m_cliffInfoNdxes); + m_cliffInfoNdxes = NULL; + + delete[](m_cellFlipState); + m_cellFlipState = NULL; + + delete[](m_cellCliffState); + m_cellCliffState = NULL; + int i; for (i=0; iNum_Pivots() == HTree->Num_Pivots()); // just assign it... - if (HTree != NULL) { - delete HTree; - } + delete HTree; HTree = W3DNEW HTreeClass(*new_htree); } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp index 60d8f72ae47..1d126d3a8bd 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp @@ -248,15 +248,13 @@ WW3DAssetManager::WW3DAssetManager(void) : *=============================================================================================*/ WW3DAssetManager::~WW3DAssetManager(void) { - if (MetalManager) delete MetalManager; + delete MetalManager; + Free(); TheInstance = NULL; - // If we need to, free the hash table - if (PrototypeHashTable != NULL) { - delete [] PrototypeHashTable; - PrototypeHashTable = NULL; - } + delete [] PrototypeHashTable; + PrototypeHashTable = NULL; } static void Create_Number_String(StringClass& number, unsigned value) diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h index f89cb06f486..6f9e0a50f4a 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h @@ -203,7 +203,7 @@ class WW3DAssetManager ** WW3DAssetManager::Get_Instance(); */ static WW3DAssetManager * Get_Instance(void) { return TheInstance; } - static void Delete_This(void) { if (TheInstance) delete TheInstance; TheInstance=NULL; } + static void Delete_This(void) { delete TheInstance; TheInstance=NULL; } /* ** Load data from any type of w3d file diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8texman.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8texman.cpp index d6c7fec1e86..0d66a497ae6 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8texman.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8texman.cpp @@ -77,7 +77,6 @@ void DX8TextureManagerClass::Shutdown() { TextureTrackerClass *track=Managed_Textures.Remove_Head(); delete track; - track=NULL; } } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp index 75c5dd4119f..ccd6c9df7f9 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp @@ -493,10 +493,8 @@ void DX8Wrapper::Do_Onetime_Device_Dependent_Shutdowns(void) TheDX8MeshRenderer.Shutdown(); MissingTexture::_Deinit(); - if (CurrentCaps) { - delete CurrentCaps; - CurrentCaps=NULL; - } + delete CurrentCaps; + CurrentCaps=NULL; } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp index e526933ff40..e78a0f90527 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp @@ -343,10 +343,8 @@ void HLodDefClass::Free(void) ::free(HierarchyTreeName); HierarchyTreeName = NULL; - if (Lod) { - delete[] Lod; - Lod = NULL; - } + delete[] Lod; + Lod = NULL; LodCount = 0; REF_PTR_RELEASE(ProxyArray); @@ -773,10 +771,9 @@ void HLodDefClass::SubObjectArrayClass::Reset(void) delete[] ModelName; ModelName = NULL; } - if (BoneIndex != NULL) { - delete[] BoneIndex; - BoneIndex = NULL; - } + + delete[] BoneIndex; + BoneIndex = NULL; ModelCount = 0; } @@ -1363,20 +1360,16 @@ void HLodClass::Free(void) Lod[lod].Delete_All(); } - if (Lod != NULL) { - delete[] Lod; - Lod = NULL; - } + + delete[] Lod; + Lod = NULL; LodCount = 0; - if (Cost != NULL) { - delete[] Cost; - Cost = NULL; - } - if (Value != NULL) { - delete[] Value; - Value = NULL; - } + delete[] Cost; + Cost = NULL; + + delete[] Value; + Value = NULL; for (model = 0; model < AdditionalModels.Count(); model++) { RenderObjClass * robj = AdditionalModels[model].Model; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp index 74823e31f75..60804fd1d4b 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp @@ -219,15 +219,11 @@ void HMorphAnimClass::Free(void) PoseData = NULL; } - if (MorphKeyData != NULL) { - delete[] MorphKeyData; - MorphKeyData = NULL; - } + delete[] MorphKeyData; + MorphKeyData = NULL; - if (PivotChannel != NULL) { - delete[] PivotChannel; - PivotChannel = NULL; - } + delete[] PivotChannel; + PivotChannel = NULL; } @@ -431,10 +427,8 @@ bool HMorphAnimClass::Import(const char *hierarchy_name, TextFileClass &text_des // // Cleanup // - if (channel_list != NULL) { - delete [] channel_list; - channel_list = NULL; - } + delete [] channel_list; + channel_list = NULL; } // @@ -447,10 +441,8 @@ bool HMorphAnimClass::Import(const char *hierarchy_name, TextFileClass &text_des // // Cleanup // - if (column_list != NULL) { - delete [] column_list; - column_list = NULL; - } + delete [] column_list; + column_list = NULL; } return retval; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp index 926a1392908..fe1e34ecc40 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp @@ -94,30 +94,14 @@ NodeMotionStruct::NodeMotionStruct() : *=============================================================================================*/ NodeMotionStruct::~NodeMotionStruct() { - if (X != NULL) { - delete X; - } - if (Y != NULL) { - delete Y; - } - if (Z != NULL) { - delete Z; - } - if (XR != NULL) { - delete XR; - } - if (YR != NULL) { - delete YR; - } - if (ZR != NULL) { - delete ZR; - } - if (Q != NULL) { - delete Q; - } - if (Vis != NULL) { - delete Vis; - } + delete X; + delete Y; + delete Z; + delete XR; + delete YR; + delete ZR; + delete Q; + delete Vis; } @@ -176,10 +160,8 @@ HRawAnimClass::~HRawAnimClass(void) *=============================================================================================*/ void HRawAnimClass::Free(void) { - if (NodeMotion != NULL) { - delete[] NodeMotion; - NodeMotion = NULL; - } + delete[] NodeMotion; + NodeMotion = NULL; } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp index 13d83b7db40..4851a3ec52d 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp @@ -121,10 +121,8 @@ void HTreeManagerClass::Free(void) void HTreeManagerClass::Free_All_Trees(void) { for (int treeidx=0; treeidx < MAX_TREES; treeidx++) { - if (TreePtr[treeidx] != NULL) { - delete TreePtr[treeidx]; - TreePtr[treeidx] = NULL; - } + delete TreePtr[treeidx]; + TreePtr[treeidx] = NULL; } NumTrees = 0; } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp index 6cc4fab8daf..927ac0f5805 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp @@ -605,15 +605,11 @@ MeshBuilderClass::~MeshBuilderClass(void) *=============================================================================================*/ void MeshBuilderClass::Free(void) { - if (Faces != NULL) { - delete[] Faces; - Faces = NULL; - } + delete[] Faces; + Faces = NULL; - if (Verts != NULL) { - delete Verts; - Verts = NULL; - } + delete Verts; + Verts = NULL; FaceCount = 0; VertCount = 0; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp index f714da43de4..275c79e2343 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp @@ -106,13 +106,9 @@ MeshModelClass::~MeshModelClass(void) Reset(0,0,0); REF_PTR_RELEASE(MatInfo); - if (DefMatDesc != NULL) { - delete DefMatDesc; - } - if (AlternateMatDesc != NULL) { - delete AlternateMatDesc; - } - return ; + delete DefMatDesc; + delete AlternateMatDesc; + } MeshModelClass & MeshModelClass::operator = (const MeshModelClass & that) @@ -127,10 +123,8 @@ MeshModelClass & MeshModelClass::operator = (const MeshModelClass & that) *DefMatDesc = *(that.DefMatDesc); CurMatDesc = DefMatDesc; - if (AlternateMatDesc != NULL) { - delete AlternateMatDesc; - AlternateMatDesc = NULL; - } + delete AlternateMatDesc; + AlternateMatDesc = NULL; if (that.AlternateMatDesc != NULL) { AlternateMatDesc = W3DNEW MeshMatDescClass(*(that.AlternateMatDesc)); @@ -138,11 +132,11 @@ MeshModelClass & MeshModelClass::operator = (const MeshModelClass & that) clone_materials(that); - if (GapFiller) { - delete GapFiller; - GapFiller=NULL; - } - if (that.GapFiller) GapFiller=W3DNEW GapFillerClass(*that.GapFiller); + delete GapFiller; + GapFiller=NULL; + + if (that.GapFiller) + GapFiller=W3DNEW GapFillerClass(*that.GapFiller); } return * this; } @@ -162,10 +156,10 @@ void MeshModelClass::Reset(int polycount,int vertcount,int passcount) MatInfo->Reset(); DefMatDesc->Reset(polycount,vertcount,passcount); - if (AlternateMatDesc != NULL) { - delete AlternateMatDesc; - AlternateMatDesc = NULL; - } + + delete AlternateMatDesc; + AlternateMatDesc = NULL; + CurMatDesc = DefMatDesc; return ; @@ -178,7 +172,7 @@ void MeshModelClass::Register_For_Rendering() if (WW3D::Get_NPatches_Gap_Filling_Mode()!=WW3D::NPATCHES_GAP_FILLING_DISABLED) { Init_For_NPatch_Rendering(); } - else if (GapFiller) { + else { delete GapFiller; GapFiller=NULL; } @@ -187,7 +181,7 @@ void MeshModelClass::Register_For_Rendering() if (WW3D::Get_NPatches_Gap_Filling_Mode()==WW3D::NPATCHES_GAP_FILLING_FORCE) { Init_For_NPatch_Rendering(); } - else if (GapFiller) { + else { delete GapFiller; GapFiller=NULL; } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp index 29ef9211d23..474ebd9c32f 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp @@ -1920,10 +1920,9 @@ MeshLoadContextClass::~MeshLoadContextClass(void) { int i; - if (TexCoords != NULL) { - delete TexCoords; - TexCoords = NULL; - } + delete TexCoords; + TexCoords = NULL; + for (i=0; iRelease_Ref(); } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp index 002c1262b52..6cc2df5b850 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp @@ -131,10 +131,8 @@ MotionChannelClass::~MotionChannelClass(void) *=============================================================================================*/ void MotionChannelClass::Free(void) { - if (Data) { - delete[] Data; - Data = NULL; - } + delete[] Data; + Data = NULL; } @@ -233,10 +231,8 @@ BitChannelClass::~BitChannelClass(void) *=============================================================================================*/ void BitChannelClass::Free(void) { - if (Bits != NULL) { - delete[] Bits; - Bits = NULL; - } + delete[] Bits; + Bits = NULL; } @@ -346,10 +342,8 @@ TimeCodedMotionChannelClass::~TimeCodedMotionChannelClass(void) *=============================================================================================*/ void TimeCodedMotionChannelClass::Free(void) { - if (Data) { - delete[] Data; - Data = NULL; - } + delete[] Data; + Data = NULL; } @@ -714,10 +708,8 @@ TimeCodedBitChannelClass::~TimeCodedBitChannelClass(void) *=============================================================================================*/ void TimeCodedBitChannelClass::Free(void) { - if (Bits != NULL) { - delete[] Bits; - Bits = NULL; - } + delete[] Bits; + Bits = NULL; } @@ -894,16 +886,11 @@ AdaptiveDeltaMotionChannelClass::~AdaptiveDeltaMotionChannelClass(void) *=============================================================================================*/ void AdaptiveDeltaMotionChannelClass::Free(void) { - if (Data) { - delete[] Data; - Data = NULL; - } - - if (CacheData) { - delete CacheData; - CacheData = NULL; - } + delete[] Data; + Data = NULL; + delete CacheData; + CacheData = NULL; } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp index b08b8d37dc4..feeb891f575 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp @@ -600,35 +600,35 @@ ParticleBufferClass & ParticleBufferClass::operator = (const ParticleBufferClass ParticleBufferClass::~ParticleBufferClass(void) { - if (NewParticleQueue) delete [] NewParticleQueue; - if (ColorKeyFrameTimes) delete [] ColorKeyFrameTimes; - if (ColorKeyFrameValues) delete [] ColorKeyFrameValues; - if (ColorKeyFrameDeltas) delete [] ColorKeyFrameDeltas; - if (AlphaKeyFrameTimes) delete [] AlphaKeyFrameTimes; - if (AlphaKeyFrameValues) delete [] AlphaKeyFrameValues; - if (AlphaKeyFrameDeltas) delete [] AlphaKeyFrameDeltas; - if (SizeKeyFrameTimes) delete [] SizeKeyFrameTimes; - if (SizeKeyFrameValues) delete [] SizeKeyFrameValues; - if (SizeKeyFrameDeltas) delete [] SizeKeyFrameDeltas; - if (RotationKeyFrameTimes) delete [] RotationKeyFrameTimes; - if (RotationKeyFrameValues) delete [] RotationKeyFrameValues; - if (HalfRotationKeyFrameDeltas) delete [] HalfRotationKeyFrameDeltas; - if (OrientationKeyFrameValues) delete [] OrientationKeyFrameValues; - if (FrameKeyFrameTimes) delete [] FrameKeyFrameTimes; - if (FrameKeyFrameValues) delete [] FrameKeyFrameValues; - if (FrameKeyFrameDeltas) delete [] FrameKeyFrameDeltas; - if (BlurTimeKeyFrameTimes) delete [] BlurTimeKeyFrameTimes; - if (BlurTimeKeyFrameValues) delete [] BlurTimeKeyFrameValues; - if (BlurTimeKeyFrameDeltas) delete [] BlurTimeKeyFrameDeltas; - if (RandomColorEntries) delete [] RandomColorEntries; - if (RandomAlphaEntries) delete [] RandomAlphaEntries; - if (RandomSizeEntries) delete [] RandomSizeEntries; - if (RandomRotationEntries) delete [] RandomRotationEntries; - if (RandomOrientationEntries) delete [] RandomOrientationEntries; - if (RandomFrameEntries) delete [] RandomFrameEntries; - if (RandomBlurTimeEntries) delete [] RandomBlurTimeEntries; - - if (PointGroup) delete PointGroup; + delete [] NewParticleQueue; + delete [] ColorKeyFrameTimes; + delete [] ColorKeyFrameValues; + delete [] ColorKeyFrameDeltas; + delete [] AlphaKeyFrameTimes; + delete [] AlphaKeyFrameValues; + delete [] AlphaKeyFrameDeltas; + delete [] SizeKeyFrameTimes; + delete [] SizeKeyFrameValues; + delete [] SizeKeyFrameDeltas; + delete [] RotationKeyFrameTimes; + delete [] RotationKeyFrameValues; + delete [] HalfRotationKeyFrameDeltas; + delete [] OrientationKeyFrameValues; + delete [] FrameKeyFrameTimes; + delete [] FrameKeyFrameValues; + delete [] FrameKeyFrameDeltas; + delete [] BlurTimeKeyFrameTimes; + delete [] BlurTimeKeyFrameValues; + delete [] BlurTimeKeyFrameDeltas; + delete [] RandomColorEntries; + delete [] RandomAlphaEntries; + delete [] RandomSizeEntries; + delete [] RandomRotationEntries; + delete [] RandomOrientationEntries; + delete [] RandomFrameEntries; + delete [] RandomBlurTimeEntries; + + delete PointGroup; REF_PTR_RELEASE(Position[0]); REF_PTR_RELEASE(Position[1]); @@ -640,8 +640,9 @@ ParticleBufferClass::~ParticleBufferClass(void) REF_PTR_RELEASE(Frame); REF_PTR_RELEASE(APT); - if (Velocity) delete [] Velocity; - if (TimeStamp) delete [] TimeStamp; + delete [] Velocity; + delete [] TimeStamp; + if (Emitter) { // We should not have an emitter at this point, since the emitter // should still have a live ref to us if it still exists which would @@ -656,9 +657,7 @@ ParticleBufferClass::~ParticleBufferClass(void) Emitter = NULL; } - if (LineRenderer) { - delete LineRenderer; - } + delete LineRenderer; // Update Global Count TotalActiveCount--; @@ -1137,14 +1136,13 @@ void ParticleBufferClass::Reset_Colors(ParticlePropertyStruct &new_prop Color->Release_Ref(); Color = NULL; } - if (ColorKeyFrameTimes) { - delete [] ColorKeyFrameTimes; - ColorKeyFrameTimes = NULL; - } - if (ColorKeyFrameDeltas) { - delete [] ColorKeyFrameDeltas; - ColorKeyFrameDeltas = NULL; - } + + delete [] ColorKeyFrameTimes; + ColorKeyFrameTimes = NULL; + + delete [] ColorKeyFrameDeltas; + ColorKeyFrameDeltas = NULL; + if (ColorKeyFrameValues) { if (NumColorKeyFrames > 1) { delete [] ColorKeyFrameValues; @@ -1183,21 +1181,10 @@ void ParticleBufferClass::Reset_Colors(ParticlePropertyStruct &new_prop // otherwise release and reallocate. unsigned int new_num_color_key_frames = ckey + 1;// Includes start keyframe (keytime == 0). if (new_num_color_key_frames != NumColorKeyFrames) { - - if (ColorKeyFrameTimes) { - delete [] ColorKeyFrameTimes; - ColorKeyFrameTimes = NULL; - } - if (ColorKeyFrameValues) { - delete [] ColorKeyFrameValues; - ColorKeyFrameValues = NULL; - } - if (ColorKeyFrameDeltas) { - delete [] ColorKeyFrameDeltas; - ColorKeyFrameDeltas = NULL; - } - NumColorKeyFrames = new_num_color_key_frames; + delete [] ColorKeyFrameTimes; + delete [] ColorKeyFrameValues; + delete [] ColorKeyFrameDeltas; ColorKeyFrameTimes = W3DNEWARRAY unsigned int [NumColorKeyFrames]; ColorKeyFrameValues = W3DNEWARRAY Vector3 [NumColorKeyFrames]; ColorKeyFrameDeltas = W3DNEWARRAY Vector3 [NumColorKeyFrames]; @@ -1297,14 +1284,13 @@ void ParticleBufferClass::Reset_Opacity(ParticlePropertyStruct &new_props Alpha->Release_Ref(); Alpha = NULL; } - if (AlphaKeyFrameTimes) { - delete [] AlphaKeyFrameTimes; - AlphaKeyFrameTimes = NULL; - } - if (AlphaKeyFrameDeltas) { - delete [] AlphaKeyFrameDeltas; - AlphaKeyFrameDeltas = NULL; - } + + delete [] AlphaKeyFrameTimes; + AlphaKeyFrameTimes = NULL; + + delete [] AlphaKeyFrameDeltas; + AlphaKeyFrameDeltas = NULL; + if (AlphaKeyFrameValues) { if (NumAlphaKeyFrames > 1) { delete [] AlphaKeyFrameValues; @@ -1343,21 +1329,10 @@ void ParticleBufferClass::Reset_Opacity(ParticlePropertyStruct &new_props // otherwise release and reallocate. unsigned int new_num_alpha_key_frames = akey + 1;// Includes start keyframe (keytime == 0). if (new_num_alpha_key_frames != NumAlphaKeyFrames) { - - if (AlphaKeyFrameTimes) { - delete [] AlphaKeyFrameTimes; - AlphaKeyFrameTimes = NULL; - } - if (AlphaKeyFrameValues) { - delete [] AlphaKeyFrameValues; - AlphaKeyFrameValues = NULL; - } - if (AlphaKeyFrameDeltas) { - delete [] AlphaKeyFrameDeltas; - AlphaKeyFrameDeltas = NULL; - } - NumAlphaKeyFrames = new_num_alpha_key_frames; + delete [] AlphaKeyFrameValues; + delete [] AlphaKeyFrameTimes; + delete [] AlphaKeyFrameDeltas; AlphaKeyFrameTimes = W3DNEWARRAY unsigned int [NumAlphaKeyFrames]; AlphaKeyFrameValues = W3DNEWARRAY float [NumAlphaKeyFrames]; AlphaKeyFrameDeltas = W3DNEWARRAY float [NumAlphaKeyFrames]; @@ -1454,14 +1429,13 @@ void ParticleBufferClass::Reset_Size(ParticlePropertyStruct &new_props) Size->Release_Ref(); Size = NULL; } - if (SizeKeyFrameTimes) { - delete [] SizeKeyFrameTimes; - SizeKeyFrameTimes = NULL; - } - if (SizeKeyFrameDeltas) { - delete [] SizeKeyFrameDeltas; - SizeKeyFrameDeltas = NULL; - } + + delete [] SizeKeyFrameTimes; + SizeKeyFrameTimes = NULL; + + delete [] SizeKeyFrameDeltas; + SizeKeyFrameDeltas = NULL; + if (SizeKeyFrameValues) { if (NumSizeKeyFrames > 1) { delete [] SizeKeyFrameValues; @@ -1500,21 +1474,10 @@ void ParticleBufferClass::Reset_Size(ParticlePropertyStruct &new_props) // otherwise release and reallocate. unsigned int new_num_size_key_frames = skey + 1;// Includes start keyframe (keytime == 0). if (new_num_size_key_frames != NumSizeKeyFrames) { - - if (SizeKeyFrameTimes) { - delete [] SizeKeyFrameTimes; - SizeKeyFrameTimes = NULL; - } - if (SizeKeyFrameValues) { - delete [] SizeKeyFrameValues; - SizeKeyFrameValues = NULL; - } - if (SizeKeyFrameDeltas) { - delete [] SizeKeyFrameDeltas; - SizeKeyFrameDeltas = NULL; - } - NumSizeKeyFrames = new_num_size_key_frames; + delete [] SizeKeyFrameTimes; + delete [] SizeKeyFrameValues; + delete [] SizeKeyFrameDeltas; SizeKeyFrameTimes = W3DNEWARRAY unsigned int [NumSizeKeyFrames]; SizeKeyFrameValues = W3DNEWARRAY float [NumSizeKeyFrames]; SizeKeyFrameDeltas = W3DNEWARRAY float [NumSizeKeyFrames]; @@ -1625,22 +1588,18 @@ void ParticleBufferClass::Reset_Rotations(ParticlePropertyStruct &new_pro // Release Arrays, REF_PTR_RELEASE(Orientation); - if (RotationKeyFrameTimes) { - delete [] RotationKeyFrameTimes; - RotationKeyFrameTimes = NULL; - } - if (HalfRotationKeyFrameDeltas) { - delete [] HalfRotationKeyFrameDeltas; - HalfRotationKeyFrameDeltas = NULL; - } - if (RotationKeyFrameValues) { - delete [] RotationKeyFrameValues; - RotationKeyFrameValues = NULL; - } - if (OrientationKeyFrameValues) { - delete [] OrientationKeyFrameValues; - OrientationKeyFrameValues = NULL; - } + + delete [] RotationKeyFrameTimes; + RotationKeyFrameTimes = NULL; + + delete [] HalfRotationKeyFrameDeltas; + HalfRotationKeyFrameDeltas = NULL; + + delete [] RotationKeyFrameValues; + RotationKeyFrameValues = NULL; + + delete [] OrientationKeyFrameValues; + OrientationKeyFrameValues = NULL; NumRotationKeyFrames = 0; NumRandomRotationEntriesMinus1 = 0; @@ -1671,25 +1630,11 @@ void ParticleBufferClass::Reset_Rotations(ParticlePropertyStruct &new_pro // OrientationKeyFrameValues if the right size, otherwise release and reallocate. unsigned int new_num_key_frames = key + 1;// Includes start keyframe (keytime == 0). if (new_num_key_frames != NumRotationKeyFrames) { - - if (RotationKeyFrameTimes) { - delete [] RotationKeyFrameTimes; - RotationKeyFrameTimes = NULL; - } - if (RotationKeyFrameValues) { - delete [] RotationKeyFrameValues; - RotationKeyFrameValues = NULL; - } - if (HalfRotationKeyFrameDeltas) { - delete [] HalfRotationKeyFrameDeltas; - HalfRotationKeyFrameDeltas = NULL; - } - if (OrientationKeyFrameValues) { - delete [] OrientationKeyFrameValues; - OrientationKeyFrameValues = NULL; - } - NumRotationKeyFrames = new_num_key_frames; + delete [] RotationKeyFrameTimes; + delete [] RotationKeyFrameValues; + delete [] HalfRotationKeyFrameDeltas; + delete [] OrientationKeyFrameValues; RotationKeyFrameTimes = W3DNEWARRAY unsigned int [NumRotationKeyFrames]; RotationKeyFrameValues = W3DNEWARRAY float [NumRotationKeyFrames]; HalfRotationKeyFrameDeltas = W3DNEWARRAY float [NumRotationKeyFrames]; @@ -1879,21 +1824,10 @@ void ParticleBufferClass::Reset_Frames(ParticlePropertyStruct &new_props) // otherwise release and reallocate. unsigned int new_num_key_frames = key + 1;// Includes start keyframe (keytime == 0). if (new_num_key_frames != NumFrameKeyFrames) { - - if (FrameKeyFrameTimes) { - delete [] FrameKeyFrameTimes; - FrameKeyFrameTimes = NULL; - } - if (FrameKeyFrameValues) { - delete [] FrameKeyFrameValues; - FrameKeyFrameValues = NULL; - } - if (FrameKeyFrameDeltas) { - delete [] FrameKeyFrameDeltas; - FrameKeyFrameDeltas = NULL; - } - NumFrameKeyFrames = new_num_key_frames; + delete [] FrameKeyFrameTimes; + delete [] FrameKeyFrameValues; + delete [] FrameKeyFrameDeltas; FrameKeyFrameTimes = W3DNEWARRAY unsigned int [NumFrameKeyFrames]; FrameKeyFrameValues = W3DNEWARRAY float [NumFrameKeyFrames]; FrameKeyFrameDeltas = W3DNEWARRAY float [NumFrameKeyFrames]; @@ -1986,14 +1920,13 @@ void ParticleBufferClass::Reset_Blur_Times(ParticlePropertyStruct &new_bl // Release Arrays, Reuse KeyFrameValues if the right size, // otherwise release and reallocate. - if (BlurTimeKeyFrameTimes) { - delete [] BlurTimeKeyFrameTimes; - BlurTimeKeyFrameTimes = NULL; - } - if (BlurTimeKeyFrameDeltas) { - delete [] BlurTimeKeyFrameDeltas; - BlurTimeKeyFrameDeltas = NULL; - } + + delete [] BlurTimeKeyFrameTimes; + BlurTimeKeyFrameTimes = NULL; + + delete [] BlurTimeKeyFrameDeltas; + BlurTimeKeyFrameDeltas = NULL; + if (BlurTimeKeyFrameValues) { if (NumBlurTimeKeyFrames > 1) { delete [] BlurTimeKeyFrameValues; @@ -2027,21 +1960,10 @@ void ParticleBufferClass::Reset_Blur_Times(ParticlePropertyStruct &new_bl // otherwise release and reallocate. unsigned int new_num_key_frames = key + 1;// Includes start keyframe (keytime == 0). if (new_num_key_frames != NumBlurTimeKeyFrames) { - - if (BlurTimeKeyFrameTimes) { - delete [] BlurTimeKeyFrameTimes; - BlurTimeKeyFrameTimes = NULL; - } - if (BlurTimeKeyFrameValues) { - delete [] BlurTimeKeyFrameValues; - BlurTimeKeyFrameValues = NULL; - } - if (BlurTimeKeyFrameDeltas) { - delete [] BlurTimeKeyFrameDeltas; - BlurTimeKeyFrameDeltas = NULL; - } - NumBlurTimeKeyFrames = new_num_key_frames; + delete [] BlurTimeKeyFrameTimes; + delete [] BlurTimeKeyFrameValues; + delete [] BlurTimeKeyFrameDeltas; BlurTimeKeyFrameTimes = new unsigned int [NumBlurTimeKeyFrames]; BlurTimeKeyFrameValues = new float [NumBlurTimeKeyFrames]; BlurTimeKeyFrameDeltas = new float [NumBlurTimeKeyFrames]; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp index 8b3b338f11c..f2585454029 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp @@ -179,15 +179,11 @@ ParticleEmitterClass::~ParticleEmitterClass(void) Buffer->Emitter_Is_Dead(); Buffer->Release_Ref(); - if (PosRand != NULL) { - delete PosRand; - PosRand = NULL; - } + delete PosRand; + PosRand = NULL; - if (VelRand != NULL) { - delete VelRand; - VelRand = NULL; - } + delete VelRand; + VelRand = NULL; if (NameString != NULL) { ::free (NameString); @@ -278,27 +274,24 @@ ParticleEmitterClass::Create_From_Definition (const ParticleEmitterDefClass &def definition.Get_Frame_Mode (), definition.Get_Line_Properties ()) ); - if (color_keys.KeyTimes != NULL) delete [] color_keys.KeyTimes; - if (color_keys.Values != NULL) delete [] color_keys.Values; - if (opacity_keys.KeyTimes != NULL) delete [] opacity_keys.KeyTimes; - if (opacity_keys.Values != NULL) delete [] opacity_keys.Values; - if (size_keys.KeyTimes != NULL) delete [] size_keys.KeyTimes; - if (size_keys.Values != NULL) delete [] size_keys.Values; - if (rotation_keys.KeyTimes != NULL) delete [] rotation_keys.KeyTimes; - if (rotation_keys.Values != NULL) delete [] rotation_keys.Values; - if (frame_keys.KeyTimes != NULL) delete [] frame_keys.KeyTimes; - if (frame_keys.Values != NULL) delete [] frame_keys.Values; - if (blur_time_keys.KeyTimes != NULL) delete [] blur_time_keys.KeyTimes; - if (blur_time_keys.Values != NULL) delete [] blur_time_keys.Values; + delete [] color_keys.KeyTimes; + delete [] color_keys.Values; + delete [] opacity_keys.KeyTimes; + delete [] opacity_keys.Values; + delete [] size_keys.KeyTimes; + delete [] size_keys.Values; + delete [] rotation_keys.KeyTimes; + delete [] rotation_keys.Values; + delete [] frame_keys.KeyTimes; + delete [] frame_keys.Values; + delete [] blur_time_keys.KeyTimes; + delete [] blur_time_keys.Values; // Pass the name along to the emitter pemitter->Set_Name (definition.Get_Name ()); // release our reference to particle texture. - if (ptexture) { - REF_PTR_RELEASE(ptexture); - ptexture = 0; - } + REF_PTR_RELEASE(ptexture); // Return a pointer to the new emitter return pemitter; @@ -442,21 +435,16 @@ bool ParticleEmitterClass::Is_Stopped(void) void ParticleEmitterClass::Set_Position_Randomizer(Vector3Randomizer *rand) { - if (PosRand) { - delete PosRand; - PosRand =NULL; - } + delete PosRand; PosRand = rand; } void ParticleEmitterClass::Set_Velocity_Randomizer(Vector3Randomizer *rand) { - if (VelRand) { - delete VelRand; - VelRand =NULL; - } + delete VelRand; VelRand = rand; + if (VelRand) { VelRand->Scale(0.001f); // Convert from seconds to ms } @@ -745,8 +733,8 @@ ParticleEmitterClass::Build_Definition (void) const ParticlePropertyStruct colors; Get_Color_Key_Frames (colors); pdefinition->Set_Color_Keyframes (colors); - if (colors.KeyTimes != NULL) delete [] colors.KeyTimes; - if (colors.Values != NULL) delete [] colors.Values; + delete [] colors.KeyTimes; + delete [] colors.Values; // // Pass the opacity keyframes onto the definition @@ -754,8 +742,8 @@ ParticleEmitterClass::Build_Definition (void) const ParticlePropertyStruct opacities; Get_Opacity_Key_Frames (opacities); pdefinition->Set_Opacity_Keyframes (opacities); - if (opacities.KeyTimes != NULL) delete [] opacities.KeyTimes; - if (opacities.Values != NULL) delete [] opacities.Values; + delete [] opacities.KeyTimes; + delete [] opacities.Values; // // Pass the size keyframes onto the definition @@ -763,8 +751,8 @@ ParticleEmitterClass::Build_Definition (void) const ParticlePropertyStruct sizes; Get_Size_Key_Frames (sizes); pdefinition->Set_Size_Keyframes (sizes); - if (sizes.KeyTimes != NULL) delete [] sizes.KeyTimes; - if (sizes.Values != NULL) delete [] sizes.Values; + delete [] sizes.KeyTimes; + delete [] sizes.Values; // // Pass the rotation keyframes onto the definition @@ -772,8 +760,8 @@ ParticleEmitterClass::Build_Definition (void) const ParticlePropertyStruct rotations; Get_Rotation_Key_Frames (rotations); pdefinition->Set_Rotation_Keyframes (rotations, Get_Initial_Orientation_Random()); - if (rotations.KeyTimes != NULL) delete [] rotations.KeyTimes; - if (rotations.Values != NULL) delete [] rotations.Values; + delete [] rotations.KeyTimes; + delete [] rotations.Values; // // Pass the frame keyframes onto the definition @@ -781,8 +769,8 @@ ParticleEmitterClass::Build_Definition (void) const ParticlePropertyStruct frames; Get_Frame_Key_Frames (frames); pdefinition->Set_Frame_Keyframes (frames); - if (frames.KeyTimes != NULL) delete [] frames.KeyTimes; - if (frames.Values != NULL) delete [] frames.Values; + delete [] frames.KeyTimes; + delete [] frames.Values; // // Pass the blur time keyframes onto the definition @@ -790,8 +778,8 @@ ParticleEmitterClass::Build_Definition (void) const ParticlePropertyStruct blur_times; Get_Blur_Time_Key_Frames (blur_times); pdefinition->Set_Blur_Time_Keyframes (blur_times); - if (blur_times.KeyTimes != NULL) delete [] blur_times.KeyTimes; - if (blur_times.Values != NULL) delete [] blur_times.Values; + delete [] blur_times.KeyTimes; + delete [] blur_times.Values; // diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp index 57f3014592d..22ceab5419a 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp @@ -42,23 +42,12 @@ #include "texture.h" #ifndef SAFE_DELETE -#define SAFE_DELETE(pointer) \ -{ \ - if (pointer) { \ - delete pointer; \ - pointer = 0; \ - } \ -} -#endif //SAFE_DELETE +#define SAFE_DELETE(pointer) { delete pointer; pointer = NULL; } +#endif #ifndef SAFE_DELETE_ARRAY -#define SAFE_DELETE_ARRAY(pointer) \ - if (pointer) { \ - delete [] pointer; \ - pointer = 0; \ - } \ - -#endif //SAFE_DELETE +#define SAFE_DELETE_ARRAY(pointer) { delete [] pointer; pointer = NULL; } +#endif /////////////////////////////////////////////////////////////////////////////////// @@ -1822,7 +1811,6 @@ ParticleEmitterLoaderClass::Load_W3D (ChunkLoadClass &chunk_load) // Error! Free the definition delete pdefinition; - pdefinition = NULL; } else { // Success! Create a prototype from the definition diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/textureloader.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/textureloader.cpp index 8af486294af..baa495c64d6 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/textureloader.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/textureloader.cpp @@ -419,7 +419,7 @@ IDirect3DSurface8* TextureLoader::Load_Surface_Immediate( DX8_ErrorCode(d3d_surface->UnlockRect()); - if (converted_surface) delete[] converted_surface; + delete[] converted_surface; return d3d_surface; } @@ -555,7 +555,7 @@ bool TextureLoader::Load_Uncompressed_Mipmap_Levels_From_TGA(TextureLoadTaskClas if (!width || !height || !src_width || !src_height) break; } - if (converted_surface) delete[] converted_surface; + delete[] converted_surface; return true; } diff --git a/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp b/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp index 0bfeeb375f7..68aca92937e 100644 --- a/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp @@ -445,25 +445,15 @@ GUIEdit::GUIEdit( void ) //============================================================================= GUIEdit::~GUIEdit( void ) { - if (TheHeaderTemplateManager) - { - delete TheHeaderTemplateManager; - TheHeaderTemplateManager = NULL; - } + delete TheHeaderTemplateManager; + TheHeaderTemplateManager = NULL; - if (TheGameText) - { - delete TheGameText; - TheGameText = NULL; - } + delete TheGameText; + TheGameText = NULL; // delete the IME Manager -// if ( TheIMEManager ) -// { -// delete TheIMEManager; -// TheIMEManager = NULL; -// } - +// delete TheIMEManager; +// TheIMEManager = NULL; // all the shutdown routine shutdown(); diff --git a/Generals/Code/Tools/WorldBuilder/src/CUndoable.cpp b/Generals/Code/Tools/WorldBuilder/src/CUndoable.cpp index d1bd1be2340..1ba555be5d3 100644 --- a/Generals/Code/Tools/WorldBuilder/src/CUndoable.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/CUndoable.cpp @@ -649,9 +649,8 @@ void FlagsInfo::UndoFlags(CWorldBuilderDoc *pDoc) ModifyFlagsUndoable::~ModifyFlagsUndoable(void) { m_pDoc = NULL; // not ref counted. - if (m_flagsList) { - delete m_flagsList; - } + + delete m_flagsList; m_flagsList = NULL; } @@ -937,9 +936,8 @@ void DeleteInfo::UndoDelete(WorldHeightMapEdit *pMap) DeleteObjectUndoable::~DeleteObjectUndoable(void) { m_pDoc = NULL; // not ref counted. - if (m_deleteList) { - delete m_deleteList; - } + + delete m_deleteList; m_deleteList=NULL; } diff --git a/Generals/Code/Tools/WorldBuilder/src/MainFrm.cpp b/Generals/Code/Tools/WorldBuilder/src/MainFrm.cpp index 99e85330eaf..0501faf23ba 100644 --- a/Generals/Code/Tools/WorldBuilder/src/MainFrm.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/MainFrm.cpp @@ -75,9 +75,7 @@ CMainFrame::CMainFrame() CMainFrame::~CMainFrame() { - if (m_layersList) { - delete m_layersList; - } + delete m_layersList; SaveBarState("MainFrame"); TheMainFrame = NULL; diff --git a/Generals/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp b/Generals/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp index 111041118af..4a3fd07652f 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp @@ -256,10 +256,8 @@ void PopupSlider::New(CWnd *pParentWnd, long kind, member function */ } catch (...) { // don't rethrow - if (pPopupSlider) { - delete pPopupSlider; - pPopupSlider = NULL; - } + delete pPopupSlider; + pPopupSlider = NULL; } diff --git a/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp b/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp index 977f3a78dca..5c87b65e969 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp @@ -1346,7 +1346,7 @@ void WorldHeightMapEdit::autoBlendOut(Int xIndex, Int yIndex, Int globalEdgeClas delete pCurNode; } - if (pProcessed) delete[] pProcessed; + delete[] pProcessed; pProcessed = NULL; } diff --git a/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp b/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp index 4f1ce2855aa..2b077964489 100644 --- a/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -474,19 +474,16 @@ void WbView3d::shutdownWW3D(void) WWMath::Shutdown(); } m_ww3dInited = false; - if (m_intersector) { - delete m_intersector; - m_intersector = NULL; - } - if (m_layer) { - delete m_layer; - m_layer = NULL; - } - if (m_buildLayer) { - delete m_buildLayer; - m_buildLayer = NULL; - } + delete m_intersector; + m_intersector = NULL; + + delete m_layer; + m_layer = NULL; + + delete m_buildLayer; + m_buildLayer = NULL; + if (m3DFont) { m3DFont->Release(); m3DFont = NULL; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/INIException.h b/GeneralsMD/Code/GameEngine/Include/Common/INIException.h index ce12ce2d781..d73af7cd0f6 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/INIException.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/INIException.h @@ -45,8 +45,6 @@ class INIException ~INIException() { - if (mFailureMessage) { - delete [] mFailureMessage; - } + delete [] mFailureMessage; } }; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp index 4b087c1c796..c7f30f53eb1 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp @@ -298,8 +298,8 @@ GameEngine::~GameEngine() delete TheFileSystem; TheFileSystem = NULL; - if (TheGameLODManager) - delete TheGameLODManager; + delete TheGameLODManager; + TheGameLODManager = NULL; Drawable::killStaticImages(); @@ -902,8 +902,7 @@ void GameEngine::reset( void ) if (deleteNetwork) { DEBUG_ASSERTCRASH(TheNetwork, ("Deleting NULL TheNetwork!")); - if (TheNetwork) - delete TheNetwork; + delete TheNetwork; TheNetwork = NULL; } if(background) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index 73143fabee7..055565ad33b 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -118,15 +118,9 @@ BuildAssistant::BuildAssistant( void ) BuildAssistant::~BuildAssistant( void ) { - // delete build position array if we used it - if( m_buildPositions ) - { - - delete [] m_buildPositions; - m_buildPositions = NULL; - m_buildPositionSize = 0; - - } + delete [] m_buildPositions; + m_buildPositions = NULL; + m_buildPositionSize = 0; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/CDManager.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/CDManager.cpp index 03f1aebc338..e0cf712725a 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/CDManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/CDManager.cpp @@ -284,10 +284,7 @@ void CDManager::destroyAllDrives( void ) { node->remove(); CDDriveInterface *drive = (CDDriveInterface *) node->item(); - if ( drive ) - { - delete drive; - } + delete drive; } } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/DataChunk.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/DataChunk.cpp index a54f2676ec9..aa8813cf2c0 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/DataChunk.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/DataChunk.cpp @@ -44,10 +44,8 @@ CachedFileInputStream::CachedFileInputStream(void):m_buffer(NULL),m_size(0) CachedFileInputStream::~CachedFileInputStream(void) { - if (m_buffer) { - delete[] m_buffer; - m_buffer=NULL; - } + delete[] m_buffer; + m_buffer=NULL; } Bool CachedFileInputStream::open(AsciiString path) @@ -104,10 +102,9 @@ Bool CachedFileInputStream::open(AsciiString path) void CachedFileInputStream::close(void) { - if (m_buffer) { - delete[] m_buffer; - m_buffer=NULL; - } + delete[] m_buffer; + m_buffer=NULL; + m_pos=0; m_size=0; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp index 5b542dbea1d..15782d54425 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp @@ -426,11 +426,8 @@ void GameStateMap::xfer( Xfer *xfer ) } else { - if( TheSkirmishGameInfo ) - { - delete TheSkirmishGameInfo; - TheSkirmishGameInfo = NULL; - } + delete TheSkirmishGameInfo; + TheSkirmishGameInfo = NULL; } // diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index 9769bade42b..0c6b39fc252 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -308,11 +308,8 @@ const Int MAX_ENABLED_MODULES = 16; //------------------------------------------------------------------------------------------------- /*static*/ void Drawable::killStaticImages() { - if( s_animationTemplates ) - { - delete[] s_animationTemplates; - s_animationTemplates = NULL; - } + delete[] s_animationTemplates; + s_animationTemplates = NULL; } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp index 9cd69272f37..8c5dbeaebb1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp @@ -137,22 +137,14 @@ AnimateWindowManager::AnimateWindowManager( void ) } AnimateWindowManager::~AnimateWindowManager( void ) { - if(m_slideFromRight) - delete m_slideFromRight; - if(m_slideFromRightFast) - delete m_slideFromRightFast; - if(m_slideFromLeft) - delete m_slideFromLeft; - if(m_slideFromTop) - delete m_slideFromTop; - if(m_slideFromTopFast) - delete m_slideFromTopFast; - if(m_slideFromBottom) - delete m_slideFromBottom; - if(m_spiral) - delete m_spiral; - if (m_slideFromBottomTimed) - delete m_slideFromBottomTimed; + delete m_slideFromRight; + delete m_slideFromRightFast; + delete m_slideFromLeft; + delete m_slideFromTop; + delete m_slideFromTopFast; + delete m_slideFromBottom; + delete m_spiral; + delete m_slideFromBottomTimed; m_slideFromRight = NULL; resetToRestPosition( ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 25eeec1304f..8232b1720c8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -998,29 +998,25 @@ ControlBar::~ControlBar( void ) m_scienceLayout = NULL; } m_genArrow = NULL; - if(m_videoManager) - delete m_videoManager; - m_videoManager = NULL; + delete m_videoManager; + m_videoManager = NULL; - if(m_animateWindowManagerForGenShortcuts) - delete m_animateWindowManagerForGenShortcuts; + delete m_animateWindowManagerForGenShortcuts; m_animateWindowManagerForGenShortcuts = NULL; - if(m_animateWindowManager) - delete m_animateWindowManager; + + delete m_animateWindowManager; m_animateWindowManager = NULL; - if(m_generalsScreenAnimate) - delete m_generalsScreenAnimate; + delete m_generalsScreenAnimate; m_generalsScreenAnimate = NULL; - if( m_controlBarSchemeManager ) - delete m_controlBarSchemeManager; + delete m_controlBarSchemeManager; m_controlBarSchemeManager = NULL; -// if(m_controlBarResizer) -// delete m_controlBarResizer; +// delete m_controlBarResizer; // m_controlBarResizer = NULL; + // destroy all the command set definitions CommandSet *set; while( m_commandSets ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp index 0b44683b660..41aec0a3f08 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp @@ -217,9 +217,7 @@ void ControlBarScheme::reset(void) while (it != m_layer[i].end()) { ControlBarSchemeImage *im = *it; - if( im ) - delete im; - im = NULL; + delete im; it ++; } m_layer[i].clear(); @@ -232,12 +230,7 @@ void ControlBarScheme::reset(void) while (it != m_animations.end()) { ControlBarSchemeAnimation *anim = *it; - if( anim ) - { - anim->m_animImage = NULL; - delete(anim); - } - anim = NULL; + delete anim; it ++; } m_animations.clear(); @@ -850,9 +843,7 @@ ControlBarSchemeManager::~ControlBarSchemeManager( void ) while (it != m_schemeList.end()) { ControlBarScheme *CBScheme = *it; - if( CBScheme ) - delete CBScheme; - CBScheme = NULL; + delete CBScheme; it ++; } m_schemeList.clear(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp index 8ecca02cc89..d9ab7ce2637 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp @@ -114,7 +114,7 @@ void ControlBarPopupDescriptionUpdateFunc( WindowLayout *layout, void *param ) { Bool wasFinished = theAnimateWindowManager->isFinished(); theAnimateWindowManager->update(); - if (theAnimateWindowManager && theAnimateWindowManager->isFinished() && !wasFinished && theAnimateWindowManager->isReversed()) + if (theAnimateWindowManager->isFinished() && !wasFinished && theAnimateWindowManager->isReversed()) { delete theAnimateWindowManager; theAnimateWindowManager = NULL; @@ -700,8 +700,8 @@ void ControlBar::deleteBuildTooltipLayout( void ) // m_buildToolTipLayout->destroyWindows(); // deleteInstance(m_buildToolTipLayout); // m_buildToolTipLayout = NULL; - if(theAnimateWindowManager) - delete theAnimateWindowManager; + + delete theAnimateWindowManager; theAnimateWindowManager = NULL; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp index 6c0e5b3ff61..bfe172ae48b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp @@ -290,8 +290,8 @@ void ResetDiplomacy( void ) theLayout = NULL; } theWindow = NULL; - if (theAnimateWindowManager) - delete theAnimateWindowManager; + + delete theAnimateWindowManager; theAnimateWindowManager = NULL; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ChallengeMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ChallengeMenu.cpp index 6939dfb1def..175294db660 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ChallengeMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ChallengeMenu.cpp @@ -454,8 +454,7 @@ void ChallengeMenuUpdate( WindowLayout *layout, void *userData ) //------------------------------------------------------------------------------------------------- void ChallengeMenuShutdown( WindowLayout *layout, void *userData ) { - if(wndVideoManager) - delete wndVideoManager; + delete wndVideoManager; wndVideoManager = NULL; lastButtonIndex = -1; @@ -473,8 +472,7 @@ void ChallengeMenuShutdown( WindowLayout *layout, void *userData ) TheTransitionHandler->reverse("ChallengeMenuFade"); isShuttingDown = TRUE; - if(TheChallengeGameInfo) - delete TheChallengeGameInfo; + delete TheChallengeGameInfo; TheChallengeGameInfo = NULL; TheAudio->removeAudioEvent( lastSelectionSound ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp index 5c186977f17..0c522ad951a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp @@ -80,8 +80,8 @@ static GameWindow *parentMainMenu = NULL; void CreditsMenuInit( WindowLayout *layout, void *userData ) { TheShell->showShellMap(FALSE); - if(TheCredits) - delete TheCredits; + + delete TheCredits; TheCredits = new CreditsManager; TheCredits->load(); TheCredits->init(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp index fe3c8b25ccf..a4e46c0309e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp @@ -262,10 +262,8 @@ void DownloadMenuInit( WindowLayout *layout, void *userData ) progressBarMunkee = TheWindowManager->winGetWindowFromId( parent, progressBarMunkeeID ); DEBUG_ASSERTCRASH(!TheDownloadManager, ("Download manager already exists")); - if (TheDownloadManager) - { - delete TheDownloadManager; - } + + delete TheDownloadManager; TheDownloadManager = NEW DownloadManagerMunkee; } @@ -276,11 +274,9 @@ void DownloadMenuInit( WindowLayout *layout, void *userData ) void DownloadMenuShutdown( WindowLayout *layout, void *userData ) { DEBUG_ASSERTCRASH(TheDownloadManager, ("No download manager")); - if (TheDownloadManager) - { - delete TheDownloadManager; - TheDownloadManager = NULL; - } + + delete TheDownloadManager; + TheDownloadManager = NULL; staticTextSize = NULL; staticTextTime = NULL; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index d853fd78cbe..2bb04820691 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -2239,11 +2239,9 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, { // go back one screen //TheShell->pop(); - if (pref) - { - delete pref; - pref = NULL; - } + + delete pref; + pref = NULL; comboBoxLANIP = NULL; comboBoxOnlineIP = NULL; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp index 033e400dc51..bd9418f4dd9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp @@ -720,8 +720,10 @@ void PlayMovieAndBlock(AsciiString movieTitle) videoBuffer = NULL; if ( videoStream ) + { videoStream->close(); - videoStream = NULL; + videoStream = NULL; + } return; } @@ -758,11 +760,10 @@ void PlayMovieAndBlock(AsciiString movieTitle) } TheWritableGlobalData->m_loadScreenRender = FALSE; movieWindow->winGetInstanceData()->setVideoBuffer(NULL); - if (videoBuffer) - { - delete videoBuffer; - videoBuffer = NULL; - } + + delete videoBuffer; + videoBuffer = NULL; + if (videoStream) { videoStream->close(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp index 3884014da89..06b6516fd8e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp @@ -1272,11 +1272,9 @@ WindowMsgHandledType WOLBuddyOverlayRCMenuSystem( GameWindow *window, UnsignedIn else if (rcData->m_itemType == ITEM_REQUEST) isRequest = TRUE; - if(rcData) - { - delete rcData; - rcData = NULL; - } + delete rcData; + rcData = NULL; + window->winSetUserData(NULL); //DEBUG_ASSERTCRASH(profileID > 0, ("Bad profile ID in user data!")); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp index f45b61e0f18..5768593797d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp @@ -1355,10 +1355,8 @@ void WOLGameSetupMenuInit( WindowLayout *layout, void *userData ) } TheGameSpyInfo->setCurrentGroupRoom(0); - if (TheNAT != NULL) { - delete TheNAT; - TheNAT = NULL; - } + delete TheNAT; + TheNAT = NULL; nextScreen = NULL; buttonPushed = false; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp index d7cc5eaf0aa..d5d0bad5aa3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp @@ -720,10 +720,8 @@ void WOLQuickMatchMenuInit( WindowLayout *layout, void *userData ) isShuttingDown = false; raiseMessageBoxes = true; - if (TheNAT != NULL) { - delete TheNAT; - TheNAT = NULL; - } + delete TheNAT; + TheNAT = NULL; parentWOLQuickMatchID = NAMEKEY( "WOLQuickMatchMenu.wnd:WOLQuickMatchMenuParent" ); buttonBackID = NAMEKEY( "WOLQuickMatchMenu.wnd:ButtonBack" ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp index ea664211b22..f40933909a9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp @@ -570,10 +570,8 @@ void WOLWelcomeMenuShutdown( WindowLayout *layout, void *userData ) { listboxInfo = NULL; - if (TheFirewallHelper != NULL) { - delete TheFirewallHelper; - TheFirewallHelper = NULL; - } + delete TheFirewallHelper; + TheFirewallHelper = NULL; isShuttingDown = TRUE; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp index 282a270c077..d906b74d8b9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp @@ -1968,10 +1968,8 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, } delete[]( list->listData ); - if( list->columnWidth ) - delete[]( list->columnWidth ); - if( list->columnWidthPercentage ) - delete[]( list->columnWidthPercentage ); + delete[]( list->columnWidth ); + delete[]( list->columnWidthPercentage ); if( list->multiSelect ) delete[]( list->selections ); @@ -2459,13 +2457,8 @@ void GadgetListBoxRemoveMultiSelect( GameWindow *listbox ) { ListboxData *listData = (ListboxData *)listbox->winGetUserData(); - if( listData->selections ) - { - - delete[]( listData->selections ); - listData->selections = NULL; - - } + delete[]( listData->selections ); + listData->selections = NULL; listData->multiSelect = FALSE; @@ -2556,8 +2549,7 @@ void GadgetListBoxSetListLength( GameWindow *listbox, Int newLength ) listboxData->listLength = newLength; - if( listboxData->listData ) - delete[]( listboxData->listData ); + delete[]( listboxData->listData ); listboxData->listData = newData; //reset the total height diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp index e90622bb259..d63c7f6b5d7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp @@ -124,12 +124,10 @@ GameWindow::GameWindow( void ) GameWindow::~GameWindow( void ) { - if( m_inputData ) - delete m_inputData; + delete m_inputData; m_inputData = NULL; - if( m_editData ) - delete m_editData; + delete m_editData; m_editData = NULL; unlinkFromTransitionWindows(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp index 354c8207714..3ee1dd95725 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp @@ -204,8 +204,8 @@ GameWindowManager::~GameWindowManager( void ) // destroy all windows winDestroyAll(); freeStaticStrings(); - if(TheTransitionHandler) - delete TheTransitionHandler; + + delete TheTransitionHandler; TheTransitionHandler = NULL; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp index c93d882371d..1238c199ba8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp @@ -157,9 +157,8 @@ TransitionWindow::~TransitionWindow( void ) m_win->unlinkTransitionWindow(this); m_win = NULL; - if(m_transition) - delete m_transition; + delete m_transition; m_transition = NULL; } @@ -172,9 +171,7 @@ Bool TransitionWindow::init( void ) // if( !m_win ) // return FALSE; - if(m_transition) - delete m_transition; - + delete m_transition; m_transition = getTransitionForStyle( m_style ); m_transition->init(m_win); @@ -253,7 +250,6 @@ TransitionGroup::~TransitionGroup( void ) { TransitionWindow *tWin = *it; delete tWin; - tWin = NULL; it = m_transitionWindowList.erase(it); } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp index deffd88ce55..f813d3048dc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp @@ -124,11 +124,7 @@ HeaderTemplateManager::~HeaderTemplateManager( void ) while(it != m_headerTemplateList.end()) { HeaderTemplate *hTemplate = *it; - if(hTemplate) - { - hTemplate->m_font = NULL; - delete hTemplate; - } + delete hTemplate; it = m_headerTemplateList.erase(it); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp index 507008e3b9e..cbe3698614e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp @@ -540,10 +540,7 @@ IMEManager::~IMEManager() TheWindowManager->winDestroy( m_statusWindow ); } - if ( m_candidateString ) - { - delete [] m_candidateString; - } + delete [] m_candidateString; detatch(); ImmAssociateContext( ApplicationHWnd, m_oldContext ); @@ -1321,11 +1318,8 @@ void IMEManager::closeCandidateList( Int candidateFlags ) TheWindowManager->winUnsetModal( m_candidateWindow ); } - if ( m_candidateString ) - { - delete [] m_candidateString; - m_candidateString = NULL; - } + delete [] m_candidateString; + m_candidateString = NULL; m_candidateCount = 0; @@ -1338,11 +1332,8 @@ void IMEManager::closeCandidateList( Int candidateFlags ) void IMEManager::updateCandidateList( Int candidateFlags ) { - if ( m_candidateString ) - { - delete [] m_candidateString; - m_candidateString = NULL; - } + delete [] m_candidateString; + m_candidateString = NULL; m_pageSize = 10; m_candidateCount = 0; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp index 1ab4c12afaa..2ea3436b3af 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp @@ -199,13 +199,15 @@ SinglePlayerLoadScreen::~SinglePlayerLoadScreen( void ) m_objectiveWin = NULL; for(Int i = 0; i < MAX_OBJECTIVE_LINES; ++i) m_objectiveLines[i] = NULL; - if(m_videoBuffer) - delete m_videoBuffer; + + delete m_videoBuffer; m_videoBuffer = NULL; if ( m_videoStream ) + { m_videoStream->close(); - m_videoStream = NULL; + m_videoStream = NULL; + } TheAudio->removeAudioEvent( m_ambientLoopHandle ); m_ambientLoopHandle = NULL; @@ -495,8 +497,10 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) m_videoBuffer = NULL; if ( m_videoStream ) + { m_videoStream->close(); - m_videoStream = NULL; + m_videoStream = NULL; + } return; } @@ -680,12 +684,15 @@ ChallengeLoadScreen::ChallengeLoadScreen( void ) ChallengeLoadScreen::~ChallengeLoadScreen( void ) { m_progressBar = NULL; - if(m_videoBuffer) - delete m_videoBuffer; + + delete m_videoBuffer; m_videoBuffer = NULL; + if ( m_videoStream ) + { m_videoStream->close(); - m_videoStream = NULL; + m_videoStream = NULL; + } m_bioNameLeft = NULL; m_bioAgeLeft = NULL; @@ -719,8 +726,7 @@ ChallengeLoadScreen::~ChallengeLoadScreen( void ) m_overlayVsBackdrop = NULL; m_overlayVs = NULL; - if(m_wndVideoManager) - delete m_wndVideoManager; + delete m_wndVideoManager; m_wndVideoManager = NULL; TheAudio->removeAudioEvent( m_ambientLoopHandle ); @@ -956,8 +962,10 @@ void ChallengeLoadScreen::init( GameInfo *game ) m_videoBuffer = NULL; if ( m_videoStream ) + { m_videoStream->close(); - m_videoStream = NULL; + m_videoStream = NULL; + } return; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp index 34040c28779..56a89d711cb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp @@ -136,8 +136,7 @@ ShellMenuScheme::~ShellMenuScheme( void ) { ShellMenuSchemeImage *image = *it; it = m_imageList.erase( it ); - if(image) - delete image; + delete image; } ShellMenuSchemeLineListIt lineIt = m_lineList.begin(); @@ -145,8 +144,7 @@ ShellMenuScheme::~ShellMenuScheme( void ) { ShellMenuSchemeLine *line = *lineIt; lineIt = m_lineList.erase( lineIt ); - if(line) - delete line; + delete line; } @@ -215,8 +213,7 @@ ShellMenuSchemeManager::~ShellMenuSchemeManager( void ) { ShellMenuScheme *scheme = *it; it = m_schemeList.erase( it ); - if(scheme) - delete scheme; + delete scheme; } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp index f579ff7dea7..5ec7b1aaba4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -124,11 +124,8 @@ GameClient::~GameClient() TheGraphDraw = NULL; #endif - if (TheDrawGroupInfo) - { - delete TheDrawGroupInfo; - TheDrawGroupInfo = NULL; - } + delete TheDrawGroupInfo; + TheDrawGroupInfo = NULL; // clear any drawable TOC we might have m_drawableTOC.clear(); @@ -144,8 +141,8 @@ GameClient::~GameClient() // DEBUG_LOG(("%s", preloadTextureNamesGlobalHack[oog])); //} //DEBUG_LOG(("End Texture files ------------------------------------------------")); - if(TheCampaignManager) - delete TheCampaignManager; + + delete TheCampaignManager; TheCampaignManager = NULL; // destroy all Drawables diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameText.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameText.cpp index 8f5836abebb..6ad2216fa95 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameText.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameText.cpp @@ -379,17 +379,11 @@ void GameTextManager::init( void ) void GameTextManager::deinit( void ) { - if( m_stringInfo != NULL ) - { - delete [] m_stringInfo; - m_stringInfo = NULL; - } + delete [] m_stringInfo; + m_stringInfo = NULL; - if( m_stringLUT != NULL ) - { - delete [] m_stringLUT; - m_stringLUT = NULL; - } + delete [] m_stringLUT; + m_stringLUT = NULL; m_textCount = 0; @@ -418,17 +412,11 @@ void GameTextManager::deinit( void ) void GameTextManager::reset( void ) { - if( m_mapStringInfo != NULL ) - { - delete [] m_mapStringInfo; - m_mapStringInfo = NULL; - } + delete [] m_mapStringInfo; + m_mapStringInfo = NULL; - if( m_mapStringLUT != NULL ) - { - delete [] m_mapStringLUT; - m_mapStringLUT = NULL; - } + delete [] m_mapStringLUT; + m_mapStringLUT = NULL; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index e2711b6e1d9..8a42ccdc355 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -5759,14 +5759,9 @@ void InGameUI::recreateControlBar( void ) createControlBar(); - if(TheControlBar) - { - delete TheControlBar; - TheControlBar = NEW ControlBar; - TheControlBar->init(); - } - - + delete TheControlBar; + TheControlBar = NEW ControlBar; + TheControlBar->init(); } void InGameUI::refreshCustomUiResources(void) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp index 5f4c3285bcf..611fff670a0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp @@ -275,17 +275,12 @@ static Bool loadMap( AsciiString filename ) static void resetMap( void ) { - if (m_data) - { - delete[] m_data; - m_data = 0; - } + delete[] m_data; + m_data = NULL; + + delete m_waypoints; + m_waypoints = NULL; - if (m_waypoints) - { - delete m_waypoints; - m_waypoints = 0; - } m_techPositions.clear(); m_supplyPositions.clear(); } @@ -954,11 +949,8 @@ typedef MapDisplayToFileNameList::iterator MapDisplayToFileNameListIter; ++curNumPlayersInMap; } - if (battleHonors) - { - delete battleHonors; - battleHonors = NULL; - } + delete battleHonors; + battleHonors = NULL; GadgetListBoxSetSelected(listbox, &selectionIndex, 1); if (selectionIndex >= 0) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp index e1da99a4b09..27812a51503 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp @@ -66,9 +66,7 @@ Anim2DTemplate::Anim2DTemplate( AsciiString name ) Anim2DTemplate::~Anim2DTemplate( void ) { - // delete the images - if( m_images ) - delete [] m_images; + delete [] m_images; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp index f2f096f8414..b49080ed1a8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp @@ -471,11 +471,8 @@ void CampaignManager::xfer( Xfer *xfer ) } else { - if( TheChallengeGameInfo ) - { - delete TheChallengeGameInfo; - TheChallengeGameInfo = NULL; - } + delete TheChallengeGameInfo; + TheChallengeGameInfo = NULL; } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp index 2fc67e38501..54f0f8047e2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp @@ -370,10 +370,9 @@ void AI::update( void ) */ AI::~AI() { - if (m_pathfinder) { - delete m_pathfinder; - } + delete m_pathfinder; m_pathfinder = NULL; + while (m_aiData) { TAiData *cur = m_aiData; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 6f21aa37042..65d8522d512 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -1969,22 +1969,17 @@ ZoneBlock::~ZoneBlock() void ZoneBlock::freeZones(void) { - if (m_groundCliffZones) { - delete [] m_groundCliffZones; - m_groundCliffZones = NULL; - } - if (m_groundWaterZones) { - delete [] m_groundWaterZones; - m_groundWaterZones = NULL; - } - if (m_groundRubbleZones) { - delete [] m_groundRubbleZones; - m_groundRubbleZones = NULL; - } - if (m_crusherZones) { - delete [] m_crusherZones; - m_crusherZones = NULL; - } + delete [] m_groundCliffZones; + m_groundCliffZones = NULL; + + delete [] m_groundWaterZones; + m_groundWaterZones = NULL; + + delete [] m_groundRubbleZones; + m_groundRubbleZones = NULL; + + delete [] m_crusherZones; + m_crusherZones = NULL; } /* Allocate zone equivalency arrays large enough to hold required entries. If the arrays are already @@ -2173,43 +2168,35 @@ PathfindZoneManager::~PathfindZoneManager() void PathfindZoneManager::freeZones() { - if (m_groundCliffZones) { - delete [] m_groundCliffZones; - m_groundCliffZones = NULL; - } - if (m_groundWaterZones) { - delete [] m_groundWaterZones; - m_groundWaterZones = NULL; - } - if (m_groundRubbleZones) { - delete [] m_groundRubbleZones; - m_groundRubbleZones = NULL; - } - if (m_terrainZones) { - delete [] m_terrainZones; - m_terrainZones = NULL; - } - if (m_crusherZones) { - delete [] m_crusherZones; - m_crusherZones = NULL; - } - if (m_hierarchicalZones) { - delete [] m_hierarchicalZones; - m_hierarchicalZones = NULL; - } + delete [] m_groundCliffZones; + m_groundCliffZones = NULL; + + delete [] m_groundWaterZones; + m_groundWaterZones = NULL; + + delete [] m_groundRubbleZones; + m_groundRubbleZones = NULL; + + delete [] m_terrainZones; + m_terrainZones = NULL; + + delete [] m_crusherZones; + m_crusherZones = NULL; + + delete [] m_hierarchicalZones; + m_hierarchicalZones = NULL; + m_zonesAllocated = 0; } void PathfindZoneManager::freeBlocks() { - if (m_blockOfZoneBlocks) { - delete [] m_blockOfZoneBlocks; - m_blockOfZoneBlocks = NULL; - } - if (m_zoneBlocks) { - delete [] m_zoneBlocks; - m_zoneBlocks = NULL; - } + delete [] m_blockOfZoneBlocks; + m_blockOfZoneBlocks = NULL; + + delete [] m_zoneBlocks; + m_zoneBlocks = NULL; + m_zoneBlockExtent.x = 0; m_zoneBlockExtent.y = 0; } @@ -3214,7 +3201,7 @@ PathfindLayer::~PathfindLayer() } /** - * Returns true if the layer is avaialble for use. + * Returns true if the layer is available for use. */ void PathfindLayer::reset(void) { @@ -3230,10 +3217,10 @@ void PathfindLayer::reset(void) delete [] m_layerCells; m_layerCells = NULL; } - if (m_blockOfMapCells) { - delete [] m_blockOfMapCells; - m_blockOfMapCells = NULL; - } + + delete [] m_blockOfMapCells; + m_blockOfMapCells = NULL; + m_width = 0; m_height = 0; m_xOrigin = 0; @@ -3838,14 +3825,11 @@ void Pathfinder::reset( void ) frameToShowObstacles = 0; DEBUG_LOG(("Pathfind cell is %d bytes, PathfindCellInfo is %d bytes", sizeof(PathfindCell), sizeof(PathfindCellInfo))); - if (m_blockOfMapCells) { - delete []m_blockOfMapCells; - m_blockOfMapCells = NULL; - } - if (m_map) { - delete [] m_map; - m_map = NULL; - } + delete [] m_blockOfMapCells; + m_blockOfMapCells = NULL; + + delete [] m_map; + m_map = NULL; Int i; for (i=0; i<=LAYER_LAST; i++) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp index 02c72545945..c90748ba92c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp @@ -71,10 +71,9 @@ m_riverStart(0) */ PolygonTrigger::~PolygonTrigger(void) { - if (m_points) { - delete [] m_points; - m_points = NULL; - } + delete [] m_points; + m_points = NULL; + if (m_nextPolygonTrigger) { PolygonTrigger *cur = m_nextPolygonTrigger; PolygonTrigger *next; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index 09867526097..8a0020cb2b9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -154,7 +154,7 @@ AttackPriorityInfo::AttackPriorityInfo() :m_defaultPriority(ATTACK_PRIORITY_DEFA //------------------------------------------------------------------------------------------------- AttackPriorityInfo::~AttackPriorityInfo() { - if (m_priorityMap) delete m_priorityMap; + delete m_priorityMap; m_priorityMap = NULL; } @@ -219,14 +219,8 @@ void AttackPriorityInfo::reset( void ) // go back to default priority m_defaultPriority = ATTACK_PRIORITY_DEFAULT; - // delete the priority map if present - if( m_priorityMap ) - { - - delete m_priorityMap; - m_priorityMap = NULL; - - } + delete m_priorityMap; + m_priorityMap = NULL; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index d635b27a9dd..c4d6494351c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -488,11 +488,8 @@ void GameLogic::reset( void ) } m_forceGameStartByTimeOut = FALSE; - if(TheStatsCollector) - { - delete TheStatsCollector; - TheStatsCollector = NULL; - } + delete TheStatsCollector; + TheStatsCollector = NULL; // clear any table of contents we have m_objectTOC.clear(); @@ -1116,13 +1113,8 @@ void GameLogic::updateLoadProgress( Int progress ) void GameLogic::deleteLoadScreen( void ) { - if( m_loadScreen ) - { - - delete m_loadScreen; - m_loadScreen = NULL; - - } + delete m_loadScreen; + m_loadScreen = NULL; } @@ -1289,10 +1281,8 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) } } else { if (m_gameMode == GAME_SINGLE_PLAYER) { - if (TheSkirmishGameInfo) { - delete TheSkirmishGameInfo; - TheSkirmishGameInfo = NULL; - } + delete TheSkirmishGameInfo; + TheSkirmishGameInfo = NULL; } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp index 72943db47ff..5c02dd79a08 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp @@ -201,10 +201,9 @@ void ConnectionManager::reset() // m_transport = new Transport; // } // m_transport->reset(); - if (m_transport != NULL) { - delete m_transport; - m_transport = NULL; - } + + delete m_transport; + m_transport = NULL; UnsignedInt i = 0; for (; i < (UnsignedInt)NUM_CONNECTIONS; ++i) { @@ -277,10 +276,7 @@ Bool ConnectionManager::isPlayerConnected( Int playerID ) } void ConnectionManager::attachTransport(Transport *transport) { - if (m_transport != NULL) { - delete m_transport; - m_transport = NULL; - } + delete m_transport; m_transport = transport; } @@ -1409,10 +1405,8 @@ void ConnectionManager::setLocalAddress(UnsignedInt ip, UnsignedInt port) { void ConnectionManager::initTransport() { DEBUG_ASSERTCRASH((m_transport == NULL), ("m_transport already exists when trying to init it.")); DEBUG_LOG(("ConnectionManager::initTransport - Initializing Transport")); - if (m_transport != NULL) { - delete m_transport; - m_transport = NULL; - } + + delete m_transport; m_transport = new Transport; m_transport->reset(); m_transport->init(m_localAddr, m_localPort); @@ -2133,7 +2127,7 @@ void ConnectionManager::sendFile(AsciiString path, UnsignedByte playerMask, Unsi compressedSize = CompressionManager::compressData(CompressionManager::getPreferredCompression(), buf, len, compressedBuf, compressedLen); - if (compressedBuf && !compressedSize) + if (!compressedSize) { delete[] compressedBuf; compressedBuf = NULL; @@ -2163,11 +2157,8 @@ void ConnectionManager::sendFile(AsciiString path, UnsignedByte playerMask, Unsi delete[] buf; buf = NULL; #ifdef COMPRESS_TARGAS - if (compressedBuf) - { - delete[] compressedBuf; - compressedBuf = NULL; - } + delete[] compressedBuf; + compressedBuf = NULL; #endif // COMPRESS_TARGAS DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("Sending file: '%s', len %d, to %X", path.str(), len, playerMask)); diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/FirewallHelper.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/FirewallHelper.cpp index 0d864d57221..25a978e6c45 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/FirewallHelper.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/FirewallHelper.cpp @@ -1556,10 +1556,8 @@ Bool FirewallHelperClass::openSpareSocket(UnsignedShort port) { void FirewallHelperClass::closeSpareSocket(UnsignedShort port) { for (Int i = 0; i < MAX_SPARE_SOCKETS; ++i) { if (m_spareSockets[i].port == port) { - if (m_spareSockets[i].udp != NULL) { - delete m_spareSockets[i].udp; - m_spareSockets[i].udp = NULL; - } + delete m_spareSockets[i].udp; + m_spareSockets[i].udp = NULL; m_spareSockets[i].port = 0; break; } @@ -1571,12 +1569,8 @@ void FirewallHelperClass::closeSpareSocket(UnsignedShort port) { */ void FirewallHelperClass::closeAllSpareSockets() { for (Int i = 0; i < MAX_SPARE_SOCKETS; ++i) { - if (m_spareSockets[i].port != 0) { - m_spareSockets[i].port = 0; - } - if (m_spareSockets[i].udp != NULL) { - delete (m_spareSockets[i].udp); - m_spareSockets[i].udp = NULL; - } + delete (m_spareSockets[i].udp); + m_spareSockets[i].udp = NULL; + m_spareSockets[i].port = 0; } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/FrameDataManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/FrameDataManager.cpp index e37ad0eeef1..9462a8ff840 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/FrameDataManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/FrameDataManager.cpp @@ -47,12 +47,8 @@ FrameDataManager::~FrameDataManager() { for (Int i = 0; i < FRAME_DATA_LENGTH; ++i) { m_frameData[i].reset(); } - - if (m_frameData) - { - delete[] m_frameData; - m_frameData = NULL; - } + delete[] m_frameData; + m_frameData = NULL; } /** diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/FrameMetrics.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/FrameMetrics.cpp index 26f38882507..30ede38c105 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/FrameMetrics.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/FrameMetrics.cpp @@ -50,21 +50,14 @@ FrameMetrics::FrameMetrics() } FrameMetrics::~FrameMetrics() { - if (m_fpsList != NULL) { - delete m_fpsList; - m_fpsList = NULL; - } + delete m_fpsList; + m_fpsList = NULL; - if (m_latencyList != NULL) { - delete m_latencyList; - m_latencyList = NULL; - } + delete m_latencyList; + m_latencyList = NULL; - if (m_pendingLatencies) - { - delete[] m_pendingLatencies; - m_pendingLatencies = NULL; - } + delete[] m_pendingLatencies; + m_pendingLatencies = NULL; } void FrameMetrics::init() { diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/LadderDefs.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/LadderDefs.cpp index 9a178ab3d22..470102c44e5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/LadderDefs.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/LadderDefs.cpp @@ -244,11 +244,7 @@ static LadderInfo *parseLadder(AsciiString raw) } } - if (lad) - { - delete lad; - lad = NULL; - } + delete lad; return NULL; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp index 18bea5bd010..e24a7a5b7fc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp @@ -461,8 +461,7 @@ static void populateBuddyGames(void) static void clearBuddyGames(void) { - if (theBuddyGames) - delete theBuddyGames; + delete theBuddyGames; theBuddyGames = NULL; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/MainMenuUtils.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/MainMenuUtils.cpp index be1ca7e9f63..95799a7534a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/MainMenuUtils.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/MainMenuUtils.cpp @@ -220,16 +220,12 @@ static void startOnline( void ) DEBUG_ASSERTCRASH( !TheGameSpyPeerMessageQueue, ("TheGameSpyPeerMessageQueue exists!") ); DEBUG_ASSERTCRASH( !TheGameSpyInfo, ("TheGameSpyInfo exists!") ); SetUpGameSpy(MOTDBuffer, configBuffer); - if (MOTDBuffer) - { - delete[] MOTDBuffer; - MOTDBuffer = NULL; - } - if (configBuffer) - { - delete[] configBuffer; - configBuffer = NULL; - } + + delete[] MOTDBuffer; + MOTDBuffer = NULL; + + delete[] configBuffer; + configBuffer = NULL; #ifdef ALLOW_NON_PROFILED_LOGIN UserPreferences pref; @@ -320,12 +316,7 @@ static GHTTPBool motdCallback( GHTTPRequest request, GHTTPResult result, return GHTTPTrue; } - if (MOTDBuffer) - { - delete[] MOTDBuffer; - MOTDBuffer = NULL; - } - + delete[] MOTDBuffer; MOTDBuffer = NEW char[bufferLen]; memcpy(MOTDBuffer, buffer, bufferLen); MOTDBuffer[bufferLen-1] = 0; @@ -360,11 +351,8 @@ static GHTTPBool configCallback( GHTTPRequest request, GHTTPResult result, return GHTTPTrue; } - if (configBuffer) - { - delete[] configBuffer; - configBuffer = NULL; - } + delete[] configBuffer; + configBuffer = NULL; if (result != GHTTPSuccess || bufferLen < 100) { @@ -464,11 +452,8 @@ static GHTTPBool configHeadCallback( GHTTPRequest request, GHTTPResult result, onlineCancelWindow = NULL; } - if (configBuffer) - { - delete[] configBuffer; - configBuffer = NULL; - } + delete[] configBuffer; + configBuffer = NULL; AsciiString fname; fname.format("%sGeneralsOnline\\Config.txt", TheGlobalData->getPath_UserData().str()); @@ -579,16 +564,12 @@ void CancelPatchCheckCallback( void ) onlineCancelWindow = NULL; } queuedDownloads.clear(); - if (MOTDBuffer) - { - delete[] MOTDBuffer; - MOTDBuffer = NULL; - } - if (configBuffer) - { - delete[] configBuffer; - configBuffer = NULL; - } + + delete[] MOTDBuffer; + MOTDBuffer = NULL; + + delete[] configBuffer; + configBuffer = NULL; } /////////////////////////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp index f9fa51f5af0..28e33e9a6d4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp @@ -678,28 +678,17 @@ void TearDownGameSpy( void ) if (ThePinger) ThePinger->endThreads(); - if(TheRankPointValues) - { - delete TheRankPointValues; - TheRankPointValues = NULL; - } - if (TheGameSpyPSMessageQueue) - { - delete TheGameSpyPSMessageQueue; - TheGameSpyPSMessageQueue = NULL; - } + delete TheRankPointValues; + TheRankPointValues = NULL; - if (TheGameSpyBuddyMessageQueue) - { - delete TheGameSpyBuddyMessageQueue; - TheGameSpyBuddyMessageQueue = NULL; - } + delete TheGameSpyPSMessageQueue; + TheGameSpyPSMessageQueue = NULL; - if (TheGameSpyPeerMessageQueue) - { - delete TheGameSpyPeerMessageQueue; - TheGameSpyPeerMessageQueue = NULL; - } + delete TheGameSpyBuddyMessageQueue; + TheGameSpyBuddyMessageQueue = NULL; + + delete TheGameSpyPeerMessageQueue; + TheGameSpyPeerMessageQueue = NULL; if (TheGameSpyInfo) { @@ -712,23 +701,14 @@ void TearDownGameSpy( void ) TheGameSpyInfo = NULL; } - if (ThePinger) - { - delete ThePinger; - ThePinger = NULL; - } + delete ThePinger; + ThePinger = NULL; - if (TheLadderList) - { - delete TheLadderList; - TheLadderList = NULL; - } + delete TheLadderList; + TheLadderList = NULL; - if (TheGameSpyConfig) - { - delete TheGameSpyConfig; - TheGameSpyConfig = NULL; - } + delete TheGameSpyConfig; + TheGameSpyConfig = NULL; // make sure the notification box doesn't exist deleteNotificationBox(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp index 6709067c7ef..a97cf333192 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp @@ -535,10 +535,8 @@ void GameSpyStagingRoom::startGame(Int gameID) UnsignedInt localIP = TheGameSpyInfo->getInternalIP(); setLocalIP(localIP); - if (TheNAT != NULL) { - delete TheNAT; - TheNAT = NULL; - } + delete TheNAT; + TheNAT = NULL; // fill in GS-specific info Int numHumans = 0; @@ -801,10 +799,8 @@ void GameSpyStagingRoom::launchGame( void ) AsciiString userList; DEBUG_ASSERTCRASH(TheNetwork == NULL, ("For some reason TheNetwork isn't NULL at the start of this game. Better look into that.")); - if (TheNetwork != NULL) { - delete TheNetwork; - TheNetwork = NULL; - } + delete TheNetwork; + TheNetwork = NULL; // Time to initialize TheNetwork for this game. TheNetwork = NetworkInterface::createNetwork(); @@ -830,10 +826,10 @@ void GameSpyStagingRoom::launchGame( void ) if (!filesOk || TheMapCache->findMap(getMap()) == NULL) { DEBUG_LOG(("After transfer, we didn't really have the map. Bailing...")); - if (TheNetwork != NULL) { - delete TheNetwork; - TheNetwork = NULL; - } + + delete TheNetwork; + TheNetwork = NULL; + GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:CouldNotTransferMap")); void PopBackToLobby( void ); @@ -865,10 +861,8 @@ void GameSpyStagingRoom::launchGame( void ) sprintf(req.arg.status.locationString, "%s", WideCharStringToMultiByte(TheGameSpyGame->getGameName().str()).c_str()); TheGameSpyBuddyMessageQueue->addRequest(req); - if (TheNAT != NULL) { - delete TheNAT; - TheNAT = NULL; - } + delete TheNAT; + TheNAT = NULL; } void GameSpyStagingRoom::reset(void) diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp index 31156acbcff..e192d652091 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp @@ -181,8 +181,7 @@ void GameSpyBuddyMessageQueue::startThread( void ) void GameSpyBuddyMessageQueue::endThread( void ) { - if (m_thread) - delete m_thread; + delete m_thread; m_thread = NULL; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/GameResultsThread.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/GameResultsThread.cpp index a0e846aa101..c54b48a9b47 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/GameResultsThread.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/GameResultsThread.cpp @@ -130,11 +130,8 @@ void GameResultsQueue::endThreads( void ) { for (Int i=0; ifetch("GUI:CouldNotTransferMap"), LANCHAT_SYSTEM); return; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp index 66c45478633..9ebca7c0c62 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp @@ -127,7 +127,6 @@ void LANAPI::handleGameAnnounce( LANMessage *msg, UnsignedInt senderIP ) // remove from list removeGame(game); delete game; - game = NULL; return; } RequestGameJoin(game, m_directConnectRemoteIP); diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NAT.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NAT.cpp index 3e3eed52196..80b932ae315 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NAT.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NAT.cpp @@ -214,10 +214,9 @@ NATStateType NAT::update() { { m_NATState = NATSTATE_DONE; TheEstablishConnectionsMenu->endMenu(); - if (TheFirewallHelper != NULL) { - delete TheFirewallHelper; - TheFirewallHelper = NULL; - } + + delete TheFirewallHelper; + TheFirewallHelper = NULL; } } else if (m_NATState == NATSTATE_DOCONNECTIONPATHS) { if (allConnectionsDoneThisRound() == TRUE) { @@ -241,10 +240,9 @@ NATStateType NAT::update() { /* m_NATState = NATSTATE_DONE; TheEstablishConnectionsMenu->endMenu(); - if (TheFirewallHelper != NULL) { - delete TheFirewallHelper; - TheFirewallHelper = NULL; - } + + delete TheFirewallHelper; + TheFirewallHelper = NULL; */ } else { doThisConnectionRound(); @@ -277,10 +275,8 @@ NATStateType NAT::update() { TheFirewallHelper = NULL; } // we failed to connect, so we don't have to pass on the transport to the network. - if (m_transport != NULL) { - delete m_transport; - m_transport = NULL; - } + delete m_transport; + m_transport = NULL; } } return m_NATState; diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetCommandMsg.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetCommandMsg.cpp index 72f51f4d11d..abb5084c312 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetCommandMsg.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetCommandMsg.cpp @@ -840,10 +840,8 @@ NetWrapperCommandMsg::NetWrapperCommandMsg() : NetCommandMsg() { } NetWrapperCommandMsg::~NetWrapperCommandMsg() { - if (m_data != NULL) { - delete m_data; - m_data = NULL; - } + delete m_data; + m_data = NULL; } UnsignedByte * NetWrapperCommandMsg::getData() { @@ -852,11 +850,7 @@ UnsignedByte * NetWrapperCommandMsg::getData() { void NetWrapperCommandMsg::setData(UnsignedByte *data, UnsignedInt dataLength) { - if (m_data != NULL) { - delete m_data; - m_data = NULL; - } - + delete m_data; m_data = NEW UnsignedByte[dataLength]; // pool[]ify memcpy(m_data, data, dataLength); m_dataLength = dataLength; @@ -917,10 +911,8 @@ NetFileCommandMsg::NetFileCommandMsg() : NetCommandMsg() { } NetFileCommandMsg::~NetFileCommandMsg() { - if (m_data != NULL) { - delete[] m_data; - m_data = NULL; - } + delete[] m_data; + m_data = NULL; } AsciiString NetFileCommandMsg::getRealFilename() diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetCommandWrapperList.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetCommandWrapperList.cpp index 521aa3b7237..c649b684da8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetCommandWrapperList.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetCommandWrapperList.cpp @@ -57,15 +57,11 @@ NetCommandWrapperListNode::NetCommandWrapperListNode(NetWrapperCommandMsg *msg) } NetCommandWrapperListNode::~NetCommandWrapperListNode() { - if (m_chunksPresent != NULL) { - delete[] m_chunksPresent; - m_chunksPresent = NULL; - } + delete[] m_chunksPresent; + m_chunksPresent = NULL; - if (m_data != NULL) { - delete[] m_data; - m_data = NULL; - } + delete[] m_data; + m_data = NULL; } Bool NetCommandWrapperListNode::isComplete() { diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/Transport.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/Transport.cpp index 6163107d414..5e5c6785ee1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/Transport.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/Transport.cpp @@ -104,8 +104,7 @@ Bool Transport::init( UnsignedInt ip, UnsignedShort port ) } // ------- Bind our port -------- - if (m_udpsock) - delete m_udpsock; + delete m_udpsock; m_udpsock = NEW UDP(); if (!m_udpsock) @@ -162,11 +161,8 @@ Bool Transport::init( UnsignedInt ip, UnsignedShort port ) void Transport::reset( void ) { - if (m_udpsock) - { - delete m_udpsock; - m_udpsock = NULL; - } + delete m_udpsock; + m_udpsock = NULL; if (m_winsockInit) { diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp index 93b9f9cf1fb..253f3efc9af 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp @@ -201,46 +201,35 @@ void BaseHeightMapRenderObjClass::drawScorches(void) BaseHeightMapRenderObjClass::~BaseHeightMapRenderObjClass(void) { freeMapResources(); - if (m_treeBuffer) { - delete m_treeBuffer; - m_treeBuffer = NULL; - } - if (m_propBuffer) { - delete m_propBuffer; - m_propBuffer = NULL; - } - if (m_bibBuffer) { - delete m_bibBuffer; - m_bibBuffer = NULL; - } + + delete m_treeBuffer; + m_treeBuffer = NULL; + + delete m_propBuffer; + m_propBuffer = NULL; + + delete m_bibBuffer; + m_bibBuffer = NULL; + #ifdef DO_ROADS - if (m_roadBuffer) { - delete m_roadBuffer; - m_roadBuffer = NULL; - } + delete m_roadBuffer; + m_roadBuffer = NULL; #endif - if (m_bridgeBuffer) { - delete m_bridgeBuffer; - } - if( m_waypointBuffer ) - { - delete m_waypointBuffer; - m_waypointBuffer = NULL; - } - if (m_shroud) { - delete m_shroud; - m_shroud = NULL; - } - if (m_shoreLineTilePositions) { - delete [] m_shoreLineTilePositions; - m_shoreLineTilePositions = NULL; - } - if (m_shoreLineSortInfos) - { - delete [] m_shoreLineSortInfos; - m_shoreLineSortInfos = NULL; - } + delete m_bridgeBuffer; + m_bridgeBuffer = NULL; + + delete m_waypointBuffer; + m_waypointBuffer = NULL; + + delete m_shroud; + m_shroud = NULL; + + delete [] m_shoreLineTilePositions; + m_shoreLineTilePositions = NULL; + + delete [] m_shoreLineSortInfos; + m_shoreLineSortInfos = NULL; } //============================================================================= @@ -1514,8 +1503,7 @@ void BaseHeightMapRenderObjClass::recordShoreLineSortInfos(void) //Check if we need to allocate memory if (!m_shoreLineSortInfos || shoreLineSortInfosSize > m_shoreLineSortInfosSize) { - if (m_shoreLineSortInfos) - delete [] m_shoreLineSortInfos; //old buffer was too small. + delete [] m_shoreLineSortInfos; //old buffer was too small. //Find the major map axis (having the most tiles). m_shoreLineSortInfosSize = shoreLineSortInfosSize; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/FlatHeightMap.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/FlatHeightMap.cpp index a500eecf318..07a36aad45e 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/FlatHeightMap.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/FlatHeightMap.cpp @@ -275,10 +275,9 @@ void FlatHeightMapRenderObjClass::doPartialUpdate(const IRegion2D &partialRange, //============================================================================= void FlatHeightMapRenderObjClass::releaseTiles(void) { - if (m_tiles) { - delete [] m_tiles; - m_tiles = NULL; - } + delete [] m_tiles; + m_tiles = NULL; + m_tilesWidth = 0; m_tilesHeight = 0; m_numTiles = 0; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp index 027b2683231..7891e46bdc8 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp @@ -1074,10 +1074,9 @@ Int HeightMapRenderObjClass::updateBlock(Int x0, Int y0, Int x1, Int y1, WorldH HeightMapRenderObjClass::~HeightMapRenderObjClass(void) { freeMapResources(); - if (m_extraBlendTilePositions) { - delete [] m_extraBlendTilePositions; - m_extraBlendTilePositions = NULL; - } + + delete [] m_extraBlendTilePositions; + m_extraBlendTilePositions = NULL; } //============================================================================= diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp index 1087aef6b74..d6eaa6030fe 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp @@ -155,14 +155,13 @@ struct Geometry return TRUE; } void Release(void) - { if (m_verts) - { delete [] m_verts; - m_verts=NULL; - } - if (m_indices) - { delete [] m_indices; - m_indices=NULL; - } + { + delete [] m_verts; + m_verts=NULL; + + delete [] m_indices; + m_indices=NULL; + m_numActivePolygon=m_numPolygon=0; m_numActiveVertex=m_numVertex=0; } @@ -868,11 +867,9 @@ W3DShadowGeometryMesh::~W3DShadowGeometryMesh( void ) { // remove our neighbor list information allocated deleteNeighbors(); - if (m_parentVerts) { - delete [] m_parentVerts; - } - if (m_polygonNormals) - delete [] m_polygonNormals; + + delete [] m_parentVerts; + delete [] m_polygonNormals; } @@ -1122,14 +1119,9 @@ void W3DShadowGeometryMesh::deleteNeighbors( void ) { // delete list - if( m_polyNeighbors ) - { - - delete [] m_polyNeighbors; - m_polyNeighbors = NULL; - m_numPolyNeighbors = 0; - - } + delete [] m_polyNeighbors; + m_polyNeighbors = NULL; + m_numPolyNeighbors = 0; // sanity error checking assert( m_numPolyNeighbors == 0 ); @@ -1700,8 +1692,8 @@ W3DVolumetricShadow::~W3DVolumetricShadow( void ) // free any shadow volume data for( i = 0; i < MAX_SHADOW_LIGHTS; i++ ) { for (j = 0; j < MAX_SHADOW_CASTER_MESHES; j++) - { if( m_shadowVolume[ i ][j] ) - delete m_shadowVolume[ i ][j]; + { + delete m_shadowVolume[i][j]; if( m_shadowVolumeVB[i][j]) TheW3DBufferManager->releaseSlot(m_shadowVolumeVB[i][j]); if( m_shadowVolumeIB[i][j]) @@ -3320,8 +3312,7 @@ Bool W3DVolumetricShadow::allocateSilhouette(Int meshIndex, Int numVertices ) void W3DVolumetricShadow::deleteSilhouette( Int meshIndex ) { - if( m_silhouetteIndex[meshIndex]) - delete [] m_silhouetteIndex[meshIndex]; + delete [] m_silhouetteIndex[meshIndex]; m_silhouetteIndex[meshIndex] = NULL; m_numSilhouetteIndices[meshIndex] = 0; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp index 951aa66dbb9..27cdd3c0ea5 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp @@ -99,7 +99,7 @@ Int W3DDebugIcons::m_numDebugIcons = 0; W3DDebugIcons::~W3DDebugIcons(void) { REF_PTR_RELEASE(m_vertexMaterialClass); - if (m_debugIcons) delete m_debugIcons; + delete m_debugIcons; m_debugIcons = NULL; m_numDebugIcons = 0; } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp index 80b8b6e5438..f67d2b95d9e 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp @@ -242,14 +242,11 @@ m_bounds(Vector3(0.0f, 0.0f, 0.0f), 1.0f) RoadSegment::~RoadSegment(void) { m_numVertex = 0; - if (m_vb) { - delete[] m_vb; - } - m_vb= NULL; + delete[] m_vb; + m_vb = NULL; + m_numIndex = 0; - if (m_ib) { - delete[] m_ib; - } + delete[] m_ib; m_ib = NULL; } @@ -262,15 +259,18 @@ RoadSegment::~RoadSegment(void) //============================================================================= void RoadSegment::SetVertexBuffer(VertexFormatXYZDUV1 *vb, Int numVertex) { - if (m_vb) { - delete[] m_vb; - m_vb = NULL; - m_numVertex = 0; - } + delete[] m_vb; + m_vb = NULL; + m_numVertex = 0; + Vector3 verts[MAX_SEG_VERTEX]; - if (numVertex<1 || numVertex > MAX_SEG_VERTEX) return; + if (numVertex<1 || numVertex > MAX_SEG_VERTEX) + return; + m_vb = NEW VertexFormatXYZDUV1[numVertex]; // pool[]ify - if (!m_vb) return; + if (!m_vb) + return; + m_numVertex = numVertex; memcpy(m_vb, vb, numVertex*sizeof(VertexFormatXYZDUV1)); Int i; @@ -290,14 +290,17 @@ void RoadSegment::SetVertexBuffer(VertexFormatXYZDUV1 *vb, Int numVertex) //============================================================================= void RoadSegment::SetIndexBuffer(UnsignedShort *ib, Int numIndex) { - if (m_ib) { - delete[] m_ib; - m_ib = NULL; - m_numIndex = 0; - } - if (numIndex < 1 || numIndex > MAX_SEG_INDEX) return; + delete[] m_ib; + m_ib = NULL; + m_numIndex = 0; + + if (numIndex < 1 || numIndex > MAX_SEG_INDEX) + return; + m_ib = NEW UnsignedShort[numIndex]; - if (!m_ib) return; + if (!m_ib) + return; + m_numIndex = numIndex; memcpy(m_ib, ib, numIndex*sizeof(UnsignedShort)); } @@ -3090,14 +3093,11 @@ W3DRoadBuffer::W3DRoadBuffer(void) : //============================================================================= void W3DRoadBuffer::freeRoadBuffers(void) { - if (m_roads) { - delete[] m_roads; - m_roads = NULL; - } - if (m_roadTypes) { - delete[] m_roadTypes; - m_roadTypes = NULL; - } + delete[] m_roads; + m_roads = NULL; + + delete[] m_roadTypes; + m_roadTypes = NULL; } //============================================================================= diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp index 6b13b179819..7c815982fe4 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp @@ -219,17 +219,10 @@ RTS3DScene::~RTS3DScene() REF_PTR_RELEASE(m_heatVisionOnlyPass); - if (m_translucentObjectsBuffer) - delete [] m_translucentObjectsBuffer; - - if (m_nonOccludersOrOccludees) - delete [] m_nonOccludersOrOccludees; - - if (m_potentialOccludees) - delete [] m_potentialOccludees; - - if (m_potentialOccluders) - delete [] m_potentialOccluders; + delete [] m_translucentObjectsBuffer; + delete [] m_nonOccludersOrOccludees; + delete [] m_potentialOccludees; + delete [] m_potentialOccluders; for (i=0; iRelease(); - m_pSrcTexture=NULL; - if (m_finalFogData) - delete [] m_finalFogData; - if (m_currentFogData) - delete [] m_currentFogData; + + delete [] m_finalFogData; + delete [] m_currentFogData; + m_drawFogOfWar=FALSE; } @@ -204,14 +204,17 @@ void W3DShroud::reset() { //Free old shroud data since it may no longer fit new map. if (m_pSrcTexture) + { m_pSrcTexture->Release(); - m_pSrcTexture=NULL; - if (m_finalFogData) - delete [] m_finalFogData; + m_pSrcTexture=NULL; + } + + delete [] m_finalFogData; m_finalFogData=NULL; - if (m_currentFogData) - delete [] m_currentFogData; + + delete [] m_currentFogData; m_currentFogData=NULL; + m_clearDstTexture = TRUE; //always refill the destination texture after a reset } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp index 2814b9397ce..a61b1d3fe62 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp @@ -191,23 +191,14 @@ W3DTerrainVisual::~W3DTerrainVisual() TheTerrainRenderObject = NULL; } - if (TheTerrainTracksRenderObjClassSystem) - { - delete TheTerrainTracksRenderObjClassSystem; - TheTerrainTracksRenderObjClassSystem=NULL; - } + delete TheTerrainTracksRenderObjClassSystem; + TheTerrainTracksRenderObjClassSystem=NULL; - if (TheW3DShadowManager) - { - delete TheW3DShadowManager; - TheW3DShadowManager=NULL; - } + delete TheW3DShadowManager; + TheW3DShadowManager=NULL; - if (TheSmudgeManager) - { - delete TheSmudgeManager; - TheSmudgeManager=NULL; - } + delete TheSmudgeManager; + TheSmudgeManager=NULL; REF_PTR_RELEASE( m_waterRenderObject ); TheWaterRenderObj=NULL; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp index 1404824d72e..48d2470b696 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp @@ -1081,10 +1081,9 @@ W3DTreeBuffer::~W3DTreeBuffer(void) for (i=0; iNum_Pivots() == HTree->Num_Pivots()); // just assign it... - if (HTree != NULL) { - delete HTree; - } + delete HTree; HTree = W3DNEW HTreeClass(*new_htree); } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp index a9223d78d8e..a0cbd3dba88 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp @@ -257,15 +257,13 @@ WW3DAssetManager::WW3DAssetManager(void) : *=============================================================================================*/ WW3DAssetManager::~WW3DAssetManager(void) { - if (MetalManager) delete MetalManager; + delete MetalManager; + Free(); TheInstance = NULL; - // If we need to, free the hash table - if (PrototypeHashTable != NULL) { - delete [] PrototypeHashTable; - PrototypeHashTable = NULL; - } + delete [] PrototypeHashTable; + PrototypeHashTable = NULL; } static void Create_Number_String(StringClass& number, unsigned value) diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h index 39df6042673..506287854d8 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h @@ -203,7 +203,7 @@ class WW3DAssetManager ** WW3DAssetManager::Get_Instance(); */ static WW3DAssetManager * Get_Instance(void) { return TheInstance; } - static void Delete_This(void) { if (TheInstance) delete TheInstance; TheInstance=NULL; } + static void Delete_This(void) { delete TheInstance; TheInstance=NULL; } /* ** Load data from any type of w3d file diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8texman.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8texman.cpp index 92c6a635c6e..d92e5b9f71f 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8texman.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8texman.cpp @@ -77,7 +77,6 @@ void DX8TextureManagerClass::Shutdown() { TextureTrackerClass *track=Managed_Textures.Remove_Head(); delete track; - track=NULL; } } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp index f1c0704ce41..6aa7ec4ab3e 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp @@ -516,10 +516,8 @@ void DX8Wrapper::Do_Onetime_Device_Dependent_Shutdowns(void) TheDX8MeshRenderer.Shutdown(); MissingTexture::_Deinit(); - if (CurrentCaps) { - delete CurrentCaps; - CurrentCaps=NULL; - } + delete CurrentCaps; + CurrentCaps=NULL; } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp index caf2151cdfd..261d70a2ff7 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp @@ -343,10 +343,8 @@ void HLodDefClass::Free(void) ::free(HierarchyTreeName); HierarchyTreeName = NULL; - if (Lod) { - delete[] Lod; - Lod = NULL; - } + delete[] Lod; + Lod = NULL; LodCount = 0; REF_PTR_RELEASE(ProxyArray); @@ -773,10 +771,9 @@ void HLodDefClass::SubObjectArrayClass::Reset(void) delete[] ModelName; ModelName = NULL; } - if (BoneIndex != NULL) { - delete[] BoneIndex; - BoneIndex = NULL; - } + + delete[] BoneIndex; + BoneIndex = NULL; ModelCount = 0; } @@ -1363,20 +1360,16 @@ void HLodClass::Free(void) Lod[lod].Delete_All(); } - if (Lod != NULL) { - delete[] Lod; - Lod = NULL; - } + + delete[] Lod; + Lod = NULL; LodCount = 0; - if (Cost != NULL) { - delete[] Cost; - Cost = NULL; - } - if (Value != NULL) { - delete[] Value; - Value = NULL; - } + delete[] Cost; + Cost = NULL; + + delete[] Value; + Value = NULL; for (model = 0; model < AdditionalModels.Count(); model++) { RenderObjClass * robj = AdditionalModels[model].Model; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp index d03744c24e1..b8ed2bfc322 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp @@ -219,15 +219,11 @@ void HMorphAnimClass::Free(void) PoseData = NULL; } - if (MorphKeyData != NULL) { - delete[] MorphKeyData; - MorphKeyData = NULL; - } + delete[] MorphKeyData; + MorphKeyData = NULL; - if (PivotChannel != NULL) { - delete[] PivotChannel; - PivotChannel = NULL; - } + delete[] PivotChannel; + PivotChannel = NULL; } @@ -431,10 +427,8 @@ bool HMorphAnimClass::Import(const char *hierarchy_name, TextFileClass &text_des // // Cleanup // - if (channel_list != NULL) { - delete [] channel_list; - channel_list = NULL; - } + delete [] channel_list; + channel_list = NULL; } // @@ -447,10 +441,8 @@ bool HMorphAnimClass::Import(const char *hierarchy_name, TextFileClass &text_des // // Cleanup // - if (column_list != NULL) { - delete [] column_list; - column_list = NULL; - } + delete [] column_list; + column_list = NULL; } return retval; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp index b349bc5817a..1f61bb410c2 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp @@ -94,30 +94,14 @@ NodeMotionStruct::NodeMotionStruct() : *=============================================================================================*/ NodeMotionStruct::~NodeMotionStruct() { - if (X != NULL) { - delete X; - } - if (Y != NULL) { - delete Y; - } - if (Z != NULL) { - delete Z; - } - if (XR != NULL) { - delete XR; - } - if (YR != NULL) { - delete YR; - } - if (ZR != NULL) { - delete ZR; - } - if (Q != NULL) { - delete Q; - } - if (Vis != NULL) { - delete Vis; - } + delete X; + delete Y; + delete Z; + delete XR; + delete YR; + delete ZR; + delete Q; + delete Vis; } @@ -176,10 +160,8 @@ HRawAnimClass::~HRawAnimClass(void) *=============================================================================================*/ void HRawAnimClass::Free(void) { - if (NodeMotion != NULL) { - delete[] NodeMotion; - NodeMotion = NULL; - } + delete[] NodeMotion; + NodeMotion = NULL; } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp index 9021514b2d6..925c0cee78b 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp @@ -124,10 +124,8 @@ void HTreeManagerClass::Free_All_Trees(void) TreeHash.Remove_All(); for (int treeidx=0; treeidx < MAX_TREES; treeidx++) { - if (TreePtr[treeidx] != NULL) { - delete TreePtr[treeidx]; - TreePtr[treeidx] = NULL; - } + delete TreePtr[treeidx]; + TreePtr[treeidx] = NULL; } NumTrees = 0; } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp index 5e2e230e3d8..9f5b985fc9c 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp @@ -605,15 +605,11 @@ MeshBuilderClass::~MeshBuilderClass(void) *=============================================================================================*/ void MeshBuilderClass::Free(void) { - if (Faces != NULL) { - delete[] Faces; - Faces = NULL; - } + delete[] Faces; + Faces = NULL; - if (Verts != NULL) { - delete Verts; - Verts = NULL; - } + delete Verts; + Verts = NULL; FaceCount = 0; VertCount = 0; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp index 76898d8707b..b83cbd89c12 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp @@ -110,13 +110,9 @@ MeshModelClass::~MeshModelClass(void) Reset(0,0,0); REF_PTR_RELEASE(MatInfo); - if (DefMatDesc != NULL) { - delete DefMatDesc; - } - if (AlternateMatDesc != NULL) { - delete AlternateMatDesc; - } - return ; + delete DefMatDesc; + delete AlternateMatDesc; + } MeshModelClass & MeshModelClass::operator = (const MeshModelClass & that) @@ -131,10 +127,8 @@ MeshModelClass & MeshModelClass::operator = (const MeshModelClass & that) *DefMatDesc = *(that.DefMatDesc); CurMatDesc = DefMatDesc; - if (AlternateMatDesc != NULL) { - delete AlternateMatDesc; - AlternateMatDesc = NULL; - } + delete AlternateMatDesc; + AlternateMatDesc = NULL; if (that.AlternateMatDesc != NULL) { AlternateMatDesc = W3DNEW MeshMatDescClass(*(that.AlternateMatDesc)); @@ -142,12 +136,12 @@ MeshModelClass & MeshModelClass::operator = (const MeshModelClass & that) clone_materials(that); - if (GapFiller) { - // DMS - using approriate deallocation method - delete GapFiller; - GapFiller=NULL; - } - if (that.GapFiller) GapFiller=W3DNEW GapFillerClass(*that.GapFiller); + // DMS - using approriate deallocation method + delete GapFiller; + GapFiller=NULL; + + if (that.GapFiller) + GapFiller=W3DNEW GapFillerClass(*that.GapFiller); } return * this; } @@ -167,10 +161,10 @@ void MeshModelClass::Reset(int polycount,int vertcount,int passcount) MatInfo->Reset(); DefMatDesc->Reset(polycount,vertcount,passcount); - if (AlternateMatDesc != NULL) { - delete AlternateMatDesc; - AlternateMatDesc = NULL; - } + + delete AlternateMatDesc; + AlternateMatDesc = NULL; + CurMatDesc = DefMatDesc; return ; @@ -184,7 +178,7 @@ void MeshModelClass::Register_For_Rendering() if (WW3D::Get_NPatches_Gap_Filling_Mode()!=WW3D::NPATCHES_GAP_FILLING_DISABLED) { Init_For_NPatch_Rendering(); } - else if (GapFiller) { + else { delete GapFiller; GapFiller=NULL; } @@ -193,7 +187,7 @@ void MeshModelClass::Register_For_Rendering() if (WW3D::Get_NPatches_Gap_Filling_Mode()==WW3D::NPATCHES_GAP_FILLING_FORCE) { Init_For_NPatch_Rendering(); } - else if (GapFiller) { + else { delete GapFiller; GapFiller=NULL; } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp index 3bb6e698606..c1447792e83 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp @@ -1966,10 +1966,9 @@ MeshLoadContextClass::~MeshLoadContextClass(void) { int i; - if (TexCoords != NULL) { - delete TexCoords; - TexCoords = NULL; - } + delete TexCoords; + TexCoords = NULL; + for (i=0; iRelease_Ref(); } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp index f45c6c4b167..9ecc96ee1d0 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp @@ -135,14 +135,11 @@ MotionChannelClass::~MotionChannelClass(void) *=============================================================================================*/ void MotionChannelClass::Free(void) { - if (CompressedData) { - delete[] CompressedData; - CompressedData=NULL; - } - if (Data) { - delete[] Data; - Data = NULL; - } + delete[] CompressedData; + CompressedData=NULL; + + delete[] Data; + Data = NULL; } @@ -251,10 +248,8 @@ BitChannelClass::~BitChannelClass(void) *=============================================================================================*/ void BitChannelClass::Free(void) { - if (Bits != NULL) { - delete[] Bits; - Bits = NULL; - } + delete[] Bits; + Bits = NULL; } @@ -364,10 +359,8 @@ TimeCodedMotionChannelClass::~TimeCodedMotionChannelClass(void) *=============================================================================================*/ void TimeCodedMotionChannelClass::Free(void) { - if (Data) { - delete[] Data; - Data = NULL; - } + delete[] Data; + Data = NULL; } @@ -732,10 +725,8 @@ TimeCodedBitChannelClass::~TimeCodedBitChannelClass(void) *=============================================================================================*/ void TimeCodedBitChannelClass::Free(void) { - if (Bits != NULL) { - delete[] Bits; - Bits = NULL; - } + delete[] Bits; + Bits = NULL; } @@ -912,16 +903,11 @@ AdaptiveDeltaMotionChannelClass::~AdaptiveDeltaMotionChannelClass(void) *=============================================================================================*/ void AdaptiveDeltaMotionChannelClass::Free(void) { - if (Data) { - delete[] Data; - Data = NULL; - } - - if (CacheData) { - delete CacheData; - CacheData = NULL; - } + delete[] Data; + Data = NULL; + delete CacheData; + CacheData = NULL; } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp index 487ef337304..6f8e52b0d59 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp @@ -728,37 +728,37 @@ ParticleBufferClass & ParticleBufferClass::operator = (const ParticleBufferClass ParticleBufferClass::~ParticleBufferClass(void) { - if (NewParticleQueue) delete [] NewParticleQueue; - if (ColorKeyFrameTimes) delete [] ColorKeyFrameTimes; - if (ColorKeyFrameValues) delete [] ColorKeyFrameValues; - if (ColorKeyFrameDeltas) delete [] ColorKeyFrameDeltas; - if (AlphaKeyFrameTimes) delete [] AlphaKeyFrameTimes; - if (AlphaKeyFrameValues) delete [] AlphaKeyFrameValues; - if (AlphaKeyFrameDeltas) delete [] AlphaKeyFrameDeltas; - if (SizeKeyFrameTimes) delete [] SizeKeyFrameTimes; - if (SizeKeyFrameValues) delete [] SizeKeyFrameValues; - if (SizeKeyFrameDeltas) delete [] SizeKeyFrameDeltas; - if (RotationKeyFrameTimes) delete [] RotationKeyFrameTimes; - if (RotationKeyFrameValues) delete [] RotationKeyFrameValues; - if (HalfRotationKeyFrameDeltas) delete [] HalfRotationKeyFrameDeltas; - if (OrientationKeyFrameValues) delete [] OrientationKeyFrameValues; - if (FrameKeyFrameTimes) delete [] FrameKeyFrameTimes; - if (FrameKeyFrameValues) delete [] FrameKeyFrameValues; - if (FrameKeyFrameDeltas) delete [] FrameKeyFrameDeltas; - if (BlurTimeKeyFrameTimes) delete [] BlurTimeKeyFrameTimes; - if (BlurTimeKeyFrameValues) delete [] BlurTimeKeyFrameValues; - if (BlurTimeKeyFrameDeltas) delete [] BlurTimeKeyFrameDeltas; - if (RandomColorEntries) delete [] RandomColorEntries; - if (RandomAlphaEntries) delete [] RandomAlphaEntries; - if (RandomSizeEntries) delete [] RandomSizeEntries; - if (RandomRotationEntries) delete [] RandomRotationEntries; - if (RandomOrientationEntries) delete [] RandomOrientationEntries; - if (RandomFrameEntries) delete [] RandomFrameEntries; - if (RandomBlurTimeEntries) delete [] RandomBlurTimeEntries; - - if (PointGroup) delete PointGroup; - if (LineRenderer) delete LineRenderer; - if (LineGroup) delete LineGroup; + delete [] NewParticleQueue; + delete [] ColorKeyFrameTimes; + delete [] ColorKeyFrameValues; + delete [] ColorKeyFrameDeltas; + delete [] AlphaKeyFrameTimes; + delete [] AlphaKeyFrameValues; + delete [] AlphaKeyFrameDeltas; + delete [] SizeKeyFrameTimes; + delete [] SizeKeyFrameValues; + delete [] SizeKeyFrameDeltas; + delete [] RotationKeyFrameTimes; + delete [] RotationKeyFrameValues; + delete [] HalfRotationKeyFrameDeltas; + delete [] OrientationKeyFrameValues; + delete [] FrameKeyFrameTimes; + delete [] FrameKeyFrameValues; + delete [] FrameKeyFrameDeltas; + delete [] BlurTimeKeyFrameTimes; + delete [] BlurTimeKeyFrameValues; + delete [] BlurTimeKeyFrameDeltas; + delete [] RandomColorEntries; + delete [] RandomAlphaEntries; + delete [] RandomSizeEntries; + delete [] RandomRotationEntries; + delete [] RandomOrientationEntries; + delete [] RandomFrameEntries; + delete [] RandomBlurTimeEntries; + + delete PointGroup; + delete LineRenderer; + delete LineGroup; REF_PTR_RELEASE(Position[0]); REF_PTR_RELEASE(Position[1]); @@ -774,8 +774,9 @@ ParticleBufferClass::~ParticleBufferClass(void) REF_PTR_RELEASE(APT); REF_PTR_RELEASE(GroupID); - if (Velocity) delete [] Velocity; - if (TimeStamp) delete [] TimeStamp; + delete [] Velocity; + delete [] TimeStamp; + if (Emitter) { // We should not have an emitter at this point, since the emitter // should still have a live ref to us if it still exists which would @@ -1443,14 +1444,13 @@ void ParticleBufferClass::Reset_Colors(ParticlePropertyStruct &new_prop Color->Release_Ref(); Color = NULL; } - if (ColorKeyFrameTimes) { - delete [] ColorKeyFrameTimes; - ColorKeyFrameTimes = NULL; - } - if (ColorKeyFrameDeltas) { - delete [] ColorKeyFrameDeltas; - ColorKeyFrameDeltas = NULL; - } + + delete [] ColorKeyFrameTimes; + ColorKeyFrameTimes = NULL; + + delete [] ColorKeyFrameDeltas; + ColorKeyFrameDeltas = NULL; + if (ColorKeyFrameValues) { if (NumColorKeyFrames > 1) { delete [] ColorKeyFrameValues; @@ -1489,21 +1489,10 @@ void ParticleBufferClass::Reset_Colors(ParticlePropertyStruct &new_prop // otherwise release and reallocate. unsigned int new_num_color_key_frames = ckey + 1;// Includes start keyframe (keytime == 0). if (new_num_color_key_frames != NumColorKeyFrames) { - - if (ColorKeyFrameTimes) { - delete [] ColorKeyFrameTimes; - ColorKeyFrameTimes = NULL; - } - if (ColorKeyFrameValues) { - delete [] ColorKeyFrameValues; - ColorKeyFrameValues = NULL; - } - if (ColorKeyFrameDeltas) { - delete [] ColorKeyFrameDeltas; - ColorKeyFrameDeltas = NULL; - } - NumColorKeyFrames = new_num_color_key_frames; + delete [] ColorKeyFrameTimes; + delete [] ColorKeyFrameValues; + delete [] ColorKeyFrameDeltas; ColorKeyFrameTimes = W3DNEWARRAY unsigned int [NumColorKeyFrames]; ColorKeyFrameValues = W3DNEWARRAY Vector3 [NumColorKeyFrames]; ColorKeyFrameDeltas = W3DNEWARRAY Vector3 [NumColorKeyFrames]; @@ -1603,14 +1592,13 @@ void ParticleBufferClass::Reset_Opacity(ParticlePropertyStruct &new_props Alpha->Release_Ref(); Alpha = NULL; } - if (AlphaKeyFrameTimes) { - delete [] AlphaKeyFrameTimes; - AlphaKeyFrameTimes = NULL; - } - if (AlphaKeyFrameDeltas) { - delete [] AlphaKeyFrameDeltas; - AlphaKeyFrameDeltas = NULL; - } + + delete [] AlphaKeyFrameTimes; + AlphaKeyFrameTimes = NULL; + + delete [] AlphaKeyFrameDeltas; + AlphaKeyFrameDeltas = NULL; + if (AlphaKeyFrameValues) { if (NumAlphaKeyFrames > 1) { delete [] AlphaKeyFrameValues; @@ -1649,21 +1637,10 @@ void ParticleBufferClass::Reset_Opacity(ParticlePropertyStruct &new_props // otherwise release and reallocate. unsigned int new_num_alpha_key_frames = akey + 1;// Includes start keyframe (keytime == 0). if (new_num_alpha_key_frames != NumAlphaKeyFrames) { - - if (AlphaKeyFrameTimes) { - delete [] AlphaKeyFrameTimes; - AlphaKeyFrameTimes = NULL; - } - if (AlphaKeyFrameValues) { - delete [] AlphaKeyFrameValues; - AlphaKeyFrameValues = NULL; - } - if (AlphaKeyFrameDeltas) { - delete [] AlphaKeyFrameDeltas; - AlphaKeyFrameDeltas = NULL; - } - NumAlphaKeyFrames = new_num_alpha_key_frames; + delete [] AlphaKeyFrameValues; + delete [] AlphaKeyFrameTimes; + delete [] AlphaKeyFrameDeltas; AlphaKeyFrameTimes = W3DNEWARRAY unsigned int [NumAlphaKeyFrames]; AlphaKeyFrameValues = W3DNEWARRAY float [NumAlphaKeyFrames]; AlphaKeyFrameDeltas = W3DNEWARRAY float [NumAlphaKeyFrames]; @@ -1760,14 +1737,13 @@ void ParticleBufferClass::Reset_Size(ParticlePropertyStruct &new_props) Size->Release_Ref(); Size = NULL; } - if (SizeKeyFrameTimes) { - delete [] SizeKeyFrameTimes; - SizeKeyFrameTimes = NULL; - } - if (SizeKeyFrameDeltas) { - delete [] SizeKeyFrameDeltas; - SizeKeyFrameDeltas = NULL; - } + + delete [] SizeKeyFrameTimes; + SizeKeyFrameTimes = NULL; + + delete [] SizeKeyFrameDeltas; + SizeKeyFrameDeltas = NULL; + if (SizeKeyFrameValues) { if (NumSizeKeyFrames > 1) { delete [] SizeKeyFrameValues; @@ -1806,21 +1782,10 @@ void ParticleBufferClass::Reset_Size(ParticlePropertyStruct &new_props) // otherwise release and reallocate. unsigned int new_num_size_key_frames = skey + 1;// Includes start keyframe (keytime == 0). if (new_num_size_key_frames != NumSizeKeyFrames) { - - if (SizeKeyFrameTimes) { - delete [] SizeKeyFrameTimes; - SizeKeyFrameTimes = NULL; - } - if (SizeKeyFrameValues) { - delete [] SizeKeyFrameValues; - SizeKeyFrameValues = NULL; - } - if (SizeKeyFrameDeltas) { - delete [] SizeKeyFrameDeltas; - SizeKeyFrameDeltas = NULL; - } - NumSizeKeyFrames = new_num_size_key_frames; + delete [] SizeKeyFrameTimes; + delete [] SizeKeyFrameValues; + delete [] SizeKeyFrameDeltas; SizeKeyFrameTimes = W3DNEWARRAY unsigned int [NumSizeKeyFrames]; SizeKeyFrameValues = W3DNEWARRAY float [NumSizeKeyFrames]; SizeKeyFrameDeltas = W3DNEWARRAY float [NumSizeKeyFrames]; @@ -1930,22 +1895,18 @@ void ParticleBufferClass::Reset_Rotations(ParticlePropertyStruct &new_pro // Release Arrays, REF_PTR_RELEASE(Orientation); - if (RotationKeyFrameTimes) { - delete [] RotationKeyFrameTimes; - RotationKeyFrameTimes = NULL; - } - if (HalfRotationKeyFrameDeltas) { - delete [] HalfRotationKeyFrameDeltas; - HalfRotationKeyFrameDeltas = NULL; - } - if (RotationKeyFrameValues) { - delete [] RotationKeyFrameValues; - RotationKeyFrameValues = NULL; - } - if (OrientationKeyFrameValues) { - delete [] OrientationKeyFrameValues; - OrientationKeyFrameValues = NULL; - } + + delete [] RotationKeyFrameTimes; + RotationKeyFrameTimes = NULL; + + delete [] HalfRotationKeyFrameDeltas; + HalfRotationKeyFrameDeltas = NULL; + + delete [] RotationKeyFrameValues; + RotationKeyFrameValues = NULL; + + delete [] OrientationKeyFrameValues; + OrientationKeyFrameValues = NULL; NumRotationKeyFrames = 0; NumRandomRotationEntriesMinus1 = 0; @@ -1976,25 +1937,11 @@ void ParticleBufferClass::Reset_Rotations(ParticlePropertyStruct &new_pro // OrientationKeyFrameValues if the right size, otherwise release and reallocate. unsigned int new_num_key_frames = key + 1;// Includes start keyframe (keytime == 0). if (new_num_key_frames != NumRotationKeyFrames) { - - if (RotationKeyFrameTimes) { - delete [] RotationKeyFrameTimes; - RotationKeyFrameTimes = NULL; - } - if (RotationKeyFrameValues) { - delete [] RotationKeyFrameValues; - RotationKeyFrameValues = NULL; - } - if (HalfRotationKeyFrameDeltas) { - delete [] HalfRotationKeyFrameDeltas; - HalfRotationKeyFrameDeltas = NULL; - } - if (OrientationKeyFrameValues) { - delete [] OrientationKeyFrameValues; - OrientationKeyFrameValues = NULL; - } - NumRotationKeyFrames = new_num_key_frames; + delete [] RotationKeyFrameTimes; + delete [] RotationKeyFrameValues; + delete [] HalfRotationKeyFrameDeltas; + delete [] OrientationKeyFrameValues; RotationKeyFrameTimes = W3DNEWARRAY unsigned int [NumRotationKeyFrames]; RotationKeyFrameValues = W3DNEWARRAY float [NumRotationKeyFrames]; HalfRotationKeyFrameDeltas = W3DNEWARRAY float [NumRotationKeyFrames]; @@ -2138,14 +2085,13 @@ void ParticleBufferClass::Reset_Frames(ParticlePropertyStruct &new_props) // otherwise release and reallocate. REF_PTR_RELEASE(Frame); REF_PTR_RELEASE(UCoord); - if (FrameKeyFrameTimes) { - delete [] FrameKeyFrameTimes; - FrameKeyFrameTimes = NULL; - } - if (FrameKeyFrameDeltas) { - delete [] FrameKeyFrameDeltas; - FrameKeyFrameDeltas = NULL; - } + + delete [] FrameKeyFrameTimes; + FrameKeyFrameTimes = NULL; + + delete [] FrameKeyFrameDeltas; + FrameKeyFrameDeltas = NULL; + if (FrameKeyFrameValues) { if (NumFrameKeyFrames > 1) { delete [] FrameKeyFrameValues; @@ -2191,21 +2137,10 @@ void ParticleBufferClass::Reset_Frames(ParticlePropertyStruct &new_props) // otherwise release and reallocate. unsigned int new_num_key_frames = key + 1;// Includes start keyframe (keytime == 0). if (new_num_key_frames != NumFrameKeyFrames) { - - if (FrameKeyFrameTimes) { - delete [] FrameKeyFrameTimes; - FrameKeyFrameTimes = NULL; - } - if (FrameKeyFrameValues) { - delete [] FrameKeyFrameValues; - FrameKeyFrameValues = NULL; - } - if (FrameKeyFrameDeltas) { - delete [] FrameKeyFrameDeltas; - FrameKeyFrameDeltas = NULL; - } - NumFrameKeyFrames = new_num_key_frames; + delete [] FrameKeyFrameTimes; + delete [] FrameKeyFrameValues; + delete [] FrameKeyFrameDeltas; FrameKeyFrameTimes = W3DNEWARRAY unsigned int [NumFrameKeyFrames]; FrameKeyFrameValues = W3DNEWARRAY float [NumFrameKeyFrames]; FrameKeyFrameDeltas = W3DNEWARRAY float [NumFrameKeyFrames]; @@ -2298,14 +2233,13 @@ void ParticleBufferClass::Reset_Blur_Times(ParticlePropertyStruct &new_bl // Release Arrays, Reuse KeyFrameValues if the right size, // otherwise release and reallocate. - if (BlurTimeKeyFrameTimes) { - delete [] BlurTimeKeyFrameTimes; - BlurTimeKeyFrameTimes = NULL; - } - if (BlurTimeKeyFrameDeltas) { - delete [] BlurTimeKeyFrameDeltas; - BlurTimeKeyFrameDeltas = NULL; - } + + delete [] BlurTimeKeyFrameTimes; + BlurTimeKeyFrameTimes = NULL; + + delete [] BlurTimeKeyFrameDeltas; + BlurTimeKeyFrameDeltas = NULL; + if (BlurTimeKeyFrameValues) { if (NumBlurTimeKeyFrames > 1) { delete [] BlurTimeKeyFrameValues; @@ -2339,21 +2273,10 @@ void ParticleBufferClass::Reset_Blur_Times(ParticlePropertyStruct &new_bl // otherwise release and reallocate. unsigned int new_num_key_frames = key + 1;// Includes start keyframe (keytime == 0). if (new_num_key_frames != NumBlurTimeKeyFrames) { - - if (BlurTimeKeyFrameTimes) { - delete [] BlurTimeKeyFrameTimes; - BlurTimeKeyFrameTimes = NULL; - } - if (BlurTimeKeyFrameValues) { - delete [] BlurTimeKeyFrameValues; - BlurTimeKeyFrameValues = NULL; - } - if (BlurTimeKeyFrameDeltas) { - delete [] BlurTimeKeyFrameDeltas; - BlurTimeKeyFrameDeltas = NULL; - } - NumBlurTimeKeyFrames = new_num_key_frames; + delete [] BlurTimeKeyFrameTimes; + delete [] BlurTimeKeyFrameValues; + delete [] BlurTimeKeyFrameDeltas; BlurTimeKeyFrameTimes = new unsigned int [NumBlurTimeKeyFrames]; BlurTimeKeyFrameValues = new float [NumBlurTimeKeyFrames]; BlurTimeKeyFrameDeltas = new float [NumBlurTimeKeyFrames]; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp index 2fbbbed81a8..2e09baa7533 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp @@ -177,15 +177,11 @@ ParticleEmitterClass::~ParticleEmitterClass(void) Buffer->Emitter_Is_Dead(); Buffer->Release_Ref(); - if (PosRand != NULL) { - delete PosRand; - PosRand = NULL; - } + delete PosRand; + PosRand = NULL; - if (VelRand != NULL) { - delete VelRand; - VelRand = NULL; - } + delete VelRand; + VelRand = NULL; if (NameString != NULL) { ::free (NameString); @@ -281,27 +277,24 @@ ParticleEmitterClass::Create_From_Definition (const ParticleEmitterDefClass &def definition.Get_Frame_Mode (), definition.Get_Line_Properties ()) ); - if (color_keys.KeyTimes != NULL) delete [] color_keys.KeyTimes; - if (color_keys.Values != NULL) delete [] color_keys.Values; - if (opacity_keys.KeyTimes != NULL) delete [] opacity_keys.KeyTimes; - if (opacity_keys.Values != NULL) delete [] opacity_keys.Values; - if (size_keys.KeyTimes != NULL) delete [] size_keys.KeyTimes; - if (size_keys.Values != NULL) delete [] size_keys.Values; - if (rotation_keys.KeyTimes != NULL) delete [] rotation_keys.KeyTimes; - if (rotation_keys.Values != NULL) delete [] rotation_keys.Values; - if (frame_keys.KeyTimes != NULL) delete [] frame_keys.KeyTimes; - if (frame_keys.Values != NULL) delete [] frame_keys.Values; - if (blur_time_keys.KeyTimes != NULL) delete [] blur_time_keys.KeyTimes; - if (blur_time_keys.Values != NULL) delete [] blur_time_keys.Values; + delete [] color_keys.KeyTimes; + delete [] color_keys.Values; + delete [] opacity_keys.KeyTimes; + delete [] opacity_keys.Values; + delete [] size_keys.KeyTimes; + delete [] size_keys.Values; + delete [] rotation_keys.KeyTimes; + delete [] rotation_keys.Values; + delete [] frame_keys.KeyTimes; + delete [] frame_keys.Values; + delete [] blur_time_keys.KeyTimes; + delete [] blur_time_keys.Values; // Pass the name along to the emitter pemitter->Set_Name (definition.Get_Name ()); // release our reference to particle texture. - if (ptexture) { - REF_PTR_RELEASE(ptexture); - ptexture = 0; - } + REF_PTR_RELEASE(ptexture); // Return a pointer to the new emitter return pemitter; @@ -451,21 +444,16 @@ bool ParticleEmitterClass::Is_Stopped(void) void ParticleEmitterClass::Set_Position_Randomizer(Vector3Randomizer *rand) { - if (PosRand) { - delete PosRand; - PosRand =NULL; - } + delete PosRand; PosRand = rand; } void ParticleEmitterClass::Set_Velocity_Randomizer(Vector3Randomizer *rand) { - if (VelRand) { - delete VelRand; - VelRand =NULL; - } + delete VelRand; VelRand = rand; + if (VelRand) { VelRand->Scale(0.001f); // Convert from seconds to ms } @@ -758,8 +746,8 @@ ParticleEmitterClass::Build_Definition (void) const ParticlePropertyStruct colors; Get_Color_Key_Frames (colors); pdefinition->Set_Color_Keyframes (colors); - if (colors.KeyTimes != NULL) delete [] colors.KeyTimes; - if (colors.Values != NULL) delete [] colors.Values; + delete [] colors.KeyTimes; + delete [] colors.Values; // // Pass the opacity keyframes onto the definition @@ -767,8 +755,8 @@ ParticleEmitterClass::Build_Definition (void) const ParticlePropertyStruct opacities; Get_Opacity_Key_Frames (opacities); pdefinition->Set_Opacity_Keyframes (opacities); - if (opacities.KeyTimes != NULL) delete [] opacities.KeyTimes; - if (opacities.Values != NULL) delete [] opacities.Values; + delete [] opacities.KeyTimes; + delete [] opacities.Values; // // Pass the size keyframes onto the definition @@ -776,8 +764,8 @@ ParticleEmitterClass::Build_Definition (void) const ParticlePropertyStruct sizes; Get_Size_Key_Frames (sizes); pdefinition->Set_Size_Keyframes (sizes); - if (sizes.KeyTimes != NULL) delete [] sizes.KeyTimes; - if (sizes.Values != NULL) delete [] sizes.Values; + delete [] sizes.KeyTimes; + delete [] sizes.Values; // // Pass the rotation keyframes onto the definition @@ -785,8 +773,8 @@ ParticleEmitterClass::Build_Definition (void) const ParticlePropertyStruct rotations; Get_Rotation_Key_Frames (rotations); pdefinition->Set_Rotation_Keyframes (rotations, Get_Initial_Orientation_Random()); - if (rotations.KeyTimes != NULL) delete [] rotations.KeyTimes; - if (rotations.Values != NULL) delete [] rotations.Values; + delete [] rotations.KeyTimes; + delete [] rotations.Values; // // Pass the frame keyframes onto the definition @@ -794,8 +782,8 @@ ParticleEmitterClass::Build_Definition (void) const ParticlePropertyStruct frames; Get_Frame_Key_Frames (frames); pdefinition->Set_Frame_Keyframes (frames); - if (frames.KeyTimes != NULL) delete [] frames.KeyTimes; - if (frames.Values != NULL) delete [] frames.Values; + delete [] frames.KeyTimes; + delete [] frames.Values; // // Pass the blur time keyframes onto the definition @@ -803,8 +791,8 @@ ParticleEmitterClass::Build_Definition (void) const ParticlePropertyStruct blur_times; Get_Blur_Time_Key_Frames (blur_times); pdefinition->Set_Blur_Time_Keyframes (blur_times); - if (blur_times.KeyTimes != NULL) delete [] blur_times.KeyTimes; - if (blur_times.Values != NULL) delete [] blur_times.Values; + delete [] blur_times.KeyTimes; + delete [] blur_times.Values; // diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp index cb15aa30842..188950ef089 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp @@ -42,23 +42,12 @@ #include "texture.h" #ifndef SAFE_DELETE -#define SAFE_DELETE(pointer) \ -{ \ - if (pointer) { \ - delete pointer; \ - pointer = 0; \ - } \ -} -#endif //SAFE_DELETE +#define SAFE_DELETE(pointer) { delete pointer; pointer = NULL; } +#endif #ifndef SAFE_DELETE_ARRAY -#define SAFE_DELETE_ARRAY(pointer) \ - if (pointer) { \ - delete [] pointer; \ - pointer = 0; \ - } \ - -#endif //SAFE_DELETE +#define SAFE_DELETE_ARRAY(pointer) { delete [] pointer; pointer = NULL; } +#endif /////////////////////////////////////////////////////////////////////////////////// @@ -1875,7 +1864,6 @@ ParticleEmitterLoaderClass::Load_W3D (ChunkLoadClass &chunk_load) // Error! Free the definition delete pdefinition; - pdefinition = NULL; } else { // Success! Create a prototype from the definition diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/textureloader.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/textureloader.cpp index bda829eb7fe..cc45c9b7952 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/textureloader.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/textureloader.cpp @@ -625,7 +625,7 @@ IDirect3DSurface8* TextureLoader::Load_Surface_Immediate( DX8_ErrorCode(d3d_surface->UnlockRect()); - if (converted_surface) delete[] converted_surface; + delete[] converted_surface; return d3d_surface; } @@ -2003,9 +2003,7 @@ bool TextureLoadTaskClass::Load_Uncompressed_Mipmap(void) } } - if (converted_surface) { - delete[] converted_surface; - } + delete[] converted_surface; return true; } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texturethumbnail.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texturethumbnail.cpp index c7bdb228b2a..9f86584c8cb 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texturethumbnail.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texturethumbnail.cpp @@ -278,7 +278,7 @@ ThumbnailManagerClass::~ThumbnailManagerClass() ite.First(); } - if (ThumbnailMemory) delete[] ThumbnailMemory; + delete[] ThumbnailMemory; ThumbnailMemory=NULL; } @@ -404,8 +404,7 @@ void ThumbnailManagerClass::Deinit() while (ThumbnailManagerClass* man=ThumbnailManagerList.Head()) { delete man; } - if (GlobalThumbnailManager) { - delete GlobalThumbnailManager; - GlobalThumbnailManager=NULL; - } + + delete GlobalThumbnailManager; + GlobalThumbnailManager=NULL; } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp index cb20781306c..9eadd9ea5a1 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp @@ -445,25 +445,15 @@ GUIEdit::GUIEdit( void ) //============================================================================= GUIEdit::~GUIEdit( void ) { - if (TheHeaderTemplateManager) - { - delete TheHeaderTemplateManager; - TheHeaderTemplateManager = NULL; - } + delete TheHeaderTemplateManager; + TheHeaderTemplateManager = NULL; - if (TheGameText) - { - delete TheGameText; - TheGameText = NULL; - } + delete TheGameText; + TheGameText = NULL; // delete the IME Manager -// if ( TheIMEManager ) -// { -// delete TheIMEManager; -// TheIMEManager = NULL; -// } - +// delete TheIMEManager; +// TheIMEManager = NULL; // all the shutdown routine shutdown(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp index 6e8934efbe1..406793275f5 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp @@ -649,9 +649,8 @@ void FlagsInfo::UndoFlags(CWorldBuilderDoc *pDoc) ModifyFlagsUndoable::~ModifyFlagsUndoable(void) { m_pDoc = NULL; // not ref counted. - if (m_flagsList) { - delete m_flagsList; - } + + delete m_flagsList; m_flagsList = NULL; } @@ -937,9 +936,8 @@ void DeleteInfo::UndoDelete(WorldHeightMapEdit *pMap) DeleteObjectUndoable::~DeleteObjectUndoable(void) { m_pDoc = NULL; // not ref counted. - if (m_deleteList) { - delete m_deleteList; - } + + delete m_deleteList; m_deleteList=NULL; } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp index 4e1824a1ee1..eca1d02a263 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp @@ -230,10 +230,10 @@ Int DrawObject::freeMapResources(void) REF_PTR_RELEASE(m_indexFeedback); REF_PTR_RELEASE(m_indexWater); REF_PTR_RELEASE(m_moldMesh); - if (m_lineRenderer) { - delete m_lineRenderer; - m_lineRenderer = NULL; - } + + delete m_lineRenderer; + m_lineRenderer = NULL; + return 0; } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/MainFrm.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/MainFrm.cpp index ffbc9ec9080..8c45d2599cc 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/MainFrm.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/MainFrm.cpp @@ -77,14 +77,11 @@ CMainFrame::CMainFrame() CMainFrame::~CMainFrame() { - if (m_layersList) { - delete m_layersList; - } + delete m_layersList; + m_layersList = NULL; - if (m_scriptDialog) { - delete m_scriptDialog; - m_scriptDialog = NULL; - } + delete m_scriptDialog; + m_scriptDialog = NULL; SaveBarState("MainFrame"); TheMainFrame = NULL; @@ -427,10 +424,7 @@ void CMainFrame::OnEditGloballightoptions() void CMainFrame::onEditScripts() { - if (m_scriptDialog) { - // Delete the old one since it is no longer valid. - delete m_scriptDialog; - } + delete m_scriptDialog; CRect frameRect; GetWindowRect(&frameRect); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp index 81f2b902cd7..fb744e422c7 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp @@ -256,10 +256,8 @@ void PopupSlider::New(CWnd *pParentWnd, long kind, member function */ } catch (...) { // don't rethrow - if (pPopupSlider) { - delete pPopupSlider; - pPopupSlider = NULL; - } + delete pPopupSlider; + pPopupSlider = NULL; } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp index 6256616cafc..586e8f8af69 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp @@ -1318,7 +1318,7 @@ void WorldHeightMapEdit::autoBlendOut(Int xIndex, Int yIndex, Int globalEdgeClas delete pCurNode; } - if (pProcessed) delete[] pProcessed; + delete[] pProcessed; pProcessed = NULL; } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp index 88667df1065..df6af034c59 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -454,19 +454,15 @@ WbView3d::~WbView3d() // ---------------------------------------------------------------------------- void WbView3d::shutdownWW3D(void) { - if (m_intersector) { - delete m_intersector; - m_intersector = NULL; - } + delete m_intersector; + m_intersector = NULL; + + delete m_layer; + m_layer = NULL; + + delete m_buildLayer; + m_buildLayer = NULL; - if (m_layer) { - delete m_layer; - m_layer = NULL; - } - if (m_buildLayer) { - delete m_buildLayer; - m_buildLayer = NULL; - } if (m3DFont) { m3DFont->Release(); m3DFont = NULL; diff --git a/GeneralsMD/Code/Tools/wdump/chunk_d.cpp b/GeneralsMD/Code/Tools/wdump/chunk_d.cpp index 49e22e05490..ffcb136076c 100644 --- a/GeneralsMD/Code/Tools/wdump/chunk_d.cpp +++ b/GeneralsMD/Code/Tools/wdump/chunk_d.cpp @@ -2305,8 +2305,7 @@ ChunkItem::ChunkItem(ChunkLoadClass &cload) { } ChunkItem::~ChunkItem() { - if(Data != 0) - delete [] Data; + delete [] Data; while(!Chunks.IsEmpty()) { ChunkItem *item = Chunks.RemoveHead(); delete item; From d61ce1fa6890eafbf7b700e20274bef2c5f439f3 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 13 Sep 2025 20:40:56 +0200 Subject: [PATCH 069/343] bugfix(collide): Prevent retail CRC mismatch from changes to Sabotage Crate Collide (#1571) --- .../Collide/CrateCollide/SabotageCommandCenterCrateCollide.cpp | 2 ++ .../Object/Collide/CrateCollide/SabotageFakeBuilding.cpp | 2 ++ .../Collide/CrateCollide/SabotageInternetCenterCrateCollide.cpp | 2 ++ .../CrateCollide/SabotageMilitaryFactoryCrateCollide.cpp | 2 ++ .../Collide/CrateCollide/SabotagePowerPlantCrateCollide.cpp | 2 ++ .../Collide/CrateCollide/SabotageSuperweaponCrateCollide.cpp | 2 ++ .../Collide/CrateCollide/SabotageSupplyCenterCrateCollide.cpp | 2 ++ .../Collide/CrateCollide/SabotageSupplyDropzoneCrateCollide.cpp | 2 ++ 8 files changed, 16 insertions(+) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageCommandCenterCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageCommandCenterCrateCollide.cpp index b7614abc94c..6c6509733cd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageCommandCenterCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageCommandCenterCrateCollide.cpp @@ -97,11 +97,13 @@ Bool SabotageCommandCenterCrateCollide::isValidToExecute( const Object *other ) return FALSE; } +#if !RETAIL_COMPATIBLE_CRC if (other->getStatusBits().testForAny(MAKE_OBJECT_STATUS_MASK2(OBJECT_STATUS_UNDER_CONSTRUCTION, OBJECT_STATUS_SOLD))) { // TheSuperHackers @bugfix Stubbjax 03/08/2025 Can't enter something being sold or under construction. return FALSE; } +#endif Relationship r = getObject()->getRelationship( other ); if( r != ENEMIES ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageFakeBuilding.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageFakeBuilding.cpp index 8554948faa3..3de539a253c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageFakeBuilding.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageFakeBuilding.cpp @@ -92,11 +92,13 @@ Bool SabotageFakeBuildingCrateCollide::isValidToExecute( const Object *other ) c return FALSE; } +#if !RETAIL_COMPATIBLE_CRC if (other->getStatusBits().testForAny(MAKE_OBJECT_STATUS_MASK2(OBJECT_STATUS_UNDER_CONSTRUCTION, OBJECT_STATUS_SOLD))) { // TheSuperHackers @bugfix Stubbjax 03/08/2025 Can't enter something being sold or under construction. return FALSE; } +#endif Relationship r = getObject()->getRelationship( other ); if( r != ENEMIES ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageInternetCenterCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageInternetCenterCrateCollide.cpp index 487b4906340..f0c3c223f36 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageInternetCenterCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageInternetCenterCrateCollide.cpp @@ -98,11 +98,13 @@ Bool SabotageInternetCenterCrateCollide::isValidToExecute( const Object *other ) return FALSE; } +#if !RETAIL_COMPATIBLE_CRC if (other->getStatusBits().testForAny(MAKE_OBJECT_STATUS_MASK2(OBJECT_STATUS_UNDER_CONSTRUCTION, OBJECT_STATUS_SOLD))) { // TheSuperHackers @bugfix Stubbjax 03/08/2025 Can't enter something being sold or under construction. return FALSE; } +#endif Relationship r = getObject()->getRelationship( other ); if( r != ENEMIES ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageMilitaryFactoryCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageMilitaryFactoryCrateCollide.cpp index cb51ddda27f..a40174cfe39 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageMilitaryFactoryCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageMilitaryFactoryCrateCollide.cpp @@ -102,11 +102,13 @@ Bool SabotageMilitaryFactoryCrateCollide::isValidToExecute( const Object *other return FALSE; } +#if !RETAIL_COMPATIBLE_CRC if (other->getStatusBits().testForAny(MAKE_OBJECT_STATUS_MASK2(OBJECT_STATUS_UNDER_CONSTRUCTION, OBJECT_STATUS_SOLD))) { // TheSuperHackers @bugfix Stubbjax 03/08/2025 Can't enter something being sold or under construction. return FALSE; } +#endif Relationship r = getObject()->getRelationship( other ); if( r != ENEMIES ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotagePowerPlantCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotagePowerPlantCrateCollide.cpp index cd95755e30e..dbb2d32c154 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotagePowerPlantCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotagePowerPlantCrateCollide.cpp @@ -92,11 +92,13 @@ Bool SabotagePowerPlantCrateCollide::isValidToExecute( const Object *other ) con return FALSE; } +#if !RETAIL_COMPATIBLE_CRC if (other->getStatusBits().testForAny(MAKE_OBJECT_STATUS_MASK2(OBJECT_STATUS_UNDER_CONSTRUCTION, OBJECT_STATUS_SOLD))) { // TheSuperHackers @bugfix Stubbjax 03/08/2025 Can't enter something being sold or under construction. return FALSE; } +#endif Relationship r = getObject()->getRelationship( other ); if( r != ENEMIES ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSuperweaponCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSuperweaponCrateCollide.cpp index 637df26f7b5..1dfc8e0c265 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSuperweaponCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSuperweaponCrateCollide.cpp @@ -97,11 +97,13 @@ Bool SabotageSuperweaponCrateCollide::isValidToExecute( const Object *other ) co return FALSE; } +#if !RETAIL_COMPATIBLE_CRC if (other->getStatusBits().testForAny(MAKE_OBJECT_STATUS_MASK2(OBJECT_STATUS_UNDER_CONSTRUCTION, OBJECT_STATUS_SOLD))) { // TheSuperHackers @bugfix Stubbjax 03/08/2025 Can't enter something being sold or under construction. return FALSE; } +#endif Relationship r = getObject()->getRelationship( other ); if( r != ENEMIES ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyCenterCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyCenterCrateCollide.cpp index 0a951bf3a02..3589e7607c3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyCenterCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyCenterCrateCollide.cpp @@ -96,11 +96,13 @@ Bool SabotageSupplyCenterCrateCollide::isValidToExecute( const Object *other ) c return FALSE; } +#if !RETAIL_COMPATIBLE_CRC if (other->getStatusBits().testForAny(MAKE_OBJECT_STATUS_MASK2(OBJECT_STATUS_UNDER_CONSTRUCTION, OBJECT_STATUS_SOLD))) { // TheSuperHackers @bugfix Stubbjax 03/08/2025 Can't enter something being sold or under construction. return FALSE; } +#endif Relationship r = getObject()->getRelationship( other ); if( r != ENEMIES ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyDropzoneCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyDropzoneCrateCollide.cpp index 416cc5c2c31..2a6a11671a9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyDropzoneCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyDropzoneCrateCollide.cpp @@ -96,11 +96,13 @@ Bool SabotageSupplyDropzoneCrateCollide::isValidToExecute( const Object *other ) return FALSE; } +#if !RETAIL_COMPATIBLE_CRC if (other->getStatusBits().testForAny(MAKE_OBJECT_STATUS_MASK2(OBJECT_STATUS_UNDER_CONSTRUCTION, OBJECT_STATUS_SOLD))) { // TheSuperHackers @bugfix Stubbjax 03/08/2025 Can't enter something being sold or under construction. return FALSE; } +#endif Relationship r = getObject()->getRelationship( other ); if( r != ENEMIES ) From f8c394e0f8cf3f5e70085a0a2c52cdd7e13f5fe9 Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Mon, 15 Sep 2025 19:42:28 +0100 Subject: [PATCH 070/343] fix(guiedit): Fix crash on GuiEdit launch by initializing GlobalLanguage after GlobalData (#1576) --- Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp | 8 +++++--- GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp b/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp index 68aca92937e..5227b26e3e0 100644 --- a/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp @@ -486,8 +486,6 @@ void GUIEdit::init( void ) TheArchiveFileSystem = new Win32BIGFileSystem; TheFileSystem->init(); - TheGlobalLanguageData = new GlobalLanguage; - TheGlobalLanguageData->init(); //--------------------------------------------------------------------------- // GUI tool specific initializations ---------------------------------------- //--------------------------------------------------------------------------- @@ -510,10 +508,14 @@ void GUIEdit::init( void ) // Game engine specific initializations ------------------------------------- //--------------------------------------------------------------------------- - // create the name key generator + // create the global data TheWritableGlobalData = new GlobalData; TheWritableGlobalData->init(); + // TheSuperHackers @info global language relies on global data being initialized + TheGlobalLanguageData = new GlobalLanguage; + TheGlobalLanguageData->init(); + // create the message stream TheMessageStream = new MessageStream; TheMessageStream->init(); diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp index 9eadd9ea5a1..3c842f751da 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp @@ -486,8 +486,6 @@ void GUIEdit::init( void ) TheArchiveFileSystem = new Win32BIGFileSystem; TheFileSystem->init(); - TheGlobalLanguageData = new GlobalLanguage; - TheGlobalLanguageData->init(); //--------------------------------------------------------------------------- // GUI tool specific initializations ---------------------------------------- //--------------------------------------------------------------------------- @@ -510,10 +508,14 @@ void GUIEdit::init( void ) // Game engine specific initializations ------------------------------------- //--------------------------------------------------------------------------- - // create the name key generator + // create the global data TheWritableGlobalData = new GlobalData; TheWritableGlobalData->init(); + // TheSuperHackers @info global language relies on global data being initialized + TheGlobalLanguageData = new GlobalLanguage; + TheGlobalLanguageData->init(); + // create the message stream TheMessageStream = new MessageStream; TheMessageStream->init(); From 2a4b508e986bf94dd315154331e3bbd6720aae68 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Mon, 15 Sep 2025 20:43:21 +0200 Subject: [PATCH 071/343] build(pathfinder): Remove unused code of EXPAND_ONE_CELL (#1564) --- .../Source/GameLogic/AI/AIPathfind.cpp | 65 ------------------- .../Source/GameLogic/AI/AIPathfind.cpp | 65 ------------------- 2 files changed, 130 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 0fa1a389c21..149584c5ffd 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -3838,71 +3838,6 @@ void Pathfinder::internal_classifyObjectFootprint( Object *obj, Bool insert ) cellBounds.hi.y = m_extent.hi.y; } - - - // Expand building bounds 1 cell. -#define no_EXPAND_ONE_CELL -#ifdef EXPAND_ONE_CELL - for( j=cellBounds.lo.y; j<=cellBounds.hi.y; j++ ) - { - for( i=cellBounds.lo.x; i<=cellBounds.hi.x; i++ ) - { - if (!insert) { - if (m_map[i][j].getType() == PathfindCell::CELL_IMPASSABLE) { - m_map[i][j].setType(PathfindCell::CELL_CLEAR); - } - m_map[i][j].setPinched(false); - } - if (!insert) { - if (m_map[i][j].isObstaclePresent(obj->getID())) { - m_map[i][j].removeObstacle( obj ); - } - continue; - } - if (m_map[i][j].getType() == PathfindCell::CELL_CLEAR) { - Bool obstacleAdjacent = false; - Int k, l; - for (k=i-1; k m_extent.hi.x) continue; - for (l=j-1; l m_extent.hi.y) continue; - if ((k==i) && (l==j)) continue; - if ((k!=i) && (l!=j)) continue; - if (m_map[k][l].getType()!=PathfindCell::CELL_CLEAR)) { - objectAdjacent = true; - break; - } - - } - } - if (obstacleAdjacent) { - m_map[i][j].setPinched(true); - } - // If the total open cells are < 2 - } - } - } - - if (insert) { - for( j=cellBounds.lo.y; j<=cellBounds.hi.y; j++ ) - { - for( i=cellBounds.lo.x; i<=cellBounds.hi.x; i++ ) - { - if (m_map[i][j].getPinched() && m_map[i][j].getType() == PathfindCell::CELL_CLEAR) { - ICoord2D pos; - pos.x = i; - pos.y = j; - m_map[i][j].setTypeAsObstacle( obj, false, pos ); - //m_map[i][j].setType(PathfindCell::CELL_CLIFF); - m_map[i][j].setPinched(false); - } - } - } - } -#endif - - - if (!insert) { for( j=cellBounds.lo.y; j<=cellBounds.hi.y; j++ ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 65d8522d512..cce92a82fd0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -4330,71 +4330,6 @@ void Pathfinder::internal_classifyObjectFootprint( Object *obj, Bool insert ) cellBounds.hi.y = m_extent.hi.y; } - - - // Expand building bounds 1 cell. -#define no_EXPAND_ONE_CELL -#ifdef EXPAND_ONE_CELL - for( j=cellBounds.lo.y; j<=cellBounds.hi.y; j++ ) - { - for( i=cellBounds.lo.x; i<=cellBounds.hi.x; i++ ) - { - if (!insert) { - if (m_map[i][j].getType() == PathfindCell::CELL_IMPASSABLE) { - m_map[i][j].setType(PathfindCell::CELL_CLEAR); - } - m_map[i][j].setPinched(false); - } - if (!insert) { - if (m_map[i][j].isObstaclePresent(obj->getID())) { - m_map[i][j].removeObstacle( obj ); - } - continue; - } - if (m_map[i][j].getType() == PathfindCell::CELL_CLEAR) { - Bool obstacleAdjacent = false; - Int k, l; - for (k=i-1; k m_extent.hi.x) continue; - for (l=j-1; l m_extent.hi.y) continue; - if ((k==i) && (l==j)) continue; - if ((k!=i) && (l!=j)) continue; - if (m_map[k][l].getType()!=PathfindCell::CELL_CLEAR)) { - objectAdjacent = true; - break; - } - - } - } - if (obstacleAdjacent) { - m_map[i][j].setPinched(true); - } - // If the total open cells are < 2 - } - } - } - - if (insert) { - for( j=cellBounds.lo.y; j<=cellBounds.hi.y; j++ ) - { - for( i=cellBounds.lo.x; i<=cellBounds.hi.x; i++ ) - { - if (m_map[i][j].getPinched() && m_map[i][j].getType() == PathfindCell::CELL_CLEAR) { - ICoord2D pos; - pos.x = i; - pos.y = j; - m_map[i][j].setTypeAsObstacle( obj, false, pos ); - //m_map[i][j].setType(PathfindCell::CELL_CLIFF); - m_map[i][j].setPinched(false); - } - } - } - } -#endif - - - if (!insert) { for( j=cellBounds.lo.y; j<=cellBounds.hi.y; j++ ) { From f789ed42cca42e6f5e25a4271a0ab1afc7f6577a Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Mon, 15 Sep 2025 20:49:41 +0200 Subject: [PATCH 072/343] tweak(fps): Set min logic time scale to 5 with RTS_DEBUG (#1577) --- Core/GameEngine/Include/Common/FrameRateLimit.h | 8 ++++++++ Core/GameEngine/Source/Common/FrameRateLimit.cpp | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Core/GameEngine/Include/Common/FrameRateLimit.h b/Core/GameEngine/Include/Common/FrameRateLimit.h index 31779e2aebe..3e3c80f0ea8 100644 --- a/Core/GameEngine/Include/Common/FrameRateLimit.h +++ b/Core/GameEngine/Include/Common/FrameRateLimit.h @@ -18,6 +18,9 @@ #pragma once +#include "Common/GameCommon.h" + + class FrameRateLimit { public: @@ -60,6 +63,11 @@ class LogicTimeScaleFpsPreset public: enum CPP_11(: UnsignedInt) { +#if RTS_DEBUG + MinFpsValue = 5, +#else + MinFpsValue = LOGICFRAMES_PER_SECOND, +#endif StepFpsValue = 5, }; diff --git a/Core/GameEngine/Source/Common/FrameRateLimit.cpp b/Core/GameEngine/Source/Common/FrameRateLimit.cpp index 71fb213d65d..5144f05403d 100644 --- a/Core/GameEngine/Source/Common/FrameRateLimit.cpp +++ b/Core/GameEngine/Source/Common/FrameRateLimit.cpp @@ -105,9 +105,9 @@ UnsignedInt LogicTimeScaleFpsPreset::getNextFpsValue(UnsignedInt value) UnsignedInt LogicTimeScaleFpsPreset::getPrevFpsValue(UnsignedInt value) { - if (value - StepFpsValue < LOGICFRAMES_PER_SECOND) + if (value - StepFpsValue < MinFpsValue) { - return LOGICFRAMES_PER_SECOND; + return MinFpsValue; } else { From 5aa89036e8a5a43724fb45d539cf9ac98d2c4839 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Mon, 15 Sep 2025 21:17:15 +0200 Subject: [PATCH 073/343] feat(system): Prevent the system from sleeping or display from turning off while the game is busy in Windows OS (#1572) --- .../Code/GameEngine/Include/Common/OSDisplay.h | 4 ++++ .../Code/GameEngine/Include/GameLogic/GameLogic.h | 4 ++++ .../Source/GameLogic/System/GameLogic.cpp | 15 +++++++++++++++ .../Source/Win32Device/Common/Win32OSDisplay.cpp | 10 ++++++++++ .../Code/GameEngine/Include/Common/OSDisplay.h | 4 ++++ .../Code/GameEngine/Include/GameLogic/GameLogic.h | 4 ++++ .../Source/GameLogic/System/GameLogic.cpp | 15 +++++++++++++++ .../Source/Win32Device/Common/Win32OSDisplay.cpp | 10 ++++++++++ 8 files changed, 66 insertions(+) diff --git a/Generals/Code/GameEngine/Include/Common/OSDisplay.h b/Generals/Code/GameEngine/Include/Common/OSDisplay.h index b7e9cd6839a..3545f4aa6cd 100644 --- a/Generals/Code/GameEngine/Include/Common/OSDisplay.h +++ b/Generals/Code/GameEngine/Include/Common/OSDisplay.h @@ -63,4 +63,8 @@ enum OSDisplayOtherFlags CPP_11(: UnsignedInt) // This function will return the button pressed to close the dialog. OSDisplayButtonType OSDisplayWarningBox(AsciiString p, AsciiString m, UnsignedInt buttonFlags, UnsignedInt otherFlags); +// TheSuperHackers @feature Tell the Operating System that the game is considered busy +// and we would not like the display screen and/or system to shut off. +void OSDisplaySetBusyState(Bool busyDisplay, Bool busySystem); + #endif /* __OSDISPLAY_H__ */ diff --git a/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h b/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h index 9879667a4fc..6b9815a411a 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h +++ b/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h @@ -173,6 +173,7 @@ class GameLogic : public SubsystemInterface, public Snapshot Bool isInInternetGame( void ); Bool isInShellGame( void ); Bool isInMultiplayerGame( void ); + Bool isInInteractiveGame() const; static Bool isInInteractiveGame(GameMode mode) { return mode != GAME_NONE && mode != GAME_SHELL; } @@ -254,6 +255,8 @@ class GameLogic : public SubsystemInterface, public Snapshot private: + void updateDisplayBusyState(); + void pauseGameLogic(Bool paused); void pauseGameSound(Bool paused); void pauseGameMusic(Bool paused); @@ -397,6 +400,7 @@ inline GameMode GameLogic::getGameMode( void ) { return m_gameMode; } inline Bool GameLogic::isInLanGame( void ) { return (m_gameMode == GAME_LAN); } inline Bool GameLogic::isInSkirmishGame( void ) { return (m_gameMode == GAME_SKIRMISH); } inline Bool GameLogic::isInMultiplayerGame( void ) { return (m_gameMode == GAME_LAN) || (m_gameMode == GAME_INTERNET) ; } +inline Bool GameLogic::isInInteractiveGame() const { return isInInteractiveGame(m_gameMode); } inline Bool GameLogic::isInReplayGame( void ) { return (m_gameMode == GAME_REPLAY); } inline Bool GameLogic::isInInternetGame( void ) { return (m_gameMode == GAME_INTERNET); } inline Bool GameLogic::isInShellGame( void ) { return (m_gameMode == GAME_SHELL); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index f1f2ee2086f..343f5889e85 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -40,6 +40,7 @@ #include "Common/LatchRestore.h" #include "Common/MapObject.h" #include "Common/MultiplayerSettings.h" +#include "Common/OSDisplay.h" #include "Common/PerfTimer.h" #include "Common/Player.h" #include "Common/PlayerList.h" @@ -981,6 +982,16 @@ void GameLogic::setGameLoading( Bool loading ) m_loadingScene = loading; } +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +void GameLogic::updateDisplayBusyState() +{ + const Bool busySystem = isInInteractiveGame() && !isGamePaused(); + const Bool busyDisplay = busySystem && !TheGlobalData->m_headless; + + OSDisplaySetBusyState(busyDisplay, busySystem); +} + // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ void GameLogic::setGameMode( GameMode mode ) @@ -989,6 +1000,8 @@ void GameLogic::setGameMode( GameMode mode ) m_gameMode = mode; TheMouse->onGameModeChanged(prev, mode); + + updateDisplayBusyState(); } // ------------------------------------------------------------------------------------------------ @@ -3736,6 +3749,8 @@ void GameLogic::setGamePaused( Bool paused, Bool pauseMusic, Bool pauseInput ) pauseGameSound(paused); pauseGameMusic(paused && pauseMusic); pauseGameInput(paused && pauseInput); + + updateDisplayBusyState(); } // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp index bc127cc6af9..3511d609d78 100644 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp @@ -123,3 +123,13 @@ OSDisplayButtonType OSDisplayWarningBox(AsciiString p, AsciiString m, UnsignedIn return OSDBT_CANCEL; } + +//------------------------------------------------------------------------------------------------- +void OSDisplaySetBusyState(Bool busyDisplay, Bool busySystem) +{ + EXECUTION_STATE state = ES_CONTINUOUS; + state |= busyDisplay ? ES_DISPLAY_REQUIRED : 0; + state |= busySystem ? ES_SYSTEM_REQUIRED : 0; + + ::SetThreadExecutionState(state); +} diff --git a/GeneralsMD/Code/GameEngine/Include/Common/OSDisplay.h b/GeneralsMD/Code/GameEngine/Include/Common/OSDisplay.h index 3951e8bea89..2d6ec58577f 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/OSDisplay.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/OSDisplay.h @@ -63,4 +63,8 @@ enum OSDisplayOtherFlags CPP_11(: UnsignedInt) // This function will return the button pressed to close the dialog. OSDisplayButtonType OSDisplayWarningBox(AsciiString p, AsciiString m, UnsignedInt buttonFlags, UnsignedInt otherFlags); +// TheSuperHackers @feature Tell the Operating System that the game is considered busy +// and we would not like the display screen and/or system to shut off. +void OSDisplaySetBusyState(Bool busyDisplay, Bool busySystem); + #endif /* __OSDISPLAY_H__ */ diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h index 3ce5706eac2..ddff182fc84 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h @@ -183,6 +183,7 @@ class GameLogic : public SubsystemInterface, public Snapshot Bool isInInternetGame( void ); Bool isInShellGame( void ); Bool isInMultiplayerGame( void ); + Bool isInInteractiveGame() const; static Bool isInInteractiveGame(GameMode mode) { return mode != GAME_NONE && mode != GAME_SHELL; } @@ -272,6 +273,8 @@ class GameLogic : public SubsystemInterface, public Snapshot private: + void updateDisplayBusyState(); + void pauseGameLogic(Bool paused); void pauseGameSound(Bool paused); void pauseGameMusic(Bool paused); @@ -420,6 +423,7 @@ inline GameMode GameLogic::getGameMode( void ) { return m_gameMode; } inline Bool GameLogic::isInLanGame( void ) { return (m_gameMode == GAME_LAN); } inline Bool GameLogic::isInSkirmishGame( void ) { return (m_gameMode == GAME_SKIRMISH); } inline Bool GameLogic::isInMultiplayerGame( void ) { return (m_gameMode == GAME_LAN) || (m_gameMode == GAME_INTERNET) ; } +inline Bool GameLogic::isInInteractiveGame() const { return isInInteractiveGame(m_gameMode); } inline Bool GameLogic::isInReplayGame( void ) { return (m_gameMode == GAME_REPLAY); } inline Bool GameLogic::isInInternetGame( void ) { return (m_gameMode == GAME_INTERNET); } inline Bool GameLogic::isInShellGame( void ) { return (m_gameMode == GAME_SHELL); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index c4d6494351c..e7a561e26c5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -41,6 +41,7 @@ #include "Common/LatchRestore.h" #include "Common/MapObject.h" #include "Common/MultiplayerSettings.h" +#include "Common/OSDisplay.h" #include "Common/PerfTimer.h" #include "Common/Player.h" #include "Common/PlayerList.h" @@ -1118,6 +1119,16 @@ void GameLogic::deleteLoadScreen( void ) } +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +void GameLogic::updateDisplayBusyState() +{ + const Bool busySystem = isInInteractiveGame() && !isGamePaused(); + const Bool busyDisplay = busySystem && !TheGlobalData->m_headless; + + OSDisplaySetBusyState(busyDisplay, busySystem); +} + // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ void GameLogic::setGameMode( GameMode mode ) @@ -1126,6 +1137,8 @@ void GameLogic::setGameMode( GameMode mode ) m_gameMode = mode; TheMouse->onGameModeChanged(prev, mode); + + updateDisplayBusyState(); } // ------------------------------------------------------------------------------------------------ @@ -4288,6 +4301,8 @@ void GameLogic::setGamePaused( Bool paused, Bool pauseMusic, Bool pauseInput ) pauseGameSound(paused); pauseGameMusic(paused && pauseMusic); pauseGameInput(paused && pauseInput); + + updateDisplayBusyState(); } // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp index 3baf1e44109..085edf99f4d 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp @@ -123,3 +123,13 @@ OSDisplayButtonType OSDisplayWarningBox(AsciiString p, AsciiString m, UnsignedIn return OSDBT_CANCEL; } + +//------------------------------------------------------------------------------------------------- +void OSDisplaySetBusyState(Bool busyDisplay, Bool busySystem) +{ + EXECUTION_STATE state = ES_CONTINUOUS; + state |= busyDisplay ? ES_DISPLAY_REQUIRED : 0; + state |= busySystem ? ES_SYSTEM_REQUIRED : 0; + + ::SetThreadExecutionState(state); +} From 9bbcf00503373faf07114fa94724e74907b6b1f7 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Wed, 17 Sep 2025 10:43:47 +0200 Subject: [PATCH 074/343] refactor: Remove superfluous enum values (#1585) --- .../Code/GameEngine/Include/Common/GameCommon.h | 4 ---- .../Code/GameEngine/Include/Common/GameState.h | 4 ---- .../GameEngine/Include/GameClient/ControlBar.h | 2 -- .../Include/GameClient/DebugDisplay.h | 1 - .../GameEngine/Include/GameClient/InGameUI.h | 2 -- .../Code/GameEngine/Include/GameClient/View.h | 2 -- Generals/Code/GameEngine/Include/GameLogic/AI.h | 2 -- .../Include/GameLogic/AIStateMachine.h | 2 -- .../Include/GameLogic/Module/FlammableUpdate.h | 2 -- .../Include/GameLogic/PartitionManager.h | 1 - .../Include/GameNetwork/GameSpy/BuddyThread.h | 2 -- .../Include/GameNetwork/GameSpy/LobbyUtils.h | 1 - .../Include/GameNetwork/GameSpy/PeerDefs.h | 1 - .../Include/GameNetwork/GameSpy/PeerThread.h | 1 - .../GameEngine/Include/GameNetwork/LANAPI.h | 5 ----- .../Include/GameNetwork/NetworkDefs.h | 2 -- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 2 -- .../GameNetwork/GameSpy/Thread/BuddyThread.cpp | 1 - .../GameNetwork/GameSpy/Thread/PeerThread.cpp | 1 - .../Include/W3DDevice/GameClient/W3DWater.h | 1 - .../Libraries/Source/WWVegas/WW3D2/shader.h | 17 ----------------- Generals/Code/Tools/GUIEdit/Include/GUIEdit.h | 4 ---- .../Code/GameEngine/Include/Common/GameCommon.h | 4 ---- .../Code/GameEngine/Include/Common/GameState.h | 4 ---- .../GameEngine/Include/GameClient/ControlBar.h | 2 -- .../Include/GameClient/DebugDisplay.h | 1 - .../GameEngine/Include/GameClient/InGameUI.h | 2 -- .../Code/GameEngine/Include/GameClient/View.h | 2 -- .../Code/GameEngine/Include/GameLogic/AI.h | 2 -- .../Include/GameLogic/AIStateMachine.h | 3 --- .../Include/GameLogic/Module/FlammableUpdate.h | 2 -- .../Include/GameLogic/PartitionManager.h | 1 - .../Include/GameNetwork/GameSpy/BuddyThread.h | 2 -- .../Include/GameNetwork/GameSpy/LobbyUtils.h | 1 - .../Include/GameNetwork/GameSpy/PeerDefs.h | 1 - .../Include/GameNetwork/GameSpy/PeerThread.h | 1 - .../GameEngine/Include/GameNetwork/LANAPI.h | 5 ----- .../Include/GameNetwork/NetworkDefs.h | 2 -- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 2 -- .../GameNetwork/GameSpy/Thread/BuddyThread.cpp | 1 - .../GameNetwork/GameSpy/Thread/PeerThread.cpp | 1 - .../Include/W3DDevice/GameClient/W3DWater.h | 1 - .../Libraries/Source/WWVegas/WW3D2/shader.h | 17 ----------------- GeneralsMD/Code/Tools/GUIEdit/Include/GUIEdit.h | 4 ---- 44 files changed, 121 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/GameCommon.h b/Generals/Code/GameEngine/Include/Common/GameCommon.h index 426906d8492..833e6374aca 100644 --- a/Generals/Code/GameEngine/Include/Common/GameCommon.h +++ b/Generals/Code/GameEngine/Include/Common/GameCommon.h @@ -148,8 +148,6 @@ enum CellShroudStatus CPP_11(: Int) CELLSHROUD_CLEAR, CELLSHROUD_FOGGED, CELLSHROUD_SHROUDED, - - CELLSHROUD_COUNT }; //------------------------------------------------------------------------------------------------- @@ -162,8 +160,6 @@ enum ObjectShroudStatus CPP_11(: Int) OBJECTSHROUD_FOGGED, ///< object is completely fogged OBJECTSHROUD_SHROUDED, ///< object is completely shrouded OBJECTSHROUD_INVALID_BUT_PREVIOUS_VALID, ///< indeterminate state, will recompute, BUT previous status is valid, don't reset (used for save/load) - - OBJECTSHROUD_COUNT }; //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/Common/GameState.h b/Generals/Code/GameEngine/Include/Common/GameState.h index 508d9e0027f..61457442460 100644 --- a/Generals/Code/GameEngine/Include/Common/GameState.h +++ b/Generals/Code/GameEngine/Include/Common/GameState.h @@ -57,8 +57,6 @@ enum SaveLoadLayoutType CPP_11(: Int) SLLT_SAVE_AND_LOAD, SLLT_LOAD_ONLY, SLLT_SAVE_ONLY, - - SLLT_NUM_TYPES // keep this last, why? don't know, it's not really used, but we like it this way }; // ------------------------------------------------------------------------------------------------ @@ -86,8 +84,6 @@ enum SaveFileType CPP_11(: Int) { SAVE_FILE_TYPE_NORMAL, ///< a regular save game at any arbitrary point in the game SAVE_FILE_TYPE_MISSION, ///< a save game in between missions (a mission save) - - SAVE_FILE_TYPE_NUM_TYPES }; // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Include/GameClient/ControlBar.h b/Generals/Code/GameEngine/Include/GameClient/ControlBar.h index e8a8b072604..7ebee3a112d 100644 --- a/Generals/Code/GameEngine/Include/GameClient/ControlBar.h +++ b/Generals/Code/GameEngine/Include/GameClient/ControlBar.h @@ -574,8 +574,6 @@ enum ControlBarContext CPP_11(: Int) CB_CONTEXT_OBSERVER_INFO, ///< for when we want to populate the player info CB_CONTEXT_OBSERVER_LIST, ///< for when we want to update the observer list CB_CONTEXT_OCL_TIMER, ///< Countdown for OCL spewers - - NUM_CB_CONTEXTS }; //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameClient/DebugDisplay.h b/Generals/Code/GameEngine/Include/GameClient/DebugDisplay.h index b81b572d3e9..0aada8a492d 100644 --- a/Generals/Code/GameEngine/Include/GameClient/DebugDisplay.h +++ b/Generals/Code/GameEngine/Include/GameClient/DebugDisplay.h @@ -83,7 +83,6 @@ class DebugDisplayInterface RED, GREEN, BLUE, - NUM_COLORS }; virtual ~DebugDisplayInterface() {}; diff --git a/Generals/Code/GameEngine/Include/GameClient/InGameUI.h b/Generals/Code/GameEngine/Include/GameClient/InGameUI.h index 0257115a440..30f0fd080b7 100644 --- a/Generals/Code/GameEngine/Include/GameClient/InGameUI.h +++ b/Generals/Code/GameEngine/Include/GameClient/InGameUI.h @@ -613,7 +613,6 @@ friend class Drawable; // for selection/deselection transactions #ifdef RTS_DEBUG DEBUG_HINT, #endif - NUM_HINT_TYPES // keep this one last }; // mouse mode interface @@ -622,7 +621,6 @@ friend class Drawable; // for selection/deselection transactions MOUSEMODE_DEFAULT = 0, MOUSEMODE_BUILD_PLACE, MOUSEMODE_GUI_COMMAND, - MOUSEMODE_MAX }; enum { MAX_MOVE_HINTS = 256 }; diff --git a/Generals/Code/GameEngine/Include/GameClient/View.h b/Generals/Code/GameEngine/Include/GameClient/View.h index 41b6aac91a5..ff86d887f28 100644 --- a/Generals/Code/GameEngine/Include/GameClient/View.h +++ b/Generals/Code/GameEngine/Include/GameClient/View.h @@ -96,8 +96,6 @@ class View : public Snapshot WTS_INSIDE_FRUSTUM = 0, // On the screen (inside frustum of camera) WTS_OUTSIDE_FRUSTUM, // Return is valid but off the screen (outside frustum of camera) WTS_INVALID, // No transform possible - - WTS_COUNT }; public: diff --git a/Generals/Code/GameEngine/Include/GameLogic/AI.h b/Generals/Code/GameEngine/Include/GameLogic/AI.h index 10f51592cc8..5fb25d4ae3a 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/AI.h +++ b/Generals/Code/GameEngine/Include/GameLogic/AI.h @@ -399,8 +399,6 @@ enum AICommandType CPP_11(: Int) // Stored in save file, do not reorder/renumber AICMD_FOLLOW_PATH_APPEND, AICMD_MOVE_TO_POSITION_EVEN_IF_SLEEPING, // same as AICMD_MOVE_TO_POSITION, but even ATTITUDE_SLEEP units respond. AICMD_GUARD_TUNNEL_NETWORK, - - AICMD_NUM_COMMANDS // keep last }; struct AICommandParms diff --git a/Generals/Code/GameEngine/Include/GameLogic/AIStateMachine.h b/Generals/Code/GameEngine/Include/GameLogic/AIStateMachine.h index 550e3f29682..202df2c20ad 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/AIStateMachine.h +++ b/Generals/Code/GameEngine/Include/GameLogic/AIStateMachine.h @@ -103,7 +103,6 @@ enum AIStateType CPP_11(: Int) AI_MOVE_AWAY_FROM_REPULSORS, ///< Civilians are running away from repulsors. (enemies or dead civs, usually) jba AI_WANDER_IN_PLACE, ///< Civilians just wander around a spot, rather than along a path. AI_BUSY, ///< This is a state that things will be in when they are busy doing random stuff that doesn't require AI interaction. - NUM_AI_STATES }; //----------------------------------------------------------------------------------------------------------- @@ -198,7 +197,6 @@ enum StateType CPP_11(: Int) APPROACH_TARGET, ///< Approach a non-moving target. AIM_AT_TARGET, ///< rotate to face GoalObject or GoalPosition FIRE_WEAPON, ///< fire the machine owner's current weapon - NUM_ATTACK_STATES }; AttackStateMachine( Object *owner, AIAttackState* att, AsciiString name, Bool follow, Bool attackingObject, Bool forceAttacking ); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h index f15eebc8b0a..ada7542a3f6 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h @@ -45,8 +45,6 @@ enum FlammabilityStatusType CPP_11(: Int) FS_NORMAL = 0, FS_AFLAME, FS_BURNED, - - FS_NORMAL_COUNT // keep last }; //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h b/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h index 213d0b284a7..d2715e96a7b 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h +++ b/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h @@ -103,7 +103,6 @@ enum ValueOrThreat CPP_11(: Int) { VOT_CashValue = 1, VOT_ThreatValue, - VOT_NumItems }; // ---------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameNetwork/GameSpy/BuddyThread.h b/Generals/Code/GameEngine/Include/GameNetwork/GameSpy/BuddyThread.h index fd71e6d3c15..b2719023bc8 100644 --- a/Generals/Code/GameEngine/Include/GameNetwork/GameSpy/BuddyThread.h +++ b/Generals/Code/GameEngine/Include/GameNetwork/GameSpy/BuddyThread.h @@ -53,7 +53,6 @@ class BuddyRequest BUDDYREQUEST_DENYADD, // don't allow someone to add you to their buddy list BUDDYREQUEST_SETSTATUS, // Set our status BUDDYREQUEST_DELETEACCT, // Delete our account - BUDDYREQUEST_MAX } buddyRequestType; union @@ -106,7 +105,6 @@ class BuddyResponse BUDDYRESPONSE_MESSAGE, BUDDYRESPONSE_REQUEST, BUDDYRESPONSE_STATUS, - BUDDYRESPONSE_MAX } buddyResponseType; GPProfile profile; diff --git a/Generals/Code/GameEngine/Include/GameNetwork/GameSpy/LobbyUtils.h b/Generals/Code/GameEngine/Include/GameNetwork/GameSpy/LobbyUtils.h index b5170166487..1390032b61e 100644 --- a/Generals/Code/GameEngine/Include/GameNetwork/GameSpy/LobbyUtils.h +++ b/Generals/Code/GameEngine/Include/GameNetwork/GameSpy/LobbyUtils.h @@ -49,7 +49,6 @@ enum GameSortType CPP_11(: Int) GAMESORT_ALPHA_DESCENDING, GAMESORT_PING_ASCENDING, GAMESORT_PING_DESCENDING, - GAMESORT_MAX, }; Bool HandleSortButton( NameKeyType sortButton ); diff --git a/Generals/Code/GameEngine/Include/GameNetwork/GameSpy/PeerDefs.h b/Generals/Code/GameEngine/Include/GameNetwork/GameSpy/PeerDefs.h index a54654036a0..a5951ea3898 100644 --- a/Generals/Code/GameEngine/Include/GameNetwork/GameSpy/PeerDefs.h +++ b/Generals/Code/GameEngine/Include/GameNetwork/GameSpy/PeerDefs.h @@ -168,7 +168,6 @@ enum GameSpyBuddyStatus CPP_11(: Int) { BUDDY_LOADING, BUDDY_PLAYING, BUDDY_MATCHING, - BUDDY_MAX }; // --------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameNetwork/GameSpy/PeerThread.h b/Generals/Code/GameEngine/Include/GameNetwork/GameSpy/PeerThread.h index b19eeb3ee46..0cdf0ca30c0 100644 --- a/Generals/Code/GameEngine/Include/GameNetwork/GameSpy/PeerThread.h +++ b/Generals/Code/GameEngine/Include/GameNetwork/GameSpy/PeerThread.h @@ -196,7 +196,6 @@ enum DisconnectReason CPP_11(: Int) DISCONNECT_GP_NEWUSER_BAD_PASSWORD, DISCONNECT_GP_NEWPROFILE_BAD_NICK, DISCONNECT_GP_NEWPROFILE_BAD_OLD_NICK, - DISCONNECT_MAX, }; enum QMStatus CPP_11(: Int) diff --git a/Generals/Code/GameEngine/Include/GameNetwork/LANAPI.h b/Generals/Code/GameEngine/Include/GameNetwork/LANAPI.h index eb12a088453..5bfcc13465d 100644 --- a/Generals/Code/GameEngine/Include/GameNetwork/LANAPI.h +++ b/Generals/Code/GameEngine/Include/GameNetwork/LANAPI.h @@ -75,7 +75,6 @@ class LANAPIInterface : public SubsystemInterface LANCHAT_NORMAL = 0, LANCHAT_EMOTE, LANCHAT_SYSTEM, - LANCHAT_MAX }; // Request functions generate network traffic @@ -110,7 +109,6 @@ class LANAPIInterface : public SubsystemInterface RET_GAME_GONE, // OnGameJoin RET_BUSY, // OnGameCreate/Join/etc if another action is in progress RET_UNKNOWN, // Default message for oddity - RET_MAX }; UnicodeString getErrorStringFromReturnType( ReturnType ret ); @@ -220,7 +218,6 @@ class LANAPI : public LANAPIInterface ACT_JOIN, ACT_JOINDIRECTCONNECT, ACT_LEAVE, - ACT_MAX }; static const UnsignedInt s_resendDelta; // in ms @@ -319,8 +316,6 @@ struct LANMessage MSG_INACTIVE, ///< I've alt-tabbed out. Unaccept me cause I'm a poo-flinging monkey. MSG_REQUEST_GAME_INFO, ///< For direct connect, get the game info from a specific IP Address - - MSG_MAX } LANMessageType; WideChar name[g_lanPlayerNameLength+1]; ///< My name, for convenience diff --git a/Generals/Code/GameEngine/Include/GameNetwork/NetworkDefs.h b/Generals/Code/GameEngine/Include/GameNetwork/NetworkDefs.h index f26530ec162..ae10c9cf76f 100644 --- a/Generals/Code/GameEngine/Include/GameNetwork/NetworkDefs.h +++ b/Generals/Code/GameEngine/Include/GameNetwork/NetworkDefs.h @@ -156,8 +156,6 @@ enum NetCommandType CPP_11(: Int) { NETCOMMANDTYPE_DISCONNECTFRAME, NETCOMMANDTYPE_DISCONNECTSCREENOFF, NETCOMMANDTYPE_DISCONNECTEND, - - NETCOMMANDTYPE_MAX }; enum NetLocalStatus CPP_11(: Int) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index af588896d77..041dc6850e9 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -214,8 +214,6 @@ enum Detail CPP_11(: Int) MEDIUMDETAIL, LOWDETAIL, CUSTOMDETAIL, - - DETAIL, }; diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp index 9c63a5612b7..06e9dae3e1d 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp @@ -121,7 +121,6 @@ enum CallbackType CALLBACK_RECVMESSAGE, CALLBACK_RECVREQUEST, CALLBACK_RECVSTATUS, - CALLBACK_MAX }; void callbackWrapper( GPConnection *con, void *arg, void *param ) diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp index 9719cddcaaa..58e32d178ea 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp @@ -504,7 +504,6 @@ enum CallbackType CALLBACK_RECVMESSAGE, CALLBACK_RECVREQUEST, CALLBACK_RECVSTATUS, - CALLBACK_MAX }; void connectCallbackWrapper( PEER peer, PEERBool success, int failureReason, void *param ) diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWater.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWater.h index f97ac886a04..3331b95cdde 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWater.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWater.h @@ -73,7 +73,6 @@ class WaterRenderObjClass : public Snapshot, WATER_TYPE_1_FB_REFLECTION, //legacy frame buffer reflection (non translucent) WATER_TYPE_2_PVSHADER, //pixel/vertex shader, texture reflection WATER_TYPE_3_GRIDMESH, //3D Mesh based water - WATER_TYPE_MAX // end of enumeration }; WaterRenderObjClass(void); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/shader.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/shader.h index 91e737acd1a..b1587c333c3 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/shader.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/shader.h @@ -44,10 +44,6 @@ #include "always.h" -#if defined (SR_OS_SOLARIS) -#undef PASS_MAX -#endif - class DX8Wrapper; struct W3dMaterial3Struct; class StringClass; @@ -95,7 +91,6 @@ class ShaderClass { ALPHATEST_DISABLE= 0,// disable alpha testing (default) ALPHATEST_ENABLE, // enable alpha testing - ALPHATEST_MAX // end of enumeration }; enum DepthCompareType @@ -108,21 +103,18 @@ class ShaderClass PASS_NOTEQUAL, // pass if incoming not equal to stored PASS_GEQUAL, // pass if incoming greater than or equal to stored PASS_ALWAYS, // pass always - PASS_MAX // end of enumeration }; enum DepthMaskType { DEPTH_WRITE_DISABLE=0, // disable depth buffer writes DEPTH_WRITE_ENABLE, // enable depth buffer writes (default) - DEPTH_WRITE_MAX // end of enumeration }; enum ColorMaskType { COLOR_WRITE_DISABLE=0, // disable color buffer writes COLOR_WRITE_ENABLE, // enable color buffer writes (default) - COLOR_WRITE_MAX // end of enumeration }; enum DetailAlphaFuncType @@ -131,7 +123,6 @@ class ShaderClass DETAILALPHA_DETAIL, // other DETAILALPHA_SCALE, // local * other DETAILALPHA_INVSCALE, // ~(~local * ~other) = local + (1-local)*other - DETAILALPHA_MAX // end of enumeration }; enum DetailColorFuncType @@ -145,22 +136,18 @@ class ShaderClass DETAILCOLOR_SUBR, // 0110 other - local DETAILCOLOR_BLEND, // 0111 (localAlpha)*local + (~localAlpha)*other DETAILCOLOR_DETAILBLEND, // 1000 (otherAlpha)*local + (~otherAlpha)*other - - DETAILCOLOR_MAX // end of enumeration }; enum CullModeType { CULL_MODE_DISABLE=0, CULL_MODE_ENABLE, - CULL_MODE_MAX }; enum NPatchEnableType { NPATCH_DISABLE=0, NPATCH_ENABLE, - NPATCH_TYPE_MAX }; enum DstBlendFuncType @@ -180,7 +167,6 @@ class ShaderClass FOG_ENABLE, // apply fog, f*fogColor + (1-f)*fragment FOG_SCALE_FRAGMENT, // fog scalar value multiplies fragment, (1-f)*fragment FOG_WHITE, // fog scalar value replaces fragment, f*fogColor - FOG_MAX // end of enumeration }; enum PriGradientType @@ -191,14 +177,12 @@ class ShaderClass GRADIENT_BUMPENVMAP, // 011 GRADIENT_BUMPENVMAPLUMINANCE, // 100 GRADIENT_DOTPRODUCT3, // 101 - GRADIENT_MAX // end of enumeration }; enum SecGradientType { SECONDARY_GRADIENT_DISABLE=0, // don't draw secondary gradient (default) SECONDARY_GRADIENT_ENABLE, // add secondary gradient RGB to fragment RGB - SECONDARY_GRADIENT_MAX // end of enumeration }; enum SrcBlendFuncType @@ -214,7 +198,6 @@ class ShaderClass { TEXTURING_DISABLE=0, // no texturing (treat fragment initial color as 1,1,1,1) TEXTURING_ENABLE, // enable texturing - TEXTURING_MAX // end of enumeration }; enum StaticSortCategoryType diff --git a/Generals/Code/Tools/GUIEdit/Include/GUIEdit.h b/Generals/Code/Tools/GUIEdit/Include/GUIEdit.h index 432ba698124..26df9a8fad1 100644 --- a/Generals/Code/Tools/GUIEdit/Include/GUIEdit.h +++ b/Generals/Code/Tools/GUIEdit/Include/GUIEdit.h @@ -70,8 +70,6 @@ typedef enum MODE_RESIZE_LEFT, ///< resize dragging left vertical MODE_KEYBOARD_MOVE, ///< moving windows with the Keyboard - MODE_NUM_MODES ///< keep this last! - } EditMode; //------------------------------------------------------------------------------------------------- @@ -103,8 +101,6 @@ typedef enum CURSOR_SIZE_WE, CURSOR_WAIT, - CURSOR_NUM_CURSORS // keep last - } CursorType; //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h b/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h index 72468b20e9c..cd4b46e7155 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h @@ -166,8 +166,6 @@ enum CellShroudStatus CPP_11(: Int) CELLSHROUD_CLEAR, CELLSHROUD_FOGGED, CELLSHROUD_SHROUDED, - - CELLSHROUD_COUNT }; //------------------------------------------------------------------------------------------------- @@ -180,8 +178,6 @@ enum ObjectShroudStatus CPP_11(: Int) OBJECTSHROUD_FOGGED, ///< object is completely fogged OBJECTSHROUD_SHROUDED, ///< object is completely shrouded OBJECTSHROUD_INVALID_BUT_PREVIOUS_VALID, ///< indeterminate state, will recompute, BUT previous status is valid, don't reset (used for save/load) - - OBJECTSHROUD_COUNT }; //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameState.h b/GeneralsMD/Code/GameEngine/Include/Common/GameState.h index df93fb650e1..b073fdd4b3c 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GameState.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GameState.h @@ -57,8 +57,6 @@ enum SaveLoadLayoutType CPP_11(: Int) SLLT_SAVE_AND_LOAD, SLLT_LOAD_ONLY, SLLT_SAVE_ONLY, - - SLLT_NUM_TYPES // keep this last, why? don't know, it's not really used, but we like it this way }; // ------------------------------------------------------------------------------------------------ @@ -86,8 +84,6 @@ enum SaveFileType CPP_11(: Int) { SAVE_FILE_TYPE_NORMAL, ///< a regular save game at any arbitrary point in the game SAVE_FILE_TYPE_MISSION, ///< a save game in between missions (a mission save) - - SAVE_FILE_TYPE_NUM_TYPES }; // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h index 59087b2ef9d..6ce6b31fd95 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h @@ -588,8 +588,6 @@ enum ControlBarContext CPP_11(: Int) CB_CONTEXT_OBSERVER_INFO, ///< for when we want to populate the player info CB_CONTEXT_OBSERVER_LIST, ///< for when we want to update the observer list CB_CONTEXT_OCL_TIMER, ///< Countdown for OCL spewers - - NUM_CB_CONTEXTS }; //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/DebugDisplay.h b/GeneralsMD/Code/GameEngine/Include/GameClient/DebugDisplay.h index 033d5cbf1d9..25a2a01d4bb 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/DebugDisplay.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/DebugDisplay.h @@ -83,7 +83,6 @@ class DebugDisplayInterface RED, GREEN, BLUE, - NUM_COLORS }; virtual ~DebugDisplayInterface() {}; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h index a419c4e8f5e..4e9c28d4581 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h @@ -633,7 +633,6 @@ friend class Drawable; // for selection/deselection transactions #ifdef RTS_DEBUG DEBUG_HINT, #endif - NUM_HINT_TYPES // keep this one last }; // mouse mode interface @@ -642,7 +641,6 @@ friend class Drawable; // for selection/deselection transactions MOUSEMODE_DEFAULT = 0, MOUSEMODE_BUILD_PLACE, MOUSEMODE_GUI_COMMAND, - MOUSEMODE_MAX }; enum { MAX_MOVE_HINTS = 256 }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/View.h b/GeneralsMD/Code/GameEngine/Include/GameClient/View.h index 59a6d50f452..761650d4575 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/View.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/View.h @@ -96,8 +96,6 @@ class View : public Snapshot WTS_INSIDE_FRUSTUM = 0, // On the screen (inside frustum of camera) WTS_OUTSIDE_FRUSTUM, // Return is valid but off the screen (outside frustum of camera) WTS_INVALID, // No transform possible - - WTS_COUNT }; public: diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h index d7ae01ca0bc..056ff903820 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h @@ -413,8 +413,6 @@ enum AICommandType CPP_11(: Int) // Stored in save file, do not reorder/renumber AICMD_EVACUATE_INSTANTLY, AICMD_EXIT_INSTANTLY, AICMD_GUARD_RETALIATE, - - AICMD_NUM_COMMANDS // keep last }; struct AICommandParms diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIStateMachine.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIStateMachine.h index e5ec02caf68..b63f072eb6f 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIStateMachine.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIStateMachine.h @@ -106,8 +106,6 @@ enum AIStateType CPP_11(: Int) AI_BUSY, ///< This is a state that things will be in when they are busy doing random stuff that doesn't require AI interaction. AI_EXIT_INSTANTLY, ///< exit this obj, without waiting -- do it in the onEnter! This frame! AI_GUARD_RETALIATE, ///< attacks attacker but with restrictions (hybrid of attack and guard). - - NUM_AI_STATES }; //----------------------------------------------------------------------------------------------------------- @@ -202,7 +200,6 @@ enum StateType CPP_11(: Int) APPROACH_TARGET, ///< Approach a non-moving target. AIM_AT_TARGET, ///< rotate to face GoalObject or GoalPosition FIRE_WEAPON, ///< fire the machine owner's current weapon - NUM_ATTACK_STATES }; AttackStateMachine( Object *owner, AIAttackState* att, AsciiString name, Bool follow, Bool attackingObject, Bool forceAttacking ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h index 5697f2ccdf5..34e79ff4b5e 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h @@ -45,8 +45,6 @@ enum FlammabilityStatusType CPP_11(: Int) FS_NORMAL = 0, FS_AFLAME, FS_BURNED, - - FS_NORMAL_COUNT // keep last }; //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h index 85035e86603..6b5fad9837b 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h @@ -103,7 +103,6 @@ enum ValueOrThreat CPP_11(: Int) { VOT_CashValue = 1, VOT_ThreatValue, - VOT_NumItems }; // ---------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/BuddyThread.h b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/BuddyThread.h index 8b94bd9bfe7..86ce35ae1e5 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/BuddyThread.h +++ b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/BuddyThread.h @@ -53,7 +53,6 @@ class BuddyRequest BUDDYREQUEST_DENYADD, // don't allow someone to add you to their buddy list BUDDYREQUEST_SETSTATUS, // Set our status BUDDYREQUEST_DELETEACCT, // Delete our account - BUDDYREQUEST_MAX } buddyRequestType; union @@ -106,7 +105,6 @@ class BuddyResponse BUDDYRESPONSE_MESSAGE, BUDDYRESPONSE_REQUEST, BUDDYRESPONSE_STATUS, - BUDDYRESPONSE_MAX } buddyResponseType; GPProfile profile; diff --git a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/LobbyUtils.h b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/LobbyUtils.h index 678a15fe20f..94aacf4c7dd 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/LobbyUtils.h +++ b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/LobbyUtils.h @@ -52,7 +52,6 @@ enum GameSortType CPP_11(: Int) GAMESORT_ALPHA_DESCENDING, GAMESORT_PING_ASCENDING, GAMESORT_PING_DESCENDING, - GAMESORT_MAX, }; Bool HandleSortButton( NameKeyType sortButton ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/PeerDefs.h b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/PeerDefs.h index 2f1c2d6f0a2..68ebfc6ec1b 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/PeerDefs.h +++ b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/PeerDefs.h @@ -168,7 +168,6 @@ enum GameSpyBuddyStatus CPP_11(: Int) { BUDDY_LOADING, BUDDY_PLAYING, BUDDY_MATCHING, - BUDDY_MAX }; // --------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/PeerThread.h b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/PeerThread.h index bbc5c5b7e88..11a4188dcc0 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/PeerThread.h +++ b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/PeerThread.h @@ -197,7 +197,6 @@ enum DisconnectReason CPP_11(: Int) DISCONNECT_GP_NEWUSER_BAD_PASSWORD, DISCONNECT_GP_NEWPROFILE_BAD_NICK, DISCONNECT_GP_NEWPROFILE_BAD_OLD_NICK, - DISCONNECT_MAX, }; enum QMStatus CPP_11(: Int) diff --git a/GeneralsMD/Code/GameEngine/Include/GameNetwork/LANAPI.h b/GeneralsMD/Code/GameEngine/Include/GameNetwork/LANAPI.h index 3ea69e9e712..d2ebaf6c7ca 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameNetwork/LANAPI.h +++ b/GeneralsMD/Code/GameEngine/Include/GameNetwork/LANAPI.h @@ -75,7 +75,6 @@ class LANAPIInterface : public SubsystemInterface LANCHAT_NORMAL = 0, LANCHAT_EMOTE, LANCHAT_SYSTEM, - LANCHAT_MAX }; // Request functions generate network traffic @@ -110,7 +109,6 @@ class LANAPIInterface : public SubsystemInterface RET_GAME_GONE, // OnGameJoin RET_BUSY, // OnGameCreate/Join/etc if another action is in progress RET_UNKNOWN, // Default message for oddity - RET_MAX }; UnicodeString getErrorStringFromReturnType( ReturnType ret ); @@ -220,7 +218,6 @@ class LANAPI : public LANAPIInterface ACT_JOIN, ACT_JOINDIRECTCONNECT, ACT_LEAVE, - ACT_MAX }; static const UnsignedInt s_resendDelta; // in ms @@ -319,8 +316,6 @@ struct LANMessage MSG_INACTIVE, ///< I've alt-tabbed out. Unaccept me cause I'm a poo-flinging monkey. MSG_REQUEST_GAME_INFO, ///< For direct connect, get the game info from a specific IP Address - - MSG_MAX } LANMessageType; WideChar name[g_lanPlayerNameLength+1]; ///< My name, for convenience diff --git a/GeneralsMD/Code/GameEngine/Include/GameNetwork/NetworkDefs.h b/GeneralsMD/Code/GameEngine/Include/GameNetwork/NetworkDefs.h index 4c9595dba2f..9b0744e4875 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameNetwork/NetworkDefs.h +++ b/GeneralsMD/Code/GameEngine/Include/GameNetwork/NetworkDefs.h @@ -156,8 +156,6 @@ enum NetCommandType CPP_11(: Int) { NETCOMMANDTYPE_DISCONNECTFRAME, NETCOMMANDTYPE_DISCONNECTSCREENOFF, NETCOMMANDTYPE_DISCONNECTEND, - - NETCOMMANDTYPE_MAX }; enum NetLocalStatus CPP_11(: Int) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index 2bb04820691..85952fe57be 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -223,8 +223,6 @@ enum Detail CPP_11(: Int) MEDIUMDETAIL, LOWDETAIL, CUSTOMDETAIL, - - DETAIL, }; diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp index e192d652091..338de3ebdec 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp @@ -121,7 +121,6 @@ enum CallbackType CALLBACK_RECVMESSAGE, CALLBACK_RECVREQUEST, CALLBACK_RECVSTATUS, - CALLBACK_MAX }; void callbackWrapper( GPConnection *con, void *arg, void *param ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp index ab31eb79f4b..7798e45024f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp @@ -509,7 +509,6 @@ enum CallbackType CALLBACK_RECVMESSAGE, CALLBACK_RECVREQUEST, CALLBACK_RECVSTATUS, - CALLBACK_MAX }; void connectCallbackWrapper( PEER peer, PEERBool success, int failureReason, void *param ) diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWater.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWater.h index f07797b45f8..1385651dada 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWater.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWater.h @@ -73,7 +73,6 @@ class WaterRenderObjClass : public Snapshot, WATER_TYPE_1_FB_REFLECTION, //legacy frame buffer reflection (non translucent) WATER_TYPE_2_PVSHADER, //pixel/vertex shader, texture reflection WATER_TYPE_3_GRIDMESH, //3D Mesh based water - WATER_TYPE_MAX // end of enumeration }; WaterRenderObjClass(void); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/shader.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/shader.h index 466026fb84c..d080ee4dd9d 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/shader.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/shader.h @@ -44,10 +44,6 @@ #include "always.h" -#if defined (SR_OS_SOLARIS) -#undef PASS_MAX -#endif - class DX8Wrapper; struct W3dMaterial3Struct; class StringClass; @@ -95,7 +91,6 @@ class ShaderClass { ALPHATEST_DISABLE= 0,// disable alpha testing (default) ALPHATEST_ENABLE, // enable alpha testing - ALPHATEST_MAX // end of enumeration }; enum DepthCompareType @@ -108,21 +103,18 @@ class ShaderClass PASS_NOTEQUAL, // pass if incoming not equal to stored PASS_GEQUAL, // pass if incoming greater than or equal to stored PASS_ALWAYS, // pass always - PASS_MAX // end of enumeration }; enum DepthMaskType { DEPTH_WRITE_DISABLE=0, // disable depth buffer writes DEPTH_WRITE_ENABLE, // enable depth buffer writes (default) - DEPTH_WRITE_MAX // end of enumeration }; enum ColorMaskType { COLOR_WRITE_DISABLE=0, // disable color buffer writes COLOR_WRITE_ENABLE, // enable color buffer writes (default) - COLOR_WRITE_MAX // end of enumeration }; enum DetailAlphaFuncType @@ -131,7 +123,6 @@ class ShaderClass DETAILALPHA_DETAIL, // other DETAILALPHA_SCALE, // local * other DETAILALPHA_INVSCALE, // ~(~local * ~other) = local + (1-local)*other - DETAILALPHA_MAX // end of enumeration }; enum DetailColorFuncType @@ -149,22 +140,18 @@ class ShaderClass DETAILCOLOR_ADDSIGNED2X, // 1010 (local + other - 0.5) * 2 DETAILCOLOR_SCALE2X, // 1011 local * other * 2 DETAILCOLOR_MODALPHAADDCOLOR, // 1100 local + localAlpha * other - - DETAILCOLOR_MAX // end of enumeration }; enum CullModeType { CULL_MODE_DISABLE=0, CULL_MODE_ENABLE, - CULL_MODE_MAX }; enum NPatchEnableType { NPATCH_DISABLE=0, NPATCH_ENABLE, - NPATCH_TYPE_MAX }; enum DstBlendFuncType @@ -184,7 +171,6 @@ class ShaderClass FOG_ENABLE, // apply fog, f*fogColor + (1-f)*fragment FOG_SCALE_FRAGMENT, // fog scalar value multiplies fragment, (1-f)*fragment FOG_WHITE, // fog scalar value replaces fragment, f*fogColor - FOG_MAX // end of enumeration }; enum PriGradientType @@ -195,14 +181,12 @@ class ShaderClass GRADIENT_BUMPENVMAP, // 011 environment-mapped bump mapping GRADIENT_BUMPENVMAPLUMINANCE, // 100 environment-mapped bump mapping with luminance control GRADIENT_MODULATE2X, // 101 modulate fragment ARGB by gradient ARGB and multiply RGB by 2 - GRADIENT_MAX // end of enumeration }; enum SecGradientType { SECONDARY_GRADIENT_DISABLE=0, // don't draw secondary gradient (default) SECONDARY_GRADIENT_ENABLE, // add secondary gradient RGB to fragment RGB - SECONDARY_GRADIENT_MAX // end of enumeration }; enum SrcBlendFuncType @@ -218,7 +202,6 @@ class ShaderClass { TEXTURING_DISABLE=0, // no texturing (treat fragment initial color as 1,1,1,1) TEXTURING_ENABLE, // enable texturing - TEXTURING_MAX // end of enumeration }; enum StaticSortCategoryType diff --git a/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEdit.h b/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEdit.h index c9af99dd962..0e210b723aa 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEdit.h +++ b/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEdit.h @@ -70,8 +70,6 @@ typedef enum MODE_RESIZE_LEFT, ///< resize dragging left vertical MODE_KEYBOARD_MOVE, ///< moving windows with the Keyboard - MODE_NUM_MODES ///< keep this last! - } EditMode; //------------------------------------------------------------------------------------------------- @@ -103,8 +101,6 @@ typedef enum CURSOR_SIZE_WE, CURSOR_WAIT, - CURSOR_NUM_CURSORS // keep last - } CursorType; //------------------------------------------------------------------------------------------------- From 1bab18edd46202ac0efb034b2710d65254e580c8 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Wed, 17 Sep 2025 11:15:17 +0200 Subject: [PATCH 075/343] refactor: Remove superfluous comments from last entries in enums and arrays (#1586) --- Core/GameEngine/Include/Common/Xfer.h | 6 +++--- Core/Tools/Autorun/autorun.cpp | 2 +- Core/Tools/PATCHGET/CHATAPI.CPP | 3 ++- .../Code/GameEngine/Include/Common/FunctionLexicon.h | 2 +- Generals/Code/GameEngine/Include/Common/GameType.h | 6 +++--- Generals/Code/GameEngine/Include/Common/Geometry.h | 2 +- Generals/Code/GameEngine/Include/Common/ModelState.h | 2 +- Generals/Code/GameEngine/Include/Common/Module.h | 2 +- Generals/Code/GameEngine/Include/Common/Radar.h | 6 +++--- .../Code/GameEngine/Include/Common/TerrainTypes.h | 2 +- Generals/Code/GameEngine/Include/Common/ThingSort.h | 2 +- .../Code/GameEngine/Include/Common/ThingTemplate.h | 8 ++++---- Generals/Code/GameEngine/Include/Common/Upgrade.h | 2 +- Generals/Code/GameEngine/Include/GameClient/Anim2D.h | 2 +- .../Code/GameEngine/Include/GameClient/ControlBar.h | 8 ++++---- Generals/Code/GameEngine/Include/GameClient/Credits.h | 5 +++-- .../Code/GameEngine/Include/GameClient/Drawable.h | 4 ++-- .../Include/GameClient/GameWindowTransitions.h | 7 ++----- .../Code/GameEngine/Include/GameClient/InGameUI.h | 3 +-- .../Code/GameEngine/Include/GameClient/MetaEvent.h | 11 ++++++----- Generals/Code/GameEngine/Include/GameClient/Mouse.h | 4 ++-- .../Code/GameEngine/Include/GameClient/ParticleSys.h | 2 +- .../Code/GameEngine/Include/GameClient/ShellHooks.h | 2 +- .../Code/GameEngine/Include/GameClient/TerrainRoads.h | 3 ++- .../GameEngine/Include/GameClient/TerrainVisual.h | 2 +- Generals/Code/GameEngine/Include/GameLogic/ArmorSet.h | 2 +- Generals/Code/GameEngine/Include/GameLogic/Damage.h | 4 ++-- .../GameEngine/Include/GameLogic/Module/AIUpdate.h | 2 +- .../Include/GameLogic/Module/DozerAIUpdate.h | 5 +++-- .../Include/GameLogic/Module/GarrisonContain.h | 2 +- .../GameLogic/Module/NeutronMissileSlowDeathUpdate.h | 2 +- .../Include/GameLogic/Module/SlowDeathBehavior.h | 2 +- .../GameLogic/Module/StructureCollapseUpdate.h | 2 +- .../Include/GameLogic/Module/StructureToppleUpdate.h | 2 +- Generals/Code/GameEngine/Include/GameLogic/Weapon.h | 2 +- .../Code/GameEngine/Include/GameLogic/WeaponSet.h | 2 +- .../Code/GameEngine/Include/GameLogic/WeaponSetType.h | 2 +- .../Code/GameEngine/Include/GameLogic/WeaponStatus.h | 2 +- .../GameEngine/Include/GameNetwork/RankPointValue.h | 2 +- Generals/Code/GameEngine/Source/Common/GlobalData.cpp | 2 +- Generals/Code/GameEngine/Source/Common/INI/INI.cpp | 2 +- .../Code/GameEngine/Source/Common/INI/INIMapCache.cpp | 2 +- .../GameEngine/Source/Common/MultiplayerSettings.cpp | 4 ++-- .../GameEngine/Source/Common/RTS/SpecialPower.cpp | 2 +- .../Source/Common/System/FunctionLexicon.cpp | 6 +++--- .../Code/GameEngine/Source/Common/System/Upgrade.cpp | 2 +- .../GameEngine/Source/Common/Thing/ThingTemplate.cpp | 4 ++-- .../Code/GameEngine/Source/GameClient/Credits.cpp | 2 +- Generals/Code/GameEngine/Source/GameClient/FXList.cpp | 2 +- .../Source/GameClient/GUI/ControlBar/ControlBar.cpp | 4 ++-- .../GameClient/GUI/ControlBar/ControlBarResizer.cpp | 2 +- .../GameClient/GUI/ControlBar/ControlBarScheme.cpp | 8 ++++---- .../GUICallbacks/Menus/EstablishConnectionsWindow.cpp | 8 ++++---- .../GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp | 4 ++-- .../GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp | 2 +- .../GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp | 3 ++- .../GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp | 4 ++-- .../GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp | 4 ++-- .../Source/GameClient/GUI/GameWindowTransitions.cpp | 4 ++-- .../Source/GameClient/GUI/Shell/ShellMenuScheme.cpp | 6 +++--- .../GameEngine/Source/GameClient/GlobalLanguage.cpp | 2 +- .../Code/GameEngine/Source/GameClient/InGameUI.cpp | 2 +- .../Source/GameClient/MessageStream/MetaEvent.cpp | 4 ++-- .../Source/GameClient/System/CampaignManager.cpp | 4 ++-- Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp | 8 ++++---- .../Code/GameEngine/Source/GameLogic/AI/AIDock.cpp | 2 +- .../Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp | 2 +- .../Code/GameEngine/Source/GameLogic/AI/AIStates.cpp | 8 ++++---- .../Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp | 2 +- .../Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp | 2 +- .../GameEngine/Source/GameLogic/Map/SidesList.cpp | 2 +- .../GameEngine/Source/GameLogic/Object/Locomotor.cpp | 2 +- .../Source/GameLogic/Object/ObjectCreationList.cpp | 2 +- .../Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp | 2 +- .../Object/Update/AIUpdate/DozerAIUpdate.cpp | 2 +- .../Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp | 10 +++++----- .../Object/Update/AIUpdate/WorkerAIUpdate.cpp | 4 ++-- .../GameEngine/Source/GameLogic/Object/Weapon.cpp | 2 +- .../Source/GameLogic/System/CrateSystem.cpp | 2 +- .../GameEngine/Source/GameNetwork/GameSpy/Chat.cpp | 2 +- Generals/Code/Libraries/Source/WWVegas/WW3D2/shader.h | 6 ++++-- Generals/Code/Tools/GUIEdit/Include/GUIEdit.h | 2 +- Generals/Code/Tools/GUIEdit/Include/Properties.h | 2 +- Generals/Code/Tools/GUIEdit/Source/Properties.cpp | 4 ++-- .../Code/Tools/ParticleEditor/ParticleEditorExport.h | 3 +-- .../Code/GameEngine/Include/Common/FunctionLexicon.h | 2 +- GeneralsMD/Code/GameEngine/Include/Common/GameType.h | 6 +++--- GeneralsMD/Code/GameEngine/Include/Common/Geometry.h | 2 +- .../Code/GameEngine/Include/Common/ModelState.h | 2 +- GeneralsMD/Code/GameEngine/Include/Common/Module.h | 2 +- GeneralsMD/Code/GameEngine/Include/Common/Radar.h | 6 +++--- .../Code/GameEngine/Include/Common/TerrainTypes.h | 3 +-- GeneralsMD/Code/GameEngine/Include/Common/ThingSort.h | 2 +- .../Code/GameEngine/Include/Common/ThingTemplate.h | 8 ++++---- GeneralsMD/Code/GameEngine/Include/Common/Upgrade.h | 2 +- .../Code/GameEngine/Include/GameClient/Anim2D.h | 2 +- .../Code/GameEngine/Include/GameClient/ControlBar.h | 8 ++++---- .../Code/GameEngine/Include/GameClient/Credits.h | 5 +++-- .../Code/GameEngine/Include/GameClient/Drawable.h | 4 ++-- .../Include/GameClient/GameWindowTransitions.h | 7 ++----- .../Code/GameEngine/Include/GameClient/InGameUI.h | 3 +-- .../Code/GameEngine/Include/GameClient/MetaEvent.h | 11 ++++++----- GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h | 4 ++-- .../Code/GameEngine/Include/GameClient/ParticleSys.h | 2 +- .../Code/GameEngine/Include/GameClient/ShellHooks.h | 2 +- .../Code/GameEngine/Include/GameClient/TerrainRoads.h | 3 ++- .../GameEngine/Include/GameClient/TerrainVisual.h | 2 +- .../Code/GameEngine/Include/GameLogic/ArmorSet.h | 2 +- GeneralsMD/Code/GameEngine/Include/GameLogic/Damage.h | 4 ++-- .../GameEngine/Include/GameLogic/Module/AIUpdate.h | 2 +- .../Include/GameLogic/Module/DozerAIUpdate.h | 5 +++-- .../Include/GameLogic/Module/GarrisonContain.h | 2 +- .../GameLogic/Module/NeutronMissileSlowDeathUpdate.h | 2 +- .../Include/GameLogic/Module/SlowDeathBehavior.h | 2 +- .../GameLogic/Module/StructureCollapseUpdate.h | 2 +- .../Include/GameLogic/Module/StructureToppleUpdate.h | 2 +- GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h | 2 +- .../Code/GameEngine/Include/GameLogic/WeaponSet.h | 2 +- .../Code/GameEngine/Include/GameLogic/WeaponSetType.h | 2 +- .../Code/GameEngine/Include/GameLogic/WeaponStatus.h | 2 +- .../GameEngine/Include/GameNetwork/RankPointValue.h | 2 +- .../Code/GameEngine/Source/Common/GlobalData.cpp | 2 +- GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp | 2 +- .../Code/GameEngine/Source/Common/INI/INIMapCache.cpp | 2 +- .../GameEngine/Source/Common/INI/INIMultiplayer.cpp | 2 +- .../GameEngine/Source/Common/MultiplayerSettings.cpp | 4 ++-- .../GameEngine/Source/Common/RTS/SpecialPower.cpp | 2 +- .../Source/Common/System/FunctionLexicon.cpp | 6 +++--- .../Code/GameEngine/Source/Common/System/Upgrade.cpp | 2 +- .../GameEngine/Source/Common/Thing/ThingTemplate.cpp | 4 ++-- .../Code/GameEngine/Source/GameClient/Credits.cpp | 2 +- .../Code/GameEngine/Source/GameClient/FXList.cpp | 2 +- .../Source/GameClient/GUI/ControlBar/ControlBar.cpp | 4 ++-- .../GameClient/GUI/ControlBar/ControlBarResizer.cpp | 2 +- .../GameClient/GUI/ControlBar/ControlBarScheme.cpp | 8 ++++---- .../GUICallbacks/Menus/EstablishConnectionsWindow.cpp | 8 ++++---- .../GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp | 4 ++-- .../GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp | 2 +- .../GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp | 3 ++- .../GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp | 4 ++-- .../GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp | 4 ++-- .../Source/GameClient/GUI/GameWindowTransitions.cpp | 4 ++-- .../Source/GameClient/GUI/Shell/ShellMenuScheme.cpp | 6 +++--- .../GameEngine/Source/GameClient/GlobalLanguage.cpp | 2 +- .../Code/GameEngine/Source/GameClient/InGameUI.cpp | 2 +- .../Source/GameClient/MessageStream/MetaEvent.cpp | 4 ++-- .../Source/GameClient/System/CampaignManager.cpp | 4 ++-- GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp | 8 ++++---- .../Code/GameEngine/Source/GameLogic/AI/AIDock.cpp | 2 +- .../Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp | 2 +- .../Source/GameLogic/AI/AIGuardRetaliate.cpp | 2 +- .../Code/GameEngine/Source/GameLogic/AI/AIStates.cpp | 8 ++++---- .../Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp | 2 +- .../Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp | 2 +- .../GameEngine/Source/GameLogic/Map/SidesList.cpp | 2 +- .../GameEngine/Source/GameLogic/Object/Locomotor.cpp | 2 +- .../Source/GameLogic/Object/ObjectCreationList.cpp | 2 +- .../Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp | 2 +- .../Object/Update/AIUpdate/DozerAIUpdate.cpp | 2 +- .../Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp | 10 +++++----- .../Object/Update/AIUpdate/WorkerAIUpdate.cpp | 4 ++-- .../GameEngine/Source/GameLogic/Object/Weapon.cpp | 2 +- .../Source/GameLogic/ScriptEngine/ScriptEngine.cpp | 2 +- .../Source/GameLogic/System/CrateSystem.cpp | 2 +- .../GameEngine/Source/GameNetwork/GameSpy/Chat.cpp | 2 +- .../Include/W3DDevice/GameClient/W3DTreeBuffer.h | 2 +- .../Code/Libraries/Source/WWVegas/WW3D2/shader.h | 6 ++++-- GeneralsMD/Code/Tools/GUIEdit/Include/GUIEdit.h | 2 +- GeneralsMD/Code/Tools/GUIEdit/Include/Properties.h | 2 +- GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp | 4 ++-- .../Code/Tools/ParticleEditor/ParticleEditorExport.h | 3 +-- 171 files changed, 292 insertions(+), 288 deletions(-) diff --git a/Core/GameEngine/Include/Common/Xfer.h b/Core/GameEngine/Include/Common/Xfer.h index 3f937bf11b0..d49e2f079cf 100644 --- a/Core/GameEngine/Include/Common/Xfer.h +++ b/Core/GameEngine/Include/Common/Xfer.h @@ -68,7 +68,7 @@ enum XferMode CPP_11(: Int) XFER_LOAD, XFER_CRC, - NUM_XFER_TYPES // please keep this last + NUM_XFER_TYPES }; //------------------------------------------------------------------------------------------------- @@ -96,7 +96,7 @@ enum XferStatus CPP_11(: Int) XFER_ERROR_UNKNOWN, ///< unknown error (isn't that useful!) - NUM_XFER_STATUS // please keep this last + NUM_XFER_STATUS }; // ------------------------------------------------------------------------------------------------ @@ -106,7 +106,7 @@ enum XferOptions CPP_11(: UnsignedInt) XO_NONE = 0x00000000, XO_NO_POST_PROCESSING = 0x00000001, - XO_ALL = 0xFFFFFFFF // keep this last please + XO_ALL = 0xFFFFFFFF }; /////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Core/Tools/Autorun/autorun.cpp b/Core/Tools/Autorun/autorun.cpp index c36774fd19f..e7d626d794c 100644 --- a/Core/Tools/Autorun/autorun.cpp +++ b/Core/Tools/Autorun/autorun.cpp @@ -252,7 +252,7 @@ enum IDS_MAIN_WINDOW, - IDS_COUNT // keep this last + IDS_COUNT }; */ diff --git a/Core/Tools/PATCHGET/CHATAPI.CPP b/Core/Tools/PATCHGET/CHATAPI.CPP index 07cb28a9fbc..1a532e673cf 100644 --- a/Core/Tools/PATCHGET/CHATAPI.CPP +++ b/Core/Tools/PATCHGET/CHATAPI.CPP @@ -49,7 +49,8 @@ enum EVENT_TYPES { NOUPDATE_EVENT=0, // don't need to update ABORT_EVENT, - NUM_EVENTS // keep last + + NUM_EVENTS }; #if RTS_GENERALS diff --git a/Generals/Code/GameEngine/Include/Common/FunctionLexicon.h b/Generals/Code/GameEngine/Include/Common/FunctionLexicon.h index 963b57678e1..816541db524 100644 --- a/Generals/Code/GameEngine/Include/Common/FunctionLexicon.h +++ b/Generals/Code/GameEngine/Include/Common/FunctionLexicon.h @@ -68,7 +68,7 @@ class FunctionLexicon : public SubsystemInterface TABLE_WIN_LAYOUT_UPDATE, TABLE_WIN_LAYOUT_SHUTDOWN, - MAX_FUNCTION_TABLES // keep this last + MAX_FUNCTION_TABLES }; public: diff --git a/Generals/Code/GameEngine/Include/Common/GameType.h b/Generals/Code/GameEngine/Include/Common/GameType.h index 8616cb6e80d..8fbe7dea777 100644 --- a/Generals/Code/GameEngine/Include/Common/GameType.h +++ b/Generals/Code/GameEngine/Include/Common/GameType.h @@ -74,7 +74,7 @@ enum TimeOfDay CPP_11(: Int) TIME_OF_DAY_EVENING, TIME_OF_DAY_NIGHT, - TIME_OF_DAY_COUNT // keep this last + TIME_OF_DAY_COUNT }; extern const char *TimeOfDayNames[]; @@ -86,7 +86,7 @@ enum Weather CPP_11(: Int) WEATHER_NORMAL = 0, WEATHER_SNOWY = 1, - WEATHER_COUNT // keep this last + WEATHER_COUNT }; extern const char *WeatherNames[]; @@ -176,7 +176,7 @@ enum WeaponSlotType CPP_11(: Int) SECONDARY_WEAPON, TERTIARY_WEAPON, - WEAPONSLOT_COUNT // keep last + WEAPONSLOT_COUNT }; //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/Common/Geometry.h b/Generals/Code/GameEngine/Include/Common/Geometry.h index 7c347e0c04f..9dc49463f57 100644 --- a/Generals/Code/GameEngine/Include/Common/Geometry.h +++ b/Generals/Code/GameEngine/Include/Common/Geometry.h @@ -52,7 +52,7 @@ enum GeometryType CPP_11(: Int) GEOMETRY_CYLINDER, ///< partition/collision testing as cylinder. (majorRadius = radius, height = height) GEOMETRY_BOX, ///< partition/collision testing as rectangular box (majorRadius = half len in forward dir; minorRadius = half len in side dir; height = height) - GEOMETRY_NUM_TYPES, // keep this last + GEOMETRY_NUM_TYPES, GEOMETRY_FIRST = GEOMETRY_SPHERE }; diff --git a/Generals/Code/GameEngine/Include/Common/ModelState.h b/Generals/Code/GameEngine/Include/Common/ModelState.h index b965cc1cc4f..4259a39f0ad 100644 --- a/Generals/Code/GameEngine/Include/Common/ModelState.h +++ b/Generals/Code/GameEngine/Include/Common/ModelState.h @@ -214,7 +214,7 @@ enum ModelConditionFlagType CPP_11(: Int) // existing values! // - MODELCONDITION_COUNT // keep last! + MODELCONDITION_COUNT }; //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/Common/Module.h b/Generals/Code/GameEngine/Include/Common/Module.h index 0daf1f3f041..bf0750a55c2 100644 --- a/Generals/Code/GameEngine/Include/Common/Module.h +++ b/Generals/Code/GameEngine/Include/Common/Module.h @@ -69,7 +69,7 @@ enum ModuleType CPP_11(: Int) MODULETYPE_CLIENT_UPDATE = 2, // put new drawable module types here - NUM_MODULE_TYPES, // keep this last! + NUM_MODULE_TYPES, FIRST_DRAWABLE_MODULE_TYPE = MODULETYPE_DRAW, LAST_DRAWABLE_MODULE_TYPE = MODULETYPE_CLIENT_UPDATE, diff --git a/Generals/Code/GameEngine/Include/Common/Radar.h b/Generals/Code/GameEngine/Include/Common/Radar.h index 5b3dbbdfb81..e1c583dee41 100644 --- a/Generals/Code/GameEngine/Include/Common/Radar.h +++ b/Generals/Code/GameEngine/Include/Common/Radar.h @@ -76,7 +76,7 @@ enum RadarEventType CPP_11(: Int) RADAR_EVENT_FAKE, //Internally creates a radar event, but doesn't notify the player (unit lost //for example, so we can use the spacebar to jump to the event). - RADAR_EVENT_NUM_EVENTS // keep this last + RADAR_EVENT_NUM_EVENTS }; @@ -142,7 +142,7 @@ enum RadarPriorityType CPP_11(: Int) RADAR_PRIORITY_UNIT, // unit level drawing priority RADAR_PRIORITY_LOCAL_UNIT_ONLY, // unit priority, but only on the radar if controlled by the local player - RADAR_PRIORITY_NUM_PRIORITIES // keep this last + RADAR_PRIORITY_NUM_PRIORITIES }; #ifdef DEFINE_RADAR_PRIORITY_NAMES static const char *RadarPriorityNames[] = @@ -153,7 +153,7 @@ static const char *RadarPriorityNames[] = "UNIT", // unit level drawing priority "LOCAL_UNIT_ONLY", // unit priority, but only on the radar if controlled by the local player - NULL // keep this last + NULL }; #endif // DEFINE_RADAR_PRIOTITY_NAMES diff --git a/Generals/Code/GameEngine/Include/Common/TerrainTypes.h b/Generals/Code/GameEngine/Include/Common/TerrainTypes.h index abd04b5b0ea..20aaf108718 100644 --- a/Generals/Code/GameEngine/Include/Common/TerrainTypes.h +++ b/Generals/Code/GameEngine/Include/Common/TerrainTypes.h @@ -70,7 +70,7 @@ typedef enum TERRAIN_WOOD, TERRAIN_BLEND_EDGES, - TERRAIN_NUM_CLASSES // keep this last + TERRAIN_NUM_CLASSES } TerrainClass; #ifdef DEFINE_TERRAIN_TYPE_NAMES diff --git a/Generals/Code/GameEngine/Include/Common/ThingSort.h b/Generals/Code/GameEngine/Include/Common/ThingSort.h index b162c9288a6..2f1a8a48c41 100644 --- a/Generals/Code/GameEngine/Include/Common/ThingSort.h +++ b/Generals/Code/GameEngine/Include/Common/ThingSort.h @@ -52,7 +52,7 @@ enum EditorSortingType CPP_11(: Int) ES_ROAD, // road objects...should never actually be in the object panel. ES_WAYPOINT, // waypoint objects...should never actually be in the object panel. - ES_NUM_SORTING_TYPES // keep this last + ES_NUM_SORTING_TYPES }; #ifdef DEFINE_EDITOR_SORTING_NAMES diff --git a/Generals/Code/GameEngine/Include/Common/ThingTemplate.h b/Generals/Code/GameEngine/Include/Common/ThingTemplate.h index d8b95d0a9c3..37a0fbfbd75 100644 --- a/Generals/Code/GameEngine/Include/Common/ThingTemplate.h +++ b/Generals/Code/GameEngine/Include/Common/ThingTemplate.h @@ -82,7 +82,7 @@ typedef std::map PerUnitFXMap; // INV_IMAGE_HILITE, // INV_IMAGE_PUSHED, // -// INV_IMAGE_NUM_IMAGES // keep this last +// INV_IMAGE_NUM_IMAGES // //}; //------------------------------------------------------------------------------------------------- @@ -141,7 +141,7 @@ enum ThingTemplateAudioType CPP_11(: Int) TTAUDIO_voiceAttackAir, ///< Unit is ordered to attack an airborne unit TTAUDIO_voiceGuard, ///< Unit is ordered to guard an area - TTAUDIO_COUNT // keep last! + TTAUDIO_COUNT }; class AudioArray @@ -204,7 +204,7 @@ enum BuildCompletionType CPP_11(: Int) BC_APPEARS_AT_RALLY_POINT, ///< unit appears at rally point of its #1 prereq BC_PLACED_BY_PLAYER, ///< unit must be manually placed by player - BC_NUM_TYPES // leave this last + BC_NUM_TYPES }; #ifdef DEFINE_BUILD_COMPLETION_NAMES static const char *BuildCompletionNames[] = @@ -225,7 +225,7 @@ enum BuildableStatus CPP_11(: Int) BSTATUS_NO, BSTATUS_ONLY_BY_AI, - BSTATUS_NUM_TYPES // leave this last + BSTATUS_NUM_TYPES }; #ifdef DEFINE_BUILDABLE_STATUS_NAMES diff --git a/Generals/Code/GameEngine/Include/Common/Upgrade.h b/Generals/Code/GameEngine/Include/Common/Upgrade.h index c1282cf537c..a1b45943afb 100644 --- a/Generals/Code/GameEngine/Include/Common/Upgrade.h +++ b/Generals/Code/GameEngine/Include/Common/Upgrade.h @@ -149,7 +149,7 @@ enum UpgradeType CPP_11(: Int) UPGRADE_TYPE_PLAYER = 0, // upgrade applies to a player as a whole UPGRADE_TYPE_OBJECT, // upgrade applies to an object instance only - NUM_UPGRADE_TYPES, // keep this last + NUM_UPGRADE_TYPES }; extern const char *TheUpgradeTypeNames[]; //Change above, change this! diff --git a/Generals/Code/GameEngine/Include/GameClient/Anim2D.h b/Generals/Code/GameEngine/Include/GameClient/Anim2D.h index 439d51a2248..5c36e0277ef 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Anim2D.h +++ b/Generals/Code/GameEngine/Include/GameClient/Anim2D.h @@ -52,7 +52,7 @@ enum Anim2DMode CPP_11(: Int) ANIM_2D_PING_PONG_BACKWARDS, // dont' forget to add new animation mode names to Anim2DModeNames[] below - ANIM_2D_NUM_MODES // keep this last please + ANIM_2D_NUM_MODES }; #ifdef DEFINE_ANIM_2D_MODE_NAMES diff --git a/Generals/Code/GameEngine/Include/GameClient/ControlBar.h b/Generals/Code/GameEngine/Include/GameClient/ControlBar.h index 7ebee3a112d..65b4642c0a9 100644 --- a/Generals/Code/GameEngine/Include/GameClient/ControlBar.h +++ b/Generals/Code/GameEngine/Include/GameClient/ControlBar.h @@ -100,7 +100,7 @@ enum CommandOption CPP_11(: Int) IGNORES_UNDERPOWERED = 0x00100000, // this button isn't disabled if its object is merely underpowered USES_MINE_CLEARING_WEAPONSET= 0x00200000, // uses the special mine-clearing weaponset, even if not current - NUM_COMMAND_OPTIONS // keep this last + NUM_COMMAND_OPTIONS }; #ifdef DEFINE_COMMAND_OPTION_NAMES @@ -208,7 +208,7 @@ enum GUICommandType CPP_11(: Int) // add more commands here, don't forget to update the string command list below too ... - GUI_COMMAND_NUM_COMMANDS // keep this last + GUI_COMMAND_NUM_COMMANDS }; #ifdef DEFINE_GUI_COMMMAND_NAMES @@ -264,7 +264,7 @@ enum CommandButtonMappedBorderType CPP_11(: Int) COMMAND_BUTTON_BORDER_ACTION, COMMAND_BUTTON_BORDER_SYSTEM, - COMMAND_BUTTON_BORDER_COUNT // keep this last + COMMAND_BUTTON_BORDER_COUNT }; static const LookupListRec CommandButtonMappedBorderTypeNames[] = @@ -275,7 +275,7 @@ static const LookupListRec CommandButtonMappedBorderTypeNames[] = { "ACTION", COMMAND_BUTTON_BORDER_ACTION }, { "SYSTEM", COMMAND_BUTTON_BORDER_SYSTEM }, - { NULL, 0 }// keep this last! + { NULL, 0 } }; //------------------------------------------------------------------------------------------------- /** Command buttons are used to load the buttons we place on throughout the command bar diff --git a/Generals/Code/GameEngine/Include/GameClient/Credits.h b/Generals/Code/GameEngine/Include/GameClient/Credits.h index 14b5f6220fa..9e8c851f7bf 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Credits.h +++ b/Generals/Code/GameEngine/Include/GameClient/Credits.h @@ -71,7 +71,8 @@ CREDIT_STYLE_POSITION, CREDIT_STYLE_NORMAL, CREDIT_STYLE_COLUMN, CREDIT_STYLE_BLANK, ///< Keep this second to last -MAX_CREDIT_STYLES ///< Keep this last + +MAX_CREDIT_STYLES }; enum{ CREDIT_SPACE_OFFSET = 2 }; @@ -83,7 +84,7 @@ static const LookupListRec CreditStyleNames[] = { "NORMAL", CREDIT_STYLE_NORMAL }, { "COLUMN", CREDIT_STYLE_COLUMN }, - { NULL, 0 }// keep this last! + { NULL, 0 } }; diff --git a/Generals/Code/GameEngine/Include/GameClient/Drawable.h b/Generals/Code/GameEngine/Include/GameClient/Drawable.h index 557c7cf000c..7111d9e26eb 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Drawable.h +++ b/Generals/Code/GameEngine/Include/GameClient/Drawable.h @@ -102,7 +102,7 @@ enum DrawableIconType CPP_11(: Int) ICON_ENTHUSIASTIC_SUBLIMINAL, ICON_CARBOMB, - MAX_ICONS ///< keep this last + MAX_ICONS }; //----------------------------------------------------------------------------- @@ -263,7 +263,7 @@ enum TerrainDecalType CPP_11(: Int) TERRAIN_DECAL_CRATE, TERRAIN_DECAL_NONE, - TERRAIN_DECAL_MAX ///< keep this last + TERRAIN_DECAL_MAX }; //----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameClient/GameWindowTransitions.h b/Generals/Code/GameEngine/Include/GameClient/GameWindowTransitions.h index 3a2d00bb28a..c91f7a73e54 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GameWindowTransitions.h +++ b/Generals/Code/GameEngine/Include/GameClient/GameWindowTransitions.h @@ -84,7 +84,7 @@ CONTROL_BAR_ARROW_TRANSITION, SCORE_SCALE_UP_TRANSITION, REVERSE_SOUND_TRANSITION, -MAX_TRANSITION_WINDOW_STYLES ///< Keep this last +MAX_TRANSITION_WINDOW_STYLES }; static const LookupListRec TransitionStyleNames[] = @@ -104,10 +104,7 @@ static const LookupListRec TransitionStyleNames[] = { "CONTROLBARARROW", CONTROL_BAR_ARROW_TRANSITION }, { "SCORESCALEUP", SCORE_SCALE_UP_TRANSITION }, { "REVERSESOUND", REVERSE_SOUND_TRANSITION }, - - - - { NULL, 0 }// keep this last! + { NULL, 0 } }; // base class for the transitions diff --git a/Generals/Code/GameEngine/Include/GameClient/InGameUI.h b/Generals/Code/GameEngine/Include/GameClient/InGameUI.h index 30f0fd080b7..dfb21199e6d 100644 --- a/Generals/Code/GameEngine/Include/GameClient/InGameUI.h +++ b/Generals/Code/GameEngine/Include/GameClient/InGameUI.h @@ -98,7 +98,7 @@ enum RadiusCursorType CPP_11(: Int) RADIUSCURSOR_SPYDRONE, - RADIUSCURSOR_COUNT // keep last + RADIUSCURSOR_COUNT }; #ifdef DEFINE_RADIUSCURSOR_NAMES @@ -345,7 +345,6 @@ friend class Drawable; // for selection/deselection transactions ACTIONTYPE_SET_RALLY_POINT, ACTIONTYPE_COMBATDROP_INTO, - //Keep last. NUM_ACTIONTYPES }; diff --git a/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h b/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h index 39f6eb7a982..9107a293b2f 100644 --- a/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h +++ b/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h @@ -44,7 +44,8 @@ enum MappableKeyCategories CPP_11(: Int) CATEGORY_TEAM, CATEGORY_MISC, CATEGORY_DEBUG, - CATEGORY_NUM_CATEGORIES // keep this last + + CATEGORY_NUM_CATEGORIES }; static const LookupListRec CategoryListName[] = @@ -57,7 +58,7 @@ static const LookupListRec CategoryListName[] = {"TEAM", CATEGORY_TEAM}, {"MISC", CATEGORY_MISC}, {"DEBUG", CATEGORY_DEBUG}, - {NULL, 0}// keep this last + {NULL, 0} }; @@ -260,7 +261,7 @@ static const LookupListRec KeyNames[] = { "KEY_INS", MK_INS }, { "KEY_DEL", MK_DEL }, { "KEY_NONE", MK_NONE }, - { NULL, 0 } // keep this last! + { NULL, 0 } }; // ------------------------------------------------------------------------------- @@ -276,7 +277,7 @@ static const LookupListRec TransitionNames[] = { "DOWN", DOWN }, { "UP", UP }, { "DOUBLEDOWN", DOUBLEDOWN }, - { NULL, 0 }// keep this last! + { NULL, 0 } }; // ------------------------------------------------------------------------------- @@ -303,7 +304,7 @@ static const LookupListRec ModifierNames[] = { "SHIFT_CTRL", SHIFT_CTRL }, { "SHIFT_ALT", SHIFT_ALT }, { "SHIFT_ALT_CTRL" , SHIFT_ALT_CTRL }, - { NULL, 0 }// keep this last! + { NULL, 0 } }; diff --git a/Generals/Code/GameEngine/Include/GameClient/Mouse.h b/Generals/Code/GameEngine/Include/GameClient/Mouse.h index 8d911d5eb95..1253b7c66cf 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Mouse.h +++ b/Generals/Code/GameEngine/Include/GameClient/Mouse.h @@ -249,7 +249,7 @@ class Mouse : public SubsystemInterface // ***** dont forget to update CursorININames[] ***** - NUM_MOUSE_CURSORS // keep this last + NUM_MOUSE_CURSORS }; @@ -261,7 +261,7 @@ class Mouse : public SubsystemInterface RM_POLYGON, //alpha blended polygon tied to frame rate. RM_DX8, //hardware cursor independent of frame rate. - RM_MAX // keep this last. + RM_MAX }; static const char *const CursorCaptureBlockReasonNames[]; diff --git a/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h b/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h index 1f369c1f993..5bb10628c0f 100644 --- a/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h +++ b/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h @@ -108,7 +108,7 @@ enum ParticlePriorityType CPP_11(: Int) ALWAYS_RENDER, ///< used for logically important display (not just fluff), so must never be culled, regardless of particle cap, lod, etc // !!! *Noting* goes here ... special is the top priority !!! PARTICLE_PRIORITY_HIGHEST = ALWAYS_RENDER, - NUM_PARTICLE_PRIORITIES ///< Keep this last + NUM_PARTICLE_PRIORITIES }; /** diff --git a/Generals/Code/GameEngine/Include/GameClient/ShellHooks.h b/Generals/Code/GameEngine/Include/GameClient/ShellHooks.h index f6a8d99272b..8af63cfc083 100644 --- a/Generals/Code/GameEngine/Include/GameClient/ShellHooks.h +++ b/Generals/Code/GameEngine/Include/GameClient/ShellHooks.h @@ -77,7 +77,7 @@ enum SHELL_SCRIPT_HOOK_LAN_CLOSED, SHELL_SCRIPT_HOOK_LAN_ENTERED_FROM_GAME, - SHELL_SCRIPT_HOOK_TOTAL // Keep this guy last! + SHELL_SCRIPT_HOOK_TOTAL }; extern const char *TheShellHookNames[]; ///< Contains a list of the text representation of the shell hooks Used in WorldBuilder and in the shell. diff --git a/Generals/Code/GameEngine/Include/GameClient/TerrainRoads.h b/Generals/Code/GameEngine/Include/GameClient/TerrainRoads.h index df21f60822f..fade346ea44 100644 --- a/Generals/Code/GameEngine/Include/GameClient/TerrainRoads.h +++ b/Generals/Code/GameEngine/Include/GameClient/TerrainRoads.h @@ -52,7 +52,8 @@ enum BridgeTowerType CPP_11(: Int) BRIDGE_TOWER_FROM_RIGHT, BRIDGE_TOWER_TO_LEFT, BRIDGE_TOWER_TO_RIGHT, - BRIDGE_MAX_TOWERS ///< keep this last + + BRIDGE_MAX_TOWERS }; // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Include/GameClient/TerrainVisual.h b/Generals/Code/GameEngine/Include/GameClient/TerrainVisual.h index bea2393879b..72b68010917 100644 --- a/Generals/Code/GameEngine/Include/GameClient/TerrainVisual.h +++ b/Generals/Code/GameEngine/Include/GameClient/TerrainVisual.h @@ -58,7 +58,7 @@ typedef enum _TerrainLOD CPP_11(: Int) TERRAIN_LOD_AUTOMATIC = 8, TERRAIN_LOD_DISABLE = 9, - TERRAIN_LOD_NUM_TYPES // keep this last + TERRAIN_LOD_NUM_TYPES } TerrainLOD; #ifdef DEFINE_TERRAIN_LOD_NAMES diff --git a/Generals/Code/GameEngine/Include/GameLogic/ArmorSet.h b/Generals/Code/GameEngine/Include/GameLogic/ArmorSet.h index e63fa016e92..95f0bbf0fab 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/ArmorSet.h +++ b/Generals/Code/GameEngine/Include/GameLogic/ArmorSet.h @@ -52,7 +52,7 @@ enum ArmorSetType CPP_11(: Int) ARMORSET_PLAYER_UPGRADE = 3, ARMORSET_WEAK_VERSUS_BASEDEFENSES = 4, - ARMORSET_COUNT ///< keep last, please + ARMORSET_COUNT }; //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameLogic/Damage.h b/Generals/Code/GameEngine/Include/GameLogic/Damage.h index 365da8e5be2..369b058848a 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Damage.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Damage.h @@ -96,7 +96,7 @@ enum DamageType CPP_11(: Int) // !!!!!!!!!!!!!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // !!!!!!!!!!!!!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - DAMAGE_NUM_TYPES // keep this last + DAMAGE_NUM_TYPES }; #ifdef DEFINE_DAMAGE_NAMES @@ -196,7 +196,7 @@ enum DeathType CPP_11(: Int) DEATH_EXTRA_7 = 18, DEATH_EXTRA_8 = 19, - DEATH_NUM_TYPES // keep this last + DEATH_NUM_TYPES }; #ifdef DEFINE_DEATH_NAMES diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h index 8a08b6b3881..e9d9db388dd 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h @@ -83,7 +83,7 @@ enum LocomotorSetType CPP_11(: Int) LOCOMOTORSET_SUPERSONIC, // set used for high-speed attacks LOCOMOTORSET_SLUGGISH, // set used for abnormally slow (but not damaged) speeds - LOCOMOTORSET_COUNT ///< keep last, please + LOCOMOTORSET_COUNT }; //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h index 493ac893fcb..a88c30eb741 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h @@ -76,7 +76,7 @@ enum DozerTask CPP_11(: Int) // These enums are saved in the game save file, so DOZER_TASK_REPAIR = 1, ///< go repair something DOZER_TASK_FORTIFY = 2, ///< go fortify something - DOZER_NUM_TASKS // keep this last + DOZER_NUM_TASKS }; // ------------------------------------------------------------------------------------------------ @@ -86,7 +86,8 @@ enum DozerDockPoint CPP_11(: Int) // These enums are saved in the game save fil DOZER_DOCK_POINT_START = 0, DOZER_DOCK_POINT_ACTION = 1, DOZER_DOCK_POINT_END = 2, - DOZER_NUM_DOCK_POINTS // keep this one last + + DOZER_NUM_DOCK_POINTS }; // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h b/Generals/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h index 42b5856f5fe..e5fadba33c8 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h @@ -197,7 +197,7 @@ class GarrisonContain : public OpenContain GARRISON_POINT_DAMAGED, GARRISON_POINT_REALLY_DAMAGED, - MAX_GARRISON_POINT_CONDITIONS ///< leave this last + MAX_GARRISON_POINT_CONDITIONS }; Team * m_originalTeam; ///< our original team before we were garrisoned diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/NeutronMissileSlowDeathUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/NeutronMissileSlowDeathUpdate.h index 4901bba500d..2d398b1b9ad 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/NeutronMissileSlowDeathUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/NeutronMissileSlowDeathUpdate.h @@ -51,7 +51,7 @@ enum NeutronBlast CPP_11(: Int) NEUTRON_BLAST_8, NEUTRON_BLAST_9, - MAX_NEUTRON_BLASTS // keep this last + MAX_NEUTRON_BLASTS }; // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h b/Generals/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h index 75e5ec3f81c..570c0c4547f 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h @@ -54,7 +54,7 @@ enum SlowDeathPhaseType CPP_11(: Int) SDPHASE_MIDPOINT, SDPHASE_FINAL, - SD_PHASE_COUNT // keep last + SD_PHASE_COUNT }; #ifdef DEFINE_SLOWDEATHPHASE_NAMES diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/StructureCollapseUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/StructureCollapseUpdate.h index 8f5ea27d114..8082a447285 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/StructureCollapseUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/StructureCollapseUpdate.h @@ -53,7 +53,7 @@ enum StructureCollapsePhaseType CPP_11(: Int) SCPHASE_BURST, SCPHASE_FINAL, - SC_PHASE_COUNT // keep last + SC_PHASE_COUNT }; //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h index 61c47ca6e92..dd51933a5ac 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h @@ -70,7 +70,7 @@ enum StructureTopplePhaseType CPP_11(: Int) STPHASE_DELAY, STPHASE_FINAL, - ST_PHASE_COUNT // keep last + ST_PHASE_COUNT }; static const char *TheStructureTopplePhaseNames[] = diff --git a/Generals/Code/GameEngine/Include/GameLogic/Weapon.h b/Generals/Code/GameEngine/Include/GameLogic/Weapon.h index cc744aba0e2..a01b6f7b5db 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Weapon.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Weapon.h @@ -255,7 +255,7 @@ class WeaponBonus RATE_OF_FIRE, PRE_ATTACK, - FIELD_COUNT // keep last + FIELD_COUNT }; WeaponBonus() diff --git a/Generals/Code/GameEngine/Include/GameLogic/WeaponSet.h b/Generals/Code/GameEngine/Include/GameLogic/WeaponSet.h index 4276b958b5d..4c905ce37e1 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/WeaponSet.h +++ b/Generals/Code/GameEngine/Include/GameLogic/WeaponSet.h @@ -68,7 +68,7 @@ static const LookupListRec TheWeaponSlotTypeNamesLookupList[] = { "SECONDARY", SECONDARY_WEAPON }, { "TERTIARY", TERTIARY_WEAPON }, - { NULL, 0 }// keep this last! + { NULL, 0 } }; #endif diff --git a/Generals/Code/GameEngine/Include/GameLogic/WeaponSetType.h b/Generals/Code/GameEngine/Include/GameLogic/WeaponSetType.h index a7a1ac5a46c..94efcfbf41d 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/WeaponSetType.h +++ b/Generals/Code/GameEngine/Include/GameLogic/WeaponSetType.h @@ -51,7 +51,7 @@ enum WeaponSetType CPP_11(: Int) WEAPONSET_CARBOMB, WEAPONSET_MINE_CLEARING_DETAIL, - WEAPONSET_COUNT ///< keep last, please + WEAPONSET_COUNT }; #endif /* __WEAPONSETTYPE_H__ */ diff --git a/Generals/Code/GameEngine/Include/GameLogic/WeaponStatus.h b/Generals/Code/GameEngine/Include/GameLogic/WeaponStatus.h index ad95f2ac376..e45e6a25fa3 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/WeaponStatus.h +++ b/Generals/Code/GameEngine/Include/GameLogic/WeaponStatus.h @@ -38,7 +38,7 @@ enum WeaponStatus CPP_11(: Int) RELOADING_CLIP, PRE_ATTACK, - WEAPON_STATUS_COUNT // keep last + WEAPON_STATUS_COUNT }; #endif /* __WEAPONSTATUS_H__ */ diff --git a/Generals/Code/GameEngine/Include/GameNetwork/RankPointValue.h b/Generals/Code/GameEngine/Include/GameNetwork/RankPointValue.h index 7d9412d0e4a..9c58ef84efe 100644 --- a/Generals/Code/GameEngine/Include/GameNetwork/RankPointValue.h +++ b/Generals/Code/GameEngine/Include/GameNetwork/RankPointValue.h @@ -77,7 +77,7 @@ enum RANK_GENERAL, RANK_COMMANDER_IN_CHIEF, - MAX_RANKS // keep last + MAX_RANKS }; struct RankPoints diff --git a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp index c3556cbf269..25fec838d18 100644 --- a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp @@ -523,7 +523,7 @@ GlobalData* GlobalData::m_theOriginal = NULL; { "ExtraLogging", INI::parseBool, NULL, offsetof( GlobalData, m_extraLogging ) }, #endif - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; diff --git a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp index ca680b1cd37..5fdd0966760 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp @@ -136,7 +136,7 @@ static const BlockParse theTypeTable[] = { "BenchProfile", INI::parseBenchProfile }, { "ReallyLowMHz", parseReallyLowMHz }, - { NULL, NULL }, // keep this last! + { NULL, NULL }, }; diff --git a/Generals/Code/GameEngine/Source/Common/INI/INIMapCache.cpp b/Generals/Code/GameEngine/Source/Common/INI/INIMapCache.cpp index fb47cddf681..85efbc6fee1 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INIMapCache.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INIMapCache.cpp @@ -107,7 +107,7 @@ const FieldParse MapMetaDataReader::m_mapFieldParseTable[] = { "InitialCameraPosition", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_initialCameraPosition ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; diff --git a/Generals/Code/GameEngine/Source/Common/MultiplayerSettings.cpp b/Generals/Code/GameEngine/Source/Common/MultiplayerSettings.cpp index 9d9d8149440..a8c2cc8b2cd 100644 --- a/Generals/Code/GameEngine/Source/Common/MultiplayerSettings.cpp +++ b/Generals/Code/GameEngine/Source/Common/MultiplayerSettings.cpp @@ -49,7 +49,7 @@ const FieldParse MultiplayerColorDefinition::m_colorFieldParseTable[] = { "TooltipName", INI::parseAsciiString, NULL, offsetof( MultiplayerColorDefinition, m_tooltipName ) }, { "RGBColor", INI::parseRGBColor, NULL, offsetof( MultiplayerColorDefinition, m_rgbValue ) }, { "RGBNightColor", INI::parseRGBColor, NULL, offsetof( MultiplayerColorDefinition, m_rgbValueNight ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; @@ -65,7 +65,7 @@ const FieldParse MultiplayerSettings::m_multiplayerSettingsFieldParseTable[] = { "ShowRandomStartPos", INI::parseBool, NULL, offsetof( MultiplayerSettings, m_showRandomStartPos ) }, { "ShowRandomColor", INI::parseBool, NULL, offsetof( MultiplayerSettings, m_showRandomColor ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; diff --git a/Generals/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp b/Generals/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp index b370566651b..d61c06e4765 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp @@ -173,7 +173,7 @@ void SpecialPowerStore::parseSpecialPowerDefinition( INI *ini ) { "ViewObjectRange", INI::parseReal, NULL, offsetof( SpecialPowerTemplate, m_viewObjectRange ) }, { "RadiusCursorRadius", INI::parseReal, NULL, offsetof( SpecialPowerTemplate, m_radiusCursorRadius ) }, { "ShortcutPower", INI::parseBool, NULL, offsetof( SpecialPowerTemplate, m_shortcutPower ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; diff --git a/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp b/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp index 21bb149c15b..56a988f6970 100644 --- a/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp @@ -281,7 +281,7 @@ static FunctionLexicon::TableEntry winLayoutInitTable[] = { NAMEKEY_INVALID, "DifficultySelectInit", DifficultySelectInit }, { NAMEKEY_INVALID, "PopupReplayInit", PopupReplayInit }, - { NAMEKEY_INVALID, NULL, NULL } // keep this last + { NAMEKEY_INVALID, NULL, NULL } }; @@ -320,7 +320,7 @@ static FunctionLexicon::TableEntry winLayoutUpdateTable[] = { NAMEKEY_INVALID, "ScoreScreenUpdate", ScoreScreenUpdate }, { NAMEKEY_INVALID, "DownloadMenuUpdate", DownloadMenuUpdate }, { NAMEKEY_INVALID, "PopupReplayUpdate", PopupReplayUpdate }, - { NAMEKEY_INVALID, NULL, NULL } // keep this last + { NAMEKEY_INVALID, NULL, NULL } }; @@ -360,7 +360,7 @@ static FunctionLexicon::TableEntry winLayoutShutdownTable[] = { NAMEKEY_INVALID, "ScoreScreenShutdown", ScoreScreenShutdown }, { NAMEKEY_INVALID, "DownloadMenuShutdown", DownloadMenuShutdown }, { NAMEKEY_INVALID, "PopupReplayShutdown", PopupReplayShutdown }, - { NAMEKEY_INVALID, NULL, NULL } // keep this last + { NAMEKEY_INVALID, NULL, NULL } }; diff --git a/Generals/Code/GameEngine/Source/Common/System/Upgrade.cpp b/Generals/Code/GameEngine/Source/Common/System/Upgrade.cpp index 9b911c04524..296ed3799dd 100644 --- a/Generals/Code/GameEngine/Source/Common/System/Upgrade.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/Upgrade.cpp @@ -122,7 +122,7 @@ const FieldParse UpgradeTemplate::m_upgradeFieldParseTable[] = { "ButtonImage", INI::parseAsciiString, NULL, offsetof( UpgradeTemplate, m_buttonImageName ) }, { "ResearchSound", INI::parseAudioEventRTS, NULL, offsetof( UpgradeTemplate, m_researchSound ) }, { "UnitSpecificSound", INI::parseAudioEventRTS, NULL, offsetof( UpgradeTemplate, m_unitSpecificSound ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; diff --git a/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp b/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp index bf6d7bab9fe..6fa3f401fa2 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp @@ -240,7 +240,7 @@ const FieldParse ThingTemplate::s_objectFieldParseTable[] = { "CrusherLevel", INI::parseUnsignedByte, NULL, offsetof( ThingTemplate, m_crusherLevel ) }, { "CrushableLevel", INI::parseUnsignedByte, NULL, offsetof( ThingTemplate, m_crushableLevel ) }, - { 0, 0, 0, 0 } // keep this last + { 0, 0, 0, 0 } }; // NOTE NOTE NOTE -- s_objectFieldParseTable and s_objectReskinFieldParseTable must be updated in tandem -- see comment above @@ -258,7 +258,7 @@ const FieldParse ThingTemplate::s_objectReskinFieldParseTable[] = { "FenceWidth", INI::parseReal, NULL, offsetof( ThingTemplate, m_fenceWidth ) }, { "FenceXOffset", INI::parseReal, NULL, offsetof( ThingTemplate, m_fenceXOffset ) }, - { 0, 0, 0, 0 } // keep this last + { 0, 0, 0, 0 } }; // NOTE NOTE NOTE -- s_objectFieldParseTable and s_objectReskinFieldParseTable must be updated in tandem -- see comment above diff --git a/Generals/Code/GameEngine/Source/GameClient/Credits.cpp b/Generals/Code/GameEngine/Source/GameClient/Credits.cpp index a1543a4c045..6be597df256 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Credits.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Credits.cpp @@ -76,7 +76,7 @@ const FieldParse CreditsManager::m_creditsFieldParseTable[] = { "Blank", CreditsManager::parseBlank, NULL, NULL }, { "Text", CreditsManager::parseText, NULL, NULL }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; diff --git a/Generals/Code/GameEngine/Source/GameClient/FXList.cpp b/Generals/Code/GameEngine/Source/GameClient/FXList.cpp index ea92f18ca16..baaf025f31e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/FXList.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/FXList.cpp @@ -772,7 +772,7 @@ static const FieldParse TheFXListFieldParse[] = { "TerrainScorch", TerrainScorchFXNugget::parse, 0, 0}, { "ParticleSystem", ParticleSystemFXNugget::parse, 0, 0}, { "FXListAtBonePos", FXListAtBonePosFXNugget::parse, 0, 0}, - { NULL, NULL, 0, 0 } // keep this last + { NULL, NULL, 0, 0 } }; //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 5c1c11c9974..366b5861d73 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -118,7 +118,7 @@ const FieldParse CommandButton::s_commandButtonFieldParseTable[] = { "RadiusCursorType", INI::parseIndexList, TheRadiusCursorNames, offsetof( CommandButton, m_radiusCursor ) }, { "UnitSpecificSound", INI::parseAudioEventRTS, NULL, offsetof( CommandButton, m_unitSpecificSound ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; static void commandButtonTooltip(GameWindow *window, @@ -717,7 +717,7 @@ const FieldParse CommandSet::m_commandSetFieldParseTable[] = { "10", CommandSet::parseCommandButton, (void *)9, offsetof( CommandSet, m_command ) }, { "11", CommandSet::parseCommandButton, (void *)10, offsetof( CommandSet, m_command ) }, { "12", CommandSet::parseCommandButton, (void *)11, offsetof( CommandSet, m_command ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp index c830e4c096b..66c9231216f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp @@ -63,7 +63,7 @@ const FieldParse ControlBarResizer::m_controlBarResizerParseTable[] = { { "AltPosition", INI::parseICoord2D, NULL, offsetof( ResizerWindow, m_altPos ) }, { "AltSize", INI::parseICoord2D, NULL, offsetof( ResizerWindow, m_altSize ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; //----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp index b48d511c130..afb11f304e4 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp @@ -155,7 +155,7 @@ const FieldParse ControlBarSchemeManager::m_controlBarSchemeFieldParseTable[] = { "CommandMarkerImage", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_commandMarkerImage) }, { "ExpBarForegroundImage", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_expBarForeground) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; @@ -849,7 +849,7 @@ void ControlBarSchemeManager::parseImagePart(INI *ini, void *instance, void* /*s { "Size", INI::parseICoord2D, NULL, offsetof( ControlBarSchemeImage, m_size ) }, { "ImageName", INI::parseMappedImage, NULL, offsetof( ControlBarSchemeImage, m_image ) }, { "Layer", INI::parseInt, NULL, offsetof( ControlBarSchemeImage, m_layer ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; ControlBarSchemeImage *schemeImage = NEW ControlBarSchemeImage; @@ -869,7 +869,7 @@ void ControlBarSchemeManager::parseAnimatingPartImage(INI *ini, void *instance, { "Size", INI::parseICoord2D, NULL, offsetof( ControlBarSchemeImage, m_size ) }, { "ImageName", INI::parseMappedImage, NULL, offsetof( ControlBarSchemeImage, m_image ) }, { "Layer", INI::parseInt, NULL, offsetof( ControlBarSchemeImage, m_layer ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; ControlBarSchemeImage *schemeImage = NEW ControlBarSchemeImage; @@ -890,7 +890,7 @@ void ControlBarSchemeManager::parseAnimatingPart(INI *ini, void *instance, void* { "Duration", INI::parseDurationUnsignedInt, NULL, offsetof( ControlBarSchemeAnimation, m_animDuration ) }, { "FinalPos", INI::parseICoord2D, NULL, offsetof( ControlBarSchemeAnimation, m_finalPos ) }, { "ImagePart", ControlBarSchemeManager::parseAnimatingPartImage, NULL, NULL }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; ControlBarSchemeAnimation *schemeAnim = NEW ControlBarSchemeAnimation; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp index 324d963c2af..0005a89d7d8 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp @@ -82,7 +82,7 @@ static const char *gadgetsToHide[] = "ButtonSelectMap", "ButtonStart", "StaticTextMapPreview", - NULL // keep this last + NULL }; static const char *perPlayerGadgetsToHide[] = { @@ -93,7 +93,7 @@ static const char *perPlayerGadgetsToHide[] = "ButtonAccept", "GenericPing", //"ButtonStartPosition", - NULL // keep this last + NULL }; static const char *qmlayoutFilename = "WOLQuickMatchMenu.wnd"; @@ -107,12 +107,12 @@ static const char *qmgadgetsToHide[] = "ButtonWiden", "ButtonStop", "ButtonStart", - NULL // keep this last + NULL }; static const char *qmperPlayerGadgetsToHide[] = { //"ButtonStartPosition", - NULL // keep this last + NULL }; static void showGameSpyGameOptionsUnderlyingGUIElements( Bool show ) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp index fdece71b255..3ac190c660f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp @@ -80,14 +80,14 @@ static const char *gadgetsToHide[] = "ButtonStart", "StaticTextMapPreview", - NULL // keep this last + NULL }; static const char *perPlayerGadgetsToHide[] = { "ComboBoxTeam", "ComboBoxColor", "ComboBoxPlayerTemplate", - NULL // keep this last + NULL }; static void showLANGameOptionsUnderlyingGUIElements( Bool show ) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp index c7f005347a7..50674634edd 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp @@ -88,7 +88,7 @@ enum DROPDOWN_LOADREPLAY, DROPDOWN_DIFFICULTY, - DROPDOWN_COUNT // keep last + DROPDOWN_COUNT }; static Bool raiseMessageBoxes = TRUE; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp index f6190b0978c..f154eb9e7bc 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp @@ -1847,7 +1847,8 @@ enum USA_ENEMY, // Keep friends with friends, enemys with enemys CHINA_ENEMY, GLA_ENEMY, - MAX_RELATIONS // keep me last + + MAX_RELATIONS }; /** Grab the single player info */ //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp index 7615ba4ae07..954509f710d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp @@ -1139,7 +1139,7 @@ static const char *gadgetsToHide[] = "StaticTextColor", "StaticTextTeam", "StaticTextFaction", - NULL // keep this last + NULL }; static const char *perPlayerGadgetsToHide[] = { @@ -1147,7 +1147,7 @@ static const char *perPlayerGadgetsToHide[] = "ComboBoxTeam", "ComboBoxColor", "ComboBoxPlayerTemplate", - NULL // keep this last + NULL }; //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp index 00d52c1ddae..7bcc84b10d4 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp @@ -98,7 +98,7 @@ static const char *gadgetsToHide[] = "ButtonStart", "StaticTextMapPreview", - NULL // keep this last + NULL }; static const char *perPlayerGadgetsToHide[] = { @@ -106,7 +106,7 @@ static const char *perPlayerGadgetsToHide[] = "ComboBoxColor", "ComboBoxPlayerTemplate", //"ButtonStartPosition", - NULL // keep this last + NULL }; void positionStartSpots( AsciiString mapName, GameWindow *buttonMapStartPositions[], GameWindow *mapWindow); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp index 3a86b422559..e530c52b515 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp @@ -65,7 +65,7 @@ const FieldParse GameWindowTransitionsHandler::m_gameWindowTransitionsFieldParse { "Window", GameWindowTransitionsHandler::parseWindow, NULL, NULL }, { "FireOnce", INI::parseBool, NULL, offsetof( TransitionGroup, m_fireOnce) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; @@ -574,7 +574,7 @@ void GameWindowTransitionsHandler::parseWindow( INI* ini, void *instance, void * { "WinName", INI::parseAsciiString, NULL, offsetof( TransitionWindow, m_winName ) }, { "Style", INI::parseLookupList, TransitionStyleNames, offsetof( TransitionWindow, m_style ) }, { "FrameDelay", INI::parseInt, NULL, offsetof( TransitionWindow, m_frameDelay ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; TransitionWindow *transWin = NEW TransitionWindow; ini->initFromINI(transWin, myFieldParse); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp index afdd5038e3f..b08e8a6d95f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp @@ -65,7 +65,7 @@ const FieldParse ShellMenuSchemeManager::m_shellMenuSchemeFieldParseTable[] = { "ImagePart", ShellMenuSchemeManager::parseImagePart, NULL, NULL }, { "LinePart", ShellMenuSchemeManager::parseLinePart, NULL, NULL }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; @@ -225,7 +225,7 @@ void ShellMenuSchemeManager::parseImagePart(INI *ini, void *instance, void* /*st { "Position", INI::parseICoord2D, NULL, offsetof( ShellMenuSchemeImage, m_position ) }, { "Size", INI::parseICoord2D, NULL, offsetof( ShellMenuSchemeImage, m_size ) }, { "ImageName", INI::parseMappedImage, NULL, offsetof( ShellMenuSchemeImage, m_image ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; ShellMenuSchemeImage *schemeImage = NEW ShellMenuSchemeImage; @@ -243,7 +243,7 @@ void ShellMenuSchemeManager::parseLinePart(INI *ini, void *instance, void* /*sto { "Color", INI::parseColorInt, NULL, offsetof( ShellMenuSchemeLine, m_color ) }, { "Width", INI::parseInt, NULL, offsetof( ShellMenuSchemeLine, m_width ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; ShellMenuSchemeLine *schemeLine = NEW ShellMenuSchemeLine; diff --git a/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp b/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp index 5111b6c0f63..68f47aacb15 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp @@ -91,7 +91,7 @@ static const FieldParse TheGlobalLanguageDataFieldParseTable[] = { "CreditsMinorTitleFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_creditsPositionFont) }, { "CreditsNormalFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_creditsNormalFont) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; //----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index 75d02e04c18..3441a0e4a4a 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -853,7 +853,7 @@ const FieldParse InGameUI::s_fieldParseTable[] = { "GameTimeColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_gameTimeColor ) }, { "GameTimeDropColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_gameTimeDropColor ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp index bf2093d78ee..a0cf8e4cd3f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp @@ -311,7 +311,7 @@ static const LookupListRec GameMessageMetaTypeNames[] = #endif//DUMP_PERF_STATS - { NULL, 0 }// keep this last! + { NULL, 0 } }; @@ -329,7 +329,7 @@ static const FieldParse TheMetaMapFieldParseTable[] = { "Description", INI::parseAndTranslateLabel, 0, offsetof( MetaMapRec, m_description ) }, { "DisplayName", INI::parseAndTranslateLabel, 0, offsetof( MetaMapRec, m_displayName ) }, - { NULL, NULL, 0, 0 } // keep this last + { NULL, NULL, 0, 0 } }; diff --git a/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp b/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp index 05842e14bd4..59866953438 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp @@ -72,7 +72,7 @@ const FieldParse CampaignManager::m_campaignFieldParseTable[] = { "CampaignNameLabel", INI::parseAsciiString, NULL, offsetof( Campaign, m_campaignNameLabel ) }, { "FinalVictoryMovie", INI::parseAsciiString, NULL, offsetof( Campaign, m_finalMovieName ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; @@ -366,7 +366,7 @@ void CampaignManager::parseMissionPart( INI* ini, void *instance, void *store, c { "VoiceLength", INI::parseInt , NULL, offsetof( Mission, m_voiceLength ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; AsciiString name; const char* c = ini->getNextToken(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp index 89cf29d84fa..5dae589d119 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp @@ -194,7 +194,7 @@ static const FieldParse TheAIFieldParseTable[] = - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; @@ -214,7 +214,7 @@ void AI::parseSideInfo(INI *ini, void *instance, void* /*store*/, const void* /* { "SkillSet3", AI::parseSkillSet, NULL, offsetof( AISideInfo, m_skillSet3 ) }, { "SkillSet4", AI::parseSkillSet, NULL, offsetof( AISideInfo, m_skillSet4 ) }, { "SkillSet5", AI::parseSkillSet, NULL, offsetof( AISideInfo, m_skillSet5 ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; AISideInfo *resourceInfo = ((TAiData*)instance)->m_sideInfo; @@ -239,7 +239,7 @@ void AI::parseSkillSet(INI *ini, void *instance, void* store, const void* /*user static const FieldParse myFieldParse[] = { { "Science", AI::parseScience, NULL, NULL }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; TSkillSet *skillset = ((TSkillSet*)store); @@ -278,7 +278,7 @@ void AI::parseSkirmishBuildList(INI *ini, void *instance, void* /*store*/, const static const FieldParse myFieldParse[] = { { "Structure", BuildListInfo::parseStructure, NULL, NULL }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; AISideBuildList *build = newInstance(AISideBuildList)(faction); diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp index 203557d9c55..7617b7f02c8 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp @@ -46,7 +46,7 @@ AIDockMachine::AIDockMachine( Object *obj ) : StateMachine( obj, "AIDockMachine" static const StateConditionInfo waitForClearanceConditions[] = { StateConditionInfo(ableToAdvance, AI_DOCK_ADVANCE_POSITION, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; // order matters: first state is the default state. diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp index 9fc2c2ea15f..07df4a59a49 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp @@ -169,7 +169,7 @@ AIGuardMachine::AIGuardMachine( Object *owner ) : static const StateConditionInfo attackAggressors[] = { StateConditionInfo(hasAttackedMeAndICanReturnFire, AI_GUARD_ATTACK_AGGRESSOR, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; // order matters: first state is the default state. diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 71345c48d94..2fe1fcf9695 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -268,7 +268,7 @@ AttackStateMachine::AttackStateMachine( Object *obj, AIAttackState* att, AsciiSt StateConditionInfo(outOfWeaponRangeObject, AttackStateMachine::CHASE_TARGET, NULL), StateConditionInfo(wantToSquishTarget, AttackStateMachine::CHASE_TARGET, NULL), StateConditionInfo(cannotPossiblyAttackObject, EXIT_MACHINE_WITH_FAILURE, (void*)ATTACK_CONTINUED_TARGET), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; // we want to use the CONTINUE mode (not NEW) since we already have acquired the target. @@ -277,7 +277,7 @@ AttackStateMachine::AttackStateMachine( Object *obj, AIAttackState* att, AsciiSt StateConditionInfo(outOfWeaponRangeObject, AttackStateMachine::CHASE_TARGET, NULL), StateConditionInfo(cannotPossiblyAttackObject, EXIT_MACHINE_WITH_FAILURE, (void*)ATTACK_CONTINUED_TARGET_FORCED), StateConditionInfo(wantToSquishTarget, AttackStateMachine::CHASE_TARGET, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; const StateConditionInfo* objectConditions = forceAttacking ? objectConditionsForced : objectConditionsNormal; @@ -285,7 +285,7 @@ AttackStateMachine::AttackStateMachine( Object *obj, AIAttackState* att, AsciiSt static const StateConditionInfo positionConditions[] = { StateConditionInfo(outOfWeaponRangePosition, AttackStateMachine::CHASE_TARGET, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; #ifdef STATE_MACHINE_DEBUG @@ -329,7 +329,7 @@ AttackStateMachine::AttackStateMachine( Object *obj, AIAttackState* att, AsciiSt static const StateConditionInfo portableStructureChaseConditions[] = { StateConditionInfo(inWeaponRangeObject, AttackStateMachine::AIM_AT_TARGET, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; /* we're a rider on a mobile object, so we can't control our motion. diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp index 19aa957d386..784609e8752 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp @@ -152,7 +152,7 @@ AITNGuardMachine::AITNGuardMachine( Object *owner ) : static const StateConditionInfo attackAggressors[] = { StateConditionInfo(hasAttackedMeAndICanReturnFire, AI_TN_GUARD_ATTACK_AGGRESSOR, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; // order matters: first state is the default state. diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp index 3f2447f0aec..6af9a825d8b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp @@ -86,7 +86,7 @@ TurretStateMachine::TurretStateMachine( TurretAI* tai, Object *obj, AsciiString static const StateConditionInfo fireConditions[] = { StateConditionInfo(outOfWeaponRangeObject, TURRETAI_AIM, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; // order matters: first state is the default state. diff --git a/Generals/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp b/Generals/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp index 1385c48fa23..b391a031db9 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp @@ -963,7 +963,7 @@ void BuildListInfo::parseStructure(INI *ini, void *instance, void* /*store*/, co { "InitiallyBuilt", INI::parseBool, NULL, offsetof( BuildListInfo, m_isInitiallyBuilt ) }, { "RallyPointOffset", INI::parseCoord2D, NULL, offsetof( BuildListInfo, m_rallyPointOffset ) }, { "AutomaticallyBuild", INI::parseBool, NULL, offsetof( BuildListInfo, m_automaticallyBuild ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; BuildListInfo *buildInfo = newInstance( BuildListInfo ); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp index 668c5aab0b4..d53f56d7ae8 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp @@ -488,7 +488,7 @@ const FieldParse* LocomotorTemplate::getFieldParse() const { "WanderLengthFactor", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_wanderLengthFactor) }, { "WanderAboutPointRadius", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_wanderAboutPointRadius) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; return TheFieldParse; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp index 98407f71c09..5f280a2c19f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp @@ -1418,7 +1418,7 @@ static const FieldParse TheObjectCreationListFieldParse[] = { "DeliverPayload", DeliverPayloadNugget::parse, 0, 0}, { "FireWeapon", FireWeaponNugget::parse, 0, 0}, { "Attack", AttackNugget::parse, 0, 0}, - { NULL, NULL, 0, 0 } // keep this last + { NULL, NULL, 0, 0 } }; //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp index 24452fce436..cde0ed97349 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp @@ -508,7 +508,7 @@ DeliverPayloadStateMachine::DeliverPayloadStateMachine( Object *owner ) : StateM static const StateConditionInfo considerConditions[] = { StateConditionInfo(DeliverPayloadStateMachine::isOffMap, RECOVER_FROM_OFF_MAP, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; // order matters: first state is the default state. diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp index cefe2f6a269..651fce9d04b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp @@ -1276,7 +1276,7 @@ DozerPrimaryStateMachine::DozerPrimaryStateMachine( Object *owner ) : StateMachi StateConditionInfo(isBuildMostImportant, DOZER_PRIMARY_BUILD, NULL), StateConditionInfo(isRepairMostImportant, DOZER_PRIMARY_REPAIR, NULL), StateConditionInfo(isFortifyMostImportant, DOZER_PRIMARY_FORTIFY, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; // order matters: first state is the default state. diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp index edcec017f36..dc1dcd8e665 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp @@ -390,7 +390,7 @@ SupplyTruckStateMachine::SupplyTruckStateMachine( Object *owner ) : StateMachine { StateConditionInfo(ownerIdle, ST_IDLE, NULL), StateConditionInfo(ownerDocking, ST_DOCKING, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; static const StateConditionInfo idleConditions[] = @@ -399,21 +399,21 @@ SupplyTruckStateMachine::SupplyTruckStateMachine( Object *owner ) : StateMachine StateConditionInfo(isForcedIntoWantingState, ST_WANTING, NULL), StateConditionInfo(ownerDocking, ST_DOCKING, NULL), StateConditionInfo(ownerNotDockingOrIdle, ST_BUSY, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; static const StateConditionInfo wantingConditions[] = { StateConditionInfo(ownerDocking, ST_DOCKING, NULL), StateConditionInfo(ownerNotDockingOrIdle, ST_BUSY, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; static const StateConditionInfo regroupingConditions[] = { StateConditionInfo(ownerIdle, ST_IDLE, NULL), StateConditionInfo(ownerDocking, ST_DOCKING, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; static const StateConditionInfo dockingConditions[] = @@ -421,7 +421,7 @@ SupplyTruckStateMachine::SupplyTruckStateMachine( Object *owner ) : StateMachine StateConditionInfo(isForcedIntoBusyState, ST_BUSY, NULL), StateConditionInfo(ownerAvailableForSupplying, ST_WANTING, NULL), StateConditionInfo(ownerNotDockingOrIdle, ST_BUSY, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; // order matters: first state is the default state. diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp index 96ebaa8fbb4..ded6e80c545 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp @@ -1172,13 +1172,13 @@ WorkerStateMachine::WorkerStateMachine( Object *owner ) : StateMachine( owner, " static const StateConditionInfo asDozerConditions[] = { StateConditionInfo(supplyTruckSubMachineWantsToEnter, AS_SUPPLY_TRUCK, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; static const StateConditionInfo asTruckConditions[] = { StateConditionInfo(supplyTruckSubMachineReadyToLeave, AS_DOZER, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; // order matters: first state is the default state. diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index 19c4e9d2c0f..2eedfb79bb0 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -232,7 +232,7 @@ const FieldParse WeaponTemplate::TheWeaponTemplateFieldParseTable[] = { "PreAttackType", INI::parseIndexList, TheWeaponPrefireNames, offsetof(WeaponTemplate, m_prefireType) }, { "ContinueAttackRange", INI::parseReal, NULL, offsetof(WeaponTemplate, m_continueAttackRange) }, { "SuspendFXDelay", INI::parseDurationUnsignedInt, NULL, offsetof(WeaponTemplate, m_suspendFXDelay) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp index b89fe781912..6b064ed7739 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp @@ -185,7 +185,7 @@ const FieldParse CrateTemplate::TheCrateTemplateFieldParseTable[] = { "CrateObject", CrateTemplate::parseCrateCreationEntry, NULL, NULL }, { "KillerScience", INI::parseScience, NULL, offsetof( CrateTemplate, m_killerScience) }, { "OwnedByMaker", INI::parseBool, NULL, offsetof( CrateTemplate, m_isOwnedByMaker) }, - { NULL, NULL, NULL, NULL }, // keep this last! + { NULL, NULL, NULL, NULL }, }; CrateTemplate::CrateTemplate() diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp index deb518bd9e8..355270f39ab 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp @@ -70,7 +70,7 @@ static const FieldParse GameSpyColorFieldParse[] = { "MOTD", INI::parseColorInt, NULL, OFFSET(GSCOLOR_MOTD) }, { "MOTDHeading", INI::parseColorInt, NULL, OFFSET(GSCOLOR_MOTD_HEADING) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/shader.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/shader.h index b1587c333c3..d04ad8dad4a 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/shader.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/shader.h @@ -158,7 +158,8 @@ class ShaderClass DSTBLEND_ONE_MINUS_SRC_COLOR, // destination pixel multiplied by one minus (i.e. inverse) fragment RGB components DSTBLEND_SRC_ALPHA, // destination pixel multiplied by fragment alpha component DSTBLEND_ONE_MINUS_SRC_ALPHA, // destination pixel multiplied by fragment inverse alpha - DSTBLEND_MAX // end of enumeration + + DSTBLEND_MAX }; enum FogFuncType @@ -191,7 +192,8 @@ class ShaderClass SRCBLEND_ONE, // fragment added unmodified to color buffer (default) SRCBLEND_SRC_ALPHA, // fragment RGB components multiplied by fragment A SRCBLEND_ONE_MINUS_SRC_ALPHA, // fragment RGB components multiplied by fragment inverse (one minus) A - SRCBLEND_MAX // end of enumeration + + SRCBLEND_MAX }; enum TexturingType diff --git a/Generals/Code/Tools/GUIEdit/Include/GUIEdit.h b/Generals/Code/Tools/GUIEdit/Include/GUIEdit.h index 26df9a8fad1..46dd674c10a 100644 --- a/Generals/Code/Tools/GUIEdit/Include/GUIEdit.h +++ b/Generals/Code/Tools/GUIEdit/Include/GUIEdit.h @@ -84,7 +84,7 @@ typedef enum STATUS_PART4, /// change to meaningful name when decided what goes here STATUS_MOUSE_COORDS, - STATUS_NUM_PARTS ///< keep this last! + STATUS_NUM_PARTS } StatusPart; diff --git a/Generals/Code/Tools/GUIEdit/Include/Properties.h b/Generals/Code/Tools/GUIEdit/Include/Properties.h index cf1048e00ee..4f93364dd48 100644 --- a/Generals/Code/Tools/GUIEdit/Include/Properties.h +++ b/Generals/Code/Tools/GUIEdit/Include/Properties.h @@ -347,7 +347,7 @@ typedef enum GENERIC_DISABLED, GENERIC_HILITE, - NUM_STATE_IDENTIFIERS // keep this last + NUM_STATE_IDENTIFIERS } StateIdentifier; diff --git a/Generals/Code/Tools/GUIEdit/Source/Properties.cpp b/Generals/Code/Tools/GUIEdit/Source/Properties.cpp index 734dc780ca0..94e1d068e2f 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Properties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Properties.cpp @@ -95,7 +95,7 @@ ColorControl colorControlTable[] = { BUTTON_COLOR, 0, }, { BUTTON_BORDER_COLOR, 0 }, - { 0, { 0, 0, 0, 0 } } // keep this last! + { 0, { 0, 0, 0, 0 } } }; ImageAndColorInfo imageAndColorTable[] = @@ -373,7 +373,7 @@ ImageAndColorInfo imageAndColorTable[] = { GWS_USER_WINDOW, GENERIC_DISABLED, "[User]Disabled Surface", NULL, 0, 0 }, { GWS_USER_WINDOW, GENERIC_HILITE, "[User]Hilite Surface", NULL, 0, 0 }, - { 0, IDENTIFIER_INVALID, NULL, NULL, 0, 0 } // keep this last! + { 0, IDENTIFIER_INVALID, NULL, NULL, 0, 0 } }; diff --git a/Generals/Code/Tools/ParticleEditor/ParticleEditorExport.h b/Generals/Code/Tools/ParticleEditor/ParticleEditorExport.h index 8fbf7391cd7..dfcaf5fef4d 100644 --- a/Generals/Code/Tools/ParticleEditor/ParticleEditorExport.h +++ b/Generals/Code/Tools/ParticleEditor/ParticleEditorExport.h @@ -47,9 +47,8 @@ extern "C" { # define PARM_ParticleTypeName 0x00 # define PARM_SlaveSystemName 0x01 # define PARM_AttachedSystemName 0x02 +# define PARM_NumParms 0x03 -// Keep this one last -# define PARM_NumParms 0x03 // parmNum can be exactly one of the above defines (PARM_*) void __declspec(dllexport) GetSelectedParticleAsciiStringParm( int parmNum, char *bufferToCopyInto, ParticleSystemTemplate **whichTemplate ); void __declspec(dllexport) UpdateParticleAsciiStringParm( int parmNum, const char *bufferToCopyFrom, ParticleSystemTemplate **whichTemplate ); diff --git a/GeneralsMD/Code/GameEngine/Include/Common/FunctionLexicon.h b/GeneralsMD/Code/GameEngine/Include/Common/FunctionLexicon.h index ad3b0aeb7da..9f03292d6ff 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/FunctionLexicon.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/FunctionLexicon.h @@ -68,7 +68,7 @@ class FunctionLexicon : public SubsystemInterface TABLE_WIN_LAYOUT_UPDATE, TABLE_WIN_LAYOUT_SHUTDOWN, - MAX_FUNCTION_TABLES // keep this last + MAX_FUNCTION_TABLES }; public: diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameType.h b/GeneralsMD/Code/GameEngine/Include/Common/GameType.h index ec51ded6144..b84aabf1198 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GameType.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GameType.h @@ -74,7 +74,7 @@ enum TimeOfDay CPP_11(: Int) TIME_OF_DAY_EVENING, TIME_OF_DAY_NIGHT, - TIME_OF_DAY_COUNT // keep this last + TIME_OF_DAY_COUNT }; extern const char *TimeOfDayNames[]; @@ -86,7 +86,7 @@ enum Weather CPP_11(: Int) WEATHER_NORMAL = 0, WEATHER_SNOWY = 1, - WEATHER_COUNT // keep this last + WEATHER_COUNT }; extern const char *WeatherNames[]; @@ -176,7 +176,7 @@ enum WeaponSlotType CPP_11(: Int) SECONDARY_WEAPON, TERTIARY_WEAPON, - WEAPONSLOT_COUNT // keep last + WEAPONSLOT_COUNT }; //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Geometry.h b/GeneralsMD/Code/GameEngine/Include/Common/Geometry.h index 75a9bd00f6f..a0c27f8b0c0 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Geometry.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Geometry.h @@ -52,7 +52,7 @@ enum GeometryType CPP_11(: Int) GEOMETRY_CYLINDER, ///< partition/collision testing as cylinder. (majorRadius = radius, height = height) GEOMETRY_BOX, ///< partition/collision testing as rectangular box (majorRadius = half len in forward dir; minorRadius = half len in side dir; height = height) - GEOMETRY_NUM_TYPES, // keep this last + GEOMETRY_NUM_TYPES, GEOMETRY_FIRST = GEOMETRY_SPHERE }; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ModelState.h b/GeneralsMD/Code/GameEngine/Include/Common/ModelState.h index 681fbbc4dd1..429b605833e 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/ModelState.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/ModelState.h @@ -242,7 +242,7 @@ enum ModelConditionFlagType CPP_11(: Int) // existing values! // - MODELCONDITION_COUNT // keep last! + MODELCONDITION_COUNT }; //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Module.h b/GeneralsMD/Code/GameEngine/Include/Common/Module.h index 3c9a921edfb..3cbe964276b 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Module.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Module.h @@ -70,7 +70,7 @@ enum ModuleType CPP_11(: Int) MODULETYPE_CLIENT_UPDATE = 2, // put new drawable module types here - NUM_MODULE_TYPES, // keep this last! + NUM_MODULE_TYPES, FIRST_DRAWABLE_MODULE_TYPE = MODULETYPE_DRAW, LAST_DRAWABLE_MODULE_TYPE = MODULETYPE_CLIENT_UPDATE, diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Radar.h b/GeneralsMD/Code/GameEngine/Include/Common/Radar.h index dcb35d78090..321234598c9 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Radar.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Radar.h @@ -76,7 +76,7 @@ enum RadarEventType CPP_11(: Int) RADAR_EVENT_FAKE, //Internally creates a radar event, but doesn't notify the player (unit lost //for example, so we can use the spacebar to jump to the event). - RADAR_EVENT_NUM_EVENTS // keep this last + RADAR_EVENT_NUM_EVENTS }; @@ -142,7 +142,7 @@ enum RadarPriorityType CPP_11(: Int) RADAR_PRIORITY_UNIT, // unit level drawing priority RADAR_PRIORITY_LOCAL_UNIT_ONLY, // unit priority, but only on the radar if controlled by the local player - RADAR_PRIORITY_NUM_PRIORITIES // keep this last + RADAR_PRIORITY_NUM_PRIORITIES }; #ifdef DEFINE_RADAR_PRIORITY_NAMES static const char *RadarPriorityNames[] = @@ -153,7 +153,7 @@ static const char *RadarPriorityNames[] = "UNIT", // unit level drawing priority "LOCAL_UNIT_ONLY", // unit priority, but only on the radar if controlled by the local player - NULL // keep this last + NULL }; #endif // DEFINE_RADAR_PRIOTITY_NAMES diff --git a/GeneralsMD/Code/GameEngine/Include/Common/TerrainTypes.h b/GeneralsMD/Code/GameEngine/Include/Common/TerrainTypes.h index f2691ede38f..278abf53404 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/TerrainTypes.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/TerrainTypes.h @@ -89,8 +89,7 @@ typedef enum TERRAIN_ACCENT_ROCK, TERRAIN_URBAN, - - TERRAIN_NUM_CLASSES // keep this last + TERRAIN_NUM_CLASSES } TerrainClass; #ifdef DEFINE_TERRAIN_TYPE_NAMES diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ThingSort.h b/GeneralsMD/Code/GameEngine/Include/Common/ThingSort.h index 7de70b1c674..4950819a7df 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/ThingSort.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/ThingSort.h @@ -52,7 +52,7 @@ enum EditorSortingType CPP_11(: Int) ES_ROAD, // road objects...should never actually be in the object panel. ES_WAYPOINT, // waypoint objects...should never actually be in the object panel. - ES_NUM_SORTING_TYPES // keep this last + ES_NUM_SORTING_TYPES }; #ifdef DEFINE_EDITOR_SORTING_NAMES diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h b/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h index 27d5af94a2e..f8c8ec22d8b 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h @@ -82,7 +82,7 @@ typedef std::map PerUnitFXMap; // INV_IMAGE_HILITE, // INV_IMAGE_PUSHED, // -// INV_IMAGE_NUM_IMAGES // keep this last +// INV_IMAGE_NUM_IMAGES // //}; //------------------------------------------------------------------------------------------------- @@ -137,7 +137,7 @@ enum ThingTemplateAudioType CPP_11(: Int) TTAUDIO_voiceAttackAir, ///< Unit is ordered to attack an airborne unit TTAUDIO_voiceGuard, ///< Unit is ordered to guard an area - TTAUDIO_COUNT // keep last! + TTAUDIO_COUNT }; class AudioArray @@ -200,7 +200,7 @@ enum BuildCompletionType CPP_11(: Int) BC_APPEARS_AT_RALLY_POINT, ///< unit appears at rally point of its #1 prereq BC_PLACED_BY_PLAYER, ///< unit must be manually placed by player - BC_NUM_TYPES // leave this last + BC_NUM_TYPES }; #ifdef DEFINE_BUILD_COMPLETION_NAMES static const char *BuildCompletionNames[] = @@ -221,7 +221,7 @@ enum BuildableStatus CPP_11(: Int) BSTATUS_NO, BSTATUS_ONLY_BY_AI, - BSTATUS_NUM_TYPES // leave this last + BSTATUS_NUM_TYPES }; #ifdef DEFINE_BUILDABLE_STATUS_NAMES diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Upgrade.h b/GeneralsMD/Code/GameEngine/Include/Common/Upgrade.h index cc07055c377..c7bb5c2981f 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Upgrade.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Upgrade.h @@ -150,7 +150,7 @@ enum UpgradeType CPP_11(: Int) UPGRADE_TYPE_PLAYER = 0, // upgrade applies to a player as a whole UPGRADE_TYPE_OBJECT, // upgrade applies to an object instance only - NUM_UPGRADE_TYPES, // keep this last + NUM_UPGRADE_TYPES }; extern const char *TheUpgradeTypeNames[]; //Change above, change this! diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h index 3ee9dbfa437..91d4a2985d2 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h @@ -52,7 +52,7 @@ enum Anim2DMode CPP_11(: Int) ANIM_2D_PING_PONG_BACKWARDS, // dont' forget to add new animation mode names to Anim2DModeNames[] below - ANIM_2D_NUM_MODES // keep this last please + ANIM_2D_NUM_MODES }; #ifdef DEFINE_ANIM_2D_MODE_NAMES diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h index 6ce6b31fd95..dbc8dc48b1d 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h @@ -103,7 +103,7 @@ enum CommandOption CPP_11(: Int) CAN_USE_WAYPOINTS = 0x00400000, // button has option to use a waypoint path MUST_BE_STOPPED = 0x00800000, // Unit must be stopped in order to be able to use button. - NUM_COMMAND_OPTIONS // keep this last + NUM_COMMAND_OPTIONS }; #ifdef DEFINE_COMMAND_OPTION_NAMES @@ -218,7 +218,7 @@ enum GUICommandType CPP_11(: Int) // add more commands here, don't forget to update the string command list below too ... - GUI_COMMAND_NUM_COMMANDS // keep this last + GUI_COMMAND_NUM_COMMANDS }; #ifdef DEFINE_GUI_COMMMAND_NAMES @@ -278,7 +278,7 @@ enum CommandButtonMappedBorderType CPP_11(: Int) COMMAND_BUTTON_BORDER_ACTION, COMMAND_BUTTON_BORDER_SYSTEM, - COMMAND_BUTTON_BORDER_COUNT // keep this last + COMMAND_BUTTON_BORDER_COUNT }; static const LookupListRec CommandButtonMappedBorderTypeNames[] = @@ -289,7 +289,7 @@ static const LookupListRec CommandButtonMappedBorderTypeNames[] = { "ACTION", COMMAND_BUTTON_BORDER_ACTION }, { "SYSTEM", COMMAND_BUTTON_BORDER_SYSTEM }, - { NULL, 0 }// keep this last! + { NULL, 0 } }; //------------------------------------------------------------------------------------------------- /** Command buttons are used to load the buttons we place on throughout the command bar diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Credits.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Credits.h index b095f525b28..2c1524bdbf0 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Credits.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Credits.h @@ -71,7 +71,8 @@ CREDIT_STYLE_POSITION, CREDIT_STYLE_NORMAL, CREDIT_STYLE_COLUMN, CREDIT_STYLE_BLANK, ///< Keep this second to last -MAX_CREDIT_STYLES ///< Keep this last + +MAX_CREDIT_STYLES }; enum{ CREDIT_SPACE_OFFSET = 2 }; @@ -83,7 +84,7 @@ static const LookupListRec CreditStyleNames[] = { "NORMAL", CREDIT_STYLE_NORMAL }, { "COLUMN", CREDIT_STYLE_COLUMN }, - { NULL, 0 }// keep this last! + { NULL, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h index d922060b405..5f17f3ebc60 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h @@ -103,7 +103,7 @@ enum DrawableIconType CPP_11(: Int) ICON_ENTHUSIASTIC_SUBLIMINAL, ICON_CARBOMB, - MAX_ICONS ///< keep this last + MAX_ICONS }; //----------------------------------------------------------------------------- @@ -271,7 +271,7 @@ enum TerrainDecalType CPP_11(: Int) TERRAIN_DECAL_NONE, TERRAIN_DECAL_SHADOW_TEXTURE, //use the shadow texture as the terrain decal. - TERRAIN_DECAL_MAX ///< keep this last + TERRAIN_DECAL_MAX }; //----------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowTransitions.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowTransitions.h index f8336f0d085..9987eafc50f 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowTransitions.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowTransitions.h @@ -84,7 +84,7 @@ CONTROL_BAR_ARROW_TRANSITION, SCORE_SCALE_UP_TRANSITION, REVERSE_SOUND_TRANSITION, -MAX_TRANSITION_WINDOW_STYLES ///< Keep this last +MAX_TRANSITION_WINDOW_STYLES }; static const LookupListRec TransitionStyleNames[] = @@ -104,10 +104,7 @@ static const LookupListRec TransitionStyleNames[] = { "CONTROLBARARROW", CONTROL_BAR_ARROW_TRANSITION }, { "SCORESCALEUP", SCORE_SCALE_UP_TRANSITION }, { "REVERSESOUND", REVERSE_SOUND_TRANSITION }, - - - - { NULL, 0 }// keep this last! + { NULL, 0 } }; // base class for the transitions diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h index 4e9c28d4581..70dc784e80f 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h @@ -104,7 +104,7 @@ enum RadiusCursorType CPP_11(: Int) RADIUSCURSOR_AMBULANCE, - RADIUSCURSOR_COUNT // keep last + RADIUSCURSOR_COUNT }; #ifdef DEFINE_RADIUSCURSOR_NAMES @@ -360,7 +360,6 @@ friend class Drawable; // for selection/deselection transactions ACTIONTYPE_COMBATDROP_INTO, ACTIONTYPE_SABOTAGE_BUILDING, - //Keep last. NUM_ACTIONTYPES }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h b/GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h index 4095fdde770..227b3d2471a 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h @@ -44,7 +44,8 @@ enum MappableKeyCategories CPP_11(: Int) CATEGORY_TEAM, CATEGORY_MISC, CATEGORY_DEBUG, - CATEGORY_NUM_CATEGORIES // keep this last + + CATEGORY_NUM_CATEGORIES }; static const LookupListRec CategoryListName[] = @@ -57,7 +58,7 @@ static const LookupListRec CategoryListName[] = {"TEAM", CATEGORY_TEAM}, {"MISC", CATEGORY_MISC}, {"DEBUG", CATEGORY_DEBUG}, - {NULL, 0}// keep this last + {NULL, 0} }; @@ -260,7 +261,7 @@ static const LookupListRec KeyNames[] = { "KEY_INS", MK_INS }, { "KEY_DEL", MK_DEL }, { "KEY_NONE", MK_NONE }, - { NULL, 0 } // keep this last! + { NULL, 0 } }; // ------------------------------------------------------------------------------- @@ -276,7 +277,7 @@ static const LookupListRec TransitionNames[] = { "DOWN", DOWN }, { "UP", UP }, { "DOUBLEDOWN", DOUBLEDOWN }, - { NULL, 0 }// keep this last! + { NULL, 0 } }; // ------------------------------------------------------------------------------- @@ -303,7 +304,7 @@ static const LookupListRec ModifierNames[] = { "SHIFT_CTRL", SHIFT_CTRL }, { "SHIFT_ALT", SHIFT_ALT }, { "SHIFT_ALT_CTRL" , SHIFT_ALT_CTRL }, - { NULL, 0 }// keep this last! + { NULL, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h index 0571e81bdbf..0d859a5899b 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h @@ -249,7 +249,7 @@ class Mouse : public SubsystemInterface // ***** dont forget to update CursorININames[] ***** - NUM_MOUSE_CURSORS // keep this last + NUM_MOUSE_CURSORS }; @@ -261,7 +261,7 @@ class Mouse : public SubsystemInterface RM_POLYGON, //alpha blended polygon tied to frame rate. RM_DX8, //hardware cursor independent of frame rate. - RM_MAX // keep this last. + RM_MAX }; static const char *const CursorCaptureBlockReasonNames[]; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h index f32d3a5fcd8..62c808aa149 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h @@ -108,7 +108,7 @@ enum ParticlePriorityType CPP_11(: Int) ALWAYS_RENDER, ///< used for logically important display (not just fluff), so must never be culled, regardless of particle cap, lod, etc // !!! *Noting* goes here ... special is the top priority !!! PARTICLE_PRIORITY_HIGHEST = ALWAYS_RENDER, - NUM_PARTICLE_PRIORITIES ///< Keep this last + NUM_PARTICLE_PRIORITIES }; /** diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ShellHooks.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ShellHooks.h index c60009011f1..b29f51cdd14 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ShellHooks.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ShellHooks.h @@ -77,7 +77,7 @@ enum SHELL_SCRIPT_HOOK_LAN_CLOSED, SHELL_SCRIPT_HOOK_LAN_ENTERED_FROM_GAME, - SHELL_SCRIPT_HOOK_TOTAL // Keep this guy last! + SHELL_SCRIPT_HOOK_TOTAL }; extern const char *TheShellHookNames[]; ///< Contains a list of the text representation of the shell hooks Used in WorldBuilder and in the shell. diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/TerrainRoads.h b/GeneralsMD/Code/GameEngine/Include/GameClient/TerrainRoads.h index 39cfa5cf615..2824953e3c3 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/TerrainRoads.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/TerrainRoads.h @@ -52,7 +52,8 @@ enum BridgeTowerType CPP_11(: Int) BRIDGE_TOWER_FROM_RIGHT, BRIDGE_TOWER_TO_LEFT, BRIDGE_TOWER_TO_RIGHT, - BRIDGE_MAX_TOWERS ///< keep this last + + BRIDGE_MAX_TOWERS }; // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/TerrainVisual.h b/GeneralsMD/Code/GameEngine/Include/GameClient/TerrainVisual.h index 35db966f9c2..7ff72cf8879 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/TerrainVisual.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/TerrainVisual.h @@ -183,7 +183,7 @@ typedef enum _TerrainLOD CPP_11(: Int) TERRAIN_LOD_AUTOMATIC = 8, TERRAIN_LOD_DISABLE = 9, - TERRAIN_LOD_NUM_TYPES // keep this last + TERRAIN_LOD_NUM_TYPES } TerrainLOD; #ifdef DEFINE_TERRAIN_LOD_NAMES diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/ArmorSet.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/ArmorSet.h index 3dfe088eabb..88896774e06 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/ArmorSet.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/ArmorSet.h @@ -55,7 +55,7 @@ enum ArmorSetType CPP_11(: Int) ARMORSET_CRATE_UPGRADE_ONE, ///< Just like weaponset type from salvage. ARMORSET_CRATE_UPGRADE_TWO, - ARMORSET_COUNT ///< keep last, please + ARMORSET_COUNT }; //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Damage.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Damage.h index 7b13dde4b06..f43f184fc8f 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Damage.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Damage.h @@ -90,7 +90,7 @@ enum DamageType CPP_11(: Int) // Please note: There is a string array DamageTypeFlags::s_bitNameList[] - DAMAGE_NUM_TYPES // keep this last + DAMAGE_NUM_TYPES }; //------------------------------------------------------------------------------------------------- @@ -195,7 +195,7 @@ enum DeathType CPP_11(: Int) DEATH_EXTRA_8 = 19, DEATH_POISONED_GAMMA = 20, - DEATH_NUM_TYPES // keep this last + DEATH_NUM_TYPES }; #ifdef DEFINE_DEATH_NAMES diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h index 1b951c74643..cf8b812e5ef 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h @@ -84,7 +84,7 @@ enum LocomotorSetType CPP_11(: Int) LOCOMOTORSET_SUPERSONIC, // set used for high-speed attacks LOCOMOTORSET_SLUGGISH, // set used for abnormally slow (but not damaged) speeds - LOCOMOTORSET_COUNT ///< keep last, please + LOCOMOTORSET_COUNT }; //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h index 2d3b77cf721..f7fd288321b 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h @@ -76,7 +76,7 @@ enum DozerTask CPP_11(: Int) // These enums are saved in the game save file, so DOZER_TASK_REPAIR = 1, ///< go repair something DOZER_TASK_FORTIFY = 2, ///< go fortify something - DOZER_NUM_TASKS // keep this last + DOZER_NUM_TASKS }; // ------------------------------------------------------------------------------------------------ @@ -86,7 +86,8 @@ enum DozerDockPoint CPP_11(: Int) // These enums are saved in the game save fil DOZER_DOCK_POINT_START = 0, DOZER_DOCK_POINT_ACTION = 1, DOZER_DOCK_POINT_END = 2, - DOZER_NUM_DOCK_POINTS // keep this one last + + DOZER_NUM_DOCK_POINTS }; // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h index cb880cc8acb..09f21a875a3 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h @@ -225,7 +225,7 @@ class GarrisonContain : public OpenContain GARRISON_POINT_DAMAGED, GARRISON_POINT_REALLY_DAMAGED, - MAX_GARRISON_POINT_CONDITIONS ///< leave this last + MAX_GARRISON_POINT_CONDITIONS }; Team * m_originalTeam; ///< our original team before we were garrisoned diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/NeutronMissileSlowDeathUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/NeutronMissileSlowDeathUpdate.h index deed7e66bbe..d4daabf77cb 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/NeutronMissileSlowDeathUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/NeutronMissileSlowDeathUpdate.h @@ -51,7 +51,7 @@ enum NeutronBlast CPP_11(: Int) NEUTRON_BLAST_8, NEUTRON_BLAST_9, - MAX_NEUTRON_BLASTS // keep this last + MAX_NEUTRON_BLASTS }; // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h index 2fad1d51a4d..4ea28436605 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h @@ -54,7 +54,7 @@ enum SlowDeathPhaseType CPP_11(: Int) SDPHASE_MIDPOINT, SDPHASE_FINAL, - SD_PHASE_COUNT // keep last + SD_PHASE_COUNT }; #ifdef DEFINE_SLOWDEATHPHASE_NAMES diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StructureCollapseUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StructureCollapseUpdate.h index 7d09bdfc203..c2a10328c4a 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StructureCollapseUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StructureCollapseUpdate.h @@ -53,7 +53,7 @@ enum StructureCollapsePhaseType CPP_11(: Int) SCPHASE_BURST, SCPHASE_FINAL, - SC_PHASE_COUNT // keep last + SC_PHASE_COUNT }; //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h index 4ed501bb881..1155b5f2d48 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h @@ -70,7 +70,7 @@ enum StructureTopplePhaseType CPP_11(: Int) STPHASE_DELAY, STPHASE_FINAL, - ST_PHASE_COUNT // keep last + ST_PHASE_COUNT }; static const char *TheStructureTopplePhaseNames[] = diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h index ca620fb298a..88b19bfc93f 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h @@ -266,7 +266,7 @@ class WeaponBonus RATE_OF_FIRE, PRE_ATTACK, - FIELD_COUNT // keep last + FIELD_COUNT }; WeaponBonus() diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/WeaponSet.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/WeaponSet.h index c278a9a6fef..eec67045ce3 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/WeaponSet.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/WeaponSet.h @@ -69,7 +69,7 @@ static const LookupListRec TheWeaponSlotTypeNamesLookupList[] = { "SECONDARY", SECONDARY_WEAPON }, { "TERTIARY", TERTIARY_WEAPON }, - { NULL, 0 }// keep this last! + { NULL, 0 } }; #endif diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/WeaponSetType.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/WeaponSetType.h index 95e7f051b56..aff5c34954c 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/WeaponSetType.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/WeaponSetType.h @@ -59,7 +59,7 @@ enum WeaponSetType CPP_11(: Int) WEAPONSET_RIDER7, WEAPONSET_RIDER8, - WEAPONSET_COUNT ///< keep last, please + WEAPONSET_COUNT }; #endif /* __WEAPONSETTYPE_H__ */ diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/WeaponStatus.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/WeaponStatus.h index 9a4b80e5114..8bfe60cca83 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/WeaponStatus.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/WeaponStatus.h @@ -38,7 +38,7 @@ enum WeaponStatus CPP_11(: Int) RELOADING_CLIP, PRE_ATTACK, - WEAPON_STATUS_COUNT // keep last + WEAPON_STATUS_COUNT }; #endif /* __WEAPONSTATUS_H__ */ diff --git a/GeneralsMD/Code/GameEngine/Include/GameNetwork/RankPointValue.h b/GeneralsMD/Code/GameEngine/Include/GameNetwork/RankPointValue.h index b0574ced38c..f24b6d8aa1c 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameNetwork/RankPointValue.h +++ b/GeneralsMD/Code/GameEngine/Include/GameNetwork/RankPointValue.h @@ -77,7 +77,7 @@ enum RANK_GENERAL, RANK_COMMANDER_IN_CHIEF, - MAX_RANKS // keep last + MAX_RANKS }; struct RankPoints diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp index bc293fa0ee4..bf41e41c1c7 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp @@ -523,7 +523,7 @@ GlobalData* GlobalData::m_theOriginal = NULL; { "ExtraLogging", INI::parseBool, NULL, offsetof( GlobalData, m_extraLogging ) }, #endif - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp index 23114c66752..f0f940f1dd6 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp @@ -141,7 +141,7 @@ static const BlockParse theTypeTable[] = { "ScriptAction", ScriptEngine::parseScriptAction }, { "ScriptCondition", ScriptEngine::parseScriptCondition }, - { NULL, NULL }, // keep this last! + { NULL, NULL }, }; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMapCache.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMapCache.cpp index f9b508928c9..a1ed70d6b8a 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMapCache.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMapCache.cpp @@ -110,7 +110,7 @@ const FieldParse MapMetaDataReader::m_mapFieldParseTable[] = { "InitialCameraPosition", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_initialCameraPosition ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp index dd10ef26d47..4931e6a93ae 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp @@ -90,7 +90,7 @@ namespace { { "Value", Money::parseMoneyAmount, NULL, offsetof( MultiplayerStartingMoneySettings, money ) }, { "Default", INI::parseBool, NULL, offsetof( MultiplayerStartingMoneySettings, isDefault ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/MultiplayerSettings.cpp b/GeneralsMD/Code/GameEngine/Source/Common/MultiplayerSettings.cpp index 98d64cea3aa..f8f99b44e4c 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/MultiplayerSettings.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/MultiplayerSettings.cpp @@ -49,7 +49,7 @@ const FieldParse MultiplayerColorDefinition::m_colorFieldParseTable[] = { "TooltipName", INI::parseAsciiString, NULL, offsetof( MultiplayerColorDefinition, m_tooltipName ) }, { "RGBColor", INI::parseRGBColor, NULL, offsetof( MultiplayerColorDefinition, m_rgbValue ) }, { "RGBNightColor", INI::parseRGBColor, NULL, offsetof( MultiplayerColorDefinition, m_rgbValueNight ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; @@ -63,7 +63,7 @@ const FieldParse MultiplayerSettings::m_multiplayerSettingsFieldParseTable[] = { "ShowRandomStartPos", INI::parseBool, NULL, offsetof( MultiplayerSettings, m_showRandomStartPos ) }, { "ShowRandomColor", INI::parseBool, NULL, offsetof( MultiplayerSettings, m_showRandomColor ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp index 22a61ce66f7..6b1b504d145 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp @@ -203,7 +203,7 @@ void SpecialPowerStore::parseSpecialPowerDefinition( INI *ini ) { "RadiusCursorRadius", INI::parseReal, NULL, offsetof( SpecialPowerTemplate, m_radiusCursorRadius ) }, { "ShortcutPower", INI::parseBool, NULL, offsetof( SpecialPowerTemplate, m_shortcutPower ) }, { "AcademyClassify", INI::parseIndexList, TheAcademyClassificationTypeNames, offsetof( SpecialPowerTemplate, m_academyClassificationType ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp index b4e06d7f79c..0a70b85d264 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp @@ -284,7 +284,7 @@ static FunctionLexicon::TableEntry winLayoutInitTable[] = { NAMEKEY_INVALID, "DifficultySelectInit", DifficultySelectInit }, { NAMEKEY_INVALID, "PopupReplayInit", PopupReplayInit }, - { NAMEKEY_INVALID, NULL, NULL } // keep this last + { NAMEKEY_INVALID, NULL, NULL } }; @@ -325,7 +325,7 @@ static FunctionLexicon::TableEntry winLayoutUpdateTable[] = { NAMEKEY_INVALID, "ScoreScreenUpdate", ScoreScreenUpdate }, { NAMEKEY_INVALID, "DownloadMenuUpdate", DownloadMenuUpdate }, { NAMEKEY_INVALID, "PopupReplayUpdate", PopupReplayUpdate }, - { NAMEKEY_INVALID, NULL, NULL } // keep this last + { NAMEKEY_INVALID, NULL, NULL } }; @@ -366,7 +366,7 @@ static FunctionLexicon::TableEntry winLayoutShutdownTable[] = { NAMEKEY_INVALID, "ScoreScreenShutdown", ScoreScreenShutdown }, { NAMEKEY_INVALID, "DownloadMenuShutdown", DownloadMenuShutdown }, { NAMEKEY_INVALID, "PopupReplayShutdown", PopupReplayShutdown }, - { NAMEKEY_INVALID, NULL, NULL } // keep this last + { NAMEKEY_INVALID, NULL, NULL } }; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp index 2cf279dd14d..a77f3cc44b6 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp @@ -122,7 +122,7 @@ const FieldParse UpgradeTemplate::m_upgradeFieldParseTable[] = { "ResearchSound", INI::parseAudioEventRTS, NULL, offsetof( UpgradeTemplate, m_researchSound ) }, { "UnitSpecificSound", INI::parseAudioEventRTS, NULL, offsetof( UpgradeTemplate, m_unitSpecificSound ) }, { "AcademyClassify", INI::parseIndexList, TheAcademyClassificationTypeNames, offsetof( UpgradeTemplate, m_academyClassificationType ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp index 9ed058a318e..1e163cfb177 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp @@ -245,7 +245,7 @@ const FieldParse ThingTemplate::s_objectFieldParseTable[] = { "CrusherLevel", INI::parseUnsignedByte, NULL, offsetof( ThingTemplate, m_crusherLevel ) }, { "CrushableLevel", INI::parseUnsignedByte, NULL, offsetof( ThingTemplate, m_crushableLevel ) }, - { 0, 0, 0, 0 } // keep this last + { 0, 0, 0, 0 } }; // NOTE NOTE NOTE -- s_objectFieldParseTable and s_objectReskinFieldParseTable must be updated in tandem -- see comment above @@ -267,7 +267,7 @@ const FieldParse ThingTemplate::s_objectReskinFieldParseTable[] = { "MaxSimultaneousOfType", ThingTemplate::parseMaxSimultaneous, NULL, offsetof(ThingTemplate, m_maxSimultaneousOfType ) }, { "MaxSimultaneousLinkKey", NameKeyGenerator::parseStringAsNameKeyType, NULL, offsetof(ThingTemplate, m_maxSimultaneousLinkKey ) }, - { 0, 0, 0, 0 } // keep this last + { 0, 0, 0, 0 } }; // NOTE NOTE NOTE -- s_objectFieldParseTable and s_objectReskinFieldParseTable must be updated in tandem -- see comment above diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp index 899f09220a0..b3724c78c34 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp @@ -76,7 +76,7 @@ const FieldParse CreditsManager::m_creditsFieldParseTable[] = { "Blank", CreditsManager::parseBlank, NULL, NULL }, { "Text", CreditsManager::parseText, NULL, NULL }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp index 164ba0786bb..f2080712072 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp @@ -772,7 +772,7 @@ static const FieldParse TheFXListFieldParse[] = { "TerrainScorch", TerrainScorchFXNugget::parse, 0, 0}, { "ParticleSystem", ParticleSystemFXNugget::parse, 0, 0}, { "FXListAtBonePos", FXListAtBonePosFXNugget::parse, 0, 0}, - { NULL, NULL, 0, 0 } // keep this last + { NULL, NULL, 0, 0 } }; //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 8232b1720c8..5064ac7afe2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -119,7 +119,7 @@ const FieldParse CommandButton::s_commandButtonFieldParseTable[] = { "RadiusCursorType", INI::parseIndexList, TheRadiusCursorNames, offsetof( CommandButton, m_radiusCursor ) }, { "UnitSpecificSound", INI::parseAudioEventRTS, NULL, offsetof( CommandButton, m_unitSpecificSound ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; static void commandButtonTooltip(GameWindow *window, @@ -740,7 +740,7 @@ const FieldParse CommandSet::m_commandSetFieldParseTable[] = { "16", CommandSet::parseCommandButton, (void *)15, offsetof( CommandSet, m_command ) }, { "17", CommandSet::parseCommandButton, (void *)16, offsetof( CommandSet, m_command ) }, { "18", CommandSet::parseCommandButton, (void *)17, offsetof( CommandSet, m_command ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp index 86dffd96f97..b97fb896045 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp @@ -63,7 +63,7 @@ const FieldParse ControlBarResizer::m_controlBarResizerParseTable[] = { { "AltPosition", INI::parseICoord2D, NULL, offsetof( ResizerWindow, m_altPos ) }, { "AltSize", INI::parseICoord2D, NULL, offsetof( ResizerWindow, m_altSize ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; //----------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp index 41aec0a3f08..36d0d69e0cf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp @@ -156,7 +156,7 @@ const FieldParse ControlBarSchemeManager::m_controlBarSchemeFieldParseTable[] = { "ExpBarForegroundImage", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_expBarForeground) }, { "PowerPurchaseImage", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_powerPurchaseImage) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; @@ -862,7 +862,7 @@ void ControlBarSchemeManager::parseImagePart(INI *ini, void *instance, void* /*s { "Size", INI::parseICoord2D, NULL, offsetof( ControlBarSchemeImage, m_size ) }, { "ImageName", INI::parseMappedImage, NULL, offsetof( ControlBarSchemeImage, m_image ) }, { "Layer", INI::parseInt, NULL, offsetof( ControlBarSchemeImage, m_layer ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; ControlBarSchemeImage *schemeImage = NEW ControlBarSchemeImage; @@ -882,7 +882,7 @@ void ControlBarSchemeManager::parseAnimatingPartImage(INI *ini, void *instance, { "Size", INI::parseICoord2D, NULL, offsetof( ControlBarSchemeImage, m_size ) }, { "ImageName", INI::parseMappedImage, NULL, offsetof( ControlBarSchemeImage, m_image ) }, { "Layer", INI::parseInt, NULL, offsetof( ControlBarSchemeImage, m_layer ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; ControlBarSchemeImage *schemeImage = NEW ControlBarSchemeImage; @@ -903,7 +903,7 @@ void ControlBarSchemeManager::parseAnimatingPart(INI *ini, void *instance, void* { "Duration", INI::parseDurationUnsignedInt, NULL, offsetof( ControlBarSchemeAnimation, m_animDuration ) }, { "FinalPos", INI::parseICoord2D, NULL, offsetof( ControlBarSchemeAnimation, m_finalPos ) }, { "ImagePart", ControlBarSchemeManager::parseAnimatingPartImage, NULL, NULL }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; ControlBarSchemeAnimation *schemeAnim = NEW ControlBarSchemeAnimation; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp index 4a73d6838a7..7bed9f1b81b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp @@ -82,7 +82,7 @@ static const char *gadgetsToHide[] = "ButtonSelectMap", "ButtonStart", "StaticTextMapPreview", - NULL // keep this last + NULL }; static const char *perPlayerGadgetsToHide[] = { @@ -93,7 +93,7 @@ static const char *perPlayerGadgetsToHide[] = "ButtonAccept", "GenericPing", //"ButtonStartPosition", - NULL // keep this last + NULL }; static const char *qmlayoutFilename = "WOLQuickMatchMenu.wnd"; @@ -107,12 +107,12 @@ static const char *qmgadgetsToHide[] = "ButtonWiden", "ButtonStop", "ButtonStart", - NULL // keep this last + NULL }; static const char *qmperPlayerGadgetsToHide[] = { //"ButtonStartPosition", - NULL // keep this last + NULL }; static void showGameSpyGameOptionsUnderlyingGUIElements( Bool show ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp index 5d9c13ab825..728f49a7c8a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp @@ -80,14 +80,14 @@ static const char *gadgetsToHide[] = "ButtonStart", "StaticTextMapPreview", - NULL // keep this last + NULL }; static const char *perPlayerGadgetsToHide[] = { "ComboBoxTeam", "ComboBoxColor", "ComboBoxPlayerTemplate", - NULL // keep this last + NULL }; static void showLANGameOptionsUnderlyingGUIElements( Bool show ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp index 533a54853ae..2d274d5bfb7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp @@ -91,7 +91,7 @@ enum DROPDOWN_LOADREPLAY, DROPDOWN_DIFFICULTY, - DROPDOWN_COUNT // keep last + DROPDOWN_COUNT }; static Bool raiseMessageBoxes = TRUE; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp index bd9418f4dd9..565057302cb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp @@ -2115,7 +2115,8 @@ enum USA_ENEMY, // Keep friends with friends, enemys with enemys CHINA_ENEMY, GLA_ENEMY, - MAX_RELATIONS // keep me last + + MAX_RELATIONS }; /** Grab the single player info */ //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp index 713198f60de..38eed0671f0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp @@ -1242,7 +1242,7 @@ static const char *gadgetsToHide[] = "StaticTextColor", "StaticTextTeam", "StaticTextFaction", - NULL // keep this last + NULL }; static const char *perPlayerGadgetsToHide[] = { @@ -1250,7 +1250,7 @@ static const char *perPlayerGadgetsToHide[] = "ComboBoxTeam", "ComboBoxColor", "ComboBoxPlayerTemplate", - NULL // keep this last + NULL }; //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp index 903b5ac166e..408e45e662d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp @@ -98,7 +98,7 @@ static const char *gadgetsToHide[] = "ButtonStart", "StaticTextMapPreview", - NULL // keep this last + NULL }; static const char *perPlayerGadgetsToHide[] = { @@ -106,7 +106,7 @@ static const char *perPlayerGadgetsToHide[] = "ComboBoxColor", "ComboBoxPlayerTemplate", //"ButtonStartPosition", - NULL // keep this last + NULL }; void positionStartSpots( AsciiString mapName, GameWindow *buttonMapStartPositions[], GameWindow *mapWindow); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp index 1238c199ba8..a169a8ccfdf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp @@ -65,7 +65,7 @@ const FieldParse GameWindowTransitionsHandler::m_gameWindowTransitionsFieldParse { "Window", GameWindowTransitionsHandler::parseWindow, NULL, NULL }, { "FireOnce", INI::parseBool, NULL, offsetof( TransitionGroup, m_fireOnce) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; @@ -574,7 +574,7 @@ void GameWindowTransitionsHandler::parseWindow( INI* ini, void *instance, void * { "WinName", INI::parseAsciiString, NULL, offsetof( TransitionWindow, m_winName ) }, { "Style", INI::parseLookupList, TransitionStyleNames, offsetof( TransitionWindow, m_style ) }, { "FrameDelay", INI::parseInt, NULL, offsetof( TransitionWindow, m_frameDelay ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; TransitionWindow *transWin = NEW TransitionWindow; ini->initFromINI(transWin, myFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp index 56a89d711cb..77f568e286f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp @@ -65,7 +65,7 @@ const FieldParse ShellMenuSchemeManager::m_shellMenuSchemeFieldParseTable[] = { "ImagePart", ShellMenuSchemeManager::parseImagePart, NULL, NULL }, { "LinePart", ShellMenuSchemeManager::parseLinePart, NULL, NULL }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; @@ -225,7 +225,7 @@ void ShellMenuSchemeManager::parseImagePart(INI *ini, void *instance, void* /*st { "Position", INI::parseICoord2D, NULL, offsetof( ShellMenuSchemeImage, m_position ) }, { "Size", INI::parseICoord2D, NULL, offsetof( ShellMenuSchemeImage, m_size ) }, { "ImageName", INI::parseMappedImage, NULL, offsetof( ShellMenuSchemeImage, m_image ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; ShellMenuSchemeImage *schemeImage = NEW ShellMenuSchemeImage; @@ -243,7 +243,7 @@ void ShellMenuSchemeManager::parseLinePart(INI *ini, void *instance, void* /*sto { "Color", INI::parseColorInt, NULL, offsetof( ShellMenuSchemeLine, m_color ) }, { "Width", INI::parseInt, NULL, offsetof( ShellMenuSchemeLine, m_width ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; ShellMenuSchemeLine *schemeLine = NEW ShellMenuSchemeLine; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp index c0b69ec7ee9..9ee55242c90 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp @@ -92,7 +92,7 @@ static const FieldParse TheGlobalLanguageDataFieldParseTable[] = { "CreditsMinorTitleFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_creditsPositionFont) }, { "CreditsNormalFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_creditsNormalFont) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; //----------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index 8a42ccdc355..3bf5453ac3a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -882,7 +882,7 @@ const FieldParse InGameUI::s_fieldParseTable[] = { "GameTimeColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_gameTimeColor ) }, { "GameTimeDropColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_gameTimeDropColor ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp index 90be12b0775..8b37d139477 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp @@ -349,7 +349,7 @@ static const LookupListRec GameMessageMetaTypeNames[] = #endif//DUMP_PERF_STATS - { NULL, 0 }// keep this last! + { NULL, 0 } }; @@ -367,7 +367,7 @@ static const FieldParse TheMetaMapFieldParseTable[] = { "Description", INI::parseAndTranslateLabel, 0, offsetof( MetaMapRec, m_description ) }, { "DisplayName", INI::parseAndTranslateLabel, 0, offsetof( MetaMapRec, m_displayName ) }, - { NULL, NULL, 0, 0 } // keep this last + { NULL, NULL, 0, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp index b49080ed1a8..1205fb0fc78 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp @@ -78,7 +78,7 @@ const FieldParse CampaignManager::m_campaignFieldParseTable[] = { "IsChallengeCampaign", INI::parseBool, NULL, offsetof( Campaign, m_isChallengeCampaign ) }, { "PlayerFaction", INI::parseAsciiString, NULL, offsetof( Campaign, m_playerFactionName ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; @@ -374,7 +374,7 @@ void CampaignManager::parseMissionPart( INI* ini, void *instance, void *store, c { "LocationNameLabel",INI::parseAsciiString, NULL, offsetof( Mission, m_locationNameLabel ) }, { "VoiceLength", INI::parseInt , NULL, offsetof( Mission, m_voiceLength ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; AsciiString name; const char* c = ini->getNextToken(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp index 54f0f8047e2..567b97fb0e8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp @@ -197,7 +197,7 @@ static const FieldParse TheAIFieldParseTable[] = { "RetaliationFriendsRadius", INI::parseReal,NULL, offsetof( TAiData, m_retaliateFriendsRadius ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; @@ -217,7 +217,7 @@ void AI::parseSideInfo(INI *ini, void *instance, void* /*store*/, const void* /* { "SkillSet3", AI::parseSkillSet, NULL, offsetof( AISideInfo, m_skillSet3 ) }, { "SkillSet4", AI::parseSkillSet, NULL, offsetof( AISideInfo, m_skillSet4 ) }, { "SkillSet5", AI::parseSkillSet, NULL, offsetof( AISideInfo, m_skillSet5 ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; AISideInfo *resourceInfo = ((TAiData*)instance)->m_sideInfo; @@ -242,7 +242,7 @@ void AI::parseSkillSet(INI *ini, void *instance, void* store, const void* /*user static const FieldParse myFieldParse[] = { { "Science", AI::parseScience, NULL, NULL }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; TSkillSet *skillset = ((TSkillSet*)store); @@ -281,7 +281,7 @@ void AI::parseSkirmishBuildList(INI *ini, void *instance, void* /*store*/, const static const FieldParse myFieldParse[] = { { "Structure", BuildListInfo::parseStructure, NULL, NULL }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; AISideBuildList *build = newInstance(AISideBuildList)(faction); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp index de1045340d7..a14f76b4a53 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp @@ -46,7 +46,7 @@ AIDockMachine::AIDockMachine( Object *obj ) : StateMachine( obj, "AIDockMachine" static const StateConditionInfo waitForClearanceConditions[] = { StateConditionInfo(ableToAdvance, AI_DOCK_ADVANCE_POSITION, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; // order matters: first state is the default state. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp index 1b17fa4c9cd..3677bd0efde 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp @@ -170,7 +170,7 @@ AIGuardMachine::AIGuardMachine( Object *owner ) : static const StateConditionInfo attackAggressors[] = { StateConditionInfo(hasAttackedMeAndICanReturnFire, AI_GUARD_ATTACK_AGGRESSOR, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; // order matters: first state is the default state. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuardRetaliate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuardRetaliate.cpp index 896d25c32e5..d2217ac71de 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuardRetaliate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuardRetaliate.cpp @@ -177,7 +177,7 @@ AIGuardRetaliateMachine::AIGuardRetaliateMachine( Object *owner ) : static const StateConditionInfo attackAggressors[] = { StateConditionInfo(hasAttackedMeAndICanReturnFire, AI_GUARD_RETALIATE_ATTACK_AGGRESSOR, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; // order matters: first state is the default state. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 9cccaf8b2c1..0f21f3c3580 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -271,7 +271,7 @@ AttackStateMachine::AttackStateMachine( Object *obj, AIAttackState* att, AsciiSt StateConditionInfo(outOfWeaponRangeObject, AttackStateMachine::CHASE_TARGET, NULL), StateConditionInfo(wantToSquishTarget, AttackStateMachine::CHASE_TARGET, NULL), StateConditionInfo(cannotPossiblyAttackObject, EXIT_MACHINE_WITH_FAILURE, (void*)ATTACK_CONTINUED_TARGET), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; // we want to use the CONTINUE mode (not NEW) since we already have acquired the target. @@ -280,7 +280,7 @@ AttackStateMachine::AttackStateMachine( Object *obj, AIAttackState* att, AsciiSt StateConditionInfo(outOfWeaponRangeObject, AttackStateMachine::CHASE_TARGET, NULL), StateConditionInfo(cannotPossiblyAttackObject, EXIT_MACHINE_WITH_FAILURE, (void*)ATTACK_CONTINUED_TARGET_FORCED), StateConditionInfo(wantToSquishTarget, AttackStateMachine::CHASE_TARGET, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; const StateConditionInfo* objectConditions = forceAttacking ? objectConditionsForced : objectConditionsNormal; @@ -288,7 +288,7 @@ AttackStateMachine::AttackStateMachine( Object *obj, AIAttackState* att, AsciiSt static const StateConditionInfo positionConditions[] = { StateConditionInfo(outOfWeaponRangePosition, AttackStateMachine::CHASE_TARGET, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; #ifdef STATE_MACHINE_DEBUG @@ -332,7 +332,7 @@ AttackStateMachine::AttackStateMachine( Object *obj, AIAttackState* att, AsciiSt static const StateConditionInfo portableStructureChaseConditions[] = { StateConditionInfo(inWeaponRangeObject, AttackStateMachine::AIM_AT_TARGET, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; /* we're a rider on a mobile object, so we can't control our motion. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp index 10de7dd7659..79fbebbc5ab 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp @@ -152,7 +152,7 @@ AITNGuardMachine::AITNGuardMachine( Object *owner ) : static const StateConditionInfo attackAggressors[] = { StateConditionInfo(hasAttackedMeAndICanReturnFire, AI_TN_GUARD_ATTACK_AGGRESSOR, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; // order matters: first state is the default state. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp index 3e9d267f984..26146efe5a0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp @@ -86,7 +86,7 @@ TurretStateMachine::TurretStateMachine( TurretAI* tai, Object *obj, AsciiString static const StateConditionInfo fireConditions[] = { StateConditionInfo(outOfWeaponRangeObject, TURRETAI_AIM, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; // order matters: first state is the default state. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp index cb2f9db9521..5924b3ae717 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp @@ -973,7 +973,7 @@ void BuildListInfo::parseStructure(INI *ini, void *instance, void* /*store*/, co { "InitiallyBuilt", INI::parseBool, NULL, offsetof( BuildListInfo, m_isInitiallyBuilt ) }, { "RallyPointOffset", INI::parseCoord2D, NULL, offsetof( BuildListInfo, m_rallyPointOffset ) }, { "AutomaticallyBuild", INI::parseBool, NULL, offsetof( BuildListInfo, m_automaticallyBuild ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; BuildListInfo *buildInfo = newInstance( BuildListInfo ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp index a4d84a7684c..4c2ed1b8e39 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp @@ -500,7 +500,7 @@ const FieldParse* LocomotorTemplate::getFieldParse() const { "RudderCorrectionRate", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_rudderCorrectionRate) }, { "ElevatorCorrectionDegree", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_elevatorCorrectionDegree) }, { "ElevatorCorrectionRate", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_elevatorCorrectionRate) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; return TheFieldParse; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp index 57947f9bfc5..c3191d8f4b3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp @@ -1507,7 +1507,7 @@ static const FieldParse TheObjectCreationListFieldParse[] = { "DeliverPayload", DeliverPayloadNugget::parse, 0, 0}, { "FireWeapon", FireWeaponNugget::parse, 0, 0}, { "Attack", AttackNugget::parse, 0, 0}, - { NULL, NULL, 0, 0 } // keep this last + { NULL, NULL, 0, 0 } }; //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp index f45c9109430..3ce4c5b1e85 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp @@ -517,7 +517,7 @@ DeliverPayloadStateMachine::DeliverPayloadStateMachine( Object *owner ) : StateM static const StateConditionInfo considerConditions[] = { StateConditionInfo(DeliverPayloadStateMachine::isOffMap, RECOVER_FROM_OFF_MAP, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; // order matters: first state is the default state. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp index ff5e8c5fdb5..ecaee75b9be 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp @@ -1281,7 +1281,7 @@ DozerPrimaryStateMachine::DozerPrimaryStateMachine( Object *owner ) : StateMachi StateConditionInfo(isBuildMostImportant, DOZER_PRIMARY_BUILD, NULL), StateConditionInfo(isRepairMostImportant, DOZER_PRIMARY_REPAIR, NULL), StateConditionInfo(isFortifyMostImportant, DOZER_PRIMARY_FORTIFY, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; // order matters: first state is the default state. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp index 67acd3c6c1e..35360bfd7e6 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp @@ -396,7 +396,7 @@ SupplyTruckStateMachine::SupplyTruckStateMachine( Object *owner ) : StateMachine { StateConditionInfo(ownerIdle, ST_IDLE, NULL), StateConditionInfo(ownerDocking, ST_DOCKING, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; static const StateConditionInfo idleConditions[] = @@ -405,20 +405,20 @@ SupplyTruckStateMachine::SupplyTruckStateMachine( Object *owner ) : StateMachine StateConditionInfo(isForcedIntoWantingState, ST_WANTING, NULL), StateConditionInfo(ownerDocking, ST_DOCKING, NULL), StateConditionInfo(ownerNotDockingOrIdle, ST_BUSY, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; static const StateConditionInfo wantingConditions[] = { StateConditionInfo(ownerDocking, ST_DOCKING, NULL), StateConditionInfo(ownerNotDockingOrIdle, ST_BUSY, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; static const StateConditionInfo regroupingConditions[] = { StateConditionInfo(ownerPlayerCommanded, ST_BUSY, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; static const StateConditionInfo dockingConditions[] = @@ -426,7 +426,7 @@ SupplyTruckStateMachine::SupplyTruckStateMachine( Object *owner ) : StateMachine StateConditionInfo(isForcedIntoBusyState, ST_BUSY, NULL), StateConditionInfo(ownerAvailableForSupplying, ST_WANTING, NULL), StateConditionInfo(ownerNotDockingOrIdle, ST_BUSY, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; // order matters: first state is the default state. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp index f95c09ba4c7..eb5419b0e87 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp @@ -1172,13 +1172,13 @@ WorkerStateMachine::WorkerStateMachine( Object *owner ) : StateMachine( owner, " static const StateConditionInfo asDozerConditions[] = { StateConditionInfo(supplyTruckSubMachineWantsToEnter, AS_SUPPLY_TRUCK, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; static const StateConditionInfo asTruckConditions[] = { StateConditionInfo(supplyTruckSubMachineReadyToLeave, AS_DOZER, NULL), - StateConditionInfo(NULL, NULL, NULL) // keep last + StateConditionInfo(NULL, NULL, NULL) }; // order matters: first state is the default state. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index ac0d20bad34..7bdb420798c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -238,7 +238,7 @@ const FieldParse WeaponTemplate::TheWeaponTemplateFieldParseTable[] = { "ContinueAttackRange", INI::parseReal, NULL, offsetof(WeaponTemplate, m_continueAttackRange) }, { "SuspendFXDelay", INI::parseDurationUnsignedInt, NULL, offsetof(WeaponTemplate, m_suspendFXDelay) }, { "MissileCallsOnDie", INI::parseBool, NULL, offsetof(WeaponTemplate, m_dieOnDetonate) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index 8a0020cb2b9..364cadf7ec9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -356,7 +356,7 @@ static const FieldParse TheTemplateFieldParseTable[] = { "UIName", INI::parseAsciiString,NULL, offsetof( Template, m_uiName ) }, { "UIName2", INI::parseAsciiString,NULL, offsetof( Template, m_uiName2 ) }, { "HelpText", INI::parseAsciiString,NULL, offsetof( Template, m_helpText ) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp index d588056d96b..efe482d8325 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp @@ -185,7 +185,7 @@ const FieldParse CrateTemplate::TheCrateTemplateFieldParseTable[] = { "CrateObject", CrateTemplate::parseCrateCreationEntry, NULL, NULL }, { "KillerScience", INI::parseScience, NULL, offsetof( CrateTemplate, m_killerScience) }, { "OwnedByMaker", INI::parseBool, NULL, offsetof( CrateTemplate, m_isOwnedByMaker) }, - { NULL, NULL, NULL, NULL }, // keep this last! + { NULL, NULL, NULL, NULL }, }; CrateTemplate::CrateTemplate() diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp index b4959d3f80f..398ab51ad48 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp @@ -70,7 +70,7 @@ static const FieldParse GameSpyColorFieldParse[] = { "MOTD", INI::parseColorInt, NULL, OFFSET(GSCOLOR_MOTD) }, { "MOTDHeading", INI::parseColorInt, NULL, OFFSET(GSCOLOR_MOTD_HEADING) }, - { NULL, NULL, NULL, 0 } // keep this last + { NULL, NULL, NULL, 0 } }; diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DTreeBuffer.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DTreeBuffer.h index 3a5ed649b07..134affac93f 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DTreeBuffer.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DTreeBuffer.h @@ -83,7 +83,7 @@ enum W3DToppleState CPP_11(: Int) TOPPLE_UPRIGHT = 0, TOPPLE_FALLING, TOPPLE_FOGGED, - TOPPPLE_SHROUDED, + TOPPLE_SHROUDED, // unused TOPPLE_DOWN }; /// The individual data for a tree. diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/shader.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/shader.h index d080ee4dd9d..a389a7ac6f8 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/shader.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/shader.h @@ -162,7 +162,8 @@ class ShaderClass DSTBLEND_ONE_MINUS_SRC_COLOR, // destination pixel multiplied by one minus (i.e. inverse) fragment RGB components DSTBLEND_SRC_ALPHA, // destination pixel multiplied by fragment alpha component DSTBLEND_ONE_MINUS_SRC_ALPHA, // destination pixel multiplied by fragment inverse alpha - DSTBLEND_MAX // end of enumeration + + DSTBLEND_MAX }; enum FogFuncType @@ -195,7 +196,8 @@ class ShaderClass SRCBLEND_ONE, // fragment added unmodified to color buffer (default) SRCBLEND_SRC_ALPHA, // fragment RGB components multiplied by fragment A SRCBLEND_ONE_MINUS_SRC_ALPHA, // fragment RGB components multiplied by fragment inverse (one minus) A - SRCBLEND_MAX // end of enumeration + + SRCBLEND_MAX }; enum TexturingType diff --git a/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEdit.h b/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEdit.h index 0e210b723aa..b39a10fde0c 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEdit.h +++ b/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEdit.h @@ -84,7 +84,7 @@ typedef enum STATUS_PART4, /// change to meaningful name when decided what goes here STATUS_MOUSE_COORDS, - STATUS_NUM_PARTS ///< keep this last! + STATUS_NUM_PARTS } StatusPart; diff --git a/GeneralsMD/Code/Tools/GUIEdit/Include/Properties.h b/GeneralsMD/Code/Tools/GUIEdit/Include/Properties.h index 1758e97c8fe..9ec2fb637d9 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Include/Properties.h +++ b/GeneralsMD/Code/Tools/GUIEdit/Include/Properties.h @@ -347,7 +347,7 @@ typedef enum GENERIC_DISABLED, GENERIC_HILITE, - NUM_STATE_IDENTIFIERS // keep this last + NUM_STATE_IDENTIFIERS } StateIdentifier; diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp index e1ebb9c55ee..d0cdc67b30a 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp @@ -95,7 +95,7 @@ ColorControl colorControlTable[] = { BUTTON_COLOR, 0, }, { BUTTON_BORDER_COLOR, 0 }, - { 0, { 0, 0, 0, 0 } } // keep this last! + { 0, { 0, 0, 0, 0 } } }; ImageAndColorInfo imageAndColorTable[] = @@ -373,7 +373,7 @@ ImageAndColorInfo imageAndColorTable[] = { GWS_USER_WINDOW, GENERIC_DISABLED, "[User]Disabled Surface", NULL, 0, 0 }, { GWS_USER_WINDOW, GENERIC_HILITE, "[User]Hilite Surface", NULL, 0, 0 }, - { 0, IDENTIFIER_INVALID, NULL, NULL, 0, 0 } // keep this last! + { 0, IDENTIFIER_INVALID, NULL, NULL, 0, 0 } }; diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorExport.h b/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorExport.h index 7441d52486d..b8b32ba3c02 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorExport.h +++ b/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorExport.h @@ -47,9 +47,8 @@ extern "C" { # define PARM_ParticleTypeName 0x00 # define PARM_SlaveSystemName 0x01 # define PARM_AttachedSystemName 0x02 +# define PARM_NumParms 0x03 -// Keep this one last -# define PARM_NumParms 0x03 // parmNum can be exactly one of the above defines (PARM_*) void __declspec(dllexport) GetSelectedParticleAsciiStringParm( int parmNum, char *bufferToCopyInto, ParticleSystemTemplate **whichTemplate ); void __declspec(dllexport) UpdateParticleAsciiStringParm( int parmNum, const char *bufferToCopyFrom, ParticleSystemTemplate **whichTemplate ); From fa9bb64e62776dc9b480a6beb098d7a22af49b46 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Thu, 18 Sep 2025 02:10:51 +1000 Subject: [PATCH 076/343] bugfix(module): Consistently yield experience for direct poison kills (#1527) --- .../GameLogic/Module/PoisonedBehavior.h | 1 + .../Object/Behavior/PoisonedBehavior.cpp | 18 +++++++++++++++++- .../GameLogic/Module/PoisonedBehavior.h | 1 + .../Object/Behavior/PoisonedBehavior.cpp | 18 +++++++++++++++++- 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/PoisonedBehavior.h b/Generals/Code/GameEngine/Include/GameLogic/Module/PoisonedBehavior.h index ed974ac591b..490fdcd1658 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/PoisonedBehavior.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/PoisonedBehavior.h @@ -92,6 +92,7 @@ class PoisonedBehavior : public UpdateModule, UnsignedInt m_poisonDamageFrame; UnsignedInt m_poisonOverallStopFrame; Real m_poisonDamageAmount; + ObjectID m_poisonSource; DeathType m_deathType; }; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp index 1a4632d0ce4..4aa1b664e8d 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp @@ -70,6 +70,7 @@ PoisonedBehavior::PoisonedBehavior( Thing *thing, const ModuleData* moduleData ) m_poisonDamageFrame = 0; m_poisonOverallStopFrame = 0; m_poisonDamageAmount = 0.0f; + m_poisonSource = INVALID_ID; m_deathType = DEATH_POISONED; setWakeFrame(getObject(), UPDATE_SLEEP_FOREVER); } @@ -117,7 +118,7 @@ UpdateSleepTime PoisonedBehavior::update() // If it is time to do damage, then do it and reset the damage timer DamageInfo damage; damage.in.m_amount = m_poisonDamageAmount; - damage.in.m_sourceID = INVALID_ID; + damage.in.m_sourceID = m_poisonSource; damage.in.m_damageType = DAMAGE_UNRESISTABLE; // Not poison, as that will infect us again damage.in.m_deathType = m_deathType; getObject()->attemptDamage( &damage ); @@ -157,6 +158,10 @@ void PoisonedBehavior::startPoisonedEffects( const DamageInfo *damageInfo ) // We are going to take the damage dealt by the original poisoner every so often for a while. m_poisonDamageAmount = damageInfo->out.m_actualDamageDealt; +#if !RETAIL_COMPATIBLE_CRC + // TheSuperHackers @bugfix Stubbjax 03/09/2025 Allow poison damage to award xp to the poison source. + m_poisonSource = damageInfo->in.m_sourceID; +#endif m_poisonOverallStopFrame = now + d->m_poisonDurationData; @@ -182,6 +187,7 @@ void PoisonedBehavior::stopPoisonedEffects() m_poisonDamageFrame = 0; m_poisonOverallStopFrame = 0; m_poisonDamageAmount = 0.0f; + m_poisonSource = INVALID_ID; Drawable *myDrawable = getObject()->getDrawable(); if( myDrawable ) @@ -208,7 +214,11 @@ void PoisonedBehavior::xfer( Xfer *xfer ) { // version +#if RETAIL_COMPATIBLE_XFER_SAVE const XferVersion currentVersion = 2; +#else + const XferVersion currentVersion = 3; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -229,6 +239,12 @@ void PoisonedBehavior::xfer( Xfer *xfer ) xfer->xferUser(&m_deathType, sizeof(m_deathType)); } +#if !RETAIL_COMPATIBLE_XFER_SAVE + if (version >= 3) + { + xfer->xferObjectID(&m_poisonSource); + } +#endif } // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PoisonedBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PoisonedBehavior.h index 996d03aa8c6..48190a1704e 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PoisonedBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PoisonedBehavior.h @@ -92,6 +92,7 @@ class PoisonedBehavior : public UpdateModule, UnsignedInt m_poisonDamageFrame; UnsignedInt m_poisonOverallStopFrame; Real m_poisonDamageAmount; + ObjectID m_poisonSource; DeathType m_deathType; }; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp index 45224c07061..e17758d88d1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp @@ -70,6 +70,7 @@ PoisonedBehavior::PoisonedBehavior( Thing *thing, const ModuleData* moduleData ) m_poisonDamageFrame = 0; m_poisonOverallStopFrame = 0; m_poisonDamageAmount = 0.0f; + m_poisonSource = INVALID_ID; m_deathType = DEATH_POISONED; setWakeFrame(getObject(), UPDATE_SLEEP_FOREVER); } @@ -117,7 +118,7 @@ UpdateSleepTime PoisonedBehavior::update() // If it is time to do damage, then do it and reset the damage timer DamageInfo damage; damage.in.m_amount = m_poisonDamageAmount; - damage.in.m_sourceID = INVALID_ID; + damage.in.m_sourceID = m_poisonSource; damage.in.m_damageType = DAMAGE_UNRESISTABLE; // Not poison, as that will infect us again damage.in.m_damageFXOverride = DAMAGE_POISON; // but this will ensure that the right effect is played damage.in.m_deathType = m_deathType; @@ -158,6 +159,10 @@ void PoisonedBehavior::startPoisonedEffects( const DamageInfo *damageInfo ) // We are going to take the damage dealt by the original poisoner every so often for a while. m_poisonDamageAmount = damageInfo->out.m_actualDamageDealt; +#if !RETAIL_COMPATIBLE_CRC + // TheSuperHackers @bugfix Stubbjax 03/09/2025 Allow poison damage to award xp to the poison source. + m_poisonSource = damageInfo->in.m_sourceID; +#endif m_poisonOverallStopFrame = now + d->m_poisonDurationData; @@ -183,6 +188,7 @@ void PoisonedBehavior::stopPoisonedEffects() m_poisonDamageFrame = 0; m_poisonOverallStopFrame = 0; m_poisonDamageAmount = 0.0f; + m_poisonSource = INVALID_ID; Drawable *myDrawable = getObject()->getDrawable(); if( myDrawable ) @@ -209,7 +215,11 @@ void PoisonedBehavior::xfer( Xfer *xfer ) { // version +#if RETAIL_COMPATIBLE_XFER_SAVE const XferVersion currentVersion = 2; +#else + const XferVersion currentVersion = 3; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -230,6 +240,12 @@ void PoisonedBehavior::xfer( Xfer *xfer ) xfer->xferUser(&m_deathType, sizeof(m_deathType)); } +#if !RETAIL_COMPATIBLE_XFER_SAVE + if (version >= 3) + { + xfer->xferObjectID(&m_poisonSource); + } +#endif } // ------------------------------------------------------------------------------------------------ From 6418de5713a013ea4ee7f7cf0c3d077aa3cae312 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Thu, 18 Sep 2025 02:11:00 +1000 Subject: [PATCH 077/343] bugfix(module): Consistently yield experience for direct flame kills (#1539) --- .../GameLogic/Module/FlammableUpdate.h | 1 + .../Object/Update/FlammableUpdate.cpp | 19 ++++++++++++++++++- .../GameLogic/Module/FlammableUpdate.h | 1 + .../Object/Update/FlammableUpdate.cpp | 19 ++++++++++++++++++- 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h index ada7542a3f6..e1799e99d62 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h @@ -111,6 +111,7 @@ class FlammableUpdate : public UpdateModule, public DamageModuleInterface UnsignedInt m_damageEndFrame; AudioHandle m_audioHandle; Real m_flameDamageLimit; + ObjectID m_flameSource; UnsignedInt m_lastFlameDamageDealt; }; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp index 95888864883..07aca03a0fd 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp @@ -84,6 +84,7 @@ FlammableUpdate::FlammableUpdate( Thing *thing, const ModuleData* moduleData ) : m_damageEndFrame = 0; m_audioHandle = NULL; m_flameDamageLimit = getFlammableUpdateModuleData()->m_flameDamageLimitData; + m_flameSource = INVALID_ID; m_lastFlameDamageDealt = 0; setWakeFrame(getObject(), UPDATE_SLEEP_FOREVER); @@ -110,6 +111,12 @@ void FlammableUpdate::onDamage( DamageInfo *damageInfo ) m_flameDamageLimit = getFlammableUpdateModuleData()->m_flameDamageLimitData; } m_lastFlameDamageDealt = now; +#if RETAIL_COMPATIBLE_CRC + m_flameSource = getObject()->getID(); +#else + // TheSuperHackers @bugfix Stubbjax 03/09/2025 Allow flame damage to award xp to the flame source. + m_flameSource = damageInfo->in.m_sourceID; +#endif Object *me = getObject(); if( !me->getStatusBits().test( OBJECT_STATUS_AFLAME ) && !me->getStatusBits().test( OBJECT_STATUS_BURNED ) ) @@ -229,7 +236,7 @@ void FlammableUpdate::doAflameDamage() DamageInfo info; info.in.m_amount = data->m_aflameDamageAmount; - info.in.m_sourceID = getObject()->getID(); + info.in.m_sourceID = m_flameSource; info.in.m_damageType = DAMAGE_FLAME; info.in.m_deathType = DEATH_BURNED; @@ -287,7 +294,11 @@ void FlammableUpdate::xfer( Xfer *xfer ) { // version +#if RETAIL_COMPATIBLE_XFER_SAVE XferVersion currentVersion = 1; +#else + XferVersion currentVersion = 2; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -312,6 +323,12 @@ void FlammableUpdate::xfer( Xfer *xfer ) // last flame damage dealt xfer->xferUnsignedInt( &m_lastFlameDamageDealt ); +#if !RETAIL_COMPATIBLE_XFER_SAVE + if (version >= 2) + { + xfer->xferObjectID(&m_flameSource); + } +#endif } // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h index 34e79ff4b5e..be73de96568 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h @@ -111,6 +111,7 @@ class FlammableUpdate : public UpdateModule, public DamageModuleInterface UnsignedInt m_damageEndFrame; AudioHandle m_audioHandle; Real m_flameDamageLimit; + ObjectID m_flameSource; UnsignedInt m_lastFlameDamageDealt; }; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp index b2bc9ffd2db..14c7b4a7257 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp @@ -84,6 +84,7 @@ FlammableUpdate::FlammableUpdate( Thing *thing, const ModuleData* moduleData ) : m_damageEndFrame = 0; m_audioHandle = NULL; m_flameDamageLimit = getFlammableUpdateModuleData()->m_flameDamageLimitData; + m_flameSource = INVALID_ID; m_lastFlameDamageDealt = 0; setWakeFrame(getObject(), UPDATE_SLEEP_FOREVER); @@ -110,6 +111,12 @@ void FlammableUpdate::onDamage( DamageInfo *damageInfo ) m_flameDamageLimit = getFlammableUpdateModuleData()->m_flameDamageLimitData; } m_lastFlameDamageDealt = now; +#if RETAIL_COMPATIBLE_CRC + m_flameSource = getObject()->getID(); +#else + // TheSuperHackers @bugfix Stubbjax 03/09/2025 Allow flame damage to award xp to the flame source. + m_flameSource = damageInfo->in.m_sourceID; +#endif Object *me = getObject(); if( !me->getStatusBits().test( OBJECT_STATUS_AFLAME ) && !me->getStatusBits().test( OBJECT_STATUS_BURNED ) ) @@ -229,7 +236,7 @@ void FlammableUpdate::doAflameDamage() DamageInfo info; info.in.m_amount = data->m_aflameDamageAmount; - info.in.m_sourceID = getObject()->getID(); + info.in.m_sourceID = m_flameSource; info.in.m_damageType = DAMAGE_FLAME; info.in.m_deathType = DEATH_BURNED; @@ -287,7 +294,11 @@ void FlammableUpdate::xfer( Xfer *xfer ) { // version +#if RETAIL_COMPATIBLE_XFER_SAVE XferVersion currentVersion = 1; +#else + XferVersion currentVersion = 2; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -312,6 +323,12 @@ void FlammableUpdate::xfer( Xfer *xfer ) // last flame damage dealt xfer->xferUnsignedInt( &m_lastFlameDamageDealt ); +#if !RETAIL_COMPATIBLE_XFER_SAVE + if (version >= 2) + { + xfer->xferObjectID(&m_flameSource); + } +#endif } // ------------------------------------------------------------------------------------------------ From 5765997e7a58f415636998935111c733118f13c0 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Thu, 18 Sep 2025 16:33:39 +1000 Subject: [PATCH 078/343] tweak(network): Transfer assets of disconnected players to allies (#1523) --- Generals/Code/GameEngine/Source/GameNetwork/Network.cpp | 7 ++++++- GeneralsMD/Code/GameEngine/Source/GameNetwork/Network.cpp | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameNetwork/Network.cpp b/Generals/Code/GameEngine/Source/GameNetwork/Network.cpp index a9fd9dcd926..a2f47681963 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/Network.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/Network.cpp @@ -666,7 +666,12 @@ void Network::processDestroyPlayerCommand(NetDestroyPlayerCommandMsg *msg) if (pPlayer) { GameMessage *msg = newInstance(GameMessage)(GameMessage::MSG_SELF_DESTRUCT); - msg->appendBooleanArgument(FALSE); +#if RETAIL_COMPATIBLE_CRC + const Bool transferAssets = FALSE; +#else + const Bool transferAssets = TRUE; +#endif + msg->appendBooleanArgument(transferAssets); msg->friend_setPlayerIndex(pPlayer->getPlayerIndex()); TheCommandList->appendMessage(msg); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/Network.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/Network.cpp index a8c009acc4d..138c7aa2285 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/Network.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/Network.cpp @@ -666,7 +666,12 @@ void Network::processDestroyPlayerCommand(NetDestroyPlayerCommandMsg *msg) if (pPlayer) { GameMessage *msg = newInstance(GameMessage)(GameMessage::MSG_SELF_DESTRUCT); - msg->appendBooleanArgument(FALSE); +#if RETAIL_COMPATIBLE_CRC + const Bool transferAssets = FALSE; +#else + const Bool transferAssets = TRUE; +#endif + msg->appendBooleanArgument(transferAssets); msg->friend_setPlayerIndex(pPlayer->getPlayerIndex()); TheCommandList->appendMessage(msg); } From dd2bb780a9226186e1d1ffe0dc60fc8000134117 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Thu, 18 Sep 2025 16:36:46 +1000 Subject: [PATCH 079/343] feat(gui): Add button to select the next idle worker of the currently viewed player for observers (#1526) --- .../GameClient/GUI/ControlBar/ControlBarObserver.cpp | 6 ++++++ .../Code/GameEngine/Source/GameClient/InGameUI.cpp | 11 ++++++++--- .../GameClient/GUI/ControlBar/ControlBarObserver.cpp | 6 ++++++ .../Code/GameEngine/Source/GameClient/InGameUI.cpp | 11 ++++++++--- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp index 1aecbae08f3..c9dca76d745 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp @@ -89,6 +89,8 @@ static NameKeyType buttonCancelID = NAMEKEY_INVALID; static GameWindow *winFlag = NULL; static GameWindow *winGeneralPortrait = NULL; +// TheSuperHackers @tweak Allow idle worker selection for observers. +static GameWindow *buttonIdleWorker = NULL; static GameWindow *staticTextNumberOfUnits = NULL; static GameWindow *staticTextNumberOfBuildings = NULL; static GameWindow *staticTextNumberOfUnitsKilled = NULL; @@ -123,6 +125,7 @@ void ControlBar::initObserverControls( void ) staticTextPlayerName = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextPlayerName")); winFlag = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:WinFlag")); winGeneralPortrait = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:WinGeneralPortrait")); + buttonIdleWorker = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonIdleWorker")); buttonCancelID = TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonCancel"); } @@ -163,6 +166,7 @@ WindowMsgHandledType ControlBarObserverSystem( GameWindow *window, UnsignedInt m TheControlBar->setObserverLookAtPlayer(NULL); ObserverPlayerInfoWindow->winHide(TRUE); ObserverPlayerListWindow->winHide(FALSE); + buttonIdleWorker->winHide(TRUE); TheControlBar->populateObserverList(); } @@ -301,6 +305,7 @@ void ControlBar::populateObserverInfoWindow ( void ) { ObserverPlayerInfoWindow->winHide(TRUE); ObserverPlayerListWindow->winHide(FALSE); + buttonIdleWorker->winHide(TRUE); populateObserverList(); return; } @@ -338,4 +343,5 @@ void ControlBar::populateObserverInfoWindow ( void ) staticTextPlayerName->winSetEnabledTextColors(color, GameMakeColor(0,0,0,255)); winFlag->winSetEnabledImage(0, m_observerLookAtPlayer->getPlayerTemplate()->getFlagWaterMarkImage()); winGeneralPortrait->winHide(FALSE); + buttonIdleWorker->winHide(FALSE); } diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index 3441a0e4a4a..68ddc81b73f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -5428,7 +5428,7 @@ void InGameUI::removeIdleWorker( Object *obj, Int playerNumber ) void InGameUI::selectNextIdleWorker( void ) { - Int index = ThePlayerList->getLocalPlayer()->getPlayerIndex(); + Int index = TheControlBar->getCurrentlyViewedPlayer()->getPlayerIndex(); if(m_idleWorkers[index].empty()) { DEBUG_ASSERTCRASH(FALSE, ("InGameUI::selectNextIdleWorker We're trying to select a worker when our list is empty for player %ls", ThePlayerList->getLocalPlayer()->getPlayerDisplayName().str())); @@ -5518,8 +5518,13 @@ ObjectPtrVector InGameUI::getUniqueIdleWorkers(const ObjectList& idleWorkers) Int InGameUI::getIdleWorkerCount( void ) { - Int index = ThePlayerList->getLocalPlayer()->getPlayerIndex(); - return m_idleWorkers[index].size(); + if (Player* player = TheControlBar->getCurrentlyViewedPlayer()) + { + Int index = player->getPlayerIndex(); + return m_idleWorkers[index].size(); + } + + return 0; } void InGameUI::showIdleWorkerLayout( void ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp index 13c55c43158..15873ceb3ee 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp @@ -89,6 +89,8 @@ static NameKeyType buttonCancelID = NAMEKEY_INVALID; static GameWindow *winFlag = NULL; static GameWindow *winGeneralPortrait = NULL; +// TheSuperHackers @tweak Allow idle worker selection for observers. +static GameWindow *buttonIdleWorker = NULL; static GameWindow *staticTextNumberOfUnits = NULL; static GameWindow *staticTextNumberOfBuildings = NULL; static GameWindow *staticTextNumberOfUnitsKilled = NULL; @@ -123,6 +125,7 @@ void ControlBar::initObserverControls( void ) staticTextPlayerName = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextPlayerName")); winFlag = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:WinFlag")); winGeneralPortrait = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:WinGeneralPortrait")); + buttonIdleWorker = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonIdleWorker")); buttonCancelID = TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonCancel"); } @@ -163,6 +166,7 @@ WindowMsgHandledType ControlBarObserverSystem( GameWindow *window, UnsignedInt m TheControlBar->setObserverLookAtPlayer(NULL); ObserverPlayerInfoWindow->winHide(TRUE); ObserverPlayerListWindow->winHide(FALSE); + buttonIdleWorker->winHide(TRUE); TheControlBar->populateObserverList(); } @@ -301,6 +305,7 @@ void ControlBar::populateObserverInfoWindow ( void ) { ObserverPlayerInfoWindow->winHide(TRUE); ObserverPlayerListWindow->winHide(FALSE); + buttonIdleWorker->winHide(TRUE); populateObserverList(); return; } @@ -338,4 +343,5 @@ void ControlBar::populateObserverInfoWindow ( void ) staticTextPlayerName->winSetEnabledTextColors(color, GameMakeColor(0,0,0,255)); winFlag->winSetEnabledImage(0, m_observerLookAtPlayer->getPlayerTemplate()->getFlagWaterMarkImage()); winGeneralPortrait->winHide(FALSE); + buttonIdleWorker->winHide(FALSE); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index 3bf5453ac3a..6a4164d916c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -5600,7 +5600,7 @@ void InGameUI::removeIdleWorker( Object *obj, Int playerNumber ) void InGameUI::selectNextIdleWorker( void ) { - Int index = ThePlayerList->getLocalPlayer()->getPlayerIndex(); + Int index = TheControlBar->getCurrentlyViewedPlayer()->getPlayerIndex(); if(m_idleWorkers[index].empty()) { DEBUG_ASSERTCRASH(FALSE, ("InGameUI::selectNextIdleWorker We're trying to select a worker when our list is empty for player %ls", ThePlayerList->getLocalPlayer()->getPlayerDisplayName().str())); @@ -5690,8 +5690,13 @@ ObjectPtrVector InGameUI::getUniqueIdleWorkers(const ObjectList& idleWorkers) Int InGameUI::getIdleWorkerCount( void ) { - Int index = ThePlayerList->getLocalPlayer()->getPlayerIndex(); - return m_idleWorkers[index].size(); + if (Player* player = TheControlBar->getCurrentlyViewedPlayer()) + { + Int index = player->getPlayerIndex(); + return m_idleWorkers[index].size(); + } + + return 0; } void InGameUI::showIdleWorkerLayout( void ) From 43f977e609da4e0c047e32b414655a2ea7c590ea Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 19 Sep 2025 10:39:10 +0200 Subject: [PATCH 080/343] refactor: Remove ELEMENTS_OF macro (#1588) --- Core/Libraries/Include/Lib/BaseTypeCore.h | 5 ----- GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp | 6 +++--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Core/Libraries/Include/Lib/BaseTypeCore.h b/Core/Libraries/Include/Lib/BaseTypeCore.h index 6f824f21da6..6b3bd905573 100644 --- a/Core/Libraries/Include/Lib/BaseTypeCore.h +++ b/Core/Libraries/Include/Lib/BaseTypeCore.h @@ -117,11 +117,6 @@ #define FALSE false #endif -// Elements in an array -#ifndef ELEMENTS_OF -#define ELEMENTS_OF( x ) ( sizeof( x ) / sizeof( x[0] ) ) -#endif - //-------------------------------------------------------------------- // Fundamental type definitions //-------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp index bd7af01e708..5bfcb5bed63 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp @@ -316,7 +316,7 @@ void Eva::update() //------------------------------------------------------------------------------------------------- EvaMessage Eva::nameToMessage(const AsciiString& name) { - DEBUG_ASSERTCRASH( ELEMENTS_OF( TheEvaMessageNames ) == EVA_COUNT + 1, ("TheEvaMessageNames out of sync" ) ); + DEBUG_ASSERTCRASH( ARRAY_SIZE( TheEvaMessageNames ) == EVA_COUNT + 1, ("TheEvaMessageNames out of sync" ) ); DEBUG_ASSERTCRASH( stricmp( TheEvaMessageNames[ EVA_COUNT ], "EVA_INVALID" ) == 0, ("TheEvaMessageNames out of sync" ) ); DEBUG_ASSERTCRASH( stricmp( TheEvaMessageNames[ EVA_COUNT - 1], "EVA_INVALID" ) != 0, ("TheEvaMessageNames out of sync" ) ); @@ -333,7 +333,7 @@ EvaMessage Eva::nameToMessage(const AsciiString& name) //------------------------------------------------------------------------------------------------- AsciiString Eva::messageToName(EvaMessage message) { - DEBUG_ASSERTCRASH( ELEMENTS_OF( TheEvaMessageNames ) == EVA_COUNT + 1, ("TheEvaMessageNames out of sync" ) ); + DEBUG_ASSERTCRASH( ARRAY_SIZE( TheEvaMessageNames ) == EVA_COUNT + 1, ("TheEvaMessageNames out of sync" ) ); DEBUG_ASSERTCRASH( stricmp( TheEvaMessageNames[ EVA_COUNT ], "EVA_INVALID" ) == 0, ("TheEvaMessageNames out of sync" ) ); DEBUG_ASSERTCRASH( stricmp( TheEvaMessageNames[ EVA_COUNT - 1], "EVA_INVALID" ) != 0, ("TheEvaMessageNames out of sync" ) ); @@ -415,7 +415,7 @@ Bool Eva::messageShouldPlay(EvaMessage messageToTest, UnsignedInt currentFrame) return FALSE; } - DEBUG_ASSERTCRASH( ELEMENTS_OF( s_shouldPlayFuncs ) == EVA_COUNT + 1, ("Eva::s_shouldPlayFuncs out of sync" ) ); + DEBUG_ASSERTCRASH( ARRAY_SIZE( s_shouldPlayFuncs ) == EVA_COUNT + 1, ("Eva::s_shouldPlayFuncs out of sync" ) ); DEBUG_ASSERTCRASH( s_shouldPlayFuncs[ EVA_COUNT ] == NULL, ("Eva::s_shouldPlayFuncs out of sync" ) ); DEBUG_ASSERTCRASH( s_shouldPlayFuncs[ EVA_COUNT - 1] != NULL, ("Eva::s_shouldPlayFuncs out of sync" ) ); From e2b97aeb80357dcd871536bab66a55b563ca1ed4 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 19 Sep 2025 10:54:53 +0200 Subject: [PATCH 081/343] fix: Fix malformed string lists (#1583) --- Core/GameEngine/Source/Common/RandomValue.cpp | 4 ++-- .../Code/GameEngine/Include/GameLogic/Module/BodyModule.h | 1 + .../GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp | 1 + .../Code/GameEngine/Include/GameLogic/Module/BodyModule.h | 2 ++ .../GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Core/GameEngine/Source/Common/RandomValue.cpp b/Core/GameEngine/Source/Common/RandomValue.cpp index f9e63adbf32..801a604d01f 100644 --- a/Core/GameEngine/Source/Common/RandomValue.cpp +++ b/Core/GameEngine/Source/Common/RandomValue.cpp @@ -352,7 +352,7 @@ DEBUG_LOG(( "%d: GetGameAudioRandomValueReal = %f, %s line %d", /*static*/ const char *GameClientRandomVariable::DistributionTypeNames[] = { - "CONSTANT", "UNIFORM", "GAUSSIAN", "TRIANGULAR", "LOW_BIAS", "HIGH_BIAS" + "CONSTANT", "UNIFORM", "GAUSSIAN", "TRIANGULAR", "LOW_BIAS", "HIGH_BIAS", NULL }; /** @@ -397,7 +397,7 @@ Real GameClientRandomVariable::getValue( void ) const /*static*/ const char *GameLogicRandomVariable::DistributionTypeNames[] = { - "CONSTANT", "UNIFORM", "GAUSSIAN", "TRIANGULAR", "LOW_BIAS", "HIGH_BIAS" + "CONSTANT", "UNIFORM", "GAUSSIAN", "TRIANGULAR", "LOW_BIAS", "HIGH_BIAS", NULL }; /** diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/BodyModule.h b/Generals/Code/GameEngine/Include/GameLogic/Module/BodyModule.h index 392c5a95bfa..2468bd7cae1 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/BodyModule.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/BodyModule.h @@ -85,6 +85,7 @@ static const char* TheMaxHealthChangeTypeNames[] = "SAME_CURRENTHEALTH", "PRESERVE_RATIO", "ADD_CURRENT_HEALTH_TOO", + NULL }; #endif diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp index 5f280a2c19f..16f9ee8b084 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp @@ -704,6 +704,7 @@ static const char* DebrisDispositionNames[] = "FLOATING", "INHERIT_VELOCITY", "WHIRLING", + NULL }; std::vector debrisModelNamesGlobalHack; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BodyModule.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BodyModule.h index 11dda5bbb45..d6b80eff8a0 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BodyModule.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BodyModule.h @@ -86,6 +86,8 @@ static const char* TheMaxHealthChangeTypeNames[] = "SAME_CURRENTHEALTH", "PRESERVE_RATIO", "ADD_CURRENT_HEALTH_TOO", + "FULLY_HEAL", + NULL }; #endif diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp index c3191d8f4b3..2c7dfeab025 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp @@ -713,6 +713,7 @@ static const char* DebrisDispositionNames[] = "FLOATING", "INHERIT_VELOCITY", "WHIRLING", + NULL }; std::vector debrisModelNamesGlobalHack; From 1b8c7d98cacfb1c19fdfc4aa7ad9a5c93d67e30b Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Fri, 19 Sep 2025 18:56:57 +1000 Subject: [PATCH 082/343] bugfix(behavior): Fix hardcoded cash hack value for Black Lotus (#1601) --- .../GameLogic/Object/Update/SpecialAbilityUpdate.cpp | 8 ++++++-- .../GameLogic/Object/Update/SpecialAbilityUpdate.cpp | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp index 39d5045da63..8c18011244e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp @@ -1335,14 +1335,18 @@ void SpecialAbilityUpdate::triggerAbilityEffect() return; } - //Steal a thousand cash from the other team! + //Steal cash from the other team! Money *targetMoney = target->getControllingPlayer()->getMoney(); Money *objectMoney = object->getControllingPlayer()->getMoney(); if( targetMoney && objectMoney ) { UnsignedInt cash = targetMoney->countMoney(); +#if RETAIL_COMPATIBLE_CRC UnsignedInt desiredAmount = 1000; - //Check to see if they have 1000 cash, otherwise, take the remainder! +#else + UnsignedInt desiredAmount = data->m_effectValue; +#endif + //Check to see if they have the cash, otherwise, take the remainder! cash = min( desiredAmount, cash ); if( cash > 0 ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp index 052f912ad05..da4f9503c15 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp @@ -1481,14 +1481,18 @@ void SpecialAbilityUpdate::triggerAbilityEffect() return; } - //Steal a thousand cash from the other team! + //Steal cash from the other team! Money *targetMoney = target->getControllingPlayer()->getMoney(); Money *objectMoney = object->getControllingPlayer()->getMoney(); if( targetMoney && objectMoney ) { UnsignedInt cash = targetMoney->countMoney(); +#if RETAIL_COMPATIBLE_CRC UnsignedInt desiredAmount = 1000; - //Check to see if they have 1000 cash, otherwise, take the remainder! +#else + UnsignedInt desiredAmount = data->m_effectValue; +#endif + //Check to see if they have the cash, otherwise, take the remainder! cash = min( desiredAmount, cash ); if( cash > 0 ) { From 783bdb771ed5be9cb957d6c42770862b6d73ea5d Mon Sep 17 00:00:00 2001 From: Felipe Braz Date: Fri, 19 Sep 2025 06:03:57 -0300 Subject: [PATCH 083/343] ci(release): Add weekly pre-releases workflow for Generals and GeneralsMD (#929) --- .github/workflows/weekly-release.yml | 210 +++++++++++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 .github/workflows/weekly-release.yml diff --git a/.github/workflows/weekly-release.yml b/.github/workflows/weekly-release.yml new file mode 100644 index 00000000000..990c869ef2f --- /dev/null +++ b/.github/workflows/weekly-release.yml @@ -0,0 +1,210 @@ +name: Weekly Release + +permissions: + contents: write + pull-requests: write + +on: + workflow_dispatch: + inputs: + build_notes: + description: 'Build notes (optional)' + required: false + default: '' + type: string + known_issues: + description: 'Known issues (optional)' + required: false + default: '' + type: string + force_changed: + description: 'Force build' + required: false + default: 'false' + type: choice + options: + - 'false' + - 'true' + pre-release: + description: 'Mark release as pre-release' + required: false + default: 'false' + type: choice + options: + - 'false' + - 'true' + + schedule: + - cron: '0 9 * * 5' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + get-date: + runs-on: ubuntu-latest + outputs: + date: ${{ steps.date.outputs.date }} + steps: + - name: Get current date + id: date + run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT + + detect-scm-changes: + needs: [get-date] + runs-on: ubuntu-latest + outputs: + changed: ${{ steps.check.outputs.changed }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + - id: check + run: | + if [ "${{ github.event.inputs.force_changed }}" = "true" ]; then + echo "changed=true" >> $GITHUB_OUTPUT + exit 0 + fi + + echo LAST TAG: + git describe --tags --abbrev=0 2>/dev/null || echo "" + + LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") + if [ -z "$LAST_TAG" ]; then + echo "changed=true" >> $GITHUB_OUTPUT + exit 0 + fi + CHANGED=$(git diff --name-only $LAST_TAG..HEAD | grep -v '.github/workflows/' | wc -l) + if [ "$CHANGED" -eq "0" ]; then + echo "changed=false" >> $GITHUB_OUTPUT + else + echo "changed=true" >> $GITHUB_OUTPUT + fi + + build-generals: + needs: [detect-scm-changes, get-date] + if: needs.detect-scm-changes.outputs.changed == 'true' + name: Build Generals${{ matrix.preset && '' }} + strategy: + matrix: + include: + - preset: "vc6" + tools: true + extras: false + release: true + fail-fast: false + uses: ./.github/workflows/build-toolchain.yml + with: + game: "Generals" + preset: ${{ matrix.preset }} + tools: ${{ matrix.tools }} + extras: ${{ matrix.extras }} + secrets: inherit + + build-generalsmd: + needs: [detect-scm-changes, get-date] + if: needs.detect-scm-changes.outputs.changed == 'true' + name: Build GeneralsMD${{ matrix.preset && '' }} + strategy: + matrix: + include: + - preset: "vc6" + tools: true + extras: false + release: true + fail-fast: false + uses: ./.github/workflows/build-toolchain.yml + with: + game: "GeneralsMD" + preset: ${{ matrix.preset }} + tools: ${{ matrix.tools }} + extras: ${{ matrix.extras }} + secrets: inherit + + create-release: + name: Create Release + needs: [build-generals, build-generalsmd, get-date] + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + + - name: Collect commits since last release + id: changelog + run: | + LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") + if [ -z "$LAST_TAG" ]; then + CHANGELOG_COMMITS=$(git log --pretty="format:- %s" --no-merges HEAD | head -n 10 || true) + else + CHANGELOG_COMMITS=$(git log --pretty="format:- %s" --no-merges "$LAST_TAG"..HEAD || true) + fi + if [ -z "$CHANGELOG_COMMITS" ]; then + CHANGELOG_COMMITS="- No relevant changes detected since the last release." + fi + { + echo 'commits<> "$GITHUB_OUTPUT" + + # Generals vc6 + - name: Download Generals VC6 Artifacts + uses: actions/download-artifact@v4 + with: + name: Generals-vc6+t + path: generals-vc6-artifacts + + - name: Prepare and Zip Generals VC6 + run: | + zip -jr generals-weekly-${{ needs.get-date.outputs.date }}.zip generals-vc6-artifacts/* + + # GeneralsMD vc6 + - name: Download GeneralsMD VC6 Artifacts + uses: actions/download-artifact@v4 + with: + name: GeneralsMD-vc6+t + path: generalsmd-vc6-artifacts + + - name: Prepare and Zip GeneralsMD VC6 + run: | + zip -jr generalszh-weekly-${{ needs.get-date.outputs.date }}.zip generalsmd-vc6-artifacts/* + + - name: Generate release notes + id: release_body + run: | + BODY="" + if [ "${{ github.event.inputs.build_notes }}" != "" ]; then + BODY="${BODY}### Build notes\n${{ github.event.inputs.build_notes }}\n" + fi + if [ "${{ github.event.inputs.known_issues }}" != "" ]; then + BODY="${BODY}### Known issues\n${{ github.event.inputs.known_issues }}\n" + fi + BODY="${BODY}### Changelog\n${{ steps.changelog.outputs.commits }}" + echo "body<> $GITHUB_OUTPUT + echo -e "$BODY" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + tag_name: weekly-${{ needs.get-date.outputs.date }} + name: weekly-${{ needs.get-date.outputs.date }} + prerelease: ${{ github.event.inputs.pre-release == 'true' }} + body: ${{ steps.release_body.outputs.body }} + files: | + generals-weekly-${{ needs.get-date.outputs.date }}.zip + generalszh-weekly-${{ needs.get-date.outputs.date }}.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Clean up release folders + if: always() + run: | + rm -rf generals-vc6-artifacts generalsmd-vc6-artifacts + rm -f generals-weekly-${{ needs.get-date.outputs.date }}.zip + rm -f generalszh-weekly-${{ needs.get-date.outputs.date }}.zip From 70e72925ba0d6858cc389369c34f1aa7af13a32b Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Sat, 20 Sep 2025 09:30:46 +0100 Subject: [PATCH 084/343] bugfix(pathfinder): Fix various crashes in Pathfinder due to inadequate cleanup of pathfinding resources (#994) Co-authored-by: Bart Roossien --- Core/GameEngine/Include/Common/GameDefines.h | 7 + .../GameEngine/Include/GameLogic/AIPathfind.h | 6 + .../Source/GameLogic/AI/AIPathfind.cpp | 610 +++++++++++++++-- .../GameEngine/Include/GameLogic/AIPathfind.h | 6 + .../Source/GameLogic/AI/AIPathfind.cpp | 613 ++++++++++++++++-- 5 files changed, 1129 insertions(+), 113 deletions(-) diff --git a/Core/GameEngine/Include/Common/GameDefines.h b/Core/GameEngine/Include/Common/GameDefines.h index 2736ad0ff4f..a25a044b8e5 100644 --- a/Core/GameEngine/Include/Common/GameDefines.h +++ b/Core/GameEngine/Include/Common/GameDefines.h @@ -35,6 +35,13 @@ #define RETAIL_COMPATIBLE_XFER_SAVE (1) // Game is expected to be Xfer Save compatible with retail Generals 1.08, Zero Hour 1.04 #endif +// This is here to easily toggle between the retail compatible with fixed pathfinding fallback and pure fixed pathfinding mode +#if RETAIL_COMPATIBLE_CRC +#define RETAIL_COMPATIBLE_PATHFINDING (1) +#else +#define RETAIL_COMPATIBLE_PATHFINDING (0) +#endif + // This is essentially synonymous for RETAIL_COMPATIBLE_CRC. There is a lot wrong with AIGroup, such as use-after-free, double-free, leaks, // but we cannot touch it much without breaking retail compatibility. Do not shy away from using massive hacks when fixing issues with AIGroup, // but put them behind this macro. diff --git a/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h b/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h index 84f418f224b..55e8e7bdcbb 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h +++ b/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h @@ -207,6 +207,9 @@ class PathfindCellInfo { friend class PathfindCell; public: +#if RETAIL_COMPATIBLE_PATHFINDING + static void forceCleanPathFindCellInfos(void); +#endif static void allocateCellInfos(void); static void releaseCellInfos(void); @@ -691,6 +694,9 @@ class Pathfinder : PathfindServicesInterface, public Snapshot Path *getDebugPath( void ); void setDebugPath( Path *debugpath ); +#if RETAIL_COMPATIBLE_PATHFINDING + void forceCleanCells(void); +#endif void cleanOpenAndClosedLists(void); // Adjusts the destination to a spot near dest that is not occupied by other units. diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 149584c5ffd..54a0709e94a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -1082,6 +1082,39 @@ enum { PATHFIND_CELLS_PER_FRAME=5000}; // Number of cells we will search pathfin enum {CELL_INFOS_TO_ALLOCATE = 30000}; PathfindCellInfo *PathfindCellInfo::s_infoArray = NULL; PathfindCellInfo *PathfindCellInfo::s_firstFree = NULL; + +#if RETAIL_COMPATIBLE_PATHFINDING +// TheSuperHackers @info This variable is here so the code will run down the retail compatible path till a failure mode is hit +// The pathfinding will then switch over to the corrected pathfinding code for SH clients +Bool s_useFixedPathfinding = false; +Bool s_forceCleanCells = false; + +void PathfindCellInfo::forceCleanPathFindCellInfos() +{ + for (Int i = 0; i < CELL_INFOS_TO_ALLOCATE - 1; i++) { + s_infoArray[i].m_nextOpen = NULL; + s_infoArray[i].m_prevOpen = NULL; + s_infoArray[i].m_open = FALSE; + s_infoArray[i].m_closed = FALSE; + } +} + +void Pathfinder::forceCleanCells() +{ + PathfindCellInfo::forceCleanPathFindCellInfos(); + m_openList = NULL; + m_closedList = NULL; + + for (int j = 0; j <= m_extent.hi.y; ++j) { + for (int i = 0; i <= m_extent.hi.x; ++i) { + if (m_map[i][j].hasInfo()) { + m_map[i][j].releaseInfo(); + } + } + } +} +#endif + /** * Allocates a pool of pathfind cell infos. */ @@ -1220,7 +1253,14 @@ Bool PathfindCell::startPathfind( PathfindCell *goalCell ) if (goalCell) { m_info->m_totalCost = costToGoal( goalCell ); } - m_info->m_open = TRUE; +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + m_info->m_open = TRUE; + } else +#endif + { + m_info->m_open = FALSE; + } m_info->m_closed = FALSE; return true; } @@ -1274,6 +1314,17 @@ Bool PathfindCell::allocateInfo( const ICoord2D &pos ) */ void PathfindCell::releaseInfo( void ) { + // TheSuperHackers @bugfix Mauller/SkyAero 05/06/2025 Parent cell links need clearing to prevent dangling pointers on starting points that can link them to an invalid parent cell. + // Parent cells are only cleared within Pathfinder::prependCells, so cells that do not make it onto the final path do not get their parent cell cleared. + // Cells with a special flags also do not get their PathfindCellInfo cleared and therefore can leave a parent cell set on a starting cell. +#if RETAIL_COMPATIBLE_PATHFINDING + if (s_useFixedPathfinding) +#endif + { + if (m_info) { + m_info->m_pathParent = NULL; + } + } if (m_type==PathfindCell::CELL_OBSTACLE) { return; } @@ -1566,9 +1617,21 @@ Int PathfindCell::releaseOpenList( PathfindCell *list ) DEBUG_ASSERTCRASH(list->m_info->m_closed==FALSE && list->m_info->m_open==TRUE, ("Serious error - Invalid flags. jba")); PathfindCell *cur = list; PathfindCellInfo *curInfo = list->m_info; + +#if RETAIL_COMPATIBLE_PATHFINDING + // TheSuperHackers @info This is only here to catch a crash point in the retail compatible pathfinding + // One crash mode is where a cell has no PathfindCellInfo, resulting in a nullptr access and a crash. + // Therefore we signal that we need to clean the maps cells and the PathfindCellInfos + if(!curInfo && !s_useFixedPathfinding) { + s_useFixedPathfinding = true; + s_forceCleanCells = true; + return count; + } +#endif + if (curInfo->m_nextOpen) { list = curInfo->m_nextOpen->m_cell; - } else { + } else { list = NULL; } DEBUG_ASSERTCRASH(cur == curInfo->m_cell, ("Bad backpointer in PathfindCellInfo")); @@ -1590,9 +1653,20 @@ Int PathfindCell::releaseClosedList( PathfindCell *list ) DEBUG_ASSERTCRASH(list->m_info->m_closed==TRUE && list->m_info->m_open==FALSE, ("Serious error - Invalid flags. jba")); PathfindCell *cur = list; PathfindCellInfo *curInfo = list->m_info; +#if RETAIL_COMPATIBLE_PATHFINDING + // TheSuperHackers @info This is only here to catch a crash point in the retail compatible pathfinding + // One crash mode is where a cell has no PathfindCellInfo, resulting in a nullptr access and a crash. + // Therefore we signal that we need to clean the maps cells and the PathfindCellInfos + if(!curInfo && !s_useFixedPathfinding) { + s_useFixedPathfinding = true; + s_forceCleanCells = true; + return count; + } +#endif + if (curInfo->m_nextOpen) { list = curInfo->m_nextOpen->m_cell; - } else { + } else { list = NULL; } DEBUG_ASSERTCRASH(cur == curInfo->m_cell, ("Bad backpointer in PathfindCellInfo")); @@ -1712,6 +1786,16 @@ UnsignedInt PathfindCell::costSoFar( PathfindCell *parent ) Int numTurns = 0; PathfindCell *prevCell = parent->getParentCell(); if (prevCell) { + +#if RETAIL_COMPATIBLE_PATHFINDING + // TheSuperHackers @info this is a possible crash point in the retail pathfinding, we just prevent the crash at this point + // External code should catch the issue in another block and cleanup the pathfinding before switching to the fixed pathfinding. + if (!prevCell->hasInfo()) + { + return cost; + } +#endif + ICoord2D dir; dir.x = prevCell->getXIndex() - parent->getXIndex(); dir.y = prevCell->getYIndex() - parent->getYIndex(); @@ -3438,6 +3522,11 @@ void Pathfinder::reset( void ) m_wallHeight = 0.0f; } m_zoneManager.reset(); + +#if RETAIL_COMPATIBLE_PATHFINDING + s_useFixedPathfinding = false; + s_forceCleanCells = false; +#endif } /** @@ -4241,10 +4330,31 @@ void Pathfinder::cleanOpenAndClosedLists(void) { count += PathfindCell::releaseOpenList(m_openList); m_openList = NULL; } + +#if RETAIL_COMPATIBLE_PATHFINDING + // TheSuperHackers @info this is here as the map cells are contained within the pathfinder and cannot be cleaned externally. + // If the crash mode within PathfindCell::releaseOpenList is hit, it will set s_forceCleanCells to allow the system to cleanly recover. + if (s_forceCleanCells) { + forceCleanCells(); + // TheSuperHackers @info cells on the closed list are forcefully cleaned up by this point + s_forceCleanCells = false; + } +#endif + if (m_closedList) { count += PathfindCell::releaseClosedList(m_closedList); m_closedList = NULL; } + +#if RETAIL_COMPATIBLE_PATHFINDING + // TheSuperHackers @info this is here and performs the same function as the above block, but for when the crash occurs within the closed list. + // If the crash mode within PathfindCell::releaseClosedList is hit, it will set s_forceCleanCells to allow the system to cleanly recover. + if (s_forceCleanCells) { + forceCleanCells(); + s_forceCleanCells = false; + } +#endif + m_cumulativeCellsAllocated += count; //#ifdef RTS_DEBUG #if 0 @@ -5955,10 +6065,24 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe zone2 = m_zoneManager.getEffectiveZone(locomotorSet.getValidSurfaces(), isCrusher, goalCell->getZone()); if (layer==LAYER_WALL && zone1 == 0) { +#if RETAIL_COMPATIBLE_PATHFINDING + if (s_useFixedPathfinding) +#endif + { + goalCell->releaseInfo(); + parentCell->releaseInfo(); + } return NULL; } if (destinationLayer==LAYER_WALL && zone2 == 0) { +#if RETAIL_COMPATIBLE_PATHFINDING + if (s_useFixedPathfinding) +#endif + { + goalCell->releaseInfo(); + parentCell->releaseInfo(); + } return NULL; } @@ -6038,8 +6162,18 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe m_isTunneling = false; // construct and return path Path *path = buildActualPath( obj, locomotorSet.getValidSurfaces(), from, goalCell, centerInCell, false ); - parentCell->releaseInfo(); - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) + { + parentCell->releaseInfo(); + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + } return path; } @@ -6115,8 +6249,19 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe #endif m_isTunneling = false; - goalCell->releaseInfo(); - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) + { + goalCell->releaseInfo(); + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + goalCell->releaseInfo(); + } return NULL; } @@ -6466,6 +6611,12 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, PathfindLayerEnum layer = TheTerrainLogic->getLayerForDestination(from); PathfindCell *parentCell = getClippedCell( layer,&clipFrom ); if (parentCell == NULL) { +#if RETAIL_COMPATIBLE_PATHFINDING + if (s_useFixedPathfinding) +#endif + { + goalCell->releaseInfo(); + } return NULL; } if (parentCell!=goalCell) { @@ -6528,8 +6679,18 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, m_isTunneling = false; // construct and return path Path *path = buildGroundPath(crusher, from, goalCell, centerInCell, pathDiameter ); - parentCell->releaseInfo(); - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) + { + parentCell->releaseInfo(); + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + } return path; } @@ -6733,8 +6894,19 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, TheGameLogic->incrementOverallFailedPathfinds(); #endif m_isTunneling = false; - goalCell->releaseInfo(); - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) + { + goalCell->releaseInfo(); + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + goalCell->releaseInfo(); + } return NULL; } @@ -6788,8 +6960,19 @@ void Pathfinder::processHierarchicalCell( const ICoord2D &scanCell, const ICoord } newCell->allocateInfo(scanCell); - if (!newCell->getClosed() && !newCell->getOpen()) { - m_closedList = newCell->putOnClosedList(m_closedList); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) + { + if (!newCell->getClosed() && !newCell->getOpen()) { + m_closedList = newCell->putOnClosedList(m_closedList); + } + } + else +#endif + { + if (newCell->hasInfo() && !newCell->getClosed() && !newCell->getOpen()) { + m_closedList = newCell->putOnClosedList(m_closedList); + } } adjNewCell->allocateInfo(adjacentCell); @@ -6942,7 +7125,22 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu // Close parent cell; m_openList = parentCell->removeFromOpenList(m_openList); m_closedList = parentCell->putOnClosedList(m_closedList); - startCell->allocateInfo(ndx); + if (!startCell->allocateInfo(ndx)) { + // TheSuperHackers @info We need to forcefully cleanup dangling pathfinding cells if this failure condition is hit in retail + // Retail clients will crash beyond this point, but we attempt to recover by performing a full cleanup then enabling the fixed pathfinding codepath +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + s_useFixedPathfinding = true; + forceCleanCells(); + } + else +#endif + { + cleanOpenAndClosedLists(); + goalCell->releaseInfo(); + } + return NULL; + } startCell->setParentCellHierarchical(parentCell); cellCount++; Int curCost = startCell->costToHierGoal(parentCell); @@ -6954,7 +7152,22 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu m_openList = startCell->putOnSortedOpenList( m_openList ); cellCount++; - cell->allocateInfo(toNdx); + if(!cell->allocateInfo(toNdx)) { + // TheSuperHackers @info We need to forcefully cleanup dangling pathfinding cells if this failure condition is hit in retail + // Retail clients will crash beyond this point, but we attempt to recover by performing a full cleanup then enabling the fixed pathfinding codepath +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + s_useFixedPathfinding = true; + forceCleanCells(); + } + else +#endif + { + cleanOpenAndClosedLists(); + goalCell->releaseInfo(); + } + return NULL; + } curCost = cell->costToHierGoal(parentCell); remCost = cell->costToHierGoal(goalCell); cell->setCostSoFar(curCost); @@ -7038,13 +7251,43 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu PathfindCell *startCell = getCell(LAYER_GROUND, ndx.x, ndx.y); if (startCell==NULL) continue; if (startCell != parentCell) { - startCell->allocateInfo(ndx); + if(!startCell->allocateInfo(ndx)) { + // TheSuperHackers @info We need to forcefully cleanup dangling pathfinding cells if this failure condition is hit in retail + // Retail clients will crash beyond this point, but we attempt to recover by performing a full cleanup then enabling the fixed pathfinding codepath +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + s_useFixedPathfinding = true; + forceCleanCells(); + } + else +#endif + { + cleanOpenAndClosedLists(); + goalCell->releaseInfo(); + } + return NULL; + } startCell->setParentCellHierarchical(parentCell); if (!startCell->getClosed() && !startCell->getOpen()) { m_closedList = startCell->putOnClosedList(m_closedList); } } - cell->allocateInfo(toNdx); + if(!cell->allocateInfo(toNdx)) { + // TheSuperHackers @info We need to forcefully cleanup dangling pathfinding cells if this failure condition is hit in retail + // Retail clients will crash beyond this point, but we attempt to recover by performing a full cleanup then enabling the fixed pathfinding codepath +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + s_useFixedPathfinding = true; + forceCleanCells(); + } + else +#endif + { + cleanOpenAndClosedLists(); + goalCell->releaseInfo(); + } + return NULL; + } cell->setParentCellHierarchical(startCell); cellCount++; @@ -7098,11 +7341,22 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu #endif } #endif - if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) { +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) + { + if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) { + goalCell->releaseInfo(); + } + parentCell->releaseInfo(); + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); goalCell->releaseInfo(); } - parentCell->releaseInfo(); - cleanOpenAndClosedLists(); return path; } @@ -7299,10 +7553,21 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu } #endif #endif - if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) { +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) + { + if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) { + goalCell->releaseInfo(); + } + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); goalCell->releaseInfo(); } - cleanOpenAndClosedLists(); return path; } @@ -7348,8 +7613,20 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu TheGameLogic->incrementOverallFailedPathfinds(); #endif m_isTunneling = false; - goalCell->releaseInfo(); - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) + { + goalCell->releaseInfo(); + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + goalCell->releaseInfo(); + } + return NULL; } @@ -7551,7 +7828,11 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet if (parentCell!=goalCell) { if (!parentCell->allocateInfo(startCellNdx)) { - desiredCell->releaseInfo(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + desiredCell->releaseInfo(); + } +#endif goalCell->releaseInfo(); return FALSE; } @@ -7666,6 +7947,13 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet if (!newCell->allocateInfo(newCellCoord)) { // Out of cells for pathing... +#if RETAIL_COMPATIBLE_PATHFINDING + if (s_useFixedPathfinding) +#endif + { + cleanOpenAndClosedLists(); + goalCell->releaseInfo(); + } return cellCount; } cellCount++; @@ -7722,8 +8010,19 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet } #endif m_isTunneling = false; - cleanOpenAndClosedLists(); - goalCell->releaseInfo(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + cleanOpenAndClosedLists(); + goalCell->releaseInfo(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + goalCell->releaseInfo(); + } + return false; } @@ -7849,16 +8148,34 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con parentCell = m_openList; m_openList = parentCell->removeFromOpenList(m_openList); - // put parent cell onto closed list - its evaluation is finished - m_closedList = parentCell->putOnClosedList( m_closedList ); + // put parent cell onto closed list - its evaluation is finished - Retail compatible behaviour +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + m_closedList = parentCell->putOnClosedList( m_closedList ); + } +#endif if (parentCell==goalCell) { Int cost = parentCell->getTotalCost(); m_isTunneling = false; cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (s_useFixedPathfinding) +#endif + { + parentCell->releaseInfo(); + } return cost; } + // put parent cell onto closed list - its evaluation is finished - Fixed behaviour +#if RETAIL_COMPATIBLE_PATHFINDING + if (s_useFixedPathfinding) +#endif + { + m_closedList = parentCell->putOnClosedList( m_closedList ); + } + if (cellCount > MAX_CELL_COUNT) { continue; } @@ -7919,6 +8236,14 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con if (!newCell->allocateInfo(newCellCoord)) { // Out of cells for pathing... +#if RETAIL_COMPATIBLE_PATHFINDING + if (s_useFixedPathfinding) +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + goalCell->releaseInfo(); + } return cellCount; } cellCount++; @@ -7961,16 +8286,36 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con if (newCell->getOpen()) m_openList = newCell->removeFromOpenList( m_openList ); +#if RETAIL_COMPATIBLE_PATHFINDING + // TheSuperHacker @info This is here to catch a retail pathfinding crash point and to recover from it + // A cell has gotten onto the open list without pathfinding info due to a danling m_open pointer on the previous listed cell so we need to force a cleanup + if (!s_useFixedPathfinding && m_openList && !m_openList->hasInfo()) { + s_useFixedPathfinding = true; + forceCleanCells(); + return MAX_COST; + } +#endif + // insert newCell in open list such that open list is sorted, smallest total path cost first m_openList = newCell->putOnSortedOpenList( m_openList ); } } m_isTunneling = false; - if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) { +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) { + goalCell->releaseInfo(); + } + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); goalCell->releaseInfo(); } - cleanOpenAndClosedLists(); return MAX_COST; } @@ -8107,6 +8452,12 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet if (parentCell!=goalCell) { worldToCell(&clipFrom, &pos2d); if (!parentCell->allocateInfo(pos2d)) { +#if RETAIL_COMPATIBLE_PATHFINDING + if (s_useFixedPathfinding) +#endif + { + goalCell->releaseInfo(); + } return NULL; } } @@ -8169,9 +8520,20 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet m_isTunneling = false; // construct and return path Path *path = buildActualPath( obj, locomotorSet.getValidSurfaces(), from, goalCell, centerInCell, blocked); - parentCell->releaseInfo(); - goalCell->releaseInfo(); - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + parentCell->releaseInfo(); + goalCell->releaseInfo(); + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + goalCell->releaseInfo(); + } + return path; } // put parent cell onto closed list - its evaluation is finished @@ -8250,8 +8612,18 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet rawTo->y = closesetCell->getYIndex()*PATHFIND_CELL_SIZE_F + PATHFIND_CELL_SIZE_F/2.0f; // construct and return path Path *path = buildActualPath( obj, locomotorSet.getValidSurfaces(), from, closesetCell, centerInCell, blocked ); - goalCell->releaseInfo(); - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + goalCell->releaseInfo(); + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + goalCell->releaseInfo(); + } return path; } @@ -8271,8 +8643,18 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet TheGameLogic->incrementOverallFailedPathfinds(); #endif m_isTunneling = false; - goalCell->releaseInfo(); - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + goalCell->releaseInfo(); + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + goalCell->releaseInfo(); + } return NULL; } @@ -8394,6 +8776,33 @@ void Pathfinder::prependCells( Path *path, const Coord3D *fromPos, } prevCell = cell; } + +#if RETAIL_COMPATIBLE_PATHFINDING + // TheSuperHackers @info This pathway is here for retail compatibility, it is to catch when a starting cell has a dangling parent that contains no pathing information + // Beyond this point a retail client will crash due to a null pointer access within cell->getXIndex() + // To recover from this we set the cell to the previous cell, which should be the actual starting cell then set to use the fixed pathing and perform a forced cleanup + if (!s_useFixedPathfinding) { + if (!cell->hasInfo()) { + cell = prevCell; + + m_zoneManager.setPassable(cell->getXIndex(), cell->getYIndex(), true); + if (goalCellNull) { + // Very short path. + adjustCoordToCell(cell->getXIndex(), cell->getYIndex(), center, pos, cell->getLayer()); + path->prependNode( &pos, cell->getLayer() ); + } + // put actual start position as first node on the path, so it begins right at the unit's feet + if (fromPos->x != path->getFirstNode()->getPosition()->x || fromPos->y != path->getFirstNode()->getPosition()->y) { + path->prependNode( fromPos, cell->getLayer() ); + } + + s_useFixedPathfinding = true; + forceCleanCells(); + return; + } + } +#endif + m_zoneManager.setPassable(cell->getXIndex(), cell->getYIndex(), true); if (goalCellNull) { // Very short path. @@ -9633,8 +10042,17 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, m_isTunneling = false; // construct and return path Path *newPath = buildActualPath( obj, locomotorSet.getValidSurfaces(), obj->getPosition(), parentCell, centerInCell, false); - parentCell->releaseInfo(); - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + parentCell->releaseInfo(); + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + } return newPath; } // put parent cell onto closed list - its evaluation is finished @@ -9655,7 +10073,16 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, DEBUG_LOG(("Unit '%s', time %f", obj->getTemplate()->getName().str(), (::GetTickCount()-startTimeMS)/1000.0f)); m_isTunneling = false; - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + } return NULL; } @@ -9771,7 +10198,15 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet } if (startNode == originalPath->getLastNode()) { - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + cleanOpenAndClosedLists(); + } + else +#endif + { + parentCell->releaseInfo(); + } return NULL; // no open nodes. } PathfindCell *candidateGoal; @@ -9779,6 +10214,12 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet ICoord2D goalCellNdx; worldToCell(&goalPos, &goalCellNdx); if (!candidateGoal->allocateInfo(goalCellNdx)) { +#if RETAIL_COMPATIBLE_PATHFINDING + if (s_useFixedPathfinding) +#endif + { + parentCell->releaseInfo(); + } return NULL; } @@ -9813,9 +10254,19 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet // cleanup the path by checking line of sight path->optimize(obj, locomotorSet.getValidSurfaces(), blocked); - parentCell->releaseInfo(); - cleanOpenAndClosedLists(); - candidateGoal->releaseInfo(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + parentCell->releaseInfo(); + cleanOpenAndClosedLists(); + candidateGoal->releaseInfo(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + candidateGoal->releaseInfo(); + } return path; } @@ -9838,12 +10289,22 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet } #endif m_isTunneling = false; - if (!candidateGoal->getOpen() && !candidateGoal->getClosed()) +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + if (!candidateGoal->getOpen() && !candidateGoal->getClosed()) + { + // Not on one of the lists + candidateGoal->releaseInfo(); + } + cleanOpenAndClosedLists(); + } + else +#endif { - // Not on one of the lists + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); candidateGoal->releaseInfo(); } - cleanOpenAndClosedLists(); return NULL; } @@ -10077,11 +10538,20 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot #endif // construct and return path Path *path = buildActualPath( obj, locomotorSet.getValidSurfaces(), obj->getPosition(), parentCell, centerInCell, false); - parentCell->releaseInfo(); - if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) { +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) { + goalCell->releaseInfo(); + } + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); goalCell->releaseInfo(); } - cleanOpenAndClosedLists(); return path; } } @@ -10137,10 +10607,20 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot TheGameLogic->incrementOverallFailedPathfinds(); #endif m_isTunneling = false; - if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) { +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) { + goalCell->releaseInfo(); + } + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); goalCell->releaseInfo(); } - cleanOpenAndClosedLists(); return NULL; } @@ -10262,8 +10742,17 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor #endif // construct and return path Path *path = buildActualPath( obj, locomotorSet.getValidSurfaces(), obj->getPosition(), parentCell, centerInCell, false); - parentCell->releaseInfo(); - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + parentCell->releaseInfo(); + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + } return path; } @@ -10297,7 +10786,16 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor TheGameLogic->incrementOverallFailedPathfinds(); #endif m_isTunneling = false; - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + } return NULL; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h index c324ecd15d7..5f7c012ae93 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h @@ -208,6 +208,9 @@ class PathfindCellInfo { friend class PathfindCell; public: +#if RETAIL_COMPATIBLE_PATHFINDING + static void forceCleanPathFindCellInfos(void); +#endif static void allocateCellInfos(void); static void releaseCellInfos(void); @@ -699,6 +702,9 @@ class Pathfinder : PathfindServicesInterface, public Snapshot Path *getDebugPath( void ); void setDebugPath( Path *debugpath ); +#if RETAIL_COMPATIBLE_PATHFINDING + void forceCleanCells(void); +#endif void cleanOpenAndClosedLists(void); // Adjusts the destination to a spot near dest that is not occupied by other units. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index cce92a82fd0..22773b296f3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -1100,6 +1100,39 @@ enum { PATHFIND_CELLS_PER_FRAME=5000}; // Number of cells we will search pathfin enum {CELL_INFOS_TO_ALLOCATE = 30000}; PathfindCellInfo *PathfindCellInfo::s_infoArray = NULL; PathfindCellInfo *PathfindCellInfo::s_firstFree = NULL; + +#if RETAIL_COMPATIBLE_PATHFINDING +// TheSuperHackers @info This variable is here so the code will run down the retail compatible path till a failure mode is hit +// The pathfinding will then switch over to the corrected pathfinding code for SH clients +Bool s_useFixedPathfinding = false; +Bool s_forceCleanCells = false; + +void PathfindCellInfo::forceCleanPathFindCellInfos() +{ + for (Int i = 0; i < CELL_INFOS_TO_ALLOCATE - 1; i++) { + s_infoArray[i].m_nextOpen = NULL; + s_infoArray[i].m_prevOpen = NULL; + s_infoArray[i].m_open = FALSE; + s_infoArray[i].m_closed = FALSE; + } +} + +void Pathfinder::forceCleanCells() +{ + PathfindCellInfo::forceCleanPathFindCellInfos(); + m_openList = NULL; + m_closedList = NULL; + + for (int j = 0; j <= m_extent.hi.y; ++j) { + for (int i = 0; i <= m_extent.hi.x; ++i) { + if (m_map[i][j].hasInfo()) { + m_map[i][j].releaseInfo(); + } + } + } +} +#endif + /** * Allocates a pool of pathfind cell infos. */ @@ -1238,7 +1271,14 @@ Bool PathfindCell::startPathfind( PathfindCell *goalCell ) if (goalCell) { m_info->m_totalCost = costToGoal( goalCell ); } - m_info->m_open = TRUE; +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + m_info->m_open = TRUE; + } else +#endif + { + m_info->m_open = FALSE; + } m_info->m_closed = FALSE; return true; } @@ -1290,8 +1330,19 @@ Bool PathfindCell::allocateInfo( const ICoord2D &pos ) /** * Releases an info record for a cell. */ -void PathfindCell::releaseInfo( void ) -{ +void PathfindCell::releaseInfo( void ) +{ + // TheSuperHackers @bugfix Mauller/SkyAero 05/06/2025 Parent cell links need clearing to prevent dangling pointers on starting points that can link them to an invalid parent cell. + // Parent cells are only cleared within Pathfinder::prependCells, so cells that do not make it onto the final path do not get their parent cell cleared. + // Cells with a special flags also do not get their PathfindCellInfo cleared and therefore can leave a parent cell set on a starting cell. +#if RETAIL_COMPATIBLE_PATHFINDING + if (s_useFixedPathfinding) +#endif + { + if (m_info) { + m_info->m_pathParent = NULL; + } + } if (m_type==PathfindCell::CELL_OBSTACLE) { return; } @@ -1586,9 +1637,21 @@ Int PathfindCell::releaseOpenList( PathfindCell *list ) DEBUG_ASSERTCRASH(list->m_info->m_closed==FALSE && list->m_info->m_open==TRUE, ("Serious error - Invalid flags. jba")); PathfindCell *cur = list; PathfindCellInfo *curInfo = list->m_info; + +#if RETAIL_COMPATIBLE_PATHFINDING + // TheSuperHackers @info This is only here to catch a crash point in the retail compatible pathfinding + // One crash mode is where a cell has no PathfindCellInfo, resulting in a nullptr access and a crash. + // Therefore we signal that we need to clean the maps cells and the PathfindCellInfos + if(!curInfo && !s_useFixedPathfinding) { + s_useFixedPathfinding = true; + s_forceCleanCells = true; + return count; + } +#endif + if (curInfo->m_nextOpen) { list = curInfo->m_nextOpen->m_cell; - } else { + } else { list = NULL; } DEBUG_ASSERTCRASH(cur == curInfo->m_cell, ("Bad backpointer in PathfindCellInfo")); @@ -1610,9 +1673,20 @@ Int PathfindCell::releaseClosedList( PathfindCell *list ) DEBUG_ASSERTCRASH(list->m_info->m_closed==TRUE && list->m_info->m_open==FALSE, ("Serious error - Invalid flags. jba")); PathfindCell *cur = list; PathfindCellInfo *curInfo = list->m_info; +#if RETAIL_COMPATIBLE_PATHFINDING + // TheSuperHackers @info This is only here to catch a crash point in the retail compatible pathfinding + // One crash mode is where a cell has no PathfindCellInfo, resulting in a nullptr access and a crash. + // Therefore we signal that we need to clean the maps cells and the PathfindCellInfos + if(!curInfo && !s_useFixedPathfinding) { + s_useFixedPathfinding = true; + s_forceCleanCells = true; + return count; + } +#endif + if (curInfo->m_nextOpen) { list = curInfo->m_nextOpen->m_cell; - } else { + } else { list = NULL; } DEBUG_ASSERTCRASH(cur == curInfo->m_cell, ("Bad backpointer in PathfindCellInfo")); @@ -1736,6 +1810,16 @@ UnsignedInt PathfindCell::costSoFar( PathfindCell *parent ) Int numTurns = 0; PathfindCell *prevCell = parent->getParentCell(); if (prevCell) { + +#if RETAIL_COMPATIBLE_PATHFINDING + // TheSuperHackers @info this is a possible crash point in the retail pathfinding, we just prevent the crash at this point + // External code should catch the issue in another block and cleanup the pathfinding before switching to the fixed pathfinding. + if (!prevCell->hasInfo()) + { + return cost; + } +#endif + ICoord2D dir; dir.x = prevCell->getXIndex() - parent->getXIndex(); dir.y = prevCell->getYIndex() - parent->getYIndex(); @@ -3880,6 +3964,11 @@ void Pathfinder::reset( void ) m_wallHeight = 0.0f; } m_zoneManager.reset(); + +#if RETAIL_COMPATIBLE_PATHFINDING + s_useFixedPathfinding = false; + s_forceCleanCells = false; +#endif } /** @@ -4735,10 +4824,31 @@ void Pathfinder::cleanOpenAndClosedLists(void) { count += PathfindCell::releaseOpenList(m_openList); m_openList = NULL; } + +#if RETAIL_COMPATIBLE_PATHFINDING + // TheSuperHackers @info this is here as the map cells are contained within the pathfinder and cannot be cleaned externally. + // If the crash mode within PathfindCell::releaseOpenList is hit, it will set s_forceCleanCells to allow the system to cleanly recover. + if (s_forceCleanCells) { + forceCleanCells(); + // TheSuperHackers @info cells on the closed list are forcefully cleaned up by this point + s_forceCleanCells = false; + } +#endif + if (m_closedList) { count += PathfindCell::releaseClosedList(m_closedList); m_closedList = NULL; } + +#if RETAIL_COMPATIBLE_PATHFINDING + // TheSuperHackers @info this is here and performs the same function as the above block, but for when the crash occurs within the closed list. + // If the crash mode within PathfindCell::releaseClosedList is hit, it will set s_forceCleanCells to allow the system to cleanly recover. + if (s_forceCleanCells) { + forceCleanCells(); + s_forceCleanCells = false; + } +#endif + m_cumulativeCellsAllocated += count; //#ifdef RTS_DEBUG #if 0 @@ -6477,10 +6587,24 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe zone2 = m_zoneManager.getEffectiveZone(locomotorSet.getValidSurfaces(), isCrusher, goalCell->getZone()); if (layer==LAYER_WALL && zone1 == 0) { +#if RETAIL_COMPATIBLE_PATHFINDING + if (s_useFixedPathfinding) +#endif + { + goalCell->releaseInfo(); + parentCell->releaseInfo(); + } return NULL; } if (destinationLayer==LAYER_WALL && zone2 == 0) { +#if RETAIL_COMPATIBLE_PATHFINDING + if (s_useFixedPathfinding) +#endif + { + goalCell->releaseInfo(); + parentCell->releaseInfo(); + } return NULL; } @@ -6560,8 +6684,18 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe m_isTunneling = false; // construct and return path Path *path = buildActualPath( obj, locomotorSet.getValidSurfaces(), from, goalCell, centerInCell, false ); - parentCell->releaseInfo(); - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) + { + parentCell->releaseInfo(); + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + } return path; } @@ -6637,8 +6771,19 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe #endif m_isTunneling = false; - goalCell->releaseInfo(); - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) + { + goalCell->releaseInfo(); + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + goalCell->releaseInfo(); + } return NULL; } @@ -7014,6 +7159,12 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, PathfindLayerEnum layer = TheTerrainLogic->getLayerForDestination(from); PathfindCell *parentCell = getClippedCell( layer,&clipFrom ); if (parentCell == NULL) { +#if RETAIL_COMPATIBLE_PATHFINDING + if (s_useFixedPathfinding) +#endif + { + goalCell->releaseInfo(); + } return NULL; } if (parentCell!=goalCell) { @@ -7076,8 +7227,18 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, m_isTunneling = false; // construct and return path Path *path = buildGroundPath(crusher, from, goalCell, centerInCell, pathDiameter ); - parentCell->releaseInfo(); - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) + { + parentCell->releaseInfo(); + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + } return path; } @@ -7281,8 +7442,19 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, TheGameLogic->incrementOverallFailedPathfinds(); #endif m_isTunneling = false; - goalCell->releaseInfo(); - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) + { + goalCell->releaseInfo(); + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + goalCell->releaseInfo(); + } return NULL; } @@ -7346,8 +7518,19 @@ void Pathfinder::processHierarchicalCell( const ICoord2D &scanCell, const ICoord } newCell->allocateInfo(scanCell); - if (!newCell->getClosed() && !newCell->getOpen()) { - m_closedList = newCell->putOnClosedList(m_closedList); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) + { + if (!newCell->getClosed() && !newCell->getOpen()) { + m_closedList = newCell->putOnClosedList(m_closedList); + } + } + else +#endif + { + if (newCell->hasInfo() && !newCell->getClosed() && !newCell->getOpen()) { + m_closedList = newCell->putOnClosedList(m_closedList); + } } adjNewCell->allocateInfo(adjacentCell); @@ -7504,7 +7687,22 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu // Close parent cell; m_openList = parentCell->removeFromOpenList(m_openList); m_closedList = parentCell->putOnClosedList(m_closedList); - startCell->allocateInfo(ndx); + if (!startCell->allocateInfo(ndx)) { + // TheSuperHackers @info We need to forcefully cleanup dangling pathfinding cells if this failure condition is hit in retail + // Retail clients will crash beyond this point, but we attempt to recover by performing a full cleanup then enabling the fixed pathfinding codepath +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + s_useFixedPathfinding = true; + forceCleanCells(); + } + else +#endif + { + cleanOpenAndClosedLists(); + goalCell->releaseInfo(); + } + return NULL; + } startCell->setParentCellHierarchical(parentCell); cellCount++; Int curCost = startCell->costToHierGoal(parentCell); @@ -7516,7 +7714,22 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu m_openList = startCell->putOnSortedOpenList( m_openList ); cellCount++; - cell->allocateInfo(toNdx); + if(!cell->allocateInfo(toNdx)) { + // TheSuperHackers @info We need to forcefully cleanup dangling pathfinding cells if this failure condition is hit in retail + // Retail clients will crash beyond this point, but we attempt to recover by performing a full cleanup then enabling the fixed pathfinding codepath +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + s_useFixedPathfinding = true; + forceCleanCells(); + } + else +#endif + { + cleanOpenAndClosedLists(); + goalCell->releaseInfo(); + } + return NULL; + } curCost = cell->costToHierGoal(parentCell); remCost = cell->costToHierGoal(goalCell); cell->setCostSoFar(curCost); @@ -7600,13 +7813,43 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu PathfindCell *startCell = getCell(LAYER_GROUND, ndx.x, ndx.y); if (startCell==NULL) continue; if (startCell != parentCell) { - startCell->allocateInfo(ndx); + if(!startCell->allocateInfo(ndx)) { + // TheSuperHackers @info We need to forcefully cleanup dangling pathfinding cells if this failure condition is hit in retail + // Retail clients will crash beyond this point, but we attempt to recover by performing a full cleanup then enabling the fixed pathfinding codepath +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + s_useFixedPathfinding = true; + forceCleanCells(); + } + else +#endif + { + cleanOpenAndClosedLists(); + goalCell->releaseInfo(); + } + return NULL; + } startCell->setParentCellHierarchical(parentCell); if (!startCell->getClosed() && !startCell->getOpen()) { m_closedList = startCell->putOnClosedList(m_closedList); } } - cell->allocateInfo(toNdx); + if(!cell->allocateInfo(toNdx)) { + // TheSuperHackers @info We need to forcefully cleanup dangling pathfinding cells if this failure condition is hit in retail + // Retail clients will crash beyond this point, but we attempt to recover by performing a full cleanup then enabling the fixed pathfinding codepath +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + s_useFixedPathfinding = true; + forceCleanCells(); + } + else +#endif + { + cleanOpenAndClosedLists(); + goalCell->releaseInfo(); + } + return NULL; + } cell->setParentCellHierarchical(startCell); cellCount++; @@ -7660,11 +7903,22 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu #endif } #endif - if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) { +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) + { + if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) { + goalCell->releaseInfo(); + } + parentCell->releaseInfo(); + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); goalCell->releaseInfo(); } - parentCell->releaseInfo(); - cleanOpenAndClosedLists(); return path; } @@ -7861,10 +8115,21 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu } #endif #endif - if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) { +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) + { + if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) { + goalCell->releaseInfo(); + } + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); goalCell->releaseInfo(); } - cleanOpenAndClosedLists(); return path; } @@ -7910,8 +8175,20 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu TheGameLogic->incrementOverallFailedPathfinds(); #endif m_isTunneling = false; - goalCell->releaseInfo(); - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) + { + goalCell->releaseInfo(); + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + goalCell->releaseInfo(); + } + return NULL; } @@ -8175,7 +8452,11 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet if (parentCell!=goalCell) { if (!parentCell->allocateInfo(startCellNdx)) { - desiredCell->releaseInfo(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + desiredCell->releaseInfo(); + } +#endif goalCell->releaseInfo(); return FALSE; } @@ -8290,6 +8571,13 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet if (!newCell->allocateInfo(newCellCoord)) { // Out of cells for pathing... +#if RETAIL_COMPATIBLE_PATHFINDING + if (s_useFixedPathfinding) +#endif + { + cleanOpenAndClosedLists(); + goalCell->releaseInfo(); + } return cellCount; } cellCount++; @@ -8346,8 +8634,19 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet } #endif m_isTunneling = false; - cleanOpenAndClosedLists(); - goalCell->releaseInfo(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + cleanOpenAndClosedLists(); + goalCell->releaseInfo(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + goalCell->releaseInfo(); + } + return false; } @@ -8473,16 +8772,34 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con parentCell = m_openList; m_openList = parentCell->removeFromOpenList(m_openList); - // put parent cell onto closed list - its evaluation is finished - m_closedList = parentCell->putOnClosedList( m_closedList ); + // put parent cell onto closed list - its evaluation is finished - Retail compatible behaviour +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + m_closedList = parentCell->putOnClosedList( m_closedList ); + } +#endif if (parentCell==goalCell) { Int cost = parentCell->getTotalCost(); m_isTunneling = false; cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (s_useFixedPathfinding) +#endif + { + parentCell->releaseInfo(); + } return cost; } + // put parent cell onto closed list - its evaluation is finished - Fixed behaviour +#if RETAIL_COMPATIBLE_PATHFINDING + if (s_useFixedPathfinding) +#endif + { + m_closedList = parentCell->putOnClosedList( m_closedList ); + } + if (cellCount > MAX_CELL_COUNT) { continue; } @@ -8543,6 +8860,14 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con if (!newCell->allocateInfo(newCellCoord)) { // Out of cells for pathing... +#if RETAIL_COMPATIBLE_PATHFINDING + if (s_useFixedPathfinding) +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + goalCell->releaseInfo(); + } return cellCount; } cellCount++; @@ -8585,16 +8910,36 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con if (newCell->getOpen()) m_openList = newCell->removeFromOpenList( m_openList ); +#if RETAIL_COMPATIBLE_PATHFINDING + // TheSuperHacker @info This is here to catch a retail pathfinding crash point and to recover from it + // A cell has gotten onto the open list without pathfinding info due to a danling m_open pointer on the previous listed cell so we need to force a cleanup + if (!s_useFixedPathfinding && m_openList && !m_openList->hasInfo()) { + s_useFixedPathfinding = true; + forceCleanCells(); + return MAX_COST; + } +#endif + // insert newCell in open list such that open list is sorted, smallest total path cost first m_openList = newCell->putOnSortedOpenList( m_openList ); } } m_isTunneling = false; - if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) { +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) { + goalCell->releaseInfo(); + } + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); goalCell->releaseInfo(); } - cleanOpenAndClosedLists(); return MAX_COST; } @@ -8731,6 +9076,12 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet if (parentCell!=goalCell) { worldToCell(&clipFrom, &pos2d); if (!parentCell->allocateInfo(pos2d)) { +#if RETAIL_COMPATIBLE_PATHFINDING + if (s_useFixedPathfinding) +#endif + { + goalCell->releaseInfo(); + } return NULL; } } @@ -8796,9 +9147,20 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet m_isTunneling = false; // construct and return path Path *path = buildActualPath( obj, locomotorSet.getValidSurfaces(), from, goalCell, centerInCell, blocked); - parentCell->releaseInfo(); - goalCell->releaseInfo(); - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + parentCell->releaseInfo(); + goalCell->releaseInfo(); + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + goalCell->releaseInfo(); + } + return path; } // put parent cell onto closed list - its evaluation is finished @@ -8877,8 +9239,18 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet rawTo->y = closesetCell->getYIndex()*PATHFIND_CELL_SIZE_F + PATHFIND_CELL_SIZE_F/2.0f; // construct and return path Path *path = buildActualPath( obj, locomotorSet.getValidSurfaces(), from, closesetCell, centerInCell, blocked ); - goalCell->releaseInfo(); - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + goalCell->releaseInfo(); + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + goalCell->releaseInfo(); + } return path; } @@ -8898,8 +9270,18 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet TheGameLogic->incrementOverallFailedPathfinds(); #endif m_isTunneling = false; - goalCell->releaseInfo(); - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + goalCell->releaseInfo(); + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + goalCell->releaseInfo(); + } return NULL; } @@ -9021,6 +9403,33 @@ void Pathfinder::prependCells( Path *path, const Coord3D *fromPos, } prevCell = cell; } + +#if RETAIL_COMPATIBLE_PATHFINDING + // TheSuperHackers @info This pathway is here for retail compatibility, it is to catch when a starting cell has a dangling parent that contains no pathing information + // Beyond this point a retail client will crash due to a null pointer access within cell->getXIndex() + // To recover from this we set the cell to the previous cell, which should be the actual starting cell then set to use the fixed pathing and perform a forced cleanup + if (!s_useFixedPathfinding) { + if (!cell->hasInfo()) { + cell = prevCell; + + m_zoneManager.setPassable(cell->getXIndex(), cell->getYIndex(), true); + if (goalCellNull) { + // Very short path. + adjustCoordToCell(cell->getXIndex(), cell->getYIndex(), center, pos, cell->getLayer()); + path->prependNode( &pos, cell->getLayer() ); + } + // put actual start position as first node on the path, so it begins right at the unit's feet + if (fromPos->x != path->getFirstNode()->getPosition()->x || fromPos->y != path->getFirstNode()->getPosition()->y) { + path->prependNode( fromPos, cell->getLayer() ); + } + + s_useFixedPathfinding = true; + forceCleanCells(); + return; + } + } +#endif + m_zoneManager.setPassable(cell->getXIndex(), cell->getYIndex(), true); if (goalCellNull) { // Very short path. @@ -10282,8 +10691,17 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, m_isTunneling = false; // construct and return path Path *newPath = buildActualPath( obj, locomotorSet.getValidSurfaces(), obj->getPosition(), parentCell, centerInCell, false); - parentCell->releaseInfo(); - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + parentCell->releaseInfo(); + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + } return newPath; } // put parent cell onto closed list - its evaluation is finished @@ -10304,7 +10722,16 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, DEBUG_LOG(("Unit '%s', time %f", obj->getTemplate()->getName().str(), (::GetTickCount()-startTimeMS)/1000.0f)); m_isTunneling = false; - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + } return NULL; } @@ -10420,7 +10847,15 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet } if (startNode == originalPath->getLastNode()) { - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + cleanOpenAndClosedLists(); + } + else +#endif + { + parentCell->releaseInfo(); + } return NULL; // no open nodes. } PathfindCell *candidateGoal; @@ -10428,6 +10863,12 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet ICoord2D goalCellNdx; worldToCell(&goalPos, &goalCellNdx); if (!candidateGoal->allocateInfo(goalCellNdx)) { +#if RETAIL_COMPATIBLE_PATHFINDING + if (s_useFixedPathfinding) +#endif + { + parentCell->releaseInfo(); + } return NULL; } @@ -10462,9 +10903,19 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet // cleanup the path by checking line of sight path->optimize(obj, locomotorSet.getValidSurfaces(), blocked); - parentCell->releaseInfo(); - cleanOpenAndClosedLists(); - candidateGoal->releaseInfo(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + parentCell->releaseInfo(); + cleanOpenAndClosedLists(); + candidateGoal->releaseInfo(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + candidateGoal->releaseInfo(); + } return path; } @@ -10487,12 +10938,22 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet } #endif m_isTunneling = false; - if (!candidateGoal->getOpen() && !candidateGoal->getClosed()) +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + if (!candidateGoal->getOpen() && !candidateGoal->getClosed()) + { + // Not on one of the lists + candidateGoal->releaseInfo(); + } + cleanOpenAndClosedLists(); + } + else +#endif { - // Not on one of the lists + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); candidateGoal->releaseInfo(); } - cleanOpenAndClosedLists(); return NULL; } @@ -10785,10 +11246,20 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot } } Path *path = buildActualPath( obj, locomotorSet.getValidSurfaces(), obj->getPosition(), parentCell, centerInCell, false); - if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) { +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) { + goalCell->releaseInfo(); + } + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); goalCell->releaseInfo(); } - cleanOpenAndClosedLists(); return path; } } @@ -10844,10 +11315,20 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot TheGameLogic->incrementOverallFailedPathfinds(); #endif m_isTunneling = false; - if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) { +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) { + goalCell->releaseInfo(); + } + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); goalCell->releaseInfo(); } - cleanOpenAndClosedLists(); return NULL; } @@ -10969,8 +11450,17 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor #endif // construct and return path Path *path = buildActualPath( obj, locomotorSet.getValidSurfaces(), obj->getPosition(), parentCell, centerInCell, false); - parentCell->releaseInfo(); - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + parentCell->releaseInfo(); + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + } return path; } @@ -11004,7 +11494,16 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor TheGameLogic->incrementOverallFailedPathfinds(); #endif m_isTunneling = false; - cleanOpenAndClosedLists(); +#if RETAIL_COMPATIBLE_PATHFINDING + if (!s_useFixedPathfinding) { + cleanOpenAndClosedLists(); + } + else +#endif + { + cleanOpenAndClosedLists(); + parentCell->releaseInfo(); + } return NULL; } From 8ee3d219a029d1366a600acc3e5e691e87d1851e Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 20 Sep 2025 11:29:29 +0200 Subject: [PATCH 085/343] refactor: Verify array size, fix constness of strings lists, and improve order of enum values (#1584) --- .../Include/Common/AudioEventInfo.h | 10 +- .../Include/GameClient/ClientRandomValue.h | 5 +- .../Include/GameLogic/LogicRandomValue.h | 5 +- .../Source/Common/INI/INIAudioEventInfo.cpp | 7 +- Core/GameEngine/Source/Common/RandomValue.cpp | 6 +- Core/Libraries/Source/WWVegas/WW3D2/rendobj.h | 29 ++--- .../Source/WWVegas/WWDebug/wwmemlog.cpp | 2 +- .../Libraries/Source/WWVegas/WWLib/Except.cpp | 2 +- .../Libraries/Source/WWVegas/WWLib/WWCommon.h | 7 ++ Core/Libraries/Source/WWVegas/WWLib/always.h | 7 -- .../Source/WWVegas/WWLib/cpudetect.cpp | 3 +- .../Source/WWVegas/WWLib/cpudetect.h | 4 +- Core/Libraries/Source/debug/debug_stack.cpp | 2 +- .../Code/GameEngine/Include/Common/BitFlags.h | 7 +- .../GameEngine/Include/Common/GameCommon.h | 15 ++- .../Code/GameEngine/Include/Common/GameLOD.h | 2 + .../Code/GameEngine/Include/Common/GameType.h | 13 ++- .../Code/GameEngine/Include/Common/Geometry.h | 7 +- Generals/Code/GameEngine/Include/Common/INI.h | 4 +- .../Code/GameEngine/Include/Common/KindOf.h | 8 +- .../GameEngine/Include/Common/ModelState.h | 7 +- .../Code/GameEngine/Include/Common/Player.h | 3 +- .../Code/GameEngine/Include/Common/Radar.h | 3 +- .../GameEngine/Include/Common/TerrainTypes.h | 3 +- .../GameEngine/Include/Common/ThingSort.h | 14 ++- .../GameEngine/Include/Common/ThingTemplate.h | 6 +- .../Code/GameEngine/Include/Common/Upgrade.h | 2 +- .../GameEngine/Include/GameClient/Anim2D.h | 3 +- .../Include/GameClient/ControlBar.h | 8 +- .../GameEngine/Include/GameClient/Credits.h | 3 +- .../Include/GameClient/DisconnectMenu.h | 14 +-- .../GameEngine/Include/GameClient/Drawable.h | 6 +- .../GameClient/EstablishConnectionsMenu.h | 6 +- .../Code/GameEngine/Include/GameClient/Eva.h | 6 +- .../Include/GameClient/GameWindow.h | 4 +- .../GameClient/GameWindowTransitions.h | 3 + .../GameEngine/Include/GameClient/Image.h | 2 +- .../GameEngine/Include/GameClient/InGameUI.h | 3 +- .../GameEngine/Include/GameClient/MetaEvent.h | 7 +- .../Include/GameClient/ParticleSys.h | 103 ++++++++++-------- .../GameEngine/Include/GameClient/Shadow.h | 2 +- .../Include/GameClient/ShellHooks.h | 2 +- .../Include/GameClient/TerrainVisual.h | 23 ++-- .../Code/GameEngine/Include/GameLogic/AI.h | 4 +- .../GameEngine/Include/GameLogic/Damage.h | 6 +- .../GameEngine/Include/GameLogic/Locomotor.h | 22 ++-- .../Include/GameLogic/LocomotorSet.h | 2 +- .../Include/GameLogic/Module/AIUpdate.h | 5 +- .../Include/GameLogic/Module/BodyModule.h | 8 +- .../Include/GameLogic/Module/DozerAIUpdate.h | 11 +- .../Include/GameLogic/Module/HordeUpdate.h | 3 +- .../GameLogic/Module/OCLSpecialPower.h | 2 + .../GameLogic/Module/SlowDeathBehavior.h | 3 +- .../Include/GameLogic/Module/StealthUpdate.h | 2 +- .../GameLogic/Module/StructureToppleUpdate.h | 3 +- .../GameEngine/Include/GameLogic/Powers.h | 3 +- .../GameEngine/Include/GameLogic/Scripts.h | 2 +- .../GameEngine/Include/GameLogic/Weapon.h | 20 ++-- .../GameEngine/Include/GameLogic/WeaponSet.h | 4 +- .../GameEngine/Source/Common/BitFlags.cpp | 8 +- .../Code/GameEngine/Source/Common/GameLOD.cpp | 12 +- .../GameEngine/Source/Common/INI/INIWater.cpp | 2 +- .../GameEngine/Source/Common/RTS/Player.cpp | 2 +- .../Source/Common/RTS/SpecialPower.cpp | 3 +- .../Source/Common/System/DisabledTypes.cpp | 3 +- .../Source/Common/System/GameCommon.cpp | 6 +- .../Source/Common/System/GameType.cpp | 6 +- .../Source/Common/System/KindOf.cpp | 3 +- .../Common/System/ObjectStatusTypes.cpp | 3 +- .../Source/Common/System/Upgrade.cpp | 3 +- .../GameEngine/Source/GameClient/Drawable.cpp | 3 +- .../Code/GameEngine/Source/GameClient/Eva.cpp | 7 +- .../GameEngine/Source/GameClient/FXList.cpp | 4 + .../GUI/ControlBar/ControlBarScheme.cpp | 1 + .../GUI/DisconnectMenu/DisconnectMenu.cpp | 14 +-- .../EstablishConnectionsMenu.cpp | 6 +- .../GUICallbacks/Menus/PopupPlayerInfo.cpp | 4 +- .../GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp | 4 +- .../GUI/GameWindowManagerScript.cpp | 10 +- .../Source/GameClient/GameClient.cpp | 2 +- .../Source/GameLogic/Object/Locomotor.cpp | 4 +- .../GameLogic/Object/ObjectCreationList.cpp | 2 +- .../Object/SpecialPower/OCLSpecialPower.cpp | 3 +- .../Object/Update/StructureCollapseUpdate.cpp | 3 +- .../Source/GameLogic/Object/WeaponSet.cpp | 3 +- .../Source/GameLogic/ScriptEngine/Scripts.cpp | 11 +- .../GameClient/Module/W3DModelDraw.h | 2 + .../GameClient/Drawable/Draw/W3DModelDraw.cpp | 5 +- .../Source/WWVegas/WW3D2/dx8caps.cpp | 3 +- .../Libraries/Source/WWVegas/WW3D2/dx8caps.h | 4 +- .../GameEngine/Include/Common/AcademyStats.h | 4 +- .../Code/GameEngine/Include/Common/BitFlags.h | 7 +- .../GameEngine/Include/Common/GameCommon.h | 15 ++- .../Code/GameEngine/Include/Common/GameLOD.h | 2 + .../Code/GameEngine/Include/Common/GameType.h | 13 ++- .../Code/GameEngine/Include/Common/Geometry.h | 7 +- .../Code/GameEngine/Include/Common/INI.h | 4 +- .../Code/GameEngine/Include/Common/KindOf.h | 8 +- .../GameEngine/Include/Common/ModelState.h | 7 +- .../Code/GameEngine/Include/Common/Player.h | 3 +- .../Code/GameEngine/Include/Common/Radar.h | 3 +- .../GameEngine/Include/Common/TerrainTypes.h | 3 +- .../GameEngine/Include/Common/ThingSort.h | 14 ++- .../GameEngine/Include/Common/ThingTemplate.h | 6 +- .../Code/GameEngine/Include/Common/Upgrade.h | 2 +- .../GameEngine/Include/GameClient/Anim2D.h | 3 +- .../Include/GameClient/ControlBar.h | 8 +- .../GameEngine/Include/GameClient/Credits.h | 3 +- .../Include/GameClient/DisconnectMenu.h | 14 +-- .../GameEngine/Include/GameClient/Drawable.h | 6 +- .../GameClient/EstablishConnectionsMenu.h | 6 +- .../Code/GameEngine/Include/GameClient/Eva.h | 6 +- .../Include/GameClient/GameWindow.h | 4 +- .../GameClient/GameWindowTransitions.h | 3 + .../GameEngine/Include/GameClient/Image.h | 2 +- .../GameEngine/Include/GameClient/InGameUI.h | 3 +- .../GameEngine/Include/GameClient/MetaEvent.h | 7 +- .../Include/GameClient/ParticleSys.h | 103 ++++++++++-------- .../GameEngine/Include/GameClient/Shadow.h | 2 +- .../Include/GameClient/ShellHooks.h | 2 +- .../Include/GameClient/TerrainVisual.h | 23 ++-- .../Code/GameEngine/Include/GameLogic/AI.h | 3 +- .../GameEngine/Include/GameLogic/Damage.h | 3 +- .../GameEngine/Include/GameLogic/Locomotor.h | 22 ++-- .../Include/GameLogic/LocomotorSet.h | 2 +- .../Include/GameLogic/Module/AIUpdate.h | 5 +- .../Include/GameLogic/Module/BodyModule.h | 8 +- .../Include/GameLogic/Module/DozerAIUpdate.h | 11 +- .../Include/GameLogic/Module/HordeUpdate.h | 3 +- .../GameLogic/Module/OCLSpecialPower.h | 2 + .../GameLogic/Module/SlowDeathBehavior.h | 3 +- .../Module/SpectreGunshipDeploymentUpdate.h | 2 + .../Include/GameLogic/Module/StealthUpdate.h | 5 +- .../GameLogic/Module/StructureToppleUpdate.h | 3 +- .../GameEngine/Include/GameLogic/Powers.h | 3 +- .../GameEngine/Include/GameLogic/Scripts.h | 2 +- .../GameEngine/Include/GameLogic/Weapon.h | 20 ++-- .../GameEngine/Include/GameLogic/WeaponSet.h | 4 +- .../GameEngine/Source/Common/BitFlags.cpp | 7 +- .../Code/GameEngine/Source/Common/GameLOD.cpp | 12 +- .../GameEngine/Source/Common/INI/INIWater.cpp | 2 +- .../Source/Common/RTS/AcademyStats.cpp | 3 +- .../GameEngine/Source/Common/RTS/Player.cpp | 2 +- .../Source/Common/RTS/SpecialPower.cpp | 3 +- .../Source/Common/System/DisabledTypes.cpp | 3 +- .../Source/Common/System/GameCommon.cpp | 6 +- .../Source/Common/System/GameType.cpp | 6 +- .../Source/Common/System/KindOf.cpp | 3 +- .../Common/System/ObjectStatusTypes.cpp | 3 +- .../Source/Common/System/Upgrade.cpp | 3 +- .../GameEngine/Source/GameClient/Drawable.cpp | 3 +- .../Code/GameEngine/Source/GameClient/Eva.cpp | 18 +-- .../GameEngine/Source/GameClient/FXList.cpp | 4 + .../GUI/ControlBar/ControlBarScheme.cpp | 1 + .../GUI/DisconnectMenu/DisconnectMenu.cpp | 14 +-- .../EstablishConnectionsMenu.cpp | 6 +- .../GUICallbacks/Menus/PopupPlayerInfo.cpp | 3 +- .../GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp | 4 +- .../GUI/GameWindowManagerScript.cpp | 12 +- .../Source/GameClient/GameClient.cpp | 2 +- .../Source/GameLogic/Object/Locomotor.cpp | 4 +- .../GameLogic/Object/ObjectCreationList.cpp | 2 +- .../Object/SpecialPower/OCLSpecialPower.cpp | 3 +- .../Update/SpectreGunshipDeploymentUpdate.cpp | 4 +- .../Object/Update/StructureCollapseUpdate.cpp | 3 +- .../Source/GameLogic/Object/WeaponSet.cpp | 3 +- .../Source/GameLogic/ScriptEngine/Scripts.cpp | 11 +- .../Source/GameLogic/System/Damage.cpp | 3 +- .../Source/GameLogic/System/GameLogic.cpp | 2 +- .../GameClient/Module/W3DModelDraw.h | 2 + .../GameClient/Drawable/Draw/W3DModelDraw.cpp | 5 +- .../Source/WWVegas/WW3D2/dx8caps.cpp | 3 +- .../Libraries/Source/WWVegas/WW3D2/dx8caps.h | 4 +- 173 files changed, 697 insertions(+), 490 deletions(-) diff --git a/Core/GameEngine/Include/Common/AudioEventInfo.h b/Core/GameEngine/Include/Common/AudioEventInfo.h index 112db478265..cebe6af4ec3 100644 --- a/Core/GameEngine/Include/Common/AudioEventInfo.h +++ b/Core/GameEngine/Include/Common/AudioEventInfo.h @@ -48,17 +48,19 @@ enum AudioType CPP_11(: Int) AT_SoundEffect }; -extern const char *theAudioPriorityNames[]; +extern const char* const theAudioPriorityNames[]; enum AudioPriority CPP_11(: Int) { AP_LOWEST, AP_LOW, AP_NORMAL, AP_HIGH, - AP_CRITICAL + AP_CRITICAL, + + AP_COUNT }; -extern const char *theSoundTypeNames[]; +extern const char *const theSoundTypeNames[]; enum SoundType CPP_11(: Int) { ST_UI = 0x0001, @@ -72,7 +74,7 @@ enum SoundType CPP_11(: Int) ST_EVERYONE = 0x0100, }; -extern const char *theAudioControlNames[]; +extern const char *const theAudioControlNames[]; enum AudioControl CPP_11(: Int) { AC_LOOP = 0x0001, diff --git a/Core/GameEngine/Include/GameClient/ClientRandomValue.h b/Core/GameEngine/Include/GameClient/ClientRandomValue.h index 9a12e3229f4..af62e59cade 100644 --- a/Core/GameEngine/Include/GameClient/ClientRandomValue.h +++ b/Core/GameEngine/Include/GameClient/ClientRandomValue.h @@ -68,10 +68,11 @@ class GameClientRandomVariable */ enum DistributionType { - CONSTANT, UNIFORM, GAUSSIAN, TRIANGULAR, LOW_BIAS, HIGH_BIAS + CONSTANT, UNIFORM, GAUSSIAN, TRIANGULAR, LOW_BIAS, HIGH_BIAS, + DISTRIBUTION_COUNT }; - static const char *DistributionTypeNames[]; + static const char *const DistributionTypeNames[]; /// define the range of random values, and the distribution of values void setRange( Real low, Real high, DistributionType type = UNIFORM ); diff --git a/Core/GameEngine/Include/GameLogic/LogicRandomValue.h b/Core/GameEngine/Include/GameLogic/LogicRandomValue.h index e11bd811d3b..2427355f586 100644 --- a/Core/GameEngine/Include/GameLogic/LogicRandomValue.h +++ b/Core/GameEngine/Include/GameLogic/LogicRandomValue.h @@ -68,10 +68,11 @@ class GameLogicRandomVariable */ enum DistributionType { - CONSTANT, UNIFORM, GAUSSIAN, TRIANGULAR, LOW_BIAS, HIGH_BIAS + CONSTANT, UNIFORM, GAUSSIAN, TRIANGULAR, LOW_BIAS, HIGH_BIAS, + DISTRIBUTION_COUNT }; - static const char *DistributionTypeNames[]; + static const char *const DistributionTypeNames[]; /// define the range of random values, and the distribution of values void setRange( Real low, Real high, DistributionType type = UNIFORM ); diff --git a/Core/GameEngine/Source/Common/INI/INIAudioEventInfo.cpp b/Core/GameEngine/Source/Common/INI/INIAudioEventInfo.cpp index a8b4d295879..74d403069f7 100644 --- a/Core/GameEngine/Source/Common/INI/INIAudioEventInfo.cpp +++ b/Core/GameEngine/Source/Common/INI/INIAudioEventInfo.cpp @@ -179,7 +179,7 @@ static void parsePitchShift( INI* ini, void *instance, void *store, const void* // STATIC DEFINIITIONS //////////////////////////////////////////////////////////////////////////// -const char *theAudioPriorityNames[] = +const char *const theAudioPriorityNames[] = { "LOWEST", "LOW", @@ -188,8 +188,9 @@ const char *theAudioPriorityNames[] = "CRITICAL", NULL }; +static_assert(ARRAY_SIZE(theAudioPriorityNames) == AP_COUNT + 1, "Incorrect array size"); -const char *theSoundTypeNames[] = +const char *const theSoundTypeNames[] = { "UI", "WORLD", @@ -203,7 +204,7 @@ const char *theSoundTypeNames[] = NULL }; -const char *theAudioControlNames[] = +const char *const theAudioControlNames[] = { "LOOP", "RANDOM", diff --git a/Core/GameEngine/Source/Common/RandomValue.cpp b/Core/GameEngine/Source/Common/RandomValue.cpp index 801a604d01f..5fcc8aac6e8 100644 --- a/Core/GameEngine/Source/Common/RandomValue.cpp +++ b/Core/GameEngine/Source/Common/RandomValue.cpp @@ -350,10 +350,11 @@ DEBUG_LOG(( "%d: GetGameAudioRandomValueReal = %f, %s line %d", // GameClientRandomVariable // -/*static*/ const char *GameClientRandomVariable::DistributionTypeNames[] = +const char *const GameClientRandomVariable::DistributionTypeNames[] = { "CONSTANT", "UNIFORM", "GAUSSIAN", "TRIANGULAR", "LOW_BIAS", "HIGH_BIAS", NULL }; +static_assert(ARRAY_SIZE(GameClientRandomVariable::DistributionTypeNames) == GameClientRandomVariable::DISTRIBUTION_COUNT + 1, "Incorrect array size"); /** define the range of random values, and the distribution of values @@ -395,10 +396,11 @@ Real GameClientRandomVariable::getValue( void ) const // GameLogicRandomVariable // -/*static*/ const char *GameLogicRandomVariable::DistributionTypeNames[] = +const char *const GameLogicRandomVariable::DistributionTypeNames[] = { "CONSTANT", "UNIFORM", "GAUSSIAN", "TRIANGULAR", "LOW_BIAS", "HIGH_BIAS", NULL }; +static_assert(ARRAY_SIZE(GameLogicRandomVariable::DistributionTypeNames) == GameLogicRandomVariable::DISTRIBUTION_COUNT + 1, "Incorrect array size"); /** define the range of random values, and the distribution of values diff --git a/Core/Libraries/Source/WWVegas/WW3D2/rendobj.h b/Core/Libraries/Source/WWVegas/WW3D2/rendobj.h index 4b758e8ca31..43758e4e085 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/rendobj.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/rendobj.h @@ -85,20 +85,6 @@ template class DynamicVectorClass; // "unreferenced formal parameter" #pragma warning(disable : 4100) -#ifdef DEFINE_W3DANIMMODE_NAMES -static const char* TheAnimModeNames[] = -{ - "MANUAL", - "LOOP", - "ONCE", - "LOOP_PINGPONG", - "LOOP_BACKWARDS", - "ONCE_BACKWARDS", - NULL -}; -#endif - - ////////////////////////////////////////////////////////////////////////////////// // RenderObjClass // This is the interface for all objects that get rendered by WW3D. @@ -336,6 +322,8 @@ class RenderObjClass : public RefCountClass , public PersistClass, public MultiL ANIM_MODE_LOOP_PINGPONG, ANIM_MODE_LOOP_BACKWARDS, //make sure only backwards playing animations after this one ANIM_MODE_ONCE_BACKWARDS, + + ANIM_MODE_COUNT }; virtual void Set_Animation( void ) { } @@ -653,6 +641,19 @@ WWINLINE bool RenderObjClass::Is_Transform_Identity_No_Validity_Check() const } +#ifdef DEFINE_W3DANIMMODE_NAMES +static const char* const TheAnimModeNames[] = +{ + "MANUAL", + "LOOP", + "ONCE", + "LOOP_PINGPONG", + "LOOP_BACKWARDS", + "ONCE_BACKWARDS", + NULL +}; +static_assert(ARRAY_SIZE(TheAnimModeNames) == RenderObjClass::ANIM_MODE_COUNT + 1, "Incorrect array size"); +#endif #endif diff --git a/Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.cpp b/Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.cpp index e55eef369eb..40be136f77b 100644 --- a/Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.cpp +++ b/Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.cpp @@ -95,7 +95,7 @@ static unsigned FreeCount; ** Name for each memory category. I'm padding the array with some "undefined" strings in case ** someone forgets to set the name when adding a new category. */ -static const char * _MemoryCategoryNames[] = +static const char *const _MemoryCategoryNames[] = { "UNKNOWN", "Geometry", diff --git a/Core/Libraries/Source/WWVegas/WWLib/Except.cpp b/Core/Libraries/Source/WWVegas/WWLib/Except.cpp index fe1d939101d..8829a550ecb 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/Except.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/Except.cpp @@ -138,7 +138,7 @@ static StackWalkType _StackWalk = NULL; static SymFunctionTableAccessType _SymFunctionTableAccess = NULL; static SymGetModuleBaseType _SymGetModuleBase = NULL; -static char const *ImagehelpFunctionNames[] = +static char const *const ImagehelpFunctionNames[] = { "SymCleanup", "SymGetSymFromAddr", diff --git a/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h b/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h index 859eb54496e..a2a2248eccf 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h +++ b/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h @@ -20,6 +20,13 @@ #include "stringex.h" + +// This macro serves as a general way to determine the number of elements within an array. +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(x) int(sizeof(x)/sizeof(x[0])) +#endif + + #if defined(_MSC_VER) && _MSC_VER < 1300 typedef unsigned MemValueType; #else diff --git a/Core/Libraries/Source/WWVegas/WWLib/always.h b/Core/Libraries/Source/WWVegas/WWLib/always.h index d9c912b462e..592d2aa0731 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/always.h +++ b/Core/Libraries/Source/WWVegas/WWLib/always.h @@ -254,13 +254,6 @@ template T max(T a,T b) #define NULL 0 #endif -/********************************************************************** -** This macro serves as a general way to determine the number of elements -** within an array. -*/ -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(x) int(sizeof(x)/sizeof(x[0])) -#endif #ifndef size_of #define size_of(typ,id) sizeof(((typ*)0)->id) diff --git a/Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp b/Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp index 686af13be3c..b972a50ec7f 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp @@ -120,7 +120,7 @@ char CPUDetectClass::ProcessorString[48]; const char* CPUDetectClass::Get_Processor_Manufacturer_Name() { - static const char* ManufacturerNames[] = { + static const char* const ManufacturerNames[] = { "", "Intel", "UMC", @@ -131,6 +131,7 @@ const char* CPUDetectClass::Get_Processor_Manufacturer_Name() "Rise", "Transmeta" }; + static_assert(ARRAY_SIZE(ManufacturerNames) == MANUFACTURER_COUNT, "Incorrect array size"); return ManufacturerNames[ProcessorManufacturer]; } diff --git a/Core/Libraries/Source/WWVegas/WWLib/cpudetect.h b/Core/Libraries/Source/WWVegas/WWLib/cpudetect.h index 23318f65077..8e31d41881c 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/cpudetect.h +++ b/Core/Libraries/Source/WWVegas/WWLib/cpudetect.h @@ -67,7 +67,9 @@ class CPUDetectClass MANUFACTURER_NEXTGEN, MANUFACTURER_VIA, MANUFACTURER_RISE, - MANUFACTURER_TRANSMETA + MANUFACTURER_TRANSMETA, + + MANUFACTURER_COUNT } ProcessorManufacturerType; typedef enum diff --git a/Core/Libraries/Source/debug/debug_stack.cpp b/Core/Libraries/Source/debug/debug_stack.cpp index 60a5aae4fdc..e40e573ebc2 100644 --- a/Core/Libraries/Source/debug/debug_stack.cpp +++ b/Core/Libraries/Source/debug/debug_stack.cpp @@ -47,7 +47,7 @@ static union #undef DBGHELP #define DBGHELP(name,ret,par) #name, -static char const *DebughelpFunctionNames[] = +static char const *const DebughelpFunctionNames[] = { #include "debug_stack.inl" NULL diff --git a/Generals/Code/GameEngine/Include/Common/BitFlags.h b/Generals/Code/GameEngine/Include/Common/BitFlags.h index 33f7f792a25..2126b37c1f7 100644 --- a/Generals/Code/GameEngine/Include/Common/BitFlags.h +++ b/Generals/Code/GameEngine/Include/Common/BitFlags.h @@ -53,9 +53,10 @@ class BitFlags { private: std::bitset m_bits; - static const char* s_bitNameList[]; public: + CPP_11(static constexpr size_t NumBits = NUMBITS); + static const char* const s_bitNameList[]; /* just a little syntactic sugar so that there is no "foo = 0" compatible constructor @@ -261,7 +262,7 @@ class BitFlags return true; } - static const char** getBitNames() + static const char* const* getBitNames() { return s_bitNameList; } @@ -274,7 +275,7 @@ class BitFlags static Int getSingleBitFromName(const char* token) { Int i = 0; - for(const char** name = s_bitNameList; *name; ++name, ++i ) + for(const char* const* name = s_bitNameList; *name; ++name, ++i ) { if( stricmp( *name, token ) == 0 ) { diff --git a/Generals/Code/GameEngine/Include/Common/GameCommon.h b/Generals/Code/GameEngine/Include/Common/GameCommon.h index 833e6374aca..87813783e11 100644 --- a/Generals/Code/GameEngine/Include/Common/GameCommon.h +++ b/Generals/Code/GameEngine/Include/Common/GameCommon.h @@ -186,7 +186,7 @@ enum // NOTE NOTE NOTE: Keep TheVeterencyNames in sync with these. enum VeterancyLevel CPP_11(: Int) { - LEVEL_REGULAR = 0, + LEVEL_REGULAR, LEVEL_VETERAN, LEVEL_ELITE, LEVEL_HEROIC, @@ -194,12 +194,12 @@ enum VeterancyLevel CPP_11(: Int) LEVEL_COUNT, LEVEL_INVALID, - LEVEL_FIRST = LEVEL_REGULAR, + LEVEL_FIRST = 0, LEVEL_LAST = LEVEL_HEROIC }; // TheVeterancyNames is defined in GameCommon.cpp -extern const char *TheVeterancyNames[]; +extern const char *const TheVeterancyNames[]; //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -211,6 +211,7 @@ enum CommandSourceType CPP_11(: Int) CMD_FROM_AI, CMD_FROM_DOZER, // Special rare command when the dozer originates a command to attack a mine. Mines are not ai-attackable, and it seems deceitful for the dozer to generate a player or script command. jba. + COMMAND_SOURCE_TYPE_COUNT }; //------------------------------------------------------------------------------------------------- @@ -478,14 +479,16 @@ inline Real stdAngleDiff(Real a1, Real a2) // NOTE NOTE NOTE: Keep TheRelationShipNames in sync with this enum enum Relationship CPP_11(: Int) { - ENEMIES = 0, + ENEMIES, NEUTRAL, - ALLIES + ALLIES, + + RELATIONSHIP_COUNT }; // TheRelationShipNames is defined in Common/GameCommon.cpp -extern const char *TheRelationshipNames[]; +extern const char *const TheRelationshipNames[]; #endif // _GAMECOMMON_H_ diff --git a/Generals/Code/GameEngine/Include/Common/GameLOD.h b/Generals/Code/GameEngine/Include/Common/GameLOD.h index 7eab7454f06..2d08f9f1615 100644 --- a/Generals/Code/GameEngine/Include/Common/GameLOD.h +++ b/Generals/Code/GameEngine/Include/Common/GameLOD.h @@ -69,6 +69,8 @@ enum CpuType CPP_11(: Int) P3, P4, K7, + + CPU_MAX }; //Keep this in sync with VideoNames in Gamelod.cpp diff --git a/Generals/Code/GameEngine/Include/Common/GameType.h b/Generals/Code/GameEngine/Include/Common/GameType.h index 8fbe7dea777..203e91bdb63 100644 --- a/Generals/Code/GameEngine/Include/Common/GameType.h +++ b/Generals/Code/GameEngine/Include/Common/GameType.h @@ -67,17 +67,18 @@ class INI; //------------------------------------------------------------------------------------------------- enum TimeOfDay CPP_11(: Int) { - TIME_OF_DAY_INVALID = 0, - TIME_OF_DAY_FIRST = 1, - TIME_OF_DAY_MORNING = TIME_OF_DAY_FIRST, + TIME_OF_DAY_INVALID, + + TIME_OF_DAY_MORNING, TIME_OF_DAY_AFTERNOON, TIME_OF_DAY_EVENING, TIME_OF_DAY_NIGHT, - TIME_OF_DAY_COUNT + TIME_OF_DAY_COUNT, + TIME_OF_DAY_FIRST = TIME_OF_DAY_MORNING, }; -extern const char *TimeOfDayNames[]; +extern const char *const TimeOfDayNames[]; // defined in Common/GameType.cpp //------------------------------------------------------------------------------------------------- @@ -89,7 +90,7 @@ enum Weather CPP_11(: Int) WEATHER_COUNT }; -extern const char *WeatherNames[]; +extern const char *const WeatherNames[]; enum Scorches CPP_11(: Int) { diff --git a/Generals/Code/GameEngine/Include/Common/Geometry.h b/Generals/Code/GameEngine/Include/Common/Geometry.h index 9dc49463f57..daa963ce5f0 100644 --- a/Generals/Code/GameEngine/Include/Common/Geometry.h +++ b/Generals/Code/GameEngine/Include/Common/Geometry.h @@ -48,22 +48,23 @@ class INI; //------------------------------------------------------------------------------------------------- enum GeometryType CPP_11(: Int) { - GEOMETRY_SPHERE = 0, ///< partition/collision testing as sphere. (majorRadius = radius) + GEOMETRY_SPHERE, ///< partition/collision testing as sphere. (majorRadius = radius) GEOMETRY_CYLINDER, ///< partition/collision testing as cylinder. (majorRadius = radius, height = height) GEOMETRY_BOX, ///< partition/collision testing as rectangular box (majorRadius = half len in forward dir; minorRadius = half len in side dir; height = height) GEOMETRY_NUM_TYPES, - GEOMETRY_FIRST = GEOMETRY_SPHERE + GEOMETRY_FIRST = 0 }; #ifdef DEFINE_GEOMETRY_NAMES -static const char *GeometryNames[] = +static const char *const GeometryNames[] = { "SPHERE", "CYLINDER", "BOX", NULL }; +static_assert(ARRAY_SIZE(GeometryNames) == GEOMETRY_NUM_TYPES + 1, "Incorrect array size"); #endif // end DEFINE_GEOMETRY_NAMES //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/Common/INI.h b/Generals/Code/GameEngine/Include/Common/INI.h index 02ba66aa046..defb17dd400 100644 --- a/Generals/Code/GameEngine/Include/Common/INI.h +++ b/Generals/Code/GameEngine/Include/Common/INI.h @@ -91,14 +91,14 @@ enum /** Function typedef for parsing data block fields. * * buffer - the character buffer of the line from INI that we are reading and parsing - * instance - instance of what we're loading (for example a thingtemplate instance) + * instance - instance of what we're loading (for example a ThingTemplate instance) * store - where to store the data parsed, this is a field in the *instance* 'instance' */ //------------------------------------------------------------------------------------------------- typedef void (*INIFieldParseProc)( INI *ini, void *instance, void *store, const void* userData ); //------------------------------------------------------------------------------------------------- -typedef const char* ConstCharPtr; +typedef const char* const ConstCharPtr; typedef ConstCharPtr* ConstCharPtrArray; //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/Common/KindOf.h b/Generals/Code/GameEngine/Include/Common/KindOf.h index 848ec363da7..1185b4100f4 100644 --- a/Generals/Code/GameEngine/Include/Common/KindOf.h +++ b/Generals/Code/GameEngine/Include/Common/KindOf.h @@ -43,8 +43,8 @@ enum KindOfType CPP_11(: Int) { KINDOF_INVALID = -1, - KINDOF_FIRST = 0, - KINDOF_OBSTACLE = KINDOF_FIRST, ///< an obstacle to land-based pathfinders + + KINDOF_OBSTACLE, ///< an obstacle to land-based pathfinders KINDOF_SELECTABLE, ///< Selectable KINDOF_IMMOBILE, ///< fixed in location KINDOF_CAN_ATTACK, ///< can attack @@ -143,8 +143,8 @@ enum KindOfType CPP_11(: Int) KINDOF_IGNORES_SELECT_ALL, ///< Too late to figure out intelligently if something should respond to a Select All command KINDOF_DONT_AUTO_CRUSH_INFANTRY, ///< These units don't try to crush the infantry if ai. - KINDOF_COUNT // total number of kindofs - + KINDOF_COUNT, // total number of kindofs + KINDOF_FIRST = 0, }; typedef BitFlags KindOfMaskType; diff --git a/Generals/Code/GameEngine/Include/Common/ModelState.h b/Generals/Code/GameEngine/Include/Common/ModelState.h index 4259a39f0ad..9291c89666d 100644 --- a/Generals/Code/GameEngine/Include/Common/ModelState.h +++ b/Generals/Code/GameEngine/Include/Common/ModelState.h @@ -91,13 +91,11 @@ enum ModelConditionFlagType CPP_11(: Int) { MODELCONDITION_INVALID = -1, - MODELCONDITION_FIRST = 0, - // // Note: these values are saved in save files, so you MUST NOT REMOVE OR CHANGE // existing values! // - MODELCONDITION_TOPPLED = MODELCONDITION_FIRST, + MODELCONDITION_TOPPLED, MODELCONDITION_FRONTCRUSHED, MODELCONDITION_BACKCRUSHED, MODELCONDITION_DAMAGED, @@ -214,7 +212,8 @@ enum ModelConditionFlagType CPP_11(: Int) // existing values! // - MODELCONDITION_COUNT + MODELCONDITION_COUNT, + MODELCONDITION_FIRST = 0, }; //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/Common/Player.h b/Generals/Code/GameEngine/Include/Common/Player.h index 380520ed359..df1e60782a2 100644 --- a/Generals/Code/GameEngine/Include/Common/Player.h +++ b/Generals/Code/GameEngine/Include/Common/Player.h @@ -101,13 +101,14 @@ enum ScienceAvailabilityType CPP_11(: Int) }; #ifdef DEFINE_SCIENCE_AVAILABILITY_NAMES -static const char *ScienceAvailabilityNames[] = +static const char *const ScienceAvailabilityNames[] = { "Available", "Disabled", "Hidden", NULL }; +static_assert(ARRAY_SIZE(ScienceAvailabilityNames) == SCIENCE_AVAILABILITY_COUNT + 1, "Incorrect array size"); #endif // end DEFINE_SCIENCE_AVAILABILITY_NAMES static const Int NUM_HOTKEY_SQUADS = 10; diff --git a/Generals/Code/GameEngine/Include/Common/Radar.h b/Generals/Code/GameEngine/Include/Common/Radar.h index e1c583dee41..aae4e8d102f 100644 --- a/Generals/Code/GameEngine/Include/Common/Radar.h +++ b/Generals/Code/GameEngine/Include/Common/Radar.h @@ -145,7 +145,7 @@ enum RadarPriorityType CPP_11(: Int) RADAR_PRIORITY_NUM_PRIORITIES }; #ifdef DEFINE_RADAR_PRIORITY_NAMES -static const char *RadarPriorityNames[] = +static const char *const RadarPriorityNames[] = { "INVALID", // a priority that has not been set (in general it won't show up on the radar) "NOT_ON_RADAR", // object specifically forbidden from being on the radar @@ -155,6 +155,7 @@ static const char *RadarPriorityNames[] = NULL }; +static_assert(ARRAY_SIZE(RadarPriorityNames) == RADAR_PRIORITY_NUM_PRIORITIES + 1, "Incorrect array size"); #endif // DEFINE_RADAR_PRIOTITY_NAMES //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/Common/TerrainTypes.h b/Generals/Code/GameEngine/Include/Common/TerrainTypes.h index 20aaf108718..9715b282d32 100644 --- a/Generals/Code/GameEngine/Include/Common/TerrainTypes.h +++ b/Generals/Code/GameEngine/Include/Common/TerrainTypes.h @@ -74,7 +74,7 @@ typedef enum } TerrainClass; #ifdef DEFINE_TERRAIN_TYPE_NAMES -static const char *terrainTypeNames[] = +static const char *const terrainTypeNames[] = { "NONE", "DESERT_1", @@ -104,6 +104,7 @@ static const char *terrainTypeNames[] = NULL }; +static_assert(ARRAY_SIZE(terrainTypeNames) == TERRAIN_NUM_CLASSES + 1, "Incorrect array size"); #endif // end DEFINE_TERRAIN_TYPE_NAMES //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/Common/ThingSort.h b/Generals/Code/GameEngine/Include/Common/ThingSort.h index 2f1a8a48c41..c12eb637316 100644 --- a/Generals/Code/GameEngine/Include/Common/ThingSort.h +++ b/Generals/Code/GameEngine/Include/Common/ThingSort.h @@ -32,12 +32,12 @@ #ifndef __THINGSORT_H_ #define __THINGSORT_H_ +#include "GameCommon.h" + //------------------------------------------------------------------------------------------------- enum EditorSortingType CPP_11(: Int) { - ES_FIRST = 0, - - ES_NONE = ES_FIRST, + ES_NONE, ES_STRUCTURE, ES_INFANTRY, ES_VEHICLE, @@ -52,11 +52,12 @@ enum EditorSortingType CPP_11(: Int) ES_ROAD, // road objects...should never actually be in the object panel. ES_WAYPOINT, // waypoint objects...should never actually be in the object panel. - ES_NUM_SORTING_TYPES - + ES_NUM_SORTING_TYPES, + ES_FIRST = 0, }; + #ifdef DEFINE_EDITOR_SORTING_NAMES -static const char *EditorSortingNames[] = +static const char *const EditorSortingNames[] = { "NONE", "STRUCTURE", @@ -75,6 +76,7 @@ static const char *EditorSortingNames[] = NULL }; +static_assert(ARRAY_SIZE(EditorSortingNames) == ES_NUM_SORTING_TYPES + 1, "Incorrect array size"); #endif #endif // __THINGSORT_H_ diff --git a/Generals/Code/GameEngine/Include/Common/ThingTemplate.h b/Generals/Code/GameEngine/Include/Common/ThingTemplate.h index 37a0fbfbd75..aaf7a2e7c69 100644 --- a/Generals/Code/GameEngine/Include/Common/ThingTemplate.h +++ b/Generals/Code/GameEngine/Include/Common/ThingTemplate.h @@ -207,7 +207,7 @@ enum BuildCompletionType CPP_11(: Int) BC_NUM_TYPES }; #ifdef DEFINE_BUILD_COMPLETION_NAMES -static const char *BuildCompletionNames[] = +static const char *const BuildCompletionNames[] = { "INVALID", "APPEARS_AT_RALLY_POINT", @@ -215,6 +215,7 @@ static const char *BuildCompletionNames[] = NULL }; +static_assert(ARRAY_SIZE(BuildCompletionNames) == BC_NUM_TYPES + 1, "Incorrect array size"); #endif // end DEFINE_BUILD_COMPLETION_NAMES enum BuildableStatus CPP_11(: Int) @@ -229,7 +230,7 @@ enum BuildableStatus CPP_11(: Int) }; #ifdef DEFINE_BUILDABLE_STATUS_NAMES -static const char *BuildableStatusNames[] = +static const char *const BuildableStatusNames[] = { "Yes", "Ignore_Prerequisites", @@ -237,6 +238,7 @@ static const char *BuildableStatusNames[] = "Only_By_AI", NULL }; +static_assert(ARRAY_SIZE(BuildableStatusNames) == BSTATUS_NUM_TYPES + 1, "Incorrect array size"); #endif // end DEFINE_BUILDABLE_STATUS_NAMES //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/Common/Upgrade.h b/Generals/Code/GameEngine/Include/Common/Upgrade.h index a1b45943afb..e443c1f9f71 100644 --- a/Generals/Code/GameEngine/Include/Common/Upgrade.h +++ b/Generals/Code/GameEngine/Include/Common/Upgrade.h @@ -151,7 +151,7 @@ enum UpgradeType CPP_11(: Int) NUM_UPGRADE_TYPES }; -extern const char *TheUpgradeTypeNames[]; //Change above, change this! +extern const char *const TheUpgradeTypeNames[]; //Change above, change this! //------------------------------------------------------------------------------------------------- /** A single upgrade template definition */ diff --git a/Generals/Code/GameEngine/Include/GameClient/Anim2D.h b/Generals/Code/GameEngine/Include/GameClient/Anim2D.h index 5c36e0277ef..ef856aa9c9d 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Anim2D.h +++ b/Generals/Code/GameEngine/Include/GameClient/Anim2D.h @@ -56,7 +56,7 @@ enum Anim2DMode CPP_11(: Int) }; #ifdef DEFINE_ANIM_2D_MODE_NAMES -static const char *Anim2DModeNames[] = +static const char *const Anim2DModeNames[] = { "NONE", "ONCE", @@ -67,6 +67,7 @@ static const char *Anim2DModeNames[] = "PING_PONG_BACKWARDS", NULL }; +static_assert(ARRAY_SIZE(Anim2DModeNames) == ANIM_2D_NUM_MODES + 1, "Incorrect array size"); #endif // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Include/GameClient/ControlBar.h b/Generals/Code/GameEngine/Include/GameClient/ControlBar.h index 65b4642c0a9..681a46daa0b 100644 --- a/Generals/Code/GameEngine/Include/GameClient/ControlBar.h +++ b/Generals/Code/GameEngine/Include/GameClient/ControlBar.h @@ -99,12 +99,10 @@ enum CommandOption CPP_11(: Int) SCRIPT_ONLY = 0x00080000, // Only a script can use this command (not by users) IGNORES_UNDERPOWERED = 0x00100000, // this button isn't disabled if its object is merely underpowered USES_MINE_CLEARING_WEAPONSET= 0x00200000, // uses the special mine-clearing weaponset, even if not current - - NUM_COMMAND_OPTIONS }; #ifdef DEFINE_COMMAND_OPTION_NAMES -static const char *TheCommandOptionNames[] = +static const char *const TheCommandOptionNames[] = { "NEED_TARGET_ENEMY_OBJECT", "NEED_TARGET_NEUTRAL_OBJECT", @@ -212,7 +210,7 @@ enum GUICommandType CPP_11(: Int) }; #ifdef DEFINE_GUI_COMMMAND_NAMES -static const char *TheGuiCommandNames[] = +static const char *const TheGuiCommandNames[] = { "NONE", "DOZER_CONSTRUCT", @@ -254,6 +252,7 @@ static const char *TheGuiCommandNames[] = NULL }; +static_assert(ARRAY_SIZE(TheGuiCommandNames) == GUI_COMMAND_NUM_COMMANDS + 1, "Incorrect array size"); #endif // end DEFINE_GUI_COMMAND_NAMES enum CommandButtonMappedBorderType CPP_11(: Int) @@ -277,6 +276,7 @@ static const LookupListRec CommandButtonMappedBorderTypeNames[] = { NULL, 0 } }; +static_assert(ARRAY_SIZE(CommandButtonMappedBorderTypeNames) == COMMAND_BUTTON_BORDER_COUNT + 1, "Incorrect array size"); //------------------------------------------------------------------------------------------------- /** Command buttons are used to load the buttons we place on throughout the command bar * interface in different context sensitive windows depending on the situation and diff --git a/Generals/Code/GameEngine/Include/GameClient/Credits.h b/Generals/Code/GameEngine/Include/GameClient/Credits.h index 9e8c851f7bf..48aaf014ed1 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Credits.h +++ b/Generals/Code/GameEngine/Include/GameClient/Credits.h @@ -83,9 +83,10 @@ static const LookupListRec CreditStyleNames[] = { "MINORTITLE", CREDIT_STYLE_POSITION }, { "NORMAL", CREDIT_STYLE_NORMAL }, { "COLUMN", CREDIT_STYLE_COLUMN }, - + // CREDIT_STYLE_BLANK { NULL, 0 } }; +static_assert(ARRAY_SIZE(CreditStyleNames) == MAX_CREDIT_STYLES, "Incorrect array size"); class CreditsLine diff --git a/Generals/Code/GameEngine/Include/GameClient/DisconnectMenu.h b/Generals/Code/GameEngine/Include/GameClient/DisconnectMenu.h index 7561cc37057..a9423f5b13a 100644 --- a/Generals/Code/GameEngine/Include/GameClient/DisconnectMenu.h +++ b/Generals/Code/GameEngine/Include/GameClient/DisconnectMenu.h @@ -69,13 +69,13 @@ class DisconnectMenu { DisconnectManager *m_disconnectManager; ///< For retrieving status updates from the disconnect manager. DisconnectMenuStateType m_menuState; ///< The current state of the menu screen. - static const char *m_playerNameTextControlNames[MAX_SLOTS]; ///< names of the player name controls in the window. - static const char *m_playerTimeoutTextControlNames[MAX_SLOTS]; ///< names of the timeout controls in the window. - static const char *m_playerVoteButtonControlNames[MAX_SLOTS]; ///< names of the vote button controls in the window. - static const char *m_playerVoteCountControlNames[MAX_SLOTS]; ///< names of the vote count static text controls in the window. - static const char *m_packetRouterTimeoutControlName; ///< name of the packet router timeout control window. - static const char *m_packetRouterTimeoutLabelControlName; ///< name of the packet router timeout label control window. - static const char *m_textDisplayControlName; ///< name of the text display listbox control window. + static const char *const m_playerNameTextControlNames[MAX_SLOTS]; ///< names of the player name controls in the window. + static const char *const m_playerTimeoutTextControlNames[MAX_SLOTS]; ///< names of the timeout controls in the window. + static const char *const m_playerVoteButtonControlNames[MAX_SLOTS]; ///< names of the vote button controls in the window. + static const char *const m_playerVoteCountControlNames[MAX_SLOTS]; ///< names of the vote count static text controls in the window. + static const char *const m_packetRouterTimeoutControlName; ///< name of the packet router timeout control window. + static const char *const m_packetRouterTimeoutLabelControlName; ///< name of the packet router timeout label control window. + static const char *const m_textDisplayControlName; ///< name of the text display listbox control window. }; extern DisconnectMenu *TheDisconnectMenu; diff --git a/Generals/Code/GameEngine/Include/GameClient/Drawable.h b/Generals/Code/GameEngine/Include/GameClient/Drawable.h index 7111d9e26eb..42a48f9eee8 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Drawable.h +++ b/Generals/Code/GameEngine/Include/GameClient/Drawable.h @@ -81,9 +81,8 @@ enum DrawableIconType CPP_11(: Int) /** NOTE: This enum MUST appear in the same order as TheDrawableIconNames array to be * indexed correctly using that array */ ICON_INVALID = -1, - ICON_FIRST = 0, - ICON_DEFAULT_HEAL = ICON_FIRST, + ICON_DEFAULT_HEAL, ICON_STRUCTURE_HEAL, ICON_VEHICLE_HEAL, #ifdef ALLOW_DEMORALIZE @@ -102,7 +101,8 @@ enum DrawableIconType CPP_11(: Int) ICON_ENTHUSIASTIC_SUBLIMINAL, ICON_CARBOMB, - MAX_ICONS + MAX_ICONS, + ICON_FIRST = 0, }; //----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameClient/EstablishConnectionsMenu.h b/Generals/Code/GameEngine/Include/GameClient/EstablishConnectionsMenu.h index 7018d5d42e9..50351552e09 100644 --- a/Generals/Code/GameEngine/Include/GameClient/EstablishConnectionsMenu.h +++ b/Generals/Code/GameEngine/Include/GameClient/EstablishConnectionsMenu.h @@ -47,9 +47,9 @@ class EstablishConnectionsMenu { protected: EstablishConnectionsMenuStateType m_menuState; - static const char *m_playerReadyControlNames[MAX_SLOTS]; - static const char *m_playerNameControlNames[MAX_SLOTS]; - static const char *m_playerStatusControlNames[MAX_SLOTS]; + static const char *const m_playerReadyControlNames[MAX_SLOTS]; + static const char *const m_playerNameControlNames[MAX_SLOTS]; + static const char *const m_playerStatusControlNames[MAX_SLOTS]; }; extern EstablishConnectionsMenu *TheEstablishConnectionsMenu; diff --git a/Generals/Code/GameEngine/Include/GameClient/Eva.h b/Generals/Code/GameEngine/Include/GameClient/Eva.h index 313453163ba..b2ddbd1affb 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Eva.h +++ b/Generals/Code/GameEngine/Include/GameClient/Eva.h @@ -39,8 +39,7 @@ class Player; // Keep in sync with TheEvaMessageNames AND Eva::s_shouldPlayFuncs enum EvaMessage CPP_11(: Int) { - EVA_FIRST = 0, - EVA_LowPower = EVA_FIRST, + EVA_LowPower, EVA_InsufficientFunds, EVA_SuperweaponDetected_ParticleCannon, EVA_SuperweaponDetected_Nuke, @@ -61,9 +60,10 @@ enum EvaMessage CPP_11(: Int) EVA_BuildingBeingStolen, EVA_COUNT, + EVA_FIRST = 0, }; -extern const char *TheEvaMessageNames[]; +extern const char *const TheEvaMessageNames[]; //------------------------------------------------------------------------------------ EvaCheckInfo struct EvaSideSounds diff --git a/Generals/Code/GameEngine/Include/GameClient/GameWindow.h b/Generals/Code/GameEngine/Include/GameClient/GameWindow.h index 7de2f660795..ad34564485d 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GameWindow.h +++ b/Generals/Code/GameEngine/Include/GameClient/GameWindow.h @@ -500,8 +500,8 @@ extern void GameWinDefaultTooltip( GameWindow *window, WinInstanceData *instData, UnsignedInt mouse ); -extern const char *WindowStatusNames[]; -extern const char *WindowStyleNames[]; +extern const char *const WindowStatusNames[]; +extern const char *const WindowStyleNames[]; #endif // __GAMEWINDOW_H_ diff --git a/Generals/Code/GameEngine/Include/GameClient/GameWindowTransitions.h b/Generals/Code/GameEngine/Include/GameClient/GameWindowTransitions.h index c91f7a73e54..35ed9714464 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GameWindowTransitions.h +++ b/Generals/Code/GameEngine/Include/GameClient/GameWindowTransitions.h @@ -48,6 +48,8 @@ #ifndef __GAME_WINDOW_TRANSITIONS_H_ #define __GAME_WINDOW_TRANSITIONS_H_ +#include "Common/GameCommon.h" + //----------------------------------------------------------------------------- // SYSTEM INCLUDES //////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- @@ -106,6 +108,7 @@ static const LookupListRec TransitionStyleNames[] = { "REVERSESOUND", REVERSE_SOUND_TRANSITION }, { NULL, 0 } }; +static_assert(ARRAY_SIZE(TransitionStyleNames) == MAX_TRANSITION_WINDOW_STYLES + 1, "Incorrect array size"); // base class for the transitions // inherit off of this adding in all the values diff --git a/Generals/Code/GameEngine/Include/GameClient/Image.h b/Generals/Code/GameEngine/Include/GameClient/Image.h index 2517ec5ade3..0fc166c55ff 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Image.h +++ b/Generals/Code/GameEngine/Include/GameClient/Image.h @@ -51,7 +51,7 @@ typedef enum } ImageStatus; #ifdef DEFINE_IMAGE_STATUS_NAMES -static const char *imageStatusNames[] = +static const char *const imageStatusNames[] = { "ROTATED_90_CLOCKWISE", "RAW_TEXTURE", diff --git a/Generals/Code/GameEngine/Include/GameClient/InGameUI.h b/Generals/Code/GameEngine/Include/GameClient/InGameUI.h index dfb21199e6d..8e712e59619 100644 --- a/Generals/Code/GameEngine/Include/GameClient/InGameUI.h +++ b/Generals/Code/GameEngine/Include/GameClient/InGameUI.h @@ -102,7 +102,7 @@ enum RadiusCursorType CPP_11(: Int) }; #ifdef DEFINE_RADIUSCURSOR_NAMES -static const char *TheRadiusCursorNames[] = +static const char *const TheRadiusCursorNames[] = { "NONE", "ATTACK_DAMAGE_AREA", @@ -135,6 +135,7 @@ static const char *TheRadiusCursorNames[] = NULL }; +static_assert(ARRAY_SIZE(TheRadiusCursorNames) == RADIUSCURSOR_COUNT + 1, "Incorrect array size"); #endif // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h b/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h index 9107a293b2f..ebbc5a24b47 100644 --- a/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h +++ b/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h @@ -269,7 +269,9 @@ enum MappableKeyTransition CPP_11(: Int) { DOWN, UP, - DOUBLEDOWN // if a key transition is repeated immediately, we generate this. + DOUBLEDOWN, // if a key transition is repeated immediately, we generate this. + + MAPPABLE_KEY_TRANSITION_COUNT }; static const LookupListRec TransitionNames[] = @@ -279,6 +281,7 @@ static const LookupListRec TransitionNames[] = { "DOUBLEDOWN", DOUBLEDOWN }, { NULL, 0 } }; +static_assert(ARRAY_SIZE(TransitionNames) == MAPPABLE_KEY_TRANSITION_COUNT + 1, "Incorrect array size"); // ------------------------------------------------------------------------------- // an easier-to-type subset of the KEY_STATE stuff. @@ -322,7 +325,7 @@ enum CommandUsableInType CPP_11(: Int) COMMANDUSABLE_EVERYWHERE = ~0, }; -static const char* TheCommandUsableInNames[] = +static const char* const TheCommandUsableInNames[] = { "SHELL", "GAME", diff --git a/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h b/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h index 5bb10628c0f..4970317cfc4 100644 --- a/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h +++ b/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h @@ -107,8 +107,8 @@ enum ParticlePriorityType CPP_11(: Int) CRITICAL, ///< super special top priority like a superweapon ALWAYS_RENDER, ///< used for logically important display (not just fluff), so must never be culled, regardless of particle cap, lod, etc // !!! *Noting* goes here ... special is the top priority !!! - PARTICLE_PRIORITY_HIGHEST = ALWAYS_RENDER, - NUM_PARTICLE_PRIORITIES + NUM_PARTICLE_PRIORITIES, + PARTICLE_PRIORITY_HIGHEST = NUM_PARTICLE_PRIORITIES - 1, }; /** @@ -250,46 +250,6 @@ class Particle : public MemoryPoolObject, }; - -//-------------------------------------------------------------------------------------------------------------- - -#ifdef DEFINE_PARTICLE_SYSTEM_NAMES - -/**** NOTE: These MUST be kept in sync with the enumerations below *****/ - -static const char *ParticleShaderTypeNames[] = -{ - "NONE", "ADDITIVE", "ALPHA", "ALPHA_TEST", "MULTIPLY", NULL -}; - -static const char *ParticleTypeNames[] = -{ - "NONE", "PARTICLE", "DRAWABLE", "STREAK", "VOLUME_PARTICLE", NULL -}; - -static const char *EmissionVelocityTypeNames[] = -{ - "NONE", "ORTHO", "SPHERICAL", "HEMISPHERICAL", "CYLINDRICAL", "OUTWARD", NULL -}; - -static const char *EmissionVolumeTypeNames[] = -{ - "NONE", "POINT", "LINE", "BOX", "SPHERE", "CYLINDER", NULL -}; - -//"NONE", "FLUFF", "DEBRIS", "NATURE", "WEAPON", "DAMAGE", "SPECIAL" -static const char *ParticlePriorityNames[] = -{ - "NONE", "WEAPON_EXPLOSION","SCORCHMARK","DUST_TRAIL","BUILDUP","DEBRIS_TRAIL","UNIT_DAMAGE_FX","DEATH_EXPLOSION","SEMI_CONSTANT","CONSTANT","WEAPON_TRAIL","AREA_EFFECT","CRITICAL", "ALWAYS_RENDER", NULL -}; - -static const char *WindMotionNames[] = -{ - "NONE", "Unused", "PingPong", "Circular", NULL -}; - -#endif - /** * All of the properties of a particle system, used by both ParticleSystemTemplates * and ParticleSystem classes. @@ -310,13 +270,15 @@ class ParticleSystemInfo : public Snapshot enum ParticleShaderType { - INVALID_SHADER=0, ADDITIVE, ALPHA, ALPHA_TEST, MULTIPLY + INVALID_SHADER=0, ADDITIVE, ALPHA, ALPHA_TEST, MULTIPLY, + PARTICLE_SHADER_TYPE_COUNT } m_shaderType; ///< how this particle is rendered enum ParticleType { - INVALID_TYPE=0, PARTICLE, DRAWABLE, STREAK, VOLUME_PARTICLE ///< is a particle a 2D-screen-facing particle, or a Drawable, or a Segment in a streak? + INVALID_TYPE=0, PARTICLE, DRAWABLE, STREAK, VOLUME_PARTICLE, ///< is a particle a 2D-screen-facing particle, or a Drawable, or a Segment in a streak? + PARTICLE_TYPE_COUNT } m_particleType; @@ -376,7 +338,8 @@ class ParticleSystemInfo : public Snapshot // The direction and speed at which particles are emitted enum EmissionVelocityType { - INVALID_VELOCITY=0, ORTHO, SPHERICAL, HEMISPHERICAL, CYLINDRICAL, OUTWARD + INVALID_VELOCITY=0, ORTHO, SPHERICAL, HEMISPHERICAL, CYLINDRICAL, OUTWARD, + EMISSION_VELOCITY_TYPE_COUNT } m_emissionVelocityType; @@ -419,7 +382,8 @@ class ParticleSystemInfo : public Snapshot // Note that the volume is relative to the system's position and orientation enum EmissionVolumeType { - INVALID_VOLUME=0, POINT, LINE, BOX, SPHERE, CYLINDER + INVALID_VOLUME=0, POINT, LINE, BOX, SPHERE, CYLINDER, + EMISSION_VOLUME_TYPE_COUNT } m_emissionVolumeType; ///< the type of volume where particles are created @@ -468,7 +432,9 @@ class ParticleSystemInfo : public Snapshot WIND_MOTION_INVALID = 0, WIND_MOTION_NOT_USED, WIND_MOTION_PING_PONG, - WIND_MOTION_CIRCULAR + WIND_MOTION_CIRCULAR, + + WIND_MOTION_COUNT }; WindMotion m_windMotion; ///< motion of the wind angle updating Real m_windAngle; ///< angle of the "wind" associated with this system @@ -485,6 +451,49 @@ class ParticleSystemInfo : public Snapshot }; +//-------------------------------------------------------------------------------------------------------------- + +#ifdef DEFINE_PARTICLE_SYSTEM_NAMES + +/**** NOTE: These MUST be kept in sync with the enumerations above *****/ + +static const char *const ParticleShaderTypeNames[] = +{ + "NONE", "ADDITIVE", "ALPHA", "ALPHA_TEST", "MULTIPLY", NULL +}; +static_assert(ARRAY_SIZE(ParticleShaderTypeNames) == ParticleSystemInfo::PARTICLE_SHADER_TYPE_COUNT + 1, "Incorrect array size"); + +static const char *const ParticleTypeNames[] = +{ + "NONE", "PARTICLE", "DRAWABLE", "STREAK", "VOLUME_PARTICLE", NULL +}; +static_assert(ARRAY_SIZE(ParticleTypeNames) == ParticleSystemInfo::PARTICLE_TYPE_COUNT + 1, "Incorrect array size"); + +static const char *const EmissionVelocityTypeNames[] = +{ + "NONE", "ORTHO", "SPHERICAL", "HEMISPHERICAL", "CYLINDRICAL", "OUTWARD", NULL +}; +static_assert(ARRAY_SIZE(EmissionVelocityTypeNames) == ParticleSystemInfo::EMISSION_VELOCITY_TYPE_COUNT + 1, "Incorrect array size"); + +static const char *const EmissionVolumeTypeNames[] = +{ + "NONE", "POINT", "LINE", "BOX", "SPHERE", "CYLINDER", NULL +}; +static_assert(ARRAY_SIZE(EmissionVolumeTypeNames) == ParticleSystemInfo::EMISSION_VOLUME_TYPE_COUNT + 1, "Incorrect array size"); + +static const char *const ParticlePriorityNames[] = +{ + "NONE", "WEAPON_EXPLOSION","SCORCHMARK","DUST_TRAIL","BUILDUP","DEBRIS_TRAIL","UNIT_DAMAGE_FX","DEATH_EXPLOSION","SEMI_CONSTANT","CONSTANT","WEAPON_TRAIL","AREA_EFFECT","CRITICAL", "ALWAYS_RENDER", NULL +}; +static_assert(ARRAY_SIZE(ParticlePriorityNames) == NUM_PARTICLE_PRIORITIES + 1, "Incorrect array size"); + +static const char *const WindMotionNames[] = +{ + "NONE", "Unused", "PingPong", "Circular", NULL +}; +static_assert(ARRAY_SIZE(WindMotionNames) == ParticleSystemInfo::WIND_MOTION_COUNT + 1, "Incorrect array size"); + +#endif /** * A ParticleSystemTemplate, used by the ParticleSystemManager to instantiate ParticleSystems. diff --git a/Generals/Code/GameEngine/Include/GameClient/Shadow.h b/Generals/Code/GameEngine/Include/GameClient/Shadow.h index e0da19a5274..2a3c8423629 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Shadow.h +++ b/Generals/Code/GameEngine/Include/GameClient/Shadow.h @@ -50,7 +50,7 @@ enum ShadowType CPP_11(: Int) SHADOW_ADDITIVE_DECAL = 0x00000040 //not really for shadows but for other decal uses. Additive blended. }; #ifdef DEFINE_SHADOW_NAMES -static const char* TheShadowNames[] = +static const char* const TheShadowNames[] = { "SHADOW_DECAL", "SHADOW_VOLUME", diff --git a/Generals/Code/GameEngine/Include/GameClient/ShellHooks.h b/Generals/Code/GameEngine/Include/GameClient/ShellHooks.h index 8af63cfc083..7e7e426ea5c 100644 --- a/Generals/Code/GameEngine/Include/GameClient/ShellHooks.h +++ b/Generals/Code/GameEngine/Include/GameClient/ShellHooks.h @@ -80,7 +80,7 @@ enum SHELL_SCRIPT_HOOK_TOTAL }; -extern const char *TheShellHookNames[]; ///< Contains a list of the text representation of the shell hooks Used in WorldBuilder and in the shell. +extern const char *const TheShellHookNames[]; ///< Contains a list of the text representation of the shell hooks Used in WorldBuilder and in the shell. void SignalUIInteraction(Int interaction); #endif // SHELLHOOKS_H diff --git a/Generals/Code/GameEngine/Include/GameClient/TerrainVisual.h b/Generals/Code/GameEngine/Include/GameClient/TerrainVisual.h index 72b68010917..29cc26146e2 100644 --- a/Generals/Code/GameEngine/Include/GameClient/TerrainVisual.h +++ b/Generals/Code/GameEngine/Include/GameClient/TerrainVisual.h @@ -47,22 +47,22 @@ class Drawable; //------------------------------------------------------------------------------------------------- typedef enum _TerrainLOD CPP_11(: Int) { - TERRAIN_LOD_INVALID = 0, - TERRAIN_LOD_MIN = 1, // note that this is less than max - TERRAIN_LOD_STRETCH_NO_CLOUDS = 2, - TERRAIN_LOD_HALF_CLOUDS = 3, - TERRAIN_LOD_NO_CLOUDS = 4, - TERRAIN_LOD_STRETCH_CLOUDS = 5, - TERRAIN_LOD_NO_WATER = 6, - TERRAIN_LOD_MAX = 7, // note that this is larger than min - TERRAIN_LOD_AUTOMATIC = 8, - TERRAIN_LOD_DISABLE = 9, + TERRAIN_LOD_INVALID, + TERRAIN_LOD_MIN, // note that this is less than max + TERRAIN_LOD_STRETCH_NO_CLOUDS, + TERRAIN_LOD_HALF_CLOUDS, + TERRAIN_LOD_NO_CLOUDS, + TERRAIN_LOD_STRETCH_CLOUDS, + TERRAIN_LOD_NO_WATER, + TERRAIN_LOD_MAX, // note that this is larger than min + TERRAIN_LOD_AUTOMATIC, + TERRAIN_LOD_DISABLE, TERRAIN_LOD_NUM_TYPES } TerrainLOD; #ifdef DEFINE_TERRAIN_LOD_NAMES -static const char * TerrainLODNames[] = +static const char *const TerrainLODNames[] = { "NONE", "MIN", @@ -77,6 +77,7 @@ static const char * TerrainLODNames[] = NULL }; +static_assert(ARRAY_SIZE(TerrainLODNames) == TERRAIN_LOD_NUM_TYPES + 1, "Incorrect array size"); #endif // end DEFINE_TERRAIN_LOD_NAMES //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameLogic/AI.h b/Generals/Code/GameEngine/Include/GameLogic/AI.h index 5fb25d4ae3a..f1a0b29af6d 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/AI.h +++ b/Generals/Code/GameEngine/Include/GameLogic/AI.h @@ -329,14 +329,16 @@ enum CommandSourceType CPP_11(: Int); typedef UnsignedInt CommandSourceMask; #ifdef DEFINE_COMMANDSOURCEMASK_NAMES -static const char *TheCommandSourceMaskNames[] = +static const char *const TheCommandSourceMaskNames[] = { "FROM_PLAYER", "FROM_SCRIPT", "FROM_AI", + "FROM_DOZER", //don't use this NULL }; +static_assert(ARRAY_SIZE(TheCommandSourceMaskNames) == COMMAND_SOURCE_TYPE_COUNT + 1, "Incorrect array size"); #endif //------------------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Include/GameLogic/Damage.h b/Generals/Code/GameEngine/Include/GameLogic/Damage.h index 369b058848a..9d324e42474 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Damage.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Damage.h @@ -100,7 +100,7 @@ enum DamageType CPP_11(: Int) }; #ifdef DEFINE_DAMAGE_NAMES -static const char *TheDamageNames[] = +static const char *const TheDamageNames[] = { "EXPLOSION", "CRUSH", @@ -137,6 +137,7 @@ static const char *TheDamageNames[] = NULL }; +static_assert(ARRAY_SIZE(TheDamageNames) == DAMAGE_NUM_TYPES + 1, "Incorrect array size"); #endif // end DEFINE_DAMAGE_NAMES @@ -200,7 +201,7 @@ enum DeathType CPP_11(: Int) }; #ifdef DEFINE_DEATH_NAMES -static const char *TheDeathNames[] = +static const char *const TheDeathNames[] = { "NORMAL", "NONE", @@ -226,6 +227,7 @@ static const char *TheDeathNames[] = NULL }; +static_assert(ARRAY_SIZE(TheDeathNames) == DEATH_NUM_TYPES + 1, "Incorrect array size"); #endif // end DEFINE_DEATH_NAMES diff --git a/Generals/Code/GameEngine/Include/GameLogic/Locomotor.h b/Generals/Code/GameEngine/Include/GameLogic/Locomotor.h index ba558d27351..2c10426ee28 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Locomotor.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Locomotor.h @@ -60,18 +60,22 @@ enum LocomotorAppearance CPP_11(: Int) LOCO_THRUST, LOCO_WINGS, LOCO_CLIMBER, // human climber - backs down cliffs. - LOCO_OTHER + LOCO_OTHER, + + LOCOMOTOR_APPEARANCE_COUNT }; enum LocomotorPriority CPP_11(: Int) { - LOCO_MOVES_BACK=0, // In a group, this one moves toward the back - LOCO_MOVES_MIDDLE=1, // In a group, this one stays in the middle - LOCO_MOVES_FRONT=2 // In a group, this one moves toward the front of the group + LOCO_MOVES_BACK, // In a group, this one moves toward the back + LOCO_MOVES_MIDDLE, // In a group, this one stays in the middle + LOCO_MOVES_FRONT, // In a group, this one moves toward the front of the group + + LOCOMOTOR_PRIORITY_COUNT }; #ifdef DEFINE_LOCO_APPEARANCE_NAMES -static const char *TheLocomotorAppearanceNames[] = +static const char *const TheLocomotorAppearanceNames[] = { "TWO_LEGS", "FOUR_WHEELS", @@ -84,6 +88,7 @@ static const char *TheLocomotorAppearanceNames[] = NULL }; +static_assert(ARRAY_SIZE(TheLocomotorAppearanceNames) == LOCOMOTOR_APPEARANCE_COUNT + 1, "Array size"); #endif //------------------------------------------------------------------------------------------------- @@ -96,11 +101,13 @@ enum LocomotorBehaviorZ CPP_11(: Int) Z_FIXED_SURFACE_RELATIVE_HEIGHT, // stays fixed at surface-rel height, regardless of physics Z_FIXED_ABSOLUTE_HEIGHT, // stays fixed at absolute height, regardless of physics Z_RELATIVE_TO_GROUND_AND_BUILDINGS, // stays fixed at surface-rel height including buildings, regardless of physics - Z_SMOOTH_RELATIVE_TO_HIGHEST_LAYER // try to follow a height relative to the highest layer. + Z_SMOOTH_RELATIVE_TO_HIGHEST_LAYER, // try to follow a height relative to the highest layer. + + LOCOMOTOR_BEHAVIOR_Z_COUNT }; #ifdef DEFINE_LOCO_Z_NAMES -static const char *TheLocomotorBehaviorZNames[] = +static const char *const TheLocomotorBehaviorZNames[] = { "NO_Z_MOTIVE_FORCE", "SEA_LEVEL", @@ -113,6 +120,7 @@ static const char *TheLocomotorBehaviorZNames[] = NULL }; +static_assert(ARRAY_SIZE(TheLocomotorBehaviorZNames) == LOCOMOTOR_BEHAVIOR_Z_COUNT + 1, "Array size"); #endif //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameLogic/LocomotorSet.h b/Generals/Code/GameEngine/Include/GameLogic/LocomotorSet.h index 09c87d2ebff..af118cdc7ba 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/LocomotorSet.h +++ b/Generals/Code/GameEngine/Include/GameLogic/LocomotorSet.h @@ -61,7 +61,7 @@ const LocomotorSurfaceTypeMask NO_SURFACES = (LocomotorSurfaceTypeMask)0x0000; const LocomotorSurfaceTypeMask ALL_SURFACES = (LocomotorSurfaceTypeMask)0xffff; #ifdef DEFINE_SURFACECATEGORY_NAMES -static const char *TheLocomotorSurfaceTypeNames[] = +static const char *const TheLocomotorSurfaceTypeNames[] = { "GROUND", "WATER", diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h index e9d9db388dd..6c176b0ebbc 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h @@ -96,7 +96,7 @@ enum GuardTargetType CPP_11(: Int) }; #ifdef DEFINE_LOCOMOTORSET_NAMES -static const char *TheLocomotorSetNames[] = +static const char *const TheLocomotorSetNames[] = { "SET_NORMAL", "SET_NORMAL_UPGRADED", @@ -109,6 +109,7 @@ static const char *TheLocomotorSetNames[] = NULL }; +static_assert(ARRAY_SIZE(TheLocomotorSetNames) == LOCOMOTORSET_COUNT + 1, "Incorrect array size"); #endif enum AutoAcquireStates CPP_11(: Int) @@ -121,7 +122,7 @@ enum AutoAcquireStates CPP_11(: Int) }; #ifdef DEFINE_AUTOACQUIRE_NAMES -static const char *TheAutoAcquireEnemiesNames[] = +static const char *const TheAutoAcquireEnemiesNames[] = { "YES", "STEALTHED", diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/BodyModule.h b/Generals/Code/GameEngine/Include/GameLogic/Module/BodyModule.h index 2468bd7cae1..707b66b75e8 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/BodyModule.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/BodyModule.h @@ -61,7 +61,7 @@ enum BodyDamageType CPP_11(: Int) }; #ifdef DEFINE_BODYDAMAGETYPE_NAMES -static const char* TheBodyDamageTypeNames[] = +static const char* const TheBodyDamageTypeNames[] = { "PRISTINE", "DAMAGED", @@ -70,6 +70,7 @@ static const char* TheBodyDamageTypeNames[] = NULL }; +static_assert(ARRAY_SIZE(TheBodyDamageTypeNames) == BODYDAMAGETYPE_COUNT + 1, "Incorrect array size"); #endif enum MaxHealthChangeType CPP_11(: Int) @@ -77,16 +78,19 @@ enum MaxHealthChangeType CPP_11(: Int) SAME_CURRENTHEALTH, PRESERVE_RATIO, ADD_CURRENT_HEALTH_TOO, + + MAX_HEALTH_CHANGE_COUNT }; #ifdef DEFINE_MAXHEALTHCHANGETYPE_NAMES -static const char* TheMaxHealthChangeTypeNames[] = +static const char* const TheMaxHealthChangeTypeNames[] = { "SAME_CURRENTHEALTH", "PRESERVE_RATIO", "ADD_CURRENT_HEALTH_TOO", NULL }; +static_assert(ARRAY_SIZE(TheMaxHealthChangeTypeNames) == MAX_HEALTH_CHANGE_COUNT + 1, "Incorrect array size"); #endif diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h index a88c30eb741..31a33564dd6 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h @@ -71,12 +71,13 @@ class DozerPrimaryStateMachine : public StateMachine enum DozerTask CPP_11(: Int) // These enums are saved in the game save file, so DO NOT renumber them. jba. { DOZER_TASK_INVALID = -1, - DOZER_TASK_FIRST = 0, - DOZER_TASK_BUILD = DOZER_TASK_FIRST, ///< go build something - DOZER_TASK_REPAIR = 1, ///< go repair something - DOZER_TASK_FORTIFY = 2, ///< go fortify something - DOZER_NUM_TASKS + DOZER_TASK_BUILD, ///< go build something + DOZER_TASK_REPAIR, ///< go repair something + DOZER_TASK_FORTIFY, ///< go fortify something + + DOZER_NUM_TASKS, // keep this last + DOZER_TASK_FIRST = 0, }; // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/HordeUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/HordeUpdate.h index fb9e97ae4a5..a1979e0f41c 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/HordeUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/HordeUpdate.h @@ -52,11 +52,12 @@ enum HordeActionType CPP_11(: Int) }; #ifdef DEFINE_HORDEACTION_NAMES -static const char *TheHordeActionTypeNames[] = +static const char *const TheHordeActionTypeNames[] = { "HORDE", NULL }; +static_assert(ARRAY_SIZE(TheHordeActionTypeNames) == HORDEACTION_COUNT + 1, "Incorrect array size"); #endif //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/OCLSpecialPower.h b/Generals/Code/GameEngine/Include/GameLogic/Module/OCLSpecialPower.h index ba2cc52b123..c428030197f 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/OCLSpecialPower.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/OCLSpecialPower.h @@ -47,6 +47,8 @@ enum OCLCreateLocType CPP_11(: Int) USE_OWNER_OBJECT, CREATE_ABOVE_LOCATION, CREATE_AT_EDGE_FARTHEST_FROM_TARGET, + + OCL_CREATE_LOC_COUNT }; //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h b/Generals/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h index 570c0c4547f..86edf379ca4 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h @@ -58,7 +58,7 @@ enum SlowDeathPhaseType CPP_11(: Int) }; #ifdef DEFINE_SLOWDEATHPHASE_NAMES -static const char *TheSlowDeathPhaseNames[] = +static const char *const TheSlowDeathPhaseNames[] = { "INITIAL", "MIDPOINT", @@ -66,6 +66,7 @@ static const char *TheSlowDeathPhaseNames[] = NULL }; +static_assert(ARRAY_SIZE(TheSlowDeathPhaseNames) == SD_PHASE_COUNT + 1, "Incorrect array size"); #endif diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/StealthUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/StealthUpdate.h index 04db57fb93a..0d970c75a0c 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/StealthUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/StealthUpdate.h @@ -52,7 +52,7 @@ enum }; #ifdef DEFINE_STEALTHLEVEL_NAMES -static const char *TheStealthLevelNames[] = +static const char *const TheStealthLevelNames[] = { "ATTACKING", "MOVING", diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h index dd51933a5ac..cea5ad278b6 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h @@ -73,7 +73,7 @@ enum StructureTopplePhaseType CPP_11(: Int) ST_PHASE_COUNT }; -static const char *TheStructureTopplePhaseNames[] = +static const char *const TheStructureTopplePhaseNames[] = { "INITIAL", "DELAY", @@ -81,6 +81,7 @@ static const char *TheStructureTopplePhaseNames[] = NULL }; +static_assert(ARRAY_SIZE(TheStructureTopplePhaseNames) == ST_PHASE_COUNT + 1, "Incorrect array size"); //------------------------------------------------------------------------------------------------- class StructureToppleUpdateModuleData : public UpdateModuleData diff --git a/Generals/Code/GameEngine/Include/GameLogic/Powers.h b/Generals/Code/GameEngine/Include/GameLogic/Powers.h index 83d0a07a1ca..ecdf1634eb4 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Powers.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Powers.h @@ -48,7 +48,7 @@ enum }; #ifdef DEFINE_POWER_NAMES -static const char *PowerNames[] = +static const char *const PowerNames[] = { "NONE", "FASTER", @@ -56,6 +56,7 @@ static const char *PowerNames[] = "SELF_HEALING", NULL }; +static_assert(ARRAY_SIZE(PowerNames) == POWERS_NUM_POWERS + 1, "Incorrect array size"); #endif // end DEFINE_POWER_NAMES #endif // __POWERS_H_ diff --git a/Generals/Code/GameEngine/Include/GameLogic/Scripts.h b/Generals/Code/GameEngine/Include/GameLogic/Scripts.h index 40d68f7d4a6..77f6130f13e 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Scripts.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Scripts.h @@ -832,7 +832,7 @@ class Parameter : public MemoryPoolObject }; EMPTY_DTOR(Parameter) -extern const char* TheObjectFlagsNames[]; +extern const char* const TheObjectFlagsNames[]; //------------------------------------------------------------------------------------------------- // ******************************** class Condition *********************************************** diff --git a/Generals/Code/GameEngine/Include/GameLogic/Weapon.h b/Generals/Code/GameEngine/Include/GameLogic/Weapon.h index a01b6f7b5db..dda3d86b336 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Weapon.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Weapon.h @@ -60,17 +60,20 @@ enum WeaponReloadType CPP_11(: Int) { AUTO_RELOAD, NO_RELOAD, - RETURN_TO_BASE_TO_RELOAD + RETURN_TO_BASE_TO_RELOAD, + + WEAPON_RELOAD_COUNT }; #ifdef DEFINE_WEAPONRELOAD_NAMES -static const char *TheWeaponReloadNames[] = +static const char *const TheWeaponReloadNames[] = { "YES", "NO", "RETURN_TO_BASE", NULL }; +static_assert(ARRAY_SIZE(TheWeaponReloadNames) == WEAPON_RELOAD_COUNT + 1, "Incorrect array size"); #endif //------------------------------------------------------------------------------------------------- @@ -84,13 +87,14 @@ enum WeaponPrefireType CPP_11(: Int) }; #ifdef DEFINE_WEAPONPREFIRE_NAMES -static const char *TheWeaponPrefireNames[] = +static const char *const TheWeaponPrefireNames[] = { "PER_SHOT", "PER_ATTACK", "PER_CLIP", NULL }; +static_assert(ARRAY_SIZE(TheWeaponPrefireNames) == PREFIRE_COUNT + 1, "Incorrect array size"); #endif //------------------------------------------------------------------------------------------------- @@ -119,7 +123,7 @@ enum WeaponAffectsMaskType CPP_11(: Int) }; #ifdef DEFINE_WEAPONAFFECTSMASK_NAMES -static const char *TheWeaponAffectsMaskNames[] = +static const char *const TheWeaponAffectsMaskNames[] = { "SELF", "ALLIES", @@ -149,7 +153,7 @@ enum WeaponCollideMaskType CPP_11(: Int) }; #ifdef DEFINE_WEAPONCOLLIDEMASK_NAMES -static const char *TheWeaponCollideMaskNames[] = +static const char *const TheWeaponCollideMaskNames[] = { "ALLIES", "ENEMIES", @@ -204,7 +208,7 @@ enum WeaponBonusConditionType CPP_11(: Int) WEAPONBONUSCONDITION_COUNT }; #ifdef DEFINE_WEAPONBONUSCONDITION_NAMES -static const char *TheWeaponBonusNames[] = +static const char *const TheWeaponBonusNames[] = { // This is a RHS enum (weapon.ini will have WeaponBonus = IT) so it is all caps "GARRISONED", @@ -235,6 +239,7 @@ static const char *TheWeaponBonusNames[] = "SOLO_AI_HARD", NULL }; +static_assert(ARRAY_SIZE(TheWeaponBonusNames) == WEAPONBONUSCONDITION_COUNT + 1, "Incorrect array size"); #endif // For WeaponBonusConditionFlags @@ -280,7 +285,7 @@ class WeaponBonus }; #ifdef DEFINE_WEAPONBONUSFIELD_NAMES -static const char *TheWeaponBonusFieldNames[] = +static const char *const TheWeaponBonusFieldNames[] = { "DAMAGE", "RADIUS", @@ -289,6 +294,7 @@ static const char *TheWeaponBonusFieldNames[] = "PRE_ATTACK", NULL }; +static_assert(ARRAY_SIZE(TheWeaponBonusFieldNames) == WeaponBonus::FIELD_COUNT + 1, "Incorrect array size"); #endif diff --git a/Generals/Code/GameEngine/Include/GameLogic/WeaponSet.h b/Generals/Code/GameEngine/Include/GameLogic/WeaponSet.h index 4c905ce37e1..51638bb3e42 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/WeaponSet.h +++ b/Generals/Code/GameEngine/Include/GameLogic/WeaponSet.h @@ -53,7 +53,7 @@ enum DamageType CPP_11(: Int); #include "GameLogic/WeaponSetFlags.h" #ifdef DEFINE_WEAPONSLOTTYPE_NAMES -static const char *TheWeaponSlotTypeNames[] = +static const char *const TheWeaponSlotTypeNames[] = { "PRIMARY", "SECONDARY", @@ -61,6 +61,7 @@ static const char *TheWeaponSlotTypeNames[] = NULL }; +static_assert(ARRAY_SIZE(TheWeaponSlotTypeNames) == WEAPONSLOT_COUNT + 1, "Incorrect array size"); static const LookupListRec TheWeaponSlotTypeNamesLookupList[] = { @@ -70,6 +71,7 @@ static const LookupListRec TheWeaponSlotTypeNamesLookupList[] = { NULL, 0 } }; +static_assert(ARRAY_SIZE(TheWeaponSlotTypeNamesLookupList) == WEAPONSLOT_COUNT + 1, "Incorrect array size"); #endif diff --git a/Generals/Code/GameEngine/Source/Common/BitFlags.cpp b/Generals/Code/GameEngine/Source/Common/BitFlags.cpp index ae27998b830..ceb943c9742 100644 --- a/Generals/Code/GameEngine/Source/Common/BitFlags.cpp +++ b/Generals/Code/GameEngine/Source/Common/BitFlags.cpp @@ -38,7 +38,7 @@ #include "GameLogic/ArmorSet.h" template<> -const char* ModelConditionFlags::s_bitNameList[] = +const char* const ModelConditionFlags::s_bitNameList[] = { "TOPPLED", "FRONTCRUSHED", @@ -148,15 +148,17 @@ const char* ModelConditionFlags::s_bitNameList[] = NULL }; +static_assert(ARRAY_SIZE(ModelConditionFlags::s_bitNameList) == ModelConditionFlags::NumBits + 1, "Incorrect array size"); template<> -const char* ArmorSetFlags::s_bitNameList[] = +const char* const ArmorSetFlags::s_bitNameList[] = { "VETERAN", "ELITE", "HERO", "PLAYER_UPGRADE", + "WEAK_VERSUS_BASEDEFENSES", NULL }; - +static_assert(ARRAY_SIZE(ArmorSetFlags::s_bitNameList) == ArmorSetFlags::NumBits + 1, "Incorrect array size"); diff --git a/Generals/Code/GameEngine/Source/Common/GameLOD.cpp b/Generals/Code/GameEngine/Source/Common/GameLOD.cpp index 1aeaf7e6567..93ef42d5585 100644 --- a/Generals/Code/GameEngine/Source/Common/GameLOD.cpp +++ b/Generals/Code/GameEngine/Source/Common/GameLOD.cpp @@ -71,13 +71,14 @@ static const FieldParse TheStaticGameLODFieldParseTable[] = { "TextureReductionFactor", INI::parseInt, NULL, offsetof( StaticGameLODInfo, m_textureReduction ) }, }; -static const char *StaticGameLODNames[]= +static const char *const StaticGameLODNames[]= { "Low", "Medium", "High", "Custom" }; +static_assert(ARRAY_SIZE(StaticGameLODNames) == STATIC_GAME_LOD_COUNT, "Incorrect array size"); StaticGameLODInfo::StaticGameLODInfo(void) { @@ -115,13 +116,14 @@ static const FieldParse TheDynamicGameLODFieldParseTable[] = { "MinParticleSkipPriority", INI::parseIndexList, ParticlePriorityNames, offsetof( DynamicGameLODInfo, m_minDynamicParticleSkipPriority)}, }; -static const char *DynamicGameLODNames[]= +static const char *const DynamicGameLODNames[]= { "Low", "Medium", "High", "VeryHigh" }; +static_assert(ARRAY_SIZE(DynamicGameLODNames) == DYNAMIC_GAME_LOD_COUNT, "Incorrect array size"); DynamicGameLODInfo::DynamicGameLODInfo(void) { @@ -134,16 +136,18 @@ DynamicGameLODInfo::DynamicGameLODInfo(void) }; //Keep this in sync with enum in GameLOD.h -static const char *CPUNames[] = +static const char *const CPUNames[] = { "XX","P3", "P4","K7", NULL }; +static_assert(ARRAY_SIZE(CPUNames) == CPU_MAX + 1, "Incorrect array size"); //Keep this in sync with enum in GameLOD.h -static const char *VideoNames[] = +static const char *const VideoNames[] = { "XX","V2","V3","V4","V5","TNT","TNT2","GF2","R100","PS11","GF3","GF4","PS14","R200","PS20","R300", NULL }; +static_assert(ARRAY_SIZE(VideoNames) == DC_MAX + 1, "Incorrect array size"); void parseReallyLowMHz(INI* ini) { diff --git a/Generals/Code/GameEngine/Source/Common/INI/INIWater.cpp b/Generals/Code/GameEngine/Source/Common/INI/INIWater.cpp index ff73a59359f..14addebfa8e 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INIWater.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INIWater.cpp @@ -57,7 +57,7 @@ void INI::parseWaterSettingDefinition( INI* ini ) name.set( token ); // get the water setting we want to load based on name - const char **timeOfDayName = TimeOfDayNames; + const char *const *timeOfDayName = TimeOfDayNames; Int timeOfDayIndex = 0; // TIME_OF_DAY_INVALID while( timeOfDayName && *timeOfDayName ) { diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp index 9e1c6434501..bd01821872b 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp @@ -158,7 +158,7 @@ static void findClosestKindOf( Object *obj, void *userData ) AsciiString kindofMaskAsAsciiString(KindOfMaskType m) { AsciiString s; - const char** kindofNames = KindOfMaskType::getBitNames(); + const char* const* kindofNames = KindOfMaskType::getBitNames(); for (Int i=KINDOF_FIRST; i -const char* SpecialPowerMaskType::s_bitNameList[] = +const char* const SpecialPowerMaskType::s_bitNameList[] = { "SPECIAL_INVALID", @@ -102,6 +102,7 @@ const char* SpecialPowerMaskType::s_bitNameList[] = NULL }; +static_assert(ARRAY_SIZE(SpecialPowerMaskType::s_bitNameList) == SpecialPowerMaskType::NumBits + 1, "Incorrect array size"); //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/Common/System/DisabledTypes.cpp b/Generals/Code/GameEngine/Source/Common/System/DisabledTypes.cpp index 4fa50719421..7bc538d7cdb 100644 --- a/Generals/Code/GameEngine/Source/Common/System/DisabledTypes.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/DisabledTypes.cpp @@ -31,7 +31,7 @@ #include "Common/BitFlagsIO.h" template<> -const char* DisabledMaskType::s_bitNameList[] = +const char* const DisabledMaskType::s_bitNameList[] = { "DEFAULT", "DISABLED_HACKED", @@ -47,6 +47,7 @@ const char* DisabledMaskType::s_bitNameList[] = NULL }; +static_assert(ARRAY_SIZE(DisabledMaskType::s_bitNameList) == DisabledMaskType::NumBits + 1, "Incorrect array size"); DisabledMaskType DISABLEDMASK_NONE; // inits to all zeroes DisabledMaskType DISABLEDMASK_ALL; diff --git a/Generals/Code/GameEngine/Source/Common/System/GameCommon.cpp b/Generals/Code/GameEngine/Source/Common/System/GameCommon.cpp index f47338d4d99..84b76bc6d50 100644 --- a/Generals/Code/GameEngine/Source/Common/System/GameCommon.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/GameCommon.cpp @@ -30,7 +30,7 @@ #include "Common/GameCommon.h" -const char *TheVeterancyNames[] = +const char *const TheVeterancyNames[] = { "REGULAR", "VETERAN", @@ -38,14 +38,16 @@ const char *TheVeterancyNames[] = "HEROIC", NULL }; +static_assert(ARRAY_SIZE(TheVeterancyNames) == LEVEL_COUNT + 1, "Incorrect array size"); -const char *TheRelationshipNames[] = +const char *const TheRelationshipNames[] = { "ENEMIES", "NEUTRAL", "ALLIES", NULL }; +static_assert(ARRAY_SIZE(TheRelationshipNames) == RELATIONSHIP_COUNT + 1, "Incorrect array size"); //------------------------------------------------------------------------------------------------- // TheSuperHackers @todo DO NOT USE THIS FUNCTION! Use WWMath::Normalize_Angle instead. Delete this. diff --git a/Generals/Code/GameEngine/Source/Common/System/GameType.cpp b/Generals/Code/GameEngine/Source/Common/System/GameType.cpp index f7142f9a827..c75330ece7d 100644 --- a/Generals/Code/GameEngine/Source/Common/System/GameType.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/GameType.cpp @@ -26,7 +26,7 @@ #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine -const char *TimeOfDayNames[] = +const char *const TimeOfDayNames[] = { "NONE", "MORNING", @@ -36,11 +36,13 @@ const char *TimeOfDayNames[] = NULL }; +static_assert(ARRAY_SIZE(TimeOfDayNames) == TIME_OF_DAY_COUNT + 1, "Incorrect array size"); -const char *WeatherNames[] = +const char *const WeatherNames[] = { "NORMAL", "SNOWY", NULL }; +static_assert(ARRAY_SIZE(WeatherNames) == WEATHER_COUNT + 1, "Incorrect array size"); diff --git a/Generals/Code/GameEngine/Source/Common/System/KindOf.cpp b/Generals/Code/GameEngine/Source/Common/System/KindOf.cpp index a32bf9b02ab..0d77c3ffc6e 100644 --- a/Generals/Code/GameEngine/Source/Common/System/KindOf.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/KindOf.cpp @@ -32,7 +32,7 @@ #include "Common/BitFlagsIO.h" template<> -const char* KindOfMaskType::s_bitNameList[] = +const char* const KindOfMaskType::s_bitNameList[] = { "OBSTACLE", "SELECTABLE", @@ -133,6 +133,7 @@ const char* KindOfMaskType::s_bitNameList[] = "DONT_AUTO_CRUSH_INFANTRY", NULL }; +static_assert(ARRAY_SIZE(KindOfMaskType::s_bitNameList) == KindOfMaskType::NumBits + 1, "Incorrect array size"); KindOfMaskType KINDOFMASK_NONE; // inits to all zeroes diff --git a/Generals/Code/GameEngine/Source/Common/System/ObjectStatusTypes.cpp b/Generals/Code/GameEngine/Source/Common/System/ObjectStatusTypes.cpp index 2e90a40f9a2..01dff2c26b0 100644 --- a/Generals/Code/GameEngine/Source/Common/System/ObjectStatusTypes.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/ObjectStatusTypes.cpp @@ -33,7 +33,7 @@ #include "Common/BitFlagsIO.h" template<> -const char* ObjectStatusMaskType::s_bitNameList[] = +const char* const ObjectStatusMaskType::s_bitNameList[] = { "NONE", "DESTROYED", @@ -66,5 +66,6 @@ const char* ObjectStatusMaskType::s_bitNameList[] = "IS_CARBOMB", NULL }; +static_assert(ARRAY_SIZE(ObjectStatusMaskType::s_bitNameList) == ObjectStatusMaskType::NumBits + 1, "Incorrect array size"); ObjectStatusMaskType OBJECT_STATUS_MASK_NONE; // inits to all zeroes diff --git a/Generals/Code/GameEngine/Source/Common/System/Upgrade.cpp b/Generals/Code/GameEngine/Source/Common/System/Upgrade.cpp index 296ed3799dd..73be233ffbe 100644 --- a/Generals/Code/GameEngine/Source/Common/System/Upgrade.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/Upgrade.cpp @@ -39,12 +39,13 @@ #include "GameClient/Image.h" -const char *TheUpgradeTypeNames[] = +const char *const TheUpgradeTypeNames[] = { "PLAYER", "OBJECT", NULL }; +static_assert(ARRAY_SIZE(TheUpgradeTypeNames) == NUM_UPGRADE_TYPES + 1, "Incorrect array size"); // PUBLIC ///////////////////////////////////////////////////////////////////////////////////////// class UpgradeCenter *TheUpgradeCenter = NULL; diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index 3fa3a88ece3..3d85bef2b69 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -82,7 +82,7 @@ #define VERY_TRANSPARENT_HEATVISION (0.001f) #define HEATVISION_FADE_SCALAR (0.8f) -static const char *TheDrawableIconNames[] = +static const char *const TheDrawableIconNames[] = { "DefaultHeal", "StructureHeal", @@ -104,6 +104,7 @@ static const char *TheDrawableIconNames[] = "CarBomb", NULL }; +static_assert(ARRAY_SIZE(TheDrawableIconNames) == MAX_ICONS + 1, "Incorrect array size"); diff --git a/Generals/Code/GameEngine/Source/GameClient/Eva.cpp b/Generals/Code/GameEngine/Source/GameClient/Eva.cpp index 3f2dd08bd51..b69c40232a8 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Eva.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Eva.cpp @@ -34,7 +34,7 @@ //------------------------------------------------------------------------------------------------- -const char *TheEvaMessageNames[] = +static const char *const TheEvaMessageNames[] = { "LOWPOWER", "INSUFFICIENTFUNDS", @@ -55,8 +55,8 @@ const char *TheEvaMessageNames[] = "CASHSTOLEN", "UPGRADECOMPLETE", "BUILDINGBEINGSTOLEN", - "EVA_INVALID", }; +static_assert(ARRAY_SIZE(TheEvaMessageNames) == EVA_COUNT, "Incorrect array size"); //------------------------------------------------------------------------------ INI::parseEvaEvent void INI::parseEvaEvent( INI* ini ) @@ -142,7 +142,6 @@ const ShouldPlayFunc Eva::s_shouldPlayFuncs[] = Eva::shouldPlayGenericHandler, Eva::shouldPlayGenericHandler, Eva::shouldPlayGenericHandler, - NULL, }; //------------------------------------------------------------------------------------------------- @@ -332,6 +331,8 @@ Bool Eva::messageShouldPlay(EvaMessage messageToTest, UnsignedInt currentFrame) return FALSE; } + static_assert(ARRAY_SIZE(s_shouldPlayFuncs) == EVA_COUNT, "Incorrect array size"); + m_messageBeingTested = messageToTest; return s_shouldPlayFuncs[messageToTest](m_localPlayer); } diff --git a/Generals/Code/GameEngine/Source/GameClient/FXList.cpp b/Generals/Code/GameEngine/Source/GameClient/FXList.cpp index baaf025f31e..95d33879c79 100644 --- a/Generals/Code/GameEngine/Source/GameClient/FXList.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/FXList.cpp @@ -423,6 +423,8 @@ class ViewShakeFXNugget : public FXNugget { "CINE_INSANE", View::SHAKE_CINE_INSANE }, { 0, 0 } }; + static_assert(ARRAY_SIZE(shakeTypeNames) == View::SHAKE_COUNT + 1, "Incorrect array size"); + *(Int *)store = INI::scanLookupList(ini->getNextToken(), shakeTypeNames); } @@ -487,6 +489,8 @@ class TerrainScorchFXNugget : public FXNugget { "RANDOM", -1 }, { 0, 0 } }; + static_assert(ARRAY_SIZE(scorchTypeNames) == SCORCH_COUNT + 2, "Incorrect array size"); + *(Int *)store = INI::scanLookupList(ini->getNextToken(), scorchTypeNames); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp index afb11f304e4..b50c88f6bbc 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp @@ -165,6 +165,7 @@ static const LookupListRec AnimTypeNames[] = { "SLIDE_RIGHT", ControlBarSchemeAnimation::CB_ANIM_SLIDE_RIGHT }, { NULL, 0 } }; +static_assert(ARRAY_SIZE(AnimTypeNames) == ControlBarSchemeAnimation::CB_ANIM_MAX + 1, "Incorrect array size"); static void animSlideRight( ControlBarSchemeAnimation *anim ); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp index 37be2f4c160..183bbddff57 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp @@ -35,7 +35,7 @@ #include "GameNetwork/GameInfo.h" #include "GameNetwork/NetworkInterface.h" -const char *DisconnectMenu::m_playerNameTextControlNames[] = { +const char *const DisconnectMenu::m_playerNameTextControlNames[] = { "DisconnectScreen.wnd:StaticPlayer1Name", "DisconnectScreen.wnd:StaticPlayer2Name", "DisconnectScreen.wnd:StaticPlayer3Name", @@ -46,7 +46,7 @@ const char *DisconnectMenu::m_playerNameTextControlNames[] = { NULL }; -const char *DisconnectMenu::m_playerTimeoutTextControlNames[] = { +const char *const DisconnectMenu::m_playerTimeoutTextControlNames[] = { "DisconnectScreen.wnd:StaticPlayer1Timeout", "DisconnectScreen.wnd:StaticPlayer2Timeout", "DisconnectScreen.wnd:StaticPlayer3Timeout", @@ -57,7 +57,7 @@ const char *DisconnectMenu::m_playerTimeoutTextControlNames[] = { NULL }; -const char *DisconnectMenu::m_playerVoteButtonControlNames[] = { +const char *const DisconnectMenu::m_playerVoteButtonControlNames[] = { "DisconnectScreen.wnd:ButtonKickPlayer1", "DisconnectScreen.wnd:ButtonKickPlayer2", "DisconnectScreen.wnd:ButtonKickPlayer3", @@ -68,7 +68,7 @@ const char *DisconnectMenu::m_playerVoteButtonControlNames[] = { NULL }; -const char *DisconnectMenu::m_playerVoteCountControlNames[] = { +const char *const DisconnectMenu::m_playerVoteCountControlNames[] = { "DisconnectScreen.wnd:StaticPlayer1Votes", "DisconnectScreen.wnd:StaticPlayer2Votes", "DisconnectScreen.wnd:StaticPlayer3Votes", @@ -79,9 +79,9 @@ const char *DisconnectMenu::m_playerVoteCountControlNames[] = { NULL }; -const char *DisconnectMenu::m_packetRouterTimeoutControlName = "DisconnectScreen.wnd:StaticPacketRouterTimeout"; -const char *DisconnectMenu::m_packetRouterTimeoutLabelControlName = "DisconnectScreen.wnd:StaticPacketRouterTimeoutLabel"; -const char *DisconnectMenu::m_textDisplayControlName = "DisconnectScreen.wnd:ListboxTextDisplay"; +const char *const DisconnectMenu::m_packetRouterTimeoutControlName = "DisconnectScreen.wnd:StaticPacketRouterTimeout"; +const char *const DisconnectMenu::m_packetRouterTimeoutLabelControlName = "DisconnectScreen.wnd:StaticPacketRouterTimeoutLabel"; +const char *const DisconnectMenu::m_textDisplayControlName = "DisconnectScreen.wnd:ListboxTextDisplay"; static const Color chatNormalColor = GameMakeColor(255,0,0,255); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp index bac079ed1fe..46c77bdc47b 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp @@ -36,7 +36,7 @@ EstablishConnectionsMenu *TheEstablishConnectionsMenu = NULL; -const char *EstablishConnectionsMenu::m_playerReadyControlNames[] = { +const char *const EstablishConnectionsMenu::m_playerReadyControlNames[] = { "EstablishConnectionsScreen.wnd:ButtonAccept1", "EstablishConnectionsScreen.wnd:ButtonAccept2", "EstablishConnectionsScreen.wnd:ButtonAccept3", @@ -46,7 +46,7 @@ const char *EstablishConnectionsMenu::m_playerReadyControlNames[] = { "EstablishConnectionsScreen.wnd:ButtonAccept7", NULL}; -const char *EstablishConnectionsMenu::m_playerNameControlNames[] = { +const char *const EstablishConnectionsMenu::m_playerNameControlNames[] = { "EstablishConnectionsScreen.wnd:StaticPlayer1Name", "EstablishConnectionsScreen.wnd:StaticPlayer2Name", "EstablishConnectionsScreen.wnd:StaticPlayer3Name", @@ -57,7 +57,7 @@ const char *EstablishConnectionsMenu::m_playerNameControlNames[] = { NULL }; -const char *EstablishConnectionsMenu::m_playerStatusControlNames[] = { +const char *const EstablishConnectionsMenu::m_playerStatusControlNames[] = { "EstablishConnectionsScreen.wnd:StaticPlayer1Status", "EstablishConnectionsScreen.wnd:StaticPlayer2Status", "EstablishConnectionsScreen.wnd:StaticPlayer3Status", diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp index 1928f2a5e7d..4841fedc661 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp @@ -90,7 +90,7 @@ static Int lookAtPlayerID = 0; static std::string lookAtPlayerName; -static const char *rankNames[] = { +static const char *const rankNames[] = { "Private", "Corporal", "Sergeant", @@ -102,6 +102,8 @@ static const char *rankNames[] = { "Brigadier", "Commander", }; +static_assert(ARRAY_SIZE(rankNames) == MAX_RANKS, "Incorrect array size"); + static const Image* lookupRankImage(AsciiString side, Int rank) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp index 439aafc56b3..8eb8db217f8 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp @@ -366,7 +366,7 @@ static void populateGroupRoomListbox(GameWindow *lb) GadgetComboBoxSetSelectedPos(lb, indexToSelect); } -static const char *rankNames[] = { +static const char *const rankNames[] = { "Private", "Corporal", "Sergeant", @@ -378,6 +378,8 @@ static const char *rankNames[] = { "Brigadier", "Commander", }; +static_assert(ARRAY_SIZE(rankNames) == MAX_RANKS, "Incorrect array size"); + const Image* LookupSmallRankImage(Int side, Int rankPoints) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp index 4f477e461a7..7c846295edd 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp @@ -137,7 +137,7 @@ static GameFont *defFont = NULL; // These strings must be in the same order as they are in their definitions // (see WIN_STATUS_* enums and GWS_* enums). // -const char *WindowStatusNames[] = { "ACTIVE", "TOGGLE", "DRAGABLE", "ENABLED", "HIDDEN", +const char *const WindowStatusNames[] = { "ACTIVE", "TOGGLE", "DRAGABLE", "ENABLED", "HIDDEN", "ABOVE", "BELOW", "IMAGE", "TABSTOP", "NOINPUT", "NOFOCUS", "DESTROYED", "BORDER", "SMOOTH_TEXT", "ONE_LINE", "NO_FLUSH", "SEE_THRU", @@ -145,7 +145,7 @@ const char *WindowStatusNames[] = { "ACTIVE", "TOGGLE", "DRAGABLE", "ENABLED", " "USE_OVERLAY_STATES", "NOT_READY", "FLASHING", "ALWAYS_COLOR", NULL }; -const char *WindowStyleNames[] = { "PUSHBUTTON", "RADIOBUTTON", "CHECKBOX", +const char *const WindowStyleNames[] = { "PUSHBUTTON", "RADIOBUTTON", "CHECKBOX", "VERTSLIDER", "HORZSLIDER", "SCROLLLISTBOX", "ENTRYFIELD", "STATICTEXT", "PROGRESSBAR", "USER", "MOUSETRACK", "ANIMATED", @@ -199,9 +199,9 @@ static GameWindow *parseWindow( File *inFile, char *buffer ); * if successful. Returns TRUE on success, else FALSE. */ //============================================================================= static Bool parseBitFlag( const char *flagString, UnsignedInt *bits, - const char **flagList ) + ConstCharPtrArray flagList ) { - const char **c; + ConstCharPtrArray c; int i; for( i = 0, c = flagList; *c; i++, c++ ) @@ -225,7 +225,7 @@ static Bool parseBitFlag( const char *flagString, UnsignedInt *bits, * argument. * Note that this routine does not clear any bits, only sets them. */ //============================================================================= -static void parseBitString( const char *inBuffer, UnsignedInt *bits, const char **flagList ) +static void parseBitString( const char *inBuffer, UnsignedInt *bits, ConstCharPtrArray flagList ) { char buffer[256]; char *tok; diff --git a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp index f1012f7b59d..6f47b700f57 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -1108,7 +1108,7 @@ void GameClient::preloadAssets( TimeOfDay timeOfDay ) DEBUG_LOG(("Preloading memory dwAvailVirtual %d --> %d : %d", before.dwAvailVirtual, after.dwAvailVirtual, before.dwAvailVirtual - after.dwAvailVirtual)); - const char *textureNames[] = { + const char *const textureNames[] = { "ptspruce01.tga", "exrktflame.tga", "cvlimo3_d2.tga", diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp index d53f56d7ae8..e3715d69f5e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp @@ -59,7 +59,7 @@ LocomotorStore *TheLocomotorStore = NULL; ///< the Locomotor store definitio const Real BIGNUM = 99999.0f; -static const char *TheLocomotorPriorityNames[] = +static const char *const TheLocomotorPriorityNames[] = { "MOVES_BACK", "MOVES_MIDDLE", @@ -67,7 +67,7 @@ static const char *TheLocomotorPriorityNames[] = NULL }; - +static_assert(ARRAY_SIZE(TheLocomotorPriorityNames) == LOCOMOTOR_PRIORITY_COUNT + 1, "Array size"); /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp index 16f9ee8b084..4524f79c535 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp @@ -693,7 +693,7 @@ enum DebrisDisposition CPP_11(: Int) WHIRLING = 0x00000100 }; -static const char* DebrisDispositionNames[] = +static const char* const DebrisDispositionNames[] = { "LIKE_EXISTING", "ON_GROUND_ALIGNED", diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp index 19059cc77c8..8f4bda80c18 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp @@ -49,7 +49,7 @@ enum CREATE_ABOVE_LOCATION_HEIGHT = 300 }; -static const char* TheOCLCreateLocTypeNames[] = +static const char* const TheOCLCreateLocTypeNames[] = { "CREATE_AT_EDGE_NEAR_SOURCE", "CREATE_AT_EDGE_NEAR_TARGET", @@ -59,6 +59,7 @@ static const char* TheOCLCreateLocTypeNames[] = "CREATE_AT_EDGE_FARTHEST_FROM_TARGET", NULL }; +static_assert(ARRAY_SIZE(TheOCLCreateLocTypeNames) == OCL_CREATE_LOC_COUNT + 1, "Incorrect array size"); //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp index 42014a77fc3..758f6812a68 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp @@ -50,7 +50,7 @@ const Int MAX_IDX = 32; //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- -static const char *TheStructureCollapsePhaseNames[] = +static const char *const TheStructureCollapsePhaseNames[] = { "INITIAL", "DELAY", @@ -59,6 +59,7 @@ static const char *TheStructureCollapsePhaseNames[] = NULL }; +static_assert(ARRAY_SIZE(TheStructureCollapsePhaseNames) == SC_PHASE_COUNT + 1, "Wrong array size"); //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp index 95aba310827..450370feb99 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp @@ -59,7 +59,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// template<> -const char* WeaponSetFlags::s_bitNameList[] = +const char* const WeaponSetFlags::s_bitNameList[] = { "VETERAN", "ELITE", @@ -73,6 +73,7 @@ const char* WeaponSetFlags::s_bitNameList[] = NULL }; +static_assert(ARRAY_SIZE(WeaponSetFlags::s_bitNameList) == WeaponSetFlags::NumBits + 1, "Incorrect array size"); /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp index 261c82695d6..e97e15edaf0 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp @@ -75,7 +75,7 @@ static ScriptGroup *s_mtGroup = NULL; // These strings must be in the same order as they are in their definitions // (See SHELL_SCRIPT_HOOK_* ) // -const char *TheShellHookNames[]= +static const char *const TheShellHookNames[]= { "ShellMainMenuCampaignPushed", //SHELL_SCRIPT_HOOK_MAIN_MENU_CAMPAIGN_SELECTED, "ShellMainMenuCampaignHighlighted", //SHELL_SCRIPT_HOOK_MAIN_MENU_CAMPAIGN_HIGHLIGHTED, @@ -116,6 +116,8 @@ const char *TheShellHookNames[]= "ShellLANClosed", //SHELL_SCRIPT_HOOK_LAN_CLOSED, "ShellLANEnteredFromGame", //SHELL_SCRIPT_HOOK_LAN_ENTERED_FROM_GAME, }; +static_assert(ARRAY_SIZE(TheShellHookNames) == SHELL_SCRIPT_HOOK_TOTAL, "Incorrect array size"); + void SignalUIInteraction(Int interaction) { if (TheScriptEngine) @@ -2094,7 +2096,7 @@ Parameter *Parameter::ReadParameter(DataChunkInput &file) if (pParm->getParameterType() == KIND_OF_PARAM) { // Need to change the string to an integer - const char** kindofNames = KindOfMaskType::getBitNames(); + const char* const* kindofNames = KindOfMaskType::getBitNames(); if (!pParm->m_string.isEmpty()) { Bool found = false; @@ -2494,10 +2496,10 @@ Bool ScriptAction::ParseActionFalseDataChunk(DataChunkInput &file, DataChunkInfo return true; } -// NOTE: Changing these or adding ot TheOBjectFlagNames requires changes to +// NOTE: Changing these or adding to TheObjectFlagsNames requires changes to // ScriptActions::changeObjectPanelFlagForSingleObject // THEY SHOULD STAY IN SYNC. -const char* TheObjectFlagsNames[] = +const char* const TheObjectFlagsNames[] = { "Enabled", "Powered", @@ -2506,5 +2508,4 @@ const char* TheObjectFlagsNames[] = "Selectable", "AI Recruitable", "Player Targetable", - NULL, }; diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h index 352c6c05161..6829691cb46 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h @@ -46,6 +46,8 @@ class RenderObjClass { ANIM_MODE_LOOP_PINGPONG, ANIM_MODE_LOOP_BACKWARDS, //make sure only backwards playing animations after this one ANIM_MODE_ONCE_BACKWARDS, + + ANIM_MODE_COUNT }; }; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp index 022f359a548..d1d3a0c946e 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp @@ -227,9 +227,11 @@ enum ACBits CPP_11(: Int) MAINTAIN_FRAME_ACROSS_STATES2, MAINTAIN_FRAME_ACROSS_STATES3, MAINTAIN_FRAME_ACROSS_STATES4, + + AC_BITS_COUNT }; -static const char *ACBitsNames[] = +static const char *const ACBitsNames[] = { "RANDOMSTART", "START_FRAME_FIRST", @@ -244,6 +246,7 @@ static const char *ACBitsNames[] = NULL }; +static_assert(ARRAY_SIZE(ACBitsNames) == AC_BITS_COUNT + 1, "Incorrect array size"); static const Int ALL_MAINTAIN_FRAME_FLAGS = (1< m_bits; - static const char* s_bitNameList[]; public: + CPP_11(static constexpr size_t NumBits = NUMBITS); + static const char* const s_bitNameList[]; /* just a little syntactic sugar so that there is no "foo = 0" compatible constructor @@ -261,7 +262,7 @@ class BitFlags return true; } - static const char** getBitNames() + static const char* const* getBitNames() { return s_bitNameList; } @@ -274,7 +275,7 @@ class BitFlags static Int getSingleBitFromName(const char* token) { Int i = 0; - for(const char** name = s_bitNameList; *name; ++name, ++i ) + for(const char* const* name = s_bitNameList; *name; ++name, ++i ) { if( stricmp( *name, token ) == 0 ) { diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h b/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h index cd4b46e7155..723ab57d2b2 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h @@ -204,7 +204,7 @@ enum // NOTE NOTE NOTE: Keep TheVeterencyNames in sync with these. enum VeterancyLevel CPP_11(: Int) { - LEVEL_REGULAR = 0, + LEVEL_REGULAR, LEVEL_VETERAN, LEVEL_ELITE, LEVEL_HEROIC, @@ -212,12 +212,12 @@ enum VeterancyLevel CPP_11(: Int) LEVEL_COUNT, LEVEL_INVALID, - LEVEL_FIRST = LEVEL_REGULAR, + LEVEL_FIRST = 0, LEVEL_LAST = LEVEL_HEROIC }; // TheVeterancyNames is defined in GameCommon.cpp -extern const char *TheVeterancyNames[]; +extern const char *const TheVeterancyNames[]; //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -230,6 +230,7 @@ enum CommandSourceType CPP_11(: Int) CMD_FROM_DOZER, // Special rare command when the dozer originates a command to attack a mine. Mines are not ai-attackable, and it seems deceitful for the dozer to generate a player or script command. jba. CMD_DEFAULT_SWITCH_WEAPON, // Special case: A weapon that can be chosen -- this is the default case (machine gun vs flashbang). + COMMAND_SOURCE_TYPE_COUNT }; //------------------------------------------------------------------------------------------------- @@ -497,14 +498,16 @@ inline Real stdAngleDiff(Real a1, Real a2) // NOTE NOTE NOTE: Keep TheRelationShipNames in sync with this enum enum Relationship CPP_11(: Int) { - ENEMIES = 0, + ENEMIES, NEUTRAL, - ALLIES + ALLIES, + + RELATIONSHIP_COUNT }; // TheRelationShipNames is defined in Common/GameCommon.cpp -extern const char *TheRelationshipNames[]; +extern const char *const TheRelationshipNames[]; #endif // _GAMECOMMON_H_ diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h b/GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h index cff9f530765..0ae0e8e2007 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h @@ -69,6 +69,8 @@ enum CpuType CPP_11(: Int) P3, P4, K7, + + CPU_MAX }; //Keep this in sync with VideoNames in Gamelod.cpp diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameType.h b/GeneralsMD/Code/GameEngine/Include/Common/GameType.h index b84aabf1198..2110d8138bc 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GameType.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GameType.h @@ -67,17 +67,18 @@ class INI; //------------------------------------------------------------------------------------------------- enum TimeOfDay CPP_11(: Int) { - TIME_OF_DAY_INVALID = 0, - TIME_OF_DAY_FIRST = 1, - TIME_OF_DAY_MORNING = TIME_OF_DAY_FIRST, + TIME_OF_DAY_INVALID, + + TIME_OF_DAY_MORNING, TIME_OF_DAY_AFTERNOON, TIME_OF_DAY_EVENING, TIME_OF_DAY_NIGHT, - TIME_OF_DAY_COUNT + TIME_OF_DAY_COUNT, + TIME_OF_DAY_FIRST = TIME_OF_DAY_MORNING, }; -extern const char *TimeOfDayNames[]; +extern const char *const TimeOfDayNames[]; // defined in Common/GameType.cpp //------------------------------------------------------------------------------------------------- @@ -89,7 +90,7 @@ enum Weather CPP_11(: Int) WEATHER_COUNT }; -extern const char *WeatherNames[]; +extern const char *const WeatherNames[]; enum Scorches CPP_11(: Int) { diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Geometry.h b/GeneralsMD/Code/GameEngine/Include/Common/Geometry.h index a0c27f8b0c0..4d745501e5d 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Geometry.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Geometry.h @@ -48,22 +48,23 @@ class INI; //------------------------------------------------------------------------------------------------- enum GeometryType CPP_11(: Int) { - GEOMETRY_SPHERE = 0, ///< partition/collision testing as sphere. (majorRadius = radius) + GEOMETRY_SPHERE, ///< partition/collision testing as sphere. (majorRadius = radius) GEOMETRY_CYLINDER, ///< partition/collision testing as cylinder. (majorRadius = radius, height = height) GEOMETRY_BOX, ///< partition/collision testing as rectangular box (majorRadius = half len in forward dir; minorRadius = half len in side dir; height = height) GEOMETRY_NUM_TYPES, - GEOMETRY_FIRST = GEOMETRY_SPHERE + GEOMETRY_FIRST = 0 }; #ifdef DEFINE_GEOMETRY_NAMES -static const char *GeometryNames[] = +static const char *const GeometryNames[] = { "SPHERE", "CYLINDER", "BOX", NULL }; +static_assert(ARRAY_SIZE(GeometryNames) == GEOMETRY_NUM_TYPES + 1, "Incorrect array size"); #endif // end DEFINE_GEOMETRY_NAMES //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/Common/INI.h b/GeneralsMD/Code/GameEngine/Include/Common/INI.h index 75f7ec6845b..33259945e83 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/INI.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/INI.h @@ -91,14 +91,14 @@ enum /** Function typedef for parsing data block fields. * * buffer - the character buffer of the line from INI that we are reading and parsing - * instance - instance of what we're loading (for example a thingtemplate instance) + * instance - instance of what we're loading (for example a ThingTemplate instance) * store - where to store the data parsed, this is a field in the *instance* 'instance' */ //------------------------------------------------------------------------------------------------- typedef void (*INIFieldParseProc)( INI *ini, void *instance, void *store, const void* userData ); //------------------------------------------------------------------------------------------------- -typedef const char* ConstCharPtr; +typedef const char* const ConstCharPtr; typedef ConstCharPtr* ConstCharPtrArray; //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/Common/KindOf.h b/GeneralsMD/Code/GameEngine/Include/Common/KindOf.h index 0f8d015ab89..104a3843055 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/KindOf.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/KindOf.h @@ -44,8 +44,8 @@ enum KindOfType CPP_11(: Int) { KINDOF_INVALID = -1, - KINDOF_FIRST = 0, - KINDOF_OBSTACLE = KINDOF_FIRST, ///< an obstacle to land-based pathfinders + + KINDOF_OBSTACLE, ///< an obstacle to land-based pathfinders KINDOF_SELECTABLE, ///< Actually means MOUSE-INTERACTABLE (doesn't mean you can select it!) KINDOF_IMMOBILE, ///< fixed in location KINDOF_CAN_ATTACK, ///< can attack @@ -171,8 +171,8 @@ enum KindOfType CPP_11(: Int) KINDOF_CONSERVATIVE_BUILDING, ///< Conservative structures aren't considered part of your base for sneak attack boundary calculations... KINDOF_IGNORE_DOCKING_BONES, ///< Structure will not look up docking bones. Patch 1.03 hack. - KINDOF_COUNT // total number of kindofs - + KINDOF_COUNT, // total number of kindofs + KINDOF_FIRST = 0, }; typedef BitFlags KindOfMaskType; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ModelState.h b/GeneralsMD/Code/GameEngine/Include/Common/ModelState.h index 429b605833e..41efd752672 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/ModelState.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/ModelState.h @@ -94,13 +94,11 @@ enum ModelConditionFlagType CPP_11(: Int) { MODELCONDITION_INVALID = -1, - MODELCONDITION_FIRST = 0, - // // Note: these values are saved in save files, so you MUST NOT REMOVE OR CHANGE // existing values! // - MODELCONDITION_TOPPLED = MODELCONDITION_FIRST, + MODELCONDITION_TOPPLED, MODELCONDITION_FRONTCRUSHED, MODELCONDITION_BACKCRUSHED, MODELCONDITION_DAMAGED, @@ -242,7 +240,8 @@ enum ModelConditionFlagType CPP_11(: Int) // existing values! // - MODELCONDITION_COUNT + MODELCONDITION_COUNT, + MODELCONDITION_FIRST = 0, }; //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Player.h b/GeneralsMD/Code/GameEngine/Include/Common/Player.h index 25d0e8daaec..2e1dd36b2e6 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Player.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Player.h @@ -101,13 +101,14 @@ enum ScienceAvailabilityType CPP_11(: Int) }; #ifdef DEFINE_SCIENCE_AVAILABILITY_NAMES -static const char *ScienceAvailabilityNames[] = +static const char *const ScienceAvailabilityNames[] = { "Available", "Disabled", "Hidden", NULL }; +static_assert(ARRAY_SIZE(ScienceAvailabilityNames) == SCIENCE_AVAILABILITY_COUNT + 1, "Incorrect array size"); #endif // end DEFINE_SCIENCE_AVAILABILITY_NAMES static const Int NUM_HOTKEY_SQUADS = 10; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Radar.h b/GeneralsMD/Code/GameEngine/Include/Common/Radar.h index 321234598c9..43afe9a55db 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Radar.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Radar.h @@ -145,7 +145,7 @@ enum RadarPriorityType CPP_11(: Int) RADAR_PRIORITY_NUM_PRIORITIES }; #ifdef DEFINE_RADAR_PRIORITY_NAMES -static const char *RadarPriorityNames[] = +static const char *const RadarPriorityNames[] = { "INVALID", // a priority that has not been set (in general it won't show up on the radar) "NOT_ON_RADAR", // object specifically forbidden from being on the radar @@ -155,6 +155,7 @@ static const char *RadarPriorityNames[] = NULL }; +static_assert(ARRAY_SIZE(RadarPriorityNames) == RADAR_PRIORITY_NUM_PRIORITIES + 1, "Incorrect array size"); #endif // DEFINE_RADAR_PRIOTITY_NAMES //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/Common/TerrainTypes.h b/GeneralsMD/Code/GameEngine/Include/Common/TerrainTypes.h index 278abf53404..6858c5e2556 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/TerrainTypes.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/TerrainTypes.h @@ -93,7 +93,7 @@ typedef enum } TerrainClass; #ifdef DEFINE_TERRAIN_TYPE_NAMES -static const char *terrainTypeNames[] = +static const char *const terrainTypeNames[] = { "NONE", "DESERT_1", @@ -142,6 +142,7 @@ static const char *terrainTypeNames[] = NULL }; +static_assert(ARRAY_SIZE(terrainTypeNames) == TERRAIN_NUM_CLASSES + 1, "Incorrect array size"); #endif // end DEFINE_TERRAIN_TYPE_NAMES //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ThingSort.h b/GeneralsMD/Code/GameEngine/Include/Common/ThingSort.h index 4950819a7df..a7029d622a6 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/ThingSort.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/ThingSort.h @@ -32,12 +32,12 @@ #ifndef __THINGSORT_H_ #define __THINGSORT_H_ +#include "GameCommon.h" + //------------------------------------------------------------------------------------------------- enum EditorSortingType CPP_11(: Int) { - ES_FIRST = 0, - - ES_NONE = ES_FIRST, + ES_NONE, ES_STRUCTURE, ES_INFANTRY, ES_VEHICLE, @@ -52,11 +52,12 @@ enum EditorSortingType CPP_11(: Int) ES_ROAD, // road objects...should never actually be in the object panel. ES_WAYPOINT, // waypoint objects...should never actually be in the object panel. - ES_NUM_SORTING_TYPES - + ES_NUM_SORTING_TYPES, + ES_FIRST = 0, }; + #ifdef DEFINE_EDITOR_SORTING_NAMES -static const char *EditorSortingNames[] = +static const char *const EditorSortingNames[] = { "NONE", "STRUCTURE", @@ -75,6 +76,7 @@ static const char *EditorSortingNames[] = NULL }; +static_assert(ARRAY_SIZE(EditorSortingNames) == ES_NUM_SORTING_TYPES + 1, "Incorrect array size"); #endif #endif // __THINGSORT_H_ diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h b/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h index f8c8ec22d8b..aa18d383212 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h @@ -203,7 +203,7 @@ enum BuildCompletionType CPP_11(: Int) BC_NUM_TYPES }; #ifdef DEFINE_BUILD_COMPLETION_NAMES -static const char *BuildCompletionNames[] = +static const char *const BuildCompletionNames[] = { "INVALID", "APPEARS_AT_RALLY_POINT", @@ -211,6 +211,7 @@ static const char *BuildCompletionNames[] = NULL }; +static_assert(ARRAY_SIZE(BuildCompletionNames) == BC_NUM_TYPES + 1, "Incorrect array size"); #endif // end DEFINE_BUILD_COMPLETION_NAMES enum BuildableStatus CPP_11(: Int) @@ -225,7 +226,7 @@ enum BuildableStatus CPP_11(: Int) }; #ifdef DEFINE_BUILDABLE_STATUS_NAMES -static const char *BuildableStatusNames[] = +static const char *const BuildableStatusNames[] = { "Yes", "Ignore_Prerequisites", @@ -233,6 +234,7 @@ static const char *BuildableStatusNames[] = "Only_By_AI", NULL }; +static_assert(ARRAY_SIZE(BuildableStatusNames) == BSTATUS_NUM_TYPES + 1, "Incorrect array size"); #endif // end DEFINE_BUILDABLE_STATUS_NAMES //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Upgrade.h b/GeneralsMD/Code/GameEngine/Include/Common/Upgrade.h index c7bb5c2981f..afcc79b82a1 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Upgrade.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Upgrade.h @@ -152,7 +152,7 @@ enum UpgradeType CPP_11(: Int) NUM_UPGRADE_TYPES }; -extern const char *TheUpgradeTypeNames[]; //Change above, change this! +extern const char *const TheUpgradeTypeNames[]; //Change above, change this! //------------------------------------------------------------------------------------------------- /** A single upgrade template definition */ diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h index 91d4a2985d2..b8346c589fc 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h @@ -56,7 +56,7 @@ enum Anim2DMode CPP_11(: Int) }; #ifdef DEFINE_ANIM_2D_MODE_NAMES -static const char *Anim2DModeNames[] = +static const char *const Anim2DModeNames[] = { "NONE", "ONCE", @@ -67,6 +67,7 @@ static const char *Anim2DModeNames[] = "PING_PONG_BACKWARDS", NULL }; +static_assert(ARRAY_SIZE(Anim2DModeNames) == ANIM_2D_NUM_MODES + 1, "Incorrect array size"); #endif // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h index dbc8dc48b1d..077d845ab02 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h @@ -102,12 +102,10 @@ enum CommandOption CPP_11(: Int) USES_MINE_CLEARING_WEAPONSET= 0x00200000, // uses the special mine-clearing weaponset, even if not current CAN_USE_WAYPOINTS = 0x00400000, // button has option to use a waypoint path MUST_BE_STOPPED = 0x00800000, // Unit must be stopped in order to be able to use button. - - NUM_COMMAND_OPTIONS }; #ifdef DEFINE_COMMAND_OPTION_NAMES -static const char *TheCommandOptionNames[] = +static const char *const TheCommandOptionNames[] = { "NEED_TARGET_ENEMY_OBJECT", "NEED_TARGET_NEUTRAL_OBJECT", @@ -222,7 +220,7 @@ enum GUICommandType CPP_11(: Int) }; #ifdef DEFINE_GUI_COMMMAND_NAMES -static const char *TheGuiCommandNames[] = +static const char *const TheGuiCommandNames[] = { "NONE", "DOZER_CONSTRUCT", @@ -268,6 +266,7 @@ static const char *TheGuiCommandNames[] = NULL }; +static_assert(ARRAY_SIZE(TheGuiCommandNames) == GUI_COMMAND_NUM_COMMANDS + 1, "Incorrect array size"); #endif // end DEFINE_GUI_COMMAND_NAMES enum CommandButtonMappedBorderType CPP_11(: Int) @@ -291,6 +290,7 @@ static const LookupListRec CommandButtonMappedBorderTypeNames[] = { NULL, 0 } }; +static_assert(ARRAY_SIZE(CommandButtonMappedBorderTypeNames) == COMMAND_BUTTON_BORDER_COUNT + 1, "Incorrect array size"); //------------------------------------------------------------------------------------------------- /** Command buttons are used to load the buttons we place on throughout the command bar * interface in different context sensitive windows depending on the situation and diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Credits.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Credits.h index 2c1524bdbf0..45c29712031 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Credits.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Credits.h @@ -83,9 +83,10 @@ static const LookupListRec CreditStyleNames[] = { "MINORTITLE", CREDIT_STYLE_POSITION }, { "NORMAL", CREDIT_STYLE_NORMAL }, { "COLUMN", CREDIT_STYLE_COLUMN }, - + // CREDIT_STYLE_BLANK { NULL, 0 } }; +static_assert(ARRAY_SIZE(CreditStyleNames) == MAX_CREDIT_STYLES, "Incorrect array size"); class CreditsLine diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/DisconnectMenu.h b/GeneralsMD/Code/GameEngine/Include/GameClient/DisconnectMenu.h index bf120b7cd78..3578157169a 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/DisconnectMenu.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/DisconnectMenu.h @@ -69,13 +69,13 @@ class DisconnectMenu { DisconnectManager *m_disconnectManager; ///< For retrieving status updates from the disconnect manager. DisconnectMenuStateType m_menuState; ///< The current state of the menu screen. - static const char *m_playerNameTextControlNames[MAX_SLOTS]; ///< names of the player name controls in the window. - static const char *m_playerTimeoutTextControlNames[MAX_SLOTS]; ///< names of the timeout controls in the window. - static const char *m_playerVoteButtonControlNames[MAX_SLOTS]; ///< names of the vote button controls in the window. - static const char *m_playerVoteCountControlNames[MAX_SLOTS]; ///< names of the vote count static text controls in the window. - static const char *m_packetRouterTimeoutControlName; ///< name of the packet router timeout control window. - static const char *m_packetRouterTimeoutLabelControlName; ///< name of the packet router timeout label control window. - static const char *m_textDisplayControlName; ///< name of the text display listbox control window. + static const char *const m_playerNameTextControlNames[MAX_SLOTS]; ///< names of the player name controls in the window. + static const char *const m_playerTimeoutTextControlNames[MAX_SLOTS]; ///< names of the timeout controls in the window. + static const char *const m_playerVoteButtonControlNames[MAX_SLOTS]; ///< names of the vote button controls in the window. + static const char *const m_playerVoteCountControlNames[MAX_SLOTS]; ///< names of the vote count static text controls in the window. + static const char *const m_packetRouterTimeoutControlName; ///< name of the packet router timeout control window. + static const char *const m_packetRouterTimeoutLabelControlName; ///< name of the packet router timeout label control window. + static const char *const m_textDisplayControlName; ///< name of the text display listbox control window. }; extern DisconnectMenu *TheDisconnectMenu; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h index 5f17f3ebc60..428868e900f 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h @@ -82,9 +82,8 @@ enum DrawableIconType CPP_11(: Int) /** NOTE: This enum MUST appear in the same order as TheDrawableIconNames array to be * indexed correctly using that array */ ICON_INVALID = -1, - ICON_FIRST = 0, - ICON_DEFAULT_HEAL = ICON_FIRST, + ICON_DEFAULT_HEAL, ICON_STRUCTURE_HEAL, ICON_VEHICLE_HEAL, #ifdef ALLOW_DEMORALIZE @@ -103,7 +102,8 @@ enum DrawableIconType CPP_11(: Int) ICON_ENTHUSIASTIC_SUBLIMINAL, ICON_CARBOMB, - MAX_ICONS + MAX_ICONS, + ICON_FIRST = 0, }; //----------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/EstablishConnectionsMenu.h b/GeneralsMD/Code/GameEngine/Include/GameClient/EstablishConnectionsMenu.h index 8a18a6adf37..2ef62d5d95c 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/EstablishConnectionsMenu.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/EstablishConnectionsMenu.h @@ -47,9 +47,9 @@ class EstablishConnectionsMenu { protected: EstablishConnectionsMenuStateType m_menuState; - static const char *m_playerReadyControlNames[MAX_SLOTS]; - static const char *m_playerNameControlNames[MAX_SLOTS]; - static const char *m_playerStatusControlNames[MAX_SLOTS]; + static const char *const m_playerReadyControlNames[MAX_SLOTS]; + static const char *const m_playerNameControlNames[MAX_SLOTS]; + static const char *const m_playerStatusControlNames[MAX_SLOTS]; }; extern EstablishConnectionsMenu *TheEstablishConnectionsMenu; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Eva.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Eva.h index 785ba049788..5878cf86b58 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Eva.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Eva.h @@ -42,8 +42,7 @@ enum EvaMessage CPP_11(: Int) { EVA_Invalid = -1, - EVA_FIRST = 0, - EVA_LowPower = EVA_FIRST, + EVA_LowPower, EVA_InsufficientFunds, EVA_SuperweaponDetected_Own_ParticleCannon, EVA_SuperweaponDetected_Own_Nuke, @@ -98,9 +97,10 @@ enum EvaMessage CPP_11(: Int) EVA_SuperweaponLaunched_Enemy_Sneak_Attack, EVA_COUNT, + EVA_FIRST = 0, }; -extern const char *TheEvaMessageNames[]; +extern const char *const TheEvaMessageNames[]; //------------------------------------------------------------------------------------ EvaCheckInfo struct EvaSideSounds diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindow.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindow.h index 5cf628a9bd6..0c49d5ba71b 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindow.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindow.h @@ -502,8 +502,8 @@ extern void GameWinDefaultTooltip( GameWindow *window, WinInstanceData *instData, UnsignedInt mouse ); -extern const char *WindowStatusNames[]; -extern const char *WindowStyleNames[]; +extern const char *const WindowStatusNames[]; +extern const char *const WindowStyleNames[]; #endif // __GAMEWINDOW_H_ diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowTransitions.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowTransitions.h index 9987eafc50f..8fb89c4e15c 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowTransitions.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowTransitions.h @@ -48,6 +48,8 @@ #ifndef __GAME_WINDOW_TRANSITIONS_H_ #define __GAME_WINDOW_TRANSITIONS_H_ +#include "Common/GameCommon.h" + //----------------------------------------------------------------------------- // SYSTEM INCLUDES //////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- @@ -106,6 +108,7 @@ static const LookupListRec TransitionStyleNames[] = { "REVERSESOUND", REVERSE_SOUND_TRANSITION }, { NULL, 0 } }; +static_assert(ARRAY_SIZE(TransitionStyleNames) == MAX_TRANSITION_WINDOW_STYLES + 1, "Incorrect array size"); // base class for the transitions // inherit off of this adding in all the values diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Image.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Image.h index 148362dca40..274ff1944a5 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Image.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Image.h @@ -52,7 +52,7 @@ typedef enum } ImageStatus; #ifdef DEFINE_IMAGE_STATUS_NAMES -static const char *imageStatusNames[] = +static const char *const imageStatusNames[] = { "ROTATED_90_CLOCKWISE", "RAW_TEXTURE", diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h index 70dc784e80f..631f371fc56 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h @@ -108,7 +108,7 @@ enum RadiusCursorType CPP_11(: Int) }; #ifdef DEFINE_RADIUSCURSOR_NAMES -static const char *TheRadiusCursorNames[] = +static const char *const TheRadiusCursorNames[] = { "NONE", "ATTACK_DAMAGE_AREA", @@ -147,6 +147,7 @@ static const char *TheRadiusCursorNames[] = NULL }; +static_assert(ARRAY_SIZE(TheRadiusCursorNames) == RADIUSCURSOR_COUNT + 1, "Incorrect array size"); #endif // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h b/GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h index 227b3d2471a..562d8faafb9 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h @@ -269,7 +269,9 @@ enum MappableKeyTransition CPP_11(: Int) { DOWN, UP, - DOUBLEDOWN // if a key transition is repeated immediately, we generate this. + DOUBLEDOWN, // if a key transition is repeated immediately, we generate this. + + MAPPABLE_KEY_TRANSITION_COUNT }; static const LookupListRec TransitionNames[] = @@ -279,6 +281,7 @@ static const LookupListRec TransitionNames[] = { "DOUBLEDOWN", DOUBLEDOWN }, { NULL, 0 } }; +static_assert(ARRAY_SIZE(TransitionNames) == MAPPABLE_KEY_TRANSITION_COUNT + 1, "Incorrect array size"); // ------------------------------------------------------------------------------- // an easier-to-type subset of the KEY_STATE stuff. @@ -322,7 +325,7 @@ enum CommandUsableInType CPP_11(: Int) COMMANDUSABLE_EVERYWHERE = ~0, }; -static const char* TheCommandUsableInNames[] = +static const char* const TheCommandUsableInNames[] = { "SHELL", "GAME", diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h index 62c808aa149..9b56bff6ff3 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h @@ -107,8 +107,8 @@ enum ParticlePriorityType CPP_11(: Int) CRITICAL, ///< super special top priority like a superweapon ALWAYS_RENDER, ///< used for logically important display (not just fluff), so must never be culled, regardless of particle cap, lod, etc // !!! *Noting* goes here ... special is the top priority !!! - PARTICLE_PRIORITY_HIGHEST = ALWAYS_RENDER, - NUM_PARTICLE_PRIORITIES + NUM_PARTICLE_PRIORITIES, + PARTICLE_PRIORITY_HIGHEST = NUM_PARTICLE_PRIORITIES - 1, }; /** @@ -244,46 +244,6 @@ class Particle : public MemoryPoolObject, }; - -//-------------------------------------------------------------------------------------------------------------- - -#ifdef DEFINE_PARTICLE_SYSTEM_NAMES - -/**** NOTE: These MUST be kept in sync with the enumerations below *****/ - -static const char *ParticleShaderTypeNames[] = -{ - "NONE", "ADDITIVE", "ALPHA", "ALPHA_TEST", "MULTIPLY", NULL -}; - -static const char *ParticleTypeNames[] = -{ - "NONE", "PARTICLE", "DRAWABLE", "STREAK", "VOLUME_PARTICLE","SMUDGE", NULL -}; - -static const char *EmissionVelocityTypeNames[] = -{ - "NONE", "ORTHO", "SPHERICAL", "HEMISPHERICAL", "CYLINDRICAL", "OUTWARD", NULL -}; - -static const char *EmissionVolumeTypeNames[] = -{ - "NONE", "POINT", "LINE", "BOX", "SPHERE", "CYLINDER", NULL -}; - -//"NONE", "FLUFF", "DEBRIS", "NATURE", "WEAPON", "DAMAGE", "SPECIAL" -static const char *ParticlePriorityNames[] = -{ - "NONE", "WEAPON_EXPLOSION","SCORCHMARK","DUST_TRAIL","BUILDUP","DEBRIS_TRAIL","UNIT_DAMAGE_FX","DEATH_EXPLOSION","SEMI_CONSTANT","CONSTANT","WEAPON_TRAIL","AREA_EFFECT","CRITICAL", "ALWAYS_RENDER", NULL -}; - -static const char *WindMotionNames[] = -{ - "NONE", "Unused", "PingPong", "Circular", NULL -}; - -#endif - /** * All of the properties of a particle system, used by both ParticleSystemTemplates * and ParticleSystem classes. @@ -304,13 +264,15 @@ class ParticleSystemInfo : public Snapshot enum ParticleShaderType { - INVALID_SHADER=0, ADDITIVE, ALPHA, ALPHA_TEST, MULTIPLY + INVALID_SHADER=0, ADDITIVE, ALPHA, ALPHA_TEST, MULTIPLY, + PARTICLE_SHADER_TYPE_COUNT } m_shaderType; ///< how this particle is rendered enum ParticleType { - INVALID_TYPE=0, PARTICLE, DRAWABLE, STREAK, VOLUME_PARTICLE, SMUDGE ///< is a particle a 2D-screen-facing particle, or a Drawable, or a Segment in a streak? + INVALID_TYPE=0, PARTICLE, DRAWABLE, STREAK, VOLUME_PARTICLE, SMUDGE, ///< is a particle a 2D-screen-facing particle, or a Drawable, or a Segment in a streak? + PARTICLE_TYPE_COUNT } m_particleType; @@ -366,7 +328,8 @@ class ParticleSystemInfo : public Snapshot // The direction and speed at which particles are emitted enum EmissionVelocityType { - INVALID_VELOCITY=0, ORTHO, SPHERICAL, HEMISPHERICAL, CYLINDRICAL, OUTWARD + INVALID_VELOCITY=0, ORTHO, SPHERICAL, HEMISPHERICAL, CYLINDRICAL, OUTWARD, + EMISSION_VELOCITY_TYPE_COUNT } m_emissionVelocityType; @@ -409,7 +372,8 @@ class ParticleSystemInfo : public Snapshot // Note that the volume is relative to the system's position and orientation enum EmissionVolumeType { - INVALID_VOLUME=0, POINT, LINE, BOX, SPHERE, CYLINDER + INVALID_VOLUME=0, POINT, LINE, BOX, SPHERE, CYLINDER, + EMISSION_VOLUME_TYPE_COUNT } m_emissionVolumeType; ///< the type of volume where particles are created @@ -458,7 +422,9 @@ class ParticleSystemInfo : public Snapshot WIND_MOTION_INVALID = 0, WIND_MOTION_NOT_USED, WIND_MOTION_PING_PONG, - WIND_MOTION_CIRCULAR + WIND_MOTION_CIRCULAR, + + WIND_MOTION_COUNT }; WindMotion m_windMotion; ///< motion of the wind angle updating Real m_windAngle; ///< angle of the "wind" associated with this system @@ -475,6 +441,49 @@ class ParticleSystemInfo : public Snapshot }; +//-------------------------------------------------------------------------------------------------------------- + +#ifdef DEFINE_PARTICLE_SYSTEM_NAMES + +/**** NOTE: These MUST be kept in sync with the enumerations above *****/ + +static const char *const ParticleShaderTypeNames[] = +{ + "NONE", "ADDITIVE", "ALPHA", "ALPHA_TEST", "MULTIPLY", NULL +}; +static_assert(ARRAY_SIZE(ParticleShaderTypeNames) == ParticleSystemInfo::PARTICLE_SHADER_TYPE_COUNT + 1, "Incorrect array size"); + +static const char *const ParticleTypeNames[] = +{ + "NONE", "PARTICLE", "DRAWABLE", "STREAK", "VOLUME_PARTICLE","SMUDGE", NULL +}; +static_assert(ARRAY_SIZE(ParticleTypeNames) == ParticleSystemInfo::PARTICLE_TYPE_COUNT + 1, "Incorrect array size"); + +static const char *const EmissionVelocityTypeNames[] = +{ + "NONE", "ORTHO", "SPHERICAL", "HEMISPHERICAL", "CYLINDRICAL", "OUTWARD", NULL +}; +static_assert(ARRAY_SIZE(EmissionVelocityTypeNames) == ParticleSystemInfo::EMISSION_VELOCITY_TYPE_COUNT + 1, "Incorrect array size"); + +static const char *const EmissionVolumeTypeNames[] = +{ + "NONE", "POINT", "LINE", "BOX", "SPHERE", "CYLINDER", NULL +}; +static_assert(ARRAY_SIZE(EmissionVolumeTypeNames) == ParticleSystemInfo::EMISSION_VOLUME_TYPE_COUNT + 1, "Incorrect array size"); + +static const char *const ParticlePriorityNames[] = +{ + "NONE", "WEAPON_EXPLOSION","SCORCHMARK","DUST_TRAIL","BUILDUP","DEBRIS_TRAIL","UNIT_DAMAGE_FX","DEATH_EXPLOSION","SEMI_CONSTANT","CONSTANT","WEAPON_TRAIL","AREA_EFFECT","CRITICAL", "ALWAYS_RENDER", NULL +}; +static_assert(ARRAY_SIZE(ParticlePriorityNames) == NUM_PARTICLE_PRIORITIES + 1, "Incorrect array size"); + +static const char *const WindMotionNames[] = +{ + "NONE", "Unused", "PingPong", "Circular", NULL +}; +static_assert(ARRAY_SIZE(WindMotionNames) == ParticleSystemInfo::WIND_MOTION_COUNT + 1, "Incorrect array size"); + +#endif /** * A ParticleSystemTemplate, used by the ParticleSystemManager to instantiate ParticleSystems. diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Shadow.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Shadow.h index e3d70169602..f9b728a8277 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Shadow.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Shadow.h @@ -50,7 +50,7 @@ enum ShadowType CPP_11(: Int) SHADOW_ADDITIVE_DECAL = 0x00000040 //not really for shadows but for other decal uses. Additive blended. }; #ifdef DEFINE_SHADOW_NAMES -static const char* TheShadowNames[] = +static const char* const TheShadowNames[] = { "SHADOW_DECAL", "SHADOW_VOLUME", diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ShellHooks.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ShellHooks.h index b29f51cdd14..3741f421040 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ShellHooks.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ShellHooks.h @@ -80,7 +80,7 @@ enum SHELL_SCRIPT_HOOK_TOTAL }; -extern const char *TheShellHookNames[]; ///< Contains a list of the text representation of the shell hooks Used in WorldBuilder and in the shell. +extern const char *const TheShellHookNames[]; ///< Contains a list of the text representation of the shell hooks Used in WorldBuilder and in the shell. void SignalUIInteraction(Int interaction); #endif // SHELLHOOKS_H diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/TerrainVisual.h b/GeneralsMD/Code/GameEngine/Include/GameClient/TerrainVisual.h index 7ff72cf8879..63a47121f5f 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/TerrainVisual.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/TerrainVisual.h @@ -172,22 +172,22 @@ class DomeStyleSeismicFilter : public SeismicSimulationFilterBase //------------------------------------------------------------------------------------------------- typedef enum _TerrainLOD CPP_11(: Int) { - TERRAIN_LOD_INVALID = 0, - TERRAIN_LOD_MIN = 1, // note that this is less than max - TERRAIN_LOD_STRETCH_NO_CLOUDS = 2, - TERRAIN_LOD_HALF_CLOUDS = 3, - TERRAIN_LOD_NO_CLOUDS = 4, - TERRAIN_LOD_STRETCH_CLOUDS = 5, - TERRAIN_LOD_NO_WATER = 6, - TERRAIN_LOD_MAX = 7, // note that this is larger than min - TERRAIN_LOD_AUTOMATIC = 8, - TERRAIN_LOD_DISABLE = 9, + TERRAIN_LOD_INVALID, + TERRAIN_LOD_MIN, // note that this is less than max + TERRAIN_LOD_STRETCH_NO_CLOUDS, + TERRAIN_LOD_HALF_CLOUDS, + TERRAIN_LOD_NO_CLOUDS, + TERRAIN_LOD_STRETCH_CLOUDS, + TERRAIN_LOD_NO_WATER, + TERRAIN_LOD_MAX, // note that this is larger than min + TERRAIN_LOD_AUTOMATIC, + TERRAIN_LOD_DISABLE, TERRAIN_LOD_NUM_TYPES } TerrainLOD; #ifdef DEFINE_TERRAIN_LOD_NAMES -static const char * TerrainLODNames[] = +static const char *const TerrainLODNames[] = { "NONE", "MIN", @@ -202,6 +202,7 @@ static const char * TerrainLODNames[] = NULL }; +static_assert(ARRAY_SIZE(TerrainLODNames) == TERRAIN_LOD_NUM_TYPES + 1, "Incorrect array size"); #endif // end DEFINE_TERRAIN_LOD_NAMES //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h index 056ff903820..fb2b226ea9e 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h @@ -337,7 +337,7 @@ enum CommandSourceType CPP_11(: Int); typedef UnsignedInt CommandSourceMask; #ifdef DEFINE_COMMANDSOURCEMASK_NAMES -static const char *TheCommandSourceMaskNames[] = +static const char *const TheCommandSourceMaskNames[] = { "FROM_PLAYER", "FROM_SCRIPT", @@ -347,6 +347,7 @@ static const char *TheCommandSourceMaskNames[] = NULL }; +static_assert(ARRAY_SIZE(TheCommandSourceMaskNames) == COMMAND_SOURCE_TYPE_COUNT + 1, "Incorrect array size"); #endif //------------------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Damage.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Damage.h index f43f184fc8f..77b5b80068c 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Damage.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Damage.h @@ -199,7 +199,7 @@ enum DeathType CPP_11(: Int) }; #ifdef DEFINE_DEATH_NAMES -static const char *TheDeathNames[] = +static const char *const TheDeathNames[] = { "NORMAL", "NONE", @@ -225,6 +225,7 @@ static const char *TheDeathNames[] = NULL }; +static_assert(ARRAY_SIZE(TheDeathNames) == DEATH_NUM_TYPES + 1, "Incorrect array size"); #endif // end DEFINE_DEATH_NAMES diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Locomotor.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Locomotor.h index 1d7faaffa94..3d605bfd95e 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Locomotor.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Locomotor.h @@ -61,18 +61,22 @@ enum LocomotorAppearance CPP_11(: Int) LOCO_WINGS, LOCO_CLIMBER, // human climber - backs down cliffs. LOCO_OTHER, - LOCO_MOTORCYCLE + LOCO_MOTORCYCLE, + + LOCOMOTOR_APPEARANCE_COUNT }; enum LocomotorPriority CPP_11(: Int) { - LOCO_MOVES_BACK=0, // In a group, this one moves toward the back - LOCO_MOVES_MIDDLE=1, // In a group, this one stays in the middle - LOCO_MOVES_FRONT=2 // In a group, this one moves toward the front of the group + LOCO_MOVES_BACK, // In a group, this one moves toward the back + LOCO_MOVES_MIDDLE, // In a group, this one stays in the middle + LOCO_MOVES_FRONT, // In a group, this one moves toward the front of the group + + LOCOMOTOR_PRIORITY_COUNT }; #ifdef DEFINE_LOCO_APPEARANCE_NAMES -static const char *TheLocomotorAppearanceNames[] = +static const char *const TheLocomotorAppearanceNames[] = { "TWO_LEGS", "FOUR_WHEELS", @@ -86,6 +90,7 @@ static const char *TheLocomotorAppearanceNames[] = NULL }; +static_assert(ARRAY_SIZE(TheLocomotorAppearanceNames) == LOCOMOTOR_APPEARANCE_COUNT + 1, "Array size"); #endif //------------------------------------------------------------------------------------------------- @@ -98,11 +103,13 @@ enum LocomotorBehaviorZ CPP_11(: Int) Z_FIXED_SURFACE_RELATIVE_HEIGHT, // stays fixed at surface-rel height, regardless of physics Z_FIXED_ABSOLUTE_HEIGHT, // stays fixed at absolute height, regardless of physics Z_RELATIVE_TO_GROUND_AND_BUILDINGS, // stays fixed at surface-rel height including buildings, regardless of physics - Z_SMOOTH_RELATIVE_TO_HIGHEST_LAYER // try to follow a height relative to the highest layer. + Z_SMOOTH_RELATIVE_TO_HIGHEST_LAYER, // try to follow a height relative to the highest layer. + + LOCOMOTOR_BEHAVIOR_Z_COUNT }; #ifdef DEFINE_LOCO_Z_NAMES -static const char *TheLocomotorBehaviorZNames[] = +static const char *const TheLocomotorBehaviorZNames[] = { "NO_Z_MOTIVE_FORCE", "SEA_LEVEL", @@ -115,6 +122,7 @@ static const char *TheLocomotorBehaviorZNames[] = NULL }; +static_assert(ARRAY_SIZE(TheLocomotorBehaviorZNames) == LOCOMOTOR_BEHAVIOR_Z_COUNT + 1, "Array size"); #endif //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/LocomotorSet.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/LocomotorSet.h index 4c4a21b588d..bbf84cc4ca1 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/LocomotorSet.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/LocomotorSet.h @@ -61,7 +61,7 @@ const LocomotorSurfaceTypeMask NO_SURFACES = (LocomotorSurfaceTypeMask)0x0000; const LocomotorSurfaceTypeMask ALL_SURFACES = (LocomotorSurfaceTypeMask)0xffff; #ifdef DEFINE_SURFACECATEGORY_NAMES -static const char *TheLocomotorSurfaceTypeNames[] = +static const char *const TheLocomotorSurfaceTypeNames[] = { "GROUND", "WATER", diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h index cf8b812e5ef..1c04e27d68a 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h @@ -97,7 +97,7 @@ enum GuardTargetType CPP_11(: Int) }; #ifdef DEFINE_LOCOMOTORSET_NAMES -static const char *TheLocomotorSetNames[] = +static const char *const TheLocomotorSetNames[] = { "SET_NORMAL", "SET_NORMAL_UPGRADED", @@ -110,6 +110,7 @@ static const char *TheLocomotorSetNames[] = NULL }; +static_assert(ARRAY_SIZE(TheLocomotorSetNames) == LOCOMOTORSET_COUNT + 1, "Incorrect array size"); #endif enum AutoAcquireStates CPP_11(: Int) @@ -122,7 +123,7 @@ enum AutoAcquireStates CPP_11(: Int) }; #ifdef DEFINE_AUTOACQUIRE_NAMES -static const char *TheAutoAcquireEnemiesNames[] = +static const char *const TheAutoAcquireEnemiesNames[] = { "YES", "STEALTHED", diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BodyModule.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BodyModule.h index d6b80eff8a0..3750d63889c 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BodyModule.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BodyModule.h @@ -61,7 +61,7 @@ enum BodyDamageType CPP_11(: Int) }; #ifdef DEFINE_BODYDAMAGETYPE_NAMES -static const char* TheBodyDamageTypeNames[] = +static const char* const TheBodyDamageTypeNames[] = { "PRISTINE", "DAMAGED", @@ -70,6 +70,7 @@ static const char* TheBodyDamageTypeNames[] = NULL }; +static_assert(ARRAY_SIZE(TheBodyDamageTypeNames) == BODYDAMAGETYPE_COUNT + 1, "Incorrect array size"); #endif enum MaxHealthChangeType CPP_11(: Int) @@ -78,10 +79,12 @@ enum MaxHealthChangeType CPP_11(: Int) PRESERVE_RATIO, ADD_CURRENT_HEALTH_TOO, FULLY_HEAL, + + MAX_HEALTH_CHANGE_COUNT }; #ifdef DEFINE_MAXHEALTHCHANGETYPE_NAMES -static const char* TheMaxHealthChangeTypeNames[] = +static const char* const TheMaxHealthChangeTypeNames[] = { "SAME_CURRENTHEALTH", "PRESERVE_RATIO", @@ -89,6 +92,7 @@ static const char* TheMaxHealthChangeTypeNames[] = "FULLY_HEAL", NULL }; +static_assert(ARRAY_SIZE(TheMaxHealthChangeTypeNames) == MAX_HEALTH_CHANGE_COUNT + 1, "Incorrect array size"); #endif diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h index f7fd288321b..1ae1566a269 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h @@ -71,12 +71,13 @@ class DozerPrimaryStateMachine : public StateMachine enum DozerTask CPP_11(: Int) // These enums are saved in the game save file, so DO NOT renumber them. jba. { DOZER_TASK_INVALID = -1, - DOZER_TASK_FIRST = 0, - DOZER_TASK_BUILD = DOZER_TASK_FIRST, ///< go build something - DOZER_TASK_REPAIR = 1, ///< go repair something - DOZER_TASK_FORTIFY = 2, ///< go fortify something - DOZER_NUM_TASKS + DOZER_TASK_BUILD, ///< go build something + DOZER_TASK_REPAIR, ///< go repair something + DOZER_TASK_FORTIFY, ///< go fortify something + + DOZER_NUM_TASKS, // keep this last + DOZER_TASK_FIRST = 0, }; // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HordeUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HordeUpdate.h index ccf98e68f1b..5ac02b4752d 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HordeUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HordeUpdate.h @@ -52,11 +52,12 @@ enum HordeActionType CPP_11(: Int) }; #ifdef DEFINE_HORDEACTION_NAMES -static const char *TheHordeActionTypeNames[] = +static const char *const TheHordeActionTypeNames[] = { "HORDE", NULL }; +static_assert(ARRAY_SIZE(TheHordeActionTypeNames) == HORDEACTION_COUNT + 1, "Incorrect array size"); #endif //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OCLSpecialPower.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OCLSpecialPower.h index 8ac9672ee5a..710d54d192a 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OCLSpecialPower.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OCLSpecialPower.h @@ -47,6 +47,8 @@ enum OCLCreateLocType CPP_11(: Int) USE_OWNER_OBJECT, CREATE_ABOVE_LOCATION, CREATE_AT_EDGE_FARTHEST_FROM_TARGET, + + OCL_CREATE_LOC_COUNT }; //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h index 4ea28436605..12f7952dcee 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h @@ -58,7 +58,7 @@ enum SlowDeathPhaseType CPP_11(: Int) }; #ifdef DEFINE_SLOWDEATHPHASE_NAMES -static const char *TheSlowDeathPhaseNames[] = +static const char *const TheSlowDeathPhaseNames[] = { "INITIAL", "MIDPOINT", @@ -66,6 +66,7 @@ static const char *TheSlowDeathPhaseNames[] = NULL }; +static_assert(ARRAY_SIZE(TheSlowDeathPhaseNames) == SD_PHASE_COUNT + 1, "Incorrect array size"); #endif diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpectreGunshipDeploymentUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpectreGunshipDeploymentUpdate.h index 5b377cfeada..c192cef5efa 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpectreGunshipDeploymentUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpectreGunshipDeploymentUpdate.h @@ -55,6 +55,8 @@ enum GunshipCreateLocType CPP_11(: Int) CREATE_GUNSHIP_AT_EDGE_FARTHEST_FROM_SOURCE, CREATE_GUNSHIP_AT_EDGE_NEAR_TARGET, CREATE_GUNSHIP_AT_EDGE_FARTHEST_FROM_TARGET, + + GUNSHIP_CREATE_LOC_COUNT }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StealthUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StealthUpdate.h index d35b94b58e8..dff2b95de6a 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StealthUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StealthUpdate.h @@ -51,12 +51,13 @@ enum STEALTH_NOT_WHILE_FIRING_TERTIARY = 0x00000020, STEALTH_ONLY_WITH_BLACK_MARKET = 0x00000040, STEALTH_NOT_WHILE_TAKING_DAMAGE = 0x00000080, - STEALTH_NOT_WHILE_FIRING_WEAPON = (STEALTH_NOT_WHILE_FIRING_PRIMARY | STEALTH_NOT_WHILE_FIRING_SECONDARY | STEALTH_NOT_WHILE_FIRING_TERTIARY), STEALTH_NOT_WHILE_RIDERS_ATTACKING = 0x00000100, + + STEALTH_NOT_WHILE_FIRING_WEAPON = (STEALTH_NOT_WHILE_FIRING_PRIMARY | STEALTH_NOT_WHILE_FIRING_SECONDARY | STEALTH_NOT_WHILE_FIRING_TERTIARY), }; #ifdef DEFINE_STEALTHLEVEL_NAMES -static const char *TheStealthLevelNames[] = +static const char *const TheStealthLevelNames[] = { "ATTACKING", "MOVING", diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h index 1155b5f2d48..000a93eec38 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h @@ -73,7 +73,7 @@ enum StructureTopplePhaseType CPP_11(: Int) ST_PHASE_COUNT }; -static const char *TheStructureTopplePhaseNames[] = +static const char *const TheStructureTopplePhaseNames[] = { "INITIAL", "DELAY", @@ -81,6 +81,7 @@ static const char *TheStructureTopplePhaseNames[] = NULL }; +static_assert(ARRAY_SIZE(TheStructureTopplePhaseNames) == ST_PHASE_COUNT + 1, "Incorrect array size"); //------------------------------------------------------------------------------------------------- class StructureToppleUpdateModuleData : public UpdateModuleData diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Powers.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Powers.h index 1b9e4eb1430..9b0d00b64d1 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Powers.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Powers.h @@ -48,7 +48,7 @@ enum }; #ifdef DEFINE_POWER_NAMES -static const char *PowerNames[] = +static const char *const PowerNames[] = { "NONE", "FASTER", @@ -56,6 +56,7 @@ static const char *PowerNames[] = "SELF_HEALING", NULL }; +static_assert(ARRAY_SIZE(PowerNames) == POWERS_NUM_POWERS + 1, "Incorrect array size"); #endif // end DEFINE_POWER_NAMES #endif // __POWERS_H_ diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Scripts.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Scripts.h index 8c569e7f085..6800bbf5f31 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Scripts.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Scripts.h @@ -842,7 +842,7 @@ class Parameter : public MemoryPoolObject }; EMPTY_DTOR(Parameter) -extern const char* TheObjectFlagsNames[]; +extern const char* const TheObjectFlagsNames[]; //------------------------------------------------------------------------------------------------- // ******************************** class Condition *********************************************** diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h index 88b19bfc93f..3435cb95e1b 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h @@ -60,17 +60,20 @@ enum WeaponReloadType CPP_11(: Int) { AUTO_RELOAD, NO_RELOAD, - RETURN_TO_BASE_TO_RELOAD + RETURN_TO_BASE_TO_RELOAD, + + WEAPON_RELOAD_COUNT }; #ifdef DEFINE_WEAPONRELOAD_NAMES -static const char *TheWeaponReloadNames[] = +static const char *const TheWeaponReloadNames[] = { "YES", "NO", "RETURN_TO_BASE", NULL }; +static_assert(ARRAY_SIZE(TheWeaponReloadNames) == WEAPON_RELOAD_COUNT + 1, "Incorrect array size"); #endif //------------------------------------------------------------------------------------------------- @@ -84,13 +87,14 @@ enum WeaponPrefireType CPP_11(: Int) }; #ifdef DEFINE_WEAPONPREFIRE_NAMES -static const char *TheWeaponPrefireNames[] = +static const char *const TheWeaponPrefireNames[] = { "PER_SHOT", "PER_ATTACK", "PER_CLIP", NULL }; +static_assert(ARRAY_SIZE(TheWeaponPrefireNames) == PREFIRE_COUNT + 1, "Incorrect array size"); #endif //------------------------------------------------------------------------------------------------- @@ -119,7 +123,7 @@ enum WeaponAffectsMaskType CPP_11(: Int) }; //#ifdef DEFINE_WEAPONAFFECTSMASK_NAMES ; Removed protection so other clases can use these strings... not sure why this was protected in the 1st place -static const char *TheWeaponAffectsMaskNames[] = +static const char *const TheWeaponAffectsMaskNames[] = { "SELF", "ALLIES", @@ -149,7 +153,7 @@ enum WeaponCollideMaskType CPP_11(: Int) }; #ifdef DEFINE_WEAPONCOLLIDEMASK_NAMES -static const char *TheWeaponCollideMaskNames[] = +static const char *const TheWeaponCollideMaskNames[] = { "ALLIES", "ENEMIES", @@ -209,7 +213,7 @@ enum WeaponBonusConditionType CPP_11(: Int) WEAPONBONUSCONDITION_COUNT }; #ifdef DEFINE_WEAPONBONUSCONDITION_NAMES -static const char *TheWeaponBonusNames[] = +static const char *const TheWeaponBonusNames[] = { // This is a RHS enum (weapon.ini will have WeaponBonus = IT) so it is all caps "GARRISONED", @@ -246,6 +250,7 @@ static const char *TheWeaponBonusNames[] = NULL }; +static_assert(ARRAY_SIZE(TheWeaponBonusNames) == WEAPONBONUSCONDITION_COUNT + 1, "Incorrect array size"); #endif // For WeaponBonusConditionFlags @@ -291,7 +296,7 @@ class WeaponBonus }; #ifdef DEFINE_WEAPONBONUSFIELD_NAMES -static const char *TheWeaponBonusFieldNames[] = +static const char *const TheWeaponBonusFieldNames[] = { "DAMAGE", "RADIUS", @@ -300,6 +305,7 @@ static const char *TheWeaponBonusFieldNames[] = "PRE_ATTACK", NULL }; +static_assert(ARRAY_SIZE(TheWeaponBonusFieldNames) == WeaponBonus::FIELD_COUNT + 1, "Incorrect array size"); #endif diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/WeaponSet.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/WeaponSet.h index eec67045ce3..352fd205449 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/WeaponSet.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/WeaponSet.h @@ -54,7 +54,7 @@ enum DamageType CPP_11(: Int); #include "GameLogic/WeaponSetFlags.h" #ifdef DEFINE_WEAPONSLOTTYPE_NAMES -static const char *TheWeaponSlotTypeNames[] = +static const char *const TheWeaponSlotTypeNames[] = { "PRIMARY", "SECONDARY", @@ -62,6 +62,7 @@ static const char *TheWeaponSlotTypeNames[] = NULL }; +static_assert(ARRAY_SIZE(TheWeaponSlotTypeNames) == WEAPONSLOT_COUNT + 1, "Incorrect array size"); static const LookupListRec TheWeaponSlotTypeNamesLookupList[] = { @@ -71,6 +72,7 @@ static const LookupListRec TheWeaponSlotTypeNamesLookupList[] = { NULL, 0 } }; +static_assert(ARRAY_SIZE(TheWeaponSlotTypeNamesLookupList) == WEAPONSLOT_COUNT + 1, "Incorrect array size"); #endif diff --git a/GeneralsMD/Code/GameEngine/Source/Common/BitFlags.cpp b/GeneralsMD/Code/GameEngine/Source/Common/BitFlags.cpp index b5ec7c8f46e..8fb0da908e3 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/BitFlags.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/BitFlags.cpp @@ -38,7 +38,7 @@ #include "GameLogic/ArmorSet.h" template<> -const char* ModelConditionFlags::s_bitNameList[] = +const char* const ModelConditionFlags::s_bitNameList[] = { "TOPPLED", "FRONTCRUSHED", @@ -174,9 +174,10 @@ const char* ModelConditionFlags::s_bitNameList[] = NULL }; +static_assert(ARRAY_SIZE(ModelConditionFlags::s_bitNameList) == ModelConditionFlags::NumBits + 1, "Incorrect array size"); template<> -const char* ArmorSetFlags::s_bitNameList[] = +const char* const ArmorSetFlags::s_bitNameList[] = { "VETERAN", "ELITE", @@ -189,4 +190,4 @@ const char* ArmorSetFlags::s_bitNameList[] = NULL }; - +static_assert(ARRAY_SIZE(ArmorSetFlags::s_bitNameList) == ArmorSetFlags::NumBits + 1, "Incorrect array size"); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp index 8805ce5e4ba..2ea3cb362a6 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp @@ -72,13 +72,14 @@ static const FieldParse TheStaticGameLODFieldParseTable[] = { "TextureReductionFactor", INI::parseInt, NULL, offsetof( StaticGameLODInfo, m_textureReduction ) }, }; -static const char *StaticGameLODNames[]= +static const char *const StaticGameLODNames[]= { "Low", "Medium", "High", "Custom" }; +static_assert(ARRAY_SIZE(StaticGameLODNames) == STATIC_GAME_LOD_COUNT, "Incorrect array size"); StaticGameLODInfo::StaticGameLODInfo(void) { @@ -117,13 +118,14 @@ static const FieldParse TheDynamicGameLODFieldParseTable[] = { "MinParticleSkipPriority", INI::parseIndexList, ParticlePriorityNames, offsetof( DynamicGameLODInfo, m_minDynamicParticleSkipPriority)}, }; -static const char *DynamicGameLODNames[]= +static const char *const DynamicGameLODNames[]= { "Low", "Medium", "High", "VeryHigh" }; +static_assert(ARRAY_SIZE(DynamicGameLODNames) == DYNAMIC_GAME_LOD_COUNT, "Incorrect array size"); DynamicGameLODInfo::DynamicGameLODInfo(void) { @@ -136,16 +138,18 @@ DynamicGameLODInfo::DynamicGameLODInfo(void) }; //Keep this in sync with enum in GameLOD.h -static const char *CPUNames[] = +static const char *const CPUNames[] = { "XX","P3", "P4","K7", NULL }; +static_assert(ARRAY_SIZE(CPUNames) == CPU_MAX + 1, "Incorrect array size"); //Keep this in sync with enum in GameLOD.h -static const char *VideoNames[] = +static const char *const VideoNames[] = { "XX","V2","V3","V4","V5","TNT","TNT2","GF2","R100","PS11","GF3","GF4","PS14","R200","PS20","R300", NULL }; +static_assert(ARRAY_SIZE(VideoNames) == DC_MAX + 1, "Incorrect array size"); void parseReallyLowMHz(INI* ini) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIWater.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIWater.cpp index ba248f8d58a..de0320d854a 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIWater.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIWater.cpp @@ -57,7 +57,7 @@ void INI::parseWaterSettingDefinition( INI* ini ) name.set( token ); // get the water setting we want to load based on name - const char **timeOfDayName = TimeOfDayNames; + const char *const *timeOfDayName = TimeOfDayNames; Int timeOfDayIndex = 0; // TIME_OF_DAY_INVALID while( timeOfDayName && *timeOfDayName ) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/AcademyStats.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/AcademyStats.cpp index 87f9ec98241..094e3b800db 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/AcademyStats.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/AcademyStats.cpp @@ -63,13 +63,14 @@ #include "GameLogic/Module/ContainModule.h" -const char *TheAcademyClassificationTypeNames[] = +const char *const TheAcademyClassificationTypeNames[] = { "ACT_NONE", "ACT_UPGRADE_RADAR", "ACT_SUPERPOWER", NULL }; +static_assert(ARRAY_SIZE(TheAcademyClassificationTypeNames) == ACT_COUNT + 1, "Incorrect array size"); #define FRAMES_BETWEEN_UPDATES 30 diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp index d6c845ffad4..03f7c017354 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp @@ -160,7 +160,7 @@ static void findClosestKindOf( Object *obj, void *userData ) AsciiString kindofMaskAsAsciiString(KindOfMaskType m) { AsciiString s; - const char** kindofNames = KindOfMaskType::getBitNames(); + const char* const* kindofNames = KindOfMaskType::getBitNames(); for (Int i=KINDOF_FIRST; i -const char* SpecialPowerMaskType::s_bitNameList[] = +const char* const SpecialPowerMaskType::s_bitNameList[] = { "SPECIAL_INVALID", @@ -131,6 +131,7 @@ const char* SpecialPowerMaskType::s_bitNameList[] = NULL }; +static_assert(ARRAY_SIZE(SpecialPowerMaskType::s_bitNameList) == SpecialPowerMaskType::NumBits + 1, "Incorrect array size"); //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/DisabledTypes.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/DisabledTypes.cpp index 56af9b84de9..643d3c06116 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/DisabledTypes.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/DisabledTypes.cpp @@ -31,7 +31,7 @@ #include "Common/BitFlagsIO.h" template<> -const char* DisabledMaskType::s_bitNameList[] = +const char* const DisabledMaskType::s_bitNameList[] = { "DEFAULT", "DISABLED_HACKED", @@ -51,6 +51,7 @@ const char* DisabledMaskType::s_bitNameList[] = NULL }; +static_assert(ARRAY_SIZE(DisabledMaskType::s_bitNameList) == DisabledMaskType::NumBits + 1, "Incorrect array size"); DisabledMaskType DISABLEDMASK_NONE; // inits to all zeroes DisabledMaskType DISABLEDMASK_ALL; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/GameCommon.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/GameCommon.cpp index db9914e0030..ad4ec11bc78 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/GameCommon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/GameCommon.cpp @@ -30,7 +30,7 @@ #include "Common/GameCommon.h" -const char *TheVeterancyNames[] = +const char *const TheVeterancyNames[] = { "REGULAR", "VETERAN", @@ -38,14 +38,16 @@ const char *TheVeterancyNames[] = "HEROIC", NULL }; +static_assert(ARRAY_SIZE(TheVeterancyNames) == LEVEL_COUNT + 1, "Incorrect array size"); -const char *TheRelationshipNames[] = +const char *const TheRelationshipNames[] = { "ENEMIES", "NEUTRAL", "ALLIES", NULL }; +static_assert(ARRAY_SIZE(TheRelationshipNames) == RELATIONSHIP_COUNT + 1, "Incorrect array size"); //------------------------------------------------------------------------------------------------- // TheSuperHackers @todo DO NOT USE THIS FUNCTION! Use WWMath::Normalize_Angle instead. Delete this. diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/GameType.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/GameType.cpp index 3461b93a7a4..7c8e7fc8ca8 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/GameType.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/GameType.cpp @@ -26,7 +26,7 @@ #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine -const char *TimeOfDayNames[] = +const char *const TimeOfDayNames[] = { "NONE", "MORNING", @@ -36,11 +36,13 @@ const char *TimeOfDayNames[] = NULL }; +static_assert(ARRAY_SIZE(TimeOfDayNames) == TIME_OF_DAY_COUNT + 1, "Incorrect array size"); -const char *WeatherNames[] = +const char *const WeatherNames[] = { "NORMAL", "SNOWY", NULL }; +static_assert(ARRAY_SIZE(WeatherNames) == WEATHER_COUNT + 1, "Incorrect array size"); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/KindOf.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/KindOf.cpp index 15b6acaef09..7e703a508a3 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/KindOf.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/KindOf.cpp @@ -32,7 +32,7 @@ #include "Common/BitFlagsIO.h" template<> -const char* KindOfMaskType::s_bitNameList[] = +const char* const KindOfMaskType::s_bitNameList[] = { "OBSTACLE", "SELECTABLE", @@ -161,6 +161,7 @@ const char* KindOfMaskType::s_bitNameList[] = NULL }; +static_assert(ARRAY_SIZE(KindOfMaskType::s_bitNameList) == KindOfMaskType::NumBits + 1, "Incorrect array size"); KindOfMaskType KINDOFMASK_NONE; // inits to all zeroes KindOfMaskType KINDOFMASK_FS; // inits to all zeroes diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/ObjectStatusTypes.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/ObjectStatusTypes.cpp index 4e5f9442f38..8b07bbc5a9c 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/ObjectStatusTypes.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/ObjectStatusTypes.cpp @@ -33,7 +33,7 @@ #include "Common/BitFlagsIO.h" template<> -const char* ObjectStatusMaskType::s_bitNameList[] = +const char* const ObjectStatusMaskType::s_bitNameList[] = { "NONE", "DESTROYED", @@ -82,5 +82,6 @@ const char* ObjectStatusMaskType::s_bitNameList[] = "DEPLOYED", NULL }; +static_assert(ARRAY_SIZE(ObjectStatusMaskType::s_bitNameList) == ObjectStatusMaskType::NumBits + 1, "Incorrect array size"); ObjectStatusMaskType OBJECT_STATUS_MASK_NONE; // inits to all zeroes diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp index a77f3cc44b6..17515a59d7e 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp @@ -38,12 +38,13 @@ #include "GameClient/Image.h" -const char *TheUpgradeTypeNames[] = +const char *const TheUpgradeTypeNames[] = { "PLAYER", "OBJECT", NULL }; +static_assert(ARRAY_SIZE(TheUpgradeTypeNames) == NUM_UPGRADE_TYPES + 1, "Incorrect array size"); // PUBLIC ///////////////////////////////////////////////////////////////////////////////////////// class UpgradeCenter *TheUpgradeCenter = NULL; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index 0c6b39fc252..46d261a6c00 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -89,7 +89,7 @@ #define VERY_TRANSPARENT_MATERIAL_PASS_OPACITY (0.001f) #define MATERIAL_PASS_OPACITY_FADE_SCALAR (0.8f) -static const char *TheDrawableIconNames[] = +static const char *const TheDrawableIconNames[] = { "DefaultHeal", "StructureHeal", @@ -111,6 +111,7 @@ static const char *TheDrawableIconNames[] = "CarBomb", NULL }; +static_assert(ARRAY_SIZE(TheDrawableIconNames) == MAX_ICONS + 1, "Incorrect array size"); /** diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp index 5bfcb5bed63..8f63959d3c0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp @@ -34,7 +34,7 @@ //------------------------------------------------------------------------------------------------- -const char *TheEvaMessageNames[] = +static const char *const TheEvaMessageNames[] = { "LOWPOWER", "INSUFFICIENTFUNDS", @@ -93,9 +93,8 @@ const char *TheEvaMessageNames[] = //**************************************************************************** //Kris: Don't forget to add another handler below -- it's ghey-ly implemented. //**************************************************************************** - - "EVA_INVALID", }; +static_assert(ARRAY_SIZE(TheEvaMessageNames) == EVA_COUNT, "Incorrect array size"); //------------------------------------------------------------------------------------------------- const ShouldPlayFunc Eva::s_shouldPlayFuncs[] = @@ -153,7 +152,6 @@ const ShouldPlayFunc Eva::s_shouldPlayFuncs[] = Eva::shouldPlayGenericHandler, Eva::shouldPlayGenericHandler, Eva::shouldPlayGenericHandler, - NULL, }; @@ -316,10 +314,6 @@ void Eva::update() //------------------------------------------------------------------------------------------------- EvaMessage Eva::nameToMessage(const AsciiString& name) { - DEBUG_ASSERTCRASH( ARRAY_SIZE( TheEvaMessageNames ) == EVA_COUNT + 1, ("TheEvaMessageNames out of sync" ) ); - DEBUG_ASSERTCRASH( stricmp( TheEvaMessageNames[ EVA_COUNT ], "EVA_INVALID" ) == 0, ("TheEvaMessageNames out of sync" ) ); - DEBUG_ASSERTCRASH( stricmp( TheEvaMessageNames[ EVA_COUNT - 1], "EVA_INVALID" ) != 0, ("TheEvaMessageNames out of sync" ) ); - for (Int i = EVA_FIRST; i < EVA_COUNT; ++i) { if (name.compareNoCase(TheEvaMessageNames[i]) == 0) { return (EvaMessage) i; @@ -333,10 +327,6 @@ EvaMessage Eva::nameToMessage(const AsciiString& name) //------------------------------------------------------------------------------------------------- AsciiString Eva::messageToName(EvaMessage message) { - DEBUG_ASSERTCRASH( ARRAY_SIZE( TheEvaMessageNames ) == EVA_COUNT + 1, ("TheEvaMessageNames out of sync" ) ); - DEBUG_ASSERTCRASH( stricmp( TheEvaMessageNames[ EVA_COUNT ], "EVA_INVALID" ) == 0, ("TheEvaMessageNames out of sync" ) ); - DEBUG_ASSERTCRASH( stricmp( TheEvaMessageNames[ EVA_COUNT - 1], "EVA_INVALID" ) != 0, ("TheEvaMessageNames out of sync" ) ); - if (message >= EVA_FIRST && message < EVA_COUNT) return TheEvaMessageNames[message]; @@ -415,9 +405,7 @@ Bool Eva::messageShouldPlay(EvaMessage messageToTest, UnsignedInt currentFrame) return FALSE; } - DEBUG_ASSERTCRASH( ARRAY_SIZE( s_shouldPlayFuncs ) == EVA_COUNT + 1, ("Eva::s_shouldPlayFuncs out of sync" ) ); - DEBUG_ASSERTCRASH( s_shouldPlayFuncs[ EVA_COUNT ] == NULL, ("Eva::s_shouldPlayFuncs out of sync" ) ); - DEBUG_ASSERTCRASH( s_shouldPlayFuncs[ EVA_COUNT - 1] != NULL, ("Eva::s_shouldPlayFuncs out of sync" ) ); + static_assert(ARRAY_SIZE(s_shouldPlayFuncs) == EVA_COUNT, "Incorrect array size"); m_messageBeingTested = messageToTest; return s_shouldPlayFuncs[messageToTest](m_localPlayer); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp index f2080712072..125b16c72f7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp @@ -423,6 +423,8 @@ class ViewShakeFXNugget : public FXNugget { "CINE_INSANE", View::SHAKE_CINE_INSANE }, { 0, 0 } }; + static_assert(ARRAY_SIZE(shakeTypeNames) == View::SHAKE_COUNT + 1, "Incorrect array size"); + *(Int *)store = INI::scanLookupList(ini->getNextToken(), shakeTypeNames); } @@ -487,6 +489,8 @@ class TerrainScorchFXNugget : public FXNugget { "RANDOM", -1 }, { 0, 0 } }; + static_assert(ARRAY_SIZE(scorchTypeNames) == SCORCH_COUNT + 2, "Incorrect array size"); + *(Int *)store = INI::scanLookupList(ini->getNextToken(), scorchTypeNames); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp index 36d0d69e0cf..1e269d18022 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp @@ -166,6 +166,7 @@ static const LookupListRec AnimTypeNames[] = { "SLIDE_RIGHT", ControlBarSchemeAnimation::CB_ANIM_SLIDE_RIGHT }, { NULL, 0 } }; +static_assert(ARRAY_SIZE(AnimTypeNames) == ControlBarSchemeAnimation::CB_ANIM_MAX + 1, "Incorrect array size"); static void animSlideRight( ControlBarSchemeAnimation *anim ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp index b56969b3d36..a3c1cad0ce7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp @@ -34,7 +34,7 @@ #include "GameClient/GameText.h" #include "GameNetwork/NetworkInterface.h" -const char *DisconnectMenu::m_playerNameTextControlNames[] = { +const char *const DisconnectMenu::m_playerNameTextControlNames[] = { "DisconnectScreen.wnd:StaticPlayer1Name", "DisconnectScreen.wnd:StaticPlayer2Name", "DisconnectScreen.wnd:StaticPlayer3Name", @@ -45,7 +45,7 @@ const char *DisconnectMenu::m_playerNameTextControlNames[] = { NULL }; -const char *DisconnectMenu::m_playerTimeoutTextControlNames[] = { +const char *const DisconnectMenu::m_playerTimeoutTextControlNames[] = { "DisconnectScreen.wnd:StaticPlayer1Timeout", "DisconnectScreen.wnd:StaticPlayer2Timeout", "DisconnectScreen.wnd:StaticPlayer3Timeout", @@ -56,7 +56,7 @@ const char *DisconnectMenu::m_playerTimeoutTextControlNames[] = { NULL }; -const char *DisconnectMenu::m_playerVoteButtonControlNames[] = { +const char *const DisconnectMenu::m_playerVoteButtonControlNames[] = { "DisconnectScreen.wnd:ButtonKickPlayer1", "DisconnectScreen.wnd:ButtonKickPlayer2", "DisconnectScreen.wnd:ButtonKickPlayer3", @@ -67,7 +67,7 @@ const char *DisconnectMenu::m_playerVoteButtonControlNames[] = { NULL }; -const char *DisconnectMenu::m_playerVoteCountControlNames[] = { +const char *const DisconnectMenu::m_playerVoteCountControlNames[] = { "DisconnectScreen.wnd:StaticPlayer1Votes", "DisconnectScreen.wnd:StaticPlayer2Votes", "DisconnectScreen.wnd:StaticPlayer3Votes", @@ -78,9 +78,9 @@ const char *DisconnectMenu::m_playerVoteCountControlNames[] = { NULL }; -const char *DisconnectMenu::m_packetRouterTimeoutControlName = "DisconnectScreen.wnd:StaticPacketRouterTimeout"; -const char *DisconnectMenu::m_packetRouterTimeoutLabelControlName = "DisconnectScreen.wnd:StaticPacketRouterTimeoutLabel"; -const char *DisconnectMenu::m_textDisplayControlName = "DisconnectScreen.wnd:ListboxTextDisplay"; +const char *const DisconnectMenu::m_packetRouterTimeoutControlName = "DisconnectScreen.wnd:StaticPacketRouterTimeout"; +const char *const DisconnectMenu::m_packetRouterTimeoutLabelControlName = "DisconnectScreen.wnd:StaticPacketRouterTimeoutLabel"; +const char *const DisconnectMenu::m_textDisplayControlName = "DisconnectScreen.wnd:ListboxTextDisplay"; static const Color chatNormalColor = GameMakeColor(255,0,0,255); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp index cd22e2b5562..a7fbcf60801 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp @@ -36,7 +36,7 @@ EstablishConnectionsMenu *TheEstablishConnectionsMenu = NULL; -const char *EstablishConnectionsMenu::m_playerReadyControlNames[] = { +const char *const EstablishConnectionsMenu::m_playerReadyControlNames[] = { "EstablishConnectionsScreen.wnd:ButtonAccept1", "EstablishConnectionsScreen.wnd:ButtonAccept2", "EstablishConnectionsScreen.wnd:ButtonAccept3", @@ -46,7 +46,7 @@ const char *EstablishConnectionsMenu::m_playerReadyControlNames[] = { "EstablishConnectionsScreen.wnd:ButtonAccept7", NULL}; -const char *EstablishConnectionsMenu::m_playerNameControlNames[] = { +const char *const EstablishConnectionsMenu::m_playerNameControlNames[] = { "EstablishConnectionsScreen.wnd:StaticPlayer1Name", "EstablishConnectionsScreen.wnd:StaticPlayer2Name", "EstablishConnectionsScreen.wnd:StaticPlayer3Name", @@ -57,7 +57,7 @@ const char *EstablishConnectionsMenu::m_playerNameControlNames[] = { NULL }; -const char *EstablishConnectionsMenu::m_playerStatusControlNames[] = { +const char *const EstablishConnectionsMenu::m_playerStatusControlNames[] = { "EstablishConnectionsScreen.wnd:StaticPlayer1Status", "EstablishConnectionsScreen.wnd:StaticPlayer2Status", "EstablishConnectionsScreen.wnd:StaticPlayer3Status", diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp index a3c3dc9d1e4..2576ed9ca62 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp @@ -90,7 +90,7 @@ static Int lookAtPlayerID = 0; static std::string lookAtPlayerName; -static const char *rankNames[] = { +static const char *const rankNames[] = { "Private", "Corporal", "Sergeant", @@ -102,6 +102,7 @@ static const char *rankNames[] = { "Brigadier", "Commander", }; +static_assert(ARRAY_SIZE(rankNames) == MAX_RANKS, "Incorrect array size"); static const Image* lookupRankImage(AsciiString side, Int rank) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp index 7f4c1d74d24..7553bf5f035 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp @@ -366,7 +366,7 @@ static void populateGroupRoomListbox(GameWindow *lb) GadgetComboBoxSetSelectedPos(lb, indexToSelect); } -static const char *rankNames[] = { +static const char *const rankNames[] = { "Private", "Corporal", "Sergeant", @@ -378,6 +378,8 @@ static const char *rankNames[] = { "Brigadier", "Commander", }; +static_assert(ARRAY_SIZE(rankNames) == MAX_RANKS, "Incorrect array size"); + const Image* LookupSmallRankImage(Int side, Int rankPoints) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp index 21c42bd748c..51b25e80459 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp @@ -137,16 +137,16 @@ static GameFont *defFont = NULL; // These strings must be in the same order as they are in their definitions // (see WIN_STATUS_* enums and GWS_* enums). // -const char *WindowStatusNames[] = { "ACTIVE", "TOGGLE", "DRAGABLE", "ENABLED", "HIDDEN", +const char *const WindowStatusNames[] = { "ACTIVE", "TOGGLE", "DRAGABLE", "ENABLED", "HIDDEN", "ABOVE", "BELOW", "IMAGE", "TABSTOP", "NOINPUT", "NOFOCUS", "DESTROYED", "BORDER", "SMOOTH_TEXT", "ONE_LINE", "NO_FLUSH", "SEE_THRU", "RIGHT_CLICK", "WRAP_CENTERED", "CHECK_LIKE","HOTKEY_TEXT", "USE_OVERLAY_STATES", "NOT_READY", "FLASHING", "ALWAYS_COLOR", - "ON_MOUSE_DOWN", + "ON_MOUSE_DOWN", /*"SHORTCUT_BUTTON",*/ NULL }; -const char *WindowStyleNames[] = { "PUSHBUTTON", "RADIOBUTTON", "CHECKBOX", +const char *const WindowStyleNames[] = { "PUSHBUTTON", "RADIOBUTTON", "CHECKBOX", "VERTSLIDER", "HORZSLIDER", "SCROLLLISTBOX", "ENTRYFIELD", "STATICTEXT", "PROGRESSBAR", "USER", "MOUSETRACK", "ANIMATED", @@ -200,9 +200,9 @@ static GameWindow *parseWindow( File *inFile, char *buffer ); * if successful. Returns TRUE on success, else FALSE. */ //============================================================================= static Bool parseBitFlag( const char *flagString, UnsignedInt *bits, - const char **flagList ) + ConstCharPtrArray flagList ) { - const char **c; + ConstCharPtrArray c; int i; for( i = 0, c = flagList; *c; i++, c++ ) @@ -226,7 +226,7 @@ static Bool parseBitFlag( const char *flagString, UnsignedInt *bits, * argument. * Note that this routine does not clear any bits, only sets them. */ //============================================================================= -static void parseBitString( const char *inBuffer, UnsignedInt *bits, const char **flagList ) +static void parseBitString( const char *inBuffer, UnsignedInt *bits, ConstCharPtrArray flagList ) { char buffer[256]; char *tok; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp index 5ec7b1aaba4..b22987b2350 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -1153,7 +1153,7 @@ void GameClient::preloadAssets( TimeOfDay timeOfDay ) DEBUG_LOG(("Preloading memory dwAvailVirtual %d --> %d : %d", before.dwAvailVirtual, after.dwAvailVirtual, before.dwAvailVirtual - after.dwAvailVirtual)); - const char *textureNames[] = { + const char *const textureNames[] = { "ptspruce01.tga", "exrktflame.tga", "cvlimo3_d2.tga", diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp index 4c2ed1b8e39..a1fb21ec303 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp @@ -59,7 +59,7 @@ LocomotorStore *TheLocomotorStore = NULL; ///< the Locomotor store definitio const Real BIGNUM = 99999.0f; -static const char *TheLocomotorPriorityNames[] = +static const char *const TheLocomotorPriorityNames[] = { "MOVES_BACK", "MOVES_MIDDLE", @@ -67,7 +67,7 @@ static const char *TheLocomotorPriorityNames[] = NULL }; - +static_assert(ARRAY_SIZE(TheLocomotorPriorityNames) == LOCOMOTOR_PRIORITY_COUNT + 1, "Array size"); /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp index 2c7dfeab025..703c49b47ab 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp @@ -702,7 +702,7 @@ enum DebrisDisposition CPP_11(: Int) WHIRLING = 0x00000100 }; -static const char* DebrisDispositionNames[] = +static const char* const DebrisDispositionNames[] = { "LIKE_EXISTING", "ON_GROUND_ALIGNED", diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp index f628c976474..50b4b3bf1b1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp @@ -51,7 +51,7 @@ enum MAX_ADJUST_RADIUS = 500 }; -static const char* TheOCLCreateLocTypeNames[] = +static const char* const TheOCLCreateLocTypeNames[] = { "CREATE_AT_EDGE_NEAR_SOURCE", "CREATE_AT_EDGE_NEAR_TARGET", @@ -61,6 +61,7 @@ static const char* TheOCLCreateLocTypeNames[] = "CREATE_AT_EDGE_FARTHEST_FROM_TARGET", NULL }; +static_assert(ARRAY_SIZE(TheOCLCreateLocTypeNames) == OCL_CREATE_LOC_COUNT + 1, "Incorrect array size"); //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipDeploymentUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipDeploymentUpdate.cpp index 2b52bfe668c..7e98567da3d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipDeploymentUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipDeploymentUpdate.cpp @@ -77,7 +77,7 @@ SpectreGunshipDeploymentUpdateModuleData::SpectreGunshipDeploymentUpdateModuleDa } -static const char* TheGunshipCreateLocTypeNames[] = +static const char* const TheGunshipCreateLocTypeNames[] = { "CREATE_AT_EDGE_NEAR_SOURCE", "CREATE_AT_EDGE_FARTHEST_FROM_SOURCE", @@ -85,7 +85,7 @@ static const char* TheGunshipCreateLocTypeNames[] = "CREATE_AT_EDGE_FARTHEST_FROM_TARGET", NULL }; - +static_assert(ARRAY_SIZE(TheGunshipCreateLocTypeNames) == GUNSHIP_CREATE_LOC_COUNT + 1, "Wrong array size"); static Real zero = 0.0f; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp index fad84d6aafa..be6b7be447d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp @@ -50,7 +50,7 @@ const Int MAX_IDX = 32; //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- -static const char *TheStructureCollapsePhaseNames[] = +static const char *const TheStructureCollapsePhaseNames[] = { "INITIAL", "DELAY", @@ -59,6 +59,7 @@ static const char *TheStructureCollapsePhaseNames[] = NULL }; +static_assert(ARRAY_SIZE(TheStructureCollapsePhaseNames) == SC_PHASE_COUNT + 1, "Wrong array size"); //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp index 0e92431fd34..b8391512d3d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp @@ -59,7 +59,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// template<> -const char* WeaponSetFlags::s_bitNameList[] = +const char* const WeaponSetFlags::s_bitNameList[] = { "VETERAN", "ELITE", @@ -81,6 +81,7 @@ const char* WeaponSetFlags::s_bitNameList[] = NULL }; +static_assert(ARRAY_SIZE(WeaponSetFlags::s_bitNameList) == WeaponSetFlags::NumBits + 1, "Incorrect array size"); /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp index 66d9780e829..657cc8cb77d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp @@ -76,7 +76,7 @@ static ScriptGroup *s_mtGroup = NULL; // These strings must be in the same order as they are in their definitions // (See SHELL_SCRIPT_HOOK_* ) // -const char *TheShellHookNames[]= +static const char *const TheShellHookNames[]= { "ShellMainMenuCampaignPushed", //SHELL_SCRIPT_HOOK_MAIN_MENU_CAMPAIGN_SELECTED, "ShellMainMenuCampaignHighlighted", //SHELL_SCRIPT_HOOK_MAIN_MENU_CAMPAIGN_HIGHLIGHTED, @@ -117,6 +117,8 @@ const char *TheShellHookNames[]= "ShellLANClosed", //SHELL_SCRIPT_HOOK_LAN_CLOSED, "ShellLANEnteredFromGame", //SHELL_SCRIPT_HOOK_LAN_ENTERED_FROM_GAME, }; +static_assert(ARRAY_SIZE(TheShellHookNames) == SHELL_SCRIPT_HOOK_TOTAL, "Incorrect array size"); + void SignalUIInteraction(Int interaction) { if (TheScriptEngine) @@ -2169,7 +2171,7 @@ Parameter *Parameter::ReadParameter(DataChunkInput &file) if (pParm->getParameterType() == KIND_OF_PARAM) { // Need to change the string to an integer - const char** kindofNames = KindOfMaskType::getBitNames(); + const char* const* kindofNames = KindOfMaskType::getBitNames(); if (!pParm->m_string.isEmpty()) { Bool found = false; @@ -2671,10 +2673,10 @@ Bool ScriptAction::ParseActionFalseDataChunk(DataChunkInput &file, DataChunkInfo return true; } -// NOTE: Changing these or adding ot TheOBjectFlagNames requires changes to +// NOTE: Changing these or adding to TheObjectFlagsNames requires changes to // ScriptActions::changeObjectPanelFlagForSingleObject // THEY SHOULD STAY IN SYNC. -const char* TheObjectFlagsNames[] = +const char* const TheObjectFlagsNames[] = { "Enabled", "Powered", @@ -2683,5 +2685,4 @@ const char* TheObjectFlagsNames[] = "Selectable", "AI Recruitable", "Player Targetable", - NULL, }; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/Damage.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/Damage.cpp index 2ed63aab601..15a07b0c608 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/Damage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/Damage.cpp @@ -40,7 +40,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// template<> -const char* DamageTypeFlags::s_bitNameList[] = +const char* const DamageTypeFlags::s_bitNameList[] = { "EXPLOSION", "CRUSH", @@ -83,6 +83,7 @@ const char* DamageTypeFlags::s_bitNameList[] = NULL }; +static_assert(ARRAY_SIZE(DamageTypeFlags::s_bitNameList) == DamageTypeFlags::NumBits + 1, "Incorrect array size"); DamageTypeFlags DAMAGE_TYPE_FLAGS_NONE; // inits to all zeroes DamageTypeFlags DAMAGE_TYPE_FLAGS_ALL; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index e7a561e26c5..0b627ac5bd7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -3476,7 +3476,7 @@ static void unitTimings(void) #endif - static char *illegalTemplateNames[] = + static const char *const illegalTemplateNames[] = { "EMPPulseBomb", "GLAAngryMobRockProjectileObject", diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h index c1e98a84125..7dedf11d76e 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h @@ -46,6 +46,8 @@ class RenderObjClass { ANIM_MODE_LOOP_PINGPONG, ANIM_MODE_LOOP_BACKWARDS, //make sure only backwards playing animations after this one ANIM_MODE_ONCE_BACKWARDS, + + ANIM_MODE_COUNT }; }; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp index 9a17a70d603..c7423e7fc85 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp @@ -227,9 +227,11 @@ enum ACBits CPP_11(: Int) MAINTAIN_FRAME_ACROSS_STATES2, MAINTAIN_FRAME_ACROSS_STATES3, MAINTAIN_FRAME_ACROSS_STATES4, + + AC_BITS_COUNT }; -static const char *ACBitsNames[] = +static const char *const ACBitsNames[] = { "RANDOMSTART", "START_FRAME_FIRST", @@ -244,6 +246,7 @@ static const char *ACBitsNames[] = NULL }; +static_assert(ARRAY_SIZE(ACBitsNames) == AC_BITS_COUNT + 1, "Incorrect array size"); static const Int ALL_MAINTAIN_FRAME_FLAGS = (1< Date: Sat, 20 Sep 2025 11:56:41 +0200 Subject: [PATCH 086/343] refactor(message): Simplify double click related code in MetaEventTranslator::translateGameMessage() (#1606) --- .../GameClient/MessageStream/MetaEvent.cpp | 78 ++++++++----------- .../GameClient/MessageStream/MetaEvent.cpp | 78 ++++++++----------- 2 files changed, 66 insertions(+), 90 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp index a0cf8e4cd3f..281b29dbb21 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp @@ -506,77 +506,62 @@ GameMessageDisposition MetaEventTranslator::translateGameMessage(const GameMessa if (t > GameMessage::MSG_RAW_MOUSE_BEGIN && t < GameMessage::MSG_RAW_MOUSE_END ) { - Int index = 0; + Int index = 3; switch (t) { case GameMessage::MSG_RAW_MOUSE_LEFT_BUTTON_DOWN: + --index; + FALLTHROUGH; case GameMessage::MSG_RAW_MOUSE_MIDDLE_BUTTON_DOWN: + --index; + FALLTHROUGH; case GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_DOWN: { - // Fill out which the current mouse down position - if (t == GameMessage::MSG_RAW_MOUSE_MIDDLE_BUTTON_DOWN) - index = 1; - else if (t == GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_DOWN) - index = 2; - // else index == 0 + --index; m_mouseDownPosition[index] = msg->getArgument(0)->pixel; m_nextUpShouldCreateDoubleClick[index] = FALSE; - break; } case GameMessage::MSG_RAW_MOUSE_LEFT_DOUBLE_CLICK: + --index; + FALLTHROUGH; case GameMessage::MSG_RAW_MOUSE_MIDDLE_DOUBLE_CLICK: + --index; + FALLTHROUGH; case GameMessage::MSG_RAW_MOUSE_RIGHT_DOUBLE_CLICK: { - if (t == GameMessage::MSG_RAW_MOUSE_MIDDLE_DOUBLE_CLICK) - index = 1; - else if (t == GameMessage::MSG_RAW_MOUSE_RIGHT_DOUBLE_CLICK) - index = 2; - // else index == 0 - + --index; m_nextUpShouldCreateDoubleClick[index] = TRUE; break; } case GameMessage::MSG_RAW_MOUSE_LEFT_BUTTON_UP: + --index; + FALLTHROUGH; case GameMessage::MSG_RAW_MOUSE_MIDDLE_BUTTON_UP: + --index; + FALLTHROUGH; case GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_UP: { - ICoord2D location = msg->getArgument(0)->pixel; - - // Fill out which the current mouse down position - if (t == GameMessage::MSG_RAW_MOUSE_MIDDLE_BUTTON_UP) - index = 1; - else if (t == GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_UP) - index = 2; - // else index == 0 + --index; - GameMessage *newMessage = NULL; - if (t == GameMessage::MSG_RAW_MOUSE_LEFT_BUTTON_UP) + constexpr const GameMessage::Type SingleClickMessages[3] = { - if (m_nextUpShouldCreateDoubleClick[index]) - newMessage = TheMessageStream->insertMessage(GameMessage::MSG_MOUSE_LEFT_DOUBLE_CLICK, const_cast(msg)); - else - newMessage = TheMessageStream->insertMessage(GameMessage::MSG_MOUSE_LEFT_CLICK, const_cast(msg)); - m_nextUpShouldCreateDoubleClick[index] = FALSE; - } - else if (t == GameMessage::MSG_RAW_MOUSE_MIDDLE_BUTTON_UP) + GameMessage::MSG_MOUSE_LEFT_CLICK, + GameMessage::MSG_MOUSE_MIDDLE_CLICK, + GameMessage::MSG_MOUSE_RIGHT_CLICK, + }; + constexpr const GameMessage::Type DoubleClickMessages[3] = { - if (m_nextUpShouldCreateDoubleClick[index]) - newMessage = TheMessageStream->insertMessage(GameMessage::MSG_MOUSE_MIDDLE_DOUBLE_CLICK, const_cast(msg)); - else - newMessage = TheMessageStream->insertMessage(GameMessage::MSG_MOUSE_MIDDLE_CLICK, const_cast(msg)); - m_nextUpShouldCreateDoubleClick[index] = FALSE; - } - else if (t == GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_UP) - { - if (m_nextUpShouldCreateDoubleClick[index]) - newMessage = TheMessageStream->insertMessage(GameMessage::MSG_MOUSE_RIGHT_DOUBLE_CLICK, const_cast(msg)); - else - newMessage = TheMessageStream->insertMessage(GameMessage::MSG_MOUSE_RIGHT_CLICK, const_cast(msg)); - m_nextUpShouldCreateDoubleClick[index] = FALSE; - } + GameMessage::MSG_MOUSE_LEFT_DOUBLE_CLICK, + GameMessage::MSG_MOUSE_MIDDLE_DOUBLE_CLICK, + GameMessage::MSG_MOUSE_RIGHT_DOUBLE_CLICK, + }; + + const ICoord2D location = msg->getArgument(0)->pixel; + const GameMessage::Type messageType = m_nextUpShouldCreateDoubleClick[index] ? DoubleClickMessages[index] : SingleClickMessages[index]; + GameMessage *newMessage = TheMessageStream->insertMessage(messageType, const_cast(msg)); IRegion2D pixelRegion; buildRegion( &m_mouseDownPosition[index], &location, &pixelRegion ); @@ -591,6 +576,9 @@ GameMessageDisposition MetaEventTranslator::translateGameMessage(const GameMessa // append the modifier keys to the message. newMessage->appendIntegerArgument( msg->getArgument(1)->integer ); + + // append the time to the message. + //newMessage->appendIntegerArgument( msg->getArgument(2)->integer ); break; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp index 8b37d139477..316b9977f5a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp @@ -564,77 +564,62 @@ GameMessageDisposition MetaEventTranslator::translateGameMessage(const GameMessa if (t > GameMessage::MSG_RAW_MOUSE_BEGIN && t < GameMessage::MSG_RAW_MOUSE_END ) { - Int index = 0; + Int index = 3; switch (t) { case GameMessage::MSG_RAW_MOUSE_LEFT_BUTTON_DOWN: + --index; + FALLTHROUGH; case GameMessage::MSG_RAW_MOUSE_MIDDLE_BUTTON_DOWN: + --index; + FALLTHROUGH; case GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_DOWN: { - // Fill out which the current mouse down position - if (t == GameMessage::MSG_RAW_MOUSE_MIDDLE_BUTTON_DOWN) - index = 1; - else if (t == GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_DOWN) - index = 2; - // else index == 0 + --index; m_mouseDownPosition[index] = msg->getArgument(0)->pixel; m_nextUpShouldCreateDoubleClick[index] = FALSE; - break; } case GameMessage::MSG_RAW_MOUSE_LEFT_DOUBLE_CLICK: + --index; + FALLTHROUGH; case GameMessage::MSG_RAW_MOUSE_MIDDLE_DOUBLE_CLICK: + --index; + FALLTHROUGH; case GameMessage::MSG_RAW_MOUSE_RIGHT_DOUBLE_CLICK: { - if (t == GameMessage::MSG_RAW_MOUSE_MIDDLE_DOUBLE_CLICK) - index = 1; - else if (t == GameMessage::MSG_RAW_MOUSE_RIGHT_DOUBLE_CLICK) - index = 2; - // else index == 0 - + --index; m_nextUpShouldCreateDoubleClick[index] = TRUE; break; } case GameMessage::MSG_RAW_MOUSE_LEFT_BUTTON_UP: + --index; + FALLTHROUGH; case GameMessage::MSG_RAW_MOUSE_MIDDLE_BUTTON_UP: + --index; + FALLTHROUGH; case GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_UP: { - ICoord2D location = msg->getArgument(0)->pixel; - - // Fill out which the current mouse down position - if (t == GameMessage::MSG_RAW_MOUSE_MIDDLE_BUTTON_UP) - index = 1; - else if (t == GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_UP) - index = 2; - // else index == 0 + --index; - GameMessage *newMessage = NULL; - if (t == GameMessage::MSG_RAW_MOUSE_LEFT_BUTTON_UP) + constexpr const GameMessage::Type SingleClickMessages[3] = { - if (m_nextUpShouldCreateDoubleClick[index]) - newMessage = TheMessageStream->insertMessage(GameMessage::MSG_MOUSE_LEFT_DOUBLE_CLICK, const_cast(msg)); - else - newMessage = TheMessageStream->insertMessage(GameMessage::MSG_MOUSE_LEFT_CLICK, const_cast(msg)); - m_nextUpShouldCreateDoubleClick[index] = FALSE; - } - else if (t == GameMessage::MSG_RAW_MOUSE_MIDDLE_BUTTON_UP) + GameMessage::MSG_MOUSE_LEFT_CLICK, + GameMessage::MSG_MOUSE_MIDDLE_CLICK, + GameMessage::MSG_MOUSE_RIGHT_CLICK, + }; + constexpr const GameMessage::Type DoubleClickMessages[3] = { - if (m_nextUpShouldCreateDoubleClick[index]) - newMessage = TheMessageStream->insertMessage(GameMessage::MSG_MOUSE_MIDDLE_DOUBLE_CLICK, const_cast(msg)); - else - newMessage = TheMessageStream->insertMessage(GameMessage::MSG_MOUSE_MIDDLE_CLICK, const_cast(msg)); - m_nextUpShouldCreateDoubleClick[index] = FALSE; - } - else if (t == GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_UP) - { - if (m_nextUpShouldCreateDoubleClick[index]) - newMessage = TheMessageStream->insertMessage(GameMessage::MSG_MOUSE_RIGHT_DOUBLE_CLICK, const_cast(msg)); - else - newMessage = TheMessageStream->insertMessage(GameMessage::MSG_MOUSE_RIGHT_CLICK, const_cast(msg)); - m_nextUpShouldCreateDoubleClick[index] = FALSE; - } + GameMessage::MSG_MOUSE_LEFT_DOUBLE_CLICK, + GameMessage::MSG_MOUSE_MIDDLE_DOUBLE_CLICK, + GameMessage::MSG_MOUSE_RIGHT_DOUBLE_CLICK, + }; + + const ICoord2D location = msg->getArgument(0)->pixel; + const GameMessage::Type messageType = m_nextUpShouldCreateDoubleClick[index] ? DoubleClickMessages[index] : SingleClickMessages[index]; + GameMessage *newMessage = TheMessageStream->insertMessage(messageType, const_cast(msg)); IRegion2D pixelRegion; buildRegion( &m_mouseDownPosition[index], &location, &pixelRegion ); @@ -649,6 +634,9 @@ GameMessageDisposition MetaEventTranslator::translateGameMessage(const GameMessa // append the modifier keys to the message. newMessage->appendIntegerArgument( msg->getArgument(1)->integer ); + + // append the time to the message. + //newMessage->appendIntegerArgument( msg->getArgument(2)->integer ); break; } From c8324cb5b0594c571c12393bb26a0048f0bc47ca Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 20 Sep 2025 12:10:38 +0200 Subject: [PATCH 087/343] refactor(view): Simplify View related code (#1600) --- .../Code/GameEngine/Include/GameClient/View.h | 12 +++--- .../GameEngine/Source/GameClient/View.cpp | 23 +++++++---- .../Source/W3DDevice/GameClient/W3DView.cpp | 29 ++------------ .../Code/GameEngine/Include/GameClient/View.h | 12 +++--- .../GameEngine/Source/GameClient/View.cpp | 23 +++++++---- .../Source/W3DDevice/GameClient/W3DView.cpp | 39 +++---------------- 6 files changed, 51 insertions(+), 87 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/View.h b/Generals/Code/GameEngine/Include/GameClient/View.h index ff86d887f28..88ebe6138a8 100644 --- a/Generals/Code/GameEngine/Include/GameClient/View.h +++ b/Generals/Code/GameEngine/Include/GameClient/View.h @@ -182,9 +182,9 @@ class View : public Snapshot virtual Real getZoom() { return m_zoom; } virtual void setZoom(Real z) { } virtual Real getHeightAboveGround() { return m_heightAboveGround; } - virtual void setHeightAboveGround(Real z) { m_heightAboveGround = z; } + virtual void setHeightAboveGround(Real z); virtual void zoom( Real height ); ///< Zoom in/out, closer to the ground, limit to min, or farther away from the ground, limit to max - virtual void setZoomToDefault( void ) { } ///< Set zoom to default value + virtual void setZoomToDefault( void ) { m_zoom = 1.0f; } ///< Set zoom to default value virtual Real getMaxZoom( void ) { return m_maxZoom; } ///< return max zoom value virtual void setOkToAdjustHeight( Bool val ) { m_okToAdjustHeight = val; } ///< Set this to adjust camera height @@ -265,8 +265,8 @@ class View : public Snapshot Real m_maxZoom; ///< Largest zoom value (minimum actual zoom) Real m_minZoom; ///< Smallest zoom value (maximum actual zoom) - Real m_maxHeightAboveGround; - Real m_minHeightAboveGround; + Real m_maxHeightAboveGround; ///< Highest camera above ground value + Real m_minHeightAboveGround; ///< Lowest camera above ground value Real m_zoom; ///< Current zoom value Real m_heightAboveGround; ///< User's desired height above ground Bool m_zoomLimited; ///< Camera restricted in zoom height @@ -276,7 +276,7 @@ class View : public Snapshot Real m_terrainHeightUnderCamera; ///< Cached value for debugging ObjectID m_cameraLock; ///< if nonzero, id of object that the camera should follow - Drawable *m_cameraLockDrawable; ///< if nonzero, drawble of object that camera should follow. + Drawable *m_cameraLockDrawable; ///< if nonzero, drawable of object that camera should follow. CameraLockType m_lockType; ///< are we following or just tethering? Real m_lockDist; ///< how far can we be when tethered? @@ -286,7 +286,7 @@ class View : public Snapshot Bool m_okToAdjustHeight; ///< Should we attempt to adjust camera height? Bool m_snapImmediate; ///< Should we immediately snap to the object we're following? - Coord2D m_guardBandBias; ///< Exttra beefy margins so huge thins can stay "on-screen" + Coord2D m_guardBandBias; ///< Extra beefy margins so huge thins can stay "on-screen" }; diff --git a/Generals/Code/GameEngine/Source/GameClient/View.cpp b/Generals/Code/GameEngine/Source/GameClient/View.cpp index c0bca09dee4..c864b2feef1 100644 --- a/Generals/Code/GameEngine/Source/GameClient/View.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/View.cpp @@ -166,14 +166,8 @@ void View::setAngle( Real angle ) */ void View::setPitch( Real angle ) { - m_pitchAngle = angle; - - Real limit = PI/5.0f; - - if (m_pitchAngle < -limit) - m_pitchAngle = -limit; - else if (m_pitchAngle > limit) - m_pitchAngle = limit; + constexpr Real limit = PI/5.0f; + m_pitchAngle = clamp(-limit, angle, limit); } /** @@ -185,6 +179,19 @@ void View::setAngleAndPitchToDefault( void ) m_pitchAngle = m_defaultPitchAngle; } +void View::setHeightAboveGround(Real z) +{ + // if our zoom is limited, we will stay within a predefined distance from the terrain + if( m_zoomLimited ) + { + m_heightAboveGround = clamp(m_minHeightAboveGround, z, m_maxHeightAboveGround); + } + else + { + m_heightAboveGround = z; + } +} + /** * write the view's current location in to the view location object */ diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 43657ed7c2d..aa5441d7957 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -117,18 +117,7 @@ inline Real maxf(Real a, Real b) { if (a > b) return a; else return b; } //------------------------------------------------------------------------------------------------- static void normAngle(Real &angle) { - if (angle < -10*PI) { - angle = 0; - } - if (angle > 10*PI) { - angle = 0; - } - while (angle < -PI) { - angle += 2*PI; - } - while (angle > PI) { - angle -= 2*PI; - } + angle = WWMath::Normalize_Angle(angle); } #define TERRAIN_SAMPLE_SIZE 40.0f @@ -1753,7 +1742,7 @@ void W3DView::setAngleAndPitchToDefault( void ) // call our base class, we are adding functionality View::setAngleAndPitchToDefault(); - this->m_FXPitch = 1.0; + m_FXPitch = 1.0; // set the camera setCameraTransform(); @@ -1775,19 +1764,7 @@ void W3DView::setDefaultView(Real pitch, Real angle, Real maxHeight) //------------------------------------------------------------------------------------------------- void W3DView::setHeightAboveGround(Real z) { - m_heightAboveGround = z; - - // if our zoom is limited, we will stay within a predefined distance from the terrain - if( m_zoomLimited ) - { - - if (m_heightAboveGround < m_minHeightAboveGround) - m_heightAboveGround = m_minHeightAboveGround; - - if (m_heightAboveGround > m_maxHeightAboveGround) - m_heightAboveGround = m_maxHeightAboveGround; - - } + View::setHeightAboveGround(z); m_doingMoveCameraOnWaypointPath = false; m_doingRotateCamera = false; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/View.h b/GeneralsMD/Code/GameEngine/Include/GameClient/View.h index 761650d4575..127eb0fc1fe 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/View.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/View.h @@ -186,9 +186,9 @@ class View : public Snapshot virtual Real getZoom() { return m_zoom; } virtual void setZoom(Real z) { } virtual Real getHeightAboveGround() { return m_heightAboveGround; } - virtual void setHeightAboveGround(Real z) { m_heightAboveGround = z; } + virtual void setHeightAboveGround(Real z); virtual void zoom( Real height ); ///< Zoom in/out, closer to the ground, limit to min, or farther away from the ground, limit to max - virtual void setZoomToDefault( void ) { } ///< Set zoom to default value + virtual void setZoomToDefault( void ) { m_zoom = 1.0f; } ///< Set zoom to default value virtual Real getMaxZoom( void ) { return m_maxZoom; } ///< return max zoom value virtual void setOkToAdjustHeight( Bool val ) { m_okToAdjustHeight = val; } ///< Set this to adjust camera height @@ -269,8 +269,8 @@ class View : public Snapshot Real m_maxZoom; ///< Largest zoom value (minimum actual zoom) Real m_minZoom; ///< Smallest zoom value (maximum actual zoom) - Real m_maxHeightAboveGround; - Real m_minHeightAboveGround; + Real m_maxHeightAboveGround; ///< Highest camera above ground value + Real m_minHeightAboveGround; ///< Lowest camera above ground value Real m_zoom; ///< Current zoom value Real m_heightAboveGround; ///< User's desired height above ground Bool m_zoomLimited; ///< Camera restricted in zoom height @@ -280,7 +280,7 @@ class View : public Snapshot Real m_terrainHeightUnderCamera; ///< Cached value for debugging ObjectID m_cameraLock; ///< if nonzero, id of object that the camera should follow - Drawable *m_cameraLockDrawable; ///< if nonzero, drawble of object that camera should follow. + Drawable *m_cameraLockDrawable; ///< if nonzero, drawable of object that camera should follow. CameraLockType m_lockType; ///< are we following or just tethering? Real m_lockDist; ///< how far can we be when tethered? @@ -290,7 +290,7 @@ class View : public Snapshot Bool m_okToAdjustHeight; ///< Should we attempt to adjust camera height? Bool m_snapImmediate; ///< Should we immediately snap to the object we're following? - Coord2D m_guardBandBias; ///< Exttra beefy margins so huge thins can stay "on-screen" + Coord2D m_guardBandBias; ///< Extra beefy margins so huge thins can stay "on-screen" }; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp index 3a50a19d039..c2481779ec9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp @@ -166,14 +166,8 @@ void View::setAngle( Real angle ) */ void View::setPitch( Real angle ) { - m_pitchAngle = angle; - - Real limit = PI/5.0f; - - if (m_pitchAngle < -limit) - m_pitchAngle = -limit; - else if (m_pitchAngle > limit) - m_pitchAngle = limit; + constexpr Real limit = PI/5.0f; + m_pitchAngle = clamp(-limit, angle, limit); } /** @@ -185,6 +179,19 @@ void View::setAngleAndPitchToDefault( void ) m_pitchAngle = m_defaultPitchAngle; } +void View::setHeightAboveGround(Real z) +{ + // if our zoom is limited, we will stay within a predefined distance from the terrain + if( m_zoomLimited ) + { + m_heightAboveGround = clamp(m_minHeightAboveGround, z, m_maxHeightAboveGround); + } + else + { + m_heightAboveGround = z; + } +} + /** * write the view's current location in to the view location object */ diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 3e3a6c042a5..e22d060e7e7 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -119,18 +119,7 @@ inline Real maxf(Real a, Real b) { if (a > b) return a; else return b; } //------------------------------------------------------------------------------------------------- static void normAngle(Real &angle) { - if (angle < -10*PI) { - angle = 0; - } - if (angle > 10*PI) { - angle = 0; - } - while (angle < -PI) { - angle += 2*PI; - } - while (angle > PI) { - angle -= 2*PI; - } + angle = WWMath::Normalize_Angle(angle); } #define TERRAIN_SAMPLE_SIZE 40.0f @@ -445,13 +434,9 @@ void W3DView::buildCameraTransform( Matrix3D *transform ) // WST 10.22.2002. Update the Listener positions used by audio system //-------------------------------------------------------------------- Vector3 position = transform->Get_Translation(); - m_pos.x = position.X; - m_pos.y = position.Y; - m_pos.z = position.Z; - - - //DEBUG_LOG(("mpos x%f, y%f, z%f", m_pos.x, m_pos.y, m_pos.z )); - + Coord3D coord; + coord.set(position.X, position.Y, position.Z); + View::setPosition(&coord); break; } } @@ -1919,7 +1904,7 @@ void W3DView::setAngleAndPitchToDefault( void ) // call our base class, we are adding functionality View::setAngleAndPitchToDefault(); - this->m_FXPitch = 1.0; + m_FXPitch = 1.0; // set the camera setCameraTransform(); @@ -1941,19 +1926,7 @@ void W3DView::setDefaultView(Real pitch, Real angle, Real maxHeight) //------------------------------------------------------------------------------------------------- void W3DView::setHeightAboveGround(Real z) { - m_heightAboveGround = z; - - // if our zoom is limited, we will stay within a predefined distance from the terrain - if( m_zoomLimited ) - { - - if (m_heightAboveGround < m_minHeightAboveGround) - m_heightAboveGround = m_minHeightAboveGround; - - if (m_heightAboveGround > m_maxHeightAboveGround) - m_heightAboveGround = m_maxHeightAboveGround; - - } + View::setHeightAboveGround(z); m_doingMoveCameraOnWaypointPath = false; m_CameraArrivedAtWaypointOnPathFlag = false; From b1eac2a5bb23d822ec90b2a8d7feadb74a992a23 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 20 Sep 2025 12:17:52 +0200 Subject: [PATCH 088/343] bugfix(fps): Fix mouse wheel zoom speed and decouple zoom update from logic step (#1587) --- .../Source/GameClient/MessageStream/LookAtXlat.cpp | 8 ++------ .../Source/W3DDevice/GameClient/W3DView.cpp | 14 +++++++------- .../Source/GameClient/MessageStream/LookAtXlat.cpp | 8 ++------ .../Source/W3DDevice/GameClient/W3DView.cpp | 14 +++++++------- 4 files changed, 18 insertions(+), 26 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index ff6131b6a45..34907e5b62c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -399,19 +399,15 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage Int spin = msg->getArgument( 1 )->integer; - // TheSuperHackers @tweak The camera zoom is now decoupled from the render update. - const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); - const Real zoomHeight = (Real)View::ZoomHeightPerSecond * fpsRatio; - if (spin > 0) { for ( ; spin > 0; spin--) - TheTacticalView->zoom( -zoomHeight ); + TheTacticalView->zoom( -View::ZoomHeightPerSecond ); } else { for ( ;spin < 0; spin++ ) - TheTacticalView->zoom( +zoomHeight ); + TheTacticalView->zoom( +View::ZoomHeightPerSecond ); } break; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index aa5441d7957..0d887707f61 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -1184,6 +1184,7 @@ void W3DView::update(void) { Real desiredHeight = (m_terrainHeightUnderCamera + m_heightAboveGround); Real desiredZoom = desiredHeight / m_cameraOffset.z; + if (didScriptedMovement || (TheGameLogic->isInReplayGame() && TheGlobalData->m_useCameraInReplay)) { // if we are in a scripted camera movement, take its height above ground as our desired height. @@ -1191,27 +1192,26 @@ void W3DView::update(void) //DEBUG_LOG(("Frame %d: height above ground: %g %g %g %g", TheGameLogic->getFrame(), m_heightAboveGround, // m_cameraOffset.z, m_zoom, m_terrainHeightUnderCamera)); } + if (TheInGameUI->isScrolling()) { // if scrolling, only adjust if we're too close or too far if (m_scrollAmount.length() < m_scrollAmountCutoff || (m_currentHeightAboveGround < m_minHeightAboveGround) || (TheGlobalData->m_enforceMaxCameraHeight && m_currentHeightAboveGround > m_maxHeightAboveGround)) { - Real zoomAdj = (desiredZoom - m_zoom)*TheGlobalData->m_cameraAdjustSpeed; - if (fabs(zoomAdj) >= 0.0001) // only do positive + Real zoomAdj = (desiredZoom - m_zoom) * TheGlobalData->m_cameraAdjustSpeed * TheGameEngine->getActualLogicTimeScaleOverFpsRatio(); + if (fabs(zoomAdj) >= 0.0001f) // only do positive { m_zoom += zoomAdj; recalcCamera = true; } } } - else + else if (!didScriptedMovement) { // we're not scrolling; settle toward desired height above ground - Real zoomAdj = (m_zoom - desiredZoom)*TheGlobalData->m_cameraAdjustSpeed; - Real zoomAdjAbs = fabs(zoomAdj); - if (zoomAdjAbs >= 0.0001 && !didScriptedMovement) + Real zoomAdj = (m_zoom - desiredZoom) * TheGlobalData->m_cameraAdjustSpeed * TheGameEngine->getActualLogicTimeScaleOverFpsRatio(); + if (fabs(zoomAdj) >= 0.0001f) { - //DEBUG_LOG(("W3DView::update() - m_zoom=%g, desiredHeight=%g", m_zoom, desiredZoom)); m_zoom -= zoomAdj; recalcCamera = true; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index 459b694a27e..e753b258694 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -398,19 +398,15 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage Int spin = msg->getArgument( 1 )->integer; - // TheSuperHackers @tweak The camera zoom is now decoupled from the render update. - const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); - const Real zoomHeight = (Real)View::ZoomHeightPerSecond * fpsRatio; - if (spin > 0) { for ( ; spin > 0; spin--) - TheTacticalView->zoom( -zoomHeight ); + TheTacticalView->zoom( -View::ZoomHeightPerSecond ); } else { for ( ;spin < 0; spin++ ) - TheTacticalView->zoom( +zoomHeight ); + TheTacticalView->zoom( +View::ZoomHeightPerSecond ); } break; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index e22d060e7e7..7231705257d 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -1333,6 +1333,7 @@ void W3DView::update(void) { Real desiredHeight = (m_terrainHeightUnderCamera + m_heightAboveGround); Real desiredZoom = desiredHeight / m_cameraOffset.z; + if (didScriptedMovement || (TheGameLogic->isInReplayGame() && TheGlobalData->m_useCameraInReplay)) { // if we are in a scripted camera movement, take its height above ground as our desired height. @@ -1340,27 +1341,26 @@ void W3DView::update(void) //DEBUG_LOG(("Frame %d: height above ground: %g %g %g %g", TheGameLogic->getFrame(), m_heightAboveGround, // m_cameraOffset.z, m_zoom, m_terrainHeightUnderCamera)); } + if (TheInGameUI->isScrolling()) { // if scrolling, only adjust if we're too close or too far if (m_scrollAmount.length() < m_scrollAmountCutoff || (m_currentHeightAboveGround < m_minHeightAboveGround) || (TheGlobalData->m_enforceMaxCameraHeight && m_currentHeightAboveGround > m_maxHeightAboveGround)) { - Real zoomAdj = (desiredZoom - m_zoom)*TheGlobalData->m_cameraAdjustSpeed; - if (fabs(zoomAdj) >= 0.0001) // only do positive + Real zoomAdj = (desiredZoom - m_zoom) * TheGlobalData->m_cameraAdjustSpeed * TheGameEngine->getActualLogicTimeScaleOverFpsRatio(); + if (fabs(zoomAdj) >= 0.0001f) // only do positive { m_zoom += zoomAdj; recalcCamera = true; } } } - else + else if (!didScriptedMovement) { // we're not scrolling; settle toward desired height above ground - Real zoomAdj = (m_zoom - desiredZoom)*TheGlobalData->m_cameraAdjustSpeed; - Real zoomAdjAbs = fabs(zoomAdj); - if (zoomAdjAbs >= 0.0001 && !didScriptedMovement) + Real zoomAdj = (m_zoom - desiredZoom) * TheGlobalData->m_cameraAdjustSpeed * TheGameEngine->getActualLogicTimeScaleOverFpsRatio(); + if (fabs(zoomAdj) >= 0.0001f) { - //DEBUG_LOG(("W3DView::update() - m_zoom=%g, desiredHeight=%g", m_zoom, desiredZoom)); m_zoom -= zoomAdj; recalcCamera = true; } From 8078a223a48b7dd3173e75221883f85da213e9be Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 20 Sep 2025 12:34:52 +0200 Subject: [PATCH 089/343] bugfix(view): Fix camera terrain height adjustment in Replay playback (#1597) --- .../Source/W3DDevice/GameClient/W3DView.cpp | 6 +++++- .../Source/W3DDevice/GameClient/W3DView.cpp | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 0d887707f61..31406a903e8 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -1178,14 +1178,18 @@ void W3DView::update(void) * scrolling), the zoom will move toward matching the desired height. */ // TheSuperHackers @tweak Can now also zoom when the game is paused. + // TheSuperHackers @tweak The camera zoom speed is now decoupled from the render update. + // TheSuperHackers @bugfix The camera terrain height adjustment now also works in replay playback. + m_terrainHeightUnderCamera = getHeightAroundPos(m_pos.x, m_pos.y); m_currentHeightAboveGround = m_cameraOffset.z * m_zoom - m_terrainHeightUnderCamera; + if (TheTerrainLogic && TheGlobalData && TheInGameUI && m_okToAdjustHeight) { Real desiredHeight = (m_terrainHeightUnderCamera + m_heightAboveGround); Real desiredZoom = desiredHeight / m_cameraOffset.z; - if (didScriptedMovement || (TheGameLogic->isInReplayGame() && TheGlobalData->m_useCameraInReplay)) + if (didScriptedMovement) { // if we are in a scripted camera movement, take its height above ground as our desired height. m_heightAboveGround = m_currentHeightAboveGround; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 7231705257d..2e142f6a54c 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -1327,14 +1327,18 @@ void W3DView::update(void) * scrolling), the zoom will move toward matching the desired height. */ // TheSuperHackers @tweak Can now also zoom when the game is paused. + // TheSuperHackers @tweak The camera zoom speed is now decoupled from the render update. + // TheSuperHackers @bugfix The camera terrain height adjustment now also works in replay playback. + m_terrainHeightUnderCamera = getHeightAroundPos(m_pos.x, m_pos.y); m_currentHeightAboveGround = m_cameraOffset.z * m_zoom - m_terrainHeightUnderCamera; + if (TheTerrainLogic && TheGlobalData && TheInGameUI && m_okToAdjustHeight) { Real desiredHeight = (m_terrainHeightUnderCamera + m_heightAboveGround); Real desiredZoom = desiredHeight / m_cameraOffset.z; - if (didScriptedMovement || (TheGameLogic->isInReplayGame() && TheGlobalData->m_useCameraInReplay)) + if (didScriptedMovement) { // if we are in a scripted camera movement, take its height above ground as our desired height. m_heightAboveGround = m_currentHeightAboveGround; From 1a78051383b5908359c3f0132dd74567ab038c8a Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 20 Sep 2025 12:46:20 +0200 Subject: [PATCH 090/343] bugfix(view): Fix camera terrain height adjustment during camera playback in Replay playback (#1598) --- Generals/Code/GameEngine/Include/GameClient/View.h | 5 +---- .../Code/GameEngine/Source/GameClient/InGameUI.cpp | 4 +++- Generals/Code/GameEngine/Source/GameClient/View.cpp | 6 +----- .../Source/W3DDevice/GameClient/W3DView.cpp | 12 +++++------- GeneralsMD/Code/GameEngine/Include/GameClient/View.h | 5 +---- .../Code/GameEngine/Source/GameClient/InGameUI.cpp | 4 +++- .../Code/GameEngine/Source/GameClient/View.cpp | 6 +----- .../Source/W3DDevice/GameClient/W3DView.cpp | 12 +++++------- 8 files changed, 20 insertions(+), 34 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/View.h b/Generals/Code/GameEngine/Include/GameClient/View.h index 88ebe6138a8..ae60609b1e0 100644 --- a/Generals/Code/GameEngine/Include/GameClient/View.h +++ b/Generals/Code/GameEngine/Include/GameClient/View.h @@ -180,12 +180,11 @@ class View : public Snapshot virtual const Coord3D& get3DCameraPosition() const = 0; ///< Returns the actual camera position virtual Real getZoom() { return m_zoom; } - virtual void setZoom(Real z) { } + virtual void setZoom(Real z) { m_zoom = z; } virtual Real getHeightAboveGround() { return m_heightAboveGround; } virtual void setHeightAboveGround(Real z); virtual void zoom( Real height ); ///< Zoom in/out, closer to the ground, limit to min, or farther away from the ground, limit to max virtual void setZoomToDefault( void ) { m_zoom = 1.0f; } ///< Set zoom to default value - virtual Real getMaxZoom( void ) { return m_maxZoom; } ///< return max zoom value virtual void setOkToAdjustHeight( Bool val ) { m_okToAdjustHeight = val; } ///< Set this to adjust camera height // for debugging @@ -263,8 +262,6 @@ class View : public Snapshot Real m_angle; ///< Angle at which view has been rotated about the Z axis Real m_pitchAngle; ///< Rotation of view direction around horizontal (X) axis - Real m_maxZoom; ///< Largest zoom value (minimum actual zoom) - Real m_minZoom; ///< Smallest zoom value (maximum actual zoom) Real m_maxHeightAboveGround; ///< Highest camera above ground value Real m_minHeightAboveGround; ///< Lowest camera above ground value Real m_zoom; ///< Current zoom value diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index 68ddc81b73f..616d2fca861 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -5345,7 +5345,9 @@ void InGameUI::updateAndDrawWorldAnimations( void ) UnsignedInt height = wad->m_anim->getCurrentFrameHeight(); // scale the width and height given the camera zoom level - Real zoomScale = TheTacticalView->getMaxZoom() / TheTacticalView->getZoom(); + // TheSuperHackers @todo Rework this with sane values. scaler=1.3 originally came from TheTacticalView::getMaxZoom() + constexpr Real scaler = 1.3f; + Real zoomScale = scaler / TheTacticalView->getZoom(); width *= zoomScale; height *= zoomScale; diff --git a/Generals/Code/GameEngine/Source/GameClient/View.cpp b/Generals/Code/GameEngine/Source/GameClient/View.cpp index c864b2feef1..c7c16c651ac 100644 --- a/Generals/Code/GameEngine/Source/GameClient/View.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/View.cpp @@ -49,9 +49,7 @@ View::View( void ) m_heightAboveGround = 0.0f; m_lockDist = 0.0f; m_maxHeightAboveGround = 0.0f; - m_maxZoom = 0.0f; m_minHeightAboveGround = 0.0f; - m_minZoom = 0.0f; m_next = NULL; m_okToAdjustHeight = TRUE; m_originX = 0; @@ -99,9 +97,7 @@ void View::init( void ) m_cameraLockDrawable = NULL; m_zoomLimited = TRUE; - m_maxZoom = 1.3f; - m_minZoom = 0.2f; - m_zoom = m_maxZoom; + m_zoom = 1.0f; m_maxHeightAboveGround = TheGlobalData->m_maxCameraHeight; m_minHeightAboveGround = TheGlobalData->m_minCameraHeight; m_okToAdjustHeight = FALSE; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 31406a903e8..5e9875b3d70 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -1781,15 +1781,13 @@ void W3DView::setHeightAboveGround(Real z) //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- +// TheSuperHackers @bugfix xezon 18/09/2025 setZoom is no longer clamped by a min and max zoom. +// Instead the min and max camera height will be clamped elsewhere. Clamping the zoom would cause +// issues with camera playback in replay playback where changes in terrain elevation would not raise +// the camera height. void W3DView::setZoom(Real z) { - m_zoom = z; - - if (m_zoom < m_minZoom) - m_zoom = m_minZoom; - - if (m_zoom > m_maxZoom) - m_zoom = m_maxZoom; + View::setZoom(z); m_doingMoveCameraOnWaypointPath = false; m_doingRotateCamera = false; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/View.h b/GeneralsMD/Code/GameEngine/Include/GameClient/View.h index 127eb0fc1fe..b204b908e11 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/View.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/View.h @@ -184,12 +184,11 @@ class View : public Snapshot virtual const Coord3D& get3DCameraPosition() const = 0; ///< Returns the actual camera position virtual Real getZoom() { return m_zoom; } - virtual void setZoom(Real z) { } + virtual void setZoom(Real z) { m_zoom = z; } virtual Real getHeightAboveGround() { return m_heightAboveGround; } virtual void setHeightAboveGround(Real z); virtual void zoom( Real height ); ///< Zoom in/out, closer to the ground, limit to min, or farther away from the ground, limit to max virtual void setZoomToDefault( void ) { m_zoom = 1.0f; } ///< Set zoom to default value - virtual Real getMaxZoom( void ) { return m_maxZoom; } ///< return max zoom value virtual void setOkToAdjustHeight( Bool val ) { m_okToAdjustHeight = val; } ///< Set this to adjust camera height // for debugging @@ -267,8 +266,6 @@ class View : public Snapshot Real m_angle; ///< Angle at which view has been rotated about the Z axis Real m_pitchAngle; ///< Rotation of view direction around horizontal (X) axis - Real m_maxZoom; ///< Largest zoom value (minimum actual zoom) - Real m_minZoom; ///< Smallest zoom value (maximum actual zoom) Real m_maxHeightAboveGround; ///< Highest camera above ground value Real m_minHeightAboveGround; ///< Lowest camera above ground value Real m_zoom; ///< Current zoom value diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index 6a4164d916c..1696a7a00e3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -5517,7 +5517,9 @@ void InGameUI::updateAndDrawWorldAnimations( void ) UnsignedInt height = wad->m_anim->getCurrentFrameHeight(); // scale the width and height given the camera zoom level - Real zoomScale = TheTacticalView->getMaxZoom() / TheTacticalView->getZoom(); + // TheSuperHackers @todo Rework this with sane values. scaler=1.3 originally came from TheTacticalView::getMaxZoom() + constexpr Real scaler = 1.3f; + Real zoomScale = scaler / TheTacticalView->getZoom(); width *= zoomScale; height *= zoomScale; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp index c2481779ec9..7d49cb9a7f0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp @@ -49,9 +49,7 @@ View::View( void ) m_heightAboveGround = 0.0f; m_lockDist = 0.0f; m_maxHeightAboveGround = 0.0f; - m_maxZoom = 0.0f; m_minHeightAboveGround = 0.0f; - m_minZoom = 0.0f; m_next = NULL; m_okToAdjustHeight = TRUE; m_originX = 0; @@ -99,9 +97,7 @@ void View::init( void ) m_cameraLockDrawable = NULL; m_zoomLimited = TRUE; - m_maxZoom = 1.3f; - m_minZoom = 0.2f; - m_zoom = m_maxZoom; + m_zoom = 1.0f; m_maxHeightAboveGround = TheGlobalData->m_maxCameraHeight; m_minHeightAboveGround = TheGlobalData->m_minCameraHeight; m_okToAdjustHeight = FALSE; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 2e142f6a54c..49909a61422 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -1944,15 +1944,13 @@ void W3DView::setHeightAboveGround(Real z) //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- +// TheSuperHackers @bugfix xezon 18/09/2025 setZoom is no longer clamped by a min and max zoom. +// Instead the min and max camera height will be clamped elsewhere. Clamping the zoom would cause +// issues with camera playback in replay playback where changes in terrain elevation would not raise +// the camera height. void W3DView::setZoom(Real z) { - m_zoom = z; - - if (m_zoom < m_minZoom) - m_zoom = m_minZoom; - - if (m_zoom > m_maxZoom) - m_zoom = m_maxZoom; + View::setZoom(z); m_doingMoveCameraOnWaypointPath = false; m_CameraArrivedAtWaypointOnPathFlag = false; From 113babd19dc9441ba858f294c17bdf9e2bbe15d2 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 20 Sep 2025 13:21:37 +0200 Subject: [PATCH 091/343] bugfix(view): Prevent moving the camera with most user inputs during camera playback in Replay playback (#1599) --- Generals/Code/GameEngine/Include/GameClient/View.h | 3 +++ Generals/Code/GameEngine/Source/GameClient/View.cpp | 8 ++++++++ .../Source/GameLogic/System/GameLogicDispatch.cpp | 3 +++ .../Source/W3DDevice/GameClient/W3DView.cpp | 4 ++++ GeneralsMD/Code/GameEngine/Include/GameClient/View.h | 3 +++ GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp | 8 ++++++++ .../Source/GameLogic/System/GameLogicDispatch.cpp | 3 +++ .../Source/W3DDevice/GameClient/W3DView.cpp | 4 ++++ 8 files changed, 36 insertions(+) diff --git a/Generals/Code/GameEngine/Include/GameClient/View.h b/Generals/Code/GameEngine/Include/GameClient/View.h index ae60609b1e0..0b426e64652 100644 --- a/Generals/Code/GameEngine/Include/GameClient/View.h +++ b/Generals/Code/GameEngine/Include/GameClient/View.h @@ -131,6 +131,7 @@ class View : public Snapshot virtual void setOrigin( Int x, Int y) { m_originX=x; m_originY=y;} ///< Sets location of top-left view corner on display virtual void getOrigin( Int *x, Int *y) { *x=m_originX; *y=m_originY;} ///< Return location of top-left view corner on display + virtual void lockViewUntilFrame(UnsignedInt frame); ///< Locks the current view until the given frame is reached. virtual void forceRedraw() = 0; virtual void lookAt( const Coord3D *o ); ///< Center the view on the given coordinate @@ -255,6 +256,8 @@ class View : public Snapshot UnsignedInt m_id; ///< Rhe ID of this view static UnsignedInt m_idNext; ///< Used for allocating view ID's for all views + UnsignedInt m_viewLockedUntilFrame; + Coord3D m_pos; ///< Position of this view, in world coordinates Int m_width, m_height; ///< Dimensions of the view Int m_originX, m_originY; ///< Location of top/left view corner diff --git a/Generals/Code/GameEngine/Source/GameClient/View.cpp b/Generals/Code/GameEngine/Source/GameClient/View.cpp index c7c16c651ac..caddaedb75e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/View.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/View.cpp @@ -43,6 +43,7 @@ View::View( void ) { //Added By Sadullah Nader //Initialization(s) inserted + m_viewLockedUntilFrame = 0u; m_currentHeightAboveGround = 0.0f; m_defaultAngle = 0.0f; m_defaultPitchAngle = 0.0f; @@ -110,6 +111,8 @@ void View::reset( void ) { // Only fixing the reported bug. Who knows what side effects resetting the rest could have. m_zoomLimited = TRUE; + + m_viewLockedUntilFrame = 0u; } /** @@ -126,6 +129,11 @@ void View::zoom( Real height ) setHeightAboveGround(getHeightAboveGround() + height); } +void View::lockViewUntilFrame(UnsignedInt frame) +{ + m_viewLockedUntilFrame = frame; +} + /** * Center the view on the given coordinate. */ diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index b2f16ae9fcc..3ffbd73acd3 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -1873,6 +1873,9 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) loc.init(pos.x, pos.y, pos.z, angle, pitch, zoom); TheTacticalView->setLocation( &loc ); + // TheSuperHackers @fix xezon 18/09/2025 Lock the new location to avoid user input from changing the camera in this frame. + TheTacticalView->lockViewUntilFrame( getFrame() + 1 ); + if (!TheLookAtTranslator->hasMouseMovedRecently()) { TheMouse->setCursor( (Mouse::MouseCursor)(msg->getArgument( 4 )->integer) ); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 5e9875b3d70..5e80699000c 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -413,6 +413,10 @@ void W3DView::setCameraTransform( void ) { if (TheGlobalData->m_headless) return; + + if (m_viewLockedUntilFrame > TheGameClient->getFrame()) + return; + m_cameraHasMovedSinceRequest = true; Matrix3D cameraTransform( 1 ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/View.h b/GeneralsMD/Code/GameEngine/Include/GameClient/View.h index b204b908e11..d78c3884247 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/View.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/View.h @@ -131,6 +131,7 @@ class View : public Snapshot virtual void setOrigin( Int x, Int y) { m_originX=x; m_originY=y;} ///< Sets location of top-left view corner on display virtual void getOrigin( Int *x, Int *y) { *x=m_originX; *y=m_originY;} ///< Return location of top-left view corner on display + virtual void lockViewUntilFrame(UnsignedInt frame); ///< Locks the current view until the given frame is reached. virtual void forceRedraw() = 0; virtual void lookAt( const Coord3D *o ); ///< Center the view on the given coordinate @@ -259,6 +260,8 @@ class View : public Snapshot UnsignedInt m_id; ///< Rhe ID of this view static UnsignedInt m_idNext; ///< Used for allocating view ID's for all views + UnsignedInt m_viewLockedUntilFrame; + Coord3D m_pos; ///< Position of this view, in world coordinates Int m_width, m_height; ///< Dimensions of the view Int m_originX, m_originY; ///< Location of top/left view corner diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp index 7d49cb9a7f0..f32bdc71575 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp @@ -43,6 +43,7 @@ View::View( void ) { //Added By Sadullah Nader //Initialization(s) inserted + m_viewLockedUntilFrame = 0u; m_currentHeightAboveGround = 0.0f; m_defaultAngle = 0.0f; m_defaultPitchAngle = 0.0f; @@ -110,6 +111,8 @@ void View::reset( void ) { // Only fixing the reported bug. Who knows what side effects resetting the rest could have. m_zoomLimited = TRUE; + + m_viewLockedUntilFrame = 0u; } /** @@ -126,6 +129,11 @@ void View::zoom( Real height ) setHeightAboveGround(getHeightAboveGround() + height); } +void View::lockViewUntilFrame(UnsignedInt frame) +{ + m_viewLockedUntilFrame = frame; +} + /** * Center the view on the given coordinate. */ diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index 03722719892..889b7a3ca53 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -1901,6 +1901,9 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) loc.init(pos.x, pos.y, pos.z, angle, pitch, zoom); TheTacticalView->setLocation( &loc ); + // TheSuperHackers @fix xezon 18/09/2025 Lock the new location to avoid user input from changing the camera in this frame. + TheTacticalView->lockViewUntilFrame( getFrame() + 1 ); + if (!TheLookAtTranslator->hasMouseMovedRecently()) { TheMouse->setCursor( (Mouse::MouseCursor)(msg->getArgument( 4 )->integer) ); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 49909a61422..c4e22165672 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -544,6 +544,10 @@ void W3DView::setCameraTransform( void ) { if (TheGlobalData->m_headless) return; + + if (m_viewLockedUntilFrame > TheGameClient->getFrame()) + return; + m_cameraHasMovedSinceRequest = true; Matrix3D cameraTransform( 1 ); From a8f69559a01d90d32eeebf5561bcc8df2783ebcb Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 20 Sep 2025 13:21:54 +0200 Subject: [PATCH 092/343] bugfix(input): Force stop camera inputs after game end (#1602) --- .../GameEngine/Source/GameClient/InGameUI.cpp | 26 +++++++++++------- .../GameEngine/Source/GameClient/InGameUI.cpp | 27 ++++++++++++------- 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index 616d2fca861..a5a63252a41 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -694,7 +694,7 @@ void InGameUI::setSuperweaponDisplayEnabledByScript(Bool enable) // ------------------------------------------------------------------------------------------------ Bool InGameUI::getSuperweaponDisplayEnabledByScript(void) const { - return m_superweaponHiddenByScript; + return !m_superweaponHiddenByScript; } // ------------------------------------------------------------------------------------------------ @@ -1932,13 +1932,13 @@ void InGameUI::reset( void ) m_namedTimers.clear(); m_namedTimerLastFlashFrame = 0; m_namedTimerUsedFlashColor = TRUE; // so next one is false - m_showNamedTimers = TRUE; + showNamedTimerDisplay(true); removeMilitarySubtitle(); clearPopupMessageData(); m_superweaponLastFlashFrame = 0; m_superweaponUsedFlashColor = TRUE; // so next one is false - m_superweaponHiddenByScript = FALSE; + setSuperweaponDisplayEnabledByScript(true); clearFloatingText(); clearWorldAnimations(); @@ -1953,12 +1953,20 @@ void InGameUI::reset( void ) } - m_waypointMode = false; - m_forceAttackMode = false; - m_forceMoveToMode = false; - m_attackMoveToMode = false; - m_preferSelection = false; - m_clientQuiet = false; + setClientQuiet(false); + setWaypointMode(false); + setForceMoveMode(false); + setForceAttackMode(false); + setPreferSelectionMode(false); + clearAttackMoveToMode(); + + // TheSuperHackers @bugfix Disable all camera interactions to prevent them getting stuck after game end. + setScrolling(false); + setSelecting(false); + setCameraRotateLeft(false); + setCameraRotateRight(false); + setCameraZoomIn(false); + setCameraZoomOut(false); m_windowLayouts.clear(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index 1696a7a00e3..8915cb3edff 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -718,7 +718,7 @@ void InGameUI::setSuperweaponDisplayEnabledByScript(Bool enable) // ------------------------------------------------------------------------------------------------ Bool InGameUI::getSuperweaponDisplayEnabledByScript(void) const { - return m_superweaponHiddenByScript; + return !m_superweaponHiddenByScript; } // ------------------------------------------------------------------------------------------------ @@ -1988,13 +1988,13 @@ void InGameUI::reset( void ) m_namedTimers.clear(); m_namedTimerLastFlashFrame = 0; m_namedTimerUsedFlashColor = TRUE; // so next one is false - m_showNamedTimers = TRUE; + showNamedTimerDisplay(true); removeMilitarySubtitle(); clearPopupMessageData(); m_superweaponLastFlashFrame = 0; m_superweaponUsedFlashColor = TRUE; // so next one is false - m_superweaponHiddenByScript = FALSE; + setSuperweaponDisplayEnabledByScript(true); clearFloatingText(); clearWorldAnimations(); @@ -2009,12 +2009,21 @@ void InGameUI::reset( void ) } - m_waypointMode = false; - m_forceAttackMode = false; - m_forceMoveToMode = false; - m_attackMoveToMode = false; - m_preferSelection = false; - m_clientQuiet = false; + setClientQuiet(false); + setWaypointMode(false); + setForceMoveMode(false); + setForceAttackMode(false); + setPreferSelectionMode(false); + clearAttackMoveToMode(); + + // TheSuperHackers @bugfix Disable all camera interactions to prevent them getting stuck after game end. + setScrolling(false); + setSelecting(false); + setCameraRotateLeft(false); + setCameraRotateRight(false); + setCameraZoomIn(false); + setCameraZoomOut(false); + setCameraTrackingDrawable(false); m_windowLayouts.clear(); From 9385483156981c098347e97e79c962756367b710 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 20 Sep 2025 19:52:36 +0200 Subject: [PATCH 093/343] bugfix(shadow): Fix missing tree shadow decals when no object shadow decals exist (#1590) --- .../W3DDevice/GameClient/W3DProjectedShadow.h | 10 ++- .../GameClient/Drawable/Draw/W3DModelDraw.cpp | 4 +- .../GameClient/Shadow/W3DProjectedShadow.cpp | 73 ++++++++++--------- .../W3DDevice/GameClient/Shadow/W3DShadow.cpp | 6 ++ .../Source/W3DDevice/GameClient/W3DScene.cpp | 5 ++ .../W3DDevice/GameClient/W3DProjectedShadow.h | 10 ++- .../GameClient/Drawable/Draw/W3DModelDraw.cpp | 4 +- .../GameClient/Shadow/W3DProjectedShadow.cpp | 73 ++++++++++--------- .../W3DDevice/GameClient/Shadow/W3DShadow.cpp | 6 ++ .../Source/W3DDevice/GameClient/W3DScene.cpp | 5 ++ .../W3DDevice/GameClient/W3DTreeBuffer.cpp | 4 +- 11 files changed, 126 insertions(+), 74 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h index 0281c53c912..dc1bb3c4084 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h @@ -57,6 +57,7 @@ class W3DProjectedShadowManager : public ProjectedShadowManager Bool init(void); ///getShadowSizeY(); shadowInfo.m_offsetX = tmplate->getShadowOffsetX(); shadowInfo.m_offsetY = tmplate->getShadowOffsetY(); - m_shadow = TheW3DShadowManager->addShadow(m_renderObject, &shadowInfo, draw); + + DEBUG_ASSERTCRASH(m_shadow == NULL, ("m_shadow is not NULL")); + m_shadow = TheW3DShadowManager->addShadow(m_renderObject, &shadowInfo, draw); if (m_shadow) { m_shadow->enableShadowInvisible(m_fullyObscuredByShroud); m_shadow->enableShadowRender(m_shadowEnabled); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp index 7014a309f92..b9f1b3d2dbd 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp @@ -88,12 +88,6 @@ extern int nShadowStartBatchIndex; extern int SHADOW_VERTEX_SIZE; extern int SHADOW_INDEX_SIZE; -//Bounding rectangle around rendered portion of terrain. -static Int drawEdgeX=0; -static Int drawEdgeY=0; -static Int drawStartX=0; -static Int drawStartY=0; - //Global streaming vertex buffer with x,y,z,u,v type. struct SHADOW_DECAL_VERTEX //vertex structure passed to D3D { @@ -215,6 +209,10 @@ W3DProjectedShadowManager::W3DProjectedShadowManager(void) m_W3DShadowTextureManager = NULL; m_shadowCamera = NULL; m_shadowContext= NULL; + m_drawEdgeX = 0; + m_drawEdgeY = 0; + m_drawStartX = 0; + m_drawStartY = 0; } W3DProjectedShadowManager::~W3DProjectedShadowManager(void) @@ -959,15 +957,15 @@ void W3DProjectedShadowManager::queueDecal(W3DProjectedShadow *shadow) Int startY=REAL_TO_INT_FLOOR(((objPos.Y+min_y)*mapScaleInv)) + borderSize; Int endY=REAL_TO_INT_CEIL(((objPos.Y+max_y)*mapScaleInv)) + borderSize; - startX = __max(startX,drawStartX); - startX = __min(startX,drawEdgeX); - startY = __max(startY,drawStartY); - startY = __min(startY,drawEdgeY); + startX = __max(startX,m_drawStartX); + startX = __min(startX,m_drawEdgeX); + startY = __max(startY,m_drawStartY); + startY = __min(startY,m_drawEdgeY); - endX = __max(endX,drawStartX); - endX = __min(endX,drawEdgeX); - endY = __max(endY,drawStartY); - endY = __min(endY,drawEdgeY); + endX = __max(endX,m_drawStartX); + endX = __min(endX,m_drawEdgeX); + endY = __max(endY,m_drawStartY); + endY = __min(endY,m_drawEdgeY); //Check if decal too large to fit inside 65536 index buffer. //try clipping each direction to < 104 since that's more than @@ -1276,33 +1274,40 @@ void W3DProjectedShadowManager::queueSimpleDecal(W3DProjectedShadow *shadow) } +void W3DProjectedShadowManager::prepareShadows() +{ + if (!TheTerrainRenderObject) + return; + + WorldHeightMap *hmap=TheTerrainRenderObject->getMap(); + + if (!hmap) + return; + + //Find extents of visible terrain + m_drawEdgeY=hmap->getDrawOrgY()+hmap->getDrawHeight()-1; + m_drawEdgeX=hmap->getDrawOrgX()+hmap->getDrawWidth()-1; + if (m_drawEdgeX > (hmap->getXExtent()-1)) + m_drawEdgeX = hmap->getXExtent()-1; + if (m_drawEdgeY > (hmap->getYExtent()-1)) + m_drawEdgeY = hmap->getYExtent()-1; + m_drawStartX=hmap->getDrawOrgX(); + m_drawStartY=hmap->getDrawOrgY(); +} + Int W3DProjectedShadowManager::renderShadows(RenderInfoClass & rinfo) { - ///@todo: implement this method. - W3DProjectedShadow *shadow; - static AABoxClass aaBox; - static SphereClass sphere; Int projectionCount=0; + if (!TheTerrainRenderObject) + return projectionCount; + if (!m_shadowList && !m_decalList) return projectionCount; //there are no shadows to render. - //Find extents of visible terrain - if (TheTerrainRenderObject) - { - WorldHeightMap *hmap=TheTerrainRenderObject->getMap(); - - drawEdgeY=hmap->getDrawOrgY()+hmap->getDrawHeight()-1; - drawEdgeX=hmap->getDrawOrgX()+hmap->getDrawWidth()-1; - if (drawEdgeX > (hmap->getXExtent()-1)) - drawEdgeX = hmap->getXExtent()-1; - if (drawEdgeY > (hmap->getYExtent()-1)) - drawEdgeY = hmap->getYExtent()-1; - drawStartX=hmap->getDrawOrgX(); - drawStartY=hmap->getDrawOrgY(); - } - else - return projectionCount; + W3DProjectedShadow *shadow; + static AABoxClass aaBox; + static SphereClass sphere; //According to Nvidia there's a D3D bug that happens if you don't start with a //new dynamic VB each frame - so we force a DISCARD by overflowing the counter. diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp index c87fd141cb0..9e5b24fee57 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp @@ -63,6 +63,12 @@ Vector3 LightPosWorld[ MAX_SHADOW_LIGHTS ] = Vector3( 94.0161f, 50.499f, 200.0f) }; +void PrepareShadows() +{ + if (TheW3DProjectedShadowManager) + TheW3DProjectedShadowManager->prepareShadows(); +} + //DECLARE_PERF_TIMER(shadowsRender) void DoShadows(RenderInfoClass & rinfo, Bool stencilPass) { diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp index 48c5f4f5dac..a20c12bc111 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp @@ -68,6 +68,7 @@ // DEFINITIONS //////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// ///@todo: Remove these globals since we no longer need W3D to call them for us. +extern void PrepareShadows(); extern void DoTrees(RenderInfoClass & rinfo); extern void DoShadows(RenderInfoClass & rinfo, Bool stencilPass); extern void DoParticles(RenderInfoClass & rinfo); @@ -789,6 +790,10 @@ void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, I /**Draw everything that was submitted from this scene*/ void RTS3DScene::Flush(RenderInfoClass & rinfo) { + // TheSuperHackers @bugfix Now always prepares shadows to guarantee correct state before doing any + // shadow draw calls. Originally just drawing shadows for trees would not properly prepare shadows. + PrepareShadows(); + //don't draw shadows in this mode because they interfere with destination alpha or are invisible (wireframe) if (m_customPassMode == SCENE_PASS_DEFAULT && Get_Extra_Pass_Polygon_Mode() == EXTRA_PASS_DISABLE) DoShadows(rinfo, false); //draw all non-stencil shadows (decals) since they fall under other objects. diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h index ef86c77f3d9..155f2efc451 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h @@ -57,6 +57,7 @@ class W3DProjectedShadowManager : public ProjectedShadowManager Bool init(void); ///getShadowSizeY(); shadowInfo.m_offsetX = tmplate->getShadowOffsetX(); shadowInfo.m_offsetY = tmplate->getShadowOffsetY(); - m_shadow = TheW3DShadowManager->addShadow(m_renderObject, &shadowInfo, draw); + + DEBUG_ASSERTCRASH(m_shadow == NULL, ("m_shadow is not NULL")); + m_shadow = TheW3DShadowManager->addShadow(m_renderObject, &shadowInfo, draw); if (m_shadow) { m_shadow->enableShadowInvisible(m_fullyObscuredByShroud); m_shadow->enableShadowRender(m_shadowEnabled); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp index 3bfb20da09f..b112d5d17d6 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp @@ -88,12 +88,6 @@ extern int nShadowStartBatchIndex; extern int SHADOW_VERTEX_SIZE; extern int SHADOW_INDEX_SIZE; -//Bounding rectangle around rendered portion of terrain. -static Int drawEdgeX=0; -static Int drawEdgeY=0; -static Int drawStartX=0; -static Int drawStartY=0; - //Global streaming vertex buffer with x,y,z,u,v type. struct SHADOW_DECAL_VERTEX //vertex structure passed to D3D { @@ -215,6 +209,10 @@ W3DProjectedShadowManager::W3DProjectedShadowManager(void) m_W3DShadowTextureManager = NULL; m_shadowCamera = NULL; m_shadowContext= NULL; + m_drawEdgeX = 0; + m_drawEdgeY = 0; + m_drawStartX = 0; + m_drawStartY = 0; } W3DProjectedShadowManager::~W3DProjectedShadowManager(void) @@ -959,15 +957,15 @@ void W3DProjectedShadowManager::queueDecal(W3DProjectedShadow *shadow) Int startY=REAL_TO_INT_FLOOR(((objPos.Y+min_y)*mapScaleInv)) + borderSize; Int endY=REAL_TO_INT_CEIL(((objPos.Y+max_y)*mapScaleInv)) + borderSize; - startX = __max(startX,drawStartX); - startX = __min(startX,drawEdgeX); - startY = __max(startY,drawStartY); - startY = __min(startY,drawEdgeY); + startX = __max(startX,m_drawStartX); + startX = __min(startX,m_drawEdgeX); + startY = __max(startY,m_drawStartY); + startY = __min(startY,m_drawEdgeY); - endX = __max(endX,drawStartX); - endX = __min(endX,drawEdgeX); - endY = __max(endY,drawStartY); - endY = __min(endY,drawEdgeY); + endX = __max(endX,m_drawStartX); + endX = __min(endX,m_drawEdgeX); + endY = __max(endY,m_drawStartY); + endY = __min(endY,m_drawEdgeY); //Check if decal too large to fit inside 65536 index buffer. //try clipping each direction to < 104 since that's more than @@ -1276,33 +1274,40 @@ void W3DProjectedShadowManager::queueSimpleDecal(W3DProjectedShadow *shadow) } +void W3DProjectedShadowManager::prepareShadows() +{ + if (!TheTerrainRenderObject) + return; + + WorldHeightMap *hmap=TheTerrainRenderObject->getMap(); + + if (!hmap) + return; + + //Find extents of visible terrain + m_drawEdgeY=hmap->getDrawOrgY()+hmap->getDrawHeight()-1; + m_drawEdgeX=hmap->getDrawOrgX()+hmap->getDrawWidth()-1; + if (m_drawEdgeX > (hmap->getXExtent()-1)) + m_drawEdgeX = hmap->getXExtent()-1; + if (m_drawEdgeY > (hmap->getYExtent()-1)) + m_drawEdgeY = hmap->getYExtent()-1; + m_drawStartX=hmap->getDrawOrgX(); + m_drawStartY=hmap->getDrawOrgY(); +} + Int W3DProjectedShadowManager::renderShadows(RenderInfoClass & rinfo) { - ///@todo: implement this method. - W3DProjectedShadow *shadow; - static AABoxClass aaBox; - static SphereClass sphere; Int projectionCount=0; + if (!TheTerrainRenderObject) + return projectionCount; + if (!m_shadowList && !m_decalList) return projectionCount; //there are no shadows to render. - //Find extents of visible terrain - if (TheTerrainRenderObject) - { - WorldHeightMap *hmap=TheTerrainRenderObject->getMap(); - - drawEdgeY=hmap->getDrawOrgY()+hmap->getDrawHeight()-1; - drawEdgeX=hmap->getDrawOrgX()+hmap->getDrawWidth()-1; - if (drawEdgeX > (hmap->getXExtent()-1)) - drawEdgeX = hmap->getXExtent()-1; - if (drawEdgeY > (hmap->getYExtent()-1)) - drawEdgeY = hmap->getYExtent()-1; - drawStartX=hmap->getDrawOrgX(); - drawStartY=hmap->getDrawOrgY(); - } - else - return projectionCount; + W3DProjectedShadow *shadow; + static AABoxClass aaBox; + static SphereClass sphere; //According to Nvidia there's a D3D bug that happens if you don't start with a //new dynamic VB each frame - so we force a DISCARD by overflowing the counter. diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp index 1db6dab0d59..4f2096efa7f 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp @@ -63,6 +63,12 @@ Vector3 LightPosWorld[ MAX_SHADOW_LIGHTS ] = Vector3( 94.0161f, 50.499f, 200.0f) }; +void PrepareShadows() +{ + if (TheW3DProjectedShadowManager) + TheW3DProjectedShadowManager->prepareShadows(); +} + //DECLARE_PERF_TIMER(shadowsRender) void DoShadows(RenderInfoClass & rinfo, Bool stencilPass) { diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp index 7c815982fe4..5bdbe1ab5a0 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp @@ -69,6 +69,7 @@ // DEFINITIONS //////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// ///@todo: Remove these globals since we no longer need W3D to call them for us. +extern void PrepareShadows(); extern void DoTrees(RenderInfoClass & rinfo); extern void DoShadows(RenderInfoClass & rinfo, Bool stencilPass); extern void DoParticles(RenderInfoClass & rinfo); @@ -827,6 +828,10 @@ void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, I /**Draw everything that was submitted from this scene*/ void RTS3DScene::Flush(RenderInfoClass & rinfo) { + // TheSuperHackers @bugfix Now always prepares shadows to guarantee correct state before doing any + // shadow draw calls. Originally just drawing shadows for trees would not properly prepare shadows. + PrepareShadows(); + //don't draw shadows in this mode because they interfere with destination alpha or are invisible (wireframe) if (m_customPassMode == SCENE_PASS_DEFAULT && Get_Extra_Pass_Polygon_Mode() == EXTRA_PASS_DISABLE) DoShadows(rinfo, false); //draw all non-stencil shadows (decals) since they fall under other objects. diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp index 48d2470b696..e418aaef20b 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp @@ -1604,12 +1604,12 @@ void W3DTreeBuffer::drawTrees(CameraClass * camera, RefRenderObjListIterator *pD if (!m_trees[curTree].visible || !m_treeTypes[type].m_doShadow) { continue; } - Real factor = 1.0f; + if (m_trees[curTree].m_toppleState == TOPPLE_FALLING || m_trees[curTree].m_toppleState == TOPPLE_DOWN) { continue; } - m_shadow->setSize(m_treeTypes[type].m_shadowSize, -m_treeTypes[type].m_shadowSize*factor); + m_shadow->setSize(m_treeTypes[type].m_shadowSize, m_treeTypes[type].m_shadowSize); m_shadow->setPosition(m_trees[curTree].location.X, m_trees[curTree].location.Y, m_trees[curTree].location.Z); TheW3DProjectedShadowManager->queueDecal(m_shadow); } From c0f8b79f1e2df7435f48fffaa443d9046279fe4e Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 20 Sep 2025 20:06:31 +0200 Subject: [PATCH 094/343] fix(shadow): Fix initial shadow states of draw modules (#1591) --- .../GameEngine/Include/Common/ThingFactory.h | 2 +- .../GameEngine/Include/GameClient/Drawable.h | 10 +++++++--- .../GameEngine/Include/GameClient/GameClient.h | 2 +- .../Source/Common/Thing/ThingFactory.cpp | 2 +- .../GameEngine/Source/GameClient/Drawable.cpp | 16 +++++++++++++++- .../GameEngine/Source/GameClient/InGameUI.cpp | 4 ++-- .../W3DDevice/GameClient/W3DGameClient.h | 2 +- .../W3DDevice/GameClient/W3DGameClient.cpp | 2 +- .../GameEngine/Include/Common/ThingFactory.h | 2 +- .../GameEngine/Include/GameClient/Drawable.h | 10 +++++++--- .../GameEngine/Include/GameClient/GameClient.h | 2 +- .../Source/Common/Thing/ThingFactory.cpp | 2 +- .../GameEngine/Source/GameClient/Drawable.cpp | 17 ++++++++++++++++- .../GameEngine/Source/GameClient/InGameUI.cpp | 4 ++-- .../Source/GameLogic/System/GameLogic.cpp | 5 ++--- .../W3DDevice/GameClient/W3DGameClient.h | 2 +- .../W3DDevice/GameClient/W3DGameClient.cpp | 2 +- 17 files changed, 61 insertions(+), 25 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/ThingFactory.h b/Generals/Code/GameEngine/Include/Common/ThingFactory.h index 69909b5713c..a6dd2b3d30a 100644 --- a/Generals/Code/GameEngine/Include/Common/ThingFactory.h +++ b/Generals/Code/GameEngine/Include/Common/ThingFactory.h @@ -92,7 +92,7 @@ class ThingFactory : public SubsystemInterface /** request a new drawable using the given template. this will throw an exception on failure; it will never return null. */ - Drawable *newDrawable(const ThingTemplate *tmplate, DrawableStatus statusBits = DRAWABLE_STATUS_NONE ); + Drawable *newDrawable(const ThingTemplate *tmplate, DrawableStatusBits statusBits = DRAWABLE_STATUS_DEFAULT ); static void parseObjectDefinition( INI* ini, const AsciiString& name, const AsciiString& reskinFrom ); diff --git a/Generals/Code/GameEngine/Include/GameClient/Drawable.h b/Generals/Code/GameEngine/Include/GameClient/Drawable.h index 42a48f9eee8..8807b3930e8 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Drawable.h +++ b/Generals/Code/GameEngine/Include/GameClient/Drawable.h @@ -225,7 +225,8 @@ enum StealthLookType CPP_11(: Int) // ------------------------------------------------------------------------------------------------ /** Drawable status bits */ // ------------------------------------------------------------------------------------------------ -enum DrawableStatus CPP_11(: Int) +typedef UnsignedInt DrawableStatusBits; +enum DrawableStatus CPP_11(: DrawableStatusBits) { DRAWABLE_STATUS_NONE = 0x00000000, ///< no status DRAWABLE_STATUS_DRAWS_IN_MIRROR = 0x00000001, ///< drawable can reflect @@ -233,6 +234,8 @@ enum DrawableStatus CPP_11(: Int) DRAWABLE_STATUS_TINT_COLOR_LOCKED = 0x00000004, ///< drawable tint color is "locked" and won't fade to normal DRAWABLE_STATUS_NO_STATE_PARTICLES = 0x00000008, ///< do *not* auto-create particle systems based on model condition DRAWABLE_STATUS_NO_SAVE = 0x00000010, ///< do *not* save this drawable (UI fluff only). ignored (error, actually) if attached to an object + + DRAWABLE_STATUS_DEFAULT = DRAWABLE_STATUS_SHADOWS, }; enum TintStatus CPP_11(: Int) @@ -283,7 +286,7 @@ class Drawable : public Thing, public: - Drawable( const ThingTemplate *thing, DrawableStatus statusBits = DRAWABLE_STATUS_NONE ); + Drawable( const ThingTemplate *thing, DrawableStatusBits statusBits = DRAWABLE_STATUS_DEFAULT ); void onDestroy( void ); ///< run from GameClient::destroyDrawable @@ -346,6 +349,7 @@ class Drawable : public Thing, ClientUpdateModule const** getClientUpdateModules() const { return (ClientUpdateModule const**)getModuleList(MODULETYPE_CLIENT_UPDATE); } ClientUpdateModule* findClientUpdateModule( NameKeyType key ); + // never returns null DrawModule** getDrawModules(); DrawModule const** getDrawModules() const; @@ -628,7 +632,7 @@ class Drawable : public Thing, Drawable *m_nextDrawable; Drawable *m_prevDrawable; ///< list links - UnsignedInt m_status; ///< status bits (see DrawableStatus enum) + DrawableStatusBits m_status; ///< status bits (see DrawableStatus enum) UnsignedInt m_tintStatus; ///< tint color status bits (see TintStatus enum) UnsignedInt m_prevTintStatus;///< for edge testing with m_tintStatus diff --git a/Generals/Code/GameEngine/Include/GameClient/GameClient.h b/Generals/Code/GameEngine/Include/GameClient/GameClient.h index c6ae2ae8396..85e378094a3 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GameClient.h +++ b/Generals/Code/GameEngine/Include/GameClient/GameClient.h @@ -126,7 +126,7 @@ class GameClient : public SubsystemInterface, virtual void iterateDrawablesInRegion( Region3D *region, GameClientFuncPtr userFunc, void *userData ); ///< Calls userFunc for each drawable contained within the region - virtual Drawable *friend_createDrawable( const ThingTemplate *thing, DrawableStatus statusBits = DRAWABLE_STATUS_NONE ) = 0; + virtual Drawable *friend_createDrawable( const ThingTemplate *thing, DrawableStatusBits statusBits = DRAWABLE_STATUS_DEFAULT ) = 0; virtual void destroyDrawable( Drawable *draw ); ///< Destroy the given drawable virtual void setTimeOfDay( TimeOfDay tod ); ///< Tell all the drawables what time of day it is now diff --git a/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp b/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp index 5b90ed07ad6..b139b81f348 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp @@ -343,7 +343,7 @@ Object *ThingFactory::newObject( const ThingTemplate *tmplate, Team *team, Objec } //============================================================================= -Drawable *ThingFactory::newDrawable(const ThingTemplate *tmplate, DrawableStatus statusBits) +Drawable *ThingFactory::newDrawable(const ThingTemplate *tmplate, DrawableStatusBits statusBits) { if (tmplate == NULL) throw ERROR_BAD_ARG; diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index 3d85bef2b69..04dfd91e83d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -308,7 +308,7 @@ void Drawable::saturateRGB(RGBColor& color, Real factor) * graphical side of a logical object, whereas GameLogic objects encapsulate * behaviors and physics. */ //------------------------------------------------------------------------------------------------- -Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatus statusBits ) +Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusBits statusBits ) : Thing( thingTemplate ) { @@ -459,6 +459,14 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatus statusBit (*m)->onObjectCreated(); } + const Bool shadowsEnabled = getShadowsEnabled(); + + // TheSuperHackers @fix xezon 14/09/2025 Match the shadow states of all draw modules with this drawable. + for (DrawModule** dm = (DrawModule**)getModuleList(MODULETYPE_DRAW); *dm; ++dm) + { + (*dm)->setShadowsEnabled(shadowsEnabled); + } + m_groupNumber = NULL; m_captionDisplayString = NULL; m_drawableInfo.m_drawable = this; @@ -3464,6 +3472,7 @@ void Drawable::clearAndSetModelConditionState( ModelConditionFlagType clr, Model DrawModule** Drawable::getDrawModules() { DrawModule** dm = (DrawModule**)getModuleList(MODULETYPE_DRAW); + #ifdef DIRTY_CONDITION_FLAGS if (m_isModelDirty) { @@ -3486,6 +3495,8 @@ DrawModule** Drawable::getDrawModules() } } #endif + + DEBUG_ASSERTCRASH(dm != NULL, ("Draw Module List is not expected NULL")); return dm; } @@ -3493,6 +3504,7 @@ DrawModule** Drawable::getDrawModules() DrawModule const** Drawable::getDrawModules() const { DrawModule const** dm = (DrawModule const**)getModuleList(MODULETYPE_DRAW); + #ifdef DIRTY_CONDITION_FLAGS if (m_isModelDirty) { @@ -3516,6 +3528,8 @@ DrawModule const** Drawable::getDrawModules() const } } #endif + + DEBUG_ASSERTCRASH(dm != NULL, ("Draw Module List is not expected NULL")); return dm; } diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index a5a63252a41..ca527d40a0c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -1529,7 +1529,7 @@ void InGameUI::handleBuildPlacements( void ) if( m_placeIcon[ i ] == NULL ) m_placeIcon[ i ] = TheThingFactory->newDrawable( m_pendingPlaceType, - DRAWABLE_STATUS_NO_STATE_PARTICLES ); + DRAWABLE_STATUS_SHADOWS | DRAWABLE_STATUS_NO_STATE_PARTICLES ); } @@ -3040,7 +3040,7 @@ void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildD // TheInGameUI->deselectAllDrawables(); // create a drawble of what we are building to be "attached" at the cursor - draw = TheThingFactory->newDrawable( build, DRAWABLE_STATUS_NO_STATE_PARTICLES ); + draw = TheThingFactory->newDrawable( build, DRAWABLE_STATUS_SHADOWS | DRAWABLE_STATUS_NO_STATE_PARTICLES ); if (sourceObject) { if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT) diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h index 734435caff4..f7bdb9e4a29 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h @@ -74,7 +74,7 @@ class W3DGameClient : public GameClient virtual ~W3DGameClient(); /// given a type, create a drawable - virtual Drawable *friend_createDrawable( const ThingTemplate *thing, DrawableStatus statusBits = DRAWABLE_STATUS_NONE ); + virtual Drawable *friend_createDrawable( const ThingTemplate *thing, DrawableStatusBits statusBits = DRAWABLE_STATUS_DEFAULT ); virtual void init( void ); ///< initialize resources virtual void update( void ); ///< per frame update diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp index 0b9cdc576c9..c8ca17e7ede 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp @@ -115,7 +115,7 @@ void W3DGameClient::reset( void ) * in the GameLogic and GameClient themselves */ //------------------------------------------------------------------------------------------------- Drawable *W3DGameClient::friend_createDrawable( const ThingTemplate *tmplate, - DrawableStatus statusBits ) + DrawableStatusBits statusBits ) { Drawable *draw = NULL; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ThingFactory.h b/GeneralsMD/Code/GameEngine/Include/Common/ThingFactory.h index ea8734dd2b9..281b6668555 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/ThingFactory.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/ThingFactory.h @@ -92,7 +92,7 @@ class ThingFactory : public SubsystemInterface /** request a new drawable using the given template. this will throw an exception on failure; it will never return null. */ - Drawable *newDrawable(const ThingTemplate *tmplate, DrawableStatus statusBits = DRAWABLE_STATUS_NONE ); + Drawable *newDrawable(const ThingTemplate *tmplate, DrawableStatusBits statusBits = DRAWABLE_STATUS_DEFAULT ); static void parseObjectDefinition( INI* ini, const AsciiString& name, const AsciiString& reskinFrom ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h index 428868e900f..868a189584e 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h @@ -228,7 +228,8 @@ enum StealthLookType CPP_11(: Int) // ------------------------------------------------------------------------------------------------ /** Drawable status bits */ // ------------------------------------------------------------------------------------------------ -enum DrawableStatus CPP_11(: Int) +typedef UnsignedInt DrawableStatusBits; +enum DrawableStatus CPP_11(: DrawableStatusBits) { DRAWABLE_STATUS_NONE = 0x00000000, ///< no status DRAWABLE_STATUS_DRAWS_IN_MIRROR = 0x00000001, ///< drawable can reflect @@ -236,6 +237,8 @@ enum DrawableStatus CPP_11(: Int) DRAWABLE_STATUS_TINT_COLOR_LOCKED = 0x00000004, ///< drawable tint color is "locked" and won't fade to normal DRAWABLE_STATUS_NO_STATE_PARTICLES = 0x00000008, ///< do *not* auto-create particle systems based on model condition DRAWABLE_STATUS_NO_SAVE = 0x00000010, ///< do *not* save this drawable (UI fluff only). ignored (error, actually) if attached to an object + + DRAWABLE_STATUS_DEFAULT = DRAWABLE_STATUS_SHADOWS, }; enum TintStatus CPP_11(: Int) @@ -291,7 +294,7 @@ class Drawable : public Thing, public: - Drawable( const ThingTemplate *thing, DrawableStatus statusBits = DRAWABLE_STATUS_NONE ); + Drawable( const ThingTemplate *thing, DrawableStatusBits statusBits = DRAWABLE_STATUS_DEFAULT ); void onDestroy( void ); ///< run from GameClient::destroyDrawable void onLevelStart(); ///< run from GameLogic::startNewGame @@ -358,6 +361,7 @@ class Drawable : public Thing, ClientUpdateModule const** getClientUpdateModules() const { return (ClientUpdateModule const**)getModuleList(MODULETYPE_CLIENT_UPDATE); } ClientUpdateModule* findClientUpdateModule( NameKeyType key ); + // never returns null DrawModule** getDrawModulesNonDirty(); DrawModule** getDrawModules(); DrawModule const** getDrawModules() const; @@ -669,7 +673,7 @@ class Drawable : public Thing, DynamicAudioEventInfo *m_customSoundAmbientInfo; ///< If not NULL, info about the ambient sound to attach to this object - UnsignedInt m_status; ///< status bits (see DrawableStatus enum) + DrawableStatusBits m_status; ///< status bits (see DrawableStatus enum) UnsignedInt m_tintStatus; ///< tint color status bits (see TintStatus enum) UnsignedInt m_prevTintStatus;///< for edge testing with m_tintStatus diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h index 634b78545a3..5dbe06a7221 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h @@ -131,7 +131,7 @@ class GameClient : public SubsystemInterface, virtual void iterateDrawablesInRegion( Region3D *region, GameClientFuncPtr userFunc, void *userData ); ///< Calls userFunc for each drawable contained within the region - virtual Drawable *friend_createDrawable( const ThingTemplate *thing, DrawableStatus statusBits = DRAWABLE_STATUS_NONE ) = 0; + virtual Drawable *friend_createDrawable( const ThingTemplate *thing, DrawableStatusBits statusBits = DRAWABLE_STATUS_DEFAULT ) = 0; virtual void destroyDrawable( Drawable *draw ); ///< Destroy the given drawable virtual void setTimeOfDay( TimeOfDay tod ); ///< Tell all the drawables what time of day it is now diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp index f7dc54fb5a6..7c0ec94c3ae 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp @@ -346,7 +346,7 @@ Object *ThingFactory::newObject( const ThingTemplate *tmplate, Team *team, Objec } //============================================================================= -Drawable *ThingFactory::newDrawable(const ThingTemplate *tmplate, DrawableStatus statusBits) +Drawable *ThingFactory::newDrawable(const ThingTemplate *tmplate, DrawableStatusBits statusBits) { if (tmplate == NULL) throw ERROR_BAD_ARG; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index 46d261a6c00..795f98762b0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -341,7 +341,7 @@ void Drawable::saturateRGB(RGBColor& color, Real factor) * graphical side of a logical object, whereas GameLogic objects encapsulate * behaviors and physics. */ //------------------------------------------------------------------------------------------------- -Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatus statusBits ) +Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusBits statusBits ) : Thing( thingTemplate ) { @@ -494,6 +494,14 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatus statusBit (*m)->onObjectCreated(); } + const Bool shadowsEnabled = getShadowsEnabled(); + + // TheSuperHackers @fix xezon 14/09/2025 Match the shadow states of all draw modules with this drawable. + for (DrawModule** dm = (DrawModule**)getModuleList(MODULETYPE_DRAW); *dm; ++dm) + { + (*dm)->setShadowsEnabled(shadowsEnabled); + } + m_groupNumber = NULL; m_captionDisplayString = NULL; m_drawableInfo.m_drawable = this; @@ -3962,6 +3970,7 @@ void Drawable::clearAndSetModelConditionState( ModelConditionFlagType clr, Model DrawModule** Drawable::getDrawModulesNonDirty() { DrawModule** dm = (DrawModule**)getModuleList(MODULETYPE_DRAW); + DEBUG_ASSERTCRASH(dm != NULL, ("Draw Module List is not expected NULL")); return dm; } @@ -3969,6 +3978,7 @@ DrawModule** Drawable::getDrawModulesNonDirty() DrawModule** Drawable::getDrawModules() { DrawModule** dm = (DrawModule**)getModuleList(MODULETYPE_DRAW); + #ifdef DIRTY_CONDITION_FLAGS if (m_isModelDirty) { @@ -3991,6 +4001,8 @@ DrawModule** Drawable::getDrawModules() } } #endif + + DEBUG_ASSERTCRASH(dm != NULL, ("Draw Module List is not expected NULL")); return dm; } @@ -3998,6 +4010,7 @@ DrawModule** Drawable::getDrawModules() DrawModule const** Drawable::getDrawModules() const { DrawModule const** dm = (DrawModule const**)getModuleList(MODULETYPE_DRAW); + #ifdef DIRTY_CONDITION_FLAGS if (m_isModelDirty) { @@ -4021,6 +4034,8 @@ DrawModule const** Drawable::getDrawModules() const } } #endif + + DEBUG_ASSERTCRASH(dm != NULL, ("Draw Module List is not expected NULL")); return dm; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index 8915cb3edff..ac7104f221f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -1585,7 +1585,7 @@ void InGameUI::handleBuildPlacements( void ) if( m_placeIcon[ i ] == NULL ) m_placeIcon[ i ] = TheThingFactory->newDrawable( m_pendingPlaceType, - DRAWABLE_STATUS_NO_STATE_PARTICLES ); + DRAWABLE_STATUS_SHADOWS | DRAWABLE_STATUS_NO_STATE_PARTICLES ); } @@ -3120,7 +3120,7 @@ void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildD // TheInGameUI->deselectAllDrawables(); // create a drawble of what we are building to be "attached" at the cursor - draw = TheThingFactory->newDrawable( build, DRAWABLE_STATUS_NO_STATE_PARTICLES ); + draw = TheThingFactory->newDrawable( build, DRAWABLE_STATUS_SHADOWS | DRAWABLE_STATUS_NO_STATE_PARTICLES ); if (sourceObject) { if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 0b627ac5bd7..0e3e69606fc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -1849,7 +1849,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) if (thingTemplate->isKindOf(KINDOF_OPTIMIZED_TREE)) { // Opt trees and props just get drawables to tell the client about it, then deleted. jba [6/5/2003] // This way there is no logic object to slow down partition manager and core logic stuff. - Drawable *draw = TheThingFactory->newDrawable(thingTemplate, DRAWABLE_STATUS_NONE); + Drawable *draw = TheThingFactory->newDrawable(thingTemplate); if (draw) { draw->setOrientation(angle); draw->setPosition( &pos ); @@ -1900,8 +1900,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) if (thingTemplate->isKindOf(KINDOF_OPTIMIZED_TREE)) { // Opt trees and props just get drawables to tell the client about it, then deleted. jba [6/5/2003] // This way there is no logic object to slow down partition manager and core logic stuff. - - Drawable *draw = TheThingFactory->newDrawable(thingTemplate, DRAWABLE_STATUS_NONE); + Drawable *draw = TheThingFactory->newDrawable(thingTemplate); if (draw) { draw->setOrientation(angle); draw->setPosition( &pos ); diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h index efad9b294de..83d24ddb956 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h @@ -78,7 +78,7 @@ class W3DGameClient : public GameClient virtual ~W3DGameClient(); /// given a type, create a drawable - virtual Drawable *friend_createDrawable( const ThingTemplate *thing, DrawableStatus statusBits = DRAWABLE_STATUS_NONE ); + virtual Drawable *friend_createDrawable( const ThingTemplate *thing, DrawableStatusBits statusBits = DRAWABLE_STATUS_DEFAULT ); virtual void init( void ); ///< initialize resources virtual void update( void ); ///< per frame update diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp index 0260c36f9b8..2852b2031c9 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp @@ -115,7 +115,7 @@ void W3DGameClient::reset( void ) * in the GameLogic and GameClient themselves */ //------------------------------------------------------------------------------------------------- Drawable *W3DGameClient::friend_createDrawable( const ThingTemplate *tmplate, - DrawableStatus statusBits ) + DrawableStatusBits statusBits ) { Drawable *draw = NULL; From 568a16294f2d8d1da78b31e14b582dc737405737 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 20 Sep 2025 20:26:28 +0200 Subject: [PATCH 095/343] feat(client): Make opacity and shadows of build placement preview objects customizable (#1592) Adds new fields ObjectPlacementOpacity=0..1 and ObjectPlacementShadows=Yes/No to GameData.ini --- .../GameEngine/Include/Common/GlobalData.h | 3 ++ .../GameEngine/Source/Common/GlobalData.cpp | 10 +++++- .../GameEngine/Source/GameClient/InGameUI.cpp | 32 +++++++++++-------- .../GameEngine/Include/Common/GlobalData.h | 3 ++ .../GameEngine/Source/Common/GlobalData.cpp | 10 +++++- .../GameEngine/Source/GameClient/InGameUI.cpp | 32 +++++++++++-------- 6 files changed, 60 insertions(+), 30 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/GlobalData.h b/Generals/Code/GameEngine/Include/Common/GlobalData.h index 8631dc87dfa..5e2bf47be9f 100644 --- a/Generals/Code/GameEngine/Include/Common/GlobalData.h +++ b/Generals/Code/GameEngine/Include/Common/GlobalData.h @@ -425,6 +425,9 @@ class GlobalData : public SubsystemInterface AsciiString m_specialPowerViewObjectName; ///< Created when certain special powers are fired so players can watch. + Real m_objectPlacementOpacity; ///< Sets the opacity of build preview objects. + Bool m_objectPlacementShadows; ///< Enables or disables shadows of build preview objects. + std::vector m_standardPublicBones; Real m_standardMinefieldDensity; diff --git a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp index 25fec838d18..a44456ef558 100644 --- a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp @@ -398,6 +398,7 @@ GlobalData* GlobalData::m_theOriginal = NULL; { "EnforceMaxCameraHeight", INI::parseBool, NULL, offsetof( GlobalData, m_enforceMaxCameraHeight ) }, { "KeyboardScrollSpeedFactor", INI::parseReal, NULL, offsetof( GlobalData, m_keyboardScrollFactor ) }, { "KeyboardDefaultScrollSpeedFactor", INI::parseReal, NULL, offsetof( GlobalData, m_keyboardDefaultScrollFactor ) }, + { "KeyboardCameraRotateSpeed", INI::parseReal, NULL, offsetof( GlobalData, m_keyboardCameraRotateSpeed ) }, { "MovementPenaltyDamageState", INI::parseIndexList, TheBodyDamageTypeNames, offsetof( GlobalData, m_movementPenaltyDamageState ) }, // you cannot set this; it always has a value of 100%. @@ -457,6 +458,11 @@ GlobalData* GlobalData::m_theOriginal = NULL; { "SpecialPowerViewObject", INI::parseAsciiString, NULL, offsetof( GlobalData, m_specialPowerViewObjectName ) }, + // TheSuperHackers @feature Customize the opacity (0..1) and shadows of build preview objects. Shadows are enabled by default. + // Note that disabling shadows loses a fair bit of contrast visually and warrants raising the opacity. + { "ObjectPlacementOpacity", INI::parseReal, NULL, offsetof( GlobalData, m_objectPlacementOpacity ) }, + { "ObjectPlacementShadows", INI::parseBool, NULL, offsetof( GlobalData, m_objectPlacementShadows ) }, + { "StandardPublicBone", INI::parseAsciiStringVectorAppend, NULL, offsetof(GlobalData, m_standardPublicBones) }, { "ShowMetrics", INI::parseBool, NULL, offsetof( GlobalData, m_showMetrics ) }, { "DefaultStartingCash", INI::parseUnsignedInt, NULL, offsetof( GlobalData, m_defaultStartingCash ) }, @@ -486,7 +492,6 @@ GlobalData* GlobalData::m_theOriginal = NULL; { "NetworkPlayerTimeoutTime", INI::parseInt, NULL, offsetof(GlobalData, m_networkPlayerTimeoutTime) }, { "NetworkDisconnectScreenNotifyTime", INI::parseInt, NULL, offsetof(GlobalData, m_networkDisconnectScreenNotifyTime) }, - { "KeyboardCameraRotateSpeed", INI::parseReal, NULL, offsetof( GlobalData, m_keyboardCameraRotateSpeed ) }, { "PlayStats", INI::parseInt, NULL, offsetof( GlobalData, m_playStats ) }, #if defined(RTS_DEBUG) @@ -868,6 +873,9 @@ GlobalData::GlobalData() m_standardMinefieldDensity = 0.01f; m_standardMinefieldDistance = 40.0f; + m_objectPlacementOpacity = 0.45f; + m_objectPlacementShadows = TRUE; + m_groupSelectMinSelectSize = 5; m_groupSelectVolumeBase = 0.5f; m_groupSelectVolumeIncrement = 0.02f; diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index ca527d40a0c..881f74b053f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -87,8 +87,7 @@ // ------------------------------------------------------------------------------------------------ -static const Real placementOpacity = 0.45f; -static const RGBColor illegalBuildColor = { 1.0, 0.0, 0.0 }; +static const RGBColor IllegalBuildColor = { 1.0, 0.0, 0.0 }; //------------------------------------------------------------------------------------------------- /// The InGameUI singleton instance. @@ -1467,8 +1466,9 @@ void InGameUI::handleBuildPlacements( void ) BuildAssistant::SHROUD_REVEALED, builderObject, NULL ); + if( lbc != LBC_OK ) - m_placeIcon[ 0 ]->colorTint( &illegalBuildColor ); + m_placeIcon[ 0 ]->colorTint( &IllegalBuildColor ); else m_placeIcon[ 0 ]->colorTint( NULL ); @@ -1528,8 +1528,11 @@ void InGameUI::handleBuildPlacements( void ) { if( m_placeIcon[ i ] == NULL ) - m_placeIcon[ i ] = TheThingFactory->newDrawable( m_pendingPlaceType, - DRAWABLE_STATUS_SHADOWS | DRAWABLE_STATUS_NO_STATE_PARTICLES ); + { + UnsignedInt drawableStatus = DRAWABLE_STATUS_NO_STATE_PARTICLES; + drawableStatus |= TheGlobalData->m_objectPlacementShadows ? DRAWABLE_STATUS_SHADOWS : 0; + m_placeIcon[ i ] = TheThingFactory->newDrawable( m_pendingPlaceType, drawableStatus ); + } } @@ -1553,11 +1556,11 @@ void InGameUI::handleBuildPlacements( void ) for( i = 0; i < tileBuildInfo->tilesUsed; i++ ) { - // set the drawble position + // set the drawable position m_placeIcon[ i ]->setPosition( &tileBuildInfo->positions[ i ] ); - // set opacity for the drawble - m_placeIcon[ i ]->setDrawableOpacity( placementOpacity ); + // set opacity for the drawable + m_placeIcon[ i ]->setDrawableOpacity( TheGlobalData->m_objectPlacementOpacity ); // set the drawable angle m_placeIcon[ i ]->setOrientation( angle ); @@ -3039,8 +3042,12 @@ void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildD ///@ todo when message stream order more formalized eliminate this // TheInGameUI->deselectAllDrawables(); - // create a drawble of what we are building to be "attached" at the cursor - draw = TheThingFactory->newDrawable( build, DRAWABLE_STATUS_SHADOWS | DRAWABLE_STATUS_NO_STATE_PARTICLES ); + { + // create a drawable of what we are building to be "attached" at the cursor + UnsignedInt drawableStatus = DRAWABLE_STATUS_NO_STATE_PARTICLES; + drawableStatus |= TheGlobalData->m_objectPlacementShadows ? DRAWABLE_STATUS_SHADOWS : 0; + draw = TheThingFactory->newDrawable( build, drawableStatus ); + } if (sourceObject) { if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT) @@ -3058,14 +3065,11 @@ void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildD // Real angle = build->getPlacementViewAngle(); - // don't forget to take into account the current view angle - // angle += TheTacticalView->getAngle(); Don't do this - makes odd angled building placements. jba. - // set the angle in the icon we just created draw->setOrientation( angle ); // set the build icon attached to the cursor to be "see-thru" - draw->setDrawableOpacity( placementOpacity ); + draw->setDrawableOpacity( TheGlobalData->m_objectPlacementOpacity ); // set the "icon" in the icon array at the first index DEBUG_ASSERTCRASH( m_placeIcon[ 0 ] == NULL, ("placeBuildAvailable, build icon array is not empty!") ); diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h index 381d1123c0f..190f2ac35aa 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h @@ -436,6 +436,9 @@ class GlobalData : public SubsystemInterface AsciiString m_specialPowerViewObjectName; ///< Created when certain special powers are fired so players can watch. + Real m_objectPlacementOpacity; ///< Sets the opacity of build preview objects. + Bool m_objectPlacementShadows; ///< Enables or disables shadows of build preview objects. + std::vector m_standardPublicBones; Real m_standardMinefieldDensity; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp index bf41e41c1c7..de74c70fb01 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp @@ -398,6 +398,7 @@ GlobalData* GlobalData::m_theOriginal = NULL; { "EnforceMaxCameraHeight", INI::parseBool, NULL, offsetof( GlobalData, m_enforceMaxCameraHeight ) }, { "KeyboardScrollSpeedFactor", INI::parseReal, NULL, offsetof( GlobalData, m_keyboardScrollFactor ) }, { "KeyboardDefaultScrollSpeedFactor", INI::parseReal, NULL, offsetof( GlobalData, m_keyboardDefaultScrollFactor ) }, + { "KeyboardCameraRotateSpeed", INI::parseReal, NULL, offsetof( GlobalData, m_keyboardCameraRotateSpeed ) }, { "MovementPenaltyDamageState", INI::parseIndexList, TheBodyDamageTypeNames, offsetof( GlobalData, m_movementPenaltyDamageState ) }, // you cannot set this; it always has a value of 100%. @@ -457,6 +458,11 @@ GlobalData* GlobalData::m_theOriginal = NULL; { "SpecialPowerViewObject", INI::parseAsciiString, NULL, offsetof( GlobalData, m_specialPowerViewObjectName ) }, + // TheSuperHackers @feature Customize the opacity (0..1) and shadows of build preview objects. Shadows are enabled by default. + // Note that disabling shadows loses a fair bit of contrast visually and warrants raising the opacity. + { "ObjectPlacementOpacity", INI::parseReal, NULL, offsetof( GlobalData, m_objectPlacementOpacity ) }, + { "ObjectPlacementShadows", INI::parseBool, NULL, offsetof( GlobalData, m_objectPlacementShadows ) }, + { "StandardPublicBone", INI::parseAsciiStringVectorAppend, NULL, offsetof(GlobalData, m_standardPublicBones) }, { "ShowMetrics", INI::parseBool, NULL, offsetof( GlobalData, m_showMetrics ) }, { "DefaultStartingCash", Money::parseMoneyAmount, NULL, offsetof( GlobalData, m_defaultStartingCash ) }, @@ -486,7 +492,6 @@ GlobalData* GlobalData::m_theOriginal = NULL; { "NetworkPlayerTimeoutTime", INI::parseInt, NULL, offsetof(GlobalData, m_networkPlayerTimeoutTime) }, { "NetworkDisconnectScreenNotifyTime", INI::parseInt, NULL, offsetof(GlobalData, m_networkDisconnectScreenNotifyTime) }, - { "KeyboardCameraRotateSpeed", INI::parseReal, NULL, offsetof( GlobalData, m_keyboardCameraRotateSpeed ) }, { "PlayStats", INI::parseInt, NULL, offsetof( GlobalData, m_playStats ) }, #if defined(RTS_DEBUG) @@ -874,6 +879,9 @@ GlobalData::GlobalData() m_standardMinefieldDensity = 0.01f; m_standardMinefieldDistance = 40.0f; + m_objectPlacementOpacity = 0.45f; + m_objectPlacementShadows = TRUE; + m_groupSelectMinSelectSize = 5; m_groupSelectVolumeBase = 0.5f; m_groupSelectVolumeIncrement = 0.02f; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index ac7104f221f..03859cf9132 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -91,8 +91,7 @@ // ------------------------------------------------------------------------------------------------ -static const Real placementOpacity = 0.45f; -static const RGBColor illegalBuildColor = { 1.0, 0.0, 0.0 }; +static const RGBColor IllegalBuildColor = { 1.0, 0.0, 0.0 }; //------------------------------------------------------------------------------------------------- /// The InGameUI singleton instance. @@ -1523,8 +1522,9 @@ void InGameUI::handleBuildPlacements( void ) BuildAssistant::IGNORE_STEALTHED, builderObject, NULL ); + if( lbc != LBC_OK ) - m_placeIcon[ 0 ]->colorTint( &illegalBuildColor ); + m_placeIcon[ 0 ]->colorTint( &IllegalBuildColor ); else m_placeIcon[ 0 ]->colorTint( NULL ); @@ -1584,8 +1584,11 @@ void InGameUI::handleBuildPlacements( void ) { if( m_placeIcon[ i ] == NULL ) - m_placeIcon[ i ] = TheThingFactory->newDrawable( m_pendingPlaceType, - DRAWABLE_STATUS_SHADOWS | DRAWABLE_STATUS_NO_STATE_PARTICLES ); + { + UnsignedInt drawableStatus = DRAWABLE_STATUS_NO_STATE_PARTICLES; + drawableStatus |= TheGlobalData->m_objectPlacementShadows ? DRAWABLE_STATUS_SHADOWS : 0; + m_placeIcon[ i ] = TheThingFactory->newDrawable( m_pendingPlaceType, drawableStatus ); + } } @@ -1609,11 +1612,11 @@ void InGameUI::handleBuildPlacements( void ) for( i = 0; i < tileBuildInfo->tilesUsed; i++ ) { - // set the drawble position + // set the drawable position m_placeIcon[ i ]->setPosition( &tileBuildInfo->positions[ i ] ); - // set opacity for the drawble - m_placeIcon[ i ]->setDrawableOpacity( placementOpacity ); + // set opacity for the drawable + m_placeIcon[ i ]->setDrawableOpacity( TheGlobalData->m_objectPlacementOpacity ); // set the drawable angle m_placeIcon[ i ]->setOrientation( angle ); @@ -3119,8 +3122,12 @@ void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildD ///@ todo when message stream order more formalized eliminate this // TheInGameUI->deselectAllDrawables(); - // create a drawble of what we are building to be "attached" at the cursor - draw = TheThingFactory->newDrawable( build, DRAWABLE_STATUS_SHADOWS | DRAWABLE_STATUS_NO_STATE_PARTICLES ); + { + // create a drawable of what we are building to be "attached" at the cursor + UnsignedInt drawableStatus = DRAWABLE_STATUS_NO_STATE_PARTICLES; + drawableStatus |= TheGlobalData->m_objectPlacementShadows ? DRAWABLE_STATUS_SHADOWS : 0; + draw = TheThingFactory->newDrawable( build, drawableStatus ); + } if (sourceObject) { if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT) @@ -3138,14 +3145,11 @@ void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildD // Real angle = build->getPlacementViewAngle(); - // don't forget to take into account the current view angle - // angle += TheTacticalView->getAngle(); Don't do this - makes odd angled building placements. jba. - // set the angle in the icon we just created draw->setOrientation( angle ); // set the build icon attached to the cursor to be "see-thru" - draw->setDrawableOpacity( placementOpacity ); + draw->setDrawableOpacity( TheGlobalData->m_objectPlacementOpacity ); // set the "icon" in the icon array at the first index DEBUG_ASSERTCRASH( m_placeIcon[ 0 ] == NULL, ("placeBuildAvailable, build icon array is not empty!") ); From dca765f84c70a63ebc55937405a50f9e0e3f557e Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Sun, 21 Sep 2025 16:23:56 +0100 Subject: [PATCH 096/343] refactor(pathfinder): Remove superfluous whitespace and commented code in Pathfinder (#1611) --- .../Source/GameLogic/AI/AIPathfind.cpp | 313 +--------- .../Source/GameLogic/AI/AIPathfind.cpp | 538 +----------------- 2 files changed, 10 insertions(+), 841 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 54a0709e94a..718ac4fcc3b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -1975,7 +1975,6 @@ inline void applyZone(PathfindCell &targetCell, const PathfindCell &sourceCell, { DEBUG_ASSERTCRASH(sourceCell.getZone()!=0, ("Unset source zone.")); Int srcZone = zoneEquivalency[sourceCell.getZone()]; - //DEBUG_ASSERTCRASH(srcZone!=0, ("Bad zone equivalency zone.")); Int targetZone = zoneEquivalency[targetCell.getZone()]; if (targetZone == 0) { @@ -2015,11 +2014,8 @@ m_interactsWithBridge(FALSE) { m_cellOrigin.x = 0; m_cellOrigin.y = 0; - //Added By Sadullah Nader - //Initialization(s) inserted m_firstZone = 0; m_markedPassable = TRUE; - // } ZoneBlock::~ZoneBlock() @@ -2329,7 +2325,6 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye #endif #endif - m_maxZone = 1; // we start using zone 0 as a flag. const Int maxZones=24000; zoneStorageType zoneEquivalency[maxZones]; @@ -2392,7 +2387,6 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye } } - //DEBUG_LOG(("Collapsed zones %d", m_maxZone)); } } @@ -2547,19 +2541,6 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye if (crusherGround(map[i][j], map[i][j-1])) { applyZone(map[i][j], map[i][j-1], m_crusherZones, m_maxZone); } -/* No diagonals. jba. - if (i>globalBounds.lo.x) { - if (waterGround(map[i][j],map[i-1][j-1])) { - applyZone(map[i][j], map[i-1][j-1], m_groundWaterZones, m_maxZone); - } - if (groundCliff(map[i][j],map[i-1][j-1])) { - applyZone(map[i][j], map[i-1][j-1], m_groundCliffZones, m_maxZone); - } - if (terrain(map[i][j],map[i-1][j-1])) { - applyZone(map[i][j], map[i-1][j-1], m_terrainZones, m_maxZone); - } - } -*/ } DEBUG_ASSERTCRASH(map[i][j].getZone() != 0, ("Cleared the zone.")); } @@ -3289,7 +3270,6 @@ PathfindCell *PathfindLayer::getCell(Int x, Int y) } - /** * Classify the given map cell as clear, or not, etc. */ @@ -3675,48 +3655,8 @@ void Pathfinder::classifyFence( Object *obj, Bool insert ) else m_map[cx][cy].removeObstacle(obj); } - } } - -#if 0 - // Perhaps it would make more sense to use the iteratecellsalongpath() provided in this class, - // but this way works well and is very traceable - // neither one is true Bresenham - // this one assumes zero fence thickness - - const Coord3D *fencePos = obj->getPosition(); - Coord3D fenceNorm; - obj->getUnitDirectionVector2D( fenceNorm ); - Coord3D halfLength = fenceNorm; - halfLength.scale( obj->getGeometryInfo().getMajorRadius() ); - - Coord3D head = *fencePos; - head.add( &halfLength ); - Coord3D tail = *fencePos; - tail.sub( &halfLength ); - - Real stepLength = 1.0f / ((halfLength.length()*2.0f) / PATHFIND_CELL_SIZE_F); - - for ( Real t = 0.0f; t <= 1.0f; t += stepLength ) - { - Real lengthWalk_x = (head.x * t) + (tail.x * (1.0f-t)); - Real lengthWalk_y = (head.y * t) + (tail.y * (1.0f-t)); - - Int cx = REAL_TO_INT_FLOOR( lengthWalk_x / PATHFIND_CELL_SIZE_F ); - Int cy = REAL_TO_INT_FLOOR( lengthWalk_y / PATHFIND_CELL_SIZE_F ); - if (cx >= 0 && cy >= 0 && cx < m_extent.hi.x && cy < m_extent.hi.y) - { - if (insert) { - ICoord2D pos = { cx, cy }; - m_map[cx][cy].setTypeAsObstacle( obj, true, pos ); - } - else - m_map[cx][cy].removeObstacle(obj); - } - } -#endif - } /** @@ -3983,8 +3923,6 @@ void Pathfinder::internal_classifyObjectFootprint( Object *obj, Bool insert ) } // Expand building bounds 1 cell. -#define MARK_BORDER_PINCHED -#ifdef MARK_BORDER_PINCHED for( j=cellBounds.lo.y; j<=cellBounds.hi.y; j++ ) { for( i=cellBounds.lo.x; i<=cellBounds.hi.x; i++ ) @@ -4011,10 +3949,6 @@ void Pathfinder::internal_classifyObjectFootprint( Object *obj, Bool insert ) } } } -#endif - - - } /** @@ -4216,8 +4150,6 @@ void Pathfinder::debugShowSearch( Bool pathFound ) // show all explored cells for debugging PathfindCell *s; - - RGBColor color; color.red = color.blue = color.green = 1; if (!pathFound) { @@ -4240,7 +4172,6 @@ void Pathfinder::debugShowSearch( Bool pathFound ) for( s = m_closedList; s; s=s->getNextOpen() ) { - // create objects to show path - they decay // create objects to show path - they decay RGBColor color; color.red = color.blue = 1; @@ -4356,30 +4287,6 @@ void Pathfinder::cleanOpenAndClosedLists(void) { #endif m_cumulativeCellsAllocated += count; -//#ifdef RTS_DEBUG -#if 0 - // Check for dangling cells. - for( int j=0; j<=m_extent.hi.y; j++ ) - for( int i=0; i<=m_extent.hi.x; i++ ) - if (m_map[ i ][ j ].hasInfo()) { - DEBUG_ASSERTCRASH((m_map[i][j].getXIndex()==i && m_map[i][j].getYIndex()==j), ("Wrong cell coordinates")); - Bool needInfo = (m_map[ i ][ j ].getType() == PathfindCell::CELL_OBSTACLE); - if (m_map[i][j].isAircraftGoal()) { - needInfo = true; - } - if (m_map[i][j].getFlags() != PathfindCell::NO_UNITS) { - needInfo = true; - } - if (!needInfo) { - DEBUG_LOG(("leaked cell %d, %d", m_map[i][j].getXIndex(), m_map[i][j].getYIndex())); - m_map[i][j].releaseInfo(); - } - DEBUG_ASSERTCRASH((needInfo), ("Minor temporary memory leak - Extra cell allocated. Tell JBA steps if repeatable.")); - }; - //DEBUG_LOG(("Pathfind used %d cells.", count)); -#endif -//#endif - } @@ -4406,49 +4313,6 @@ Bool Pathfinder::validMovementPosition( Bool isCrusher, LocomotorSurfaceTypeMask if ((cellSurfaces & acceptableSurfaces) == 0) return false; -#if 0 - // - // For diagonal moves, check neighboring vertical and horizontal - // steps as well to avoid "squeezing through a crack". - // - if (fromCell) - { - ICoord2D delta; - - delta.x = toCell->getXIndex() - fromCell->getXIndex(); - delta.y = toCell->getYIndex() - fromCell->getYIndex(); - - if (delta.x != 0 && delta.y != 0) - { - // test vertical movement - PathfindCell *otherCell = getCell( toCell->getXIndex(), fromCell->getYIndex() ); - Bool open = true; - - // check if cell is on the map - if (otherCell == NULL) - open = false; - - // check if we can move onto this new cell - if (validMovementPosition( locomotorSet, otherCell, fromCell ) == false) - open = false; - - // test horizontal movement - if (open == false) - { - otherCell = getCell( fromCell->getXIndex(), toCell->getYIndex() ); - - // check if cell is on the map - if (otherCell == NULL) - return false; - - // check if we can move onto this new cell - if (validMovementPosition( locomotorSet, otherCell, fromCell ) == false) - return false; - } - } - } -#endif - return true; } @@ -4707,7 +4571,6 @@ void Pathfinder::snapClosestGoalPosition(Object *obj, Coord3D *pos) } } } - //DEBUG_LOG(("Couldn't find goal.")); } /** @@ -4877,8 +4740,6 @@ Bool Pathfinder::adjustToLandingDestination(Object *obj, Coord3D *dest) } - - /** * Find an unoccupied spot for a unit to move to. * Returns false if there are no spots available within a reasonable radius. @@ -4956,8 +4817,6 @@ Bool Pathfinder::adjustDestination(Object *obj, const LocomotorSet& locomotorSet // Didn't work, so just do simple adjust. return(adjustDestination(obj, locomotorSet, dest, NULL)); } - //DEBUG_LOG(("adjustDestination failed, dest (%f, %f), adj dest (%f,%f), %x %s", dest->x, dest->y, adjustDest.x, adjustDest.y, - //obj, obj->getTemplate()->getName().str())); return false; } @@ -5333,8 +5192,6 @@ Path *Pathfinder::getAircraftPath( const Object *obj, const Coord3D *to ) { // for now, quick path objects don't pathfind, generally airborne units // build a trivial one-node path containing destination, then avoid buildings. - - Path *thePath = newInstance(Path); const AIUpdateInterface *ai = obj->getAI(); ObjectID avoidObject = INVALID_ID; @@ -5607,10 +5464,6 @@ struct ExamineCellsStruct to->setParentCell(from) ; to->setTotalCost(to->getCostSoFar() + costRemaining) ; - //DEBUG_LOG(("Cell (%d,%d), Parent cost %d, newCostSoFar %d, cost rem %d, tot %d", - // to->getXIndex(), to->getYIndex(), - // to->costSoFar(from), newCostSoFar, costRemaining, to->getCostSoFar() + costRemaining)); - // if to was on closed list, remove it from the list if (to->getClosed()) d->thePathfinder->m_closedList = to->removeFromClosedList( d->thePathfinder->m_closedList ); @@ -5627,8 +5480,6 @@ struct ExamineCellsStruct } - - Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell *goalCell, const LocomotorSet& locomotorSet, Bool isHuman, Bool centerInCell, Int radius, const ICoord2D &startCellNdx, const Object *obj, Int attackDistance) @@ -5671,8 +5522,6 @@ Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell * UnsignedInt newCostSoFar = 0; - - for( int i=0; isetTotalCost(newCell->getCostSoFar() + costRemaining) ; - //DEBUG_LOG(("Cell (%d,%d), Parent cost %d, newCostSoFar %d, cost rem %d, tot %d", - // newCell->getXIndex(), newCell->getYIndex(), - // newCell->costSoFar(parentCell), newCostSoFar, costRemaining, newCell->getCostSoFar() + costRemaining)); - // if newCell was on closed list, remove it from the list if (newCell->getClosed()) m_closedList = newCell->removeFromClosedList( m_closedList ); @@ -5916,50 +5759,6 @@ Path *Pathfinder::findPath( Object *obj, const LocomotorSet& locomotorSet, const return pat; } -/* hierarchical build path code. - if (pat) { - - Path *path = newInstance(Path); - PathNode *prior = NULL; - for (PathNode *node = pat->getLastNode(); node; node=node->getPrevious()) { - Bool unobstructed = true; - if (prior!=NULL) { - unobstructed = isLinePassable( obj, locomotorSet.getValidSurfaces(), - prior->getLayer(), *prior->getPosition(), *node->getPosition(), false, true); - } - if (unobstructed) { - path->prependNode( node->getPosition(), node->getLayer() ); - path->getFirstNode()->setCanOptimize(node->getCanOptimize()); - path->getFirstNode()->setNextOptimized(path->getFirstNode()->getNext()); - } else { - Path *linkPath = findClosestPath(obj, locomotorSet, node->getPosition(), - prior->getPosition(), false, 0, true); - if (linkPath==NULL) { - DEBUG_LOG(("Couldn't find path - unexpected. jba.")); - continue; - } - PathNode *linkNode = linkPath->getLastNode(); - if (linkNode==NULL) { - DEBUG_LOG(("Empty path - unexpected. jba.")); - continue; - } - for (linkNode=linkNode->getPrevious(); linkNode; linkNode=linkNode->getPrevious()) { - path->prependNode( linkNode->getPosition(), linkNode->getLayer() ); - path->getFirstNode()->setCanOptimize(linkNode->getCanOptimize()); - path->getFirstNode()->setNextOptimized(path->getFirstNode()->getNext()); - } - deleteInstance(linkPath); - } - prior = node; - } - deleteInstance(pat); - path->optimize(obj, locomotorSet.getValidSurfaces(), false); - if (TheGlobalData->m_debugAI) { - setDebugPath(path); - } - return path; - } -*/ return NULL; } /** @@ -6823,18 +6622,11 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, if (newCell->getCostSoFar() <= newCostSoFar) continue; } - //DEBUG_LOG(("CELL(%d,%d)L%d CD%d CSF %d, CR%d // ",newCell->getXIndex(), newCell->getYIndex(), - // newCell->getLayer(), clearDiameter, newCostSoFar, costRemaining)); - //if ((cellCount&7)==0) DEBUG_LOG_RAW(("\n")); newCell->setCostSoFar(newCostSoFar); // keep track of path we're building - point back to cell we moved here from newCell->setParentCell(parentCell) ; newCell->setTotalCost(newCell->getCostSoFar() + costRemaining) ; - //DEBUG_LOG(("Cell (%d,%d), Parent cost %d, newCostSoFar %d, cost rem %d, tot %d", - // newCell->getXIndex(), newCell->getYIndex(), - // newCell->costSoFar(parentCell), newCostSoFar, costRemaining, newCell->getCostSoFar() + costRemaining)); - // if newCell was on closed list, remove it from the list if (newCell->getClosed()) m_closedList = newCell->removeFromClosedList( m_closedList ); @@ -6846,8 +6638,6 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, // insert newCell in open list such that open list is sorted, smallest total path cost first m_openList = newCell->putOnSortedOpenList( m_openList ); } - - } // failure - goal cannot be reached #ifdef INTENSE_DEBUG @@ -7319,26 +7109,6 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu show |= (TheGlobalData->m_debugAI==AI_DEBUG_GROUND_PATHS); if (show) { debugShowSearch(true); -#if 0 // Show hierarchical blocks (big blue ones.) - Int i, j; - ICoord2D extent; - m_zoneManager.getExtent(extent); - for (i=0; igetGroundHeight( pos.x, pos.y ) + 0.5f; - if (m_zoneManager.isPassable(i*PathfindZoneManager::ZONE_BLOCK_SIZE, j*PathfindZoneManager::ZONE_BLOCK_SIZE)) { - addIcon(&pos, 5*PATHFIND_CELL_SIZE_F, 300, color); - } - } - } -#endif } #endif #if RETAIL_COMPATIBLE_PATHFINDING @@ -7527,32 +7297,7 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu m_isTunneling = false; // construct and return path Path *path = buildHierachicalPath( from, closestCell ); -#if defined(RTS_DEBUG) -#if 0 - if (TheGlobalData->m_debugAI) - { - debugShowSearch(true); - Int i, j; - ICoord2D extent; - m_zoneManager.getExtent(extent); - for (i=0; igetGroundHeight( pos.x, pos.y ) + 0.5f; - if (m_zoneManager.isPassable(i*PathfindZoneManager::ZONE_BLOCK_SIZE, j*PathfindZoneManager::ZONE_BLOCK_SIZE)) { - addIcon(&pos, 5*PATHFIND_CELL_SIZE_F, 300, color); - } - } - } - } -#endif -#endif + #if RETAIL_COMPATIBLE_PATHFINDING if (!s_useFixedPathfinding) { @@ -7874,8 +7619,7 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet Int dx = IABS(goalCell->getXIndex()-parentCell->getXIndex()); Int dy = IABS(goalCell->getYIndex()-parentCell->getYIndex()); Real distSqr = dx*dx+dy*dy; - //Real cost = (parentCell->getCostSoFar()*(parentCell->getCostSoFar()*COST_TO_DISTANCE_FACTOR))*0.5f; - //distSqr += sqr(cost); + if (distSqr < closestDistanceSqr) { closestCell = parentCell; closestDistanceSqr = distSqr; @@ -7984,10 +7728,6 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet newCell->setTotalCost(newCell->getCostSoFar() + costRemaining) ; - //DEBUG_LOG(("Cell (%d,%d), Parent cost %d, newCostSoFar %d, cost rem %d, tot %d", - // newCell->getXIndex(), newCell->getYIndex(), - // newCell->costSoFar(parentCell), newCostSoFar, costRemaining, newCell->getCostSoFar() + costRemaining)); - // if newCell was on closed list, remove it from the list if (newCell->getClosed()) m_closedList = newCell->removeFromClosedList( m_closedList ); @@ -8274,10 +8014,6 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con newCell->setTotalCost(newCell->getCostSoFar() + costRemaining) ; - //DEBUG_LOG(("Cell (%d,%d), Parent cost %d, newCostSoFar %d, cost rem %d, tot %d", - // newCell->getXIndex(), newCell->getYIndex(), - // newCell->costSoFar(parentCell), newCostSoFar, costRemaining, newCell->getCostSoFar() + costRemaining)); - // if newCell was on closed list, remove it from the list if (newCell->getClosed()) m_closedList = newCell->removeFromClosedList( m_closedList ); @@ -8320,8 +8056,6 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con } - - /** * Find a short, valid path between the FROM location and a location NEAR the to location. * Uses A* algorithm. @@ -8672,8 +8406,6 @@ void Pathfinder::adjustCoordToCell(Int cellX, Int cellY, Bool centerInCell, Coor } - - /** * Work backwards from goal cell to construct final path. */ @@ -9514,8 +9246,7 @@ void Pathfinder::updateGoal( Object *obj, const Coord3D *newGoalPos, PathfindLay if (cell) { if (warn && cell->getGoalUnit()!=INVALID_ID && cell->getGoalUnit() != obj->getID()) { warn = false; - // jba intense debug - //DEBUG_LOG(, ("Units got stuck close to each other. jba")); + //Units got stuck close to each other. jba } cellNdx.x = i; cellNdx.y = j; @@ -9527,8 +9258,7 @@ void Pathfinder::updateGoal( Object *obj, const Coord3D *newGoalPos, PathfindLay if (cell) { if (warn && cell->getGoalUnit()!=INVALID_ID && cell->getGoalUnit() != obj->getID()) { warn = false; - // jba intense debug - //DEBUG_LOG(, ("Units got stuck close to each other. jba")); + //Units got stuck close to each other. jba } cellNdx.x = i; cellNdx.y = j; @@ -10087,7 +9817,6 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, } - /** Patch to the exiting path from the current position, either because we became blocked, or because we had to move off the path to avoid other units. */ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet, @@ -10313,39 +10042,7 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomotorSet, const Coord3D *from, const Object *victim, const Coord3D* victimPos, const Weapon *weapon ) { - /* - CRCDEBUG_LOG(("Pathfinder::findAttackPath() for object %d (%s)", obj->getID(), obj->getTemplate()->getName().str())); - XferCRC xferCRC; - xferCRC.open("lightCRC"); - xferCRC.xferSnapshot((Object *)obj); - xferCRC.close(); - CRCDEBUG_LOG(("obj CRC is %X", xferCRC.getCRC())); - if (from) - { - CRCDEBUG_LOG(("from: (%g,%g,%g) (%X,%X,%X)", - from->x, from->y, from->z, - AS_INT(from->x), AS_INT(from->y), AS_INT(from->z))); - } - if (victim) - { - CRCDEBUG_LOG(("victim is %d (%s)", victim->getID(), victim->getTemplate()->getName().str())); - XferCRC xferCRC; - xferCRC.open("lightCRC"); - xferCRC.xferSnapshot((Object *)victim); - xferCRC.close(); - CRCDEBUG_LOG(("victim CRC is %X", xferCRC.getCRC())); - } - if (victimPos) - { - CRCDEBUG_LOG(("from: (%g,%g,%g) (%X,%X,%X)", - victimPos->x, victimPos->y, victimPos->z, - AS_INT(victimPos->x), AS_INT(victimPos->y), AS_INT(victimPos->z))); - } - */ if (m_isMapReady == false) return NULL; // Should always be ok. -#if defined(RTS_DEBUG) -// Int startTimeMS = ::GetTickCount(); -#endif Bool isCrusher = obj ? obj->getCrusherLevel() > 0 : false; Int radius; @@ -10393,8 +10090,6 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot } } - - const Int ATTACK_CELL_LIMIT = 2500; // this is a rather expensive operation, so limit the search. Bool isHuman = true; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 22773b296f3..4a3dda9b2a1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -1999,7 +1999,6 @@ inline void applyZone(PathfindCell &targetCell, const PathfindCell &sourceCell, { DEBUG_ASSERTCRASH(sourceCell.getZone()!=0, ("Unset source zone.")); Int srcZone = zoneEquivalency[sourceCell.getZone()]; - //DEBUG_ASSERTCRASH(srcZone!=0, ("Bad zone equivalency zone.")); Int targetZone = zoneEquivalency[targetCell.getZone()]; if (targetZone == 0) { @@ -2039,11 +2038,8 @@ m_interactsWithBridge(FALSE) { m_cellOrigin.x = 0; m_cellOrigin.y = 0; - //Added By Sadullah Nader - //Initialization(s) inserted m_firstZone = 0; m_markedPassable = TRUE; - // } ZoneBlock::~ZoneBlock() @@ -2340,9 +2336,6 @@ void PathfindZoneManager::markZonesDirty( Bool insert ) ///< Called when the zo m_nextFrameToCalculateZones = 2; return; } -// if ( insert ) -// m_nextFrameToCalculateZones = TheGameLogic->getFrame(); -// else m_nextFrameToCalculateZones = MIN( m_nextFrameToCalculateZones, TheGameLogic->getFrame() + ZONE_UPDATE_FREQUENCY ); } @@ -2354,14 +2347,11 @@ void PathfindZoneManager::markZonesDirty( Bool insert ) ///< Called when the zo * complicated. */ - - #define dont_forceRefreshCalling #ifdef forceRefreshCalling static Bool s_stopForceCalling = FALSE; #endif - void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer layers[], const IRegion2D &globalBounds ) { @@ -2377,7 +2367,6 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye #endif #endif - m_maxZone = 1; // we start using zone 0 as a flag. const Int maxZones=24000; zoneStorageType zoneEquivalency[maxZones]; @@ -2406,10 +2395,6 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye if (bounds.hi.y > globalBounds.hi.y) { bounds.hi.y = globalBounds.hi.y; } -// if (bounds.lo.x>bounds.hi.x || bounds.lo.y>bounds.hi.y) { -// DEBUG_CRASH(("Incorrect bounds calculation. Logic error, fix me. jba.")); -// continue; -// } m_zoneBlocks[xBlock][yBlock].setInteractsWithBridge(false); for( j=bounds.lo.y; j<=bounds.hi.y; j++ ) { for( i=bounds.lo.x; i<=bounds.hi.x; i++ ) { @@ -2429,10 +2414,6 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye if (cell->getZone()==0) { cell->setZone(m_maxZone); m_maxZone++; -// if (m_maxZone>= maxZones) { -// DEBUG_CRASH(("Ran out of pathfind zones. SERIOUS ERROR! jba.")); -// break; -// } } if (cell->getConnectLayer() > LAYER_GROUND) { m_zoneBlocks[xBlock][yBlock].setInteractsWithBridge(true); @@ -2440,14 +2421,10 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye } } - //DEBUG_LOG(("Collapsed zones %d", m_maxZone)); } } Int totalZones = m_maxZone; -// if (totalZones>maxZones/2) { -// DEBUG_LOG(("Max zones %d", m_maxZone)); -// } // Collapse the zones into a 1,2,3... sequence, removing collapsed zones. m_maxZone = 1; @@ -2469,34 +2446,6 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye ++i; } -// for (i=1; i globalBounds.hi.y) bounds.hi.y = globalBounds.hi.y; -// Although a good safeguard, the logic is already proven, thus skip the check -// if (bounds.lo.x>bounds.hi.x || bounds.lo.y>bounds.hi.y) { -// DEBUG_CRASH(("Incorrect bounds calculation. Logic error, fix me. jba.")); -// continue; -// } m_zoneBlocks[xBlock][yBlock].blockCalculateZones(map, layers, bounds); } } - - - -//#ifdef DEBUG_QPF -//#if defined(DEBUG_LOGGING) -// QueryPerformanceCounter((LARGE_INTEGER *)&endTime64); -// timeToUpdate = ((double)(endTime64-startTime64) / (double)(freq64)); -// DEBUG_LOG(("Time to calculate second %f", timeToUpdate)); -//#endif -//#endif - - - - - - // Determine water/ground equivalent zones, and ground/cliff equivalent zones. -// for (i=0; i LAYER_GROUND) && -// (map[i][j].getType() == PathfindCell::CELL_CLEAR) ) { -// PathfindLayer *layer = layers + map[i][j].getConnectLayer(); -// resolveZones(map[i][j].getZone(), layer->getZone(), m_hierarchicalZones, m_maxZone); -// } -// if (i>globalBounds.lo.x && map[i][j].getZone()!=map[i-1][j].getZone()) { -// if (map[i][j].getType() == map[i-1][j].getType()) { -// applyZone(map[i][j], map[i-1][j], m_hierarchicalZones, m_maxZone); -// } -// if (waterGround(map[i][j], map[i-1][j])) { -// applyZone(map[i][j], map[i-1][j], m_groundWaterZones, m_maxZone); -// } -// if (groundRubble(map[i][j], map[i-1][j])) { -//// Int zone1 = map[i][j].getZone(); -//// Int zone2 = map[i-1][j].getZone(); -//// if (m_terrainZones[zone1] != m_terrainZones[zone2]) { -//// //DEBUG_LOG(("Matching terrain zone %d to %d.", zone1, zone2)); -//// } -// applyZone(map[i][j], map[i-1][j], m_groundRubbleZones, m_maxZone); -// } -// if (groundCliff(map[i][j], map[i-1][j])) { -// applyZone(map[i][j], map[i-1][j], m_groundCliffZones, m_maxZone); -// } -// if (terrain(map[i][j], map[i-1][j])) { -// applyZone(map[i][j], map[i-1][j], m_terrainZones, m_maxZone); -// } -// if (crusherGround(map[i][j], map[i-1][j])) { -// applyZone(map[i][j], map[i-1][j], m_crusherZones, m_maxZone); -// } -// } -// if (j>globalBounds.lo.y && map[i][j].getZone()!=map[i][j-1].getZone()) { -// if (map[i][j].getType() == map[i][j-1].getType()) { -// applyZone(map[i][j], map[i][j-1], m_hierarchicalZones, m_maxZone); -// } -// if (waterGround(map[i][j],map[i][j-1])) { -// applyZone(map[i][j], map[i][j-1], m_groundWaterZones, m_maxZone); -// } -// if (groundRubble(map[i][j], map[i][j-1])) { -//// Int zone1 = map[i][j].getZone(); -//// Int zone2 = map[i][j-1].getZone(); -//// if (m_terrainZones[zone1] != m_terrainZones[zone2]) { -//// //DEBUG_LOG(("Matching terrain zone %d to %d.", zone1, zone2)); -//// } -// applyZone(map[i][j], map[i][j-1], m_groundRubbleZones, m_maxZone); -// } -// if (groundCliff(map[i][j],map[i][j-1])) { -// applyZone(map[i][j], map[i][j-1], m_groundCliffZones, m_maxZone); -// } -// if (terrain(map[i][j], map[i][j-1])) { -// applyZone(map[i][j], map[i][j-1], m_terrainZones, m_maxZone); -// } -// if (crusherGround(map[i][j], map[i][j-1])) { -// applyZone(map[i][j], map[i][j-1], m_crusherZones, m_maxZone); -// } -// } -// // DEBUG_ASSERTCRASH(map[i][j].getZone() != 0, ("Cleared the zone.")); -// } -// } REGISTER UnsignedInt maxZone = m_maxZone; j=globalBounds.lo.y; while( j <= globalBounds.hi.y ) @@ -2793,31 +2601,12 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye } -// DEBUG_ASSERTCRASH(r_thisCell.getZone() != 0, ("Cleared the zone.")); - ++i; } ++j; } - - - - - - - - -// if (m_maxZone >= m_zonesAllocated) { -// RELEASE_CRASH("Pathfind allocation error - fatal. see jba."); -// } - -// for (i=1; igetPosition(); - Coord3D fenceNorm; - obj->getUnitDirectionVector2D( fenceNorm ); - Coord3D halfLength = fenceNorm; - halfLength.scale( obj->getGeometryInfo().getMajorRadius() ); - - Coord3D head = *fencePos; - head.add( &halfLength ); - Coord3D tail = *fencePos; - tail.sub( &halfLength ); - - Real stepLength = 1.0f / ((halfLength.length()*2.0f) / PATHFIND_CELL_SIZE_F); - - for ( Real t = 0.0f; t <= 1.0f; t += stepLength ) - { - Real lengthWalk_x = (head.x * t) + (tail.x * (1.0f-t)); - Real lengthWalk_y = (head.y * t) + (tail.y * (1.0f-t)); - - Int cx = REAL_TO_INT_FLOOR( lengthWalk_x / PATHFIND_CELL_SIZE_F ); - Int cy = REAL_TO_INT_FLOOR( lengthWalk_y / PATHFIND_CELL_SIZE_F ); - if (cx >= 0 && cy >= 0 && cx < m_extent.hi.x && cy < m_extent.hi.y) - { - if (insert) { - ICoord2D pos = { cx, cy }; - m_map[cx][cy].setTypeAsObstacle( obj, true, pos ); - } - else - m_map[cx][cy].removeObstacle(obj); - } - } -#endif - } /** @@ -4475,8 +4206,6 @@ void Pathfinder::internal_classifyObjectFootprint( Object *obj, Bool insert ) } // Expand building bounds 1 cell. -#define MARK_BORDER_PINCHED -#ifdef MARK_BORDER_PINCHED for( j=cellBounds.lo.y; j<=cellBounds.hi.y; j++ ) { for( i=cellBounds.lo.x; i<=cellBounds.hi.x; i++ ) @@ -4503,10 +4232,6 @@ void Pathfinder::internal_classifyObjectFootprint( Object *obj, Bool insert ) } } } -#endif - - - } /** @@ -4708,8 +4433,6 @@ void Pathfinder::debugShowSearch( Bool pathFound ) // show all explored cells for debugging PathfindCell *s; - - RGBColor color; color.red = color.blue = color.green = 1; if (!pathFound) { @@ -4732,7 +4455,6 @@ void Pathfinder::debugShowSearch( Bool pathFound ) for( s = m_closedList; s; s=s->getNextOpen() ) { - // create objects to show path - they decay // create objects to show path - they decay RGBColor color; color.red = color.blue = 1; @@ -4803,6 +4525,7 @@ Bool Pathfinder::validMovementTerrain( PathfindLayerEnum layer, const Locomotor* if (toCell == NULL) return false; + // Only do terrain, not obstacle cells. jba. if (toCell->getType()==PathfindCell::CELL_OBSTACLE) return true; if (toCell->getType()==PathfindCell::CELL_IMPASSABLE) return true; if (toCell->getLayer()!=LAYER_GROUND && toCell->getLayer() == PathfindCell::CELL_CLEAR) { @@ -4850,30 +4573,6 @@ void Pathfinder::cleanOpenAndClosedLists(void) { #endif m_cumulativeCellsAllocated += count; -//#ifdef RTS_DEBUG -#if 0 - // Check for dangling cells. - for( int j=0; j<=m_extent.hi.y; j++ ) - for( int i=0; i<=m_extent.hi.x; i++ ) - if (m_map[ i ][ j ].hasInfo()) { - DEBUG_ASSERTCRASH((m_map[i][j].getXIndex()==i && m_map[i][j].getYIndex()==j), ("Wrong cell coordinates")); - Bool needInfo = (m_map[ i ][ j ].getType() == PathfindCell::CELL_OBSTACLE); - if (m_map[i][j].isAircraftGoal()) { - needInfo = true; - } - if (m_map[i][j].getFlags() != PathfindCell::NO_UNITS) { - needInfo = true; - } - if (!needInfo) { - DEBUG_LOG(("leaked cell %d, %d", m_map[i][j].getXIndex(), m_map[i][j].getYIndex())); - m_map[i][j].releaseInfo(); - } - DEBUG_ASSERTCRASH((needInfo), ("Minor temporary memory leak - Extra cell allocated. Tell JBA steps if repeatable.")); - }; - //DEBUG_LOG(("Pathfind used %d cells.", count)); -#endif -//#endif - } @@ -4900,49 +4599,6 @@ Bool Pathfinder::validMovementPosition( Bool isCrusher, LocomotorSurfaceTypeMask if ((cellSurfaces & acceptableSurfaces) == 0) return false; -#if 0 - // - // For diagonal moves, check neighboring vertical and horizontal - // steps as well to avoid "squeezing through a crack". - // - if (fromCell) - { - ICoord2D delta; - - delta.x = toCell->getXIndex() - fromCell->getXIndex(); - delta.y = toCell->getYIndex() - fromCell->getYIndex(); - - if (delta.x != 0 && delta.y != 0) - { - // test vertical movement - PathfindCell *otherCell = getCell( toCell->getXIndex(), fromCell->getYIndex() ); - Bool open = true; - - // check if cell is on the map - if (otherCell == NULL) - open = false; - - // check if we can move onto this new cell - if (validMovementPosition( locomotorSet, otherCell, fromCell ) == false) - open = false; - - // test horizontal movement - if (open == false) - { - otherCell = getCell( fromCell->getXIndex(), toCell->getYIndex() ); - - // check if cell is on the map - if (otherCell == NULL) - return false; - - // check if we can move onto this new cell - if (validMovementPosition( locomotorSet, otherCell, fromCell ) == false) - return false; - } - } - } -#endif - return true; } @@ -5094,11 +4750,6 @@ Bool Pathfinder::checkForMovement(const Object *obj, TCheckMovementInfo &info) if (!unit->getAIUpdateInterface()) { return false; // can't path through not-idle units. } -#if 0 - if (!unit->getAIUpdateInterface()->isIdle()) { - return false; // can't path through not-idle units. - } -#endif Bool found = false; Int k; for (k=0; kx, dest->y, adjustDest.x, adjustDest.y, - //obj, obj->getTemplate()->getName().str())); return false; } @@ -5836,8 +5482,6 @@ Path *Pathfinder::getAircraftPath( const Object *obj, const Coord3D *to ) { // for now, quick path objects don't pathfind, generally airborne units // build a trivial one-node path containing destination, then avoid buildings. - - Path *thePath = newInstance(Path); const AIUpdateInterface *ai = obj->getAI(); ObjectID avoidObject = INVALID_ID; @@ -5901,9 +5545,6 @@ Path *Pathfinder::getAircraftPath( const Object *obj, const Coord3D *to ) } - - - /** * Process some path requests in the pathfind queue. */ @@ -5925,8 +5566,6 @@ void Pathfinder::processPathfindQueue(void) #endif #endif - - if ( #ifdef forceRefreshCalling #pragma message("AHHHH!, forced calls to pathzonerefresh still in code... notify M Lorenzen") @@ -6125,10 +5764,6 @@ struct ExamineCellsStruct to->setParentCell(from) ; to->setTotalCost(to->getCostSoFar() + costRemaining) ; - //DEBUG_LOG(("Cell (%d,%d), Parent cost %d, newCostSoFar %d, cost rem %d, tot %d", - // to->getXIndex(), to->getYIndex(), - // to->costSoFar(from), newCostSoFar, costRemaining, to->getCostSoFar() + costRemaining)); - // if to was on closed list, remove it from the list if (to->getClosed()) d->thePathfinder->m_closedList = to->removeFromClosedList( d->thePathfinder->m_closedList ); @@ -6145,8 +5780,6 @@ struct ExamineCellsStruct } - - Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell *goalCell, const LocomotorSet& locomotorSet, Bool isHuman, Bool centerInCell, Int radius, const ICoord2D &startCellNdx, const Object *obj, Int attackDistance) @@ -6189,8 +5822,6 @@ Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell * UnsignedInt newCostSoFar = 0; - - for( int i=0; isetTotalCost(newCell->getCostSoFar() + costRemaining) ; - //DEBUG_LOG(("Cell (%d,%d), Parent cost %d, newCostSoFar %d, cost rem %d, tot %d", - // newCell->getXIndex(), newCell->getYIndex(), - // newCell->costSoFar(parentCell), newCostSoFar, costRemaining, newCell->getCostSoFar() + costRemaining)); - // if newCell was on closed list, remove it from the list if (newCell->getClosed()) m_closedList = newCell->removeFromClosedList( m_closedList ); @@ -6438,50 +6063,6 @@ Path *Pathfinder::findPath( Object *obj, const LocomotorSet& locomotorSet, const return pat; } -/* hierarchical build path code. - if (pat) { - - Path *path = newInstance(Path); - PathNode *prior = NULL; - for (PathNode *node = pat->getLastNode(); node; node=node->getPrevious()) { - Bool unobstructed = true; - if (prior!=NULL) { - unobstructed = isLinePassable( obj, locomotorSet.getValidSurfaces(), - prior->getLayer(), *prior->getPosition(), *node->getPosition(), false, true); - } - if (unobstructed) { - path->prependNode( node->getPosition(), node->getLayer() ); - path->getFirstNode()->setCanOptimize(node->getCanOptimize()); - path->getFirstNode()->setNextOptimized(path->getFirstNode()->getNext()); - } else { - Path *linkPath = findClosestPath(obj, locomotorSet, node->getPosition(), - prior->getPosition(), false, 0, true); - if (linkPath==NULL) { - DEBUG_LOG(("Couldn't find path - unexpected. jba.")); - continue; - } - PathNode *linkNode = linkPath->getLastNode(); - if (linkNode==NULL) { - DEBUG_LOG(("Empty path - unexpected. jba.")); - continue; - } - for (linkNode=linkNode->getPrevious(); linkNode; linkNode=linkNode->getPrevious()) { - path->prependNode( linkNode->getPosition(), linkNode->getLayer() ); - path->getFirstNode()->setCanOptimize(linkNode->getCanOptimize()); - path->getFirstNode()->setNextOptimized(path->getFirstNode()->getNext()); - } - deleteInstance(linkPath); - } - prior = node; - } - deleteInstance(pat); - path->optimize(obj, locomotorSet.getValidSurfaces(), false); - if (TheGlobalData->m_debugAI) { - setDebugPath(path); - } - return path; - } -*/ return NULL; } /** @@ -7371,18 +6952,11 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, if (newCell->getCostSoFar() <= newCostSoFar) continue; } - //DEBUG_LOG(("CELL(%d,%d)L%d CD%d CSF %d, CR%d // ",newCell->getXIndex(), newCell->getYIndex(), - // newCell->getLayer(), clearDiameter, newCostSoFar, costRemaining)); - //if ((cellCount&7)==0) DEBUG_LOG_RAW(("\n")); newCell->setCostSoFar(newCostSoFar); // keep track of path we're building - point back to cell we moved here from newCell->setParentCell(parentCell) ; newCell->setTotalCost(newCell->getCostSoFar() + costRemaining) ; - //DEBUG_LOG(("Cell (%d,%d), Parent cost %d, newCostSoFar %d, cost rem %d, tot %d", - // newCell->getXIndex(), newCell->getYIndex(), - // newCell->costSoFar(parentCell), newCostSoFar, costRemaining, newCell->getCostSoFar() + costRemaining)); - // if newCell was on closed list, remove it from the list if (newCell->getClosed()) m_closedList = newCell->removeFromClosedList( m_closedList ); @@ -7394,8 +6968,6 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, // insert newCell in open list such that open list is sorted, smallest total path cost first m_openList = newCell->putOnSortedOpenList( m_openList ); } - - } // failure - goal cannot be reached #ifdef INTENSE_DEBUG @@ -7881,26 +7453,6 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu show |= (TheGlobalData->m_debugAI==AI_DEBUG_GROUND_PATHS); if (show) { debugShowSearch(true); -#if 0 // Show hierarchical blocks (big blue ones.) - Int i, j; - ICoord2D extent; - m_zoneManager.getExtent(extent); - for (i=0; igetGroundHeight( pos.x, pos.y ) + 0.5f; - if (m_zoneManager.isPassable(i*PathfindZoneManager::ZONE_BLOCK_SIZE, j*PathfindZoneManager::ZONE_BLOCK_SIZE)) { - addIcon(&pos, 5*PATHFIND_CELL_SIZE_F, 300, color); - } - } - } -#endif } #endif #if RETAIL_COMPATIBLE_PATHFINDING @@ -8089,32 +7641,7 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu m_isTunneling = false; // construct and return path Path *path = buildHierachicalPath( from, closestCell ); -#if defined(RTS_DEBUG) -#if 0 - if (TheGlobalData->m_debugAI) - { - debugShowSearch(true); - Int i, j; - ICoord2D extent; - m_zoneManager.getExtent(extent); - for (i=0; igetGroundHeight( pos.x, pos.y ) + 0.5f; - if (m_zoneManager.isPassable(i*PathfindZoneManager::ZONE_BLOCK_SIZE, j*PathfindZoneManager::ZONE_BLOCK_SIZE)) { - addIcon(&pos, 5*PATHFIND_CELL_SIZE_F, 300, color); - } - } - } - } -#endif -#endif + #if RETAIL_COMPATIBLE_PATHFINDING if (!s_useFixedPathfinding) { @@ -8498,8 +8025,7 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet Int dx = IABS(goalCell->getXIndex()-parentCell->getXIndex()); Int dy = IABS(goalCell->getYIndex()-parentCell->getYIndex()); Real distSqr = dx*dx+dy*dy; - //Real cost = (parentCell->getCostSoFar()*(parentCell->getCostSoFar()*COST_TO_DISTANCE_FACTOR))*0.5f; - //distSqr += sqr(cost); + if (distSqr < closestDistanceSqr) { closestCell = parentCell; closestDistanceSqr = distSqr; @@ -8608,10 +8134,6 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet newCell->setTotalCost(newCell->getCostSoFar() + costRemaining) ; - //DEBUG_LOG(("Cell (%d,%d), Parent cost %d, newCostSoFar %d, cost rem %d, tot %d", - // newCell->getXIndex(), newCell->getYIndex(), - // newCell->costSoFar(parentCell), newCostSoFar, costRemaining, newCell->getCostSoFar() + costRemaining)); - // if newCell was on closed list, remove it from the list if (newCell->getClosed()) m_closedList = newCell->removeFromClosedList( m_closedList ); @@ -8898,10 +8420,6 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con newCell->setTotalCost(newCell->getCostSoFar() + costRemaining) ; - //DEBUG_LOG(("Cell (%d,%d), Parent cost %d, newCostSoFar %d, cost rem %d, tot %d", - // newCell->getXIndex(), newCell->getYIndex(), - // newCell->costSoFar(parentCell), newCostSoFar, costRemaining, newCell->getCostSoFar() + costRemaining)); - // if newCell was on closed list, remove it from the list if (newCell->getClosed()) m_closedList = newCell->removeFromClosedList( m_closedList ); @@ -8944,8 +8462,6 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con } - - /** * Find a short, valid path between the FROM location and a location NEAR the to location. * Uses A* algorithm. @@ -9299,8 +8815,6 @@ void Pathfinder::adjustCoordToCell(Int cellX, Int cellY, Bool centerInCell, Coor } - - /** * Work backwards from goal cell to construct final path. */ @@ -10102,7 +9616,6 @@ void Pathfinder::updateGoal( Object *obj, const Coord3D *newGoalPos, PathfindLay PathfindLayerEnum originalLayer = obj->getDestinationLayer(); - //DEBUG_LOG(("Object Goal layer is %d", layer)); Bool layerChanged = originalLayer != layer; Bool doGround=false; @@ -10150,8 +9663,7 @@ void Pathfinder::updateGoal( Object *obj, const Coord3D *newGoalPos, PathfindLay if (cell) { if (warn && cell->getGoalUnit()!=INVALID_ID && cell->getGoalUnit() != obj->getID()) { warn = false; - // jba intense debug - //DEBUG_LOG(, ("Units got stuck close to each other. jba")); + //Units got stuck close to each other. jba } cellNdx.x = i; cellNdx.y = j; @@ -10163,8 +9675,7 @@ void Pathfinder::updateGoal( Object *obj, const Coord3D *newGoalPos, PathfindLay if (cell) { if (warn && cell->getGoalUnit()!=INVALID_ID && cell->getGoalUnit() != obj->getID()) { warn = false; - // jba intense debug - //DEBUG_LOG(, ("Units got stuck close to each other. jba")); + //Units got stuck close to each other. jba } cellNdx.x = i; cellNdx.y = j; @@ -10736,7 +10247,6 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, } - /** Patch to the exiting path from the current position, either because we became blocked, or because we had to move off the path to avoid other units. */ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet, @@ -10962,39 +10472,7 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomotorSet, const Coord3D *from, const Object *victim, const Coord3D* victimPos, const Weapon *weapon ) { - /* - CRCDEBUG_LOG(("Pathfinder::findAttackPath() for object %d (%s)", obj->getID(), obj->getTemplate()->getName().str())); - XferCRC xferCRC; - xferCRC.open("lightCRC"); - xferCRC.xferSnapshot((Object *)obj); - xferCRC.close(); - CRCDEBUG_LOG(("obj CRC is %X", xferCRC.getCRC())); - if (from) - { - CRCDEBUG_LOG(("from: (%g,%g,%g) (%X,%X,%X)", - from->x, from->y, from->z, - AS_INT(from->x), AS_INT(from->y), AS_INT(from->z))); - } - if (victim) - { - CRCDEBUG_LOG(("victim is %d (%s)", victim->getID(), victim->getTemplate()->getName().str())); - XferCRC xferCRC; - xferCRC.open("lightCRC"); - xferCRC.xferSnapshot((Object *)victim); - xferCRC.close(); - CRCDEBUG_LOG(("victim CRC is %X", xferCRC.getCRC())); - } - if (victimPos) - { - CRCDEBUG_LOG(("from: (%g,%g,%g) (%X,%X,%X)", - victimPos->x, victimPos->y, victimPos->z, - AS_INT(victimPos->x), AS_INT(victimPos->y), AS_INT(victimPos->z))); - } - */ if (m_isMapReady == false) return NULL; // Should always be ok. -#if defined(RTS_DEBUG) -// Int startTimeMS = ::GetTickCount(); -#endif Bool isCrusher = obj ? obj->getCrusherLevel() > 0 : false; Int radius; @@ -11042,8 +10520,6 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot } } - - const Int ATTACK_CELL_LIMIT = 2500; // this is a rather expensive operation, so limit the search. Bool isHuman = true; @@ -11182,9 +10658,7 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot #endif if (show) debugShowSearch(true); - #if defined(RTS_DEBUG) - //DEBUG_LOG(("Attack path took %d cells, %f sec", cellCount, (::GetTickCount()-startTimeMS)/1000.0f)); - #endif + // put parent cell onto closed list - its evaluation is finished m_closedList = parentCell->putOnClosedList( m_closedList ); // construct and return path From 1875dbfa296ede28400fdc7273bad5f7d5544017 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Mon, 22 Sep 2025 01:24:28 +1000 Subject: [PATCH 097/343] bugfix(input): Double-clicking to place a building no longer performs double-click selection logic (#1608) --- .../Source/GameClient/MessageStream/PlaceEventTranslator.cpp | 2 ++ .../Source/GameClient/MessageStream/PlaceEventTranslator.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp index 77a194390f7..4c0e714ad10 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp @@ -62,6 +62,8 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess { //--------------------------------------------------------------------------------------------- + // TheSuperHackers @bugfix Prevent double-clicks from falling through to other translators during building placement + case GameMessage::MSG_RAW_MOUSE_LEFT_DOUBLE_CLICK: case GameMessage::MSG_RAW_MOUSE_LEFT_BUTTON_DOWN: { // if we're in a building placement mode, do the place and send to all players diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp index 34508b20aa6..a2fd606d9b9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp @@ -68,6 +68,8 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess { //--------------------------------------------------------------------------------------------- + // TheSuperHackers @bugfix Prevent double-clicks from falling through to other translators during building placement + case GameMessage::MSG_RAW_MOUSE_LEFT_DOUBLE_CLICK: case GameMessage::MSG_RAW_MOUSE_LEFT_BUTTON_DOWN: { // if we're in a building placement mode, do the place and send to all players From a2cebd814c3ea7292c765d93894137b06296fe0e Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Tue, 23 Sep 2025 16:54:16 +1000 Subject: [PATCH 098/343] bugfix(module): Fix damage calculation for determining the initial death of GLA Battle Bus (#1603) --- .../GameEngine/Source/GameLogic/Object/Body/UndeadBody.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/UndeadBody.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/UndeadBody.cpp index 05b968d3223..c66ae7f5862 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/UndeadBody.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/UndeadBody.cpp @@ -81,7 +81,12 @@ void UndeadBody::attemptDamage( DamageInfo *damageInfo ) if( damageInfo->in.m_damageType != DAMAGE_UNRESISTABLE && !m_isSecondLife +#if RETAIL_COMPATIBLE_CRC && damageInfo->in.m_amount >= getHealth() +#else + // TheSuperHackers @bugfix Stubbjax 20/09/2025 Battle Buses now correctly apply damage modifiers when calculating lethal damage + && estimateDamage(damageInfo->in) >= getHealth() +#endif && IsHealthDamagingDamage(damageInfo->in.m_damageType) ) { From cd86cc4f21672545e11ea4eb7437abcd59df4b97 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 23 Sep 2025 09:19:28 +0200 Subject: [PATCH 099/343] bugfix(input): Fix broken single click command after right mouse double click (#1605) --- .../Source/GameClient/MessageStream/CommandXlat.cpp | 10 +++++++--- .../Source/GameClient/MessageStream/CommandXlat.cpp | 4 ++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index eebfe674230..e76839a56bb 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -3533,9 +3533,13 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } //----------------------------------------------------------------------------- - case GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_DOWN: - { - // There are two ways in which we can ignore this as a deselect: + // TheSuperHackers @bugfix Treat the raw double click event identical to the raw button down event + // because it implicitly is a raw button down event as well. Failing to do so would mess with the + // button timings in later events on button up. + case GameMessage::MSG_RAW_MOUSE_RIGHT_DOUBLE_CLICK: + case GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_DOWN: + { + // There are two ways in which we can ignore this as a deselect: // 1) 2-D position on screen // 2) Time has exceeded the time which we allow for this to be a click. m_mouseRightDragAnchor = msg->getArgument( 0 )->pixel; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index a6b9e2d19d9..e4c9f655da5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -3874,6 +3874,10 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } //----------------------------------------------------------------------------- + // TheSuperHackers @bugfix Treat the raw double click event identical to the raw button down event + // because it implicitly is a raw button down event as well. Failing to do so would mess with the + // button timings in later events on button up. + case GameMessage::MSG_RAW_MOUSE_RIGHT_DOUBLE_CLICK: case GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_DOWN: { // There are two ways in which we can ignore this as a deselect: From 80cc300e43ea58a74b5376170a1f52e9e6a51bc1 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 23 Sep 2025 10:11:56 +0200 Subject: [PATCH 100/343] refactor(tree): Simplify W3DTreeDraw related code (#1614) --- .../GameEngine/Include/Common/ThingTemplate.h | 1 + .../Source/GameLogic/System/GameLogic.cpp | 16 ++---- .../GameEngine/Include/Common/ThingTemplate.h | 1 + .../GameEngine/Include/GameLogic/GameLogic.h | 2 + .../Source/GameLogic/System/GameLogic.cpp | 52 ++++++++----------- .../W3DDevice/GameClient/Module/W3DTreeDraw.h | 17 +++--- .../W3DDevice/GameClient/W3DTreeBuffer.h | 38 +++++++------- .../GameClient/Drawable/Draw/W3DTreeDraw.cpp | 38 ++++---------- .../W3DDevice/GameClient/W3DTreeBuffer.cpp | 7 +-- 9 files changed, 69 insertions(+), 103 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/ThingTemplate.h b/Generals/Code/GameEngine/Include/Common/ThingTemplate.h index aaf7a2e7c69..2be32629a66 100644 --- a/Generals/Code/GameEngine/Include/Common/ThingTemplate.h +++ b/Generals/Code/GameEngine/Include/Common/ThingTemplate.h @@ -430,6 +430,7 @@ class ThingTemplate : public Overridable Real getFenceXOffset() const { return m_fenceXOffset; } // return fence offset Bool isBridge() const { return m_isBridge; } // return fence offset + Bool isBridgeLike() const { return isBridge() || isKindOf(KINDOF_WALK_ON_TOP_OF_WALL); } // Only Object can ask this. Everyone else should ask the Object. In fact, you really should ask the Object everything. Real friend_getVisionRange() const { return m_visionRange; } ///< get vision range diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 343f5889e85..1f01c04aa48 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -1565,14 +1565,7 @@ void GameLogic::startNewGame( Bool saveGame ) if( thingTemplate == NULL ) continue; - Bool isBridgeLikeObject = false; - - if (thingTemplate->isBridge()) - isBridgeLikeObject = true; - if (thingTemplate->isKindOf(KINDOF_WALK_ON_TOP_OF_WALL)) - isBridgeLikeObject = true; - - if (!isBridgeLikeObject) + if (!thingTemplate->isBridgeLike()) continue; Team *team = ThePlayerList->getNeutralPlayer()->getDefaultTeam(); @@ -1679,11 +1672,8 @@ void GameLogic::startNewGame( Bool saveGame ) if( thingTemplate == NULL ) continue; - Bool isBridgeLikeObject = false; - if (thingTemplate->isBridge()) isBridgeLikeObject = true; - if (thingTemplate->isKindOf(KINDOF_WALK_ON_TOP_OF_WALL)) isBridgeLikeObject = true; - if (isBridgeLikeObject) - continue; // bridges have to be added earlier. + if (thingTemplate->isBridgeLike()) + continue; // bridges have to be added earlier. Bool useTrees = TheGlobalData->m_useTrees; if (TheRecorder && TheRecorder->isMultiplayer()) { diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h b/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h index aa18d383212..14fbd7a4e7c 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h @@ -430,6 +430,7 @@ class ThingTemplate : public Overridable Real getFenceXOffset() const { return m_fenceXOffset; } // return fence offset Bool isBridge() const { return m_isBridge; } // return fence offset + Bool isBridgeLike() const { return isBridge() || isKindOf(KINDOF_WALK_ON_TOP_OF_WALL); } // Only Object can ask this. Everyone else should ask the Object. In fact, you really should ask the Object everything. Real friend_calcVisionRange() const { return m_visionRange; } ///< get vision range diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h index ddff182fc84..285847aad95 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h @@ -290,6 +290,8 @@ class GameLogic : public SubsystemInterface, public Snapshot void remakeSleepyUpdate(); void validateSleepyUpdate() const; + static void createOptimizedTree(const ThingTemplate *thingTemplate, Coord3D *pos, Real angle); + private: /** diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 0e3e69606fc..540731886dd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -1727,14 +1727,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) if( thingTemplate == NULL ) continue; - Bool isBridgeLikeObject = false; - - if (thingTemplate->isBridge()) - isBridgeLikeObject = true; - if (thingTemplate->isKindOf(KINDOF_WALK_ON_TOP_OF_WALL)) - isBridgeLikeObject = true; - - if (!isBridgeLikeObject) + if (!thingTemplate->isBridgeLike()) continue; Team *team = ThePlayerList->getNeutralPlayer()->getDefaultTeam(); @@ -1846,15 +1839,9 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) Coord3D pos = *pMapObj->getLocation(); pos.z += TheTerrainLogic->getGroundHeight( pos.x, pos.y ); Real angle = normalizeAngle(pMapObj->getAngle()); + if (thingTemplate->isKindOf(KINDOF_OPTIMIZED_TREE)) { - // Opt trees and props just get drawables to tell the client about it, then deleted. jba [6/5/2003] - // This way there is no logic object to slow down partition manager and core logic stuff. - Drawable *draw = TheThingFactory->newDrawable(thingTemplate); - if (draw) { - draw->setOrientation(angle); - draw->setPosition( &pos ); - TheGameClient->destroyDrawable(draw); - } + createOptimizedTree(thingTemplate, &pos, angle); } } } @@ -1884,11 +1871,8 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) if( thingTemplate == NULL ) continue; - Bool isBridgeLikeObject = false; - if (thingTemplate->isBridge()) isBridgeLikeObject = true; - if (thingTemplate->isKindOf(KINDOF_WALK_ON_TOP_OF_WALL)) isBridgeLikeObject = true; - if (isBridgeLikeObject) - continue; // bridges have to be added earlier. + if (thingTemplate->isBridgeLike()) + continue; // bridges have to be added earlier. // don't create trees and shrubs if this is one and we have that option off if( thingTemplate->isKindOf( KINDOF_SHRUBBERY ) && !useTrees ) @@ -1897,18 +1881,12 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) Coord3D pos = *pMapObj->getLocation(); pos.z += TheTerrainLogic->getGroundHeight( pos.x, pos.y ); Real angle = normalizeAngle(pMapObj->getAngle()); - if (thingTemplate->isKindOf(KINDOF_OPTIMIZED_TREE)) { - // Opt trees and props just get drawables to tell the client about it, then deleted. jba [6/5/2003] - // This way there is no logic object to slow down partition manager and core logic stuff. - Drawable *draw = TheThingFactory->newDrawable(thingTemplate); - if (draw) { - draw->setOrientation(angle); - draw->setPosition( &pos ); - TheGameClient->destroyDrawable(draw); - } + if (thingTemplate->isKindOf(KINDOF_OPTIMIZED_TREE)) { + createOptimizedTree(thingTemplate, &pos, angle); continue; } + #if 1 Bool isProp = thingTemplate->isKindOf(KINDOF_PROP); Bool isFluff = false; @@ -2428,6 +2406,20 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) } +//----------------------------------------------------------------------------------------- +void GameLogic::createOptimizedTree(const ThingTemplate *thingTemplate, Coord3D *pos, Real angle) +{ + // Opt trees and props just get drawables to tell the client about it, then deleted. jba [6/5/2003] + // This way there is no logic object to slow down partition manager and core logic stuff. + // TheSuperHackers @info Destroying the drawable will register the tree in the tree buffer. + Drawable *draw = TheThingFactory->newDrawable(thingTemplate); + if (draw) { + draw->setOrientation(angle); + draw->setPosition(pos); + TheGameClient->destroyDrawable(draw); + } +} + //----------------------------------------------------------------------------------------- static void findAndSelectCommandCenter(Object *obj, void* alreadyFound) { diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DTreeDraw.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DTreeDraw.h index 26b6303e42e..6e9190d82f5 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DTreeDraw.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DTreeDraw.h @@ -84,16 +84,17 @@ class W3DTreeDraw : public DrawModule W3DTreeDraw( Thing *thing, const ModuleData* moduleData ); // virtual destructor prototype provided by memory pool declaration - virtual void doDrawModule(const Matrix3D* transformMtx); - virtual void setShadowsEnabled(Bool enable) { } - virtual void releaseShadows(void) {}; ///< we don't care about preserving temporary shadows. - virtual void allocateShadows(void) {}; ///< we don't care about preserving temporary shadows. - virtual void setFullyObscuredByShroud(Bool fullyObscured) { } - virtual void reactToTransformChange(const Matrix3D* oldMtx, const Coord3D* oldPos, Real oldAngle); - virtual void reactToGeometryChange() { } + virtual void doDrawModule(const Matrix3D* transformMtx) {} + virtual void setShadowsEnabled(Bool enable) {} + virtual void releaseShadows(void) {} ///< we don't care about preserving temporary shadows. + virtual void allocateShadows(void) {} ///< we don't care about preserving temporary shadows. + virtual void setFullyObscuredByShroud(Bool fullyObscured) {} + virtual void reactToTransformChange(const Matrix3D* oldMtx, const Coord3D* oldPos, Real oldAngle) {} + virtual void reactToGeometryChange() {} protected: - Bool m_treeAdded; + + void addToTreeBuffer(); }; diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DTreeBuffer.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DTreeBuffer.h index 134affac93f..3b2b5892dec 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DTreeBuffer.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DTreeBuffer.h @@ -144,29 +144,31 @@ typedef struct { // // W3DTreeBuffer: Draw buffer for the trees. // +// TheSuperHackers @info This class acts as a bootstrap for adding a new tree +// instance to the tree buffer. It does not do anything useful until it is deleted. // class W3DTreeBuffer : public Snapshot { //friend class BaseHeightMapRenderObjClass; -//----------------------------------------------------------------------------- -// W3DTreeTextureClass -//----------------------------------------------------------------------------- -class W3DTreeTextureClass : public TextureClass -{ - W3DMPO_GLUE(W3DTreeTextureClass) -protected: - virtual void Apply(unsigned int stage); - -public: - /// Create texture. - W3DTreeTextureClass(unsigned width, unsigned height); - - // just use default destructor. ~TerrainTextureClass(void); -public: - int update(W3DTreeBuffer *buffer); ///< Sets the pixels, and returns the actual height of the texture. - void setLOD(Int LOD) const; -}; + //----------------------------------------------------------------------------- + // W3DTreeTextureClass + //----------------------------------------------------------------------------- + class W3DTreeTextureClass : public TextureClass + { + W3DMPO_GLUE(W3DTreeTextureClass) + protected: + virtual void Apply(unsigned int stage); + + public: + /// Create texture. + W3DTreeTextureClass(unsigned width, unsigned height); + + // just use default destructor. ~TerrainTextureClass(void); + public: + int update(W3DTreeBuffer *buffer); ///< Sets the pixels, and returns the actual height of the texture. + void setLOD(Int LOD) const; + }; public: diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTreeDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTreeDraw.cpp index 44b4317164e..a90cef1d9b4 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTreeDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTreeDraw.cpp @@ -24,7 +24,7 @@ // FILE: W3DTreeDraw.cpp //////////////////////////////////////////////////////////////////////// // Author: Colin Day, December 2001 -// Desc: Tracer drawing +// Desc: Tree draw /////////////////////////////////////////////////////////////////////////////////////////////////// // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// @@ -109,51 +109,31 @@ void W3DTreeDrawModuleData::buildFieldParse(MultiIniFieldParse& p) //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- -W3DTreeDraw::W3DTreeDraw( Thing *thing, const ModuleData* moduleData ) : DrawModule( thing, moduleData ), -m_treeAdded(false) +W3DTreeDraw::W3DTreeDraw( Thing *thing, const ModuleData* moduleData ) : DrawModule( thing, moduleData ) { - } - //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- W3DTreeDraw::~W3DTreeDraw( void ) { + addToTreeBuffer(); } //------------------------------------------------------------------------------------------------- -void W3DTreeDraw::reactToTransformChange( const Matrix3D *oldMtx, - const Coord3D *oldPos, - Real oldAngle ) +void W3DTreeDraw::addToTreeBuffer() { - Drawable *draw = getDrawable(); - if (m_treeAdded) { - return; - } - if (draw->getPosition()->x==0.0f && draw->getPosition()->y == 0.0f) { - return; - } - m_treeAdded = true; const W3DTreeDrawModuleData *moduleData = getW3DTreeDrawModuleData(); - if (!moduleData) { - return; - } + const Drawable *draw = getDrawable(); + + DEBUG_ASSERTCRASH(draw->getPosition()->x == 0.0f && draw->getPosition()->y == 0.0f, + ("W3DTreeDraw::addToTreeBuffer - Why place tree at x:0 y:0 ?")); + Real scale = draw->getScale(); Real scaleRandomness = draw->getTemplate()->getInstanceScaleFuzziness(); scaleRandomness = 0.0f; // We use the scale fuzziness inside WB to generate random scales, so they don't change at load time. jba. [4/22/2003] TheTerrainRenderObject->addTree(draw->getID(), *draw->getPosition(), scale, draw->getOrientation(), scaleRandomness, moduleData); - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void W3DTreeDraw::doDrawModule(const Matrix3D* transformMtx) -{ - - return; - } // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp index e418aaef20b..b2c9153b901 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp @@ -344,10 +344,7 @@ Int W3DTreeBuffer::getPartitionBucket(const Coord3D &pos) const } //============================================================================= -// W3DTreeBuffer::cull -//============================================================================= -/** Culls the trees, marking the visible flag. If a tree becomes visible, it sets -it's sortKey */ +// W3DTreeBuffer::updateSway //============================================================================= void W3DTreeBuffer::updateSway(const BreezeInfo& info) { @@ -1443,7 +1440,7 @@ void W3DTreeBuffer::addTree(DrawableID id, Coord3D location, Real scale, Real an m_trees[m_numTrees].bounds.Center *= m_trees[m_numTrees].scale; m_trees[m_numTrees].bounds.Radius *= m_trees[m_numTrees].scale; m_trees[m_numTrees].bounds.Center += m_trees[m_numTrees].location; - // Initially set it invisible. cull will update it's visiblity flag. + // Initially set it invisible. cull will update it's visibility flag. m_trees[m_numTrees].visible = false; m_trees[m_numTrees].drawableID = id; From 5a9a52617233a6f08ec975fe92e01d36107d5ab1 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 23 Sep 2025 10:12:19 +0200 Subject: [PATCH 101/343] bugfix(tree): Fix 1 in 10 trees not swaying (#1613) --- .../Source/W3DDevice/GameClient/W3DTreeBuffer.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp index b2c9153b901..087e9dfaa0a 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp @@ -359,10 +359,8 @@ void W3DTreeBuffer::updateSway(const BreezeInfo& info) m_swayOffsets[i].Z = C - 1.0f; } - Real delta = info.m_randomness * 0.5f; - for (i=0; i Date: Tue, 23 Sep 2025 10:12:37 +0200 Subject: [PATCH 102/343] perf(behavior): Optimize loops in ParkingPlaceBehavior (#1618) --- .../Object/Behavior/ParkingPlaceBehavior.cpp | 21 +++++++++++++------ .../Object/Behavior/FlightDeckBehavior.cpp | 2 ++ .../Object/Behavior/ParkingPlaceBehavior.cpp | 21 +++++++++++++------ 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp index 68cec00aa60..f51d9172177 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp @@ -352,9 +352,13 @@ Bool ParkingPlaceBehavior::reserveSpace(ObjectID id, Real parkingOffset, Parking for (std::vector::iterator it = m_runways.begin(); it != m_runways.end(); ++it) { - if (it->m_inUseBy == id && it->m_wasInLine) + if (it->m_inUseBy == id) { - info->runwayStart = info->runwayPrep; + if (it->m_wasInLine) + { + info->runwayStart = info->runwayPrep; + } + break; } } @@ -383,6 +387,7 @@ void ParkingPlaceBehavior::releaseSpace(ObjectID id) it->m_postponedRunwayReservationForTakeoff = false; if (pu) pu->setHoldDoorOpen(it->m_door, false); + break; } } } @@ -402,11 +407,15 @@ void ParkingPlaceBehavior::transferRunwayReservationToNextInLineForTakeoff(Objec purgeDead(); for (std::vector::iterator it = m_runways.begin(); it != m_runways.end(); ++it) { - if (it->m_inUseBy == id && it->m_nextInLineForTakeoff != INVALID_ID) + if (it->m_inUseBy == id) { - it->m_inUseBy = it->m_nextInLineForTakeoff; - it->m_wasInLine = true; - it->m_nextInLineForTakeoff = INVALID_ID; + if (it->m_nextInLineForTakeoff != INVALID_ID) + { + it->m_inUseBy = it->m_nextInLineForTakeoff; + it->m_wasInLine = true; + it->m_nextInLineForTakeoff = INVALID_ID; + } + break; } } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp index 2c6a6031844..6b94e64f015 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp @@ -569,6 +569,7 @@ void FlightDeckBehavior::calcPPInfo( ObjectID id, PPInfo *info ) if (it->m_inUseByForTakeoff == id ) { info->runwayStart = info->runwayPrep; + break; } } } @@ -586,6 +587,7 @@ void FlightDeckBehavior::releaseSpace(ObjectID id) if (it->m_objectInSpace == id) { it->m_objectInSpace = INVALID_ID; + break; } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp index 436770d9fbe..0ff6a2003c2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp @@ -410,9 +410,13 @@ void ParkingPlaceBehavior::calcPPInfo( ObjectID id, PPInfo *info ) for (std::vector::iterator it = m_runways.begin(); it != m_runways.end(); ++it) { - if (it->m_inUseBy == id && it->m_wasInLine) + if (it->m_inUseBy == id) { - info->runwayStart = info->runwayPrep; + if (it->m_wasInLine) + { + info->runwayStart = info->runwayPrep; + } + break; } } } @@ -434,6 +438,7 @@ void ParkingPlaceBehavior::releaseSpace(ObjectID id) it->m_postponedRunwayReservationForTakeoff = false; if (pu) pu->setHoldDoorOpen(it->m_door, false); + break; } } @@ -461,11 +466,15 @@ void ParkingPlaceBehavior::transferRunwayReservationToNextInLineForTakeoff(Objec purgeDead(); for (std::vector::iterator it = m_runways.begin(); it != m_runways.end(); ++it) { - if (it->m_inUseBy == id && it->m_nextInLineForTakeoff != INVALID_ID) + if (it->m_inUseBy == id) { - it->m_inUseBy = it->m_nextInLineForTakeoff; - it->m_wasInLine = true; - it->m_nextInLineForTakeoff = INVALID_ID; + if (it->m_nextInLineForTakeoff != INVALID_ID) + { + it->m_inUseBy = it->m_nextInLineForTakeoff; + it->m_wasInLine = true; + it->m_nextInLineForTakeoff = INVALID_ID; + } + break; } } } From e87031fce372ac75f2e47255ff80916e3abccaf7 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Fri, 26 Sep 2025 00:58:48 +1000 Subject: [PATCH 103/343] bugfix(buildassistant): Prevent showing the invalid placement indicator for shrouded objects (#1543) --- .../Source/Common/System/BuildAssistant.cpp | 16 ++++++++++++---- .../Source/Common/System/BuildAssistant.cpp | 18 ++++++++++++++++-- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index 03ea8267ea5..14e82de6d68 100644 --- a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -650,7 +650,9 @@ void BuildAssistant::iterateFootprint( const ThingTemplate *build, //------------------------------------------------------------------------------------------------- -/** Check for objects preventing building at this location. */ +/** Check for objects preventing building at this location. + * TheSuperHackers @tweak Stubbjax 05/09/2025 Return LBC_SHROUD for shrouded objects near the + * edge of the shroud so that players cannot use this info to determine whether they exist. */ //------------------------------------------------------------------------------------------------- Bool BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos, const ThingTemplate *build, @@ -668,6 +670,8 @@ Bool BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos, MemoryPoolObjectHolder hold(iter); for( them = iter->first(); them; them = iter->next() ) { + if (them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud()) + return false; // ignore any kind of class of objects that we will "remove" for building if( isRemovableForConstruction( them ) == TRUE ) @@ -797,22 +801,26 @@ Bool BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos, // an immobile object will obstruct our building no matter what team it's on if ( them->isKindOf( KINDOF_IMMOBILE ) ) { + Bool shrouded = them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud(); /* Check for overlap of my exit rectangle to his geom info. */ if (checkMyExit && ThePartitionManager->geomCollidesWithGeom(them->getPosition(), hisBounds, them->getOrientation(), &myExitPos, myGeom, angle)) { - TheTerrainVisual->addFactionBib(them, true); + if (!shrouded) + TheTerrainVisual->addFactionBib(them, true); return false; } // Check for overlap of his exit rectangle with my geom info if (checkHisExit && ThePartitionManager->geomCollidesWithGeom(&hisExitPos, hisGeom, them->getOrientation(), worldPos, myBounds, angle)) { - TheTerrainVisual->addFactionBib(them, true); + if (!shrouded) + TheTerrainVisual->addFactionBib(them, true); return false; } // Check both exit rectangles together. if (checkMyExit&&checkHisExit&&ThePartitionManager->geomCollidesWithGeom(&hisExitPos, hisGeom, them->getOrientation(), &myExitPos, myGeom, angle)) { - TheTerrainVisual->addFactionBib(them, true); + if (!shrouded) + TheTerrainVisual->addFactionBib(them, true); return false; } } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index 055565ad33b..2b498c2ae92 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -650,7 +650,9 @@ void BuildAssistant::iterateFootprint( const ThingTemplate *build, //------------------------------------------------------------------------------------------------- -/** Check for objects preventing building at this location. */ +/** Check for objects preventing building at this location. + * TheSuperHackers @tweak Stubbjax 05/09/2025 Return LBC_SHROUD for shrouded objects near the + * edge of the shroud so that players cannot use this info to determine whether they exist. */ //------------------------------------------------------------------------------------------------- LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos, const ThingTemplate *build, @@ -668,8 +670,10 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos MemoryPoolObjectHolder hold(iter); for( them = iter->first(); them; them = iter->next() ) { - Bool feedbackWithFailure = TRUE; + if (them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud()) + return LBC_SHROUD; + Bool feedbackWithFailure = TRUE; Relationship rel = builderObject ? builderObject->getRelationship( them ) : NEUTRAL; //Kris: If the object is stealthed and we can't see it, pretend we can build there. @@ -865,21 +869,31 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos // an immobile object will obstruct our building no matter what team it's on if ( them->isKindOf( KINDOF_IMMOBILE ) ) { + Bool shrouded = them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud(); /* Check for overlap of my exit rectangle to his geom info. */ if (checkMyExit && ThePartitionManager->geomCollidesWithGeom(them->getPosition(), hisBounds, them->getOrientation(), &myExitPos, myGeom, angle)) { + if (shrouded) + return LBC_SHROUD; + TheTerrainVisual->addFactionBib(them, true); return LBC_OBJECTS_IN_THE_WAY; } // Check for overlap of his exit rectangle with my geom info if (checkHisExit && ThePartitionManager->geomCollidesWithGeom(&hisExitPos, hisGeom, them->getOrientation(), worldPos, myBounds, angle)) { + if (shrouded) + return LBC_SHROUD; + TheTerrainVisual->addFactionBib(them, true); return LBC_OBJECTS_IN_THE_WAY; } // Check both exit rectangles together. if (checkMyExit&&checkHisExit&&ThePartitionManager->geomCollidesWithGeom(&hisExitPos, hisGeom, them->getOrientation(), &myExitPos, myGeom, angle)) { + if (shrouded) + return LBC_SHROUD; + TheTerrainVisual->addFactionBib(them, true); return LBC_OBJECTS_IN_THE_WAY; } From e8ef120015466d0d6a567422bc4f4bc9e1457aa9 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Fri, 26 Sep 2025 00:59:11 +1000 Subject: [PATCH 104/343] bugfix(gui): Consistently show blue health bars for disabled objects (#1622) --- Generals/Code/GameEngine/Source/GameClient/Drawable.cpp | 5 ++++- GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index 04dfd91e83d..9891fb0f89b 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -3387,7 +3387,10 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion) // Color color, outlineColor; - if( obj->getStatusBits().test( OBJECT_STATUS_UNDER_CONSTRUCTION ) || (obj->isDisabled() && !obj->isDisabledByType(DISABLED_HELD)) ) + DisabledMaskType mask = obj->getDisabledFlags(); + mask.clear(MAKE_DISABLED_MASK(DISABLED_HELD)); + + if (obj->getStatusBits().test(OBJECT_STATUS_UNDER_CONSTRUCTION) || DISABLEDMASK_ANY_SET(mask)) { color = GameMakeColor( 0, healthRatio * 255.0f, 255, 255 );//blue to cyan outlineColor = GameMakeColor( 0, healthRatio * 128.0f, 128, 255 );//dark blue to dark cyan diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index 795f98762b0..328440a0ea5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -3885,7 +3885,10 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion) // Color color, outlineColor; - if( obj->getStatusBits().test( OBJECT_STATUS_UNDER_CONSTRUCTION ) || (obj->isDisabled() && !obj->isDisabledByType(DISABLED_HELD)) ) + DisabledMaskType mask = obj->getDisabledFlags(); + mask.clear(MAKE_DISABLED_MASK(DISABLED_HELD)); + + if (obj->getStatusBits().test(OBJECT_STATUS_UNDER_CONSTRUCTION) || DISABLEDMASK_ANY_SET(mask)) { color = GameMakeColor( 0, healthRatio * 255.0f, 255, 255 );//blue to cyan outlineColor = GameMakeColor( 0, healthRatio * 128.0f, 128, 255 );//dark blue to dark cyan From 5ba1741dd3335b085e8a36507ab3398687165fe8 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Fri, 26 Sep 2025 01:15:49 +1000 Subject: [PATCH 105/343] bugfix(module): GLA Battle Bus can no longer be subdued indefinitely (#1604) --- .../Source/GameLogic/Object/Body/ActiveBody.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp index 0808282786e..f0fea0540ef 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp @@ -492,9 +492,11 @@ void ActiveBody::attemptDamage( DamageInfo *damageInfo ) if( !canBeSubdued() ) return; + // TheSuperHackers @bugfix Stubbjax 20/09/2025 The isSubdued() function now directly checks status instead + // of health to prevent indefinite subdue status when internally shifting health across the threshold. Bool wasSubdued = isSubdued(); internalAddSubdualDamage(amount); - Bool nowSubdued = isSubdued(); + Bool nowSubdued = m_maxHealth <= m_currentSubdualDamage; alreadyHandled = TRUE; allowModifier = FALSE; @@ -1313,7 +1315,11 @@ void ActiveBody::onSubdualChange( Bool isNowSubdued ) //------------------------------------------------------------------------------------------------- Bool ActiveBody::isSubdued() const { +#if RETAIL_COMPATIBLE_CRC return m_maxHealth <= m_currentSubdualDamage; +#else + return getObject()->isDisabledByType(DISABLED_SUBDUED); +#endif } //------------------------------------------------------------------------------------------------- From 04b968f6e55c69f699e47f5154c592d614e1ba06 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Fri, 26 Sep 2025 20:15:15 +1000 Subject: [PATCH 106/343] bugfix(contain): Fix unit attachments being visible in fog after exiting a GLA Tunnel Network (#1522) --- .../Source/GameLogic/Object/Contain/TunnelContain.cpp | 8 +++++++- .../Source/GameLogic/Object/Contain/TunnelContain.cpp | 10 +++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp index 68e5d01e8b0..40667378f7b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp @@ -105,7 +105,6 @@ void TunnelContain::removeFromContain( Object *obj, Bool exposeStealthUnits ) return; owningPlayer->getTunnelSystem()->removeFromContain( obj, exposeStealthUnits ); - } //------------------------------------------------------------------------------------------------- @@ -164,6 +163,7 @@ void TunnelContain::onRemoving( Object *obj ) obj->clearDisabled( DISABLED_HELD ); /// place the object in the world at position of the container m_object +#if RETAIL_COMPATIBLE_CRC ThePartitionManager->registerObject( obj ); obj->setPosition( getObject()->getPosition() ); if( obj->getDrawable() ) @@ -171,6 +171,12 @@ void TunnelContain::onRemoving( Object *obj ) obj->setSafeOcclusionFrame(TheGameLogic->getFrame()+obj->getTemplate()->getOcclusionDelay()); obj->getDrawable()->setDrawableHidden( false ); } +#else + // TheSuperHackers @bugfix Now correctly adds the objects to the world without issues with shrouded portable structures. + obj->setPosition(getObject()->getPosition()); + obj->setSafeOcclusionFrame(TheGameLogic->getFrame() + obj->getTemplate()->getOcclusionDelay()); + addOrRemoveObjFromWorld(obj, TRUE); +#endif doUnloadSound(); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp index 6d639e77baf..20245689ed3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp @@ -105,7 +105,6 @@ void TunnelContain::removeFromContain( Object *obj, Bool exposeStealthUnits ) return; owningPlayer->getTunnelSystem()->removeFromContain( obj, exposeStealthUnits ); - } @@ -241,6 +240,7 @@ void TunnelContain::onRemoving( Object *obj ) obj->clearDisabled( DISABLED_HELD ); /// place the object in the world at position of the container m_object +#if RETAIL_COMPATIBLE_CRC ThePartitionManager->registerObject( obj ); obj->setPosition( getObject()->getPosition() ); if( obj->getDrawable() ) @@ -248,10 +248,14 @@ void TunnelContain::onRemoving( Object *obj ) obj->setSafeOcclusionFrame(TheGameLogic->getFrame()+obj->getTemplate()->getOcclusionDelay()); obj->getDrawable()->setDrawableHidden( false ); } +#else + // TheSuperHackers @bugfix Now correctly adds the objects to the world without issues with shrouded portable structures. + obj->setPosition(getObject()->getPosition()); + obj->setSafeOcclusionFrame(TheGameLogic->getFrame() + obj->getTemplate()->getOcclusionDelay()); + addOrRemoveObjFromWorld(obj, TRUE); +#endif doUnloadSound(); - - } //------------------------------------------------------------------------------------------------- From 63ec8d0a66558e8e70ec0b7620f644e11ab44581 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 27 Sep 2025 08:50:16 +0200 Subject: [PATCH 107/343] tweak(options): Simplify user options for Cursor Capture (#1541) Replaces CursorCaptureMode with the following options in Options.ini: CursorCaptureEnabledInFullscreenGame=yes CursorCaptureEnabledInFullscreenMenu=yes CursorCaptureEnabledInWindowedGame=yes CursorCaptureEnabledInWindowedMenu=no --- .../Include/Common/UserPreferences.h | 6 +- .../GameEngine/Include/GameClient/Mouse.h | 22 +++--- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 71 +++++++++++++++---- .../Source/GameClient/Input/Mouse.cpp | 68 +++++++++--------- .../Include/Common/UserPreferences.h | 6 +- .../GameEngine/Include/GameClient/Mouse.h | 22 +++--- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 71 +++++++++++++++---- .../Source/GameClient/Input/Mouse.cpp | 68 +++++++++--------- 8 files changed, 212 insertions(+), 122 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/UserPreferences.h b/Generals/Code/GameEngine/Include/Common/UserPreferences.h index 5f1b033aed8..88f5874651b 100644 --- a/Generals/Code/GameEngine/Include/Common/UserPreferences.h +++ b/Generals/Code/GameEngine/Include/Common/UserPreferences.h @@ -38,7 +38,7 @@ //----------------------------------------------------------------------------- #include "Common/STLTypedefs.h" -enum CursorCaptureMode CPP_11(: Int); +typedef UnsignedInt CursorCaptureMode; typedef UnsignedInt ScreenEdgeScrollMode; //----------------------------------------------------------------------------- @@ -95,6 +95,10 @@ class OptionPreferences : public UserPreferences Real getScrollFactor(void); // convenience function Bool getDrawScrollAnchor(void); Bool getMoveScrollAnchor(void); + Bool getCursorCaptureEnabledInWindowedGame() const; + Bool getCursorCaptureEnabledInWindowedMenu() const; + Bool getCursorCaptureEnabledInFullscreenGame() const; + Bool getCursorCaptureEnabledInFullscreenMenu() const; CursorCaptureMode getCursorCaptureMode() const; Bool getScreenEdgeScrollEnabledInWindowedApp() const; Bool getScreenEdgeScrollEnabledInFullscreenApp() const; diff --git a/Generals/Code/GameEngine/Include/GameClient/Mouse.h b/Generals/Code/GameEngine/Include/GameClient/Mouse.h index 1253b7c66cf..a8c4090a135 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Mouse.h +++ b/Generals/Code/GameEngine/Include/GameClient/Mouse.h @@ -141,19 +141,20 @@ class CursorInfo Int numDirections; //number of directions for cursors like scrolling/panning. }; -enum CursorCaptureMode CPP_11(: Int) +typedef UnsignedInt CursorCaptureMode; +enum CursorCaptureMode_ CPP_11(: CursorCaptureMode) { - CursorCaptureMode_None, // Does not capture the cursor - CursorCaptureMode_InGame, // Captures the cursor when playing and observing - CursorCaptureMode_Always, // Captures the cursor always in menus and game - CursorCaptureMode_Auto, // Applies mode "InGame" when Windowed, "Always" when Fullscreen - - CursorCaptureMode_Count, - CursorCaptureMode_Default = CursorCaptureMode_Auto, + CursorCaptureMode_EnabledInWindowedGame = 1<<0, // Captures the cursor when in game while the app is windowed + CursorCaptureMode_EnabledInWindowedMenu = 1<<1, // Captures the cursor when in menu while the app is windowed + CursorCaptureMode_EnabledInFullscreenGame = 1<<2, // Captures the cursor when in game while the app is fullscreen + CursorCaptureMode_EnabledInFullscreenMenu = 1<<3, // Captures the cursor when in menu while the app is fullscreen + + CursorCaptureMode_Default = + CursorCaptureMode_EnabledInWindowedGame | + CursorCaptureMode_EnabledInFullscreenGame | + CursorCaptureMode_EnabledInFullscreenMenu, }; -extern const char* const TheCursorCaptureModeNames[]; - // Mouse ---------------------------------------------------------------------- // Class interface for working with a mouse pointing device // @@ -170,7 +171,6 @@ class Mouse : public SubsystemInterface enum CursorCaptureBlockReason { CursorCaptureBlockReason_NoInit, - CursorCaptureBlockReason_NoGame, CursorCaptureBlockReason_Paused, CursorCaptureBlockReason_Unfocused, diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index 041dc6850e9..e4383dae01f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -372,21 +372,61 @@ Bool OptionPreferences::getMoveScrollAnchor(void) return FALSE; } +Bool OptionPreferences::getCursorCaptureEnabledInWindowedGame() const +{ + OptionPreferences::const_iterator it = find("CursorCaptureEnabledInWindowedGame"); + if (it == end()) + return (CursorCaptureMode_Default & CursorCaptureMode_EnabledInWindowedGame) != 0; + + if (stricmp(it->second.str(), "yes") == 0) + return TRUE; + + return FALSE; +} + +Bool OptionPreferences::getCursorCaptureEnabledInWindowedMenu() const +{ + OptionPreferences::const_iterator it = find("CursorCaptureEnabledInWindowedMenu"); + if (it == end()) + return (CursorCaptureMode_Default & CursorCaptureMode_EnabledInWindowedMenu) != 0; + + if (stricmp(it->second.str(), "yes") == 0) + return TRUE; + + return FALSE; +} + +Bool OptionPreferences::getCursorCaptureEnabledInFullscreenGame() const +{ + OptionPreferences::const_iterator it = find("CursorCaptureEnabledInFullscreenGame"); + if (it == end()) + return (CursorCaptureMode_Default & CursorCaptureMode_EnabledInFullscreenGame) != 0; + + if (stricmp(it->second.str(), "yes") == 0) + return TRUE; + + return FALSE; +} + +Bool OptionPreferences::getCursorCaptureEnabledInFullscreenMenu() const +{ + OptionPreferences::const_iterator it = find("CursorCaptureEnabledInFullscreenMenu"); + if (it == end()) + return (CursorCaptureMode_Default & CursorCaptureMode_EnabledInFullscreenMenu) != 0; + + if (stricmp(it->second.str(), "yes") == 0) + return TRUE; + + return FALSE; +} + CursorCaptureMode OptionPreferences::getCursorCaptureMode() const { - CursorCaptureMode mode = CursorCaptureMode_Default; - OptionPreferences::const_iterator it = find("CursorCaptureMode"); - if (it != end()) - { - for (Int i = 0; i < CursorCaptureMode_Count; ++i) - { - if (stricmp(it->second.str(), TheCursorCaptureModeNames[i]) == 0) - { - mode = static_cast(i); - break; - } - } - } + CursorCaptureMode mode = 0; + mode |= getCursorCaptureEnabledInWindowedGame() ? CursorCaptureMode_EnabledInWindowedGame : 0; + mode |= getCursorCaptureEnabledInWindowedMenu() ? CursorCaptureMode_EnabledInWindowedMenu : 0; + mode |= getCursorCaptureEnabledInFullscreenGame() ? CursorCaptureMode_EnabledInFullscreenGame : 0; + mode |= getCursorCaptureEnabledInFullscreenMenu() ? CursorCaptureMode_EnabledInFullscreenMenu : 0; return mode; } @@ -1233,7 +1273,10 @@ static void saveOptions( void ) // TheSuperHackers @todo Add combo box ? { CursorCaptureMode mode = pref->getCursorCaptureMode(); - (*pref)["CursorCaptureMode"] = TheCursorCaptureModeNames[mode]; + (*pref)["CursorCaptureEnabledInWindowedGame"] = (mode & CursorCaptureMode_EnabledInWindowedGame) ? "yes" : "no"; + (*pref)["CursorCaptureEnabledInWindowedMenu"] = (mode & CursorCaptureMode_EnabledInWindowedMenu) ? "yes" : "no"; + (*pref)["CursorCaptureEnabledInFullscreenGame"] = (mode & CursorCaptureMode_EnabledInFullscreenGame) ? "yes" : "no"; + (*pref)["CursorCaptureEnabledInFullscreenMenu"] = (mode & CursorCaptureMode_EnabledInFullscreenMenu) ? "yes" : "no"; TheMouse->setCursorCaptureMode(mode); } diff --git a/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp b/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp index dbc4489deae..386d12f6d74 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp @@ -53,14 +53,6 @@ // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// Mouse *TheMouse = NULL; -const char* const TheCursorCaptureModeNames[] = { - "None", - "InGame", - "Always", - "Auto", -}; -static_assert(ARRAY_SIZE(TheCursorCaptureModeNames) == CursorCaptureMode_Count, "Incorrect array size"); - const char *const Mouse::RedrawModeName[] = { "Mouse:Windows", "Mouse:W3D", @@ -70,7 +62,6 @@ const char *const Mouse::RedrawModeName[] = { const char *const Mouse::CursorCaptureBlockReasonNames[] = { "CursorCaptureBlockReason_NoInit", - "CursorCaptureBlockReason_NoGame", "CursorCaptureBlockReason_Paused", "CursorCaptureBlockReason_Unfocused", }; @@ -552,8 +543,8 @@ Mouse::Mouse( void ) m_cursorCaptureMode = CursorCaptureMode_Default; - m_captureBlockReasonBits = (1 << CursorCaptureBlockReason_NoInit) | (1 << CursorCaptureBlockReason_NoGame); - DEBUG_LOG(("Mouse::Mouse: m_blockCaptureReason=CursorCaptureBlockReason_NoInit|CursorCaptureBlockReason_NoGame")); + m_captureBlockReasonBits = (1 << CursorCaptureBlockReason_NoInit); + DEBUG_LOG(("Mouse::Mouse: m_blockCaptureReason=CursorCaptureBlockReason_NoInit")); } @@ -653,17 +644,7 @@ void Mouse::mouseNotifyResolutionChange( void ) //------------------------------------------------------------------------------------------------- void Mouse::onGameModeChanged(GameMode prev, GameMode next) { - const Bool wasInteractiveGame = GameLogic::isInInteractiveGame(prev); - const Bool isInteractiveGame = GameLogic::isInInteractiveGame(next); - - if (wasInteractiveGame && !isInteractiveGame) - { - blockCapture(CursorCaptureBlockReason_NoGame); - } - else if (!wasInteractiveGame && isInteractiveGame) - { - unblockCapture(CursorCaptureBlockReason_NoGame); - } + refreshCursorCapture(); } //------------------------------------------------------------------------------------------------- @@ -1072,23 +1053,40 @@ void Mouse::initCapture() // ------------------------------------------------------------------------------------------------ Bool Mouse::canCapture() const { - constexpr const CursorCaptureBlockReasonInt noGameBits = CursorCaptureBlockReason_NoGame | CursorCaptureBlockReason_Paused; + if (m_captureBlockReasonBits != 0) + return false; + + DEBUG_ASSERTCRASH(TheDisplay != NULL, ("The Display is NULL")); + const Bool inInteractiveGame = TheGameLogic && TheGameLogic->isInInteractiveGame(); - switch (m_cursorCaptureMode) + if (TheDisplay->getWindowed()) { - case CursorCaptureMode_None: - return false; - case CursorCaptureMode_InGame: - return (m_captureBlockReasonBits == 0); - case CursorCaptureMode_Always: - return (m_captureBlockReasonBits & ~noGameBits) == 0; - case CursorCaptureMode_Auto: - default: - if (TheDisplay == NULL || TheDisplay->getWindowed()) - return (m_captureBlockReasonBits == 0); + if (inInteractiveGame) + { + if ((m_cursorCaptureMode & CursorCaptureMode_EnabledInWindowedGame) == 0) + return false; + } else - return (m_captureBlockReasonBits & ~noGameBits) == 0; + { + if ((m_cursorCaptureMode & CursorCaptureMode_EnabledInWindowedMenu) == 0) + return false; + } } + else + { + if (inInteractiveGame) + { + if ((m_cursorCaptureMode & CursorCaptureMode_EnabledInFullscreenGame) == 0) + return false; + } + else + { + if ((m_cursorCaptureMode & CursorCaptureMode_EnabledInFullscreenMenu) == 0) + return false; + } + } + + return true; } // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h b/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h index 369d16f6277..27fc7963500 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h @@ -39,7 +39,7 @@ #include "Common/STLTypedefs.h" class Money; -enum CursorCaptureMode CPP_11(: Int); +typedef UnsignedInt CursorCaptureMode; typedef UnsignedInt ScreenEdgeScrollMode; //----------------------------------------------------------------------------- @@ -98,6 +98,10 @@ class OptionPreferences : public UserPreferences Real getScrollFactor(void); // convenience function Bool getDrawScrollAnchor(void); Bool getMoveScrollAnchor(void); + Bool getCursorCaptureEnabledInWindowedGame() const; + Bool getCursorCaptureEnabledInWindowedMenu() const; + Bool getCursorCaptureEnabledInFullscreenGame() const; + Bool getCursorCaptureEnabledInFullscreenMenu() const; CursorCaptureMode getCursorCaptureMode() const; Bool getScreenEdgeScrollEnabledInWindowedApp() const; Bool getScreenEdgeScrollEnabledInFullscreenApp() const; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h index 0d859a5899b..7211ea4f82e 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h @@ -141,19 +141,20 @@ class CursorInfo Int numDirections; //number of directions for cursors like scrolling/panning. }; -enum CursorCaptureMode CPP_11(: Int) +typedef UnsignedInt CursorCaptureMode; +enum CursorCaptureMode_ CPP_11(: CursorCaptureMode) { - CursorCaptureMode_None, // Does not capture the cursor - CursorCaptureMode_InGame, // Captures the cursor when playing and observing - CursorCaptureMode_Always, // Captures the cursor always in menus and game - CursorCaptureMode_Auto, // Applies mode "InGame" when Windowed, "Always" when Fullscreen - - CursorCaptureMode_Count, - CursorCaptureMode_Default = CursorCaptureMode_Auto, + CursorCaptureMode_EnabledInWindowedGame = 1<<0, // Captures the cursor when in game while the app is windowed + CursorCaptureMode_EnabledInWindowedMenu = 1<<1, // Captures the cursor when in menu while the app is windowed + CursorCaptureMode_EnabledInFullscreenGame = 1<<2, // Captures the cursor when in game while the app is fullscreen + CursorCaptureMode_EnabledInFullscreenMenu = 1<<3, // Captures the cursor when in menu while the app is fullscreen + + CursorCaptureMode_Default = + CursorCaptureMode_EnabledInWindowedGame | + CursorCaptureMode_EnabledInFullscreenGame | + CursorCaptureMode_EnabledInFullscreenMenu, }; -extern const char* const TheCursorCaptureModeNames[]; - // Mouse ---------------------------------------------------------------------- // Class interface for working with a mouse pointing device // @@ -170,7 +171,6 @@ class Mouse : public SubsystemInterface enum CursorCaptureBlockReason { CursorCaptureBlockReason_NoInit, - CursorCaptureBlockReason_NoGame, CursorCaptureBlockReason_Paused, CursorCaptureBlockReason_Unfocused, diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index 85952fe57be..37d674c41b2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -404,21 +404,61 @@ Bool OptionPreferences::getMoveScrollAnchor(void) return FALSE; } +Bool OptionPreferences::getCursorCaptureEnabledInWindowedGame() const +{ + OptionPreferences::const_iterator it = find("CursorCaptureEnabledInWindowedGame"); + if (it == end()) + return (CursorCaptureMode_Default & CursorCaptureMode_EnabledInWindowedGame) != 0; + + if (stricmp(it->second.str(), "yes") == 0) + return TRUE; + + return FALSE; +} + +Bool OptionPreferences::getCursorCaptureEnabledInWindowedMenu() const +{ + OptionPreferences::const_iterator it = find("CursorCaptureEnabledInWindowedMenu"); + if (it == end()) + return (CursorCaptureMode_Default & CursorCaptureMode_EnabledInWindowedMenu) != 0; + + if (stricmp(it->second.str(), "yes") == 0) + return TRUE; + + return FALSE; +} + +Bool OptionPreferences::getCursorCaptureEnabledInFullscreenGame() const +{ + OptionPreferences::const_iterator it = find("CursorCaptureEnabledInFullscreenGame"); + if (it == end()) + return (CursorCaptureMode_Default & CursorCaptureMode_EnabledInFullscreenGame) != 0; + + if (stricmp(it->second.str(), "yes") == 0) + return TRUE; + + return FALSE; +} + +Bool OptionPreferences::getCursorCaptureEnabledInFullscreenMenu() const +{ + OptionPreferences::const_iterator it = find("CursorCaptureEnabledInFullscreenMenu"); + if (it == end()) + return (CursorCaptureMode_Default & CursorCaptureMode_EnabledInFullscreenMenu) != 0; + + if (stricmp(it->second.str(), "yes") == 0) + return TRUE; + + return FALSE; +} + CursorCaptureMode OptionPreferences::getCursorCaptureMode() const { - CursorCaptureMode mode = CursorCaptureMode_Default; - OptionPreferences::const_iterator it = find("CursorCaptureMode"); - if (it != end()) - { - for (Int i = 0; i < CursorCaptureMode_Count; ++i) - { - if (stricmp(it->second.str(), TheCursorCaptureModeNames[i]) == 0) - { - mode = static_cast(i); - break; - } - } - } + CursorCaptureMode mode = 0; + mode |= getCursorCaptureEnabledInWindowedGame() ? CursorCaptureMode_EnabledInWindowedGame : 0; + mode |= getCursorCaptureEnabledInWindowedMenu() ? CursorCaptureMode_EnabledInWindowedMenu : 0; + mode |= getCursorCaptureEnabledInFullscreenGame() ? CursorCaptureMode_EnabledInFullscreenGame : 0; + mode |= getCursorCaptureEnabledInFullscreenMenu() ? CursorCaptureMode_EnabledInFullscreenMenu : 0; return mode; } @@ -1293,7 +1333,10 @@ static void saveOptions( void ) // TheSuperHackers @todo Add combo box ? { CursorCaptureMode mode = pref->getCursorCaptureMode(); - (*pref)["CursorCaptureMode"] = TheCursorCaptureModeNames[mode]; + (*pref)["CursorCaptureEnabledInWindowedGame"] = (mode & CursorCaptureMode_EnabledInWindowedGame) ? "yes" : "no"; + (*pref)["CursorCaptureEnabledInWindowedMenu"] = (mode & CursorCaptureMode_EnabledInWindowedMenu) ? "yes" : "no"; + (*pref)["CursorCaptureEnabledInFullscreenGame"] = (mode & CursorCaptureMode_EnabledInFullscreenGame) ? "yes" : "no"; + (*pref)["CursorCaptureEnabledInFullscreenMenu"] = (mode & CursorCaptureMode_EnabledInFullscreenMenu) ? "yes" : "no"; TheMouse->setCursorCaptureMode(mode); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp index 6c88f78929e..b2c722ded38 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp @@ -53,14 +53,6 @@ // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// Mouse *TheMouse = NULL; -const char* const TheCursorCaptureModeNames[] = { - "None", - "InGame", - "Always", - "Auto", -}; -static_assert(ARRAY_SIZE(TheCursorCaptureModeNames) == CursorCaptureMode_Count, "Incorrect array size"); - const char *const Mouse::RedrawModeName[] = { "Mouse:Windows", "Mouse:W3D", @@ -70,7 +62,6 @@ const char *const Mouse::RedrawModeName[] = { const char *const Mouse::CursorCaptureBlockReasonNames[] = { "CursorCaptureBlockReason_NoInit", - "CursorCaptureBlockReason_NoGame", "CursorCaptureBlockReason_Paused", "CursorCaptureBlockReason_Unfocused", }; @@ -552,8 +543,8 @@ Mouse::Mouse( void ) m_cursorCaptureMode = CursorCaptureMode_Default; - m_captureBlockReasonBits = (1 << CursorCaptureBlockReason_NoInit) | (1 << CursorCaptureBlockReason_NoGame); - DEBUG_LOG(("Mouse::Mouse: m_blockCaptureReason=CursorCaptureBlockReason_NoInit|CursorCaptureBlockReason_NoGame")); + m_captureBlockReasonBits = (1 << CursorCaptureBlockReason_NoInit); + DEBUG_LOG(("Mouse::Mouse: m_blockCaptureReason=CursorCaptureBlockReason_NoInit")); } @@ -653,17 +644,7 @@ void Mouse::mouseNotifyResolutionChange( void ) //------------------------------------------------------------------------------------------------- void Mouse::onGameModeChanged(GameMode prev, GameMode next) { - const Bool wasInteractiveGame = GameLogic::isInInteractiveGame(prev); - const Bool isInteractiveGame = GameLogic::isInInteractiveGame(next); - - if (wasInteractiveGame && !isInteractiveGame) - { - blockCapture(CursorCaptureBlockReason_NoGame); - } - else if (!wasInteractiveGame && isInteractiveGame) - { - unblockCapture(CursorCaptureBlockReason_NoGame); - } + refreshCursorCapture(); } //------------------------------------------------------------------------------------------------- @@ -1072,23 +1053,40 @@ void Mouse::initCapture() // ------------------------------------------------------------------------------------------------ Bool Mouse::canCapture() const { - constexpr const CursorCaptureBlockReasonInt noGameBits = CursorCaptureBlockReason_NoGame | CursorCaptureBlockReason_Paused; + if (m_captureBlockReasonBits != 0) + return false; + + DEBUG_ASSERTCRASH(TheDisplay != NULL, ("The Display is NULL")); + const Bool inInteractiveGame = TheGameLogic && TheGameLogic->isInInteractiveGame(); - switch (m_cursorCaptureMode) + if (TheDisplay->getWindowed()) { - case CursorCaptureMode_None: - return false; - case CursorCaptureMode_InGame: - return (m_captureBlockReasonBits == 0); - case CursorCaptureMode_Always: - return (m_captureBlockReasonBits & ~noGameBits) == 0; - case CursorCaptureMode_Auto: - default: - if (TheDisplay == NULL || TheDisplay->getWindowed()) - return (m_captureBlockReasonBits == 0); + if (inInteractiveGame) + { + if ((m_cursorCaptureMode & CursorCaptureMode_EnabledInWindowedGame) == 0) + return false; + } else - return (m_captureBlockReasonBits & ~noGameBits) == 0; + { + if ((m_cursorCaptureMode & CursorCaptureMode_EnabledInWindowedMenu) == 0) + return false; + } } + else + { + if (inInteractiveGame) + { + if ((m_cursorCaptureMode & CursorCaptureMode_EnabledInFullscreenGame) == 0) + return false; + } + else + { + if ((m_cursorCaptureMode & CursorCaptureMode_EnabledInFullscreenMenu) == 0) + return false; + } + } + + return true; } // ------------------------------------------------------------------------------------------------ From abe8dba13e80e160015060b26604ce4c0b85a1db Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 27 Sep 2025 08:56:07 +0200 Subject: [PATCH 108/343] bugfix(input): Fix cargo units selection hack (#1635) --- .../Include/GameClient/SelectionInfo.h | 2 ++ .../GameClient/MessageStream/SelectionXlat.cpp | 1 + .../Source/GameClient/SelectionInfo.cpp | 18 ++++++++++-------- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/SelectionInfo.h b/GeneralsMD/Code/GameEngine/Include/GameClient/SelectionInfo.h index d0c6ed10a17..c1516db6afc 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/SelectionInfo.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/SelectionInfo.h @@ -67,6 +67,8 @@ struct PickDrawableStruct { // List to fill with Drawables. This should be provided by the caller. DrawableList *drawableListToFill; + + Bool isPointSelection; Bool forceAttackMode; // Note, this is OR'd with the things we are attempting to select. diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp index 35da9a457bc..f3c4a73dfb5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp @@ -608,6 +608,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa DrawableList drawablesThatWillSelect; PickDrawableStruct pds; pds.drawableListToFill = &drawablesThatWillSelect; + pds.isPointSelection = isPoint; TheTacticalView->iterateDrawablesInRegion(&selectionRegion, addDrawableToList, &pds); if (drawablesThatWillSelect.empty()) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp index a18ffdb8e71..5eb28a3cabd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp @@ -63,12 +63,8 @@ SelectionInfo::SelectionInfo() : { } //------------------------------------------------------------------------------------------------- -PickDrawableStruct::PickDrawableStruct() : drawableListToFill(NULL) +PickDrawableStruct::PickDrawableStruct() : drawableListToFill(NULL), isPointSelection(FALSE) { - //Added By Sadullah Nader - //Initializations inserted - drawableListToFill = FALSE; - // forceAttackMode = TheInGameUI->isInForceAttackMode(); UnsignedInt pickType = getPickTypesForContext(forceAttackMode); translatePickTypesToKindof(pickType, kindofsToMatch); @@ -365,7 +361,7 @@ Bool addDrawableToList( Drawable *draw, void *userData ) const Object *obj = draw->getObject(); if ( obj && obj->getContainedBy() )//hmm, interesting... he is not selectable but he is contained {// What we are after here is to propagate the selection the selection ti the container - // if the cobtainer is non-enclosing... see also selectionxlat, in the left_click case + // if the container is non-enclosing... see also SelectionXlat, in the left_click case ContainModuleInterface *contain = obj->getContainedBy()->getContain(); Drawable *containDraw = obj->getContainedBy()->getDrawable(); @@ -382,8 +378,14 @@ Bool addDrawableToList( Drawable *draw, void *userData ) // enemy selection logic to exit early (only 1 enemy unit can be selected at a time). Some players // exploit this bug to determine if a transport contains passengers and consider this an important // feature and an advanced skill to pull off, so we must leave the exploit. - if (draw->getObject() && draw->getObject()->getContain() && draw->getObject()->getContain()->getContainCount() > 0) - pds->drawableListToFill->push_back(draw); // Just add the unit twice to prevent enemy selections + if (!pds->isPointSelection) + { + const Object *obj = draw->getObject(); + if (obj) + if (obj->getControllingPlayer() != ThePlayerList->getLocalPlayer()) + if (obj->getContain() && draw->getObject()->getContain()->getContainCount() > 0) + return FALSE; + } #endif pds->drawableListToFill->push_back(draw); From 777eae8d5d2746a953e7fa850af392158aa27461 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 13 Sep 2025 12:20:30 +0200 Subject: [PATCH 109/343] refactor(ww3d): Rename WW3D::Get_Frame_Time to WW3D::Get_Sync_Frame_Time (#1579) --- .../Source/WWVegas/WW3D2/ringobj.cpp | 2 +- .../Source/WWVegas/WW3D2/sphereobj.cpp | 2 +- Core/Tools/W3DView/GraphicView.cpp | 2 +- .../GameEngine/Source/GameClient/Drawable.cpp | 2 +- .../GameClient/Drawable/Draw/W3DTankDraw.cpp | 2 +- .../Drawable/Draw/W3DTankTruckDraw.cpp | 2 +- .../GameClient/Drawable/Draw/W3DTruckDraw.cpp | 2 +- .../Libraries/Source/WWVegas/WW3D2/dazzle.cpp | 7 ++--- .../Source/WWVegas/WW3D2/part_emt.cpp | 2 +- .../Source/WWVegas/WW3D2/texproject.cpp | 2 +- .../Libraries/Source/WWVegas/WW3D2/ww3d.h | 26 +++++++++---------- .../GameEngine/Source/GameClient/Drawable.cpp | 2 +- .../GameClient/Drawable/Draw/W3DTankDraw.cpp | 2 +- .../Drawable/Draw/W3DTankTruckDraw.cpp | 2 +- .../GameClient/Drawable/Draw/W3DTruckDraw.cpp | 2 +- .../Source/W3DDevice/GameClient/W3DSnow.cpp | 2 +- .../Libraries/Source/WWVegas/WW3D2/dazzle.cpp | 7 ++--- .../Source/WWVegas/WW3D2/part_emt.cpp | 2 +- .../Source/WWVegas/WW3D2/texproject.cpp | 2 +- .../Libraries/Source/WWVegas/WW3D2/ww3d.h | 26 +++++++++---------- 20 files changed, 46 insertions(+), 52 deletions(-) diff --git a/Core/Libraries/Source/WWVegas/WW3D2/ringobj.cpp b/Core/Libraries/Source/WWVegas/WW3D2/ringobj.cpp index 9795b389096..5db7898b32d 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/ringobj.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/ringobj.cpp @@ -1150,7 +1150,7 @@ void RingRenderObjClass::animate() // Convert from milliseconds to seconds and normalize the time // if (AnimDuration > 0) { - float frametime = WW3D::Get_Frame_Time(); + float frametime = WW3D::Get_Sync_Frame_Time(); frametime = (frametime * 0.001F) / AnimDuration; anim_time += frametime; } else { diff --git a/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp b/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp index fa3e5c4ed3a..b14d7f323c0 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp @@ -1108,7 +1108,7 @@ void SphereRenderObjClass::animate (void) // Convert from milliseconds to seconds and normalize the time // if (AnimDuration > 0) { - float frametime = WW3D::Get_Frame_Time(); + float frametime = WW3D::Get_Sync_Frame_Time(); frametime = (frametime * 0.001F) / AnimDuration; anim_time += frametime; } else { diff --git a/Core/Tools/W3DView/GraphicView.cpp b/Core/Tools/W3DView/GraphicView.cpp index ccf5bbfca5f..c6e785198c2 100644 --- a/Core/Tools/W3DView/GraphicView.cpp +++ b/Core/Tools/W3DView/GraphicView.cpp @@ -546,7 +546,7 @@ CGraphicView::RepaintView // // Let the audio class think // - WWAudioClass::Get_Instance ()->On_Frame_Update (WW3D::Get_Frame_Time()); + WWAudioClass::Get_Instance ()->On_Frame_Update (WW3D::Get_Sync_Frame_Time()); // // Update the count of particles and polys in the status bar diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index 9891fb0f89b..4dd5fcee678 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -1264,7 +1264,7 @@ void Drawable::applyPhysicsXform(Matrix3D* mtx) { // TheSuperHackers @tweak Update the physics transform on every WW Sync only. // All calculations are originally catered to a 30 fps logic step. - if (WW3D::Get_Frame_Time() != 0) + if (WW3D::Get_Sync_Frame_Time() != 0) { calcPhysicsXform(*m_physicsXform); } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp index 1138e394b8d..6b91b28be2f 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp @@ -312,7 +312,7 @@ void W3DTankDraw::doDrawModule(const Matrix3D* transformMtx) { // TheSuperHackers @tweak Update the draw on every WW Sync only. // All calculations are originally catered to a 30 fps logic step. - if (WW3D::Get_Frame_Time() == 0) + if (WW3D::Get_Sync_Frame_Time() == 0) return; const Real DEBRIS_THRESHOLD = 0.00001f; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp index 899a4da37e4..433b3af4c46 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp @@ -517,7 +517,7 @@ void W3DTankTruckDraw::doDrawModule(const Matrix3D* transformMtx) // TheSuperHackers @tweak Update the draw on every WW Sync only. // All calculations are originally catered to a 30 fps logic step. - if (WW3D::Get_Frame_Time() == 0) + if (WW3D::Get_Sync_Frame_Time() == 0) return; const Real ACCEL_THRESHOLD = 0.01f; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp index c34a8c4303d..0baa25aa28a 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp @@ -395,7 +395,7 @@ void W3DTruckDraw::doDrawModule(const Matrix3D* transformMtx) // TheSuperHackers @tweak Update the draw on every WW Sync only. // All calculations are originally catered to a 30 fps logic step. - if (WW3D::Get_Frame_Time() == 0) + if (WW3D::Get_Sync_Frame_Time() == 0) return; const Real ACCEL_THRESHOLD = 0.01f; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp index 5b27bdaf4a7..5ff6f9ef2c1 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp @@ -940,7 +940,7 @@ void DazzleRenderObjClass::Render(RenderInfoClass & rinfo) const DazzleTypeClass* params=types[type]; params->Calculate_Intensities(dazzle_intensity,dazzle_size,current_halo_intensity,camera_dir,current_dir,current_distance); - unsigned time_ms=WW3D::Get_Frame_Time(); + unsigned time_ms=WW3D::Get_Sync_Frame_Time(); if (time_ms==0) time_ms=1; float weight=pow(params->ic.history_weight,time_ms); @@ -1012,9 +1012,6 @@ void DazzleRenderObjClass::Render_Dazzle(CameraClass* camera) screen_x_scale=h/w; } -// unsigned time_ms=WW3D::Get_Frame_Time(); -// if (time_ms==0) time_ms=1; - float halo_scale_x=types[type]->ic.halo_scale_x; float halo_scale_y=types[type]->ic.halo_scale_y; float dazzle_scale_x=types[type]->ic.dazzle_scale_x; @@ -1481,7 +1478,7 @@ void DazzleLayerClass::Render(CameraClass* camera) camera->Apply(); - unsigned time_ms=WW3D::Get_Frame_Time(); + unsigned time_ms=WW3D::Get_Sync_Frame_Time(); if (time_ms==0) time_ms=1; DX8Wrapper::Set_Material(NULL); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp index f2585454029..4f21627fa63 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp @@ -549,7 +549,7 @@ void ParticleEmitterClass::Create_New_Particles(const Quaternion & curr_quat, co // the previous interval when the last particle was emitted) is added to // the size of the current frame to yield the time currently available // for emitting particles. - unsigned int frametime = WW3D::Get_Frame_Time(); + unsigned int frametime = WW3D::Get_Sync_Frame_Time(); // Since the particles are written into a wraparound buffer, we can take the time modulo a time // constant which represents the time it takes to fill up the entire buffer with new particles. // We will do this so we don't run into performance problems with very large frame times. diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/texproject.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/texproject.cpp index 12ab1a9056e..46bc5913515 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/texproject.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/texproject.cpp @@ -1283,7 +1283,7 @@ void TexProjectClass::Pre_Render_Update(const Matrix3D & camera) /* ** update the current intensity by iterating it towards the desired intensity */ - float frame_time = (float)WW3D::Get_Frame_Time() / 1000.0f; + float frame_time = (float)WW3D::Get_Sync_Frame_Time() / 1000.0f; float intensity_delta = DesiredIntensity - Intensity; float max_intensity_delta = INTENSITY_RATE_OF_CHANGE * frame_time; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h index 9c544db8163..a8ef60241c9 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h @@ -170,10 +170,10 @@ class WW3D ** By calling the Sync function, the application can move the ww3d library time forward. This ** will control things like animated uv-offset mappers and render object animations. */ - static void Sync( unsigned int sync_time ); + static void Sync( unsigned int sync_time ); static unsigned int Get_Sync_Time(void) { return SyncTime; } - static unsigned int Get_Frame_Time(void) { return SyncTime - PreviousSyncTime; } - static unsigned int Get_Frame_Count(void) { return FrameCount; } + static unsigned int Get_Sync_Frame_Time(void) { return SyncTime - PreviousSyncTime; } + static unsigned int Get_Frame_Count(void) { return FrameCount; } static unsigned int Get_Last_Frame_Poly_Count(void); static unsigned int Get_Last_Frame_Vertex_Count(void); @@ -326,16 +326,16 @@ class WW3D static float FractionalSyncMs; // Timing info: - // The absolute synchronized frame time (in milliseconds) supplied by the - // application at the start of every frame. Note that wraparound cases - // etc. need to be considered. - static unsigned int SyncTime; - - // The previously set absolute sync time - this is used to get the interval between - // the most recently set sync time and the previous one. Assuming the - // application sets sync time at the start of every frame, this represents - // the frame interval. - static unsigned int PreviousSyncTime; + // The absolute synchronized frame time (in milliseconds) supplied by the + // application at the start of every frame. Note that wraparound cases + // etc. need to be considered. + static unsigned int SyncTime; + + // The previously set absolute sync time - this is used to get the interval between + // the most recently set sync time and the previous one. Assuming the + // application sets sync time at the start of every frame, this represents + // the frame interval. + static unsigned int PreviousSyncTime; static float PixelCenterX; static float PixelCenterY; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index 328440a0ea5..1358b1b0546 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -1392,7 +1392,7 @@ void Drawable::applyPhysicsXform(Matrix3D* mtx) { // TheSuperHackers @tweak Update the physics transform on every WW Sync only. // All calculations are originally catered to a 30 fps logic step. - if (WW3D::Get_Frame_Time() != 0) + if (WW3D::Get_Sync_Frame_Time() != 0) { calcPhysicsXform(*m_physicsXform); } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp index eb59745dd98..0e366bb3dfc 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp @@ -312,7 +312,7 @@ void W3DTankDraw::doDrawModule(const Matrix3D* transformMtx) { // TheSuperHackers @tweak Update the draw on every WW Sync only. // All calculations are originally catered to a 30 fps logic step. - if (WW3D::Get_Frame_Time() == 0) + if (WW3D::Get_Sync_Frame_Time() == 0) return; const Real DEBRIS_THRESHOLD = 0.00001f; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp index 94b43a54b7c..83945bf5f38 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp @@ -517,7 +517,7 @@ void W3DTankTruckDraw::doDrawModule(const Matrix3D* transformMtx) // TheSuperHackers @tweak Update the draw on every WW Sync only. // All calculations are originally catered to a 30 fps logic step. - if (WW3D::Get_Frame_Time() == 0) + if (WW3D::Get_Sync_Frame_Time() == 0) return; const Real ACCEL_THRESHOLD = 0.01f; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp index 12a52f8da16..49625d66289 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp @@ -395,7 +395,7 @@ void W3DTruckDraw::doDrawModule(const Matrix3D* transformMtx) // TheSuperHackers @tweak Update the draw on every WW Sync only. // All calculations are originally catered to a 30 fps logic step. - if (WW3D::Get_Frame_Time() == 0) + if (WW3D::Get_Sync_Frame_Time() == 0) return; const Real ACCEL_THRESHOLD = 0.01f; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DSnow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DSnow.cpp index cf40de7c791..348fc1f0034 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DSnow.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DSnow.cpp @@ -157,7 +157,7 @@ void W3DSnowManager::reset( void ) void W3DSnowManager::update(void) { - m_time += WW3D::Get_Frame_Time() / 1000.0f; + m_time += WW3D::Get_Sync_Frame_Time() / 1000.0f; //find current time offset, adjusting for overflow m_time=fmod(m_time,m_fullTimePeriod); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp index 1b19381d44e..786e3db009b 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp @@ -975,7 +975,7 @@ void DazzleRenderObjClass::Render(RenderInfoClass & rinfo) const DazzleTypeClass* params=types[type]; params->Calculate_Intensities(dazzle_intensity,dazzle_size,current_halo_intensity,camera_dir,current_dir,dir,current_distance); - unsigned time_ms=WW3D::Get_Frame_Time(); + unsigned time_ms=WW3D::Get_Sync_Frame_Time(); if (time_ms==0) time_ms=1; float weight=pow(params->ic.history_weight,time_ms); @@ -1048,9 +1048,6 @@ void DazzleRenderObjClass::Render_Dazzle(CameraClass* camera) screen_x_scale=h/w; } -// unsigned time_ms=WW3D::Get_Frame_Time(); -// if (time_ms==0) time_ms=1; - // Do NOT scale halo by current scale // because it uses screen parallel primitives // and if it's too big it will be visible until @@ -1587,7 +1584,7 @@ void DazzleLayerClass::Render(CameraClass* camera) camera->Apply(); - unsigned time_ms=WW3D::Get_Frame_Time(); + unsigned time_ms=WW3D::Get_Sync_Frame_Time(); if (time_ms==0) time_ms=1; DX8Wrapper::Set_Material(NULL); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp index 2e09baa7533..9cf680b8401 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp @@ -558,7 +558,7 @@ void ParticleEmitterClass::Create_New_Particles(const Quaternion & curr_quat, co // the previous interval when the last particle was emitted) is added to // the size of the current frame to yield the time currently available // for emitting particles. - unsigned int frametime = WW3D::Get_Frame_Time(); + unsigned int frametime = WW3D::Get_Sync_Frame_Time(); // Since the particles are written into a wraparound buffer, we can take the time modulo a time // constant which represents the time it takes to fill up the entire buffer with new particles. // We will do this so we don't run into performance problems with very large frame times. diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texproject.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texproject.cpp index 5cb239e2764..a729abc55e1 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texproject.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texproject.cpp @@ -1317,7 +1317,7 @@ void TexProjectClass::Pre_Render_Update(const Matrix3D & camera) /* ** update the current intensity by iterating it towards the desired intensity */ - float frame_time = (float)WW3D::Get_Frame_Time() / 1000.0f; + float frame_time = (float)WW3D::Get_Sync_Frame_Time() / 1000.0f; float intensity_delta = DesiredIntensity - Intensity; float max_intensity_delta = INTENSITY_RATE_OF_CHANGE * frame_time; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h index af2261961ea..9f23f2c1ec3 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h @@ -170,10 +170,10 @@ class WW3D ** By calling the Sync function, the application can move the ww3d library time forward. This ** will control things like animated uv-offset mappers and render object animations. */ - static void Sync( unsigned int sync_time ); + static void Sync( unsigned int sync_time ); static unsigned int Get_Sync_Time(void) { return SyncTime; } - static unsigned int Get_Frame_Time(void) { return SyncTime - PreviousSyncTime; } - static unsigned int Get_Frame_Count(void) { return FrameCount; } + static unsigned int Get_Sync_Frame_Time(void) { return SyncTime - PreviousSyncTime; } + static unsigned int Get_Frame_Count(void) { return FrameCount; } static unsigned int Get_Last_Frame_Poly_Count(void); static unsigned int Get_Last_Frame_Vertex_Count(void); @@ -326,16 +326,16 @@ class WW3D static float FractionalSyncMs; // Timing info: - // The absolute synchronized frame time (in milliseconds) supplied by the - // application at the start of every frame. Note that wraparound cases - // etc. need to be considered. - static unsigned int SyncTime; - - // The previously set absolute sync time - this is used to get the interval between - // the most recently set sync time and the previous one. Assuming the - // application sets sync time at the start of every frame, this represents - // the frame interval. - static unsigned int PreviousSyncTime; + // The absolute synchronized frame time (in milliseconds) supplied by the + // application at the start of every frame. Note that wraparound cases + // etc. need to be considered. + static unsigned int SyncTime; + + // The previously set absolute sync time - this is used to get the interval between + // the most recently set sync time and the previous one. Assuming the + // application sets sync time at the start of every frame, this represents + // the frame interval. + static unsigned int PreviousSyncTime; static float PixelCenterX; static float PixelCenterY; From e0d992f8e1cff2401ed9afbafcd9cc2aadcb9d54 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 13 Sep 2025 12:22:16 +0200 Subject: [PATCH 110/343] bugfix(draw): Fix tank draw update logic step time is smaller than render frame time (#1579) --- .../Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp | 4 ++-- .../Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp index 6b91b28be2f..efdc37d46a2 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp @@ -310,6 +310,8 @@ void W3DTankDraw::onRenderObjRecreated(void) //------------------------------------------------------------------------------------------------- void W3DTankDraw::doDrawModule(const Matrix3D* transformMtx) { + W3DModelDraw::doDrawModule(transformMtx); + // TheSuperHackers @tweak Update the draw on every WW Sync only. // All calculations are originally catered to a 30 fps logic step. if (WW3D::Get_Sync_Frame_Time() == 0) @@ -405,8 +407,6 @@ void W3DTankDraw::doDrawModule(const Matrix3D* transformMtx) } } } - - W3DModelDraw::doDrawModule(transformMtx); } // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp index 0e366bb3dfc..56af0e77ca1 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp @@ -310,6 +310,8 @@ void W3DTankDraw::onRenderObjRecreated(void) //------------------------------------------------------------------------------------------------- void W3DTankDraw::doDrawModule(const Matrix3D* transformMtx) { + W3DModelDraw::doDrawModule(transformMtx); + // TheSuperHackers @tweak Update the draw on every WW Sync only. // All calculations are originally catered to a 30 fps logic step. if (WW3D::Get_Sync_Frame_Time() == 0) @@ -405,8 +407,6 @@ void W3DTankDraw::doDrawModule(const Matrix3D* transformMtx) } } } - - W3DModelDraw::doDrawModule(transformMtx); } // ------------------------------------------------------------------------------------------------ From a9a69f68e3b758ac710147f6773c77bab7cd2b87 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 13 Sep 2025 12:30:43 +0200 Subject: [PATCH 111/343] tweak(snow): Decouple snow render update from logic step (#1579) --- .../Source/W3DDevice/GameClient/W3DDisplay.cpp | 2 +- .../Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp | 4 +++- Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h | 12 +++++++++--- .../Source/W3DDevice/GameClient/W3DDisplay.cpp | 2 +- .../Source/W3DDevice/GameClient/W3DSnow.cpp | 4 ++-- .../Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp | 4 +++- .../Code/Libraries/Source/WWVegas/WW3D2/ww3d.h | 12 +++++++++--- 7 files changed, 28 insertions(+), 12 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 0f1306bcb86..a1813f3d7e9 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -1731,7 +1731,7 @@ void W3DDisplay::draw( void ) } } - WW3D::Add_Frame_Time(TheGameEngine->getLogicTimeStepMilliseconds()); + WW3D::Update_Logic_Frame_Time(TheGameEngine->getLogicTimeStepMilliseconds()); static Int now; now=timeGetTime(); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp index cadd4fb4bfd..f44fa6820f2 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp @@ -165,6 +165,7 @@ const char* DAZZLE_INI_FILENAME="DAZZLE.INI"; ** ***********************************************************************************/ +float WW3D::LogicFrameTimeMs = 33.33f; float WW3D::FractionalSyncMs = 0.0f; unsigned int WW3D::SyncTime = 0; unsigned int WW3D::PreviousSyncTime = 0; @@ -1168,8 +1169,9 @@ unsigned int WW3D::Get_Last_Frame_Vertex_Count(void) return Debug_Statistics::Get_DX8_Vertices(); } -void WW3D::Add_Frame_Time(float milliseconds) +void WW3D::Update_Logic_Frame_Time(float milliseconds) { + LogicFrameTimeMs = milliseconds; FractionalSyncMs += milliseconds; unsigned int integralSyncMs = (unsigned int)FractionalSyncMs; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h index a8ef60241c9..d32aa3861f9 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h @@ -162,9 +162,9 @@ class WW3D static void Flip_To_Primary(void); - // TheSuperHackers @info Call this function to accumulate fractional render time. - // It will then call Sync with a new time on its own once an appropriate amount of time has passed. - static void Add_Frame_Time(float milliseconds); + // TheSuperHackers @info Add amount of milliseconds that the simulation has advanced in this render frame. + // This can be a fraction of a logic step. It will call Sync on its own once an appropriate amount of time has passed. + static void Update_Logic_Frame_Time(float milliseconds); /* ** Timing ** By calling the Sync function, the application can move the ww3d library time forward. This @@ -173,6 +173,8 @@ class WW3D static void Sync( unsigned int sync_time ); static unsigned int Get_Sync_Time(void) { return SyncTime; } static unsigned int Get_Sync_Frame_Time(void) { return SyncTime - PreviousSyncTime; } + static float Get_Logic_Frame_Time_Milliseconds() { return LogicFrameTimeMs; } + static float Get_Logic_Frame_Time_Seconds() { return LogicFrameTimeMs * 0.001f; } static unsigned int Get_Frame_Count(void) { return FrameCount; } static unsigned int Get_Last_Frame_Poly_Count(void); static unsigned int Get_Last_Frame_Vertex_Count(void); @@ -323,6 +325,10 @@ class WW3D static void Allocate_Debug_Resources(void); static void Release_Debug_Resources(void); + // Logic frame time, in milliseconds + static float LogicFrameTimeMs; + + // Accumulated synchronized frame time in milliseconds static float FractionalSyncMs; // Timing info: diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index cadeda72099..bef1b0e4891 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -1812,7 +1812,7 @@ void W3DDisplay::draw( void ) } } - WW3D::Add_Frame_Time(TheGameEngine->getLogicTimeStepMilliseconds()); + WW3D::Update_Logic_Frame_Time(TheGameEngine->getLogicTimeStepMilliseconds()); static Int now; now=timeGetTime(); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DSnow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DSnow.cpp index 348fc1f0034..bed66d1c65d 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DSnow.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DSnow.cpp @@ -156,8 +156,8 @@ void W3DSnowManager::reset( void ) void W3DSnowManager::update(void) { - - m_time += WW3D::Get_Sync_Frame_Time() / 1000.0f; + // TheSuperHackers @tweak The snow render update is now decoupled from the logic step. + m_time += WW3D::Get_Logic_Frame_Time_Seconds(); //find current time offset, adjusting for overflow m_time=fmod(m_time,m_fullTimePeriod); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp index 14aa8203cd6..072d816efdd 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp @@ -166,6 +166,7 @@ const char* DAZZLE_INI_FILENAME="DAZZLE.INI"; ** ***********************************************************************************/ +float WW3D::LogicFrameTimeMs = 33.33f; float WW3D::FractionalSyncMs = 0.0f; unsigned int WW3D::SyncTime = 0; unsigned int WW3D::PreviousSyncTime = 0; @@ -1163,8 +1164,9 @@ unsigned int WW3D::Get_Last_Frame_Vertex_Count(void) return Debug_Statistics::Get_DX8_Vertices(); } -void WW3D::Add_Frame_Time(float milliseconds) +void WW3D::Update_Logic_Frame_Time(float milliseconds) { + LogicFrameTimeMs = milliseconds; FractionalSyncMs += milliseconds; unsigned int integralSyncMs = (unsigned int)FractionalSyncMs; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h index 9f23f2c1ec3..b46b135dce2 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h @@ -162,9 +162,9 @@ class WW3D static void Flip_To_Primary(void); - // TheSuperHackers @info Call this function to accumulate fractional render time. - // It will then call Sync with a new time on its own once an appropriate amount of time has passed. - static void Add_Frame_Time(float milliseconds); + // TheSuperHackers @info Add amount of milliseconds that the simulation has advanced in this render frame. + // This can be a fraction of a logic step. It will call Sync on its own once an appropriate amount of time has passed. + static void Update_Logic_Frame_Time(float milliseconds); /* ** Timing ** By calling the Sync function, the application can move the ww3d library time forward. This @@ -173,6 +173,8 @@ class WW3D static void Sync( unsigned int sync_time ); static unsigned int Get_Sync_Time(void) { return SyncTime; } static unsigned int Get_Sync_Frame_Time(void) { return SyncTime - PreviousSyncTime; } + static float Get_Logic_Frame_Time_Milliseconds() { return LogicFrameTimeMs; } + static float Get_Logic_Frame_Time_Seconds() { return LogicFrameTimeMs * 0.001f; } static unsigned int Get_Frame_Count(void) { return FrameCount; } static unsigned int Get_Last_Frame_Poly_Count(void); static unsigned int Get_Last_Frame_Vertex_Count(void); @@ -323,6 +325,10 @@ class WW3D static void Allocate_Debug_Resources(void); static void Release_Debug_Resources(void); + // Logic frame time, in milliseconds + static float LogicFrameTimeMs; + + // Accumulated synchronized frame time in milliseconds static float FractionalSyncMs; // Timing info: From bfa56712608fa5a58e6d9dfdcd58cddc0930136d Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 13 Sep 2025 12:40:36 +0200 Subject: [PATCH 112/343] tweak(segline): Decouple segline render update from logic step (#1579) --- .../Libraries/Source/WWVegas/WW3D2/seglinerenderer.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Core/Libraries/Source/WWVegas/WW3D2/seglinerenderer.cpp b/Core/Libraries/Source/WWVegas/WW3D2/seglinerenderer.cpp index 16ccba9f861..dd97d4a0508 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/seglinerenderer.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/seglinerenderer.cpp @@ -78,7 +78,6 @@ SegLineRendererClass::SegLineRendererClass(void) : NoiseAmplitude(0.0f), MergeAbortFactor(1.5f), TextureTileFactor(1.0f), - LastUsedSyncTime(WW3D::Get_Sync_Time()), CurrentUVOffset(0.0f,0.0f), UVOffsetDeltaPerMS(0.0f, 0.0f), Bits(DEFAULT_BITS), @@ -98,7 +97,6 @@ SegLineRendererClass::SegLineRendererClass(const SegLineRendererClass & that) : NoiseAmplitude(0.0f), MergeAbortFactor(1.5f), TextureTileFactor(1.0f), - LastUsedSyncTime(that.LastUsedSyncTime), CurrentUVOffset(0.0f,0.0f), UVOffsetDeltaPerMS(0.0f, 0.0f), Bits(DEFAULT_BITS), @@ -120,7 +118,6 @@ SegLineRendererClass & SegLineRendererClass::operator = (const SegLineRendererCl NoiseAmplitude = that.NoiseAmplitude; MergeAbortFactor = that.MergeAbortFactor; TextureTileFactor = that.TextureTileFactor; - LastUsedSyncTime = that.LastUsedSyncTime; CurrentUVOffset = that.CurrentUVOffset; UVOffsetDeltaPerMS = that.UVOffsetDeltaPerMS; Bits = that.Bits; @@ -201,7 +198,6 @@ void SegLineRendererClass::Set_Texture_Tile_Factor(float factor) void SegLineRendererClass::Reset_Line(void) { - LastUsedSyncTime = WW3D::Get_Sync_Time(); CurrentUVOffset.Set(0.0f,0.0f); } @@ -227,9 +223,8 @@ void SegLineRendererClass::Render /* ** Handle texture UV offset animation (done once for entire line). */ - unsigned int delta = WW3D::Get_Sync_Time() - LastUsedSyncTime; - float del = (float)delta; - Vector2 uv_offset = CurrentUVOffset + UVOffsetDeltaPerMS * del; + // TheSuperHackers @tweak The render update is now decoupled from the logic step. + Vector2 uv_offset = CurrentUVOffset + UVOffsetDeltaPerMS * WW3D::Get_Logic_Frame_Time_Milliseconds(); // ensure offsets are in [0, 1] range: uv_offset.X = uv_offset.X - floorf(uv_offset.X); @@ -237,7 +232,6 @@ void SegLineRendererClass::Render // Update state CurrentUVOffset = uv_offset; - LastUsedSyncTime = WW3D::Get_Sync_Time(); // Used later TextureMapMode map_mode = Get_Texture_Mapping_Mode(); From 4aabdcc6b6147250cb0db6cd058efff6c9cfc54a Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 13 Sep 2025 16:51:52 +0200 Subject: [PATCH 113/343] bugfix(anim): Fix calling Animatable3DObjClass::Single_Anim_Progress more than once a frame (#1579) --- .../Source/WWVegas/WW3D2/animobj.cpp | 21 +------------------ .../Source/WWVegas/WW3D2/animobj.cpp | 21 +------------------ 2 files changed, 2 insertions(+), 40 deletions(-) diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp index f2d8d959ce4..b5278deecb7 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp @@ -289,12 +289,6 @@ void Animatable3DObjClass::Render(RenderInfoClass & rinfo) return; } - if ( CurMotionMode == SINGLE_ANIM ) { - if ( ModeAnim.AnimMode != ANIM_MODE_MANUAL ) { - Single_Anim_Progress(); - } - } - if (!Is_Hierarchy_Valid() || Are_Sub_Object_Transforms_Dirty()) { Update_Sub_Object_Transforms(); } @@ -316,12 +310,6 @@ void Animatable3DObjClass::Special_Render(SpecialRenderInfoClass & rinfo) { if (HTree == NULL) return; - if ( CurMotionMode == SINGLE_ANIM ) { - if ( ModeAnim.AnimMode != ANIM_MODE_MANUAL ) { - Single_Anim_Progress(); - } - } - if (!Is_Hierarchy_Valid()) { Update_Sub_Object_Transforms(); } @@ -1043,19 +1031,12 @@ void Animatable3DObjClass::Single_Anim_Progress (void) // // Update the frame number and sync time // - float oldprev = ModeAnim.PrevFrame; ModeAnim.PrevFrame = ModeAnim.Frame; ModeAnim.Frame = Compute_Current_Frame(&ModeAnim.animDirection); ModeAnim.LastSyncTime = WW3D::Get_Sync_Time(); - if (ModeAnim.Frame == ModeAnim.PrevFrame) { - // This function was somehow called twice per frame. - // Since ModeAnim.Frame hasn't changed, reset the ModeAnim.PrevFrame. - // If you don't do this sounds won't be triggered properly because Frame and PrevFrame will be the same. - ModeAnim.PrevFrame = oldprev; - } // - // Force the heirarchy to be recalculated + // Force the hierarchy to be recalculated // Set_Hierarchy_Valid (false); } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp index 551cb699579..32ce456d48b 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp @@ -289,12 +289,6 @@ void Animatable3DObjClass::Render(RenderInfoClass & rinfo) return; } - if ( CurMotionMode == SINGLE_ANIM ) { - if ( ModeAnim.AnimMode != ANIM_MODE_MANUAL ) { - Single_Anim_Progress(); - } - } - if (!Is_Hierarchy_Valid() || Are_Sub_Object_Transforms_Dirty()) { Update_Sub_Object_Transforms(); } @@ -316,12 +310,6 @@ void Animatable3DObjClass::Special_Render(SpecialRenderInfoClass & rinfo) { if (HTree == NULL) return; - if ( CurMotionMode == SINGLE_ANIM ) { - if ( ModeAnim.AnimMode != ANIM_MODE_MANUAL ) { - Single_Anim_Progress(); - } - } - if (!Is_Hierarchy_Valid()) { Update_Sub_Object_Transforms(); } @@ -1051,19 +1039,12 @@ void Animatable3DObjClass::Single_Anim_Progress (void) // // Update the frame number and sync time // - float oldprev = ModeAnim.PrevFrame; ModeAnim.PrevFrame = ModeAnim.Frame; ModeAnim.Frame = Compute_Current_Frame(&ModeAnim.animDirection); ModeAnim.LastSyncTime = WW3D::Get_Sync_Time(); - if (ModeAnim.Frame == ModeAnim.PrevFrame) { - // This function was somehow called twice per frame. - // Since ModeAnim.Frame hasn't changed, reset the ModeAnim.PrevFrame. - // If you don't do this sounds won't be triggered properly because Frame and PrevFrame will be the same. - ModeAnim.PrevFrame = oldprev; - } // - // Force the heirarchy to be recalculated + // Force the hierarchy to be recalculated // Set_Hierarchy_Valid (false); } From abf86faa08895d2344c5f316a4128d4de4f07c91 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 13 Sep 2025 16:53:04 +0200 Subject: [PATCH 114/343] tweak(anim): Decouple anim object render update from logic step (#1579) --- .../Source/WWVegas/WW3D2/animobj.cpp | 28 ++++++++----------- .../Libraries/Source/WWVegas/WW3D2/animobj.h | 1 - .../Source/WWVegas/WW3D2/animobj.cpp | 28 ++++++++----------- .../Libraries/Source/WWVegas/WW3D2/animobj.h | 1 - 4 files changed, 24 insertions(+), 34 deletions(-) diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp index b5278deecb7..2b81b7b36ca 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp @@ -89,7 +89,6 @@ Animatable3DObjClass::Animatable3DObjClass(const char * htree_name) : ModeAnim.Motion=NULL; ModeAnim.Frame=0.0f; ModeAnim.PrevFrame=0.0f; - ModeAnim.LastSyncTime=WW3D::Get_Sync_Time(); ModeAnim.frameRateMultiplier=1.0; // 020607 srj -- added ModeAnim.animDirection=1.0; // 020607 srj -- added ModeInterp.Motion0=NULL; @@ -145,7 +144,6 @@ Animatable3DObjClass::Animatable3DObjClass(const Animatable3DObjClass & src) : ModeAnim.Motion=NULL; ModeAnim.Frame=0.0f; ModeAnim.PrevFrame=0.0f; - ModeAnim.LastSyncTime=WW3D::Get_Sync_Time(); ModeAnim.frameRateMultiplier=1.0; // 020607 srj -- added ModeAnim.animDirection=1.0; // 020607 srj -- added ModeInterp.Motion0=NULL; @@ -205,7 +203,6 @@ Animatable3DObjClass & Animatable3DObjClass::operator = (const Animatable3DObjCl ModeAnim.Motion = NULL; ModeAnim.Frame = 0.0f; ModeAnim.PrevFrame = 0.0f; - ModeAnim.LastSyncTime = WW3D::Get_Sync_Time(); ModeAnim.frameRateMultiplier=1.0; // 020607 srj -- added ModeAnim.animDirection=1.0; // 020607 srj -- added ModeInterp.Motion0 = NULL; @@ -464,7 +461,6 @@ void Animatable3DObjClass::Set_Animation(HAnimClass * motion, float frame, int m ModeAnim.Motion = motion; ModeAnim.PrevFrame = ModeAnim.Frame; ModeAnim.Frame = frame; - ModeAnim.LastSyncTime = WW3D::Get_Sync_Time(); ModeAnim.frameRateMultiplier=1.0; // 020607 srj -- added ModeAnim.animDirection=1.0; // 020607 srj -- added @@ -765,7 +761,7 @@ void Animatable3DObjClass::Control_Bone(int bindex,const Matrix3D & objtm,bool w void Animatable3DObjClass::Update_Sub_Object_Transforms(void) { /* - ** The RenderObj impementation will cause our 'container' + ** The RenderObj implementation will cause our 'container' ** to update if we are not valid yet */ CompositeRenderObjClass::Update_Sub_Object_Transforms(); @@ -937,8 +933,9 @@ float Animatable3DObjClass::Compute_Current_Frame(float *newDirection) const // Compute the current frame based on elapsed time. // if (ModeAnim.AnimMode != ANIM_MODE_MANUAL) { - float sync_time_diff = WW3D::Get_Sync_Time() - ModeAnim.LastSyncTime; - float delta = ModeAnim.Motion->Get_Frame_Rate() * ModeAnim.frameRateMultiplier * ModeAnim.animDirection * sync_time_diff * 0.001f; + // TheSuperHackers @tweak The animation render update is now decoupled from the logic step. + const float frametime = WW3D::Get_Logic_Frame_Time_Seconds(); + const float delta = ModeAnim.Motion->Get_Frame_Rate() * ModeAnim.frameRateMultiplier * ModeAnim.animDirection * frametime; frame += delta; // @@ -954,10 +951,10 @@ float Animatable3DObjClass::Compute_Current_Frame(float *newDirection) const case ANIM_MODE_LOOP: if ( frame >= ModeAnim.Motion->Get_Num_Frames() - 1 ) { frame -= ModeAnim.Motion->Get_Num_Frames() - 1; - } - // If it is still too far out, reset - if ( frame >= ModeAnim.Motion->Get_Num_Frames() - 1 ) { - frame = 0; + // If it is still too far out, reset + if ( frame >= ModeAnim.Motion->Get_Num_Frames() - 1 ) { + frame = 0; + } } break; case ANIM_MODE_ONCE_BACKWARDS: //play animation one time but backwards @@ -968,10 +965,10 @@ float Animatable3DObjClass::Compute_Current_Frame(float *newDirection) const case ANIM_MODE_LOOP_BACKWARDS: //play animation backwards in a loop if ( frame < 0 ) { frame += ModeAnim.Motion->Get_Num_Frames() - 1; - } - // If it is still too far out, reset - if ( frame < 0 ) { - frame = ModeAnim.Motion->Get_Num_Frames() - 1; + // If it is still too far out, reset + if ( frame < 0 ) { + frame = ModeAnim.Motion->Get_Num_Frames() - 1; + } } break; case ANIM_MODE_LOOP_PINGPONG: @@ -1033,7 +1030,6 @@ void Animatable3DObjClass::Single_Anim_Progress (void) // ModeAnim.PrevFrame = ModeAnim.Frame; ModeAnim.Frame = Compute_Current_Frame(&ModeAnim.animDirection); - ModeAnim.LastSyncTime = WW3D::Get_Sync_Time(); // // Force the hierarchy to be recalculated diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h index cd5a745d84a..174c1eeafe6 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h @@ -190,7 +190,6 @@ class Animatable3DObjClass : public CompositeRenderObjClass float Frame; float PrevFrame; int AnimMode; - mutable int LastSyncTime; float animDirection; float frameRateMultiplier; // 020607 srj -- added } ModeAnim; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp index 32ce456d48b..86ba38c1914 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp @@ -89,7 +89,6 @@ Animatable3DObjClass::Animatable3DObjClass(const char * htree_name) : ModeAnim.Motion=NULL; ModeAnim.Frame=0.0f; ModeAnim.PrevFrame=0.0f; - ModeAnim.LastSyncTime=WW3D::Get_Sync_Time(); ModeAnim.frameRateMultiplier=1.0; // 020607 srj -- added ModeAnim.animDirection=1.0; // 020607 srj -- added ModeInterp.Motion0=NULL; @@ -145,7 +144,6 @@ Animatable3DObjClass::Animatable3DObjClass(const Animatable3DObjClass & src) : ModeAnim.Motion=NULL; ModeAnim.Frame=0.0f; ModeAnim.PrevFrame=0.0f; - ModeAnim.LastSyncTime=WW3D::Get_Sync_Time(); ModeAnim.frameRateMultiplier=1.0; // 020607 srj -- added ModeAnim.animDirection=1.0; // 020607 srj -- added ModeInterp.Motion0=NULL; @@ -205,7 +203,6 @@ Animatable3DObjClass & Animatable3DObjClass::operator = (const Animatable3DObjCl ModeAnim.Motion = NULL; ModeAnim.Frame = 0.0f; ModeAnim.PrevFrame = 0.0f; - ModeAnim.LastSyncTime = WW3D::Get_Sync_Time(); ModeAnim.frameRateMultiplier=1.0; // 020607 srj -- added ModeAnim.animDirection=1.0; // 020607 srj -- added ModeInterp.Motion0 = NULL; @@ -464,7 +461,6 @@ void Animatable3DObjClass::Set_Animation(HAnimClass * motion, float frame, int m ModeAnim.Motion = motion; ModeAnim.PrevFrame = ModeAnim.Frame; ModeAnim.Frame = frame; - ModeAnim.LastSyncTime = WW3D::Get_Sync_Time(); ModeAnim.frameRateMultiplier=1.0; // 020607 srj -- added ModeAnim.animDirection=1.0; // 020607 srj -- added @@ -764,7 +760,7 @@ void Animatable3DObjClass::Control_Bone(int bindex,const Matrix3D & objtm,bool w void Animatable3DObjClass::Update_Sub_Object_Transforms(void) { /* - ** The RenderObj impementation will cause our 'container' + ** The RenderObj implementation will cause our 'container' ** to update if we are not valid yet */ CompositeRenderObjClass::Update_Sub_Object_Transforms(); @@ -945,8 +941,9 @@ float Animatable3DObjClass::Compute_Current_Frame(float *newDirection) const // Compute the current frame based on elapsed time. // if (ModeAnim.AnimMode != ANIM_MODE_MANUAL) { - float sync_time_diff = WW3D::Get_Sync_Time() - ModeAnim.LastSyncTime; - float delta = ModeAnim.Motion->Get_Frame_Rate() * ModeAnim.frameRateMultiplier * ModeAnim.animDirection * sync_time_diff * 0.001f; + // TheSuperHackers @tweak The animation render update is now decoupled from the logic step. + const float frametime = WW3D::Get_Logic_Frame_Time_Seconds(); + const float delta = ModeAnim.Motion->Get_Frame_Rate() * ModeAnim.frameRateMultiplier * ModeAnim.animDirection * frametime; frame += delta; // @@ -962,10 +959,10 @@ float Animatable3DObjClass::Compute_Current_Frame(float *newDirection) const case ANIM_MODE_LOOP: if ( frame >= ModeAnim.Motion->Get_Num_Frames() - 1 ) { frame -= ModeAnim.Motion->Get_Num_Frames() - 1; - } - // If it is still too far out, reset - if ( frame >= ModeAnim.Motion->Get_Num_Frames() - 1 ) { - frame = 0; + // If it is still too far out, reset + if ( frame >= ModeAnim.Motion->Get_Num_Frames() - 1 ) { + frame = 0; + } } break; case ANIM_MODE_ONCE_BACKWARDS: //play animation one time but backwards @@ -976,10 +973,10 @@ float Animatable3DObjClass::Compute_Current_Frame(float *newDirection) const case ANIM_MODE_LOOP_BACKWARDS: //play animation backwards in a loop if ( frame < 0 ) { frame += ModeAnim.Motion->Get_Num_Frames() - 1; - } - // If it is still too far out, reset - if ( frame < 0 ) { - frame = ModeAnim.Motion->Get_Num_Frames() - 1; + // If it is still too far out, reset + if ( frame < 0 ) { + frame = ModeAnim.Motion->Get_Num_Frames() - 1; + } } break; case ANIM_MODE_LOOP_PINGPONG: @@ -1041,7 +1038,6 @@ void Animatable3DObjClass::Single_Anim_Progress (void) // ModeAnim.PrevFrame = ModeAnim.Frame; ModeAnim.Frame = Compute_Current_Frame(&ModeAnim.animDirection); - ModeAnim.LastSyncTime = WW3D::Get_Sync_Time(); // // Force the hierarchy to be recalculated diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h index a671b5b1af8..6985ade3ebf 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h @@ -190,7 +190,6 @@ class Animatable3DObjClass : public CompositeRenderObjClass float Frame; float PrevFrame; int AnimMode; - mutable int LastSyncTime; float animDirection; float frameRateMultiplier; // 020607 srj -- added } ModeAnim; From eee445d771fc1181e84aab13e9eaffd85bea2044 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 13 Sep 2025 19:39:18 +0200 Subject: [PATCH 115/343] bugfix(ww3d): Bind the ww3d sync step to the game logic step (#1579) --- .../Source/WWVegas/WWLib/WWDefines.h | 6 ----- .../GameEngine/Include/GameLogic/GameLogic.h | 2 ++ .../Source/GameLogic/System/GameLogic.cpp | 6 +++++ .../W3DDevice/GameClient/W3DDisplay.cpp | 4 ++++ .../Libraries/Source/WWVegas/WW3D2/ww3d.cpp | 23 +++++++------------ .../Libraries/Source/WWVegas/WW3D2/ww3d.h | 4 ++-- .../Source/WWVegas/WWLib/WWDefines.h | 6 ----- .../GameEngine/Include/GameLogic/GameLogic.h | 2 ++ .../Source/GameLogic/System/GameLogic.cpp | 6 +++++ .../W3DDevice/GameClient/W3DDisplay.cpp | 4 ++++ .../Libraries/Source/WWVegas/WW3D2/ww3d.cpp | 23 +++++++------------ .../Libraries/Source/WWVegas/WW3D2/ww3d.h | 4 ++-- 12 files changed, 44 insertions(+), 46 deletions(-) diff --git a/Core/Libraries/Source/WWVegas/WWLib/WWDefines.h b/Core/Libraries/Source/WWVegas/WWLib/WWDefines.h index d7acdd7b4ed..cb93ccd88d1 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/WWDefines.h +++ b/Core/Libraries/Source/WWVegas/WWLib/WWDefines.h @@ -17,9 +17,3 @@ */ #pragma once - -// The WW3D Sync time. This was originally 33 ms, ~30 fps, integer. -// Changing or removing this will require tweaking all Drawable code that concerns logic time step, including locomotion physics. -#ifndef MSEC_PER_WWSYNC_FRAME -#define MSEC_PER_WWSYNC_FRAME (33) -#endif diff --git a/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h b/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h index 6b9815a411a..512e0ee5a1a 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h +++ b/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h @@ -133,6 +133,7 @@ class GameLogic : public SubsystemInterface, public Snapshot Real getHeight( void ); ///< Returns the height of the world Bool isInGameLogicUpdate( void ) const { return m_isInUpdate; } + Bool hasUpdated() const { return m_hasUpdated; } ///< Returns true if the logic frame has advanced in the current client/render update UnsignedInt getFrame( void ); ///< Returns the current simulation frame number UnsignedInt getCRC( Int mode = CRC_CACHED, AsciiString deepCRCFileName = AsciiString::TheEmptyString ); ///< Returns the CRC @@ -301,6 +302,7 @@ class GameLogic : public SubsystemInterface, public Snapshot Bool m_loadingScene; Bool m_isInUpdate; + Bool m_hasUpdated; Int m_rankPointsToAddAtGameStart; diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 1f01c04aa48..92bf469c281 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -226,6 +226,7 @@ GameLogic::GameLogic( void ) // m_frame = 0; + m_hasUpdated = FALSE; m_frameObjectsChangedTriggerAreas = 0; m_width = 0; m_height = 0; @@ -256,6 +257,7 @@ GameLogic::GameLogic( void ) void GameLogic::setDefaults( Bool saveGame ) { m_frame = 0; + m_hasUpdated = FALSE; m_width = DEFAULT_WORLD_WIDTH; m_height = DEFAULT_WORLD_HEIGHT; m_objList = NULL; @@ -1020,6 +1022,7 @@ void GameLogic::startNewGame( Bool saveGame ) // reset the frame counter m_frame = 0; + m_hasUpdated = FALSE; #ifdef DEBUG_CRC // TheSuperHackers @info helmutbuhler 04/09/2025 @@ -3327,6 +3330,7 @@ void GameLogic::update( void ) if (!m_startNewGame) { m_frame++; + m_hasUpdated = TRUE; } } @@ -3334,6 +3338,8 @@ void GameLogic::update( void ) // ------------------------------------------------------------------------------------------------ void GameLogic::preUpdate() { + m_hasUpdated = FALSE; + if (m_pauseFrame == m_frame && m_pauseFrame != 0) { m_pauseFrame = 0; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index a1813f3d7e9..a5e39e74035 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -1733,6 +1733,10 @@ void W3DDisplay::draw( void ) WW3D::Update_Logic_Frame_Time(TheGameEngine->getLogicTimeStepMilliseconds()); + // TheSuperHackers @info This binds the WW3D update to the logic update. This was originally 33 ms, ~30 fps, integer. + // Changing this will require tweaking all Drawable code that concerns the ww3d time step, including locomotion physics. + WW3D::Sync(TheGameLogic->hasUpdated()); + static Int now; now=timeGetTime(); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp index f44fa6820f2..973b0ff2fb2 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp @@ -1173,18 +1173,6 @@ void WW3D::Update_Logic_Frame_Time(float milliseconds) { LogicFrameTimeMs = milliseconds; FractionalSyncMs += milliseconds; - unsigned int integralSyncMs = (unsigned int)FractionalSyncMs; - -#if MSEC_PER_WWSYNC_FRAME - if (integralSyncMs < MSEC_PER_WWSYNC_FRAME) - { - Sync(SyncTime); - return; - } -#endif - - FractionalSyncMs -= integralSyncMs; - Sync(SyncTime + integralSyncMs); } @@ -1200,12 +1188,17 @@ void WW3D::Update_Logic_Frame_Time(float milliseconds) * HISTORY: * * 3/24/98 GTH : Created. * *=============================================================================================*/ -void WW3D::Sync(unsigned int sync_time) +void WW3D::Sync(bool step) { PreviousSyncTime = SyncTime; - SyncTime = sync_time; -} + if (step) + { + unsigned int integralSyncMs = (unsigned int)FractionalSyncMs; + FractionalSyncMs -= integralSyncMs; + SyncTime += integralSyncMs; + } +} /*********************************************************************************************** * WW3D::Set_Ext_Swap_Interval -- Sets the swap interval the device should aim sync for. * diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h index d32aa3861f9..4cb8c5bf9bd 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h @@ -163,14 +163,14 @@ class WW3D static void Flip_To_Primary(void); // TheSuperHackers @info Add amount of milliseconds that the simulation has advanced in this render frame. - // This can be a fraction of a logic step. It will call Sync on its own once an appropriate amount of time has passed. + // This can be a fraction of a logic step. static void Update_Logic_Frame_Time(float milliseconds); /* ** Timing ** By calling the Sync function, the application can move the ww3d library time forward. This ** will control things like animated uv-offset mappers and render object animations. */ - static void Sync( unsigned int sync_time ); + static void Sync(bool step); static unsigned int Get_Sync_Time(void) { return SyncTime; } static unsigned int Get_Sync_Frame_Time(void) { return SyncTime - PreviousSyncTime; } static float Get_Logic_Frame_Time_Milliseconds() { return LogicFrameTimeMs; } diff --git a/Generals/Libraries/Source/WWVegas/WWLib/WWDefines.h b/Generals/Libraries/Source/WWVegas/WWLib/WWDefines.h index d7acdd7b4ed..cb93ccd88d1 100644 --- a/Generals/Libraries/Source/WWVegas/WWLib/WWDefines.h +++ b/Generals/Libraries/Source/WWVegas/WWLib/WWDefines.h @@ -17,9 +17,3 @@ */ #pragma once - -// The WW3D Sync time. This was originally 33 ms, ~30 fps, integer. -// Changing or removing this will require tweaking all Drawable code that concerns logic time step, including locomotion physics. -#ifndef MSEC_PER_WWSYNC_FRAME -#define MSEC_PER_WWSYNC_FRAME (33) -#endif diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h index 285847aad95..5931e710fdd 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h @@ -138,6 +138,7 @@ class GameLogic : public SubsystemInterface, public Snapshot Real getHeight( void ); ///< Returns the height of the world Bool isInGameLogicUpdate( void ) const { return m_isInUpdate; } + Bool hasUpdated() const { return m_hasUpdated; } ///< Returns true if the logic frame has advanced in the current client/render update UnsignedInt getFrame( void ); ///< Returns the current simulation frame number UnsignedInt getCRC( Int mode = CRC_CACHED, AsciiString deepCRCFileName = AsciiString::TheEmptyString ); ///< Returns the CRC @@ -324,6 +325,7 @@ class GameLogic : public SubsystemInterface, public Snapshot Bool m_clearingGameData; Bool m_isInUpdate; + Bool m_hasUpdated; Int m_rankPointsToAddAtGameStart; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 540731886dd..7cdcc3eabb4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -237,6 +237,7 @@ GameLogic::GameLogic( void ) // m_frame = 0; + m_hasUpdated = FALSE; m_frameObjectsChangedTriggerAreas = 0; m_width = 0; m_height = 0; @@ -271,6 +272,7 @@ GameLogic::GameLogic( void ) void GameLogic::setDefaults( Bool loadingSaveGame ) { m_frame = 0; + m_hasUpdated = FALSE; m_width = DEFAULT_WORLD_WIDTH; m_height = DEFAULT_WORLD_HEIGHT; m_objList = NULL; @@ -1157,6 +1159,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) // reset the frame counter m_frame = 0; + m_hasUpdated = FALSE; #ifdef DEBUG_CRC // TheSuperHackers @info helmutbuhler 04/09/2025 @@ -3863,6 +3866,7 @@ void GameLogic::update( void ) if (!m_startNewGame) { m_frame++; + m_hasUpdated = TRUE; } } @@ -3870,6 +3874,8 @@ void GameLogic::update( void ) // ------------------------------------------------------------------------------------------------ void GameLogic::preUpdate() { + m_hasUpdated = FALSE; + if (m_pauseFrame == m_frame && m_pauseFrame != 0) { m_pauseFrame = 0; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index bef1b0e4891..2ae78b18ec6 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -1814,6 +1814,10 @@ void W3DDisplay::draw( void ) WW3D::Update_Logic_Frame_Time(TheGameEngine->getLogicTimeStepMilliseconds()); + // TheSuperHackers @info This binds the WW3D update to the logic update. This was originally 33 ms, ~30 fps, integer. + // Changing this will require tweaking all Drawable code that concerns the ww3d time step, including locomotion physics. + WW3D::Sync(TheGameLogic->hasUpdated()); + static Int now; now=timeGetTime(); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp index 072d816efdd..fdc9b93dc78 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp @@ -1168,18 +1168,6 @@ void WW3D::Update_Logic_Frame_Time(float milliseconds) { LogicFrameTimeMs = milliseconds; FractionalSyncMs += milliseconds; - unsigned int integralSyncMs = (unsigned int)FractionalSyncMs; - -#if MSEC_PER_WWSYNC_FRAME - if (integralSyncMs < MSEC_PER_WWSYNC_FRAME) - { - Sync(SyncTime); - return; - } -#endif - - FractionalSyncMs -= integralSyncMs; - Sync(SyncTime + integralSyncMs); } @@ -1195,12 +1183,17 @@ void WW3D::Update_Logic_Frame_Time(float milliseconds) * HISTORY: * * 3/24/98 GTH : Created. * *=============================================================================================*/ -void WW3D::Sync(unsigned int sync_time) +void WW3D::Sync(bool step) { PreviousSyncTime = SyncTime; - SyncTime = sync_time; -} + if (step) + { + unsigned int integralSyncMs = (unsigned int)FractionalSyncMs; + FractionalSyncMs -= integralSyncMs; + SyncTime += integralSyncMs; + } +} /*********************************************************************************************** * WW3D::Set_Ext_Swap_Interval -- Sets the swap interval the device should aim sync for. * diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h index b46b135dce2..0057dbf9891 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h @@ -163,14 +163,14 @@ class WW3D static void Flip_To_Primary(void); // TheSuperHackers @info Add amount of milliseconds that the simulation has advanced in this render frame. - // This can be a fraction of a logic step. It will call Sync on its own once an appropriate amount of time has passed. + // This can be a fraction of a logic step. static void Update_Logic_Frame_Time(float milliseconds); /* ** Timing ** By calling the Sync function, the application can move the ww3d library time forward. This ** will control things like animated uv-offset mappers and render object animations. */ - static void Sync( unsigned int sync_time ); + static void Sync(bool step); static unsigned int Get_Sync_Time(void) { return SyncTime; } static unsigned int Get_Sync_Frame_Time(void) { return SyncTime - PreviousSyncTime; } static float Get_Logic_Frame_Time_Milliseconds() { return LogicFrameTimeMs; } From 5dd9d6aa460efbe295f98d99d090f6dcace82f72 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 13 Sep 2025 20:58:18 +0200 Subject: [PATCH 116/343] refactor(anim): Cleanup and simplify animation code a bit (#1579) --- Core/Libraries/Source/WWVegas/WW3D2/hanim.h | 4 --- Core/Libraries/Source/WWVegas/WW3D2/hcanim.h | 2 -- .../Source/WWVegas/WW3D2/animobj.cpp | 26 ++++++++++--------- .../Libraries/Source/WWVegas/WW3D2/animobj.h | 4 +-- .../Source/WWVegas/WW3D2/hmorphanim.h | 2 -- .../Libraries/Source/WWVegas/WW3D2/hrawanim.h | 2 -- .../Source/WWVegas/WW3D2/animobj.cpp | 26 ++++++++++--------- .../Libraries/Source/WWVegas/WW3D2/animobj.h | 4 +-- .../Source/WWVegas/WW3D2/hmorphanim.h | 2 -- .../Libraries/Source/WWVegas/WW3D2/hrawanim.h | 2 -- 10 files changed, 32 insertions(+), 42 deletions(-) diff --git a/Core/Libraries/Source/WWVegas/WW3D2/hanim.h b/Core/Libraries/Source/WWVegas/WW3D2/hanim.h index 65652639883..34df969829d 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/hanim.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/hanim.h @@ -95,11 +95,7 @@ class HAnimClass : public RefCountClass, public HashableClass virtual float Get_Frame_Rate() = 0; virtual float Get_Total_Time() = 0; -// virtual Vector3 Get_Translation(int pividx,float frame) = 0; -// virtual Quaternion Get_Orientation(int pividx,float frame) = 0; // Jani: Changed to pass in reference of destination to avoid copying - virtual void Get_Translation(int pividx,float frame) {} // todo: remove - virtual void Get_Orientation(int pividx,float frame) {} // todo: remove virtual void Get_Translation(Vector3& translation, int pividx,float frame) const = 0; virtual void Get_Orientation(Quaternion& orientation, int pividx,float frame) const = 0; virtual void Get_Transform(Matrix3D&, int pividx, float frame) const = 0; diff --git a/Core/Libraries/Source/WWVegas/WW3D2/hcanim.h b/Core/Libraries/Source/WWVegas/WW3D2/hcanim.h index fe21ef17878..5924046fff4 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/hcanim.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/hcanim.h @@ -93,8 +93,6 @@ class HCompressedAnimClass : public HAnimClass float Get_Total_Time() { return (float)NumFrames / FrameRate; } int Get_Flavor() { return Flavor; } -// Vector3 Get_Translation(int pividx,float frame); -// Quaternion Get_Orientation(int pividx,float frame); void Get_Translation(Vector3& translation, int pividx,float frame) const; void Get_Orientation(Quaternion& orientation, int pividx,float frame) const; void Get_Transform(Matrix3D& transform, int pividx,float frame) const; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp index 2b81b7b36ca..4cf15ff8292 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp @@ -941,18 +941,20 @@ float Animatable3DObjClass::Compute_Current_Frame(float *newDirection) const // // Wrap the frame // + const int numFrames = ModeAnim.Motion->Get_Num_Frames() - 1; + switch (ModeAnim.AnimMode) { case ANIM_MODE_ONCE: - if (frame >= ModeAnim.Motion->Get_Num_Frames() - 1) { - frame = ModeAnim.Motion->Get_Num_Frames() - 1; + if (frame >= numFrames) { + frame = numFrames; } break; case ANIM_MODE_LOOP: - if ( frame >= ModeAnim.Motion->Get_Num_Frames() - 1 ) { - frame -= ModeAnim.Motion->Get_Num_Frames() - 1; + if ( frame >= numFrames ) { + frame -= numFrames; // If it is still too far out, reset - if ( frame >= ModeAnim.Motion->Get_Num_Frames() - 1 ) { + if ( frame >= numFrames ) { frame = 0; } } @@ -964,22 +966,22 @@ float Animatable3DObjClass::Compute_Current_Frame(float *newDirection) const break; case ANIM_MODE_LOOP_BACKWARDS: //play animation backwards in a loop if ( frame < 0 ) { - frame += ModeAnim.Motion->Get_Num_Frames() - 1; + frame += numFrames; // If it is still too far out, reset if ( frame < 0 ) { - frame = ModeAnim.Motion->Get_Num_Frames() - 1; + frame = numFrames; } } break; case ANIM_MODE_LOOP_PINGPONG: if (ModeAnim.animDirection >= 1.0f) { //playing forwards, reverse direction - if (frame >= (ModeAnim.Motion->Get_Num_Frames() - 1)) + if (frame >= numFrames) { //step backwards in animation by excess time - frame = (ModeAnim.Motion->Get_Num_Frames() - 1)*2 - frame; + frame = numFrames * 2 - frame; // If it is still too far out, reset - if ( frame >= ModeAnim.Motion->Get_Num_Frames() - 1 ) - frame = (ModeAnim.Motion->Get_Num_Frames() - 1); + if ( frame >= numFrames - 1 ) + frame = numFrames; direction = ModeAnim.animDirection * -1.0f; } } @@ -989,7 +991,7 @@ float Animatable3DObjClass::Compute_Current_Frame(float *newDirection) const { //step forwards in animation by excess time frame = -frame; // If it is still too far out, reset - if ( frame >= ModeAnim.Motion->Get_Num_Frames() - 1 ) + if ( frame >= numFrames ) frame = 0; direction = ModeAnim.animDirection * -1.0f; } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h index 174c1eeafe6..02a3f53425a 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h @@ -261,8 +261,8 @@ inline void Animatable3DObjClass::Anim_Update(const Matrix3D & root,HAnimClass * ** Apply motion to the base pose */ if ((motion) && (HTree)) { - if (ModeAnim.Motion->Class_ID() == HAnimClass::CLASSID_HRAWANIM) - HTree->Anim_Update(Transform,(HRawAnimClass*)ModeAnim.Motion,ModeAnim.Frame); + if (motion->Class_ID() == HAnimClass::CLASSID_HRAWANIM) + HTree->Anim_Update(root,(HRawAnimClass*)motion,frame); else HTree->Anim_Update(root,motion,frame); } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.h index 425aec33d2e..c74753c7b2b 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.h @@ -94,8 +94,6 @@ class HMorphAnimClass : public HAnimClass float Get_Frame_Rate() { return FrameRate; } float Get_Total_Time() { return (float)FrameCount / FrameRate; } -// Vector3 Get_Translation(int pividx,float frame); -// Quaternion Get_Orientation(int pividx,float frame); void Get_Translation(Vector3& translation, int pividx,float frame) const; void Get_Orientation(Quaternion& orientation, int pividx,float frame) const; void Get_Transform(Matrix3D& transform, int pividx,float frame) const; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.h index 3cb08cce445..90566267041 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.h @@ -97,8 +97,6 @@ class HRawAnimClass : public HAnimClass float Get_Frame_Rate() { return FrameRate; } float Get_Total_Time() { return (float)NumFrames / FrameRate; } -// Vector3 Get_Translation(int pividx,float frame); -// Quaternion Get_Orientation(int pividx,float frame); void Get_Translation(Vector3& translation, int pividx,float frame) const; void Get_Orientation(Quaternion& orientation, int pividx,float frame) const; void Get_Transform(Matrix3D& transform, int pividx,float frame) const; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp index 86ba38c1914..15e089a0bab 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp @@ -949,18 +949,20 @@ float Animatable3DObjClass::Compute_Current_Frame(float *newDirection) const // // Wrap the frame // + const int numFrames = ModeAnim.Motion->Get_Num_Frames() - 1; + switch (ModeAnim.AnimMode) { case ANIM_MODE_ONCE: - if (frame >= ModeAnim.Motion->Get_Num_Frames() - 1) { - frame = ModeAnim.Motion->Get_Num_Frames() - 1; + if (frame >= numFrames) { + frame = numFrames; } break; case ANIM_MODE_LOOP: - if ( frame >= ModeAnim.Motion->Get_Num_Frames() - 1 ) { - frame -= ModeAnim.Motion->Get_Num_Frames() - 1; + if ( frame >= numFrames ) { + frame -= numFrames; // If it is still too far out, reset - if ( frame >= ModeAnim.Motion->Get_Num_Frames() - 1 ) { + if ( frame >= numFrames ) { frame = 0; } } @@ -972,22 +974,22 @@ float Animatable3DObjClass::Compute_Current_Frame(float *newDirection) const break; case ANIM_MODE_LOOP_BACKWARDS: //play animation backwards in a loop if ( frame < 0 ) { - frame += ModeAnim.Motion->Get_Num_Frames() - 1; + frame += numFrames; // If it is still too far out, reset if ( frame < 0 ) { - frame = ModeAnim.Motion->Get_Num_Frames() - 1; + frame = numFrames; } } break; case ANIM_MODE_LOOP_PINGPONG: if (ModeAnim.animDirection >= 1.0f) { //playing forwards, reverse direction - if (frame >= (ModeAnim.Motion->Get_Num_Frames() - 1)) + if (frame >= numFrames) { //step backwards in animation by excess time - frame = (ModeAnim.Motion->Get_Num_Frames() - 1)*2 - frame; + frame = numFrames * 2 - frame; // If it is still too far out, reset - if ( frame >= ModeAnim.Motion->Get_Num_Frames() - 1 ) - frame = (ModeAnim.Motion->Get_Num_Frames() - 1); + if ( frame >= numFrames - 1 ) + frame = numFrames; direction = ModeAnim.animDirection * -1.0f; } } @@ -997,7 +999,7 @@ float Animatable3DObjClass::Compute_Current_Frame(float *newDirection) const { //step forwards in animation by excess time frame = -frame; // If it is still too far out, reset - if ( frame >= ModeAnim.Motion->Get_Num_Frames() - 1 ) + if ( frame >= numFrames ) frame = 0; direction = ModeAnim.animDirection * -1.0f; } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h index 6985ade3ebf..9a34e9c8eb3 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h @@ -261,8 +261,8 @@ inline void Animatable3DObjClass::Anim_Update(const Matrix3D & root,HAnimClass * ** Apply motion to the base pose */ if ((motion) && (HTree)) { - if (ModeAnim.Motion->Class_ID() == HAnimClass::CLASSID_HRAWANIM) - HTree->Anim_Update(Transform,(HRawAnimClass*)ModeAnim.Motion,ModeAnim.Frame); + if (motion->Class_ID() == HAnimClass::CLASSID_HRAWANIM) + HTree->Anim_Update(root,(HRawAnimClass*)motion,frame); else HTree->Anim_Update(root,motion,frame); } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.h index 537fb9639d4..e6c8a273509 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.h @@ -94,8 +94,6 @@ class HMorphAnimClass : public HAnimClass float Get_Frame_Rate() { return FrameRate; } float Get_Total_Time() { return (float)FrameCount / FrameRate; } -// Vector3 Get_Translation(int pividx,float frame); -// Quaternion Get_Orientation(int pividx,float frame); void Get_Translation(Vector3& translation, int pividx,float frame) const; void Get_Orientation(Quaternion& orientation, int pividx,float frame) const; void Get_Transform(Matrix3D& transform, int pividx,float frame) const; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.h index 38733f89b28..0ea90bfbf25 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.h @@ -97,8 +97,6 @@ class HRawAnimClass : public HAnimClass float Get_Frame_Rate() { return FrameRate; } float Get_Total_Time() { return (float)NumFrames / FrameRate; } -// Vector3 Get_Translation(int pividx,float frame); -// Quaternion Get_Orientation(int pividx,float frame); void Get_Translation(Vector3& translation, int pividx,float frame) const; void Get_Orientation(Quaternion& orientation, int pividx,float frame) const; void Get_Transform(Matrix3D& transform, int pividx,float frame) const; From 26c5a9b7bd104988c3f8e733203b4b508bd139ce Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 14 Sep 2025 09:57:25 +0200 Subject: [PATCH 117/343] tweak(anim): Enable interpolation for raw animation updates and couple the legacy non interpolated updates to the ww3d sync (#1579) --- Core/Libraries/Source/WWVegas/WW3D2/htree.cpp | 11 ++++++++++- Core/Libraries/Source/WWVegas/WW3D2/htree.h | 2 +- Core/Libraries/Source/WWVegas/WWLib/WWCommon.h | 6 ++++++ Core/Libraries/Source/WWVegas/WWLib/WWDefines.h | 9 +++++++++ Generals/Code/GameEngine/Include/Common/GameCommon.h | 2 +- Generals/Code/GameEngine/Source/Common/GameEngine.cpp | 2 +- .../Source/W3DDevice/GameClient/W3DDisplay.cpp | 3 +-- .../Code/Libraries/Source/WWVegas/WW3D2/animobj.h | 4 +++- Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp | 2 +- Generals/Libraries/Source/WWVegas/WWLib/WWDefines.h | 9 +++++++++ .../Code/GameEngine/Include/Common/GameCommon.h | 2 +- .../Code/GameEngine/Source/Common/GameEngine.cpp | 2 +- .../Source/W3DDevice/GameClient/W3DDisplay.cpp | 3 +-- .../Code/Libraries/Source/WWVegas/WW3D2/animobj.h | 4 +++- .../Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp | 2 +- 15 files changed, 49 insertions(+), 14 deletions(-) diff --git a/Core/Libraries/Source/WWVegas/WW3D2/htree.cpp b/Core/Libraries/Source/WWVegas/WW3D2/htree.cpp index 0a8d11c999b..db808dc9482 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/htree.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/htree.cpp @@ -62,6 +62,7 @@ #include "wwmemlog.h" #include "hrawanim.h" #include "motchan.h" +#include "ww3d.h" /*********************************************************************************************** * HTreeClass::HTreeClass -- constructor * @@ -606,8 +607,16 @@ void HTreeClass::Anim_Update(const Matrix3D & root,HAnimClass * motion,float fra /*Customized version of the above which excludes interpolation and assumes HRawAnimClass For use by 'Generals' -MW*/ -void HTreeClass::Anim_Update(const Matrix3D & root,HRawAnimClass * motion,float frame) +void HTreeClass::Anim_Update_Without_Interpolation(const Matrix3D & root,HRawAnimClass * motion,float frame) { + if (WW3D::Get_Sync_Frame_Time() == 0 && (int)motion->Get_Frame_Rate() == WWSyncPerSecond) + { + // TheSuperHackers @tweak Keep the animation frame step in sync with the ww3d frame step if they can align. + // @todo This needs improving if the WWSyncPerSecond is changed or the animation frame rates can be larger. + static_assert(WWSyncPerSecond == 30, "This is currently catered to a 30 fps sync"); + return; + } + PivotClass *pivot,*endpivot,*lastAnimPivot; Pivot[0].Transform = root; diff --git a/Core/Libraries/Source/WWVegas/WW3D2/htree.h b/Core/Libraries/Source/WWVegas/WW3D2/htree.h index f0fe2c563cf..01e993061fd 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/htree.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/htree.h @@ -100,7 +100,7 @@ class HTreeClass : public W3DMPO void Anim_Update( const Matrix3D & root, HAnimClass * motion, float frame); - void Anim_Update(const Matrix3D & root,HRawAnimClass * motion,float frame); + void Anim_Update_Without_Interpolation(const Matrix3D & root,HRawAnimClass * motion,float frame); void Blend_Update( const Matrix3D & root, HAnimClass * motion0, diff --git a/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h b/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h index a2a2248eccf..329324ca51f 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h +++ b/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h @@ -26,6 +26,12 @@ #define ARRAY_SIZE(x) int(sizeof(x)/sizeof(x[0])) #endif +enum +{ + // TheSuperHackers @info The original WWSync was 33 ms, ~30 fps, integer. + // Changing this will require tweaking all Drawable code that concerns the ww3d time step, including locomotion physics. + WWSyncPerSecond = 30 +}; #if defined(_MSC_VER) && _MSC_VER < 1300 typedef unsigned MemValueType; diff --git a/Core/Libraries/Source/WWVegas/WWLib/WWDefines.h b/Core/Libraries/Source/WWVegas/WWLib/WWDefines.h index cb93ccd88d1..eb25d597db8 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/WWDefines.h +++ b/Core/Libraries/Source/WWVegas/WWLib/WWDefines.h @@ -17,3 +17,12 @@ */ #pragma once + +// Enable translation and rotation interpolation for raw animation (HRawAnimClass) updates. +// This was intentionally disabled in the retail version, but likely not fully thought through. +// Interpolation is certainly desired for animations that move and rotate meshes, but may not be +// desired for animations that teleport meshes from one location to another, such as blinking lights. +// @todo Implement a new flag per animation file to opt-out of interpolation. +#ifndef WW3D_ENABLE_RAW_ANIM_INTERPOLATION +#define WW3D_ENABLE_RAW_ANIM_INTERPOLATION (1) +#endif diff --git a/Generals/Code/GameEngine/Include/Common/GameCommon.h b/Generals/Code/GameEngine/Include/Common/GameCommon.h index 87813783e11..e83eea3bb30 100644 --- a/Generals/Code/GameEngine/Include/Common/GameCommon.h +++ b/Generals/Code/GameEngine/Include/Common/GameCommon.h @@ -66,7 +66,7 @@ enum { BaseFps = 30, // The historic base frame rate for this game. This value must never change. - LOGICFRAMES_PER_SECOND = 30, + LOGICFRAMES_PER_SECOND = WWSyncPerSecond, MSEC_PER_SECOND = 1000 }; const Real LOGICFRAMES_PER_MSEC_REAL = (((Real)LOGICFRAMES_PER_SECOND) / ((Real)MSEC_PER_SECOND)); diff --git a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp index c2b324641c0..58a1419c123 100644 --- a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp @@ -255,7 +255,7 @@ GameEngine::GameEngine( void ) // initialize to non garbage values m_maxFPS = BaseFps; m_logicTimeScaleFPS = LOGICFRAMES_PER_SECOND; - m_updateTime = 0.0f; + m_updateTime = 1.0f / BaseFps; // initialized to something to avoid division by zero on first use m_logicTimeAccumulator = 0.0f; m_quitting = FALSE; m_isActive = FALSE; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index a5e39e74035..c839a8e988d 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -1733,8 +1733,7 @@ void W3DDisplay::draw( void ) WW3D::Update_Logic_Frame_Time(TheGameEngine->getLogicTimeStepMilliseconds()); - // TheSuperHackers @info This binds the WW3D update to the logic update. This was originally 33 ms, ~30 fps, integer. - // Changing this will require tweaking all Drawable code that concerns the ww3d time step, including locomotion physics. + // TheSuperHackers @info This binds the WW3D update to the logic update. WW3D::Sync(TheGameLogic->hasUpdated()); static Int now; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h index 02a3f53425a..b93b1bc775b 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h @@ -261,9 +261,11 @@ inline void Animatable3DObjClass::Anim_Update(const Matrix3D & root,HAnimClass * ** Apply motion to the base pose */ if ((motion) && (HTree)) { +#if !WW3D_ENABLE_RAW_ANIM_INTERPOLATION if (motion->Class_ID() == HAnimClass::CLASSID_HRAWANIM) - HTree->Anim_Update(root,(HRawAnimClass*)motion,frame); + HTree->Anim_Update_Without_Interpolation(root,(HRawAnimClass*)motion,frame); else +#endif HTree->Anim_Update(root,motion,frame); } Set_Hierarchy_Valid(true); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp index 973b0ff2fb2..0acd23d8479 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp @@ -165,7 +165,7 @@ const char* DAZZLE_INI_FILENAME="DAZZLE.INI"; ** ***********************************************************************************/ -float WW3D::LogicFrameTimeMs = 33.33f; +float WW3D::LogicFrameTimeMs = 1000.0f / WWSyncPerSecond; // initialized to something to avoid division by zero on first use float WW3D::FractionalSyncMs = 0.0f; unsigned int WW3D::SyncTime = 0; unsigned int WW3D::PreviousSyncTime = 0; diff --git a/Generals/Libraries/Source/WWVegas/WWLib/WWDefines.h b/Generals/Libraries/Source/WWVegas/WWLib/WWDefines.h index cb93ccd88d1..eb25d597db8 100644 --- a/Generals/Libraries/Source/WWVegas/WWLib/WWDefines.h +++ b/Generals/Libraries/Source/WWVegas/WWLib/WWDefines.h @@ -17,3 +17,12 @@ */ #pragma once + +// Enable translation and rotation interpolation for raw animation (HRawAnimClass) updates. +// This was intentionally disabled in the retail version, but likely not fully thought through. +// Interpolation is certainly desired for animations that move and rotate meshes, but may not be +// desired for animations that teleport meshes from one location to another, such as blinking lights. +// @todo Implement a new flag per animation file to opt-out of interpolation. +#ifndef WW3D_ENABLE_RAW_ANIM_INTERPOLATION +#define WW3D_ENABLE_RAW_ANIM_INTERPOLATION (1) +#endif diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h b/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h index 723ab57d2b2..2ce08a130f6 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h @@ -72,7 +72,7 @@ enum { BaseFps = 30, // The historic base frame rate for this game. This value must never change. - LOGICFRAMES_PER_SECOND = 30, + LOGICFRAMES_PER_SECOND = WWSyncPerSecond, MSEC_PER_SECOND = 1000 }; const Real LOGICFRAMES_PER_MSEC_REAL = (((Real)LOGICFRAMES_PER_SECOND) / ((Real)MSEC_PER_SECOND)); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp index c7f30f53eb1..02d786b4e55 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp @@ -253,7 +253,7 @@ GameEngine::GameEngine( void ) // initialize to non garbage values m_maxFPS = BaseFps; m_logicTimeScaleFPS = LOGICFRAMES_PER_SECOND; - m_updateTime = 0.0f; + m_updateTime = 1.0f / BaseFps; // initialized to something to avoid division by zero on first use m_logicTimeAccumulator = 0.0f; m_quitting = FALSE; m_isActive = FALSE; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 2ae78b18ec6..3b7fd684fd3 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -1814,8 +1814,7 @@ void W3DDisplay::draw( void ) WW3D::Update_Logic_Frame_Time(TheGameEngine->getLogicTimeStepMilliseconds()); - // TheSuperHackers @info This binds the WW3D update to the logic update. This was originally 33 ms, ~30 fps, integer. - // Changing this will require tweaking all Drawable code that concerns the ww3d time step, including locomotion physics. + // TheSuperHackers @info This binds the WW3D update to the logic update. WW3D::Sync(TheGameLogic->hasUpdated()); static Int now; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h index 9a34e9c8eb3..437480caf16 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h @@ -261,9 +261,11 @@ inline void Animatable3DObjClass::Anim_Update(const Matrix3D & root,HAnimClass * ** Apply motion to the base pose */ if ((motion) && (HTree)) { +#if !WW3D_ENABLE_RAW_ANIM_INTERPOLATION if (motion->Class_ID() == HAnimClass::CLASSID_HRAWANIM) - HTree->Anim_Update(root,(HRawAnimClass*)motion,frame); + HTree->Anim_Update_Without_Interpolation(root,(HRawAnimClass*)motion,frame); else +#endif HTree->Anim_Update(root,motion,frame); } Set_Hierarchy_Valid(true); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp index fdc9b93dc78..c27bd871345 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp @@ -166,7 +166,7 @@ const char* DAZZLE_INI_FILENAME="DAZZLE.INI"; ** ***********************************************************************************/ -float WW3D::LogicFrameTimeMs = 33.33f; +float WW3D::LogicFrameTimeMs = 1000.0f / WWSyncPerSecond; // initialized to something to avoid division by zero on first use float WW3D::FractionalSyncMs = 0.0f; unsigned int WW3D::SyncTime = 0; unsigned int WW3D::PreviousSyncTime = 0; From 792d17db2b7459217a684351219a580a5188e8bb Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 14 Sep 2025 12:13:41 +0200 Subject: [PATCH 118/343] tweak(heightmap): Decouple cloud render update from logic step (#1579) --- .../Include/W3DDevice/GameClient/HeightMap.h | 4 +- .../W3DDevice/GameClient/W3DShaderManager.h | 2 + .../Source/W3DDevice/GameClient/HeightMap.cpp | 24 ++++++---- .../W3DDevice/GameClient/W3DShaderManager.cpp | 44 +++++++++---------- .../W3DDevice/GameClient/BaseHeightMap.h | 2 + .../Include/W3DDevice/GameClient/HeightMap.h | 7 +-- .../W3DDevice/GameClient/W3DShaderManager.h | 2 + .../W3DDevice/GameClient/BaseHeightMap.cpp | 5 +++ .../W3DDevice/GameClient/FlatHeightMap.cpp | 13 +++--- .../Source/W3DDevice/GameClient/HeightMap.cpp | 18 ++++---- .../W3DDevice/GameClient/W3DShaderManager.cpp | 44 +++++++++---------- 11 files changed, 89 insertions(+), 76 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/HeightMap.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/HeightMap.h index 5be5f6fc743..52cc395bc6b 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/HeightMap.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/HeightMap.h @@ -180,7 +180,6 @@ class HeightMapRenderObjClass : public RenderObjClass, public DX8_CleanupHook void renderTerrainPass(CameraClass *pCamera); ///< renders additional terrain pass. W3DShroud *getShroud() {return m_shroud;} - void renderExtraBlendTiles(void); ///< render 3-way blend tiles that have blend of 3 textures. void updateShorelineTiles(Int minX, Int minY, Int maxX, Int maxY, WorldHeightMap *pMap); ///
m_useCloudMap; + const Bool doCloud = useCloud(); + + if (doCloud) + { + // TheSuperHackers @tweak Updates the cloud movement before applying it to the world. + // Is now decoupled from logic step. + W3DShaderManager::updateCloud(); + } Matrix3D tm(Transform); #if 0 // There is some weirdness sometimes with the dx8 static buffers. @@ -3906,10 +3913,6 @@ void HeightMapRenderObjClass::Render(RenderInfoClass & rinfo) DX8Wrapper::Set_Material(m_vertexMaterialClass); DX8Wrapper::Set_Shader(m_shaderClass); - if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT) { - doCloud = false; - } - st=W3DShaderManager::ST_TERRAIN_BASE; //set default shader //set correct shader based on current settings @@ -4454,10 +4457,7 @@ void HeightMapRenderObjClass::renderExtraBlendTiles(void) W3DShaderManager::ShaderTypes st = W3DShaderManager::ST_ROAD_BASE; - Bool doCloud = TheGlobalData->m_useCloudMap; - if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT) { - doCloud = false; - } + const Bool doCloud = useCloud(); if (TheGlobalData->m_useLightMap && doCloud) { @@ -4486,3 +4486,9 @@ void HeightMapRenderObjClass::renderExtraBlendTiles(void) } } } + +//============================================================================= +Bool HeightMapRenderObjClass::useCloud() +{ + return TheGlobalData->m_useCloudMap && TheGlobalData->m_timeOfDay != TIME_OF_DAY_NIGHT; +} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp index 2c9d8a26d51..a219e4912d4 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp @@ -1248,12 +1248,14 @@ class TerrainShader2Stage : public W3DShaderInterface public: float m_xSlidePerSecond ; ///< How far the clouds move per second. float m_ySlidePerSecond ; ///< How far the clouds move per second. - int m_curTick; float m_xOffset; float m_yOffset; + virtual Int set(Int pass); /// 1) m_xOffset -= 1; + while (m_yOffset > 1) m_yOffset -= 1; + while (m_xOffset < -1) m_xOffset += 1; + while (m_yOffset < -1) m_yOffset += 1; +} + void TerrainShader2Stage::updateNoise1(D3DXMATRIX *destMatrix,D3DXMATRIX *curViewInverse, Bool doUpdate) { #define STRETCH_FACTOR ((float)(1/(63.0*MAP_XY_FACTOR/2))) /* covers 63/2 tiles */ @@ -1340,26 +1352,6 @@ void TerrainShader2Stage::updateNoise1(D3DXMATRIX *destMatrix,D3DXMATRIX *curVie *destMatrix = *curViewInverse * scale; D3DXMATRIX offset; - - Int delta = m_curTick; - m_curTick = WW3D::Get_Sync_Time();//::GetTickCount(); - delta = m_curTick-delta; - m_xOffset += m_xSlidePerSecond*delta/1000; - m_yOffset += m_ySlidePerSecond*delta/1000; - - - //m_xOffset += m_xSlidePerSecond*delta/500; - //m_yOffset += m_ySlidePerSecond*delta/500; - - - //m_yOffset = sinf( (float)m_curTick * 0.0001f ); - //m_xOffset = cosf( (float)m_curTick * 0.0001f ); - - if (m_xOffset > 1) m_xOffset -= 1; - if (m_yOffset > 1) m_yOffset -= 1; - if (m_xOffset < -1) m_xOffset += 1; - if (m_yOffset < -1) m_yOffset += 1; - D3DXMatrixTranslation(&offset, m_xOffset, m_yOffset,0); *destMatrix *= offset; } @@ -2447,6 +2439,12 @@ void W3DShaderManager::shutdown(void) } } +//============================================================================= +void W3DShaderManager::updateCloud() +{ + terrainShader2Stage.updateCloud(); +} + // W3DShaderManager::getShaderPasses ======================================================= /** Return number of renderig passes required in perform the desired shader on current hardware. App will need to re-render the polygons this many times to complete the diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/BaseHeightMap.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/BaseHeightMap.h index 7e439de2dae..60165711afc 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/BaseHeightMap.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/BaseHeightMap.h @@ -328,6 +328,8 @@ class BaseHeightMapRenderObjClass : public RenderObjClass, public DX8_CleanupHoo void initDestAlphaLUT(void); ///m_useCloudMap && TheGlobalData->m_timeOfDay != TIME_OF_DAY_NIGHT; +} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/FlatHeightMap.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/FlatHeightMap.cpp index 07a36aad45e..553e62db203 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/FlatHeightMap.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/FlatHeightMap.cpp @@ -459,7 +459,14 @@ void FlatHeightMapRenderObjClass::Render(RenderInfoClass & rinfo) Int devicePasses; W3DShaderManager::ShaderTypes st; - Bool doCloud = TheGlobalData->m_useCloudMap; + const Bool doCloud = useCloud(); + + if (doCloud) + { + // TheSuperHackers @tweak Updates the cloud movement before applying it to the world. + // Is now decoupled from logic step. + W3DShaderManager::updateCloud(); + } Matrix3D tm(Transform); // If there are trees, tell them to draw at the transparent time to draw. @@ -494,10 +501,6 @@ void FlatHeightMapRenderObjClass::Render(RenderInfoClass & rinfo) DX8Wrapper::Set_Material(m_vertexMaterialClass); DX8Wrapper::Set_Shader(m_shaderClass); - if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT) { - doCloud = false; - } - st=W3DShaderManager::ST_FLAT_TERRAIN_BASE; //set default shader //set correct shader based on current settings diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp index 7891e46bdc8..6b7dbd25a84 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp @@ -1912,7 +1912,14 @@ void HeightMapRenderObjClass::Render(RenderInfoClass & rinfo) Int i,j,devicePasses; W3DShaderManager::ShaderTypes st; - Bool doCloud = TheGlobalData->m_useCloudMap; + const Bool doCloud = useCloud(); + + if (doCloud) + { + // TheSuperHackers @tweak Updates the cloud movement before applying it to the world. + // Is now decoupled from logic step. + W3DShaderManager::updateCloud(); + } Matrix3D tm(Transform); #if 0 // There is some weirdness sometimes with the dx8 static buffers. @@ -2003,10 +2010,6 @@ void HeightMapRenderObjClass::Render(RenderInfoClass & rinfo) DX8Wrapper::Set_Material(m_vertexMaterialClass); DX8Wrapper::Set_Shader(m_shaderClass); - if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT) { - doCloud = false; - } - st=W3DShaderManager::ST_TERRAIN_BASE; //set default shader //set correct shader based on current settings @@ -2415,10 +2418,7 @@ void HeightMapRenderObjClass::renderExtraBlendTiles(void) W3DShaderManager::ShaderTypes st = W3DShaderManager::ST_ROAD_BASE; - Bool doCloud = TheGlobalData->m_useCloudMap; - if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT) { - doCloud = false; - } + const Bool doCloud = useCloud(); if (TheGlobalData->m_useLightMap && doCloud) { diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp index b487858291d..a3df4598132 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp @@ -1482,12 +1482,14 @@ class TerrainShader2Stage : public W3DShaderInterface public: float m_xSlidePerSecond ; ///< How far the clouds move per second. float m_ySlidePerSecond ; ///< How far the clouds move per second. - int m_curTick; float m_xOffset; float m_yOffset; + virtual Int set(Int pass); /// 1) m_xOffset -= 1; + while (m_yOffset > 1) m_yOffset -= 1; + while (m_xOffset < -1) m_xOffset += 1; + while (m_yOffset < -1) m_yOffset += 1; +} + void TerrainShader2Stage::updateNoise1(D3DXMATRIX *destMatrix,D3DXMATRIX *curViewInverse, Bool doUpdate) { #define STRETCH_FACTOR ((float)(1/(63.0*MAP_XY_FACTOR/2))) /* covers 63/2 tiles */ @@ -1605,26 +1617,6 @@ void TerrainShader2Stage::updateNoise1(D3DXMATRIX *destMatrix,D3DXMATRIX *curVie *destMatrix = *curViewInverse * scale; D3DXMATRIX offset; - - Int delta = m_curTick; - m_curTick = WW3D::Get_Sync_Time();//::GetTickCount(); - delta = m_curTick-delta; - m_xOffset += m_xSlidePerSecond*delta/1000; - m_yOffset += m_ySlidePerSecond*delta/1000; - - - //m_xOffset += m_xSlidePerSecond*delta/500; - //m_yOffset += m_ySlidePerSecond*delta/500; - - - //m_yOffset = sinf( (float)m_curTick * 0.0001f ); - //m_xOffset = cosf( (float)m_curTick * 0.0001f ); - - while (m_xOffset > 1) m_xOffset -= 1; - while (m_yOffset > 1) m_yOffset -= 1; - while (m_xOffset < -1) m_xOffset += 1; - while (m_yOffset < -1) m_yOffset += 1; - D3DXMatrixTranslation(&offset, m_xOffset, m_yOffset,0); *destMatrix *= offset; } @@ -2704,6 +2696,12 @@ void W3DShaderManager::shutdown(void) } +//============================================================================= +void W3DShaderManager::updateCloud() +{ + terrainShader2Stage.updateCloud(); +} + // W3DShaderManager::getShaderPasses ======================================================= /** Return number of renderig passes required in perform the desired shader on current hardware. App will need to re-render the polygons this many times to complete the From 7ac7a41e1a5610059e2efbeabb45c4216d026e05 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 14 Sep 2025 18:09:44 +0200 Subject: [PATCH 119/343] bugfix(drawable): Fix locked color in Drawable::colorTint, EMPUpdate::update (#1579) --- .../GameEngine/Include/GameClient/Drawable.h | 5 ++--- .../GameEngine/Source/GameClient/Drawable.cpp | 17 +++-------------- .../GameLogic/Object/Update/EMPUpdate.cpp | 2 +- .../GameEngine/Include/GameClient/Drawable.h | 5 ++--- .../GameEngine/Source/GameClient/Drawable.cpp | 17 +++-------------- .../GameLogic/Object/Update/EMPUpdate.cpp | 2 +- 6 files changed, 12 insertions(+), 36 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/Drawable.h b/Generals/Code/GameEngine/Include/GameClient/Drawable.h index 8807b3930e8..750f76fcf89 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Drawable.h +++ b/Generals/Code/GameEngine/Include/GameClient/Drawable.h @@ -168,7 +168,7 @@ class TintEnvelope : public MemoryPoolObject, public Snapshot TintEnvelope(void); void update(void); ///< does all the work void play(const RGBColor *peak, - UnsignedInt atackFrames = DEF_ATTACK_FRAMES, + UnsignedInt attackFrames = DEF_ATTACK_FRAMES, UnsignedInt decayFrames = DEF_DECAY_FRAMES, UnsignedInt sustainAtPeak = DEF_SUSTAIN_FRAMES ); // ask MLorenzen void sustain(void) { m_envState = ENVELOPE_STATE_SUSTAIN; } @@ -231,7 +231,6 @@ enum DrawableStatus CPP_11(: DrawableStatusBits) DRAWABLE_STATUS_NONE = 0x00000000, ///< no status DRAWABLE_STATUS_DRAWS_IN_MIRROR = 0x00000001, ///< drawable can reflect DRAWABLE_STATUS_SHADOWS = 0x00000002, ///< use setShadowsEnabled() access method - DRAWABLE_STATUS_TINT_COLOR_LOCKED = 0x00000004, ///< drawable tint color is "locked" and won't fade to normal DRAWABLE_STATUS_NO_STATE_PARTICLES = 0x00000008, ///< do *not* auto-create particle systems based on model condition DRAWABLE_STATUS_NO_SAVE = 0x00000010, ///< do *not* save this drawable (UI fluff only). ignored (error, actually) if attached to an object @@ -372,7 +371,7 @@ class Drawable : public Thing, Bool getDrawsInMirror() const { return BitIsSet(m_status, DRAWABLE_STATUS_DRAWS_IN_MIRROR) || isKindOf(KINDOF_CAN_CAST_REFLECTIONS); } - void colorFlash( const RGBColor *color, UnsignedInt decayFrames = DEF_DECAY_FRAMES, UnsignedInt attackFrames = 0, UnsignedInt sustainAtPeak = FALSE ); ///< flash a drawable in the color specified for a short time + void colorFlash( const RGBColor *color, UnsignedInt decayFrames = DEF_DECAY_FRAMES, UnsignedInt attackFrames = 0, UnsignedInt sustainAtPeak = 0 ); ///< flash a drawable in the color specified for a short time void colorTint( const RGBColor *color ); ///< tint this drawable the color specified void setTintEnvelope( const RGBColor *color, Real attack, Real decay ); ///< how to transition color void flashAsSelected( const RGBColor *color = NULL ); ///< drawable takes care of the details if you spec no color diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index 4dd5fcee678..891bd99470f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -922,9 +922,6 @@ void Drawable::colorFlash( const RGBColor* color, UnsignedInt decayFrames, Unsig white.setFromInt(0xffffffff); m_colorTintEnvelope->play( &white ); } - - // make sure the tint color is unlocked so we "fade back down" to normal - clearDrawableStatus( DRAWABLE_STATUS_TINT_COLOR_LOCKED ); } // ------------------------------------------------------------------------------------------------ @@ -935,11 +932,7 @@ void Drawable::colorTint( const RGBColor* color ) if( color ) { // set the color via color flash - colorFlash( color, 0, 0, TRUE ); - - // lock the tint color so the flash never "fades back down" - setDrawableStatus( DRAWABLE_STATUS_TINT_COLOR_LOCKED ); - + colorFlash( color, 0, 0, ~0u ); } else { @@ -948,10 +941,6 @@ void Drawable::colorTint( const RGBColor* color ) // remove the tint applied to the object m_colorTintEnvelope->rest(); - - // set the tint as unlocked so we can flash and stuff again - clearDrawableStatus( DRAWABLE_STATUS_TINT_COLOR_LOCKED ); - } } @@ -4756,11 +4745,11 @@ TintEnvelope::TintEnvelope(void) const Real FADE_RATE_EPSILON = (0.001f); //------------------------------------------------------------------------------------------------- -void TintEnvelope::play(const RGBColor *peak, UnsignedInt atackFrames, UnsignedInt decayFrames, UnsignedInt sustainAtPeak ) +void TintEnvelope::play(const RGBColor *peak, UnsignedInt attackFrames, UnsignedInt decayFrames, UnsignedInt sustainAtPeak ) { setPeakColor( peak ); - setAttackFrames( atackFrames ); + setAttackFrames( attackFrames ); setDecayFrames( decayFrames ); m_envState = ENVELOPE_STATE_ATTACK; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp index 3bfdc41b174..328d1dfdbe9 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp @@ -147,7 +147,7 @@ UpdateSleepTime EMPUpdate::update( void ) { RGBColor end = data->m_endColor; saturateRGB( end, 5 ); - dr->colorFlash( &end, 9999, m_tintEnvFadeFrames, TRUE ); + dr->colorFlash( &end, 0, m_tintEnvFadeFrames, ~0u ); doDisableAttack(); } diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h index 868a189584e..7f320bd4095 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h @@ -171,7 +171,7 @@ class TintEnvelope : public MemoryPoolObject, public Snapshot TintEnvelope(void); void update(void); ///< does all the work void play(const RGBColor *peak, - UnsignedInt atackFrames = DEF_ATTACK_FRAMES, + UnsignedInt attackFrames = DEF_ATTACK_FRAMES, UnsignedInt decayFrames = DEF_DECAY_FRAMES, UnsignedInt sustainAtPeak = DEF_SUSTAIN_FRAMES ); // ask MLorenzen void sustain(void) { m_envState = ENVELOPE_STATE_SUSTAIN; } @@ -234,7 +234,6 @@ enum DrawableStatus CPP_11(: DrawableStatusBits) DRAWABLE_STATUS_NONE = 0x00000000, ///< no status DRAWABLE_STATUS_DRAWS_IN_MIRROR = 0x00000001, ///< drawable can reflect DRAWABLE_STATUS_SHADOWS = 0x00000002, ///< use setShadowsEnabled() access method - DRAWABLE_STATUS_TINT_COLOR_LOCKED = 0x00000004, ///< drawable tint color is "locked" and won't fade to normal DRAWABLE_STATUS_NO_STATE_PARTICLES = 0x00000008, ///< do *not* auto-create particle systems based on model condition DRAWABLE_STATUS_NO_SAVE = 0x00000010, ///< do *not* save this drawable (UI fluff only). ignored (error, actually) if attached to an object @@ -388,7 +387,7 @@ class Drawable : public Thing, Bool getDrawsInMirror() const { return BitIsSet(m_status, DRAWABLE_STATUS_DRAWS_IN_MIRROR) || isKindOf(KINDOF_CAN_CAST_REFLECTIONS); } - void colorFlash( const RGBColor *color, UnsignedInt decayFrames = DEF_DECAY_FRAMES, UnsignedInt attackFrames = 0, UnsignedInt sustainAtPeak = FALSE ); ///< flash a drawable in the color specified for a short time + void colorFlash( const RGBColor *color, UnsignedInt decayFrames = DEF_DECAY_FRAMES, UnsignedInt attackFrames = 0, UnsignedInt sustainAtPeak = 0 ); ///< flash a drawable in the color specified for a short time void colorTint( const RGBColor *color ); ///< tint this drawable the color specified void setTintEnvelope( const RGBColor *color, Real attack, Real decay ); ///< how to transition color void flashAsSelected( const RGBColor *color = NULL ); ///< drawable takes care of the details if you spec no color diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index 1358b1b0546..dce9e2c4127 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -971,9 +971,6 @@ void Drawable::colorFlash( const RGBColor* color, UnsignedInt decayFrames, Unsig white.setFromInt(0xffffffff); m_colorTintEnvelope->play( &white ); } - - // make sure the tint color is unlocked so we "fade back down" to normal - clearDrawableStatus( DRAWABLE_STATUS_TINT_COLOR_LOCKED ); } // ------------------------------------------------------------------------------------------------ @@ -984,11 +981,7 @@ void Drawable::colorTint( const RGBColor* color ) if( color ) { // set the color via color flash - colorFlash( color, 0, 0, TRUE ); - - // lock the tint color so the flash never "fades back down" - setDrawableStatus( DRAWABLE_STATUS_TINT_COLOR_LOCKED ); - + colorFlash( color, 0, 0, ~0u ); } else { @@ -997,10 +990,6 @@ void Drawable::colorTint( const RGBColor* color ) // remove the tint applied to the object m_colorTintEnvelope->rest(); - - // set the tint as unlocked so we can flash and stuff again - clearDrawableStatus( DRAWABLE_STATUS_TINT_COLOR_LOCKED ); - } } @@ -5513,11 +5502,11 @@ TintEnvelope::TintEnvelope(void) const Real FADE_RATE_EPSILON = (0.001f); //------------------------------------------------------------------------------------------------- -void TintEnvelope::play(const RGBColor *peak, UnsignedInt atackFrames, UnsignedInt decayFrames, UnsignedInt sustainAtPeak ) +void TintEnvelope::play(const RGBColor *peak, UnsignedInt attackFrames, UnsignedInt decayFrames, UnsignedInt sustainAtPeak ) { setPeakColor( peak ); - setAttackFrames( atackFrames ); + setAttackFrames( attackFrames ); setDecayFrames( decayFrames ); m_envState = ENVELOPE_STATE_ATTACK; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp index 8d754fa1b04..63e7fdb9e49 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp @@ -149,7 +149,7 @@ UpdateSleepTime EMPUpdate::update( void ) { RGBColor end = data->m_endColor; saturateRGB( end, 5 ); - dr->colorFlash( &end, 9999, m_tintEnvFadeFrames, TRUE ); + dr->colorFlash( &end, 0, m_tintEnvFadeFrames, ~0u ); doDisableAttack(); } From 8dc210c886ca273b025baaf50f062c7310ef9293 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 14 Sep 2025 18:30:42 +0200 Subject: [PATCH 120/343] tweak(ww3d): Decouple render update from logic step in RingRenderObjClass::animate, SphereRenderObjClass::animate (#1579) --- Core/Libraries/Source/WWVegas/WW3D2/ringobj.cpp | 8 ++------ Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Core/Libraries/Source/WWVegas/WW3D2/ringobj.cpp b/Core/Libraries/Source/WWVegas/WW3D2/ringobj.cpp index 5db7898b32d..f5fc0417a2b 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/ringobj.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/ringobj.cpp @@ -1146,13 +1146,9 @@ void RingRenderObjClass::animate() InnerScaleChannel.Get_Key_Count () > 0 || OuterScaleChannel.Get_Key_Count () > 0) { - // - // Convert from milliseconds to seconds and normalize the time - // if (AnimDuration > 0) { - float frametime = WW3D::Get_Sync_Frame_Time(); - frametime = (frametime * 0.001F) / AnimDuration; - anim_time += frametime; + float frametime = WW3D::Get_Logic_Frame_Time_Seconds(); + anim_time += frametime / AnimDuration; } else { anim_time = 1.0F; } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp b/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp index b14d7f323c0..bd3514e747f 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp @@ -1104,13 +1104,9 @@ void SphereRenderObjClass::animate (void) ScaleChannel.Get_Key_Count () > 0 || VectorChannel.Get_Key_Count () > 0) { - // - // Convert from milliseconds to seconds and normalize the time - // if (AnimDuration > 0) { - float frametime = WW3D::Get_Sync_Frame_Time(); - frametime = (frametime * 0.001F) / AnimDuration; - anim_time += frametime; + float frametime = WW3D::Get_Logic_Frame_Time_Seconds(); + anim_time += frametime / AnimDuration; } else { anim_time = 1.0F; } From 2683d1b597ec4b648cc7ad8db066652280e6e0cb Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 14 Sep 2025 18:31:23 +0200 Subject: [PATCH 121/343] tweak(ww3d): Decouple render update from logic step in DazzleRenderObjClass::Render, TexProjectClass::Pre_Render_Update (#1579) --- Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp | 6 +----- Generals/Code/Libraries/Source/WWVegas/WW3D2/texproject.cpp | 3 +-- GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp | 6 +----- .../Code/Libraries/Source/WWVegas/WW3D2/texproject.cpp | 3 +-- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp index 5ff6f9ef2c1..9e4a933d957 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp @@ -940,8 +940,7 @@ void DazzleRenderObjClass::Render(RenderInfoClass & rinfo) const DazzleTypeClass* params=types[type]; params->Calculate_Intensities(dazzle_intensity,dazzle_size,current_halo_intensity,camera_dir,current_dir,current_distance); - unsigned time_ms=WW3D::Get_Sync_Frame_Time(); - if (time_ms==0) time_ms=1; + float time_ms=WW3D::Get_Logic_Frame_Time_Milliseconds(); float weight=pow(params->ic.history_weight,time_ms); if (dazzle_intensity>0.0f) { @@ -1478,9 +1477,6 @@ void DazzleLayerClass::Render(CameraClass* camera) camera->Apply(); - unsigned time_ms=WW3D::Get_Sync_Frame_Time(); - if (time_ms==0) time_ms=1; - DX8Wrapper::Set_Material(NULL); for (unsigned type=0;type max_intensity_delta) { Intensity += max_intensity_delta; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp index 786e3db009b..d6099851233 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp @@ -975,8 +975,7 @@ void DazzleRenderObjClass::Render(RenderInfoClass & rinfo) const DazzleTypeClass* params=types[type]; params->Calculate_Intensities(dazzle_intensity,dazzle_size,current_halo_intensity,camera_dir,current_dir,dir,current_distance); - unsigned time_ms=WW3D::Get_Sync_Frame_Time(); - if (time_ms==0) time_ms=1; + float time_ms=WW3D::Get_Logic_Frame_Time_Milliseconds(); float weight=pow(params->ic.history_weight,time_ms); if (dazzle_intensity>0.0f) { @@ -1584,9 +1583,6 @@ void DazzleLayerClass::Render(CameraClass* camera) camera->Apply(); - unsigned time_ms=WW3D::Get_Sync_Frame_Time(); - if (time_ms==0) time_ms=1; - DX8Wrapper::Set_Material(NULL); for (unsigned type=0;type max_intensity_delta) { Intensity += max_intensity_delta; From 049ef5f3a953ab47d3e8c28f1941f6b654f9f562 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Mon, 15 Sep 2025 11:46:45 +0200 Subject: [PATCH 122/343] tweak(w3dview): Decouple WWAudioClass update from logic step (#1579) --- Core/Tools/W3DView/GraphicView.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Tools/W3DView/GraphicView.cpp b/Core/Tools/W3DView/GraphicView.cpp index c6e785198c2..185c4465c6e 100644 --- a/Core/Tools/W3DView/GraphicView.cpp +++ b/Core/Tools/W3DView/GraphicView.cpp @@ -546,7 +546,7 @@ CGraphicView::RepaintView // // Let the audio class think // - WWAudioClass::Get_Instance ()->On_Frame_Update (WW3D::Get_Sync_Frame_Time()); + WWAudioClass::Get_Instance ()->On_Frame_Update (WW3D::Get_Logic_Frame_Time_Milliseconds()); // // Update the count of particles and polys in the status bar From 2bbf90241e2bb30ef9deff234e495a65baf24796 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 27 Sep 2025 09:40:09 +0200 Subject: [PATCH 123/343] fix(shadow): Fix counting of W3DProjectedShadowManager::m_numDecalShadows (#1568) --- .../W3DDevice/GameClient/W3DProjectedShadow.h | 2 + .../GameClient/Shadow/W3DProjectedShadow.cpp | 86 ++++++------------- .../W3DDevice/GameClient/W3DProjectedShadow.h | 2 + .../GameClient/Shadow/W3DProjectedShadow.cpp | 86 ++++++------------- 4 files changed, 52 insertions(+), 124 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h index dc1bb3c4084..6546d186958 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h @@ -78,7 +78,9 @@ class W3DProjectedShadowManager : public ProjectedShadowManager private: Int renderProjectedTerrainShadow(W3DProjectedShadow *shadow, AABoxClass &box); ///m_type) - { - case SHADOW_DECAL: - case SHADOW_ALPHA_DECAL: - case SHADOW_ADDITIVE_DECAL: - m_numDecalShadows++; - break; - case SHADOW_PROJECTION: - m_numProjectionShadows++; - break; - default: - break; - } - + updateShadowNumbers(shadow->m_type, +1); return shadow; } @@ -1703,20 +1690,7 @@ Shadow* W3DProjectedShadowManager::addDecal(RenderObjClass *robj, Shadow::Shadow m_decalList = shadow; } - switch (shadow->m_type) - { - case SHADOW_DECAL: - case SHADOW_ALPHA_DECAL: - case SHADOW_ADDITIVE_DECAL: - m_numDecalShadows++; - break; - case SHADOW_PROJECTION: - m_numProjectionShadows++; - break; - default: - break; - } - + updateShadowNumbers(shadow->m_type, +1); return shadow; } @@ -1902,18 +1876,7 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S m_shadowList = shadow; } - switch (shadow->m_type) - { - case SHADOW_DECAL: - m_numDecalShadows++; - break; - case SHADOW_PROJECTION: - m_numProjectionShadows++; - break; - default: - break; - } - + updateShadowNumbers(shadow->m_type, +1); return shadow; } @@ -2033,17 +1996,8 @@ void W3DProjectedShadowManager::removeShadow (W3DProjectedShadow *shadow) prev_shadow->m_next=shadow->m_next; else m_decalList=shadow->m_next; - switch (shadow->m_type) - { - case SHADOW_DECAL: - m_numDecalShadows--; - break; - case SHADOW_PROJECTION: - m_numProjectionShadows--; - break; - default: - break; - } + + updateShadowNumbers(shadow->m_type, -1); delete shadow; return; } @@ -2059,17 +2013,8 @@ void W3DProjectedShadowManager::removeShadow (W3DProjectedShadow *shadow) prev_shadow->m_next=shadow->m_next; else m_shadowList=shadow->m_next; - switch (shadow->m_type) - { - case SHADOW_DECAL: - m_numDecalShadows--; - break; - case SHADOW_PROJECTION: - m_numProjectionShadows--; - break; - default: - break; - } + + updateShadowNumbers(shadow->m_type, -1); delete shadow; return; } @@ -2104,6 +2049,23 @@ void W3DProjectedShadowManager::removeAllShadows(void) } } +void W3DProjectedShadowManager::updateShadowNumbers(ShadowType shadowType, Int addNum) +{ + switch (shadowType) + { + case SHADOW_DECAL: + case SHADOW_ALPHA_DECAL: + case SHADOW_ADDITIVE_DECAL: + m_numDecalShadows += addNum; + break; + case SHADOW_PROJECTION: + m_numProjectionShadows += addNum; + break; + default: + break; + } +} + #if defined(RTS_DEBUG) void W3DProjectedShadow::getRenderCost(RenderCost & rc) const { diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h index 155f2efc451..14f93b963a1 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h @@ -78,7 +78,9 @@ class W3DProjectedShadowManager : public ProjectedShadowManager private: Int renderProjectedTerrainShadow(W3DProjectedShadow *shadow, AABoxClass &box); ///m_type) - { - case SHADOW_DECAL: - case SHADOW_ALPHA_DECAL: - case SHADOW_ADDITIVE_DECAL: - m_numDecalShadows++; - break; - case SHADOW_PROJECTION: - m_numProjectionShadows++; - break; - default: - break; - } - + updateShadowNumbers(shadow->m_type, +1); return shadow; } @@ -1703,20 +1690,7 @@ Shadow* W3DProjectedShadowManager::addDecal(RenderObjClass *robj, Shadow::Shadow m_decalList = shadow; } - switch (shadow->m_type) - { - case SHADOW_DECAL: - case SHADOW_ALPHA_DECAL: - case SHADOW_ADDITIVE_DECAL: - m_numDecalShadows++; - break; - case SHADOW_PROJECTION: - m_numProjectionShadows++; - break; - default: - break; - } - + updateShadowNumbers(shadow->m_type, +1); return shadow; } @@ -1902,18 +1876,7 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S m_shadowList = shadow; } - switch (shadow->m_type) - { - case SHADOW_DECAL: - m_numDecalShadows++; - break; - case SHADOW_PROJECTION: - m_numProjectionShadows++; - break; - default: - break; - } - + updateShadowNumbers(shadow->m_type, +1); return shadow; } @@ -2033,17 +1996,8 @@ void W3DProjectedShadowManager::removeShadow (W3DProjectedShadow *shadow) prev_shadow->m_next=shadow->m_next; else m_decalList=shadow->m_next; - switch (shadow->m_type) - { - case SHADOW_DECAL: - m_numDecalShadows--; - break; - case SHADOW_PROJECTION: - m_numProjectionShadows--; - break; - default: - break; - } + + updateShadowNumbers(shadow->m_type, -1); delete shadow; return; } @@ -2059,17 +2013,8 @@ void W3DProjectedShadowManager::removeShadow (W3DProjectedShadow *shadow) prev_shadow->m_next=shadow->m_next; else m_shadowList=shadow->m_next; - switch (shadow->m_type) - { - case SHADOW_DECAL: - m_numDecalShadows--; - break; - case SHADOW_PROJECTION: - m_numProjectionShadows--; - break; - default: - break; - } + + updateShadowNumbers(shadow->m_type, -1); delete shadow; return; } @@ -2104,6 +2049,23 @@ void W3DProjectedShadowManager::removeAllShadows(void) } } +void W3DProjectedShadowManager::updateShadowNumbers(ShadowType shadowType, Int addNum) +{ + switch (shadowType) + { + case SHADOW_DECAL: + case SHADOW_ALPHA_DECAL: + case SHADOW_ADDITIVE_DECAL: + m_numDecalShadows += addNum; + break; + case SHADOW_PROJECTION: + m_numProjectionShadows += addNum; + break; + default: + break; + } +} + #if defined(RTS_DEBUG) void W3DProjectedShadow::getRenderCost(RenderCost & rc) const { From 0193ad27d96d9fafb2d977ff0ba21067e6a39bb1 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Wed, 1 Oct 2025 03:07:55 +1000 Subject: [PATCH 124/343] bugfix(buildassistant): Fix Network game mismatch by using the correct player index to check shroud status when placing structures (#1646) --- .../Source/Common/System/BuildAssistant.cpp | 17 +++++---- .../Source/Common/System/BuildAssistant.cpp | 38 ++++++++++--------- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index 14e82de6d68..ec6c3ef6516 100644 --- a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -670,9 +670,6 @@ Bool BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos, MemoryPoolObjectHolder hold(iter); for( them = iter->first(); them; them = iter->next() ) { - if (them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud()) - return false; - // ignore any kind of class of objects that we will "remove" for building if( isRemovableForConstruction( them ) == TRUE ) continue; @@ -686,11 +683,17 @@ Bool BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos, if (them->isKindOf(KINDOF_INERT)) continue; - // an immobile object may obstruct our building depending on flags. - if( them->isKindOf( KINDOF_IMMOBILE ) ) { - if (onlyCheckEnemies && builderObject && builderObject->getRelationship( them ) != ENEMIES ) { + if (them->isKindOf(KINDOF_IMMOBILE)) { + if (onlyCheckEnemies && builderObject && builderObject->getRelationship(them) != ENEMIES) { continue; } + } + + if (builderObject && them->getShroudedStatus(builderObject->getControllingPlayer()->getPlayerIndex()) >= OBJECTSHROUD_FOGGED) + return false; + + // an immobile object may obstruct our building depending on flags. + if( them->isKindOf( KINDOF_IMMOBILE ) ) { TheTerrainVisual->addFactionBib(them, true); return false; } @@ -801,7 +804,7 @@ Bool BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos, // an immobile object will obstruct our building no matter what team it's on if ( them->isKindOf( KINDOF_IMMOBILE ) ) { - Bool shrouded = them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud(); + Bool shrouded = builderObject && them->getShroudedStatus(builderObject->getControllingPlayer()->getPlayerIndex()) >= OBJECTSHROUD_FOGGED; /* Check for overlap of my exit rectangle to his geom info. */ if (checkMyExit && ThePartitionManager->geomCollidesWithGeom(them->getPosition(), hisBounds, them->getOrientation(), &myExitPos, myGeom, angle)) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index 2b498c2ae92..2b9dc020b1a 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -670,9 +670,6 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos MemoryPoolObjectHolder hold(iter); for( them = iter->first(); them; them = iter->next() ) { - if (them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud()) - return LBC_SHROUD; - Bool feedbackWithFailure = TRUE; Relationship rel = builderObject ? builderObject->getRelationship( them ) : NEUTRAL; @@ -695,16 +692,6 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos } } - //Kris: Patch 1.01 - November 5, 2003 - //Prevent busy units (black lotus hacking from being moved by trying to place a building -- exploit). - if( rel == ALLIES ) - { - if( them->testStatus( OBJECT_STATUS_IS_USING_ABILITY ) || them->getAI() && them->getAI()->isBusy() ) - { - return LBC_OBJECTS_IN_THE_WAY; - } - } - // ignore any kind of class of objects that we will "remove" for building if( isRemovableForConstruction( them ) == TRUE ) continue; @@ -718,13 +705,28 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos if (them->isKindOf(KINDOF_INERT)) continue; - // an immobile object may obstruct our building depending on flags. - if( them->isKindOf( KINDOF_IMMOBILE ) ) + if (them->isKindOf(KINDOF_IMMOBILE)) { - if (onlyCheckEnemies && builderObject && rel != ENEMIES ) - { + if (onlyCheckEnemies && builderObject && rel != ENEMIES) continue; + } + + if (builderObject && them->getShroudedStatus(builderObject->getControllingPlayer()->getPlayerIndex()) >= OBJECTSHROUD_FOGGED) + return LBC_SHROUD; + + //Kris: Patch 1.01 - November 5, 2003 + //Prevent busy units (black lotus hacking from being moved by trying to place a building -- exploit). + if (rel == ALLIES) + { + if (them->testStatus(OBJECT_STATUS_IS_USING_ABILITY) || them->getAI() && them->getAI()->isBusy()) + { + return LBC_OBJECTS_IN_THE_WAY; } + } + + // an immobile object may obstruct our building depending on flags. + if( them->isKindOf( KINDOF_IMMOBILE ) ) + { if( feedbackWithFailure ) { TheTerrainVisual->addFactionBib( them, TRUE ); @@ -869,7 +871,7 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos // an immobile object will obstruct our building no matter what team it's on if ( them->isKindOf( KINDOF_IMMOBILE ) ) { - Bool shrouded = them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud(); + Bool shrouded = builderObject && them->getShroudedStatus(builderObject->getControllingPlayer()->getPlayerIndex()) >= OBJECTSHROUD_FOGGED; /* Check for overlap of my exit rectangle to his geom info. */ if (checkMyExit && ThePartitionManager->geomCollidesWithGeom(them->getPosition(), hisBounds, them->getOrientation(), &myExitPos, myGeom, angle)) { From 098f63801eb7895eae6f054897f54bc069de5d18 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 30 Sep 2025 19:13:07 +0200 Subject: [PATCH 125/343] bugfix(debug): Fix missing toggle for DEMO_TOGGLE_NO_DRAW (#1633) --- .../GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp | 3 ++- .../GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index e76839a56bb..fd5f717b720 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -4672,7 +4672,8 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage //----------------------------------------------------------------------------------------- case GameMessage::MSG_NO_DRAW: { - TheWritableGlobalData->m_noDraw = REAL_TO_INT(pow(2, 32) - 1); + const Bool isZero = TheGlobalData->m_noDraw == 0u; + TheWritableGlobalData->m_noDraw = isZero ? ~0u : 0u; disp = DESTROY_MESSAGE; break; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index e4c9f655da5..a6f96ca201c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -5088,7 +5088,8 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage //----------------------------------------------------------------------------------------- case GameMessage::MSG_NO_DRAW: { - TheWritableGlobalData->m_noDraw = REAL_TO_INT(pow(2, 32) - 1); + const Bool isZero = TheGlobalData->m_noDraw == 0u; + TheWritableGlobalData->m_noDraw = isZero ? ~0u : 0u; disp = DESTROY_MESSAGE; break; } From 9174d63c24e6cec789d91c4462ec21856ade7008 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Wed, 1 Oct 2025 03:15:49 +1000 Subject: [PATCH 126/343] bugfix(lan): Always allow players to join a LAN room if there is an open slot (#1637) --- .../Source/GameNetwork/LANAPIhandlers.cpp | 68 +++++++------------ .../Source/GameNetwork/LANAPIhandlers.cpp | 68 +++++++------------ 2 files changed, 48 insertions(+), 88 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp b/Generals/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp index a492c2cfd1f..fe9f70ee295 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp @@ -307,55 +307,35 @@ void LANAPI::handleRequestJoin( LANMessage *msg, UnsignedInt senderIP ) } } - // See if there's room - // First get the number of players currently in the room. - Int numPlayers = 0; - for (player = 0; player < MAX_SLOTS; ++player) + // TheSuperHackers @bugfix Stubbjax 26/09/2025 Players can now join open slots regardless of starting spots on the map. + for (player = 0; canJoin && playergetLANSlot(player)->isOccupied() - && !(m_currentGame->getLANSlot(player)->getPlayerTemplate() == PLAYERTEMPLATE_OBSERVER)) + if (m_currentGame->getLANSlot(player)->isOpen()) { - ++numPlayers; - } - } + // OK, add him in. + reply.LANMessageType = LANMessage::MSG_JOIN_ACCEPT; + wcsncpy(reply.GameJoined.gameName, m_currentGame->getName().str(), g_lanGameNameLength); + reply.GameJoined.gameName[g_lanGameNameLength] = 0; + reply.GameJoined.slotPosition = player; + reply.GameJoined.gameIP = m_localIP; + reply.GameJoined.playerIP = senderIP; + + LANGameSlot newSlot; + newSlot.setState(SLOT_PLAYER, UnicodeString(msg->name)); + newSlot.setIP(senderIP); + newSlot.setPort(NETWORK_BASE_PORT_NUMBER); + newSlot.setLastHeard(timeGetTime()); + newSlot.setSerial(msg->GameToJoin.serial); + m_currentGame->setSlot(player,newSlot); + DEBUG_LOG(("LANAPI::handleRequestJoin - added player %ls at ip 0x%08x to the game", msg->name, senderIP)); + + OnPlayerJoin(player, UnicodeString(msg->name)); + responseIP = 0; - // now get the number of starting spots on the map. - Int numStartingSpots = MAX_SLOTS; - const MapMetaData *md = TheMapCache->findMap(m_currentGame->getMap()); - if (md != NULL) - { - numStartingSpots = md->m_numPlayers; - } - - if (numPlayers < numStartingSpots) { - for (player = 0; canJoin && playergetLANSlot(player)->isOpen()) - { - // OK, add him in. - reply.LANMessageType = LANMessage::MSG_JOIN_ACCEPT; - wcsncpy(reply.GameJoined.gameName, m_currentGame->getName().str(), g_lanGameNameLength); - reply.GameJoined.gameName[g_lanGameNameLength] = 0; - reply.GameJoined.slotPosition = player; - reply.GameJoined.gameIP = m_localIP; - reply.GameJoined.playerIP = senderIP; - - LANGameSlot newSlot; - newSlot.setState(SLOT_PLAYER, UnicodeString(msg->name)); - newSlot.setIP(senderIP); - newSlot.setPort(NETWORK_BASE_PORT_NUMBER); - newSlot.setLastHeard(timeGetTime()); - newSlot.setSerial(msg->GameToJoin.serial); - m_currentGame->setSlot(player,newSlot); - DEBUG_LOG(("LANAPI::handleRequestJoin - added player %ls at ip 0x%08x to the game", msg->name, senderIP)); - - OnPlayerJoin(player, UnicodeString(msg->name)); - responseIP = 0; - - break; - } + break; } } + if (canJoin && player == MAX_SLOTS) { reply.LANMessageType = LANMessage::MSG_JOIN_DENY; diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp index 9ebca7c0c62..125895fd958 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp @@ -308,55 +308,35 @@ void LANAPI::handleRequestJoin( LANMessage *msg, UnsignedInt senderIP ) } } - // See if there's room - // First get the number of players currently in the room. - Int numPlayers = 0; - for (player = 0; player < MAX_SLOTS; ++player) + // TheSuperHackers @bugfix Stubbjax 26/09/2025 Players can now join open slots regardless of starting spots on the map. + for (player = 0; canJoin && playergetLANSlot(player)->isOccupied() - && !(m_currentGame->getLANSlot(player)->getPlayerTemplate() == PLAYERTEMPLATE_OBSERVER)) + if (m_currentGame->getLANSlot(player)->isOpen()) { - ++numPlayers; - } - } + // OK, add him in. + reply.LANMessageType = LANMessage::MSG_JOIN_ACCEPT; + wcsncpy(reply.GameJoined.gameName, m_currentGame->getName().str(), g_lanGameNameLength); + reply.GameJoined.gameName[g_lanGameNameLength] = 0; + reply.GameJoined.slotPosition = player; + reply.GameJoined.gameIP = m_localIP; + reply.GameJoined.playerIP = senderIP; + + LANGameSlot newSlot; + newSlot.setState(SLOT_PLAYER, UnicodeString(msg->name)); + newSlot.setIP(senderIP); + newSlot.setPort(NETWORK_BASE_PORT_NUMBER); + newSlot.setLastHeard(timeGetTime()); + newSlot.setSerial(msg->GameToJoin.serial); + m_currentGame->setSlot(player,newSlot); + DEBUG_LOG(("LANAPI::handleRequestJoin - added player %ls at ip 0x%08x to the game", msg->name, senderIP)); + + OnPlayerJoin(player, UnicodeString(msg->name)); + responseIP = 0; - // now get the number of starting spots on the map. - Int numStartingSpots = MAX_SLOTS; - const MapMetaData *md = TheMapCache->findMap(m_currentGame->getMap()); - if (md != NULL) - { - numStartingSpots = md->m_numPlayers; - } - - if (numPlayers < numStartingSpots) { - for (player = 0; canJoin && playergetLANSlot(player)->isOpen()) - { - // OK, add him in. - reply.LANMessageType = LANMessage::MSG_JOIN_ACCEPT; - wcsncpy(reply.GameJoined.gameName, m_currentGame->getName().str(), g_lanGameNameLength); - reply.GameJoined.gameName[g_lanGameNameLength] = 0; - reply.GameJoined.slotPosition = player; - reply.GameJoined.gameIP = m_localIP; - reply.GameJoined.playerIP = senderIP; - - LANGameSlot newSlot; - newSlot.setState(SLOT_PLAYER, UnicodeString(msg->name)); - newSlot.setIP(senderIP); - newSlot.setPort(NETWORK_BASE_PORT_NUMBER); - newSlot.setLastHeard(timeGetTime()); - newSlot.setSerial(msg->GameToJoin.serial); - m_currentGame->setSlot(player,newSlot); - DEBUG_LOG(("LANAPI::handleRequestJoin - added player %ls at ip 0x%08x to the game", msg->name, senderIP)); - - OnPlayerJoin(player, UnicodeString(msg->name)); - responseIP = 0; - - break; - } + break; } } + if (canJoin && player == MAX_SLOTS) { reply.LANMessageType = LANMessage::MSG_JOIN_DENY; From e13efd4852406ff086f737d16dcf2388d1df1435 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 30 Sep 2025 19:24:25 +0200 Subject: [PATCH 127/343] bugfix(network): Fix Network stalling state (#1650) --- .../Code/GameEngine/Source/GameNetwork/Network.cpp | 13 ++++++++++--- .../Code/GameEngine/Source/GameNetwork/Network.cpp | 13 ++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameNetwork/Network.cpp b/Generals/Code/GameEngine/Source/GameNetwork/Network.cpp index a2f47681963..ced611d7a80 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/Network.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/Network.cpp @@ -207,6 +207,7 @@ class Network : public NetworkInterface __int64 m_nextFrameTime; ///< When did we execute the last frame? For slugging the GameLogic... Bool m_frameDataReady; ///< Is the frame data for the next frame ready to be executed by TheGameLogic? + Bool m_isStalling; // CRC info Bool m_checkCRCsThisFrame; @@ -269,6 +270,7 @@ Network::Network() m_checkCRCsThisFrame = FALSE; m_didSelfSlug = FALSE; m_frameDataReady = FALSE; + m_isStalling = FALSE; m_sawCRCMismatch = FALSE; // @@ -334,6 +336,7 @@ void Network::init() m_lastExecutionFrame = m_runAhead - 1; // subtract 1 since we're starting on frame 0 m_lastFrameCompleted = m_runAhead - 1; // subtract 1 since we're starting on frame 0 m_frameDataReady = FALSE; + m_isStalling = FALSE; m_didSelfSlug = FALSE; m_localStatus = NETLOCALSTATUS_PREGAME; @@ -692,6 +695,7 @@ void Network::update( void ) // 4. If all commands are there, put that frame's commands on TheCommandList. // m_frameDataReady = FALSE; + m_isStalling = FALSE; #if defined(RTS_DEBUG) if (m_networkOn == FALSE) { @@ -723,6 +727,11 @@ void Network::update( void ) m_frameDataReady = TRUE; // Tell the GameEngine to run the commands for the new frame. } } + else { + __int64 curTime; + QueryPerformanceCounter((LARGE_INTEGER *)&curTime); + m_isStalling = curTime >= m_nextFrameTime; + } } void Network::liteupdate() { @@ -812,9 +821,7 @@ Bool Network::isFrameDataReady() { Bool Network::isStalling() { - __int64 curTime; - QueryPerformanceCounter((LARGE_INTEGER *)&curTime); - return curTime >= m_nextFrameTime; + return m_isStalling; } /** diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/Network.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/Network.cpp index 138c7aa2285..47af9940eea 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/Network.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/Network.cpp @@ -207,6 +207,7 @@ class Network : public NetworkInterface __int64 m_nextFrameTime; ///< When did we execute the last frame? For slugging the GameLogic... Bool m_frameDataReady; ///< Is the frame data for the next frame ready to be executed by TheGameLogic? + Bool m_isStalling; // CRC info Bool m_checkCRCsThisFrame; @@ -269,6 +270,7 @@ Network::Network() m_checkCRCsThisFrame = FALSE; m_didSelfSlug = FALSE; m_frameDataReady = FALSE; + m_isStalling = FALSE; m_sawCRCMismatch = FALSE; // @@ -334,6 +336,7 @@ void Network::init() m_lastExecutionFrame = m_runAhead - 1; // subtract 1 since we're starting on frame 0 m_lastFrameCompleted = m_runAhead - 1; // subtract 1 since we're starting on frame 0 m_frameDataReady = FALSE; + m_isStalling = FALSE; m_didSelfSlug = FALSE; m_localStatus = NETLOCALSTATUS_PREGAME; @@ -692,6 +695,7 @@ void Network::update( void ) // 4. If all commands are there, put that frame's commands on TheCommandList. // m_frameDataReady = FALSE; + m_isStalling = FALSE; #if defined(RTS_DEBUG) if (m_networkOn == FALSE) { @@ -723,6 +727,11 @@ void Network::update( void ) m_frameDataReady = TRUE; // Tell the GameEngine to run the commands for the new frame. } } + else { + __int64 curTime; + QueryPerformanceCounter((LARGE_INTEGER *)&curTime); + m_isStalling = curTime >= m_nextFrameTime; + } } void Network::liteupdate() { @@ -812,9 +821,7 @@ Bool Network::isFrameDataReady() { Bool Network::isStalling() { - __int64 curTime; - QueryPerformanceCounter((LARGE_INTEGER *)&curTime); - return curTime >= m_nextFrameTime; + return m_isStalling; } /** From c830b3bed067da275cb2bbd95ae3d7143728b23d Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 30 Sep 2025 19:52:22 +0200 Subject: [PATCH 128/343] refactor: Remove obsolete pragma optimize directives (#1649) --- Core/Libraries/Source/WWVegas/WW3D2/aabtree.cpp | 8 -------- .../Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp | 2 -- Generals/Code/Tools/WorldBuilder/src/DrawObject.cpp | 8 +------- .../Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp | 2 -- .../Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp | 3 --- .../Code/Libraries/Source/WWVegas/WW3D2/texture.cpp | 3 --- .../Code/Libraries/Source/WWVegas/WW3D2/textureloader.cpp | 3 --- GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp | 8 +------- 8 files changed, 2 insertions(+), 35 deletions(-) diff --git a/Core/Libraries/Source/WWVegas/WW3D2/aabtree.cpp b/Core/Libraries/Source/WWVegas/WW3D2/aabtree.cpp index ce077c29528..0dc4fb8cc29 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/aabtree.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/aabtree.cpp @@ -724,10 +724,6 @@ bool AABTreeClass::Intersect_OBBox_Recursive(AABTreeClass::CullNodeStruct * node return res; } -#ifdef RTS_DEBUG -#pragma optimize("", off) // We get an odd error when using optimized in the debug. -// All optimized seems to work. jba. -#endif /*********************************************************************************************** * AABTreeClass::Cast_Ray_To_Polys -- cast the ray to polys in the given node * * * @@ -787,10 +783,6 @@ bool AABTreeClass::Cast_Ray_To_Polys(CullNodeStruct * node,RayCollisionTestClass } return false; } -#ifdef RTS_DEBUG -#pragma optimize("", on) -#endif - /*********************************************************************************************** * AABTreeClass::Cast_Semi_Infinite_Axis_Aligned_Ray_To_Polys -- cast ray to polys in the node * diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp index 0964c1ab4cf..406ee01ac22 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp @@ -59,8 +59,6 @@ #include "assetmgr.h" #include "WW3D2/dx8wrapper.h" -//#pragma optimize("", off) - //#define ALLOW_WATER_TRACK_EDIT //number of vertex pages allocated - allows double buffering of vertex updates. diff --git a/Generals/Code/Tools/WorldBuilder/src/DrawObject.cpp b/Generals/Code/Tools/WorldBuilder/src/DrawObject.cpp index 7245e7e6842..8c60712f75d 100644 --- a/Generals/Code/Tools/WorldBuilder/src/DrawObject.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/DrawObject.cpp @@ -1622,12 +1622,6 @@ void DrawObject::setRampFeedbackParms(const Coord3D *start, const Coord3D *end, } -// This routine fails to draw poly triggers in some cases when optimized. -// So just shut it off for now. The failure case was new doc, add a poly trigger. -// Adding any other object fixed the problem. jba - -#pragma optimize("", off) - /** Render draws into the current 3d context. */ void DrawObject::Render(RenderInfoClass & rinfo) { @@ -1933,7 +1927,7 @@ void DrawObject::Render(RenderInfoClass & rinfo) } } -#pragma optimize("", on) + void BuildRectFromSegmentAndWidth(const Coord3D* start, const Coord3D* end, Real width, Coord3D* outBL, Coord3D* outTL, Coord3D* outBR, Coord3D* outTR) diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp index 8911bd9e8c5..da700a2d948 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp @@ -62,8 +62,6 @@ #include "assetmgr.h" #include "WW3D2/dx8wrapper.h" -//#pragma optimize("", off) - //#define ALLOW_WATER_TRACK_EDIT //number of vertex pages allocated - allows double buffering of vertex updates. diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp index 51a8cb7face..b85a955a1b6 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp @@ -58,9 +58,6 @@ #include "wwmemlog.h" #include "assetmgr.h" -//#pragma optimize("", off) -//#pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes") - RectClass Render2DClass::ScreenResolution( 0,0,0,0 ); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texture.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texture.cpp index a3dd2c564a1..df53dadbaff 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texture.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texture.cpp @@ -59,9 +59,6 @@ #include "texturethumbnail.h" #include "wwprofile.h" -//#pragma optimize("", off) -//#pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes") - const unsigned DEFAULT_INACTIVATION_TIME=20000; /* diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/textureloader.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/textureloader.cpp index cc45c9b7952..7d1795a9eb4 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/textureloader.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/textureloader.cpp @@ -62,9 +62,6 @@ #include "bitmaphandler.h" #include "wwprofile.h" -//#pragma optimize("", off) -//#pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes") - bool TextureLoader::TextureLoadSuspended; int TextureLoader::TextureInactiveOverrideTime = 0; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp index eca1d02a263..c37deea52a8 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp @@ -2056,12 +2056,6 @@ void DrawObject::setRampFeedbackParms(const Coord3D *start, const Coord3D *end, } -// This routine fails to draw poly triggers in some cases when optimized. -// So just shut it off for now. The failure case was new doc, add a poly trigger. -// Adding any other object fixed the problem. jba - -#pragma optimize("", off) - bool _skip_drawobject_render = false; /** Render draws into the current 3d context. */ @@ -2457,7 +2451,7 @@ if (pMapObj->isSelected()) { m_lineRenderer->Reset(); } } -#pragma optimize("", on) + void BuildRectFromSegmentAndWidth(const Coord3D* start, const Coord3D* end, Real width, Coord3D* outBL, Coord3D* outTL, Coord3D* outBR, Coord3D* outTR) From 358f6606bfaa355ff947bb9c66465cd10d16a211 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 30 Sep 2025 19:52:55 +0200 Subject: [PATCH 129/343] refactor(terrain): Simplify cloud movement clamping (#1648) --- .../Source/W3DDevice/GameClient/W3DShaderManager.cpp | 7 +++---- .../Source/W3DDevice/GameClient/W3DShaderManager.cpp | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp index a219e4912d4..8c096a88b1d 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp @@ -1336,10 +1336,9 @@ void TerrainShader2Stage::updateCloud() m_xOffset += m_xSlidePerSecond * frame_time; m_yOffset += m_ySlidePerSecond * frame_time; - while (m_xOffset > 1) m_xOffset -= 1; - while (m_yOffset > 1) m_yOffset -= 1; - while (m_xOffset < -1) m_xOffset += 1; - while (m_yOffset < -1) m_yOffset += 1; + // This moves offsets towards zero when smaller -1.0 or larger 1.0 + m_xOffset -= (Int)m_xOffset; + m_yOffset -= (Int)m_yOffset; } void TerrainShader2Stage::updateNoise1(D3DXMATRIX *destMatrix,D3DXMATRIX *curViewInverse, Bool doUpdate) diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp index a3df4598132..08fcd60a6f7 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp @@ -1601,10 +1601,9 @@ void TerrainShader2Stage::updateCloud() m_xOffset += m_xSlidePerSecond * frame_time; m_yOffset += m_ySlidePerSecond * frame_time; - while (m_xOffset > 1) m_xOffset -= 1; - while (m_yOffset > 1) m_yOffset -= 1; - while (m_xOffset < -1) m_xOffset += 1; - while (m_yOffset < -1) m_yOffset += 1; + // This moves offsets towards zero when smaller -1.0 or larger 1.0 + m_xOffset -= (Int)m_xOffset; + m_yOffset -= (Int)m_yOffset; } void TerrainShader2Stage::updateNoise1(D3DXMATRIX *destMatrix,D3DXMATRIX *curViewInverse, Bool doUpdate) From 538407f776a926ed2b3c9e792bb564f570121637 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 30 Sep 2025 20:20:30 +0200 Subject: [PATCH 130/343] bugfix(camera): Decouple camera zoom update from logic time (#1655) --- .../Source/W3DDevice/GameClient/W3DView.cpp | 6 ++++-- .../Source/W3DDevice/GameClient/W3DView.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 5e80699000c..31e10ef8f54 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -1206,7 +1206,8 @@ void W3DView::update(void) // if scrolling, only adjust if we're too close or too far if (m_scrollAmount.length() < m_scrollAmountCutoff || (m_currentHeightAboveGround < m_minHeightAboveGround) || (TheGlobalData->m_enforceMaxCameraHeight && m_currentHeightAboveGround > m_maxHeightAboveGround)) { - Real zoomAdj = (desiredZoom - m_zoom) * TheGlobalData->m_cameraAdjustSpeed * TheGameEngine->getActualLogicTimeScaleOverFpsRatio(); + const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); + const Real zoomAdj = (desiredZoom - m_zoom) * TheGlobalData->m_cameraAdjustSpeed * fpsRatio; if (fabs(zoomAdj) >= 0.0001f) // only do positive { m_zoom += zoomAdj; @@ -1217,7 +1218,8 @@ void W3DView::update(void) else if (!didScriptedMovement) { // we're not scrolling; settle toward desired height above ground - Real zoomAdj = (m_zoom - desiredZoom) * TheGlobalData->m_cameraAdjustSpeed * TheGameEngine->getActualLogicTimeScaleOverFpsRatio(); + const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); + const Real zoomAdj = (m_zoom - desiredZoom) * TheGlobalData->m_cameraAdjustSpeed * fpsRatio; if (fabs(zoomAdj) >= 0.0001f) { m_zoom -= zoomAdj; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index c4e22165672..a8b8d3474ed 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -1355,7 +1355,8 @@ void W3DView::update(void) // if scrolling, only adjust if we're too close or too far if (m_scrollAmount.length() < m_scrollAmountCutoff || (m_currentHeightAboveGround < m_minHeightAboveGround) || (TheGlobalData->m_enforceMaxCameraHeight && m_currentHeightAboveGround > m_maxHeightAboveGround)) { - Real zoomAdj = (desiredZoom - m_zoom) * TheGlobalData->m_cameraAdjustSpeed * TheGameEngine->getActualLogicTimeScaleOverFpsRatio(); + const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); + const Real zoomAdj = (desiredZoom - m_zoom) * TheGlobalData->m_cameraAdjustSpeed * fpsRatio; if (fabs(zoomAdj) >= 0.0001f) // only do positive { m_zoom += zoomAdj; @@ -1366,7 +1367,8 @@ void W3DView::update(void) else if (!didScriptedMovement) { // we're not scrolling; settle toward desired height above ground - Real zoomAdj = (m_zoom - desiredZoom) * TheGlobalData->m_cameraAdjustSpeed * TheGameEngine->getActualLogicTimeScaleOverFpsRatio(); + const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); + const Real zoomAdj = (m_zoom - desiredZoom) * TheGlobalData->m_cameraAdjustSpeed * fpsRatio; if (fabs(zoomAdj) >= 0.0001f) { m_zoom -= zoomAdj; From 93e7ea87459ad66b75125113063bb60063e50509 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 30 Sep 2025 20:21:08 +0200 Subject: [PATCH 131/343] tweak(water): Decouple water movement time step from render update (#1653) --- .../Include/W3DDevice/GameClient/W3DWater.h | 2 +- .../W3DDevice/GameClient/Water/W3DWater.cpp | 45 ++++++++----------- .../Include/W3DDevice/GameClient/W3DWater.h | 2 +- .../W3DDevice/GameClient/Water/W3DWater.cpp | 45 ++++++++----------- 4 files changed, 40 insertions(+), 54 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWater.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWater.h index 3331b95cdde..6e9991fd665 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWater.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWater.h @@ -168,7 +168,7 @@ class WaterRenderObjClass : public Snapshot, Int m_numIndices; ///getActualLogicTimeScaleOverFpsRatio(); - if( TheGameLogic ) - currLogicFrame = TheGameLogic->getFrame(); - - // we only process things if the logic frame has changed - if( lastLogicFrame != currLogicFrame ) { + constexpr const Real MagicOffset = 0.0125f * 33 / 5000; ///< the work of top Munkees; do not question it - m_riverVOrigin += 0.002f; - m_riverXOffset += (Real)(0.0125*33/5000); - m_riverYOffset += (Real)(2*0.0125*33/5000); - if (m_riverXOffset > 1) m_riverXOffset -= 1; - if (m_riverYOffset > 1) m_riverYOffset -= 1; - if (m_riverXOffset < -1) m_riverXOffset += 1; - if (m_riverYOffset < -1) m_riverYOffset += 1; - m_iBumpFrame++; - if (m_iBumpFrame >= NUM_BUMP_FRAMES) { - m_iBumpFrame = 0; - } + m_riverVOrigin += 0.002f * timeScale; + m_riverXOffset += (Real)(MagicOffset * timeScale); + m_riverYOffset += (Real)(2 * MagicOffset * timeScale); + + // This moves offsets towards zero when smaller -1.0 or larger 1.0 + m_riverXOffset -= (Int)m_riverXOffset; + m_riverYOffset -= (Int)m_riverYOffset; + + m_fBumpFrame += timeScale; + if (m_fBumpFrame >= NUM_BUMP_FRAMES) + m_fBumpFrame = 0.0f; // for vertex animated water we need to update the vector field if( m_doWaterGrid && m_meshInMotion == TRUE ) { const Real PREFERRED_HEIGHT_FUDGE = 1.0f; ///< this is close enough to at rest - const Real AT_REST_VELOCITY_FUDGE = 1.0f; ///< when we're close enought to at rest height and velocity we will stop + const Real AT_REST_VELOCITY_FUDGE = 1.0f; ///< when we're close enough to at rest height and velocity we will stop const Real WATER_DAMPENING = 0.93f; ///< use with up force of 15.0 Int i, j; Int mx = m_gridCellsX+1; @@ -1280,9 +1276,6 @@ void WaterRenderObjClass::update( void ) } - // mark the last logic frame we processed on - lastLogicFrame = currLogicFrame; - } } @@ -1823,7 +1816,7 @@ void WaterRenderObjClass::drawSea(RenderInfoClass & rinfo) m_pDev->SetTextureStageState(1, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP); m_pDev->SetTextureStageState(1, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP); - m_pDev->SetTexture( 0, m_pBumpTexture[m_iBumpFrame]); + m_pDev->SetTexture( 0, m_pBumpTexture[(Int)m_fBumpFrame]); #ifdef MIPMAP_BUMP_TEXTURE m_pDev->SetTextureStageState( 0, D3DTSS_MIPFILTER, D3DTEXF_POINT ); m_pDev->SetTextureStageState( 0, D3DTSS_MINFILTER, D3DTEXF_LINEAR ); diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWater.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWater.h index 1385651dada..eeedcac8ac7 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWater.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWater.h @@ -168,7 +168,7 @@ class WaterRenderObjClass : public Snapshot, Int m_numIndices; ///getActualLogicTimeScaleOverFpsRatio(); - if( TheGameLogic ) - currLogicFrame = TheGameLogic->getFrame(); - - // we only process things if the logic frame has changed - if( lastLogicFrame != currLogicFrame ) { + constexpr const Real MagicOffset = 0.0125f * 33 / 5000; ///< the work of top Munkees; do not question it - m_riverVOrigin += 0.002f; - m_riverXOffset += (Real)(0.0125*33/5000); - m_riverYOffset += (Real)(2*0.0125*33/5000); - if (m_riverXOffset > 1) m_riverXOffset -= 1; - if (m_riverYOffset > 1) m_riverYOffset -= 1; - if (m_riverXOffset < -1) m_riverXOffset += 1; - if (m_riverYOffset < -1) m_riverYOffset += 1; - m_iBumpFrame++; - if (m_iBumpFrame >= NUM_BUMP_FRAMES) { - m_iBumpFrame = 0; - } + m_riverVOrigin += 0.002f * timeScale; + m_riverXOffset += (Real)(MagicOffset * timeScale); + m_riverYOffset += (Real)(2 * MagicOffset * timeScale); + + // This moves offsets towards zero when smaller -1.0 or larger 1.0 + m_riverXOffset -= (Int)m_riverXOffset; + m_riverYOffset -= (Int)m_riverYOffset; + + m_fBumpFrame += timeScale; + if (m_fBumpFrame >= NUM_BUMP_FRAMES) + m_fBumpFrame = 0.0f; // for vertex animated water we need to update the vector field if( m_doWaterGrid && m_meshInMotion == TRUE ) { const Real PREFERRED_HEIGHT_FUDGE = 1.0f; ///< this is close enough to at rest - const Real AT_REST_VELOCITY_FUDGE = 1.0f; ///< when we're close enought to at rest height and velocity we will stop + const Real AT_REST_VELOCITY_FUDGE = 1.0f; ///< when we're close enough to at rest height and velocity we will stop const Real WATER_DAMPENING = 0.93f; ///< use with up force of 15.0 Int i, j; Int mx = m_gridCellsX+1; @@ -1303,9 +1299,6 @@ void WaterRenderObjClass::update( void ) } - // mark the last logic frame we processed on - lastLogicFrame = currLogicFrame; - } } @@ -1846,7 +1839,7 @@ void WaterRenderObjClass::drawSea(RenderInfoClass & rinfo) m_pDev->SetTextureStageState(1, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP); m_pDev->SetTextureStageState(1, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP); - m_pDev->SetTexture( 0, m_pBumpTexture[m_iBumpFrame]); + m_pDev->SetTexture( 0, m_pBumpTexture[(Int)m_fBumpFrame]); #ifdef MIPMAP_BUMP_TEXTURE m_pDev->SetTextureStageState( 0, D3DTSS_MIPFILTER, D3DTEXF_POINT ); m_pDev->SetTextureStageState( 0, D3DTSS_MINFILTER, D3DTEXF_LINEAR ); From 3ae6b3ad39ee7a8d6121deadcffecd91d13fbdbf Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 30 Sep 2025 20:45:37 +0200 Subject: [PATCH 132/343] tweak(water): Decouple wave movement time step from render update (#1654) --- .../GameClient/Water/W3DWaterTracks.cpp | 18 ++++-------------- .../GameClient/Water/W3DWaterTracks.cpp | 18 ++++-------------- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp index 406ee01ac22..61f71d2de77 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp @@ -47,6 +47,7 @@ #include "W3DDevice/GameClient/W3DWaterTracks.h" #include "GameClient/InGameUI.h" #include "GameLogic/TerrainLogic.h" +#include "Common/GameEngine.h" #include "Common/GlobalData.h" #include "Common/UnicodeString.h" #include "Common/file.h" @@ -59,8 +60,6 @@ #include "assetmgr.h" #include "WW3D2/dx8wrapper.h" -//#define ALLOW_WATER_TRACK_EDIT - //number of vertex pages allocated - allows double buffering of vertex updates. //while one is being rendered, another is being updated. Improves HW parallelism. #define WATER_VB_PAGES 1000 @@ -278,18 +277,6 @@ void WaterTracksObj::init( Real width, const Vector2 &start, const Vector2 &end, //============================================================================= Int WaterTracksObj::update(Int msElapsed) { -#ifdef ALLOW_WATER_TRACK_EDIT -// if (pauseWaves) -// m_elapsedMs = m_timeToReachBeach+m_timeToStop; -// else -#endif - - //nothing to do here...most of the work is done on render. - m_elapsedMs += msElapsed; //advance time for this update - - ///@todo: Should check in here if we are done with this object are return FALSE to free it. - // return FALSE; - return TRUE; //assume we had an update } @@ -305,6 +292,9 @@ Int WaterTracksObj::update(Int msElapsed) Int WaterTracksObj::render(DX8VertexBufferClass *vertexBuffer, Int batchStart) { + // TheSuperHackers @tweak The wave movement time step is now decoupled from the render update. + m_elapsedMs += TheGameEngine->getLogicTimeStepMilliseconds(); + VertexFormatXYZDUV1 *vb; Vector2 waveTailOrigin,waveFrontOrigin; Real ooWaveDirLen=1.0f/m_waveDir.Length(); //one over length diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp index da700a2d948..8169dbb7f75 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp @@ -50,6 +50,7 @@ #include "GameClient/InGameUI.h" #include "GameClient/Water.h" #include "GameLogic/TerrainLogic.h" +#include "Common/GameEngine.h" #include "Common/GlobalData.h" #include "Common/UnicodeString.h" #include "Common/file.h" @@ -62,8 +63,6 @@ #include "assetmgr.h" #include "WW3D2/dx8wrapper.h" -//#define ALLOW_WATER_TRACK_EDIT - //number of vertex pages allocated - allows double buffering of vertex updates. //while one is being rendered, another is being updated. Improves HW parallelism. #define WATER_VB_PAGES 1000 @@ -281,18 +280,6 @@ void WaterTracksObj::init( Real width, const Vector2 &start, const Vector2 &end, //============================================================================= Int WaterTracksObj::update(Int msElapsed) { -#ifdef ALLOW_WATER_TRACK_EDIT -// if (pauseWaves) -// m_elapsedMs = m_timeToReachBeach+m_timeToStop; -// else -#endif - - //nothing to do here...most of the work is done on render. - m_elapsedMs += msElapsed; //advance time for this update - - ///@todo: Should check in here if we are done with this object are return FALSE to free it. - // return FALSE; - return TRUE; //assume we had an update } @@ -308,6 +295,9 @@ Int WaterTracksObj::update(Int msElapsed) Int WaterTracksObj::render(DX8VertexBufferClass *vertexBuffer, Int batchStart) { + // TheSuperHackers @tweak The wave movement time step is now decoupled from the render update. + m_elapsedMs += TheGameEngine->getLogicTimeStepMilliseconds(); + VertexFormatXYZDUV1 *vb; Vector2 waveTailOrigin,waveFrontOrigin; Real ooWaveDirLen=1.0f/m_waveDir.Length(); //one over length From ca90e3de8e2ed35e1b11c66353359c1347b9dc12 Mon Sep 17 00:00:00 2001 From: Lemon <100478094+L3-M@users.noreply.github.com> Date: Tue, 30 Sep 2025 21:47:48 +0300 Subject: [PATCH 133/343] feat(ui): Implement simple Latency and FPS display (#1546) --- .../GameEngine/Include/Common/GlobalData.h | 3 + .../Include/Common/UserPreferences.h | 2 + .../GameEngine/Include/GameClient/InGameUI.h | 32 ++- .../GameEngine/Source/Common/GlobalData.cpp | 4 + .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 50 ++++ .../GameEngine/Source/GameClient/InGameUI.cpp | 230 +++++++++++++++++- .../GameEngine/Include/Common/GlobalData.h | 3 + .../Include/Common/UserPreferences.h | 2 + .../GameEngine/Include/GameClient/InGameUI.h | 32 ++- .../GameEngine/Source/Common/GlobalData.cpp | 4 + .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 50 ++++ .../GameEngine/Source/GameClient/InGameUI.cpp | 230 +++++++++++++++++- 12 files changed, 618 insertions(+), 24 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/GlobalData.h b/Generals/Code/GameEngine/Include/Common/GlobalData.h index 5e2bf47be9f..c56d1b48166 100644 --- a/Generals/Code/GameEngine/Include/Common/GlobalData.h +++ b/Generals/Code/GameEngine/Include/Common/GlobalData.h @@ -399,6 +399,9 @@ class GlobalData : public SubsystemInterface Bool m_saveCameraInReplay; Bool m_useCameraInReplay; + // TheSuperHackers @feature L3-M 05/09/2025 allow the network latency counter and render fps counter font size to be set, a size of zero disables them + Int m_networkLatencyFontSize; + Int m_renderFpsFontSize; // TheSuperHackers @feature Mauller 21/06/2025 allow the system time and game time font size to be set, a size of zero disables them Int m_systemTimeFontSize; Int m_gameTimeFontSize; diff --git a/Generals/Code/GameEngine/Include/Common/UserPreferences.h b/Generals/Code/GameEngine/Include/Common/UserPreferences.h index 88f5874651b..79d22b3feef 100644 --- a/Generals/Code/GameEngine/Include/Common/UserPreferences.h +++ b/Generals/Code/GameEngine/Include/Common/UserPreferences.h @@ -139,6 +139,8 @@ class OptionPreferences : public UserPreferences Int getCampaignDifficulty(void); void setCampaignDifficulty( Int diff ); + Int getNetworkLatencyFontSize(void); + Int getRenderFpsFontSize(void); Int getSystemTimeFontSize(void); Int getGameTimeFontSize(void); diff --git a/Generals/Code/GameEngine/Include/GameClient/InGameUI.h b/Generals/Code/GameEngine/Include/GameClient/InGameUI.h index 8e712e59619..f5d0a3c7f6f 100644 --- a/Generals/Code/GameEngine/Include/GameClient/InGameUI.h +++ b/Generals/Code/GameEngine/Include/GameClient/InGameUI.h @@ -554,6 +554,8 @@ friend class Drawable; // for selection/deselection transactions virtual void recreateControlBar( void ); virtual void refreshCustomUiResources( void ); + virtual void refreshNetworkLatencyResources(void); + virtual void refreshRenderFpsResources(void); virtual void refreshSystemTimeResources( void ); virtual void refreshGameTimeResources( void ); @@ -575,7 +577,10 @@ friend class Drawable; // for selection/deselection transactions virtual void updateIdleWorker( void ); virtual void resetIdleWorker( void ); - void drawSystemTime(); + void updateRenderFpsString(); + void drawNetworkLatency(Int &x, Int &y); + void drawRenderFps(Int &x, Int &y); + void drawSystemTime(Int &x, Int &y); void drawGameTime(); public: @@ -731,6 +736,31 @@ friend class Drawable; // for selection/deselection transactions VideoBuffer* m_cameoVideoBuffer;///< video playback buffer VideoStreamInterface* m_cameoVideoStream;///< Video stream; + // Network Latency Counter + DisplayString * m_networkLatencyString; + AsciiString m_networkLatencyFont; + Int m_networkLatencyPointSize; + Bool m_networkLatencyBold; + Coord2D m_networkLatencyPosition; + Color m_networkLatencyColor; + Color m_networkLatencyDropColor; + UnsignedInt m_lastNetworkLatencyFrames; + + // Render FPS Counter + DisplayString * m_renderFpsString; + DisplayString * m_renderFpsLimitString; + AsciiString m_renderFpsFont; + Int m_renderFpsPointSize; + Bool m_renderFpsBold; + Coord2D m_renderFpsPosition; + Color m_renderFpsColor; + Color m_renderFpsLimitColor; + Color m_renderFpsDropColor; + UnsignedInt m_renderFpsRefreshMs; + UnsignedInt m_lastRenderFps; + UnsignedInt m_lastRenderFpsLimit; + UnsignedInt m_lastRenderFpsUpdateMs; + // System Time DisplayString * m_systemTimeString; AsciiString m_systemTimeFont; diff --git a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp index a44456ef558..28f5250f919 100644 --- a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp @@ -933,6 +933,8 @@ GlobalData::GlobalData() m_saveCameraInReplay = FALSE; m_useCameraInReplay = FALSE; + m_networkLatencyFontSize = 8; + m_renderFpsFontSize = 8; m_systemTimeFontSize = 8; m_gameTimeFontSize = 8; @@ -1184,6 +1186,8 @@ void GlobalData::parseGameDataDefinition( INI* ini ) TheWritableGlobalData->m_saveCameraInReplay = optionPref.saveCameraInReplays(); TheWritableGlobalData->m_useCameraInReplay = optionPref.useCameraInReplays(); + TheWritableGlobalData->m_networkLatencyFontSize = optionPref.getNetworkLatencyFontSize(); + TheWritableGlobalData->m_renderFpsFontSize = optionPref.getRenderFpsFontSize(); TheWritableGlobalData->m_systemTimeFontSize = optionPref.getSystemTimeFontSize(); TheWritableGlobalData->m_gameTimeFontSize = optionPref.getGameTimeFontSize(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index e4383dae01f..839748ac39c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -854,6 +854,34 @@ Real OptionPreferences::getMoneyTransactionVolume(void) const return volume; } +Int OptionPreferences::getNetworkLatencyFontSize(void) +{ + OptionPreferences::const_iterator it = find("NetworkLatencyFontSize"); + if (it == end()) + return 8; + + Int fontSize = atoi(it->second.str()); + if (fontSize < 0) + { + fontSize = 0; + } + return fontSize; +} + +Int OptionPreferences::getRenderFpsFontSize(void) +{ + OptionPreferences::const_iterator it = find("RenderFpsFontSize"); + if (it == end()) + return 8; + + Int fontSize = atoi(it->second.str()); + if (fontSize < 0) + { + fontSize = 0; + } + return fontSize; +} + Int OptionPreferences::getSystemTimeFontSize(void) { OptionPreferences::const_iterator it = find("SystemTimeFontSize"); @@ -1413,6 +1441,28 @@ static void saveOptions( void ) } } + //------------------------------------------------------------------------------------------------- + // Set Network Latency Font Size + val = pref->getNetworkLatencyFontSize(); + if (val >= 0) + { + AsciiString prefString; + prefString.format("%d", val); + (*pref)["NetworkLatencyFontSize"] = prefString; + TheInGameUI->refreshNetworkLatencyResources(); + } + + //------------------------------------------------------------------------------------------------- + // Set Render FPS Font Size + val = pref->getRenderFpsFontSize(); + if (val >= 0) + { + AsciiString prefString; + prefString.format("%d", val); + (*pref)["RenderFpsFontSize"] = prefString; + TheInGameUI->refreshRenderFpsResources(); + } + //------------------------------------------------------------------------------------------------- // Set System Time Font Size val = pref->getSystemTimeFontSize(); // TheSuperHackers @todo replace with options input when applicable diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index 881f74b053f..ed5de557064 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -46,6 +46,7 @@ #include "Common/BuildAssistant.h" #include "Common/Recorder.h" #include "Common/SpecialPower.h" +#include "Common/FrameRateLimit.h" #include "GameClient/Anim2D.h" #include "GameClient/ControlBar.h" @@ -71,6 +72,7 @@ #include "GameClient/SelectionXlat.h" #include "GameClient/Shadow.h" #include "GameClient/GlobalLanguage.h" +#include "GameClient/Display.h" #include "GameLogic/AIGuard.h" #include "GameLogic/Weapon.h" @@ -84,6 +86,8 @@ #include "GameLogic/Module/SupplyWarehouseDockUpdate.h" #include "GameLogic/Module/MobMemberSlavedUpdate.h"//ML +#include "GameNetwork/NetworkInterface.h" + // ------------------------------------------------------------------------------------------------ @@ -840,6 +844,20 @@ const FieldParse InGameUI::s_fieldParseTable[] = { "SpyDroneRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SPYDRONE] ) }, // TheSuperHackers @info ui enhancement configuration + { "NetworkLatencyFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_networkLatencyFont ) }, + { "NetworkLatencyBold", INI::parseBool, NULL, offsetof( InGameUI, m_networkLatencyBold ) }, + { "NetworkLatencyPosition", INI::parseCoord2D, NULL, offsetof( InGameUI, m_networkLatencyPosition ) }, + { "NetworkLatencyColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_networkLatencyColor ) }, + { "NetworkLatencyDropColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_networkLatencyDropColor ) }, + + { "RenderFpsFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_renderFpsFont ) }, + { "RenderFpsBold", INI::parseBool, NULL, offsetof( InGameUI, m_renderFpsBold ) }, + { "RenderFpsPosition", INI::parseCoord2D, NULL, offsetof( InGameUI, m_renderFpsPosition ) }, + { "RenderFpsColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_renderFpsColor ) }, + { "RenderFpsLimitColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_renderFpsLimitColor ) }, + { "RenderFpsDropColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_renderFpsDropColor ) }, + { "RenderFpsRefreshMs", INI::parseUnsignedInt, NULL, offsetof( InGameUI, m_renderFpsRefreshMs ) }, + { "SystemTimeFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_systemTimeFont ) }, { "SystemTimeBold", INI::parseBool, NULL, offsetof( InGameUI, m_systemTimeBold ) }, { "SystemTimePosition", INI::parseCoord2D, NULL, offsetof( InGameUI, m_systemTimePosition ) }, @@ -867,6 +885,16 @@ void INI::parseInGameUIDefinition( INI* ini ) } } +//------------------------------------------------------------------------------------------------- +namespace +{ + // helpers for inline counters + constexpr const Int kHudAnchorX = 3; + constexpr const Int kHudAnchorY = -1; + constexpr const Int kHudGapPx = 6; + inline Bool isAtHudAnchorPos(const Coord2D &p) { return p.x == kHudAnchorX && p.y == kHudAnchorY; } +} + //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- InGameUI::InGameUI() @@ -976,13 +1004,38 @@ InGameUI::InGameUI() m_replayWindow = NULL; m_messagesOn = TRUE; - // TheSuperHackers @info the default font, size and positions of the system and game times were chosen based on GenTools implementation + // TheSuperHackers @info the default font, size and positions of the various counters were chosen based on GenTools implementation + m_networkLatencyString = NULL; + m_networkLatencyFont = "Tahoma"; + m_networkLatencyPointSize = TheGlobalData->m_networkLatencyFontSize; + m_networkLatencyBold = TRUE; + m_networkLatencyPosition.x = kHudAnchorX; + m_networkLatencyPosition.y = kHudAnchorY; + m_networkLatencyColor = GameMakeColor( 173, 216, 255, 255 ); + m_networkLatencyDropColor = GameMakeColor( 0, 0, 0, 255 ); + m_lastNetworkLatencyFrames = ~0u; + + m_renderFpsString = NULL; + m_renderFpsLimitString = NULL; + m_renderFpsFont = "Tahoma"; + m_renderFpsPointSize = TheGlobalData->m_renderFpsFontSize; + m_renderFpsBold = TRUE; + m_renderFpsPosition.x = kHudAnchorX; + m_renderFpsPosition.y = kHudAnchorY; + m_renderFpsColor = GameMakeColor( 255, 255, 0, 255 ); + m_renderFpsLimitColor = GameMakeColor(119, 119, 119, 255); + m_renderFpsDropColor = GameMakeColor( 0, 0, 0, 255 ); + m_renderFpsRefreshMs = 1000; + m_lastRenderFps = ~0u; + m_lastRenderFpsLimit = ~0u; + m_lastRenderFpsUpdateMs = 0u; + m_systemTimeString = NULL; m_systemTimeFont = "Tahoma"; m_systemTimePointSize = TheGlobalData->m_systemTimeFontSize; m_systemTimeBold = TRUE; - m_systemTimePosition.x = 3; // TheSuperHackers @info relative to the left of the screen - m_systemTimePosition.y = -1; + m_systemTimePosition.x = kHudAnchorX; // TheSuperHackers @info relative to the left of the screen + m_systemTimePosition.y = kHudAnchorY; m_systemTimeColor = GameMakeColor( 255, 255, 255, 255 ); m_systemTimeDropColor = GameMakeColor( 0, 0, 0, 255 ); @@ -991,8 +1044,8 @@ InGameUI::InGameUI() m_gameTimeFont = "Tahoma"; m_gameTimePointSize = TheGlobalData->m_gameTimeFontSize; m_gameTimeBold = TRUE; - m_gameTimePosition.x = 3; // TheSuperHackers @info relative to the right of the screen - m_gameTimePosition.y = -1; + m_gameTimePosition.x = kHudAnchorX; // TheSuperHackers @info relative to the right of the screen + m_gameTimePosition.y = kHudAnchorY; m_gameTimeColor = GameMakeColor( 255, 255, 255, 255 ); m_gameTimeDropColor = GameMakeColor( 0, 0, 0, 255 ); @@ -2006,6 +2059,12 @@ void InGameUI::freeMessageResources( void ) void InGameUI::freeCustomUiResources( void ) { + TheDisplayStringManager->freeDisplayString(m_networkLatencyString); + m_networkLatencyString = NULL; + TheDisplayStringManager->freeDisplayString(m_renderFpsString); + m_renderFpsString = NULL; + TheDisplayStringManager->freeDisplayString(m_renderFpsLimitString); + m_renderFpsLimitString = NULL; TheDisplayStringManager->freeDisplayString(m_systemTimeString); m_systemTimeString = NULL; TheDisplayStringManager->freeDisplayString(m_gameTimeString); @@ -3459,9 +3518,22 @@ void InGameUI::disregardDrawable( Drawable *draw ) //------------------------------------------------------------------------------------------------- void InGameUI::postWindowDraw( void ) { + Int hudOffsetX = 0; + Int hudOffsetY = 0; + + if (m_networkLatencyPointSize > 0 && TheGameLogic->isInMultiplayerGame()) + { + drawNetworkLatency(hudOffsetX, hudOffsetY); + } + + if (m_renderFpsPointSize > 0) + { + drawRenderFps(hudOffsetX, hudOffsetY); + } + if (m_systemTimePointSize > 0) { - drawSystemTime(); + drawSystemTime(hudOffsetX, hudOffsetY); } if ( (m_gameTimePointSize > 0) && !TheGameLogic->isInShellGame() && TheGameLogic->isInGame() ) @@ -5613,10 +5685,49 @@ void InGameUI::recreateControlBar( void ) void InGameUI::refreshCustomUiResources(void) { + refreshNetworkLatencyResources(); + refreshRenderFpsResources(); refreshSystemTimeResources(); refreshGameTimeResources(); } +void InGameUI::refreshNetworkLatencyResources(void) +{ + if (!m_networkLatencyString) + { + m_networkLatencyString = TheDisplayStringManager->newDisplayString(); + m_lastNetworkLatencyFrames = ~0u; + } + + m_networkLatencyPointSize = TheGlobalData->m_networkLatencyFontSize; + Int adjustedNetworkLatencyFontSize = TheGlobalLanguageData->adjustFontSize(m_networkLatencyPointSize); + GameFont* latencyFont = TheWindowManager->winFindFont(m_networkLatencyFont, adjustedNetworkLatencyFontSize, m_networkLatencyBold); + m_networkLatencyString->setFont(latencyFont); +} + +void InGameUI::refreshRenderFpsResources(void) +{ + if (!m_renderFpsString) + { + m_renderFpsString = TheDisplayStringManager->newDisplayString(); + m_lastRenderFps = ~0u; + m_lastRenderFpsUpdateMs = 0u; + updateRenderFpsString(); + } + + if (!m_renderFpsLimitString) + { + m_renderFpsLimitString = TheDisplayStringManager->newDisplayString(); + m_lastRenderFpsLimit = ~0u; + } + + m_renderFpsPointSize = TheGlobalData->m_renderFpsFontSize; + Int adjustedRenderFpsFontSize = TheGlobalLanguageData->adjustFontSize(m_renderFpsPointSize); + GameFont *fpsFont = TheWindowManager->winFindFont(m_renderFpsFont, adjustedRenderFpsFontSize, m_renderFpsBold); + m_renderFpsString->setFont(fpsFont); + m_renderFpsLimitString->setFont(fpsFont); +} + void InGameUI::refreshSystemTimeResources(void) { if (!m_systemTimeString) @@ -5703,17 +5814,114 @@ WindowMsgHandledType IdleWorkerSystem( GameWindow *window, UnsignedInt msg, } -void InGameUI::drawSystemTime() + +void InGameUI::updateRenderFpsString() +{ + const UnsignedInt renderFps = (UnsignedInt)(TheDisplay->getAverageFPS() + 0.5f); + if (renderFps != m_lastRenderFps) + { + UnicodeString fpsStr; + fpsStr.format(L"%u", renderFps); + m_renderFpsString->setText(fpsStr); + m_lastRenderFps = renderFps; + } +} + +void InGameUI::drawNetworkLatency(Int &x, Int &y) +{ + const UnsignedInt networkLatencyFrames = TheNetwork->getRunAhead(); + + if (networkLatencyFrames != m_lastNetworkLatencyFrames) + { + UnicodeString latencyStr; + latencyStr.format(L"%u", networkLatencyFrames); + m_networkLatencyString->setText(latencyStr); + m_lastNetworkLatencyFrames = networkLatencyFrames; + } + + // TheSuperHackers @info at the HUD anchor this draws inline and advances x otherwise uses configured position + if (isAtHudAnchorPos(m_networkLatencyPosition)) + { + m_networkLatencyString->draw(kHudAnchorX + x, kHudAnchorY + y, m_networkLatencyColor, m_networkLatencyDropColor); + x += m_networkLatencyString->getWidth() + kHudGapPx; + } + else + { + m_networkLatencyString->draw(m_networkLatencyPosition.x, m_networkLatencyPosition.y, m_networkLatencyColor, m_networkLatencyDropColor); + } +} + +void InGameUI::drawRenderFps(Int &x, Int &y) +{ + if (m_renderFpsRefreshMs > 0u) + { + const UnsignedInt nowMs = timeGetTime(); + const UnsignedInt deltaMs = nowMs - m_lastRenderFpsUpdateMs; + if (deltaMs >= m_renderFpsRefreshMs) + { + m_lastRenderFpsUpdateMs = nowMs; + updateRenderFpsString(); + } + } + else + { + updateRenderFpsString(); + } + + UnsignedInt renderFpsLimit = 0u; + if (TheGlobalData->m_useFpsLimit) + { + renderFpsLimit = (UnsignedInt)TheGameEngine->getFramesPerSecondLimit(); + if (renderFpsLimit == RenderFpsPreset::UncappedFpsValue) + { + renderFpsLimit = 0u; + } + } + if (renderFpsLimit != m_lastRenderFpsLimit) + { + UnicodeString fpsLimitStr; + fpsLimitStr.format(L"[%u]", renderFpsLimit); + m_renderFpsLimitString->setText(fpsLimitStr); + m_lastRenderFpsLimit = renderFpsLimit; + } + + // TheSuperHackers @info at the HUD anchor this draws inline and advances x otherwise uses configured position + if (isAtHudAnchorPos(m_renderFpsPosition)) + { + const Int drawY = kHudAnchorY + y; + + m_renderFpsString->draw(kHudAnchorX + x, drawY, m_renderFpsColor, m_renderFpsDropColor); + x += m_renderFpsString->getWidth(); + m_renderFpsLimitString->draw(kHudAnchorX + x, drawY, m_renderFpsLimitColor, m_renderFpsDropColor); + x += m_renderFpsLimitString->getWidth() + kHudGapPx; + } + else + { + m_renderFpsString->draw(m_renderFpsPosition.x, m_renderFpsPosition.y, m_renderFpsColor, m_renderFpsDropColor); + m_renderFpsLimitString->draw(m_renderFpsPosition.x + m_renderFpsString->getWidth(), m_renderFpsPosition.y, m_renderFpsLimitColor, m_renderFpsDropColor); + } +} + +void InGameUI::drawSystemTime(Int &x, Int &y) { // current system time SYSTEMTIME systemTime; GetLocalTime( &systemTime ); - UnicodeString TimeString; - TimeString.format(L"%2.2d:%2.2d:%2.2d", systemTime.wHour, systemTime.wMinute, systemTime.wSecond); - m_systemTimeString->setText(TimeString); + UnicodeString TimeString; + TimeString.format(L"%2.2d:%2.2d:%2.2d", systemTime.wHour, systemTime.wMinute, systemTime.wSecond); + m_systemTimeString->setText(TimeString); - m_systemTimeString->draw(m_systemTimePosition.x, m_systemTimePosition.y, m_systemTimeColor, m_systemTimeDropColor); + // TheSuperHackers @info at the HUD anchor this draws inline and advances x otherwise uses configured position + if (isAtHudAnchorPos(m_systemTimePosition)) + { + m_systemTimeString->draw(kHudAnchorX + x, kHudAnchorY + y, m_systemTimeColor, m_systemTimeDropColor); + x += m_systemTimeString->getWidth() + kHudGapPx; + } + else + { + m_systemTimeString->draw(m_systemTimePosition.x, m_systemTimePosition.y, m_systemTimeColor, m_systemTimeDropColor); + } } void InGameUI::drawGameTime() diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h index 190f2ac35aa..7bb3e5a0b4c 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h @@ -407,6 +407,9 @@ class GlobalData : public SubsystemInterface Bool m_saveCameraInReplay; Bool m_useCameraInReplay; + // TheSuperHackers @feature L3-M 05/09/2025 allow the network latency counter and render fps counter font size to be set, a size of zero disables them + Int m_networkLatencyFontSize; + Int m_renderFpsFontSize; // TheSuperHackers @feature Mauller 21/06/2025 allow the system time and game time font size to be set, a size of zero disables them Int m_systemTimeFontSize; Int m_gameTimeFontSize; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h b/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h index 27fc7963500..49bd0cbf3ab 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h @@ -143,6 +143,8 @@ class OptionPreferences : public UserPreferences Int getCampaignDifficulty(void); void setCampaignDifficulty( Int diff ); + Int getNetworkLatencyFontSize(void); + Int getRenderFpsFontSize(void); Int getSystemTimeFontSize(void); Int getGameTimeFontSize(void); diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h index 631f371fc56..4b12206c401 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h @@ -571,6 +571,8 @@ friend class Drawable; // for selection/deselection transactions virtual void recreateControlBar( void ); virtual void refreshCustomUiResources( void ); + virtual void refreshNetworkLatencyResources(void); + virtual void refreshRenderFpsResources(void); virtual void refreshSystemTimeResources( void ); virtual void refreshGameTimeResources( void ); @@ -592,7 +594,10 @@ friend class Drawable; // for selection/deselection transactions virtual void updateIdleWorker( void ); virtual void resetIdleWorker( void ); - void drawSystemTime(); + void updateRenderFpsString(); + void drawNetworkLatency(Int &x, Int &y); + void drawRenderFps(Int &x, Int &y); + void drawSystemTime(Int &x, Int &y); void drawGameTime(); public: @@ -753,6 +758,31 @@ friend class Drawable; // for selection/deselection transactions VideoBuffer* m_cameoVideoBuffer;///< video playback buffer VideoStreamInterface* m_cameoVideoStream;///< Video stream; + // Network Latency Counter + DisplayString * m_networkLatencyString; + AsciiString m_networkLatencyFont; + Int m_networkLatencyPointSize; + Bool m_networkLatencyBold; + Coord2D m_networkLatencyPosition; + Color m_networkLatencyColor; + Color m_networkLatencyDropColor; + UnsignedInt m_lastNetworkLatencyFrames; + + // Render FPS Counter + DisplayString * m_renderFpsString; + DisplayString * m_renderFpsLimitString; + AsciiString m_renderFpsFont; + Int m_renderFpsPointSize; + Bool m_renderFpsBold; + Coord2D m_renderFpsPosition; + Color m_renderFpsColor; + Color m_renderFpsLimitColor; + Color m_renderFpsDropColor; + UnsignedInt m_renderFpsRefreshMs; + UnsignedInt m_lastRenderFps; + UnsignedInt m_lastRenderFpsLimit; + UnsignedInt m_lastRenderFpsUpdateMs; + // System Time DisplayString * m_systemTimeString; AsciiString m_systemTimeFont; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp index de74c70fb01..bc4ac4f2bbe 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp @@ -942,6 +942,8 @@ GlobalData::GlobalData() m_saveCameraInReplay = FALSE; m_useCameraInReplay = FALSE; + m_networkLatencyFontSize = 8; + m_renderFpsFontSize = 8; m_systemTimeFontSize = 8; m_gameTimeFontSize = 8; @@ -1212,6 +1214,8 @@ void GlobalData::parseGameDataDefinition( INI* ini ) TheWritableGlobalData->m_saveCameraInReplay = optionPref.saveCameraInReplays(); TheWritableGlobalData->m_useCameraInReplay = optionPref.useCameraInReplays(); + TheWritableGlobalData->m_networkLatencyFontSize = optionPref.getNetworkLatencyFontSize(); + TheWritableGlobalData->m_renderFpsFontSize = optionPref.getRenderFpsFontSize(); TheWritableGlobalData->m_systemTimeFontSize = optionPref.getSystemTimeFontSize(); TheWritableGlobalData->m_gameTimeFontSize = optionPref.getGameTimeFontSize(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index 37d674c41b2..e5b8b02a000 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -898,6 +898,34 @@ Real OptionPreferences::getMoneyTransactionVolume(void) const return volume; } +Int OptionPreferences::getNetworkLatencyFontSize(void) +{ + OptionPreferences::const_iterator it = find("NetworkLatencyFontSize"); + if (it == end()) + return 8; + + Int fontSize = atoi(it->second.str()); + if (fontSize < 0) + { + fontSize = 0; + } + return fontSize; +} + +Int OptionPreferences::getRenderFpsFontSize(void) +{ + OptionPreferences::const_iterator it = find("RenderFpsFontSize"); + if (it == end()) + return 8; + + Int fontSize = atoi(it->second.str()); + if (fontSize < 0) + { + fontSize = 0; + } + return fontSize; +} + Int OptionPreferences::getSystemTimeFontSize(void) { OptionPreferences::const_iterator it = find("SystemTimeFontSize"); @@ -1473,6 +1501,28 @@ static void saveOptions( void ) } } + //------------------------------------------------------------------------------------------------- + // Set Network Latency Font Size + val = pref->getNetworkLatencyFontSize(); + if (val >= 0) + { + AsciiString prefString; + prefString.format("%d", val); + (*pref)["NetworkLatencyFontSize"] = prefString; + TheInGameUI->refreshNetworkLatencyResources(); + } + + //------------------------------------------------------------------------------------------------- + // Set Render FPS Font Size + val = pref->getRenderFpsFontSize(); + if (val >= 0) + { + AsciiString prefString; + prefString.format("%d", val); + (*pref)["RenderFpsFontSize"] = prefString; + TheInGameUI->refreshRenderFpsResources(); + } + //------------------------------------------------------------------------------------------------- // Set System Time Font Size val = pref->getSystemTimeFontSize(); // TheSuperHackers @todo replace with options input when applicable diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index 03859cf9132..70f367d029c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -46,6 +46,7 @@ #include "Common/BuildAssistant.h" #include "Common/Recorder.h" #include "Common/SpecialPower.h" +#include "Common/FrameRateLimit.h" #include "GameClient/Anim2D.h" #include "GameClient/ControlBar.h" @@ -72,6 +73,7 @@ #include "GameClient/SelectionXlat.h" #include "GameClient/Shadow.h" #include "GameClient/GlobalLanguage.h" +#include "GameClient/Display.h" #include "GameLogic/AIGuard.h" #include "GameLogic/Weapon.h" @@ -86,6 +88,8 @@ #include "GameLogic/Module/SupplyWarehouseDockUpdate.h" #include "GameLogic/Module/MobMemberSlavedUpdate.h"//ML +#include "GameNetwork/NetworkInterface.h" + #include "Common/UnitTimings.h" //Contains the DO_UNIT_TIMINGS define jba. @@ -869,6 +873,20 @@ const FieldParse InGameUI::s_fieldParseTable[] = { "AmbulanceRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_AMBULANCE] ) }, // TheSuperHackers @info ui enhancement configuration + { "NetworkLatencyFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_networkLatencyFont ) }, + { "NetworkLatencyBold", INI::parseBool, NULL, offsetof( InGameUI, m_networkLatencyBold ) }, + { "NetworkLatencyPosition", INI::parseCoord2D, NULL, offsetof( InGameUI, m_networkLatencyPosition ) }, + { "NetworkLatencyColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_networkLatencyColor ) }, + { "NetworkLatencyDropColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_networkLatencyDropColor ) }, + + { "RenderFpsFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_renderFpsFont ) }, + { "RenderFpsBold", INI::parseBool, NULL, offsetof( InGameUI, m_renderFpsBold ) }, + { "RenderFpsPosition", INI::parseCoord2D, NULL, offsetof( InGameUI, m_renderFpsPosition ) }, + { "RenderFpsColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_renderFpsColor ) }, + { "RenderFpsLimitColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_renderFpsLimitColor ) }, + { "RenderFpsDropColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_renderFpsDropColor ) }, + { "RenderFpsRefreshMs", INI::parseUnsignedInt, NULL, offsetof( InGameUI, m_renderFpsRefreshMs ) }, + { "SystemTimeFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_systemTimeFont ) }, { "SystemTimeBold", INI::parseBool, NULL, offsetof( InGameUI, m_systemTimeBold ) }, { "SystemTimePosition", INI::parseCoord2D, NULL, offsetof( InGameUI, m_systemTimePosition ) }, @@ -896,6 +914,16 @@ void INI::parseInGameUIDefinition( INI* ini ) } } +//------------------------------------------------------------------------------------------------- +namespace +{ + // helpers for inline counters + constexpr const Int kHudAnchorX = 3; + constexpr const Int kHudAnchorY = -1; + constexpr const Int kHudGapPx = 6; + inline Bool isAtHudAnchorPos(const Coord2D &p) { return p.x == kHudAnchorX && p.y == kHudAnchorY; } +} + //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- InGameUI::InGameUI() @@ -1006,13 +1034,38 @@ InGameUI::InGameUI() m_replayWindow = NULL; m_messagesOn = TRUE; - // TheSuperHackers @info the default font, size and positions of the system and game times were chosen based on GenTools implementation + // TheSuperHackers @info the default font, size and positions of the various counters were chosen based on GenTools implementation + m_networkLatencyString = NULL; + m_networkLatencyFont = "Tahoma"; + m_networkLatencyPointSize = TheGlobalData->m_networkLatencyFontSize; + m_networkLatencyBold = TRUE; + m_networkLatencyPosition.x = kHudAnchorX; + m_networkLatencyPosition.y = kHudAnchorY; + m_networkLatencyColor = GameMakeColor( 173, 216, 255, 255 ); + m_networkLatencyDropColor = GameMakeColor( 0, 0, 0, 255 ); + m_lastNetworkLatencyFrames = ~0u; + + m_renderFpsString = NULL; + m_renderFpsLimitString = NULL; + m_renderFpsFont = "Tahoma"; + m_renderFpsPointSize = TheGlobalData->m_renderFpsFontSize; + m_renderFpsBold = TRUE; + m_renderFpsPosition.x = kHudAnchorX; + m_renderFpsPosition.y = kHudAnchorY; + m_renderFpsColor = GameMakeColor( 255, 255, 0, 255 ); + m_renderFpsLimitColor = GameMakeColor(119, 119, 119, 255); + m_renderFpsDropColor = GameMakeColor( 0, 0, 0, 255 ); + m_renderFpsRefreshMs = 1000; + m_lastRenderFps = ~0u; + m_lastRenderFpsLimit = ~0u; + m_lastRenderFpsUpdateMs = 0u; + m_systemTimeString = NULL; m_systemTimeFont = "Tahoma"; m_systemTimePointSize = TheGlobalData->m_systemTimeFontSize; m_systemTimeBold = TRUE; - m_systemTimePosition.x = 3; // TheSuperHackers @info relative to the left of the screen - m_systemTimePosition.y = -1; + m_systemTimePosition.x = kHudAnchorX; // TheSuperHackers @info relative to the left of the screen + m_systemTimePosition.y = kHudAnchorY; m_systemTimeColor = GameMakeColor( 255, 255, 255, 255 ); m_systemTimeDropColor = GameMakeColor( 0, 0, 0, 255 ); @@ -1021,8 +1074,8 @@ InGameUI::InGameUI() m_gameTimeFont = "Tahoma"; m_gameTimePointSize = TheGlobalData->m_gameTimeFontSize; m_gameTimeBold = TRUE; - m_gameTimePosition.x = 3; // TheSuperHackers @info relative to the right of the screen - m_gameTimePosition.y = -1; + m_gameTimePosition.x = kHudAnchorX; // TheSuperHackers @info relative to the right of the screen + m_gameTimePosition.y = kHudAnchorY; m_gameTimeColor = GameMakeColor( 255, 255, 255, 255 ); m_gameTimeDropColor = GameMakeColor( 0, 0, 0, 255 ); @@ -2063,6 +2116,12 @@ void InGameUI::freeMessageResources( void ) void InGameUI::freeCustomUiResources( void ) { + TheDisplayStringManager->freeDisplayString(m_networkLatencyString); + m_networkLatencyString = NULL; + TheDisplayStringManager->freeDisplayString(m_renderFpsString); + m_renderFpsString = NULL; + TheDisplayStringManager->freeDisplayString(m_renderFpsLimitString); + m_renderFpsLimitString = NULL; TheDisplayStringManager->freeDisplayString(m_systemTimeString); m_systemTimeString = NULL; TheDisplayStringManager->freeDisplayString(m_gameTimeString); @@ -3550,9 +3609,22 @@ void InGameUI::disregardDrawable( Drawable *draw ) //------------------------------------------------------------------------------------------------- void InGameUI::postWindowDraw( void ) { + Int hudOffsetX = 0; + Int hudOffsetY = 0; + + if (m_networkLatencyPointSize > 0 && TheGameLogic->isInMultiplayerGame()) + { + drawNetworkLatency(hudOffsetX, hudOffsetY); + } + + if (m_renderFpsPointSize > 0) + { + drawRenderFps(hudOffsetX, hudOffsetY); + } + if (m_systemTimePointSize > 0) { - drawSystemTime(); + drawSystemTime(hudOffsetX, hudOffsetY); } if ( (m_gameTimePointSize > 0) && !TheGameLogic->isInShellGame() && TheGameLogic->isInGame() ) @@ -5786,10 +5858,49 @@ void InGameUI::recreateControlBar( void ) void InGameUI::refreshCustomUiResources(void) { + refreshNetworkLatencyResources(); + refreshRenderFpsResources(); refreshSystemTimeResources(); refreshGameTimeResources(); } +void InGameUI::refreshNetworkLatencyResources(void) +{ + if (!m_networkLatencyString) + { + m_networkLatencyString = TheDisplayStringManager->newDisplayString(); + m_lastNetworkLatencyFrames = ~0u; + } + + m_networkLatencyPointSize = TheGlobalData->m_networkLatencyFontSize; + Int adjustedNetworkLatencyFontSize = TheGlobalLanguageData->adjustFontSize(m_networkLatencyPointSize); + GameFont* latencyFont = TheWindowManager->winFindFont(m_networkLatencyFont, adjustedNetworkLatencyFontSize, m_networkLatencyBold); + m_networkLatencyString->setFont(latencyFont); +} + +void InGameUI::refreshRenderFpsResources(void) +{ + if (!m_renderFpsString) + { + m_renderFpsString = TheDisplayStringManager->newDisplayString(); + m_lastRenderFps = ~0u; + m_lastRenderFpsUpdateMs = 0u; + updateRenderFpsString(); + } + + if (!m_renderFpsLimitString) + { + m_renderFpsLimitString = TheDisplayStringManager->newDisplayString(); + m_lastRenderFpsLimit = ~0u; + } + + m_renderFpsPointSize = TheGlobalData->m_renderFpsFontSize; + Int adjustedRenderFpsFontSize = TheGlobalLanguageData->adjustFontSize(m_renderFpsPointSize); + GameFont *fpsFont = TheWindowManager->winFindFont(m_renderFpsFont, adjustedRenderFpsFontSize, m_renderFpsBold); + m_renderFpsString->setFont(fpsFont); + m_renderFpsLimitString->setFont(fpsFont); +} + void InGameUI::refreshSystemTimeResources(void) { if (!m_systemTimeString) @@ -5876,17 +5987,114 @@ WindowMsgHandledType IdleWorkerSystem( GameWindow *window, UnsignedInt msg, } -void InGameUI::drawSystemTime() + +void InGameUI::updateRenderFpsString() +{ + const UnsignedInt renderFps = (UnsignedInt)(TheDisplay->getAverageFPS() + 0.5f); + if (renderFps != m_lastRenderFps) + { + UnicodeString fpsStr; + fpsStr.format(L"%u", renderFps); + m_renderFpsString->setText(fpsStr); + m_lastRenderFps = renderFps; + } +} + +void InGameUI::drawNetworkLatency(Int &x, Int &y) +{ + const UnsignedInt networkLatencyFrames = TheNetwork->getRunAhead(); + + if (networkLatencyFrames != m_lastNetworkLatencyFrames) + { + UnicodeString latencyStr; + latencyStr.format(L"%u", networkLatencyFrames); + m_networkLatencyString->setText(latencyStr); + m_lastNetworkLatencyFrames = networkLatencyFrames; + } + + // TheSuperHackers @info at the HUD anchor this draws inline and advances x otherwise uses configured position + if (isAtHudAnchorPos(m_networkLatencyPosition)) + { + m_networkLatencyString->draw(kHudAnchorX + x, kHudAnchorY + y, m_networkLatencyColor, m_networkLatencyDropColor); + x += m_networkLatencyString->getWidth() + kHudGapPx; + } + else + { + m_networkLatencyString->draw(m_networkLatencyPosition.x, m_networkLatencyPosition.y, m_networkLatencyColor, m_networkLatencyDropColor); + } +} + +void InGameUI::drawRenderFps(Int &x, Int &y) +{ + if (m_renderFpsRefreshMs > 0u) + { + const UnsignedInt nowMs = timeGetTime(); + const UnsignedInt deltaMs = nowMs - m_lastRenderFpsUpdateMs; + if (deltaMs >= m_renderFpsRefreshMs) + { + m_lastRenderFpsUpdateMs = nowMs; + updateRenderFpsString(); + } + } + else + { + updateRenderFpsString(); + } + + UnsignedInt renderFpsLimit = 0u; + if (TheGlobalData->m_useFpsLimit) + { + renderFpsLimit = (UnsignedInt)TheGameEngine->getFramesPerSecondLimit(); + if (renderFpsLimit == RenderFpsPreset::UncappedFpsValue) + { + renderFpsLimit = 0u; + } + } + if (renderFpsLimit != m_lastRenderFpsLimit) + { + UnicodeString fpsLimitStr; + fpsLimitStr.format(L"[%u]", renderFpsLimit); + m_renderFpsLimitString->setText(fpsLimitStr); + m_lastRenderFpsLimit = renderFpsLimit; + } + + // TheSuperHackers @info at the HUD anchor this draws inline and advances x otherwise uses configured position + if (isAtHudAnchorPos(m_renderFpsPosition)) + { + const Int drawY = kHudAnchorY + y; + + m_renderFpsString->draw(kHudAnchorX + x, drawY, m_renderFpsColor, m_renderFpsDropColor); + x += m_renderFpsString->getWidth(); + m_renderFpsLimitString->draw(kHudAnchorX + x, drawY, m_renderFpsLimitColor, m_renderFpsDropColor); + x += m_renderFpsLimitString->getWidth() + kHudGapPx; + } + else + { + m_renderFpsString->draw(m_renderFpsPosition.x, m_renderFpsPosition.y, m_renderFpsColor, m_renderFpsDropColor); + m_renderFpsLimitString->draw(m_renderFpsPosition.x + m_renderFpsString->getWidth(), m_renderFpsPosition.y, m_renderFpsLimitColor, m_renderFpsDropColor); + } +} + +void InGameUI::drawSystemTime(Int &x, Int &y) { // current system time SYSTEMTIME systemTime; GetLocalTime( &systemTime ); - UnicodeString TimeString; - TimeString.format(L"%2.2d:%2.2d:%2.2d", systemTime.wHour, systemTime.wMinute, systemTime.wSecond); - m_systemTimeString->setText(TimeString); + UnicodeString TimeString; + TimeString.format(L"%2.2d:%2.2d:%2.2d", systemTime.wHour, systemTime.wMinute, systemTime.wSecond); + m_systemTimeString->setText(TimeString); - m_systemTimeString->draw(m_systemTimePosition.x, m_systemTimePosition.y, m_systemTimeColor, m_systemTimeDropColor); + // TheSuperHackers @info at the HUD anchor this draws inline and advances x otherwise uses configured position + if (isAtHudAnchorPos(m_systemTimePosition)) + { + m_systemTimeString->draw(kHudAnchorX + x, kHudAnchorY + y, m_systemTimeColor, m_systemTimeDropColor); + x += m_systemTimeString->getWidth() + kHudGapPx; + } + else + { + m_systemTimeString->draw(m_systemTimePosition.x, m_systemTimePosition.y, m_systemTimeColor, m_systemTimeDropColor); + } } void InGameUI::drawGameTime() From c2c53369f0845781814f35f38dd5cf785923ce5c Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Sun, 21 Sep 2025 19:14:14 +0100 Subject: [PATCH 134/343] refactor(pathfinder): Simplify and improve readability of PathfindCell::releaseInfo (#1619) --- .../Source/GameLogic/AI/AIPathfind.cpp | 31 +++++++++-------- .../Source/GameLogic/AI/AIPathfind.cpp | 33 +++++++++---------- 2 files changed, 31 insertions(+), 33 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 718ac4fcc3b..af472695544 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -1312,7 +1312,7 @@ Bool PathfindCell::allocateInfo( const ICoord2D &pos ) /** * Releases an info record for a cell. */ -void PathfindCell::releaseInfo( void ) +void PathfindCell::releaseInfo(void) { // TheSuperHackers @bugfix Mauller/SkyAero 05/06/2025 Parent cell links need clearing to prevent dangling pointers on starting points that can link them to an invalid parent cell. // Parent cells are only cleared within Pathfinder::prependCells, so cells that do not make it onto the final path do not get their parent cell cleared. @@ -1325,28 +1325,27 @@ void PathfindCell::releaseInfo( void ) m_info->m_pathParent = NULL; } } - if (m_type==PathfindCell::CELL_OBSTACLE) { + + if (m_type == PathfindCell::CELL_OBSTACLE || m_flags != NO_UNITS || m_aircraftGoal) { return; } - if (m_flags!=NO_UNITS) { + + if (!m_info) { return; } - if (m_aircraftGoal) { + + DEBUG_ASSERTCRASH(m_info->m_prevOpen==NULL && m_info->m_nextOpen==NULL, ("Shouldn't be linked.")); + DEBUG_ASSERTCRASH(m_info->m_open==NULL && m_info->m_closed==NULL, ("Shouldn't be linked.")); + DEBUG_ASSERTCRASH(m_info->m_goalUnitID==INVALID_ID && m_info->m_posUnitID==INVALID_ID, ("Shouldn't be occupied.")); + DEBUG_ASSERTCRASH(m_info->m_goalAircraftID==INVALID_ID , ("Shouldn't be occupied by aircraft.")); + if (m_info->m_prevOpen || m_info->m_nextOpen || m_info->m_open || m_info->m_closed) { + // Bad release. Skip for now, better leak than crash. jba. return; } - if (m_info) { - DEBUG_ASSERTCRASH(m_info->m_prevOpen==NULL && m_info->m_nextOpen==NULL, ("Shouldn't be linked.")); - DEBUG_ASSERTCRASH(m_info->m_open==NULL && m_info->m_closed==NULL, ("Shouldn't be linked.")); - DEBUG_ASSERTCRASH(m_info->m_goalUnitID==INVALID_ID && m_info->m_posUnitID==INVALID_ID, ("Shouldn't be occupied.")); - DEBUG_ASSERTCRASH(m_info->m_goalAircraftID==INVALID_ID , ("Shouldn't be occupied by aircraft.")); - if (m_info->m_prevOpen || m_info->m_nextOpen || m_info->m_open || m_info->m_closed) { - // Bad release. Skip for now, better leak than crash. jba. - return; - } - PathfindCellInfo::releaseACellInfo(m_info); - m_info = NULL; - } + PathfindCellInfo::releaseACellInfo(m_info); + m_info = NULL; + } /** diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 4a3dda9b2a1..47799b8229b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -1330,8 +1330,8 @@ Bool PathfindCell::allocateInfo( const ICoord2D &pos ) /** * Releases an info record for a cell. */ -void PathfindCell::releaseInfo( void ) -{ +void PathfindCell::releaseInfo(void) +{ // TheSuperHackers @bugfix Mauller/SkyAero 05/06/2025 Parent cell links need clearing to prevent dangling pointers on starting points that can link them to an invalid parent cell. // Parent cells are only cleared within Pathfinder::prependCells, so cells that do not make it onto the final path do not get their parent cell cleared. // Cells with a special flags also do not get their PathfindCellInfo cleared and therefore can leave a parent cell set on a starting cell. @@ -1343,28 +1343,27 @@ void PathfindCell::releaseInfo( void ) m_info->m_pathParent = NULL; } } - if (m_type==PathfindCell::CELL_OBSTACLE) { + + if (m_type == PathfindCell::CELL_OBSTACLE || m_flags != NO_UNITS || m_aircraftGoal) { return; } - if (m_flags!=NO_UNITS) { + + if (!m_info) { return; } - if (m_aircraftGoal) { + + DEBUG_ASSERTCRASH(m_info->m_prevOpen==NULL && m_info->m_nextOpen==NULL, ("Shouldn't be linked.")); + DEBUG_ASSERTCRASH(m_info->m_open==NULL && m_info->m_closed==NULL, ("Shouldn't be linked.")); + DEBUG_ASSERTCRASH(m_info->m_goalUnitID==INVALID_ID && m_info->m_posUnitID==INVALID_ID, ("Shouldn't be occupied.")); + DEBUG_ASSERTCRASH(m_info->m_goalAircraftID==INVALID_ID , ("Shouldn't be occupied by aircraft.")); + if (m_info->m_prevOpen || m_info->m_nextOpen || m_info->m_open || m_info->m_closed) { + // Bad release. Skip for now, better leak than crash. jba. return; } - if (m_info) { - DEBUG_ASSERTCRASH(m_info->m_prevOpen==NULL && m_info->m_nextOpen==NULL, ("Shouldn't be linked.")); - DEBUG_ASSERTCRASH(m_info->m_open==NULL && m_info->m_closed==NULL, ("Shouldn't be linked.")); - DEBUG_ASSERTCRASH(m_info->m_goalUnitID==INVALID_ID && m_info->m_posUnitID==INVALID_ID, ("Shouldn't be occupied.")); - DEBUG_ASSERTCRASH(m_info->m_goalAircraftID==INVALID_ID , ("Shouldn't be occupied by aircraft.")); - if (m_info->m_prevOpen || m_info->m_nextOpen || m_info->m_open || m_info->m_closed) { - // Bad release. Skip for now, better leak than crash. jba. - return; - } - PathfindCellInfo::releaseACellInfo(m_info); - m_info = NULL; - } + PathfindCellInfo::releaseACellInfo(m_info); + m_info = NULL; + } /** From 733d67797a785de2234437eb66e084ea3bc58289 Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Sun, 21 Sep 2025 19:15:02 +0100 Subject: [PATCH 135/343] refactor(pathfinder): Simplify and improve readability of Pathfinder::checkChangeLayers (#1619) --- .../Source/GameLogic/AI/AIPathfind.cpp | 62 ++++++++----------- .../Source/GameLogic/AI/AIPathfind.cpp | 62 ++++++++----------- 2 files changed, 52 insertions(+), 72 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index af472695544..c219a6483d2 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -5332,44 +5332,34 @@ void Pathfinder::processPathfindQueue(void) void Pathfinder::checkChangeLayers(PathfindCell *parentCell) { - ICoord2D newCellCoord; - PathfindCell *newCell; - if (parentCell->getConnectLayer() != LAYER_INVALID) { - newCellCoord.x = parentCell->getXIndex(); - newCellCoord.y = parentCell->getYIndex(); + if (parentCell->getConnectLayer() == LAYER_INVALID) + return; - if (parentCell->getConnectLayer() == LAYER_GROUND) { - newCell = getCell(LAYER_GROUND, newCellCoord.x, newCellCoord.y ); - } else { - newCell = getCell(parentCell->getConnectLayer(), newCellCoord.x, newCellCoord.y); - } - DEBUG_ASSERTCRASH(newCell, ("Couldn't find cell.")); - if (newCell) { - Bool onList = false; - if (newCell->hasInfo()) { - if (newCell->getOpen() || newCell->getClosed()) - { - // already on one of the lists - onList = true; - } - } - if (!onList) { - if (!newCell->allocateInfo(newCellCoord)) { - // Out of cells for pathing... - return; - } - // compute cost of path thus far - // keep track of path we're building - point back to cell we moved here from - newCell->setParentCell(parentCell) ; - // store cost of this path - newCell->setCostSoFar(parentCell->getCostSoFar()); // same as parent cost - newCell->setTotalCost(parentCell->getTotalCost()) ; - // insert newCell in open list such that open list is sorted, smallest total path cost first - m_openList = newCell->putOnSortedOpenList( m_openList ); + ICoord2D newCellCoord = { parentCell->getXIndex(), parentCell->getYIndex() }; + PathfindCell *newCell = getCell(parentCell->getConnectLayer(), newCellCoord.x, newCellCoord.y ); - } - } - } + if (!newCell) { + DEBUG_CRASH(("Couldn't find cell.")); + return; + } + + // already on one of the lists + if (newCell->hasInfo() && (newCell->getOpen() || newCell->getClosed())) { + return; + } + + if (!newCell->allocateInfo(newCellCoord)) { + // Out of cells for pathing... + return; + } + // compute cost of path thus far + // keep track of path we're building - point back to cell we moved here from + newCell->setParentCell(parentCell) ; + // store cost of this path + newCell->setCostSoFar(parentCell->getCostSoFar()); // same as parent cost + newCell->setTotalCost(parentCell->getTotalCost()); + // insert newCell in open list such that open list is sorted, smallest total path cost first + m_openList = newCell->putOnSortedOpenList( m_openList ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 47799b8229b..772118600a5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -5632,44 +5632,34 @@ void Pathfinder::processPathfindQueue(void) void Pathfinder::checkChangeLayers(PathfindCell *parentCell) { - ICoord2D newCellCoord; - PathfindCell *newCell; - if (parentCell->getConnectLayer() != LAYER_INVALID) { - newCellCoord.x = parentCell->getXIndex(); - newCellCoord.y = parentCell->getYIndex(); + if (parentCell->getConnectLayer() == LAYER_INVALID) + return; - if (parentCell->getConnectLayer() == LAYER_GROUND) { - newCell = getCell(LAYER_GROUND, newCellCoord.x, newCellCoord.y ); - } else { - newCell = getCell(parentCell->getConnectLayer(), newCellCoord.x, newCellCoord.y); - } - DEBUG_ASSERTCRASH(newCell, ("Couldn't find cell.")); - if (newCell) { - Bool onList = false; - if (newCell->hasInfo()) { - if (newCell->getOpen() || newCell->getClosed()) - { - // already on one of the lists - onList = true; - } - } - if (!onList) { - if (!newCell->allocateInfo(newCellCoord)) { - // Out of cells for pathing... - return; - } - // compute cost of path thus far - // keep track of path we're building - point back to cell we moved here from - newCell->setParentCell(parentCell) ; - // store cost of this path - newCell->setCostSoFar(parentCell->getCostSoFar()); // same as parent cost - newCell->setTotalCost(parentCell->getTotalCost()) ; - // insert newCell in open list such that open list is sorted, smallest total path cost first - m_openList = newCell->putOnSortedOpenList( m_openList ); + ICoord2D newCellCoord = { parentCell->getXIndex(), parentCell->getYIndex() }; + PathfindCell *newCell = getCell(parentCell->getConnectLayer(), newCellCoord.x, newCellCoord.y ); - } - } - } + if (!newCell) { + DEBUG_CRASH(("Couldn't find cell.")); + return; + } + + // already on one of the lists + if (newCell->hasInfo() && (newCell->getOpen() || newCell->getClosed())) { + return; + } + + if (!newCell->allocateInfo(newCellCoord)) { + // Out of cells for pathing... + return; + } + // compute cost of path thus far + // keep track of path we're building - point back to cell we moved here from + newCell->setParentCell(parentCell) ; + // store cost of this path + newCell->setCostSoFar(parentCell->getCostSoFar()); // same as parent cost + newCell->setTotalCost(parentCell->getTotalCost()); + // insert newCell in open list such that open list is sorted, smallest total path cost first + m_openList = newCell->putOnSortedOpenList( m_openList ); } From 824e3f8b2305e8f5bbebde948e270b4cf18575ef Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Sun, 21 Sep 2025 19:17:33 +0100 Subject: [PATCH 136/343] refactor(pathfinder): Simplify and improve readability of Pathfinder::examineNeighboringCells (#1619) --- .../Source/GameLogic/AI/AIPathfind.cpp | 71 +++++++----------- .../Source/GameLogic/AI/AIPathfind.cpp | 74 +++++++------------ 2 files changed, 56 insertions(+), 89 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index c219a6483d2..1de8e1c1259 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -5522,7 +5522,7 @@ Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell * newCell = getCell(parentCell->getLayer(), newCellCoord.x, newCellCoord.y ); // check if cell is on the map - if (newCell == NULL) + if (!newCell) continue; Bool notZonePassable = false; @@ -5539,18 +5539,9 @@ Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell * // check if this neighbor cell is already on the open (waiting to be tried) // or closed (already tried) lists - Bool onList = false; - if (newCell->hasInfo()) { - if (newCell->getOpen() || newCell->getClosed()) - { - // already on one of the lists - onList = true; - } - } - if (onList) { - // we have already examined this one, so continue. + if ( newCell->hasInfo() && (newCell->getOpen() || newCell->getClosed()) ) continue; - } + if (i>=firstDiagonal) { // make sure one of the adjacent sides is open. if (!neighborFlags[adjacent[i-4]] && !neighborFlags[adjacent[i-3]]) { @@ -5575,24 +5566,20 @@ Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell * continue; } - Bool movementValid = true; + Bool movementValid = validMovementPosition(isCrusher, locomotorSet.getValidSurfaces(), newCell, parentCell); Bool dozerHack = false; - if (validMovementPosition( isCrusher, locomotorSet.getValidSurfaces(), newCell, parentCell )) { - } else { - movementValid = false; - if (obj->isKindOf(KINDOF_DOZER)) { - if (newCell->getType()==PathfindCell::CELL_OBSTACLE) { - Object *obstacle = TheGameLogic->findObjectByID(newCell->getObstacleID()); - if (obstacle && !(obj->getRelationship(obstacle)==ENEMIES)) { - movementValid = true; - dozerHack = true; - } - } - } - if (!movementValid && !m_isTunneling) { - continue; + if (!movementValid && obj->isKindOf(KINDOF_DOZER) && newCell->getType() == PathfindCell::CELL_OBSTACLE) { + Object* obstacle = TheGameLogic->findObjectByID(newCell->getObstacleID()); + if (obstacle && !(obj->getRelationship(obstacle) == ENEMIES)) { + movementValid = true; + dozerHack = true; } } + + if (!movementValid && !m_isTunneling) { + continue; + } + if (!dozerHack) neighborFlags[i] = true; @@ -5615,10 +5602,12 @@ Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell * } movementValid = false; } + if (movementValid && !newCell->getPinched()) { //Note to self - only turn off tunneling after check for movement.jba. m_isTunneling = false; } + if (!newCell->hasInfo()) { if (!newCell->allocateInfo(newCellCoord)) { // Out of cells for pathing... @@ -5631,6 +5620,7 @@ Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell * if (info.allyMoving && dx<10 && dy<10) { newCostSoFar += 3*COST_DIAGONAL; } + if (newCell->getType() == PathfindCell::CELL_CLIFF && !newCell->getPinched() ) { Coord3D fromPos; fromPos.x = parentCell->getXIndex() * PATHFIND_CELL_SIZE_F ; @@ -5648,15 +5638,14 @@ Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell * } else if (newCell->getPinched()) { newCostSoFar += COST_ORTHOGONAL; } + newCell->setBlockedByAlly(false); - if (info.allyFixedCount) { - if (canPathThroughUnits) { - newCostSoFar += 3*COST_DIAGONAL*info.allyFixedCount; - } else { + if (info.allyFixedCount>0) { + newCostSoFar += 3*COST_DIAGONAL*info.allyFixedCount; + if (!canPathThroughUnits) newCell->setBlockedByAlly(true); - newCostSoFar += 3*COST_DIAGONAL*info.allyFixedCount; - } } + Int costRemaining = 0; if (goalCell) { if (attackDistance == 0) { @@ -5666,7 +5655,8 @@ Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell * dy = newCellCoord.y - goalCell->getYIndex(); costRemaining = COST_ORTHOGONAL*sqrt(dx*dx + dy*dy); costRemaining -= attackDistance/2; - if (costRemaining<0) costRemaining=0; + if (costRemaining<0) + costRemaining=0; if (info.allyGoal) { if (obj->isKindOf(KINDOF_VEHICLE)) { newCostSoFar += 3*COST_ORTHOGONAL; @@ -5677,26 +5667,21 @@ Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell * } } } + if (notZonePassable) { newCostSoFar += 100*COST_ORTHOGONAL; } + if (newCell->getType()==PathfindCell::CELL_OBSTACLE) { newCostSoFar += 100*COST_ORTHOGONAL; } - // check if this neighbor cell is already on the open (waiting to be tried) - // or closed (already tried) lists - if (onList) - { - // already on one of the lists - if existing costSoFar is less, - // the new cell is on a longer path, so skip it - if (newCell->getCostSoFar() <= newCostSoFar) - continue; - } + if (m_isTunneling) { if (!validMovementPosition( isCrusher, locomotorSet.getValidSurfaces(), newCell, parentCell )) { newCostSoFar += 10*COST_ORTHOGONAL; } } + newCell->setCostSoFar(newCostSoFar); // keep track of path we're building - point back to cell we moved here from newCell->setParentCell(parentCell) ; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 772118600a5..fea7939c173 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -5822,13 +5822,14 @@ Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell * newCell = getCell(parentCell->getLayer(), newCellCoord.x, newCellCoord.y ); // check if cell is on the map - if (newCell == NULL) + if (!newCell) continue; Bool notZonePassable = false; if ((newCell->getLayer()==LAYER_GROUND) && !m_zoneManager.isPassable(newCellCoord.x, newCellCoord.y)) { notZonePassable = true; } + if (isHuman) { // check if new cell is in logical map. (computer can move off logical map) if (newCellCoord.x < m_logicalExtent.lo.x) continue; @@ -5839,18 +5840,9 @@ Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell * // check if this neighbor cell is already on the open (waiting to be tried) // or closed (already tried) lists - Bool onList = false; - if (newCell->hasInfo()) { - if (newCell->getOpen() || newCell->getClosed()) - { - // already on one of the lists - onList = true; - } - } - if (onList) { - // we have already examined this one, so continue. + if ( newCell->hasInfo() && (newCell->getOpen() || newCell->getClosed()) ) continue; - } + if (i>=firstDiagonal) { // make sure one of the adjacent sides is open. if (!neighborFlags[adjacent[i-4]] && !neighborFlags[adjacent[i-3]]) { @@ -5875,24 +5867,20 @@ Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell * continue; } - Bool movementValid = true; + Bool movementValid = validMovementPosition(isCrusher, locomotorSet.getValidSurfaces(), newCell, parentCell); Bool dozerHack = false; - if (validMovementPosition( isCrusher, locomotorSet.getValidSurfaces(), newCell, parentCell )) { - } else { - movementValid = false; - if (obj->isKindOf(KINDOF_DOZER)) { - if (newCell->getType()==PathfindCell::CELL_OBSTACLE) { - Object *obstacle = TheGameLogic->findObjectByID(newCell->getObstacleID()); - if (obstacle && !(obj->getRelationship(obstacle)==ENEMIES)) { - movementValid = true; - dozerHack = true; - } - } - } - if (!movementValid && !m_isTunneling) { - continue; + if (!movementValid && obj->isKindOf(KINDOF_DOZER) && newCell->getType() == PathfindCell::CELL_OBSTACLE) { + Object* obstacle = TheGameLogic->findObjectByID(newCell->getObstacleID()); + if (obstacle && !(obj->getRelationship(obstacle) == ENEMIES)) { + movementValid = true; + dozerHack = true; } } + + if (!movementValid && !m_isTunneling) { + continue; + } + if (!dozerHack) neighborFlags[i] = true; @@ -5915,10 +5903,12 @@ Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell * } movementValid = false; } + if (movementValid && !newCell->getPinched()) { //Note to self - only turn off tunneling after check for movement.jba. m_isTunneling = false; } + if (!newCell->hasInfo()) { if (!newCell->allocateInfo(newCellCoord)) { // Out of cells for pathing... @@ -5931,6 +5921,7 @@ Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell * if (info.allyMoving && dx<10 && dy<10) { newCostSoFar += 3*COST_DIAGONAL; } + if (newCell->getType() == PathfindCell::CELL_CLIFF && !newCell->getPinched() ) { Coord3D fromPos; fromPos.x = parentCell->getXIndex() * PATHFIND_CELL_SIZE_F ; @@ -5948,19 +5939,14 @@ Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell * } else if (newCell->getPinched()) { newCostSoFar += COST_ORTHOGONAL; } + newCell->setBlockedByAlly(false); if (info.allyFixedCount>0) { - Int costFactor = 3*COST_DIAGONAL; - if (attackDistance != NO_ATTACK) { - costFactor = 3*COST_DIAGONAL; - } - if (canPathThroughUnits) { - newCostSoFar += costFactor; - } else { + newCostSoFar += 3*COST_DIAGONAL; + if (!canPathThroughUnits) newCell->setBlockedByAlly(true); - newCostSoFar += costFactor; - } } + Int costRemaining = 0; if (goalCell) { if (attackDistance == NO_ATTACK) { @@ -5970,7 +5956,8 @@ Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell * dy = newCellCoord.y - goalCell->getYIndex(); costRemaining = COST_ORTHOGONAL*sqrt(dx*dx + dy*dy); costRemaining -= attackDistance/2; - if (costRemaining<0) costRemaining=0; + if (costRemaining<0) + costRemaining=0; if (info.allyGoal) { if (obj->isKindOf(KINDOF_VEHICLE)) { newCostSoFar += 3*COST_ORTHOGONAL; @@ -5981,26 +5968,21 @@ Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell * } } } + if (notZonePassable) { newCostSoFar += 100*COST_ORTHOGONAL; } + if (newCell->getType()==PathfindCell::CELL_OBSTACLE) { newCostSoFar += 100*COST_ORTHOGONAL; } - // check if this neighbor cell is already on the open (waiting to be tried) - // or closed (already tried) lists - if (onList) - { - // already on one of the lists - if existing costSoFar is less, - // the new cell is on a longer path, so skip it - if (newCell->getCostSoFar() <= newCostSoFar) - continue; - } + if (m_isTunneling) { if (!validMovementPosition( isCrusher, locomotorSet.getValidSurfaces(), newCell, parentCell )) { newCostSoFar += 10*COST_ORTHOGONAL; } } + newCell->setCostSoFar(newCostSoFar); // keep track of path we're building - point back to cell we moved here from newCell->setParentCell(parentCell) ; From ab2c83524861af1817d013cdfa2beabc4ea51dd6 Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Tue, 30 Sep 2025 19:54:46 +0100 Subject: [PATCH 137/343] refactor(pathfinder): Extract functionality Pathfinder::checkCellOutsideExtents (#1619) --- Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h | 2 ++ .../Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp | 7 +++++++ GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h | 2 ++ .../Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp | 7 +++++++ 4 files changed, 18 insertions(+) diff --git a/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h b/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h index 55e8e7bdcbb..64785c1d201 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h +++ b/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h @@ -825,6 +825,8 @@ class Pathfinder : PathfindServicesInterface, public Snapshot void checkChangeLayers(PathfindCell *parentCell); + bool checkCellOutsideExtents(ICoord2D& cell); + #if defined(RTS_DEBUG) void doDebugIcons(void) ; #endif diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 1de8e1c1259..494ac78b6cf 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -5362,6 +5362,13 @@ void Pathfinder::checkChangeLayers(PathfindCell *parentCell) m_openList = newCell->putOnSortedOpenList( m_openList ); } +bool Pathfinder::checkCellOutsideExtents(ICoord2D& cell) { + return cell.x < m_logicalExtent.lo.x || + cell.x > m_logicalExtent.hi.x || + cell.y < m_logicalExtent.lo.y || + cell.y > m_logicalExtent.hi.y; +} + struct ExamineCellsStruct { diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h index 5f7c012ae93..28b300711cd 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h @@ -833,6 +833,8 @@ class Pathfinder : PathfindServicesInterface, public Snapshot void checkChangeLayers(PathfindCell *parentCell); + bool checkCellOutsideExtents(ICoord2D& cell); + #if defined(RTS_DEBUG) void doDebugIcons(void) ; #endif diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index fea7939c173..0a6ea7dbf98 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -5662,6 +5662,13 @@ void Pathfinder::checkChangeLayers(PathfindCell *parentCell) m_openList = newCell->putOnSortedOpenList( m_openList ); } +bool Pathfinder::checkCellOutsideExtents(ICoord2D& cell) { + return cell.x < m_logicalExtent.lo.x || + cell.x > m_logicalExtent.hi.x || + cell.y < m_logicalExtent.lo.y || + cell.y > m_logicalExtent.hi.y; +} + struct ExamineCellsStruct { From 6c6e05b88208bf2a35b77c3f782ebbb5a0eaa7ef Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Tue, 30 Sep 2025 19:55:30 +0100 Subject: [PATCH 138/343] refactor(pathfinder): Simplify and improve readability of Pathfinder::internal_findHierarchicalPath (#1619) --- .../Source/GameLogic/AI/AIPathfind.cpp | 122 +++++++++--------- .../Source/GameLogic/AI/AIPathfind.cpp | 121 +++++++++-------- 2 files changed, 119 insertions(+), 124 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 494ac78b6cf..d90dc3d4ab8 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -5536,13 +5536,10 @@ Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell * if ((newCell->getLayer()==LAYER_GROUND) && !m_zoneManager.isPassable(newCellCoord.x, newCellCoord.y)) { notZonePassable = true; } - if (isHuman) { - // check if new cell is in logical map. (computer can move off logical map) - if (newCellCoord.x < m_logicalExtent.lo.x) continue; - if (newCellCoord.y < m_logicalExtent.lo.y) continue; - if (newCellCoord.x > m_logicalExtent.hi.x) continue; - if (newCellCoord.y > m_logicalExtent.hi.y) continue; - } + + // check if new cell is in logical map. (computer can move off logical map) + if (isHuman && checkCellOutsideExtents(newCellCoord)) + continue; // check if this neighbor cell is already on the open (waiting to be tried) // or closed (already tried) lists @@ -6825,9 +6822,10 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu // determine goal cell PathfindCell *goalCell = getCell( destinationLayer, cell.x, cell.y ); - if (goalCell == NULL) { + if (!goalCell) { return NULL; } + if (!goalCell->allocateInfo(cell)) { return NULL; } @@ -6836,9 +6834,10 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu ICoord2D startCellNdx; PathfindLayerEnum layer = TheTerrainLogic->getLayerForDestination(from); PathfindCell *parentCell = getClippedCell( layer,&clipFrom ); - if (parentCell == NULL) { + if (!parentCell) { return NULL; } + if (parentCell!=goalCell) { worldToCell(&clipFrom, &startCellNdx); if (!parentCell->allocateInfo(startCellNdx)) { @@ -6879,11 +6878,10 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu goalBlockNdx.y = -1; } - if (parentCell->getLayer()==LAYER_GROUND) { - // initialize "open" list to contain start cell - m_openList = parentCell; - } else { - m_openList = parentCell; + // initialize "open" list to contain start cell + m_openList = parentCell; + + if (parentCell->getLayer()!=LAYER_GROUND) { PathfindLayerEnum layer = parentCell->getLayer(); // We're starting on a bridge, so link to land at the bridge end points. ICoord2D ndx; @@ -7015,12 +7013,16 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu break; } PathfindCell *cell = getCell(LAYER_GROUND, toNdx.x, toNdx.y); - if (cell==NULL) continue; - if (cell->hasInfo() && (cell->getClosed() || cell->getOpen())) { + if (!cell) continue; - } + + if (cell->hasInfo() && (cell->getClosed() || cell->getOpen())) + continue; + PathfindCell *startCell = getCell(LAYER_GROUND, ndx.x, ndx.y); - if (startCell==NULL) continue; + if (!startCell) + continue; + if (startCell != parentCell) { if(!startCell->allocateInfo(ndx)) { // TheSuperHackers @info We need to forcefully cleanup dangling pathfinding cells if this failure condition is hit in retail @@ -7156,20 +7158,19 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu ICoord2D delta; delta.x = -1; // left side moves -1. delta.y = 0; + PathfindCell *cell = getCell(LAYER_GROUND, scanCell.x, scanCell.y); - if (cell==NULL) continue; - if (cell->hasInfo() && (cell->getClosed() || cell->getOpen())) { - if (parentZone == m_zoneManager.getBlockZone(locomotorSurface, - crusher, scanCell.x, scanCell.y, m_map)) { + if (!cell) + continue; + + if ( cell->hasInfo() && (cell->getClosed() || cell->getOpen()) ) { + if (parentZone == m_zoneManager.getBlockZone(locomotorSurface, crusher, scanCell.x, scanCell.y, m_map)) break; - } - } - if (isHuman) { - if (scanCell.x < m_logicalExtent.lo.x || scanCell.x > m_logicalExtent.hi.x || - scanCell.y < m_logicalExtent.lo.y || scanCell.y > m_logicalExtent.hi.y) { - continue; - } } + + if (isHuman && checkCellOutsideExtents(scanCell)) + continue; + processHierarchicalCell(scanCell, delta, parentCell, goalCell, parentZone, examinedZones, numExZones, crusher, cellCount); } @@ -7189,20 +7190,19 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu ICoord2D delta; delta.x = 1; // right side moves +1. delta.y = 0; + PathfindCell *cell = getCell(LAYER_GROUND, scanCell.x, scanCell.y); - if (cell==NULL) continue; - if (cell->hasInfo() && (cell->getClosed() || cell->getOpen())) { - if (parentZone == m_zoneManager.getBlockZone(locomotorSurface, - crusher, scanCell.x, scanCell.y, m_map)) { + if (!cell) + continue; + + if ( cell->hasInfo() && (cell->getClosed() || cell->getOpen()) ) { + if (parentZone == m_zoneManager.getBlockZone(locomotorSurface, crusher, scanCell.x, scanCell.y, m_map)) break; - } - } - if (isHuman) { - if (scanCell.x < m_logicalExtent.lo.x || scanCell.x > m_logicalExtent.hi.x || - scanCell.y < m_logicalExtent.lo.y || scanCell.y > m_logicalExtent.hi.y) { - continue; - } } + + if (isHuman && checkCellOutsideExtents(scanCell)) + continue; + processHierarchicalCell(scanCell, delta, parentCell, goalCell, parentZone, examinedZones, numExZones, crusher, cellCount); } @@ -7221,20 +7221,19 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu ICoord2D delta; delta.x = 0; delta.y = -1; // Top side moves -1. + PathfindCell *cell = getCell(LAYER_GROUND, scanCell.x, scanCell.y); - if (cell==NULL) continue; - if (cell->hasInfo() && (cell->getClosed() || cell->getOpen())) { - if (parentZone == m_zoneManager.getBlockZone(locomotorSurface, - crusher, scanCell.x, scanCell.y, m_map)) { + if (!cell) + continue; + + if ( cell->hasInfo() && (cell->getClosed() || cell->getOpen()) ) { + if (parentZone == m_zoneManager.getBlockZone(locomotorSurface, crusher, scanCell.x, scanCell.y, m_map)) break; - } - } - if (isHuman) { - if (scanCell.x < m_logicalExtent.lo.x || scanCell.x > m_logicalExtent.hi.x || - scanCell.y < m_logicalExtent.lo.y || scanCell.y > m_logicalExtent.hi.y) { - continue; - } } + + if (isHuman && checkCellOutsideExtents(scanCell)) + continue; + processHierarchicalCell(scanCell, delta, parentCell, goalCell, parentZone, examinedZones, numExZones, crusher, cellCount); } @@ -7254,20 +7253,19 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu ICoord2D delta; delta.x = 0; delta.y = 1; // Top side moves +1. + PathfindCell *cell = getCell(LAYER_GROUND, scanCell.x, scanCell.y); - if (cell==NULL) continue; - if (cell->hasInfo() && (cell->getClosed() || cell->getOpen())) { - if (parentZone == m_zoneManager.getBlockZone(locomotorSurface, - crusher, scanCell.x, scanCell.y, m_map)) { + if (!cell) + continue; + + if ( cell->hasInfo() && (cell->getClosed() || cell->getOpen()) ) { + if (parentZone == m_zoneManager.getBlockZone(locomotorSurface, crusher, scanCell.x, scanCell.y, m_map)) break; - } - } - if (isHuman) { - if (scanCell.x < m_logicalExtent.lo.x || scanCell.x > m_logicalExtent.hi.x || - scanCell.y < m_logicalExtent.lo.y || scanCell.y > m_logicalExtent.hi.y) { - continue; - } } + + if (isHuman && checkCellOutsideExtents(scanCell)) + continue; + processHierarchicalCell(scanCell, delta, parentCell, goalCell, parentZone, examinedZones, numExZones, crusher, cellCount); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 0a6ea7dbf98..f85606b87d3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -5837,13 +5837,9 @@ Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell * notZonePassable = true; } - if (isHuman) { - // check if new cell is in logical map. (computer can move off logical map) - if (newCellCoord.x < m_logicalExtent.lo.x) continue; - if (newCellCoord.y < m_logicalExtent.lo.y) continue; - if (newCellCoord.x > m_logicalExtent.hi.x) continue; - if (newCellCoord.y > m_logicalExtent.hi.y) continue; - } + // check if new cell is in logical map. (computer can move off logical map) + if (isHuman && checkCellOutsideExtents(newCellCoord)) + continue; // check if this neighbor cell is already on the open (waiting to be tried) // or closed (already tried) lists @@ -7166,9 +7162,10 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu // determine goal cell PathfindCell *goalCell = getCell( destinationLayer, cell.x, cell.y ); - if (goalCell == NULL) { + if (!goalCell) { return NULL; } + if (!goalCell->allocateInfo(cell)) { return NULL; } @@ -7177,9 +7174,10 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu ICoord2D startCellNdx; PathfindLayerEnum layer = TheTerrainLogic->getLayerForDestination(from); PathfindCell *parentCell = getClippedCell( layer,&clipFrom ); - if (parentCell == NULL) { + if (!parentCell) { return NULL; } + if (parentCell!=goalCell) { worldToCell(&clipFrom, &startCellNdx); if (!parentCell->allocateInfo(startCellNdx)) { @@ -7220,11 +7218,10 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu goalBlockNdx.y = -1; } - if (parentCell->getLayer()==LAYER_GROUND) { - // initialize "open" list to contain start cell - m_openList = parentCell; - } else { - m_openList = parentCell; + // initialize "open" list to contain start cell + m_openList = parentCell; + + if (parentCell->getLayer()!=LAYER_GROUND) { PathfindLayerEnum layer = parentCell->getLayer(); // We're starting on a bridge, so link to land at the bridge end points. ICoord2D ndx; @@ -7356,12 +7353,16 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu break; } PathfindCell *cell = getCell(LAYER_GROUND, toNdx.x, toNdx.y); - if (cell==NULL) continue; - if (cell->hasInfo() && (cell->getClosed() || cell->getOpen())) { + if (!cell) continue; - } + + if (cell->hasInfo() && (cell->getClosed() || cell->getOpen())) + continue; + PathfindCell *startCell = getCell(LAYER_GROUND, ndx.x, ndx.y); - if (startCell==NULL) continue; + if (!startCell) + continue; + if (startCell != parentCell) { if(!startCell->allocateInfo(ndx)) { // TheSuperHackers @info We need to forcefully cleanup dangling pathfinding cells if this failure condition is hit in retail @@ -7497,20 +7498,19 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu ICoord2D delta; delta.x = -1; // left side moves -1. delta.y = 0; + PathfindCell *cell = getCell(LAYER_GROUND, scanCell.x, scanCell.y); - if (cell==NULL) continue; - if (cell->hasInfo() && (cell->getClosed() || cell->getOpen())) { - if (parentZone == m_zoneManager.getBlockZone(locomotorSurface, - crusher, scanCell.x, scanCell.y, m_map)) { + if (!cell) + continue; + + if ( cell->hasInfo() && (cell->getClosed() || cell->getOpen()) ) { + if (parentZone == m_zoneManager.getBlockZone(locomotorSurface, crusher, scanCell.x, scanCell.y, m_map)) break; - } - } - if (isHuman) { - if (scanCell.x < m_logicalExtent.lo.x || scanCell.x > m_logicalExtent.hi.x || - scanCell.y < m_logicalExtent.lo.y || scanCell.y > m_logicalExtent.hi.y) { - continue; - } } + + if (isHuman && checkCellOutsideExtents(scanCell)) + continue; + processHierarchicalCell(scanCell, delta, parentCell, goalCell, parentZone, examinedZones, numExZones, crusher, cellCount); } @@ -7530,20 +7530,19 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu ICoord2D delta; delta.x = 1; // right side moves +1. delta.y = 0; + PathfindCell *cell = getCell(LAYER_GROUND, scanCell.x, scanCell.y); - if (cell==NULL) continue; - if (cell->hasInfo() && (cell->getClosed() || cell->getOpen())) { - if (parentZone == m_zoneManager.getBlockZone(locomotorSurface, - crusher, scanCell.x, scanCell.y, m_map)) { + if (!cell) + continue; + + if ( cell->hasInfo() && (cell->getClosed() || cell->getOpen()) ) { + if (parentZone == m_zoneManager.getBlockZone(locomotorSurface, crusher, scanCell.x, scanCell.y, m_map)) break; - } - } - if (isHuman) { - if (scanCell.x < m_logicalExtent.lo.x || scanCell.x > m_logicalExtent.hi.x || - scanCell.y < m_logicalExtent.lo.y || scanCell.y > m_logicalExtent.hi.y) { - continue; - } } + + if (isHuman && checkCellOutsideExtents(scanCell)) + continue; + processHierarchicalCell(scanCell, delta, parentCell, goalCell, parentZone, examinedZones, numExZones, crusher, cellCount); } @@ -7562,20 +7561,19 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu ICoord2D delta; delta.x = 0; delta.y = -1; // Top side moves -1. + PathfindCell *cell = getCell(LAYER_GROUND, scanCell.x, scanCell.y); - if (cell==NULL) continue; - if (cell->hasInfo() && (cell->getClosed() || cell->getOpen())) { - if (parentZone == m_zoneManager.getBlockZone(locomotorSurface, - crusher, scanCell.x, scanCell.y, m_map)) { + if (!cell) + continue; + + if ( cell->hasInfo() && (cell->getClosed() || cell->getOpen()) ) { + if (parentZone == m_zoneManager.getBlockZone(locomotorSurface, crusher, scanCell.x, scanCell.y, m_map)) break; - } - } - if (isHuman) { - if (scanCell.x < m_logicalExtent.lo.x || scanCell.x > m_logicalExtent.hi.x || - scanCell.y < m_logicalExtent.lo.y || scanCell.y > m_logicalExtent.hi.y) { - continue; - } } + + if (isHuman && checkCellOutsideExtents(scanCell)) + continue; + processHierarchicalCell(scanCell, delta, parentCell, goalCell, parentZone, examinedZones, numExZones, crusher, cellCount); } @@ -7595,20 +7593,19 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu ICoord2D delta; delta.x = 0; delta.y = 1; // Top side moves +1. + PathfindCell *cell = getCell(LAYER_GROUND, scanCell.x, scanCell.y); - if (cell==NULL) continue; - if (cell->hasInfo() && (cell->getClosed() || cell->getOpen())) { - if (parentZone == m_zoneManager.getBlockZone(locomotorSurface, - crusher, scanCell.x, scanCell.y, m_map)) { + if (!cell) + continue; + + if ( cell->hasInfo() && (cell->getClosed() || cell->getOpen()) ) { + if (parentZone == m_zoneManager.getBlockZone(locomotorSurface, crusher, scanCell.x, scanCell.y, m_map)) break; - } - } - if (isHuman) { - if (scanCell.x < m_logicalExtent.lo.x || scanCell.x > m_logicalExtent.hi.x || - scanCell.y < m_logicalExtent.lo.y || scanCell.y > m_logicalExtent.hi.y) { - continue; - } } + + if (isHuman && checkCellOutsideExtents(scanCell)) + continue; + processHierarchicalCell(scanCell, delta, parentCell, goalCell, parentZone, examinedZones, numExZones, crusher, cellCount); } From 172362c54d20f937b198570ed4ed2a94e424fc09 Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Mon, 22 Sep 2025 19:19:02 +0100 Subject: [PATCH 139/343] refactor(pathfinder): Simplify and improve readability of Pathfinder::internalFindPath (#1620) --- .../Source/GameLogic/AI/AIPathfind.cpp | 24 ++++--------------- .../Source/GameLogic/AI/AIPathfind.cpp | 24 ++++--------------- 2 files changed, 8 insertions(+), 40 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index d90dc3d4ab8..a80e7255d84 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -5829,30 +5829,14 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe // to ignore obstacle cells until it reaches a cell that is no longer // classified as an obstacle. At that point, the pathfind behaves normally. // - if (parentCell->getType() == PathfindCell::CELL_OBSTACLE) { - m_isTunneling = true; - } - else { - m_isTunneling = false; - } + m_isTunneling = parentCell->getType() == PathfindCell::CELL_OBSTACLE; Int zone1, zone2; Bool isCrusher = obj ? obj->getCrusherLevel() > 0 : false; zone1 = m_zoneManager.getEffectiveZone(locomotorSet.getValidSurfaces(), isCrusher, parentCell->getZone()); zone2 = m_zoneManager.getEffectiveZone(locomotorSet.getValidSurfaces(), isCrusher, goalCell->getZone()); - if (layer==LAYER_WALL && zone1 == 0) { -#if RETAIL_COMPATIBLE_PATHFINDING - if (s_useFixedPathfinding) -#endif - { - goalCell->releaseInfo(); - parentCell->releaseInfo(); - } - return NULL; - } - - if (destinationLayer==LAYER_WALL && zone2 == 0) { + if ( (layer==LAYER_WALL && zone1 == 0) || (destinationLayer==LAYER_WALL && zone2 == 0) ) { #if RETAIL_COMPATIBLE_PATHFINDING if (s_useFixedPathfinding) #endif @@ -5881,7 +5865,7 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe } // sanity check - if destination is invalid, can't path there - if (validMovementPosition( isCrusher, destinationLayer, locomotorSet, to ) == false) { + if (!validMovementPosition( isCrusher, destinationLayer, locomotorSet, to )) { m_isTunneling = false; goalCell->releaseInfo(); parentCell->releaseInfo(); @@ -5889,7 +5873,7 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe } // sanity check - if source is invalid, we have to cheat - if (validMovementPosition( isCrusher, layer, locomotorSet, from ) == false) { + if (!validMovementPosition( isCrusher, layer, locomotorSet, from )) { // somehow we got to an impassable location. m_isTunneling = true; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index f85606b87d3..d4cb98a4e83 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -6129,30 +6129,14 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe // to ignore obstacle cells until it reaches a cell that is no longer // classified as an obstacle. At that point, the pathfind behaves normally. // - if (parentCell->getType() == PathfindCell::CELL_OBSTACLE) { - m_isTunneling = true; - } - else { - m_isTunneling = false; - } + m_isTunneling = parentCell->getType() == PathfindCell::CELL_OBSTACLE; Int zone1, zone2; Bool isCrusher = obj ? obj->getCrusherLevel() > 0 : false; zone1 = m_zoneManager.getEffectiveZone(locomotorSet.getValidSurfaces(), isCrusher, parentCell->getZone()); zone2 = m_zoneManager.getEffectiveZone(locomotorSet.getValidSurfaces(), isCrusher, goalCell->getZone()); - if (layer==LAYER_WALL && zone1 == 0) { -#if RETAIL_COMPATIBLE_PATHFINDING - if (s_useFixedPathfinding) -#endif - { - goalCell->releaseInfo(); - parentCell->releaseInfo(); - } - return NULL; - } - - if (destinationLayer==LAYER_WALL && zone2 == 0) { + if ( (layer==LAYER_WALL && zone1 == 0) || (destinationLayer==LAYER_WALL && zone2 == 0) ) { #if RETAIL_COMPATIBLE_PATHFINDING if (s_useFixedPathfinding) #endif @@ -6181,7 +6165,7 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe } // sanity check - if destination is invalid, can't path there - if (validMovementPosition( isCrusher, destinationLayer, locomotorSet, to ) == false) { + if (!validMovementPosition( isCrusher, destinationLayer, locomotorSet, to )) { m_isTunneling = false; goalCell->releaseInfo(); parentCell->releaseInfo(); @@ -6189,7 +6173,7 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe } // sanity check - if source is invalid, we have to cheat - if (validMovementPosition( isCrusher, layer, locomotorSet, from ) == false) { + if (!validMovementPosition( isCrusher, layer, locomotorSet, from )) { // somehow we got to an impassable location. m_isTunneling = true; } From 455b8e8427ec842f4bf9a8326de572e07fd552cd Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Mon, 22 Sep 2025 19:26:02 +0100 Subject: [PATCH 140/343] refactor(pathfinder): Simplify and improve readability of Pathfinder::validLocomotorSurfacesForCellType (#1620) --- .../Source/GameLogic/AI/AIPathfind.cpp | 38 +++++++++-------- .../Source/GameLogic/AI/AIPathfind.cpp | 42 +++++++++---------- 2 files changed, 41 insertions(+), 39 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index a80e7255d84..8420bc6bb78 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -4204,25 +4204,27 @@ Locomotor* Pathfinder::chooseBestLocomotorForPosition(PathfindLayerEnum layer, L /*static*/ LocomotorSurfaceTypeMask Pathfinder::validLocomotorSurfacesForCellType(PathfindCell::CellType t) { - if (t == PathfindCell::CELL_OBSTACLE) { - return LOCOMOTORSURFACE_AIR; - } - if (t == PathfindCell::CELL_IMPASSABLE) { - return LOCOMOTORSURFACE_AIR; - } - if (t==PathfindCell::CELL_CLEAR) { - return LOCOMOTORSURFACE_GROUND | LOCOMOTORSURFACE_AIR; - } - if (t == PathfindCell::CELL_WATER) { - return LOCOMOTORSURFACE_WATER | LOCOMOTORSURFACE_AIR; - } - if (t == PathfindCell::CELL_RUBBLE) { - return LOCOMOTORSURFACE_RUBBLE | LOCOMOTORSURFACE_AIR; - } - if ( t == PathfindCell::CELL_CLIFF ) { - return LOCOMOTORSURFACE_CLIFF | LOCOMOTORSURFACE_AIR; + switch (t) + { + case PathfindCell::CELL_CLEAR: + return LOCOMOTORSURFACE_GROUND | LOCOMOTORSURFACE_AIR; + + case PathfindCell::CELL_WATER: + return LOCOMOTORSURFACE_WATER | LOCOMOTORSURFACE_AIR; + + case PathfindCell::CELL_CLIFF: + return LOCOMOTORSURFACE_CLIFF | LOCOMOTORSURFACE_AIR; + + case PathfindCell::CELL_RUBBLE: + return LOCOMOTORSURFACE_RUBBLE | LOCOMOTORSURFACE_AIR; + + case PathfindCell::CELL_OBSTACLE: + case PathfindCell::CELL_IMPASSABLE: + return LOCOMOTORSURFACE_AIR; + + default: + return NO_SURFACES; } - return NO_SURFACES; } // diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index d4cb98a4e83..1b57b24ff77 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -4487,28 +4487,28 @@ Locomotor* Pathfinder::chooseBestLocomotorForPosition(PathfindLayerEnum layer, L /*static*/ LocomotorSurfaceTypeMask Pathfinder::validLocomotorSurfacesForCellType(PathfindCell::CellType t) { - if (t == PathfindCell::CELL_OBSTACLE) { - return LOCOMOTORSURFACE_AIR; - } - if (t == PathfindCell::CELL_IMPASSABLE) { - return LOCOMOTORSURFACE_AIR; - } - if (t == PathfindCell::CELL_BRIDGE_IMPASSABLE) { - return LOCOMOTORSURFACE_AIR; - } - if (t==PathfindCell::CELL_CLEAR) { - return LOCOMOTORSURFACE_GROUND | LOCOMOTORSURFACE_AIR; - } - if (t == PathfindCell::CELL_WATER) { - return LOCOMOTORSURFACE_WATER | LOCOMOTORSURFACE_AIR; - } - if (t == PathfindCell::CELL_RUBBLE) { - return LOCOMOTORSURFACE_RUBBLE | LOCOMOTORSURFACE_AIR; - } - if ( t == PathfindCell::CELL_CLIFF ) { - return LOCOMOTORSURFACE_CLIFF | LOCOMOTORSURFACE_AIR; + switch (t) + { + case PathfindCell::CELL_CLEAR: + return LOCOMOTORSURFACE_GROUND | LOCOMOTORSURFACE_AIR; + + case PathfindCell::CELL_WATER: + return LOCOMOTORSURFACE_WATER | LOCOMOTORSURFACE_AIR; + + case PathfindCell::CELL_CLIFF: + return LOCOMOTORSURFACE_CLIFF | LOCOMOTORSURFACE_AIR; + + case PathfindCell::CELL_RUBBLE: + return LOCOMOTORSURFACE_RUBBLE | LOCOMOTORSURFACE_AIR; + + case PathfindCell::CELL_OBSTACLE: + case PathfindCell::CELL_BRIDGE_IMPASSABLE: + case PathfindCell::CELL_IMPASSABLE: + return LOCOMOTORSURFACE_AIR; + + default: + return NO_SURFACES; } - return NO_SURFACES; } // From 3ce09e566f548a01d7da05cd35eef6bcaf8a444d Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Mon, 22 Sep 2025 19:45:30 +0100 Subject: [PATCH 141/343] refactor(pathfinder): Simplify and improve readability of Pathfinder::findAttackPath (#1620) --- .../Source/GameLogic/AI/AIPathfind.cpp | 61 ++++++++++--------- .../Source/GameLogic/AI/AIPathfind.cpp | 61 ++++++++++--------- 2 files changed, 66 insertions(+), 56 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 8420bc6bb78..31a72204f47 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -10007,7 +10007,8 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomotorSet, const Coord3D *from, const Object *victim, const Coord3D* victimPos, const Weapon *weapon ) { - if (m_isMapReady == false) return NULL; // Should always be ok. + if (!m_isMapReady) + return NULL; // Should always be ok. Bool isCrusher = obj ? obj->getCrusherLevel() > 0 : false; Int radius; @@ -10032,26 +10033,30 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot ICoord2D cellNdx; worldToCell(&testPos, &cellNdx); PathfindCell *aCell = getCell(obj->getLayer(), cellNdx.x, cellNdx.y); - if (aCell==NULL) break; - if (!validMovementPosition( isCrusher, locomotorSet.getValidSurfaces(), aCell )) { + if (!aCell) break; - } - if (!checkDestination(obj, cellNdx.x, cellNdx.y, obj->getLayer(), radius, centerInCell)) { + + if (!validMovementPosition(isCrusher, locomotorSet.getValidSurfaces(), aCell)) break; + + if (!checkDestination(obj, cellNdx.x, cellNdx.y, obj->getLayer(), radius, centerInCell)) + break; + + if (!weapon->isGoalPosWithinAttackRange(obj, &testPos, victim, victimPos)) + continue; + + if (isAttackViewBlockedByObstacle(obj, testPos, victim, *victimPos)) + continue; + + // return path. + Path *path = newInstance(Path); + path->prependNode( &testPos, obj->getLayer() ); + path->prependNode( &curPos, obj->getLayer() ); + path->getFirstNode()->setNextOptimized(path->getFirstNode()->getNext()); + if (TheGlobalData->m_debugAI==AI_DEBUG_PATHS) { + setDebugPath(path); } - if (weapon->isGoalPosWithinAttackRange(obj, &testPos, victim, victimPos)) { - if (!isAttackViewBlockedByObstacle(obj, testPos, victim, *victimPos)) { - // return path. - Path *path = newInstance(Path); - path->prependNode( &testPos, obj->getLayer() ); - path->prependNode( &curPos, obj->getLayer() ); - path->getFirstNode()->setNextOptimized(path->getFirstNode()->getNext()); - if (TheGlobalData->m_debugAI==AI_DEBUG_PATHS) { - setDebugPath(path); - } - return path; - } - } + return path; } } @@ -10084,18 +10089,19 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot objPos.x += PATHFIND_CELL_SIZE_F/2.0f; objPos.y += PATHFIND_CELL_SIZE_F/2.0f; } + + if (!obj->getAIUpdateInterface()) // shouldn't happen, but can't move without an ai. + return NULL; + worldToCell(&objPos, &startCellNdx); PathfindCell *parentCell = getClippedCell( obj->getLayer(), &objPos ); - if (parentCell == NULL) + if (!parentCell) return NULL; - if (!obj->getAIUpdateInterface()) { - return NULL; // shouldn't happen, but can't move it without an ai. - } - const PathfindCell *startCell = parentCell; - if (!parentCell->allocateInfo(startCellNdx)) { + if (!parentCell->allocateInfo(startCellNdx)) return NULL; - } + + const PathfindCell *startCell = parentCell; parentCell->startPathfind(NULL); // determine start cell @@ -10104,7 +10110,7 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot // determine goal cell PathfindCell *goalCell = getCell( LAYER_GROUND, victimCellNdx.x, victimCellNdx.y ); - if (goalCell == NULL) + if (!goalCell) return NULL; if (!goalCell->allocateInfo(victimCellNdx)) { @@ -10215,8 +10221,7 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot return path; } } - if (checkDestination(obj, parentCell->getXIndex(), parentCell->getYIndex(), - parentCell->getLayer(), radius, centerInCell)) { + if (checkDestination(obj, parentCell->getXIndex(), parentCell->getYIndex(), parentCell->getLayer(), radius, centerInCell)) { if (validMovementPosition( isCrusher, locomotorSet.getValidSurfaces(), parentCell )) { Real dx = IABS(victimCellNdx.x-parentCell->getXIndex()); Real dy = IABS(victimCellNdx.y-parentCell->getYIndex()); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 1b57b24ff77..1411ad98e82 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -10431,7 +10431,8 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomotorSet, const Coord3D *from, const Object *victim, const Coord3D* victimPos, const Weapon *weapon ) { - if (m_isMapReady == false) return NULL; // Should always be ok. + if (!m_isMapReady) + return NULL; // Should always be ok. Bool isCrusher = obj ? obj->getCrusherLevel() > 0 : false; Int radius; @@ -10456,26 +10457,30 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot ICoord2D cellNdx; worldToCell(&testPos, &cellNdx); PathfindCell *aCell = getCell(obj->getLayer(), cellNdx.x, cellNdx.y); - if (aCell==NULL) break; - if (!validMovementPosition( isCrusher, locomotorSet.getValidSurfaces(), aCell )) { + if (!aCell) break; - } - if (!checkDestination(obj, cellNdx.x, cellNdx.y, obj->getLayer(), radius, centerInCell)) { + + if (!validMovementPosition(isCrusher, locomotorSet.getValidSurfaces(), aCell)) break; + + if (!checkDestination(obj, cellNdx.x, cellNdx.y, obj->getLayer(), radius, centerInCell)) + break; + + if (!weapon->isGoalPosWithinAttackRange(obj, &testPos, victim, victimPos)) + continue; + + if (isAttackViewBlockedByObstacle(obj, testPos, victim, *victimPos)) + continue; + + // return path. + Path *path = newInstance(Path); + path->prependNode( &testPos, obj->getLayer() ); + path->prependNode( &curPos, obj->getLayer() ); + path->getFirstNode()->setNextOptimized(path->getFirstNode()->getNext()); + if (TheGlobalData->m_debugAI==AI_DEBUG_PATHS) { + setDebugPath(path); } - if (weapon->isGoalPosWithinAttackRange(obj, &testPos, victim, victimPos)) { - if (!isAttackViewBlockedByObstacle(obj, testPos, victim, *victimPos)) { - // return path. - Path *path = newInstance(Path); - path->prependNode( &testPos, obj->getLayer() ); - path->prependNode( &curPos, obj->getLayer() ); - path->getFirstNode()->setNextOptimized(path->getFirstNode()->getNext()); - if (TheGlobalData->m_debugAI==AI_DEBUG_PATHS) { - setDebugPath(path); - } - return path; - } - } + return path; } } @@ -10508,18 +10513,19 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot objPos.x += PATHFIND_CELL_SIZE_F/2.0f; objPos.y += PATHFIND_CELL_SIZE_F/2.0f; } + + if (!obj->getAIUpdateInterface()) // shouldn't happen, but can't move without an ai. + return NULL; + worldToCell(&objPos, &startCellNdx); PathfindCell *parentCell = getClippedCell( obj->getLayer(), &objPos ); - if (parentCell == NULL) + if (!parentCell) return NULL; - if (!obj->getAIUpdateInterface()) { - return NULL; // shouldn't happen, but can't move it without an ai. - } - const PathfindCell *startCell = parentCell; - if (!parentCell->allocateInfo(startCellNdx)) { + if (!parentCell->allocateInfo(startCellNdx)) return NULL; - } + + const PathfindCell *startCell = parentCell; parentCell->startPathfind(NULL); // determine start cell @@ -10528,7 +10534,7 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot // determine goal cell PathfindCell *goalCell = getCell( LAYER_GROUND, victimCellNdx.x, victimCellNdx.y ); - if (goalCell == NULL) + if (!goalCell) return NULL; if (!goalCell->allocateInfo(victimCellNdx)) { @@ -10696,8 +10702,7 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot return path; } } - if (checkDestination(obj, parentCell->getXIndex(), parentCell->getYIndex(), - parentCell->getLayer(), radius, centerInCell)) { + if (checkDestination(obj, parentCell->getXIndex(), parentCell->getYIndex(), parentCell->getLayer(), radius, centerInCell)) { if (validMovementPosition( isCrusher, locomotorSet.getValidSurfaces(), parentCell )) { Real dx = IABS(victimCellNdx.x-parentCell->getXIndex()); Real dy = IABS(victimCellNdx.y-parentCell->getYIndex()); From 487e5ce2daba29ed8f196252580d5d0f0f4a4dc9 Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Mon, 22 Sep 2025 19:51:48 +0100 Subject: [PATCH 142/343] refactor(pathfinder): Simplify and improve readability of Pathfinder::getMoveAwayFromPath (#1620) --- .../Source/GameLogic/AI/AIPathfind.cpp | 27 +++++++------------ .../Source/GameLogic/AI/AIPathfind.cpp | 27 +++++++------------ 2 files changed, 20 insertions(+), 34 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 31a72204f47..9967a654278 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -9596,7 +9596,9 @@ if (g_UT_startTiming) return false; Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, Path *pathToAvoid, Object *otherObj2, Path *pathToAvoid2) { - if (m_isMapReady == false) return NULL; // Should always be ok. + if (!m_isMapReady) + return NULL; // Should always be ok. + #ifdef DEBUG_LOGGING Int startTimeMS = ::GetTickCount(); #endif @@ -9627,11 +9629,12 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, } worldToCell(&startPos, &startCellNdx); PathfindCell *parentCell = getClippedCell( obj->getLayer(), obj->getPosition() ); - if (parentCell == NULL) + if (!parentCell) return NULL; - if (!obj->getAIUpdateInterface()) { - return NULL; // shouldn't happen, but can't move it without an ai. - } + + if (!obj->getAIUpdateInterface()) // shouldn't happen, but can't move it without an ai. + return NULL; + const LocomotorSet& locomotorSet = obj->getAIUpdateInterface()->getLocomotorSet(); m_isTunneling = false; @@ -9686,12 +9689,7 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, bounds.hi.y = cellCenter.y+boxHalfWidth; PathNode *node; Bool overlap = false; - if (obj) { - if (bounds.lo.xgetPosition()->x && bounds.hi.x>obj->getPosition()->x && - bounds.lo.ygetPosition()->y && bounds.hi.y>obj->getPosition()->y) { - //overlap = true; - } - } + for( node = pathToAvoid->getFirstNode(); node && node->getNextOptimized(); node = node->getNextOptimized() ) { Coord2D start, end; start.x = node->getPosition()->x; @@ -9703,12 +9701,7 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, break; } } - if (otherObj) { - if (bounds.lo.xgetPosition()->x && bounds.hi.x>otherObj->getPosition()->x && - bounds.lo.ygetPosition()->y && bounds.hi.y>otherObj->getPosition()->y) { - //overlap = true; - } - } + if (!overlap && pathToAvoid2) { for( node = pathToAvoid2->getFirstNode(); node && node->getNextOptimized(); node = node->getNextOptimized() ) { Coord2D start, end; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 1411ad98e82..93976cd80f0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -10020,7 +10020,9 @@ if (g_UT_startTiming) return false; Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, Path *pathToAvoid, Object *otherObj2, Path *pathToAvoid2) { - if (m_isMapReady == false) return NULL; // Should always be ok. + if (!m_isMapReady) + return NULL; // Should always be ok. + #ifdef DEBUG_LOGGING Int startTimeMS = ::GetTickCount(); #endif @@ -10051,11 +10053,12 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, } worldToCell(&startPos, &startCellNdx); PathfindCell *parentCell = getClippedCell( obj->getLayer(), obj->getPosition() ); - if (parentCell == NULL) + if (!parentCell) return NULL; - if (!obj->getAIUpdateInterface()) { - return NULL; // shouldn't happen, but can't move it without an ai. - } + + if (!obj->getAIUpdateInterface()) // shouldn't happen, but can't move it without an ai. + return NULL; + const LocomotorSet& locomotorSet = obj->getAIUpdateInterface()->getLocomotorSet(); m_isTunneling = false; @@ -10110,12 +10113,7 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, bounds.hi.y = cellCenter.y+boxHalfWidth; PathNode *node; Bool overlap = false; - if (obj) { - if (bounds.lo.xgetPosition()->x && bounds.hi.x>obj->getPosition()->x && - bounds.lo.ygetPosition()->y && bounds.hi.y>obj->getPosition()->y) { - //overlap = true; - } - } + for( node = pathToAvoid->getFirstNode(); node && node->getNextOptimized(); node = node->getNextOptimized() ) { Coord2D start, end; start.x = node->getPosition()->x; @@ -10127,12 +10125,7 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, break; } } - if (otherObj) { - if (bounds.lo.xgetPosition()->x && bounds.hi.x>otherObj->getPosition()->x && - bounds.lo.ygetPosition()->y && bounds.hi.y>otherObj->getPosition()->y) { - //overlap = true; - } - } + if (!overlap && pathToAvoid2) { for( node = pathToAvoid2->getFirstNode(); node && node->getNextOptimized(); node = node->getNextOptimized() ) { Coord2D start, end; From 9697c73e6c1dad689d5a9d63ddb1dc6e045095f2 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Mon, 22 Sep 2025 17:54:26 +0200 Subject: [PATCH 143/343] refactor(jetaiupdate): Rename variable in JetPauseBeforeTakeoffState (#1617) --- .../Object/Update/AIUpdate/JetAIUpdate.cpp | 14 +++++++------- .../Object/Update/AIUpdate/JetAIUpdate.cpp | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp index 2208beac770..11474339ce7 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp @@ -1059,7 +1059,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState xfer->xferVersion( &version, currentVersion ); // set on create. xfer->xferBool(&m_landing); - xfer->xferUnsignedInt(&m_when); + xfer->xferUnsignedInt(&m_whenTakeoff); xfer->xferUnsignedInt(&m_whenTransfer); xfer->xferBool(&m_afterburners); xfer->xferBool(&m_resetTimer); @@ -1071,7 +1071,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState } private: - UnsignedInt m_when; + UnsignedInt m_whenTakeoff; UnsignedInt m_whenTransfer; ObjectID m_waitedForTaxiID; Bool m_resetTimer; @@ -1110,7 +1110,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState public: JetPauseBeforeTakeoffState( StateMachine *machine ) : AIFaceState(machine, false), - m_when(0), + m_whenTakeoff(0), m_whenTransfer(0), m_waitedForTaxiID(INVALID_ID), m_resetTimer(false), @@ -1129,7 +1129,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState jetAI->friend_setTakeoffInProgress(true); jetAI->friend_setLandingInProgress(false); - m_when = 0; + m_whenTakeoff = 0; m_whenTransfer = 0; m_waitedForTaxiID = INVALID_ID; m_resetTimer = false; @@ -1165,7 +1165,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState if (!m_resetTimer) { // we had to wait, but now everyone else is ready, so restart our countdown. - m_when = now + jetAI->friend_getTakeoffPause(); + m_whenTakeoff = now + jetAI->friend_getTakeoffPause(); if (m_waitedForTaxiID == INVALID_ID) { m_waitedForTaxiID = jet->getID(); // just so we don't pick up anyone else @@ -1184,7 +1184,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState m_afterburners = true; } - DEBUG_ASSERTCRASH(m_when != 0, ("hmm")); + DEBUG_ASSERTCRASH(m_whenTakeoff != 0, ("hmm")); DEBUG_ASSERTCRASH(m_whenTransfer != 0, ("hmm")); // once we start the final wait, release the runways for guys behind us, so they can start taxiing @@ -1194,7 +1194,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState pp->transferRunwayReservationToNextInLineForTakeoff(jet->getID()); } - if (now >= m_when) + if (now >= m_whenTakeoff) return superStatus; return STATE_CONTINUE; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp index 05452e14e0e..8c623bd1364 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp @@ -1251,7 +1251,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState xfer->xferVersion( &version, currentVersion ); // set on create. xfer->xferBool(&m_landing); - xfer->xferUnsignedInt(&m_when); + xfer->xferUnsignedInt(&m_whenTakeoff); xfer->xferUnsignedInt(&m_whenTransfer); xfer->xferBool(&m_afterburners); xfer->xferBool(&m_resetTimer); @@ -1263,7 +1263,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState } private: - UnsignedInt m_when; + UnsignedInt m_whenTakeoff; UnsignedInt m_whenTransfer; ObjectID m_waitedForTaxiID; Bool m_resetTimer; @@ -1302,7 +1302,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState public: JetPauseBeforeTakeoffState( StateMachine *machine ) : AIFaceState(machine, false), - m_when(0), + m_whenTakeoff(0), m_whenTransfer(0), m_waitedForTaxiID(INVALID_ID), m_resetTimer(false), @@ -1321,7 +1321,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState jetAI->friend_setTakeoffInProgress(true); jetAI->friend_setLandingInProgress(false); - m_when = 0; + m_whenTakeoff = 0; m_whenTransfer = 0; m_waitedForTaxiID = INVALID_ID; m_resetTimer = false; @@ -1357,7 +1357,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState if (!m_resetTimer) { // we had to wait, but now everyone else is ready, so restart our countdown. - m_when = now + jetAI->friend_getTakeoffPause(); + m_whenTakeoff = now + jetAI->friend_getTakeoffPause(); if (m_waitedForTaxiID == INVALID_ID) { m_waitedForTaxiID = jet->getID(); // just so we don't pick up anyone else @@ -1376,7 +1376,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState m_afterburners = true; } - DEBUG_ASSERTCRASH(m_when != 0, ("hmm")); + DEBUG_ASSERTCRASH(m_whenTakeoff != 0, ("hmm")); DEBUG_ASSERTCRASH(m_whenTransfer != 0, ("hmm")); // once we start the final wait, release the runways for guys behind us, so they can start taxiing @@ -1386,7 +1386,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState pp->transferRunwayReservationToNextInLineForTakeoff(jet->getID()); } - if (now >= m_when) + if (now >= m_whenTakeoff) return superStatus; return STATE_CONTINUE; From 4eeb20ebeef100d6173ec4d4f38e7b6f53080ab0 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Mon, 22 Sep 2025 17:58:56 +0200 Subject: [PATCH 144/343] bugfix(jetaiupdate): Fix pairs of Jets not waiting for each other before takeoff (#1617) --- .../Include/GameLogic/Module/BehaviorModule.h | 6 + .../GameLogic/Module/ParkingPlaceBehavior.h | 3 +- .../Object/Behavior/ParkingPlaceBehavior.cpp | 15 ++ .../Object/Update/AIUpdate/JetAIUpdate.cpp | 154 +++++++++++++++++- .../Include/GameLogic/Module/BehaviorModule.h | 6 + .../GameLogic/Module/FlightDeckBehavior.h | 1 + .../GameLogic/Module/ParkingPlaceBehavior.h | 3 +- .../Object/Behavior/FlightDeckBehavior.cpp | 15 ++ .../Object/Behavior/ParkingPlaceBehavior.cpp | 15 ++ .../Object/Update/AIUpdate/JetAIUpdate.cpp | 154 +++++++++++++++++- 10 files changed, 352 insertions(+), 20 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/BehaviorModule.h b/Generals/Code/GameEngine/Include/GameLogic/Module/BehaviorModule.h index 65e8357e294..ed25d3636a4 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/BehaviorModule.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/BehaviorModule.h @@ -202,6 +202,11 @@ class BehaviorModule : public ObjectModule, public BehaviorModuleInterface inline BehaviorModule::BehaviorModule( Thing *thing, const ModuleData* moduleData ) : ObjectModule( thing, moduleData ) { } inline BehaviorModule::~BehaviorModule() { } +enum +{ + InvalidRunway = -1, +}; + //------------------------------------------------------------------------------------------------- class ParkingPlaceBehaviorInterface { @@ -224,6 +229,7 @@ class ParkingPlaceBehaviorInterface virtual void releaseSpace(ObjectID id) = 0; virtual Bool reserveRunway(ObjectID id, Bool forLanding) = 0; virtual void releaseRunway(ObjectID id) = 0; + virtual Int getRunwayIndex(ObjectID id) = 0; virtual Int getRunwayCount() const = 0; virtual ObjectID getRunwayReservation(Int r) = 0; virtual void transferRunwayReservationToNextInLineForTakeoff(ObjectID id) = 0; diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h b/Generals/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h index df445a10bdd..23b421101aa 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h @@ -130,8 +130,8 @@ class ParkingPlaceBehavior : public UpdateModule, Bool reserveSpace(ObjectID id, Real parkingOffset, PPInfo* info); void releaseSpace(ObjectID id); Bool reserveRunway(ObjectID id, Bool forLanding); - Bool postponeRunwayReservation(UnsignedInt spaceIndex, Bool forLanding); void releaseRunway(ObjectID id); + virtual Int getRunwayIndex(ObjectID id); Int getRunwayCount() const { return m_runways.size(); } ObjectID getRunwayReservation(Int r); void transferRunwayReservationToNextInLineForTakeoff(ObjectID id); @@ -191,6 +191,7 @@ class ParkingPlaceBehavior : public UpdateModule, UnsignedInt m_nextHealFrame; Bool m_gotInfo; + Bool postponeRunwayReservation(UnsignedInt spaceIndex, Bool forLanding); void buildInfo(); void purgeDead(); void resetWakeFrame(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp index f51d9172177..d9a9abb50d9 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp @@ -392,6 +392,21 @@ void ParkingPlaceBehavior::releaseSpace(ObjectID id) } } +//------------------------------------------------------------------------------------------------- +Int ParkingPlaceBehavior::getRunwayIndex(ObjectID id) +{ + purgeDead(); + + for (std::vector::iterator it = m_spaces.begin(); it != m_spaces.end(); ++it) + { + if (it->m_objectInSpace == id) + { + return it->m_runway; + } + } + return InvalidRunway; +} + //------------------------------------------------------------------------------------------------- ObjectID ParkingPlaceBehavior::getRunwayReservation(Int runway) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp index 11474339ce7..08258ee868a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp @@ -1054,17 +1054,37 @@ class JetPauseBeforeTakeoffState : public AIFaceState virtual void xfer( Xfer *xfer ) { // version +#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE XferVersion currentVersion = 1; +#else + XferVersion currentVersion = 2; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); // set on create. xfer->xferBool(&m_landing); xfer->xferUnsignedInt(&m_whenTakeoff); xfer->xferUnsignedInt(&m_whenTransfer); - xfer->xferBool(&m_afterburners); - xfer->xferBool(&m_resetTimer); + +#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE + if (version <= 1) + { + xfer->xferBool(&m_afterburners); + xfer->xferBool(&m_resetTimer); + } +#else + if (version <= 1) + { + Bool afterburners = false; + Bool resetTimer = false; + xfer->xferBool(&afterburners); + xfer->xferBool(&resetTimer); + } +#endif + xfer->xferObjectID(&m_waitedForTaxiID); } + virtual void loadPostProcess() { // empty. jba. @@ -1074,9 +1094,12 @@ class JetPauseBeforeTakeoffState : public AIFaceState UnsignedInt m_whenTakeoff; UnsignedInt m_whenTransfer; ObjectID m_waitedForTaxiID; +#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE Bool m_resetTimer; Bool m_afterburners; +#endif +#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE Bool findWaiter() { Object* jet = getMachineOwner(); @@ -1106,15 +1129,50 @@ class JetPauseBeforeTakeoffState : public AIFaceState } return false; } +#else + Object* findJetToWaitFor() const + { + const Object* thisJet = getMachineOwner(); + ParkingPlaceBehaviorInterface* pp = getPP(getMachineOwner()->getProducerID()); + + if (pp != NULL) + { + const Int thisJetRunway = pp->getRunwayIndex(thisJet->getID()); + const Int runwayCount = pp->getRunwayCount(); + + for (Int runway = 0; runway < runwayCount; ++runway) + { + if (runway == thisJetRunway) + continue; + + Object* otherJet = TheGameLogic->findObjectByID(pp->getRunwayReservation(runway)); + if (otherJet == NULL) + continue; + + AIUpdateInterface* ai = otherJet->getAIUpdateInterface(); + if (ai == NULL) + continue; + + if (ai->getCurrentStateID() != TAXI_TO_TAKEOFF) + continue; + + return otherJet; + } + } + return NULL; + } +#endif public: - JetPauseBeforeTakeoffState( StateMachine *machine ) : - AIFaceState(machine, false), - m_whenTakeoff(0), - m_whenTransfer(0), - m_waitedForTaxiID(INVALID_ID), - m_resetTimer(false), - m_afterburners(false) + JetPauseBeforeTakeoffState( StateMachine *machine ) + : AIFaceState(machine, false) + , m_whenTakeoff(0) + , m_whenTransfer(0) + , m_waitedForTaxiID(INVALID_ID) +#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE + , m_resetTimer(false) + , m_afterburners(false) +#endif { // nothing } @@ -1132,8 +1190,10 @@ class JetPauseBeforeTakeoffState : public AIFaceState m_whenTakeoff = 0; m_whenTransfer = 0; m_waitedForTaxiID = INVALID_ID; +#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE m_resetTimer = false; m_afterburners = false; +#endif ParkingPlaceBehaviorInterface* pp = getPP(jet->getProducerID()); if (pp == NULL) @@ -1148,6 +1208,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState return AIFaceState::onEnter(); } +#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE virtual StateReturnType update() { Object* jet = getMachineOwner(); @@ -1199,6 +1260,81 @@ class JetPauseBeforeTakeoffState : public AIFaceState return STATE_CONTINUE; } +#else + // TheSuperHackers @bugfix Reimplements the update to wait for another Jet on another runway. + // If this must work with more than 2 runways, then this logic needs another look. + virtual StateReturnType update() + { + Object* jet = getMachineOwner(); + JetAIUpdate* jetAI = (JetAIUpdate*)jet->getAIUpdateInterface(); + + if (jet->isEffectivelyDead()) + return STATE_FAILURE; + + // always call this. + StateReturnType superStatus = AIFaceState::update(); + + if (Object* otherJet = findJetToWaitFor()) + { + // Found a jet on another runway to wait for. + if (m_waitedForTaxiID == INVALID_ID) + { + // Save the other Jet to wait for. + m_waitedForTaxiID = otherJet->getID(); + } + + if (m_waitedForTaxiID == otherJet->getID()) + { + // Wait for the other Jet to get ready. + return STATE_CONTINUE; + } + } + + const UnsignedInt now = TheGameLogic->getFrame(); + + if (m_whenTakeoff == 0) + { + // The other Jet (if any) is ready. Prepare runway transfer and takeoff. + // Transfer the runway after one or two frames earliest to give the other + // Jet a chance to update as well before the runway is transfered. + if (m_waitedForTaxiID == INVALID_ID) + { + // Do not wait for any other Jet from now on. + m_waitedForTaxiID = jet->getID(); + m_whenTransfer = now + 1; + } + else + { + m_whenTransfer = now + 2; // 2 seems odd, but is correct + } + + // Take off soon, but not before the runway transfer. + m_whenTakeoff = std::max(m_whenTransfer, now + jetAI->friend_getTakeoffPause()); + jetAI->friend_enableAfterburners(true); + } + else + { + // once we start the final wait, release the runways for guys behind us, so they can start taxiing + if (now >= m_whenTransfer) + { + if (ParkingPlaceBehaviorInterface* pp = getPP(jet->getProducerID())) + { + pp->transferRunwayReservationToNextInLineForTakeoff(jet->getID()); + } + // Do not transfer the runway again in the next update. + m_whenTransfer = ~0u; + } + + if (now >= m_whenTakeoff) + { + // Ready to take off! + return superStatus; + } + } + + return STATE_CONTINUE; + } +#endif virtual void onExit(StateExitType status) { diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BehaviorModule.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BehaviorModule.h index 2653fcedf5e..0c013932f29 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BehaviorModule.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BehaviorModule.h @@ -213,6 +213,11 @@ enum RunwayReservationType CPP_11(: Int) RESERVATION_LANDING, }; +enum +{ + InvalidRunway = -1, +}; + //------------------------------------------------------------------------------------------------- class ParkingPlaceBehaviorInterface { @@ -241,6 +246,7 @@ class ParkingPlaceBehaviorInterface virtual Bool reserveRunway(ObjectID id, Bool forLanding) = 0; virtual void calcPPInfo( ObjectID id, PPInfo *info ) = 0; virtual void releaseRunway(ObjectID id) = 0; + virtual Int getRunwayIndex(ObjectID id) = 0; virtual Int getRunwayCount() const = 0; virtual ObjectID getRunwayReservation( Int r, RunwayReservationType type = RESERVATION_TAKEOFF ) = 0; virtual void transferRunwayReservationToNextInLineForTakeoff(ObjectID id) = 0; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FlightDeckBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FlightDeckBehavior.h index 693a15244cc..c74f4234e76 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FlightDeckBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FlightDeckBehavior.h @@ -139,6 +139,7 @@ class FlightDeckBehavior : public AIUpdateInterface, virtual Bool reserveRunway(ObjectID id, Bool forLanding); virtual void releaseRunway(ObjectID id); virtual void calcPPInfo( ObjectID id, PPInfo *info ); + virtual Int getRunwayIndex(ObjectID id); virtual Int getRunwayCount() const { return m_runways.size(); } virtual ObjectID getRunwayReservation( Int r, RunwayReservationType type ); virtual void transferRunwayReservationToNextInLineForTakeoff(ObjectID id); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h index 8e0c2d1988a..43b95b5d195 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h @@ -140,9 +140,9 @@ class ParkingPlaceBehavior : public UpdateModule, virtual Bool reserveSpace(ObjectID id, Real parkingOffset, PPInfo* info); virtual void releaseSpace(ObjectID id); virtual Bool reserveRunway(ObjectID id, Bool forLanding); - Bool postponeRunwayReservation(UnsignedInt spaceIndex, Bool forLanding); virtual void releaseRunway(ObjectID id); virtual void calcPPInfo( ObjectID id, PPInfo *info ); + virtual Int getRunwayIndex(ObjectID id); virtual Int getRunwayCount() const { return m_runways.size(); } virtual ObjectID getRunwayReservation( Int r, RunwayReservationType type ); virtual void transferRunwayReservationToNextInLineForTakeoff(ObjectID id); @@ -206,6 +206,7 @@ class ParkingPlaceBehavior : public UpdateModule, UnsignedInt m_nextHealFrame; Bool m_gotInfo; + Bool postponeRunwayReservation(UnsignedInt spaceIndex, Bool forLanding); void buildInfo(); void purgeDead(); void resetWakeFrame(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp index 6b94e64f015..75811f7183e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp @@ -599,6 +599,21 @@ void FlightDeckBehavior::releaseSpace(ObjectID id) } +//------------------------------------------------------------------------------------------------- +Int FlightDeckBehavior::getRunwayIndex(ObjectID id) +{ + purgeDead(); + + for (std::vector::iterator it = m_spaces.begin(); it != m_spaces.end(); ++it) + { + if (it->m_objectInSpace == id) + { + return it->m_runway; + } + } + return InvalidRunway; +} + //------------------------------------------------------------------------------------------------- ObjectID FlightDeckBehavior::getRunwayReservation( Int runway, RunwayReservationType type ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp index 0ff6a2003c2..8498e993d1c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp @@ -450,6 +450,21 @@ void ParkingPlaceBehavior::releaseSpace(ObjectID id) } +//------------------------------------------------------------------------------------------------- +Int ParkingPlaceBehavior::getRunwayIndex(ObjectID id) +{ + purgeDead(); + + for (std::vector::iterator it = m_spaces.begin(); it != m_spaces.end(); ++it) + { + if (it->m_objectInSpace == id) + { + return it->m_runway; + } + } + return InvalidRunway; +} + //------------------------------------------------------------------------------------------------- ObjectID ParkingPlaceBehavior::getRunwayReservation( Int runway, RunwayReservationType type ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp index 8c623bd1364..5d5189ed68a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp @@ -1246,17 +1246,37 @@ class JetPauseBeforeTakeoffState : public AIFaceState virtual void xfer( Xfer *xfer ) { // version +#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE XferVersion currentVersion = 1; +#else + XferVersion currentVersion = 2; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); // set on create. xfer->xferBool(&m_landing); xfer->xferUnsignedInt(&m_whenTakeoff); xfer->xferUnsignedInt(&m_whenTransfer); - xfer->xferBool(&m_afterburners); - xfer->xferBool(&m_resetTimer); + +#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE + if (version <= 1) + { + xfer->xferBool(&m_afterburners); + xfer->xferBool(&m_resetTimer); + } +#else + if (version <= 1) + { + Bool afterburners = false; + Bool resetTimer = false; + xfer->xferBool(&afterburners); + xfer->xferBool(&resetTimer); + } +#endif + xfer->xferObjectID(&m_waitedForTaxiID); } + virtual void loadPostProcess() { // empty. jba. @@ -1266,9 +1286,12 @@ class JetPauseBeforeTakeoffState : public AIFaceState UnsignedInt m_whenTakeoff; UnsignedInt m_whenTransfer; ObjectID m_waitedForTaxiID; +#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE Bool m_resetTimer; Bool m_afterburners; +#endif +#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE Bool findWaiter() { Object* jet = getMachineOwner(); @@ -1298,15 +1321,50 @@ class JetPauseBeforeTakeoffState : public AIFaceState } return false; } +#else + Object* findJetToWaitFor() const + { + const Object* thisJet = getMachineOwner(); + ParkingPlaceBehaviorInterface* pp = getPP(getMachineOwner()->getProducerID()); + + if (pp != NULL) + { + const Int thisJetRunway = pp->getRunwayIndex(thisJet->getID()); + const Int runwayCount = pp->getRunwayCount(); + + for (Int runway = 0; runway < runwayCount; ++runway) + { + if (runway == thisJetRunway) + continue; + + Object* otherJet = TheGameLogic->findObjectByID(pp->getRunwayReservation(runway, RESERVATION_TAKEOFF)); + if (otherJet == NULL) + continue; + + AIUpdateInterface* ai = otherJet->getAIUpdateInterface(); + if (ai == NULL) + continue; + + if (ai->getCurrentStateID() != TAXI_TO_TAKEOFF) + continue; + + return otherJet; + } + } + return NULL; + } +#endif public: - JetPauseBeforeTakeoffState( StateMachine *machine ) : - AIFaceState(machine, false), - m_whenTakeoff(0), - m_whenTransfer(0), - m_waitedForTaxiID(INVALID_ID), - m_resetTimer(false), - m_afterburners(false) + JetPauseBeforeTakeoffState( StateMachine *machine ) + : AIFaceState(machine, false) + , m_whenTakeoff(0) + , m_whenTransfer(0) + , m_waitedForTaxiID(INVALID_ID) +#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE + , m_resetTimer(false) + , m_afterburners(false) +#endif { // nothing } @@ -1324,8 +1382,10 @@ class JetPauseBeforeTakeoffState : public AIFaceState m_whenTakeoff = 0; m_whenTransfer = 0; m_waitedForTaxiID = INVALID_ID; +#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE m_resetTimer = false; m_afterburners = false; +#endif ParkingPlaceBehaviorInterface* pp = getPP(jet->getProducerID()); if (pp == NULL) @@ -1340,6 +1400,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState return AIFaceState::onEnter(); } +#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE virtual StateReturnType update() { Object* jet = getMachineOwner(); @@ -1391,6 +1452,81 @@ class JetPauseBeforeTakeoffState : public AIFaceState return STATE_CONTINUE; } +#else + // TheSuperHackers @bugfix Reimplements the update to wait for another Jet on another runway. + // If this must work with more than 2 runways, then this logic needs another look. + virtual StateReturnType update() + { + Object* jet = getMachineOwner(); + JetAIUpdate* jetAI = (JetAIUpdate*)jet->getAIUpdateInterface(); + + if (jet->isEffectivelyDead()) + return STATE_FAILURE; + + // always call this. + StateReturnType superStatus = AIFaceState::update(); + + if (Object* otherJet = findJetToWaitFor()) + { + // Found a jet on another runway to wait for. + if (m_waitedForTaxiID == INVALID_ID) + { + // Save the other Jet to wait for. + m_waitedForTaxiID = otherJet->getID(); + } + + if (m_waitedForTaxiID == otherJet->getID()) + { + // Wait for the other Jet to get ready. + return STATE_CONTINUE; + } + } + + const UnsignedInt now = TheGameLogic->getFrame(); + + if (m_whenTakeoff == 0) + { + // The other Jet (if any) is ready. Prepare runway transfer and takeoff. + // Transfer the runway after one or two frames earliest to give the other + // Jet a chance to update as well before the runway is transfered. + if (m_waitedForTaxiID == INVALID_ID) + { + // Do not wait for any other Jet from now on. + m_waitedForTaxiID = jet->getID(); + m_whenTransfer = now + 1; + } + else + { + m_whenTransfer = now + 2; // 2 seems odd, but is correct + } + + // Take off soon, but not before the runway transfer. + m_whenTakeoff = std::max(m_whenTransfer, now + jetAI->friend_getTakeoffPause()); + jetAI->friend_enableAfterburners(true); + } + else + { + // once we start the final wait, release the runways for guys behind us, so they can start taxiing + if (now >= m_whenTransfer) + { + if (ParkingPlaceBehaviorInterface* pp = getPP(jet->getProducerID())) + { + pp->transferRunwayReservationToNextInLineForTakeoff(jet->getID()); + } + // Do not transfer the runway again in the next update. + m_whenTransfer = ~0u; + } + + if (now >= m_whenTakeoff) + { + // Ready to take off! + return superStatus; + } + } + + return STATE_CONTINUE; + } +#endif virtual void onExit(StateExitType status) { From 16ff7e43b950fc27fb9b37ad3d7b96a54a7eb98b Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Wed, 8 Oct 2025 03:00:21 +1100 Subject: [PATCH 145/343] bugfix(network): Fix clearing remote player commands in Connection::clearCommandsExceptFrom() to prevent local player left hanging in game over screen (#1638) --- .../GameEngine/Source/GameNetwork/Connection.cpp | 13 +++++++------ .../GameEngine/Source/GameNetwork/Connection.cpp | 13 +++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameNetwork/Connection.cpp b/Generals/Code/GameEngine/Source/GameNetwork/Connection.cpp index b699d081d4e..12c450410b3 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/Connection.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/Connection.cpp @@ -217,18 +217,19 @@ void Connection::clearCommandsExceptFrom( Int playerIndex ) NetCommandRef *tmp = m_netCommandList->getFirstMessage(); while (tmp) { + NetCommandRef *next = tmp->getNext(); NetCommandMsg *msg = tmp->getCommand(); + if (msg->getPlayerID() != playerIndex) { - DEBUG_LOG(("Connection::clearCommandsExceptFrom(%d) - clearing a command from %d for frame %d", + DEBUG_LOG(("Connection::clearCommandsExceptFrom(%d) - clearing a command from player %d for frame %d", playerIndex, tmp->getCommand()->getPlayerID(), tmp->getCommand()->getExecutionFrame())); + m_netCommandList->removeMessage(tmp); - NetCommandRef *toDelete = tmp; - tmp = tmp->getNext(); - deleteInstance(toDelete); - } else { - tmp = tmp->getNext(); + deleteInstance(tmp); } + + tmp = next; } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/Connection.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/Connection.cpp index d0b5e377a6e..e72ee57963e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/Connection.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/Connection.cpp @@ -217,18 +217,19 @@ void Connection::clearCommandsExceptFrom( Int playerIndex ) NetCommandRef *tmp = m_netCommandList->getFirstMessage(); while (tmp) { + NetCommandRef *next = tmp->getNext(); NetCommandMsg *msg = tmp->getCommand(); + if (msg->getPlayerID() != playerIndex) { - DEBUG_LOG(("Connection::clearCommandsExceptFrom(%d) - clearing a command from %d for frame %d", + DEBUG_LOG(("Connection::clearCommandsExceptFrom(%d) - clearing a command from player %d for frame %d", playerIndex, tmp->getCommand()->getPlayerID(), tmp->getCommand()->getExecutionFrame())); + m_netCommandList->removeMessage(tmp); - NetCommandRef *toDelete = tmp; - tmp = tmp->getNext(); - deleteInstance(toDelete); - } else { - tmp = tmp->getNext(); + deleteInstance(tmp); } + + tmp = next; } } From 341bef2ca66bddc9bf9ad7d1aabeb12627c2e162 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 7 Oct 2025 18:20:38 +0200 Subject: [PATCH 146/343] tweak(drawable): Decouple tint update step from render update (#1651) --- .../GameEngine/Include/GameClient/Drawable.h | 2 +- .../GameEngine/Source/GameClient/Drawable.cpp | 38 +++++++++++++++---- .../GameEngine/Include/GameClient/Drawable.h | 2 +- .../GameEngine/Source/GameClient/Drawable.cpp | 38 +++++++++++++++---- 4 files changed, 62 insertions(+), 18 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/Drawable.h b/Generals/Code/GameEngine/Include/GameClient/Drawable.h index 750f76fcf89..9eb79d2058d 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Drawable.h +++ b/Generals/Code/GameEngine/Include/GameClient/Drawable.h @@ -203,7 +203,7 @@ class TintEnvelope : public MemoryPoolObject, public Snapshot Vector3 m_decayRate; ///< step amount to make tint turn off slow or fast Vector3 m_peakColor; ///< um, the peak color, what color we are headed toward during attack Vector3 m_currentColor; ///< um, the current color, how we are colored, now - UnsignedInt m_sustainCounter; + Real m_sustainCounter; Byte m_envState; ///< a randomly switchable SUSTAIN state, release is compliment Bool m_affect; ///< set TRUE if this has any effect (has a non 0,0,0 color). }; diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index 891bd99470f..30232b73e0d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -4784,6 +4784,9 @@ void TintEnvelope::setDecayFrames( UnsignedInt frames ) //------------------------------------------------------------------------------------------------- void TintEnvelope::update(void) { + // TheSuperHackers @tweak The tint time step is now decoupled from the render update. + const Real timeScale = TheGameEngine->getActualLogicTimeScaleOverFpsRatio(); + switch ( m_envState ) { case ( ENVELOPE_STATE_REST ) : //most likely case @@ -4794,25 +4797,31 @@ void TintEnvelope::update(void) } case ( ENVELOPE_STATE_DECAY ) : // much more likely than attack { - if (m_decayRate.Length() > m_currentColor.Length() || m_currentColor.Length() <= FADE_RATE_EPSILON) //we are at rest + const Vector3 decayRate = m_decayRate * timeScale; + + if (decayRate.Length() > m_currentColor.Length() || m_currentColor.Length() <= FADE_RATE_EPSILON) { + // We are at rest m_envState = ENVELOPE_STATE_REST; m_affect = FALSE; } else { - Vector3::Add( m_decayRate, m_currentColor, &m_currentColor );//Add the decayRate to the current color; + // Add the decayRate to the current color + Vector3::Add( decayRate, m_currentColor, &m_currentColor ); m_affect = TRUE; } break; } case ( ENVELOPE_STATE_ATTACK ) : { + const Vector3 attackRate = m_attackRate * timeScale; Vector3 delta; Vector3::Subtract(m_currentColor, m_peakColor, &delta); - if (m_attackRate.Length() > delta.Length() || delta.Length() <= FADE_RATE_EPSILON) //we are at the peak + if (attackRate.Length() > delta.Length() || delta.Length() <= FADE_RATE_EPSILON) { + // We are at the peak if ( m_sustainCounter ) { m_envState = ENVELOPE_STATE_SUSTAIN; @@ -4821,11 +4830,11 @@ void TintEnvelope::update(void) { m_envState = ENVELOPE_STATE_DECAY; } - } else { - Vector3::Add( m_attackRate, m_currentColor, &m_currentColor );//Add the attackRate to the current color; + // Add the attackRate to the current color + Vector3::Add( attackRate, m_currentColor, &m_currentColor ); m_affect = TRUE; } @@ -4833,8 +4842,8 @@ void TintEnvelope::update(void) } case ( ENVELOPE_STATE_SUSTAIN ) : { - if ( m_sustainCounter > 0 ) - --m_sustainCounter; + if ( m_sustainCounter > 0.0f ) + m_sustainCounter -= timeScale; else release(); @@ -4867,7 +4876,11 @@ void TintEnvelope::xfer( Xfer *xfer ) { // version +#if RETAIL_COMPATIBLE_XFER_SAVE XferVersion currentVersion = 1; +#else + XferVersion currentVersion = 2; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -4884,7 +4897,16 @@ void TintEnvelope::xfer( Xfer *xfer ) xfer->xferUser( &m_currentColor, sizeof( Vector3 ) ); // sustain counter - xfer->xferUnsignedInt( &m_sustainCounter ); + if (version <= 1) + { + UnsignedInt sustainCounter = (UnsignedInt)m_sustainCounter; + xfer->xferUnsignedInt( &sustainCounter ); + m_sustainCounter = (Real)sustainCounter; + } + else + { + xfer->xferReal( &m_sustainCounter ); + } // affect xfer->xferBool( &m_affect ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h index 7f320bd4095..56ac630babd 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h @@ -206,7 +206,7 @@ class TintEnvelope : public MemoryPoolObject, public Snapshot Vector3 m_decayRate; ///< step amount to make tint turn off slow or fast Vector3 m_peakColor; ///< um, the peak color, what color we are headed toward during attack Vector3 m_currentColor; ///< um, the current color, how we are colored, now - UnsignedInt m_sustainCounter; + Real m_sustainCounter; Byte m_envState; ///< a randomly switchable SUSTAIN state, release is compliment Bool m_affect; ///< set TRUE if this has any effect (has a non 0,0,0 color). }; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index dce9e2c4127..416da00b5b7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -5541,6 +5541,9 @@ void TintEnvelope::setDecayFrames( UnsignedInt frames ) //------------------------------------------------------------------------------------------------- void TintEnvelope::update(void) { + // TheSuperHackers @tweak The tint time step is now decoupled from the render update. + const Real timeScale = TheGameEngine->getActualLogicTimeScaleOverFpsRatio(); + switch ( m_envState ) { case ( ENVELOPE_STATE_REST ) : //most likely case @@ -5551,25 +5554,31 @@ void TintEnvelope::update(void) } case ( ENVELOPE_STATE_DECAY ) : // much more likely than attack { - if (m_decayRate.Length() > m_currentColor.Length() || m_currentColor.Length() <= FADE_RATE_EPSILON) //we are at rest + const Vector3 decayRate = m_decayRate * timeScale; + + if (decayRate.Length() > m_currentColor.Length() || m_currentColor.Length() <= FADE_RATE_EPSILON) { + // We are at rest m_envState = ENVELOPE_STATE_REST; m_affect = FALSE; } else { - Vector3::Add( m_decayRate, m_currentColor, &m_currentColor );//Add the decayRate to the current color; + // Add the decayRate to the current color + Vector3::Add( decayRate, m_currentColor, &m_currentColor ); m_affect = TRUE; } break; } case ( ENVELOPE_STATE_ATTACK ) : { + const Vector3 attackRate = m_attackRate * timeScale; Vector3 delta; Vector3::Subtract(m_currentColor, m_peakColor, &delta); - if (m_attackRate.Length() > delta.Length() || delta.Length() <= FADE_RATE_EPSILON) //we are at the peak + if (attackRate.Length() > delta.Length() || delta.Length() <= FADE_RATE_EPSILON) { + // We are at the peak if ( m_sustainCounter ) { m_envState = ENVELOPE_STATE_SUSTAIN; @@ -5578,11 +5587,11 @@ void TintEnvelope::update(void) { m_envState = ENVELOPE_STATE_DECAY; } - } else { - Vector3::Add( m_attackRate, m_currentColor, &m_currentColor );//Add the attackRate to the current color; + // Add the attackRate to the current color + Vector3::Add( attackRate, m_currentColor, &m_currentColor ); m_affect = TRUE; } @@ -5590,8 +5599,8 @@ void TintEnvelope::update(void) } case ( ENVELOPE_STATE_SUSTAIN ) : { - if ( m_sustainCounter > 0 ) - --m_sustainCounter; + if ( m_sustainCounter > 0.0f ) + m_sustainCounter -= timeScale; else release(); @@ -5624,7 +5633,11 @@ void TintEnvelope::xfer( Xfer *xfer ) { // version +#if RETAIL_COMPATIBLE_XFER_SAVE XferVersion currentVersion = 1; +#else + XferVersion currentVersion = 2; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -5641,7 +5654,16 @@ void TintEnvelope::xfer( Xfer *xfer ) xfer->xferUser( &m_currentColor, sizeof( Vector3 ) ); // sustain counter - xfer->xferUnsignedInt( &m_sustainCounter ); + if (version <= 1) + { + UnsignedInt sustainCounter = (UnsignedInt)m_sustainCounter; + xfer->xferUnsignedInt( &sustainCounter ); + m_sustainCounter = (Real)sustainCounter; + } + else + { + xfer->xferReal( &m_sustainCounter ); + } // affect xfer->xferBool( &m_affect ); From 605b9b38a4e2d9b9c6546a974f6166d600ab6a22 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 7 Oct 2025 18:24:58 +0200 Subject: [PATCH 147/343] tweak(fps): Simplify function W3DDisplay::updateAverageFPS() and remove its frame spike filter (#1662) --- .../GameEngine/Include/Common/GameEngine.h | 4 +- .../Include/W3DDevice/GameClient/W3DDisplay.h | 2 +- .../W3DDevice/GameClient/W3DDisplay.cpp | 50 ++++++------------- .../GameEngine/Include/Common/GameEngine.h | 4 +- .../Include/W3DDevice/GameClient/W3DDisplay.h | 2 +- .../W3DDevice/GameClient/W3DDisplay.cpp | 50 ++++++------------- 6 files changed, 36 insertions(+), 76 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/GameEngine.h b/Generals/Code/GameEngine/Include/Common/GameEngine.h index 57852123860..90be51a76ca 100644 --- a/Generals/Code/GameEngine/Include/Common/GameEngine.h +++ b/Generals/Code/GameEngine/Include/Common/GameEngine.h @@ -78,7 +78,7 @@ class GameEngine : public SubsystemInterface virtual void setFramesPerSecondLimit( Int fps ); ///< Set the max render and engine update fps. virtual Int getFramesPerSecondLimit( void ); ///< Get the max render and engine update fps. - Real getUpdateTime(); ///< Get the last engine update delta time. + Real getUpdateTime(); ///< Get the last engine update delta time in seconds. Real getUpdateFps(); ///< Get the last engine update fps. static Bool isTimeFrozen(); ///< Returns true if a script has frozen time. @@ -128,7 +128,7 @@ class GameEngine : public SubsystemInterface Int m_maxFPS; ///< Maximum frames per second for rendering Int m_logicTimeScaleFPS; ///< Maximum frames per second for logic time scale - Real m_updateTime; ///< Last engine update delta time + Real m_updateTime; ///< Last engine update delta time in seconds Real m_logicTimeAccumulator; ///< Frame time accumulated towards submitting a new logic frame Bool m_quitting; ///< true when we need to quit the game diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h index ffac86708e5..7f4cdeacee4 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h @@ -161,7 +161,7 @@ class W3DDisplay : public Display void drawCurrentDebugDisplay( void ); ///< draws current debug display void calculateTerrainLOD(void); ///< Calculate terrain LOD. void renderLetterBox(UnsignedInt time); ///< draw letter box border - void updateAverageFPS(void); ///< figure out the average fps over the last 30 frames. + void updateAverageFPS(void); ///< calculate the average fps over the last 30 frames. Byte m_initialized; ///< TRUE when system is initialized LightClass *m_myLight[LightEnvironmentClass::MAX_LIGHTS]; ///< light hack for now diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index c839a8e988d..07d95191074 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -34,6 +34,7 @@ static void drawFramerateBar(void); // SYSTEM INCLUDES //////////////////////////////////////////////////////////// +#include #include #include #include @@ -835,21 +836,16 @@ void W3DDisplay::reset( void ) const UnsignedInt START_CUMU_FRAME = LOGICFRAMES_PER_SECOND / 2; // skip first half-sec -/** Update a moving average of the last 30 fps measurements. Also try to filter out temporary spikes. - This code is designed to be used by the GameLOD sytems to determine the correct dynamic LOD setting. -*/ void W3DDisplay::updateAverageFPS(void) { - const Real MaximumFrameTimeCutoff = 0.5f; //largest frame interval (seconds) we accept before ignoring it as a momentary "spike" - const Int FPS_HISTORY_SIZE = 30; //keep track of the last 30 frames + constexpr const Int FPS_HISTORY_SIZE = 30; static Int64 lastUpdateTime64 = 0; static Int historyOffset = 0; - static Int numSamples = 0; - static double fpsHistory[FPS_HISTORY_SIZE]; + static Real fpsHistory[FPS_HISTORY_SIZE] = {0}; - Int64 freq64 = getPerformanceCounterFrequency(); - Int64 time64 = getPerformanceCounter(); + const Int64 freq64 = getPerformanceCounterFrequency(); + const Int64 time64 = getPerformanceCounter(); #if defined(RTS_DEBUG) if (TheGameLogic->getFrame() == START_CUMU_FRAME) @@ -858,37 +854,21 @@ void W3DDisplay::updateAverageFPS(void) } #endif - Int64 timeDiff = time64 - lastUpdateTime64; + const Int64 timeDiff = time64 - lastUpdateTime64; // convert elapsed time to seconds - double elapsedSeconds = (double)timeDiff/(double)(freq64); - - if (elapsedSeconds <= MaximumFrameTimeCutoff) //make sure it's not a spike - { - // append new sameple to fps history. - if (historyOffset >= FPS_HISTORY_SIZE) - historyOffset = 0; + Real elapsedSeconds = (Real)timeDiff/(Real)freq64; - m_currentFPS = 1.0/elapsedSeconds; - fpsHistory[historyOffset++] = m_currentFPS; - numSamples++; - if (numSamples > FPS_HISTORY_SIZE) - numSamples = FPS_HISTORY_SIZE; - } + // append new sample to fps history. + if (historyOffset >= FPS_HISTORY_SIZE) + historyOffset = 0; - if (numSamples) - { - // determine average frame rate over our past history. - Real average=0; - for (Int i=0,j=historyOffset-1; i #include #include #include @@ -885,21 +886,16 @@ void W3DDisplay::reset( void ) const UnsignedInt START_CUMU_FRAME = LOGICFRAMES_PER_SECOND / 2; // skip first half-sec -/** Update a moving average of the last 30 fps measurements. Also try to filter out temporary spikes. - This code is designed to be used by the GameLOD sytems to determine the correct dynamic LOD setting. -*/ void W3DDisplay::updateAverageFPS(void) { - const Real MaximumFrameTimeCutoff = 0.5f; //largest frame interval (seconds) we accept before ignoring it as a momentary "spike" - const Int FPS_HISTORY_SIZE = 30; //keep track of the last 30 frames + constexpr const Int FPS_HISTORY_SIZE = 30; static Int64 lastUpdateTime64 = 0; static Int historyOffset = 0; - static Int numSamples = 0; - static double fpsHistory[FPS_HISTORY_SIZE]; + static Real fpsHistory[FPS_HISTORY_SIZE] = {0}; - Int64 freq64 = getPerformanceCounterFrequency(); - Int64 time64 = getPerformanceCounter(); + const Int64 freq64 = getPerformanceCounterFrequency(); + const Int64 time64 = getPerformanceCounter(); #if defined(RTS_DEBUG) if (TheGameLogic->getFrame() == START_CUMU_FRAME) @@ -908,37 +904,21 @@ void W3DDisplay::updateAverageFPS(void) } #endif - Int64 timeDiff = time64 - lastUpdateTime64; + const Int64 timeDiff = time64 - lastUpdateTime64; // convert elapsed time to seconds - double elapsedSeconds = (double)timeDiff/(double)(freq64); - - if (elapsedSeconds <= MaximumFrameTimeCutoff) //make sure it's not a spike - { - // append new sameple to fps history. - if (historyOffset >= FPS_HISTORY_SIZE) - historyOffset = 0; + Real elapsedSeconds = (Real)timeDiff/(Real)freq64; - m_currentFPS = 1.0/elapsedSeconds; - fpsHistory[historyOffset++] = m_currentFPS; - numSamples++; - if (numSamples > FPS_HISTORY_SIZE) - numSamples = FPS_HISTORY_SIZE; - } + // append new sample to fps history. + if (historyOffset >= FPS_HISTORY_SIZE) + historyOffset = 0; - if (numSamples) - { - // determine average frame rate over our past history. - Real average=0; - for (Int i=0,j=historyOffset-1; i Date: Tue, 7 Oct 2025 18:50:12 +0200 Subject: [PATCH 148/343] fix(debug): Fix wrong assert condition in W3DTreeDraw::addToTreeBuffer() (#1663) --- Generals/Code/GameEngine/Include/Common/Thing.h | 3 +++ .../Code/GameEngine/Source/Common/Thing/Thing.cpp | 13 ++++++++++++- GeneralsMD/Code/GameEngine/Include/Common/Thing.h | 3 +++ .../Code/GameEngine/Source/Common/Thing/Thing.cpp | 13 ++++++++++++- .../GameClient/Drawable/Draw/W3DTreeDraw.cpp | 6 ++---- 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/Thing.h b/Generals/Code/GameEngine/Include/Common/Thing.h index b0c91c2a8aa..13e0a3b89c6 100644 --- a/Generals/Code/GameEngine/Include/Common/Thing.h +++ b/Generals/Code/GameEngine/Include/Common/Thing.h @@ -121,6 +121,9 @@ class Thing : public MemoryPoolObject inline const Coord3D *getPosition() const { return &m_cachedPos; } inline Real getOrientation() const { return m_cachedAngle; } + + Bool isPositioned() const; + const Coord3D *getUnitDirectionVector2D() const; void getUnitDirectionVector2D(Coord3D& dir) const; void getUnitDirectionVector3D(Coord3D& dir) const; diff --git a/Generals/Code/GameEngine/Source/Common/Thing/Thing.cpp b/Generals/Code/GameEngine/Source/Common/Thing/Thing.cpp index 9fbf11acf56..65607038b2c 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/Thing.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/Thing.cpp @@ -47,6 +47,9 @@ #include "GameLogic/TerrainLogic.h" +static constexpr const Real InitialThingPosX = 0.0f; +static constexpr const Real InitialThingPosY = 0.0f; + //============================================================================= /** Constructor */ //============================================================================= @@ -67,7 +70,9 @@ Thing::Thing( const ThingTemplate *thingTemplate ) m_templateName = thingTemplate->getName(); #endif m_transform.Make_Identity(); - m_cachedPos.zero(); + m_cachedPos.x = InitialThingPosX; + m_cachedPos.y = InitialThingPosY; + m_cachedPos.z = 0.0f; m_cachedAngle = 0.0f; m_cachedDirVector.zero(); m_cachedAltitudeAboveTerrain = 0; @@ -91,6 +96,12 @@ const ThingTemplate *Thing::getTemplate() const return m_template; } +//============================================================================= +Bool Thing::isPositioned() const +{ + return m_cachedPos.x != InitialThingPosX || m_cachedPos.y != InitialThingPosY; +} + //============================================================================= const Coord3D* Thing::getUnitDirectionVector2D() const { diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Thing.h b/GeneralsMD/Code/GameEngine/Include/Common/Thing.h index e1318551e3e..e278e7f19fa 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Thing.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Thing.h @@ -121,6 +121,9 @@ class Thing : public MemoryPoolObject inline const Coord3D *getPosition() const { return &m_cachedPos; } inline Real getOrientation() const { return m_cachedAngle; } + + Bool isPositioned() const; + const Coord3D *getUnitDirectionVector2D() const; void getUnitDirectionVector2D(Coord3D& dir) const; void getUnitDirectionVector3D(Coord3D& dir) const; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/Thing.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/Thing.cpp index 89c917c3775..1deba83a7bb 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/Thing.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/Thing.cpp @@ -47,6 +47,9 @@ #include "GameLogic/TerrainLogic.h" +static constexpr const Real InitialThingPosX = 0.0f; +static constexpr const Real InitialThingPosY = 0.0f; + //============================================================================= /** Constructor */ //============================================================================= @@ -67,7 +70,9 @@ Thing::Thing( const ThingTemplate *thingTemplate ) m_templateName = thingTemplate->getName(); #endif m_transform.Make_Identity(); - m_cachedPos.zero(); + m_cachedPos.x = InitialThingPosX; + m_cachedPos.y = InitialThingPosY; + m_cachedPos.z = 0.0f; m_cachedAngle = 0.0f; m_cachedDirVector.zero(); m_cachedAltitudeAboveTerrain = 0; @@ -91,6 +96,12 @@ const ThingTemplate *Thing::getTemplate() const return m_template; } +//============================================================================= +Bool Thing::isPositioned() const +{ + return m_cachedPos.x != InitialThingPosX || m_cachedPos.y != InitialThingPosY; +} + //============================================================================= const Coord3D* Thing::getUnitDirectionVector2D() const { diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTreeDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTreeDraw.cpp index a90cef1d9b4..81fff438779 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTreeDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTreeDraw.cpp @@ -126,14 +126,12 @@ void W3DTreeDraw::addToTreeBuffer() const W3DTreeDrawModuleData *moduleData = getW3DTreeDrawModuleData(); const Drawable *draw = getDrawable(); - DEBUG_ASSERTCRASH(draw->getPosition()->x == 0.0f && draw->getPosition()->y == 0.0f, - ("W3DTreeDraw::addToTreeBuffer - Why place tree at x:0 y:0 ?")); + DEBUG_ASSERTCRASH(draw->isPositioned(), ("W3DTreeDraw::addToTreeBuffer - This tree was not positioned!")); Real scale = draw->getScale(); Real scaleRandomness = draw->getTemplate()->getInstanceScaleFuzziness(); scaleRandomness = 0.0f; // We use the scale fuzziness inside WB to generate random scales, so they don't change at load time. jba. [4/22/2003] - TheTerrainRenderObject->addTree(draw->getID(), *draw->getPosition(), - scale, draw->getOrientation(), scaleRandomness, moduleData); + TheTerrainRenderObject->addTree(draw->getID(), *draw->getPosition(), scale, draw->getOrientation(), scaleRandomness, moduleData); } // ------------------------------------------------------------------------------------------------ From dbdcd89f1054ec8178e4a02807fd84d998414acf Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Wed, 8 Oct 2025 04:04:23 +1100 Subject: [PATCH 149/343] tweak(module): Add 'TransferSelection' field to CreateObjectDie INI module to allow transfer selection on object creation (#1665) This change allows to configure the GLA Sneak Attack in INI to remain selected after it transitioned to the fully emerged object. Object GLASneakAttackTunnelNetworkStart Behavior = CreateObjectDie ModuleTag ... TransferSelection = Yes ; The tunnel remains selected after emerging End End --- .../GameLogic/Module/CreateObjectDie.h | 1 + .../GameLogic/Object/Die/CreateObjectDie.cpp | 24 ++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CreateObjectDie.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CreateObjectDie.h index 03e073938aa..ae706e4043d 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CreateObjectDie.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CreateObjectDie.h @@ -48,6 +48,7 @@ class CreateObjectDieModuleData : public DieModuleData const ObjectCreationList* m_ocl; ///< object creaton list to make Bool m_transferPreviousHealth; ///< Transfers previous health before death to the new object created. + Bool m_transferSelection; ///< Transfers selection state before death to the new object created. CreateObjectDieModuleData(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateObjectDie.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateObjectDie.cpp index 8d581305257..ff93e0d8166 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateObjectDie.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateObjectDie.cpp @@ -38,7 +38,7 @@ #include "GameLogic/Object.h" #include "GameLogic/ObjectCreationList.h" #include "GameLogic/Module/BodyModule.h" - +#include "GameClient/InGameUI.h" // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -47,7 +47,7 @@ CreateObjectDieModuleData::CreateObjectDieModuleData() m_ocl = NULL; m_transferPreviousHealth = FALSE; - + m_transferSelection = FALSE; } // ------------------------------------------------------------------------------------------------ @@ -60,6 +60,7 @@ CreateObjectDieModuleData::CreateObjectDieModuleData() { { "CreationList", INI::parseObjectCreationList, NULL, offsetof( CreateObjectDieModuleData, m_ocl ) }, { "TransferPreviousHealth", INI::parseBool, NULL ,offsetof( CreateObjectDieModuleData, m_transferPreviousHealth ) }, + { "TransferSelection", INI::parseBool, NULL, offsetof( CreateObjectDieModuleData, m_transferSelection ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); @@ -95,11 +96,13 @@ void CreateObjectDie::onDie( const DamageInfo * damageInfo ) Object *damageDealer = TheGameLogic->findObjectByID( damageInfo->in.m_sourceID ); Object *newObject = ObjectCreationList::create( data->m_ocl, getObject(), damageDealer ); + if (!newObject) + return; //If we're transferring previous health, we're transfering the last known //health before we died. In the case of the sneak attack tunnel network, it //is killed after the lifetime update expires. - if( newObject && data->m_transferPreviousHealth ) + if( data->m_transferPreviousHealth ) { //Convert old health to new health. Object *oldObject = getObject(); @@ -140,7 +143,22 @@ void CreateObjectDie::onDie( const DamageInfo * damageInfo ) } } + // TheSuperHackers @bugfix Stubbjax 02/10/2025 If the old object was selected, select the new one. + // This is important for the Sneak Attack, which is spawned via a CreateObjectDie module. + if (data->m_transferSelection) + { + Object* oldObject = getObject(); + Drawable* selectedDrawable = TheInGameUI->getFirstSelectedDrawable(); + Bool oldObjectSelected = selectedDrawable && selectedDrawable->getID() == oldObject->getDrawable()->getID(); + if (oldObjectSelected) + { + GameMessage* msg = TheMessageStream->appendMessage(GameMessage::MSG_CREATE_SELECTED_GROUP_NO_SOUND); + msg->appendBooleanArgument(TRUE); + msg->appendObjectIDArgument(newObject->getID()); + TheInGameUI->selectDrawable(newObject->getDrawable()); + } + } } // ------------------------------------------------------------------------------------------------ From fe49f3bede8e33fd6ae77d8708eb4c3adea65714 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Thu, 9 Oct 2025 03:58:12 +1100 Subject: [PATCH 150/343] bugfix(tunnel): Fix stacked unit healing time inside multiple GLA Tunnel Networks (#1626) To restore a quasi instant build like the retail game did with many tunnels, reduce the value of 'TimeForFullHeal' in TunnelContain modules Behavior = TunnelContain ModuleTag TimeForFullHeal = 5000 ; (in milliseconds) End --- .../GameEngine/Include/Common/TunnelTracker.h | 7 +++ .../Include/GameLogic/Module/ContainModule.h | 1 + .../Include/GameLogic/Module/HealContain.h | 1 + .../Include/GameLogic/Module/OpenContain.h | 1 + .../Include/GameLogic/Module/TunnelContain.h | 1 + .../GameEngine/Source/Common/RTS/Player.cpp | 8 ++++ .../Source/Common/RTS/TunnelTracker.cpp | 47 +++++++++++++++++++ .../Object/Contain/TunnelContain.cpp | 10 +++- .../GameEngine/Include/Common/TunnelTracker.h | 7 +++ .../Include/GameLogic/Module/TunnelContain.h | 1 + .../GameEngine/Source/Common/RTS/Player.cpp | 8 ++++ .../Source/Common/RTS/TunnelTracker.cpp | 47 +++++++++++++++++++ .../Object/Contain/TunnelContain.cpp | 10 +++- 13 files changed, 145 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/TunnelTracker.h b/Generals/Code/GameEngine/Include/Common/TunnelTracker.h index 4fe040954bb..79851d503fe 100644 --- a/Generals/Code/GameEngine/Include/Common/TunnelTracker.h +++ b/Generals/Code/GameEngine/Include/Common/TunnelTracker.h @@ -62,7 +62,11 @@ class TunnelTracker : public MemoryPoolObject, static void destroyObject( Object *obj, void *userData ); ///< Callback for Iterate Contained system static void healObject( Object *obj, void *frames ); ///< Callback for Iterate Contained system +#if RETAIL_COMPATIBLE_CRC void healObjects(Real frames); ///< heal all objects within the tunnel +#else + void healObjects(); ///< heal all objects within the tunnel +#endif UnsignedInt friend_getTunnelCount() const {return m_tunnelCount;}///< TunnelContains are allowed to ask if they are the last one ahead of deletion time @@ -78,12 +82,15 @@ class TunnelTracker : public MemoryPoolObject, virtual void loadPostProcess( void ); private: + void updateFullHealTime(); std::list< ObjectID > m_tunnelIDs; ///< I have to try to keep track of these because Caves need to iterate on them. ContainedItemsList m_containList; ///< the contained object pointers list std::list< ObjectID > m_xferContainList;///< for loading of m_containList during post processing Int m_containListSize; ///< size of the contain list UnsignedInt m_tunnelCount; ///< How many tunnels have registered so we know when we should kill our contain list + UnsignedInt m_framesForFullHeal; ///< How many frames it takes to fully heal a unit + Bool m_needsFullHealTimeUpdate; ///< Set to true when needing to recalc full heal time to batch the operation ObjectID m_curNemesisID; ///< If we have team(s) guarding a tunnel network system, this is one of the current targets. UnsignedInt m_nemesisTimestamp; ///< We only keep nemesis for a couple of seconds. diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/ContainModule.h b/Generals/Code/GameEngine/Include/GameLogic/Module/ContainModule.h index c24fb01f179..728b9b2f970 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/ContainModule.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/ContainModule.h @@ -86,6 +86,7 @@ class ContainModuleInterface virtual Bool isGarrisonable() const = 0; virtual Bool isSpecialZeroSlotContainer() const = 0; virtual Bool isHealContain() const = 0; + virtual Bool isTunnelContain() const = 0; virtual Bool isImmuneToClearBuildingAttacks() const = 0; diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/HealContain.h b/Generals/Code/GameEngine/Include/GameLogic/Module/HealContain.h index 7c9d878f640..43f74a841bc 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/HealContain.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/HealContain.h @@ -66,6 +66,7 @@ class HealContain : public OpenContain virtual UpdateSleepTime update(); ///< called once per frame virtual Bool isHealContain() const { return true; } ///< true when container only contains units while healing (not a transport!) + virtual Bool isTunnelContain() const { return FALSE; } protected: diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/OpenContain.h b/Generals/Code/GameEngine/Include/GameLogic/Module/OpenContain.h index c43fec89c85..2c00ed04a48 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/OpenContain.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/OpenContain.h @@ -191,6 +191,7 @@ class OpenContain : public UpdateModule, virtual Bool isGarrisonable() const { return false; } ///< can this unit be Garrisoned? (ick) virtual Bool isHealContain() const { return false; } ///< true when container only contains units while healing (not a transport!) + virtual Bool isTunnelContain() const { return FALSE; } virtual Bool isSpecialZeroSlotContainer() const { return false; } virtual Bool isImmuneToClearBuildingAttacks() const { return true; } diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/TunnelContain.h b/Generals/Code/GameEngine/Include/GameLogic/Module/TunnelContain.h index 26d0c788d85..3a89b8dc215 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/TunnelContain.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/TunnelContain.h @@ -110,6 +110,7 @@ class TunnelContain : public OpenContain, public CreateModuleInterface virtual UnsignedInt getContainCount() const; virtual Int getContainMax( void ) const; virtual const ContainedItemsList* getContainedItemsList() const; + virtual UnsignedInt getFullTimeForHeal(void) const; ///< Returns the time in frames until a contained object becomes fully healed virtual Bool isDisplayedOnControlBar() const { return TRUE; } ///< Does this container display its contents on the ControlBar? virtual Bool isKickOutOnCapture(){ return FALSE; }///< Caves and Tunnels don't kick out on capture. diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp index bd01821872b..177c6e5a0ee 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp @@ -666,6 +666,14 @@ void Player::update() team->updateGenericScripts(); } } + +#if !RETAIL_COMPATIBLE_CRC + // TheSuperHackers @bugfix Stubbjax 26/09/2025 The Tunnel System now heals + // all units once per frame instead of once per frame per Tunnel Network. + TunnelTracker* tunnelSystem = getTunnelSystem(); + if (tunnelSystem) + tunnelSystem->healObjects(); +#endif } //============================================================================= diff --git a/Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp b/Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp index 8f6767594ed..f91af534f08 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp @@ -54,6 +54,8 @@ TunnelTracker::TunnelTracker() m_containListSize = 0; m_curNemesisID = INVALID_ID; m_nemesisTimestamp = 0; + m_framesForFullHeal = 0; + m_needsFullHealTimeUpdate = false; } // ------------------------------------------------------------------------ @@ -211,6 +213,7 @@ void TunnelTracker::onTunnelCreated( const Object *newTunnel ) { m_tunnelCount++; m_tunnelIDs.push_back( newTunnel->getID() ); + m_needsFullHealTimeUpdate = true; } // ------------------------------------------------------------------------ @@ -218,6 +221,7 @@ void TunnelTracker::onTunnelDestroyed( const Object *deadTunnel ) { m_tunnelCount--; m_tunnelIDs.remove( deadTunnel->getID() ); + m_needsFullHealTimeUpdate = true; if( m_tunnelCount == 0 ) { @@ -252,10 +256,23 @@ void TunnelTracker::destroyObject( Object *obj, void * ) // ------------------------------------------------------------------------ // heal all the objects within the tunnel system using the iterateContained function +#if RETAIL_COMPATIBLE_CRC void TunnelTracker::healObjects(Real frames) { iterateContained(healObject, &frames, FALSE); } +#else +void TunnelTracker::healObjects() +{ + if (m_needsFullHealTimeUpdate) + { + updateFullHealTime(); + m_needsFullHealTimeUpdate = false; + } + + iterateContained(healObject, &m_framesForFullHeal, FALSE); +} +#endif // ------------------------------------------------------------------------ // heal one object within the tunnel network system @@ -263,7 +280,11 @@ void TunnelTracker::healObject( Object *obj, void *frames) { //get the number of frames to heal +#if RETAIL_COMPATIBLE_CRC Real *framesForFullHeal = (Real*)frames; +#else + UnsignedInt* framesForFullHeal = (UnsignedInt*)frames; +#endif // setup the healing damageInfo structure with all but the amount DamageInfo healInfo; @@ -300,6 +321,31 @@ void TunnelTracker::healObject( Object *obj, void *frames) } } +void TunnelTracker::updateFullHealTime() +{ + UnsignedInt minFrames = ~0u; + + for (std::list::const_iterator it = m_tunnelIDs.begin(); it != m_tunnelIDs.end(); ++it) + { + const Object* tunnelObj = TheGameLogic->findObjectByID(*it); + if (!tunnelObj) + continue; + + const ContainModuleInterface* contain = tunnelObj->getContain(); + DEBUG_ASSERTCRASH(contain != NULL, ("Contain module is NULL")); + + if (!contain->isTunnelContain()) + continue; + + const TunnelContain* tunnelContain = static_cast(contain); + const UnsignedInt framesForFullHeal = tunnelContain->getFullTimeForHeal(); + if (framesForFullHeal < minFrames) + minFrames = framesForFullHeal; + } + + m_framesForFullHeal = minFrames; +} + // ------------------------------------------------------------------------------------------------ /** CRC */ // ------------------------------------------------------------------------------------------------ @@ -353,6 +399,7 @@ void TunnelTracker::xfer( Xfer *xfer ) } + m_needsFullHealTimeUpdate = true; } // tunnel count diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp index 40667378f7b..5179d5f1662 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp @@ -248,7 +248,11 @@ const ContainedItemsList* TunnelContain::getContainedItemsList() const return NULL; } - +UnsignedInt TunnelContain::getFullTimeForHeal(void) const +{ + const TunnelContainModuleData* modData = getTunnelContainModuleData(); + return modData->m_framesForFullHeal; +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////////////////////////// @@ -389,7 +393,6 @@ UpdateSleepTime TunnelContain::update( void ) { // extending functionality to heal the units within the tunnel system OpenContain::update(); - const TunnelContainModuleData *modData = getTunnelContainModuleData(); Object *obj = getObject(); Player *controllingPlayer = NULL; @@ -400,10 +403,13 @@ UpdateSleepTime TunnelContain::update( void ) if (controllingPlayer) { TunnelTracker *tunnelSystem = controllingPlayer->getTunnelSystem(); +#if RETAIL_COMPATIBLE_CRC if (tunnelSystem) { + const TunnelContainModuleData* modData = getTunnelContainModuleData(); tunnelSystem->healObjects(modData->m_framesForFullHeal); } +#endif // check for attacked. BodyModuleInterface *body = obj->getBodyModule(); diff --git a/GeneralsMD/Code/GameEngine/Include/Common/TunnelTracker.h b/GeneralsMD/Code/GameEngine/Include/Common/TunnelTracker.h index f363c963134..595442cf58d 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/TunnelTracker.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/TunnelTracker.h @@ -62,7 +62,11 @@ class TunnelTracker : public MemoryPoolObject, static void destroyObject( Object *obj, void *userData ); ///< Callback for Iterate Contained system static void healObject( Object *obj, void *frames ); ///< Callback for Iterate Contained system +#if RETAIL_COMPATIBLE_CRC void healObjects(Real frames); ///< heal all objects within the tunnel +#else + void healObjects(); ///< heal all objects within the tunnel +#endif UnsignedInt friend_getTunnelCount() const {return m_tunnelCount;}///< TunnelContains are allowed to ask if they are the last one ahead of deletion time @@ -78,12 +82,15 @@ class TunnelTracker : public MemoryPoolObject, virtual void loadPostProcess( void ); private: + void updateFullHealTime(); std::list< ObjectID > m_tunnelIDs; ///< I have to try to keep track of these because Caves need to iterate on them. ContainedItemsList m_containList; ///< the contained object pointers list std::list< ObjectID > m_xferContainList;///< for loading of m_containList during post processing Int m_containListSize; ///< size of the contain list UnsignedInt m_tunnelCount; ///< How many tunnels have registered so we know when we should kill our contain list + UnsignedInt m_framesForFullHeal; ///< How many frames it takes to fully heal a unit + Bool m_needsFullHealTimeUpdate; ///< Set to true when needing to recalc full heal time to batch the operation ObjectID m_curNemesisID; ///< If we have team(s) guarding a tunnel network system, this is one of the current targets. UnsignedInt m_nemesisTimestamp; ///< We only keep nemesis for a couple of seconds. diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/TunnelContain.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/TunnelContain.h index bcbdcbd29eb..672a0dba0bf 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/TunnelContain.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/TunnelContain.h @@ -117,6 +117,7 @@ class TunnelContain : public OpenContain, public CreateModuleInterface virtual UnsignedInt getContainCount() const; virtual Int getContainMax( void ) const; virtual const ContainedItemsList* getContainedItemsList() const; + virtual UnsignedInt getFullTimeForHeal(void) const; ///< Returns the time in frames until a contained object becomes fully healed virtual Bool isDisplayedOnControlBar() const { return TRUE; } ///< Does this container display its contents on the ControlBar? virtual Bool isKickOutOnCapture(){ return FALSE; }///< Caves and Tunnels don't kick out on capture. diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp index 03f7c017354..109e7f71d6a 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp @@ -716,6 +716,14 @@ void Player::update() } } } + +#if !RETAIL_COMPATIBLE_CRC + // TheSuperHackers @bugfix Stubbjax 26/09/2025 The Tunnel System now heals + // all units once per frame instead of once per frame per Tunnel Network. + TunnelTracker* tunnelSystem = getTunnelSystem(); + if (tunnelSystem) + tunnelSystem->healObjects(); +#endif } //============================================================================= diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp index 8e035dfd377..035aac9bf34 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp @@ -54,6 +54,8 @@ TunnelTracker::TunnelTracker() m_containListSize = 0; m_curNemesisID = INVALID_ID; m_nemesisTimestamp = 0; + m_framesForFullHeal = 0; + m_needsFullHealTimeUpdate = false; } // ------------------------------------------------------------------------ @@ -212,6 +214,7 @@ void TunnelTracker::onTunnelCreated( const Object *newTunnel ) { m_tunnelCount++; m_tunnelIDs.push_back( newTunnel->getID() ); + m_needsFullHealTimeUpdate = true; } // ------------------------------------------------------------------------ @@ -219,6 +222,7 @@ void TunnelTracker::onTunnelDestroyed( const Object *deadTunnel ) { m_tunnelCount--; m_tunnelIDs.remove( deadTunnel->getID() ); + m_needsFullHealTimeUpdate = true; if( m_tunnelCount == 0 ) { @@ -253,10 +257,23 @@ void TunnelTracker::destroyObject( Object *obj, void * ) // ------------------------------------------------------------------------ // heal all the objects within the tunnel system using the iterateContained function +#if RETAIL_COMPATIBLE_CRC void TunnelTracker::healObjects(Real frames) { iterateContained(healObject, &frames, FALSE); } +#else +void TunnelTracker::healObjects() +{ + if (m_needsFullHealTimeUpdate) + { + updateFullHealTime(); + m_needsFullHealTimeUpdate = false; + } + + iterateContained(healObject, &m_framesForFullHeal, FALSE); +} +#endif // ------------------------------------------------------------------------ // heal one object within the tunnel network system @@ -264,7 +281,11 @@ void TunnelTracker::healObject( Object *obj, void *frames) { //get the number of frames to heal +#if RETAIL_COMPATIBLE_CRC Real *framesForFullHeal = (Real*)frames; +#else + UnsignedInt* framesForFullHeal = (UnsignedInt*)frames; +#endif // setup the healing damageInfo structure with all but the amount DamageInfo healInfo; @@ -301,6 +322,31 @@ void TunnelTracker::healObject( Object *obj, void *frames) } } +void TunnelTracker::updateFullHealTime() +{ + UnsignedInt minFrames = ~0u; + + for (std::list::const_iterator it = m_tunnelIDs.begin(); it != m_tunnelIDs.end(); ++it) + { + const Object* tunnelObj = TheGameLogic->findObjectByID(*it); + if (!tunnelObj) + continue; + + const ContainModuleInterface* contain = tunnelObj->getContain(); + DEBUG_ASSERTCRASH(contain != NULL, ("Contain module is NULL")); + + if (!contain->isTunnelContain()) + continue; + + const TunnelContain* tunnelContain = static_cast(contain); + const UnsignedInt framesForFullHeal = tunnelContain->getFullTimeForHeal(); + if (framesForFullHeal < minFrames) + minFrames = framesForFullHeal; + } + + m_framesForFullHeal = minFrames; +} + // ------------------------------------------------------------------------------------------------ /** CRC */ // ------------------------------------------------------------------------------------------------ @@ -354,6 +400,7 @@ void TunnelTracker::xfer( Xfer *xfer ) } + m_needsFullHealTimeUpdate = true; } // tunnel count diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp index 20245689ed3..b0188241dea 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp @@ -325,7 +325,11 @@ const ContainedItemsList* TunnelContain::getContainedItemsList() const return NULL; } - +UnsignedInt TunnelContain::getFullTimeForHeal(void) const +{ + const TunnelContainModuleData* modData = getTunnelContainModuleData(); + return modData->m_framesForFullHeal; +} /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////////////////////////// @@ -525,7 +529,6 @@ UpdateSleepTime TunnelContain::update( void ) { // extending functionality to heal the units within the tunnel system OpenContain::update(); - const TunnelContainModuleData *modData = getTunnelContainModuleData(); Object *obj = getObject(); Player *controllingPlayer = NULL; @@ -536,10 +539,13 @@ UpdateSleepTime TunnelContain::update( void ) if (controllingPlayer) { TunnelTracker *tunnelSystem = controllingPlayer->getTunnelSystem(); +#if RETAIL_COMPATIBLE_CRC if (tunnelSystem) { + const TunnelContainModuleData* modData = getTunnelContainModuleData(); tunnelSystem->healObjects(modData->m_framesForFullHeal); } +#endif // check for attacked. BodyModuleInterface *body = obj->getBodyModule(); From 870f41c7455307912b773c6293d5c9770f6b8399 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Wed, 8 Oct 2025 12:09:42 -0500 Subject: [PATCH 151/343] refactor(network): Extract magic NetPacket character literals into named constants (#1672) --- .../Source/GameNetwork/NetPacket.cpp | 668 +++++++++--------- .../Source/GameNetwork/NetPacket.cpp | 668 +++++++++--------- 2 files changed, 680 insertions(+), 656 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameNetwork/NetPacket.cpp b/Generals/Code/GameEngine/Source/GameNetwork/NetPacket.cpp index 09f4aab429c..0805712ec2b 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/NetPacket.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/NetPacket.cpp @@ -31,7 +31,19 @@ #include "GameNetwork/NetworkDefs.h" #include "GameNetwork/networkutil.h" #include "GameNetwork/GameMessageParser.h" +#include +// TheSuperHackers @refactor BobTista 10/06/2025 Extract magic character literals into named constants for improved readability +typedef UnsignedByte NetPacketFieldType; + +namespace NetPacketFieldTypes { + constexpr const NetPacketFieldType CommandType = 'T'; // NetCommandType field + constexpr const NetPacketFieldType Relay = 'R'; // Relay field + constexpr const NetPacketFieldType PlayerId = 'P'; // Player ID field + constexpr const NetPacketFieldType CommandId = 'C'; // Command ID field + constexpr const NetPacketFieldType Frame = 'F'; // Frame field + constexpr const NetPacketFieldType Data = 'D'; // Data payload field +} // This function assumes that all of the fields are either of default value or are // present in the raw data. @@ -50,37 +62,37 @@ NetCommandRef * NetPacket::ConstructNetCommandMsgFromRawData(UnsignedByte *data, switch (data[offset]) { - case 'T': + case NetPacketFieldTypes::CommandType: ++offset; memcpy(&commandType, data + offset, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); break; - case 'R': + case NetPacketFieldTypes::Relay: ++offset; memcpy(&relay, data + offset, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); break; - case 'P': + case NetPacketFieldTypes::PlayerId: ++offset; memcpy(&playerID, data + offset, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); break; - case 'C': + case NetPacketFieldTypes::CommandId: ++offset; memcpy(&commandID, data + offset, sizeof(UnsignedShort)); offset += sizeof(UnsignedShort); break; - case 'F': + case NetPacketFieldTypes::Frame: ++offset; memcpy(&frame, data + offset, sizeof(UnsignedInt)); offset += sizeof(UnsignedInt); break; - case 'D': + case NetPacketFieldTypes::Data: ++offset; switch (commandType) { @@ -348,7 +360,7 @@ UnsignedInt NetPacket::GetGameCommandSize(NetCommandMsg *msg) { msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // relay msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // command type msglen += sizeof(UnsignedShort) + sizeof(UnsignedByte); // command ID - msglen += sizeof(UnsignedByte); // the 'D' for the data section. + msglen += sizeof(UnsignedByte); // the NetPacketFieldTypes::Data for the data section. GameMessage *gmsg = cmdMsg->constructGameMessage(); GameMessageParser *parser = newInstance(GameMessageParser)(gmsg); @@ -519,7 +531,7 @@ UnsignedInt NetPacket::GetKeepAliveCommandSize(NetCommandMsg *msg) { ++msglen; msglen += sizeof(UnsignedByte); - ++msglen; // For the 'D' + ++msglen; // For the NetPacketFieldTypes::Data return msglen; } @@ -533,7 +545,7 @@ UnsignedInt NetPacket::GetDisconnectKeepAliveCommandSize(NetCommandMsg *msg) { ++msglen; msglen += sizeof(UnsignedByte); - ++msglen; // For the 'D' + ++msglen; // For the NetPacketFieldTypes::Data return msglen; } @@ -548,7 +560,7 @@ UnsignedInt NetPacket::GetDisconnectPlayerCommandSize(NetCommandMsg *msg) { msglen += sizeof(UnsignedByte); msglen += sizeof(UnsignedShort) + sizeof(UnsignedByte); - ++msglen; // the 'D' + ++msglen; // the NetPacketFieldTypes::Data msglen += sizeof(UnsignedByte); // slot number msglen += sizeof(UnsignedInt); // disconnect frame @@ -564,7 +576,7 @@ UnsignedInt NetPacket::GetPacketRouterQueryCommandSize(NetCommandMsg *msg) { ++msglen; msglen += sizeof(UnsignedByte); - ++msglen; // the 'D' + ++msglen; // the NetPacketFieldTypes::Data return msglen; } @@ -578,7 +590,7 @@ UnsignedInt NetPacket::GetPacketRouterAckCommandSize(NetCommandMsg *msg) { ++msglen; msglen += sizeof(UnsignedByte); - ++msglen; // the 'D' + ++msglen; // the NetPacketFieldTypes::Data return msglen; } @@ -593,7 +605,7 @@ UnsignedInt NetPacket::GetDisconnectChatCommandSize(NetCommandMsg *msg) { ++msglen; msglen += sizeof(UnsignedByte); - ++msglen; // the 'D' + ++msglen; // the NetPacketFieldTypes::Data msglen += sizeof(UnsignedByte); // string msglength UnsignedByte textmsglen = cmdMsg->getText().getLength(); msglen += textmsglen * sizeof(UnsignedShort); @@ -611,7 +623,7 @@ UnsignedInt NetPacket::GetDisconnectVoteCommandSize(NetCommandMsg *msg) { msglen += sizeof(UnsignedByte); msglen += sizeof(UnsignedShort) + sizeof(UnsignedByte); - ++msglen; // the 'D' + ++msglen; // the NetPacketFieldTypes::Data msglen += sizeof(UnsignedByte); // slot number msglen += sizeof(UnsignedInt); // vote frame. @@ -630,7 +642,7 @@ UnsignedInt NetPacket::GetChatCommandSize(NetCommandMsg *msg) { msglen += sizeof(UnsignedByte); msglen += sizeof(UnsignedShort) + sizeof(UnsignedByte); - ++msglen; // the 'D' + ++msglen; // the NetPacketFieldTypes::Data msglen += sizeof(UnsignedByte); // string msglength UnsignedByte textmsglen = cmdMsg->getText().getLength(); msglen += textmsglen * sizeof(UnsignedShort); @@ -648,7 +660,7 @@ UnsignedInt NetPacket::GetProgressMessageSize(NetCommandMsg *msg) { ++msglen; msglen += sizeof(UnsignedByte); - ++msglen; // For the 'D' + ++msglen; // For the NetPacketFieldTypes::Data ++msglen; // percentage return msglen; @@ -663,7 +675,7 @@ UnsignedInt NetPacket::GetLoadCompleteMessageSize(NetCommandMsg *msg) { ++msglen; msglen += sizeof(UnsignedByte); - ++msglen; // For the 'D' + ++msglen; // For the NetPacketFieldTypes::Data return msglen; } @@ -677,7 +689,7 @@ UnsignedInt NetPacket::GetTimeOutGameStartMessageSize(NetCommandMsg *msg) { ++msglen; msglen += sizeof(UnsignedByte); - ++msglen; // For the 'D' + ++msglen; // For the NetPacketFieldTypes::Data return msglen; } @@ -686,12 +698,12 @@ UnsignedInt NetPacket::GetTimeOutGameStartMessageSize(NetCommandMsg *msg) { UnsignedInt NetPacket::GetWrapperCommandSize(NetCommandMsg *msg) { UnsignedInt msglen = 0; - ++msglen; // 'T' + ++msglen; // NetPacketFieldTypes::CommandType msglen += sizeof(UnsignedByte); // command type - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'P' and player ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // 'C' and command ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'R' and relay - ++msglen; // 'D' + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::PlayerId and player ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // NetPacketFieldTypes::CommandId and command ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::Relay and relay + ++msglen; // NetPacketFieldTypes::Data msglen += sizeof(UnsignedShort); // m_wrappedCommandID msglen += sizeof(UnsignedInt); // m_chunkNumber @@ -706,12 +718,12 @@ UnsignedInt NetPacket::GetWrapperCommandSize(NetCommandMsg *msg) { UnsignedInt NetPacket::GetFileCommandSize(NetCommandMsg *msg) { NetFileCommandMsg *filemsg = (NetFileCommandMsg *)msg; UnsignedInt msglen = 0; - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'T' and command type - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'P' and player ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // 'C' and command ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'R' and relay + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::CommandType and command type + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::PlayerId and player ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // NetPacketFieldTypes::CommandId and command ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::Relay and relay - ++msglen; // 'D' + ++msglen; // NetPacketFieldTypes::Data msglen += filemsg->getPortableFilename().getLength() + 1; // PORTABLE filename and the terminating 0 msglen += sizeof(UnsignedInt); // file data length @@ -723,12 +735,12 @@ UnsignedInt NetPacket::GetFileCommandSize(NetCommandMsg *msg) { UnsignedInt NetPacket::GetFileAnnounceCommandSize(NetCommandMsg *msg) { NetFileAnnounceCommandMsg *filemsg = (NetFileAnnounceCommandMsg *)msg; UnsignedInt msglen = 0; - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'T' and command type - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'P' and player ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // 'C' and command ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'R' and relay + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::CommandType and command type + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::PlayerId and player ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // NetPacketFieldTypes::CommandId and command ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::Relay and relay - ++msglen; // 'D' + ++msglen; // NetPacketFieldTypes::Data msglen += filemsg->getPortableFilename().getLength() + 1; // PORTABLE filename and the terminating 0 msglen += sizeof(UnsignedShort); // m_fileID @@ -739,12 +751,12 @@ UnsignedInt NetPacket::GetFileAnnounceCommandSize(NetCommandMsg *msg) { UnsignedInt NetPacket::GetFileProgressCommandSize(NetCommandMsg *msg) { UnsignedInt msglen = 0; - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'T' and command type - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'P' and player ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // 'C' and command ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'R' and relay + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::CommandType and command type + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::PlayerId and player ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // NetPacketFieldTypes::CommandId and command ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::Relay and relay - ++msglen; // 'D' + ++msglen; // NetPacketFieldTypes::Data msglen += sizeof(UnsignedShort); // m_fileID msglen += sizeof(Int); // m_progress @@ -754,12 +766,12 @@ UnsignedInt NetPacket::GetFileProgressCommandSize(NetCommandMsg *msg) { UnsignedInt NetPacket::GetDisconnectFrameCommandSize(NetCommandMsg *msg) { UnsignedInt msglen = 0; - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'T' and command type - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'P' and player ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // 'C' and command ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'R' and relay + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::CommandType and command type + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::PlayerId and player ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // NetPacketFieldTypes::CommandId and command ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::Relay and relay - ++msglen; // 'D' + ++msglen; // NetPacketFieldTypes::Data msglen += sizeof(UnsignedInt); // disconnect frame return msglen; @@ -767,12 +779,12 @@ UnsignedInt NetPacket::GetDisconnectFrameCommandSize(NetCommandMsg *msg) { UnsignedInt NetPacket::GetDisconnectScreenOffCommandSize(NetCommandMsg *msg) { UnsignedInt msglen = 0; - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'T' and command type - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'P' and player ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // 'C' and command ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'R' and relay + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::CommandType and command type + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::PlayerId and player ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // NetPacketFieldTypes::CommandId and command ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::Relay and relay - ++msglen; // 'D' + ++msglen; // NetPacketFieldTypes::Data msglen += sizeof(UnsignedInt); // new frame return msglen; @@ -780,12 +792,12 @@ UnsignedInt NetPacket::GetDisconnectScreenOffCommandSize(NetCommandMsg *msg) { UnsignedInt NetPacket::GetFrameResendRequestCommandSize(NetCommandMsg *msg) { UnsignedInt msglen = 0; - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'T' and command type - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'P' and player ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // 'C' and command ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'R' and relay + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::CommandType and command type + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::PlayerId and player ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // NetPacketFieldTypes::CommandId and command ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::Relay and relay - ++msglen; // 'D' + ++msglen; // NetPacketFieldTypes::Data msglen += sizeof(UnsignedInt); // frame to resend return msglen; @@ -886,39 +898,39 @@ void NetPacket::FillBufferWithGameCommand(UnsignedByte *buffer, NetCommandRef *m //DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::FillBufferWithGameCommand for command ID %d", cmdMsg->getID())); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the execution frame into the packet. - buffer[offset] = 'F'; + buffer[offset] = NetPacketFieldTypes::Frame; ++offset; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(buffer+offset, &newframe, sizeof(UnsignedInt)); offset += sizeof(UnsignedInt); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); // If necessary, put the playerID into the packet. - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // If necessary, specify the command ID of this command. - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(UnsignedShort)); offset += sizeof(UnsignedShort); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; // Now copy the GameMessage type into the packet. @@ -1045,18 +1057,18 @@ void NetPacket::FillBufferWithAckCommand(UnsignedByte *buffer, NetCommandRef *ms } - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = type; offset += sizeof(UnsignedByte); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // Put in the command id of the command we are acking. - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; memcpy(buffer + offset, &commandID, sizeof(UnsignedShort)); offset += sizeof(UnsignedShort); @@ -1072,20 +1084,20 @@ void NetPacket::FillBufferWithFrameCommand(UnsignedByte *buffer, NetCommandRef * // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addFrameCommand - adding frame command for frame %d, command count = %d, command id = %d", cmdMsg->getExecutionFrame(), cmdMsg->getCommandCount(), cmdMsg->getID())); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the execution frame into the packet. - buffer[offset] = 'F'; + buffer[offset] = NetPacketFieldTypes::Frame; ++offset; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(buffer+offset, &newframe, sizeof(UnsignedInt)); offset += sizeof(UnsignedInt); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); @@ -1093,7 +1105,7 @@ void NetPacket::FillBufferWithFrameCommand(UnsignedByte *buffer, NetCommandRef * // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); @@ -1101,7 +1113,7 @@ void NetPacket::FillBufferWithFrameCommand(UnsignedByte *buffer, NetCommandRef * // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); // If necessary, specify the command ID of this command. - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(UnsignedShort)); @@ -1109,7 +1121,7 @@ void NetPacket::FillBufferWithFrameCommand(UnsignedByte *buffer, NetCommandRef * // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnsignedShort cmdCount = cmdMsg->getCommandCount(); memcpy(buffer + offset, &cmdCount, sizeof(UnsignedShort)); @@ -1125,20 +1137,20 @@ void NetPacket::FillBufferWithPlayerLeaveCommand(UnsignedByte *buffer, NetComman // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addPlayerLeaveCommand - adding player leave command for player %d", cmdMsg->getLeavingPlayerID())); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); // If necessary, put the execution frame into the packet. - buffer[offset] = 'F'; + buffer[offset] = NetPacketFieldTypes::Frame; ++offset; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(buffer+offset, &newframe, sizeof(UnsignedInt)); @@ -1146,7 +1158,7 @@ void NetPacket::FillBufferWithPlayerLeaveCommand(UnsignedByte *buffer, NetComman // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); @@ -1154,7 +1166,7 @@ void NetPacket::FillBufferWithPlayerLeaveCommand(UnsignedByte *buffer, NetComman // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); // If necessary, specify the command ID of this command. - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(UnsignedShort)); @@ -1162,7 +1174,7 @@ void NetPacket::FillBufferWithPlayerLeaveCommand(UnsignedByte *buffer, NetComman // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnsignedByte leavingPlayerID = cmdMsg->getLeavingPlayerID(); memcpy(buffer + offset, &leavingPlayerID, sizeof(UnsignedByte)); @@ -1175,13 +1187,13 @@ void NetPacket::FillBufferWithRunAheadMetricsCommand(UnsignedByte *buffer, NetCo // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addRunAheadMetricsCommand - adding run ahead metrics for player %d, fps = %d, latency = %f", cmdMsg->getPlayerID(), cmdMsg->getAverageFps(), cmdMsg->getAverageLatency())); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); @@ -1189,7 +1201,7 @@ void NetPacket::FillBufferWithRunAheadMetricsCommand(UnsignedByte *buffer, NetCo // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); @@ -1197,7 +1209,7 @@ void NetPacket::FillBufferWithRunAheadMetricsCommand(UnsignedByte *buffer, NetCo // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); // If necessary, specify the command ID of this command. - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(UnsignedShort)); @@ -1205,7 +1217,7 @@ void NetPacket::FillBufferWithRunAheadMetricsCommand(UnsignedByte *buffer, NetCo // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; // write the average latency Real averageLatency = cmdMsg->getAverageLatency(); @@ -1223,20 +1235,20 @@ void NetPacket::FillBufferWithRunAheadCommand(UnsignedByte *buffer, NetCommandRe //DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::FillBufferWithRunAheadCommand - adding run ahead command")); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); // If necessary, put the execution frame into the packet. - buffer[offset] = 'F'; + buffer[offset] = NetPacketFieldTypes::Frame; ++offset; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(buffer+offset, &newframe, sizeof(UnsignedInt)); @@ -1244,7 +1256,7 @@ void NetPacket::FillBufferWithRunAheadCommand(UnsignedByte *buffer, NetCommandRe // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); @@ -1252,7 +1264,7 @@ void NetPacket::FillBufferWithRunAheadCommand(UnsignedByte *buffer, NetCommandRe // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); // If necessary, specify the command ID of this command. - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(UnsignedShort)); @@ -1260,7 +1272,7 @@ void NetPacket::FillBufferWithRunAheadCommand(UnsignedByte *buffer, NetCommandRe // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnsignedShort newRunAhead = cmdMsg->getRunAhead(); memcpy(buffer + offset, &newRunAhead, sizeof(UnsignedShort)); @@ -1279,20 +1291,20 @@ void NetPacket::FillBufferWithDestroyPlayerCommand(UnsignedByte *buffer, NetComm // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addRunAheadCommand - adding run ahead command")); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); // If necessary, put the execution frame into the packet. - buffer[offset] = 'F'; + buffer[offset] = NetPacketFieldTypes::Frame; ++offset; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(buffer+offset, &newframe, sizeof(UnsignedInt)); @@ -1300,7 +1312,7 @@ void NetPacket::FillBufferWithDestroyPlayerCommand(UnsignedByte *buffer, NetComm // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); @@ -1308,7 +1320,7 @@ void NetPacket::FillBufferWithDestroyPlayerCommand(UnsignedByte *buffer, NetComm // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); // If necessary, specify the command ID of this command. - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(UnsignedShort)); @@ -1316,7 +1328,7 @@ void NetPacket::FillBufferWithDestroyPlayerCommand(UnsignedByte *buffer, NetComm // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnsignedInt newVal = cmdMsg->getPlayerIndex(); memcpy(buffer + offset, &newVal, sizeof(UnsignedInt)); @@ -1328,24 +1340,24 @@ void NetPacket::FillBufferWithKeepAliveCommand(UnsignedByte *buffer, NetCommandR UnsignedShort offset = 0; // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; } @@ -1354,25 +1366,25 @@ void NetPacket::FillBufferWithDisconnectKeepAliveCommand(UnsignedByte *buffer, N UnsignedShort offset = 0; // Put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // Put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); // Put the player ID into the packet. - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; } @@ -1382,13 +1394,13 @@ void NetPacket::FillBufferWithDisconnectPlayerCommand(UnsignedByte *buffer, NetC // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addDisconnectPlayerCommand - adding run ahead command")); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); @@ -1396,7 +1408,7 @@ void NetPacket::FillBufferWithDisconnectPlayerCommand(UnsignedByte *buffer, NetC // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); @@ -1404,7 +1416,7 @@ void NetPacket::FillBufferWithDisconnectPlayerCommand(UnsignedByte *buffer, NetC // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); // If necessary, specify the command ID of this command. - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(UnsignedShort)); @@ -1412,7 +1424,7 @@ void NetPacket::FillBufferWithDisconnectPlayerCommand(UnsignedByte *buffer, NetC // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnsignedByte slot = cmdMsg->getDisconnectSlot(); memcpy(buffer + offset, &slot, sizeof(slot)); @@ -1429,27 +1441,27 @@ void NetPacket::FillBufferWithPacketRouterQueryCommand(UnsignedByte *buffer, Net // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addPacketRouterQueryCommand - adding packet router query command")); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; } @@ -1459,13 +1471,13 @@ void NetPacket::FillBufferWithPacketRouterAckCommand(UnsignedByte *buffer, NetCo // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addPacketRouterAckCommand - adding packet router query command")); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); @@ -1473,14 +1485,14 @@ void NetPacket::FillBufferWithPacketRouterAckCommand(UnsignedByte *buffer, NetCo // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; } @@ -1490,13 +1502,13 @@ void NetPacket::FillBufferWithDisconnectChatCommand(UnsignedByte *buffer, NetCom // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addDisconnectChatCommand - adding run ahead command")); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); @@ -1504,14 +1516,14 @@ void NetPacket::FillBufferWithDisconnectChatCommand(UnsignedByte *buffer, NetCom // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnicodeString unitext = cmdMsg->getText(); UnsignedByte length = unitext.getLength(); @@ -1528,13 +1540,13 @@ void NetPacket::FillBufferWithDisconnectVoteCommand(UnsignedByte *buffer, NetCom // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addDisconnectVoteCommand - adding run ahead command")); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); @@ -1542,7 +1554,7 @@ void NetPacket::FillBufferWithDisconnectVoteCommand(UnsignedByte *buffer, NetCom // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); @@ -1550,7 +1562,7 @@ void NetPacket::FillBufferWithDisconnectVoteCommand(UnsignedByte *buffer, NetCom // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); // If necessary, specify the command ID of this command. - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(UnsignedShort)); @@ -1558,7 +1570,7 @@ void NetPacket::FillBufferWithDisconnectVoteCommand(UnsignedByte *buffer, NetCom // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnsignedByte slot = cmdMsg->getSlot(); memcpy(buffer + offset, &slot, sizeof(slot)); @@ -1575,20 +1587,20 @@ void NetPacket::FillBufferWithChatCommand(UnsignedByte *buffer, NetCommandRef *m // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addDisconnectChatCommand - adding run ahead command")); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the execution frame into the packet. - buffer[offset] = 'F'; + buffer[offset] = NetPacketFieldTypes::Frame; ++offset; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(buffer+offset, &newframe, sizeof(UnsignedInt)); offset += sizeof(UnsignedInt); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); @@ -1596,7 +1608,7 @@ void NetPacket::FillBufferWithChatCommand(UnsignedByte *buffer, NetCommandRef *m // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); @@ -1604,7 +1616,7 @@ void NetPacket::FillBufferWithChatCommand(UnsignedByte *buffer, NetCommandRef *m // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); // If necessary, specify the command ID of this command. - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(UnsignedShort)); @@ -1612,7 +1624,7 @@ void NetPacket::FillBufferWithChatCommand(UnsignedByte *buffer, NetCommandRef *m // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnicodeString unitext = cmdMsg->getText(); UnsignedByte length = unitext.getLength(); @@ -1632,25 +1644,25 @@ void NetPacket::FillBufferWithProgressMessage(UnsignedByte *buffer, NetCommandRe UnsignedShort offset = 0; // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); // Put the player ID into the packet. - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; buffer[offset] = cmdMsg->getPercentage(); @@ -1662,31 +1674,31 @@ void NetPacket::FillBufferWithLoadCompleteMessage(UnsignedByte *buffer, NetComma UnsignedShort offset = 0; // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // If necessary, specify the command ID of this command. - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(UnsignedShort)); offset += sizeof(UnsignedShort); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; } @@ -1695,30 +1707,30 @@ void NetPacket::FillBufferWithTimeOutGameStartMessage(UnsignedByte *buffer, NetC UnsignedShort offset = 0; // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // If necessary, specify the command ID of this command. - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(UnsignedShort)); offset += sizeof(UnsignedShort); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; } @@ -1727,32 +1739,32 @@ void NetPacket::FillBufferWithFileMessage(UnsignedByte *buffer, NetCommandRef *m UnsignedInt offset = 0; // command type - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // relay - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; buffer[offset] = msg->getRelay(); offset += sizeof(UnsignedByte); // player ID - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // command ID - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(newID)); offset += sizeof(newID); // data - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; AsciiString filename = cmdMsg->getPortableFilename(); // PORTABLE @@ -1776,32 +1788,32 @@ void NetPacket::FillBufferWithFileAnnounceMessage(UnsignedByte *buffer, NetComma UnsignedInt offset = 0; // command type - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // relay - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; buffer[offset] = msg->getRelay(); offset += sizeof(UnsignedByte); // player ID - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // command ID - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(newID)); offset += sizeof(newID); // data - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; AsciiString filename = cmdMsg->getPortableFilename(); // PORTABLE @@ -1826,32 +1838,32 @@ void NetPacket::FillBufferWithFileProgressMessage(UnsignedByte *buffer, NetComma UnsignedInt offset = 0; // command type - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // relay - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; buffer[offset] = msg->getRelay(); offset += sizeof(UnsignedByte); // player ID - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // command ID - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(newID)); offset += sizeof(newID); // data - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnsignedShort fileID = cmdMsg->getFileID(); @@ -1868,32 +1880,32 @@ void NetPacket::FillBufferWithDisconnectFrameMessage(UnsignedByte *buffer, NetCo UnsignedInt offset = 0; // command type - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // relay - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; buffer[offset] = msg->getRelay(); offset += sizeof(UnsignedByte); // player ID - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // command ID - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(newID)); offset += sizeof(newID); // data - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnsignedInt disconnectFrame = cmdMsg->getDisconnectFrame(); @@ -1906,32 +1918,32 @@ void NetPacket::FillBufferWithDisconnectScreenOffMessage(UnsignedByte *buffer, N UnsignedInt offset = 0; // command type - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // relay - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; buffer[offset] = msg->getRelay(); offset += sizeof(UnsignedByte); // player ID - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // command ID - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(newID)); offset += sizeof(newID); // data - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnsignedInt newFrame = cmdMsg->getNewFrame(); @@ -1944,32 +1956,32 @@ void NetPacket::FillBufferWithFrameResendRequestMessage(UnsignedByte *buffer, Ne UnsignedInt offset = 0; // command type - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // relay - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; buffer[offset] = msg->getRelay(); offset += sizeof(UnsignedByte); // player ID - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // command ID - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(newID)); offset += sizeof(newID); // data - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnsignedInt frameToResend = cmdMsg->getFrameToResend(); @@ -2132,7 +2144,7 @@ Bool NetPacket::addFrameResendRequestCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -2142,7 +2154,7 @@ Bool NetPacket::addFrameResendRequestCommand(NetCommandRef *msg) { // If necessary, put the execution frame into the packet. if (m_lastFrame != cmdMsg->getExecutionFrame()) { - m_packet[m_packetLen] = 'F'; + m_packet[m_packetLen] = NetPacketFieldTypes::Frame; ++m_packetLen; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(m_packet+m_packetLen, &newframe, sizeof(UnsignedInt)); @@ -2153,7 +2165,7 @@ Bool NetPacket::addFrameResendRequestCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet + m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -2164,7 +2176,7 @@ Bool NetPacket::addFrameResendRequestCommand(NetCommandRef *msg) { // If necessary put the player ID into the packet. if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -2175,7 +2187,7 @@ Bool NetPacket::addFrameResendRequestCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -2183,7 +2195,7 @@ Bool NetPacket::addFrameResendRequestCommand(NetCommandRef *msg) { } m_lastCommandID = cmdMsg->getID(); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnsignedInt frameToResend = cmdMsg->getFrameToResend(); @@ -2226,7 +2238,7 @@ Bool NetPacket::isRoomForFrameResendRequestMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // for 'D' + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedInt); // for the frame to be resent if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; @@ -2241,7 +2253,7 @@ Bool NetPacket::addDisconnectScreenOffCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -2251,7 +2263,7 @@ Bool NetPacket::addDisconnectScreenOffCommand(NetCommandRef *msg) { // If necessary, put the execution frame into the packet. if (m_lastFrame != cmdMsg->getExecutionFrame()) { - m_packet[m_packetLen] = 'F'; + m_packet[m_packetLen] = NetPacketFieldTypes::Frame; ++m_packetLen; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(m_packet+m_packetLen, &newframe, sizeof(UnsignedInt)); @@ -2262,7 +2274,7 @@ Bool NetPacket::addDisconnectScreenOffCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet + m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -2273,7 +2285,7 @@ Bool NetPacket::addDisconnectScreenOffCommand(NetCommandRef *msg) { // If necessary put the player ID into the packet. if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -2284,7 +2296,7 @@ Bool NetPacket::addDisconnectScreenOffCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -2292,7 +2304,7 @@ Bool NetPacket::addDisconnectScreenOffCommand(NetCommandRef *msg) { } m_lastCommandID = cmdMsg->getID(); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnsignedInt newFrame = cmdMsg->getNewFrame(); @@ -2335,7 +2347,7 @@ Bool NetPacket::isRoomForDisconnectScreenOffMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // for 'D' + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedInt); // for the disconnect frame if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; @@ -2350,7 +2362,7 @@ Bool NetPacket::addDisconnectFrameCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -2360,7 +2372,7 @@ Bool NetPacket::addDisconnectFrameCommand(NetCommandRef *msg) { // If necessary, put the execution frame into the packet. if (m_lastFrame != cmdMsg->getExecutionFrame()) { - m_packet[m_packetLen] = 'F'; + m_packet[m_packetLen] = NetPacketFieldTypes::Frame; ++m_packetLen; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(m_packet+m_packetLen, &newframe, sizeof(UnsignedInt)); @@ -2371,7 +2383,7 @@ Bool NetPacket::addDisconnectFrameCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet + m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -2382,7 +2394,7 @@ Bool NetPacket::addDisconnectFrameCommand(NetCommandRef *msg) { // If necessary put the player ID into the packet. if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -2393,7 +2405,7 @@ Bool NetPacket::addDisconnectFrameCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -2401,7 +2413,7 @@ Bool NetPacket::addDisconnectFrameCommand(NetCommandRef *msg) { } m_lastCommandID = cmdMsg->getID(); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnsignedInt disconnectFrame = cmdMsg->getDisconnectFrame(); @@ -2444,7 +2456,7 @@ Bool NetPacket::isRoomForDisconnectFrameMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // for 'D' + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedInt); // for the disconnect frame if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; @@ -2459,7 +2471,7 @@ Bool NetPacket::addFileCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -2469,7 +2481,7 @@ Bool NetPacket::addFileCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet + m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -2480,7 +2492,7 @@ Bool NetPacket::addFileCommand(NetCommandRef *msg) { // If necessary put the player ID into the packet. if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -2491,7 +2503,7 @@ Bool NetPacket::addFileCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -2500,7 +2512,7 @@ Bool NetPacket::addFileCommand(NetCommandRef *msg) { m_lastCommandID = cmdMsg->getID(); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; AsciiString filename = cmdMsg->getPortableFilename(); // PORTABLE @@ -2542,7 +2554,7 @@ Bool NetPacket::isRoomForFileMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte) + sizeof(UnsignedShort); } - ++len; // 'D' + ++len; // NetPacketFieldTypes::Data len += cmdMsg->getPortableFilename().getLength() + 1; // PORTABLE filename + the terminating 0 len += sizeof(UnsignedInt); // filedata length len += cmdMsg->getFileLength(); @@ -2561,7 +2573,7 @@ Bool NetPacket::addFileAnnounceCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -2571,7 +2583,7 @@ Bool NetPacket::addFileAnnounceCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet + m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -2582,7 +2594,7 @@ Bool NetPacket::addFileAnnounceCommand(NetCommandRef *msg) { // If necessary put the player ID into the packet. if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -2593,7 +2605,7 @@ Bool NetPacket::addFileAnnounceCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -2602,7 +2614,7 @@ Bool NetPacket::addFileAnnounceCommand(NetCommandRef *msg) { m_lastCommandID = cmdMsg->getID(); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; AsciiString filename = cmdMsg->getPortableFilename(); // PORTABLE @@ -2649,7 +2661,7 @@ Bool NetPacket::isRoomForFileAnnounceMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte) + sizeof(UnsignedShort); } - ++len; // 'D' + ++len; // NetPacketFieldTypes::Data len += cmdMsg->getPortableFilename().getLength() + 1; // PORTABLE filename + the terminating 0 len += sizeof(UnsignedShort); // m_fileID len += sizeof(UnsignedByte); // m_playerMask @@ -2668,7 +2680,7 @@ Bool NetPacket::addFileProgressCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -2678,7 +2690,7 @@ Bool NetPacket::addFileProgressCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet + m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -2689,7 +2701,7 @@ Bool NetPacket::addFileProgressCommand(NetCommandRef *msg) { // If necessary put the player ID into the packet. if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -2700,7 +2712,7 @@ Bool NetPacket::addFileProgressCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -2709,7 +2721,7 @@ Bool NetPacket::addFileProgressCommand(NetCommandRef *msg) { m_lastCommandID = cmdMsg->getID(); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnsignedShort fileID = cmdMsg->getFileID(); @@ -2749,7 +2761,7 @@ Bool NetPacket::isRoomForFileProgressMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte) + sizeof(UnsignedShort); } - ++len; // 'D' + ++len; // NetPacketFieldTypes::Data len += sizeof(UnsignedShort); // m_fileID len += sizeof(Int); // m_progress @@ -2767,7 +2779,7 @@ Bool NetPacket::addWrapperCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -2777,7 +2789,7 @@ Bool NetPacket::addWrapperCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet + m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -2788,7 +2800,7 @@ Bool NetPacket::addWrapperCommand(NetCommandRef *msg) { // If necessary put the player ID into the packet. if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -2799,7 +2811,7 @@ Bool NetPacket::addWrapperCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -2808,7 +2820,7 @@ Bool NetPacket::addWrapperCommand(NetCommandRef *msg) { m_lastCommandID = cmdMsg->getID(); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; // wrapped command ID @@ -2879,7 +2891,7 @@ Bool NetPacket::isRoomForWrapperMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte) + sizeof(UnsignedShort); } - ++len; // 'D' + ++len; // NetPacketFieldTypes::Data len += sizeof(UnsignedShort); // wrapped command ID len += sizeof(UnsignedInt); // chunk number len += sizeof(UnsignedInt); // number of chunks @@ -2905,7 +2917,7 @@ Bool NetPacket::addTimeOutGameStartMessage(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -2915,7 +2927,7 @@ Bool NetPacket::addTimeOutGameStartMessage(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -2925,7 +2937,7 @@ Bool NetPacket::addTimeOutGameStartMessage(NetCommandRef *msg) { } if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -2936,7 +2948,7 @@ Bool NetPacket::addTimeOutGameStartMessage(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -2944,7 +2956,7 @@ Bool NetPacket::addTimeOutGameStartMessage(NetCommandRef *msg) { } m_lastCommandID = cmdMsg->getID(); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; ++m_numCommands; @@ -2978,7 +2990,7 @@ Bool NetPacket::isRoomForTimeOutGameStartMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // For the 'D' + ++len; // For the NetPacketFieldTypes::Data if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; } @@ -2997,7 +3009,7 @@ Bool NetPacket::addLoadCompleteMessage(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -3007,7 +3019,7 @@ Bool NetPacket::addLoadCompleteMessage(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -3017,7 +3029,7 @@ Bool NetPacket::addLoadCompleteMessage(NetCommandRef *msg) { } if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -3028,7 +3040,7 @@ Bool NetPacket::addLoadCompleteMessage(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -3036,7 +3048,7 @@ Bool NetPacket::addLoadCompleteMessage(NetCommandRef *msg) { } m_lastCommandID = cmdMsg->getID(); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; ++m_numCommands; @@ -3070,7 +3082,7 @@ Bool NetPacket::isRoomForLoadCompleteMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // For the 'D' + ++len; // For the NetPacketFieldTypes::Data if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; } @@ -3089,7 +3101,7 @@ Bool NetPacket::addProgressMessage(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -3099,7 +3111,7 @@ Bool NetPacket::addProgressMessage(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -3109,7 +3121,7 @@ Bool NetPacket::addProgressMessage(NetCommandRef *msg) { } if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -3117,7 +3129,7 @@ Bool NetPacket::addProgressMessage(NetCommandRef *msg) { m_lastPlayerID = cmdMsg->getPlayerID(); } - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPercentage(); @@ -3154,7 +3166,7 @@ Bool NetPacket::isRoomForProgressMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // For the 'D' + ++len; // For the NetPacketFieldTypes::Data ++len; // percentage if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; @@ -3175,7 +3187,7 @@ Bool NetPacket::addDisconnectVoteCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -3185,7 +3197,7 @@ Bool NetPacket::addDisconnectVoteCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -3197,7 +3209,7 @@ Bool NetPacket::addDisconnectVoteCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -3210,7 +3222,7 @@ Bool NetPacket::addDisconnectVoteCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -3220,7 +3232,7 @@ Bool NetPacket::addDisconnectVoteCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnsignedByte slot = cmdMsg->getSlot(); memcpy(m_packet + m_packetLen, &slot, sizeof(slot)); @@ -3265,7 +3277,7 @@ Bool NetPacket::isRoomForDisconnectVoteMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // the 'D' + ++len; // the NetPacketFieldTypes::Data len += sizeof(UnsignedByte); // slot number len += sizeof(UnsignedInt); // vote frame @@ -3285,7 +3297,7 @@ Bool NetPacket::addDisconnectChatCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -3295,7 +3307,7 @@ Bool NetPacket::addDisconnectChatCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -3307,7 +3319,7 @@ Bool NetPacket::addDisconnectChatCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -3317,7 +3329,7 @@ Bool NetPacket::addDisconnectChatCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnicodeString unitext = cmdMsg->getText(); UnsignedByte length = unitext.getLength(); @@ -3354,7 +3366,7 @@ Bool NetPacket::isRoomForDisconnectChatMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // the 'D' + ++len; // the NetPacketFieldTypes::Data len += sizeof(UnsignedByte); // string length UnsignedByte textLen = cmdMsg->getText().getLength(); len += textLen * sizeof(UnsignedShort); @@ -3372,7 +3384,7 @@ Bool NetPacket::addChatCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -3382,7 +3394,7 @@ Bool NetPacket::addChatCommand(NetCommandRef *msg) { // If necessary, put the execution frame into the packet. if (m_lastFrame != cmdMsg->getExecutionFrame()) { - m_packet[m_packetLen] = 'F'; + m_packet[m_packetLen] = NetPacketFieldTypes::Frame; ++m_packetLen; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(m_packet+m_packetLen, &newframe, sizeof(UnsignedInt)); @@ -3393,7 +3405,7 @@ Bool NetPacket::addChatCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -3405,7 +3417,7 @@ Bool NetPacket::addChatCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -3418,7 +3430,7 @@ Bool NetPacket::addChatCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -3428,7 +3440,7 @@ Bool NetPacket::addChatCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnicodeString unitext = cmdMsg->getText(); UnsignedByte length = unitext.getLength(); @@ -3477,7 +3489,7 @@ Bool NetPacket::isRoomForChatMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // the 'D' + ++len; // the NetPacketFieldTypes::Data len += sizeof(UnsignedByte); // string length UnsignedByte textLen = cmdMsg->getText().getLength(); len += textLen * sizeof(UnsignedShort); @@ -3496,7 +3508,7 @@ Bool NetPacket::addPacketRouterAckCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -3506,7 +3518,7 @@ Bool NetPacket::addPacketRouterAckCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -3518,7 +3530,7 @@ Bool NetPacket::addPacketRouterAckCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -3528,7 +3540,7 @@ Bool NetPacket::addPacketRouterAckCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket - added packet router ack command, player id %d", m_lastPlayerID)); @@ -3561,7 +3573,7 @@ Bool NetPacket::isRoomForPacketRouterAckMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // the 'D' + ++len; // the NetPacketFieldTypes::Data if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; } @@ -3576,7 +3588,7 @@ Bool NetPacket::addPacketRouterQueryCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -3586,7 +3598,7 @@ Bool NetPacket::addPacketRouterQueryCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -3598,7 +3610,7 @@ Bool NetPacket::addPacketRouterQueryCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -3608,7 +3620,7 @@ Bool NetPacket::addPacketRouterQueryCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket - added packet router query command, player id %d", m_lastPlayerID)); @@ -3641,7 +3653,7 @@ Bool NetPacket::isRoomForPacketRouterQueryMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // the 'D' + ++len; // the NetPacketFieldTypes::Data if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; } @@ -3659,7 +3671,7 @@ Bool NetPacket::addDisconnectPlayerCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -3669,7 +3681,7 @@ Bool NetPacket::addDisconnectPlayerCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -3681,7 +3693,7 @@ Bool NetPacket::addDisconnectPlayerCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -3694,7 +3706,7 @@ Bool NetPacket::addDisconnectPlayerCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -3704,7 +3716,7 @@ Bool NetPacket::addDisconnectPlayerCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnsignedByte slot = cmdMsg->getDisconnectSlot(); memcpy(m_packet + m_packetLen, &slot, sizeof(slot)); @@ -3749,7 +3761,7 @@ Bool NetPacket::isRoomForDisconnectPlayerMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // the 'D' + ++len; // the NetPacketFieldTypes::Data len += sizeof(UnsignedByte); // slot number len += sizeof(UnsignedInt); // disconnectFrame if ((len + m_packetLen) > MAX_PACKET_SIZE) { @@ -3768,7 +3780,7 @@ Bool NetPacket::addDisconnectKeepAliveCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -3778,7 +3790,7 @@ Bool NetPacket::addDisconnectKeepAliveCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -3788,7 +3800,7 @@ Bool NetPacket::addDisconnectKeepAliveCommand(NetCommandRef *msg) { } if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -3796,7 +3808,7 @@ Bool NetPacket::addDisconnectKeepAliveCommand(NetCommandRef *msg) { m_lastPlayerID = cmdMsg->getPlayerID(); } - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; ++m_numCommands; @@ -3830,7 +3842,7 @@ Bool NetPacket::isRoomForDisconnectKeepAliveMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // For the 'D' + ++len; // For the NetPacketFieldTypes::Data if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; } @@ -3846,7 +3858,7 @@ Bool NetPacket::addKeepAliveCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -3856,7 +3868,7 @@ Bool NetPacket::addKeepAliveCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -3866,7 +3878,7 @@ Bool NetPacket::addKeepAliveCommand(NetCommandRef *msg) { } if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -3874,7 +3886,7 @@ Bool NetPacket::addKeepAliveCommand(NetCommandRef *msg) { m_lastPlayerID = cmdMsg->getPlayerID(); } - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; ++m_numCommands; @@ -3908,7 +3920,7 @@ Bool NetPacket::isRoomForKeepAliveMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // For the 'D' + ++len; // For the NetPacketFieldTypes::Data if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; } @@ -3926,7 +3938,7 @@ Bool NetPacket::addRunAheadCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -3936,7 +3948,7 @@ Bool NetPacket::addRunAheadCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -3947,7 +3959,7 @@ Bool NetPacket::addRunAheadCommand(NetCommandRef *msg) { // If necessary, put the execution frame into the packet. if (m_lastFrame != cmdMsg->getExecutionFrame()) { - m_packet[m_packetLen] = 'F'; + m_packet[m_packetLen] = NetPacketFieldTypes::Frame; ++m_packetLen; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(m_packet+m_packetLen, &newframe, sizeof(UnsignedInt)); @@ -3959,7 +3971,7 @@ Bool NetPacket::addRunAheadCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -3972,7 +3984,7 @@ Bool NetPacket::addRunAheadCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -3982,7 +3994,7 @@ Bool NetPacket::addRunAheadCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnsignedShort newRunAhead = cmdMsg->getRunAhead(); memcpy(m_packet + m_packetLen, &newRunAhead, sizeof(UnsignedShort)); @@ -4030,7 +4042,7 @@ Bool NetPacket::isRoomForRunAheadMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // for 'D' + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedShort); len += sizeof(UnsignedByte); if ((len + m_packetLen) > MAX_PACKET_SIZE) { @@ -4049,7 +4061,7 @@ Bool NetPacket::addDestroyPlayerCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -4059,7 +4071,7 @@ Bool NetPacket::addDestroyPlayerCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -4070,7 +4082,7 @@ Bool NetPacket::addDestroyPlayerCommand(NetCommandRef *msg) { // If necessary, put the execution frame into the packet. if (m_lastFrame != cmdMsg->getExecutionFrame()) { - m_packet[m_packetLen] = 'F'; + m_packet[m_packetLen] = NetPacketFieldTypes::Frame; ++m_packetLen; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(m_packet+m_packetLen, &newframe, sizeof(UnsignedInt)); @@ -4082,7 +4094,7 @@ Bool NetPacket::addDestroyPlayerCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -4095,7 +4107,7 @@ Bool NetPacket::addDestroyPlayerCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -4105,7 +4117,7 @@ Bool NetPacket::addDestroyPlayerCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnsignedInt newVal = cmdMsg->getPlayerIndex(); memcpy(m_packet + m_packetLen, &newVal, sizeof(UnsignedInt)); @@ -4149,7 +4161,7 @@ Bool NetPacket::isRoomForDestroyPlayerMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // for 'D' + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedInt); if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; @@ -4168,7 +4180,7 @@ Bool NetPacket::addRunAheadMetricsCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -4178,7 +4190,7 @@ Bool NetPacket::addRunAheadMetricsCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -4190,7 +4202,7 @@ Bool NetPacket::addRunAheadMetricsCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -4203,7 +4215,7 @@ Bool NetPacket::addRunAheadMetricsCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -4213,7 +4225,7 @@ Bool NetPacket::addRunAheadMetricsCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; // write the average latency Real averageLatency = cmdMsg->getAverageLatency(); @@ -4257,7 +4269,7 @@ Bool NetPacket::isRoomForRunAheadMetricsMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // 'D' + ++len; // NetPacketFieldTypes::Data len += sizeof(UnsignedShort); len += sizeof(Real); if ((len + m_packetLen) > MAX_PACKET_SIZE) { @@ -4278,7 +4290,7 @@ Bool NetPacket::addPlayerLeaveCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -4288,7 +4300,7 @@ Bool NetPacket::addPlayerLeaveCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -4299,7 +4311,7 @@ Bool NetPacket::addPlayerLeaveCommand(NetCommandRef *msg) { // If necessary, put the execution frame into the packet. if (m_lastFrame != cmdMsg->getExecutionFrame()) { - m_packet[m_packetLen] = 'F'; + m_packet[m_packetLen] = NetPacketFieldTypes::Frame; ++m_packetLen; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(m_packet+m_packetLen, &newframe, sizeof(UnsignedInt)); @@ -4311,7 +4323,7 @@ Bool NetPacket::addPlayerLeaveCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -4324,7 +4336,7 @@ Bool NetPacket::addPlayerLeaveCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -4334,7 +4346,7 @@ Bool NetPacket::addPlayerLeaveCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnsignedByte leavingPlayerID = cmdMsg->getLeavingPlayerID(); memcpy(m_packet + m_packetLen, &leavingPlayerID, sizeof(UnsignedByte)); @@ -4376,7 +4388,7 @@ Bool NetPacket::isRoomForPlayerLeaveMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // for 'D' + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedByte); if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; @@ -4411,7 +4423,7 @@ Bool NetPacket::addFrameCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -4421,7 +4433,7 @@ Bool NetPacket::addFrameCommand(NetCommandRef *msg) { // If necessary, put the execution frame into the packet. if (m_lastFrame != cmdMsg->getExecutionFrame()) { - m_packet[m_packetLen] = 'F'; + m_packet[m_packetLen] = NetPacketFieldTypes::Frame; ++m_packetLen; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(m_packet+m_packetLen, &newframe, sizeof(UnsignedInt)); @@ -4432,7 +4444,7 @@ Bool NetPacket::addFrameCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -4444,7 +4456,7 @@ Bool NetPacket::addFrameCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -4457,7 +4469,7 @@ Bool NetPacket::addFrameCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -4467,7 +4479,7 @@ Bool NetPacket::addFrameCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnsignedShort cmdCount = cmdMsg->getCommandCount(); memcpy(m_packet + m_packetLen, &cmdCount, sizeof(UnsignedShort)); @@ -4512,7 +4524,7 @@ Bool NetPacket::isRoomForFrameMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // for 'D' + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedShort); if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; @@ -4590,7 +4602,7 @@ Bool NetPacket::addAckCommand(NetCommandRef *msg, UnsignedShort commandID, Unsig // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addAckCommand - adding ack for command %d for player %d", cmdMsg->getCommandID(), msg->getCommand()->getPlayerID())); // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -4599,7 +4611,7 @@ Bool NetPacket::addAckCommand(NetCommandRef *msg, UnsignedShort commandID, Unsig } if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -4608,7 +4620,7 @@ Bool NetPacket::addAckCommand(NetCommandRef *msg, UnsignedShort commandID, Unsig } // Put in the command id of the command we are acking. - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; memcpy(m_packet + m_packetLen, &commandID, sizeof(UnsignedShort)); m_packetLen += sizeof(UnsignedShort); @@ -4641,7 +4653,7 @@ Bool NetPacket::isRoomForAckMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // for 'D' + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedShort); len += sizeof(UnsignedByte); if ((len + m_packetLen) > MAX_PACKET_SIZE) { @@ -4732,7 +4744,7 @@ Bool NetPacket::addGameCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -4742,7 +4754,7 @@ Bool NetPacket::addGameCommand(NetCommandRef *msg) { // If necessary, put the execution frame into the packet. if (m_lastFrame != cmdMsg->getExecutionFrame()) { - m_packet[m_packetLen] = 'F'; + m_packet[m_packetLen] = NetPacketFieldTypes::Frame; ++m_packetLen; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(m_packet+m_packetLen, &newframe, sizeof(UnsignedInt)); @@ -4753,7 +4765,7 @@ Bool NetPacket::addGameCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -4764,7 +4776,7 @@ Bool NetPacket::addGameCommand(NetCommandRef *msg) { // If necessary, put the playerID into the packet. if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -4776,7 +4788,7 @@ Bool NetPacket::addGameCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -4784,7 +4796,7 @@ Bool NetPacket::addGameCommand(NetCommandRef *msg) { } m_lastCommandID = cmdMsg->getID(); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; // Now copy the GameMessage type into the packet. @@ -4920,7 +4932,7 @@ Bool NetPacket::isRoomForGameMessage(NetCommandRef *msg, GameMessage *gmsg) { GameMessageParser *parser = newInstance(GameMessageParser)(gmsg); - ++msglen; // for 'D' + ++msglen; // for NetPacketFieldTypes::Data msglen += sizeof(GameMessage::Type); msglen += sizeof(UnsignedByte); // Int numTypes = parser->getNumTypes(); @@ -5002,32 +5014,32 @@ NetCommandList * NetPacket::getCommandList() { switch(m_packet[i]) { - case 'T': + case NetPacketFieldTypes::CommandType: ++i; memcpy(&commandType, m_packet + i, sizeof(UnsignedByte)); i += sizeof(UnsignedByte); break; - case 'F': + case NetPacketFieldTypes::Frame: ++i; memcpy(&frame, m_packet + i, sizeof(UnsignedInt)); i += sizeof(UnsignedInt); break; - case 'P': + case NetPacketFieldTypes::PlayerId: ++i; memcpy(&playerID, m_packet + i, sizeof(UnsignedByte)); i += sizeof(UnsignedByte); break; - case 'R': + case NetPacketFieldTypes::Relay: ++i; memcpy(&relay, m_packet + i, sizeof(UnsignedByte)); i += sizeof(UnsignedByte); break; - case 'C': + case NetPacketFieldTypes::CommandId: ++i; memcpy(&commandID, m_packet + i, sizeof(UnsignedShort)); i += sizeof(UnsignedShort); break; - case 'D': { + case NetPacketFieldTypes::Data: { ++i; NetCommandMsg *msg = NULL; diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetPacket.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetPacket.cpp index 776ad7eb02b..6b5007a4b69 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetPacket.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetPacket.cpp @@ -31,7 +31,19 @@ #include "GameNetwork/NetworkDefs.h" #include "GameNetwork/networkutil.h" #include "GameNetwork/GameMessageParser.h" +#include +// TheSuperHackers @refactor BobTista 10/06/2025 Extract magic character literals into named constants for improved readability +typedef UnsignedByte NetPacketFieldType; + +namespace NetPacketFieldTypes { + constexpr const NetPacketFieldType CommandType = 'T'; // NetCommandType field + constexpr const NetPacketFieldType Relay = 'R'; // Relay field + constexpr const NetPacketFieldType PlayerId = 'P'; // Player ID field + constexpr const NetPacketFieldType CommandId = 'C'; // Command ID field + constexpr const NetPacketFieldType Frame = 'F'; // Frame field + constexpr const NetPacketFieldType Data = 'D'; // Data payload field +} // This function assumes that all of the fields are either of default value or are // present in the raw data. @@ -50,37 +62,37 @@ NetCommandRef * NetPacket::ConstructNetCommandMsgFromRawData(UnsignedByte *data, switch (data[offset]) { - case 'T': + case NetPacketFieldTypes::CommandType: ++offset; memcpy(&commandType, data + offset, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); break; - case 'R': + case NetPacketFieldTypes::Relay: ++offset; memcpy(&relay, data + offset, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); break; - case 'P': + case NetPacketFieldTypes::PlayerId: ++offset; memcpy(&playerID, data + offset, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); break; - case 'C': + case NetPacketFieldTypes::CommandId: ++offset; memcpy(&commandID, data + offset, sizeof(UnsignedShort)); offset += sizeof(UnsignedShort); break; - case 'F': + case NetPacketFieldTypes::Frame: ++offset; memcpy(&frame, data + offset, sizeof(UnsignedInt)); offset += sizeof(UnsignedInt); break; - case 'D': + case NetPacketFieldTypes::Data: ++offset; switch (commandType) { @@ -348,7 +360,7 @@ UnsignedInt NetPacket::GetGameCommandSize(NetCommandMsg *msg) { msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // relay msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // command type msglen += sizeof(UnsignedShort) + sizeof(UnsignedByte); // command ID - msglen += sizeof(UnsignedByte); // the 'D' for the data section. + msglen += sizeof(UnsignedByte); // the NetPacketFieldTypes::Data for the data section. GameMessage *gmsg = cmdMsg->constructGameMessage(); GameMessageParser *parser = newInstance(GameMessageParser)(gmsg); @@ -519,7 +531,7 @@ UnsignedInt NetPacket::GetKeepAliveCommandSize(NetCommandMsg *msg) { ++msglen; msglen += sizeof(UnsignedByte); - ++msglen; // For the 'D' + ++msglen; // For the NetPacketFieldTypes::Data return msglen; } @@ -533,7 +545,7 @@ UnsignedInt NetPacket::GetDisconnectKeepAliveCommandSize(NetCommandMsg *msg) { ++msglen; msglen += sizeof(UnsignedByte); - ++msglen; // For the 'D' + ++msglen; // For the NetPacketFieldTypes::Data return msglen; } @@ -548,7 +560,7 @@ UnsignedInt NetPacket::GetDisconnectPlayerCommandSize(NetCommandMsg *msg) { msglen += sizeof(UnsignedByte); msglen += sizeof(UnsignedShort) + sizeof(UnsignedByte); - ++msglen; // the 'D' + ++msglen; // the NetPacketFieldTypes::Data msglen += sizeof(UnsignedByte); // slot number msglen += sizeof(UnsignedInt); // disconnect frame @@ -564,7 +576,7 @@ UnsignedInt NetPacket::GetPacketRouterQueryCommandSize(NetCommandMsg *msg) { ++msglen; msglen += sizeof(UnsignedByte); - ++msglen; // the 'D' + ++msglen; // the NetPacketFieldTypes::Data return msglen; } @@ -578,7 +590,7 @@ UnsignedInt NetPacket::GetPacketRouterAckCommandSize(NetCommandMsg *msg) { ++msglen; msglen += sizeof(UnsignedByte); - ++msglen; // the 'D' + ++msglen; // the NetPacketFieldTypes::Data return msglen; } @@ -593,7 +605,7 @@ UnsignedInt NetPacket::GetDisconnectChatCommandSize(NetCommandMsg *msg) { ++msglen; msglen += sizeof(UnsignedByte); - ++msglen; // the 'D' + ++msglen; // the NetPacketFieldTypes::Data msglen += sizeof(UnsignedByte); // string msglength UnsignedByte textmsglen = cmdMsg->getText().getLength(); msglen += textmsglen * sizeof(UnsignedShort); @@ -611,7 +623,7 @@ UnsignedInt NetPacket::GetDisconnectVoteCommandSize(NetCommandMsg *msg) { msglen += sizeof(UnsignedByte); msglen += sizeof(UnsignedShort) + sizeof(UnsignedByte); - ++msglen; // the 'D' + ++msglen; // the NetPacketFieldTypes::Data msglen += sizeof(UnsignedByte); // slot number msglen += sizeof(UnsignedInt); // vote frame. @@ -630,7 +642,7 @@ UnsignedInt NetPacket::GetChatCommandSize(NetCommandMsg *msg) { msglen += sizeof(UnsignedByte); msglen += sizeof(UnsignedShort) + sizeof(UnsignedByte); - ++msglen; // the 'D' + ++msglen; // the NetPacketFieldTypes::Data msglen += sizeof(UnsignedByte); // string msglength UnsignedByte textmsglen = cmdMsg->getText().getLength(); msglen += textmsglen * sizeof(UnsignedShort); @@ -648,7 +660,7 @@ UnsignedInt NetPacket::GetProgressMessageSize(NetCommandMsg *msg) { ++msglen; msglen += sizeof(UnsignedByte); - ++msglen; // For the 'D' + ++msglen; // For the NetPacketFieldTypes::Data ++msglen; // percentage return msglen; @@ -663,7 +675,7 @@ UnsignedInt NetPacket::GetLoadCompleteMessageSize(NetCommandMsg *msg) { ++msglen; msglen += sizeof(UnsignedByte); - ++msglen; // For the 'D' + ++msglen; // For the NetPacketFieldTypes::Data return msglen; } @@ -677,7 +689,7 @@ UnsignedInt NetPacket::GetTimeOutGameStartMessageSize(NetCommandMsg *msg) { ++msglen; msglen += sizeof(UnsignedByte); - ++msglen; // For the 'D' + ++msglen; // For the NetPacketFieldTypes::Data return msglen; } @@ -686,12 +698,12 @@ UnsignedInt NetPacket::GetTimeOutGameStartMessageSize(NetCommandMsg *msg) { UnsignedInt NetPacket::GetWrapperCommandSize(NetCommandMsg *msg) { UnsignedInt msglen = 0; - ++msglen; // 'T' + ++msglen; // NetPacketFieldTypes::CommandType msglen += sizeof(UnsignedByte); // command type - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'P' and player ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // 'C' and command ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'R' and relay - ++msglen; // 'D' + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::PlayerId and player ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // NetPacketFieldTypes::CommandId and command ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::Relay and relay + ++msglen; // NetPacketFieldTypes::Data msglen += sizeof(UnsignedShort); // m_wrappedCommandID msglen += sizeof(UnsignedInt); // m_chunkNumber @@ -706,12 +718,12 @@ UnsignedInt NetPacket::GetWrapperCommandSize(NetCommandMsg *msg) { UnsignedInt NetPacket::GetFileCommandSize(NetCommandMsg *msg) { NetFileCommandMsg *filemsg = (NetFileCommandMsg *)msg; UnsignedInt msglen = 0; - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'T' and command type - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'P' and player ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // 'C' and command ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'R' and relay + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::CommandType and command type + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::PlayerId and player ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // NetPacketFieldTypes::CommandId and command ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::Relay and relay - ++msglen; // 'D' + ++msglen; // NetPacketFieldTypes::Data msglen += filemsg->getPortableFilename().getLength() + 1; // PORTABLE filename and the terminating 0 msglen += sizeof(UnsignedInt); // file data length @@ -723,12 +735,12 @@ UnsignedInt NetPacket::GetFileCommandSize(NetCommandMsg *msg) { UnsignedInt NetPacket::GetFileAnnounceCommandSize(NetCommandMsg *msg) { NetFileAnnounceCommandMsg *filemsg = (NetFileAnnounceCommandMsg *)msg; UnsignedInt msglen = 0; - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'T' and command type - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'P' and player ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // 'C' and command ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'R' and relay + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::CommandType and command type + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::PlayerId and player ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // NetPacketFieldTypes::CommandId and command ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::Relay and relay - ++msglen; // 'D' + ++msglen; // NetPacketFieldTypes::Data msglen += filemsg->getPortableFilename().getLength() + 1; // PORTABLE filename and the terminating 0 msglen += sizeof(UnsignedShort); // m_fileID @@ -739,12 +751,12 @@ UnsignedInt NetPacket::GetFileAnnounceCommandSize(NetCommandMsg *msg) { UnsignedInt NetPacket::GetFileProgressCommandSize(NetCommandMsg *msg) { UnsignedInt msglen = 0; - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'T' and command type - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'P' and player ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // 'C' and command ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'R' and relay + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::CommandType and command type + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::PlayerId and player ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // NetPacketFieldTypes::CommandId and command ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::Relay and relay - ++msglen; // 'D' + ++msglen; // NetPacketFieldTypes::Data msglen += sizeof(UnsignedShort); // m_fileID msglen += sizeof(Int); // m_progress @@ -754,12 +766,12 @@ UnsignedInt NetPacket::GetFileProgressCommandSize(NetCommandMsg *msg) { UnsignedInt NetPacket::GetDisconnectFrameCommandSize(NetCommandMsg *msg) { UnsignedInt msglen = 0; - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'T' and command type - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'P' and player ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // 'C' and command ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'R' and relay + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::CommandType and command type + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::PlayerId and player ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // NetPacketFieldTypes::CommandId and command ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::Relay and relay - ++msglen; // 'D' + ++msglen; // NetPacketFieldTypes::Data msglen += sizeof(UnsignedInt); // disconnect frame return msglen; @@ -767,12 +779,12 @@ UnsignedInt NetPacket::GetDisconnectFrameCommandSize(NetCommandMsg *msg) { UnsignedInt NetPacket::GetDisconnectScreenOffCommandSize(NetCommandMsg *msg) { UnsignedInt msglen = 0; - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'T' and command type - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'P' and player ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // 'C' and command ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'R' and relay + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::CommandType and command type + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::PlayerId and player ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // NetPacketFieldTypes::CommandId and command ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::Relay and relay - ++msglen; // 'D' + ++msglen; // NetPacketFieldTypes::Data msglen += sizeof(UnsignedInt); // new frame return msglen; @@ -780,12 +792,12 @@ UnsignedInt NetPacket::GetDisconnectScreenOffCommandSize(NetCommandMsg *msg) { UnsignedInt NetPacket::GetFrameResendRequestCommandSize(NetCommandMsg *msg) { UnsignedInt msglen = 0; - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'T' and command type - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'P' and player ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // 'C' and command ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // 'R' and relay + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::CommandType and command type + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::PlayerId and player ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // NetPacketFieldTypes::CommandId and command ID + msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::Relay and relay - ++msglen; // 'D' + ++msglen; // NetPacketFieldTypes::Data msglen += sizeof(UnsignedInt); // frame to resend return msglen; @@ -886,39 +898,39 @@ void NetPacket::FillBufferWithGameCommand(UnsignedByte *buffer, NetCommandRef *m //DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::FillBufferWithGameCommand for command ID %d", cmdMsg->getID())); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the execution frame into the packet. - buffer[offset] = 'F'; + buffer[offset] = NetPacketFieldTypes::Frame; ++offset; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(buffer+offset, &newframe, sizeof(UnsignedInt)); offset += sizeof(UnsignedInt); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); // If necessary, put the playerID into the packet. - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // If necessary, specify the command ID of this command. - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(UnsignedShort)); offset += sizeof(UnsignedShort); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; // Now copy the GameMessage type into the packet. @@ -1045,18 +1057,18 @@ void NetPacket::FillBufferWithAckCommand(UnsignedByte *buffer, NetCommandRef *ms } - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = type; offset += sizeof(UnsignedByte); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // Put in the command id of the command we are acking. - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; memcpy(buffer + offset, &commandID, sizeof(UnsignedShort)); offset += sizeof(UnsignedShort); @@ -1072,20 +1084,20 @@ void NetPacket::FillBufferWithFrameCommand(UnsignedByte *buffer, NetCommandRef * // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addFrameCommand - adding frame command for frame %d, command count = %d, command id = %d", cmdMsg->getExecutionFrame(), cmdMsg->getCommandCount(), cmdMsg->getID())); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the execution frame into the packet. - buffer[offset] = 'F'; + buffer[offset] = NetPacketFieldTypes::Frame; ++offset; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(buffer+offset, &newframe, sizeof(UnsignedInt)); offset += sizeof(UnsignedInt); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); @@ -1093,7 +1105,7 @@ void NetPacket::FillBufferWithFrameCommand(UnsignedByte *buffer, NetCommandRef * // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); @@ -1101,7 +1113,7 @@ void NetPacket::FillBufferWithFrameCommand(UnsignedByte *buffer, NetCommandRef * // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); // If necessary, specify the command ID of this command. - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(UnsignedShort)); @@ -1109,7 +1121,7 @@ void NetPacket::FillBufferWithFrameCommand(UnsignedByte *buffer, NetCommandRef * // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnsignedShort cmdCount = cmdMsg->getCommandCount(); memcpy(buffer + offset, &cmdCount, sizeof(UnsignedShort)); @@ -1125,20 +1137,20 @@ void NetPacket::FillBufferWithPlayerLeaveCommand(UnsignedByte *buffer, NetComman // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addPlayerLeaveCommand - adding player leave command for player %d", cmdMsg->getLeavingPlayerID())); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); // If necessary, put the execution frame into the packet. - buffer[offset] = 'F'; + buffer[offset] = NetPacketFieldTypes::Frame; ++offset; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(buffer+offset, &newframe, sizeof(UnsignedInt)); @@ -1146,7 +1158,7 @@ void NetPacket::FillBufferWithPlayerLeaveCommand(UnsignedByte *buffer, NetComman // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); @@ -1154,7 +1166,7 @@ void NetPacket::FillBufferWithPlayerLeaveCommand(UnsignedByte *buffer, NetComman // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); // If necessary, specify the command ID of this command. - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(UnsignedShort)); @@ -1162,7 +1174,7 @@ void NetPacket::FillBufferWithPlayerLeaveCommand(UnsignedByte *buffer, NetComman // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnsignedByte leavingPlayerID = cmdMsg->getLeavingPlayerID(); memcpy(buffer + offset, &leavingPlayerID, sizeof(UnsignedByte)); @@ -1175,13 +1187,13 @@ void NetPacket::FillBufferWithRunAheadMetricsCommand(UnsignedByte *buffer, NetCo // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addRunAheadMetricsCommand - adding run ahead metrics for player %d, fps = %d, latency = %f", cmdMsg->getPlayerID(), cmdMsg->getAverageFps(), cmdMsg->getAverageLatency())); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); @@ -1189,7 +1201,7 @@ void NetPacket::FillBufferWithRunAheadMetricsCommand(UnsignedByte *buffer, NetCo // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); @@ -1197,7 +1209,7 @@ void NetPacket::FillBufferWithRunAheadMetricsCommand(UnsignedByte *buffer, NetCo // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); // If necessary, specify the command ID of this command. - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(UnsignedShort)); @@ -1205,7 +1217,7 @@ void NetPacket::FillBufferWithRunAheadMetricsCommand(UnsignedByte *buffer, NetCo // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; // write the average latency Real averageLatency = cmdMsg->getAverageLatency(); @@ -1223,20 +1235,20 @@ void NetPacket::FillBufferWithRunAheadCommand(UnsignedByte *buffer, NetCommandRe //DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::FillBufferWithRunAheadCommand - adding run ahead command")); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); // If necessary, put the execution frame into the packet. - buffer[offset] = 'F'; + buffer[offset] = NetPacketFieldTypes::Frame; ++offset; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(buffer+offset, &newframe, sizeof(UnsignedInt)); @@ -1244,7 +1256,7 @@ void NetPacket::FillBufferWithRunAheadCommand(UnsignedByte *buffer, NetCommandRe // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); @@ -1252,7 +1264,7 @@ void NetPacket::FillBufferWithRunAheadCommand(UnsignedByte *buffer, NetCommandRe // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); // If necessary, specify the command ID of this command. - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(UnsignedShort)); @@ -1260,7 +1272,7 @@ void NetPacket::FillBufferWithRunAheadCommand(UnsignedByte *buffer, NetCommandRe // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnsignedShort newRunAhead = cmdMsg->getRunAhead(); memcpy(buffer + offset, &newRunAhead, sizeof(UnsignedShort)); @@ -1279,20 +1291,20 @@ void NetPacket::FillBufferWithDestroyPlayerCommand(UnsignedByte *buffer, NetComm // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addRunAheadCommand - adding run ahead command")); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); // If necessary, put the execution frame into the packet. - buffer[offset] = 'F'; + buffer[offset] = NetPacketFieldTypes::Frame; ++offset; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(buffer+offset, &newframe, sizeof(UnsignedInt)); @@ -1300,7 +1312,7 @@ void NetPacket::FillBufferWithDestroyPlayerCommand(UnsignedByte *buffer, NetComm // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); @@ -1308,7 +1320,7 @@ void NetPacket::FillBufferWithDestroyPlayerCommand(UnsignedByte *buffer, NetComm // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); // If necessary, specify the command ID of this command. - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(UnsignedShort)); @@ -1316,7 +1328,7 @@ void NetPacket::FillBufferWithDestroyPlayerCommand(UnsignedByte *buffer, NetComm // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnsignedInt newVal = cmdMsg->getPlayerIndex(); memcpy(buffer + offset, &newVal, sizeof(UnsignedInt)); @@ -1328,24 +1340,24 @@ void NetPacket::FillBufferWithKeepAliveCommand(UnsignedByte *buffer, NetCommandR UnsignedShort offset = 0; // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; } @@ -1354,25 +1366,25 @@ void NetPacket::FillBufferWithDisconnectKeepAliveCommand(UnsignedByte *buffer, N UnsignedShort offset = 0; // Put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // Put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); // Put the player ID into the packet. - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; } @@ -1382,13 +1394,13 @@ void NetPacket::FillBufferWithDisconnectPlayerCommand(UnsignedByte *buffer, NetC // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addDisconnectPlayerCommand - adding run ahead command")); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); @@ -1396,7 +1408,7 @@ void NetPacket::FillBufferWithDisconnectPlayerCommand(UnsignedByte *buffer, NetC // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); @@ -1404,7 +1416,7 @@ void NetPacket::FillBufferWithDisconnectPlayerCommand(UnsignedByte *buffer, NetC // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); // If necessary, specify the command ID of this command. - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(UnsignedShort)); @@ -1412,7 +1424,7 @@ void NetPacket::FillBufferWithDisconnectPlayerCommand(UnsignedByte *buffer, NetC // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnsignedByte slot = cmdMsg->getDisconnectSlot(); memcpy(buffer + offset, &slot, sizeof(slot)); @@ -1429,27 +1441,27 @@ void NetPacket::FillBufferWithPacketRouterQueryCommand(UnsignedByte *buffer, Net // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addPacketRouterQueryCommand - adding packet router query command")); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; } @@ -1459,13 +1471,13 @@ void NetPacket::FillBufferWithPacketRouterAckCommand(UnsignedByte *buffer, NetCo // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addPacketRouterAckCommand - adding packet router query command")); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); @@ -1473,14 +1485,14 @@ void NetPacket::FillBufferWithPacketRouterAckCommand(UnsignedByte *buffer, NetCo // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; } @@ -1490,13 +1502,13 @@ void NetPacket::FillBufferWithDisconnectChatCommand(UnsignedByte *buffer, NetCom // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addDisconnectChatCommand - adding run ahead command")); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); @@ -1504,14 +1516,14 @@ void NetPacket::FillBufferWithDisconnectChatCommand(UnsignedByte *buffer, NetCom // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnicodeString unitext = cmdMsg->getText(); UnsignedByte length = unitext.getLength(); @@ -1528,13 +1540,13 @@ void NetPacket::FillBufferWithDisconnectVoteCommand(UnsignedByte *buffer, NetCom // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addDisconnectVoteCommand - adding run ahead command")); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); @@ -1542,7 +1554,7 @@ void NetPacket::FillBufferWithDisconnectVoteCommand(UnsignedByte *buffer, NetCom // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); @@ -1550,7 +1562,7 @@ void NetPacket::FillBufferWithDisconnectVoteCommand(UnsignedByte *buffer, NetCom // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); // If necessary, specify the command ID of this command. - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(UnsignedShort)); @@ -1558,7 +1570,7 @@ void NetPacket::FillBufferWithDisconnectVoteCommand(UnsignedByte *buffer, NetCom // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnsignedByte slot = cmdMsg->getSlot(); memcpy(buffer + offset, &slot, sizeof(slot)); @@ -1575,20 +1587,20 @@ void NetPacket::FillBufferWithChatCommand(UnsignedByte *buffer, NetCommandRef *m // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addDisconnectChatCommand - adding run ahead command")); // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the execution frame into the packet. - buffer[offset] = 'F'; + buffer[offset] = NetPacketFieldTypes::Frame; ++offset; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(buffer+offset, &newframe, sizeof(UnsignedInt)); offset += sizeof(UnsignedInt); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); @@ -1596,7 +1608,7 @@ void NetPacket::FillBufferWithChatCommand(UnsignedByte *buffer, NetCommandRef *m // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); @@ -1604,7 +1616,7 @@ void NetPacket::FillBufferWithChatCommand(UnsignedByte *buffer, NetCommandRef *m // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); // If necessary, specify the command ID of this command. - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(UnsignedShort)); @@ -1612,7 +1624,7 @@ void NetPacket::FillBufferWithChatCommand(UnsignedByte *buffer, NetCommandRef *m // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnicodeString unitext = cmdMsg->getText(); UnsignedByte length = unitext.getLength(); @@ -1632,25 +1644,25 @@ void NetPacket::FillBufferWithProgressMessage(UnsignedByte *buffer, NetCommandRe UnsignedShort offset = 0; // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); // Put the player ID into the packet. - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; buffer[offset] = cmdMsg->getPercentage(); @@ -1662,31 +1674,31 @@ void NetPacket::FillBufferWithLoadCompleteMessage(UnsignedByte *buffer, NetComma UnsignedShort offset = 0; // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // If necessary, specify the command ID of this command. - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(UnsignedShort)); offset += sizeof(UnsignedShort); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; } @@ -1695,30 +1707,30 @@ void NetPacket::FillBufferWithTimeOutGameStartMessage(UnsignedByte *buffer, NetC UnsignedShort offset = 0; // If necessary, put the NetCommandType into the packet. - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // If necessary, put the relay into the packet. - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; UnsignedByte newRelay = msg->getRelay(); memcpy(buffer+offset, &newRelay, sizeof(UnsignedByte)); offset += sizeof(UnsignedByte); - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // If necessary, specify the command ID of this command. - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(UnsignedShort)); offset += sizeof(UnsignedShort); - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; } @@ -1727,32 +1739,32 @@ void NetPacket::FillBufferWithFileMessage(UnsignedByte *buffer, NetCommandRef *m UnsignedInt offset = 0; // command type - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // relay - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; buffer[offset] = msg->getRelay(); offset += sizeof(UnsignedByte); // player ID - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // command ID - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(newID)); offset += sizeof(newID); // data - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; AsciiString filename = cmdMsg->getPortableFilename(); // PORTABLE @@ -1776,32 +1788,32 @@ void NetPacket::FillBufferWithFileAnnounceMessage(UnsignedByte *buffer, NetComma UnsignedInt offset = 0; // command type - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // relay - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; buffer[offset] = msg->getRelay(); offset += sizeof(UnsignedByte); // player ID - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // command ID - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(newID)); offset += sizeof(newID); // data - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; AsciiString filename = cmdMsg->getPortableFilename(); // PORTABLE @@ -1826,32 +1838,32 @@ void NetPacket::FillBufferWithFileProgressMessage(UnsignedByte *buffer, NetComma UnsignedInt offset = 0; // command type - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // relay - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; buffer[offset] = msg->getRelay(); offset += sizeof(UnsignedByte); // player ID - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // command ID - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(newID)); offset += sizeof(newID); // data - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnsignedShort fileID = cmdMsg->getFileID(); @@ -1868,32 +1880,32 @@ void NetPacket::FillBufferWithDisconnectFrameMessage(UnsignedByte *buffer, NetCo UnsignedInt offset = 0; // command type - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // relay - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; buffer[offset] = msg->getRelay(); offset += sizeof(UnsignedByte); // player ID - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // command ID - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(newID)); offset += sizeof(newID); // data - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnsignedInt disconnectFrame = cmdMsg->getDisconnectFrame(); @@ -1906,32 +1918,32 @@ void NetPacket::FillBufferWithDisconnectScreenOffMessage(UnsignedByte *buffer, N UnsignedInt offset = 0; // command type - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // relay - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; buffer[offset] = msg->getRelay(); offset += sizeof(UnsignedByte); // player ID - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // command ID - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(newID)); offset += sizeof(newID); // data - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnsignedInt newFrame = cmdMsg->getNewFrame(); @@ -1944,32 +1956,32 @@ void NetPacket::FillBufferWithFrameResendRequestMessage(UnsignedByte *buffer, Ne UnsignedInt offset = 0; // command type - buffer[offset] = 'T'; + buffer[offset] = NetPacketFieldTypes::CommandType; ++offset; buffer[offset] = cmdMsg->getNetCommandType(); offset += sizeof(UnsignedByte); // relay - buffer[offset] = 'R'; + buffer[offset] = NetPacketFieldTypes::Relay; ++offset; buffer[offset] = msg->getRelay(); offset += sizeof(UnsignedByte); // player ID - buffer[offset] = 'P'; + buffer[offset] = NetPacketFieldTypes::PlayerId; ++offset; buffer[offset] = cmdMsg->getPlayerID(); offset += sizeof(UnsignedByte); // command ID - buffer[offset] = 'C'; + buffer[offset] = NetPacketFieldTypes::CommandId; ++offset; UnsignedShort newID = cmdMsg->getID(); memcpy(buffer + offset, &newID, sizeof(newID)); offset += sizeof(newID); // data - buffer[offset] = 'D'; + buffer[offset] = NetPacketFieldTypes::Data; ++offset; UnsignedInt frameToResend = cmdMsg->getFrameToResend(); @@ -2132,7 +2144,7 @@ Bool NetPacket::addFrameResendRequestCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -2142,7 +2154,7 @@ Bool NetPacket::addFrameResendRequestCommand(NetCommandRef *msg) { // If necessary, put the execution frame into the packet. if (m_lastFrame != cmdMsg->getExecutionFrame()) { - m_packet[m_packetLen] = 'F'; + m_packet[m_packetLen] = NetPacketFieldTypes::Frame; ++m_packetLen; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(m_packet+m_packetLen, &newframe, sizeof(UnsignedInt)); @@ -2153,7 +2165,7 @@ Bool NetPacket::addFrameResendRequestCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet + m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -2164,7 +2176,7 @@ Bool NetPacket::addFrameResendRequestCommand(NetCommandRef *msg) { // If necessary put the player ID into the packet. if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -2175,7 +2187,7 @@ Bool NetPacket::addFrameResendRequestCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -2183,7 +2195,7 @@ Bool NetPacket::addFrameResendRequestCommand(NetCommandRef *msg) { } m_lastCommandID = cmdMsg->getID(); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnsignedInt frameToResend = cmdMsg->getFrameToResend(); @@ -2226,7 +2238,7 @@ Bool NetPacket::isRoomForFrameResendRequestMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // for 'D' + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedInt); // for the frame to be resent if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; @@ -2241,7 +2253,7 @@ Bool NetPacket::addDisconnectScreenOffCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -2251,7 +2263,7 @@ Bool NetPacket::addDisconnectScreenOffCommand(NetCommandRef *msg) { // If necessary, put the execution frame into the packet. if (m_lastFrame != cmdMsg->getExecutionFrame()) { - m_packet[m_packetLen] = 'F'; + m_packet[m_packetLen] = NetPacketFieldTypes::Frame; ++m_packetLen; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(m_packet+m_packetLen, &newframe, sizeof(UnsignedInt)); @@ -2262,7 +2274,7 @@ Bool NetPacket::addDisconnectScreenOffCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet + m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -2273,7 +2285,7 @@ Bool NetPacket::addDisconnectScreenOffCommand(NetCommandRef *msg) { // If necessary put the player ID into the packet. if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -2284,7 +2296,7 @@ Bool NetPacket::addDisconnectScreenOffCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -2292,7 +2304,7 @@ Bool NetPacket::addDisconnectScreenOffCommand(NetCommandRef *msg) { } m_lastCommandID = cmdMsg->getID(); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnsignedInt newFrame = cmdMsg->getNewFrame(); @@ -2335,7 +2347,7 @@ Bool NetPacket::isRoomForDisconnectScreenOffMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // for 'D' + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedInt); // for the disconnect frame if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; @@ -2350,7 +2362,7 @@ Bool NetPacket::addDisconnectFrameCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -2360,7 +2372,7 @@ Bool NetPacket::addDisconnectFrameCommand(NetCommandRef *msg) { // If necessary, put the execution frame into the packet. if (m_lastFrame != cmdMsg->getExecutionFrame()) { - m_packet[m_packetLen] = 'F'; + m_packet[m_packetLen] = NetPacketFieldTypes::Frame; ++m_packetLen; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(m_packet+m_packetLen, &newframe, sizeof(UnsignedInt)); @@ -2371,7 +2383,7 @@ Bool NetPacket::addDisconnectFrameCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet + m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -2382,7 +2394,7 @@ Bool NetPacket::addDisconnectFrameCommand(NetCommandRef *msg) { // If necessary put the player ID into the packet. if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -2393,7 +2405,7 @@ Bool NetPacket::addDisconnectFrameCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -2401,7 +2413,7 @@ Bool NetPacket::addDisconnectFrameCommand(NetCommandRef *msg) { } m_lastCommandID = cmdMsg->getID(); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnsignedInt disconnectFrame = cmdMsg->getDisconnectFrame(); @@ -2444,7 +2456,7 @@ Bool NetPacket::isRoomForDisconnectFrameMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // for 'D' + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedInt); // for the disconnect frame if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; @@ -2459,7 +2471,7 @@ Bool NetPacket::addFileCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -2469,7 +2481,7 @@ Bool NetPacket::addFileCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet + m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -2480,7 +2492,7 @@ Bool NetPacket::addFileCommand(NetCommandRef *msg) { // If necessary put the player ID into the packet. if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -2491,7 +2503,7 @@ Bool NetPacket::addFileCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -2500,7 +2512,7 @@ Bool NetPacket::addFileCommand(NetCommandRef *msg) { m_lastCommandID = cmdMsg->getID(); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; AsciiString filename = cmdMsg->getPortableFilename(); // PORTABLE @@ -2542,7 +2554,7 @@ Bool NetPacket::isRoomForFileMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte) + sizeof(UnsignedShort); } - ++len; // 'D' + ++len; // NetPacketFieldTypes::Data len += cmdMsg->getPortableFilename().getLength() + 1; // PORTABLE filename + the terminating 0 len += sizeof(UnsignedInt); // filedata length len += cmdMsg->getFileLength(); @@ -2561,7 +2573,7 @@ Bool NetPacket::addFileAnnounceCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -2571,7 +2583,7 @@ Bool NetPacket::addFileAnnounceCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet + m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -2582,7 +2594,7 @@ Bool NetPacket::addFileAnnounceCommand(NetCommandRef *msg) { // If necessary put the player ID into the packet. if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -2593,7 +2605,7 @@ Bool NetPacket::addFileAnnounceCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -2602,7 +2614,7 @@ Bool NetPacket::addFileAnnounceCommand(NetCommandRef *msg) { m_lastCommandID = cmdMsg->getID(); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; AsciiString filename = cmdMsg->getPortableFilename(); // PORTABLE @@ -2649,7 +2661,7 @@ Bool NetPacket::isRoomForFileAnnounceMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte) + sizeof(UnsignedShort); } - ++len; // 'D' + ++len; // NetPacketFieldTypes::Data len += cmdMsg->getPortableFilename().getLength() + 1; // PORTABLE filename + the terminating 0 len += sizeof(UnsignedShort); // m_fileID len += sizeof(UnsignedByte); // m_playerMask @@ -2668,7 +2680,7 @@ Bool NetPacket::addFileProgressCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -2678,7 +2690,7 @@ Bool NetPacket::addFileProgressCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet + m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -2689,7 +2701,7 @@ Bool NetPacket::addFileProgressCommand(NetCommandRef *msg) { // If necessary put the player ID into the packet. if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -2700,7 +2712,7 @@ Bool NetPacket::addFileProgressCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -2709,7 +2721,7 @@ Bool NetPacket::addFileProgressCommand(NetCommandRef *msg) { m_lastCommandID = cmdMsg->getID(); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnsignedShort fileID = cmdMsg->getFileID(); @@ -2749,7 +2761,7 @@ Bool NetPacket::isRoomForFileProgressMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte) + sizeof(UnsignedShort); } - ++len; // 'D' + ++len; // NetPacketFieldTypes::Data len += sizeof(UnsignedShort); // m_fileID len += sizeof(Int); // m_progress @@ -2767,7 +2779,7 @@ Bool NetPacket::addWrapperCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -2777,7 +2789,7 @@ Bool NetPacket::addWrapperCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet + m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -2788,7 +2800,7 @@ Bool NetPacket::addWrapperCommand(NetCommandRef *msg) { // If necessary put the player ID into the packet. if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -2799,7 +2811,7 @@ Bool NetPacket::addWrapperCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -2808,7 +2820,7 @@ Bool NetPacket::addWrapperCommand(NetCommandRef *msg) { m_lastCommandID = cmdMsg->getID(); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; // wrapped command ID @@ -2879,7 +2891,7 @@ Bool NetPacket::isRoomForWrapperMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte) + sizeof(UnsignedShort); } - ++len; // 'D' + ++len; // NetPacketFieldTypes::Data len += sizeof(UnsignedShort); // wrapped command ID len += sizeof(UnsignedInt); // chunk number len += sizeof(UnsignedInt); // number of chunks @@ -2905,7 +2917,7 @@ Bool NetPacket::addTimeOutGameStartMessage(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -2915,7 +2927,7 @@ Bool NetPacket::addTimeOutGameStartMessage(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -2925,7 +2937,7 @@ Bool NetPacket::addTimeOutGameStartMessage(NetCommandRef *msg) { } if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -2936,7 +2948,7 @@ Bool NetPacket::addTimeOutGameStartMessage(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -2944,7 +2956,7 @@ Bool NetPacket::addTimeOutGameStartMessage(NetCommandRef *msg) { } m_lastCommandID = cmdMsg->getID(); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; ++m_numCommands; @@ -2978,7 +2990,7 @@ Bool NetPacket::isRoomForTimeOutGameStartMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // For the 'D' + ++len; // For the NetPacketFieldTypes::Data if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; } @@ -2997,7 +3009,7 @@ Bool NetPacket::addLoadCompleteMessage(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -3007,7 +3019,7 @@ Bool NetPacket::addLoadCompleteMessage(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -3017,7 +3029,7 @@ Bool NetPacket::addLoadCompleteMessage(NetCommandRef *msg) { } if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -3028,7 +3040,7 @@ Bool NetPacket::addLoadCompleteMessage(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -3036,7 +3048,7 @@ Bool NetPacket::addLoadCompleteMessage(NetCommandRef *msg) { } m_lastCommandID = cmdMsg->getID(); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; ++m_numCommands; @@ -3070,7 +3082,7 @@ Bool NetPacket::isRoomForLoadCompleteMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // For the 'D' + ++len; // For the NetPacketFieldTypes::Data if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; } @@ -3089,7 +3101,7 @@ Bool NetPacket::addProgressMessage(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -3099,7 +3111,7 @@ Bool NetPacket::addProgressMessage(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -3109,7 +3121,7 @@ Bool NetPacket::addProgressMessage(NetCommandRef *msg) { } if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -3117,7 +3129,7 @@ Bool NetPacket::addProgressMessage(NetCommandRef *msg) { m_lastPlayerID = cmdMsg->getPlayerID(); } - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPercentage(); @@ -3154,7 +3166,7 @@ Bool NetPacket::isRoomForProgressMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // For the 'D' + ++len; // For the NetPacketFieldTypes::Data ++len; // percentage if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; @@ -3175,7 +3187,7 @@ Bool NetPacket::addDisconnectVoteCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -3185,7 +3197,7 @@ Bool NetPacket::addDisconnectVoteCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -3197,7 +3209,7 @@ Bool NetPacket::addDisconnectVoteCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -3210,7 +3222,7 @@ Bool NetPacket::addDisconnectVoteCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -3220,7 +3232,7 @@ Bool NetPacket::addDisconnectVoteCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnsignedByte slot = cmdMsg->getSlot(); memcpy(m_packet + m_packetLen, &slot, sizeof(slot)); @@ -3265,7 +3277,7 @@ Bool NetPacket::isRoomForDisconnectVoteMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // the 'D' + ++len; // the NetPacketFieldTypes::Data len += sizeof(UnsignedByte); // slot number len += sizeof(UnsignedInt); // vote frame @@ -3285,7 +3297,7 @@ Bool NetPacket::addDisconnectChatCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -3295,7 +3307,7 @@ Bool NetPacket::addDisconnectChatCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -3307,7 +3319,7 @@ Bool NetPacket::addDisconnectChatCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -3317,7 +3329,7 @@ Bool NetPacket::addDisconnectChatCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnicodeString unitext = cmdMsg->getText(); UnsignedByte length = unitext.getLength(); @@ -3354,7 +3366,7 @@ Bool NetPacket::isRoomForDisconnectChatMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // the 'D' + ++len; // the NetPacketFieldTypes::Data len += sizeof(UnsignedByte); // string length UnsignedByte textLen = cmdMsg->getText().getLength(); len += textLen * sizeof(UnsignedShort); @@ -3372,7 +3384,7 @@ Bool NetPacket::addChatCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -3382,7 +3394,7 @@ Bool NetPacket::addChatCommand(NetCommandRef *msg) { // If necessary, put the execution frame into the packet. if (m_lastFrame != cmdMsg->getExecutionFrame()) { - m_packet[m_packetLen] = 'F'; + m_packet[m_packetLen] = NetPacketFieldTypes::Frame; ++m_packetLen; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(m_packet+m_packetLen, &newframe, sizeof(UnsignedInt)); @@ -3393,7 +3405,7 @@ Bool NetPacket::addChatCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -3405,7 +3417,7 @@ Bool NetPacket::addChatCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -3418,7 +3430,7 @@ Bool NetPacket::addChatCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -3428,7 +3440,7 @@ Bool NetPacket::addChatCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnicodeString unitext = cmdMsg->getText(); UnsignedByte length = unitext.getLength(); @@ -3477,7 +3489,7 @@ Bool NetPacket::isRoomForChatMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // the 'D' + ++len; // the NetPacketFieldTypes::Data len += sizeof(UnsignedByte); // string length UnsignedByte textLen = cmdMsg->getText().getLength(); len += textLen * sizeof(UnsignedShort); @@ -3496,7 +3508,7 @@ Bool NetPacket::addPacketRouterAckCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -3506,7 +3518,7 @@ Bool NetPacket::addPacketRouterAckCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -3518,7 +3530,7 @@ Bool NetPacket::addPacketRouterAckCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -3528,7 +3540,7 @@ Bool NetPacket::addPacketRouterAckCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket - added packet router ack command, player id %d", m_lastPlayerID)); @@ -3561,7 +3573,7 @@ Bool NetPacket::isRoomForPacketRouterAckMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // the 'D' + ++len; // the NetPacketFieldTypes::Data if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; } @@ -3576,7 +3588,7 @@ Bool NetPacket::addPacketRouterQueryCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -3586,7 +3598,7 @@ Bool NetPacket::addPacketRouterQueryCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -3598,7 +3610,7 @@ Bool NetPacket::addPacketRouterQueryCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -3608,7 +3620,7 @@ Bool NetPacket::addPacketRouterQueryCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("player = %d", m_lastPlayerID)); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket - added packet router query command, player id %d", m_lastPlayerID)); @@ -3641,7 +3653,7 @@ Bool NetPacket::isRoomForPacketRouterQueryMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // the 'D' + ++len; // the NetPacketFieldTypes::Data if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; } @@ -3659,7 +3671,7 @@ Bool NetPacket::addDisconnectPlayerCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -3669,7 +3681,7 @@ Bool NetPacket::addDisconnectPlayerCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -3681,7 +3693,7 @@ Bool NetPacket::addDisconnectPlayerCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -3694,7 +3706,7 @@ Bool NetPacket::addDisconnectPlayerCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -3704,7 +3716,7 @@ Bool NetPacket::addDisconnectPlayerCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnsignedByte slot = cmdMsg->getDisconnectSlot(); memcpy(m_packet + m_packetLen, &slot, sizeof(slot)); @@ -3749,7 +3761,7 @@ Bool NetPacket::isRoomForDisconnectPlayerMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // the 'D' + ++len; // the NetPacketFieldTypes::Data len += sizeof(UnsignedByte); // slot number len += sizeof(UnsignedInt); // disconnectFrame if ((len + m_packetLen) > MAX_PACKET_SIZE) { @@ -3768,7 +3780,7 @@ Bool NetPacket::addDisconnectKeepAliveCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -3778,7 +3790,7 @@ Bool NetPacket::addDisconnectKeepAliveCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -3788,7 +3800,7 @@ Bool NetPacket::addDisconnectKeepAliveCommand(NetCommandRef *msg) { } if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -3796,7 +3808,7 @@ Bool NetPacket::addDisconnectKeepAliveCommand(NetCommandRef *msg) { m_lastPlayerID = cmdMsg->getPlayerID(); } - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; ++m_numCommands; @@ -3830,7 +3842,7 @@ Bool NetPacket::isRoomForDisconnectKeepAliveMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // For the 'D' + ++len; // For the NetPacketFieldTypes::Data if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; } @@ -3846,7 +3858,7 @@ Bool NetPacket::addKeepAliveCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -3856,7 +3868,7 @@ Bool NetPacket::addKeepAliveCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -3866,7 +3878,7 @@ Bool NetPacket::addKeepAliveCommand(NetCommandRef *msg) { } if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -3874,7 +3886,7 @@ Bool NetPacket::addKeepAliveCommand(NetCommandRef *msg) { m_lastPlayerID = cmdMsg->getPlayerID(); } - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; ++m_numCommands; @@ -3908,7 +3920,7 @@ Bool NetPacket::isRoomForKeepAliveMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // For the 'D' + ++len; // For the NetPacketFieldTypes::Data if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; } @@ -3926,7 +3938,7 @@ Bool NetPacket::addRunAheadCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -3936,7 +3948,7 @@ Bool NetPacket::addRunAheadCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -3947,7 +3959,7 @@ Bool NetPacket::addRunAheadCommand(NetCommandRef *msg) { // If necessary, put the execution frame into the packet. if (m_lastFrame != cmdMsg->getExecutionFrame()) { - m_packet[m_packetLen] = 'F'; + m_packet[m_packetLen] = NetPacketFieldTypes::Frame; ++m_packetLen; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(m_packet+m_packetLen, &newframe, sizeof(UnsignedInt)); @@ -3959,7 +3971,7 @@ Bool NetPacket::addRunAheadCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -3972,7 +3984,7 @@ Bool NetPacket::addRunAheadCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -3982,7 +3994,7 @@ Bool NetPacket::addRunAheadCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnsignedShort newRunAhead = cmdMsg->getRunAhead(); memcpy(m_packet + m_packetLen, &newRunAhead, sizeof(UnsignedShort)); @@ -4030,7 +4042,7 @@ Bool NetPacket::isRoomForRunAheadMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // for 'D' + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedShort); len += sizeof(UnsignedByte); if ((len + m_packetLen) > MAX_PACKET_SIZE) { @@ -4049,7 +4061,7 @@ Bool NetPacket::addDestroyPlayerCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -4059,7 +4071,7 @@ Bool NetPacket::addDestroyPlayerCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -4070,7 +4082,7 @@ Bool NetPacket::addDestroyPlayerCommand(NetCommandRef *msg) { // If necessary, put the execution frame into the packet. if (m_lastFrame != cmdMsg->getExecutionFrame()) { - m_packet[m_packetLen] = 'F'; + m_packet[m_packetLen] = NetPacketFieldTypes::Frame; ++m_packetLen; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(m_packet+m_packetLen, &newframe, sizeof(UnsignedInt)); @@ -4082,7 +4094,7 @@ Bool NetPacket::addDestroyPlayerCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -4095,7 +4107,7 @@ Bool NetPacket::addDestroyPlayerCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -4105,7 +4117,7 @@ Bool NetPacket::addDestroyPlayerCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnsignedInt newVal = cmdMsg->getPlayerIndex(); memcpy(m_packet + m_packetLen, &newVal, sizeof(UnsignedInt)); @@ -4149,7 +4161,7 @@ Bool NetPacket::isRoomForDestroyPlayerMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // for 'D' + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedInt); if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; @@ -4168,7 +4180,7 @@ Bool NetPacket::addRunAheadMetricsCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -4178,7 +4190,7 @@ Bool NetPacket::addRunAheadMetricsCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -4190,7 +4202,7 @@ Bool NetPacket::addRunAheadMetricsCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -4203,7 +4215,7 @@ Bool NetPacket::addRunAheadMetricsCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -4213,7 +4225,7 @@ Bool NetPacket::addRunAheadMetricsCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; // write the average latency Real averageLatency = cmdMsg->getAverageLatency(); @@ -4257,7 +4269,7 @@ Bool NetPacket::isRoomForRunAheadMetricsMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // 'D' + ++len; // NetPacketFieldTypes::Data len += sizeof(UnsignedShort); len += sizeof(Real); if ((len + m_packetLen) > MAX_PACKET_SIZE) { @@ -4278,7 +4290,7 @@ Bool NetPacket::addPlayerLeaveCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -4288,7 +4300,7 @@ Bool NetPacket::addPlayerLeaveCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -4299,7 +4311,7 @@ Bool NetPacket::addPlayerLeaveCommand(NetCommandRef *msg) { // If necessary, put the execution frame into the packet. if (m_lastFrame != cmdMsg->getExecutionFrame()) { - m_packet[m_packetLen] = 'F'; + m_packet[m_packetLen] = NetPacketFieldTypes::Frame; ++m_packetLen; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(m_packet+m_packetLen, &newframe, sizeof(UnsignedInt)); @@ -4311,7 +4323,7 @@ Bool NetPacket::addPlayerLeaveCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -4324,7 +4336,7 @@ Bool NetPacket::addPlayerLeaveCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -4334,7 +4346,7 @@ Bool NetPacket::addPlayerLeaveCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnsignedByte leavingPlayerID = cmdMsg->getLeavingPlayerID(); memcpy(m_packet + m_packetLen, &leavingPlayerID, sizeof(UnsignedByte)); @@ -4376,7 +4388,7 @@ Bool NetPacket::isRoomForPlayerLeaveMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // for 'D' + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedByte); if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; @@ -4411,7 +4423,7 @@ Bool NetPacket::addFrameCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -4421,7 +4433,7 @@ Bool NetPacket::addFrameCommand(NetCommandRef *msg) { // If necessary, put the execution frame into the packet. if (m_lastFrame != cmdMsg->getExecutionFrame()) { - m_packet[m_packetLen] = 'F'; + m_packet[m_packetLen] = NetPacketFieldTypes::Frame; ++m_packetLen; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(m_packet+m_packetLen, &newframe, sizeof(UnsignedInt)); @@ -4432,7 +4444,7 @@ Bool NetPacket::addFrameCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -4444,7 +4456,7 @@ Bool NetPacket::addFrameCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("relay = %d, ", m_lastRelay)); if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -4457,7 +4469,7 @@ Bool NetPacket::addFrameCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -4467,7 +4479,7 @@ Bool NetPacket::addFrameCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("command id = %d", m_lastCommandID)); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; UnsignedShort cmdCount = cmdMsg->getCommandCount(); memcpy(m_packet + m_packetLen, &cmdCount, sizeof(UnsignedShort)); @@ -4512,7 +4524,7 @@ Bool NetPacket::isRoomForFrameMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // for 'D' + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedShort); if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; @@ -4590,7 +4602,7 @@ Bool NetPacket::addAckCommand(NetCommandRef *msg, UnsignedShort commandID, Unsig // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addAckCommand - adding ack for command %d for player %d", cmdMsg->getCommandID(), msg->getCommand()->getPlayerID())); // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -4599,7 +4611,7 @@ Bool NetPacket::addAckCommand(NetCommandRef *msg, UnsignedShort commandID, Unsig } if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -4608,7 +4620,7 @@ Bool NetPacket::addAckCommand(NetCommandRef *msg, UnsignedShort commandID, Unsig } // Put in the command id of the command we are acking. - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; memcpy(m_packet + m_packetLen, &commandID, sizeof(UnsignedShort)); m_packetLen += sizeof(UnsignedShort); @@ -4641,7 +4653,7 @@ Bool NetPacket::isRoomForAckMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // for 'D' + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedShort); len += sizeof(UnsignedByte); if ((len + m_packetLen) > MAX_PACKET_SIZE) { @@ -4732,7 +4744,7 @@ Bool NetPacket::addGameCommand(NetCommandRef *msg) { // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { - m_packet[m_packetLen] = 'T'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandType; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getNetCommandType(); m_packetLen += sizeof(UnsignedByte); @@ -4742,7 +4754,7 @@ Bool NetPacket::addGameCommand(NetCommandRef *msg) { // If necessary, put the execution frame into the packet. if (m_lastFrame != cmdMsg->getExecutionFrame()) { - m_packet[m_packetLen] = 'F'; + m_packet[m_packetLen] = NetPacketFieldTypes::Frame; ++m_packetLen; UnsignedInt newframe = cmdMsg->getExecutionFrame(); memcpy(m_packet+m_packetLen, &newframe, sizeof(UnsignedInt)); @@ -4753,7 +4765,7 @@ Bool NetPacket::addGameCommand(NetCommandRef *msg) { // If necessary, put the relay into the packet. if (m_lastRelay != msg->getRelay()) { - m_packet[m_packetLen] = 'R'; + m_packet[m_packetLen] = NetPacketFieldTypes::Relay; ++m_packetLen; UnsignedByte newRelay = msg->getRelay(); memcpy(m_packet+m_packetLen, &newRelay, sizeof(UnsignedByte)); @@ -4764,7 +4776,7 @@ Bool NetPacket::addGameCommand(NetCommandRef *msg) { // If necessary, put the playerID into the packet. if (m_lastPlayerID != cmdMsg->getPlayerID()) { - m_packet[m_packetLen] = 'P'; + m_packet[m_packetLen] = NetPacketFieldTypes::PlayerId; ++m_packetLen; m_packet[m_packetLen] = cmdMsg->getPlayerID(); m_packetLen += sizeof(UnsignedByte); @@ -4776,7 +4788,7 @@ Bool NetPacket::addGameCommand(NetCommandRef *msg) { // If necessary, specify the command ID of this command. if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { - m_packet[m_packetLen] = 'C'; + m_packet[m_packetLen] = NetPacketFieldTypes::CommandId; ++m_packetLen; UnsignedShort newID = cmdMsg->getID(); memcpy(m_packet + m_packetLen, &newID, sizeof(UnsignedShort)); @@ -4784,7 +4796,7 @@ Bool NetPacket::addGameCommand(NetCommandRef *msg) { } m_lastCommandID = cmdMsg->getID(); - m_packet[m_packetLen] = 'D'; + m_packet[m_packetLen] = NetPacketFieldTypes::Data; ++m_packetLen; // Now copy the GameMessage type into the packet. @@ -4920,7 +4932,7 @@ Bool NetPacket::isRoomForGameMessage(NetCommandRef *msg, GameMessage *gmsg) { GameMessageParser *parser = newInstance(GameMessageParser)(gmsg); - ++msglen; // for 'D' + ++msglen; // for NetPacketFieldTypes::Data msglen += sizeof(GameMessage::Type); msglen += sizeof(UnsignedByte); // Int numTypes = parser->getNumTypes(); @@ -5002,32 +5014,32 @@ NetCommandList * NetPacket::getCommandList() { switch(m_packet[i]) { - case 'T': + case NetPacketFieldTypes::CommandType: ++i; memcpy(&commandType, m_packet + i, sizeof(UnsignedByte)); i += sizeof(UnsignedByte); break; - case 'F': + case NetPacketFieldTypes::Frame: ++i; memcpy(&frame, m_packet + i, sizeof(UnsignedInt)); i += sizeof(UnsignedInt); break; - case 'P': + case NetPacketFieldTypes::PlayerId: ++i; memcpy(&playerID, m_packet + i, sizeof(UnsignedByte)); i += sizeof(UnsignedByte); break; - case 'R': + case NetPacketFieldTypes::Relay: ++i; memcpy(&relay, m_packet + i, sizeof(UnsignedByte)); i += sizeof(UnsignedByte); break; - case 'C': + case NetPacketFieldTypes::CommandId: ++i; memcpy(&commandID, m_packet + i, sizeof(UnsignedShort)); i += sizeof(UnsignedShort); break; - case 'D': { + case NetPacketFieldTypes::Data: { ++i; NetCommandMsg *msg = NULL; From 11b61d5795a623c5954a2d9daf4cc76af1bbe122 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 30 Sep 2025 20:44:04 +0200 Subject: [PATCH 152/343] fix(quotedprintable): Fix assert in AsciiStringToQuotedPrintable during map cache generation (#1659) --- .../Code/GameEngine/Source/Common/System/QuotedPrintable.cpp | 4 ++-- .../Code/GameEngine/Source/Common/System/QuotedPrintable.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/System/QuotedPrintable.cpp b/Generals/Code/GameEngine/Source/Common/System/QuotedPrintable.cpp index 0edf836cefe..c8e15f0827a 100644 --- a/Generals/Code/GameEngine/Source/Common/System/QuotedPrintable.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/QuotedPrintable.cpp @@ -56,7 +56,7 @@ static int hexDigitToInt(char c) AsciiString UnicodeStringToQuotedPrintable(UnicodeString original) { static char dest[1024]; - const char *src = (const char *)original.str(); + const unsigned char *src = reinterpret_cast(original.str()); int i=0; while ( !(src[0]=='\0' && src[1]=='\0') && i<1021 ) { @@ -91,7 +91,7 @@ AsciiString UnicodeStringToQuotedPrintable(UnicodeString original) AsciiString AsciiStringToQuotedPrintable(AsciiString original) { static char dest[1024]; - const char *src = (const char *)original.str(); + const unsigned char *src = reinterpret_cast(original.str()); int i=0; while ( src[0]!='\0' && i<1021 ) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/QuotedPrintable.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/QuotedPrintable.cpp index a4181645d6d..6326765853f 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/QuotedPrintable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/QuotedPrintable.cpp @@ -56,7 +56,7 @@ static int hexDigitToInt(char c) AsciiString UnicodeStringToQuotedPrintable(UnicodeString original) { static char dest[1024]; - const char *src = (const char *)original.str(); + const unsigned char *src = reinterpret_cast(original.str()); int i=0; while ( !(src[0]=='\0' && src[1]=='\0') && i<1021 ) { @@ -91,7 +91,7 @@ AsciiString UnicodeStringToQuotedPrintable(UnicodeString original) AsciiString AsciiStringToQuotedPrintable(AsciiString original) { static char dest[1024]; - const char *src = (const char *)original.str(); + const unsigned char *src = reinterpret_cast(original.str()); int i=0; while ( src[0]!='\0' && i<1021 ) { From 6d10c91b97a06defcfa51ed4d553d3c8c8cf5c41 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 30 Sep 2025 20:45:12 +0200 Subject: [PATCH 153/343] refactor(quotedprintable): Simplify and modernize code in QuotedPrintable (#1659) --- .../Source/Common/System/QuotedPrintable.cpp | 21 ++++++++++--------- .../Source/Common/System/QuotedPrintable.cpp | 21 ++++++++++--------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/System/QuotedPrintable.cpp b/Generals/Code/GameEngine/Source/Common/System/QuotedPrintable.cpp index c8e15f0827a..32941991436 100644 --- a/Generals/Code/GameEngine/Source/Common/System/QuotedPrintable.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/QuotedPrintable.cpp @@ -65,7 +65,8 @@ AsciiString UnicodeStringToQuotedPrintable(UnicodeString original) dest[i++] = MAGIC_CHAR; dest[i++] = intToHexDigit((*src)>>4); dest[i++] = intToHexDigit((*src)&0xf); - } else + } + else { dest[i++] = *src; } @@ -100,7 +101,8 @@ AsciiString AsciiStringToQuotedPrintable(AsciiString original) dest[i++] = MAGIC_CHAR; dest[i++] = intToHexDigit((*src)>>4); dest[i++] = intToHexDigit((*src)&0xf); - } else + } + else { dest[i++] = *src; } @@ -117,8 +119,8 @@ UnicodeString QuotedPrintableToUnicodeString(AsciiString original) static WideChar dest[1024]; int i=0; - unsigned char *c = (unsigned char *)dest; - const unsigned char *src = (const unsigned char *)original.str(); + unsigned char *c = reinterpret_cast(dest); + const unsigned char *src = reinterpret_cast(original.str()); while (*src && i<1023) { @@ -159,18 +161,17 @@ UnicodeString QuotedPrintableToUnicodeString(AsciiString original) *c = 0; - UnicodeString out(dest); - return out; + return dest; } // Convert ascii quoted-printable strings into ascii strings AsciiString QuotedPrintableToAsciiString(AsciiString original) { - static unsigned char dest[1024]; + static char dest[1024]; int i=0; - unsigned char *c = (unsigned char *)dest; - const unsigned char *src = (const unsigned char *)original.str(); + unsigned char *c = reinterpret_cast(dest); + const unsigned char *src = reinterpret_cast(original.str()); while (*src && i<1023) { @@ -200,6 +201,6 @@ AsciiString QuotedPrintableToAsciiString(AsciiString original) *c = 0; - return AsciiString((const char *)dest); + return dest; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/QuotedPrintable.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/QuotedPrintable.cpp index 6326765853f..69c8f41eddb 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/QuotedPrintable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/QuotedPrintable.cpp @@ -65,7 +65,8 @@ AsciiString UnicodeStringToQuotedPrintable(UnicodeString original) dest[i++] = MAGIC_CHAR; dest[i++] = intToHexDigit((*src)>>4); dest[i++] = intToHexDigit((*src)&0xf); - } else + } + else { dest[i++] = *src; } @@ -100,7 +101,8 @@ AsciiString AsciiStringToQuotedPrintable(AsciiString original) dest[i++] = MAGIC_CHAR; dest[i++] = intToHexDigit((*src)>>4); dest[i++] = intToHexDigit((*src)&0xf); - } else + } + else { dest[i++] = *src; } @@ -117,8 +119,8 @@ UnicodeString QuotedPrintableToUnicodeString(AsciiString original) static WideChar dest[1024]; int i=0; - unsigned char *c = (unsigned char *)dest; - const unsigned char *src = (const unsigned char *)original.str(); + unsigned char *c = reinterpret_cast(dest); + const unsigned char *src = reinterpret_cast(original.str()); while (*src && i<1023) { @@ -159,18 +161,17 @@ UnicodeString QuotedPrintableToUnicodeString(AsciiString original) *c = 0; - UnicodeString out(dest); - return out; + return dest; } // Convert ascii quoted-printable strings into ascii strings AsciiString QuotedPrintableToAsciiString(AsciiString original) { - static unsigned char dest[1024]; + static char dest[1024]; int i=0; - unsigned char *c = (unsigned char *)dest; - const unsigned char *src = (const unsigned char *)original.str(); + unsigned char *c = reinterpret_cast(dest); + const unsigned char *src = reinterpret_cast(original.str()); while (*src && i<1023) { @@ -200,6 +201,6 @@ AsciiString QuotedPrintableToAsciiString(AsciiString original) *c = 0; - return AsciiString((const char *)dest); + return dest; } From fbb1ca4765bc97282cda3726a2de9474762534bb Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 9 Oct 2025 20:55:49 +0200 Subject: [PATCH 154/343] refactor(utils): Move STLUtils.h to WWLib (#1679) --- Core/GameEngine/CMakeLists.txt | 1 - Core/Libraries/Source/WWVegas/WW3D2/rendobj.cpp | 4 ++-- Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp | 4 ++-- Core/Libraries/Source/WWVegas/WWLib/CMakeLists.txt | 1 + .../Common => Libraries/Source/WWVegas/WWLib}/STLUtils.h | 0 Core/Libraries/Source/WWVegas/WWLib/WWCommon.h | 1 + Generals/Code/GameEngine/Include/Common/STLTypedefs.h | 1 - Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp | 2 +- GeneralsMD/Code/GameEngine/Include/Common/STLTypedefs.h | 1 - GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp | 2 +- 10 files changed, 8 insertions(+), 9 deletions(-) rename Core/{GameEngine/Include/Common => Libraries/Source/WWVegas/WWLib}/STLUtils.h (100%) diff --git a/Core/GameEngine/CMakeLists.txt b/Core/GameEngine/CMakeLists.txt index f713e0a0ab5..43460b8ecf8 100644 --- a/Core/GameEngine/CMakeLists.txt +++ b/Core/GameEngine/CMakeLists.txt @@ -114,7 +114,6 @@ set(GAMEENGINE_SRC # Include/Common/StateMachine.h # Include/Common/StatsCollector.h # Include/Common/STLTypedefs.h - Include/Common/STLUtils.h Include/Common/StreamingArchiveFile.h # Include/Common/SubsystemInterface.h # Include/Common/SystemInfo.h diff --git a/Core/Libraries/Source/WWVegas/WW3D2/rendobj.cpp b/Core/Libraries/Source/WWVegas/WW3D2/rendobj.cpp index b7f32993617..1fa114bb545 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/rendobj.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/rendobj.cpp @@ -1243,7 +1243,7 @@ PersistClass * RenderObjPersistFactoryClass::Load(ChunkLoadClass & cload) const // if the object we saved didn't have a name, replace it with null if (strlen(name) == 0) { static int count = 0; - if ( ++count < 10 ) { + if ( count++ < 10 ) { WWDEBUG_SAY(("RenderObjPersistFactory attempted to load an un-named render object!")); WWDEBUG_SAY(("Replacing it with a NULL render object!")); } @@ -1254,7 +1254,7 @@ PersistClass * RenderObjPersistFactoryClass::Load(ChunkLoadClass & cload) const if (new_obj == NULL) { static int count = 0; - if ( ++count < 10 ) { + if ( count++ < 10 ) { WWDEBUG_SAY(("RenderObjPersistFactory failed to create object: %s!!",name)); WWDEBUG_SAY(("Either the asset for this object is gone or you tried to save a procedural object.")); WWDEBUG_SAY(("Replacing it with a NULL render object!")); diff --git a/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp b/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp index 6b30fb8648c..b82bff12819 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp @@ -372,7 +372,7 @@ WWAudioClass::Get_Sound_Buffer (const char *filename, bool is_3d) buffer = Create_Sound_Buffer (*file, filename, is_3d); } else { static int count = 0; - if ( ++count < 10 ) { + if ( count++ < 10 ) { WWDEBUG_SAY(( "Sound \"%s\" not found", filename )); } } @@ -807,7 +807,7 @@ WWAudioClass::Create_3D_Sound sound_obj->Set_Buffer (buffer); } else { static int count = 0; - if ( ++count < 10 ) { + if ( count++ < 10 ) { WWDEBUG_SAY(( "Sound File not Found \"%s\"", filename )); } } diff --git a/Core/Libraries/Source/WWVegas/WWLib/CMakeLists.txt b/Core/Libraries/Source/WWVegas/WWLib/CMakeLists.txt index b81bac059b7..99ae03ab2e8 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/CMakeLists.txt +++ b/Core/Libraries/Source/WWVegas/WWLib/CMakeLists.txt @@ -106,6 +106,7 @@ set(WWLIB_SRC SLNODE.H stimer.cpp stimer.h + STLUtils.h straw.cpp STRAW.H stringex.h diff --git a/Core/GameEngine/Include/Common/STLUtils.h b/Core/Libraries/Source/WWVegas/WWLib/STLUtils.h similarity index 100% rename from Core/GameEngine/Include/Common/STLUtils.h rename to Core/Libraries/Source/WWVegas/WWLib/STLUtils.h diff --git a/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h b/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h index 329324ca51f..77c231a6d5c 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h +++ b/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h @@ -18,6 +18,7 @@ #pragma once +#include "STLUtils.h" #include "stringex.h" diff --git a/Generals/Code/GameEngine/Include/Common/STLTypedefs.h b/Generals/Code/GameEngine/Include/Common/STLTypedefs.h index 28d42fe5127..6a6b7c9d2c9 100644 --- a/Generals/Code/GameEngine/Include/Common/STLTypedefs.h +++ b/Generals/Code/GameEngine/Include/Common/STLTypedefs.h @@ -58,7 +58,6 @@ class STLSpecialAlloc; #include "Common/UnicodeString.h" #include "Common/GameCommon.h" #include "Common/GameMemory.h" -#include "Common/STLUtils.h" //----------------------------------------------------------------------------- diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp index 9e4a933d957..d7af5da0885 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp @@ -1395,7 +1395,7 @@ PersistClass * DazzlePersistFactoryClass::Load(ChunkLoadClass & cload) const */ if (new_obj == NULL) { static int count = 0; - if ( ++count < 10 ) { + if ( count++ < 10 ) { WWDEBUG_SAY(("DazzlePersistFactory failed to create dazzle of type: %s!!",dazzle_type)); WWDEBUG_SAY(("Replacing it with a NULL render object!")); } diff --git a/GeneralsMD/Code/GameEngine/Include/Common/STLTypedefs.h b/GeneralsMD/Code/GameEngine/Include/Common/STLTypedefs.h index d3ed133b238..939d27af6b7 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/STLTypedefs.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/STLTypedefs.h @@ -58,7 +58,6 @@ class STLSpecialAlloc; #include "Common/UnicodeString.h" #include "Common/GameCommon.h" #include "Common/GameMemory.h" -#include "Common/STLUtils.h" //----------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp index d6099851233..0a1d64b2bda 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp @@ -1498,7 +1498,7 @@ PersistClass * DazzlePersistFactoryClass::Load(ChunkLoadClass & cload) const */ if (new_obj == NULL) { static int count = 0; - if ( ++count < 10 ) { + if ( count++ < 10 ) { WWDEBUG_SAY(("DazzlePersistFactory failed to create dazzle of type: %s!!",dazzle_type)); WWDEBUG_SAY(("Replacing it with a NULL render object!")); } From 89858fbfc240d656e0f853b9d1c438676f3610d3 Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Tue, 23 Sep 2025 20:31:55 +0100 Subject: [PATCH 155/343] refactor(pathfinder): Simplify and improve readability of Pathfinder::checkDestination (#1645) --- .../Source/GameLogic/AI/AIPathfind.cpp | 88 +++++++++-------- .../Source/GameLogic/AI/AIPathfind.cpp | 95 +++++++++++-------- 2 files changed, 106 insertions(+), 77 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 9967a654278..fc1d65aa81a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -4339,49 +4339,63 @@ Bool Pathfinder::checkDestination(const Object *obj, Int cellX, Int cellY, Pathf for (i=cellX-iRadius; iisAircraftGoal()) continue; - if (cell->getGoalAircraft()==objID) continue; - return false; - } - if (cell->getType()==PathfindCell::CELL_OBSTACLE) { - if (cell->isObstaclePresent( ignoreId )) - continue; - return false; + if (!cell) { + return false; // off the map, so can't place here. + } + + if (checkForAircraft) { + if (!cell->isAircraftGoal()) { + continue; } - if (cell->getFlags() == PathfindCell::NO_UNITS) { - continue; // Nobody is here, so it's ok. + if (cell->getGoalAircraft() == objID) { + continue; } - ObjectID goalUnitID = cell->getGoalUnit(); - if (goalUnitID==objID) { - continue; // we got it. - } else if (ignoreId==goalUnitID) { - continue; // we are ignoring it. - } else if (goalUnitID!=INVALID_ID) { - if (obj==NULL) { - return false; - } - Object *unit = TheGameLogic->findObjectByID(goalUnitID); - if (unit) { - // order matters: we want to know if I consider it to be an ally, not vice versa - if (obj->getRelationship(unit) == ALLIES) { - return false; // Don't usurp your allies goals. jba. - } - if (cell->getFlags()==PathfindCell::UNIT_PRESENT_FIXED) { - Bool canCrush = obj->canCrushOrSquish(unit, TEST_CRUSH_OR_SQUISH); - if (!canCrush) { - return false; // Don't move to an occupied cell. - } - } - } + return false; + } + + if (cell->getType()==PathfindCell::CELL_OBSTACLE) { + if (cell->isObstaclePresent( ignoreId )) + continue; + return false; + } + + if (cell->getFlags() == PathfindCell::NO_UNITS) { + continue; // Nobody is here, so it's ok. + } + + ObjectID goalUnitID = cell->getGoalUnit(); + if (goalUnitID == objID) { + continue; // we got it. + } + + if (goalUnitID == ignoreId) { + continue; // we are ignoring it. + } + + if (goalUnitID == INVALID_ID) { + continue; + } + + if (!obj) { + return false; + } + Object *unit = TheGameLogic->findObjectByID(goalUnitID); + if (!unit) { + continue; + } + + // order matters: we want to know if I consider it to be an ally, not vice versa + if (obj->getRelationship(unit) == ALLIES) { + return false; // Don't usurp your allies goals. jba. + } + if (cell->getFlags()==PathfindCell::UNIT_PRESENT_FIXED) { + Bool canCrush = obj->canCrushOrSquish(unit, TEST_CRUSH_OR_SQUISH); + if (!canCrush) { + return false; // Don't move to an occupied cell. } - } else { - return false; // off the map, so can't place here. } } } - return true; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 93976cd80f0..c4cc68738bb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -4623,52 +4623,67 @@ Bool Pathfinder::checkDestination(const Object *obj, Int cellX, Int cellY, Pathf for (i=cellX-iRadius; iisAircraftGoal()) continue; - if (cell->getGoalAircraft()==objID) continue; - return false; - } - if (cell->getType()==PathfindCell::CELL_OBSTACLE) { - if (cell->isObstaclePresent( ignoreId )) - continue; - return false; - } - if (IS_IMPASSABLE(cell->getType())) { - return false; + if (!cell) { + return false; // off the map, so can't place here. + } + + if (checkForAircraft) { + if (!cell->isAircraftGoal()) { + continue; } - if (cell->getFlags() == PathfindCell::NO_UNITS) { - continue; // Nobody is here, so it's ok. + if (cell->getGoalAircraft() == objID) { + continue; } - ObjectID goalUnitID = cell->getGoalUnit(); - if (goalUnitID==objID) { - continue; // we got it. - } else if (ignoreId==goalUnitID) { - continue; // we are ignoring it. - } else if (goalUnitID!=INVALID_ID) { - if (obj==NULL) { - return false; - } - Object *unit = TheGameLogic->findObjectByID(goalUnitID); - if (unit) { - // order matters: we want to know if I consider it to be an ally, not vice versa - if (obj->getRelationship(unit) == ALLIES) { - return false; // Don't usurp your allies goals. jba. - } - if (cell->getFlags()==PathfindCell::UNIT_PRESENT_FIXED) { - Bool canCrush = obj->canCrushOrSquish(unit, TEST_CRUSH_OR_SQUISH); - if (!canCrush) { - return false; // Don't move to an occupied cell. - } - } - } + return false; + } + + if (cell->getType()==PathfindCell::CELL_OBSTACLE) { + if (cell->isObstaclePresent( ignoreId )) + continue; + return false; + } + + if (IS_IMPASSABLE(cell->getType())) { + return false; + } + + if (cell->getFlags() == PathfindCell::NO_UNITS) { + continue; // Nobody is here, so it's ok. + } + + ObjectID goalUnitID = cell->getGoalUnit(); + if (goalUnitID == objID) { + continue; // we got it. + } + + if (goalUnitID == ignoreId) { + continue; // we are ignoring it. + } + + if (goalUnitID == INVALID_ID) { + continue; + } + + if (!obj) { + return false; + } + Object *unit = TheGameLogic->findObjectByID(goalUnitID); + if (!unit) { + continue; + } + + // order matters: we want to know if I consider it to be an ally, not vice versa + if (obj->getRelationship(unit) == ALLIES) { + return false; // Don't usurp your allies goals. jba. + } + if (cell->getFlags()==PathfindCell::UNIT_PRESENT_FIXED) { + Bool canCrush = obj->canCrushOrSquish(unit, TEST_CRUSH_OR_SQUISH); + if (!canCrush) { + return false; // Don't move to an occupied cell. } - } else { - return false; // off the map, so can't place here. } } } - return true; } From 155280b56743052784951078e26a01a2c950ebfe Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Wed, 24 Sep 2025 19:11:33 +0100 Subject: [PATCH 156/343] refactor(pathfinder): Simplify and improve readability of Pathfinder::snapClosestGoalPosition (#1645) --- .../Source/GameLogic/AI/AIPathfind.cpp | 52 ++++++++++--------- .../Source/GameLogic/AI/AIPathfind.cpp | 52 ++++++++++--------- 2 files changed, 56 insertions(+), 48 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index fc1d65aa81a..c28fe7ed2aa 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -4552,37 +4552,41 @@ void Pathfinder::snapClosestGoalPosition(Object *obj, Coord3D *pos) // Try adjusting by 1. Int i,j; - for (i=cell.x-1; igetGoalUnit()==INVALID_ID || newCell->getGoalUnit()==obj->getID()) { - adjustCoordToCell(i, j, center, *pos, layer); - return; - } - } + + if (iRadius > 0) + return; + + // Try to find an unoccupied cell. + for (i = cell.x - 1; i < cell.x + 2; i++) { + for (j = cell.y - 1; j < cell.y + 2; j++) { + PathfindCell* newCell = getCell(layer, i, j); + if (!newCell) + continue; + + if (newCell->getGoalUnit() == INVALID_ID || newCell->getGoalUnit() == obj->getID()) { + adjustCoordToCell(i, j, center, *pos, layer); + return; } } - // Try to find an unoccupied cell. - for (i=cell.x-1; igetFlags()!=PathfindCell::UNIT_PRESENT_FIXED) { - adjustCoordToCell(i, j, center, *pos, layer); - return; - } - } + } + + for (i = cell.x - 1; i < cell.x + 2; i++) { + for (j = cell.y - 1; j < cell.y + 2; j++) { + PathfindCell* newCell = getCell(layer, i, j); + if (!newCell) + continue; + + if (newCell->getFlags()!=PathfindCell::UNIT_PRESENT_FIXED) { + adjustCoordToCell(i, j, center, *pos, layer); + return; } } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index c4cc68738bb..013acde5949 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -4837,37 +4837,41 @@ void Pathfinder::snapClosestGoalPosition(Object *obj, Coord3D *pos) // Try adjusting by 1. Int i,j; - for (i=cell.x-1; igetGoalUnit()==INVALID_ID || newCell->getGoalUnit()==obj->getID()) { - adjustCoordToCell(i, j, center, *pos, layer); - return; - } - } + + if (iRadius > 0) + return; + + // Try to find an unoccupied cell. + for (i = cell.x - 1; i < cell.x + 2; i++) { + for (j = cell.y - 1; j < cell.y + 2; j++) { + PathfindCell* newCell = getCell(layer, i, j); + if (!newCell) + continue; + + if (newCell->getGoalUnit() == INVALID_ID || newCell->getGoalUnit() == obj->getID()) { + adjustCoordToCell(i, j, center, *pos, layer); + return; } } - // Try to find an unoccupied cell. - for (i=cell.x-1; igetFlags()!=PathfindCell::UNIT_PRESENT_FIXED) { - adjustCoordToCell(i, j, center, *pos, layer); - return; - } - } + } + + for (i = cell.x - 1; i < cell.x + 2; i++) { + for (j = cell.y - 1; j < cell.y + 2; j++) { + PathfindCell* newCell = getCell(layer, i, j); + if (!newCell) + continue; + + if (newCell->getFlags()!=PathfindCell::UNIT_PRESENT_FIXED) { + adjustCoordToCell(i, j, center, *pos, layer); + return; } } } From c95e79b9f8d3eb77fea4b3950665a7e91c9c9109 Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Sun, 28 Sep 2025 09:35:20 +0100 Subject: [PATCH 157/343] refactor(pathfinder): Simplify and improve readability of Pathfinder::examineCellsCallback (#1645) --- .../Source/GameLogic/AI/AIPathfind.cpp | 32 ++++++++----------- .../Source/GameLogic/AI/AIPathfind.cpp | 32 ++++++++----------- 2 files changed, 28 insertions(+), 36 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index c28fe7ed2aa..cec570612da 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -5413,14 +5413,7 @@ struct ExamineCellsStruct if ( (to->getLayer() == LAYER_GROUND) && !d->thePathfinder->m_zoneManager.isPassable(to_x, to_y) ) { return 1; } - Bool onList = false; - if (to->hasInfo()) { - if (to->getOpen() || to->getClosed()) - { - // already on one of the lists - onList = true; - } - } + if (to->getPinched()) { return 1; // abort. } @@ -5439,25 +5432,26 @@ struct ExamineCellsStruct info.radius = d->radius; info.considerTransient = false; info.acceptableSurfaces = d->theLoco->getValidSurfaces(); - if (!d->thePathfinder->checkForMovement(d->obj, info) || info.enemyFixed) { + if (!d->thePathfinder->checkForMovement(d->obj, info)) { return 1; //abort. } + if (info.enemyFixed) { return 1; //abort. } - ICoord2D newCellCoord; - newCellCoord.x = to_x; - newCellCoord.y = to_y; + + if (info.allyFixedCount) { + return 1; //abort. + } UnsignedInt newCostSoFar = from->getCostSoFar( ) + 0.5f*COST_ORTHOGONAL; if (to->getType() == PathfindCell::CELL_CLIFF ) { return 1; } - if (info.allyFixedCount) { - return 1; - } else if (info.enemyFixed) { - return 1; - } + + ICoord2D newCellCoord; + newCellCoord.x = to_x; + newCellCoord.y = to_y; if (!to->allocateInfo(newCellCoord)) { // Out of cells for pathing... @@ -5466,15 +5460,17 @@ struct ExamineCellsStruct to->setBlockedByAlly(false); Int costRemaining = 0; costRemaining = to->costToGoal( d->goalCell ); + // check if this neighbor cell is already on the open (waiting to be tried) // or closed (already tried) lists - if (onList) + if ( to->hasInfo() && (to->getOpen() || to->getClosed()) ) { // already on one of the lists - if existing costSoFar is less, // the new cell is on a longer path, so skip it if (to->getCostSoFar() <= newCostSoFar) return 0; // keep going. } + to->setCostSoFar(newCostSoFar); // keep track of path we're building - point back to cell we moved here from to->setParentCell(from) ; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 013acde5949..32a73154952 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -5712,14 +5712,7 @@ struct ExamineCellsStruct if ( (to->getLayer() == LAYER_GROUND) && !d->thePathfinder->m_zoneManager.isPassable(to_x, to_y) ) { return 1; } - Bool onList = false; - if (to->hasInfo()) { - if (to->getOpen() || to->getClosed()) - { - // already on one of the lists - onList = true; - } - } + if (to->getPinched()) { return 1; // abort. } @@ -5738,25 +5731,26 @@ struct ExamineCellsStruct info.radius = d->radius; info.considerTransient = false; info.acceptableSurfaces = d->theLoco->getValidSurfaces(); - if (!d->thePathfinder->checkForMovement(d->obj, info) || info.enemyFixed) { + if (!d->thePathfinder->checkForMovement(d->obj, info)) { return 1; //abort. } + if (info.enemyFixed) { return 1; //abort. } - ICoord2D newCellCoord; - newCellCoord.x = to_x; - newCellCoord.y = to_y; + + if (info.allyFixedCount) { + return 1; //abort. + } UnsignedInt newCostSoFar = from->getCostSoFar( ) + 0.5f*COST_ORTHOGONAL; if (to->getType() == PathfindCell::CELL_CLIFF ) { return 1; } - if (info.allyFixedCount) { - return 1; - } else if (info.enemyFixed) { - return 1; - } + + ICoord2D newCellCoord; + newCellCoord.x = to_x; + newCellCoord.y = to_y; if (!to->allocateInfo(newCellCoord)) { // Out of cells for pathing... @@ -5765,15 +5759,17 @@ struct ExamineCellsStruct to->setBlockedByAlly(false); Int costRemaining = 0; costRemaining = to->costToGoal( d->goalCell ); + // check if this neighbor cell is already on the open (waiting to be tried) // or closed (already tried) lists - if (onList) + if ( to->hasInfo() && (to->getOpen() || to->getClosed()) ) { // already on one of the lists - if existing costSoFar is less, // the new cell is on a longer path, so skip it if (to->getCostSoFar() <= newCostSoFar) return 0; // keep going. } + to->setCostSoFar(newCostSoFar); // keep track of path we're building - point back to cell we moved here from to->setParentCell(from) ; From 8c02b2209f22a8e926fff2c6da4b6afa9ffbcb73 Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Sun, 28 Sep 2025 10:01:04 +0100 Subject: [PATCH 158/343] refactor(pathfinder): Simplify and improve readability of Pathfinder::checkForMovement (#1645) --- .../Source/GameLogic/AI/AIPathfind.cpp | 150 +++++++++--------- .../Source/GameLogic/AI/AIPathfind.cpp | 144 +++++++++-------- 2 files changed, 155 insertions(+), 139 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index cec570612da..6dfb1491480 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -4415,7 +4415,10 @@ Bool Pathfinder::checkForMovement(const Object *obj, TCheckMovementInfo &info) ObjectID allies[maxAlly]; Int numAlly = 0; - if (!obj) return true; // not object can move there. + if (!obj) { + return true; // not object can move there. + } + ObjectID ignoreId = INVALID_ID; if (obj->getAIUpdateInterface()) { ignoreId = obj->getAIUpdateInterface()->getIgnoredObstacleID(); @@ -4428,81 +4431,86 @@ Bool Pathfinder::checkForMovement(const Object *obj, TCheckMovementInfo &info) for (i=info.cell.x-info.radius; igetFlags(); - ObjectID posUnit = cell->getPosUnit(); - if ((flags == PathfindCell::UNIT_GOAL) || (flags == PathfindCell::UNIT_GOAL_OTHER_MOVING)) { - info.allyGoal = true; - } - if (flags == PathfindCell::NO_UNITS) { - continue; // Nobody is here, so it's ok. - } else if (posUnit==obj->getID()) { - continue; // we got it. - } else if (posUnit==ignoreId) { - continue; // we are ignoring this one. - } else { - Bool check = false; - Object *unit = NULL; - if (flags==PathfindCell::UNIT_PRESENT_MOVING || flags==PathfindCell::UNIT_GOAL_OTHER_MOVING) { - unit = TheGameLogic->findObjectByID(posUnit); - // order matters: we want to know if I consider it to be an ally, not vice versa - if (unit && obj->getRelationship(unit) == ALLIES) { - info.allyMoving = true; - } - if (info.considerTransient) { - check = true; - } - } - if (flags == PathfindCell::UNIT_PRESENT_FIXED) { - check = true; - unit = TheGameLogic->findObjectByID(posUnit); - } - if (check && unit!=NULL) { - if (obj->getAIUpdateInterface() && obj->getAIUpdateInterface()->getIgnoredObstacleID()==unit->getID()) { - // Don't check if it's the ignored obstacle. - check = false; - } - } - if (check && unit) { + if (!cell) { + return false; // off the map, so can't move here. + } + + PathfindCell::CellFlags flags = cell->getFlags(); + if ((flags == PathfindCell::UNIT_GOAL) || (flags == PathfindCell::UNIT_GOAL_OTHER_MOVING)) { + info.allyGoal = true; + } else if (flags == PathfindCell::NO_UNITS) { + continue; // Nobody is here, so it's ok. + } + + ObjectID posUnit = cell->getPosUnit(); + if (posUnit == obj->getID()) { + continue; // we got it. + } + + if (posUnit == ignoreId) { + continue; // we are ignoring this one. + } + + Bool check = false; + Object *unit = NULL; + if (flags == PathfindCell::UNIT_PRESENT_MOVING || flags == PathfindCell::UNIT_GOAL_OTHER_MOVING) { + unit = TheGameLogic->findObjectByID(posUnit); + // order matters: we want to know if I consider it to be an ally, not vice versa + if (unit && obj->getRelationship(unit) == ALLIES) { + info.allyMoving = true; + } + if (info.considerTransient) { + check = true; + } + } + if (flags == PathfindCell::UNIT_PRESENT_FIXED) { + check = true; + unit = TheGameLogic->findObjectByID(posUnit); + } + if (check && unit!=NULL) { + if (obj->getAIUpdateInterface() && obj->getAIUpdateInterface()->getIgnoredObstacleID()==unit->getID()) { + // Don't check if it's the ignored obstacle. + check = false; + } + } + if (!check || !unit) { + continue; + } + #ifdef INFANTRY_MOVES_THROUGH_INFANTRY - if (obj->isKindOf(KINDOF_INFANTRY) && unit->isKindOf(KINDOF_INFANTRY)) { - // Infantry can run through infantry. - continue; // - } + if (obj->isKindOf(KINDOF_INFANTRY) && unit->isKindOf(KINDOF_INFANTRY)) { + // Infantry can run through infantry. + continue; // + } #endif - // See if it is an ally. - // order matters: we want to know if I consider it to be an ally, not vice versa - if (obj->getRelationship(unit) == ALLIES) { - if (!unit->getAIUpdateInterface()) { - return false; // can't path through not-idle units. - } - if (!unit->getAIUpdateInterface()->isIdle()) { - return false; // can't path through not-idle units. - } - Bool found = false; - Int k; - for (k=0; kgetID()) { - found = true; - } - } - if (!found) { - info.allyFixedCount++; - if (numAlly < maxAlly) { - allies[numAlly] = unit->getID(); - numAlly++; - } - } - } else { - Bool canCrush = obj->canCrushOrSquish( unit, TEST_CRUSH_OR_SQUISH ); - if (!canCrush) { - info.enemyFixed = true; - } - } + // See if it is an ally. + // order matters: we want to know if I consider it to be an ally, not vice versa + if (obj->getRelationship(unit) == ALLIES) { + if (!unit->getAIUpdateInterface()) { + return false; // can't path through not-idle units. + } + if (!unit->getAIUpdateInterface()->isIdle()) { + return false; // can't path through not-idle units. + } + Bool found = false; + Int k; + for (k=0; kgetID()) { + found = true; + } + } + if (!found) { + info.allyFixedCount++; + if (numAlly < maxAlly) { + allies[numAlly] = unit->getID(); + numAlly++; } } } else { - return false; // off the map, so can't place here. + Bool canCrush = obj->canCrushOrSquish( unit, TEST_CRUSH_OR_SQUISH ); + if (!canCrush) { + info.enemyFixed = true; + } } } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 32a73154952..10f8772c660 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -4703,7 +4703,10 @@ Bool Pathfinder::checkForMovement(const Object *obj, TCheckMovementInfo &info) ObjectID allies[maxAlly]; Int numAlly = 0; - if (!obj) return true; // not object can move there. + if (!obj) { + return true; // not object can move there. + } + ObjectID ignoreId = INVALID_ID; if (obj->getAIUpdateInterface()) { ignoreId = obj->getAIUpdateInterface()->getIgnoredObstacleID(); @@ -4716,78 +4719,83 @@ Bool Pathfinder::checkForMovement(const Object *obj, TCheckMovementInfo &info) for (i=info.cell.x-info.radius; igetFlags(); - ObjectID posUnit = cell->getPosUnit(); - if ((flags == PathfindCell::UNIT_GOAL) || (flags == PathfindCell::UNIT_GOAL_OTHER_MOVING)) { - info.allyGoal = true; - } - if (flags == PathfindCell::NO_UNITS) { - continue; // Nobody is here, so it's ok. - } else if (posUnit==obj->getID()) { - continue; // we got it. - } else if (posUnit==ignoreId) { - continue; // we are ignoring this one. - } else { - Bool check = false; - Object *unit = NULL; - if (flags==PathfindCell::UNIT_PRESENT_MOVING || flags==PathfindCell::UNIT_GOAL_OTHER_MOVING) { - unit = TheGameLogic->findObjectByID(posUnit); - // order matters: we want to know if I consider it to be an ally, not vice versa - if (unit && obj->getRelationship(unit) == ALLIES) { - info.allyMoving = true; - } - if (info.considerTransient) { - check = true; - } - } - if (flags == PathfindCell::UNIT_PRESENT_FIXED) { - check = true; - unit = TheGameLogic->findObjectByID(posUnit); - } - if (check && unit!=NULL) { - if (obj->getAIUpdateInterface() && obj->getAIUpdateInterface()->getIgnoredObstacleID()==unit->getID()) { - // Don't check if it's the ignored obstacle. - check = false; - } - } - if (check && unit) { + if (!cell) { + return false; // off the map, so can't move here. + } + + PathfindCell::CellFlags flags = cell->getFlags(); + if ((flags == PathfindCell::UNIT_GOAL) || (flags == PathfindCell::UNIT_GOAL_OTHER_MOVING)) { + info.allyGoal = true; + } else if (flags == PathfindCell::NO_UNITS) { + continue; // Nobody is here, so it's ok. + } + + ObjectID posUnit = cell->getPosUnit(); + if (posUnit == obj->getID()) { + continue; // we got it. + } + + if (posUnit == ignoreId) { + continue; // we are ignoring this one. + } + + Bool check = false; + Object *unit = NULL; + if (flags == PathfindCell::UNIT_PRESENT_MOVING || flags == PathfindCell::UNIT_GOAL_OTHER_MOVING) { + unit = TheGameLogic->findObjectByID(posUnit); + // order matters: we want to know if I consider it to be an ally, not vice versa + if (unit && obj->getRelationship(unit) == ALLIES) { + info.allyMoving = true; + } + if (info.considerTransient) { + check = true; + } + } + if (flags == PathfindCell::UNIT_PRESENT_FIXED) { + check = true; + unit = TheGameLogic->findObjectByID(posUnit); + } + if (check && unit!=NULL) { + if (obj->getAIUpdateInterface() && obj->getAIUpdateInterface()->getIgnoredObstacleID()==unit->getID()) { + // Don't check if it's the ignored obstacle. + check = false; + } + } + if (!check || !unit) { + continue; + } + #ifdef INFANTRY_MOVES_THROUGH_INFANTRY - if (obj->isKindOf(KINDOF_INFANTRY) && unit->isKindOf(KINDOF_INFANTRY)) { - // Infantry can run through infantry. - continue; // - } + if (obj->isKindOf(KINDOF_INFANTRY) && unit->isKindOf(KINDOF_INFANTRY)) { + // Infantry can run through infantry. + continue; // + } #endif - // See if it is an ally. - // order matters: we want to know if I consider it to be an ally, not vice versa - if (obj->getRelationship(unit) == ALLIES) { - if (!unit->getAIUpdateInterface()) { - return false; // can't path through not-idle units. - } - Bool found = false; - Int k; - for (k=0; kgetID()) { - found = true; - } - } - if (!found) { - info.allyFixedCount++; - if (numAlly < maxAlly) { - allies[numAlly] = unit->getID(); - numAlly++; - } - } - } else { - Bool canCrush = obj->canCrushOrSquish( unit, TEST_CRUSH_OR_SQUISH ); - if (!canCrush) { - info.enemyFixed = true; - } - } + // See if it is an ally. + // order matters: we want to know if I consider it to be an ally, not vice versa + if (obj->getRelationship(unit) == ALLIES) { + if (!unit->getAIUpdateInterface()) { + return false; // can't path through not-idle units. + } + Bool found = false; + Int k; + for (k=0; kgetID()) { + found = true; + } + } + if (!found) { + info.allyFixedCount++; + if (numAlly < maxAlly) { + allies[numAlly] = unit->getID(); + numAlly++; } } } else { - return false; // off the map, so can't place here. + Bool canCrush = obj->canCrushOrSquish( unit, TEST_CRUSH_OR_SQUISH ); + if (!canCrush) { + info.enemyFixed = true; + } } } } From 6c9a97596a819df9d278bd6e7e93e81d7bdc98f8 Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Tue, 30 Sep 2025 21:51:28 +0100 Subject: [PATCH 159/343] refactor(pathfinder): Simplify and improve readability of Pathfinder::moveAllies (#1645) --- .../Source/GameLogic/AI/AIPathfind.cpp | 71 +++++++++------ .../Source/GameLogic/AI/AIPathfind.cpp | 90 +++++++++++-------- 2 files changed, 98 insertions(+), 63 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 6dfb1491480..bbe5e29e699 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -9555,10 +9555,14 @@ if (g_UT_startTiming) return false; #endif if (!obj->isKindOf(KINDOF_DOZER) && !obj->isKindOf(KINDOF_HARVESTER)) { // Harvesters & dozers want a clear path. - if (!path->getBlockedByAlly()) return FALSE; // Only move units if it is required. + if (!path->getBlockedByAlly()) { + return FALSE; // Only move units if it is required. + } } LatchRestore recursiveDepth(m_moveAlliesDepth, m_moveAlliesDepth+1); - if (m_moveAlliesDepth > 2) return false; + if (m_moveAlliesDepth > 2) { + return false; + } Bool centerInCell; Int radius; @@ -9577,33 +9581,48 @@ if (g_UT_startTiming) return false; for (i=curCell.x-radius; igetLayer(), i, j); - if (cell) { - if (cell->getPosUnit()==INVALID_ID) { + if (!cell) { + continue; // Cell is not on the pathfinding grid + } + + ObjectID unitId = cell->getPosUnit(); + if (unitId==INVALID_ID) { + continue; + } + + if (unitId==obj->getID()) { + continue; // It's us. + } + + if (unitId==ignoreId) { + continue; // It's the one we are ignoring. + } + + Object *otherObj = TheGameLogic->findObjectByID(unitId); + if (!otherObj) { + continue; + } + + if (obj->getRelationship(otherObj)!=ALLIES) { + continue; // Only move allies. + } + + if (obj->isKindOf(KINDOF_INFANTRY) && otherObj->isKindOf(KINDOF_INFANTRY)) { + continue; // infantry can walk through other infantry, so just let them. + } + if (obj->isKindOf(KINDOF_INFANTRY) && !otherObj->isKindOf(KINDOF_INFANTRY)) { + // If this is a general clear operation, don't let infantry push vehicles. + if (!path->getBlockedByAlly()) { continue; } - if (cell->getPosUnit()==obj->getID()) { - continue; // It's us. - } - if (cell->getPosUnit()==ignoreId) { - continue; // It's the one we are ignoring. - } - Object *otherObj = TheGameLogic->findObjectByID(cell->getPosUnit()); - if (obj->getRelationship(otherObj)!=ALLIES) { - continue; // Only move allies. - } - if (otherObj==NULL) continue; - if (obj->isKindOf(KINDOF_INFANTRY) && otherObj->isKindOf(KINDOF_INFANTRY)) { - continue; // infantry can walk through other infantry, so just let them. - } - if (obj->isKindOf(KINDOF_INFANTRY) && !otherObj->isKindOf(KINDOF_INFANTRY)) { - // If this is a general clear operation, don't let infantry push vehicles. - if (!path->getBlockedByAlly()) continue; - } - if (otherObj && otherObj->getAI() && !otherObj->getAI()->isMoving()) { - //DEBUG_LOG(("Moving ally")); - otherObj->getAI()->aiMoveAwayFromUnit(obj, CMD_FROM_AI); - } } + + if (!otherObj->getAI() || otherObj->getAI()->isMoving()) { + continue; + } + + //DEBUG_LOG(("Moving ally")); + otherObj->getAI()->aiMoveAwayFromUnit(obj, CMD_FROM_AI); } } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 10f8772c660..43b135c80fb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -9967,10 +9967,14 @@ if (g_UT_startTiming) return false; #endif if (!obj->isKindOf(KINDOF_DOZER) && !obj->isKindOf(KINDOF_HARVESTER)) { // Harvesters & dozers want a clear path. - if (!path->getBlockedByAlly()) return FALSE; // Only move units if it is required. + if (!path->getBlockedByAlly()) { + return FALSE; // Only move units if it is required. + } } LatchRestore recursiveDepth(m_moveAlliesDepth, m_moveAlliesDepth+1); - if (m_moveAlliesDepth > 2) return false; + if (m_moveAlliesDepth > 2) { + return false; + } Bool centerInCell; Int radius; @@ -9989,46 +9993,58 @@ if (g_UT_startTiming) return false; for (i=curCell.x-radius; igetLayer(), i, j); - if (cell) { - if (cell->getPosUnit()==INVALID_ID) { + if (!cell) { + continue; // Cell is not on the pathfinding grid + } + + ObjectID unitId = cell->getPosUnit(); + if (unitId==INVALID_ID) { + continue; + } + + if (unitId==obj->getID()) { + continue; // It's us. + } + + if (unitId==ignoreId) { + continue; // It's the one we are ignoring. + } + + Object *otherObj = TheGameLogic->findObjectByID(unitId); + if (!otherObj) { + continue; + } + + if (obj->getRelationship(otherObj)!=ALLIES) { + continue; // Only move allies. + } + + if (obj->isKindOf(KINDOF_INFANTRY) && otherObj->isKindOf(KINDOF_INFANTRY)) { + continue; // infantry can walk through other infantry, so just let them. + } + if (obj->isKindOf(KINDOF_INFANTRY) && !otherObj->isKindOf(KINDOF_INFANTRY)) { + // If this is a general clear operation, don't let infantry push vehicles. + if (!path->getBlockedByAlly()) { continue; } - if (cell->getPosUnit()==obj->getID()) { - continue; // It's us. - } - if (cell->getPosUnit()==ignoreId) { - continue; // It's the one we are ignoring. - } - Object *otherObj = TheGameLogic->findObjectByID(cell->getPosUnit()); - if (obj->getRelationship(otherObj)!=ALLIES) { - continue; // Only move allies. - } - if (otherObj==NULL) continue; - if (obj->isKindOf(KINDOF_INFANTRY) && otherObj->isKindOf(KINDOF_INFANTRY)) { - continue; // infantry can walk through other infantry, so just let them. - } - if (obj->isKindOf(KINDOF_INFANTRY) && !otherObj->isKindOf(KINDOF_INFANTRY)) { - // If this is a general clear operation, don't let infantry push vehicles. - if (!path->getBlockedByAlly()) continue; - } - if( otherObj && otherObj->getAI() && !otherObj->getAI()->isMoving() ) - { - if( otherObj->getAI()->isAttacking() ) - { - continue; // Don't move units that are attacking. [8/14/2003] - } + } - //Kris: Patch 1.01 November 3, 2003 - //Black Lotus exploit fix -- moving while hacking. - if( otherObj->testStatus( OBJECT_STATUS_IS_USING_ABILITY ) || otherObj->getAI()->isBusy() ) - { - continue; // Packing or unpacking objects for example - } + if (!otherObj->getAI() || otherObj->getAI()->isMoving()) { + continue; + } - //DEBUG_LOG(("Moving ally")); - otherObj->getAI()->aiMoveAwayFromUnit(obj, CMD_FROM_AI); - } + if (otherObj->getAI()->isAttacking()) { + continue; // Don't move units that are attacking. [8/14/2003] + } + + //Kris: Patch 1.01 November 3, 2003 + //Black Lotus exploit fix -- moving while hacking. + if( otherObj->testStatus( OBJECT_STATUS_IS_USING_ABILITY ) || otherObj->getAI()->isBusy() ) { + continue; // Packing or unpacking objects for example } + + //DEBUG_LOG(("Moving ally")); + otherObj->getAI()->aiMoveAwayFromUnit(obj, CMD_FROM_AI); } } } From 9e42e5988f66b22a6b382e9577728b12592a911b Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 11 Oct 2025 21:48:04 +0200 Subject: [PATCH 160/343] tweak(gamelod): Simplify game detail setup for Options Menu (#1628) --- .../Code/GameEngine/Include/Common/GameLOD.h | 2 +- .../Code/GameEngine/Source/Common/GameLOD.cpp | 10 +- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 102 +++--------------- .../GUI/GUICallbacks/Menus/ScoreScreen.cpp | 4 +- .../W3DDevice/GameClient/W3DDisplay.cpp | 4 +- .../Code/GameEngine/Include/Common/GameLOD.h | 2 +- .../Code/GameEngine/Source/Common/GameLOD.cpp | 10 +- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 102 +++--------------- .../GUI/GUICallbacks/Menus/ScoreScreen.cpp | 4 +- .../W3DDevice/GameClient/W3DDisplay.cpp | 4 +- 10 files changed, 52 insertions(+), 192 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/GameLOD.h b/Generals/Code/GameEngine/Include/Common/GameLOD.h index 2d08f9f1615..d19246a18b2 100644 --- a/Generals/Code/GameEngine/Include/Common/GameLOD.h +++ b/Generals/Code/GameEngine/Include/Common/GameLOD.h @@ -163,7 +163,7 @@ class GameLODManager const char *getStaticGameLODLevelName(StaticGameLODLevel level); const char *getDynamicGameLODLevelName(DynamicGameLODLevel level); - StaticGameLODLevel findStaticLODLevel(void); ///< calculate the optimal static LOD level for this system. + StaticGameLODLevel getRecommendedStaticLODLevel(void); ///< calculate the optimal static LOD level for this system. Bool setStaticLODLevel(StaticGameLODLevel level); ///< set the current static LOD level. StaticGameLODLevel getStaticLODLevel(void) { return m_currentStaticLOD;} DynamicGameLODLevel findDynamicLODLevel(Real averageFPS); ///= STATIC_GAME_LOD_COUNT) - return m_staticGameLODInfo[STATIC_GAME_LOD_LOW].m_textureReduction; + return getLevelTextureReduction(STATIC_GAME_LOD_LOW); - return m_staticGameLODInfo[m_idealDetailLevel].m_textureReduction; + return getLevelTextureReduction(m_idealDetailLevel); } Int GameLODManager::getLevelTextureReduction(StaticGameLODLevel level) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index 839748ac39c..7f9755f105f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -208,14 +208,6 @@ extern void DoResolutionDialog(); static Bool ignoreSelected = FALSE; WindowLayout *OptionsLayout = NULL; -enum Detail CPP_11(: Int) -{ - HIGHDETAIL = 0, - MEDIUMDETAIL, - LOWDETAIL, - CUSTOMDETAIL, -}; - OptionPreferences::OptionPreferences( void ) { @@ -946,25 +938,9 @@ static void setDefaults( void ) //------------------------------------------------------------------------------------------------- // LOD - if ((TheGameLogic->isInGame() == FALSE) || (TheGameLogic->isInShellGame() == TRUE)) { - TheGameLODManager->setStaticLODLevel(TheGameLODManager->findStaticLODLevel()); - switch (TheGameLODManager->getStaticLODLevel()) - { - case STATIC_GAME_LOD_LOW: - GadgetComboBoxSetSelectedPos(comboBoxDetail, LOWDETAIL); - break; - case STATIC_GAME_LOD_MEDIUM: - GadgetComboBoxSetSelectedPos(comboBoxDetail, MEDIUMDETAIL); - break; - case STATIC_GAME_LOD_HIGH: - GadgetComboBoxSetSelectedPos(comboBoxDetail, HIGHDETAIL); - break; - case STATIC_GAME_LOD_CUSTOM: - GadgetComboBoxSetSelectedPos(comboBoxDetail, CUSTOMDETAIL); - break; - default: - DEBUG_ASSERTCRASH(FALSE,("Tried to set comboBoxDetail to a value of %d ", TheGameLODManager->getStaticLODLevel()) ); - }; + if ((TheGameLogic->isInGame() == FALSE) || (TheGameLogic->isInShellGame() == TRUE)) + { + GadgetComboBoxSetSelectedPos(comboBoxDetail, (Int)TheGameLODManager->getRecommendedStaticLODLevel()); } //------------------------------------------------------------------------------------------------- @@ -1131,7 +1107,7 @@ static void saveOptions( void ) //------------------------------------------------------------------------------------------------- // Custom game detail settings. GadgetComboBoxGetSelectedPos( comboBoxDetail, &index ); - if (index == CUSTOMDETAIL) + if (index == STATIC_GAME_LOD_CUSTOM) { //------------------------------------------------------------------------------------------------- // Texture resolution slider @@ -1200,27 +1176,8 @@ static void saveOptions( void ) // LOD if (comboBoxDetail && comboBoxDetail->winGetEnabled()) { - Bool levelChanged=FALSE; GadgetComboBoxGetSelectedPos( comboBoxDetail, &index ); - - //The levels stored by the LOD Manager are inverted compared to GUI so find correct one: - switch (index) { - case HIGHDETAIL: - levelChanged=TheGameLODManager->setStaticLODLevel(STATIC_GAME_LOD_HIGH); - break; - case MEDIUMDETAIL: - levelChanged=TheGameLODManager->setStaticLODLevel(STATIC_GAME_LOD_MEDIUM); - break; - case LOWDETAIL: - levelChanged=TheGameLODManager->setStaticLODLevel(STATIC_GAME_LOD_LOW); - break; - case CUSTOMDETAIL: - levelChanged=TheGameLODManager->setStaticLODLevel(STATIC_GAME_LOD_CUSTOM); - break; - default: - DEBUG_ASSERTCRASH(FALSE,("LOD passed in was %d, %d is not a supported LOD",index,index)); - break; - } + const Bool levelChanged = TheGameLODManager->setStaticLODLevel((StaticGameLODLevel)index); if (levelChanged) (*pref)["StaticGameLOD"] = TheGameLODManager->getStaticGameLODLevelName(TheGameLODManager->getStaticLODLevel()); @@ -1567,23 +1524,7 @@ static void acceptAdvancedOptions() static void cancelAdvancedOptions() { //restore the detail selection back to initial state - switch (TheGameLODManager->getStaticLODLevel()) - { - case STATIC_GAME_LOD_LOW: - GadgetComboBoxSetSelectedPos(comboBoxDetail, LOWDETAIL); - break; - case STATIC_GAME_LOD_MEDIUM: - GadgetComboBoxSetSelectedPos(comboBoxDetail, MEDIUMDETAIL); - break; - case STATIC_GAME_LOD_HIGH: - GadgetComboBoxSetSelectedPos(comboBoxDetail, HIGHDETAIL); - break; - case STATIC_GAME_LOD_CUSTOM: - GadgetComboBoxSetSelectedPos(comboBoxDetail, CUSTOMDETAIL); - break; - default: - DEBUG_ASSERTCRASH(FALSE,("Tried to set comboBoxDetail to a value of %d ", TheGameLODManager->getStaticLODLevel()) ); - }; + GadgetComboBoxSetSelectedPos(comboBoxDetail, (Int)TheGameLODManager->getStaticLODLevel()); WinAdvancedDisplay->winHide(TRUE); } @@ -1894,35 +1835,22 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) GadgetComboBoxSetSelectedPos( comboBoxResolution, selectedResIndex ); // set the display detail + // TheSuperHackers @tweak xezon 24/09/2025 The Detail Combo Box now has the same value order as StaticGameLODLevel for simplicity. GadgetComboBoxReset(comboBoxDetail); - GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:High"), color); - GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:Medium"), color); GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:Low"), color); + GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:Medium"), color); + GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:High"), color); GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:Custom"), color); + static_assert(STATIC_GAME_LOD_COUNT == 4, "Wrong combo box count"); //Check if level was never set and default to setting most suitable for system. if (TheGameLODManager->getStaticLODLevel() == STATIC_GAME_LOD_UNKNOWN) - TheGameLODManager->setStaticLODLevel(TheGameLODManager->findStaticLODLevel()); - - switch (TheGameLODManager->getStaticLODLevel()) - { - case STATIC_GAME_LOD_LOW: - GadgetComboBoxSetSelectedPos(comboBoxDetail, LOWDETAIL); - break; - case STATIC_GAME_LOD_MEDIUM: - GadgetComboBoxSetSelectedPos(comboBoxDetail, MEDIUMDETAIL); - break; - case STATIC_GAME_LOD_HIGH: - GadgetComboBoxSetSelectedPos(comboBoxDetail, HIGHDETAIL); - break; - case STATIC_GAME_LOD_CUSTOM: - GadgetComboBoxSetSelectedPos(comboBoxDetail, CUSTOMDETAIL); - break; - default: - DEBUG_ASSERTCRASH(FALSE,("Tried to set comboBoxDetail to a value of %d ", TheGameLODManager->getStaticLODLevel()) ); - }; + { + TheGameLODManager->setStaticLODLevel(TheGameLODManager->getRecommendedStaticLODLevel()); + } Int txtFact=TheGameLODManager->getCurrentTextureReduction(); + GadgetComboBoxSetSelectedPos(comboBoxDetail, (Int)TheGameLODManager->getStaticLODLevel()); GadgetSliderSetPosition( sliderTextureResolution, 2-txtFact); @@ -2239,7 +2167,7 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, { Int index; GadgetComboBoxGetSelectedPos( comboBoxDetail, &index ); - if(index != CUSTOMDETAIL) + if(index != STATIC_GAME_LOD_CUSTOM) break; showAdvancedOptions(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp index f154eb9e7bc..69fac1c8305 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp @@ -741,7 +741,7 @@ void finishSinglePlayerInit( void ) if (!TheGameLODManager->didMemPass()) { useLowRes = TRUE; } - if (TheGameLODManager->findStaticLODLevel()==STATIC_GAME_LOD_LOW) { + if (TheGameLODManager->getRecommendedStaticLODLevel()==STATIC_GAME_LOD_LOW) { useLowRes = TRUE; } if (TheGameLODManager->getStaticLODLevel()==STATIC_GAME_LOD_LOW) { @@ -1715,7 +1715,7 @@ winName.format("ScoreScreen.wnd:StaticTextScore%d", pos); stats.surrenders[ptIdx] += TheGameInfo->haveWeSurrendered() || !TheVictoryConditions->getEndFrame(); AsciiString systemSpec; - systemSpec.format("LOD%d", TheGameLODManager->findStaticLODLevel()); + systemSpec.format("LOD%d", TheGameLODManager->getRecommendedStaticLODLevel()); stats.systemSpec = systemSpec.str(); stats.techCaptured[ptIdx] += s->getTotalTechBuildingsCaptured(); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 07d95191074..1c64f1e530d 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -741,7 +741,9 @@ void W3DDisplay::init( void ) //Check if level was never set and default to setting most suitable for system. if (TheGameLODManager->getStaticLODLevel() == STATIC_GAME_LOD_UNKNOWN) - TheGameLODManager->setStaticLODLevel(TheGameLODManager->findStaticLODLevel()); + { + TheGameLODManager->setStaticLODLevel(TheGameLODManager->getRecommendedStaticLODLevel()); + } else { //Static LOD level was applied during GameLOD manager init except for texture reduction //which needs to be applied here. diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h b/GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h index 0ae0e8e2007..cccbee03113 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h @@ -164,7 +164,7 @@ class GameLODManager const char *getStaticGameLODLevelName(StaticGameLODLevel level); const char *getDynamicGameLODLevelName(DynamicGameLODLevel level); - StaticGameLODLevel findStaticLODLevel(void); ///< calculate the optimal static LOD level for this system. + StaticGameLODLevel getRecommendedStaticLODLevel(void); ///< calculate the optimal static LOD level for this system. Bool setStaticLODLevel(StaticGameLODLevel level); ///< set the current static LOD level. StaticGameLODLevel getStaticLODLevel(void) { return m_currentStaticLOD;} DynamicGameLODLevel findDynamicLODLevel(Real averageFPS); ///= STATIC_GAME_LOD_COUNT) - return m_staticGameLODInfo[STATIC_GAME_LOD_LOW].m_textureReduction; + return getLevelTextureReduction(STATIC_GAME_LOD_LOW); - return m_staticGameLODInfo[m_idealDetailLevel].m_textureReduction; + return getLevelTextureReduction(m_idealDetailLevel); } Int GameLODManager::getLevelTextureReduction(StaticGameLODLevel level) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index e5b8b02a000..6962e61b988 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -217,14 +217,6 @@ extern void DoResolutionDialog(); static Bool ignoreSelected = FALSE; WindowLayout *OptionsLayout = NULL; -enum Detail CPP_11(: Int) -{ - HIGHDETAIL = 0, - MEDIUMDETAIL, - LOWDETAIL, - CUSTOMDETAIL, -}; - OptionPreferences::OptionPreferences( void ) { @@ -990,25 +982,9 @@ static void setDefaults( void ) //------------------------------------------------------------------------------------------------- // LOD - if ((TheGameLogic->isInGame() == FALSE) || (TheGameLogic->isInShellGame() == TRUE)) { - StaticGameLODLevel level=TheGameLODManager->findStaticLODLevel(); - switch (level) - { - case STATIC_GAME_LOD_LOW: - GadgetComboBoxSetSelectedPos(comboBoxDetail, LOWDETAIL); - break; - case STATIC_GAME_LOD_MEDIUM: - GadgetComboBoxSetSelectedPos(comboBoxDetail, MEDIUMDETAIL); - break; - case STATIC_GAME_LOD_HIGH: - GadgetComboBoxSetSelectedPos(comboBoxDetail, HIGHDETAIL); - break; - case STATIC_GAME_LOD_CUSTOM: - GadgetComboBoxSetSelectedPos(comboBoxDetail, CUSTOMDETAIL); - break; - default: - DEBUG_ASSERTCRASH(FALSE,("Tried to set comboBoxDetail to a value of %d ", TheGameLODManager->getStaticLODLevel()) ); - }; + if ((TheGameLogic->isInGame() == FALSE) || (TheGameLogic->isInShellGame() == TRUE)) + { + GadgetComboBoxSetSelectedPos(comboBoxDetail, (Int)TheGameLODManager->getRecommendedStaticLODLevel()); } //------------------------------------------------------------------------------------------------- @@ -1182,7 +1158,7 @@ static void saveOptions( void ) //------------------------------------------------------------------------------------------------- // Custom game detail settings. GadgetComboBoxGetSelectedPos( comboBoxDetail, &index ); - if (index == CUSTOMDETAIL) + if (index == STATIC_GAME_LOD_CUSTOM) { //------------------------------------------------------------------------------------------------- // Texture resolution slider @@ -1254,27 +1230,8 @@ static void saveOptions( void ) // LOD if (comboBoxDetail && comboBoxDetail->winGetEnabled()) { - Bool levelChanged=FALSE; GadgetComboBoxGetSelectedPos( comboBoxDetail, &index ); - - //The levels stored by the LOD Manager are inverted compared to GUI so find correct one: - switch (index) { - case HIGHDETAIL: - levelChanged=TheGameLODManager->setStaticLODLevel(STATIC_GAME_LOD_HIGH); - break; - case MEDIUMDETAIL: - levelChanged=TheGameLODManager->setStaticLODLevel(STATIC_GAME_LOD_MEDIUM); - break; - case LOWDETAIL: - levelChanged=TheGameLODManager->setStaticLODLevel(STATIC_GAME_LOD_LOW); - break; - case CUSTOMDETAIL: - levelChanged=TheGameLODManager->setStaticLODLevel(STATIC_GAME_LOD_CUSTOM); - break; - default: - DEBUG_ASSERTCRASH(FALSE,("LOD passed in was %d, %d is not a supported LOD",index,index)); - break; - } + const Bool levelChanged = TheGameLODManager->setStaticLODLevel((StaticGameLODLevel)index); if (levelChanged) (*pref)["StaticGameLOD"] = TheGameLODManager->getStaticGameLODLevelName(TheGameLODManager->getStaticLODLevel()); @@ -1627,23 +1584,7 @@ static void acceptAdvancedOptions() static void cancelAdvancedOptions() { //restore the detail selection back to initial state - switch (TheGameLODManager->getStaticLODLevel()) - { - case STATIC_GAME_LOD_LOW: - GadgetComboBoxSetSelectedPos(comboBoxDetail, LOWDETAIL); - break; - case STATIC_GAME_LOD_MEDIUM: - GadgetComboBoxSetSelectedPos(comboBoxDetail, MEDIUMDETAIL); - break; - case STATIC_GAME_LOD_HIGH: - GadgetComboBoxSetSelectedPos(comboBoxDetail, HIGHDETAIL); - break; - case STATIC_GAME_LOD_CUSTOM: - GadgetComboBoxSetSelectedPos(comboBoxDetail, CUSTOMDETAIL); - break; - default: - DEBUG_ASSERTCRASH(FALSE,("Tried to set comboBoxDetail to a value of %d ", TheGameLODManager->getStaticLODLevel()) ); - }; + GadgetComboBoxSetSelectedPos(comboBoxDetail, (Int)TheGameLODManager->getStaticLODLevel()); WinAdvancedDisplay->winHide(TRUE); } @@ -1961,35 +1902,22 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) GadgetComboBoxSetSelectedPos( comboBoxResolution, selectedResIndex ); // set the display detail + // TheSuperHackers @tweak xezon 24/09/2025 The Detail Combo Box now has the same value order as StaticGameLODLevel for simplicity. GadgetComboBoxReset(comboBoxDetail); - GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:High"), color); - GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:Medium"), color); GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:Low"), color); + GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:Medium"), color); + GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:High"), color); GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:Custom"), color); + static_assert(STATIC_GAME_LOD_COUNT == 4, "Wrong combo box count"); //Check if level was never set and default to setting most suitable for system. if (TheGameLODManager->getStaticLODLevel() == STATIC_GAME_LOD_UNKNOWN) - TheGameLODManager->setStaticLODLevel(TheGameLODManager->findStaticLODLevel()); - - switch (TheGameLODManager->getStaticLODLevel()) - { - case STATIC_GAME_LOD_LOW: - GadgetComboBoxSetSelectedPos(comboBoxDetail, LOWDETAIL); - break; - case STATIC_GAME_LOD_MEDIUM: - GadgetComboBoxSetSelectedPos(comboBoxDetail, MEDIUMDETAIL); - break; - case STATIC_GAME_LOD_HIGH: - GadgetComboBoxSetSelectedPos(comboBoxDetail, HIGHDETAIL); - break; - case STATIC_GAME_LOD_CUSTOM: - GadgetComboBoxSetSelectedPos(comboBoxDetail, CUSTOMDETAIL); - break; - default: - DEBUG_ASSERTCRASH(FALSE,("Tried to set comboBoxDetail to a value of %d ", TheGameLODManager->getStaticLODLevel()) ); - }; + { + TheGameLODManager->setStaticLODLevel(TheGameLODManager->getRecommendedStaticLODLevel()); + } Int txtFact=TheGameLODManager->getCurrentTextureReduction(); + GadgetComboBoxSetSelectedPos(comboBoxDetail, (Int)TheGameLODManager->getStaticLODLevel()); GadgetSliderSetPosition( sliderTextureResolution, 2-txtFact); @@ -2310,7 +2238,7 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, { Int index; GadgetComboBoxGetSelectedPos( comboBoxDetail, &index ); - if(index != CUSTOMDETAIL) + if(index != STATIC_GAME_LOD_CUSTOM) break; showAdvancedOptions(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp index 565057302cb..7d824b2daec 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp @@ -900,7 +900,7 @@ void finishSinglePlayerInit( void ) if (!TheGameLODManager->didMemPass()) { useLowRes = TRUE; } - if (TheGameLODManager->findStaticLODLevel()==STATIC_GAME_LOD_LOW) { + if (TheGameLODManager->getRecommendedStaticLODLevel()==STATIC_GAME_LOD_LOW) { useLowRes = TRUE; } if (TheGameLODManager->getStaticLODLevel()==STATIC_GAME_LOD_LOW) { @@ -1980,7 +1980,7 @@ winName.format("ScoreScreen.wnd:StaticTextScore%d", pos); stats.surrenders[ptIdx] += TheGameInfo->haveWeSurrendered() || !TheVictoryConditions->getEndFrame(); AsciiString systemSpec; - systemSpec.format("LOD%d", TheGameLODManager->findStaticLODLevel()); + systemSpec.format("LOD%d", TheGameLODManager->getRecommendedStaticLODLevel()); stats.systemSpec = systemSpec.str(); stats.techCaptured[ptIdx] += s->getTotalTechBuildingsCaptured(); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 0a9acb08a11..517eb95a90c 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -791,7 +791,9 @@ void W3DDisplay::init( void ) //Check if level was never set and default to setting most suitable for system. if (TheGameLODManager->getStaticLODLevel() == STATIC_GAME_LOD_UNKNOWN) - TheGameLODManager->setStaticLODLevel(TheGameLODManager->findStaticLODLevel()); + { + TheGameLODManager->setStaticLODLevel(TheGameLODManager->getRecommendedStaticLODLevel()); + } else { //Static LOD level was applied during GameLOD manager init except for texture reduction //which needs to be applied here. From 42bc6b08ff32c418baefc9bd1b07098d6fce5784 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 11 Oct 2025 22:14:22 +0200 Subject: [PATCH 161/343] feat(gamelod): Implement 'Very High' system spec (#1629) --- Core/GameEngine/Include/Common/GameDefines.h | 5 +++ .../Code/GameEngine/Include/Common/GameLOD.h | 11 ++++-- .../Code/GameEngine/Source/Common/GameLOD.cpp | 35 ++++++++++++++++-- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 8 ++++- .../W3DDevice/GameClient/W3DShaderManager.cpp | 2 +- .../Code/GameEngine/Include/Common/GameLOD.h | 11 ++++-- .../Code/GameEngine/Source/Common/GameLOD.cpp | 36 +++++++++++++++++-- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 8 ++++- .../Source/GameLogic/System/GameLogic.cpp | 2 +- .../W3DDevice/GameClient/W3DShaderManager.cpp | 2 +- 10 files changed, 107 insertions(+), 13 deletions(-) diff --git a/Core/GameEngine/Include/Common/GameDefines.h b/Core/GameEngine/Include/Common/GameDefines.h index a25a044b8e5..02229cfc8e5 100644 --- a/Core/GameEngine/Include/Common/GameDefines.h +++ b/Core/GameEngine/Include/Common/GameDefines.h @@ -81,6 +81,11 @@ #endif #endif +// Overwrite window settings until wnd data files are adapted or fixed. +#ifndef ENABLE_GUI_HACKS +#define ENABLE_GUI_HACKS (1) +#endif + #define MIN_DISPLAY_BIT_DEPTH 16 #define DEFAULT_DISPLAY_BIT_DEPTH 32 #define DEFAULT_DISPLAY_WIDTH 800 // The standard resolution this game was designed for diff --git a/Generals/Code/GameEngine/Include/Common/GameLOD.h b/Generals/Code/GameEngine/Include/Common/GameLOD.h index d19246a18b2..7ed420b22bc 100644 --- a/Generals/Code/GameEngine/Include/Common/GameLOD.h +++ b/Generals/Code/GameEngine/Include/Common/GameLOD.h @@ -38,18 +38,24 @@ enum ParticlePriorityType CPP_11(: Int); -#define MAX_LOD_PRESETS_PER_LEVEL 32 //number of hardware configs preset for each low,medium,high +#define MAX_LOD_PRESETS_PER_LEVEL 32 //number of hardware configs preset for each low,medium,high,veryhigh #define MAX_BENCH_PROFILES 16 //Make sure this enum stays in sync with GameLODNames[] enum StaticGameLODLevel CPP_11(: Int) { STATIC_GAME_LOD_UNKNOWN=-1, + STATIC_GAME_LOD_LOW, STATIC_GAME_LOD_MEDIUM, STATIC_GAME_LOD_HIGH, + STATIC_GAME_LOD_VERY_HIGH, + STATIC_GAME_LOD_CUSTOM, //make sure this remains last! - STATIC_GAME_LOD_COUNT + + STATIC_GAME_LOD_COUNT, + STATIC_GAME_LOD_FIRST = 0, + STATIC_GAME_LOD_LAST = STATIC_GAME_LOD_CUSTOM - 1, }; enum DynamicGameLODLevel CPP_11(: Int) @@ -193,6 +199,7 @@ class GameLODManager BenchProfile m_benchProfiles[MAX_BENCH_PROFILES]; protected: + void initStaticLODLevels(); void applyStaticLODLevel(StaticGameLODLevel level); void applyDynamicLODLevel(DynamicGameLODLevel level); void refreshCustomStaticLODLevel(void); ///m_intBenchIndex >= PROFILE_ERROR_LIMIT && m_floatBenchIndex/prof->m_floatBenchIndex >= PROFILE_ERROR_LIMIT && m_memBenchIndex/prof->m_memBenchIndex >= PROFILE_ERROR_LIMIT) { - for (Int i=STATIC_GAME_LOD_HIGH; i >= STATIC_GAME_LOD_LOW; i--) + for (Int i=STATIC_GAME_LOD_LAST; i >= STATIC_GAME_LOD_FIRST; i--) { LODPresetInfo *preset=&m_lodPresets[i][0]; //pointer to first preset at this LOD level. for (Int j=0; j= STATIC_GAME_LOD_LOW; i--) + for (Int i=STATIC_GAME_LOD_LAST; i >= STATIC_GAME_LOD_FIRST; i--) { LODPresetInfo *preset=&m_lodPresets[i][0]; //pointer to first preset at this LOD level. for (Int j=0; jfetch("GUI:Low"), color); GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:Medium"), color); GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:High"), color); + GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->FETCH_OR_SUBSTITUTE("GUI:VeryHigh", L"Very High"), color); GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:Custom"), color); - static_assert(STATIC_GAME_LOD_COUNT == 4, "Wrong combo box count"); + static_assert(STATIC_GAME_LOD_COUNT == 5, "Wrong combo box count"); //Check if level was never set and default to setting most suitable for system. if (TheGameLODManager->getStaticLODLevel() == STATIC_GAME_LOD_UNKNOWN) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp index 8c096a88b1d..2fedaa86ea0 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp @@ -2855,7 +2855,7 @@ StaticGameLODLevel W3DShaderManager::getGPUPerformanceIndex(void) if (chipType >= DC_GEFORCE2) detailSetting=STATIC_GAME_LOD_LOW; //these cards need multiple terrain passes. if (chipType >= DC_GENERIC_PIXEL_SHADER_1_1) //these cards can do terrain in single pass. - detailSetting=STATIC_GAME_LOD_HIGH; + detailSetting=STATIC_GAME_LOD_VERY_HIGH; } return detailSetting; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h b/GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h index cccbee03113..e4d90fd4d4f 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h @@ -38,18 +38,24 @@ enum ParticlePriorityType CPP_11(: Int); -#define MAX_LOD_PRESETS_PER_LEVEL 32 //number of hardware configs preset for each low,medium,high +#define MAX_LOD_PRESETS_PER_LEVEL 32 //number of hardware configs preset for each low,medium,high,veryhigh #define MAX_BENCH_PROFILES 16 //Make sure this enum stays in sync with GameLODNames[] enum StaticGameLODLevel CPP_11(: Int) { STATIC_GAME_LOD_UNKNOWN=-1, + STATIC_GAME_LOD_LOW, STATIC_GAME_LOD_MEDIUM, STATIC_GAME_LOD_HIGH, + STATIC_GAME_LOD_VERY_HIGH, + STATIC_GAME_LOD_CUSTOM, //make sure this remains last! - STATIC_GAME_LOD_COUNT + + STATIC_GAME_LOD_COUNT, + STATIC_GAME_LOD_FIRST = 0, + STATIC_GAME_LOD_LAST = STATIC_GAME_LOD_CUSTOM - 1, }; enum DynamicGameLODLevel CPP_11(: Int) @@ -194,6 +200,7 @@ class GameLODManager BenchProfile m_benchProfiles[MAX_BENCH_PROFILES]; protected: + void initStaticLODLevels(); void applyStaticLODLevel(StaticGameLODLevel level); void applyDynamicLODLevel(DynamicGameLODLevel level); void refreshCustomStaticLODLevel(void); ///m_intBenchIndex >= PROFILE_ERROR_LIMIT && m_floatBenchIndex/prof->m_floatBenchIndex >= PROFILE_ERROR_LIMIT && m_memBenchIndex/prof->m_memBenchIndex >= PROFILE_ERROR_LIMIT) { - for (Int i=STATIC_GAME_LOD_HIGH; i >= STATIC_GAME_LOD_LOW; i--) + for (Int i=STATIC_GAME_LOD_LAST; i >= STATIC_GAME_LOD_FIRST; i--) { LODPresetInfo *preset=&m_lodPresets[i][0]; //pointer to first preset at this LOD level. for (Int j=0; j= STATIC_GAME_LOD_LOW; i--) + for (Int i=STATIC_GAME_LOD_LAST; i >= STATIC_GAME_LOD_FIRST; i--) { LODPresetInfo *preset=&m_lodPresets[i][0]; //pointer to first preset at this LOD level. for (Int j=0; jfetch("GUI:Low"), color); GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:Medium"), color); GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:High"), color); + GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->FETCH_OR_SUBSTITUTE("GUI:VeryHigh", L"Very High"), color); GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:Custom"), color); - static_assert(STATIC_GAME_LOD_COUNT == 4, "Wrong combo box count"); + static_assert(STATIC_GAME_LOD_COUNT == 5, "Wrong combo box count"); //Check if level was never set and default to setting most suitable for system. if (TheGameLODManager->getStaticLODLevel() == STATIC_GAME_LOD_UNKNOWN) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 7cdcc3eabb4..d7f82871e4a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -1813,7 +1813,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) // If forceFluffToProp == true, removable objects get created on client only. [7/14/2003] // If static lod is HIGH, we don't do force fluff to client side only (create logic side props, more expensive. jba) - Bool forceFluffToProp = TheGameLODManager->getStaticLODLevel() != STATIC_GAME_LOD_HIGH; + Bool forceFluffToProp = TheGameLODManager->getStaticLODLevel() < STATIC_GAME_LOD_HIGH; if (TheGameLODManager->getStaticLODLevel() == STATIC_GAME_LOD_CUSTOM && TheGlobalData->m_useShadowVolumes) { // Custom LOD, and volumetric shadows turned on - very high detail. So use logic props too. jba. [7/14/2003] diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp index 08fcd60a6f7..5811dccd33f 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp @@ -3125,7 +3125,7 @@ StaticGameLODLevel W3DShaderManager::getGPUPerformanceIndex(void) if (chipType >= DC_GEFORCE2) detailSetting=STATIC_GAME_LOD_LOW; //these cards need multiple terrain passes. if (chipType >= DC_GENERIC_PIXEL_SHADER_1_1) //these cards can do terrain in single pass. - detailSetting=STATIC_GAME_LOD_HIGH; + detailSetting=STATIC_GAME_LOD_VERY_HIGH; } return detailSetting; From 5155aeafec55bb6800fb430c47eb08821b8ebee4 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 12 Oct 2025 10:26:10 +0200 Subject: [PATCH 162/343] bugfix(gamelod): Disable the recommended static lod level for texture reduction to prevent low texture resolution with 'Medium' and 'High' specs (#1630) --- .../Code/GameEngine/Include/Common/GameLOD.h | 1 + .../Code/GameEngine/Source/Common/GameLOD.cpp | 53 ++++++++++++++----- .../Code/GameEngine/Include/Common/GameLOD.h | 1 + .../Code/GameEngine/Source/Common/GameLOD.cpp | 53 ++++++++++++++----- 4 files changed, 82 insertions(+), 26 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/GameLOD.h b/Generals/Code/GameEngine/Include/Common/GameLOD.h index 7ed420b22bc..61d13e3d7ee 100644 --- a/Generals/Code/GameEngine/Include/Common/GameLOD.h +++ b/Generals/Code/GameEngine/Include/Common/GameLOD.h @@ -203,6 +203,7 @@ class GameLODManager void applyStaticLODLevel(StaticGameLODLevel level); void applyDynamicLODLevel(DynamicGameLODLevel level); void refreshCustomStaticLODLevel(void); ///m_textureReduction; + { + requestedTextureReduction = lodInfo->m_textureReduction; requestedTrees = lodInfo->m_useTrees; } else - if (level >= STATIC_GAME_LOD_LOW) - { //normal non-custom level gets texture reduction based on recommendation - requestedTextureReduction = getRecommendedTextureReduction(); + { + //normal non-custom level gets texture reduction based on recommendation + StaticGameLODLevel textureLevel = getRecommendedTextureLODLevel(); + if (textureLevel == STATIC_GAME_LOD_UNKNOWN) + textureLevel = level; + requestedTextureReduction = getLevelTextureReduction(textureLevel); + + //only use trees if memory requirement passed. + requestedTrees = m_memPassed; } if (TheGlobalData) @@ -717,16 +724,36 @@ void GameLODManager::applyDynamicLODLevel(DynamicGameLODLevel level) Int GameLODManager::getRecommendedTextureReduction(void) { - if (m_idealDetailLevel == STATIC_GAME_LOD_UNKNOWN) - getRecommendedStaticLODLevel(); //it was never tested, so test now. + StaticGameLODLevel level = getRecommendedTextureLODLevel(); + + if (level == STATIC_GAME_LOD_UNKNOWN) + { + level = getStaticLODLevel(); + } + return getLevelTextureReduction(level); +} - if (!m_memPassed) //if they have < 256 MB, force them to low res textures. - return getLevelTextureReduction(STATIC_GAME_LOD_LOW); +StaticGameLODLevel GameLODManager::getRecommendedTextureLODLevel() +{ + // TheSuperHackers @bugfix xezon 24/09/2025 Disables the recommended static LOD level for texture reduction + // because the benchmark code always generates a low level for it. Can revisit if the benchmarking is changed. + constexpr const Bool UseRecommendedStaticLODLevel = FALSE; - if (m_idealDetailLevel < 0 || m_idealDetailLevel >= STATIC_GAME_LOD_COUNT) - return getLevelTextureReduction(STATIC_GAME_LOD_LOW); + StaticGameLODLevel level = STATIC_GAME_LOD_LOW; - return getLevelTextureReduction(m_idealDetailLevel); + // Force low res textures if user has less than 256 MB. + if (m_memPassed) + { + if constexpr (UseRecommendedStaticLODLevel) + { + level = getRecommendedStaticLODLevel(); + } + else + { + level = STATIC_GAME_LOD_UNKNOWN; + } + } + return level; } Int GameLODManager::getLevelTextureReduction(StaticGameLODLevel level) diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h b/GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h index e4d90fd4d4f..e9ddaa78dd4 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h @@ -204,6 +204,7 @@ class GameLODManager void applyStaticLODLevel(StaticGameLODLevel level); void applyDynamicLODLevel(DynamicGameLODLevel level); void refreshCustomStaticLODLevel(void); ///m_textureReduction; + { + requestedTextureReduction = lodInfo->m_textureReduction; requestedTrees = lodInfo->m_useTrees; } else - if (level >= STATIC_GAME_LOD_LOW) - { //normal non-custom level gets texture reduction based on recommendation - requestedTextureReduction = getRecommendedTextureReduction(); + { + //normal non-custom level gets texture reduction based on recommendation + StaticGameLODLevel textureLevel = getRecommendedTextureLODLevel(); + if (textureLevel == STATIC_GAME_LOD_UNKNOWN) + textureLevel = level; + requestedTextureReduction = getLevelTextureReduction(textureLevel); + + //only use trees if memory requirement passed. + requestedTrees = m_memPassed; } if (TheGlobalData) @@ -723,16 +730,36 @@ void GameLODManager::applyDynamicLODLevel(DynamicGameLODLevel level) Int GameLODManager::getRecommendedTextureReduction(void) { - if (m_idealDetailLevel == STATIC_GAME_LOD_UNKNOWN) - getRecommendedStaticLODLevel(); //it was never tested, so test now. + StaticGameLODLevel level = getRecommendedTextureLODLevel(); + + if (level == STATIC_GAME_LOD_UNKNOWN) + { + level = getStaticLODLevel(); + } + return getLevelTextureReduction(level); +} - if (!m_memPassed) //if they have < 256 MB, force them to low res textures. - return getLevelTextureReduction(STATIC_GAME_LOD_LOW); +StaticGameLODLevel GameLODManager::getRecommendedTextureLODLevel() +{ + // TheSuperHackers @bugfix xezon 24/09/2025 Disables the recommended static LOD level for texture reduction + // because the benchmark code always generates a low level for it. Can revisit if the benchmarking is changed. + constexpr const Bool UseRecommendedStaticLODLevel = FALSE; - if (m_idealDetailLevel < 0 || m_idealDetailLevel >= STATIC_GAME_LOD_COUNT) - return getLevelTextureReduction(STATIC_GAME_LOD_LOW); + StaticGameLODLevel level = STATIC_GAME_LOD_LOW; - return getLevelTextureReduction(m_idealDetailLevel); + // Force low res textures if user has less than 256 MB. + if (m_memPassed) + { + if constexpr (UseRecommendedStaticLODLevel) + { + level = getRecommendedStaticLODLevel(); + } + else + { + level = STATIC_GAME_LOD_UNKNOWN; + } + } + return level; } Int GameLODManager::getLevelTextureReduction(StaticGameLODLevel level) From ebe28dcc16f4bf9f86654297d665c1b89614667d Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 12 Oct 2025 11:06:03 +0200 Subject: [PATCH 163/343] refactor(gamelod): Simplify texture reduction code (#1631) --- .../Code/GameEngine/Include/Common/GameLOD.h | 3 -- .../Include/GameClient/GameClient.h | 3 +- .../Code/GameEngine/Source/Common/GameLOD.cpp | 12 +++----- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 17 +++++------ .../GameClient/MessageStream/CommandXlat.cpp | 7 +++-- .../W3DDevice/GameClient/W3DGameClient.h | 2 +- .../W3DDevice/GameClient/TerrainTex.cpp | 4 +-- .../W3DDevice/GameClient/W3DDisplay.cpp | 10 ++----- .../W3DDevice/GameClient/W3DGameClient.cpp | 29 +++++-------------- .../Code/GameEngine/Include/Common/GameLOD.h | 3 -- .../Include/GameClient/GameClient.h | 3 +- .../Code/GameEngine/Source/Common/GameLOD.cpp | 12 +++----- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 17 +++++------ .../GameClient/MessageStream/CommandXlat.cpp | 8 +++-- .../W3DDevice/GameClient/W3DGameClient.h | 2 +- .../W3DDevice/GameClient/TerrainTex.cpp | 4 +-- .../W3DDevice/GameClient/W3DDisplay.cpp | 10 ++----- .../W3DDevice/GameClient/W3DGameClient.cpp | 21 ++++---------- .../W3DDevice/GameClient/W3DTreeBuffer.cpp | 4 +-- .../W3DDevice/GameClient/WorldHeightMap.cpp | 4 +-- 20 files changed, 65 insertions(+), 110 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/GameLOD.h b/Generals/Code/GameEngine/Include/Common/GameLOD.h index 61d13e3d7ee..520dc648e2c 100644 --- a/Generals/Code/GameEngine/Include/Common/GameLOD.h +++ b/Generals/Code/GameEngine/Include/Common/GameLOD.h @@ -176,8 +176,6 @@ class GameLODManager Bool setDynamicLODLevel(DynamicGameLODLevel level); ///< set the current dynamic LOD level. DynamicGameLODLevel getDynamicLODLevel(void) { return m_currentDynamicLOD;} void init(void); ///m_useShadowVolumes=lodInfo->m_useShadowVolumes; TheWritableGlobalData->m_useShadowDecals=lodInfo->m_useShadowDecals; - //Check if texture resolution changed. No need to apply when current is unknown because display will do it - if (requestedTextureReduction != m_currentTextureReduction) - { - TheWritableGlobalData->m_textureReductionFactor = requestedTextureReduction; - if (TheGameClient) - TheGameClient->adjustLOD(0); //apply the new setting stored in globaldata - } + TheWritableGlobalData->m_textureReductionFactor = requestedTextureReduction; //Check if shadow state changed if (m_currentStaticLOD == STATIC_GAME_LOD_UNKNOWN || @@ -623,9 +616,12 @@ void GameLODManager::applyStaticLODLevel(StaticGameLODLevel level) TheWritableGlobalData->m_shellMapOn = false; } } + if (TheTerrainVisual) TheTerrainVisual->setTerrainTracksDetail(); + if (TheGameClient) + TheGameClient->setTextureLOD(requestedTextureReduction); } /**Parse a description of all the LOD settings for a given detail level*/ diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index 1f6d2f8bf59..94395c0055e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -75,6 +75,8 @@ //used to access a messagebox that does "ok" and "cancel" #include "GameClient/MessageBox.h" +#include "ww3d.h" + // This is for non-RC builds only!!! #define VERBOSE_VERSION L"Release" @@ -1112,18 +1114,14 @@ static void saveOptions( void ) //------------------------------------------------------------------------------------------------- // Texture resolution slider { - AsciiString prefString; - - val = GadgetSliderGetPosition(sliderTextureResolution); - val = 2-val; + val = 2 - GadgetSliderGetPosition(sliderTextureResolution); + AsciiString prefString; prefString.format("%d",val); (*pref)["TextureReduction"] = prefString; - if (TheGlobalData->m_textureReductionFactor != val) - { - TheGameClient->adjustLOD(val-TheGlobalData->m_textureReductionFactor); //apply the new setting - } + TheWritableGlobalData->m_textureReductionFactor = val; + TheGameClient->setTextureLOD(val); } TheWritableGlobalData->m_useShadowVolumes = GadgetCheckBoxIsChecked( check3DShadows ); @@ -1855,10 +1853,9 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) TheGameLODManager->setStaticLODLevel(TheGameLODManager->getRecommendedStaticLODLevel()); } - Int txtFact=TheGameLODManager->getCurrentTextureReduction(); GadgetComboBoxSetSelectedPos(comboBoxDetail, (Int)TheGameLODManager->getStaticLODLevel()); - GadgetSliderSetPosition( sliderTextureResolution, 2-txtFact); + GadgetSliderSetPosition( sliderTextureResolution, 2-WW3D::Get_Texture_Reduction()); GadgetCheckBoxSetChecked( check3DShadows, TheGlobalData->m_useShadowVolumes); diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index fd5f717b720..37241be0b2b 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -88,6 +88,7 @@ #include "GameNetwork/GameSpyOverlay.h" #include "GameNetwork/GameSpy/BuddyThread.h" +#include "ww3d.h" #if defined(RTS_DEBUG) @@ -3785,7 +3786,8 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage //----------------------------------------------------------------------------------------- case GameMessage::MSG_META_DEMO_LOD_DECREASE: { - TheGameClient->adjustLOD(-1); + const Int level = clamp(0, WW3D::Get_Texture_Reduction() - 1, 4); + TheGameClient->setTextureLOD(level); TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:DebugDecreaseLOD", L"Decrease LOD") ); disp = DESTROY_MESSAGE; break; @@ -3795,7 +3797,8 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage //----------------------------------------------------------------------------------------- case GameMessage::MSG_META_DEMO_LOD_INCREASE: { - TheGameClient->adjustLOD(1); + const Int level = clamp(0, WW3D::Get_Texture_Reduction() + 1, 4); + TheGameClient->setTextureLOD(level); TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:DebugIncreaseLOD", L"Increase LOD") ); disp = DESTROY_MESSAGE; break; diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h index f7bdb9e4a29..848dbd71981 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h @@ -88,7 +88,7 @@ class W3DGameClient : public GameClient //--------------------------------------------------------------------------- virtual void setTeamColor( Int red, Int green, Int blue ); ///< @todo superhack for demo, remove!!! - virtual void adjustLOD( Int adj ); ///< @todo hack for evaluation, remove. + virtual void setTextureLOD( Int level ); protected: diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/TerrainTex.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/TerrainTex.cpp index 76de020a9ef..91c0d47eeaa 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/TerrainTex.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/TerrainTex.cpp @@ -187,8 +187,8 @@ int TerrainTextureClass::update(WorldHeightMap *htMap) surface_level->UnlockRect(); surface_level->Release(); DX8_ErrorCode(D3DXFilterTexture(Peek_D3D_Texture(), NULL, 0, D3DX_FILTER_BOX)); - if (TheWritableGlobalData->m_textureReductionFactor) { - Peek_D3D_Texture()->SetLOD(TheWritableGlobalData->m_textureReductionFactor); + if (WW3D::Get_Texture_Reduction()) { + Peek_D3D_Texture()->SetLOD(WW3D::Get_Texture_Reduction()); } return(surface_desc.Height); } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 1c64f1e530d..e6209f3ef55 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -745,14 +745,10 @@ void W3DDisplay::init( void ) TheGameLODManager->setStaticLODLevel(TheGameLODManager->getRecommendedStaticLODLevel()); } else - { //Static LOD level was applied during GameLOD manager init except for texture reduction + { + //Static LOD level was applied during GameLOD manager init except for texture reduction //which needs to be applied here. - Int txtReduction=TheWritableGlobalData->m_textureReductionFactor; - if (txtReduction > 0) - { WW3D::Set_Texture_Reduction(txtReduction,6); - //Tell LOD manager that texture reduction was applied. - TheGameLODManager->setCurrentTextureReduction(txtReduction); - } + TheGameClient->setTextureLOD(TheWritableGlobalData->m_textureReductionFactor); } if (TheGlobalData->m_displayGamma != 1.0f) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp index c8ca17e7ede..11f6372e141 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp @@ -196,29 +196,16 @@ void W3DGameClient::setTeamColor(Int red, Int green, Int blue) } //------------------------------------------------------------------------------------------------- -/** temporary entry point for adjusting LOD for development testing. */ //------------------------------------------------------------------------------------------------- -void W3DGameClient::adjustLOD( Int adj ) +void W3DGameClient::setTextureLOD( Int level ) { - if (TheGlobalData == NULL) - return; - - TheWritableGlobalData->m_textureReductionFactor += adj; - - if (TheWritableGlobalData->m_textureReductionFactor > 4) - TheWritableGlobalData->m_textureReductionFactor = 4; //16x less resolution is probably enough. - if (TheWritableGlobalData->m_textureReductionFactor < 0) - TheWritableGlobalData->m_textureReductionFactor = 0; + if (WW3D::Get_Texture_Reduction() != level) + { + WW3D::Set_Texture_Reduction(level, 6); - if (WW3D::Get_Texture_Reduction() != TheWritableGlobalData->m_textureReductionFactor) - { WW3D::Set_Texture_Reduction(TheWritableGlobalData->m_textureReductionFactor,6); - TheGameLODManager->setCurrentTextureReduction(TheWritableGlobalData->m_textureReductionFactor); + //I commented this out because we're no longer using terrain LOD. So I + //stole this function and keys to adjust the texture resolution instead. -MW + //if( TheTerrainRenderObject ) + // TheTerrainRenderObject->setTextureLOD(level); } - -//I commented this out because we're no longer using terrain LOD. So I -//stole this function and keys to adjust the texture resolution instead. -MW - -// if( TheTerrainRenderObject ) -// TheTerrainRenderObject->adjustTerrainLOD( adj ); - } diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h b/GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h index e9ddaa78dd4..7b3b206f3e7 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h @@ -177,8 +177,6 @@ class GameLODManager Bool setDynamicLODLevel(DynamicGameLODLevel level); ///< set the current dynamic LOD level. DynamicGameLODLevel getDynamicLODLevel(void) { return m_currentDynamicLOD;} void init(void); ///m_useShadowVolumes=lodInfo->m_useShadowVolumes; TheWritableGlobalData->m_useShadowDecals=lodInfo->m_useShadowDecals; - //Check if texture resolution changed. No need to apply when current is unknown because display will do it - if (requestedTextureReduction != m_currentTextureReduction) - { - TheWritableGlobalData->m_textureReductionFactor = requestedTextureReduction; - if (TheGameClient) - TheGameClient->adjustLOD(0); //apply the new setting stored in globaldata - } + TheWritableGlobalData->m_textureReductionFactor = requestedTextureReduction; //Check if shadow state changed if (m_currentStaticLOD == STATIC_GAME_LOD_UNKNOWN || @@ -629,9 +622,12 @@ void GameLODManager::applyStaticLODLevel(StaticGameLODLevel level) TheWritableGlobalData->m_shellMapOn = false; } } + if (TheTerrainVisual) TheTerrainVisual->setTerrainTracksDetail(); + if (TheGameClient) + TheGameClient->setTextureLOD(requestedTextureReduction); } /**Parse a description of all the LOD settings for a given detail level*/ diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index ab379e892d1..ae99c6735dd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -75,6 +75,8 @@ //used to access a messagebox that does "ok" and "cancel" #include "GameClient/MessageBox.h" +#include "ww3d.h" + // This is for non-RC builds only!!! #define VERBOSE_VERSION L"Release" @@ -1163,18 +1165,14 @@ static void saveOptions( void ) //------------------------------------------------------------------------------------------------- // Texture resolution slider { - AsciiString prefString; - - val = GadgetSliderGetPosition(sliderTextureResolution); - val = 2-val; + val = 2 - GadgetSliderGetPosition(sliderTextureResolution); + AsciiString prefString; prefString.format("%d",val); (*pref)["TextureReduction"] = prefString; - if (TheGlobalData->m_textureReductionFactor != val) - { - TheGameClient->adjustLOD(val-TheGlobalData->m_textureReductionFactor); //apply the new setting - } + TheWritableGlobalData->m_textureReductionFactor = val; + TheGameClient->setTextureLOD(val); } TheWritableGlobalData->m_useShadowVolumes = GadgetCheckBoxIsChecked( check3DShadows ); @@ -1922,10 +1920,9 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) TheGameLODManager->setStaticLODLevel(TheGameLODManager->getRecommendedStaticLODLevel()); } - Int txtFact=TheGameLODManager->getCurrentTextureReduction(); GadgetComboBoxSetSelectedPos(comboBoxDetail, (Int)TheGameLODManager->getStaticLODLevel()); - GadgetSliderSetPosition( sliderTextureResolution, 2-txtFact); + GadgetSliderSetPosition( sliderTextureResolution, 2-WW3D::Get_Texture_Reduction()); GadgetCheckBoxSetChecked( check3DShadows, TheGlobalData->m_useShadowVolumes); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index a6f96ca201c..7dd70033b94 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -88,7 +88,7 @@ #include "GameNetwork/GameSpyOverlay.h" #include "GameNetwork/GameSpy/BuddyThread.h" - +#include "ww3d.h" #define dont_ALLOW_ALT_F4 @@ -4179,7 +4179,8 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage //----------------------------------------------------------------------------------------- case GameMessage::MSG_META_DEMO_LOD_DECREASE: { - TheGameClient->adjustLOD(-1); + const Int level = clamp(0, WW3D::Get_Texture_Reduction() - 1, 4); + TheGameClient->setTextureLOD(level); TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:DebugDecreaseLOD", L"Decrease LOD") ); disp = DESTROY_MESSAGE; break; @@ -4189,7 +4190,8 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage //----------------------------------------------------------------------------------------- case GameMessage::MSG_META_DEMO_LOD_INCREASE: { - TheGameClient->adjustLOD(1); + const Int level = clamp(0, WW3D::Get_Texture_Reduction() + 1, 4); + TheGameClient->setTextureLOD(level); TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:DebugIncreaseLOD", L"Increase LOD") ); disp = DESTROY_MESSAGE; break; diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h index 83d24ddb956..545ca438509 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h @@ -92,7 +92,7 @@ class W3DGameClient : public GameClient //--------------------------------------------------------------------------- virtual void setTeamColor( Int red, Int green, Int blue ); ///< @todo superhack for demo, remove!!! - virtual void adjustLOD( Int adj ); ///< @todo hack for evaluation, remove. + virtual void setTextureLOD( Int level ); virtual void notifyTerrainObjectMoved(Object *obj); protected: diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/TerrainTex.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/TerrainTex.cpp index 61b9492190e..7702b77b66e 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/TerrainTex.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/TerrainTex.cpp @@ -195,8 +195,8 @@ int TerrainTextureClass::update(WorldHeightMap *htMap) surface_level->UnlockRect(); surface_level->Release(); DX8_ErrorCode(D3DXFilterTexture(Peek_D3D_Texture(), NULL, 0, D3DX_FILTER_BOX)); - if (TheWritableGlobalData->m_textureReductionFactor) { - Peek_D3D_Texture()->SetLOD(TheWritableGlobalData->m_textureReductionFactor); + if (WW3D::Get_Texture_Reduction()) { + Peek_D3D_Texture()->SetLOD(WW3D::Get_Texture_Reduction()); } return(surface_desc.Height); } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 517eb95a90c..b2949a68cab 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -795,14 +795,10 @@ void W3DDisplay::init( void ) TheGameLODManager->setStaticLODLevel(TheGameLODManager->getRecommendedStaticLODLevel()); } else - { //Static LOD level was applied during GameLOD manager init except for texture reduction + { + //Static LOD level was applied during GameLOD manager init except for texture reduction //which needs to be applied here. - Int txtReduction=TheWritableGlobalData->m_textureReductionFactor; - if (txtReduction > 0) - { WW3D::Set_Texture_Reduction(txtReduction,32); - //Tell LOD manager that texture reduction was applied. - TheGameLODManager->setCurrentTextureReduction(txtReduction); - } + TheGameClient->setTextureLOD(TheWritableGlobalData->m_textureReductionFactor); } if (TheGlobalData->m_displayGamma != 1.0f) diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp index 2852b2031c9..4f5dbd6dd62 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp @@ -196,27 +196,16 @@ void W3DGameClient::setTeamColor(Int red, Int green, Int blue) } //------------------------------------------------------------------------------------------------- -/** temporary entry point for adjusting LOD for development testing. */ //------------------------------------------------------------------------------------------------- -void W3DGameClient::adjustLOD( Int adj ) +void W3DGameClient::setTextureLOD( Int level ) { - if (TheGlobalData == NULL) - return; - - TheWritableGlobalData->m_textureReductionFactor += adj; - - if (TheWritableGlobalData->m_textureReductionFactor > 4) - TheWritableGlobalData->m_textureReductionFactor = 4; //16x less resolution is probably enough. - if (TheWritableGlobalData->m_textureReductionFactor < 0) - TheWritableGlobalData->m_textureReductionFactor = 0; + if (WW3D::Get_Texture_Reduction() != level) + { + WW3D::Set_Texture_Reduction(level, 32); - if (WW3D::Get_Texture_Reduction() != TheWritableGlobalData->m_textureReductionFactor) - { WW3D::Set_Texture_Reduction(TheWritableGlobalData->m_textureReductionFactor,32); - TheGameLODManager->setCurrentTextureReduction(TheWritableGlobalData->m_textureReductionFactor); if( TheTerrainRenderObject ) - TheTerrainRenderObject->setTextureLOD( TheWritableGlobalData->m_textureReductionFactor ); + TheTerrainRenderObject->setTextureLOD(level); } - } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp index 087e9dfaa0a..0d45c27ef4f 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp @@ -189,8 +189,8 @@ int W3DTreeBuffer::W3DTreeTextureClass::update(W3DTreeBuffer *buffer) DX8_ErrorCode(surface_level->UnlockRect()); surface_level->Release(); DX8_ErrorCode(D3DXFilterTexture(Peek_D3D_Texture(), NULL, (UINT)0, D3DX_FILTER_BOX)); - if (TheWritableGlobalData->m_textureReductionFactor) { - DX8_ErrorCode(Peek_D3D_Texture()->SetLOD((DWORD)TheWritableGlobalData->m_textureReductionFactor)); + if (WW3D::Get_Texture_Reduction()) { + DX8_ErrorCode(Peek_D3D_Texture()->SetLOD((DWORD)WW3D::Get_Texture_Reduction())); } return(surface_desc.Height); } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp index 53efa14dbb1..64a3ae4ce4d 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp @@ -2214,8 +2214,8 @@ TextureClass *WorldHeightMap::getEdgeTerrainTexture(void) TerrainTextureClass *WorldHeightMap::getFlatTexture(Int xCell, Int yCell, Int cellWidth, Int pixelsPerCell) { - if (TheWritableGlobalData->m_textureReductionFactor) { - if (TheWritableGlobalData->m_textureReductionFactor>1) { + if (WW3D::Get_Texture_Reduction()) { + if (WW3D::Get_Texture_Reduction()>1) { pixelsPerCell /= 4; } else { pixelsPerCell /= 2; From 403696c775dbd2311a2b514285b30923e3f74766 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 12 Oct 2025 11:26:48 +0200 Subject: [PATCH 164/343] tweak(gamelod): Disable changing display settings when clicking the Default button in Options Menu (#1632) --- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 16 +++++++++++----- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 16 +++++++++++----- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index 94395c0055e..66914476a5c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -922,6 +922,8 @@ static OptionPreferences *pref = NULL; static void setDefaults( void ) { + constexpr const Bool ModifyDisplaySettings = FALSE; + //------------------------------------------------------------------------------------------------- // provider type // GadgetCheckBoxSetChecked(checkAudioHardware, FALSE); @@ -938,6 +940,8 @@ static void setDefaults( void ) // send Delay GadgetCheckBoxSetChecked(checkSendDelay, FALSE); + if constexpr (ModifyDisplaySettings) + { //------------------------------------------------------------------------------------------------- // LOD if ((TheGameLogic->isInGame() == FALSE) || (TheGameLogic->isInShellGame() == TRUE)) @@ -961,7 +965,7 @@ static void setDefaults( void ) } GadgetComboBoxSetSelectedPos( comboBoxResolution, defaultResIndex ); //should be 800x600 (our lowest supported mode) } - + } //------------------------------------------------------------------------------------------------- // Mouse Mode @@ -996,12 +1000,13 @@ static void setDefaults( void ) GadgetSliderGetMinMax(sliderGamma,&valMin, &valMax); GadgetSliderSetPosition(sliderGamma, ((valMax - valMin) / 2 + valMin)); - //------------------------------------------------------------------------------------------------- - // Texture resolution slider - // - + if constexpr (ModifyDisplaySettings) + { if ((TheGameLogic->isInGame() == FALSE) || (TheGameLogic->isInShellGame() == TRUE)) { + //------------------------------------------------------------------------------------------------- + // Texture resolution slider + // Int txtFact=TheGameLODManager->getRecommendedTextureReduction(); GadgetSliderSetPosition( sliderTextureResolution, 2-txtFact); @@ -1061,6 +1066,7 @@ static void setDefaults( void ) // GadgetCheckBoxSetChecked( checkProps, TheGlobalData->m_useTrees); } + } } static void saveOptions( void ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index ae99c6735dd..627633d0fe9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -966,6 +966,8 @@ static OptionPreferences *pref = NULL; static void setDefaults( void ) { + constexpr const Bool ModifyDisplaySettings = FALSE; + //------------------------------------------------------------------------------------------------- // provider type // GadgetCheckBoxSetChecked(checkAudioHardware, FALSE); @@ -982,6 +984,8 @@ static void setDefaults( void ) // send Delay GadgetCheckBoxSetChecked(checkSendDelay, FALSE); + if constexpr (ModifyDisplaySettings) + { //------------------------------------------------------------------------------------------------- // LOD if ((TheGameLogic->isInGame() == FALSE) || (TheGameLogic->isInShellGame() == TRUE)) @@ -1005,7 +1009,7 @@ static void setDefaults( void ) } GadgetComboBoxSetSelectedPos( comboBoxResolution, defaultResIndex ); //should be 800x600 (our lowest supported mode) } - + } //------------------------------------------------------------------------------------------------- // Mouse Mode @@ -1042,12 +1046,13 @@ static void setDefaults( void ) GadgetSliderGetMinMax(sliderGamma,&valMin, &valMax); GadgetSliderSetPosition(sliderGamma, ((valMax - valMin) / 2 + valMin)); - //------------------------------------------------------------------------------------------------- - // Texture resolution slider - // - + if constexpr (ModifyDisplaySettings) + { if ((TheGameLogic->isInGame() == FALSE) || (TheGameLogic->isInShellGame() == TRUE)) { + //------------------------------------------------------------------------------------------------- + // Texture resolution slider + // Int txtFact=TheGameLODManager->getRecommendedTextureReduction(); GadgetSliderSetPosition( sliderTextureResolution, 2-txtFact); @@ -1112,6 +1117,7 @@ static void setDefaults( void ) // GadgetCheckBoxSetChecked( checkProps, TheGlobalData->m_useTrees); } + } } static void saveOptions( void ) From 6620cc31aa4e5c118d6cd962d6de7f55e28ab94a Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 14 Oct 2025 18:25:14 +0200 Subject: [PATCH 165/343] refactor(gameengine): Move game time related code into new FramePacer class (#1688) --- Core/GameEngine/CMakeLists.txt | 2 + Core/GameEngine/Include/Common/FramePacer.h | 73 +++++++ Core/GameEngine/Source/Common/FramePacer.cpp | 182 ++++++++++++++++++ .../GameEngine/Include/Common/GameEngine.h | 32 --- .../GameEngine/Source/Common/GameEngine.cpp | 168 ++-------------- .../GameEngine/Source/Common/GameMain.cpp | 4 + .../GameEngine/Source/GameClient/Drawable.cpp | 4 +- .../GUI/GUICallbacks/Menus/QuitMenu.cpp | 3 +- .../GameEngine/Source/GameClient/InGameUI.cpp | 7 +- .../GameClient/MessageStream/CommandXlat.cpp | 30 +-- .../GameClient/MessageStream/LookAtXlat.cpp | 4 +- .../GameLogic/ScriptEngine/ScriptActions.cpp | 6 +- .../GameLogic/ScriptEngine/ScriptEngine.cpp | 6 +- .../Source/GameLogic/System/GameLogic.cpp | 7 +- .../GameLogic/System/GameLogicDispatch.cpp | 3 +- .../W3DDevice/GameClient/W3DDisplay.cpp | 8 +- .../Source/W3DDevice/GameClient/W3DView.cpp | 8 +- .../W3DDevice/GameClient/Water/W3DWater.cpp | 4 +- .../GameClient/Water/W3DWaterTracks.cpp | 4 +- .../GameEngine/Include/Common/GameEngine.h | 32 --- .../GameEngine/Source/Common/GameEngine.cpp | 168 ++-------------- .../GameEngine/Source/Common/GameMain.cpp | 4 + .../GameEngine/Source/GameClient/Drawable.cpp | 4 +- .../GUI/GUICallbacks/Menus/QuitMenu.cpp | 3 +- .../GameEngine/Source/GameClient/InGameUI.cpp | 7 +- .../GameClient/MessageStream/CommandXlat.cpp | 30 +-- .../GameClient/MessageStream/LookAtXlat.cpp | 4 +- .../GameLogic/ScriptEngine/ScriptActions.cpp | 6 +- .../GameLogic/ScriptEngine/ScriptEngine.cpp | 6 +- .../Source/GameLogic/System/GameLogic.cpp | 7 +- .../GameLogic/System/GameLogicDispatch.cpp | 3 +- .../W3DDevice/GameClient/W3DDisplay.cpp | 8 +- .../Source/W3DDevice/GameClient/W3DView.cpp | 10 +- .../W3DDevice/GameClient/Water/W3DWater.cpp | 4 +- .../GameClient/Water/W3DWaterTracks.cpp | 4 +- 35 files changed, 390 insertions(+), 465 deletions(-) create mode 100644 Core/GameEngine/Include/Common/FramePacer.h create mode 100644 Core/GameEngine/Source/Common/FramePacer.cpp diff --git a/Core/GameEngine/CMakeLists.txt b/Core/GameEngine/CMakeLists.txt index 43460b8ecf8..0a58dfc4315 100644 --- a/Core/GameEngine/CMakeLists.txt +++ b/Core/GameEngine/CMakeLists.txt @@ -39,6 +39,7 @@ set(GAMEENGINE_SRC # Include/Common/Errors.h Include/Common/file.h Include/Common/FileSystem.h + Include/Common/FramePacer.h Include/Common/FrameRateLimit.h # Include/Common/FunctionLexicon.h Include/Common/GameAudio.h @@ -570,6 +571,7 @@ set(GAMEENGINE_SRC # Source/Common/DamageFX.cpp # Source/Common/Dict.cpp # Source/Common/DiscreteCircle.cpp + Source/Common/FramePacer.cpp Source/Common/FrameRateLimit.cpp # Source/Common/GameEngine.cpp # Source/Common/GameLOD.cpp diff --git a/Core/GameEngine/Include/Common/FramePacer.h b/Core/GameEngine/Include/Common/FramePacer.h new file mode 100644 index 00000000000..95c76527362 --- /dev/null +++ b/Core/GameEngine/Include/Common/FramePacer.h @@ -0,0 +1,73 @@ +/* +** Command & Conquer Generals Zero Hour(tm) +** Copyright 2025 Electronic Arts Inc. +** +** This program is free software: you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation, either version 3 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program. If not, see . +*/ +#pragma once + +#include "Common/FrameRateLimit.h" + + +class FramePacer +{ +public: + + typedef UnsignedInt LogicTimeQueryFlags; + enum LogicTimeQueryFlags_ CPP_11(: LogicTimeQueryFlags) + { + IgnoreFrozenTime = 1<<0, ///< Ignore frozen time for the query + IgnoreHaltedGame = 1<<1, ///< Ignore halted game for the query + }; + + FramePacer(); + ~FramePacer(); + + void update(); ///< Signal that the app/render update is done and wait for the fps limit if applicable. + + void setFramesPerSecondLimit( Int fps ); ///< Set the max update fps. + Int getFramesPerSecondLimit() const; ///< Get the max update fps. + Real getUpdateTime() const; ///< Get the last update delta time in seconds. + Real getUpdateFps() const; ///< Get the last update fps. + + void setTimeFrozen(Bool frozen); ///< Set time frozen. Allows scripted camera movement. + void setGameHalted(Bool halted); ///< Set game halted. Does not allow scripted camera movement. + Bool isTimeFrozen() const; + Bool isGameHalted() const; + + void setLogicTimeScaleFps( Int fps ); ///< Set the logic time scale fps and therefore scale the simulation time. Is capped by the max render fps and does not apply to network matches. + Int getLogicTimeScaleFps() const; ///< Get the raw logic time scale fps value. + void enableLogicTimeScale( Bool enable ); ///< Enable the logic time scale setup. If disabled, the simulation time scale is bound to the render frame time or network update time. + Bool isLogicTimeScaleEnabled() const; ///< Check whether the logic time scale setup is enabled. + Int getActualLogicTimeScaleFps(LogicTimeQueryFlags flags = 0) const; ///< Get the real logic time scale fps, depending on the max render fps, network state and enabled state. + Real getActualLogicTimeScaleRatio(LogicTimeQueryFlags flags = 0) const; ///< Get the real logic time scale ratio, depending on the max render fps, network state and enabled state. + Real getActualLogicTimeScaleOverFpsRatio(LogicTimeQueryFlags flags = 0) const; ///< Get the real logic time scale over render fps ratio, used to scale down steps in render updates to match logic updates. + Real getLogicTimeStepSeconds(LogicTimeQueryFlags flags = 0) const; ///< Get the logic time step in seconds + Real getLogicTimeStepMilliseconds(LogicTimeQueryFlags flags = 0) const; ///< Get the logic time step in milliseconds + +protected: + + FrameRateLimit m_frameRateLimit; + + Int m_maxFPS; ///< Maximum frames per second for rendering + Int m_logicTimeScaleFPS; ///< Maximum frames per second for logic time scale + + Real m_updateTime; ///< Last update delta time in seconds + + Bool m_enableLogicTimeScale; + Bool m_isTimeFrozen; + Bool m_isGameHalted; +}; + +extern FramePacer* TheFramePacer; diff --git a/Core/GameEngine/Source/Common/FramePacer.cpp b/Core/GameEngine/Source/Common/FramePacer.cpp new file mode 100644 index 00000000000..8bbc9e914f8 --- /dev/null +++ b/Core/GameEngine/Source/Common/FramePacer.cpp @@ -0,0 +1,182 @@ +/* +** Command & Conquer Generals Zero Hour(tm) +** Copyright 2025 Electronic Arts Inc. +** +** This program is free software: you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation, either version 3 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program. If not, see . +*/ +#include "PreRTS.h" + +#include "Common/FramePacer.h" + +#include "GameClient/View.h" + +#include "GameLogic/GameLogic.h" +#include "GameLogic/ScriptEngine.h" + +#include "GameNetwork/NetworkDefs.h" +#include "GameNetwork/NetworkInterface.h" + + +FramePacer* TheFramePacer = NULL; + +FramePacer::FramePacer() +{ + // Set the time slice size to 1 ms. + timeBeginPeriod(1); + + m_maxFPS = BaseFps; + m_logicTimeScaleFPS = LOGICFRAMES_PER_SECOND; + m_updateTime = 1.0f / BaseFps; // initialized to something to avoid division by zero on first use + m_enableLogicTimeScale = FALSE; + m_isTimeFrozen = FALSE; + m_isGameHalted = FALSE; +} + +FramePacer::~FramePacer() +{ + // Restore the previous time slice for Windows. + timeEndPeriod(1); +} + +void FramePacer::update() +{ + Bool allowFpsLimit = TheTacticalView->getTimeMultiplier()<=1 && !TheScriptEngine->isTimeFast(); + + // I'm disabling this in debug because many people need alt-tab capability. If you happen to be + // doing performance tuning, please just change this on your local system. -MDC +#if defined(RTS_DEBUG) + if (allowFpsLimit) + ::Sleep(1); // give everyone else a tiny time slice. +#endif + +#if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) + allowFpsLimit &= !(!TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode); +#else //always allow this cheat key if we're in a replay game. + allowFpsLimit &= !(!TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame()); +#endif + + // TheSuperHackers @bugfix xezon 05/08/2025 Re-implements the frame rate limiter + // with higher resolution counters to cap the frame rate more accurately to the desired limit. + allowFpsLimit &= TheGlobalData->m_useFpsLimit; + const UnsignedInt maxFps = allowFpsLimit ? getFramesPerSecondLimit() : RenderFpsPreset::UncappedFpsValue; + m_updateTime = m_frameRateLimit.wait(maxFps); +} + +void FramePacer::setFramesPerSecondLimit( Int fps ) +{ + DEBUG_LOG(("FramePacer::setFramesPerSecondLimit() - setting max fps to %d (TheGlobalData->m_useFpsLimit == %d)", fps, TheGlobalData->m_useFpsLimit)); + m_maxFPS = fps; +} + +Int FramePacer::getFramesPerSecondLimit() const +{ + return m_maxFPS; +} + +Real FramePacer::getUpdateTime() const +{ + return m_updateTime; +} + +Real FramePacer::getUpdateFps() const +{ + return 1.0f / m_updateTime; +} + +void FramePacer::setTimeFrozen(Bool frozen) +{ + m_isTimeFrozen = frozen; +} + +void FramePacer::setGameHalted(Bool halted) +{ + m_isGameHalted = halted; +} + +Bool FramePacer::isTimeFrozen() const +{ + return m_isTimeFrozen; +} + +Bool FramePacer::isGameHalted() const +{ + return m_isGameHalted; +} + +void FramePacer::setLogicTimeScaleFps( Int fps ) +{ + m_logicTimeScaleFPS = fps; +} + +Int FramePacer::getLogicTimeScaleFps() const +{ + return m_logicTimeScaleFPS; +} + +void FramePacer::enableLogicTimeScale( Bool enable ) +{ + m_enableLogicTimeScale = enable; +} + +Bool FramePacer::isLogicTimeScaleEnabled() const +{ + return m_enableLogicTimeScale; +} + +Int FramePacer::getActualLogicTimeScaleFps(LogicTimeQueryFlags flags) const +{ + if (m_isTimeFrozen && (flags & IgnoreFrozenTime) == 0) + { + return 0; + } + + if (m_isGameHalted && (flags & IgnoreHaltedGame) == 0) + { + return 0; + } + + if (TheNetwork != NULL) + { + return TheNetwork->getFrameRate(); + } + + if (isLogicTimeScaleEnabled()) + { + return min(getLogicTimeScaleFps(), getFramesPerSecondLimit()); + } + + return getFramesPerSecondLimit(); +} + +Real FramePacer::getActualLogicTimeScaleRatio(LogicTimeQueryFlags flags) const +{ + return (Real)getActualLogicTimeScaleFps(flags) / LOGICFRAMES_PER_SECONDS_REAL; +} + +Real FramePacer::getActualLogicTimeScaleOverFpsRatio(LogicTimeQueryFlags flags) const +{ + // TheSuperHackers @info Clamps ratio to min 1, because the logic + // frame rate is currently capped by the render frame rate. + return min(1.0f, (Real)getActualLogicTimeScaleFps(flags) / getUpdateFps()); +} + +Real FramePacer::getLogicTimeStepSeconds(LogicTimeQueryFlags flags) const +{ + return SECONDS_PER_LOGICFRAME_REAL * getActualLogicTimeScaleOverFpsRatio(flags); +} + +Real FramePacer::getLogicTimeStepMilliseconds(LogicTimeQueryFlags flags) const +{ + return MSEC_PER_LOGICFRAME_REAL * getActualLogicTimeScaleOverFpsRatio(flags); +} diff --git a/Generals/Code/GameEngine/Include/Common/GameEngine.h b/Generals/Code/GameEngine/Include/Common/GameEngine.h index 90be51a76ca..8dc44e396ed 100644 --- a/Generals/Code/GameEngine/Include/Common/GameEngine.h +++ b/Generals/Code/GameEngine/Include/Common/GameEngine.h @@ -55,15 +55,6 @@ class ParticleSystemManager; class GameEngine : public SubsystemInterface { -public: - - typedef UnsignedInt LogicTimeQueryFlags; - enum LogicTimeQueryFlags_ CPP_11(: LogicTimeQueryFlags) - { - IgnoreFrozenTime = 1<<0, // Ignore frozen time for the query - IgnoreHaltedGame = 1<<1, // Ignore halted game for the query - }; - public: GameEngine( void ); @@ -76,24 +67,9 @@ class GameEngine : public SubsystemInterface virtual void execute( void ); /**< The "main loop" of the game engine. It will not return until the game exits. */ - virtual void setFramesPerSecondLimit( Int fps ); ///< Set the max render and engine update fps. - virtual Int getFramesPerSecondLimit( void ); ///< Get the max render and engine update fps. - Real getUpdateTime(); ///< Get the last engine update delta time in seconds. - Real getUpdateFps(); ///< Get the last engine update fps. - static Bool isTimeFrozen(); ///< Returns true if a script has frozen time. static Bool isGameHalted(); ///< Returns true if the game is paused or the network is stalling. - virtual void setLogicTimeScaleFps( Int fps ); ///< Set the logic time scale fps and therefore scale the simulation time. Is capped by the max render fps and does not apply to network matches. - virtual Int getLogicTimeScaleFps(); ///< Get the raw logic time scale fps value. - virtual void enableLogicTimeScale( Bool enable ); ///< Enable the logic time scale setup. If disabled, the simulation time scale is bound to the render frame time or network update time. - virtual Bool isLogicTimeScaleEnabled(); ///< Check whether the logic time scale setup is enabled. - Int getActualLogicTimeScaleFps(LogicTimeQueryFlags flags = 0); ///< Get the real logic time scale fps, depending on the max render fps, network state and enabled state. - Real getActualLogicTimeScaleRatio(LogicTimeQueryFlags flags = 0); ///< Get the real logic time scale ratio, depending on the max render fps, network state and enabled state. - Real getActualLogicTimeScaleOverFpsRatio(LogicTimeQueryFlags flags = 0); ///< Get the real logic time scale over render fps ratio, used to scale down steps in render updates to match logic updates. - Real getLogicTimeStepSeconds(LogicTimeQueryFlags flags = 0); ///< Get the logic time step in seconds - Real getLogicTimeStepMilliseconds(LogicTimeQueryFlags flags = 0); ///< Get the logic time step in milliseconds - virtual void setQuitting( Bool quitting ); ///< set quitting status virtual Bool getQuitting(void); ///< is app getting ready to quit. @@ -125,18 +101,10 @@ class GameEngine : public SubsystemInterface virtual ParticleSystemManager* createParticleSystemManager( void ) = 0; virtual AudioManager *createAudioManager( void ) = 0; ///< Factory for Audio Manager - Int m_maxFPS; ///< Maximum frames per second for rendering - Int m_logicTimeScaleFPS; ///< Maximum frames per second for logic time scale - - Real m_updateTime; ///< Last engine update delta time in seconds Real m_logicTimeAccumulator; ///< Frame time accumulated towards submitting a new logic frame Bool m_quitting; ///< true when we need to quit the game Bool m_isActive; ///< app has OS focus. - Bool m_enableLogicTimeScale; - Bool m_isTimeFrozen; - Bool m_isGameHalted; - }; inline void GameEngine::setQuitting( Bool quitting ) { m_quitting = quitting; } diff --git a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp index 58a1419c123..7943cab3292 100644 --- a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp @@ -32,6 +32,7 @@ #include "Common/AudioAffect.h" #include "Common/BuildAssistant.h" #include "Common/CRCDebug.h" +#include "Common/FramePacer.h" #include "Common/Radar.h" #include "Common/PlayerTemplate.h" #include "Common/Team.h" @@ -44,7 +45,6 @@ #include "Common/ThingFactory.h" #include "Common/file.h" #include "Common/FileSystem.h" -#include "Common/FrameRateLimit.h" #include "Common/ArchiveFileSystem.h" #include "Common/LocalFileSystem.h" #include "Common/CDManager.h" @@ -249,19 +249,10 @@ static void updateWindowTitle() //------------------------------------------------------------------------------------------------- GameEngine::GameEngine( void ) { - // Set the time slice size to 1 ms. - timeBeginPeriod(1); - // initialize to non garbage values - m_maxFPS = BaseFps; - m_logicTimeScaleFPS = LOGICFRAMES_PER_SECOND; - m_updateTime = 1.0f / BaseFps; // initialized to something to avoid division by zero on first use m_logicTimeAccumulator = 0.0f; m_quitting = FALSE; m_isActive = FALSE; - m_enableLogicTimeScale = FALSE; - m_isTimeFrozen = FALSE; - m_isGameHalted = FALSE; _Module.Init(NULL, ApplicationHInstance, NULL); } @@ -307,34 +298,6 @@ GameEngine::~GameEngine() #ifdef PERF_TIMERS PerfGather::termPerfDump(); #endif - - // Restore the previous time slice for Windows. - timeEndPeriod(1); -} - -//------------------------------------------------------------------------------------------------- -void GameEngine::setFramesPerSecondLimit( Int fps ) -{ - DEBUG_LOG(("GameEngine::setFramesPerSecondLimit() - setting max fps to %d (TheGlobalData->m_useFpsLimit == %d)", fps, TheGlobalData->m_useFpsLimit)); - m_maxFPS = fps; -} - -//------------------------------------------------------------------------------------------------- -Int GameEngine::getFramesPerSecondLimit( void ) -{ - return m_maxFPS; -} - -//------------------------------------------------------------------------------------------------- -Real GameEngine::getUpdateTime() -{ - return m_updateTime; -} - -//------------------------------------------------------------------------------------------------- -Real GameEngine::getUpdateFps() -{ - return 1.0f / m_updateTime; } //------------------------------------------------------------------------------------------------- @@ -376,80 +339,6 @@ Bool GameEngine::isGameHalted() return false; } -//------------------------------------------------------------------------------------------------- -void GameEngine::setLogicTimeScaleFps( Int fps ) -{ - m_logicTimeScaleFPS = fps; -} - -//------------------------------------------------------------------------------------------------- -Int GameEngine::getLogicTimeScaleFps() -{ - return m_logicTimeScaleFPS; -} - -//------------------------------------------------------------------------------------------------- -void GameEngine::enableLogicTimeScale( Bool enable ) -{ - m_enableLogicTimeScale = enable; -} - -//------------------------------------------------------------------------------------------------- -Bool GameEngine::isLogicTimeScaleEnabled() -{ - return m_enableLogicTimeScale; -} - -//------------------------------------------------------------------------------------------------- -Int GameEngine::getActualLogicTimeScaleFps(LogicTimeQueryFlags flags) -{ - if (m_isTimeFrozen && (flags & IgnoreFrozenTime) == 0) - { - return 0; - } - - if (m_isGameHalted && (flags & IgnoreHaltedGame) == 0) - { - return 0; - } - - if (TheNetwork != NULL) - { - return TheNetwork->getFrameRate(); - } - - if (isLogicTimeScaleEnabled()) - { - return min(getLogicTimeScaleFps(), getFramesPerSecondLimit()); - } - - return getFramesPerSecondLimit(); -} - -//------------------------------------------------------------------------------------------------- -Real GameEngine::getActualLogicTimeScaleRatio(LogicTimeQueryFlags flags) -{ - return (Real)getActualLogicTimeScaleFps(flags) / LOGICFRAMES_PER_SECONDS_REAL; -} - -//------------------------------------------------------------------------------------------------- -Real GameEngine::getActualLogicTimeScaleOverFpsRatio(LogicTimeQueryFlags flags) -{ - // TheSuperHackers @info Clamps ratio to min 1, because the logic - // frame rate is currently capped by the render frame rate. - return min(1.0f, (Real)getActualLogicTimeScaleFps(flags) / getUpdateFps()); -} - -Real GameEngine::getLogicTimeStepSeconds(LogicTimeQueryFlags flags) -{ - return SECONDS_PER_LOGICFRAME_REAL * getActualLogicTimeScaleOverFpsRatio(flags); -} - -Real GameEngine::getLogicTimeStepMilliseconds(LogicTimeQueryFlags flags) -{ - return MSEC_PER_LOGICFRAME_REAL * getActualLogicTimeScaleOverFpsRatio(flags); -} - /** ----------------------------------------------------------------------------------------------- * Initialize the game engine by initializing the GameLogic and GameClient. */ @@ -601,7 +490,7 @@ void GameEngine::init() TheSubsystemList->postProcessLoadAll(); - setFramesPerSecondLimit(TheGlobalData->m_framesPerSecondLimit); + TheFramePacer->setFramesPerSecondLimit(TheGlobalData->m_framesPerSecondLimit); TheAudio->setOn(TheGlobalData->m_audioOn && TheGlobalData->m_musicOn, AudioAffect_Music); TheAudio->setOn(TheGlobalData->m_audioOn && TheGlobalData->m_soundsOn, AudioAffect_Sound); @@ -754,8 +643,8 @@ Bool GameEngine::canUpdateGameLogic() // Must be first. TheGameLogic->preUpdate(); - m_isTimeFrozen = isTimeFrozen(); - m_isGameHalted = isGameHalted(); + TheFramePacer->setTimeFrozen(isTimeFrozen()); + TheFramePacer->setGameHalted(isGameHalted()); if (TheNetwork != NULL) { @@ -767,6 +656,7 @@ Bool GameEngine::canUpdateGameLogic() } } +/// ----------------------------------------------------------------------------------------------- Bool GameEngine::canUpdateNetworkGameLogic() { DEBUG_ASSERTCRASH(TheNetwork != NULL, ("TheNetwork is NULL")); @@ -774,7 +664,7 @@ Bool GameEngine::canUpdateNetworkGameLogic() if (TheNetwork->isFrameDataReady()) { // Important: The Network is definitely no longer stalling. - m_isGameHalted = false; + TheFramePacer->setGameHalted(false); return true; } @@ -782,11 +672,12 @@ Bool GameEngine::canUpdateNetworkGameLogic() return false; } +/// ----------------------------------------------------------------------------------------------- Bool GameEngine::canUpdateRegularGameLogic() { - const Bool enabled = isLogicTimeScaleEnabled(); - const Int logicTimeScaleFps = getLogicTimeScaleFps(); - const Int maxRenderFps = getFramesPerSecondLimit(); + const Bool enabled = TheFramePacer->isLogicTimeScaleEnabled(); + const Int logicTimeScaleFps = TheFramePacer->getLogicTimeScaleFps(); + const Int maxRenderFps = TheFramePacer->getFramesPerSecondLimit(); #if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) const Bool useFastMode = TheGlobalData->m_TiVOFastMode; @@ -804,7 +695,7 @@ Bool GameEngine::canUpdateRegularGameLogic() // TheSuperHackers @tweak xezon 06/08/2025 // The logic time step is now decoupled from the render update. const Real targetFrameTime = 1.0f / logicTimeScaleFps; - m_logicTimeAccumulator += min(m_updateTime, targetFrameTime); + m_logicTimeAccumulator += min(TheFramePacer->getUpdateTime(), targetFrameTime); if (m_logicTimeAccumulator >= targetFrameTime) { @@ -847,8 +738,8 @@ void GameEngine::update( void ) } const Bool canUpdate = canUpdateGameLogic(); - const Bool canUpdateLogic = canUpdate && !m_isGameHalted && !m_isTimeFrozen; - const Bool canUpdateScript = canUpdate && !m_isGameHalted; + const Bool canUpdateLogic = canUpdate && !TheFramePacer->isGameHalted() && !TheFramePacer->isTimeFrozen(); + const Bool canUpdateScript = canUpdate && !TheFramePacer->isGameHalted(); if (canUpdateLogic) { @@ -873,8 +764,6 @@ extern HWND ApplicationHWnd; */ void GameEngine::execute( void ) { - FrameRateLimit* frameRateLimit = new FrameRateLimit(); - #if defined(RTS_DEBUG) DWORD startTime = timeGetTime() / 1000; #endif @@ -943,34 +832,7 @@ void GameEngine::execute( void ) } } - { - { - Bool allowFpsLimit = TheTacticalView->getTimeMultiplier()<=1 && !TheScriptEngine->isTimeFast(); - - // I'm disabling this in debug because many people need alt-tab capability. If you happen to be - // doing performance tuning, please just change this on your local system. -MDC - #if defined(RTS_DEBUG) - if (allowFpsLimit) - ::Sleep(1); // give everyone else a tiny time slice. - #endif - - - #if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) - allowFpsLimit &= !(!TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode); - #else //always allow this cheat key if we're in a replay game. - allowFpsLimit &= !(!TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame()); - #endif - { - // TheSuperHackers @bugfix xezon 05/08/2025 Re-implements the frame rate limiter - // with higher resolution counters to cap the frame rate more accurately to the desired limit. - allowFpsLimit &= TheGlobalData->m_useFpsLimit; - const UnsignedInt maxFps = allowFpsLimit ? getFramesPerSecondLimit() : RenderFpsPreset::UncappedFpsValue; - m_updateTime = frameRateLimit->wait(maxFps); - } - - } - } - + TheFramePacer->update(); } #ifdef PERF_TIMERS @@ -983,8 +845,6 @@ void GameEngine::execute( void ) #endif } - - delete frameRateLimit; } /** ----------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/Common/GameMain.cpp b/Generals/Code/GameEngine/Source/Common/GameMain.cpp index cf5f2e3be84..6255d6384c0 100644 --- a/Generals/Code/GameEngine/Source/Common/GameMain.cpp +++ b/Generals/Code/GameEngine/Source/Common/GameMain.cpp @@ -28,6 +28,7 @@ #include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine +#include "Common/FramePacer.h" #include "Common/GameEngine.h" #include "Common/ReplaySimulation.h" @@ -39,6 +40,7 @@ Int GameMain() { int exitcode = 0; // initialize the game engine using factory function + TheFramePacer = new FramePacer(); TheGameEngine = CreateGameEngine(); TheGameEngine->init(); @@ -53,6 +55,8 @@ Int GameMain() } // since execute() returned, we are exiting the game + delete TheFramePacer; + TheFramePacer = NULL; delete TheGameEngine; TheGameEngine = NULL; diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index 30232b73e0d..f8c9bbe9a5c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -35,8 +35,8 @@ #include "Common/BuildAssistant.h" #include "Common/ClientUpdateModule.h" #include "Common/DrawModule.h" +#include "Common/FramePacer.h" #include "Common/GameAudio.h" -#include "Common/GameEngine.h" #include "Common/GameLOD.h" #include "Common/GameState.h" #include "Common/GlobalData.h" @@ -4785,7 +4785,7 @@ void TintEnvelope::setDecayFrames( UnsignedInt frames ) void TintEnvelope::update(void) { // TheSuperHackers @tweak The tint time step is now decoupled from the render update. - const Real timeScale = TheGameEngine->getActualLogicTimeScaleOverFpsRatio(); + const Real timeScale = TheFramePacer->getActualLogicTimeScaleOverFpsRatio(); switch ( m_envState ) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp index eb51606ebb8..37fab267563 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp @@ -30,6 +30,7 @@ // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine +#include "Common/FramePacer.h" #include "Common/GameEngine.h" #include "Common/GameState.h" #include "Common/MessageStream.h" @@ -215,7 +216,7 @@ static void restartMissionMenu() Int rankPointsStartedWith = TheGameLogic->getRankPointsToAddAtGameStart();// must write down before reset GameDifficulty diff = TheScriptEngine->getGlobalDifficulty(); - Int fps = TheGameEngine->getFramesPerSecondLimit(); + Int fps = TheFramePacer->getFramesPerSecondLimit(); TheGameLogic->clearGameData(FALSE); TheGameEngine->setQuitting(FALSE); diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index ed5de557064..0cd5764c2a6 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -32,8 +32,8 @@ #define DEFINE_SHADOW_NAMES #include "Common/ActionManager.h" +#include "Common/FramePacer.h" #include "Common/GameAudio.h" -#include "Common/GameEngine.h" #include "Common/GameType.h" #include "Common/MessageStream.h" #include "Common/PerfTimer.h" @@ -46,7 +46,6 @@ #include "Common/BuildAssistant.h" #include "Common/Recorder.h" #include "Common/SpecialPower.h" -#include "Common/FrameRateLimit.h" #include "GameClient/Anim2D.h" #include "GameClient/ControlBar.h" @@ -1889,7 +1888,7 @@ void InGameUI::update( void ) if (m_cameraRotatingLeft || m_cameraRotatingRight || m_cameraZoomingIn || m_cameraZoomingOut) { // TheSuperHackers @tweak The camera rotation and zoom are now decoupled from the render update. - const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); + const Real fpsRatio = (Real)BaseFps / TheFramePacer->getUpdateFps(); const Real rotateAngle = TheGlobalData->m_keyboardCameraRotateSpeed * fpsRatio; const Real zoomHeight = (Real)View::ZoomHeightPerSecond * fpsRatio; @@ -5871,7 +5870,7 @@ void InGameUI::drawRenderFps(Int &x, Int &y) UnsignedInt renderFpsLimit = 0u; if (TheGlobalData->m_useFpsLimit) { - renderFpsLimit = (UnsignedInt)TheGameEngine->getFramesPerSecondLimit(); + renderFpsLimit = (UnsignedInt)TheFramePacer->getFramesPerSecondLimit(); if (renderFpsLimit == RenderFpsPreset::UncappedFpsValue) { renderFpsLimit = 0u; diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 37241be0b2b..678cd666533 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -32,7 +32,7 @@ #include "Common/AudioAffect.h" #include "Common/ActionManager.h" -#include "Common/FrameRateLimit.h" +#include "Common/FramePacer.h" #include "Common/GameAudio.h" #include "Common/GameEngine.h" #include "Common/GameType.h" @@ -187,10 +187,10 @@ Bool hasThingsInProduction(PlayerType playerType) bool changeMaxRenderFps(FpsValueChange change) { - UnsignedInt maxRenderFps = TheGameEngine->getFramesPerSecondLimit(); + UnsignedInt maxRenderFps = TheFramePacer->getFramesPerSecondLimit(); maxRenderFps = RenderFpsPreset::changeFpsValue(maxRenderFps, change); - TheGameEngine->setFramesPerSecondLimit(maxRenderFps); + TheFramePacer->setFramesPerSecondLimit(maxRenderFps); TheWritableGlobalData->m_useFpsLimit = (maxRenderFps != RenderFpsPreset::UncappedFpsValue); UnicodeString message; @@ -214,16 +214,16 @@ bool changeLogicTimeScale(FpsValueChange change) if (TheNetwork != NULL) return false; - const UnsignedInt maxRenderFps = TheGameEngine->getFramesPerSecondLimit(); + const UnsignedInt maxRenderFps = TheFramePacer->getFramesPerSecondLimit(); UnsignedInt maxRenderRemainder = LogicTimeScaleFpsPreset::StepFpsValue; maxRenderRemainder -= maxRenderFps % LogicTimeScaleFpsPreset::StepFpsValue; maxRenderRemainder %= LogicTimeScaleFpsPreset::StepFpsValue; - UnsignedInt logicTimeScaleFps = TheGameEngine->getLogicTimeScaleFps(); + UnsignedInt logicTimeScaleFps = TheFramePacer->getLogicTimeScaleFps(); // Set the value to the max render fps value plus a bit when time scale is // disabled. This ensures that the time scale does not re-enable with a // 'surprise' value. - if (!TheGameEngine->isLogicTimeScaleEnabled()) + if (!TheFramePacer->isLogicTimeScaleEnabled()) { logicTimeScaleFps = maxRenderFps + maxRenderRemainder; } @@ -234,26 +234,26 @@ bool changeLogicTimeScale(FpsValueChange change) logicTimeScaleFps = LogicTimeScaleFpsPreset::changeFpsValue(logicTimeScaleFps, change); // Set value before potentially disabling it. - if (TheGameEngine->isLogicTimeScaleEnabled()) + if (TheFramePacer->isLogicTimeScaleEnabled()) { - TheGameEngine->setLogicTimeScaleFps(logicTimeScaleFps); + TheFramePacer->setLogicTimeScaleFps(logicTimeScaleFps); } - TheGameEngine->enableLogicTimeScale(logicTimeScaleFps < maxRenderFps); + TheFramePacer->enableLogicTimeScale(logicTimeScaleFps < maxRenderFps); // Set value after potentially enabling it. - if (TheGameEngine->isLogicTimeScaleEnabled()) + if (TheFramePacer->isLogicTimeScaleEnabled()) { - TheGameEngine->setLogicTimeScaleFps(logicTimeScaleFps); + TheFramePacer->setLogicTimeScaleFps(logicTimeScaleFps); } - logicTimeScaleFps = TheGameEngine->getLogicTimeScaleFps(); - const UnsignedInt actualLogicTimeScaleFps = TheGameEngine->getActualLogicTimeScaleFps(); - const Real actualLogicTimeScaleRatio = TheGameEngine->getActualLogicTimeScaleRatio(); + logicTimeScaleFps = TheFramePacer->getLogicTimeScaleFps(); + const UnsignedInt actualLogicTimeScaleFps = TheFramePacer->getActualLogicTimeScaleFps(); + const Real actualLogicTimeScaleRatio = TheFramePacer->getActualLogicTimeScaleRatio(); UnicodeString message; - if (TheGameEngine->isLogicTimeScaleEnabled()) + if (TheFramePacer->isLogicTimeScaleEnabled()) { message = TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:SetLogicTimeScaleFps", L"Logic Time Scale FPS is %u (actual %u, ratio %.02f)", logicTimeScaleFps, actualLogicTimeScaleFps, actualLogicTimeScaleRatio); diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index 34907e5b62c..ad6242db93e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -28,8 +28,8 @@ #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine +#include "Common/FramePacer.h" #include "Common/GameType.h" -#include "Common/GameEngine.h" #include "Common/MessageStream.h" #include "Common/Player.h" #include "Common/PlayerList.h" @@ -440,7 +440,7 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage { // TheSuperHackers @bugfix Mauller 07/06/2025 The camera scrolling is now decoupled from the render update. - const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); + const Real fpsRatio = (Real)BaseFps / TheFramePacer->getUpdateFps(); switch (m_scrollType) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp index 479f5bd42c2..a46d193b26f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp @@ -31,8 +31,8 @@ #include "Common/AudioAffect.h" #include "Common/AudioHandleSpecialValues.h" +#include "Common/FramePacer.h" #include "Common/GameAudio.h" -#include "Common/GameEngine.h" #include "Common/MapObject.h" // For MAP_XY_FACTOR #include "Common/PartitionSolver.h" #include "Common/Player.h" @@ -6583,11 +6583,11 @@ void ScriptActions::executeAction( ScriptAction *pAction ) case ScriptAction::SET_FPS_LIMIT: if (!pAction->getParameter(0)->getInt()) { - TheGameEngine->setFramesPerSecondLimit(TheGlobalData->m_framesPerSecondLimit); + TheFramePacer->setFramesPerSecondLimit(TheGlobalData->m_framesPerSecondLimit); } else { - TheGameEngine->setFramesPerSecondLimit(pAction->getParameter(0)->getInt()); + TheFramePacer->setFramesPerSecondLimit(pAction->getParameter(0)->getInt()); } // Setting the fps limit doesn't do much good if we don't use it. jba. TheWritableGlobalData->m_useFpsLimit = true; diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index 7ee2c1ec169..b9678cbefe1 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -31,7 +31,7 @@ #include "Common/DataChunk.h" #include "Common/file.h" #include "Common/FileSystem.h" -#include "Common/GameEngine.h" +#include "Common/FramePacer.h" #include "Common/GameState.h" #include "Common/LatchRestore.h" #include "Common/MessageStream.h" @@ -4530,8 +4530,8 @@ void ScriptEngine::init( void ) void ScriptEngine::reset( void ) { // setting FPS limit in case a script had changed it - if (TheGameEngine && TheGlobalData) - TheGameEngine->setFramesPerSecondLimit(TheGlobalData->m_framesPerSecondLimit); + if (TheFramePacer && TheGlobalData) + TheFramePacer->setFramesPerSecondLimit(TheGlobalData->m_framesPerSecondLimit); if (TheScriptActions) { TheScriptActions->reset(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 92bf469c281..fec53639343 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -33,6 +33,7 @@ #include "Common/AudioHandleSpecialValues.h" #include "Common/BuildAssistant.h" #include "Common/CRCDebug.h" +#include "Common/FramePacer.h" #include "Common/GameAudio.h" #include "Common/GameEngine.h" #include "Common/GameState.h" @@ -3718,8 +3719,8 @@ void GameLogic::setGamePausedInFrame( UnsignedInt frame, Bool disableLogicTimeSc if (disableLogicTimeScale) { - m_logicTimeScaleEnabledMemory = TheGameEngine->isLogicTimeScaleEnabled(); - TheGameEngine->enableLogicTimeScale(FALSE); + m_logicTimeScaleEnabledMemory = TheFramePacer->isLogicTimeScaleEnabled(); + TheFramePacer->enableLogicTimeScale(FALSE); } } } @@ -3758,7 +3759,7 @@ void GameLogic::pauseGameLogic(Bool paused) if (!paused && m_logicTimeScaleEnabledMemory) { m_logicTimeScaleEnabledMemory = FALSE; - TheGameEngine->enableLogicTimeScale(TRUE); + TheFramePacer->enableLogicTimeScale(TRUE); } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index 3ffbd73acd3..1726d021969 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -31,6 +31,7 @@ #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine #include "Common/CRCDebug.h" +#include "Common/FramePacer.h" #include "Common/GameAudio.h" #include "Common/GameEngine.h" #include "Common/GlobalData.h" @@ -427,7 +428,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) if (maxFPS < 1 || maxFPS > 1000) maxFPS = TheGlobalData->m_framesPerSecondLimit; DEBUG_LOG(("Setting max FPS limit to %d FPS", maxFPS)); - TheGameEngine->setFramesPerSecondLimit(maxFPS); + TheFramePacer->setFramesPerSecondLimit(maxFPS); TheWritableGlobalData->m_useFpsLimit = true; } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index e6209f3ef55..ed0dd771aae 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -41,8 +41,8 @@ static void drawFramerateBar(void); #include // USER INCLUDES ////////////////////////////////////////////////////////////// +#include "Common/FramePacer.h" #include "Common/ThingFactory.h" -#include "Common/GameEngine.h" #include "Common/GlobalData.h" #include "Common/PerfTimer.h" #include "Common/FileSystem.h" @@ -975,7 +975,7 @@ void W3DDisplay::gatherDebugStats( void ) //Int LOD = TheGlobalData->m_terrainLOD; //unibuffer.format( L"FPS: %.2f, %.2fms mapLOD=%d [cumu FPS=%.2f] draws: %.2f sort: %.2f", fps, ms, LOD, cumuFPS, drawsPerFrame,sortPolysPerFrame); if (TheGlobalData->m_useFpsLimit) - unibuffer.format( L"%.2f/%d FPS, ", fps, TheGameEngine->getFramesPerSecondLimit()); + unibuffer.format( L"%.2f/%d FPS, ", fps, TheFramePacer->getFramesPerSecondLimit()); else unibuffer.format( L"%.2f FPS, ", fps); @@ -1673,7 +1673,7 @@ void W3DDisplay::draw( void ) // //PredictiveLODOptimizerClass::Optimize_LODs( 5000 ); - Bool freezeTime = TheGameEngine->isTimeFrozen() || TheGameEngine->isGameHalted(); + Bool freezeTime = TheFramePacer->isTimeFrozen() || TheFramePacer->isGameHalted(); /// @todo: I'm assuming the first view is our main 3D view. W3DView *primaryW3DView=(W3DView *)getFirstView(); @@ -1709,7 +1709,7 @@ void W3DDisplay::draw( void ) } } - WW3D::Update_Logic_Frame_Time(TheGameEngine->getLogicTimeStepMilliseconds()); + WW3D::Update_Logic_Frame_Time(TheFramePacer->getLogicTimeStepMilliseconds()); // TheSuperHackers @info This binds the WW3D update to the logic update. WW3D::Sync(TheGameLogic->hasUpdated()); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 31e10ef8f54..538368eface 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -38,7 +38,7 @@ // USER INCLUDES ////////////////////////////////////////////////////////////////////////////////// #include "Common/BuildAssistant.h" -#include "Common/GameEngine.h" +#include "Common/FramePacer.h" #include "Common/GlobalData.h" #include "Common/Module.h" #include "Common/RandomValue.h" @@ -905,7 +905,7 @@ Bool W3DView::updateCameraMovements() m_previousLookAtPosition = *getPosition(); // TheSuperHackers @tweak The scripted camera movement is now decoupled from the render update. // The scripted camera will still move when the time is frozen, but not when the game is halted. - moveAlongWaypointPath(TheGameEngine->getLogicTimeStepMilliseconds(GameEngine::IgnoreFrozenTime)); + moveAlongWaypointPath(TheFramePacer->getLogicTimeStepMilliseconds(FramePacer::IgnoreFrozenTime)); didUpdate = true; } if (m_doingScriptedCameraLock) @@ -1206,7 +1206,7 @@ void W3DView::update(void) // if scrolling, only adjust if we're too close or too far if (m_scrollAmount.length() < m_scrollAmountCutoff || (m_currentHeightAboveGround < m_minHeightAboveGround) || (TheGlobalData->m_enforceMaxCameraHeight && m_currentHeightAboveGround > m_maxHeightAboveGround)) { - const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); + const Real fpsRatio = (Real)BaseFps / TheFramePacer->getUpdateFps(); const Real zoomAdj = (desiredZoom - m_zoom) * TheGlobalData->m_cameraAdjustSpeed * fpsRatio; if (fabs(zoomAdj) >= 0.0001f) // only do positive { @@ -1218,7 +1218,7 @@ void W3DView::update(void) else if (!didScriptedMovement) { // we're not scrolling; settle toward desired height above ground - const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); + const Real fpsRatio = (Real)BaseFps / TheFramePacer->getUpdateFps(); const Real zoomAdj = (m_zoom - desiredZoom) * TheGlobalData->m_cameraAdjustSpeed * fpsRatio; if (fabs(zoomAdj) >= 0.0001f) { diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp index 784851861e8..2119e618d79 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp @@ -49,7 +49,7 @@ #include "mesh.h" #include "matinfo.h" -#include "Common/GameEngine.h" +#include "Common/FramePacer.h" #include "Common/GameState.h" #include "Common/GlobalData.h" #include "Common/PerfTimer.h" @@ -1187,7 +1187,7 @@ void WaterRenderObjClass::enableWaterGrid(Bool state) void WaterRenderObjClass::update( void ) { // TheSuperHackers @tweak The water movement time step is now decoupled from the render update. - const Real timeScale = TheGameEngine->getActualLogicTimeScaleOverFpsRatio(); + const Real timeScale = TheFramePacer->getActualLogicTimeScaleOverFpsRatio(); { constexpr const Real MagicOffset = 0.0125f * 33 / 5000; ///< the work of top Munkees; do not question it diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp index 61f71d2de77..4edfd72bdea 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp @@ -47,7 +47,7 @@ #include "W3DDevice/GameClient/W3DWaterTracks.h" #include "GameClient/InGameUI.h" #include "GameLogic/TerrainLogic.h" -#include "Common/GameEngine.h" +#include "Common/FramePacer.h" #include "Common/GlobalData.h" #include "Common/UnicodeString.h" #include "Common/file.h" @@ -293,7 +293,7 @@ Int WaterTracksObj::update(Int msElapsed) Int WaterTracksObj::render(DX8VertexBufferClass *vertexBuffer, Int batchStart) { // TheSuperHackers @tweak The wave movement time step is now decoupled from the render update. - m_elapsedMs += TheGameEngine->getLogicTimeStepMilliseconds(); + m_elapsedMs += TheFramePacer->getLogicTimeStepMilliseconds(); VertexFormatXYZDUV1 *vb; Vector2 waveTailOrigin,waveFrontOrigin; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h b/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h index d952b45f58a..5ce1fed5a75 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h @@ -55,15 +55,6 @@ class ParticleSystemManager; class GameEngine : public SubsystemInterface { -public: - - typedef UnsignedInt LogicTimeQueryFlags; - enum LogicTimeQueryFlags_ CPP_11(: LogicTimeQueryFlags) - { - IgnoreFrozenTime = 1<<0, // Ignore frozen time for the query - IgnoreHaltedGame = 1<<1, // Ignore halted game for the query - }; - public: GameEngine( void ); @@ -76,24 +67,9 @@ class GameEngine : public SubsystemInterface virtual void execute( void ); /**< The "main loop" of the game engine. It will not return until the game exits. */ - virtual void setFramesPerSecondLimit( Int fps ); ///< Set the max render and engine update fps. - virtual Int getFramesPerSecondLimit( void ); ///< Get the max render and engine update fps. - Real getUpdateTime(); ///< Get the last engine update delta time in seconds. - Real getUpdateFps(); ///< Get the last engine update fps. - static Bool isTimeFrozen(); ///< Returns true if a script has frozen time. static Bool isGameHalted(); ///< Returns true if the game is paused or the network is stalling. - virtual void setLogicTimeScaleFps( Int fps ); ///< Set the logic time scale fps and therefore scale the simulation time. Is capped by the max render fps and does not apply to network matches. - virtual Int getLogicTimeScaleFps(); ///< Get the raw logic time scale fps value. - virtual void enableLogicTimeScale( Bool enable ); ///< Enable the logic time scale setup. If disabled, the simulation time scale is bound to the render frame time or network update time. - virtual Bool isLogicTimeScaleEnabled(); ///< Check whether the logic time scale setup is enabled. - Int getActualLogicTimeScaleFps(LogicTimeQueryFlags flags = 0); ///< Get the real logic time scale fps, depending on the max render fps, network state and enabled state. - Real getActualLogicTimeScaleRatio(LogicTimeQueryFlags flags = 0); ///< Get the real logic time scale ratio, depending on the max render fps, network state and enabled state. - Real getActualLogicTimeScaleOverFpsRatio(LogicTimeQueryFlags flags = 0); ///< Get the real logic time scale over render fps ratio, used to scale down steps in render updates to match logic updates. - Real getLogicTimeStepSeconds(LogicTimeQueryFlags flags = 0); ///< Get the logic time step in seconds - Real getLogicTimeStepMilliseconds(LogicTimeQueryFlags flags = 0); ///< Get the logic time step in milliseconds - virtual void setQuitting( Bool quitting ); ///< set quitting status virtual Bool getQuitting(void); ///< is app getting ready to quit. @@ -124,18 +100,10 @@ class GameEngine : public SubsystemInterface virtual ParticleSystemManager* createParticleSystemManager( void ) = 0; virtual AudioManager *createAudioManager( void ) = 0; ///< Factory for Audio Manager - Int m_maxFPS; ///< Maximum frames per second for rendering - Int m_logicTimeScaleFPS; ///< Maximum frames per second for logic time scale - - Real m_updateTime; ///< Last engine update delta time in seconds Real m_logicTimeAccumulator; ///< Frame time accumulated towards submitting a new logic frame Bool m_quitting; ///< true when we need to quit the game Bool m_isActive; ///< app has OS focus. - Bool m_enableLogicTimeScale; - Bool m_isTimeFrozen; - Bool m_isGameHalted; - }; inline void GameEngine::setQuitting( Bool quitting ) { m_quitting = quitting; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp index 02d786b4e55..2b6bcad36d1 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp @@ -32,6 +32,7 @@ #include "Common/AudioAffect.h" #include "Common/BuildAssistant.h" #include "Common/CRCDebug.h" +#include "Common/FramePacer.h" #include "Common/Radar.h" #include "Common/PlayerTemplate.h" #include "Common/Team.h" @@ -44,7 +45,6 @@ #include "Common/ThingFactory.h" #include "Common/file.h" #include "Common/FileSystem.h" -#include "Common/FrameRateLimit.h" #include "Common/ArchiveFileSystem.h" #include "Common/LocalFileSystem.h" #include "Common/CDManager.h" @@ -247,19 +247,10 @@ static void updateWindowTitle() //------------------------------------------------------------------------------------------------- GameEngine::GameEngine( void ) { - // Set the time slice size to 1 ms. - timeBeginPeriod(1); - // initialize to non garbage values - m_maxFPS = BaseFps; - m_logicTimeScaleFPS = LOGICFRAMES_PER_SECOND; - m_updateTime = 1.0f / BaseFps; // initialized to something to avoid division by zero on first use m_logicTimeAccumulator = 0.0f; m_quitting = FALSE; m_isActive = FALSE; - m_enableLogicTimeScale = FALSE; - m_isTimeFrozen = FALSE; - m_isGameHalted = FALSE; _Module.Init(NULL, ApplicationHInstance, NULL); } @@ -308,34 +299,6 @@ GameEngine::~GameEngine() #ifdef PERF_TIMERS PerfGather::termPerfDump(); #endif - - // Restore the previous time slice for Windows. - timeEndPeriod(1); -} - -//------------------------------------------------------------------------------------------------- -void GameEngine::setFramesPerSecondLimit( Int fps ) -{ - DEBUG_LOG(("GameEngine::setFramesPerSecondLimit() - setting max fps to %d (TheGlobalData->m_useFpsLimit == %d)", fps, TheGlobalData->m_useFpsLimit)); - m_maxFPS = fps; -} - -//------------------------------------------------------------------------------------------------- -Int GameEngine::getFramesPerSecondLimit( void ) -{ - return m_maxFPS; -} - -//------------------------------------------------------------------------------------------------- -Real GameEngine::getUpdateTime() -{ - return m_updateTime; -} - -//------------------------------------------------------------------------------------------------- -Real GameEngine::getUpdateFps() -{ - return 1.0f / m_updateTime; } //------------------------------------------------------------------------------------------------- @@ -377,80 +340,6 @@ Bool GameEngine::isGameHalted() return false; } -//------------------------------------------------------------------------------------------------- -void GameEngine::setLogicTimeScaleFps( Int fps ) -{ - m_logicTimeScaleFPS = fps; -} - -//------------------------------------------------------------------------------------------------- -Int GameEngine::getLogicTimeScaleFps() -{ - return m_logicTimeScaleFPS; -} - -//------------------------------------------------------------------------------------------------- -void GameEngine::enableLogicTimeScale( Bool enable ) -{ - m_enableLogicTimeScale = enable; -} - -//------------------------------------------------------------------------------------------------- -Bool GameEngine::isLogicTimeScaleEnabled() -{ - return m_enableLogicTimeScale; -} - -//------------------------------------------------------------------------------------------------- -Int GameEngine::getActualLogicTimeScaleFps(LogicTimeQueryFlags flags) -{ - if (m_isTimeFrozen && (flags & IgnoreFrozenTime) == 0) - { - return 0; - } - - if (m_isGameHalted && (flags & IgnoreHaltedGame) == 0) - { - return 0; - } - - if (TheNetwork != NULL) - { - return TheNetwork->getFrameRate(); - } - - if (isLogicTimeScaleEnabled()) - { - return min(getLogicTimeScaleFps(), getFramesPerSecondLimit()); - } - - return getFramesPerSecondLimit(); -} - -//------------------------------------------------------------------------------------------------- -Real GameEngine::getActualLogicTimeScaleRatio(LogicTimeQueryFlags flags) -{ - return (Real)getActualLogicTimeScaleFps(flags) / LOGICFRAMES_PER_SECONDS_REAL; -} - -//------------------------------------------------------------------------------------------------- -Real GameEngine::getActualLogicTimeScaleOverFpsRatio(LogicTimeQueryFlags flags) -{ - // TheSuperHackers @info Clamps ratio to min 1, because the logic - // frame rate is currently capped by the render frame rate. - return min(1.0f, (Real)getActualLogicTimeScaleFps(flags) / getUpdateFps()); -} - -Real GameEngine::getLogicTimeStepSeconds(LogicTimeQueryFlags flags) -{ - return SECONDS_PER_LOGICFRAME_REAL * getActualLogicTimeScaleOverFpsRatio(flags); -} - -Real GameEngine::getLogicTimeStepMilliseconds(LogicTimeQueryFlags flags) -{ - return MSEC_PER_LOGICFRAME_REAL * getActualLogicTimeScaleOverFpsRatio(flags); -} - /** ----------------------------------------------------------------------------------------------- * Initialize the game engine by initializing the GameLogic and GameClient. */ @@ -765,7 +654,7 @@ void GameEngine::init() TheSubsystemList->postProcessLoadAll(); - setFramesPerSecondLimit(TheGlobalData->m_framesPerSecondLimit); + TheFramePacer->setFramesPerSecondLimit(TheGlobalData->m_framesPerSecondLimit); TheAudio->setOn(TheGlobalData->m_audioOn && TheGlobalData->m_musicOn, AudioAffect_Music); TheAudio->setOn(TheGlobalData->m_audioOn && TheGlobalData->m_soundsOn, AudioAffect_Sound); @@ -929,8 +818,8 @@ Bool GameEngine::canUpdateGameLogic() // Must be first. TheGameLogic->preUpdate(); - m_isTimeFrozen = isTimeFrozen(); - m_isGameHalted = isGameHalted(); + TheFramePacer->setTimeFrozen(isTimeFrozen()); + TheFramePacer->setGameHalted(isGameHalted()); if (TheNetwork != NULL) { @@ -942,6 +831,7 @@ Bool GameEngine::canUpdateGameLogic() } } +/// ----------------------------------------------------------------------------------------------- Bool GameEngine::canUpdateNetworkGameLogic() { DEBUG_ASSERTCRASH(TheNetwork != NULL, ("TheNetwork is NULL")); @@ -949,7 +839,7 @@ Bool GameEngine::canUpdateNetworkGameLogic() if (TheNetwork->isFrameDataReady()) { // Important: The Network is definitely no longer stalling. - m_isGameHalted = false; + TheFramePacer->setGameHalted(false); return true; } @@ -957,11 +847,12 @@ Bool GameEngine::canUpdateNetworkGameLogic() return false; } +/// ----------------------------------------------------------------------------------------------- Bool GameEngine::canUpdateRegularGameLogic() { - const Bool enabled = isLogicTimeScaleEnabled(); - const Int logicTimeScaleFps = getLogicTimeScaleFps(); - const Int maxRenderFps = getFramesPerSecondLimit(); + const Bool enabled = TheFramePacer->isLogicTimeScaleEnabled(); + const Int logicTimeScaleFps = TheFramePacer->getLogicTimeScaleFps(); + const Int maxRenderFps = TheFramePacer->getFramesPerSecondLimit(); #if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) const Bool useFastMode = TheGlobalData->m_TiVOFastMode; @@ -979,7 +870,7 @@ Bool GameEngine::canUpdateRegularGameLogic() // TheSuperHackers @tweak xezon 06/08/2025 // The logic time step is now decoupled from the render update. const Real targetFrameTime = 1.0f / logicTimeScaleFps; - m_logicTimeAccumulator += min(m_updateTime, targetFrameTime); + m_logicTimeAccumulator += min(TheFramePacer->getUpdateTime(), targetFrameTime); if (m_logicTimeAccumulator >= targetFrameTime) { @@ -1022,8 +913,8 @@ void GameEngine::update( void ) } const Bool canUpdate = canUpdateGameLogic(); - const Bool canUpdateLogic = canUpdate && !m_isGameHalted && !m_isTimeFrozen; - const Bool canUpdateScript = canUpdate && !m_isGameHalted; + const Bool canUpdateLogic = canUpdate && !TheFramePacer->isGameHalted() && !TheFramePacer->isTimeFrozen(); + const Bool canUpdateScript = canUpdate && !TheFramePacer->isGameHalted(); if (canUpdateLogic) { @@ -1048,8 +939,6 @@ extern HWND ApplicationHWnd; */ void GameEngine::execute( void ) { - FrameRateLimit* frameRateLimit = new FrameRateLimit(); - #if defined(RTS_DEBUG) DWORD startTime = timeGetTime() / 1000; #endif @@ -1118,34 +1007,7 @@ void GameEngine::execute( void ) } } - { - { - Bool allowFpsLimit = TheTacticalView->getTimeMultiplier()<=1 && !TheScriptEngine->isTimeFast(); - - // I'm disabling this in debug because many people need alt-tab capability. If you happen to be - // doing performance tuning, please just change this on your local system. -MDC - #if defined(RTS_DEBUG) - if (allowFpsLimit) - ::Sleep(1); // give everyone else a tiny time slice. - #endif - - - #if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) - allowFpsLimit &= !(!TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode); - #else //always allow this cheat key if we're in a replay game. - allowFpsLimit &= !(!TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame()); - #endif - { - // TheSuperHackers @bugfix xezon 05/08/2025 Re-implements the frame rate limiter - // with higher resolution counters to cap the frame rate more accurately to the desired limit. - allowFpsLimit &= TheGlobalData->m_useFpsLimit; - const UnsignedInt maxFps = allowFpsLimit ? getFramesPerSecondLimit() : RenderFpsPreset::UncappedFpsValue; - m_updateTime = frameRateLimit->wait(maxFps); - } - - } - } - + TheFramePacer->update(); } #ifdef PERF_TIMERS @@ -1158,8 +1020,6 @@ void GameEngine::execute( void ) #endif } - - delete frameRateLimit; } /** ----------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameMain.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameMain.cpp index 7ee88428c06..76cfecef5d9 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GameMain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GameMain.cpp @@ -28,6 +28,7 @@ #include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine +#include "Common/FramePacer.h" #include "Common/GameEngine.h" #include "Common/ReplaySimulation.h" @@ -39,6 +40,7 @@ Int GameMain() { int exitcode = 0; // initialize the game engine using factory function + TheFramePacer = new FramePacer(); TheGameEngine = CreateGameEngine(); TheGameEngine->init(); @@ -53,6 +55,8 @@ Int GameMain() } // since execute() returned, we are exiting the game + delete TheFramePacer; + TheFramePacer = NULL; delete TheGameEngine; TheGameEngine = NULL; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index 416da00b5b7..ed091e87c8c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -36,8 +36,8 @@ #include "Common/BuildAssistant.h" #include "Common/ClientUpdateModule.h" #include "Common/DrawModule.h" +#include "Common/FramePacer.h" #include "Common/GameAudio.h" -#include "Common/GameEngine.h" #include "Common/GameLOD.h" #include "Common/GameState.h" #include "Common/GlobalData.h" @@ -5542,7 +5542,7 @@ void TintEnvelope::setDecayFrames( UnsignedInt frames ) void TintEnvelope::update(void) { // TheSuperHackers @tweak The tint time step is now decoupled from the render update. - const Real timeScale = TheGameEngine->getActualLogicTimeScaleOverFpsRatio(); + const Real timeScale = TheFramePacer->getActualLogicTimeScaleOverFpsRatio(); switch ( m_envState ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp index d247d840867..81f65ec654c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp @@ -30,6 +30,7 @@ // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine +#include "Common/FramePacer.h" #include "Common/GameEngine.h" #include "Common/GameState.h" #include "Common/MessageStream.h" @@ -215,7 +216,7 @@ static void restartMissionMenu() Int rankPointsStartedWith = TheGameLogic->getRankPointsToAddAtGameStart();// must write down before reset GameDifficulty diff = TheScriptEngine->getGlobalDifficulty(); - Int fps = TheGameEngine->getFramesPerSecondLimit(); + Int fps = TheFramePacer->getFramesPerSecondLimit(); TheGameLogic->clearGameData(FALSE); TheGameEngine->setQuitting(FALSE); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index 70f367d029c..4c331e3f88a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -32,8 +32,8 @@ #define DEFINE_SHADOW_NAMES #include "Common/ActionManager.h" +#include "Common/FramePacer.h" #include "Common/GameAudio.h" -#include "Common/GameEngine.h" #include "Common/GameType.h" #include "Common/MessageStream.h" #include "Common/PerfTimer.h" @@ -46,7 +46,6 @@ #include "Common/BuildAssistant.h" #include "Common/Recorder.h" #include "Common/SpecialPower.h" -#include "Common/FrameRateLimit.h" #include "GameClient/Anim2D.h" #include "GameClient/ControlBar.h" @@ -1945,7 +1944,7 @@ void InGameUI::update( void ) if (m_cameraRotatingLeft || m_cameraRotatingRight || m_cameraZoomingIn || m_cameraZoomingOut) { // TheSuperHackers @tweak The camera rotation and zoom are now decoupled from the render update. - const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); + const Real fpsRatio = (Real)BaseFps / TheFramePacer->getUpdateFps(); const Real rotateAngle = TheGlobalData->m_keyboardCameraRotateSpeed * fpsRatio; const Real zoomHeight = (Real)View::ZoomHeightPerSecond * fpsRatio; @@ -6044,7 +6043,7 @@ void InGameUI::drawRenderFps(Int &x, Int &y) UnsignedInt renderFpsLimit = 0u; if (TheGlobalData->m_useFpsLimit) { - renderFpsLimit = (UnsignedInt)TheGameEngine->getFramesPerSecondLimit(); + renderFpsLimit = (UnsignedInt)TheFramePacer->getFramesPerSecondLimit(); if (renderFpsLimit == RenderFpsPreset::UncappedFpsValue) { renderFpsLimit = 0u; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 7dd70033b94..fadbc5f2320 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -32,7 +32,7 @@ #include "Common/AudioAffect.h" #include "Common/ActionManager.h" -#include "Common/FrameRateLimit.h" +#include "Common/FramePacer.h" #include "Common/GameAudio.h" #include "Common/GameEngine.h" #include "Common/GameType.h" @@ -190,10 +190,10 @@ Bool hasThingsInProduction(PlayerType playerType) bool changeMaxRenderFps(FpsValueChange change) { - UnsignedInt maxRenderFps = TheGameEngine->getFramesPerSecondLimit(); + UnsignedInt maxRenderFps = TheFramePacer->getFramesPerSecondLimit(); maxRenderFps = RenderFpsPreset::changeFpsValue(maxRenderFps, change); - TheGameEngine->setFramesPerSecondLimit(maxRenderFps); + TheFramePacer->setFramesPerSecondLimit(maxRenderFps); TheWritableGlobalData->m_useFpsLimit = (maxRenderFps != RenderFpsPreset::UncappedFpsValue); UnicodeString message; @@ -217,16 +217,16 @@ bool changeLogicTimeScale(FpsValueChange change) if (TheNetwork != NULL) return false; - const UnsignedInt maxRenderFps = TheGameEngine->getFramesPerSecondLimit(); + const UnsignedInt maxRenderFps = TheFramePacer->getFramesPerSecondLimit(); UnsignedInt maxRenderRemainder = LogicTimeScaleFpsPreset::StepFpsValue; maxRenderRemainder -= maxRenderFps % LogicTimeScaleFpsPreset::StepFpsValue; maxRenderRemainder %= LogicTimeScaleFpsPreset::StepFpsValue; - UnsignedInt logicTimeScaleFps = TheGameEngine->getLogicTimeScaleFps(); + UnsignedInt logicTimeScaleFps = TheFramePacer->getLogicTimeScaleFps(); // Set the value to the max render fps value plus a bit when time scale is // disabled. This ensures that the time scale does not re-enable with a // 'surprise' value. - if (!TheGameEngine->isLogicTimeScaleEnabled()) + if (!TheFramePacer->isLogicTimeScaleEnabled()) { logicTimeScaleFps = maxRenderFps + maxRenderRemainder; } @@ -237,26 +237,26 @@ bool changeLogicTimeScale(FpsValueChange change) logicTimeScaleFps = LogicTimeScaleFpsPreset::changeFpsValue(logicTimeScaleFps, change); // Set value before potentially disabling it. - if (TheGameEngine->isLogicTimeScaleEnabled()) + if (TheFramePacer->isLogicTimeScaleEnabled()) { - TheGameEngine->setLogicTimeScaleFps(logicTimeScaleFps); + TheFramePacer->setLogicTimeScaleFps(logicTimeScaleFps); } - TheGameEngine->enableLogicTimeScale(logicTimeScaleFps < maxRenderFps); + TheFramePacer->enableLogicTimeScale(logicTimeScaleFps < maxRenderFps); // Set value after potentially enabling it. - if (TheGameEngine->isLogicTimeScaleEnabled()) + if (TheFramePacer->isLogicTimeScaleEnabled()) { - TheGameEngine->setLogicTimeScaleFps(logicTimeScaleFps); + TheFramePacer->setLogicTimeScaleFps(logicTimeScaleFps); } - logicTimeScaleFps = TheGameEngine->getLogicTimeScaleFps(); - const UnsignedInt actualLogicTimeScaleFps = TheGameEngine->getActualLogicTimeScaleFps(); - const Real actualLogicTimeScaleRatio = TheGameEngine->getActualLogicTimeScaleRatio(); + logicTimeScaleFps = TheFramePacer->getLogicTimeScaleFps(); + const UnsignedInt actualLogicTimeScaleFps = TheFramePacer->getActualLogicTimeScaleFps(); + const Real actualLogicTimeScaleRatio = TheFramePacer->getActualLogicTimeScaleRatio(); UnicodeString message; - if (TheGameEngine->isLogicTimeScaleEnabled()) + if (TheFramePacer->isLogicTimeScaleEnabled()) { message = TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:SetLogicTimeScaleFps", L"Logic Time Scale FPS is %u (actual %u, ratio %.02f)", logicTimeScaleFps, actualLogicTimeScaleFps, actualLogicTimeScaleRatio); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index e753b258694..fc20aa0185e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -28,8 +28,8 @@ #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine +#include "Common/FramePacer.h" #include "Common/GameType.h" -#include "Common/GameEngine.h" #include "Common/MessageStream.h" #include "Common/Player.h" #include "Common/PlayerList.h" @@ -439,7 +439,7 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage { // TheSuperHackers @bugfix Mauller 07/06/2025 The camera scrolling is now decoupled from the render update. - const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); + const Real fpsRatio = (Real)BaseFps / TheFramePacer->getUpdateFps(); switch (m_scrollType) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp index 710b49eeeea..dbe9e4a5e8d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp @@ -31,8 +31,8 @@ #include "Common/AudioAffect.h" #include "Common/AudioHandleSpecialValues.h" +#include "Common/FramePacer.h" #include "Common/GameAudio.h" -#include "Common/GameEngine.h" #include "Common/MapObject.h" // For MAP_XY_FACTOR #include "Common/PartitionSolver.h" #include "Common/Player.h" @@ -7129,11 +7129,11 @@ void ScriptActions::executeAction( ScriptAction *pAction ) case ScriptAction::SET_FPS_LIMIT: if (!pAction->getParameter(0)->getInt()) { - TheGameEngine->setFramesPerSecondLimit(TheGlobalData->m_framesPerSecondLimit); + TheFramePacer->setFramesPerSecondLimit(TheGlobalData->m_framesPerSecondLimit); } else { - TheGameEngine->setFramesPerSecondLimit(pAction->getParameter(0)->getInt()); + TheFramePacer->setFramesPerSecondLimit(pAction->getParameter(0)->getInt()); } // Setting the fps limit doesn't do much good if we don't use it. jba. TheWritableGlobalData->m_useFpsLimit = true; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index 364cadf7ec9..ee5d5fd1f5e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -31,7 +31,7 @@ #include "Common/DataChunk.h" #include "Common/file.h" #include "Common/FileSystem.h" -#include "Common/GameEngine.h" +#include "Common/FramePacer.h" #include "Common/GameState.h" #include "Common/LatchRestore.h" #include "Common/MessageStream.h" @@ -5265,8 +5265,8 @@ void ScriptEngine::init( void ) void ScriptEngine::reset( void ) { // setting FPS limit in case a script had changed it - if (TheGameEngine && TheGlobalData) - TheGameEngine->setFramesPerSecondLimit(TheGlobalData->m_framesPerSecondLimit); + if (TheFramePacer && TheGlobalData) + TheFramePacer->setFramesPerSecondLimit(TheGlobalData->m_framesPerSecondLimit); if (TheScriptActions) { TheScriptActions->reset(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index d7f82871e4a..6e9ec822f27 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -33,6 +33,7 @@ #include "Common/AudioHandleSpecialValues.h" #include "Common/BuildAssistant.h" #include "Common/CRCDebug.h" +#include "Common/FramePacer.h" #include "Common/GameAudio.h" #include "Common/GameEngine.h" #include "Common/GameLOD.h" @@ -4271,8 +4272,8 @@ void GameLogic::setGamePausedInFrame( UnsignedInt frame, Bool disableLogicTimeSc if (disableLogicTimeScale) { - m_logicTimeScaleEnabledMemory = TheGameEngine->isLogicTimeScaleEnabled(); - TheGameEngine->enableLogicTimeScale(FALSE); + m_logicTimeScaleEnabledMemory = TheFramePacer->isLogicTimeScaleEnabled(); + TheFramePacer->enableLogicTimeScale(FALSE); } } } @@ -4311,7 +4312,7 @@ void GameLogic::pauseGameLogic(Bool paused) if (!paused && m_logicTimeScaleEnabledMemory) { m_logicTimeScaleEnabledMemory = FALSE; - TheGameEngine->enableLogicTimeScale(TRUE); + TheFramePacer->enableLogicTimeScale(TRUE); } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index 889b7a3ca53..b680f82c4fc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -31,6 +31,7 @@ #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine #include "Common/CRCDebug.h" +#include "Common/FramePacer.h" #include "Common/GameAudio.h" #include "Common/GameEngine.h" #include "Common/GlobalData.h" @@ -436,7 +437,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) if (maxFPS < 1 || maxFPS > 1000) maxFPS = TheGlobalData->m_framesPerSecondLimit; DEBUG_LOG(("Setting max FPS limit to %d FPS", maxFPS)); - TheGameEngine->setFramesPerSecondLimit(maxFPS); + TheFramePacer->setFramesPerSecondLimit(maxFPS); TheWritableGlobalData->m_useFpsLimit = true; } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index b2949a68cab..352b9d97c7c 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -41,8 +41,8 @@ static void drawFramerateBar(void); #include // USER INCLUDES ////////////////////////////////////////////////////////////// +#include "Common/FramePacer.h" #include "Common/ThingFactory.h" -#include "Common/GameEngine.h" #include "Common/GlobalData.h" #include "Common/PerfTimer.h" #include "Common/FileSystem.h" @@ -1025,7 +1025,7 @@ void W3DDisplay::gatherDebugStats( void ) Int LOD = TheGlobalData->m_terrainLOD; //unibuffer.format( L"FPS: %.2f, %.2fms mapLOD=%d [cumu FPS=%.2f] draws: %.2f sort: %.2f", fps, ms, LOD, cumuFPS, drawsPerFrame,sortPolysPerFrame); if (TheGlobalData->m_useFpsLimit) - unibuffer.format( L"%.2f/%d FPS, ", fps, TheGameEngine->getFramesPerSecondLimit()); + unibuffer.format( L"%.2f/%d FPS, ", fps, TheFramePacer->getFramesPerSecondLimit()); else unibuffer.format( L"%.2f FPS, ", fps); @@ -1754,7 +1754,7 @@ void W3DDisplay::draw( void ) // //PredictiveLODOptimizerClass::Optimize_LODs( 5000 ); - Bool freezeTime = TheGameEngine->isTimeFrozen() || TheGameEngine->isGameHalted(); + Bool freezeTime = TheFramePacer->isTimeFrozen() || TheFramePacer->isGameHalted(); /// @todo: I'm assuming the first view is our main 3D view. W3DView *primaryW3DView=(W3DView *)getFirstView(); @@ -1790,7 +1790,7 @@ void W3DDisplay::draw( void ) } } - WW3D::Update_Logic_Frame_Time(TheGameEngine->getLogicTimeStepMilliseconds()); + WW3D::Update_Logic_Frame_Time(TheFramePacer->getLogicTimeStepMilliseconds()); // TheSuperHackers @info This binds the WW3D update to the logic update. WW3D::Sync(TheGameLogic->hasUpdated()); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index a8b8d3474ed..3cf288e5da2 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -38,7 +38,7 @@ // USER INCLUDES ////////////////////////////////////////////////////////////////////////////////// #include "Common/BuildAssistant.h" -#include "Common/GameEngine.h" +#include "Common/FramePacer.h" #include "Common/GlobalData.h" #include "Common/Module.h" #include "Common/RandomValue.h" @@ -399,7 +399,7 @@ void W3DView::buildCameraTransform( Matrix3D *transform ) //WST 11/12/2002 New camera shaker system // TheSuperHackers @tweak The camera shaker is now decoupled from the render update. - CameraShakerSystem.Timestep(TheGameEngine->getLogicTimeStepMilliseconds()); + CameraShakerSystem.Timestep(TheFramePacer->getLogicTimeStepMilliseconds()); CameraShakerSystem.Update_Camera_Shaker(sourcePos, &m_shakerAngles); transform->Rotate_X(m_shakerAngles.X); transform->Rotate_Y(m_shakerAngles.Y); @@ -1046,7 +1046,7 @@ Bool W3DView::updateCameraMovements() m_previousLookAtPosition = *getPosition(); // TheSuperHackers @tweak The scripted camera movement is now decoupled from the render update. // The scripted camera will still move when the time is frozen, but not when the game is halted. - moveAlongWaypointPath(TheGameEngine->getLogicTimeStepMilliseconds(GameEngine::IgnoreFrozenTime)); + moveAlongWaypointPath(TheFramePacer->getLogicTimeStepMilliseconds(FramePacer::IgnoreFrozenTime)); didUpdate = true; } if (m_doingScriptedCameraLock) @@ -1355,7 +1355,7 @@ void W3DView::update(void) // if scrolling, only adjust if we're too close or too far if (m_scrollAmount.length() < m_scrollAmountCutoff || (m_currentHeightAboveGround < m_minHeightAboveGround) || (TheGlobalData->m_enforceMaxCameraHeight && m_currentHeightAboveGround > m_maxHeightAboveGround)) { - const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); + const Real fpsRatio = (Real)BaseFps / TheFramePacer->getUpdateFps(); const Real zoomAdj = (desiredZoom - m_zoom) * TheGlobalData->m_cameraAdjustSpeed * fpsRatio; if (fabs(zoomAdj) >= 0.0001f) // only do positive { @@ -1367,7 +1367,7 @@ void W3DView::update(void) else if (!didScriptedMovement) { // we're not scrolling; settle toward desired height above ground - const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); + const Real fpsRatio = (Real)BaseFps / TheFramePacer->getUpdateFps(); const Real zoomAdj = (m_zoom - desiredZoom) * TheGlobalData->m_cameraAdjustSpeed * fpsRatio; if (fabs(zoomAdj) >= 0.0001f) { diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp index e9599a7a256..9ef4271dcc0 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp @@ -49,7 +49,7 @@ #include "mesh.h" #include "matinfo.h" -#include "Common/GameEngine.h" +#include "Common/FramePacer.h" #include "Common/GameState.h" #include "Common/GlobalData.h" #include "Common/PerfTimer.h" @@ -1210,7 +1210,7 @@ void WaterRenderObjClass::enableWaterGrid(Bool state) void WaterRenderObjClass::update( void ) { // TheSuperHackers @tweak The water movement time step is now decoupled from the render update. - const Real timeScale = TheGameEngine->getActualLogicTimeScaleOverFpsRatio(); + const Real timeScale = TheFramePacer->getActualLogicTimeScaleOverFpsRatio(); { constexpr const Real MagicOffset = 0.0125f * 33 / 5000; ///< the work of top Munkees; do not question it diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp index 8169dbb7f75..98c2556fbfd 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp @@ -50,7 +50,7 @@ #include "GameClient/InGameUI.h" #include "GameClient/Water.h" #include "GameLogic/TerrainLogic.h" -#include "Common/GameEngine.h" +#include "Common/FramePacer.h" #include "Common/GlobalData.h" #include "Common/UnicodeString.h" #include "Common/file.h" @@ -296,7 +296,7 @@ Int WaterTracksObj::update(Int msElapsed) Int WaterTracksObj::render(DX8VertexBufferClass *vertexBuffer, Int batchStart) { // TheSuperHackers @tweak The wave movement time step is now decoupled from the render update. - m_elapsedMs += TheGameEngine->getLogicTimeStepMilliseconds(); + m_elapsedMs += TheFramePacer->getLogicTimeStepMilliseconds(); VertexFormatXYZDUV1 *vb; Vector2 waveTailOrigin,waveFrontOrigin; From c12bab6e2fa8862c25162cf0bb21965ce84da3bd Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 14 Oct 2025 18:33:48 +0200 Subject: [PATCH 166/343] bugfix(fps): Fix crashes and ww3d updates in tools (#1688) --- Core/GameEngine/Include/Common/FramePacer.h | 17 +++-- .../Include/Common/FrameRateLimit.h | 4 +- Core/GameEngine/Source/Common/FramePacer.cpp | 65 +++++++++++++------ .../Source/Common/FrameRateLimit.cpp | 14 ++-- .../Libraries/Source/WWVegas/WWLib/WWCommon.h | 3 +- Core/Tools/W3DView/GraphicView.cpp | 16 +++-- .../GameEngine/Source/Common/GameMain.cpp | 1 + .../Libraries/Source/WWVegas/WW3D2/ww3d.h | 1 + .../Code/Tools/GUIEdit/Source/EditWindow.cpp | 10 ++- .../Code/Tools/GUIEdit/Source/WinMain.cpp | 9 ++- .../Tools/WorldBuilder/src/WorldBuilder.cpp | 6 ++ .../Code/Tools/WorldBuilder/src/wbview3d.cpp | 10 ++- .../GameEngine/Source/Common/GameMain.cpp | 1 + .../Libraries/Source/WWVegas/WW3D2/ww3d.h | 1 + .../Code/Tools/GUIEdit/Source/EditWindow.cpp | 10 ++- .../Code/Tools/GUIEdit/Source/WinMain.cpp | 9 ++- .../Tools/WorldBuilder/src/WorldBuilder.cpp | 6 ++ .../Code/Tools/WorldBuilder/src/wbview3d.cpp | 10 ++- 18 files changed, 136 insertions(+), 57 deletions(-) diff --git a/Core/GameEngine/Include/Common/FramePacer.h b/Core/GameEngine/Include/Common/FramePacer.h index 95c76527362..66955c45858 100644 --- a/Core/GameEngine/Include/Common/FramePacer.h +++ b/Core/GameEngine/Include/Common/FramePacer.h @@ -20,6 +20,9 @@ #include "Common/FrameRateLimit.h" +// TheSuperHackers @todo Use unsigned integers for fps values +// TheSuperHackers @todo Consolidate the GlobalData::m_useFpsLimit and FramePacer::m_enableFpsLimit +// TheSuperHackers @todo Implement new fast forward in here class FramePacer { public: @@ -36,8 +39,13 @@ class FramePacer void update(); ///< Signal that the app/render update is done and wait for the fps limit if applicable. - void setFramesPerSecondLimit( Int fps ); ///< Set the max update fps. - Int getFramesPerSecondLimit() const; ///< Get the max update fps. + void setFramesPerSecondLimit( Int fps ); ///< Set the update fps limit. + Int getFramesPerSecondLimit() const; ///< Get the update fps limit. + void enableFramesPerSecondLimit( Bool enable ); ///< Enable or disable the update fps limit. + Bool isFramesPerSecondLimitEnabled() const; ///< Returns whether the fps limit is enabled here. + Bool isActualFramesPerSecondLimitEnabled() const; ///< Returns whether the fps limit is actually enabled when considering all game settings and setups. + Int getActualFramesPerSecondLimit() const; // Get the actual update fps limit. + Real getUpdateTime() const; ///< Get the last update delta time in seconds. Real getUpdateFps() const; ///< Get the last update fps. @@ -47,8 +55,8 @@ class FramePacer Bool isGameHalted() const; void setLogicTimeScaleFps( Int fps ); ///< Set the logic time scale fps and therefore scale the simulation time. Is capped by the max render fps and does not apply to network matches. - Int getLogicTimeScaleFps() const; ///< Get the raw logic time scale fps value. - void enableLogicTimeScale( Bool enable ); ///< Enable the logic time scale setup. If disabled, the simulation time scale is bound to the render frame time or network update time. + Int getLogicTimeScaleFps() const; ///< Get the raw logic time scale fps value. + void enableLogicTimeScale( Bool enable ); ///< Enable or disable the logic time scale setup. If disabled, the simulation time scale is bound to the render frame time or network update time. Bool isLogicTimeScaleEnabled() const; ///< Check whether the logic time scale setup is enabled. Int getActualLogicTimeScaleFps(LogicTimeQueryFlags flags = 0) const; ///< Get the real logic time scale fps, depending on the max render fps, network state and enabled state. Real getActualLogicTimeScaleRatio(LogicTimeQueryFlags flags = 0) const; ///< Get the real logic time scale ratio, depending on the max render fps, network state and enabled state. @@ -65,6 +73,7 @@ class FramePacer Real m_updateTime; ///< Last update delta time in seconds + Bool m_enableFpsLimit; Bool m_enableLogicTimeScale; Bool m_isTimeFrozen; Bool m_isGameHalted; diff --git a/Core/GameEngine/Include/Common/FrameRateLimit.h b/Core/GameEngine/Include/Common/FrameRateLimit.h index 3e3c80f0ea8..5bb2b5fd3a7 100644 --- a/Core/GameEngine/Include/Common/FrameRateLimit.h +++ b/Core/GameEngine/Include/Common/FrameRateLimit.h @@ -29,8 +29,8 @@ class FrameRateLimit Real wait(UnsignedInt maxFps); private: - LARGE_INTEGER m_freq; - LARGE_INTEGER m_start; + Int64 m_freq; + Int64 m_start; }; diff --git a/Core/GameEngine/Source/Common/FramePacer.cpp b/Core/GameEngine/Source/Common/FramePacer.cpp index 8bbc9e914f8..0f233899002 100644 --- a/Core/GameEngine/Source/Common/FramePacer.cpp +++ b/Core/GameEngine/Source/Common/FramePacer.cpp @@ -37,7 +37,8 @@ FramePacer::FramePacer() m_maxFPS = BaseFps; m_logicTimeScaleFPS = LOGICFRAMES_PER_SECOND; - m_updateTime = 1.0f / BaseFps; // initialized to something to avoid division by zero on first use + m_updateTime = 1.0f / (Real)BaseFps; // initialized to something to avoid division by zero on first use + m_enableFpsLimit = FALSE; m_enableLogicTimeScale = FALSE; m_isTimeFrozen = FALSE; m_isGameHalted = FALSE; @@ -51,25 +52,9 @@ FramePacer::~FramePacer() void FramePacer::update() { - Bool allowFpsLimit = TheTacticalView->getTimeMultiplier()<=1 && !TheScriptEngine->isTimeFast(); - - // I'm disabling this in debug because many people need alt-tab capability. If you happen to be - // doing performance tuning, please just change this on your local system. -MDC -#if defined(RTS_DEBUG) - if (allowFpsLimit) - ::Sleep(1); // give everyone else a tiny time slice. -#endif - -#if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) - allowFpsLimit &= !(!TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode); -#else //always allow this cheat key if we're in a replay game. - allowFpsLimit &= !(!TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame()); -#endif - // TheSuperHackers @bugfix xezon 05/08/2025 Re-implements the frame rate limiter // with higher resolution counters to cap the frame rate more accurately to the desired limit. - allowFpsLimit &= TheGlobalData->m_useFpsLimit; - const UnsignedInt maxFps = allowFpsLimit ? getFramesPerSecondLimit() : RenderFpsPreset::UncappedFpsValue; + const UnsignedInt maxFps = getActualFramesPerSecondLimit();// allowFpsLimit ? getFramesPerSecondLimit() : RenderFpsPreset::UncappedFpsValue; m_updateTime = m_frameRateLimit.wait(maxFps); } @@ -84,6 +69,45 @@ Int FramePacer::getFramesPerSecondLimit() const return m_maxFPS; } +void FramePacer::enableFramesPerSecondLimit( Bool enable ) +{ + m_enableFpsLimit = enable; +} + +Bool FramePacer::isFramesPerSecondLimitEnabled() const +{ + return m_enableFpsLimit; +} + +Bool FramePacer::isActualFramesPerSecondLimitEnabled() const +{ + Bool allowFpsLimit = true; + + if (TheTacticalView != NULL) + { + allowFpsLimit &= TheTacticalView->getTimeMultiplier()<=1 && !TheScriptEngine->isTimeFast(); + } + + if (TheGameLogic != NULL) + { +#if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) + allowFpsLimit &= !(!TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode); +#else //always allow this cheat key if we're in a replay game. + allowFpsLimit &= !(!TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame()); +#endif + } + + allowFpsLimit &= TheGlobalData->m_useFpsLimit; + allowFpsLimit &= isFramesPerSecondLimitEnabled(); + + return allowFpsLimit; +} + +Int FramePacer::getActualFramesPerSecondLimit() const +{ + return isActualFramesPerSecondLimitEnabled() ? getFramesPerSecondLimit() : RenderFpsPreset::UncappedFpsValue; +} + Real FramePacer::getUpdateTime() const { return m_updateTime; @@ -153,10 +177,11 @@ Int FramePacer::getActualLogicTimeScaleFps(LogicTimeQueryFlags flags) const if (isLogicTimeScaleEnabled()) { - return min(getLogicTimeScaleFps(), getFramesPerSecondLimit()); + return getLogicTimeScaleFps(); } - return getFramesPerSecondLimit(); + // Returns uncapped value to align with the render update as per the original game behavior. + return RenderFpsPreset::UncappedFpsValue; } Real FramePacer::getActualLogicTimeScaleRatio(LogicTimeQueryFlags flags) const diff --git a/Core/GameEngine/Source/Common/FrameRateLimit.cpp b/Core/GameEngine/Source/Common/FrameRateLimit.cpp index 5144f05403d..b8c7f1ff7a9 100644 --- a/Core/GameEngine/Source/Common/FrameRateLimit.cpp +++ b/Core/GameEngine/Source/Common/FrameRateLimit.cpp @@ -22,15 +22,19 @@ FrameRateLimit::FrameRateLimit() { - QueryPerformanceFrequency(&m_freq); - QueryPerformanceCounter(&m_start); + LARGE_INTEGER freq; + LARGE_INTEGER start; + QueryPerformanceFrequency(&freq); + QueryPerformanceCounter(&start); + m_freq = freq.QuadPart; + m_start = start.QuadPart; } Real FrameRateLimit::wait(UnsignedInt maxFps) { LARGE_INTEGER tick; QueryPerformanceCounter(&tick); - double elapsedSeconds = static_cast(tick.QuadPart - m_start.QuadPart) / m_freq.QuadPart; + double elapsedSeconds = static_cast(tick.QuadPart - m_start) / m_freq; const double targetSeconds = 1.0 / maxFps; const double sleepSeconds = targetSeconds - elapsedSeconds - 0.002; // leave ~2ms for spin wait @@ -45,11 +49,11 @@ Real FrameRateLimit::wait(UnsignedInt maxFps) do { QueryPerformanceCounter(&tick); - elapsedSeconds = static_cast(tick.QuadPart - m_start.QuadPart) / m_freq.QuadPart; + elapsedSeconds = static_cast(tick.QuadPart - m_start) / m_freq; } while (elapsedSeconds < targetSeconds); - m_start = tick; + m_start = tick.QuadPart; return (Real)elapsedSeconds; } diff --git a/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h b/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h index 77c231a6d5c..1f59b884492 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h +++ b/Core/Libraries/Source/WWVegas/WWLib/WWCommon.h @@ -31,7 +31,8 @@ enum { // TheSuperHackers @info The original WWSync was 33 ms, ~30 fps, integer. // Changing this will require tweaking all Drawable code that concerns the ww3d time step, including locomotion physics. - WWSyncPerSecond = 30 + WWSyncPerSecond = 30, + WWSyncMilliseconds = 1000 / WWSyncPerSecond, }; #if defined(_MSC_VER) && _MSC_VER < 1300 diff --git a/Core/Tools/W3DView/GraphicView.cpp b/Core/Tools/W3DView/GraphicView.cpp index 185c4465c6e..bb31526a1d0 100644 --- a/Core/Tools/W3DView/GraphicView.cpp +++ b/Core/Tools/W3DView/GraphicView.cpp @@ -436,7 +436,8 @@ CGraphicView::RepaintView // Simple check to avoid re-entrance // static bool _already_painting = false; - if (_already_painting) return; + if (_already_painting) + return; _already_painting = true; // @@ -452,10 +453,15 @@ CGraphicView::RepaintView m_dwLastFrameUpdate = cur_ticks; // Update the W3D frame times according to our elapsed tick count - if (ticks_to_use == 0) { - WW3D::Sync (WW3D::Get_Sync_Time() + (ticks_elapsed * m_animationSpeed)); - } else { - WW3D::Sync (WW3D::Get_Sync_Time() + ticks_to_use); + if (ticks_to_use == 0) + { + WW3D::Update_Logic_Frame_Time(ticks_elapsed * m_animationSpeed); + WW3D::Sync(WW3D::Get_Fractional_Sync_Milliseconds() >= WWSyncMilliseconds); + } + else + { + WW3D::Update_Logic_Frame_Time(ticks_to_use); + WW3D::Sync(true); } // Do we need to update the current animation? diff --git a/Generals/Code/GameEngine/Source/Common/GameMain.cpp b/Generals/Code/GameEngine/Source/Common/GameMain.cpp index 6255d6384c0..870829597bc 100644 --- a/Generals/Code/GameEngine/Source/Common/GameMain.cpp +++ b/Generals/Code/GameEngine/Source/Common/GameMain.cpp @@ -41,6 +41,7 @@ Int GameMain() int exitcode = 0; // initialize the game engine using factory function TheFramePacer = new FramePacer(); + TheFramePacer->enableFramesPerSecondLimit(TRUE); TheGameEngine = CreateGameEngine(); TheGameEngine->init(); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h index 4cb8c5bf9bd..47069d614c2 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h @@ -173,6 +173,7 @@ class WW3D static void Sync(bool step); static unsigned int Get_Sync_Time(void) { return SyncTime; } static unsigned int Get_Sync_Frame_Time(void) { return SyncTime - PreviousSyncTime; } + static unsigned int Get_Fractional_Sync_Milliseconds() { return FractionalSyncMs; } static float Get_Logic_Frame_Time_Milliseconds() { return LogicFrameTimeMs; } static float Get_Logic_Frame_Time_Seconds() { return LogicFrameTimeMs * 0.001f; } static unsigned int Get_Frame_Count(void) { return FrameCount; } diff --git a/Generals/Code/Tools/GUIEdit/Source/EditWindow.cpp b/Generals/Code/Tools/GUIEdit/Source/EditWindow.cpp index 3b8c95eb684..08eec4d1a3f 100644 --- a/Generals/Code/Tools/GUIEdit/Source/EditWindow.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/EditWindow.cpp @@ -49,6 +49,7 @@ // USER INCLUDES ////////////////////////////////////////////////////////////// #include "Common/Debug.h" +#include "Common/FramePacer.h" #include "GameClient/Display.h" #include "GameClient/GameWindowManager.h" #include "W3DDevice/GameClient/W3DFileSystem.h" @@ -1456,13 +1457,9 @@ void EditWindow::drawGrid( void ) //============================================================================= void EditWindow::draw( void ) { - static UnsignedInt syncTime = 0; - // allow W3D to update its internals - WW3D::Sync( syncTime ); - - // for now, use constant time steps to avoid animations running independent of framerate - syncTime += 50; + WW3D::Update_Logic_Frame_Time(TheFramePacer->getLogicTimeStepMilliseconds()); + WW3D::Sync(WW3D::Get_Fractional_Sync_Milliseconds() >= WWSyncMilliseconds); // start render block WW3D::Begin_Render( true, true, Vector3( m_backgroundColor.red, @@ -1479,6 +1476,7 @@ void EditWindow::draw( void ) // render is all done! WW3D::End_Render(); + TheFramePacer->update(); } // EditWindow::setSize ======================================================== diff --git a/Generals/Code/Tools/GUIEdit/Source/WinMain.cpp b/Generals/Code/Tools/GUIEdit/Source/WinMain.cpp index 1d692600e36..9cfb49d2047 100644 --- a/Generals/Code/Tools/GUIEdit/Source/WinMain.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/WinMain.cpp @@ -50,8 +50,8 @@ // USER INCLUDES ////////////////////////////////////////////////////////////// #include "Common/Debug.h" +#include "Common/FramePacer.h" #include "Common/GameMemory.h" -#include "Common/GameEngine.h" #include "GameClient/GameWindowManager.h" #include "Win32Device/GameClient/Win32Mouse.h" #include "resource.h" @@ -224,6 +224,8 @@ Int APIENTRY WinMain(HINSTANCE hInstance, return FALSE; TheEditor->init(); + TheFramePacer = new FramePacer(); + // // see if we have any messages to process, a NULL window handle tells the // OS to look at the main window associated with the calling thread, us! @@ -262,7 +264,7 @@ Int APIENTRY WinMain(HINSTANCE hInstance, else { - // udpate our universe + // update our universe TheEditor->update(); Sleep(1); @@ -271,6 +273,9 @@ Int APIENTRY WinMain(HINSTANCE hInstance, } // shutdown GUIEdit data + delete TheFramePacer; + TheFramePacer = NULL; + delete TheEditor; TheEditor = NULL; diff --git a/Generals/Code/Tools/WorldBuilder/src/WorldBuilder.cpp b/Generals/Code/Tools/WorldBuilder/src/WorldBuilder.cpp index bf4afd9aa64..9d440098c87 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WorldBuilder.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WorldBuilder.cpp @@ -33,6 +33,7 @@ //#include #include "W3DDevice/GameClient/W3DFileSystem.h" +#include "Common/FramePacer.h" #include "Common/GlobalData.h" #include "WHeightMapEdit.h" //#include "Common/GameFileSystem.h" @@ -338,6 +339,8 @@ BOOL CWorldBuilderApp::InitInstance() initSubsystem(TheWritableGlobalData, new GlobalData(), "Data\\INI\\Default\\GameData", "Data\\INI\\GameData"); + TheFramePacer = new FramePacer(); + #if defined(RTS_DEBUG) ini.loadFileDirectory( AsciiString( "Data\\INI\\GameDataDebug" ), INI_LOAD_MULTIFILE, NULL ); #endif @@ -634,6 +637,9 @@ int CWorldBuilderApp::ExitInstance() WorldHeightMapEdit::shutdown(); + delete TheFramePacer; + TheFramePacer = NULL; + delete TheFileSystem; TheFileSystem = NULL; TextureLoadTaskClass::shutdown(); diff --git a/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp b/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp index 2b077964489..1bb3ce444e8 100644 --- a/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -31,7 +31,6 @@ #include "W3DDevice/GameClient/Module/W3DModelDraw.h" #include "agg_def.h" #include "part_ldr.h" -#include "rendobj.h" #include "hanim.h" #include "dx8wrapper.h" #include "dx8indexbuffer.h" @@ -78,6 +77,7 @@ #include "WorldBuilder.h" #include "wbview3d.h" #include "Common/Debug.h" +#include "Common/FramePacer.h" #include "Common/ThingFactory.h" #include "GameClient/Water.h" #include "Common/WellKnownKeys.h" @@ -1981,12 +1981,18 @@ void WbView3d::redraw(void) m_showPolygonTriggers || PolygonTool::isActive()); } - WW3D::Sync( GetTickCount() ); + WW3D::Update_Logic_Frame_Time(TheFramePacer->getLogicTimeStepMilliseconds()); + WW3D::Sync(WW3D::Get_Fractional_Sync_Milliseconds() >= WWSyncMilliseconds); + m_buildRedMultiplier += (GetTickCount()-m_time)/500.0f; if (m_buildRedMultiplier>4.0f || m_buildRedMultiplier<0) { m_buildRedMultiplier = 0; } + render(); + + TheFramePacer->update(); + m_time = ::GetTickCount(); } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameMain.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameMain.cpp index 76cfecef5d9..7c72fc4e1e8 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GameMain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GameMain.cpp @@ -41,6 +41,7 @@ Int GameMain() int exitcode = 0; // initialize the game engine using factory function TheFramePacer = new FramePacer(); + TheFramePacer->enableFramesPerSecondLimit(TRUE); TheGameEngine = CreateGameEngine(); TheGameEngine->init(); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h index 0057dbf9891..5e8c5a9fc24 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h @@ -173,6 +173,7 @@ class WW3D static void Sync(bool step); static unsigned int Get_Sync_Time(void) { return SyncTime; } static unsigned int Get_Sync_Frame_Time(void) { return SyncTime - PreviousSyncTime; } + static unsigned int Get_Fractional_Sync_Milliseconds() { return FractionalSyncMs; } static float Get_Logic_Frame_Time_Milliseconds() { return LogicFrameTimeMs; } static float Get_Logic_Frame_Time_Seconds() { return LogicFrameTimeMs * 0.001f; } static unsigned int Get_Frame_Count(void) { return FrameCount; } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp index b53ed8a602c..9c577027cc9 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp @@ -49,6 +49,7 @@ // USER INCLUDES ////////////////////////////////////////////////////////////// #include "Common/Debug.h" +#include "Common/FramePacer.h" #include "GameClient/Display.h" #include "GameClient/GameWindowManager.h" #include "W3DDevice/GameClient/W3DFileSystem.h" @@ -1470,13 +1471,9 @@ void EditWindow::drawGrid( void ) //============================================================================= void EditWindow::draw( void ) { - static UnsignedInt syncTime = 0; - // allow W3D to update its internals - WW3D::Sync( syncTime ); - - // for now, use constant time steps to avoid animations running independent of framerate - syncTime += 50; + WW3D::Update_Logic_Frame_Time(TheFramePacer->getLogicTimeStepMilliseconds()); + WW3D::Sync(WW3D::Get_Fractional_Sync_Milliseconds() >= WWSyncMilliseconds); // start render block WW3D::Begin_Render( true, true, Vector3( m_backgroundColor.red, @@ -1493,6 +1490,7 @@ void EditWindow::draw( void ) // render is all done! WW3D::End_Render(); + TheFramePacer->update(); } // EditWindow::setSize ======================================================== diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/WinMain.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/WinMain.cpp index 4a1a529a61b..b6b4375057f 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/WinMain.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/WinMain.cpp @@ -50,8 +50,8 @@ // USER INCLUDES ////////////////////////////////////////////////////////////// #include "Common/Debug.h" +#include "Common/FramePacer.h" #include "Common/GameMemory.h" -#include "Common/GameEngine.h" #include "GameClient/GameWindowManager.h" #include "Win32Device/GameClient/Win32Mouse.h" #include "resource.h" @@ -224,6 +224,8 @@ Int APIENTRY WinMain(HINSTANCE hInstance, return FALSE; TheEditor->init(); + TheFramePacer = new FramePacer(); + // // see if we have any messages to process, a NULL window handle tells the // OS to look at the main window associated with the calling thread, us! @@ -262,7 +264,7 @@ Int APIENTRY WinMain(HINSTANCE hInstance, else { - // udpate our universe + // update our universe TheEditor->update(); Sleep(1); @@ -271,6 +273,9 @@ Int APIENTRY WinMain(HINSTANCE hInstance, } // shutdown GUIEdit data + delete TheFramePacer; + TheFramePacer = NULL; + delete TheEditor; TheEditor = NULL; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilder.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilder.cpp index 2225c6f9a24..dead6bdcc3a 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilder.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilder.cpp @@ -33,6 +33,7 @@ //#include #include "W3DDevice/GameClient/W3DFileSystem.h" +#include "Common/FramePacer.h" #include "Common/GlobalData.h" #include "WHeightMapEdit.h" //#include "Common/GameFileSystem.h" @@ -350,6 +351,8 @@ BOOL CWorldBuilderApp::InitInstance() initSubsystem(TheWritableGlobalData, new GlobalData(), "Data\\INI\\Default\\GameData", "Data\\INI\\GameData"); + TheFramePacer = new FramePacer(); + #if defined(RTS_DEBUG) ini.loadFileDirectory( AsciiString( "Data\\INI\\GameDataDebug" ), INI_LOAD_MULTIFILE, NULL ); #endif @@ -654,6 +657,9 @@ int CWorldBuilderApp::ExitInstance() WorldHeightMapEdit::shutdown(); + delete TheFramePacer; + TheFramePacer = NULL; + delete TheFileSystem; TheFileSystem = NULL; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp index df6af034c59..751e1d830dc 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -31,7 +31,6 @@ #include "W3DDevice/GameClient/Module/W3DModelDraw.h" #include "agg_def.h" #include "part_ldr.h" -#include "rendobj.h" #include "hanim.h" #include "dx8wrapper.h" #include "dx8indexbuffer.h" @@ -78,6 +77,7 @@ #include "WorldBuilder.h" #include "wbview3d.h" #include "Common/Debug.h" +#include "Common/FramePacer.h" #include "Common/ThingFactory.h" #include "GameClient/Water.h" #include "Common/WellKnownKeys.h" @@ -2058,12 +2058,18 @@ void WbView3d::redraw(void) m_showBoundingBoxes, m_showSightRanges, m_showWeaponRanges, m_showSoundCircles, m_highlightTestArt, m_showLetterbox); } - WW3D::Sync( GetTickCount() ); + WW3D::Update_Logic_Frame_Time(TheFramePacer->getLogicTimeStepMilliseconds()); + WW3D::Sync(WW3D::Get_Fractional_Sync_Milliseconds() >= WWSyncMilliseconds); + m_buildRedMultiplier += (GetTickCount()-m_time)/500.0f; if (m_buildRedMultiplier>4.0f || m_buildRedMultiplier<0) { m_buildRedMultiplier = 0; } + render(); + + TheFramePacer->update(); + m_time = ::GetTickCount(); } From affa598037488f05347233f377026fe0564c9bb9 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Thu, 16 Oct 2025 03:22:01 +1100 Subject: [PATCH 167/343] refactor(gui): Remove duplicate code in score screen (#1699) --- .../GUI/GUICallbacks/Menus/ScoreScreen.cpp | 21 ------------------- .../GUI/GUICallbacks/Menus/ScoreScreen.cpp | 21 ------------------- 2 files changed, 42 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp index 69fac1c8305..0c023439390 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp @@ -1265,15 +1265,6 @@ void populatePlayerInfo( Player *player, Int pos) win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor()); win->winHide(FALSE); - // set the total BuildingsDestroyed - winName.format("ScoreScreen.wnd:StaticTextBuildingsDestroyed%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); - DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); - winValue.format(L"%d", scoreKpr->getTotalBuildingsDestroyed()); - GadgetStaticTextSetText(win, winValue); - win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor()); - win->winHide(FALSE); - // set the total Resources winName.format("ScoreScreen.wnd:StaticTextResources%d", pos); win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); @@ -2035,12 +2026,6 @@ void hideWindows( Int pos ) DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); - // set the total BuildingsDestroyed - winName.format("ScoreScreen.wnd:StaticTextBuildingsDestroyed%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); - DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); - win->winHide(TRUE); - // set the total Resources winName.format("ScoreScreen.wnd:StaticTextResources%d", i); win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); @@ -2133,12 +2118,6 @@ void setObserverWindows( Player *player, Int i ) DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); - // set the total BuildingsDestroyed - winName.format("ScoreScreen.wnd:StaticTextBuildingsDestroyed%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); - DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); - win->winHide(TRUE); - // set the total Resources winName.format("ScoreScreen.wnd:StaticTextResources%d", i); win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp index 7d824b2daec..d7d4c1db4e8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp @@ -1499,15 +1499,6 @@ void populatePlayerInfo( Player *player, Int pos) win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor()); win->winHide(FALSE); - // set the total BuildingsDestroyed - winName.format("ScoreScreen.wnd:StaticTextBuildingsDestroyed%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); - DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); - winValue.format(L"%d", scoreKpr->getTotalBuildingsDestroyed()); - GadgetStaticTextSetText(win, winValue); - win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor()); - win->winHide(FALSE); - // set the total Resources winName.format("ScoreScreen.wnd:StaticTextResources%d", pos); win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); @@ -2303,12 +2294,6 @@ void hideWindows( Int pos ) DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); - // set the total BuildingsDestroyed - winName.format("ScoreScreen.wnd:StaticTextBuildingsDestroyed%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); - DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); - win->winHide(TRUE); - // set the total Resources winName.format("ScoreScreen.wnd:StaticTextResources%d", i); win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); @@ -2401,12 +2386,6 @@ void setObserverWindows( Player *player, Int i ) DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); - // set the total BuildingsDestroyed - winName.format("ScoreScreen.wnd:StaticTextBuildingsDestroyed%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); - DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); - win->winHide(TRUE); - // set the total Resources winName.format("ScoreScreen.wnd:StaticTextResources%d", i); win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); From 1e37075c131a6f2e7b931ecb3274313c82045e47 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Mon, 13 Oct 2025 22:00:17 +0200 Subject: [PATCH 168/343] refactor(lan): Simplify LAN player tooltip related code (#1693) --- .../Include/GameNetwork/LANAPICallbacks.h | 2 +- .../GUICallbacks/Menus/LanGameOptionsMenu.cpp | 24 ++++++++++++------- .../GUI/GUICallbacks/Menus/LanLobbyMenu.cpp | 10 ++------ .../GameEngine/Source/GameNetwork/LANAPI.cpp | 22 ++++++++++------- .../Include/GameNetwork/LANAPICallbacks.h | 2 +- .../GUICallbacks/Menus/LanGameOptionsMenu.cpp | 24 ++++++++++++------- .../GUI/GUICallbacks/Menus/LanLobbyMenu.cpp | 10 ++------ .../GameEngine/Source/GameNetwork/LANAPI.cpp | 22 ++++++++++------- 8 files changed, 66 insertions(+), 50 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameNetwork/LANAPICallbacks.h b/Generals/Code/GameEngine/Include/GameNetwork/LANAPICallbacks.h index 315ee7b2271..15e492f3bb8 100644 --- a/Generals/Code/GameEngine/Include/GameNetwork/LANAPICallbacks.h +++ b/Generals/Code/GameEngine/Include/GameNetwork/LANAPICallbacks.h @@ -74,7 +74,7 @@ extern const Color acceptFalseColor; void lanUpdateSlotList( void ); void updateGameOptions( void ); - +void setLANPlayerTooltip(LANPlayer* player); //Enum is used for the utility function so other windows do not need //to know about controls on LanGameOptions window. 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 46ccea00325..f5bdf172df5 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp @@ -214,15 +214,8 @@ static void playerTooltip(GameWindow *window, TheMouse->setCursorTooltip( UnicodeString::TheEmptyString ); return; } - UnicodeString tooltip; - tooltip.format(TheGameText->fetch("TOOLTIP:LANPlayer"), player->getLogin().str(), player->getHost().str()); -#if defined(RTS_DEBUG) - UnicodeString ip; - ip.format(L" - %d.%d.%d.%d", PRINTF_IP_AS_4_INTS(player->getIP())); - tooltip.concat(ip); -#endif - TheMouse->setCursorTooltip( tooltip ); + setLANPlayerTooltip(player); } void StartPressed(void) @@ -903,6 +896,21 @@ void updateGameOptions( void ) } +//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------------------------- +void setLANPlayerTooltip(LANPlayer* player) +{ + UnicodeString tooltip; + tooltip.format(TheGameText->fetch("TOOLTIP:LANPlayer"), player->getLogin().str(), player->getHost().str()); +#if defined(RTS_DEBUG) + UnicodeString ip; + ip.format(L" - %d.%d.%d.%d", PRINTF_IP_AS_4_INTS(player->getIP())); + tooltip.concat(ip); +#endif + TheMouse->setCursorTooltip( tooltip ); + +} + //------------------------------------------------------------------------------------------------- /** This is called when a shutdown is complete for this menu */ diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp index 28489122cf7..50153090836 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp @@ -310,14 +310,8 @@ static void playerTooltip(GameWindow *window, //TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:LobbyPlayers") ); return; } - UnicodeString tooltip; - tooltip.format(TheGameText->fetch("TOOLTIP:LANPlayer"), player->getLogin().str(), player->getHost().str()); -#if defined(RTS_DEBUG) - UnicodeString ip; - ip.format(L" - %d.%d.%d.%d", PRINTF_IP_AS_4_INTS(player->getIP())); - tooltip.concat(ip); -#endif - TheMouse->setCursorTooltip( tooltip ); + + setLANPlayerTooltip(player); } diff --git a/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp b/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp index 89a53cd1b63..dea225b29b4 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp @@ -112,21 +112,27 @@ void LANAPI::init( void ) m_lastGameopt = ""; - unsigned long bufSize = UNLEN + 1; char userName[UNLEN + 1]; - if (!GetUserName(userName, &bufSize)) + DWORD bufSize = ARRAY_SIZE(userName); + if (GetUserNameA(userName, &bufSize)) { - strcpy(userName, "unknown"); + m_userName.set(userName, bufSize); + } + else + { + m_userName = "unknown"; } - m_userName = userName; - bufSize = MAX_COMPUTERNAME_LENGTH + 1; char computerName[MAX_COMPUTERNAME_LENGTH + 1]; - if (!GetComputerName(computerName, &bufSize)) + bufSize = ARRAY_SIZE(computerName); + if (GetComputerNameA(computerName, &bufSize)) + { + m_hostName.set(computerName, bufSize); + } + else { - strcpy(computerName, "unknown"); + m_hostName = "unknown"; } - m_hostName = computerName; } void LANAPI::reset( void ) diff --git a/GeneralsMD/Code/GameEngine/Include/GameNetwork/LANAPICallbacks.h b/GeneralsMD/Code/GameEngine/Include/GameNetwork/LANAPICallbacks.h index ef31229a2df..8f4a726ce3a 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameNetwork/LANAPICallbacks.h +++ b/GeneralsMD/Code/GameEngine/Include/GameNetwork/LANAPICallbacks.h @@ -74,7 +74,7 @@ extern const Color acceptFalseColor; void lanUpdateSlotList( void ); void updateGameOptions( void ); - +void setLANPlayerTooltip(LANPlayer* player); //Enum is used for the utility function so other windows do not need //to know about controls on LanGameOptions window. 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 d686c7130e7..8e9f9e6f78b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp @@ -221,15 +221,8 @@ static void playerTooltip(GameWindow *window, TheMouse->setCursorTooltip( UnicodeString::TheEmptyString ); return; } - UnicodeString tooltip; - tooltip.format(TheGameText->fetch("TOOLTIP:LANPlayer"), player->getLogin().str(), player->getHost().str()); -#if defined(RTS_DEBUG) - UnicodeString ip; - ip.format(L" - %d.%d.%d.%d", PRINTF_IP_AS_4_INTS(player->getIP())); - tooltip.concat(ip); -#endif - TheMouse->setCursorTooltip( tooltip ); + setLANPlayerTooltip(player); } void StartPressed(void) @@ -998,6 +991,21 @@ void updateGameOptions( void ) } +//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------------------------- +void setLANPlayerTooltip(LANPlayer* player) +{ + UnicodeString tooltip; + tooltip.format(TheGameText->fetch("TOOLTIP:LANPlayer"), player->getLogin().str(), player->getHost().str()); +#if defined(RTS_DEBUG) + UnicodeString ip; + ip.format(L" - %d.%d.%d.%d", PRINTF_IP_AS_4_INTS(player->getIP())); + tooltip.concat(ip); +#endif + TheMouse->setCursorTooltip( tooltip ); + +} + //------------------------------------------------------------------------------------------------- /** This is called when a shutdown is complete for this menu */ diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp index 59a4d7a7862..1f1a8e2b05d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp @@ -352,14 +352,8 @@ static void playerTooltip(GameWindow *window, //TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:LobbyPlayers") ); return; } - UnicodeString tooltip; - tooltip.format(TheGameText->fetch("TOOLTIP:LANPlayer"), player->getLogin().str(), player->getHost().str()); -#if defined(RTS_DEBUG) - UnicodeString ip; - ip.format(L" - %d.%d.%d.%d", PRINTF_IP_AS_4_INTS(player->getIP())); - tooltip.concat(ip); -#endif - TheMouse->setCursorTooltip( tooltip ); + + setLANPlayerTooltip(player); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp index e10a45aa26d..cc7be676654 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp @@ -112,21 +112,27 @@ void LANAPI::init( void ) m_lastGameopt = ""; - unsigned long bufSize = UNLEN + 1; char userName[UNLEN + 1]; - if (!GetUserName(userName, &bufSize)) + DWORD bufSize = ARRAY_SIZE(userName); + if (GetUserNameA(userName, &bufSize)) { - strcpy(userName, "unknown"); + m_userName.set(userName, bufSize); + } + else + { + m_userName = "unknown"; } - m_userName = userName; - bufSize = MAX_COMPUTERNAME_LENGTH + 1; char computerName[MAX_COMPUTERNAME_LENGTH + 1]; - if (!GetComputerName(computerName, &bufSize)) + bufSize = ARRAY_SIZE(computerName); + if (GetComputerNameA(computerName, &bufSize)) + { + m_hostName.set(computerName, bufSize); + } + else { - strcpy(computerName, "unknown"); + m_hostName = "unknown"; } - m_hostName = computerName; } void LANAPI::reset( void ) From 9ede47fd0e11d427bfc5f6b534560cf0aa017bc8 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Mon, 13 Oct 2025 22:11:48 +0200 Subject: [PATCH 169/343] tweak(lan): Hide computer identity in LAN lobby (#1693) --- Core/GameEngine/Include/Common/GameDefines.h | 8 ++++++++ .../GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp | 12 ++++++++++-- .../Code/GameEngine/Source/GameNetwork/LANAPI.cpp | 4 ++++ .../GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp | 12 ++++++++++-- .../Code/GameEngine/Source/GameNetwork/LANAPI.cpp | 4 ++++ 5 files changed, 36 insertions(+), 4 deletions(-) diff --git a/Core/GameEngine/Include/Common/GameDefines.h b/Core/GameEngine/Include/Common/GameDefines.h index 02229cfc8e5..189e5b07a34 100644 --- a/Core/GameEngine/Include/Common/GameDefines.h +++ b/Core/GameEngine/Include/Common/GameDefines.h @@ -86,6 +86,14 @@ #define ENABLE_GUI_HACKS (1) #endif +// Tell our computer identity in the LAN lobby. Disable for privacy. +// Was enabled in the retail game and exposed the computer login and host names. +#ifdef RTS_DEBUG +#ifndef TELL_COMPUTER_IDENTITY_IN_LAN_LOBBY +#define TELL_COMPUTER_IDENTITY_IN_LAN_LOBBY (1) +#endif +#endif + #define MIN_DISPLAY_BIT_DEPTH 16 #define DEFAULT_DISPLAY_BIT_DEPTH 32 #define DEFAULT_DISPLAY_WIDTH 800 // The standard resolution this game was designed for 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 f5bdf172df5..b72c8334295 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp @@ -901,14 +901,22 @@ void updateGameOptions( void ) void setLANPlayerTooltip(LANPlayer* player) { UnicodeString tooltip; - tooltip.format(TheGameText->fetch("TOOLTIP:LANPlayer"), player->getLogin().str(), player->getHost().str()); + + if (!player->getLogin().isEmpty() || !player->getHost().isEmpty()) + { + tooltip.format(TheGameText->fetch("TOOLTIP:LANPlayer"), player->getLogin().str(), player->getHost().str()); + } + #if defined(RTS_DEBUG) UnicodeString ip; ip.format(L" - %d.%d.%d.%d", PRINTF_IP_AS_4_INTS(player->getIP())); tooltip.concat(ip); #endif - TheMouse->setCursorTooltip( tooltip ); + if (!tooltip.isEmpty()) + { + TheMouse->setCursorTooltip( tooltip ); + } } diff --git a/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp b/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp index dea225b29b4..5feff8444e5 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp @@ -112,6 +112,7 @@ void LANAPI::init( void ) m_lastGameopt = ""; +#if TELL_COMPUTER_IDENTITY_IN_LAN_LOBBY char userName[UNLEN + 1]; DWORD bufSize = ARRAY_SIZE(userName); if (GetUserNameA(userName, &bufSize)) @@ -133,6 +134,7 @@ void LANAPI::init( void ) { m_hostName = "unknown"; } +#endif } void LANAPI::reset( void ) @@ -451,11 +453,13 @@ void LANAPI::update( void ) } else { +#if TELL_COMPUTER_IDENTITY_IN_LAN_LOBBY AsciiString text; text.format("User=%s", m_userName.str()); RequestGameOptions( text, true ); text.format("Host=%s", m_hostName.str()); RequestGameOptions( text, true ); +#endif RequestGameOptions( "HELLO", false ); } } 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 8e9f9e6f78b..8e34a81e019 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp @@ -996,14 +996,22 @@ void updateGameOptions( void ) void setLANPlayerTooltip(LANPlayer* player) { UnicodeString tooltip; - tooltip.format(TheGameText->fetch("TOOLTIP:LANPlayer"), player->getLogin().str(), player->getHost().str()); + + if (!player->getLogin().isEmpty() || !player->getHost().isEmpty()) + { + tooltip.format(TheGameText->fetch("TOOLTIP:LANPlayer"), player->getLogin().str(), player->getHost().str()); + } + #if defined(RTS_DEBUG) UnicodeString ip; ip.format(L" - %d.%d.%d.%d", PRINTF_IP_AS_4_INTS(player->getIP())); tooltip.concat(ip); #endif - TheMouse->setCursorTooltip( tooltip ); + if (!tooltip.isEmpty()) + { + TheMouse->setCursorTooltip( tooltip ); + } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp index cc7be676654..87027fe46d1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp @@ -112,6 +112,7 @@ void LANAPI::init( void ) m_lastGameopt = ""; +#if TELL_COMPUTER_IDENTITY_IN_LAN_LOBBY char userName[UNLEN + 1]; DWORD bufSize = ARRAY_SIZE(userName); if (GetUserNameA(userName, &bufSize)) @@ -133,6 +134,7 @@ void LANAPI::init( void ) { m_hostName = "unknown"; } +#endif } void LANAPI::reset( void ) @@ -451,11 +453,13 @@ void LANAPI::update( void ) } else { +#if TELL_COMPUTER_IDENTITY_IN_LAN_LOBBY AsciiString text; text.format("User=%s", m_userName.str()); RequestGameOptions( text, true ); text.format("Host=%s", m_hostName.str()); RequestGameOptions( text, true ); +#endif RequestGameOptions( "HELLO", false ); } } From 630f6df1f5d21f5ad1fbf2a85fcf7f09a882e36b Mon Sep 17 00:00:00 2001 From: SkyAero <21192585+Skyaero42@users.noreply.github.com> Date: Wed, 15 Oct 2025 19:43:28 +0200 Subject: [PATCH 170/343] fix: Replace strncpy with strlcpy for robustness (#1533) --- .../Source/WWVegas/WW3D2/collect.cpp | 2 +- .../Libraries/Source/WWVegas/WW3D2/hcanim.cpp | 2 +- .../Source/WWVegas/WW3D2/hmdldef.cpp | 6 +-- .../Source/WWVegas/WW3D2/w3d_dep.cpp | 4 +- .../Source/WWVegas/WWDownload/Download.cpp | 18 +++---- .../Source/WWVegas/WWDownload/FTP.CPP | 12 ++--- Core/Libraries/Source/WWVegas/WWLib/TARGA.CPP | 4 +- .../Source/WWVegas/WWLib/cpudetect.cpp | 2 +- Core/Libraries/Source/WWVegas/WWLib/ini.cpp | 6 +-- Core/Libraries/Source/debug/CMakeLists.txt | 1 + Core/Libraries/Source/debug/debug_debug.cpp | 10 ++-- Core/Libraries/Source/debug/debug_io_flat.cpp | 11 ++--- Core/Libraries/Source/debug/debug_stack.cpp | 10 ++-- Core/Libraries/Source/profile/CMakeLists.txt | 1 + .../Source/profile/profile_highlevel.cpp | 6 +-- Core/Tools/ImagePacker/Source/ImagePacker.cpp | 4 +- .../GameEngine/Source/Common/Recorder.cpp | 2 +- .../Source/Common/Thing/ThingTemplate.cpp | 2 +- .../GUICallbacks/Menus/WOLQuickMatchMenu.cpp | 3 +- .../GameEngine/Source/GameClient/MapUtil.cpp | 6 +-- .../GameSpy/Thread/BuddyThread.cpp | 3 +- .../GameEngine/Source/GameNetwork/LANAPI.cpp | 13 ++--- .../Source/GameNetwork/LANAPIhandlers.cpp | 4 +- .../GameClient/Shadow/W3DProjectedShadow.cpp | 49 +++++++++---------- .../GameClient/Shadow/W3DVolumetricShadow.cpp | 4 +- .../W3DDevice/GameClient/W3DFileSystem.cpp | 2 +- .../W3DDevice/GameLogic/W3DTerrainLogic.cpp | 3 +- .../Source/WWVegas/WW3D2/ddsfile.cpp | 2 +- .../Source/WWVegas/WW3D2/dx8wrapper.cpp | 3 +- .../Libraries/Source/WWVegas/WW3D2/hlod.cpp | 2 +- .../Source/WWVegas/WW3D2/hmorphanim.cpp | 12 ++--- .../Source/WWVegas/WW3D2/hrawanim.cpp | 2 +- .../Source/WWVegas/WW3D2/meshmdlio.cpp | 6 +-- .../Tools/WorldBuilder/src/BlendMaterial.cpp | 2 +- .../WorldBuilder/src/TerrainMaterial.cpp | 2 +- .../Tools/WorldBuilder/src/TerrainModal.cpp | 2 +- .../GameEngine/Source/Common/Recorder.cpp | 2 +- .../Source/Common/Thing/ThingTemplate.cpp | 2 +- .../GUICallbacks/Menus/WOLQuickMatchMenu.cpp | 3 +- .../GameEngine/Source/GameClient/MapUtil.cpp | 6 +-- .../GameSpy/Thread/BuddyThread.cpp | 3 +- .../GameEngine/Source/GameNetwork/LANAPI.cpp | 14 ++---- .../Source/GameNetwork/LANAPIhandlers.cpp | 4 +- .../GameClient/Shadow/W3DProjectedShadow.cpp | 49 +++++++++---------- .../GameClient/Shadow/W3DVolumetricShadow.cpp | 4 +- .../W3DDevice/GameClient/W3DFileSystem.cpp | 2 +- .../W3DDevice/GameLogic/W3DTerrainLogic.cpp | 3 +- .../Source/WWVegas/WW3D2/ddsfile.cpp | 2 +- .../Source/WWVegas/WW3D2/dx8wrapper.cpp | 3 +- .../Libraries/Source/WWVegas/WW3D2/hlod.cpp | 2 +- .../Source/WWVegas/WW3D2/hmorphanim.cpp | 12 ++--- .../Source/WWVegas/WW3D2/hrawanim.cpp | 2 +- .../Source/WWVegas/WW3D2/meshmdlio.cpp | 6 +-- .../Tools/WorldBuilder/src/BlendMaterial.cpp | 2 +- .../Tools/WorldBuilder/src/EditAction.cpp | 6 +-- .../Tools/WorldBuilder/src/EditCondition.cpp | 6 +-- .../WorldBuilder/src/TerrainMaterial.cpp | 2 +- .../Tools/WorldBuilder/src/TerrainModal.cpp | 2 +- 58 files changed, 158 insertions(+), 202 deletions(-) diff --git a/Core/Libraries/Source/WWVegas/WW3D2/collect.cpp b/Core/Libraries/Source/WWVegas/WW3D2/collect.cpp index c911d68dd2e..eaefe47fbd2 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/collect.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/collect.cpp @@ -1015,7 +1015,7 @@ WW3DErrorType CollectionDefClass::Load(ChunkLoadClass & cload) if (cload.Read(&header,sizeof(header)) != sizeof(header)) goto Error; if (!cload.Close_Chunk()) goto Error; - strncpy(Name,header.Name,W3D_NAME_LEN); + strlcpy(Name,header.Name,W3D_NAME_LEN); ObjectNames.Resize(header.RenderObjectCount); while (cload.Open_Chunk()) { diff --git a/Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp b/Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp index b6ff2124826..0136f448826 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp @@ -264,7 +264,7 @@ int HCompressedAnimClass::Load_W3D(ChunkLoadClass & cload) WWASSERT(HierarchyName != NULL); WWASSERT(aheader.HierarchyName != NULL); WWASSERT(sizeof(HierarchyName) >= W3D_NAME_LEN); - strncpy(HierarchyName,aheader.HierarchyName,W3D_NAME_LEN); + strlcpy(HierarchyName,aheader.HierarchyName,W3D_NAME_LEN); HTreeClass * base_pose = WW3DAssetManager::Get_Instance()->Get_HTree(HierarchyName); if (base_pose == NULL) { diff --git a/Core/Libraries/Source/WWVegas/WW3D2/hmdldef.cpp b/Core/Libraries/Source/WWVegas/WW3D2/hmdldef.cpp index 54932d04898..352e56d35bf 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/hmdldef.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/hmdldef.cpp @@ -149,10 +149,8 @@ int HModelDefClass::Load_W3D(ChunkLoadClass & cload) /* ** process the header info */ - strncpy(ModelName,header.Name,W3D_NAME_LEN); - ModelName[W3D_NAME_LEN - 1] = 0; - strncpy(BasePoseName,header.HierarchyName,W3D_NAME_LEN); - BasePoseName[W3D_NAME_LEN-1] = 0; + strlcpy(ModelName,header.Name,W3D_NAME_LEN); + strlcpy(BasePoseName,header.HierarchyName,W3D_NAME_LEN); strcpy(Name,ModelName); /* diff --git a/Core/Libraries/Source/WWVegas/WW3D2/w3d_dep.cpp b/Core/Libraries/Source/WWVegas/WW3D2/w3d_dep.cpp index 49279e03cec..38c7e8a3e01 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/w3d_dep.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/w3d_dep.cpp @@ -532,9 +532,9 @@ static void Get_W3D_Name (const char *filename, char *w3d_name) // Copy all characters from start to end (excluding 'end') // into the w3d_name buffer. Then capitalize the string. - memset(w3d_name, 0, W3D_NAME_LEN); // blank out the buffer int num_chars = end - start; - strncpy(w3d_name, start, num_chars < W3D_NAME_LEN ? num_chars : W3D_NAME_LEN-1); + WWASSERT(num_chars <= W3D_NAME_LEN); + strlcpy(w3d_name, start, min(W3D_NAME_LEN, num_chars)); strupr(w3d_name); } diff --git a/Core/Libraries/Source/WWVegas/WWDownload/Download.cpp b/Core/Libraries/Source/WWVegas/WWDownload/Download.cpp index 05e5dbb3ed7..803bbdc84ab 100644 --- a/Core/Libraries/Source/WWVegas/WWDownload/Download.cpp +++ b/Core/Libraries/Source/WWVegas/WWDownload/Download.cpp @@ -19,6 +19,7 @@ // Download.cpp : Implementation of CDownload #include "DownloadDebug.h" #include "Download.h" +#include "stringex.h" #include #include #include @@ -69,15 +70,15 @@ HRESULT CDownload::DownloadFile(LPCSTR server, LPCSTR username, LPCSTR password, _mkdir("download"); // Copy parameters to member variables. - strncpy( m_Server, server, sizeof( m_Server ) ); - strncpy( m_Login, username, sizeof( m_Login ) ); - strncpy( m_Password, password, sizeof( m_Password ) ); - strncpy( m_File, file, sizeof( m_File ) ); - strncpy( m_LocalFile, localfile, sizeof( m_LocalFile ) ); + strlcpy( m_Server, server, sizeof( m_Server ) ); + strlcpy( m_Login, username, sizeof( m_Login ) ); + strlcpy( m_Password, password, sizeof( m_Password ) ); + strlcpy( m_File, file, sizeof( m_File ) ); + strlcpy( m_LocalFile, localfile, sizeof( m_LocalFile ) ); - strncpy( m_LastLocalFile, localfile, sizeof( m_LastLocalFile ) ); + strlcpy( m_LastLocalFile, localfile, sizeof( m_LastLocalFile ) ); - strncpy( m_RegKey, regkey, sizeof( m_RegKey ) ); + strlcpy( m_RegKey, regkey, sizeof( m_RegKey ) ); m_TryResume = tryresume; m_StartPosition=0; @@ -113,8 +114,7 @@ HRESULT CDownload::GetLastLocalFile(char *local_file, int maxlen) { if (local_file==0) return(E_FAIL); - strncpy(local_file, m_LastLocalFile, maxlen); - local_file[maxlen-1]=0; + strlcpy(local_file, m_LastLocalFile, maxlen); return(S_OK); } diff --git a/Core/Libraries/Source/WWVegas/WWDownload/FTP.CPP b/Core/Libraries/Source/WWVegas/WWDownload/FTP.CPP index f4e807c5bdf..2cea0011612 100644 --- a/Core/Libraries/Source/WWVegas/WWDownload/FTP.CPP +++ b/Core/Libraries/Source/WWVegas/WWDownload/FTP.CPP @@ -38,6 +38,7 @@ #include //#include "wlib/wstring.h" +#include "stringex.h" #include "DownloadDebug.h" // umm... what?? BGC 3/27/03 @@ -324,7 +325,7 @@ HRESULT Cftp::ConnectToServer(LPCSTR szServerName) char buffer[ 256 ]; int iReply, error; - strncpy( m_szServerName, szServerName, 128 ); + strlcpy( m_szServerName, szServerName, sizeof(m_szServerName)); if( m_iStatus == FTPSTAT_INIT ) { @@ -487,8 +488,8 @@ HRESULT Cftp::LoginToServer( LPCSTR szUserName, LPCSTR szPassword ) char command[ 256 ]; int iReply; - strncpy( m_szUserName, szUserName, 128 ); - strncpy( m_szPassword, szPassword, 128 ); + strlcpy( m_szUserName, szUserName, sizeof(m_szUserName)); + strlcpy( m_szPassword, szPassword, sizeof(m_szPassword)); memset( command, 0, 256 ); @@ -1396,7 +1397,7 @@ HRESULT Cftp::GetNextFileBlock( LPCSTR szLocalFileName, int * piTotalRead ) //char str[ 256 ]; - strncpy( m_szLocalFileName, szLocalFileName, 256 ); + strlcpy( m_szLocalFileName, szLocalFileName, sizeof(m_szLocalFileName)); // Open local file @@ -1830,8 +1831,7 @@ bool Prepare_Directories(const char *rootdir, const char *filename) const char *cptr=filename; while(cptr=strchr(cptr,'\\')) { - memset(tempstr,0,256); - strncpy(tempstr,filename,cptr-filename); + strlcpy(tempstr,filename,cptr-filename + 1); sprintf(newdir,"%s\\%s",rootdir, tempstr); if (!CreateDirectory(newdir, NULL)) return false; diff --git a/Core/Libraries/Source/WWVegas/WWLib/TARGA.CPP b/Core/Libraries/Source/WWVegas/WWLib/TARGA.CPP index c4a027ed8f1..d05c50ea87a 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/TARGA.CPP +++ b/Core/Libraries/Source/WWVegas/WWLib/TARGA.CPP @@ -713,7 +713,7 @@ long Targa::Save(const char* name, long flags, bool addextension) if (!error) { mExtension.ExtSize = 495; - strncpy(mExtension.SoftID, "Denzil's Targa Code", 41); + strlcpy(mExtension.SoftID, "Denzil's Targa Code", sizeof(mExtension.SoftID)); mExtension.SoftVer.Number = (1 * 100); mExtension.SoftVer.Letter = 0; @@ -735,7 +735,7 @@ long Targa::Save(const char* name, long flags, bool addextension) if (!error) { footer.Developer = 0; - strncpy(footer.Signature, TGA2_SIGNATURE, 16); + strlcpy(footer.Signature, TGA2_SIGNATURE, sizeof(footer.Signature)); footer.RsvdChar = '.'; footer.BZST = 0; diff --git a/Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp b/Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp index b972a50ec7f..e08182ff2a0 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp @@ -802,7 +802,7 @@ void CPUDetectClass::Init_Processor_String() case INTEL_PROCESSOR_PENTIUM4: str+="Pentium4"; break; } } - strncpy(ProcessorString,str.str(),sizeof(ProcessorString)); + strlcpy(ProcessorString,str.str(),sizeof(ProcessorString)); } } diff --git a/Core/Libraries/Source/WWVegas/WWLib/ini.cpp b/Core/Libraries/Source/WWVegas/WWLib/ini.cpp index 82b0f0b5495..1cc1a5a2796 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/ini.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/ini.cpp @@ -1150,8 +1150,7 @@ bool INIClass::Put_TextBlock(char const * section, char const * text) char buffer[128]; - strncpy(buffer, text, 75); - buffer[75] = '\0'; + strlcpy(buffer, text, 76); char b[32]; sprintf(b, "%d", index); @@ -1724,8 +1723,7 @@ int INIClass::Get_String(char const * section, char const * entry, char const * buffer[0] = '\0'; return(0); } else { - strncpy(buffer, defvalue, size); - buffer[size-1] = '\0'; + strlcpy(buffer, defvalue, size); strtrim(buffer); return(strlen(buffer)); } diff --git a/Core/Libraries/Source/debug/CMakeLists.txt b/Core/Libraries/Source/debug/CMakeLists.txt index f81690ac1cb..cb2cdcc6f34 100644 --- a/Core/Libraries/Source/debug/CMakeLists.txt +++ b/Core/Libraries/Source/debug/CMakeLists.txt @@ -34,5 +34,6 @@ target_include_directories(core_debug INTERFACE target_link_libraries(core_debug PRIVATE core_config + core_wwcommon corei_always ) diff --git a/Core/Libraries/Source/debug/debug_debug.cpp b/Core/Libraries/Source/debug/debug_debug.cpp index e35f9006ee5..a2fbc3b6960 100644 --- a/Core/Libraries/Source/debug/debug_debug.cpp +++ b/Core/Libraries/Source/debug/debug_debug.cpp @@ -27,6 +27,7 @@ // Debug class implementation ////////////////////////////////////////////////////////////////////////////// #include "_pch.h" +#include #include #include #include @@ -729,8 +730,7 @@ Debug& Debug::operator<<(const char *str) void Debug::SetPrefixAndRadix(const char *prefix, int radix) { - strncpy(m_prefix,prefix?prefix:"",sizeof(m_prefix)-1); - m_prefix[sizeof(m_prefix)-1]=0; + strlcpy(m_prefix,prefix?prefix:"",sizeof(m_prefix)); m_radix=radix; } @@ -1423,11 +1423,11 @@ void Debug::SetBuildInfo(const char *version, const char *buildDate) { if (version) - strncpy(Instance.m_version,version,sizeof(Instance.m_version)-1); + strlcpy(Instance.m_version,version,sizeof(Instance.m_version)); if (internalVersion) - strncpy(Instance.m_intVersion,internalVersion,sizeof(Instance.m_intVersion)-1); + strlcpy(Instance.m_intVersion,internalVersion,sizeof(Instance.m_intVersion)); if (buildDate) - strncpy(Instance.m_buildDate,buildDate,sizeof(Instance.m_buildDate)-1); + strlcpy(Instance.m_buildDate,buildDate,sizeof(Instance.m_buildDate)); } void Debug::WriteBuildInfo(void) diff --git a/Core/Libraries/Source/debug/debug_io_flat.cpp b/Core/Libraries/Source/debug/debug_io_flat.cpp index 1f1bc85d1ae..196a0892aad 100644 --- a/Core/Libraries/Source/debug/debug_io_flat.cpp +++ b/Core/Libraries/Source/debug/debug_io_flat.cpp @@ -27,6 +27,7 @@ // Debug I/O class flat (flat or split log file) ////////////////////////////////////////////////////////////////////////////// #include "_pch.h" +#include "stringex.h" #include #include // needed for placement new prototype @@ -428,8 +429,7 @@ void DebugIOFlat::Execute(class Debug& dbg, const char *cmd, bool structuredCmd, // copy if (argn) { - strncpy(m_copyDir,argv[0],sizeof(m_copyDir)-1); - m_copyDir[sizeof(m_copyDir)-1]=0; + strlcpy(m_copyDir,argv[0],sizeof(m_copyDir)); } } else if (!strcmp(cmd,"splitadd")) @@ -460,11 +460,8 @@ void DebugIOFlat::Execute(class Debug& dbg, const char *cmd, bool structuredCmd, if (!cur->stringTypes) cur->stringTypes=0xffffffff; - strncpy(cur->items,argv[1],sizeof(cur->items)-1); - cur->items[sizeof(cur->items)-1]=0; - - strncpy(cur->name,argv[2],sizeof(cur->name)-1); - cur->name[sizeof(cur->name)-1]=0; + strlcpy(cur->items,argv[1],sizeof(cur->items)); + strlcpy(cur->name,argv[2],sizeof(cur->name)); // create our filename, search for stream with same filename char fn[256]; diff --git a/Core/Libraries/Source/debug/debug_stack.cpp b/Core/Libraries/Source/debug/debug_stack.cpp index e40e573ebc2..438be1bfc12 100644 --- a/Core/Libraries/Source/debug/debug_stack.cpp +++ b/Core/Libraries/Source/debug/debug_stack.cpp @@ -27,6 +27,7 @@ // Stack walker ////////////////////////////////////////////////////////////////////////////// #include "_pch.h" +#include "stringex.h" #include // Definitions to allow run-time linking to the dbghelp.dll functions. @@ -250,8 +251,7 @@ void DebugStackwalk::Signature::GetSymbol(unsigned addr, char *p=strrchr(symbolBuffer,'\\'); // use filename only, strip off path p=p?p+1:symbolBuffer; - strncpy(bufMod,p,sizeMod); - bufMod[sizeMod-1]=0; + strlcpy(bufMod,p,sizeMod); } if (relMod) *relMod=addr-modBase; @@ -266,8 +266,7 @@ void DebugStackwalk::Signature::GetSymbol(unsigned addr, DWORD displacement; if (gDbg._SymGetSymFromAddr((HANDLE)GetCurrentProcessId(),addr,&displacement,symPtr)) { - strncpy(bufSym,symPtr->Name,sizeSym); - bufSym[sizeSym-1]=0; + strlcpy(bufSym,symPtr->Name,sizeSym); if (relSym) *relSym=displacement; } @@ -288,8 +287,7 @@ void DebugStackwalk::Signature::GetSymbol(unsigned addr, { char *p=strrchr(line.FileName,'\\'); // use filename only, strip off path p=p?p+1:line.FileName; - strncpy(bufFile,p,sizeFile); - bufFile[sizeFile-1]=0; + strlcpy(bufFile,p,sizeFile); if (linePtr) *linePtr=line.LineNumber; if (relLine) diff --git a/Core/Libraries/Source/profile/CMakeLists.txt b/Core/Libraries/Source/profile/CMakeLists.txt index bad4e7f94cb..b2b93c3a6c4 100644 --- a/Core/Libraries/Source/profile/CMakeLists.txt +++ b/Core/Libraries/Source/profile/CMakeLists.txt @@ -28,5 +28,6 @@ target_include_directories(core_profile INTERFACE target_link_libraries(core_profile PRIVATE core_config + core_wwcommon corei_always ) diff --git a/Core/Libraries/Source/profile/profile_highlevel.cpp b/Core/Libraries/Source/profile/profile_highlevel.cpp index 06cc22aca6d..f0915297893 100644 --- a/Core/Libraries/Source/profile/profile_highlevel.cpp +++ b/Core/Libraries/Source/profile/profile_highlevel.cpp @@ -27,6 +27,7 @@ // High level profiling ////////////////////////////////////////////////////////////////////////////// #include "_pch.h" +#include "stringex.h" #include #include @@ -91,9 +92,8 @@ ProfileHighLevel::Block::Block(const char *name) m_idTime=AddProfile(name,NULL,"msec",6,-4); char help[256]; - strncpy(help,name,sizeof(help)); - help[sizeof(help)-1-2]=0; - strcat(help,".c"); + strlcpy(help, name, sizeof(help) - 2); + strlcat(help, ".c", sizeof(help)); AddProfile(help,NULL,"calls",6,0).Increment(); ProfileGetTime(m_start); diff --git a/Core/Tools/ImagePacker/Source/ImagePacker.cpp b/Core/Tools/ImagePacker/Source/ImagePacker.cpp index 470117db2db..3796bbcdd4d 100644 --- a/Core/Tools/ImagePacker/Source/ImagePacker.cpp +++ b/Core/Tools/ImagePacker/Source/ImagePacker.cpp @@ -46,6 +46,7 @@ #include // USER INCLUDES ////////////////////////////////////////////////////////////// +#include "stringex.h" #include "Common/Debug.h" #include "WWLib/TARGA.H" #include "Resource.h" @@ -844,8 +845,7 @@ void ImagePacker::addImage( char *path ) strcpy( info->m_filenameOnly, c ); info->m_filenameOnlyNoExt = new char[ nameLen - 4 + 1 ]; - strncpy( info->m_filenameOnlyNoExt, c, nameLen - 4 ); - info->m_filenameOnlyNoExt[ nameLen - 4 ] = '\0'; + strlcpy( info->m_filenameOnlyNoExt, c, nameLen - 4 + 1 ); // assign to array m_imageList[ m_imageCount++ ] = info; diff --git a/Generals/Code/GameEngine/Source/Common/Recorder.cpp b/Generals/Code/GameEngine/Source/Common/Recorder.cpp index b80c7abe6b1..6182b67d45d 100644 --- a/Generals/Code/GameEngine/Source/Common/Recorder.cpp +++ b/Generals/Code/GameEngine/Source/Common/Recorder.cpp @@ -288,7 +288,7 @@ void RecorderClass::cleanUpReplayFile( void ) if (TheGlobalData->m_saveStats) { char fname[_MAX_PATH+1]; - strncpy(fname, TheGlobalData->m_baseStatsDir.str(), _MAX_PATH); + strlcpy(fname, TheGlobalData->m_baseStatsDir.str(), ARRAY_SIZE(fname)); strncat(fname, m_fileName.str(), _MAX_PATH - strlen(fname)); DEBUG_LOG(("Saving replay to %s", fname)); AsciiString oldFname; diff --git a/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp b/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp index 6fa3f401fa2..4b92df0bfbf 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp @@ -1177,7 +1177,7 @@ void ThingTemplate::initForLTA(const AsciiString& name) m_nameString = name; char buffer[1024]; - strncpy(buffer, name.str(), sizeof(buffer)); + strlcpy(buffer, name.str(), sizeof(buffer)); int i=0; for (; buffer[i]; i++) { if (buffer[i] == '/') { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp index 2c556656d7f..a19db1902b5 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp @@ -1718,8 +1718,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms req.QM.discons = numDiscons; - strncpy(req.QM.pings, TheGameSpyInfo->getPingString().str(), 17); - req.QM.pings[16] = 0; + strlcpy(req.QM.pings, TheGameSpyInfo->getPingString().str(), sizeof(req.QM.pings)); req.QM.botID = TheGameSpyConfig->getQMBotID(); req.QM.roomID = TheGameSpyConfig->getQMChannel(); diff --git a/Generals/Code/GameEngine/Source/GameClient/MapUtil.cpp b/Generals/Code/GameEngine/Source/GameClient/MapUtil.cpp index d5b7885e7b0..ff604a932f9 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MapUtil.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MapUtil.cpp @@ -95,8 +95,7 @@ static UnsignedInt calcCRC( AsciiString dirName, AsciiString fname ) length = strlen( tempBuf ); if( length >= 4 ) { - memset( filenameBuf, '\0', _MAX_PATH); - strncpy( filenameBuf, tempBuf, length - 4); + strlcpy( filenameBuf, tempBuf, length - 4 + 1); } File *fp; @@ -242,8 +241,7 @@ static Bool loadMap( AsciiString filename ) length = strlen( tempBuf ); if( length >= 4 ) { - memset( filenameBuf, '\0', _MAX_PATH); - strncpy( filenameBuf, tempBuf, length - 4); + strlcpy( filenameBuf, tempBuf, length - 4 + 1); } CachedFileInputStream fileStrm; diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp index 06e9dae3e1d..f0d08b7588d 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp @@ -483,8 +483,7 @@ void BuddyThreadClass::errorCallback( GPConnection *con, GPErrorArg *arg ) errorResponse.result = arg->result; errorResponse.arg.error.errorCode = arg->errorCode; errorResponse.arg.error.fatal = arg->fatal; - strncpy(errorResponse.arg.error.errorString, arg->errorString, MAX_BUDDY_CHAT_LEN); - errorResponse.arg.error.errorString[MAX_BUDDY_CHAT_LEN-1] = 0; + strlcpy(errorResponse.arg.error.errorString, arg->errorString, MAX_BUDDY_CHAT_LEN); m_isConnecting = m_isConnected = false; TheGameSpyBuddyMessageQueue->addResponse( errorResponse ); if (m_isdeleting) diff --git a/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp b/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp index 5feff8444e5..43a35249be7 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp @@ -642,8 +642,7 @@ void LANAPI::RequestGameJoin( LANGameInfo *game, UnsignedInt ip /* = 0 */ ) AsciiString s = ""; GetStringFromRegistry("\\ergc", "", s); - strncpy(msg.GameToJoin.serial, s.str(), g_maxSerialLength); - msg.GameToJoin.serial[g_maxSerialLength-1] = '\0'; + strlcpy(msg.GameToJoin.serial, s.str(), ARRAY_SIZE(msg.GameToJoin.serial)); sendMessage(&msg, ip); @@ -717,7 +716,7 @@ void LANAPI::RequestGameAnnounce( void ) reply.LANMessageType = LANMessage::MSG_GAME_ANNOUNCE; AsciiString gameOpts = GameInfoToAsciiString(m_currentGame); - strncpy(reply.GameInfo.options,gameOpts.str(),m_lanMaxOptionsLength); + strlcpy(reply.GameInfo.options,gameOpts.str(), ARRAY_SIZE(reply.GameInfo.options)); wcsncpy(reply.GameInfo.gameName, m_currentGame->getName().str(), g_lanGameNameLength); reply.GameInfo.gameName[g_lanGameNameLength] = 0; reply.GameInfo.inProgress = m_currentGame->isGameInProgress(); @@ -849,7 +848,7 @@ void LANAPI::RequestGameOptions( AsciiString gameOptions, Bool isPublic, Unsigne LANMessage msg; fillInLANMessage( &msg ); msg.LANMessageType = LANMessage::MSG_GAME_OPTIONS; - strncpy(msg.GameOptions.options, gameOptions.str(), m_lanMaxOptionsLength); + strlcpy(msg.GameOptions.options, gameOptions.str(), ARRAY_SIZE(msg.GameOptions.options)); msg.GameOptions.options[m_lanMaxOptionsLength] = 0; sendMessage(&msg, ip); @@ -1085,10 +1084,8 @@ void LANAPI::fillInLANMessage( LANMessage *msg ) wcsncpy(msg->name, m_name.str(), g_lanPlayerNameLength); msg->name[g_lanPlayerNameLength] = 0; - strncpy(msg->userName, m_userName.str(), g_lanLoginNameLength); - msg->userName[g_lanLoginNameLength] = 0; - strncpy(msg->hostName, m_hostName.str(), g_lanHostNameLength); - msg->hostName[g_lanHostNameLength] = 0; + strlcpy(msg->userName, m_userName.str(), ARRAY_SIZE(msg->userName)); + strlcpy(msg->hostName, m_hostName.str(), ARRAY_SIZE(msg->hostName)); } void LANAPI::RequestLobbyLeave( Bool forced ) diff --git a/Generals/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp b/Generals/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp index fe9f70ee295..ce16788bd4a 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp @@ -62,7 +62,7 @@ void LANAPI::handleRequestLocations( LANMessage *msg, UnsignedInt senderIP ) fillInLANMessage( &reply ); reply.LANMessageType = LANMessage::MSG_GAME_ANNOUNCE; AsciiString gameOpts = GenerateGameOptionsString(); - strncpy(reply.GameInfo.options,gameOpts.str(),m_lanMaxOptionsLength); + strlcpy(reply.GameInfo.options, gameOpts.str(), ARRAY_SIZE(reply.GameInfo.options)); wcsncpy(reply.GameInfo.gameName, m_currentGame->getName().str(), g_lanGameNameLength); reply.GameInfo.gameName[g_lanGameNameLength] = 0; reply.GameInfo.inProgress = m_currentGame->isGameInProgress(); @@ -193,7 +193,7 @@ void LANAPI::handleRequestGameInfo( LANMessage *msg, UnsignedInt senderIP ) reply.LANMessageType = LANMessage::MSG_GAME_ANNOUNCE; AsciiString gameOpts = GameInfoToAsciiString(m_currentGame); - strncpy(reply.GameInfo.options,gameOpts.str(),m_lanMaxOptionsLength); + strlcpy(reply.GameInfo.options,gameOpts.str(), ARRAY_SIZE(reply.GameInfo.options)); wcsncpy(reply.GameInfo.gameName, m_currentGame->getName().str(), g_lanGameNameLength); reply.GameInfo.gameName[g_lanGameNameLength] = 0; reply.GameInfo.inProgress = m_currentGame->isGameInProgress(); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp index 76f55e8d0bc..3f36d54e3d7 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp @@ -160,8 +160,8 @@ class W3DShadowTexture : public RefCountClass, public HashableClass const char * Get_Name(void) const { return m_namebuf;} void Set_Name(const char *name) - { memset(m_namebuf,0,sizeof(m_namebuf)); //pad with zero so always ends with null character. - strncpy(m_namebuf,name,sizeof(m_namebuf)-1); + { + strlcpy(m_namebuf,name,sizeof(m_namebuf)); } TextureClass *getTexture(void) { return m_texture;} void setTexture(TextureClass *texture) {m_texture = texture;} @@ -1477,8 +1477,7 @@ Shadow* W3DProjectedShadowManager::addDecal(Shadow::ShadowTypeInfo *shadowInfo) Real decalSizeY=0.0f; Bool allowSunDirection=FALSE; - Char texture_name[64]; - Int nameLen; + Char texture_name[ARRAY_SIZE(shadowInfo->m_ShadowName)]; if (!shadowInfo) return NULL; //right now we require hardware render-to-texture support @@ -1486,9 +1485,8 @@ Shadow* W3DProjectedShadowManager::addDecal(Shadow::ShadowTypeInfo *shadowInfo) //simple decal using the premade texture specified. //can be always perpendicular to model's z-axis or projected //onto world geometry. - nameLen=strlen(shadowInfo->m_ShadowName); - strncpy(texture_name,shadowInfo->m_ShadowName,nameLen); - strcpy(texture_name+nameLen,".tga"); //append texture extension + strlcpy(texture_name, shadowInfo->m_ShadowName, ARRAY_SIZE(texture_name)); + strlcat(texture_name, ".tga", ARRAY_SIZE(texture_name)); //Check if we previously added a decal using this texture st=m_W3DShadowTextureManager->getTexture(texture_name); @@ -1583,8 +1581,7 @@ Shadow* W3DProjectedShadowManager::addDecal(RenderObjClass *robj, Shadow::Shadow Real decalOffsetY=0.0f; Bool allowSunDirection=FALSE; - Char texture_name[64]; - Int nameLen; + Char texture_name[ARRAY_SIZE(shadowInfo->m_ShadowName)]; if (!robj || !shadowInfo) return NULL; //right now we require hardware render-to-texture support @@ -1592,9 +1589,8 @@ Shadow* W3DProjectedShadowManager::addDecal(RenderObjClass *robj, Shadow::Shadow //simple decal using the premade texture specified. //can be always perpendicular to model's z-axis or projected //onto world geometry. - nameLen=strlen(shadowInfo->m_ShadowName); - strncpy(texture_name,shadowInfo->m_ShadowName,nameLen); - strcpy(texture_name+nameLen,".tga"); //append texture extension + strlcpy(texture_name, shadowInfo->m_ShadowName, ARRAY_SIZE(texture_name)); + strlcat(texture_name, ".tga", ARRAY_SIZE(texture_name)); //Check if we previously added a decal using this texture st=m_W3DShadowTextureManager->getTexture(texture_name); @@ -1706,8 +1702,7 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S Real decalOffsetY=0.0f; Bool allowSunDirection=FALSE; - Char texture_name[64]; - Int nameLen; + Char texture_name[ARRAY_SIZE(shadowInfo->m_ShadowName)]; if (!m_dynamicRenderTarget || !robj || !TheGlobalData->m_useShadowDecals) @@ -1721,13 +1716,14 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S { //simple decal using the premade texture specified. //can be always perpendicular to model's z-axis or projected //onto world geometry. - nameLen=strlen(shadowInfo->m_ShadowName); - if (nameLen <= 1) //no texture name given, use same as object - { strcpy(texture_name,defaultDecalName); + if (strlen(shadowInfo->m_ShadowName) <= 1) //no texture name given, use same as object + { + strcpy(texture_name, defaultDecalName); } else - { strncpy(texture_name,shadowInfo->m_ShadowName,nameLen); - strcpy(texture_name+nameLen,".tga"); //append texture extension + { + strlcpy(texture_name, shadowInfo->m_ShadowName, ARRAY_SIZE(texture_name)); + strlcat(texture_name, ".tga", ARRAY_SIZE(texture_name)); } st=m_W3DShadowTextureManager->getTexture(texture_name); @@ -1891,20 +1887,19 @@ W3DProjectedShadow* W3DProjectedShadowManager::createDecalShadow(Shadow::ShadowT Real decalOffsetX=0.0f; Real decalOffsetY=0.0f; const Real defaultWidth = 10.0f; - - Char texture_name[64]; - Int nameLen; + Char texture_name[ARRAY_SIZE(shadowInfo->m_ShadowName)]; //simple decal using the premade texture specified. //can be always perpendicular to model's z-axis or projected //onto world geometry. - nameLen=strlen(shadowInfo->m_ShadowName); - if (nameLen <= 1) //no texture name given, use same as object - { strcpy(texture_name,defaultDecalName); + if (strlen(shadowInfo->m_ShadowName) <= 1) //no texture name given, use same as object + { + strcpy(texture_name,defaultDecalName); } else - { strncpy(texture_name,shadowInfo->m_ShadowName,nameLen); - strcpy(texture_name+nameLen,".tga"); //append texture extension + { + strlcpy(texture_name, shadowInfo->m_ShadowName, ARRAY_SIZE(texture_name)); + strlcat(texture_name, ".tga", ARRAY_SIZE(texture_name)); } st=m_W3DShadowTextureManager->getTexture(texture_name); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp index 72efdf7b6b9..34ff71f1d13 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp @@ -579,8 +579,8 @@ class W3DShadowGeometry : public RefCountClass, public HashableClass const char * Get_Name(void) const { return m_namebuf;} void Set_Name(const char *name) - { memset(m_namebuf,0,sizeof(m_namebuf)); //pad with zero so always ends with null character. - strncpy(m_namebuf,name,sizeof(m_namebuf)-1); + { + strlcpy(m_namebuf,name,sizeof(m_namebuf)); } Int getMeshCount(void) { return m_meshCount;} W3DShadowGeometryMesh *getMesh(Int index) { return &m_meshList[index];} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp index fdd14ec1fc5..d75fc310082 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp @@ -129,7 +129,7 @@ char const * GameFileClass::Set_Name( char const *filename ) Close(); // save the filename - strncpy( m_filename, filename, _MAX_PATH ); + strlcpy( m_filename, filename, _MAX_PATH ); char name[_MAX_PATH]; const Int EXT_LEN = 32; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp index 85f8c9b5bb4..0c34f99695e 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp @@ -126,8 +126,7 @@ Bool W3DTerrainLogic::loadMap( AsciiString filename , Bool query ) length = strlen( tempBuf ); if( length >= 4 ) { - memset( filenameBuf, '\0', _MAX_PATH); - strncpy( filenameBuf, tempBuf, length - 4); + strlcpy( filenameBuf, tempBuf, length - 4 + 1); } // const char *fname = filename.reverseFind('\\'); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp index d8165cd0295..e1dbea9c491 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp @@ -47,7 +47,7 @@ DDSFileClass::DDSFileClass(const char* name,unsigned reduction_factor) DateTime(0), CubeFaceSize(0) { - strncpy(Name,name,sizeof(Name)); + strlcpy(Name,name,sizeof(Name)); // The name could be given in .tga or .dds format, so ensure we're opening .dds... int len=strlen(Name); Name[len-3]='d'; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp index ccd6c9df7f9..a94c8d239c2 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp @@ -2401,8 +2401,7 @@ IDirect3DSurface8 * DX8Wrapper::_Create_DX8_Surface(const char *filename_) // If file not found, try the dds format // else create a surface with missing texture in it char compressed_name[200]; - strncpy(compressed_name,filename_, ARRAY_SIZE(compressed_name)); - compressed_name[ARRAY_SIZE(compressed_name)-1] = '\0'; + strlcpy(compressed_name,filename_, sizeof(compressed_name)); char *ext = strstr(compressed_name, "."); if ( ext && (strlen(ext)==4) && ( (ext[1] == 't') || (ext[1] == 'T') ) && diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp index e78a0f90527..4bf53237c7d 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp @@ -165,7 +165,7 @@ class ProxyRecordClass void Init(const W3dHLodSubObjectStruct & w3d_data) { BoneIndex = w3d_data.BoneIndex; - strncpy(Name,w3d_data.Name,sizeof(Name)); + strlcpy(Name,w3d_data.Name,sizeof(Name)); } int Get_Bone_Index(void) { return BoneIndex; } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp index 60804fd1d4b..ca25a66d09b 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp @@ -343,8 +343,7 @@ bool HMorphAnimClass::Import(const char *hierarchy_name, TextFileClass &text_des // // Copy the hierarchy name into a class variable // - ::strncpy (HierarchyName, hierarchy_name, W3D_NAME_LEN); - HierarchyName[W3D_NAME_LEN - 1] = 0; + ::strlcpy(HierarchyName, hierarchy_name, W3D_NAME_LEN); // // Attempt to load the new base pose @@ -550,8 +549,8 @@ int HMorphAnimClass::Load_W3D(ChunkLoadClass & cload) cload.Read(&header,sizeof(header)); cload.Close_Chunk(); - strncpy(AnimName,header.Name,sizeof(AnimName)); - strncpy(HierarchyName,header.HierarchyName,sizeof(HierarchyName)); + strlcpy(AnimName,header.Name,sizeof(AnimName)); + strlcpy(HierarchyName,header.HierarchyName,sizeof(HierarchyName)); strcpy(Name,HierarchyName); strcat(Name,"."); strcat(Name,AnimName); @@ -621,9 +620,8 @@ int HMorphAnimClass::Save_W3D(ChunkSaveClass & csave) // init the header data W3dMorphAnimHeaderStruct header; - memset(&header,0,sizeof(header)); - strncpy(header.Name,AnimName,sizeof(header.Name)); - strncpy(header.HierarchyName,HierarchyName,sizeof(header.HierarchyName)); + strlcpy(header.Name,AnimName,sizeof(header.Name)); + strlcpy(header.HierarchyName,HierarchyName,sizeof(header.HierarchyName)); header.FrameCount = FrameCount; header.FrameRate = FrameRate; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp index fe1e34ecc40..cf0398f0b53 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp @@ -219,7 +219,7 @@ int HRawAnimClass::Load_W3D(ChunkLoadClass & cload) WWASSERT(HierarchyName != NULL); WWASSERT(aheader.HierarchyName != NULL); WWASSERT(sizeof(HierarchyName) >= W3D_NAME_LEN); - strncpy(HierarchyName,aheader.HierarchyName,W3D_NAME_LEN); + strlcpy(HierarchyName,aheader.HierarchyName,W3D_NAME_LEN); HTreeClass * base_pose = WW3DAssetManager::Get_Instance()->Get_HTree(HierarchyName); if (base_pose == NULL) { diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp index 474ebd9c32f..d950ec4d04d 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp @@ -2283,9 +2283,9 @@ WW3DErrorType MeshModelClass::write_header(ChunkSaveClass & csave,MeshSaveContex hierarchy_name_len = (int)mesh_name - (int)name; mesh_name++; } - assert( hierarchy_name_len <= W3D_NAME_LEN); - strncpy( header.MeshName, mesh_name, W3D_NAME_LEN); - strncpy( header.ContainerName, name, hierarchy_name_len); + assert( hierarchy_name_len < W3D_NAME_LEN); + strlcpy( header.MeshName, mesh_name, W3D_NAME_LEN); + strlcpy( header.ContainerName, name, hierarchy_name_len + 1); } else { sprintf(header.MeshName,"UnNamed"); } diff --git a/Generals/Code/Tools/WorldBuilder/src/BlendMaterial.cpp b/Generals/Code/Tools/WorldBuilder/src/BlendMaterial.cpp index 775a9aea7d5..ed498107837 100644 --- a/Generals/Code/Tools/WorldBuilder/src/BlendMaterial.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/BlendMaterial.cpp @@ -239,7 +239,7 @@ void BlendMaterial::updateTextures(void) for (i=WorldHeightMapEdit::getNumTexClasses()-1; i>=0; i--) { char path[_MAX_PATH]; AsciiString uiName = WorldHeightMapEdit::getTexClassUiName(i); - strncpy(path, uiName.str(), _MAX_PATH-2); + strlcpy(path, uiName.str(), _MAX_PATH); addTerrain(path, i, TVI_ROOT); } m_updating = false; diff --git a/Generals/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp b/Generals/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp index f65721ddcfd..679f261a0af 100644 --- a/Generals/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp @@ -369,7 +369,7 @@ void TerrainMaterial::updateTextures(WorldHeightMapEdit *pMap) for (i=0; igetNumTexClasses(); i++) { char path[_MAX_PATH]; AsciiString uiName = pMap->getTexClassUiName(i); - strncpy(path, uiName.str(), _MAX_PATH-2); + strlcpy(path, uiName.str(), _MAX_PATH); m_staticThis->addTerrain(path, i, TVI_ROOT); } m_staticThis->m_updating = false; diff --git a/Generals/Code/Tools/WorldBuilder/src/TerrainModal.cpp b/Generals/Code/Tools/WorldBuilder/src/TerrainModal.cpp index f038bf80495..430d7b36d03 100644 --- a/Generals/Code/Tools/WorldBuilder/src/TerrainModal.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/TerrainModal.cpp @@ -234,7 +234,7 @@ void TerrainModal::updateTextures(void) } const char *tName = WorldHeightMapEdit::getTexClassName(i).str(); char path[_MAX_PATH]; - strncpy(path, tName, _MAX_PATH-2); + strlcpy(path, tName, _MAX_PATH); addTerrain(path, i, TVI_ROOT); } setTerrainTreeViewSelection(TVI_ROOT, m_currentFgTexture); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp index 99e70f26c51..1bd0d75352a 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp @@ -288,7 +288,7 @@ void RecorderClass::cleanUpReplayFile( void ) if (TheGlobalData->m_saveStats) { char fname[_MAX_PATH+1]; - strncpy(fname, TheGlobalData->m_baseStatsDir.str(), _MAX_PATH); + strlcpy(fname, TheGlobalData->m_baseStatsDir.str(), ARRAY_SIZE(fname)); strncat(fname, m_fileName.str(), _MAX_PATH - strlen(fname)); DEBUG_LOG(("Saving replay to %s", fname)); AsciiString oldFname; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp index 1e163cfb177..c0fc82f6ed4 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp @@ -1316,7 +1316,7 @@ void ThingTemplate::initForLTA(const AsciiString& name) m_nameString = name; char buffer[1024]; - strncpy(buffer, name.str(), sizeof(buffer)); + strlcpy(buffer, name.str(), sizeof(buffer)); int i=0; for (; buffer[i]; i++) { if (buffer[i] == '/') { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp index d5d0bad5aa3..0f609c90930 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp @@ -1783,8 +1783,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms req.QM.discons = numDiscons; - strncpy(req.QM.pings, TheGameSpyInfo->getPingString().str(), 17); - req.QM.pings[16] = 0; + strlcpy(req.QM.pings, TheGameSpyInfo->getPingString().str(), sizeof(req.QM.pings)); req.QM.botID = TheGameSpyConfig->getQMBotID(); req.QM.roomID = TheGameSpyConfig->getQMChannel(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp index 611fff670a0..08572be74d5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp @@ -95,8 +95,7 @@ static UnsignedInt calcCRC( AsciiString dirName, AsciiString fname ) length = strlen( tempBuf ); if( length >= 4 ) { - memset( filenameBuf, '\0', _MAX_PATH); - strncpy( filenameBuf, tempBuf, length - 4); + strlcpy( filenameBuf, tempBuf, length - 4 + 1); } File *fp; @@ -242,8 +241,7 @@ static Bool loadMap( AsciiString filename ) length = strlen( tempBuf ); if( length >= 4 ) { - memset( filenameBuf, '\0', _MAX_PATH); - strncpy( filenameBuf, tempBuf, length - 4); + strlcpy( filenameBuf, tempBuf, length - 4 + 1); } CachedFileInputStream fileStrm; diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp index 338de3ebdec..75905f2e09c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp @@ -483,8 +483,7 @@ void BuddyThreadClass::errorCallback( GPConnection *con, GPErrorArg *arg ) errorResponse.result = arg->result; errorResponse.arg.error.errorCode = arg->errorCode; errorResponse.arg.error.fatal = arg->fatal; - strncpy(errorResponse.arg.error.errorString, arg->errorString, MAX_BUDDY_CHAT_LEN); - errorResponse.arg.error.errorString[MAX_BUDDY_CHAT_LEN-1] = 0; + strlcpy(errorResponse.arg.error.errorString, arg->errorString, MAX_BUDDY_CHAT_LEN); m_isConnecting = m_isConnected = false; TheGameSpyBuddyMessageQueue->addResponse( errorResponse ); if (m_isdeleting) diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp index 87027fe46d1..47220962719 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp @@ -642,8 +642,7 @@ void LANAPI::RequestGameJoin( LANGameInfo *game, UnsignedInt ip /* = 0 */ ) AsciiString s = ""; GetStringFromRegistry("\\ergc", "", s); - strncpy(msg.GameToJoin.serial, s.str(), g_maxSerialLength); - msg.GameToJoin.serial[g_maxSerialLength-1] = '\0'; + strlcpy(msg.GameToJoin.serial, s.str(), ARRAY_SIZE(msg.GameToJoin.serial)); sendMessage(&msg, ip); @@ -717,7 +716,7 @@ void LANAPI::RequestGameAnnounce( void ) reply.LANMessageType = LANMessage::MSG_GAME_ANNOUNCE; AsciiString gameOpts = GameInfoToAsciiString(m_currentGame); - strncpy(reply.GameInfo.options,gameOpts.str(),m_lanMaxOptionsLength); + strlcpy(reply.GameInfo.options,gameOpts.str(), ARRAY_SIZE(reply.GameOptions.options)); wcsncpy(reply.GameInfo.gameName, m_currentGame->getName().str(), g_lanGameNameLength); reply.GameInfo.gameName[g_lanGameNameLength] = 0; reply.GameInfo.inProgress = m_currentGame->isGameInProgress(); @@ -849,8 +848,7 @@ void LANAPI::RequestGameOptions( AsciiString gameOptions, Bool isPublic, Unsigne LANMessage msg; fillInLANMessage( &msg ); msg.LANMessageType = LANMessage::MSG_GAME_OPTIONS; - strncpy(msg.GameOptions.options, gameOptions.str(), m_lanMaxOptionsLength); - msg.GameOptions.options[m_lanMaxOptionsLength] = 0; + strlcpy(msg.GameOptions.options, gameOptions.str(), ARRAY_SIZE(msg.GameOptions.options)); sendMessage(&msg, ip); m_lastGameopt = gameOptions; @@ -1085,10 +1083,8 @@ void LANAPI::fillInLANMessage( LANMessage *msg ) wcsncpy(msg->name, m_name.str(), g_lanPlayerNameLength); msg->name[g_lanPlayerNameLength] = 0; - strncpy(msg->userName, m_userName.str(), g_lanLoginNameLength); - msg->userName[g_lanLoginNameLength] = 0; - strncpy(msg->hostName, m_hostName.str(), g_lanHostNameLength); - msg->hostName[g_lanHostNameLength] = 0; + strlcpy(msg->userName, m_userName.str(), ARRAY_SIZE(msg->userName)); + strlcpy(msg->hostName, m_hostName.str(), ARRAY_SIZE(msg->hostName)); } void LANAPI::RequestLobbyLeave( Bool forced ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp index 125895fd958..5291b6b7848 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp @@ -62,7 +62,7 @@ void LANAPI::handleRequestLocations( LANMessage *msg, UnsignedInt senderIP ) fillInLANMessage( &reply ); reply.LANMessageType = LANMessage::MSG_GAME_ANNOUNCE; AsciiString gameOpts = GenerateGameOptionsString(); - strncpy(reply.GameInfo.options,gameOpts.str(),m_lanMaxOptionsLength); + strlcpy(reply.GameInfo.options,gameOpts.str(), ARRAY_SIZE(reply.GameInfo.options)); wcsncpy(reply.GameInfo.gameName, m_currentGame->getName().str(), g_lanGameNameLength); reply.GameInfo.gameName[g_lanGameNameLength] = 0; reply.GameInfo.inProgress = m_currentGame->isGameInProgress(); @@ -193,7 +193,7 @@ void LANAPI::handleRequestGameInfo( LANMessage *msg, UnsignedInt senderIP ) reply.LANMessageType = LANMessage::MSG_GAME_ANNOUNCE; AsciiString gameOpts = GameInfoToAsciiString(m_currentGame); - strncpy(reply.GameInfo.options,gameOpts.str(),m_lanMaxOptionsLength); + strlcpy(reply.GameInfo.options,gameOpts.str(), ARRAY_SIZE(reply.GameInfo.options)); wcsncpy(reply.GameInfo.gameName, m_currentGame->getName().str(), g_lanGameNameLength); reply.GameInfo.gameName[g_lanGameNameLength] = 0; reply.GameInfo.inProgress = m_currentGame->isGameInProgress(); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp index 5e6a8703997..33c0782c72d 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp @@ -160,8 +160,8 @@ class W3DShadowTexture : public RefCountClass, public HashableClass const char * Get_Name(void) const { return m_namebuf;} void Set_Name(const char *name) - { memset(m_namebuf,0,sizeof(m_namebuf)); //pad with zero so always ends with null character. - strncpy(m_namebuf,name,sizeof(m_namebuf)-1); + { + strlcpy(m_namebuf,name,sizeof(m_namebuf)); } TextureClass *getTexture(void) { return m_texture;} void setTexture(TextureClass *texture) {m_texture = texture;} @@ -1477,8 +1477,7 @@ Shadow* W3DProjectedShadowManager::addDecal(Shadow::ShadowTypeInfo *shadowInfo) Real decalSizeY=0.0f; Bool allowSunDirection=FALSE; - Char texture_name[64]; - Int nameLen; + Char texture_name[ARRAY_SIZE(shadowInfo->m_ShadowName)]; if (!shadowInfo) return NULL; //right now we require hardware render-to-texture support @@ -1486,9 +1485,8 @@ Shadow* W3DProjectedShadowManager::addDecal(Shadow::ShadowTypeInfo *shadowInfo) //simple decal using the premade texture specified. //can be always perpendicular to model's z-axis or projected //onto world geometry. - nameLen=strlen(shadowInfo->m_ShadowName); - strncpy(texture_name,shadowInfo->m_ShadowName,nameLen); - strcpy(texture_name+nameLen,".tga"); //append texture extension + strlcpy(texture_name, shadowInfo->m_ShadowName, ARRAY_SIZE(texture_name)); + strlcat(texture_name, ".tga", ARRAY_SIZE(texture_name)); //Check if we previously added a decal using this texture st=m_W3DShadowTextureManager->getTexture(texture_name); @@ -1583,8 +1581,7 @@ Shadow* W3DProjectedShadowManager::addDecal(RenderObjClass *robj, Shadow::Shadow Real decalOffsetY=0.0f; Bool allowSunDirection=FALSE; - Char texture_name[64]; - Int nameLen; + Char texture_name[ARRAY_SIZE(shadowInfo->m_ShadowName)]; if (!robj || !shadowInfo) return NULL; //right now we require hardware render-to-texture support @@ -1592,9 +1589,8 @@ Shadow* W3DProjectedShadowManager::addDecal(RenderObjClass *robj, Shadow::Shadow //simple decal using the premade texture specified. //can be always perpendicular to model's z-axis or projected //onto world geometry. - nameLen=strlen(shadowInfo->m_ShadowName); - strncpy(texture_name,shadowInfo->m_ShadowName,nameLen); - strcpy(texture_name+nameLen,".tga"); //append texture extension + strlcpy(texture_name, shadowInfo->m_ShadowName, ARRAY_SIZE(texture_name)); + strlcat(texture_name, ".tga", ARRAY_SIZE(texture_name)); //Check if we previously added a decal using this texture st=m_W3DShadowTextureManager->getTexture(texture_name); @@ -1706,8 +1702,7 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S Real decalOffsetY=0.0f; Bool allowSunDirection=FALSE; - Char texture_name[64]; - Int nameLen; + Char texture_name[ARRAY_SIZE(shadowInfo->m_ShadowName)]; if (!m_dynamicRenderTarget || !robj || !TheGlobalData->m_useShadowDecals) @@ -1721,13 +1716,14 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S { //simple decal using the premade texture specified. //can be always perpendicular to model's z-axis or projected //onto world geometry. - nameLen=strlen(shadowInfo->m_ShadowName); - if (nameLen <= 1) //no texture name given, use same as object - { strcpy(texture_name,defaultDecalName); + if (strlen(shadowInfo->m_ShadowName) <= 1) //no texture name given, use same as object + { + strcpy(texture_name, defaultDecalName); } else - { strncpy(texture_name,shadowInfo->m_ShadowName,nameLen); - strcpy(texture_name+nameLen,".tga"); //append texture extension + { + strlcpy(texture_name, shadowInfo->m_ShadowName, ARRAY_SIZE(texture_name)); + strlcat(texture_name, ".tga", ARRAY_SIZE(texture_name)); } st=m_W3DShadowTextureManager->getTexture(texture_name); @@ -1891,20 +1887,19 @@ W3DProjectedShadow* W3DProjectedShadowManager::createDecalShadow(Shadow::ShadowT Real decalOffsetX=0.0f; Real decalOffsetY=0.0f; const Real defaultWidth = 10.0f; - - Char texture_name[64]; - Int nameLen; + Char texture_name[ARRAY_SIZE(shadowInfo->m_ShadowName)]; //simple decal using the premade texture specified. //can be always perpendicular to model's z-axis or projected //onto world geometry. - nameLen=strlen(shadowInfo->m_ShadowName); - if (nameLen <= 1) //no texture name given, use same as object - { strcpy(texture_name,defaultDecalName); + if (strlen(shadowInfo->m_ShadowName) <= 1) //no texture name given, use same as object + { + strcpy(texture_name, defaultDecalName); } else - { strncpy(texture_name,shadowInfo->m_ShadowName,nameLen); - strcpy(texture_name+nameLen,".tga"); //append texture extension + { + strlcpy(texture_name, shadowInfo->m_ShadowName, ARRAY_SIZE(texture_name)); + strlcat(texture_name, ".tga", ARRAY_SIZE(texture_name)); } st=m_W3DShadowTextureManager->getTexture(texture_name); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp index d6eaa6030fe..28bb07e9ab2 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp @@ -599,8 +599,8 @@ class W3DShadowGeometry : public RefCountClass, public HashableClass const char * Get_Name(void) const { return m_namebuf;} void Set_Name(const char *name) - { memset(m_namebuf,0,sizeof(m_namebuf)); //pad with zero so always ends with null character. - strncpy(m_namebuf,name,sizeof(m_namebuf)-1); + { + strlcpy(m_namebuf,name,sizeof(m_namebuf)); } Int getMeshCount(void) { return m_meshCount;} W3DShadowGeometryMesh *getMesh(Int index) { return &m_meshList[index];} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp index 23e043019aa..4c9336143ff 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp @@ -144,7 +144,7 @@ char const * GameFileClass::Set_Name( char const *filename ) Close(); // save the filename - strncpy( m_filename, filename, _MAX_PATH ); + strlcpy( m_filename, filename, _MAX_PATH ); char name[_MAX_PATH]; const Int EXT_LEN = 32; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp index 08a24c78514..35b3c12824a 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp @@ -126,8 +126,7 @@ Bool W3DTerrainLogic::loadMap( AsciiString filename , Bool query ) length = strlen( tempBuf ); if( length >= 4 ) { - memset( filenameBuf, '\0', _MAX_PATH); - strncpy( filenameBuf, tempBuf, length - 4); + strlcpy( filenameBuf, tempBuf, length - 4 + 1); } // const char *fname = filename.reverseFind('\\'); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp index d39237856c2..252c3f17e52 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp @@ -47,7 +47,7 @@ DDSFileClass::DDSFileClass(const char* name,unsigned reduction_factor) DateTime(0), CubeFaceSize(0) { - strncpy(Name,name,sizeof(Name)); + strlcpy(Name,name,sizeof(Name)); // The name could be given in .tga or .dds format, so ensure we're opening .dds... int len=strlen(Name); Name[len-3]='d'; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp index 6aa7ec4ab3e..33adbebd630 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp @@ -2940,8 +2940,7 @@ IDirect3DSurface8 * DX8Wrapper::_Create_DX8_Surface(const char *filename_) // If file not found, try the dds format // else create a surface with missing texture in it char compressed_name[200]; - strncpy(compressed_name,filename_, ARRAY_SIZE(compressed_name)); - compressed_name[ARRAY_SIZE(compressed_name)-1] = '\0'; + strlcpy(compressed_name,filename_, sizeof(compressed_name)); char *ext = strstr(compressed_name, "."); if ( ext && (strlen(ext)==4) && ( (ext[1] == 't') || (ext[1] == 'T') ) && diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp index 261d70a2ff7..9f84919dbdb 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp @@ -165,7 +165,7 @@ class ProxyRecordClass void Init(const W3dHLodSubObjectStruct & w3d_data) { BoneIndex = w3d_data.BoneIndex; - strncpy(Name,w3d_data.Name,sizeof(Name)); + strlcpy(Name,w3d_data.Name,sizeof(Name)); } int Get_Bone_Index(void) { return BoneIndex; } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp index b8ed2bfc322..be53ca5e636 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp @@ -343,8 +343,7 @@ bool HMorphAnimClass::Import(const char *hierarchy_name, TextFileClass &text_des // // Copy the hierarchy name into a class variable // - ::strncpy (HierarchyName, hierarchy_name, W3D_NAME_LEN); - HierarchyName[W3D_NAME_LEN - 1] = 0; + strlcpy (HierarchyName, hierarchy_name, W3D_NAME_LEN); // // Attempt to load the new base pose @@ -549,8 +548,8 @@ int HMorphAnimClass::Load_W3D(ChunkLoadClass & cload) cload.Read(&header,sizeof(header)); cload.Close_Chunk(); - strncpy(AnimName,header.Name,sizeof(AnimName)); - strncpy(HierarchyName,header.HierarchyName,sizeof(HierarchyName)); + strlcpy(AnimName,header.Name,sizeof(AnimName)); + strlcpy(HierarchyName,header.HierarchyName,sizeof(HierarchyName)); strcpy(Name,HierarchyName); strcat(Name,"."); strcat(Name,AnimName); @@ -620,9 +619,8 @@ int HMorphAnimClass::Save_W3D(ChunkSaveClass & csave) // init the header data W3dMorphAnimHeaderStruct header; - memset(&header,0,sizeof(header)); - strncpy(header.Name,AnimName,sizeof(header.Name)); - strncpy(header.HierarchyName,HierarchyName,sizeof(header.HierarchyName)); + strlcpy(header.Name,AnimName,sizeof(header.Name)); + strlcpy(header.HierarchyName,HierarchyName,sizeof(header.HierarchyName)); header.FrameCount = FrameCount; header.FrameRate = FrameRate; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp index 1f61bb410c2..0a625a64ba8 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp @@ -219,7 +219,7 @@ int HRawAnimClass::Load_W3D(ChunkLoadClass & cload) WWASSERT(HierarchyName != NULL); WWASSERT(aheader.HierarchyName != NULL); WWASSERT(sizeof(HierarchyName) >= W3D_NAME_LEN); - strncpy(HierarchyName,aheader.HierarchyName,W3D_NAME_LEN); + strlcpy(HierarchyName,aheader.HierarchyName,W3D_NAME_LEN); HTreeClass * base_pose = WW3DAssetManager::Get_Instance()->Get_HTree(HierarchyName); if (base_pose == NULL) { diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp index c1447792e83..b6dfc18e66f 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp @@ -2329,9 +2329,9 @@ WW3DErrorType MeshModelClass::write_header(ChunkSaveClass & csave,MeshSaveContex hierarchy_name_len = (int)mesh_name - (int)name; mesh_name++; } - assert( hierarchy_name_len <= W3D_NAME_LEN); - strncpy( header.MeshName, mesh_name, W3D_NAME_LEN); - strncpy( header.ContainerName, name, hierarchy_name_len); + assert( hierarchy_name_len < W3D_NAME_LEN); + strlcpy( header.MeshName, mesh_name, W3D_NAME_LEN); + strlcpy( header.ContainerName, name, hierarchy_name_len + 1); } else { sprintf(header.MeshName,"UnNamed"); } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/BlendMaterial.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/BlendMaterial.cpp index 170b9ca18b3..e8ea32a206a 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/BlendMaterial.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/BlendMaterial.cpp @@ -239,7 +239,7 @@ void BlendMaterial::updateTextures(void) for (i=WorldHeightMapEdit::getNumTexClasses()-1; i>=0; i--) { char path[_MAX_PATH]; AsciiString uiName = WorldHeightMapEdit::getTexClassUiName(i); - strncpy(path, uiName.str(), _MAX_PATH-2); + strlcpy(path, uiName.str(), _MAX_PATH); addTerrain(path, i, TVI_ROOT); } m_updating = false; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/EditAction.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/EditAction.cpp index 7b517725214..bae26db5dab 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/EditAction.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/EditAction.cpp @@ -140,8 +140,7 @@ BOOL EditAction::OnInitDialog() count = 0; } if (count>0) { - strncpy(prefix, nameStart, count); - prefix[count-1] = 0; + strlcpy(prefix, nameStart, count); parent = findOrAdd(&m_actionTreeView, parent, prefix); } } while (count>0); @@ -178,8 +177,7 @@ BOOL EditAction::OnInitDialog() count = 0; } if (count>0) { - strncpy(prefix, nameStart, count); - prefix[count-1] = 0; + strlcpy(prefix, nameStart, count); parent = findOrAdd(&m_actionTreeView, parent, prefix); } } while (count>0); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/EditCondition.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/EditCondition.cpp index b591d856a3e..6df3962f51b 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/EditCondition.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/EditCondition.cpp @@ -152,8 +152,7 @@ BOOL EditCondition::OnInitDialog() count = 0; } if (count>0) { - strncpy(prefix, nameStart, count); - prefix[count-1] = 0; + strlcpy(prefix, nameStart, count); parent = findOrAdd(&m_conditionTreeView, parent, prefix); } } while (count>0); @@ -190,8 +189,7 @@ BOOL EditCondition::OnInitDialog() count = 0; } if (count>0) { - strncpy(prefix, nameStart, count); - prefix[count-1] = 0; + strlcpy(prefix, nameStart, count); parent = findOrAdd(&m_conditionTreeView, parent, prefix); } } while (count>0); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp index ea444f637a1..69299bc306e 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp @@ -369,7 +369,7 @@ void TerrainMaterial::updateTextures(WorldHeightMapEdit *pMap) for (i=0; igetNumTexClasses(); i++) { char path[_MAX_PATH]; AsciiString uiName = pMap->getTexClassUiName(i); - strncpy(path, uiName.str(), _MAX_PATH-2); + strlcpy(path, uiName.str(), _MAX_PATH); m_staticThis->addTerrain(path, i, TVI_ROOT); } m_staticThis->m_updating = false; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainModal.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainModal.cpp index ac4dfb619f8..17afe7ba5ed 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainModal.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainModal.cpp @@ -234,7 +234,7 @@ void TerrainModal::updateTextures(void) } const char *tName = WorldHeightMapEdit::getTexClassName(i).str(); char path[_MAX_PATH]; - strncpy(path, tName, _MAX_PATH-2); + strlcpy(path, tName, _MAX_PATH); addTerrain(path, i, TVI_ROOT); } setTerrainTreeViewSelection(TVI_ROOT, m_currentFgTexture); From 14211bb809795479920694d2a039384362d84d03 Mon Sep 17 00:00:00 2001 From: Paul Levlin Date: Wed, 15 Oct 2025 21:42:34 +0200 Subject: [PATCH 171/343] build(memory): Add placement new for VC6 compat with GameMemoryNull (#1701) --- Core/GameEngine/Include/Common/GameMemoryNull.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Core/GameEngine/Include/Common/GameMemoryNull.h b/Core/GameEngine/Include/Common/GameMemoryNull.h index bf0ee87bc3d..5babbf4553c 100644 --- a/Core/GameEngine/Include/Common/GameMemoryNull.h +++ b/Core/GameEngine/Include/Common/GameMemoryNull.h @@ -163,3 +163,9 @@ extern void* __cdecl operator new[](size_t size, const char *, int); extern void __cdecl operator delete[](void *p, const char *, int); #endif + +#if defined(_MSC_VER) && _MSC_VER < 1300 +// additional overloads for 'placement new' +inline void* __cdecl operator new[](size_t s, void* p) { return p; } +inline void __cdecl operator delete[](void*, void* p) {} +#endif From 47b4cdcd1ad11c2045302fa839497cb661f97828 Mon Sep 17 00:00:00 2001 From: SkyAero <21192585+Skyaero42@users.noreply.github.com> Date: Wed, 15 Oct 2025 21:50:44 +0200 Subject: [PATCH 172/343] fix: Replace strcat with strlcat for robustness (#1685) --- .../GameEngine/Source/Common/System/Debug.cpp | 24 ++++++------- .../Source/Common/System/GameMemory.cpp | 2 +- .../Source/Common/System/GameMemoryInit.cpp | 2 +- .../Libraries/Source/WWVegas/WW3D2/hcanim.cpp | 4 +-- .../Source/WWVegas/WW3D2/hmdldef.cpp | 4 +-- .../Source/WWVegas/WW3D2/w3d_dep.cpp | 2 +- .../Source/WWVegas/WWDownload/FTP.CPP | 9 ++--- .../Libraries/Source/WWVegas/WWLib/Except.cpp | 18 +++++----- .../Source/WWVegas/WWLib/registry.cpp | 16 ++++----- Core/Libraries/Source/debug/debug_debug.cpp | 5 +-- Core/Libraries/Source/debug/debug_io_flat.cpp | 3 +- .../Source/profile/profile_highlevel.cpp | 1 + Core/Tools/ImagePacker/CMakeLists.txt | 1 + Core/Tools/ImagePacker/Source/ImagePacker.cpp | 5 +-- .../WindowProcedures/DirectorySelect.cpp | 7 ++-- Core/Tools/W3DView/AnimReportPage.cpp | 2 +- Core/Tools/W3DView/AnimReportPage.h | 2 +- Core/Tools/W3DView/GraphicView.cpp | 2 +- Core/Tools/W3DView/MainFrm.cpp | 2 +- Core/Tools/W3DView/W3DViewDoc.cpp | 2 +- .../Code/GameEngine/Source/Common/INI/INI.cpp | 8 ++--- .../GameEngine/Source/Common/PerfTimer.cpp | 2 +- .../Source/Common/System/StackDump.cpp | 2 +- .../Source/GameLogic/ScriptEngine/Scripts.cpp | 2 +- .../W3DDevice/GameClient/W3DBridgeBuffer.cpp | 6 ++-- .../W3DDevice/GameClient/W3DDisplay.cpp | 2 +- .../W3DDevice/GameClient/W3DFileSystem.cpp | 20 +++++------ .../Source/WWVegas/WW3D2/hmorphanim.cpp | 4 +-- .../Source/WWVegas/WW3D2/hrawanim.cpp | 4 +-- .../Source/WWVegas/WW3D2/meshgeometry.cpp | 4 +-- .../Source/WWVegas/WW3D2/meshmdlio.cpp | 4 +-- .../Dialog Procedures/ListboxProperties.cpp | 4 +-- .../GUIEdit/Source/GUIEditWindowManager.cpp | 4 +-- .../Tools/GUIEdit/Source/HierarchyView.cpp | 4 +-- Generals/Code/Tools/GUIEdit/Source/Save.cpp | 36 +++++++++---------- .../Code/Tools/WorldBuilder/src/BuildList.cpp | 6 ++-- .../WorldBuilder/src/MeshMoldOptions.cpp | 2 +- .../Tools/WorldBuilder/src/ObjectOptions.cpp | 6 ++-- .../Code/Tools/WorldBuilder/src/OpenMap.cpp | 12 +++---- .../Tools/WorldBuilder/src/RoadOptions.cpp | 4 +-- .../Code/Tools/WorldBuilder/src/SaveMap.cpp | 10 +++--- .../Tools/WorldBuilder/src/WorldBuilder.cpp | 6 ++-- .../WorldBuilder/src/WorldBuilderDoc.cpp | 8 ++--- .../Code/GameEngine/Source/Common/INI/INI.cpp | 8 ++--- .../GameEngine/Source/Common/PerfTimer.cpp | 2 +- .../Source/Common/System/StackDump.cpp | 2 +- .../Source/GameLogic/ScriptEngine/Scripts.cpp | 2 +- .../W3DDevice/GameClient/W3DBridgeBuffer.cpp | 6 ++-- .../W3DDevice/GameClient/W3DDisplay.cpp | 2 +- .../W3DDevice/GameClient/W3DFileSystem.cpp | 22 ++++++------ .../Source/WWVegas/WW3D2/hmorphanim.cpp | 4 +-- .../Source/WWVegas/WW3D2/hrawanim.cpp | 4 +-- .../Source/WWVegas/WW3D2/meshgeometry.cpp | 4 +-- .../Source/WWVegas/WW3D2/meshmdlio.cpp | 4 +-- GeneralsMD/Code/Main/WinMain.cpp | 2 +- .../Dialog Procedures/ListboxProperties.cpp | 4 +-- .../GUIEdit/Source/GUIEditWindowManager.cpp | 4 +-- .../Tools/GUIEdit/Source/HierarchyView.cpp | 4 +-- GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp | 36 +++++++++---------- .../Code/Tools/WorldBuilder/src/BuildList.cpp | 6 ++-- .../WorldBuilder/src/MeshMoldOptions.cpp | 2 +- .../Tools/WorldBuilder/src/ObjectOptions.cpp | 6 ++-- .../Code/Tools/WorldBuilder/src/OpenMap.cpp | 12 +++---- .../Tools/WorldBuilder/src/RoadOptions.cpp | 4 +-- .../Code/Tools/WorldBuilder/src/SaveMap.cpp | 10 +++--- .../Tools/WorldBuilder/src/WorldBuilder.cpp | 6 ++-- .../WorldBuilder/src/WorldBuilderDoc.cpp | 8 ++--- 67 files changed, 222 insertions(+), 215 deletions(-) diff --git a/Core/GameEngine/Source/Common/System/Debug.cpp b/Core/GameEngine/Source/Common/System/Debug.cpp index 88a65e228fc..55dcdcd65f2 100644 --- a/Core/GameEngine/Source/Common/System/Debug.cpp +++ b/Core/GameEngine/Source/Common/System/Debug.cpp @@ -388,24 +388,24 @@ void DebugInit(int flags) } strcpy(theLogFileNamePrev, dirbuf); - strcat(theLogFileNamePrev, gAppPrefix); - strcat(theLogFileNamePrev, DEBUG_FILE_NAME_PREV); + strlcat(theLogFileNamePrev, gAppPrefix, ARRAY_SIZE(theLogFileNamePrev)); + strlcat(theLogFileNamePrev, DEBUG_FILE_NAME_PREV, ARRAY_SIZE(theLogFileNamePrev)); if (rts::ClientInstance::getInstanceId() > 1u) { size_t offset = strlen(theLogFileNamePrev); snprintf(theLogFileNamePrev + offset, ARRAY_SIZE(theLogFileNamePrev) - offset, "_Instance%.2u", rts::ClientInstance::getInstanceId()); } - strcat(theLogFileNamePrev, ".txt"); + strlcat(theLogFileNamePrev, ".txt", ARRAY_SIZE(theLogFileNamePrev)); strcpy(theLogFileName, dirbuf); - strcat(theLogFileName, gAppPrefix); - strcat(theLogFileName, DEBUG_FILE_NAME); + strlcat(theLogFileName, gAppPrefix, ARRAY_SIZE(theLogFileNamePrev)); + strlcat(theLogFileName, DEBUG_FILE_NAME, ARRAY_SIZE(theLogFileNamePrev)); if (rts::ClientInstance::getInstanceId() > 1u) { size_t offset = strlen(theLogFileName); snprintf(theLogFileName + offset, ARRAY_SIZE(theLogFileName) - offset, "_Instance%.2u", rts::ClientInstance::getInstanceId()); } - strcat(theLogFileName, ".txt"); + strlcat(theLogFileName, ".txt", ARRAY_SIZE(theLogFileNamePrev)); remove(theLogFileNamePrev); rename(theLogFileName, theLogFileNamePrev); @@ -509,7 +509,7 @@ void DebugCrash(const char *format, ...) char theCrashBuffer[ LARGE_BUFFER ]; prepBuffer(theCrashBuffer); - strcat(theCrashBuffer, "ASSERTION FAILURE: "); + strlcat(theCrashBuffer, "ASSERTION FAILURE: ", ARRAY_SIZE(theCrashBuffer)); va_list arg; va_start(arg, format); @@ -538,7 +538,7 @@ void DebugCrash(const char *format, ...) #endif } - strcat(theCrashBuffer, "\n\nAbort->exception; Retry->debugger; Ignore->continue"); + strlcat(theCrashBuffer, "\n\nAbort->exception; Retry->debugger; Ignore->continue", ARRAY_SIZE(theCrashBuffer)); const int result = doCrashBox(theCrashBuffer, useLogging); @@ -737,9 +737,9 @@ void ReleaseCrash(const char *reason) } strcpy(prevbuf, TheGlobalData->getPath_UserData().str()); - strcat(prevbuf, RELEASECRASH_FILE_NAME_PREV); + strlcat(prevbuf, RELEASECRASH_FILE_NAME_PREV, ARRAY_SIZE(prevbuf)); strcpy(curbuf, TheGlobalData->getPath_UserData().str()); - strcat(curbuf, RELEASECRASH_FILE_NAME); + strlcat(curbuf, RELEASECRASH_FILE_NAME, ARRAY_SIZE(curbuf)); remove(prevbuf); rename(curbuf, prevbuf); @@ -826,9 +826,9 @@ void ReleaseCrashLocalized(const AsciiString& p, const AsciiString& m) char curbuf[ _MAX_PATH ]; strcpy(prevbuf, TheGlobalData->getPath_UserData().str()); - strcat(prevbuf, RELEASECRASH_FILE_NAME_PREV); + strlcat(prevbuf, RELEASECRASH_FILE_NAME_PREV, ARRAY_SIZE(prevbuf)); strcpy(curbuf, TheGlobalData->getPath_UserData().str()); - strcat(curbuf, RELEASECRASH_FILE_NAME); + strlcat(curbuf, RELEASECRASH_FILE_NAME, ARRAY_SIZE(curbuf)); remove(prevbuf); rename(curbuf, prevbuf); diff --git a/Core/GameEngine/Source/Common/System/GameMemory.cpp b/Core/GameEngine/Source/Common/System/GameMemory.cpp index 81d70b9d554..8fcf71b1388 100644 --- a/Core/GameEngine/Source/Common/System/GameMemory.cpp +++ b/Core/GameEngine/Source/Common/System/GameMemory.cpp @@ -2976,7 +2976,7 @@ void MemoryPoolFactory::memoryPoolUsageReport( const char* filename, FILE *appen { char tmp[256]; strcpy(tmp,filename); - strcat(tmp,".csv"); + strlcat(tmp, ".csv", ARRAY_SIZE(tmp)); perfStatsFile = fopen(tmp, "w"); } else diff --git a/Core/GameEngine/Source/Common/System/GameMemoryInit.cpp b/Core/GameEngine/Source/Common/System/GameMemoryInit.cpp index 3f559fbdd05..7a1b0de9484 100644 --- a/Core/GameEngine/Source/Common/System/GameMemoryInit.cpp +++ b/Core/GameEngine/Source/Common/System/GameMemoryInit.cpp @@ -123,7 +123,7 @@ void userMemoryManagerInitPools() } --pEnd; } - strcat(buf, "\\Data\\INI\\MemoryPools.ini"); + strlcat(buf, "\\Data\\INI\\MemoryPools.ini", ARRAY_SIZE(buf)); FILE* fp = fopen(buf, "r"); if (fp) diff --git a/Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp b/Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp index 0136f448826..2f0589fa4ca 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp @@ -257,8 +257,8 @@ int HCompressedAnimClass::Load_W3D(ChunkLoadClass & cload) cload.Close_Chunk(); strcpy(Name,aheader.HierarchyName); - strcat(Name,"."); - strcat(Name,aheader.Name); + strlcat(Name, ".", ARRAY_SIZE(Name)); + strlcat(Name, aheader.Name, ARRAY_SIZE(Name)); // TSS chasing crash bug 05/26/99 WWASSERT(HierarchyName != NULL); diff --git a/Core/Libraries/Source/WWVegas/WW3D2/hmdldef.cpp b/Core/Libraries/Source/WWVegas/WW3D2/hmdldef.cpp index 352e56d35bf..fb4b04d0700 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/hmdldef.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/hmdldef.cpp @@ -234,8 +234,8 @@ bool HModelDefClass::read_connection(ChunkLoadClass & cload,HmdlNodeDefStruct * } strcpy(node->RenderObjName,ModelName); - strcat(node->RenderObjName,"."); - strcat(node->RenderObjName,con.RenderObjName); + strlcat(node->RenderObjName, ".", ARRAY_SIZE(node->RenderObjName)); + strlcat(node->RenderObjName, con.RenderObjName, ARRAY_SIZE(node->RenderObjName)); if (pre30) { if (con.PivotIdx == 65535) { diff --git a/Core/Libraries/Source/WWVegas/WW3D2/w3d_dep.cpp b/Core/Libraries/Source/WWVegas/WW3D2/w3d_dep.cpp index 38c7e8a3e01..81659faabf5 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/w3d_dep.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/w3d_dep.cpp @@ -570,6 +570,6 @@ static const char * Make_W3D_Filename (const char *w3d_name) if (dot) *dot = 0; strlwr(buffer); - strcat(buffer, ".w3d"); + strlcat(buffer, ".w3d", ARRAY_SIZE(buffer)); return buffer; } diff --git a/Core/Libraries/Source/WWVegas/WWDownload/FTP.CPP b/Core/Libraries/Source/WWVegas/WWDownload/FTP.CPP index 2cea0011612..36296fa3354 100644 --- a/Core/Libraries/Source/WWVegas/WWDownload/FTP.CPP +++ b/Core/Libraries/Source/WWVegas/WWDownload/FTP.CPP @@ -36,6 +36,7 @@ #include #include #include +#include //#include "wlib/wstring.h" #include "stringex.h" @@ -141,7 +142,7 @@ static bool Use_Non_Blocking_Mode(void) if ((regRetval!=ERROR_SUCCESS) || (type != REG_DWORD)) return(TRUE); - return(bool(value)); + return bool(value); } @@ -679,7 +680,7 @@ HRESULT Cftp::FindFile( LPCSTR szRemoteFileName, int * piSize ) _splitpath( szRemoteFileName, NULL, m_szRemoteFilePath+strlen(m_szRemoteFilePath), m_szRemoteFileName, ext ); - strcat( m_szRemoteFileName, ext ); + strlcat(m_szRemoteFileName, ext, ARRAY_SIZE(m_szRemoteFileName)); for( i = 0; i < (int)strlen( m_szRemoteFilePath ); i++ ) { @@ -1723,11 +1724,11 @@ HRESULT Cftp::FileRecoveryPosition( LPCSTR szLocalFileName, LPCSTR szRegistryRo strcpy( regkey, szRegistryRoot ); if( regkey[ strlen( regkey ) - 1 ] != '\\' ) { - strcat( regkey, "\\Download" ); + strlcat(regkey, "\\Download", ARRAY_SIZE(regkey)); } else { - strcat( regkey, "Download" ); + strlcat(regkey, "Download", ARRAY_SIZE(regkey)); } if( RegOpenKeyEx( HKEY_LOCAL_MACHINE, (LPCTSTR)regkey, diff --git a/Core/Libraries/Source/WWVegas/WWLib/Except.cpp b/Core/Libraries/Source/WWVegas/WWLib/Except.cpp index 8829a550ecb..6de15adbb59 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/Except.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/Except.cpp @@ -224,7 +224,7 @@ char const * Last_Error_Text(void) *=============================================================================================*/ static void Add_Txt (char const *txt) { - if (strlen(ExceptionText) + strlen(txt) < 65535) { + if (strlen(ExceptionText) + strlen(txt) < ARRAY_SIZE(ExceptionText) - 1) { strcat(ExceptionText, txt); } #if (0) @@ -653,15 +653,15 @@ void Dump_Exception_Info(EXCEPTION_POINTERS *e_info) for (int c = 0 ; c < 32 ; c++) { if (IsBadReadPtr(eip_ptr, 1)) { - strcat(scrap, "?? "); + strlcat(scrap, "?? ", ARRAY_SIZE(scrap)); } else { sprintf(bytestr, "%02X ", *eip_ptr); - strcat(scrap, bytestr); + strlcat(scrap, bytestr, ARRAY_SIZE(scrap)); } eip_ptr++; } - strcat(scrap, "\r\n\r\n"); + strlcat(scrap, "\r\n\r\n", ARRAY_SIZE(scrap)); Add_Txt(scrap); /* @@ -677,14 +677,14 @@ void Dump_Exception_Info(EXCEPTION_POINTERS *e_info) ** The stack contents cannot be read so just print up question marks. */ sprintf(scrap, "%p: ", static_cast(stackptr)); - strcat(scrap, "????????\r\n"); + strlcat(scrap, "????????\r\n", ARRAY_SIZE(scrap)); } else { /* ** If this stack address is in our memory space then try to match it with a code symbol. */ if (IsBadCodePtr((FARPROC)*stackptr)) { sprintf(scrap, "%p: %08lX ", static_cast(stackptr), *stackptr); - strcat(scrap, "DATA_PTR\r\n"); + strlcat(scrap, "DATA_PTR\r\n", ARRAY_SIZE(scrap)); } else { sprintf(scrap, "%p: %08lX", static_cast(stackptr), *stackptr); @@ -697,12 +697,12 @@ void Dump_Exception_Info(EXCEPTION_POINTERS *e_info) if (_SymGetSymFromAddr != NULL && _SymGetSymFromAddr (GetCurrentProcess(), *stackptr, &displacement, symptr)) { char symbuf[256]; sprintf(symbuf, " - %s + %08X", symptr->Name, displacement); - strcat(scrap, symbuf); + strlcat(scrap, symbuf, ARRAY_SIZE(scrap)); } } else { - strcat (scrap, " *"); + strlcat(scrap, " *", ARRAY_SIZE(scrap)); } - strcat (scrap, "\r\n"); + strlcat(scrap, "\r\n", ARRAY_SIZE(scrap)); } } Add_Txt(scrap); diff --git a/Core/Libraries/Source/WWVegas/WWLib/registry.cpp b/Core/Libraries/Source/WWVegas/WWLib/registry.cpp index cabbd36243f..d5680ee7edb 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/registry.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/registry.cpp @@ -386,7 +386,7 @@ void RegistryClass::Save_Registry_Values(HKEY key, char *path, INIClass *ini) */ case REG_DWORD: strcpy(save_name, "DWORD_"); - strcat(save_name, value_name); + strlcat(save_name, value_name, ARRAY_SIZE(save_name)); ini->Put_Int(path, save_name, *((unsigned long*)data)); break; @@ -395,7 +395,7 @@ void RegistryClass::Save_Registry_Values(HKEY key, char *path, INIClass *ini) */ case REG_SZ: strcpy(save_name, "STRING_"); - strcat(save_name, value_name); + strlcat(save_name, value_name, ARRAY_SIZE(save_name)); ini->Put_String(path, save_name, (char*)data); break; @@ -404,7 +404,7 @@ void RegistryClass::Save_Registry_Values(HKEY key, char *path, INIClass *ini) */ case REG_BINARY: strcpy(save_name, "BIN_"); - strcat(save_name, value_name); + strlcat(save_name, value_name, ARRAY_SIZE(save_name)); ini->Put_UUBlock(path, save_name, (char*)data, data_size); break; @@ -471,8 +471,8 @@ void RegistryClass::Save_Registry_Tree(char *path, INIClass *ini) */ char new_key_path[512]; strcpy(new_key_path, path); - strcat(new_key_path, "\\"); - strcat(new_key_path, name); + strlcat(new_key_path, "\\", ARRAY_SIZE(new_key_path)); + strlcat(new_key_path, name, ARRAY_SIZE(new_key_path)); unsigned long num_subs = 0; unsigned long num_values = 0; @@ -567,7 +567,7 @@ void RegistryClass::Load_Registry(const char *filename, char *old_path, char *ne strcpy(path, new_path); char *cut = strstr(section_name, old_path); if (cut) { - strcat(path, cut + old_path_len); + strlcat(path, cut + old_path_len, ARRAY_SIZE(path)); } /* @@ -694,8 +694,8 @@ void RegistryClass::Delete_Registry_Tree(char *path) */ char new_key_path[512]; strcpy(new_key_path, path); - strcat(new_key_path, "\\"); - strcat(new_key_path, name); + strlcat(new_key_path, "\\", ARRAY_SIZE(new_key_path)); + strlcat(new_key_path, name, ARRAY_SIZE(new_key_path)); unsigned long num_subs = 0; unsigned long num_values = 0; diff --git a/Core/Libraries/Source/debug/debug_debug.cpp b/Core/Libraries/Source/debug/debug_debug.cpp index a2fbc3b6960..9aeb7ec4cdb 100644 --- a/Core/Libraries/Source/debug/debug_debug.cpp +++ b/Core/Libraries/Source/debug/debug_debug.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include // needed for placement new prototype // a little dummy variable that makes the linker actually include @@ -347,7 +348,7 @@ bool Debug::AssertDone(void) "time being (stops logging this assertion as well)."; char *help=(char *)DebugAllocMemory(ioBuffer[curType].used+strlen(addInfo)+1); strcpy(help,ioBuffer[curType].buffer+82); - strcat(help,addInfo); + strlcat(help, addInfo, ARRAY_SIZE(help)); // First hit? Then do a stack trace if (curFrameEntry->hits==1) @@ -611,7 +612,7 @@ bool Debug::CrashDone(bool die) #endif char *help=(char *)DebugAllocMemory(ioBuffer[curType].used+strlen(addInfo)+1); strcpy(help,ioBuffer[curType].buffer+82); - strcat(help,addInfo); + strlcat(help, addInfo, ARRAY_SIZE(help)); // First hit? Then do a stack trace if (curFrameEntry->hits==1) diff --git a/Core/Libraries/Source/debug/debug_io_flat.cpp b/Core/Libraries/Source/debug/debug_io_flat.cpp index 196a0892aad..80c6ff3a620 100644 --- a/Core/Libraries/Source/debug/debug_io_flat.cpp +++ b/Core/Libraries/Source/debug/debug_io_flat.cpp @@ -29,6 +29,7 @@ #include "_pch.h" #include "stringex.h" #include +#include #include // needed for placement new prototype DebugIOFlat::OutputStream::OutputStream(const char *filename, unsigned maxSize): @@ -94,7 +95,7 @@ void DebugIOFlat::OutputStream::Delete(const char *path) if (++run) wsprintf(help+strlen(help),"(%i)%s",run,ext); else - strcat(help,ext); + strlcat(help, ext, ARRAY_SIZE(help)); if (CopyFile(m_fileName,help,TRUE)) break; if (GetLastError()!=ERROR_FILE_EXISTS) diff --git a/Core/Libraries/Source/profile/profile_highlevel.cpp b/Core/Libraries/Source/profile/profile_highlevel.cpp index f0915297893..566cb8cbcf8 100644 --- a/Core/Libraries/Source/profile/profile_highlevel.cpp +++ b/Core/Libraries/Source/profile/profile_highlevel.cpp @@ -29,6 +29,7 @@ #include "_pch.h" #include "stringex.h" #include +#include #include // our own fast critical section diff --git a/Core/Tools/ImagePacker/CMakeLists.txt b/Core/Tools/ImagePacker/CMakeLists.txt index eb944eda28d..c71eefca56d 100644 --- a/Core/Tools/ImagePacker/CMakeLists.txt +++ b/Core/Tools/ImagePacker/CMakeLists.txt @@ -29,6 +29,7 @@ target_link_libraries(corei_imagepacker INTERFACE comctl32 core_debug core_profile + core_wwcommon dbghelplib imm32 vfw32 diff --git a/Core/Tools/ImagePacker/Source/ImagePacker.cpp b/Core/Tools/ImagePacker/Source/ImagePacker.cpp index 3796bbcdd4d..42c815a4ffc 100644 --- a/Core/Tools/ImagePacker/Source/ImagePacker.cpp +++ b/Core/Tools/ImagePacker/Source/ImagePacker.cpp @@ -44,6 +44,7 @@ #include #include #include +#include // USER INCLUDES ////////////////////////////////////////////////////////////// #include "stringex.h" @@ -1186,8 +1187,8 @@ Bool ImagePacker::process( void ) CreateDirectory( m_outputDirectory, NULL ); // subdir of output directory based on output image name - strcat( m_outputDirectory, m_outputFile ); - strcat( m_outputDirectory, "\\" ); + strlcat(m_outputDirectory, m_outputFile, ARRAY_SIZE(m_outputDirectory)); + strlcat(m_outputDirectory, "\\", ARRAY_SIZE(m_outputDirectory)); // // check for existing images in the output directory ... if we have diff --git a/Core/Tools/ImagePacker/Source/WindowProcedures/DirectorySelect.cpp b/Core/Tools/ImagePacker/Source/WindowProcedures/DirectorySelect.cpp index 3d944516e31..c76e57d98cd 100644 --- a/Core/Tools/ImagePacker/Source/WindowProcedures/DirectorySelect.cpp +++ b/Core/Tools/ImagePacker/Source/WindowProcedures/DirectorySelect.cpp @@ -40,6 +40,7 @@ // SYSTEM INCLUDES //////////////////////////////////////////////////////////// #include #include +#include // USER INCLUDES ////////////////////////////////////////////////////////////// #include "ImagePacker.h" @@ -127,7 +128,7 @@ BOOL CALLBACK DirectorySelectProc( HWND hWndDialog, UINT message, // set the current directory in the top label GetCurrentDirectory( _MAX_PATH, buffer ); if( buffer[ strlen( buffer ) - 1 ] != '\\' ) - strcat( buffer, "\\" ); + strlcat(buffer, "\\", ARRAY_SIZE(buffer)); SetDlgItemText( hWndDialog, STATIC_CURRENT_DIR, buffer ); // load the drive box @@ -262,7 +263,7 @@ BOOL CALLBACK DirectorySelectProc( HWND hWndDialog, UINT message, // construct new direcotry name and update status text GetCurrentDirectory( _MAX_PATH, buffer ); if( buffer[ strlen( buffer ) - 1 ] != '\\' ) - strcat( buffer, "\\" ); + strlcat(buffer, "\\", ARRAY_SIZE(buffer)); SetDlgItemText( hWndDialog, STATIC_CURRENT_DIR, buffer ); EnableWindow( GetDlgItem( hWndDialog, BUTTON_ADD ), FALSE ); @@ -353,7 +354,7 @@ BOOL CALLBACK DirectorySelectProc( HWND hWndDialog, UINT message, // construct new direcotry name and update status text GetCurrentDirectory( _MAX_PATH, buffer ); if( buffer[ strlen( buffer ) - 1 ] != '\\' ) - strcat( buffer, "\\" ); + strlcat(buffer, "\\", ARRAY_SIZE(buffer)); SetDlgItemText( hWndDialog, STATIC_CURRENT_DIR, buffer ); EnableWindow( GetDlgItem( hWndDialog, BUTTON_ADD ), FALSE ); diff --git a/Core/Tools/W3DView/AnimReportPage.cpp b/Core/Tools/W3DView/AnimReportPage.cpp index 5435dbfc422..1b5af2f3ce8 100644 --- a/Core/Tools/W3DView/AnimReportPage.cpp +++ b/Core/Tools/W3DView/AnimReportPage.cpp @@ -187,7 +187,7 @@ int CAnimReportPage::FindItem (const char *item_name) return m_AnimReport.FindItem(&lvfi); } -void CAnimReportPage::MakeChannelStr (int bone_idx, HAnimClass *hanim, char *channels) +void CAnimReportPage::MakeChannelStr (int bone_idx, HAnimClass *hanim, char channels[6]) { if (hanim->Has_X_Translation(bone_idx)) strcat(channels, "X"); diff --git a/Core/Tools/W3DView/AnimReportPage.h b/Core/Tools/W3DView/AnimReportPage.h index 74f9b96df33..914a57df3da 100644 --- a/Core/Tools/W3DView/AnimReportPage.h +++ b/Core/Tools/W3DView/AnimReportPage.h @@ -60,7 +60,7 @@ class CAnimReportPage : public CPropertyPage protected: void FillListControl (void); int FindItem (const char *item_name); - void MakeChannelStr (int bone_idx, HAnimClass *hanim, char *channels); + void MakeChannelStr(int bone_idx, HAnimClass* hanim, char channels[6]); CAdvancedAnimSheet *m_Sheet; diff --git a/Core/Tools/W3DView/GraphicView.cpp b/Core/Tools/W3DView/GraphicView.cpp index bb31526a1d0..9ddeb97c896 100644 --- a/Core/Tools/W3DView/GraphicView.cpp +++ b/Core/Tools/W3DView/GraphicView.cpp @@ -1327,7 +1327,7 @@ CGraphicView::Load_Default_Dat (void) } // Concat the default.dat filename onto the path - ::strcat (filename, "\\default.dat"); + strlcat(filename, "\\default.dat", ARRAY_SIZE(filename)); // Does the file exist in the directory? if (::GetFileAttributes (filename) != 0xFFFFFFFF) { diff --git a/Core/Tools/W3DView/MainFrm.cpp b/Core/Tools/W3DView/MainFrm.cpp index ce8035a5a29..e27917e65f3 100644 --- a/Core/Tools/W3DView/MainFrm.cpp +++ b/Core/Tools/W3DView/MainFrm.cpp @@ -687,7 +687,7 @@ CMainFrame::WindowProc // Concat the default.dat filename onto the path TCHAR full_path[MAX_PATH]; - ::strcat (filename, "\\settings"); + strlcat (filename, "\\settings", ARRAY_SIZE(filename)); ::wsprintf (full_path, "%s%d.dat", filename, (LOWORD(wParam) - IDM_SETTINGS1) + 1); // Does the file exist in the directory? diff --git a/Core/Tools/W3DView/W3DViewDoc.cpp b/Core/Tools/W3DView/W3DViewDoc.cpp index 19bd7530db1..9c6fc5707d2 100644 --- a/Core/Tools/W3DView/W3DViewDoc.cpp +++ b/Core/Tools/W3DView/W3DViewDoc.cpp @@ -1532,7 +1532,7 @@ CW3DViewDoc::SaveSettings if (szPath[::lstrlen (szPath)-1] != '\\') { // Ensure the path is directory delimited - ::strcat (szPath, "\\"); + strlcat(szPath, "\\", ARRAY_SIZE(szPath)); } // Prepend the filename with its new path diff --git a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp index 5fdd0966760..2b9fb9ce075 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp @@ -790,8 +790,8 @@ AsciiString INI::getNextQuotedAsciiString() if (strlen(token) > 1 && token[1] != '\t') { - strcat(buff, " "); - strcat(buff, token); + strlcat(buff, " ", ARRAY_SIZE(buff)); + strlcat(buff, token, ARRAY_SIZE(buff)); } else { Int buflen=strlen(buff); @@ -832,9 +832,9 @@ AsciiString INI::getNextAsciiString() if (strlen(token) > 1 && token[1] != '\t') { - strcat(buff, " "); + strlcat(buff, " ", ARRAY_SIZE(buff)); } - strcat(buff, token); + strlcat(buff, token, ARRAY_SIZE(buff)); result.set(buff); } } diff --git a/Generals/Code/GameEngine/Source/Common/PerfTimer.cpp b/Generals/Code/GameEngine/Source/Common/PerfTimer.cpp index c8912ef73db..d427b6fd019 100644 --- a/Generals/Code/GameEngine/Source/Common/PerfTimer.cpp +++ b/Generals/Code/GameEngine/Source/Common/PerfTimer.cpp @@ -273,7 +273,7 @@ void PerfGather::reset() char tmp[256]; strcpy(tmp, s_buf); - strcat(tmp, ".csv"); + strlcat(tmp, ".csv", ARRAY_SIZE(tmp)); s_perfStatsFile = fopen(tmp, "w"); s_perfDumpOptions = options; diff --git a/Generals/Code/GameEngine/Source/Common/System/StackDump.cpp b/Generals/Code/GameEngine/Source/Common/System/StackDump.cpp index 7e8d58b62f2..669264aa222 100644 --- a/Generals/Code/GameEngine/Source/Common/System/StackDump.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/StackDump.cpp @@ -616,7 +616,7 @@ void DumpExceptionInfo( unsigned int u, EXCEPTION_POINTERS* e_info ) else { sprintf (bytestr, "%02X ", *eip_ptr); - strcat (scrap, bytestr); + strlcat(scrap, bytestr, ARRAY_SIZE(scrap)); } eip_ptr++; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp index e97e15edaf0..496bdf224fc 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp @@ -2063,7 +2063,7 @@ Parameter *Parameter::ReadParameter(DataChunkInput &file) char newName[256]; strcpy(oldName, pParm->m_string.str()); strcpy(newName, "GLA"); - strcat(newName, oldName+strlen("Fundamentalist")); + strlcat(newName, oldName+strlen("Fundamentalist"), ARRAY_SIZE(newName)); pParm->m_string.set(newName); DEBUG_LOG(("Changing Script Ref from %s to %s", oldName, newName)); } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp index d96364cb710..693129dd39d 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp @@ -237,11 +237,11 @@ Bool W3DBridge::load(BodyDamageType curDamageState) char right[_MAX_PATH]; strcpy(left, modelName); - strcat(left, ".BRIDGE_LEFT"); + strlcat(left, ".BRIDGE_LEFT", ARRAY_SIZE(left)); strcpy(section, modelName); - strcat(section, ".BRIDGE_SPAN"); + strlcat(section, ".BRIDGE_SPAN", ARRAY_SIZE(section)); strcpy(right, modelName); - strcat(right, ".BRIDGE_RIGHT"); + strlcat(right, ".BRIDGE_RIGHT", ARRAY_SIZE(right)); m_bridgeTexture = pMgr->Get_Texture(textureFile, MIP_LEVELS_3); m_leftMtx.Make_Identity(); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index ed0dd771aae..7a23fc3d1e2 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -2900,7 +2900,7 @@ void W3DDisplay::takeScreenShot(void) sprintf( leafname, "%s%.3d.bmp", "sshot", frame_number++); #endif strcpy(pathname, TheGlobalData->getPath_UserData().str()); - strcat(pathname, leafname); + strlcat(pathname, leafname, ARRAY_SIZE(pathname)); if (_access( pathname, 0 ) == -1) done = true; } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp index d75fc310082..8b615401569 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp @@ -172,14 +172,14 @@ char const * GameFileClass::Set_Name( char const *filename ) { strcpy( m_filePath, W3D_DIR_PATH ); - strcat( m_filePath, filename ); + strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } else if( isImageFileType(fileType) ) { strcpy( m_filePath, TGA_DIR_PATH ); - strcat( m_filePath, filename ); + strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } else @@ -197,14 +197,14 @@ char const * GameFileClass::Set_Name( char const *filename ) { strcpy( m_filePath, LEGACY_W3D_DIR_PATH ); - strcat( m_filePath, filename ); + strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } else if( isImageFileType(fileType) ) { strcpy( m_filePath, LEGACY_TGA_DIR_PATH ); - strcat( m_filePath, filename ); + strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } @@ -223,14 +223,14 @@ char const * GameFileClass::Set_Name( char const *filename ) { strcpy( m_filePath, TEST_W3D_DIR_PATH ); - strcat( m_filePath, filename ); + strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } else if( isImageFileType(fileType) ) { strcpy( m_filePath, TEST_TGA_DIR_PATH ); - strcat( m_filePath, filename ); + strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } @@ -247,14 +247,14 @@ char const * GameFileClass::Set_Name( char const *filename ) { sprintf(m_filePath,USER_W3D_DIR_PATH, TheGlobalData->getPath_UserData().str()); //strcpy( m_filePath, USER_W3D_DIR_PATH ); - strcat( m_filePath, filename ); + strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } if( isImageFileType(fileType) ) { sprintf(m_filePath,USER_TGA_DIR_PATH, TheGlobalData->getPath_UserData().str()); //strcpy( m_filePath, USER_TGA_DIR_PATH ); - strcat( m_filePath, filename ); + strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } @@ -271,7 +271,7 @@ char const * GameFileClass::Set_Name( char const *filename ) { sprintf(m_filePath,MAP_PREVIEW_DIR_PATH, TheGlobalData->getPath_UserData().str()); //strcpy( m_filePath, USER_TGA_DIR_PATH ); - strcat( m_filePath, filename ); + strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } @@ -287,7 +287,7 @@ char const * GameFileClass::Set_Name( char const *filename ) { static const char *localizedPathFormat = "Data/%s/Art/Textures/"; sprintf(m_filePath,localizedPathFormat, GetRegistryLanguage().str()); - strcat( m_filePath, filename ); + strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp index ca25a66d09b..8214610364d 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp @@ -552,8 +552,8 @@ int HMorphAnimClass::Load_W3D(ChunkLoadClass & cload) strlcpy(AnimName,header.Name,sizeof(AnimName)); strlcpy(HierarchyName,header.HierarchyName,sizeof(HierarchyName)); strcpy(Name,HierarchyName); - strcat(Name,"."); - strcat(Name,AnimName); + strlcat(Name, ".", ARRAY_SIZE(Name)); + strlcat(Name, AnimName, ARRAY_SIZE(Name)); HTreeClass * base_pose = WW3DAssetManager::Get_Instance()->Get_HTree(HierarchyName); if (base_pose == NULL) { diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp index cf0398f0b53..ae95dfc9767 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp @@ -212,8 +212,8 @@ int HRawAnimClass::Load_W3D(ChunkLoadClass & cload) } strcpy(Name,aheader.HierarchyName); - strcat(Name,"."); - strcat(Name,aheader.Name); + strlcat(Name, ".", ARRAY_SIZE(Name)); + strlcat(Name, aheader.Name, ARRAY_SIZE(Name)); // TSS chasing crash bug 05/26/99 WWASSERT(HierarchyName != NULL); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp index 27d8d5567e3..221307965e6 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp @@ -1604,9 +1604,9 @@ WW3DErrorType MeshGeometryClass::Load_W3D(ChunkLoadClass & cload) if (strlen(header.ContainerName) > 0) { strcpy(tmpname,header.ContainerName); - strcat(tmpname,"."); + strcat(tmpname, "."); } - strcat(tmpname,header.MeshName); + strcat(tmpname, header.MeshName); Set_Name(tmpname); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp index d950ec4d04d..d50b7ebda37 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp @@ -275,9 +275,9 @@ WW3DErrorType MeshModelClass::Load_W3D(ChunkLoadClass & cload) if (strlen(context->Header.ContainerName) > 0) { strcpy(tmpname,context->Header.ContainerName); - strcat(tmpname,"."); + strcat(tmpname, "."); } - strcat(tmpname,context->Header.MeshName); + strcat(tmpname, context->Header.MeshName); Set_Name(tmpname); diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp index 770001592c9..7d73dea2097 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp @@ -948,8 +948,8 @@ HWND InitListboxPropertiesDialog( GameWindow *window ) sprintf(percentages,"%d",listData->columnWidthPercentage[0]); for(Int i = 1; i < listData->columns; i++ ) { - strcat(percentages,","); - strcat(percentages,itoa(listData->columnWidthPercentage[i],tempStr,10)); + strlcat(percentages, ",", ARRAY_SIZE(percentages)); + strlcat(percentages, itoa(listData->columnWidthPercentage[i],tempStr,10), ARRAY_SIZE(percentages)); } SetDlgItemText(dialog,EDIT_COLUMN_PERCENT,percentages); diff --git a/Generals/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp b/Generals/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp index f26eb7428eb..81f60d75e9b 100644 --- a/Generals/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp @@ -515,7 +515,7 @@ void GUIEditWindowManager::incrementName( GameWindow *window ) if( len == 0 ) { - strcat( name, "1" ); + strlcat(name, "1", ARRAY_SIZE(name)); goto cleanup; } @@ -586,7 +586,7 @@ void GUIEditWindowManager::incrementName( GameWindow *window ) { // no number at end, easy ... just append a number '1' - strcat( name, "1" ); + strlcat(name, "1", ARRAY_SIZE(name)); } diff --git a/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp b/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp index 59dc28e3128..9a10111a27c 100644 --- a/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp @@ -877,8 +877,8 @@ char *HierarchyView::getWindowTreeName( GameWindow *window ) if( !instData->m_decoratedNameString.isEmpty() ) { - strcat( buffer, ": " ); - strcat( buffer, instData->m_decoratedNameString.str() ); + strlcat(buffer, ": ", ARRAY_SIZE(buffer)); + strlcat(buffer, instData->m_decoratedNameString.str(), ARRAY_SIZE(buffer)); } diff --git a/Generals/Code/Tools/GUIEdit/Source/Save.cpp b/Generals/Code/Tools/GUIEdit/Source/Save.cpp index ea99537a36d..949f4ef1b47 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Save.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Save.cpp @@ -230,10 +230,10 @@ static Bool saveStatus( GameWindow *window, FILE *fp, Int dataIndent ) // if this is an additional bit add a + if( bitWritten == TRUE ) - strcat( buffer, "+"); + strlcat(buffer, "+", ARRAY_SIZE(buffer)); // add status name - strcat( buffer, WindowStatusNames[ i ] ); + strlcat(buffer, WindowStatusNames[ i ], ARRAY_SIZE(buffer)); bitWritten = TRUE; } @@ -243,10 +243,10 @@ static Bool saveStatus( GameWindow *window, FILE *fp, Int dataIndent ) // if no bits written write NONE in the file if( bitWritten == FALSE ) - strcat( buffer, "NONE" ); + strlcat(buffer, "NONE", ARRAY_SIZE(buffer)); // complete line and write - strcat( buffer, ";\n" ); + strlcat(buffer, ";\n", ARRAY_SIZE(buffer)); writeBufferToFile( fp, buffer ); return TRUE; @@ -274,10 +274,10 @@ static Bool saveStyle( GameWindow *window, FILE *fp, Int dataIndent ) // if this is an additional bit add a + if( bitWritten == TRUE ) - strcat( buffer, "+"); + strlcat(buffer, "+", ARRAY_SIZE(buffer)); // add status name - strcat( buffer, WindowStyleNames[ i ] ); + strlcat(buffer, WindowStyleNames[ i ], ARRAY_SIZE(buffer)); bitWritten = TRUE; } @@ -287,10 +287,10 @@ static Bool saveStyle( GameWindow *window, FILE *fp, Int dataIndent ) // if no bits written write NONE in the file if( bitWritten == FALSE ) - strcat( buffer, "NONE" ); + strlcat(buffer, "NONE", ARRAY_SIZE(buffer)); // complete line and write - strcat( buffer, ";\n" ); + strlcat(buffer, ";\n", ARRAY_SIZE(buffer)); writeBufferToFile( fp, buffer ); return TRUE; @@ -1115,11 +1115,11 @@ void GUIEdit::validateNames( GameWindow *root, char *filename, Bool *valid ) if( strlen( filename ) + instData->m_decoratedNameString.getLength() >= MAX_WINDOW_NAME_LEN ) { - strcat( offendingNames, "[Too Long] " ); - strcat( offendingNames, filename ); - strcat( offendingNames, ":" ); - strcat( offendingNames, instData->m_decoratedNameString.str() ); - strcat( offendingNames, "\n"); + strlcat(offendingNames, "[Too Long] ", ARRAY_SIZE(offendingNames)); + strlcat(offendingNames, filename, ARRAY_SIZE(offendingNames)); + strlcat(offendingNames, ":", ARRAY_SIZE(offendingNames)); + strlcat(offendingNames, instData->m_decoratedNameString.str(), ARRAY_SIZE(offendingNames)); + strlcat(offendingNames, "\n", ARRAY_SIZE(offendingNames)); *valid = FALSE; } @@ -1129,11 +1129,11 @@ void GUIEdit::validateNames( GameWindow *root, char *filename, Bool *valid ) root, instData->m_decoratedNameString ) ) { - strcat( offendingNames, "[Duplicate] " ); - strcat( offendingNames, filename ); - strcat( offendingNames, ":" ); - strcat( offendingNames, instData->m_decoratedNameString.str() ); - strcat( offendingNames, "\n" ); + strlcat(offendingNames, "[Duplicate] ", ARRAY_SIZE(offendingNames)); + strlcat(offendingNames, filename, ARRAY_SIZE(offendingNames)); + strlcat(offendingNames, ":", ARRAY_SIZE(offendingNames)); + strlcat(offendingNames, instData->m_decoratedNameString.str(), ARRAY_SIZE(offendingNames)); + strlcat(offendingNames, "\n", ARRAY_SIZE(offendingNames)); *valid = FALSE; } diff --git a/Generals/Code/Tools/WorldBuilder/src/BuildList.cpp b/Generals/Code/Tools/WorldBuilder/src/BuildList.cpp index d47437e28d4..831ad919f4c 100644 --- a/Generals/Code/Tools/WorldBuilder/src/BuildList.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/BuildList.cpp @@ -756,9 +756,9 @@ void BuildList::OnExport() SidesInfo *pSide = TheSidesList->getSideInfo(m_curSide); Dict *d = TheSidesList->getSideInfo(m_curSide)->getDict(); AsciiString name = d->getAsciiString(TheKey_playerName); - strcat(curbuf, name.str()); - strcat(curbuf, "_BuildList"); - strcat(curbuf, ".ini"); + strlcat(curbuf, name.str(), ARRAY_SIZE(curbuf)); + strlcat(curbuf, "_BuildList", ARRAY_SIZE(curbuf)); + strlcat(curbuf, ".ini", ARRAY_SIZE(curbuf)); theLogFile = fopen(curbuf, "w"); if (theLogFile == NULL) diff --git a/Generals/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp index ea6b3d0d24c..b8311dc8645 100644 --- a/Generals/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp @@ -93,7 +93,7 @@ BOOL MeshMoldOptions::OnInitDialog() dirBuf[len] = 0; } strcpy(findBuf, dirBuf); - strcat(findBuf, "*.w3d"); + strlcat(findBuf, "*.w3d", ARRAY_SIZE(findBuf)); FilenameList filenameList; TheFileSystem->getFileListInDirectory(AsciiString(dirBuf), AsciiString("*.w3d"), filenameList, FALSE); diff --git a/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp index 463f0cbce21..d60794cc75b 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp @@ -290,7 +290,7 @@ BOOL ObjectOptions::OnInitDialog() dirBuf[len] = 0; } strcpy(findBuf, dirBuf); - strcat(findBuf, "*.*"); + strlcat(findBuf, "*.*", ARRAY_SIZE(findBuf)); FilenameList filenameList; TheFileSystem->getFileListInDirectory(AsciiString(dirBuf), AsciiString("*.w3d"), filenameList, FALSE); @@ -310,8 +310,8 @@ BOOL ObjectOptions::OnInitDialog() } strcpy(fileBuf, TEST_STRING); - strcat(fileBuf, "/"); - strcat(fileBuf, token.str()); + strlcat(fileBuf, "/", ARRAY_SIZE(findBuf)); + strlcat(fileBuf, token.str(), ARRAY_SIZE(findBuf)); for (i=strlen(fileBuf)-1; i>0; i--) { if (fileBuf[i] == '.') { // strip off .w3d file extension. diff --git a/Generals/Code/Tools/WorldBuilder/src/OpenMap.cpp b/Generals/Code/Tools/WorldBuilder/src/OpenMap.cpp index 97045445e98..8417ad50fc3 100644 --- a/Generals/Code/Tools/WorldBuilder/src/OpenMap.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/OpenMap.cpp @@ -119,7 +119,7 @@ void OpenMap::populateMapListbox( Bool systemMaps ) else { strcpy(dirBuf, TheGlobalData->getPath_UserData().str()); - strcat(dirBuf, "Maps\\"); + strlcat(dirBuf, "Maps\\", ARRAY_SIZE(dirBuf)); } int len = strlen(dirBuf); @@ -132,7 +132,7 @@ void OpenMap::populateMapListbox( Bool systemMaps ) if (pList == NULL) return; pList->ResetContent(); strcpy(findBuf, dirBuf); - strcat(findBuf, "*.*"); + strlcat(findBuf, "*.*", ARRAY_SIZE(findBuf)); Bool found = false; @@ -146,10 +146,10 @@ void OpenMap::populateMapListbox( Bool systemMaps ) } strcpy(fileBuf, dirBuf); - strcat(fileBuf, findData.cFileName); - strcat(fileBuf, "\\"); - strcat(fileBuf, findData.cFileName); - strcat(fileBuf, ".map"); + strlcat(fileBuf, findData.cFileName, ARRAY_SIZE(findBuf)); + strlcat(fileBuf, "\\", ARRAY_SIZE(findBuf)); + strlcat(fileBuf, findData.cFileName, ARRAY_SIZE(findBuf)); + strlcat(fileBuf, ".map", ARRAY_SIZE(findBuf)); try { CFileStatus status; if (CFile::GetStatus(fileBuf, status)) { diff --git a/Generals/Code/Tools/WorldBuilder/src/RoadOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/RoadOptions.cpp index a2366228194..918e42976f8 100644 --- a/Generals/Code/Tools/WorldBuilder/src/RoadOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/RoadOptions.cpp @@ -274,8 +274,8 @@ BOOL RoadOptions::OnInitDialog() continue; } strcpy(fileBuf, TEST_STRING); - strcat(fileBuf, "\\"); - strcat(fileBuf, filename.str()); + strlcat(fileBuf, "\\", ARRAY_SIZE(fileBuf)); + strlcat(fileBuf, filename.str(), ARRAY_SIZE(fileBuf)); addRoad(fileBuf, index, TVI_ROOT); index++; m_numberOfRoads++; diff --git a/Generals/Code/Tools/WorldBuilder/src/SaveMap.cpp b/Generals/Code/Tools/WorldBuilder/src/SaveMap.cpp index 162697f9dea..cb70c42ccb1 100644 --- a/Generals/Code/Tools/WorldBuilder/src/SaveMap.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/SaveMap.cpp @@ -139,7 +139,7 @@ void SaveMap::populateMapListbox( Bool systemMaps ) if (pList == NULL) return; pList->ResetContent(); strcpy(findBuf, dirBuf); - strcat(findBuf, "*.*"); + strlcat(findBuf, "*.*", ARRAY_SIZE(findBuf)); hFindFile = FindFirstFile(findBuf, &findData); if (hFindFile != INVALID_HANDLE_VALUE) { @@ -150,10 +150,10 @@ void SaveMap::populateMapListbox( Bool systemMaps ) continue; } strcpy(fileBuf, dirBuf); - strcat(fileBuf, findData.cFileName); - strcat(fileBuf, "\\"); - strcat(fileBuf, findData.cFileName); - strcat(fileBuf, ".map"); + strlcat(fileBuf, findData.cFileName, ARRAY_SIZE(fileBuf)); + strlcat(fileBuf, "\\", ARRAY_SIZE(fileBuf)); + strlcat(fileBuf, findData.cFileName, ARRAY_SIZE(fileBuf)); + strlcat(fileBuf, ".map", ARRAY_SIZE(fileBuf)); try { CFileStatus status; if (CFile::GetStatus(fileBuf, status)) { diff --git a/Generals/Code/Tools/WorldBuilder/src/WorldBuilder.cpp b/Generals/Code/Tools/WorldBuilder/src/WorldBuilder.cpp index 9d440098c87..fb897701eca 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WorldBuilder.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WorldBuilder.cpp @@ -353,10 +353,10 @@ BOOL CWorldBuilderApp::InitInstance() // srj sez: put INI into our user data folder, not the ap dir free((void*)m_pszProfileName); strcpy(buf, TheGlobalData->getPath_UserData().str()); - strcat(buf, "WorldBuilder.ini"); + strlcat(buf, "WorldBuilder.ini", ARRAY_SIZE(buf)); #else - strcat(buf, "//"); - strcat(buf, m_pszProfileName); + strlcat(buf, "//", ARRAY_SIZE(buf)); + strlcat(buf, m_pszProfileName, ARRAY_SIZE(buf)); free((void*)m_pszProfileName); #endif m_pszProfileName = (const char *)malloc(strlen(buf)+2); diff --git a/Generals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp b/Generals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp index b875fa5e5d3..a4364d5f242 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp @@ -426,7 +426,7 @@ AsciiString ConvertName(AsciiString name) char newName[256]; strcpy(oldName, name.str()); strcpy(newName, "GLA"); - strcat(newName, oldName+strlen("Fundamentalist")); + strlcat(newName, oldName+strlen("Fundamentalist"), ARRAY_SIZE(newName)); AsciiString swapName; swapName.set(newName); const ThingTemplate *tt = TheThingFactory->findTemplate(swapName); @@ -442,7 +442,7 @@ AsciiString ConvertFaction(AsciiString name) char newName[256]; strcpy(oldName, name.str()); strcpy(newName, "FactionGLA"); - strcat(newName, oldName+strlen("FactionFundamentalist")); + strlcat(newName, oldName+strlen("FactionFundamentalist"), ARRAY_SIZE(newName)); AsciiString swapName; swapName.set(newName); const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(swapName)); @@ -2119,8 +2119,8 @@ void CWorldBuilderDoc::OnDumpDocToText(void) char curbuf[ _MAX_PATH ]; strcpy(curbuf, dirbuf); - strcat(curbuf, m_strTitle); - strcat(curbuf, ".txt"); + strlcat(curbuf, m_strTitle, ARRAY_SIZE(curbuf)); + strlcat(curbuf, ".txt", ARRAY_SIZE(curbuf)); theLogFile = fopen(curbuf, "w"); if (theLogFile == NULL) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp index f0f940f1dd6..13e02c692b7 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp @@ -782,8 +782,8 @@ AsciiString INI::getNextQuotedAsciiString() if (strlen(token) > 1 && token[1] != '\t') { - strcat(buff, " "); - strcat(buff, token); + strlcat(buff, " ", ARRAY_SIZE(buff)); + strlcat(buff, token, ARRAY_SIZE(buff)); } else { Int buflen=strlen(buff); @@ -824,9 +824,9 @@ AsciiString INI::getNextAsciiString() if (token) { if (strlen(token) > 1 && token[1] != '\t') { - strcat(buff, " "); + strlcat(buff, " ", ARRAY_SIZE(buff)); } - strcat(buff, token); + strlcat(buff, token, ARRAY_SIZE(buff)); result.set(buff); } else { Int len = strlen(buff); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/PerfTimer.cpp b/GeneralsMD/Code/GameEngine/Source/Common/PerfTimer.cpp index 0da53ddcddc..72fc4837ca9 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/PerfTimer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/PerfTimer.cpp @@ -353,7 +353,7 @@ void PerfGather::reset() char tmp[256]; strcpy(tmp, s_buf); - strcat(tmp, ".csv"); + strlcat(tmp, ".csv", ARRAY_SIZE(tmp)); s_perfStatsFile = fopen(tmp, "w"); s_perfDumpOptions = options; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/StackDump.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/StackDump.cpp index b485a89a84c..012f649a16c 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/StackDump.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/StackDump.cpp @@ -617,7 +617,7 @@ void DumpExceptionInfo( unsigned int u, EXCEPTION_POINTERS* e_info ) else { sprintf (bytestr, "%02X ", *eip_ptr); - strcat (scrap, bytestr); + strlcat(scrap, bytestr, ARRAY_SIZE(scrap)); } eip_ptr++; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp index 657cc8cb77d..a8b756760aa 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp @@ -2138,7 +2138,7 @@ Parameter *Parameter::ReadParameter(DataChunkInput &file) char newName[256]; strcpy(oldName, pParm->m_string.str()); strcpy(newName, "GLA"); - strcat(newName, oldName+strlen("Fundamentalist")); + strlcat(newName, oldName+strlen("Fundamentalist"), ARRAY_SIZE(newName)); pParm->m_string.set(newName); DEBUG_LOG(("Changing Script Ref from %s to %s", oldName, newName)); } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp index 8a2062cce14..fbb0111fd2d 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp @@ -237,11 +237,11 @@ Bool W3DBridge::load(BodyDamageType curDamageState) char right[_MAX_PATH]; strcpy(left, modelName); - strcat(left, ".BRIDGE_LEFT"); + strlcat(left, ".BRIDGE_LEFT", ARRAY_SIZE(left)); strcpy(section, modelName); - strcat(section, ".BRIDGE_SPAN"); + strlcat(section, ".BRIDGE_SPAN", ARRAY_SIZE(section)); strcpy(right, modelName); - strcat(right, ".BRIDGE_RIGHT"); + strlcat(right, ".BRIDGE_RIGHT", ARRAY_SIZE(right)); m_bridgeTexture = pMgr->Get_Texture(textureFile, MIP_LEVELS_3); m_leftMtx.Make_Identity(); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 352b9d97c7c..9de06ab757b 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -3019,7 +3019,7 @@ void W3DDisplay::takeScreenShot(void) sprintf( leafname, "%s%.3d.bmp", "sshot", frame_number++); #endif strcpy(pathname, TheGlobalData->getPath_UserData().str()); - strcat(pathname, leafname); + strlcat(pathname, leafname, ARRAY_SIZE(pathname)); if (_access( pathname, 0 ) == -1) done = true; } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp index 4c9336143ff..a4079ad8aa3 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp @@ -189,7 +189,7 @@ char const * GameFileClass::Set_Name( char const *filename ) { static const char *localizedPathFormat = "Data/%s/Art/W3D/"; sprintf(m_filePath,localizedPathFormat, GetRegistryLanguage().str()); - strcat( m_filePath, filename ); + strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } @@ -198,7 +198,7 @@ char const * GameFileClass::Set_Name( char const *filename ) { static const char *localizedPathFormat = "Data/%s/Art/Textures/"; sprintf(m_filePath,localizedPathFormat, GetRegistryLanguage().str()); - strcat( m_filePath, filename ); + strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } @@ -215,14 +215,14 @@ char const * GameFileClass::Set_Name( char const *filename ) { strcpy( m_filePath, W3D_DIR_PATH ); - strcat( m_filePath, filename ); + strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } else if( isImageFileType(fileType) ) { strcpy( m_filePath, TGA_DIR_PATH ); - strcat( m_filePath, filename ); + strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } else @@ -243,14 +243,14 @@ char const * GameFileClass::Set_Name( char const *filename ) { strcpy( m_filePath, LEGACY_W3D_DIR_PATH ); - strcat( m_filePath, filename ); + strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } else if( isImageFileType(fileType) ) { strcpy( m_filePath, LEGACY_TGA_DIR_PATH ); - strcat( m_filePath, filename ); + strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } @@ -271,14 +271,14 @@ char const * GameFileClass::Set_Name( char const *filename ) { strcpy( m_filePath, TEST_W3D_DIR_PATH ); - strcat( m_filePath, filename ); + strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } else if( isImageFileType(fileType) ) { strcpy( m_filePath, TEST_TGA_DIR_PATH ); - strcat( m_filePath, filename ); + strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } @@ -295,14 +295,14 @@ char const * GameFileClass::Set_Name( char const *filename ) { sprintf(m_filePath,USER_W3D_DIR_PATH, TheGlobalData->getPath_UserData().str()); //strcpy( m_filePath, USER_W3D_DIR_PATH ); - strcat( m_filePath, filename ); + strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } if( isImageFileType(fileType) ) { sprintf(m_filePath,USER_TGA_DIR_PATH, TheGlobalData->getPath_UserData().str()); //strcpy( m_filePath, USER_TGA_DIR_PATH ); - strcat( m_filePath, filename ); + strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } @@ -319,7 +319,7 @@ char const * GameFileClass::Set_Name( char const *filename ) { sprintf(m_filePath,MAP_PREVIEW_DIR_PATH, TheGlobalData->getPath_UserData().str()); //strcpy( m_filePath, USER_TGA_DIR_PATH ); - strcat( m_filePath, filename ); + strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp index be53ca5e636..03477b880dc 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp @@ -551,8 +551,8 @@ int HMorphAnimClass::Load_W3D(ChunkLoadClass & cload) strlcpy(AnimName,header.Name,sizeof(AnimName)); strlcpy(HierarchyName,header.HierarchyName,sizeof(HierarchyName)); strcpy(Name,HierarchyName); - strcat(Name,"."); - strcat(Name,AnimName); + strlcat(Name, ".", ARRAY_SIZE(Name)); + strlcat(Name, AnimName, ARRAY_SIZE(Name)); HTreeClass * base_pose = WW3DAssetManager::Get_Instance()->Get_HTree(HierarchyName); if (base_pose == NULL) { diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp index 0a625a64ba8..790abf043ac 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp @@ -212,8 +212,8 @@ int HRawAnimClass::Load_W3D(ChunkLoadClass & cload) } strcpy(Name,aheader.HierarchyName); - strcat(Name,"."); - strcat(Name,aheader.Name); + strlcat(Name, ".", ARRAY_SIZE(Name)); + strlcat(Name, aheader.Name, ARRAY_SIZE(Name)); // TSS chasing crash bug 05/26/99 WWASSERT(HierarchyName != NULL); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp index bb609a1f5c7..242f66da06e 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp @@ -1616,9 +1616,9 @@ WW3DErrorType MeshGeometryClass::Load_W3D(ChunkLoadClass & cload) if (strlen(header.ContainerName) > 0) { strcpy(tmpname,header.ContainerName); - strcat(tmpname,"."); + strcat(tmpname, "."); } - strcat(tmpname,header.MeshName); + strcat(tmpname, header.MeshName); Set_Name(tmpname); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp index b6dfc18e66f..7eb0c93909d 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp @@ -275,9 +275,9 @@ WW3DErrorType MeshModelClass::Load_W3D(ChunkLoadClass & cload) if (strlen(context->Header.ContainerName) > 0) { strcpy(tmpname,context->Header.ContainerName); - strcat(tmpname,"."); + strcat(tmpname, "."); } - strcat(tmpname,context->Header.MeshName); + strcat(tmpname, context->Header.MeshName); Set_Name(tmpname); diff --git a/GeneralsMD/Code/Main/WinMain.cpp b/GeneralsMD/Code/Main/WinMain.cpp index 2fd5e3f8048..e23d4e4b440 100644 --- a/GeneralsMD/Code/Main/WinMain.cpp +++ b/GeneralsMD/Code/Main/WinMain.cpp @@ -837,7 +837,7 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, const char *fileName = "Install_Final.bmp"; static const char *localizedPathFormat = "Data/%s/"; sprintf(filePath,localizedPathFormat, GetRegistryLanguage().str()); - strcat( filePath, fileName ); + strlcat(filePath, fileName, ARRAY_SIZE(filePath)); FILE *fileImage = fopen(filePath, "r"); if (fileImage) { fclose(fileImage); diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp index 882aa666182..569de7ba74d 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp @@ -948,8 +948,8 @@ HWND InitListboxPropertiesDialog( GameWindow *window ) sprintf(percentages,"%d",listData->columnWidthPercentage[0]); for(Int i = 1; i < listData->columns; i++ ) { - strcat(percentages,","); - strcat(percentages,itoa(listData->columnWidthPercentage[i],tempStr,10)); + strlcat(percentages, ",", ARRAY_SIZE(percentages)); + strlcat(percentages, itoa(listData->columnWidthPercentage[i],tempStr,10), ARRAY_SIZE(percentages)); } SetDlgItemText(dialog,EDIT_COLUMN_PERCENT,percentages); diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp index 005c618f7b5..43f00b40a0c 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp @@ -515,7 +515,7 @@ void GUIEditWindowManager::incrementName( GameWindow *window ) if( len == 0 ) { - strcat( name, "1" ); + strlcat(name, "1", ARRAY_SIZE(name)); goto cleanup; } @@ -586,7 +586,7 @@ void GUIEditWindowManager::incrementName( GameWindow *window ) { // no number at end, easy ... just append a number '1' - strcat( name, "1" ); + strlcat(name, "1", ARRAY_SIZE(name)); } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp index 4cf2cc128ba..e46cb28c750 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp @@ -891,8 +891,8 @@ char *HierarchyView::getWindowTreeName( GameWindow *window ) if( !instData->m_decoratedNameString.isEmpty() ) { - strcat( buffer, ": " ); - strcat( buffer, instData->m_decoratedNameString.str() ); + strlcat(buffer, ": ", ARRAY_SIZE(buffer)); + strlcat(buffer, instData->m_decoratedNameString.str(), ARRAY_SIZE(buffer)); } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp index 42f29d89c43..56111932ebe 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp @@ -230,10 +230,10 @@ static Bool saveStatus( GameWindow *window, FILE *fp, Int dataIndent ) // if this is an additional bit add a + if( bitWritten == TRUE ) - strcat( buffer, "+"); + strlcat(buffer, "+", ARRAY_SIZE(buffer)); // add status name - strcat( buffer, WindowStatusNames[ i ] ); + strlcat(buffer, WindowStatusNames[ i ], ARRAY_SIZE(buffer)); bitWritten = TRUE; } @@ -243,10 +243,10 @@ static Bool saveStatus( GameWindow *window, FILE *fp, Int dataIndent ) // if no bits written write NONE in the file if( bitWritten == FALSE ) - strcat( buffer, "NONE" ); + strlcat(buffer, "NONE", ARRAY_SIZE(buffer)); // complete line and write - strcat( buffer, ";\n" ); + strlcat(buffer, ";\n", ARRAY_SIZE(buffer)); writeBufferToFile( fp, buffer ); return TRUE; @@ -274,10 +274,10 @@ static Bool saveStyle( GameWindow *window, FILE *fp, Int dataIndent ) // if this is an additional bit add a + if( bitWritten == TRUE ) - strcat( buffer, "+"); + strlcat(buffer, "+", ARRAY_SIZE(buffer)); // add status name - strcat( buffer, WindowStyleNames[ i ] ); + strlcat(buffer, WindowStyleNames[ i ], ARRAY_SIZE(buffer)); bitWritten = TRUE; } @@ -287,10 +287,10 @@ static Bool saveStyle( GameWindow *window, FILE *fp, Int dataIndent ) // if no bits written write NONE in the file if( bitWritten == FALSE ) - strcat( buffer, "NONE" ); + strlcat(buffer, "NONE", ARRAY_SIZE(buffer)); // complete line and write - strcat( buffer, ";\n" ); + strlcat(buffer, ";\n", ARRAY_SIZE(buffer)); writeBufferToFile( fp, buffer ); return TRUE; @@ -1115,11 +1115,11 @@ void GUIEdit::validateNames( GameWindow *root, char *filename, Bool *valid ) if( strlen( filename ) + instData->m_decoratedNameString.getLength() >= MAX_WINDOW_NAME_LEN ) { - strcat( offendingNames, "[Too Long] " ); - strcat( offendingNames, filename ); - strcat( offendingNames, ":" ); - strcat( offendingNames, instData->m_decoratedNameString.str() ); - strcat( offendingNames, "\n"); + strlcat(offendingNames, "[Too Long] ", ARRAY_SIZE(offendingNames)); + strlcat(offendingNames, filename, ARRAY_SIZE(offendingNames)); + strlcat(offendingNames, ":", ARRAY_SIZE(offendingNames)); + strlcat(offendingNames, instData->m_decoratedNameString.str(), ARRAY_SIZE(offendingNames)); + strlcat(offendingNames, "\n", ARRAY_SIZE(offendingNames)); *valid = FALSE; } @@ -1129,11 +1129,11 @@ void GUIEdit::validateNames( GameWindow *root, char *filename, Bool *valid ) root, instData->m_decoratedNameString ) ) { - strcat( offendingNames, "[Duplicate] " ); - strcat( offendingNames, filename ); - strcat( offendingNames, ":" ); - strcat( offendingNames, instData->m_decoratedNameString.str() ); - strcat( offendingNames, "\n" ); + strlcat(offendingNames, "[Duplicate] ", ARRAY_SIZE(offendingNames)); + strlcat(offendingNames, filename, ARRAY_SIZE(offendingNames)); + strlcat(offendingNames, ":", ARRAY_SIZE(offendingNames)); + strlcat(offendingNames, instData->m_decoratedNameString.str(), ARRAY_SIZE(offendingNames)); + strlcat(offendingNames, "\n", ARRAY_SIZE(offendingNames)); *valid = FALSE; } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/BuildList.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/BuildList.cpp index 7b20f601c0d..3c9034a89a6 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/BuildList.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/BuildList.cpp @@ -756,9 +756,9 @@ void BuildList::OnExport() SidesInfo *pSide = TheSidesList->getSideInfo(m_curSide); Dict *d = TheSidesList->getSideInfo(m_curSide)->getDict(); AsciiString name = d->getAsciiString(TheKey_playerName); - strcat(curbuf, name.str()); - strcat(curbuf, "_BuildList"); - strcat(curbuf, ".ini"); + strlcat(curbuf, name.str(), ARRAY_SIZE(curbuf)); + strlcat(curbuf, "_BuildList", ARRAY_SIZE(curbuf)); + strlcat(curbuf, ".ini", ARRAY_SIZE(curbuf)); theLogFile = fopen(curbuf, "w"); if (theLogFile == NULL) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp index bbd6c110b0a..666f1d655a7 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp @@ -93,7 +93,7 @@ BOOL MeshMoldOptions::OnInitDialog() dirBuf[len] = 0; } strcpy(findBuf, dirBuf); - strcat(findBuf, "*.w3d"); + strlcat(findBuf, "*.w3d", ARRAY_SIZE(findBuf)); FilenameList filenameList; TheFileSystem->getFileListInDirectory(AsciiString(dirBuf), AsciiString("*.w3d"), filenameList, FALSE); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp index 3e5e4f28130..f7e5b7e471f 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp @@ -290,7 +290,7 @@ BOOL ObjectOptions::OnInitDialog() dirBuf[len] = 0; } strcpy(findBuf, dirBuf); - strcat(findBuf, "*.*"); + strlcat(findBuf, "*.*", ARRAY_SIZE(findBuf)); FilenameList filenameList; TheFileSystem->getFileListInDirectory(AsciiString(dirBuf), AsciiString("*.w3d"), filenameList, FALSE); @@ -310,8 +310,8 @@ BOOL ObjectOptions::OnInitDialog() } strcpy(fileBuf, TEST_STRING); - strcat(fileBuf, "/"); - strcat(fileBuf, token.str()); + strlcat(fileBuf, "/", ARRAY_SIZE(findBuf)); + strlcat(fileBuf, token.str(), ARRAY_SIZE(findBuf)); for (i=strlen(fileBuf)-1; i>0; i--) { if (fileBuf[i] == '.') { // strip off .w3d file extension. diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/OpenMap.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/OpenMap.cpp index e09dfafb701..4973d45c5f0 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/OpenMap.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/OpenMap.cpp @@ -119,7 +119,7 @@ void OpenMap::populateMapListbox( Bool systemMaps ) else { strcpy(dirBuf, TheGlobalData->getPath_UserData().str()); - strcat(dirBuf, "Maps\\"); + strlcat(dirBuf, "Maps\\", ARRAY_SIZE(dirBuf)); } int len = strlen(dirBuf); @@ -132,7 +132,7 @@ void OpenMap::populateMapListbox( Bool systemMaps ) if (pList == NULL) return; pList->ResetContent(); strcpy(findBuf, dirBuf); - strcat(findBuf, "*.*"); + strlcat(findBuf, "*.*", ARRAY_SIZE(findBuf)); Bool found = false; @@ -146,10 +146,10 @@ void OpenMap::populateMapListbox( Bool systemMaps ) } strcpy(fileBuf, dirBuf); - strcat(fileBuf, findData.cFileName); - strcat(fileBuf, "\\"); - strcat(fileBuf, findData.cFileName); - strcat(fileBuf, ".map"); + strlcat(fileBuf, findData.cFileName, ARRAY_SIZE(findBuf)); + strlcat(fileBuf, "\\", ARRAY_SIZE(findBuf)); + strlcat(fileBuf, findData.cFileName, ARRAY_SIZE(findBuf)); + strlcat(fileBuf, ".map", ARRAY_SIZE(findBuf)); try { CFileStatus status; if (CFile::GetStatus(fileBuf, status)) { diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/RoadOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/RoadOptions.cpp index c6142d37c7b..861182155c2 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/RoadOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/RoadOptions.cpp @@ -274,8 +274,8 @@ BOOL RoadOptions::OnInitDialog() continue; } strcpy(fileBuf, TEST_STRING); - strcat(fileBuf, "\\"); - strcat(fileBuf, filename.str()); + strlcat(fileBuf, "\\", ARRAY_SIZE(fileBuf)); + strlcat(fileBuf, filename.str(), ARRAY_SIZE(fileBuf)); addRoad(fileBuf, index, TVI_ROOT); index++; m_numberOfRoads++; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/SaveMap.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/SaveMap.cpp index 4b6ca773aee..f7b18a277b3 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/SaveMap.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/SaveMap.cpp @@ -139,7 +139,7 @@ void SaveMap::populateMapListbox( Bool systemMaps ) if (pList == NULL) return; pList->ResetContent(); strcpy(findBuf, dirBuf); - strcat(findBuf, "*.*"); + strlcat(findBuf, "*.*", ARRAY_SIZE(findBuf)); hFindFile = FindFirstFile(findBuf, &findData); if (hFindFile != INVALID_HANDLE_VALUE) { @@ -150,10 +150,10 @@ void SaveMap::populateMapListbox( Bool systemMaps ) continue; } strcpy(fileBuf, dirBuf); - strcat(fileBuf, findData.cFileName); - strcat(fileBuf, "\\"); - strcat(fileBuf, findData.cFileName); - strcat(fileBuf, ".map"); + strlcat(fileBuf, findData.cFileName, ARRAY_SIZE(fileBuf)); + strlcat(fileBuf, "\\", ARRAY_SIZE(fileBuf)); + strlcat(fileBuf, findData.cFileName, ARRAY_SIZE(fileBuf)); + strlcat(fileBuf, ".map", ARRAY_SIZE(fileBuf)); try { CFileStatus status; if (CFile::GetStatus(fileBuf, status)) { diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilder.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilder.cpp index dead6bdcc3a..0acb59714fa 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilder.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilder.cpp @@ -366,10 +366,10 @@ BOOL CWorldBuilderApp::InitInstance() // srj sez: put INI into our user data folder, not the ap dir free((void*)m_pszProfileName); strcpy(buf, TheGlobalData->getPath_UserData().str()); - strcat(buf, "WorldBuilder.ini"); + strlcat(buf, "WorldBuilder.ini", ARRAY_SIZE(buf)); #else - strcat(buf, "//"); - strcat(buf, m_pszProfileName); + strlcat(buf, "//", ARRAY_SIZE(buf)); + strlcat(buf, m_pszProfileName, ARRAY_SIZE(buf)); free((void*)m_pszProfileName); #endif m_pszProfileName = (const char *)malloc(strlen(buf)+2); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp index 69a15a01ca5..52bed9d22ca 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp @@ -457,7 +457,7 @@ AsciiString ConvertName(AsciiString name) char newName[256]; strcpy(oldName, name.str()); strcpy(newName, "GLA"); - strcat(newName, oldName+strlen("Fundamentalist")); + strlcat(newName, oldName+strlen("Fundamentalist"), ARRAY_SIZE(newName)); AsciiString swapName; swapName.set(newName); const ThingTemplate *tt = TheThingFactory->findTemplate(swapName); @@ -473,7 +473,7 @@ AsciiString ConvertFaction(AsciiString name) char newName[256]; strcpy(oldName, name.str()); strcpy(newName, "FactionGLA"); - strcat(newName, oldName+strlen("FactionFundamentalist")); + strlcat(newName, oldName+strlen("FactionFundamentalist"), ARRAY_SIZE(newName)); AsciiString swapName; swapName.set(newName); const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(swapName)); @@ -2176,8 +2176,8 @@ void CWorldBuilderDoc::OnDumpDocToText(void) char curbuf[ _MAX_PATH ]; strcpy(curbuf, dirbuf); - strcat(curbuf, m_strTitle); - strcat(curbuf, ".txt"); + strlcat(curbuf, m_strTitle, ARRAY_SIZE(curbuf)); + strlcat(curbuf, ".txt", ARRAY_SIZE(curbuf)); theLogFile = fopen(curbuf, "w"); if (theLogFile == NULL) From 9e4b82f32179d99133dd0cb0fa130cedb02eaf8a Mon Sep 17 00:00:00 2001 From: SkyAero <21192585+Skyaero42@users.noreply.github.com> Date: Wed, 15 Oct 2025 22:44:38 +0200 Subject: [PATCH 173/343] fix: Replace strncat with strlcat for robustness (#1677) --- Generals/Code/GameEngine/Source/Common/Recorder.cpp | 2 +- GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/Recorder.cpp b/Generals/Code/GameEngine/Source/Common/Recorder.cpp index 6182b67d45d..b7a6df6e412 100644 --- a/Generals/Code/GameEngine/Source/Common/Recorder.cpp +++ b/Generals/Code/GameEngine/Source/Common/Recorder.cpp @@ -289,7 +289,7 @@ void RecorderClass::cleanUpReplayFile( void ) { char fname[_MAX_PATH+1]; strlcpy(fname, TheGlobalData->m_baseStatsDir.str(), ARRAY_SIZE(fname)); - strncat(fname, m_fileName.str(), _MAX_PATH - strlen(fname)); + strlcat(fname, m_fileName.str(), ARRAY_SIZE(fname)); DEBUG_LOG(("Saving replay to %s", fname)); AsciiString oldFname; oldFname.format("%s%s", getReplayDir().str(), m_fileName.str()); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp index 1bd0d75352a..b59813da066 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp @@ -289,7 +289,7 @@ void RecorderClass::cleanUpReplayFile( void ) { char fname[_MAX_PATH+1]; strlcpy(fname, TheGlobalData->m_baseStatsDir.str(), ARRAY_SIZE(fname)); - strncat(fname, m_fileName.str(), _MAX_PATH - strlen(fname)); + strlcat(fname, m_fileName.str(), ARRAY_SIZE(fname)); DEBUG_LOG(("Saving replay to %s", fname)); AsciiString oldFname; oldFname.format("%s%s", getReplayDir().str(), m_fileName.str()); From eb7093ec6ed14b2e36adee9313e22a0ac8bac609 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Wed, 15 Oct 2025 22:56:15 +0200 Subject: [PATCH 174/343] tweak(shadow): Double 3D shadow buffers in W3DBufferManager (#1691) --- .../W3DDevice/GameClient/W3DBufferManager.h | 27 ++++++++++++------- .../W3DDevice/GameClient/W3DBufferManager.h | 27 ++++++++++++------- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h index 20787f67a15..7f7f915c882 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h @@ -36,16 +36,25 @@ #include "dx8vertexbuffer.h" #include "dx8indexbuffer.h" -#define MAX_VB_SIZES 128 //number of different sized VB slots allowed. -#define MIN_SLOT_SIZE 32 //minimum number of vertices allocated per slot (power of 2). See also MIN_SLOT_SIZE_SHIFT. -#define MIN_SLOT_SIZE_SHIFT 5 //used for division by MIN_SLOT_SIZE -#define MAX_VERTEX_BUFFERS_CREATED 32 //maximum number of D3D vertex buffers allowed to create per vertex type. -#define DEFAULT_VERTEX_BUFFER_SIZE 8192 //this size ends up generating VB's of about 256Kbytes -#define MAX_NUMBER_SLOTS 4096 //maximum number of slots that can be allocated. - +// TheSuperHackers @info The max sizes correspond to a number of vertices and indices of a mesh casting shadows +// in the scene. The more vertices the meshes are supposed to have, the higher these limits need to be. +// Multiplying these numbers by MIN_SLOT_SIZE gives the max supported amount of vertices and indices. +#define MAX_VB_SIZES 128 //number of different sized VB slots allowed. #define MAX_IB_SIZES 128 //number of different sized IB slots allowed (goes all the way up to 65536) -#define MAX_INDEX_BUFFERS_CREATED 32 -#define DEFAULT_INDEX_BUFFER_SIZE 32768 + +#define MIN_SLOT_SIZE_SHIFT 5 //used for division by MIN_SLOT_SIZE +#define MIN_SLOT_SIZE (1 << MIN_SLOT_SIZE_SHIFT) //minimum number of vertices allocated per slot (power of 2). + +// TheSuperHackers @info The number of slots corresponds to number of meshes casting shadows in the scene. +// The more meshes there are, the larger the slots needs to be. +// TheSuperHackers @tweak Double the original sizes to allow for twice as many shadows to be created in the scene. +#define SLOTS_MULTIPLIER 2 +#define MAX_NUMBER_SLOTS (4096 * SLOTS_MULTIPLIER) //maximum number of slots that can be allocated. +#define MAX_VERTEX_BUFFERS_CREATED (32 * SLOTS_MULTIPLIER) //maximum number of D3D vertex buffers allowed to create per vertex type. +#define MAX_INDEX_BUFFERS_CREATED (32 * SLOTS_MULTIPLIER) + +#define DEFAULT_VERTEX_BUFFER_SIZE 8192 //this size ends up generating VB's of about 256Kbytes +#define DEFAULT_INDEX_BUFFER_SIZE 32768 class W3DBufferManager { diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h index 763660b743b..26f07e2b5f3 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h @@ -36,16 +36,25 @@ #include "dx8vertexbuffer.h" #include "dx8indexbuffer.h" -#define MAX_VB_SIZES 128 //number of different sized VB slots allowed. -#define MIN_SLOT_SIZE 32 //minimum number of vertices allocated per slot (power of 2). See also MIN_SLOT_SIZE_SHIFT. -#define MIN_SLOT_SIZE_SHIFT 5 //used for division by MIN_SLOT_SIZE -#define MAX_VERTEX_BUFFERS_CREATED 32 //maximum number of D3D vertex buffers allowed to create per vertex type. -#define DEFAULT_VERTEX_BUFFER_SIZE 8192 //this size ends up generating VB's of about 256Kbytes -#define MAX_NUMBER_SLOTS 4096 //maximum number of slots that can be allocated. - +// TheSuperHackers @info The max sizes correspond to a number of vertices and indices of a mesh casting shadows +// in the scene. The more vertices the meshes are supposed to have, the higher these limits need to be. +// Multiplying these numbers by MIN_SLOT_SIZE gives the max supported amount of vertices and indices. +#define MAX_VB_SIZES 128 //number of different sized VB slots allowed. #define MAX_IB_SIZES 128 //number of different sized IB slots allowed (goes all the way up to 65536) -#define MAX_INDEX_BUFFERS_CREATED 32 -#define DEFAULT_INDEX_BUFFER_SIZE 32768 + +#define MIN_SLOT_SIZE_SHIFT 5 //used for division by MIN_SLOT_SIZE +#define MIN_SLOT_SIZE (1 << MIN_SLOT_SIZE_SHIFT) //minimum number of vertices allocated per slot (power of 2). + +// TheSuperHackers @info The number of slots corresponds to number of meshes casting shadows in the scene. +// The more meshes there are, the larger the slots needs to be. +// TheSuperHackers @tweak Double the original sizes to allow for twice as many shadows to be created in the scene. +#define SLOTS_MULTIPLIER 2 +#define MAX_NUMBER_SLOTS (4096 * SLOTS_MULTIPLIER) //maximum number of slots that can be allocated. +#define MAX_VERTEX_BUFFERS_CREATED (32 * SLOTS_MULTIPLIER) //maximum number of D3D vertex buffers allowed to create per vertex type. +#define MAX_INDEX_BUFFERS_CREATED (32 * SLOTS_MULTIPLIER) + +#define DEFAULT_VERTEX_BUFFER_SIZE 8192 //this size ends up generating VB's of about 256Kbytes +#define DEFAULT_INDEX_BUFFER_SIZE 32768 class W3DBufferManager { From 9ba92fa2c44600d020a2a0d062c2397531955302 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Wed, 15 Oct 2025 22:56:38 +0200 Subject: [PATCH 175/343] tweak(tree): Decouple tree sway, topple and sink time step from render update (#1652) --- .../Drawable/Update/SwayClientUpdate.cpp | 6 +- .../Drawable/Update/SwayClientUpdate.cpp | 6 +- .../W3DDevice/GameClient/W3DTreeBuffer.h | 5 +- .../W3DDevice/GameClient/W3DTreeBuffer.cpp | 81 +++++++++---------- 4 files changed, 51 insertions(+), 47 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp index 648860b3b80..a6ce3d3521f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp @@ -32,6 +32,7 @@ #include "GameClient/Drawable.h" #include "GameClient/Module/SwayClientUpdate.h" +#include "Common/FramePacer.h" #include "Common/Player.h" #include "Common/PlayerList.h" #include "Common/ThingFactory.h" @@ -114,7 +115,10 @@ void SwayClientUpdate::clientUpdate( void ) return; } - m_curValue += m_curDelta; + // TheSuperHackers @tweak The tree sway time step is now decoupled from the render update. + const Real timeScale = TheFramePacer->getActualLogicTimeScaleOverFpsRatio(); + + m_curValue += m_curDelta * timeScale; if (m_curValue > 2*PI) m_curValue -= 2*PI; Real cosine = Cos(m_curValue); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp index 0b234535fcc..8a7624f8dc5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp @@ -32,6 +32,7 @@ #include "GameClient/Drawable.h" #include "GameClient/Module/SwayClientUpdate.h" +#include "Common/FramePacer.h" #include "Common/Player.h" #include "Common/PlayerList.h" #include "Common/ThingFactory.h" @@ -114,7 +115,10 @@ void SwayClientUpdate::clientUpdate( void ) return; } - m_curValue += m_curDelta; + // TheSuperHackers @tweak The tree sway time step is now decoupled from the render update. + const Real timeScale = TheFramePacer->getActualLogicTimeScaleOverFpsRatio(); + + m_curValue += m_curDelta * timeScale; if (m_curValue > 2*PI) m_curValue -= 2*PI; Real cosine = Cos(m_curValue); diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DTreeBuffer.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DTreeBuffer.h index 3b2b5892dec..536137586a3 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DTreeBuffer.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DTreeBuffer.h @@ -121,7 +121,7 @@ typedef struct { Real m_angularAccumulation; ///< How much have I rotated so I know when to bounce. UnsignedInt m_options; ///< topple options Matrix3D m_mtx; - UnsignedInt m_sinkFramesLeft; ///< Toppled trees sink into the terrain & disappear, how many frames left. + Real m_sinkFramesLeft; ///< Toppled trees sink into the terrain & disappear, how many frames left. } TTree; @@ -256,7 +256,6 @@ class W3DTreeBuffer : public Snapshot Real m_curSwayOffset[MAX_SWAY_TYPES]; Real m_curSwayStep[MAX_SWAY_TYPES]; Real m_curSwayFactor[MAX_SWAY_TYPES]; - Int m_lastLogicFrame; W3DProjectedShadow *m_shadow; @@ -282,7 +281,7 @@ class W3DTreeBuffer : public Snapshot Int getPartitionBucket(const Coord3D &pos) const; - void updateTopplingTree(TTree *tree); + void updateTopplingTree(TTree *tree, Real timeScale); void applyTopplingForce( TTree *tree, const Coord3D* toppleDirection, Real toppleSpeed, UnsignedInt options ); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp index 0d45c27ef4f..d18da2eb0de 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp @@ -60,6 +60,7 @@ enum #include #include #include +#include "Common/FramePacer.h" #include "Common/MapReaderWriterInfo.h" #include "Common/FileSystem.h" #include "Common/file.h" @@ -1274,8 +1275,6 @@ void W3DTreeBuffer::clearAllTrees(void) m_areaPartition[i] = END_OF_PARTITION; } m_numTreeTypes = 0; - - m_lastLogicFrame = 0; } //============================================================================= @@ -1537,34 +1536,20 @@ void W3DTreeBuffer::drawTrees(CameraClass * camera, RefRenderObjListIterator *pD // if breeze changes, always process the full update, even if not visible, // so that things offscreen won't 'pop' when first viewed const BreezeInfo& info = TheScriptEngine->getBreezeInfo(); - Bool pause = TheScriptEngine->isTimeFrozenScript() || TheScriptEngine->isTimeFrozenDebug(); - if (TheGameLogic && TheGameLogic->isGamePaused()) { - pause = true; - } - - // TheSuperHackers @bugfix Mauller 04/07/2025 decouple the tree sway position updates from the client fps - if (TheGameLogic) { - UnsignedInt currentFrame = TheGameLogic->getFrame(); - if (m_lastLogicFrame == currentFrame) { - pause = true; - } - m_lastLogicFrame = currentFrame; + if (info.m_breezeVersion != m_curSwayVersion) + { + updateSway(info); } - Int i; - if (!pause) { - if (info.m_breezeVersion != m_curSwayVersion) - { - updateSway(info); - } - } + // TheSuperHackers @tweak The tree sway, topple and sink time steps are now decoupled from the render update. + const Real timeScale = TheFramePacer->getActualLogicTimeScaleOverFpsRatio(); Vector3 swayFactor[MAX_SWAY_TYPES]; - for (i=0; i NUM_SWAY_ENTRIES-1) { - m_curSwayOffset[i] -= NUM_SWAY_ENTRIES-1; - } + Int i; + for (i=0; i NUM_SWAY_ENTRIES-1) { + m_curSwayOffset[i] -= NUM_SWAY_ENTRIES-1; } Int minOffset = REAL_TO_INT_FLOOR(m_curSwayOffset[i]); if (minOffset>=0 && minOffset+1m_killWhenToppled) { - if (m_trees[curTree].m_sinkFramesLeft==0) { + if (moduleData->m_killWhenToppled) { + if (m_trees[curTree].m_sinkFramesLeft <= 0.0f) { m_trees[curTree].treeType = DELETED_TREE_TYPE; // delete it. [7/11/2003] m_anythingChanged = true; // need to regenerate trees. [7/11/2003] } - m_trees[curTree].m_sinkFramesLeft--; - m_trees[curTree].location.Z -= m_treeTypes[type].m_data->m_sinkDistance/m_treeTypes[type].m_data->m_sinkFrames; + const Real sinkDistancePerFrame = moduleData->m_sinkDistance / moduleData->m_sinkFrames; + m_trees[curTree].m_sinkFramesLeft -= timeScale; + m_trees[curTree].location.Z -= sinkDistancePerFrame * timeScale; m_trees[curTree].m_mtx.Set_Translation(m_trees[curTree].location); } } else if (m_trees[curTree].pushAsideDelta!=0.0f) { m_trees[curTree].pushAside += m_trees[curTree].pushAsideDelta; if (m_trees[curTree].pushAside>=1.0f) { - m_trees[curTree].pushAsideDelta = -1.0/(Real)m_treeTypes[type].m_data->m_framesToMoveInward; + m_trees[curTree].pushAsideDelta = -1.0f/(Real)moduleData->m_framesToMoveInward; } else if (m_trees[curTree].pushAside<=0.0f) { m_trees[curTree].pushAsideDelta = 0.0f; m_trees[curTree].pushAside = 0.0f; @@ -1856,7 +1840,7 @@ static const Real ANGULAR_LIMIT = PI/2 - PI/64; //------------------------------------------------------------------------------------------------- ///< Keep track of rotational fall distance, bounce and/or stop when needed. //------------------------------------------------------------------------------------------------- -void W3DTreeBuffer::updateTopplingTree(TTree *tree) +void W3DTreeBuffer::updateTopplingTree(TTree *tree, Real timeScale) { //DLOG(Debug::Format("updating W3DTreeBuffer %08lx\n",this)); DEBUG_ASSERTCRASH(tree->m_toppleState != TOPPLE_UPRIGHT, ("hmm, we should be sleeping here")); @@ -1880,21 +1864,20 @@ void W3DTreeBuffer::updateTopplingTree(TTree *tree) tree->m_mtx.In_Place_Pre_Rotate_Y(ANGULAR_LIMIT * tree->m_toppleDirection.x); if (d->m_killWhenToppled) { // If got killed in the fog, just remove. jba [8/11/2003] - tree->m_sinkFramesLeft = 0; + tree->m_sinkFramesLeft = 0.0f; } return; } const Real VELOCITY_BOUNCE_LIMIT = 0.01f; // if the velocity after a bounce will be this or lower, just stop at zero const Real VELOCITY_BOUNCE_SOUND_LIMIT = 0.03f; // and if this low, then skip the bounce sound - Real curVelToUse = tree->m_angularVelocity; + Real curVelToUse = tree->m_angularVelocity * timeScale; if (tree->m_angularAccumulation + curVelToUse > ANGULAR_LIMIT) curVelToUse = ANGULAR_LIMIT - tree->m_angularAccumulation; tree->m_mtx.In_Place_Pre_Rotate_X(-curVelToUse * tree->m_toppleDirection.y); tree->m_mtx.In_Place_Pre_Rotate_Y(curVelToUse * tree->m_toppleDirection.x); - tree->m_angularAccumulation += curVelToUse; if ((tree->m_angularAccumulation >= ANGULAR_LIMIT) && (tree->m_angularVelocity > 0)) { @@ -1926,7 +1909,7 @@ void W3DTreeBuffer::updateTopplingTree(TTree *tree) } else { - tree->m_angularVelocity += tree->m_angularAcceleration; + tree->m_angularVelocity += tree->m_angularAcceleration * timeScale; } } @@ -1948,7 +1931,11 @@ void W3DTreeBuffer::xfer( Xfer *xfer ) { // version +#if RETAIL_COMPATIBLE_XFER_SAVE XferVersion currentVersion = 1; +#else + XferVersion currentVersion = 2; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -2008,7 +1995,17 @@ void W3DTreeBuffer::xfer( Xfer *xfer ) xfer->xferReal(&tree.m_angularAccumulation); ///< How much have I rotated so I know when to bounce. xfer->xferUnsignedInt(&tree.m_options); ///< topple options xfer->xferMatrix3D(&tree.m_mtx); - xfer->xferUnsignedInt(&tree.m_sinkFramesLeft); ///< Toppled trees sink into the terrain & disappear, how many frames left. + + if (version <= 1) + { + UnsignedInt sinkFramesLeft = (UnsignedInt)tree.m_sinkFramesLeft; + xfer->xferUnsignedInt(&sinkFramesLeft); ///< Toppled trees sink into the terrain & disappear, how many frames left. + tree.m_sinkFramesLeft = (Real)sinkFramesLeft; + } + else + { + xfer->xferReal(&tree.m_sinkFramesLeft); ///< Toppled trees sink into the terrain & disappear, how many frames left. + } if (xfer->getXferMode() == XFER_LOAD && treeType != DELETED_TREE_TYPE && treeType < m_numTreeTypes) { Coord3D pos; From 3b78b63d489ca4c08f63396f3f7e367faf87787b Mon Sep 17 00:00:00 2001 From: SkyAero <21192585+Skyaero42@users.noreply.github.com> Date: Thu, 16 Oct 2025 18:16:14 +0200 Subject: [PATCH 176/343] fix: Replace wcsncpy with wcslcpy for robustness (#1676) --- .../Code/GameEngine/Include/Common/Language.h | 1 - .../GUI/GUICallbacks/Menus/ScoreScreen.cpp | 3 +- .../GUICallbacks/Menus/WOLBuddyOverlay.cpp | 6 +-- .../GameSpy/Thread/BuddyThread.cpp | 6 +-- .../GameEngine/Source/GameNetwork/LANAPI.cpp | 42 +++++++------------ .../Source/GameNetwork/LANAPIhandlers.cpp | 12 ++---- .../Code/GameEngine/Include/Common/Language.h | 1 - .../GUI/GUICallbacks/Menus/ScoreScreen.cpp | 3 +- .../GUICallbacks/Menus/WOLBuddyOverlay.cpp | 6 +-- .../GameSpy/Thread/BuddyThread.cpp | 6 +-- .../GameEngine/Source/GameNetwork/LANAPI.cpp | 42 +++++++------------ .../Source/GameNetwork/LANAPIhandlers.cpp | 12 ++---- 12 files changed, 46 insertions(+), 94 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/Language.h b/Generals/Code/GameEngine/Include/Common/Language.h index a2db8eafaf0..d03ed08d984 100644 --- a/Generals/Code/GameEngine/Include/Common/Language.h +++ b/Generals/Code/GameEngine/Include/Common/Language.h @@ -76,7 +76,6 @@ typedef enum } LanguageID; #define GameStrcpy wcscpy -#define GameStrncpy wcsncpy #define GameStrlen wcslen #define GameStrcat wcscat #define GameStrcmp wcscmp diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp index 0c023439390..2dcc4720601 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp @@ -540,8 +540,7 @@ WindowMsgHandledType ScoreScreenSystem( GameWindow *window, UnsignedInt msg, req.arg.addbuddy.id = playerID; UnicodeString buddyAddstr; buddyAddstr = TheGameText->fetch("GUI:BuddyAddReq"); - wcsncpy(req.arg.addbuddy.text, buddyAddstr.str(), MAX_BUDDY_CHAT_LEN); - req.arg.addbuddy.text[MAX_BUDDY_CHAT_LEN-1] = 0; + wcslcpy(req.arg.addbuddy.text, buddyAddstr.str(), MAX_BUDDY_CHAT_LEN); TheGameSpyBuddyMessageQueue->addRequest(req); } } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp index d0495d7e927..c99b32e55e4 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp @@ -304,8 +304,7 @@ WindowMsgHandledType BuddyControlSystem( GameWindow *window, UnsignedInt msg, // Send the message BuddyRequest req; req.buddyRequestType = BuddyRequest::BUDDYREQUEST_MESSAGE; - wcsncpy(req.arg.message.text, txtInput.str(), MAX_BUDDY_CHAT_LEN); - req.arg.message.text[MAX_BUDDY_CHAT_LEN-1] = 0; + wcslcpy(req.arg.message.text, txtInput.str(), MAX_BUDDY_CHAT_LEN); req.arg.message.recipient = selectedProfile; TheGameSpyBuddyMessageQueue->addRequest(req); @@ -1184,8 +1183,7 @@ void RequestBuddyAdd(Int profileID, AsciiString nick) req.arg.addbuddy.id = profileID; UnicodeString buddyAddstr; buddyAddstr = TheGameText->fetch("GUI:BuddyAddReq"); - wcsncpy(req.arg.addbuddy.text, buddyAddstr.str(), MAX_BUDDY_CHAT_LEN); - req.arg.addbuddy.text[MAX_BUDDY_CHAT_LEN-1] = 0; + wcslcpy(req.arg.addbuddy.text, buddyAddstr.str(), MAX_BUDDY_CHAT_LEN); TheGameSpyBuddyMessageQueue->addRequest(req); UnicodeString s; diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp index f0d08b7588d..39f8f3469b2 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp @@ -512,8 +512,7 @@ void BuddyThreadClass::messageCallback( GPConnection *con, GPRecvBuddyMessageArg gpGetInfo( con, arg->profile, GP_CHECK_CACHE, GP_BLOCKING, (GPCallback)getNickForMessage, &messageResponse); std::wstring s = MultiByteToWideCharSingleLine( arg->message ); - wcsncpy(messageResponse.arg.message.text, s.c_str(), MAX_BUDDY_CHAT_LEN); - messageResponse.arg.message.text[MAX_BUDDY_CHAT_LEN-1] = 0; + wcslcpy(messageResponse.arg.message.text, s.c_str(), MAX_BUDDY_CHAT_LEN); messageResponse.arg.message.date = arg->date; DEBUG_LOG(("Got a buddy message from %d [%ls]", arg->profile, s.c_str())); TheGameSpyBuddyMessageQueue->addResponse( messageResponse ); @@ -629,8 +628,7 @@ void BuddyThreadClass::requestCallback( GPConnection *con, GPRecvBuddyRequestArg gpGetInfo( con, arg->profile, GP_CHECK_CACHE, GP_BLOCKING, (GPCallback)getInfoResponseForRequest, &response); std::wstring s = MultiByteToWideCharSingleLine( arg->reason ); - wcsncpy(response.arg.request.text, s.c_str(), GP_REASON_LEN); - response.arg.request.text[GP_REASON_LEN-1] = 0; + wcslcpy(response.arg.request.text, s.c_str(), GP_REASON_LEN); TheGameSpyBuddyMessageQueue->addResponse( response ); } diff --git a/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp b/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp index 43a35249be7..d2ab560dae0 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp @@ -519,8 +519,7 @@ void LANAPI::update( void ) LANMessage msg; fillInLANMessage( &msg ); msg.LANMessageType = LANMessage::MSG_REQUEST_GAME_LEAVE; - wcsncpy(msg.name, m_currentGame->getPlayerName(0).str(), g_lanPlayerNameLength); - msg.name[g_lanPlayerNameLength] = 0; + wcslcpy(msg.name, m_currentGame->getPlayerName(0).str(), ARRAY_SIZE(msg.name)); handleRequestGameLeave(&msg, m_currentGame->getIP(0)); UnicodeString text; text = TheGameText->fetch("LAN:HostNotResponding"); @@ -538,8 +537,7 @@ void LANAPI::update( void ) UnicodeString theStr; theStr.format(TheGameText->fetch("LAN:PlayerDropped"), m_currentGame->getPlayerName(p).str()); msg.LANMessageType = LANMessage::MSG_REQUEST_GAME_LEAVE; - wcsncpy(msg.name, m_currentGame->getPlayerName(p).str(), g_lanPlayerNameLength); - msg.name[g_lanPlayerNameLength] = 0; + wcslcpy(msg.name, m_currentGame->getPlayerName(p).str(), ARRAY_SIZE(msg.name)); handleRequestGameLeave(&msg, m_currentGame->getIP(p)); OnChat(UnicodeString::TheEmptyString, m_localIP, theStr, LANCHAT_SYSTEM); } @@ -670,8 +668,7 @@ void LANAPI::RequestGameJoinDirectConnect(UnsignedInt ipaddress) msg.LANMessageType = LANMessage::MSG_REQUEST_GAME_INFO; fillInLANMessage(&msg); msg.PlayerInfo.ip = GetLocalIP(); - wcsncpy(msg.PlayerInfo.playerName, m_name.str(), m_name.getLength()); - msg.PlayerInfo.playerName[m_name.getLength()] = 0; + wcslcpy(msg.PlayerInfo.playerName, m_name.str(), ARRAY_SIZE(msg.PlayerInfo.playerName)); sendMessage(&msg, ipaddress); @@ -684,8 +681,7 @@ void LANAPI::RequestGameLeave( void ) LANMessage msg; msg.LANMessageType = LANMessage::MSG_REQUEST_GAME_LEAVE; fillInLANMessage( &msg ); - wcsncpy(msg.GameToLeave.gameName, (m_currentGame)?m_currentGame->getName().str():L"", g_lanGameNameLength); - msg.GameToLeave.gameName[g_lanGameNameLength] = 0; + wcslcpy(msg.PlayerInfo.playerName, m_name.str(), ARRAY_SIZE(msg.PlayerInfo.playerName)); sendMessage(&msg); m_transport->update(); // Send immediately, before OnPlayerLeave below resets everything. @@ -717,8 +713,7 @@ void LANAPI::RequestGameAnnounce( void ) AsciiString gameOpts = GameInfoToAsciiString(m_currentGame); strlcpy(reply.GameInfo.options,gameOpts.str(), ARRAY_SIZE(reply.GameInfo.options)); - wcsncpy(reply.GameInfo.gameName, m_currentGame->getName().str(), g_lanGameNameLength); - reply.GameInfo.gameName[g_lanGameNameLength] = 0; + wcslcpy(reply.GameInfo.gameName, m_currentGame->getName().str(), ARRAY_SIZE(reply.GameInfo.gameName)); reply.GameInfo.inProgress = m_currentGame->isGameInProgress(); reply.GameInfo.isDirectConnect = m_currentGame->getIsDirectConnect(); @@ -736,8 +731,7 @@ void LANAPI::RequestAccept( void ) fillInLANMessage( &msg ); msg.LANMessageType = LANMessage::MSG_SET_ACCEPT; msg.Accept.isAccepted = true; - wcsncpy(msg.Accept.gameName, m_currentGame->getName().str(), g_lanGameNameLength); - msg.Accept.gameName[g_lanGameNameLength] = 0; + wcslcpy(msg.Accept.gameName, m_currentGame->getName().str(), ARRAY_SIZE(msg.Accept.gameName)); sendMessage(&msg); } @@ -750,8 +744,7 @@ void LANAPI::RequestHasMap( void ) fillInLANMessage( &msg ); msg.LANMessageType = LANMessage::MSG_MAP_AVAILABILITY; msg.MapStatus.hasMap = m_currentGame->getSlot(m_currentGame->getLocalSlotNum())->hasMap(); - wcsncpy(msg.MapStatus.gameName, m_currentGame->getName().str(), g_lanGameNameLength); - msg.MapStatus.gameName[g_lanGameNameLength] = 0; + wcslcpy(msg.MapStatus.gameName, m_currentGame->getName().str(), ARRAY_SIZE(msg.MapStatus.gameName)); CRC mapNameCRC; //mapNameCRC.computeCRC(m_currentGame->getMap().str(), m_currentGame->getMap().getLength()); AsciiString portableMapName = TheGameState->realMapPathToPortableMapPath(m_currentGame->getMap()); @@ -788,12 +781,10 @@ void LANAPI::RequestChat( UnicodeString message, ChatType format ) { LANMessage msg; fillInLANMessage( &msg ); - wcsncpy(msg.Chat.gameName, (m_currentGame)?m_currentGame->getName().str():L"", g_lanGameNameLength); - msg.Chat.gameName[g_lanGameNameLength] = 0; + wcslcpy(msg.Chat.gameName, (m_currentGame) ? m_currentGame->getName().str() : L"", ARRAY_SIZE(msg.Chat.gameName)); msg.LANMessageType = LANMessage::MSG_CHAT; msg.Chat.chatType = format; - wcsncpy(msg.Chat.message, message.str(), g_lanMaxChatLength); - msg.Chat.message[g_lanMaxChatLength] = 0; + wcslcpy(msg.Chat.message, message.str(), ARRAY_SIZE(msg.Chat.message)); sendMessage(&msg); OnChat(m_name, m_localIP, message, format); @@ -943,8 +934,7 @@ void LANAPI::RequestGameCreate( UnicodeString gameName, Bool isDirectConnect ) //RequestSlotList(); /* LANMessage msg; - wcsncpy(msg.name, m_name.str(), g_lanPlayerNameLength); - msg.name[g_lanPlayerNameLength] = 0; + wcslcpy(msg.name, m_name.str(), ARRAY_SIZE(msg.name)); wcscpy(msg.GameInfo.gameName, myGame->getName().str()); for (player=0; playergetPlayerName(player).str(), g_lanPlayerNameLength); - reply.GameInfo.name[player][g_lanPlayerNameLength] = 0; + wcslcpy(reply.GameInfo.name[player], m_currentGame->getPlayerName(player).str(), ARRAY_SIZE(reply.GameInfo.name[player])); reply.GameInfo.ip[player] = m_currentGame->getIP(player); reply.GameInfo.playerAccepted[player] = m_currentGame->getSlot(player)->isAccepted(); } - wcsncpy(reply.GameInfo.gameName, m_currentGame->getName().str(), g_lanGameNameLength); - reply.GameInfo.gameName[g_lanGameNameLength] = 0; + wcslcpy(reply.GameInfo.gameName, m_currentGame->getName().str(), ARRAY_SIZE(reply.GameInfo.gameName)); reply.GameInfo.inProgress = m_currentGame->isGameInProgress(); sendMessage(&reply); @@ -1082,8 +1069,7 @@ void LANAPI::fillInLANMessage( LANMessage *msg ) if (!msg) return; - wcsncpy(msg->name, m_name.str(), g_lanPlayerNameLength); - msg->name[g_lanPlayerNameLength] = 0; + wcslcpy(msg->name, m_name.str(), ARRAY_SIZE(msg->name)); strlcpy(msg->userName, m_userName.str(), ARRAY_SIZE(msg->userName)); strlcpy(msg->hostName, m_hostName.str(), ARRAY_SIZE(msg->hostName)); } diff --git a/Generals/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp b/Generals/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp index ce16788bd4a..9f8876f0961 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp @@ -63,8 +63,7 @@ void LANAPI::handleRequestLocations( LANMessage *msg, UnsignedInt senderIP ) reply.LANMessageType = LANMessage::MSG_GAME_ANNOUNCE; AsciiString gameOpts = GenerateGameOptionsString(); strlcpy(reply.GameInfo.options, gameOpts.str(), ARRAY_SIZE(reply.GameInfo.options)); - wcsncpy(reply.GameInfo.gameName, m_currentGame->getName().str(), g_lanGameNameLength); - reply.GameInfo.gameName[g_lanGameNameLength] = 0; + wcslcpy(reply.GameInfo.gameName, m_currentGame->getName().str(), ARRAY_SIZE(reply.GameInfo.gameName)); reply.GameInfo.inProgress = m_currentGame->isGameInProgress(); sendMessage(&reply); @@ -194,8 +193,7 @@ void LANAPI::handleRequestGameInfo( LANMessage *msg, UnsignedInt senderIP ) AsciiString gameOpts = GameInfoToAsciiString(m_currentGame); strlcpy(reply.GameInfo.options,gameOpts.str(), ARRAY_SIZE(reply.GameInfo.options)); - wcsncpy(reply.GameInfo.gameName, m_currentGame->getName().str(), g_lanGameNameLength); - reply.GameInfo.gameName[g_lanGameNameLength] = 0; + wcslcpy(reply.GameInfo.gameName, m_currentGame->getName().str(), ARRAY_SIZE(reply.GameInfo.gameName)); reply.GameInfo.inProgress = m_currentGame->isGameInProgress(); reply.GameInfo.isDirectConnect = m_currentGame->getIsDirectConnect(); @@ -314,8 +312,7 @@ void LANAPI::handleRequestJoin( LANMessage *msg, UnsignedInt senderIP ) { // OK, add him in. reply.LANMessageType = LANMessage::MSG_JOIN_ACCEPT; - wcsncpy(reply.GameJoined.gameName, m_currentGame->getName().str(), g_lanGameNameLength); - reply.GameJoined.gameName[g_lanGameNameLength] = 0; + wcslcpy(reply.GameJoined.gameName, m_currentGame->getName().str(), ARRAY_SIZE(reply.GameJoined.gameName)); reply.GameJoined.slotPosition = player; reply.GameJoined.gameIP = m_localIP; reply.GameJoined.playerIP = senderIP; @@ -339,8 +336,7 @@ void LANAPI::handleRequestJoin( LANMessage *msg, UnsignedInt senderIP ) if (canJoin && player == MAX_SLOTS) { reply.LANMessageType = LANMessage::MSG_JOIN_DENY; - wcsncpy(reply.GameNotJoined.gameName, m_currentGame->getName().str(), g_lanGameNameLength); - reply.GameNotJoined.gameName[g_lanGameNameLength] = 0; + wcslcpy(reply.GameNotJoined.gameName, m_currentGame->getName().str(), ARRAY_SIZE(reply.GameNotJoined.gameName)); reply.GameNotJoined.reason = LANAPIInterface::RET_GAME_FULL; reply.GameNotJoined.gameIP = m_localIP; reply.GameNotJoined.playerIP = senderIP; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Language.h b/GeneralsMD/Code/GameEngine/Include/Common/Language.h index b55884f6c7d..cc1b80e263e 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Language.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Language.h @@ -76,7 +76,6 @@ typedef enum } LanguageID; #define GameStrcpy wcscpy -#define GameStrncpy wcsncpy #define GameStrlen wcslen #define GameStrcat wcscat #define GameStrcmp wcscmp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp index d7d4c1db4e8..51b3f1cd767 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp @@ -632,8 +632,7 @@ WindowMsgHandledType ScoreScreenSystem( GameWindow *window, UnsignedInt msg, req.arg.addbuddy.id = playerID; UnicodeString buddyAddstr; buddyAddstr = TheGameText->fetch("GUI:BuddyAddReq"); - wcsncpy(req.arg.addbuddy.text, buddyAddstr.str(), MAX_BUDDY_CHAT_LEN); - req.arg.addbuddy.text[MAX_BUDDY_CHAT_LEN-1] = 0; + wcslcpy(req.arg.addbuddy.text, buddyAddstr.str(), MAX_BUDDY_CHAT_LEN); TheGameSpyBuddyMessageQueue->addRequest(req); } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp index 06b6516fd8e..942819c8679 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp @@ -304,8 +304,7 @@ WindowMsgHandledType BuddyControlSystem( GameWindow *window, UnsignedInt msg, // Send the message BuddyRequest req; req.buddyRequestType = BuddyRequest::BUDDYREQUEST_MESSAGE; - wcsncpy(req.arg.message.text, txtInput.str(), MAX_BUDDY_CHAT_LEN); - req.arg.message.text[MAX_BUDDY_CHAT_LEN-1] = 0; + wcslcpy(req.arg.message.text, txtInput.str(), MAX_BUDDY_CHAT_LEN); req.arg.message.recipient = selectedProfile; TheGameSpyBuddyMessageQueue->addRequest(req); @@ -1185,8 +1184,7 @@ void RequestBuddyAdd(Int profileID, AsciiString nick) req.arg.addbuddy.id = profileID; UnicodeString buddyAddstr; buddyAddstr = TheGameText->fetch("GUI:BuddyAddReq"); - wcsncpy(req.arg.addbuddy.text, buddyAddstr.str(), MAX_BUDDY_CHAT_LEN); - req.arg.addbuddy.text[MAX_BUDDY_CHAT_LEN-1] = 0; + wcslcpy(req.arg.addbuddy.text, buddyAddstr.str(), MAX_BUDDY_CHAT_LEN); TheGameSpyBuddyMessageQueue->addRequest(req); UnicodeString s; diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp index 75905f2e09c..a31644dca09 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp @@ -512,8 +512,7 @@ void BuddyThreadClass::messageCallback( GPConnection *con, GPRecvBuddyMessageArg gpGetInfo( con, arg->profile, GP_CHECK_CACHE, GP_BLOCKING, (GPCallback)getNickForMessage, &messageResponse); std::wstring s = MultiByteToWideCharSingleLine( arg->message ); - wcsncpy(messageResponse.arg.message.text, s.c_str(), MAX_BUDDY_CHAT_LEN); - messageResponse.arg.message.text[MAX_BUDDY_CHAT_LEN-1] = 0; + wcslcpy(messageResponse.arg.message.text, s.c_str(), MAX_BUDDY_CHAT_LEN); messageResponse.arg.message.date = arg->date; DEBUG_LOG(("Got a buddy message from %d [%ls]", arg->profile, s.c_str())); TheGameSpyBuddyMessageQueue->addResponse( messageResponse ); @@ -629,8 +628,7 @@ void BuddyThreadClass::requestCallback( GPConnection *con, GPRecvBuddyRequestArg gpGetInfo( con, arg->profile, GP_CHECK_CACHE, GP_BLOCKING, (GPCallback)getInfoResponseForRequest, &response); std::wstring s = MultiByteToWideCharSingleLine( arg->reason ); - wcsncpy(response.arg.request.text, s.c_str(), GP_REASON_LEN); - response.arg.request.text[GP_REASON_LEN-1] = 0; + wcslcpy(response.arg.request.text, s.c_str(), GP_REASON_LEN); TheGameSpyBuddyMessageQueue->addResponse( response ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp index 47220962719..e851a8e1ab3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp @@ -519,8 +519,7 @@ void LANAPI::update( void ) LANMessage msg; fillInLANMessage( &msg ); msg.LANMessageType = LANMessage::MSG_REQUEST_GAME_LEAVE; - wcsncpy(msg.name, m_currentGame->getPlayerName(0).str(), g_lanPlayerNameLength); - msg.name[g_lanPlayerNameLength] = 0; + wcslcpy(msg.name, m_currentGame->getPlayerName(0).str(), ARRAY_SIZE(msg.name)); handleRequestGameLeave(&msg, m_currentGame->getIP(0)); UnicodeString text; text = TheGameText->fetch("LAN:HostNotResponding"); @@ -538,8 +537,7 @@ void LANAPI::update( void ) UnicodeString theStr; theStr.format(TheGameText->fetch("LAN:PlayerDropped"), m_currentGame->getPlayerName(p).str()); msg.LANMessageType = LANMessage::MSG_REQUEST_GAME_LEAVE; - wcsncpy(msg.name, m_currentGame->getPlayerName(p).str(), g_lanPlayerNameLength); - msg.name[g_lanPlayerNameLength] = 0; + wcslcpy(msg.name, m_currentGame->getPlayerName(p).str(), ARRAY_SIZE(msg.name)); handleRequestGameLeave(&msg, m_currentGame->getIP(p)); OnChat(UnicodeString::TheEmptyString, m_localIP, theStr, LANCHAT_SYSTEM); } @@ -670,8 +668,7 @@ void LANAPI::RequestGameJoinDirectConnect(UnsignedInt ipaddress) msg.LANMessageType = LANMessage::MSG_REQUEST_GAME_INFO; fillInLANMessage(&msg); msg.PlayerInfo.ip = GetLocalIP(); - wcsncpy(msg.PlayerInfo.playerName, m_name.str(), m_name.getLength()); - msg.PlayerInfo.playerName[m_name.getLength()] = 0; + wcslcpy(msg.PlayerInfo.playerName, m_name.str(), ARRAY_SIZE(msg.PlayerInfo.playerName)); sendMessage(&msg, ipaddress); @@ -684,8 +681,7 @@ void LANAPI::RequestGameLeave( void ) LANMessage msg; msg.LANMessageType = LANMessage::MSG_REQUEST_GAME_LEAVE; fillInLANMessage( &msg ); - wcsncpy(msg.GameToLeave.gameName, (m_currentGame)?m_currentGame->getName().str():L"", g_lanGameNameLength); - msg.GameToLeave.gameName[g_lanGameNameLength] = 0; + wcslcpy(msg.GameToLeave.gameName, (m_currentGame)?m_currentGame->getName().str():L"", ARRAY_SIZE(msg.GameToLeave.gameName)); sendMessage(&msg); m_transport->update(); // Send immediately, before OnPlayerLeave below resets everything. @@ -717,8 +713,7 @@ void LANAPI::RequestGameAnnounce( void ) AsciiString gameOpts = GameInfoToAsciiString(m_currentGame); strlcpy(reply.GameInfo.options,gameOpts.str(), ARRAY_SIZE(reply.GameOptions.options)); - wcsncpy(reply.GameInfo.gameName, m_currentGame->getName().str(), g_lanGameNameLength); - reply.GameInfo.gameName[g_lanGameNameLength] = 0; + wcslcpy(reply.GameInfo.gameName, m_currentGame->getName().str(), ARRAY_SIZE(reply.GameInfo.gameName)); reply.GameInfo.inProgress = m_currentGame->isGameInProgress(); reply.GameInfo.isDirectConnect = m_currentGame->getIsDirectConnect(); @@ -736,8 +731,7 @@ void LANAPI::RequestAccept( void ) fillInLANMessage( &msg ); msg.LANMessageType = LANMessage::MSG_SET_ACCEPT; msg.Accept.isAccepted = true; - wcsncpy(msg.Accept.gameName, m_currentGame->getName().str(), g_lanGameNameLength); - msg.Accept.gameName[g_lanGameNameLength] = 0; + wcslcpy(msg.Accept.gameName, m_currentGame->getName().str(), ARRAY_SIZE(msg.Accept.gameName)); sendMessage(&msg); } @@ -750,8 +744,7 @@ void LANAPI::RequestHasMap( void ) fillInLANMessage( &msg ); msg.LANMessageType = LANMessage::MSG_MAP_AVAILABILITY; msg.MapStatus.hasMap = m_currentGame->getSlot(m_currentGame->getLocalSlotNum())->hasMap(); - wcsncpy(msg.MapStatus.gameName, m_currentGame->getName().str(), g_lanGameNameLength); - msg.MapStatus.gameName[g_lanGameNameLength] = 0; + wcslcpy(msg.MapStatus.gameName, m_currentGame->getName().str(), ARRAY_SIZE(msg.MapStatus.gameName)); CRC mapNameCRC; //mapNameCRC.computeCRC(m_currentGame->getMap().str(), m_currentGame->getMap().getLength()); AsciiString portableMapName = TheGameState->realMapPathToPortableMapPath(m_currentGame->getMap()); @@ -788,12 +781,10 @@ void LANAPI::RequestChat( UnicodeString message, ChatType format ) { LANMessage msg; fillInLANMessage( &msg ); - wcsncpy(msg.Chat.gameName, (m_currentGame)?m_currentGame->getName().str():L"", g_lanGameNameLength); - msg.Chat.gameName[g_lanGameNameLength] = 0; + wcslcpy(msg.Chat.gameName, (m_currentGame)?m_currentGame->getName().str():L"", ARRAY_SIZE(msg.Chat.gameName)); msg.LANMessageType = LANMessage::MSG_CHAT; msg.Chat.chatType = format; - wcsncpy(msg.Chat.message, message.str(), g_lanMaxChatLength); - msg.Chat.message[g_lanMaxChatLength] = 0; + wcslcpy(msg.Chat.message, message.str(), ARRAY_SIZE(msg.Chat.message)); sendMessage(&msg); OnChat(m_name, m_localIP, message, format); @@ -942,8 +933,7 @@ void LANAPI::RequestGameCreate( UnicodeString gameName, Bool isDirectConnect ) //RequestSlotList(); /* LANMessage msg; - wcsncpy(msg.name, m_name.str(), g_lanPlayerNameLength); - msg.name[g_lanPlayerNameLength] = 0; + wcslcpy(msg.name, m_name.str(), ARRAY_SIZE(msg.name)); wcscpy(msg.GameInfo.gameName, myGame->getName().str()); for (player=0; playergetPlayerName(player).str(), g_lanPlayerNameLength); - reply.GameInfo.name[player][g_lanPlayerNameLength] = 0; + wcslcpy(reply.GameInfo.name[player], m_currentGame->getPlayerName(player).str(), ARRAY_SIZE(reply.GameInfo.name[player])); reply.GameInfo.ip[player] = m_currentGame->getIP(player); reply.GameInfo.playerAccepted[player] = m_currentGame->getSlot(player)->isAccepted(); } - wcsncpy(reply.GameInfo.gameName, m_currentGame->getName().str(), g_lanGameNameLength); - reply.GameInfo.gameName[g_lanGameNameLength] = 0; + wcslcpy(reply.GameInfo.gameName, m_currentGame->getName().str(), ARRAY_SIZE(reply.GameInfo.gameName)); reply.GameInfo.inProgress = m_currentGame->isGameInProgress(); sendMessage(&reply); @@ -1081,8 +1068,7 @@ void LANAPI::fillInLANMessage( LANMessage *msg ) if (!msg) return; - wcsncpy(msg->name, m_name.str(), g_lanPlayerNameLength); - msg->name[g_lanPlayerNameLength] = 0; + wcslcpy(msg->name, m_name.str(), ARRAY_SIZE(msg->name)); strlcpy(msg->userName, m_userName.str(), ARRAY_SIZE(msg->userName)); strlcpy(msg->hostName, m_hostName.str(), ARRAY_SIZE(msg->hostName)); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp index 5291b6b7848..d2244cc77ae 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp @@ -63,8 +63,7 @@ void LANAPI::handleRequestLocations( LANMessage *msg, UnsignedInt senderIP ) reply.LANMessageType = LANMessage::MSG_GAME_ANNOUNCE; AsciiString gameOpts = GenerateGameOptionsString(); strlcpy(reply.GameInfo.options,gameOpts.str(), ARRAY_SIZE(reply.GameInfo.options)); - wcsncpy(reply.GameInfo.gameName, m_currentGame->getName().str(), g_lanGameNameLength); - reply.GameInfo.gameName[g_lanGameNameLength] = 0; + wcslcpy(reply.GameInfo.gameName, m_currentGame->getName().str(), ARRAY_SIZE(reply.GameInfo.gameName)); reply.GameInfo.inProgress = m_currentGame->isGameInProgress(); sendMessage(&reply); @@ -194,8 +193,7 @@ void LANAPI::handleRequestGameInfo( LANMessage *msg, UnsignedInt senderIP ) AsciiString gameOpts = GameInfoToAsciiString(m_currentGame); strlcpy(reply.GameInfo.options,gameOpts.str(), ARRAY_SIZE(reply.GameInfo.options)); - wcsncpy(reply.GameInfo.gameName, m_currentGame->getName().str(), g_lanGameNameLength); - reply.GameInfo.gameName[g_lanGameNameLength] = 0; + wcslcpy(reply.GameInfo.gameName, m_currentGame->getName().str(), ARRAY_SIZE(reply.GameInfo.gameName)); reply.GameInfo.inProgress = m_currentGame->isGameInProgress(); reply.GameInfo.isDirectConnect = m_currentGame->getIsDirectConnect(); @@ -315,8 +313,7 @@ void LANAPI::handleRequestJoin( LANMessage *msg, UnsignedInt senderIP ) { // OK, add him in. reply.LANMessageType = LANMessage::MSG_JOIN_ACCEPT; - wcsncpy(reply.GameJoined.gameName, m_currentGame->getName().str(), g_lanGameNameLength); - reply.GameJoined.gameName[g_lanGameNameLength] = 0; + wcslcpy(reply.GameJoined.gameName, m_currentGame->getName().str(), ARRAY_SIZE(reply.GameJoined.gameName)); reply.GameJoined.slotPosition = player; reply.GameJoined.gameIP = m_localIP; reply.GameJoined.playerIP = senderIP; @@ -340,8 +337,7 @@ void LANAPI::handleRequestJoin( LANMessage *msg, UnsignedInt senderIP ) if (canJoin && player == MAX_SLOTS) { reply.LANMessageType = LANMessage::MSG_JOIN_DENY; - wcsncpy(reply.GameNotJoined.gameName, m_currentGame->getName().str(), g_lanGameNameLength); - reply.GameNotJoined.gameName[g_lanGameNameLength] = 0; + wcslcpy(reply.GameNotJoined.gameName, m_currentGame->getName().str(), ARRAY_SIZE(reply.GameNotJoined.gameName)); reply.GameNotJoined.reason = LANAPIInterface::RET_GAME_FULL; reply.GameNotJoined.gameIP = m_localIP; reply.GameNotJoined.playerIP = senderIP; From 57a8949a19f1fb9e6ee65b452d2f2187fdeffb21 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 16 Oct 2025 18:38:13 +0200 Subject: [PATCH 177/343] bugfix(anim): Fix single animation updates (#1702) --- .../Source/WWVegas/WW3D2/animobj.cpp | 34 +++++++++++-------- .../Libraries/Source/WWVegas/WW3D2/animobj.h | 8 ++--- .../Source/WWVegas/WW3D2/animobj.cpp | 34 +++++++++++-------- .../Libraries/Source/WWVegas/WW3D2/animobj.h | 8 ++--- 4 files changed, 46 insertions(+), 38 deletions(-) diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp index 4cf15ff8292..d2b16477fd5 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp @@ -286,7 +286,12 @@ void Animatable3DObjClass::Render(RenderInfoClass & rinfo) return; } - if (!Is_Hierarchy_Valid() || Are_Sub_Object_Transforms_Dirty()) { + // + // Force the hierarchy to be recalculated for single animations. + // + const bool isSingleAnim = CurMotionMode == SINGLE_ANIM && ModeAnim.AnimMode != ANIM_MODE_MANUAL; + + if (isSingleAnim || !Is_Hierarchy_Valid() || Are_Sub_Object_Transforms_Dirty()) { Update_Sub_Object_Transforms(); } } @@ -307,7 +312,12 @@ void Animatable3DObjClass::Special_Render(SpecialRenderInfoClass & rinfo) { if (HTree == NULL) return; - if (!Is_Hierarchy_Valid()) { + // + // Force the hierarchy to be recalculated for single animations. + // + const bool isSingleAnim = CurMotionMode == SINGLE_ANIM && ModeAnim.AnimMode != ANIM_MODE_MANUAL; + + if (isSingleAnim || !Is_Hierarchy_Valid()) { Update_Sub_Object_Transforms(); } } @@ -805,7 +815,7 @@ void Animatable3DObjClass::Update_Sub_Object_Transforms(void) ModeInterp.PrevFrame1 = AnimatedSoundMgrClass::Trigger_Sound(ModeInterp.Motion1, ModeInterp.PrevFrame1, ModeInterp.Frame1, HTree->Get_Transform(ModeInterp.Motion1->Get_Embedded_Sound_Bone_Index())); } - break; + break; case MULTIPLE_ANIM: { @@ -1025,19 +1035,13 @@ void Animatable3DObjClass::Single_Anim_Progress (void) // // Update the current frame (only works in "SINGLE_ANIM" mode!) // - if (CurMotionMode == SINGLE_ANIM) { + WWASSERT(CurMotionMode == SINGLE_ANIM); - // - // Update the frame number and sync time - // - ModeAnim.PrevFrame = ModeAnim.Frame; - ModeAnim.Frame = Compute_Current_Frame(&ModeAnim.animDirection); - - // - // Force the hierarchy to be recalculated - // - Set_Hierarchy_Valid (false); - } + // + // Update the frame number and sync time + // + ModeAnim.PrevFrame = ModeAnim.Frame; + ModeAnim.Frame = Compute_Current_Frame(&ModeAnim.animDirection); } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h index b93b1bc775b..99e14f61aa5 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h @@ -113,7 +113,7 @@ class Animatable3DObjClass : public CompositeRenderObjClass // // Simple bone evaluation methods for when the caller doesn't want - // to update the heirarchy, but needs to know the transform of + // to update the hierarchy, but needs to know the transform of // a bone at a given frame. // virtual bool Simple_Evaluate_Bone(int boneindex, Matrix3D *tm) const; @@ -153,14 +153,14 @@ class Animatable3DObjClass : public CompositeRenderObjClass void Combo_Update( const Matrix3D & root, HAnimComboClass *anim); - // flag to kep track of whether the hierarchy tree transforms are currently valid + // flag to keep track of whether the hierarchy tree transforms are currently valid bool Is_Hierarchy_Valid(void) const { return IsTreeValid; } void Set_Hierarchy_Valid(bool onoff) const { IsTreeValid = onoff; } - // Progress anims for single anim (loop and once) + // Progress animations for single anim (loop and once) void Single_Anim_Progress( void ); - // Release any anims + // Release any animations void Release( void ); protected: diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp index 15e089a0bab..1c5d4483a40 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp @@ -286,7 +286,12 @@ void Animatable3DObjClass::Render(RenderInfoClass & rinfo) return; } - if (!Is_Hierarchy_Valid() || Are_Sub_Object_Transforms_Dirty()) { + // + // Force the hierarchy to be recalculated for single animations. + // + const bool isSingleAnim = CurMotionMode == SINGLE_ANIM && ModeAnim.AnimMode != ANIM_MODE_MANUAL; + + if (isSingleAnim || !Is_Hierarchy_Valid() || Are_Sub_Object_Transforms_Dirty()) { Update_Sub_Object_Transforms(); } } @@ -307,7 +312,12 @@ void Animatable3DObjClass::Special_Render(SpecialRenderInfoClass & rinfo) { if (HTree == NULL) return; - if (!Is_Hierarchy_Valid()) { + // + // Force the hierarchy to be recalculated for single animations. + // + const bool isSingleAnim = CurMotionMode == SINGLE_ANIM && ModeAnim.AnimMode != ANIM_MODE_MANUAL; + + if (isSingleAnim || !Is_Hierarchy_Valid()) { Update_Sub_Object_Transforms(); } } @@ -804,7 +814,7 @@ void Animatable3DObjClass::Update_Sub_Object_Transforms(void) ModeInterp.PrevFrame1 = AnimatedSoundMgrClass::Trigger_Sound(ModeInterp.Motion1, ModeInterp.PrevFrame1, ModeInterp.Frame1, HTree->Get_Transform(ModeInterp.Motion1->Get_Embedded_Sound_Bone_Index())); } - break; + break; case MULTIPLE_ANIM: { @@ -1033,19 +1043,13 @@ void Animatable3DObjClass::Single_Anim_Progress (void) // // Update the current frame (only works in "SINGLE_ANIM" mode!) // - if (CurMotionMode == SINGLE_ANIM) { + WWASSERT(CurMotionMode == SINGLE_ANIM); - // - // Update the frame number and sync time - // - ModeAnim.PrevFrame = ModeAnim.Frame; - ModeAnim.Frame = Compute_Current_Frame(&ModeAnim.animDirection); - - // - // Force the hierarchy to be recalculated - // - Set_Hierarchy_Valid (false); - } + // + // Update the frame number and sync time + // + ModeAnim.PrevFrame = ModeAnim.Frame; + ModeAnim.Frame = Compute_Current_Frame(&ModeAnim.animDirection); } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h index 437480caf16..5f0aa7c8d6e 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h @@ -113,7 +113,7 @@ class Animatable3DObjClass : public CompositeRenderObjClass // // Simple bone evaluation methods for when the caller doesn't want - // to update the heirarchy, but needs to know the transform of + // to update the hierarchy, but needs to know the transform of // a bone at a given frame. // virtual bool Simple_Evaluate_Bone(int boneindex, Matrix3D *tm) const; @@ -153,14 +153,14 @@ class Animatable3DObjClass : public CompositeRenderObjClass void Combo_Update( const Matrix3D & root, HAnimComboClass *anim); - // flag to kep track of whether the hierarchy tree transforms are currently valid + // flag to keep track of whether the hierarchy tree transforms are currently valid bool Is_Hierarchy_Valid(void) const { return IsTreeValid; } void Set_Hierarchy_Valid(bool onoff) const { IsTreeValid = onoff; } - // Progress anims for single anim (loop and once) + // Progress animations for single anim (loop and once) void Single_Anim_Progress( void ); - // Release any anims + // Release any animations void Release( void ); protected: From 76a2f4a13550e2a26053fea190ccf5ad710bfa0c Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Fri, 17 Oct 2025 04:09:18 +1100 Subject: [PATCH 178/343] bugfix(object): Reward unit experience for kills caused by OCL objects (#1634) --- .../Code/GameEngine/Include/GameLogic/ExperienceTracker.h | 1 + .../Source/GameLogic/Object/ExperienceTracker.cpp | 6 ++++++ .../Source/GameLogic/Object/ObjectCreationList.cpp | 5 +++++ .../Code/GameEngine/Include/GameLogic/ExperienceTracker.h | 1 + .../Source/GameLogic/Object/ExperienceTracker.cpp | 6 ++++++ .../Source/GameLogic/Object/ObjectCreationList.cpp | 5 +++++ 6 files changed, 24 insertions(+) diff --git a/Generals/Code/GameEngine/Include/GameLogic/ExperienceTracker.h b/Generals/Code/GameEngine/Include/GameLogic/ExperienceTracker.h index a237b0209fb..58420b5931a 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/ExperienceTracker.h +++ b/Generals/Code/GameEngine/Include/GameLogic/ExperienceTracker.h @@ -58,6 +58,7 @@ class ExperienceTracker : public MemoryPoolObject, public Snapshot Bool canGainExpForLevel(Int levelsToGain) const; ///< return same value as gainExpForLevel, but don't change anything void setExperienceAndLevel(Int experienceIn, Bool provideFeedback = TRUE ); void setExperienceSink( ObjectID sink ); ///< My experience actually goes to this person (loose couple) + ObjectID getExperienceSink() const; Real getExperienceScalar() const { return m_experienceScalar; } void setExperienceScalar( Real scalar ) { m_experienceScalar = scalar; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp index a8bd115b557..ddd9a877a54 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp @@ -80,6 +80,12 @@ void ExperienceTracker::setExperienceSink( ObjectID sink ) m_experienceSink = sink; } +//------------------------------------------------------------------------------------------------- +ObjectID ExperienceTracker::getExperienceSink() const +{ + return m_experienceSink; +} + //------------------------------------------------------------------------------------------------- // Set Level to AT LEAST this... if we are already >= this level, do nothing. void ExperienceTracker::setMinVeterancyLevel( VeterancyLevel newLevel, Bool provideFeedback ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp index 4524f79c535..589227646a8 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp @@ -1333,6 +1333,11 @@ class GenericObjectCreationNugget : public ObjectCreationNugget } } +#if !RETAIL_COMPATIBLE_CRC && !RETAIL_COMPATIBLE_BUG + ObjectID sinkID = sourceObj->getExperienceTracker()->getExperienceSink(); + firstObject->getExperienceTracker()->setExperienceSink(sinkID != INVALID_ID ? sinkID : sourceObj->getID()); +#endif + if (container) doStuffToObj( container, AsciiString::TheEmptyString, pos, mtx, orientation, sourceObj, lifetimeFrames ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/ExperienceTracker.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/ExperienceTracker.h index 31b30a03b4a..559545a3c54 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/ExperienceTracker.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/ExperienceTracker.h @@ -58,6 +58,7 @@ class ExperienceTracker : public MemoryPoolObject, public Snapshot Bool canGainExpForLevel(Int levelsToGain) const; ///< return same value as gainExpForLevel, but don't change anything void setExperienceAndLevel(Int experienceIn, Bool provideFeedback = TRUE ); void setExperienceSink( ObjectID sink ); ///< My experience actually goes to this person (loose couple) + ObjectID getExperienceSink() const; Real getExperienceScalar() const { return m_experienceScalar; } void setExperienceScalar( Real scalar ) { m_experienceScalar = scalar; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp index 4eebcdd51fa..7438a50e0d7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp @@ -80,6 +80,12 @@ void ExperienceTracker::setExperienceSink( ObjectID sink ) m_experienceSink = sink; } +//------------------------------------------------------------------------------------------------- +ObjectID ExperienceTracker::getExperienceSink() const +{ + return m_experienceSink; +} + //------------------------------------------------------------------------------------------------- // Set Level to AT LEAST this... if we are already >= this level, do nothing. void ExperienceTracker::setMinVeterancyLevel( VeterancyLevel newLevel, Bool provideFeedback ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp index 703c49b47ab..0714620b6fa 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp @@ -1421,6 +1421,11 @@ class GenericObjectCreationNugget : public ObjectCreationNugget } } +#if !RETAIL_COMPATIBLE_CRC && !RETAIL_COMPATIBLE_BUG + ObjectID sinkID = sourceObj->getExperienceTracker()->getExperienceSink(); + firstObject->getExperienceTracker()->setExperienceSink(sinkID != INVALID_ID ? sinkID : sourceObj->getID()); +#endif + if (container) doStuffToObj( container, AsciiString::TheEmptyString, pos, mtx, orientation, sourceObj, lifetimeFrames ); From 441e1aa4830caa5f998159e136c32179fdd075a9 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Fri, 17 Oct 2025 04:09:50 +1100 Subject: [PATCH 179/343] bugfix(behavior): Fix unexpected propaganda influence from contained units with direct Propaganda Tower behavior modules (#1545) --- Generals/Code/GameEngine/Include/GameLogic/Object.h | 1 + .../Object/Behavior/PropagandaTowerBehavior.cpp | 11 +++++++---- .../GameEngine/Source/GameLogic/Object/Object.cpp | 12 ++++++++++++ .../Code/GameEngine/Include/GameLogic/Object.h | 1 + .../Object/Behavior/PropagandaTowerBehavior.cpp | 11 +++++++---- .../GameEngine/Source/GameLogic/Object/Object.cpp | 12 ++++++++++++ 6 files changed, 40 insertions(+), 8 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameLogic/Object.h b/Generals/Code/GameEngine/Include/GameLogic/Object.h index cf7fbf9dfdd..6f9781964f3 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Object.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Object.h @@ -421,6 +421,7 @@ class Object : public Thing, public Snapshot void onRemovedFrom( Object *removedFrom ); Int getTransportSlotCount() const; void friend_setContainedBy( Object *containedBy ) { m_containedBy = containedBy; } + Object* getEnclosingContainedBy(); ///< Find the first enclosing container in the containment chain. // Special Powers ------------------------------------------------------------------------------- SpecialPowerModuleInterface *getSpecialPowerModule( const SpecialPowerTemplate *specialPowerTemplate ) const; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp index cd34783518b..f10dd04960a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp @@ -40,6 +40,7 @@ #include "GameLogic/Object.h" #include "GameLogic/PartitionManager.h" #include "GameLogic/Weapon.h" +#include "GameLogic/Module/ContainModule.h" #include "GameLogic/Module/PropagandaTowerBehavior.h" #include "GameLogic/Module/BodyModule.h" @@ -205,11 +206,13 @@ UpdateSleepTime PropagandaTowerBehavior::update( void ) } } - if( self->getContainedBy() && self->getContainedBy()->getContainedBy() ) +#if RETAIL_COMPATIBLE_CRC + if (self->getContainedBy() && self->getContainedBy()->getContainedBy()) +#else + // TheSuperHackers @bugfix If our container or any parent containers are enclosing, we turn the heck off. + if (self->getEnclosingContainedBy()) +#endif { - // If our container is contained, we turn the heck off. Seems like a weird specific check, but all of - // attacking is guarded by the same check in isPassengersAllowedToFire. We similarly work in a container, - // but not in a double container. removeAllInfluence(); return UPDATE_SLEEP_NONE; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp index f4d77051071..c0dbd47221c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -667,6 +667,18 @@ Int Object::getTransportSlotCount() const return count; } +Object* Object::getEnclosingContainedBy() +{ + for (Object* child = this, *container = getContainedBy(); container; child = container, container = container->getContainedBy()) + { + ContainModuleInterface* containModule = container->getContain(); + if (containModule && containModule->isEnclosingContainerFor(child)) + return container; + } + + return NULL; +} + //------------------------------------------------------------------------------------------------- /** Run from GameLogic::destroyObject */ //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h index 70714d8f37d..24cdb68781d 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h @@ -446,6 +446,7 @@ class Object : public Thing, public Snapshot void onRemovedFrom( Object *removedFrom ); Int getTransportSlotCount() const; void friend_setContainedBy( Object *containedBy ) { m_containedBy = containedBy; } + Object* getEnclosingContainedBy(); ///< Find the first enclosing container in the containment chain. // Special Powers ------------------------------------------------------------------------------- SpecialPowerModuleInterface *getSpecialPowerModule( const SpecialPowerTemplate *specialPowerTemplate ) const; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp index 2d22c471237..abd971772e4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp @@ -40,6 +40,7 @@ #include "GameLogic/Object.h" #include "GameLogic/PartitionManager.h" #include "GameLogic/Weapon.h" +#include "GameLogic/Module/ContainModule.h" #include "GameLogic/Module/PropagandaTowerBehavior.h" #include "GameLogic/Module/BodyModule.h" @@ -207,11 +208,13 @@ UpdateSleepTime PropagandaTowerBehavior::update( void ) } } - if( self->getContainedBy() && self->getContainedBy()->getContainedBy() ) +#if RETAIL_COMPATIBLE_CRC + if (self->getContainedBy() && self->getContainedBy()->getContainedBy()) +#else + // TheSuperHackers @bugfix If our container or any parent containers are enclosing, we turn the heck off. + if (self->getEnclosingContainedBy()) +#endif { - // If our container is contained, we turn the heck off. Seems like a weird specific check, but all of - // attacking is guarded by the same check in isPassengersAllowedToFire. We similarly work in a container, - // but not in a double container. removeAllInfluence(); return UPDATE_SLEEP_NONE; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp index f48cd78ec02..039b8581174 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -731,6 +731,18 @@ Int Object::getTransportSlotCount() const return count; } +Object* Object::getEnclosingContainedBy() +{ + for (Object* child = this, *container = getContainedBy(); container; child = container, container = container->getContainedBy()) + { + ContainModuleInterface* containModule = container->getContain(); + if (containModule && containModule->isEnclosingContainerFor(child)) + return container; + } + + return NULL; +} + //------------------------------------------------------------------------------------------------- /** Run from GameLogic::destroyObject */ //------------------------------------------------------------------------------------------------- From 08e59cb80fcca82a7ebc8010fe3fdfb0513ec14e Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 16 Oct 2025 20:18:20 +0200 Subject: [PATCH 180/343] bugfix(lan): Fix LANAPI init error (#1704) --- Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp | 4 ++-- GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp b/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp index d2ab560dae0..b17eb107c08 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp @@ -117,7 +117,7 @@ void LANAPI::init( void ) DWORD bufSize = ARRAY_SIZE(userName); if (GetUserNameA(userName, &bufSize)) { - m_userName.set(userName, bufSize); + m_userName.set(userName, bufSize - 1); } else { @@ -128,7 +128,7 @@ void LANAPI::init( void ) bufSize = ARRAY_SIZE(computerName); if (GetComputerNameA(computerName, &bufSize)) { - m_hostName.set(computerName, bufSize); + m_hostName.set(computerName, bufSize - 1); } else { diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp index e851a8e1ab3..69c87311106 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp @@ -117,7 +117,7 @@ void LANAPI::init( void ) DWORD bufSize = ARRAY_SIZE(userName); if (GetUserNameA(userName, &bufSize)) { - m_userName.set(userName, bufSize); + m_userName.set(userName, bufSize - 1); } else { @@ -128,7 +128,7 @@ void LANAPI::init( void ) bufSize = ARRAY_SIZE(computerName); if (GetComputerNameA(computerName, &bufSize)) { - m_hostName.set(computerName, bufSize); + m_hostName.set(computerName, bufSize - 1); } else { From 6748e68e7e56b78634a42e1bf34230b1cc58ea1b Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 16 Oct 2025 21:42:11 +0200 Subject: [PATCH 181/343] feat(filesystem): Implement access to shadowed files inside archives (#1483) --- .../Include/Common/ArchiveFileSystem.h | 73 +++--- Core/GameEngine/Include/Common/FileSystem.h | 35 ++- .../Source/Common/System/ArchiveFile.cpp | 60 ++--- .../Common/System/ArchiveFileSystem.cpp | 233 ++++++++++-------- .../Source/Common/System/FileSystem.cpp | 86 +++++-- .../Include/StdDevice/Common/StdBIGFile.h | 2 +- .../Include/Win32Device/Common/Win32BIGFile.h | 2 +- .../Source/StdDevice/Common/StdBIGFile.cpp | 4 +- .../StdDevice/Common/StdBIGFileSystem.cpp | 4 +- .../Win32Device/Common/Win32BIGFile.cpp | 4 +- .../Win32Device/Common/Win32BIGFileSystem.cpp | 4 +- .../Libraries/Source/WWVegas/WWLib/STLUtils.h | 73 +++++- 12 files changed, 362 insertions(+), 218 deletions(-) diff --git a/Core/GameEngine/Include/Common/ArchiveFileSystem.h b/Core/GameEngine/Include/Common/ArchiveFileSystem.h index b781a90e0af..9f216fb29c6 100644 --- a/Core/GameEngine/Include/Common/ArchiveFileSystem.h +++ b/Core/GameEngine/Include/Common/ArchiveFileSystem.h @@ -84,26 +84,19 @@ class ArchivedDirectoryInfo; class DetailedArchivedDirectoryInfo; class ArchivedFileInfo; -typedef std::map DetailedArchivedDirectoryInfoMap; -typedef std::map ArchivedDirectoryInfoMap; -typedef std::map ArchivedFileInfoMap; -typedef std::map ArchiveFileMap; -typedef std::map ArchivedFileLocationMap; // first string is the file name, second one is the archive filename. +typedef std::map DetailedArchivedDirectoryInfoMap; // Archived directory name to detailed archived directory info +typedef std::map ArchivedDirectoryInfoMap; // Archived directory name to archived directory info +typedef std::map ArchivedFileInfoMap; // Archived file name to archived file info +typedef std::map ArchiveFileMap; // Archive file name to archive data +typedef std::multimap ArchivedFileLocationMap; // Archived file name to archive data class ArchivedDirectoryInfo { public: - AsciiString m_directoryName; - ArchivedDirectoryInfoMap m_directories; - ArchivedFileLocationMap m_files; - - void clear() - { - m_directoryName.clear(); - m_directories.clear(); - m_files.clear(); - } - + AsciiString m_path; // The full path to this directory + AsciiString m_directoryName; // The current directory + ArchivedDirectoryInfoMap m_directories; // Contained leaf directories + ArchivedFileLocationMap m_files; // Contained files }; class DetailedArchivedDirectoryInfo @@ -112,13 +105,6 @@ class DetailedArchivedDirectoryInfo AsciiString m_directoryName; DetailedArchivedDirectoryInfoMap m_directories; ArchivedFileInfoMap m_files; - - void clear() - { - m_directoryName.clear(); - m_directories.clear(); - m_files.clear(); - } }; class ArchivedFileInfo @@ -130,23 +116,16 @@ class ArchivedFileInfo UnsignedInt m_size; ArchivedFileInfo() + : m_offset(0) + , m_size(0) { - clear(); - } - - void clear() - { - m_filename.clear(); - m_archiveFilename.clear(); - m_offset = 0; - m_size = 0; } }; class ArchiveFileSystem : public SubsystemInterface { - public: +public: ArchiveFileSystem(); virtual ~ArchiveFileSystem(); @@ -158,24 +137,38 @@ class ArchiveFileSystem : public SubsystemInterface // ArchiveFile operations virtual ArchiveFile* openArchiveFile( const Char *filename ) = 0; ///< Create new or return existing Archive file from file name virtual void closeArchiveFile( const Char *filename ) = 0; ///< Close the one specified big file. - virtual void closeAllArchiveFiles( void ) = 0; ///< Close all Archivefiles currently open + virtual void closeAllArchiveFiles( void ) = 0; ///< Close all Archive files currently open // File operations - virtual File* openFile( const Char *filename, Int access = 0); ///< Search Archive files for specified file name and open it if found - virtual void closeAllFiles( void ) = 0; ///< Close all files associated with ArchiveFiles - virtual Bool doesFileExist(const Char *filename) const; ///< return true if that file exists in an archive file somewhere. + virtual File* openFile( const Char *filename, Int access = 0, FileInstance instance = 0); ///< Search Archive files for specified file name and open it if found + virtual void closeAllFiles( void ) = 0; ///< Close all files associated with Archive files + virtual Bool doesFileExist(const Char *filename, FileInstance instance = 0) const; ///< return true if that file exists in an archive file somewhere. void getFileListInDirectory(const AsciiString& currentDirectory, const AsciiString& originalDirectory, const AsciiString& searchName, FilenameList &filenameList, Bool searchSubdirectories) const; ///< search the given directory for files matching the searchName (egs. *.ini, *.rep). Possibly search subdirectories. Scans each Archive file. - Bool getFileInfo(const AsciiString& filename, FileInfo *fileInfo) const; ///< see FileSystem.h + Bool getFileInfo(const AsciiString& filename, FileInfo *fileInfo, FileInstance instance = 0) const; ///< see FileSystem.h virtual Bool loadBigFilesFromDirectory(AsciiString dir, AsciiString fileMask, Bool overwrite = FALSE) = 0; // Unprotected this for copy-protection routines - AsciiString getArchiveFilenameForFile(const AsciiString& filename) const; + ArchiveFile* getArchiveFile(const AsciiString& filename, FileInstance instance = 0) const; + void loadMods( void ); + ArchivedDirectoryInfo* friend_getArchivedDirectoryInfo(const Char* directory); + protected: - virtual void loadIntoDirectoryTree(const ArchiveFile *archiveFile, const AsciiString& archiveFilename, Bool overwrite = FALSE ); ///< load the archive file's header information and apply it to the global archive directory tree. + struct ArchivedDirectoryInfoResult + { + ArchivedDirectoryInfoResult() : dirInfo(NULL) {} + Bool valid() const { return dirInfo != NULL; } + + ArchivedDirectoryInfo* dirInfo; + AsciiString lastToken; ///< Synonymous for file name if the search directory was a file path + }; + + ArchivedDirectoryInfoResult getArchivedDirectoryInfo(const Char* directory); + + virtual void loadIntoDirectoryTree(ArchiveFile *archiveFile, Bool overwrite = FALSE); ///< load the archive file's header information and apply it to the global archive directory tree. ArchiveFileMap m_archiveFileMap; ArchivedDirectoryInfo m_rootDirectory; diff --git a/Core/GameEngine/Include/Common/FileSystem.h b/Core/GameEngine/Include/Common/FileSystem.h index 122a15526d3..14acf2eb7a0 100644 --- a/Core/GameEngine/Include/Common/FileSystem.h +++ b/Core/GameEngine/Include/Common/FileSystem.h @@ -66,6 +66,7 @@ typedef std::set > FilenameList; typedef FilenameList::iterator FilenameListIter; +typedef UnsignedByte FileInstance; //---------------------------------------------------------------------------- // Type Defines @@ -80,7 +81,7 @@ typedef FilenameList::iterator FilenameListIter; #define USER_W3D_DIR_PATH "%sW3D/" ///< .w3d files live here #define USER_TGA_DIR_PATH "%sTextures/" ///< User .tga texture files live here -// the following defines are only to be used while maintaining legacy compatability +// the following defines are only to be used while maintaining legacy compatibility // with old files until they are completely gone and in the regular art set #ifdef MAINTAIN_LEGACY_FILES #define LEGACY_W3D_DIR_PATH "../LegacyArt/W3D/" ///< .w3d files live here @@ -102,7 +103,16 @@ typedef FilenameList::iterator FilenameListIter; #define TEST_TGA_DIR_PATH "../TestArt/" ///< .tga texture files live here #endif +#ifndef ENABLE_FILESYSTEM_LOGGING +#define ENABLE_FILESYSTEM_LOGGING (0) +#endif + + struct FileInfo { + + Int64 size() const { return (Int64)sizeHigh << 32 | sizeLow; } + Int64 timestamp() const { return (Int64)timestampHigh << 32 | timestampLow; } + Int sizeHigh; Int sizeLow; Int timestampHigh; @@ -115,11 +125,13 @@ struct FileInfo { /** * FileSystem is an interface class for creating specific FileSystem objects. * - * A FileSystem object's implemenation decides what derivative of File object needs to be + * A FileSystem object's implementation decides what derivative of File object needs to be * created when FileSystem::Open() gets called. */ +// TheSuperHackers @feature xezon 23/08/2025 Implements file instance access. +// Can be used to access different versions of files in different archives under the same name. +// Instance 0 refers to the top file that shadows all other files under the same name. //=============================== - class FileSystem : public SubsystemInterface { FileSystem(const FileSystem&); @@ -133,23 +145,30 @@ class FileSystem : public SubsystemInterface void reset(); void update(); - File* openFile( const Char *filename, Int access = File::NONE, size_t bufferSize = File::BUFFERSIZE ); ///< opens a File interface to the specified file - Bool doesFileExist(const Char *filename) const; ///< returns TRUE if the file exists. filename should have no directory. + File* openFile( const Char *filename, Int access = File::NONE, size_t bufferSize = File::BUFFERSIZE, FileInstance instance = 0 ); ///< opens a File interface to the specified file + Bool doesFileExist(const Char *filename, FileInstance instance = 0) const; ///< returns TRUE if the file exists. filename should have no directory. void getFileListInDirectory(const AsciiString& directory, const AsciiString& searchName, FilenameList &filenameList, Bool searchSubdirectories) const; ///< search the given directory for files matching the searchName (egs. *.ini, *.rep). Possibly search subdirectories. - Bool getFileInfo(const AsciiString& filename, FileInfo *fileInfo) const; ///< fills in the FileInfo struct for the file given. returns TRUE if successful. + Bool getFileInfo(const AsciiString& filename, FileInfo *fileInfo, FileInstance instance = 0) const; ///< fills in the FileInfo struct for the file given. returns TRUE if successful. Bool createDirectory(AsciiString directory); ///< create a directory of the given name. Bool areMusicFilesOnCD(); void loadMusicFilesFromCD(); void unloadMusicFilesFromCD(); - AsciiString normalizePath(const AsciiString& path) const; ///< normalizes a file path. The path can refer to a directory. File path must be absolute, but does not need to exist. Returns an empty string on failure. + + static AsciiString normalizePath(const AsciiString& path); ///< normalizes a file path. The path can refer to a directory. File path must be absolute, but does not need to exist. Returns an empty string on failure. static Bool isPathInDirectory(const AsciiString& testPath, const AsciiString& basePath); ///< determines if a file path is within a base path. Both paths must be absolute, but do not need to exist. protected: #if ENABLE_FILESYSTEM_EXISTENCE_CACHE + struct FileExistData + { + FileExistData() : instanceExists(0), instanceDoesNotExist(~FileInstance(0)) {} + FileInstance instanceExists; + FileInstance instanceDoesNotExist; + }; typedef std::hash_map< - rts::string_key, bool, + rts::string_key, FileExistData, rts::string_key_hash, rts::string_key_equal > FileExistMap; mutable FileExistMap m_fileExist; diff --git a/Core/GameEngine/Source/Common/System/ArchiveFile.cpp b/Core/GameEngine/Source/Common/System/ArchiveFile.cpp index 3ea2cc0fb8b..c10b42754cf 100644 --- a/Core/GameEngine/Source/Common/System/ArchiveFile.cpp +++ b/Core/GameEngine/Source/Common/System/ArchiveFile.cpp @@ -90,50 +90,46 @@ ArchiveFile::~ArchiveFile() } ArchiveFile::ArchiveFile() + : m_file(NULL) { - m_rootDirectory.clear(); } void ArchiveFile::addFile(const AsciiString& path, const ArchivedFileInfo *fileInfo) { - AsciiString temp; - temp = path; - temp.toLower(); - AsciiString token; - AsciiString debugpath; - DetailedArchivedDirectoryInfo *dirInfo = &m_rootDirectory; - temp.nextToken(&token, "\\/"); + AsciiString token; + AsciiString tokenizer = path; + tokenizer.toLower(); + tokenizer.nextToken(&token, "\\/"); - while (token.getLength() > 0) { - if (dirInfo->m_directories.find(token) == dirInfo->m_directories.end()) + while (token.getLength() > 0) + { + DetailedArchivedDirectoryInfoMap::iterator tempiter = dirInfo->m_directories.find(token); + if (tempiter == dirInfo->m_directories.end()) + { + dirInfo = &(dirInfo->m_directories[token]); + dirInfo->m_directoryName = token; + } + else { - dirInfo->m_directories[token].clear(); - dirInfo->m_directories[token].m_directoryName = token; + dirInfo = &tempiter->second; } - debugpath.concat(token); - debugpath.concat('\\'); - dirInfo = &(dirInfo->m_directories[token]); - temp.nextToken(&token, "\\/"); + tokenizer.nextToken(&token, "\\/"); } dirInfo->m_files[fileInfo->m_filename] = *fileInfo; - //path.concat(fileInfo->m_filename); } void ArchiveFile::getFileListInDirectory(const AsciiString& currentDirectory, const AsciiString& originalDirectory, const AsciiString& searchName, FilenameList &filenameList, Bool searchSubdirectories) const { - - AsciiString searchDir; const DetailedArchivedDirectoryInfo *dirInfo = &m_rootDirectory; - searchDir = originalDirectory; - searchDir.toLower(); AsciiString token; - - searchDir.nextToken(&token, "\\/"); + AsciiString tokenizer = originalDirectory; + tokenizer.toLower(); + tokenizer.nextToken(&token, "\\/"); while (token.getLength() > 0) { @@ -148,7 +144,7 @@ void ArchiveFile::getFileListInDirectory(const AsciiString& currentDirectory, co return; } - searchDir.nextToken(&token, "\\/"); + tokenizer.nextToken(&token, "\\/"); } getFileListInDirectory(dirInfo, originalDirectory, searchName, filenameList, searchSubdirectories); @@ -198,17 +194,15 @@ void ArchiveFile::attachFile(File *file) const ArchivedFileInfo * ArchiveFile::getArchivedFileInfo(const AsciiString& filename) const { - AsciiString path; - path = filename; - path.toLower(); - AsciiString token; - const DetailedArchivedDirectoryInfo *dirInfo = &m_rootDirectory; - path.nextToken(&token, "\\/"); - - while ((token.find('.') == NULL) || (path.find('.') != NULL)) { + AsciiString token; + AsciiString tokenizer = filename; + tokenizer.toLower(); + tokenizer.nextToken(&token, "\\/"); + while (!token.find('.') || tokenizer.find('.')) + { DetailedArchivedDirectoryInfoMap::const_iterator it = dirInfo->m_directories.find(token); if (it != dirInfo->m_directories.end()) { @@ -219,7 +213,7 @@ const ArchivedFileInfo * ArchiveFile::getArchivedFileInfo(const AsciiString& fil return NULL; } - path.nextToken(&token, "\\/"); + tokenizer.nextToken(&token, "\\/"); } ArchivedFileInfoMap::const_iterator it = dirInfo->m_files.find(token); diff --git a/Core/GameEngine/Source/Common/System/ArchiveFileSystem.cpp b/Core/GameEngine/Source/Common/System/ArchiveFileSystem.cpp index 06d76fffe10..02f3552e9ab 100644 --- a/Core/GameEngine/Source/Common/System/ArchiveFileSystem.cpp +++ b/Core/GameEngine/Source/Common/System/ArchiveFileSystem.cpp @@ -115,7 +115,7 @@ ArchiveFileSystem::~ArchiveFileSystem() } } -void ArchiveFileSystem::loadIntoDirectoryTree(const ArchiveFile *archiveFile, const AsciiString& archiveFilename, Bool overwrite) +void ArchiveFileSystem::loadIntoDirectoryTree(ArchiveFile *archiveFile, Bool overwrite) { FilenameList filenameList; @@ -124,53 +124,101 @@ void ArchiveFileSystem::loadIntoDirectoryTree(const ArchiveFile *archiveFile, co FilenameListIter it = filenameList.begin(); - while (it != filenameList.end()) { - // add this filename to the directory tree. - AsciiString path = *it; - path.toLower(); - AsciiString token; - AsciiString debugpath; - + while (it != filenameList.end()) + { ArchivedDirectoryInfo *dirInfo = &m_rootDirectory; - Bool infoInPath; - infoInPath = path.nextToken(&token, "\\/"); + AsciiString path; + AsciiString token; + AsciiString tokenizer = *it; + tokenizer.toLower(); + Bool infoInPath = tokenizer.nextToken(&token, "\\/"); + + while (infoInPath && (!token.find('.') || tokenizer.find('.'))) + { + path.concat(token); + path.concat('\\'); - while (infoInPath && (!token.find('.') || path.find('.'))) { ArchivedDirectoryInfoMap::iterator tempiter = dirInfo->m_directories.find(token); if (tempiter == dirInfo->m_directories.end()) { - dirInfo->m_directories[token].clear(); - dirInfo->m_directories[token].m_directoryName = token; + dirInfo = &(dirInfo->m_directories[token]); + dirInfo->m_path = path; + dirInfo->m_directoryName = token; + } + else + { + dirInfo = &tempiter->second; } - dirInfo = &(dirInfo->m_directories[token]); - debugpath.concat(token); - debugpath.concat('\\'); - infoInPath = path.nextToken(&token, "\\/"); + infoInPath = tokenizer.nextToken(&token, "\\/"); } - // token is the filename, and dirInfo is the directory that this file is in. - if (dirInfo->m_files.find(token) == dirInfo->m_files.end() || overwrite) { - AsciiString path2; - path2 = debugpath; - path2.concat(token); -// DEBUG_LOG(("ArchiveFileSystem::loadIntoDirectoryTree - adding file %s, archived in %s", path2.str(), archiveFilename.str())); - dirInfo->m_files[token] = archiveFilename; + ArchivedFileLocationMap::iterator fileIt; + if (overwrite) + { + // When overwriting, try place the new value at the beginning of the key list. + fileIt = dirInfo->m_files.find(token); + } + else + { + // Append to the end of the key list. + fileIt = dirInfo->m_files.end(); + } + + dirInfo->m_files.insert(fileIt, std::make_pair(token, archiveFile)); + +#if defined(DEBUG_LOGGING) && ENABLE_FILESYSTEM_LOGGING + { + const stl::const_range range = stl::get_range(dirInfo->m_files, token, 0); + if (range.distance() >= 2) + { + ArchivedFileLocationMap::const_iterator rangeIt0; + ArchivedFileLocationMap::const_iterator rangeIt1; + + if (overwrite) + { + rangeIt0 = range.begin; + rangeIt1 = std::next(rangeIt0); + + DEBUG_LOG(("ArchiveFileSystem::loadIntoDirectoryTree - adding file %s, archived in %s, overwriting same file in %s", + it->str(), + rangeIt0->second->getName().str(), + rangeIt1->second->getName().str() + )); + } + else + { + rangeIt1 = std::prev(range.end); + rangeIt0 = std::prev(rangeIt1); + + DEBUG_LOG(("ArchiveFileSystem::loadIntoDirectoryTree - adding file %s, archived in %s, overwritten by same file in %s", + it->str(), + rangeIt1->second->getName().str(), + rangeIt0->second->getName().str() + )); + } + } + else + { + DEBUG_LOG(("ArchiveFileSystem::loadIntoDirectoryTree - adding file %s, archived in %s", it->str(), archiveFile->getName().str())); + } } +#endif it++; } } -void ArchiveFileSystem::loadMods() { +void ArchiveFileSystem::loadMods() +{ if (TheGlobalData->m_modBIG.isNotEmpty()) { ArchiveFile *archiveFile = openArchiveFile(TheGlobalData->m_modBIG.str()); if (archiveFile != NULL) { DEBUG_LOG(("ArchiveFileSystem::loadMods - loading %s into the directory tree.", TheGlobalData->m_modBIG.str())); - loadIntoDirectoryTree(archiveFile, TheGlobalData->m_modBIG, TRUE); + loadIntoDirectoryTree(archiveFile, TRUE); m_archiveFileMap[TheGlobalData->m_modBIG] = archiveFile; DEBUG_LOG(("ArchiveFileSystem::loadMods - %s inserted into the archive file map.", TheGlobalData->m_modBIG.str())); } @@ -190,51 +238,68 @@ void ArchiveFileSystem::loadMods() { } } -Bool ArchiveFileSystem::doesFileExist(const Char *filename) const +Bool ArchiveFileSystem::doesFileExist(const Char *filename, FileInstance instance) const { - AsciiString path = filename; - path.toLower(); - AsciiString token; + ArchivedDirectoryInfoResult result = const_cast(this)->getArchivedDirectoryInfo(filename); + + if (!result.valid()) + return false; + + stl::const_range range = stl::get_range(result.dirInfo->m_files, result.lastToken, instance); + + return range.valid(); +} + +ArchivedDirectoryInfo* ArchiveFileSystem::friend_getArchivedDirectoryInfo(const Char* directory) +{ + ArchivedDirectoryInfoResult result = getArchivedDirectoryInfo(directory); + + return result.dirInfo; +} - const ArchivedDirectoryInfo *dirInfo = &m_rootDirectory; +ArchiveFileSystem::ArchivedDirectoryInfoResult ArchiveFileSystem::getArchivedDirectoryInfo(const Char* directory) +{ + ArchivedDirectoryInfoResult result; + ArchivedDirectoryInfo* dirInfo = &m_rootDirectory; - path.nextToken(&token, "\\/"); + AsciiString token; + AsciiString tokenizer = directory; + tokenizer.toLower(); + Bool infoInPath = tokenizer.nextToken(&token, "\\/"); - while (!token.find('.') || path.find('.')) + while (infoInPath && (!token.find('.') || tokenizer.find('.'))) { - ArchivedDirectoryInfoMap::const_iterator tempiter = dirInfo->m_directories.find(token); + ArchivedDirectoryInfoMap::iterator tempiter = dirInfo->m_directories.find(token); if (tempiter != dirInfo->m_directories.end()) { dirInfo = &tempiter->second; - path.nextToken(&token, "\\/"); + infoInPath = tokenizer.nextToken(&token, "\\/"); } else { - // the directory doesn't exist, so return false - return FALSE; + // the directory doesn't exist + result.dirInfo = NULL; + result.lastToken = AsciiString::TheEmptyString; + return result; } } - // token is the filename, and dirInfo is the directory that this file is in. - if (dirInfo->m_files.find(token) == dirInfo->m_files.end()) { - return FALSE; - } - return TRUE; + result.dirInfo = dirInfo; + result.lastToken = token; + return result; } -File * ArchiveFileSystem::openFile(const Char *filename, Int access /* = 0 */) +File * ArchiveFileSystem::openFile(const Char *filename, Int access, FileInstance instance) { - AsciiString archiveFilename; - archiveFilename = getArchiveFilenameForFile(AsciiString(filename)); + ArchiveFile* archive = getArchiveFile(filename, instance); - if (archiveFilename.getLength() == 0) { + if (archive == NULL) return NULL; - } - return m_archiveFileMap[archiveFilename]->openFile(filename, access); + return archive->openFile(filename, access); } -Bool ArchiveFileSystem::getFileInfo(const AsciiString& filename, FileInfo *fileInfo) const +Bool ArchiveFileSystem::getFileInfo(const AsciiString& filename, FileInfo *fileInfo, FileInstance instance) const { if (fileInfo == NULL) { return FALSE; @@ -244,69 +309,27 @@ Bool ArchiveFileSystem::getFileInfo(const AsciiString& filename, FileInfo *fileI return FALSE; } - AsciiString archiveFilename = getArchiveFilenameForFile(filename); - ArchiveFileMap::const_iterator it = m_archiveFileMap.find(archiveFilename); - if (it != m_archiveFileMap.end()) - { - return it->second->getFileInfo(filename, fileInfo); - } - else - { + ArchiveFile* archive = getArchiveFile(filename, instance); + + if (archive == NULL) return FALSE; - } + + return archive->getFileInfo(filename, fileInfo); } -AsciiString ArchiveFileSystem::getArchiveFilenameForFile(const AsciiString& filename) const +ArchiveFile* ArchiveFileSystem::getArchiveFile(const AsciiString& filename, FileInstance instance) const { - AsciiString path; - path = filename; - path.toLower(); - AsciiString token; - AsciiString debugpath; - - const ArchivedDirectoryInfo *dirInfo = &m_rootDirectory; - - path.nextToken(&token, "\\/"); + ArchivedDirectoryInfoResult result = const_cast(this)->getArchivedDirectoryInfo(filename.str()); - while (!token.find('.') || path.find('.')) { - - ArchivedDirectoryInfoMap::const_iterator it = dirInfo->m_directories.find(token); - if (it != dirInfo->m_directories.end()) - { - dirInfo = &it->second; - } - else - { - // the directory doesn't exist, so return NULL - - // dump the directories; - //DEBUG_LOG(("directory %s not found in %s in archive file system", token.str(), debugpath.str())); - //DEBUG_LOG(("directories in %s in archive file system are:", debugpath.str())); - //ArchivedDirectoryInfoMap::const_iterator it = dirInfo->m_directories.begin(); - //while (it != dirInfo->m_directories.end()) { - // DEBUG_LOG(("\t%s", it->second.m_directoryName.str())); - // it++; - //} - //DEBUG_LOG(("end of directory list.")); - return AsciiString::TheEmptyString; - } - - debugpath.concat(token); - debugpath.concat('\\'); - - path.nextToken(&token, "\\/"); - } + if (!result.valid()) + return NULL; - ArchivedFileLocationMap::const_iterator it = dirInfo->m_files.find(token); - if (it != dirInfo->m_files.end()) - { - return it->second; - } - else - { - return AsciiString::TheEmptyString; - } + stl::const_range range = stl::get_range(result.dirInfo->m_files, result.lastToken, instance); + if (!range.valid()) + return NULL; + + return range.get()->second; } void ArchiveFileSystem::getFileListInDirectory(const AsciiString& currentDirectory, const AsciiString& originalDirectory, const AsciiString& searchName, FilenameList &filenameList, Bool searchSubdirectories) const diff --git a/Core/GameEngine/Source/Common/System/FileSystem.cpp b/Core/GameEngine/Source/Common/System/FileSystem.cpp index 7ce22ab9522..8d5589b5f68 100644 --- a/Core/GameEngine/Source/Common/System/FileSystem.cpp +++ b/Core/GameEngine/Source/Common/System/FileSystem.cpp @@ -171,26 +171,47 @@ void FileSystem::reset( void ) // FileSystem::open //============================================================================ -File* FileSystem::openFile( const Char *filename, Int access, size_t bufferSize ) +File* FileSystem::openFile( const Char *filename, Int access, size_t bufferSize, FileInstance instance ) { USE_PERF_TIMER(FileSystem) File *file = NULL; if ( TheLocalFileSystem != NULL ) { - file = TheLocalFileSystem->openFile( filename, access, bufferSize ); - -#if ENABLE_FILESYSTEM_EXISTENCE_CACHE - if (file != NULL && (file->getAccess() & File::CREATE)) + if (instance != 0) { - m_fileExist[filename]=true; + if (TheLocalFileSystem->doesFileExist(filename)) + { + --instance; + } } + else + { + file = TheLocalFileSystem->openFile( filename, access, bufferSize ); + +#if ENABLE_FILESYSTEM_EXISTENCE_CACHE + if (file != NULL && (file->getAccess() & File::CREATE)) + { + FileExistMap::iterator it = m_fileExist.find(FileExistMap::key_type::temporary(filename)); + if (it != m_fileExist.end()) + { + ++it->second.instanceExists; + if (it->second.instanceDoesNotExist != ~FileInstance(0)) + ++it->second.instanceDoesNotExist; + } + else + { + m_fileExist[filename]; + } + } #endif + } } if ( (TheArchiveFileSystem != NULL) && (file == NULL) ) { - file = TheArchiveFileSystem->openFile( filename ); + // TheSuperHackers @todo Pass 'access' here? + file = TheArchiveFileSystem->openFile( filename, 0, instance ); } return file; @@ -200,35 +221,49 @@ File* FileSystem::openFile( const Char *filename, Int access, size_t bufferSize // FileSystem::doesFileExist //============================================================================ -Bool FileSystem::doesFileExist(const Char *filename) const +Bool FileSystem::doesFileExist(const Char *filename, FileInstance instance) const { USE_PERF_TIMER(FileSystem) #if ENABLE_FILESYSTEM_EXISTENCE_CACHE { - FileExistMap::iterator i = m_fileExist.find(FileExistMap::key_type::temporary(filename)); - if (i!=m_fileExist.end()) - return i->second; + FileExistMap::const_iterator it = m_fileExist.find(FileExistMap::key_type::temporary(filename)); + if (it != m_fileExist.end()) + { + // Must test instanceDoesNotExist first! + if (instance >= it->second.instanceDoesNotExist) + return FALSE; + if (instance <= it->second.instanceExists) + return TRUE; + } } #endif if (TheLocalFileSystem->doesFileExist(filename)) { + if (instance == 0) + { #if ENABLE_FILESYSTEM_EXISTENCE_CACHE - m_fileExist[filename]=true; + m_fileExist[filename]; #endif - return TRUE; + return TRUE; + } + + --instance; } - if (TheArchiveFileSystem->doesFileExist(filename)) + + if (TheArchiveFileSystem->doesFileExist(filename, instance)) { #if ENABLE_FILESYSTEM_EXISTENCE_CACHE - m_fileExist[filename]=true; + FileExistMap::mapped_type& value = m_fileExist[filename]; + value.instanceExists = max(value.instanceExists, instance); #endif return TRUE; } #if ENABLE_FILESYSTEM_EXISTENCE_CACHE - m_fileExist[filename]=false; + FileExistMap::mapped_type& value = m_fileExist[filename]; + value.instanceDoesNotExist = min(value.instanceDoesNotExist, instance); #endif return FALSE; } @@ -239,26 +274,33 @@ Bool FileSystem::doesFileExist(const Char *filename) const void FileSystem::getFileListInDirectory(const AsciiString& directory, const AsciiString& searchName, FilenameList &filenameList, Bool searchSubdirectories) const { USE_PERF_TIMER(FileSystem) - TheLocalFileSystem->getFileListInDirectory(AsciiString(""), directory, searchName, filenameList, searchSubdirectories); - TheArchiveFileSystem->getFileListInDirectory(AsciiString(""), directory, searchName, filenameList, searchSubdirectories); + TheLocalFileSystem->getFileListInDirectory(AsciiString::TheEmptyString, directory, searchName, filenameList, searchSubdirectories); + TheArchiveFileSystem->getFileListInDirectory(AsciiString::TheEmptyString, directory, searchName, filenameList, searchSubdirectories); } //============================================================================ // FileSystem::getFileInfo //============================================================================ -Bool FileSystem::getFileInfo(const AsciiString& filename, FileInfo *fileInfo) const +Bool FileSystem::getFileInfo(const AsciiString& filename, FileInfo *fileInfo, FileInstance instance) const { USE_PERF_TIMER(FileSystem) + + // TheSuperHackers @todo Add file info cache? + if (fileInfo == NULL) { return FALSE; } memset(fileInfo, 0, sizeof(*fileInfo)); if (TheLocalFileSystem->getFileInfo(filename, fileInfo)) { - return TRUE; + if (instance == 0) { + return TRUE; + } + + --instance; } - if (TheArchiveFileSystem->getFileInfo(filename, fileInfo)) { + if (TheArchiveFileSystem->getFileInfo(filename, fileInfo, instance)) { return TRUE; } @@ -358,7 +400,7 @@ void FileSystem::unloadMusicFilesFromCD() //============================================================================ // FileSystem::normalizePath //============================================================================ -AsciiString FileSystem::normalizePath(const AsciiString& path) const +AsciiString FileSystem::normalizePath(const AsciiString& path) { return TheLocalFileSystem->normalizePath(path); } diff --git a/Core/GameEngineDevice/Include/StdDevice/Common/StdBIGFile.h b/Core/GameEngineDevice/Include/StdDevice/Common/StdBIGFile.h index 17c4e952aa1..a601a981196 100644 --- a/Core/GameEngineDevice/Include/StdDevice/Common/StdBIGFile.h +++ b/Core/GameEngineDevice/Include/StdDevice/Common/StdBIGFile.h @@ -38,7 +38,7 @@ class StdBIGFile : public ArchiveFile { public: - StdBIGFile(); + StdBIGFile(AsciiString name, AsciiString path); virtual ~StdBIGFile(); virtual Bool getFileInfo(const AsciiString& filename, FileInfo *fileInfo) const; ///< fill in the fileInfo struct with info about the requested file. diff --git a/Core/GameEngineDevice/Include/Win32Device/Common/Win32BIGFile.h b/Core/GameEngineDevice/Include/Win32Device/Common/Win32BIGFile.h index 13ca71c7261..20dfbfa9b98 100644 --- a/Core/GameEngineDevice/Include/Win32Device/Common/Win32BIGFile.h +++ b/Core/GameEngineDevice/Include/Win32Device/Common/Win32BIGFile.h @@ -38,7 +38,7 @@ class Win32BIGFile : public ArchiveFile { public: - Win32BIGFile(); + Win32BIGFile(AsciiString name, AsciiString path); virtual ~Win32BIGFile(); virtual Bool getFileInfo(const AsciiString& filename, FileInfo *fileInfo) const; ///< fill in the fileInfo struct with info about the requested file. diff --git a/Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFile.cpp b/Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFile.cpp index 3bfcc92f5ac..1c988d12987 100644 --- a/Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFile.cpp +++ b/Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFile.cpp @@ -38,7 +38,9 @@ // StdBIGFile::StdBIGFile //============================================================================ -StdBIGFile::StdBIGFile() +StdBIGFile::StdBIGFile(AsciiString name, AsciiString path) + : m_name(name) + , m_path(path) { } diff --git a/Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFileSystem.cpp b/Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFileSystem.cpp index 8a867f6e594..2470d669125 100644 --- a/Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFileSystem.cpp +++ b/Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFileSystem.cpp @@ -86,7 +86,7 @@ ArchiveFile * StdBIGFileSystem::openArchiveFile(const Char *filename) { Int archiveFileSize = 0; Int numLittleFiles = 0; - ArchiveFile *archiveFile = NEW StdBIGFile; + ArchiveFile *archiveFile = NEW StdBIGFile(filename, AsciiString::TheEmptyString); DEBUG_LOG(("StdBIGFileSystem::openArchiveFile - opening BIG file %s", filename)); @@ -219,7 +219,7 @@ Bool StdBIGFileSystem::loadBigFilesFromDirectory(AsciiString dir, AsciiString fi if (archiveFile != NULL) { DEBUG_LOG(("StdBIGFileSystem::loadBigFilesFromDirectory - loading %s into the directory tree.", (*it).str())); - loadIntoDirectoryTree(archiveFile, *it, overwrite); + loadIntoDirectoryTree(archiveFile, overwrite); m_archiveFileMap[(*it)] = archiveFile; DEBUG_LOG(("StdBIGFileSystem::loadBigFilesFromDirectory - %s inserted into the archive file map.", (*it).str())); actuallyAdded = TRUE; diff --git a/Core/GameEngineDevice/Source/Win32Device/Common/Win32BIGFile.cpp b/Core/GameEngineDevice/Source/Win32Device/Common/Win32BIGFile.cpp index c1c07f392f4..9379f1042a1 100644 --- a/Core/GameEngineDevice/Source/Win32Device/Common/Win32BIGFile.cpp +++ b/Core/GameEngineDevice/Source/Win32Device/Common/Win32BIGFile.cpp @@ -38,7 +38,9 @@ // Win32BIGFile::Win32BIGFile //============================================================================ -Win32BIGFile::Win32BIGFile() +Win32BIGFile::Win32BIGFile(AsciiString name, AsciiString path) + : m_name(name) + , m_path(path) { } diff --git a/Core/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp b/Core/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp index f0a07b912f2..95f9e7ef0e5 100644 --- a/Core/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp +++ b/Core/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp @@ -129,7 +129,7 @@ ArchiveFile * Win32BIGFileSystem::openArchiveFile(const Char *filename) { // read in each directory listing. ArchivedFileInfo *fileInfo = NEW ArchivedFileInfo; // TheSuperHackers @fix Mauller 23/04/2025 Create new file handle when necessary to prevent memory leak - ArchiveFile *archiveFile = NEW Win32BIGFile; + ArchiveFile *archiveFile = NEW Win32BIGFile(filename, AsciiString::TheEmptyString); for (Int i = 0; i < numLittleFiles; ++i) { Int filesize = 0; @@ -220,7 +220,7 @@ Bool Win32BIGFileSystem::loadBigFilesFromDirectory(AsciiString dir, AsciiString if (archiveFile != NULL) { DEBUG_LOG(("Win32BIGFileSystem::loadBigFilesFromDirectory - loading %s into the directory tree.", (*it).str())); - loadIntoDirectoryTree(archiveFile, *it, overwrite); + loadIntoDirectoryTree(archiveFile, overwrite); m_archiveFileMap[(*it)] = archiveFile; DEBUG_LOG(("Win32BIGFileSystem::loadBigFilesFromDirectory - %s inserted into the archive file map.", (*it).str())); actuallyAdded = TRUE; diff --git a/Core/Libraries/Source/WWVegas/WWLib/STLUtils.h b/Core/Libraries/Source/WWVegas/WWLib/STLUtils.h index 4fae9beef39..ca92bf76c67 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/STLUtils.h +++ b/Core/Libraries/Source/WWVegas/WWLib/STLUtils.h @@ -18,13 +18,48 @@ #pragma once -#include -#include #include +#include +#include +#include +#include namespace stl { +// Convenience struct to avoid the std::pair +template +struct range +{ + typedef typename Container::iterator iterator; + + range(iterator b, iterator e) : begin(b), end(e) {} + + iterator get() const { return begin; } + bool valid() const { return begin != end; } + ptrdiff_t distance() const { return std::distance(begin, end); } + + iterator begin; + iterator end; +}; + +template +struct const_range +{ + typedef typename Container::const_iterator iterator; + + const_range(iterator b, iterator e) : begin(b), end(e) {} + const_range(const range& other) : begin(other.begin), end(other.end) {} + + iterator get() const { return begin; } + bool valid() const { return begin != end; } + ptrdiff_t distance() const { return std::distance(begin, end); } + + iterator begin; + iterator end; +}; + + // Finds first matching element in vector-like container and erases it. template bool find_and_erase(Container& container, const typename Container::value_type& value) @@ -73,4 +108,38 @@ bool push_back_unique(Container& container, const typename Container::value_type return false; } + +template +Iter advance_in_range(Iter first, Iter last, ptrdiff_t n) +{ + if (n <= 0) + return first; + + const ptrdiff_t count = std::distance(first, last); + + if (n >= count) + return last; + + std::advance(first, n); + return first; +} + +template +range > get_range(std::multimap& mm, const Key& key, ptrdiff_t n = 0) +{ + typedef typename std::multimap::iterator Iter; + const std::pair pair = mm.equal_range(key); + const Iter it = advance_in_range(pair.first, pair.second, n); + return range >(it, pair.second); +} + +template +const_range > get_range(const std::multimap& mm, const Key& key, ptrdiff_t n = 0) +{ + typedef typename std::multimap::const_iterator Iter; + const std::pair pair = mm.equal_range(key); + const Iter it = advance_in_range(pair.first, pair.second, n); + return const_range >(it, pair.second); +} + } // namespace stl From cb57c1bc393a769b4c521cc9c9a17518ac7df1f6 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 17 Oct 2025 18:23:38 +0200 Subject: [PATCH 182/343] refactor: Remove redundant CppMacros.h includes (#1706) --- Core/Libraries/Source/WWVegas/WW3D2/intersec.cpp | 1 - Core/Libraries/Source/WWVegas/WWLib/always.h | 1 - Dependencies/Utility/Utility/endian_compat.h | 1 - Generals/Code/GameEngine/Source/GameNetwork/NetPacket.cpp | 1 - GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp | 2 -- GeneralsMD/Code/GameEngine/Source/GameNetwork/NetPacket.cpp | 1 - 6 files changed, 7 deletions(-) diff --git a/Core/Libraries/Source/WWVegas/WW3D2/intersec.cpp b/Core/Libraries/Source/WWVegas/WW3D2/intersec.cpp index 7aba004b133..38fe2c904de 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/intersec.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/intersec.cpp @@ -40,7 +40,6 @@ #include "camera.h" #include "scene.h" #include "intersec.inl" -#include "Utility/CppMacros.h" ////////////////////////////////////////////////////////////////////// diff --git a/Core/Libraries/Source/WWVegas/WWLib/always.h b/Core/Libraries/Source/WWVegas/WWLib/always.h index 592d2aa0731..3f7ab140549 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/always.h +++ b/Core/Libraries/Source/WWVegas/WWLib/always.h @@ -49,7 +49,6 @@ // TheSuperHackers @build feliwir 17/04/2025 include utility macros for cross-platform compatibility #include #include -#include // Disable warning about exception handling not being enabled. It's used as part of STL - in a part of STL we don't use. #pragma warning(disable : 4530) diff --git a/Dependencies/Utility/Utility/endian_compat.h b/Dependencies/Utility/Utility/endian_compat.h index 04ea2baa42e..97e5b31b74d 100644 --- a/Dependencies/Utility/Utility/endian_compat.h +++ b/Dependencies/Utility/Utility/endian_compat.h @@ -19,7 +19,6 @@ // This file contains macros to help with endian conversions between different endian systems. #pragma once -// VC6 does not support pragma once #ifndef ENDIAN_COMPAT_H #define ENDIAN_COMPAT_H diff --git a/Generals/Code/GameEngine/Source/GameNetwork/NetPacket.cpp b/Generals/Code/GameEngine/Source/GameNetwork/NetPacket.cpp index 0805712ec2b..c16939299d8 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/NetPacket.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/NetPacket.cpp @@ -31,7 +31,6 @@ #include "GameNetwork/NetworkDefs.h" #include "GameNetwork/networkutil.h" #include "GameNetwork/GameMessageParser.h" -#include // TheSuperHackers @refactor BobTista 10/06/2025 Extract magic character literals into named constants for improved readability typedef UnsignedByte NetPacketFieldType; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 43b135c80fb..4b2626e74c5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -52,8 +52,6 @@ #include "Common/UnitTimings.h" //Contains the DO_UNIT_TIMINGS define jba. -#include "Utility/CppMacros.h" - #define no_INTENSE_DEBUG #define DEBUG_QPF diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetPacket.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetPacket.cpp index 6b5007a4b69..620fa8c71e9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetPacket.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetPacket.cpp @@ -31,7 +31,6 @@ #include "GameNetwork/NetworkDefs.h" #include "GameNetwork/networkutil.h" #include "GameNetwork/GameMessageParser.h" -#include // TheSuperHackers @refactor BobTista 10/06/2025 Extract magic character literals into named constants for improved readability typedef UnsignedByte NetPacketFieldType; From b838c65293adacc39eb8b79e79106e668b3250d3 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 18 Oct 2025 15:52:17 +0200 Subject: [PATCH 183/343] feat(filesystem): Recover 481 higher resolution textures in Zero Hour by re-prioritizing textures by size (#1484) --- Core/GameEngine/Include/Common/GameDefines.h | 6 + .../W3DDevice/GameClient/W3DFileSystem.h | 6 + .../W3DDevice/GameClient/W3DFileSystem.cpp | 152 ++++++++++++----- .../W3DDevice/GameClient/W3DFileSystem.h | 6 + .../W3DDevice/GameClient/W3DFileSystem.cpp | 157 ++++++++++++------ 5 files changed, 235 insertions(+), 92 deletions(-) diff --git a/Core/GameEngine/Include/Common/GameDefines.h b/Core/GameEngine/Include/Common/GameDefines.h index 189e5b07a34..4d11397296c 100644 --- a/Core/GameEngine/Include/Common/GameDefines.h +++ b/Core/GameEngine/Include/Common/GameDefines.h @@ -73,6 +73,12 @@ #define ENABLE_FILESYSTEM_EXISTENCE_CACHE (1) #endif +// Enable prioritization of textures by size. This will improve the texture quality of 481 textures in Zero Hour +// by using the larger resolution textures from Generals. Content wise these textures are identical. +#ifndef PRIORITIZE_TEXTURES_BY_SIZE +#define PRIORITIZE_TEXTURES_BY_SIZE (1) +#endif + // Enable obsolete code. This mainly refers to code that existed in Generals but was removed in GeneralsMD. // Disable and remove this when Generals and GeneralsMD are merged. #if RTS_GENERALS diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DFileSystem.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DFileSystem.h index cc96045c8a6..1cd17426757 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DFileSystem.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DFileSystem.h @@ -40,6 +40,7 @@ #define __W3DFILESYSTEM_H_ #include "WWLib/ffactory.h" +#include "Common/ArchiveFileSystem.h" #include "Common/file.h" //------------------------------------------------------------------------------------------------- @@ -93,6 +94,11 @@ class W3DFileSystem : public FileFactoryClass { virtual FileClass * Get_File( char const *filename ); virtual void Return_File( FileClass *file ); + +private: + + static void reprioritizeTexturesBySize(); + static void reprioritizeTexturesBySize(ArchivedDirectoryInfo& dirInfo); }; extern W3DFileSystem *TheW3DFileSystem; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp index 8b615401569..1870b062d93 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp @@ -40,6 +40,7 @@ // for now we maintain old legacy files // #define MAINTAIN_LEGACY_FILES +#include "Common/ArchiveFile.h" #include "Common/Debug.h" #include "Common/file.h" #include "Common/FileSystem.h" @@ -47,10 +48,11 @@ #include "Common/MapObject.h" #include "Common/Registry.h" #include "W3DDevice/GameClient/W3DFileSystem.h" -// DEFINES //////////////////////////////////////////////////////////////////////////////////////// #include +// DEFINES //////////////////////////////////////////////////////////////////////////////////////// + //------------------------------------------------------------------------------------------------- /** Game file access. At present this allows us to access test assets, assets from * legacy GDI assets, and the current flat directory access for textures, models etc */ @@ -71,9 +73,9 @@ typedef enum GameFileClass::GameFileClass( char const *filename ) { - m_fileExists = FALSE; m_theFile = NULL; - m_filePath[ 0 ] = 0; + m_fileExists = FALSE; + m_filePath[0] = 0; m_filename[0] = 0; if( filename ) @@ -119,6 +121,24 @@ inline static Bool isImageFileType( GameFileType fileType ) return (fileType == FILE_TYPE_TGA || fileType == FILE_TYPE_DDS); } +//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------------------------- +static GameFileType getFileType( char const *filename ) +{ + if (char const *extension = strrchr( filename, '.' )) + { + // test the extension to recognize a few key file types + if( stricmp( extension, ".w3d" ) == 0 ) + return FILE_TYPE_W3D; + else if( stricmp( extension, ".tga" ) == 0 ) + return FILE_TYPE_TGA; + else if( stricmp( extension, ".dds" ) == 0 ) + return FILE_TYPE_DDS; + } + + return FILE_TYPE_COMPLETELY_UNKNOWN; // MBL FILE_TYPE_UNKNOWN change due to compile error +} + //------------------------------------------------------------------------------------------------- /** Sets the file name, and finds the GDI asset if present. */ //------------------------------------------------------------------------------------------------- @@ -131,41 +151,7 @@ char const * GameFileClass::Set_Name( char const *filename ) // save the filename strlcpy( m_filename, filename, _MAX_PATH ); - char name[_MAX_PATH]; - const Int EXT_LEN = 32; - char extension[EXT_LEN]; - extension[0] = 0; - strcpy(name, filename); - Int i = strlen(name); - i--; - Int extLen = 1; - while(i>0 && extLen < EXT_LEN) { - if (name[i] == '.') { - strcpy(extension, name+i); - name[i] = 0; - break; - } - i--; - extLen++; - } - Int j = 0; - // Strip out spaces. - for (i=0; name[i]; i++) { - if (name[i] != ' ') { - name[j] = name[i]; - j++; - } - } - name[j] = 0; - - // test the extension to recognize a few key file types - GameFileType fileType = FILE_TYPE_COMPLETELY_UNKNOWN; // MBL FILE_TYPE_UNKNOWN change due to compile error - if( stricmp( extension, ".w3d" ) == 0 ) - fileType = FILE_TYPE_W3D; - else if( stricmp( extension, ".tga" ) == 0 ) - fileType = FILE_TYPE_TGA; - else if( stricmp( extension, ".dds" ) == 0 ) - fileType = FILE_TYPE_DDS; + GameFileType fileType = getFileType(filename); // all .w3d files are in W3D_DIR_PATH, all .tga files are in TGA_DIR_PATH if( fileType == FILE_TYPE_W3D ) @@ -250,7 +236,7 @@ char const * GameFileClass::Set_Name( char const *filename ) strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } - if( isImageFileType(fileType) ) + else if( isImageFileType(fileType) ) { sprintf(m_filePath,USER_TGA_DIR_PATH, TheGlobalData->getPath_UserData().str()); //strcpy( m_filePath, USER_TGA_DIR_PATH ); @@ -264,10 +250,10 @@ char const * GameFileClass::Set_Name( char const *filename ) } - // We Need to be able to "temporarily copy over the map preview for whichever directory it came from + // We need to be able to temporarily copy over the map preview for whichever directory it came from if( m_fileExists == FALSE && TheGlobalData) { - if( fileType == FILE_TYPE_TGA ) // just TGA, since we don't dds previews + if( fileType == FILE_TYPE_TGA ) // just TGA, since we don't do dds previews { sprintf(m_filePath,MAP_PREVIEW_DIR_PATH, TheGlobalData->getPath_UserData().str()); //strcpy( m_filePath, USER_TGA_DIR_PATH ); @@ -343,11 +329,9 @@ int GameFileClass::Open(int rights) return(false); } - // just open up the file in m_filePath m_theFile = TheFileSystem->openFile( m_filePath, File::READ | File::BINARY ); return (m_theFile != NULL); - } //------------------------------------------------------------------------------------------------- @@ -418,12 +402,16 @@ void GameFileClass::Close(void) extern W3DFileSystem *TheW3DFileSystem = NULL; //------------------------------------------------------------------------------------------------- -/** Constructor. Creating an instance of this class overrices the default +/** Constructor. Creating an instance of this class overrides the default W3D file factory. */ //------------------------------------------------------------------------------------------------- W3DFileSystem::W3DFileSystem(void) { _TheFileFactory = this; // override the w3d file factory. + +#if RTS_ZEROHOUR && PRIORITIZE_TEXTURES_BY_SIZE + reprioritizeTexturesBySize(); +#endif } //------------------------------------------------------------------------------------------------- @@ -451,3 +439,79 @@ void W3DFileSystem::Return_File( FileClass *file ) delete file; } +//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------------------------- +void W3DFileSystem::reprioritizeTexturesBySize() +{ + ArchivedDirectoryInfo* dirInfo = TheArchiveFileSystem->friend_getArchivedDirectoryInfo(TGA_DIR_PATH); + if (dirInfo != NULL) + { + reprioritizeTexturesBySize(*dirInfo); + } +} + +//------------------------------------------------------------------------------------------------- +// TheSuperHackers @info This function moves the largest texture of its name to the front of the +// directory info. The algorithm only prioritizes the first item in the multimap, because this is +// what we currently need: +// Before: A(256kb) B(128kb) C(512kb) +// After: C(512kb) B(128kb) A(256kb) +// +// Catered to specific game archives only. This ensures that user created archives are not included +// for the re-prioritization of textures. +//------------------------------------------------------------------------------------------------- +void W3DFileSystem::reprioritizeTexturesBySize(ArchivedDirectoryInfo& dirInfo) +{ + const char* const superiorArchive = "Textures.big"; + const char* const inferiorArchive = "TexturesZH.big"; + + ArchivedFileLocationMap::iterator it0; + ArchivedFileLocationMap::iterator it1 = dirInfo.m_files.begin(); + ArchivedFileLocationMap::iterator end = dirInfo.m_files.end(); + + if (it1 != end) + { + it0 = it1; + ++it1; + } + + for (; it1 != end; ++it1) + { + const AsciiString& file0 = it0->first; + const AsciiString& file1 = it1->first; + + if (file0 == file1) + { + GameFileType type = getFileType(file0.str()); + if (isImageFileType(type)) + { + ArchiveFile* archive0 = it0->second; + ArchiveFile* archive1 = it1->second; + FileInfo info0; + FileInfo info1; + AsciiString filepath(dirInfo.m_path); + filepath.concat(file0); + + if (archive0->getFileInfo(filepath, &info0) && archive1->getFileInfo(filepath, &info1)) + { + if (info0.size() < info1.size() + && archive0->getName().endsWithNoCase(inferiorArchive) + && archive1->getName().endsWithNoCase(superiorArchive)) + { + std::swap(it0->second, it1->second); + +#if ENABLE_FILESYSTEM_LOGGING + DEBUG_LOG(("W3DFileSystem::reprioritizeTexturesBySize - prioritize %s(%ukb) from %s over %s(%ukb) from %s", + file1.str(), UnsignedInt(info1.size() / 1024), archive1->getName().str(), + file0.str(), UnsignedInt(info0.size() / 1024), archive0->getName().str())); +#endif + } + } + } + } + else + { + it0 = it1; + } + } +} diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DFileSystem.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DFileSystem.h index b5bbeda03ae..a0ae96869db 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DFileSystem.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DFileSystem.h @@ -40,6 +40,7 @@ #define __W3DFILESYSTEM_H_ #include "WWLib/ffactory.h" +#include "Common/ArchiveFileSystem.h" #include "Common/file.h" //------------------------------------------------------------------------------------------------- @@ -93,6 +94,11 @@ class W3DFileSystem : public FileFactoryClass { virtual FileClass * Get_File( char const *filename ); virtual void Return_File( FileClass *file ); + +private: + + static void reprioritizeTexturesBySize(); + static void reprioritizeTexturesBySize(ArchivedDirectoryInfo& dirInfo); }; extern W3DFileSystem *TheW3DFileSystem; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp index a4079ad8aa3..eae8ffc2500 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp @@ -40,6 +40,7 @@ // for now we maintain old legacy files // #define MAINTAIN_LEGACY_FILES +#include "Common/ArchiveFile.h" #include "Common/Debug.h" #include "Common/file.h" #include "Common/FileSystem.h" @@ -47,10 +48,11 @@ #include "Common/MapObject.h" #include "Common/Registry.h" #include "W3DDevice/GameClient/W3DFileSystem.h" -// DEFINES //////////////////////////////////////////////////////////////////////////////////////// #include +// DEFINES //////////////////////////////////////////////////////////////////////////////////////// + //------------------------------------------------------------------------------------------------- /** Game file access. At present this allows us to access test assets, assets from * legacy GDI assets, and the current flat directory access for textures, models etc */ @@ -71,9 +73,9 @@ typedef enum GameFileClass::GameFileClass( char const *filename ) { - m_fileExists = FALSE; m_theFile = NULL; - m_filePath[ 0 ] = 0; + m_fileExists = FALSE; + m_filePath[0] = 0; m_filename[0] = 0; if( filename ) @@ -119,6 +121,24 @@ inline static Bool isImageFileType( GameFileType fileType ) return (fileType == FILE_TYPE_TGA || fileType == FILE_TYPE_DDS); } +//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------------------------- +static GameFileType getFileType( char const *filename ) +{ + if (char const *extension = strrchr( filename, '.' )) + { + // test the extension to recognize a few key file types + if( stricmp( extension, ".w3d" ) == 0 ) + return FILE_TYPE_W3D; + else if( stricmp( extension, ".tga" ) == 0 ) + return FILE_TYPE_TGA; + else if( stricmp( extension, ".dds" ) == 0 ) + return FILE_TYPE_DDS; + } + + return FILE_TYPE_COMPLETELY_UNKNOWN; // MBL FILE_TYPE_UNKNOWN change due to compile error +} + //------------------------------------------------------------------------------------------------- /** Sets the file name, and finds the GDI asset if present. @@ -146,43 +166,7 @@ char const * GameFileClass::Set_Name( char const *filename ) // save the filename strlcpy( m_filename, filename, _MAX_PATH ); - char name[_MAX_PATH]; - const Int EXT_LEN = 32; - char extension[EXT_LEN]; - extension[0] = 0; - strcpy(name, filename); - Int i = strlen(name); - i--; - Int extLen = 1; - while(i>0 && extLen < EXT_LEN) { - if (name[i] == '.') { - strcpy(extension, name+i); - name[i] = 0; - break; - } - i--; - extLen++; - } - Int j = 0; - // Strip out spaces. - for (i=0; name[i]; i++) { - if (name[i] != ' ') { - name[j] = name[i]; - j++; - } - } - name[j] = 0; - - // test the extension to recognize a few key file types - GameFileType fileType = FILE_TYPE_COMPLETELY_UNKNOWN; // MBL FILE_TYPE_UNKNOWN change due to compile error - if( stricmp( extension, ".w3d" ) == 0 ) - fileType = FILE_TYPE_W3D; - else if( stricmp( extension, ".tga" ) == 0 ) - fileType = FILE_TYPE_TGA; - else if( stricmp( extension, ".dds" ) == 0 ) - fileType = FILE_TYPE_DDS; - - + GameFileType fileType = getFileType(filename); // We need to be able to grab w3d's from a localization dir, since Germany hates exploding people units. if( fileType == FILE_TYPE_W3D ) @@ -192,9 +176,8 @@ char const * GameFileClass::Set_Name( char const *filename ) strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } - // We need to be able to grab images from a localization dir, because Art has a fetish for baked-in text. Munkee. - if( isImageFileType(fileType) ) + else if( isImageFileType(fileType) ) { static const char *localizedPathFormat = "Data/%s/Art/Textures/"; sprintf(m_filePath,localizedPathFormat, GetRegistryLanguage().str()); @@ -298,7 +281,7 @@ char const * GameFileClass::Set_Name( char const *filename ) strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath)); } - if( isImageFileType(fileType) ) + else if( isImageFileType(fileType) ) { sprintf(m_filePath,USER_TGA_DIR_PATH, TheGlobalData->getPath_UserData().str()); //strcpy( m_filePath, USER_TGA_DIR_PATH ); @@ -312,10 +295,10 @@ char const * GameFileClass::Set_Name( char const *filename ) } - // We Need to be able to "temporarily copy over the map preview for whichever directory it came from + // We need to be able to temporarily copy over the map preview for whichever directory it came from if( m_fileExists == FALSE && TheGlobalData) { - if( fileType == FILE_TYPE_TGA ) // just TGA, since we don't dds previews + if( fileType == FILE_TYPE_TGA ) // just TGA, since we don't do dds previews { sprintf(m_filePath,MAP_PREVIEW_DIR_PATH, TheGlobalData->getPath_UserData().str()); //strcpy( m_filePath, USER_TGA_DIR_PATH ); @@ -373,11 +356,9 @@ int GameFileClass::Open(int rights) return(false); } - // just open up the file in m_filePath m_theFile = TheFileSystem->openFile( m_filePath, File::READ | File::BINARY ); return (m_theFile != NULL); - } //------------------------------------------------------------------------------------------------- @@ -448,12 +429,16 @@ void GameFileClass::Close(void) extern W3DFileSystem *TheW3DFileSystem = NULL; //------------------------------------------------------------------------------------------------- -/** Constructor. Creating an instance of this class overrices the default +/** Constructor. Creating an instance of this class overrides the default W3D file factory. */ //------------------------------------------------------------------------------------------------- W3DFileSystem::W3DFileSystem(void) { _TheFileFactory = this; // override the w3d file factory. + +#if RTS_ZEROHOUR && PRIORITIZE_TEXTURES_BY_SIZE + reprioritizeTexturesBySize(); +#endif } //------------------------------------------------------------------------------------------------- @@ -481,3 +466,79 @@ void W3DFileSystem::Return_File( FileClass *file ) delete file; } +//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------------------------- +void W3DFileSystem::reprioritizeTexturesBySize() +{ + ArchivedDirectoryInfo* dirInfo = TheArchiveFileSystem->friend_getArchivedDirectoryInfo(TGA_DIR_PATH); + if (dirInfo != NULL) + { + reprioritizeTexturesBySize(*dirInfo); + } +} + +//------------------------------------------------------------------------------------------------- +// TheSuperHackers @info This function moves the largest texture of its name to the front of the +// directory info. The algorithm only prioritizes the first item in the multimap, because this is +// what we currently need: +// Before: A(256kb) B(128kb) C(512kb) +// After: C(512kb) B(128kb) A(256kb) +// +// Catered to specific game archives only. This ensures that user created archives are not included +// for the re-prioritization of textures. +//------------------------------------------------------------------------------------------------- +void W3DFileSystem::reprioritizeTexturesBySize(ArchivedDirectoryInfo& dirInfo) +{ + const char* const superiorArchive = "Textures.big"; + const char* const inferiorArchive = "TexturesZH.big"; + + ArchivedFileLocationMap::iterator it0; + ArchivedFileLocationMap::iterator it1 = dirInfo.m_files.begin(); + ArchivedFileLocationMap::iterator end = dirInfo.m_files.end(); + + if (it1 != end) + { + it0 = it1; + ++it1; + } + + for (; it1 != end; ++it1) + { + const AsciiString& file0 = it0->first; + const AsciiString& file1 = it1->first; + + if (file0 == file1) + { + GameFileType type = getFileType(file0.str()); + if (isImageFileType(type)) + { + ArchiveFile* archive0 = it0->second; + ArchiveFile* archive1 = it1->second; + FileInfo info0; + FileInfo info1; + AsciiString filepath(dirInfo.m_path); + filepath.concat(file0); + + if (archive0->getFileInfo(filepath, &info0) && archive1->getFileInfo(filepath, &info1)) + { + if (info0.size() < info1.size() + && archive0->getName().endsWithNoCase(inferiorArchive) + && archive1->getName().endsWithNoCase(superiorArchive)) + { + std::swap(it0->second, it1->second); + +#if ENABLE_FILESYSTEM_LOGGING + DEBUG_LOG(("W3DFileSystem::reprioritizeTexturesBySize - prioritize %s(%ukb) from %s over %s(%ukb) from %s", + file1.str(), UnsignedInt(info1.size() / 1024), archive1->getName().str(), + file0.str(), UnsignedInt(info0.size() / 1024), archive0->getName().str())); +#endif + } + } + } + } + else + { + it0 = it1; + } + } +} From 8fa506b96f4371aa98d0fb4335a5fc5f33db8b3e Mon Sep 17 00:00:00 2001 From: SkyAero <21192585+Skyaero42@users.noreply.github.com> Date: Sun, 19 Oct 2025 10:07:09 +0200 Subject: [PATCH 184/343] fix: Revert strlcat on pointer arguments (#1713) --- Core/Libraries/Source/debug/debug_debug.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/Libraries/Source/debug/debug_debug.cpp b/Core/Libraries/Source/debug/debug_debug.cpp index 9aeb7ec4cdb..314b911e631 100644 --- a/Core/Libraries/Source/debug/debug_debug.cpp +++ b/Core/Libraries/Source/debug/debug_debug.cpp @@ -348,7 +348,7 @@ bool Debug::AssertDone(void) "time being (stops logging this assertion as well)."; char *help=(char *)DebugAllocMemory(ioBuffer[curType].used+strlen(addInfo)+1); strcpy(help,ioBuffer[curType].buffer+82); - strlcat(help, addInfo, ARRAY_SIZE(help)); + strcat(help, addInfo); // First hit? Then do a stack trace if (curFrameEntry->hits==1) @@ -612,7 +612,7 @@ bool Debug::CrashDone(bool die) #endif char *help=(char *)DebugAllocMemory(ioBuffer[curType].used+strlen(addInfo)+1); strcpy(help,ioBuffer[curType].buffer+82); - strlcat(help, addInfo, ARRAY_SIZE(help)); + strcat(help, addInfo); // First hit? Then do a stack trace if (curFrameEntry->hits==1) From 2b791f2289e409615ce0c60c9c502ee7c535d4a3 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 12 Sep 2025 12:07:23 +0200 Subject: [PATCH 185/343] refactor(ghostobject): Simplify code and style in GhostObject, W3DGhostObject (#1569) --- .../Include/GameLogic/GhostObject.h | 14 +- .../Source/GameLogic/Object/GhostObject.cpp | 22 +- .../W3DDevice/GameLogic/W3DGhostObject.h | 10 +- .../W3DDevice/GameLogic/W3DGhostObject.cpp | 344 ++++++++---------- .../Include/GameLogic/GhostObject.h | 14 +- .../Source/GameLogic/Object/GhostObject.cpp | 22 +- .../W3DDevice/GameLogic/W3DGhostObject.h | 10 +- .../W3DDevice/GameLogic/W3DGhostObject.cpp | 344 ++++++++---------- 8 files changed, 322 insertions(+), 458 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameLogic/GhostObject.h b/Generals/Code/GameEngine/Include/GameLogic/GhostObject.h index e2a52bbb8e0..8e7eb9fcee6 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/GhostObject.h +++ b/Generals/Code/GameEngine/Include/GameLogic/GhostObject.h @@ -37,10 +37,6 @@ // #define DEBUG_FOG_MEMORY ///< this define is used to force object snapshots for all players, not just local player. -//Magic pointer value which indicates that a drawable pointer is actually invalid -//because we're looking at a ghost object. -#define GHOST_OBJECT_DRAWABLE 0xFFFFFFFF - class Object; class PartitionData; enum GeometryType CPP_11(: Int); @@ -63,7 +59,6 @@ class GhostObject : public Snapshot inline const Coord3D *getParentPosition(void) const {return &m_parentPosition;} protected: - virtual void crc( Xfer *xfer ); virtual void xfer( Xfer *xfer ); virtual void loadPostProcess( void ); @@ -83,20 +78,23 @@ class GhostObjectManager : public Snapshot public: GhostObjectManager(); virtual ~GhostObjectManager(); + virtual void reset(void); virtual GhostObject *addGhostObject(Object *object, PartitionData *pd); virtual void removeGhostObject(GhostObject *mod); - virtual inline void setLocalPlayerIndex(int index) { m_localPlayer = index; } + virtual void setLocalPlayerIndex(int playerIndex) { m_localPlayer = playerIndex; } inline int getLocalPlayerIndex(void) { return m_localPlayer; } - virtual void updateOrphanedObjects(int *playerIndexList, int numNonLocalPlayers); + virtual void updateOrphanedObjects(int *playerIndexList, int playerIndexCount); virtual void releasePartitionData(void); ///xferObjectID( &parentObjectID ); if( xfer->getXferMode() == XFER_LOAD ) { - // tie up parent object pointer m_parentObject = TheGameLogic->findObjectByID( parentObjectID ); // sanity if( parentObjectID != INVALID_ID && m_parentObject == NULL ) { - DEBUG_CRASH(( "GhostObject::xfer - Unable to connect m_parentObject" )); throw INI_INVALID_DATA; - } - } // parent geometry type @@ -126,7 +118,6 @@ void GhostObject::xfer( Xfer *xfer ) // partition data ///@todo write me ---> !!!!! // PartitionData *m_partitionData; ///< our PartitionData - } // ------------------------------------------------------------------------------------------------ @@ -134,7 +125,6 @@ void GhostObject::xfer( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ void GhostObject::loadPostProcess( void ) { - } // ------------------------------------------------------------------------------------------------ @@ -150,14 +140,12 @@ GhostObjectManager::GhostObjectManager(void) // ------------------------------------------------------------------------------------------------ GhostObjectManager::~GhostObjectManager() { - } // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ void GhostObjectManager::reset(void) { - } // ------------------------------------------------------------------------------------------------ @@ -171,14 +159,12 @@ GhostObject *GhostObjectManager::addGhostObject(Object *object, PartitionData *p // ------------------------------------------------------------------------------------------------ void GhostObjectManager::removeGhostObject(GhostObject *mod) { - } // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ -void GhostObjectManager::updateOrphanedObjects(int *playerIndexList, int numNonLocalPlayers) +void GhostObjectManager::updateOrphanedObjects(int *playerIndexList, int playerIndexCount) { - } // ------------------------------------------------------------------------------------------------ @@ -197,7 +183,6 @@ void GhostObjectManager::restorePartitionData(void) // ------------------------------------------------------------------------------------------------ void GhostObjectManager::crc( Xfer *xfer ) { - } // ------------------------------------------------------------------------------------------------ @@ -207,7 +192,6 @@ void GhostObjectManager::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ void GhostObjectManager::xfer( Xfer *xfer ) { - // version XferVersion currentVersion = 1; XferVersion version = currentVersion; @@ -215,7 +199,6 @@ void GhostObjectManager::xfer( Xfer *xfer ) // local player xfer->xferInt( &m_localPlayer ); - } // ------------------------------------------------------------------------------------------------ @@ -223,5 +206,4 @@ void GhostObjectManager::xfer( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ void GhostObjectManager::loadPostProcess( void ) { - } diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGhostObject.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGhostObject.h index 7dada97968e..1c4d4378b92 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGhostObject.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGhostObject.h @@ -45,12 +45,14 @@ class PartitionData; class W3DGhostObject: public GhostObject { friend W3DGhostObjectManager; + public: W3DGhostObject(); virtual ~W3DGhostObject(); virtual void snapShot(int playerIndex); virtual void updateParentObject(Object *object, PartitionData *mod); virtual void freeSnapShot(int playerIndex); + protected: virtual void crc( Xfer *xfer); virtual void xfer( Xfer *xfer ); @@ -59,9 +61,9 @@ class W3DGhostObject: public GhostObject void restoreParentObject(void); ///< restore the original non-ghosted object to scene. void addToScene(int playerIndex); void removeFromScene(int playerIndex); - void release(void); ///< used by manager to return object to free store. - void getShroudStatus(int playerIndex); ///< used to get the partition manager to update ghost objects without parent objects. + ObjectShroudStatus getShroudStatus(int playerIndex); ///< used to get the partition manager to update ghost objects without parent objects. void freeAllSnapShots(void); ///< used to free all snapshots from all players. + W3DRenderObjectSnapshot *m_parentSnapshots[MAX_PLAYER_COUNT]; DrawableInfo m_drawableInfo; @@ -78,8 +80,8 @@ class W3DGhostObjectManager : public GhostObjectManager virtual void reset(void); virtual GhostObject *addGhostObject(Object *object, PartitionData *pd); virtual void removeGhostObject(GhostObject *mod); - virtual void setLocalPlayerIndex(int index); - virtual void updateOrphanedObjects(int *playerIndexList, int numNonLocalPlayers); + virtual void setLocalPlayerIndex(int playerIndex); + virtual void updateOrphanedObjects(int *playerIndexList, int playerIndexCount); virtual void releasePartitionData(void); virtual void restorePartitionData(void); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index 66b4abce4bc..8781a1779ca 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -44,6 +44,7 @@ #include "W3DDevice/GameClient/Module/W3DModelDraw.h" #include "W3DDevice/GameClient/W3DAssetManager.h" #include "W3DDevice/GameClient/W3DDisplay.h" +#include "W3DDevice/GameClient/W3DScene.h" #include "W3DDevice/GameLogic/W3DGhostObject.h" #include "WW3D2/rendobj.h" #include "WW3D2/hlod.h" @@ -60,8 +61,11 @@ class W3DRenderObjectSnapshot : public Snapshot W3DRenderObjectSnapshot(RenderObjClass *m_parentRobj, DrawableInfo *drawInfo, Bool cloneParentRobj = TRUE); ~W3DRenderObjectSnapshot() {REF_PTR_RELEASE(m_robj);} - inline void update(RenderObjClass *robj, DrawableInfo *drawInfo, Bool cloneParentRobj=TRUE); ///Get_Num_Sub_Objects(); i++) { - RenderObjClass *subObj=robj->Get_Sub_Object(i); + RenderObjClass *subObj = robj->Get_Sub_Object(i); if (subObj && subObj->Class_ID() == RenderObjClass::CLASSID_MESH) - { //check if sub-object has the correct material to do texture scrolling. - MaterialInfoClass *mat=subObj->Get_Material_Info(); + { + //check if sub-object has the correct material to do texture scrolling. + MaterialInfoClass *mat = subObj->Get_Material_Info(); if (mat) - { for (Int j=0; jVertex_Material_Count(); j++) + { + for (Int j=0; jVertex_Material_Count(); j++) { - VertexMaterialClass *vmaterial=mat->Peek_Vertex_Material(j); - LinearOffsetTextureMapperClass *mapper=(LinearOffsetTextureMapperClass *)vmaterial->Peek_Mapper(); + VertexMaterialClass *vmaterial = mat->Peek_Vertex_Material(j); + LinearOffsetTextureMapperClass *mapper = (LinearOffsetTextureMapperClass *)vmaterial->Peek_Mapper(); if (mapper && mapper->Mapper_ID() == TextureMapperClass::MAPPER_ID_LINEAR_OFFSET) { subObj->Set_User_Data(&animationDisableOverride); //tell W3D about custom material settings @@ -118,8 +124,7 @@ void W3DRenderObjectSnapshot::update(RenderObjClass *robj, DrawableInfo *drawInf if( cloneParentRobj == TRUE ) { - - m_robj=robj->Clone(); + m_robj = robj->Clone(); m_robj->Set_ObjectColor(robj->Get_ObjectColor()); #ifdef DEBUG_FOG_MEMORY m_robjName = m_robj->Get_Name(); @@ -131,16 +136,17 @@ void W3DRenderObjectSnapshot::update(RenderObjClass *robj, DrawableInfo *drawInf float frame,mult; int mode,numFrames; - HAnimClass *hanim=((HLodClass *)robj)->Peek_Animation_And_Info(frame,numFrames,mode,mult); + HAnimClass *hanim = ((HLodClass *)robj)->Peek_Animation_And_Info(frame,numFrames,mode,mult); m_robj->Set_Animation(hanim,frame); disableUVAnimations(m_robj); } } else - m_robj=robj; + { + m_robj = robj; + } m_robj->Set_User_Data(drawInfo); - } // ------------------------------------------------------------------------------------------------ @@ -148,7 +154,14 @@ void W3DRenderObjectSnapshot::update(RenderObjClass *robj, DrawableInfo *drawInf void W3DRenderObjectSnapshot::addToScene(void) { if (W3DDisplay::m_3DScene != NULL) - ((SimpleSceneClass *)W3DDisplay::m_3DScene)->Add_Render_Object(m_robj); + W3DDisplay::m_3DScene->Add_Render_Object(m_robj); +} + +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +void W3DRenderObjectSnapshot::removeFromScene() +{ + m_robj->Remove(); } // ------------------------------------------------------------------------------------------------ @@ -156,8 +169,8 @@ void W3DRenderObjectSnapshot::addToScene(void) W3DRenderObjectSnapshot::W3DRenderObjectSnapshot(RenderObjClass *robj, DrawableInfo *drawInfo, Bool cloneParentRobj) { - m_robj=NULL; - m_next=NULL; + m_robj = NULL; + m_next = NULL; update(robj, drawInfo, cloneParentRobj); } @@ -166,7 +179,6 @@ W3DRenderObjectSnapshot::W3DRenderObjectSnapshot(RenderObjClass *robj, DrawableI // ------------------------------------------------------------------------------------------------ void W3DRenderObjectSnapshot::crc( Xfer *xfer ) { - } // ------------------------------------------------------------------------------------------------ @@ -176,7 +188,6 @@ void W3DRenderObjectSnapshot::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ void W3DRenderObjectSnapshot::xfer( Xfer *xfer ) { - // version XferVersion currentVersion = 1; XferVersion version = currentVersion; @@ -199,27 +210,24 @@ void W3DRenderObjectSnapshot::xfer( Xfer *xfer ) Bool visible; RenderObjClass *subObject; AsciiString subObjectName; + for( Int i = 0; i < subObjectCount; ++i ) { - // // when saving we get sub objects by index and xfer their name, when loading // we read the name and find that sub object // if( xfer->getXferMode() == XFER_SAVE ) { - // get sub object subObject = m_robj->Get_Sub_Object( i ); // xfer sub object name which is unique among those in this render object subObjectName.set( subObject->Get_Name() ); xfer->xferAsciiString( &subObjectName ); - } else { - // read sub object name xfer->xferAsciiString( &subObjectName ); @@ -254,17 +262,14 @@ void W3DRenderObjectSnapshot::xfer( Xfer *xfer ) // need to tell W3D that this sub object transforms are ok if( subObject ) { - // need to cast to HLod if we can to validate the hierarchy if( subObject->Class_ID() == RenderObjClass::CLASSID_HLOD ) ((HLodClass *)subObject)->Friend_Set_Hierarchy_Valid( TRUE ); - } // release reference to sub object if( subObject ) REF_PTR_RELEASE( subObject ); - } // tell W3D that the transforms for our sub objects are all OK cause we've done them ourselves @@ -284,9 +289,8 @@ void W3DRenderObjectSnapshot::loadPostProcess( void ) // ------------------------------------------------------------------------------------------------ W3DGhostObject::W3DGhostObject() { - - for (Int i=0; i< MAX_PLAYER_COUNT; i++) - m_parentSnapshots[i]=NULL; + for (Int i = 0; i < MAX_PLAYER_COUNT; i++) + m_parentSnapshots[i] = NULL; m_drawableInfo.m_drawable = NULL; m_drawableInfo.m_flags = 0; @@ -295,7 +299,6 @@ W3DGhostObject::W3DGhostObject() m_nextSystem = NULL; m_prevSystem = NULL; - } // ------------------------------------------------------------------------------------------------ @@ -303,7 +306,7 @@ W3DGhostObject::W3DGhostObject() W3DGhostObject::~W3DGhostObject() { #ifdef DEBUG_FOG_MEMORY - for (Int i=0; igetDrawable(); + Drawable *draw = m_parentObject->getDrawable(); + if (draw->isDrawableEffectivelyHidden()) return; //don't bother to snapshot things which nobody can see. - W3DRenderObjectSnapshot *snap=m_parentSnapshots[playerIndex],*prevSnap=NULL; + W3DRenderObjectSnapshot *snap = m_parentSnapshots[playerIndex]; + W3DRenderObjectSnapshot *prevSnap = NULL; //walk through all W3D render objects used by this object for (DrawModule ** dm = draw->getDrawModules(); *dm; ++dm) @@ -336,10 +341,9 @@ void W3DGhostObject::snapShot(int playerIndex) const ObjectDrawInterface* di = (*dm)->getObjectDrawInterface(); if (di) { - W3DModelDraw *w3dDraw= (W3DModelDraw *)di; - RenderObjClass *robj=NULL; + W3DModelDraw *w3dDraw = (W3DModelDraw *)di; + RenderObjClass *robj = w3dDraw->getRenderObject(); - robj=w3dDraw->getRenderObject(); //robj may be null for modules which have no render objects such //as for build-ups that are currently disabled. if (robj) @@ -348,9 +352,9 @@ void W3DGhostObject::snapShot(int playerIndex) { snap = NEW W3DRenderObjectSnapshot(robj, &m_drawableInfo); // poolify if (prevSnap) - prevSnap->m_next=snap; + prevSnap->m_next = snap; else - m_parentSnapshots[playerIndex]=snap; + m_parentSnapshots[playerIndex] = snap; } else m_parentSnapshots[playerIndex]->update(robj, &m_drawableInfo); @@ -365,7 +369,7 @@ void W3DGhostObject::snapShot(int playerIndex) snap->addToScene(); } - prevSnap=snap; + prevSnap = snap; snap = snap->m_next; } } @@ -373,16 +377,17 @@ void W3DGhostObject::snapShot(int playerIndex) //Check if we captured at least one snapshot if (snap != m_parentSnapshots[playerIndex]) - { //save off other info we may need in case the parent object is destroyed. + { + //save off other info we may need in case the parent object is destroyed. ///@todo: We're going to ignore the case where each player index could be - //looking at a different geometry info/orientation because ghostobjects + //looking at a different geometry info/orientation because ghost objects //are supposed to be used on immobile buildings. - m_parentGeometryType=m_parentObject->getGeometryInfo().getGeomType(); - m_parentGeometryIsSmall=m_parentObject->getGeometryInfo().getIsSmall(); - m_parentGeometryMajorRadius=m_parentObject->getGeometryInfo().getMajorRadius(); - m_parentGeometryminorRadius=m_parentObject->getGeometryInfo().getMinorRadius(); - m_parentPosition=*m_parentObject->getPosition(); - m_parentAngle=m_parentObject->getOrientation(); + m_parentGeometryType = m_parentObject->getGeometryInfo().getGeomType(); + m_parentGeometryIsSmall = m_parentObject->getGeometryInfo().getIsSmall(); + m_parentGeometryMajorRadius = m_parentObject->getGeometryInfo().getMajorRadius(); + m_parentGeometryminorRadius = m_parentObject->getGeometryInfo().getMinorRadius(); + m_parentPosition = *m_parentObject->getPosition(); + m_parentAngle = m_parentObject->getOrientation(); } } @@ -391,12 +396,11 @@ void W3DGhostObject::snapShot(int playerIndex) // ------------------------------------------------------------------------------------------------ void W3DGhostObject::removeParentObject(void) { - // sanity if( m_parentObject == NULL ) return; - Drawable *draw=m_parentObject->getDrawable(); + Drawable *draw = m_parentObject->getDrawable(); //After we remove the unfogged object, we also disable //anything that should be hidden inside fog - shadow, particles, etc. @@ -408,10 +412,8 @@ void W3DGhostObject::removeParentObject(void) const ObjectDrawInterface* di = (*dm)->getObjectDrawInterface(); if (di) { - W3DModelDraw *w3dDraw= (W3DModelDraw *)di; - RenderObjClass *robj=NULL; - - robj=w3dDraw->getRenderObject(); + W3DModelDraw *w3dDraw = (W3DModelDraw *)di; + RenderObjClass *robj = w3dDraw->getRenderObject(); if (robj) { DEBUG_ASSERTCRASH(robj->Peek_Scene() != NULL, ("Removing GhostObject parent not in scene")); @@ -428,7 +430,11 @@ void W3DGhostObject::restoreParentObject(void) { if (TheGlobalData->m_headless) return; - Drawable *draw=m_parentObject->getDrawable(); + + if (!m_parentObject) + return; + + Drawable *draw = m_parentObject->getDrawable(); if (!draw) return; @@ -441,19 +447,19 @@ void W3DGhostObject::restoreParentObject(void) const ObjectDrawInterface* di = (*dm)->getObjectDrawInterface(); if (di) { - W3DModelDraw *w3dDraw= (W3DModelDraw *)di; - RenderObjClass *robj=NULL; + W3DModelDraw *w3dDraw = (W3DModelDraw *)di; + RenderObjClass *robj = w3dDraw->getRenderObject(); - robj=w3dDraw->getRenderObject(); //robj may be null for modules which have no render objects such //as for build-ups that are currently disabled. if (robj) - { //if we have a render object that's not in the scene, it must have been + { + //if we have a render object that's not in the scene, it must have been //removed by the ghost object manager, so restore it. If we have a render //object that is in the scene, then it was probably added because the model //changed while the object was ghosted (for damage states, garrison, etc.). - if (robj->Peek_Scene() == NULL) - ((SimpleSceneClass *)W3DDisplay::m_3DScene)->Add_Render_Object(robj); + if (!robj->Is_In_Scene()) + W3DDisplay::m_3DScene->Add_Render_Object(robj); } } } @@ -466,27 +472,28 @@ void W3DGhostObject::freeAllSnapShots(void) Int playerIndex; #ifdef DEBUG_FOG_MEMORY - for (playerIndex=0; playerIndexgetLocalPlayerIndex(); #endif if (m_parentSnapshots[playerIndex]) - { //if we have a snapshot for this object, remove it from + { + //if we have a snapshot for this object, remove it from //scene. removeFromScene(playerIndex); //Restore actual objects assuming they are still alive. - if (m_parentObject) - restoreParentObject(); + restoreParentObject(); - W3DRenderObjectSnapshot *snap=m_parentSnapshots[playerIndex]; + W3DRenderObjectSnapshot *snap = m_parentSnapshots[playerIndex]; W3DRenderObjectSnapshot *nextSnap; while (snap) - { nextSnap = snap->m_next; + { + nextSnap = snap->m_next; delete snap; snap = nextSnap; } - m_parentSnapshots[playerIndex]=NULL; + m_parentSnapshots[playerIndex] = NULL; } } @@ -501,7 +508,8 @@ void W3DGhostObject::freeSnapShot(int playerIndex) #endif if (m_parentSnapshots[playerIndex]) - { //if we have a snapshot for this object, remove it from + { + //if we have a snapshot for this object, remove it from //scene and put back the original object if it still exists. if (playerIndex == TheGhostObjectManager->getLocalPlayerIndex()) { @@ -512,18 +520,18 @@ void W3DGhostObject::freeSnapShot(int playerIndex) removeFromScene(playerIndex); //Restore actual objects assuming they are still alive. - if (m_parentObject) - restoreParentObject(); + restoreParentObject(); } - W3DRenderObjectSnapshot *snap=m_parentSnapshots[playerIndex]; + W3DRenderObjectSnapshot *snap = m_parentSnapshots[playerIndex]; W3DRenderObjectSnapshot *nextSnap; while (snap) - { nextSnap = snap->m_next; + { + nextSnap = snap->m_next; delete snap; snap = nextSnap; } - m_parentSnapshots[playerIndex]=NULL; + m_parentSnapshots[playerIndex] = NULL; } } @@ -540,12 +548,12 @@ void W3DGhostObject::updateParentObject(Object *object, PartitionData *mod) // ------------------------------------------------------------------------------------------------ void W3DGhostObject::removeFromScene(int playerIndex) { - W3DRenderObjectSnapshot *snap=m_parentSnapshots[playerIndex]; + W3DRenderObjectSnapshot *snap = m_parentSnapshots[playerIndex]; while (snap) { - snap->m_robj->Remove(); - snap=snap->m_next; + snap->removeFromScene(); + snap = snap->m_next; } } @@ -554,38 +562,20 @@ void W3DGhostObject::removeFromScene(int playerIndex) // ------------------------------------------------------------------------------------------------ void W3DGhostObject::addToScene(int playerIndex) { - W3DRenderObjectSnapshot *snap=m_parentSnapshots[playerIndex]; + W3DRenderObjectSnapshot *snap = m_parentSnapshots[playerIndex]; while (snap) { - ((SimpleSceneClass *)W3DDisplay::m_3DScene)->Add_Render_Object(snap->m_robj); - snap=snap->m_next; + snap->addToScene(); + snap = snap->m_next; } } // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ -void W3DGhostObject::release(void) +ObjectShroudStatus W3DGhostObject::getShroudStatus(int playerIndex) { - W3DRenderObjectSnapshot *snap,*nextSnap; - - for (Int i=0; im_next; - delete snap; - snap=nextSnap; - } - m_parentSnapshots[i]=NULL; - } -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void W3DGhostObject::getShroudStatus(int playerIndex) -{ - m_partitionData->getShroudedStatus(playerIndex); + return m_partitionData->getShroudedStatus(playerIndex); } // ------------------------------------------------------------------------------------------------ @@ -593,10 +583,8 @@ void W3DGhostObject::getShroudStatus(int playerIndex) // ------------------------------------------------------------------------------------------------ void W3DGhostObject::crc( Xfer *xfer ) { - // extend base class GhostObject::crc( xfer ); - } // ------------------------------------------------------------------------------------------------ @@ -606,7 +594,6 @@ void W3DGhostObject::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ void W3DGhostObject::xfer( Xfer *xfer ) { - // version XferVersion currentVersion = 1; XferVersion version = currentVersion; @@ -626,14 +613,12 @@ void W3DGhostObject::xfer( Xfer *xfer ) xfer->xferDrawableID( &drawableID ); if( xfer->getXferMode() == XFER_LOAD ) { - // reconnect the drawable pointer m_drawableInfo.m_drawable = TheGameClient->findDrawableByID( drawableID ); // sanity if( drawableID != INVALID_DRAWABLE_ID && m_drawableInfo.m_drawable == NULL ) DEBUG_CRASH(( "W3DGhostObject::xfer - Unable to find drawable for ghost object" )); - } // @@ -646,19 +631,16 @@ void W3DGhostObject::xfer( Xfer *xfer ) UnsignedByte snapshotCount; for( Int i = 0; i < MAX_PLAYER_COUNT; ++i ) { - // count the snapshots at this index snapshotCount = 0; W3DRenderObjectSnapshot *objectSnapshot = m_parentSnapshots[ i ]; while( objectSnapshot ) { - // increment count snapshotCount++; // on to the next snapshot objectSnapshot = objectSnapshot->m_next; - } // xfer the snapshot count at this index @@ -670,24 +652,21 @@ void W3DGhostObject::xfer( Xfer *xfer ) // if( snapshotCount == 0 && m_parentSnapshots[ i ] != NULL ) { - DEBUG_CRASH(( "W3DGhostObject::xfer - m_parentShapshots[ %d ] has data present but the count from the xfer stream is empty", i )); throw INI_INVALID_DATA; - } // xfer each of the snapshots at this index Real scale; UnsignedInt color; AsciiString name; + if( xfer->getXferMode() == XFER_SAVE ) { - // iterate through list objectSnapshot = m_parentSnapshots[ i ]; while( objectSnapshot ) { - // write name from render object name.set( objectSnapshot->m_robj->Get_Name() ); xfer->xferAsciiString( &name ); @@ -705,9 +684,7 @@ void W3DGhostObject::xfer( Xfer *xfer ) // onto the next objectSnapshot = objectSnapshot->m_next; - } - } else { @@ -716,7 +693,6 @@ void W3DGhostObject::xfer( Xfer *xfer ) for( UnsignedByte j = 0; j < snapshotCount; ++j ) { - // read render object name xfer->xferAsciiString( &name ); @@ -745,11 +721,8 @@ void W3DGhostObject::xfer( Xfer *xfer ) // add snapshot to the scene objectSnapshot->addToScene(); - } - } - } // @@ -773,15 +746,12 @@ void W3DGhostObject::xfer( Xfer *xfer ) ObjectShroudStatus status; if( xfer->getXferMode() == XFER_SAVE ) { - // iterate through all array points for( playerIndex = 0; playerIndex < MAX_PLAYER_COUNT; ++playerIndex ) { - // is this a location with any info if( m_parentSnapshots[ playerIndex ] ) { - // write this index xfer->xferUnsignedByte( &playerIndex ); @@ -792,11 +762,8 @@ void W3DGhostObject::xfer( Xfer *xfer ) // write previous shroudedness status = m_partitionData->friend_getShroudednessPrevious( playerIndex ); xfer->xferUser( &status, sizeof( ObjectShroudStatus ) ); - } - } - } else { @@ -816,11 +783,8 @@ void W3DGhostObject::xfer( Xfer *xfer ) // read shroudedness previous and set xfer->xferUser( &status, sizeof( ObjectShroudStatus ) ); m_partitionData->friend_setShroudednessPrevious( playerIndex, status ); - } - } - } // ------------------------------------------------------------------------------------------------ @@ -828,20 +792,16 @@ void W3DGhostObject::xfer( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ void W3DGhostObject::loadPostProcess( void ) { - // extend base class GhostObject::loadPostProcess(); - } // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ W3DGhostObjectManager::W3DGhostObjectManager(void) { - m_freeModules = NULL; m_usedModules = NULL; - } // ------------------------------------------------------------------------------------------------ @@ -855,9 +815,9 @@ W3DGhostObjectManager::~W3DGhostObjectManager() while (mod) { - nextmod=mod->m_nextSystem; + nextmod = mod->m_nextSystem; delete mod; - mod=nextmod; + mod = nextmod; } } @@ -871,24 +831,24 @@ void W3DGhostObjectManager::reset(void) //Remove any orphaned modules that were not deleted with their parent object because player had fogged memory of them. while (mod) { - nextmod=mod->m_nextSystem; + nextmod = mod->m_nextSystem; if (!mod->m_parentObject) //make sure it has no parent object { ThePartitionManager->unRegisterGhostObject(mod); removeGhostObject(mod); } - mod=nextmod; + mod = nextmod; } DEBUG_ASSERTCRASH(m_usedModules == NULL, ("Reset of Non-Empty GhostObjectManager")); //Delete any remaining modules (should be none) - mod=m_usedModules; + mod = m_usedModules; while (mod) { - nextmod=mod->m_nextSystem; + nextmod = mod->m_nextSystem; removeGhostObject(mod); - mod=nextmod; + mod = nextmod; } } @@ -923,7 +883,6 @@ void W3DGhostObjectManager::removeGhostObject(GhostObject *object) // ------------------------------------------------------------------------------------------------ GhostObject *W3DGhostObjectManager::addGhostObject(Object *object, PartitionData *pd) { - // we disabled adding new ghost objects - used during map border resizing and loading if (m_lockGhostObjects || m_saveLockGhostObjects ) return NULL; @@ -932,17 +891,13 @@ GhostObject *W3DGhostObjectManager::addGhostObject(Object *object, PartitionData // sanity if( object != NULL ) { - W3DGhostObject *sanity = m_usedModules; while( sanity ) { - DEBUG_ASSERTCRASH( sanity->m_parentObject != object, - ("W3DGhostObjectManager::addGhostObject - Duplicate ghost object detected\n") ); + ("W3DGhostObjectManager::addGhostObject - Duplicate ghost object detected") ); sanity = sanity->m_nextSystem; - } - } #endif @@ -969,17 +924,17 @@ GhostObject *W3DGhostObjectManager::addGhostObject(Object *object, PartitionData m_usedModules = mod; //Copy settings from parent object - mod->m_parentObject=object; - mod->m_drawableInfo.m_drawable=NULL; //these dummy render objects don't have drawables. + mod->m_parentObject = object; + mod->m_drawableInfo.m_drawable = NULL; //these dummy render objects don't have drawables. mod->m_drawableInfo.m_ghostObject = mod; - mod->m_partitionData=pd; + mod->m_partitionData = pd; return mod; } // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ -void W3DGhostObjectManager::setLocalPlayerIndex(int index) +void W3DGhostObjectManager::setLocalPlayerIndex(int playerIndex) { //Whenever we switch local players, we need to remove all ghost objects belonging //to another player from the map. We then insert the current local player's @@ -990,25 +945,29 @@ void W3DGhostObjectManager::setLocalPlayerIndex(int index) while (mod) { mod->removeFromScene(m_localPlayer); - if (mod->m_parentSnapshots[index]) - { //new player has his own snapshot - if (!mod->m_parentSnapshots[m_localPlayer] && mod->m_parentObject) - { //previous player didn't have a snapshot so real object must + + if (mod->m_parentSnapshots[playerIndex]) + { + //new player has his own snapshot + if (!mod->m_parentSnapshots[m_localPlayer]) + { + //previous player didn't have a snapshot so real object must //have been in the scene. Replace it with our snapshot. mod->removeParentObject(); } - mod->addToScene(index); + mod->addToScene(playerIndex); } - //new player doesn't have a snapshot which means restore original object - //if it was replaced by a snapshot by the previous player. - else - if (mod->m_parentSnapshots[m_localPlayer] && mod->m_parentObject) + else if (mod->m_parentSnapshots[m_localPlayer]) + { + //new player doesn't have a snapshot which means restore original object + //if it was replaced by a snapshot by the previous player. mod->restoreParentObject(); + } - mod=mod->m_nextSystem; + mod = mod->m_nextSystem; } - m_localPlayer = index; + GhostObjectManager::setLocalPlayerIndex(playerIndex); } // ------------------------------------------------------------------------------------------------ @@ -1017,40 +976,44 @@ a GhostObject in case any players didn't see the death and have a fogged view of We need to manually determine if these orphaned GhostObjects ever become visible and are no longer needed*/ // ------------------------------------------------------------------------------------------------ -void W3DGhostObjectManager::updateOrphanedObjects(int *playerIndexList, int numNonLocalPlayers) +void W3DGhostObjectManager::updateOrphanedObjects(int *playerIndexList, int playerIndexCount) { - W3DGhostObject *mod = m_usedModules, *nextmod; int numStoredSnapshots; while (mod) { - //updating the shroud status of this ghostobject could remove + //updating the shroud status of this ghost object could remove //it from the scene if it becomes visible but parent object is gone. - nextmod=mod->m_nextSystem; + nextmod = mod->m_nextSystem; if (!mod->m_parentObject) { - numStoredSnapshots=0; + numStoredSnapshots = 0; + #ifdef DEBUG_FOG_MEMORY - for (int i=0; im_parentSnapshots[*playerIndexList]) mod->getShroudStatus(*playerIndexList); + if (mod->m_parentSnapshots[*playerIndexList]) numStoredSnapshots++; } #endif mod->getShroudStatus(m_localPlayer); + if (mod->m_parentSnapshots[m_localPlayer]) numStoredSnapshots++; + if (!numStoredSnapshots) - { ThePartitionManager->unRegisterGhostObject(mod); - mod->m_partitionData=NULL; + { + ThePartitionManager->unRegisterGhostObject(mod); + mod->m_partitionData = NULL; removeGhostObject(mod); } } - mod=nextmod; + mod = nextmod; } } @@ -1066,7 +1029,8 @@ void W3DGhostObjectManager::releasePartitionData(void) while (mod) { - nextmod=mod->m_nextSystem; + nextmod = mod->m_nextSystem; + //if module has no parent object, then its holding a ghost object which //needs to have it's own partition data. if (!mod->m_parentObject) @@ -1075,7 +1039,8 @@ void W3DGhostObjectManager::releasePartitionData(void) mod->m_partitionData = NULL; } else - { //The parent object will handle unregistering so just tell to break the + { + //The parent object will handle unregistering so just tell to break the //ghost object link. mod->friend_getPartitionData()->friend_setGhostObject(NULL); mod->m_partitionData = NULL; @@ -1095,13 +1060,14 @@ void W3DGhostObjectManager::restorePartitionData(void) while (mod) { nextmod=mod->m_nextSystem; + //if module has no parent object, then its holding a ghost object which //needs to have it's own partition data. if (mod->m_parentObject) { //restore into parent's partition data mod->m_parentObject->friend_getPartitionData()->friend_setGhostObject(mod); - mod->m_partitionData=mod->m_parentObject->friend_getPartitionData(); + mod->m_partitionData = mod->m_parentObject->friend_getPartitionData(); } else { @@ -1111,12 +1077,13 @@ void W3DGhostObjectManager::restorePartitionData(void) //set partition data to reflect that we've seen a fogged version //of this object if one exists. - for (Int i=0; im_parentSnapshots[i]) + for (Int i = 0; i < MAX_PLAYER_COUNT; i++) + { + if (mod->m_parentSnapshots[i]) mod->m_partitionData->friend_setShroudednessPrevious(i,OBJECTSHROUD_FOGGED); } - mod=nextmod; + mod = nextmod; } } @@ -1125,10 +1092,8 @@ void W3DGhostObjectManager::restorePartitionData(void) // ------------------------------------------------------------------------------------------------ void W3DGhostObjectManager::crc( Xfer *xfer ) { - // extend base class GhostObjectManager::crc( xfer ); - } // ------------------------------------------------------------------------------------------------ @@ -1138,7 +1103,6 @@ void W3DGhostObjectManager::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ void W3DGhostObjectManager::xfer( Xfer *xfer ) { - // version XferVersion currentVersion = 1; XferVersion version = currentVersion; @@ -1160,11 +1124,9 @@ void W3DGhostObjectManager::xfer( Xfer *xfer ) ObjectID objectID; if( xfer->getXferMode() == XFER_SAVE ) { - // iterate all ghost objects for( w3dGhostObject = m_usedModules; w3dGhostObject; w3dGhostObject = w3dGhostObject->m_nextSystem ) { - // write out object ID if( w3dGhostObject->m_parentObject ) objectID = w3dGhostObject->m_parentObject->getID(); @@ -1174,28 +1136,26 @@ void W3DGhostObjectManager::xfer( Xfer *xfer ) // write out ghost object data xfer->xferSnapshot( w3dGhostObject ); - } - } else { - // sanity, there should be no ghost objects loaded at this time DEBUG_ASSERTCRASH( m_usedModules == NULL, - ("W3DGhostObjectManager::xfer - The used module list is not NULL upon load, but should be!\n") ); + ("W3DGhostObjectManager::xfer - The used module list is not NULL upon load, but should be!") ); // now it's time to unlock the ghost objects for loading DEBUG_ASSERTCRASH( m_saveLockGhostObjects == TRUE, - ("W3DGhostObjectManager::xfer - Ghost object manager is not save locked, but should be\n") ); + ("W3DGhostObjectManager::xfer - Ghost object manager is not save locked, but should be") ); + TheGhostObjectManager->saveLockGhostObjects( FALSE ); // read all ghost objects GhostObject *ghostObject; Object *object; + for( UnsignedShort i = 0; i < count; ++i ) { - // read object id xfer->xferObjectID( &objectID ); @@ -1205,40 +1165,32 @@ void W3DGhostObjectManager::xfer( Xfer *xfer ) // create ghost object data if( object ) { - // create ghost object ghostObject = addGhostObject( object, object->friend_getPartitionData() ); // sanity DEBUG_ASSERTCRASH( ghostObject != NULL, - ("W3DGhostObjectManager::xfer - Could not create ghost object for object '%s'\n", - object->getTemplate()->getName().str()) ); + ("W3DGhostObjectManager::xfer - Could not create ghost object for object '%s'", object->getTemplate()->getName().str()) ); // link the ghost object and logical object togehter through partition/ghostObject dat DEBUG_ASSERTCRASH( object->friend_getPartitionData()->getGhostObject() == NULL, - ("W3DGhostObjectManager::xfer - Ghost object already on object '%s'\n", - object->getTemplate()->getName().str()) ); - object->friend_getPartitionData()->friend_setGhostObject( ghostObject ); + ("W3DGhostObjectManager::xfer - Ghost object already on object '%s'", object->getTemplate()->getName().str()) ); + object->friend_getPartitionData()->friend_setGhostObject( ghostObject ); } else { - // create object with no object or partition data ghostObject = addGhostObject( NULL, NULL ); // register ghost object object with partition system and fill out partition data ThePartitionManager->registerGhostObject( ghostObject ); - } // read ghost object data xfer->xferSnapshot( ghostObject ); - } - } - } // ------------------------------------------------------------------------------------------------ @@ -1246,8 +1198,6 @@ void W3DGhostObjectManager::xfer( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ void W3DGhostObjectManager::loadPostProcess( void ) { - // extend base class GhostObjectManager::loadPostProcess(); - } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/GhostObject.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/GhostObject.h index 5e64f61f1b8..822412a67ac 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/GhostObject.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/GhostObject.h @@ -37,10 +37,6 @@ // #define DEBUG_FOG_MEMORY ///< this define is used to force object snapshots for all players, not just local player. -//Magic pointer value which indicates that a drawable pointer is actually invalid -//because we're looking at a ghost object. -#define GHOST_OBJECT_DRAWABLE 0xFFFFFFFF - class Object; class PartitionData; enum GeometryType CPP_11(: Int); @@ -63,7 +59,6 @@ class GhostObject : public Snapshot inline const Coord3D *getParentPosition(void) const {return &m_parentPosition;} protected: - virtual void crc( Xfer *xfer ); virtual void xfer( Xfer *xfer ); virtual void loadPostProcess( void ); @@ -83,20 +78,23 @@ class GhostObjectManager : public Snapshot public: GhostObjectManager(); virtual ~GhostObjectManager(); + virtual void reset(void); virtual GhostObject *addGhostObject(Object *object, PartitionData *pd); virtual void removeGhostObject(GhostObject *mod); - virtual inline void setLocalPlayerIndex(int index) { m_localPlayer = index; } + virtual void setLocalPlayerIndex(int playerIndex) { m_localPlayer = playerIndex; } inline int getLocalPlayerIndex(void) { return m_localPlayer; } - virtual void updateOrphanedObjects(int *playerIndexList, int numNonLocalPlayers); + virtual void updateOrphanedObjects(int *playerIndexList, int playerIndexCount); virtual void releasePartitionData(void); ///xferObjectID( &parentObjectID ); if( xfer->getXferMode() == XFER_LOAD ) { - // tie up parent object pointer m_parentObject = TheGameLogic->findObjectByID( parentObjectID ); // sanity if( parentObjectID != INVALID_ID && m_parentObject == NULL ) { - DEBUG_CRASH(( "GhostObject::xfer - Unable to connect m_parentObject" )); throw INI_INVALID_DATA; - } - } // parent geometry type @@ -126,7 +118,6 @@ void GhostObject::xfer( Xfer *xfer ) // partition data ///@todo write me ---> !!!!! // PartitionData *m_partitionData; ///< our PartitionData - } // ------------------------------------------------------------------------------------------------ @@ -134,7 +125,6 @@ void GhostObject::xfer( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ void GhostObject::loadPostProcess( void ) { - } // ------------------------------------------------------------------------------------------------ @@ -150,14 +140,12 @@ GhostObjectManager::GhostObjectManager(void) // ------------------------------------------------------------------------------------------------ GhostObjectManager::~GhostObjectManager() { - } // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ void GhostObjectManager::reset(void) { - } // ------------------------------------------------------------------------------------------------ @@ -171,14 +159,12 @@ GhostObject *GhostObjectManager::addGhostObject(Object *object, PartitionData *p // ------------------------------------------------------------------------------------------------ void GhostObjectManager::removeGhostObject(GhostObject *mod) { - } // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ -void GhostObjectManager::updateOrphanedObjects(int *playerIndexList, int numNonLocalPlayers) +void GhostObjectManager::updateOrphanedObjects(int *playerIndexList, int playerIndexCount) { - } // ------------------------------------------------------------------------------------------------ @@ -197,7 +183,6 @@ void GhostObjectManager::restorePartitionData(void) // ------------------------------------------------------------------------------------------------ void GhostObjectManager::crc( Xfer *xfer ) { - } // ------------------------------------------------------------------------------------------------ @@ -207,7 +192,6 @@ void GhostObjectManager::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ void GhostObjectManager::xfer( Xfer *xfer ) { - // version XferVersion currentVersion = 1; XferVersion version = currentVersion; @@ -215,7 +199,6 @@ void GhostObjectManager::xfer( Xfer *xfer ) // local player xfer->xferInt( &m_localPlayer ); - } // ------------------------------------------------------------------------------------------------ @@ -223,5 +206,4 @@ void GhostObjectManager::xfer( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ void GhostObjectManager::loadPostProcess( void ) { - } diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGhostObject.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGhostObject.h index 34efb3f3a70..d3c0df05b89 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGhostObject.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGhostObject.h @@ -45,12 +45,14 @@ class PartitionData; class W3DGhostObject: public GhostObject { friend W3DGhostObjectManager; + public: W3DGhostObject(); virtual ~W3DGhostObject(); virtual void snapShot(int playerIndex); virtual void updateParentObject(Object *object, PartitionData *mod); virtual void freeSnapShot(int playerIndex); + protected: virtual void crc( Xfer *xfer); virtual void xfer( Xfer *xfer ); @@ -59,9 +61,9 @@ class W3DGhostObject: public GhostObject void restoreParentObject(void); ///< restore the original non-ghosted object to scene. void addToScene(int playerIndex); void removeFromScene(int playerIndex); - void release(void); ///< used by manager to return object to free store. - void getShroudStatus(int playerIndex); ///< used to get the partition manager to update ghost objects without parent objects. + ObjectShroudStatus getShroudStatus(int playerIndex); ///< used to get the partition manager to update ghost objects without parent objects. void freeAllSnapShots(void); ///< used to free all snapshots from all players. + W3DRenderObjectSnapshot *m_parentSnapshots[MAX_PLAYER_COUNT]; DrawableInfo m_drawableInfo; @@ -78,8 +80,8 @@ class W3DGhostObjectManager : public GhostObjectManager virtual void reset(void); virtual GhostObject *addGhostObject(Object *object, PartitionData *pd); virtual void removeGhostObject(GhostObject *mod); - virtual void setLocalPlayerIndex(int index); - virtual void updateOrphanedObjects(int *playerIndexList, int numNonLocalPlayers); + virtual void setLocalPlayerIndex(int playerIndex); + virtual void updateOrphanedObjects(int *playerIndexList, int playerIndexCount); virtual void releasePartitionData(void); virtual void restorePartitionData(void); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index 77dbb878533..d5a1182d966 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -44,6 +44,7 @@ #include "W3DDevice/GameClient/Module/W3DModelDraw.h" #include "W3DDevice/GameClient/W3DAssetManager.h" #include "W3DDevice/GameClient/W3DDisplay.h" +#include "W3DDevice/GameClient/W3DScene.h" #include "W3DDevice/GameLogic/W3DGhostObject.h" #include "WW3D2/rendobj.h" #include "WW3D2/hlod.h" @@ -60,8 +61,11 @@ class W3DRenderObjectSnapshot : public Snapshot W3DRenderObjectSnapshot(RenderObjClass *m_parentRobj, DrawableInfo *drawInfo, Bool cloneParentRobj = TRUE); ~W3DRenderObjectSnapshot() {REF_PTR_RELEASE(m_robj);} - inline void update(RenderObjClass *robj, DrawableInfo *drawInfo, Bool cloneParentRobj=TRUE); ///Get_Num_Sub_Objects(); i++) { - RenderObjClass *subObj=robj->Get_Sub_Object(i); + RenderObjClass *subObj = robj->Get_Sub_Object(i); if (subObj && subObj->Class_ID() == RenderObjClass::CLASSID_MESH) - { //check if sub-object has the correct material to do texture scrolling. - MaterialInfoClass *mat=subObj->Get_Material_Info(); + { + //check if sub-object has the correct material to do texture scrolling. + MaterialInfoClass *mat = subObj->Get_Material_Info(); if (mat) - { for (Int j=0; jVertex_Material_Count(); j++) + { + for (Int j=0; jVertex_Material_Count(); j++) { - VertexMaterialClass *vmaterial=mat->Peek_Vertex_Material(j); - LinearOffsetTextureMapperClass *mapper=(LinearOffsetTextureMapperClass *)vmaterial->Peek_Mapper(); + VertexMaterialClass *vmaterial = mat->Peek_Vertex_Material(j); + LinearOffsetTextureMapperClass *mapper = (LinearOffsetTextureMapperClass *)vmaterial->Peek_Mapper(); if (mapper && mapper->Mapper_ID() == TextureMapperClass::MAPPER_ID_LINEAR_OFFSET) { subObj->Set_User_Data(&animationDisableOverride); //tell W3D about custom material settings @@ -122,8 +128,7 @@ void W3DRenderObjectSnapshot::update(RenderObjClass *robj, DrawableInfo *drawInf if( cloneParentRobj == TRUE ) { - - m_robj=robj->Clone(); + m_robj = robj->Clone(); m_robj->Set_ObjectColor(robj->Get_ObjectColor()); #ifdef DEBUG_FOG_MEMORY m_robjName = m_robj->Get_Name(); @@ -135,16 +140,17 @@ void W3DRenderObjectSnapshot::update(RenderObjClass *robj, DrawableInfo *drawInf float frame,mult; int mode,numFrames; - HAnimClass *hanim=((HLodClass *)robj)->Peek_Animation_And_Info(frame,numFrames,mode,mult); + HAnimClass *hanim = ((HLodClass *)robj)->Peek_Animation_And_Info(frame,numFrames,mode,mult); m_robj->Set_Animation(hanim,frame); disableUVAnimations(m_robj); } } else - m_robj=robj; + { + m_robj = robj; + } m_robj->Set_User_Data(drawInfo); - } // ------------------------------------------------------------------------------------------------ @@ -152,7 +158,14 @@ void W3DRenderObjectSnapshot::update(RenderObjClass *robj, DrawableInfo *drawInf void W3DRenderObjectSnapshot::addToScene(void) { if (W3DDisplay::m_3DScene != NULL) - ((SimpleSceneClass *)W3DDisplay::m_3DScene)->Add_Render_Object(m_robj); + W3DDisplay::m_3DScene->Add_Render_Object(m_robj); +} + +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +void W3DRenderObjectSnapshot::removeFromScene() +{ + m_robj->Remove(); } // ------------------------------------------------------------------------------------------------ @@ -160,8 +173,8 @@ void W3DRenderObjectSnapshot::addToScene(void) W3DRenderObjectSnapshot::W3DRenderObjectSnapshot(RenderObjClass *robj, DrawableInfo *drawInfo, Bool cloneParentRobj) { - m_robj=NULL; - m_next=NULL; + m_robj = NULL; + m_next = NULL; update(robj, drawInfo, cloneParentRobj); } @@ -170,7 +183,6 @@ W3DRenderObjectSnapshot::W3DRenderObjectSnapshot(RenderObjClass *robj, DrawableI // ------------------------------------------------------------------------------------------------ void W3DRenderObjectSnapshot::crc( Xfer *xfer ) { - } // ------------------------------------------------------------------------------------------------ @@ -180,7 +192,6 @@ void W3DRenderObjectSnapshot::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ void W3DRenderObjectSnapshot::xfer( Xfer *xfer ) { - // version XferVersion currentVersion = 1; XferVersion version = currentVersion; @@ -203,27 +214,24 @@ void W3DRenderObjectSnapshot::xfer( Xfer *xfer ) Bool visible; RenderObjClass *subObject; AsciiString subObjectName; + for( Int i = 0; i < subObjectCount; ++i ) { - // // when saving we get sub objects by index and xfer their name, when loading // we read the name and find that sub object // if( xfer->getXferMode() == XFER_SAVE ) { - // get sub object subObject = m_robj->Get_Sub_Object( i ); // xfer sub object name which is unique among those in this render object subObjectName.set( subObject->Get_Name() ); xfer->xferAsciiString( &subObjectName ); - } else { - // read sub object name xfer->xferAsciiString( &subObjectName ); @@ -258,17 +266,14 @@ void W3DRenderObjectSnapshot::xfer( Xfer *xfer ) // need to tell W3D that this sub object transforms are ok if( subObject ) { - // need to cast to HLod if we can to validate the hierarchy if( subObject->Class_ID() == RenderObjClass::CLASSID_HLOD ) ((HLodClass *)subObject)->Friend_Set_Hierarchy_Valid( TRUE ); - } // release reference to sub object if( subObject ) REF_PTR_RELEASE( subObject ); - } // tell W3D that the transforms for our sub objects are all OK cause we've done them ourselves @@ -288,9 +293,8 @@ void W3DRenderObjectSnapshot::loadPostProcess( void ) // ------------------------------------------------------------------------------------------------ W3DGhostObject::W3DGhostObject() { - - for (Int i=0; i< MAX_PLAYER_COUNT; i++) - m_parentSnapshots[i]=NULL; + for (Int i = 0; i < MAX_PLAYER_COUNT; i++) + m_parentSnapshots[i] = NULL; m_drawableInfo.m_drawable = NULL; m_drawableInfo.m_flags = 0; @@ -299,7 +303,6 @@ W3DGhostObject::W3DGhostObject() m_nextSystem = NULL; m_prevSystem = NULL; - } // ------------------------------------------------------------------------------------------------ @@ -307,7 +310,7 @@ W3DGhostObject::W3DGhostObject() W3DGhostObject::~W3DGhostObject() { #ifdef DEBUG_FOG_MEMORY - for (Int i=0; igetDrawable(); + Drawable *draw = m_parentObject->getDrawable(); + if (draw->isDrawableEffectivelyHidden()) return; //don't bother to snapshot things which nobody can see. - W3DRenderObjectSnapshot *snap=m_parentSnapshots[playerIndex],*prevSnap=NULL; + W3DRenderObjectSnapshot *snap = m_parentSnapshots[playerIndex]; + W3DRenderObjectSnapshot *prevSnap = NULL; //walk through all W3D render objects used by this object for (DrawModule ** dm = draw->getDrawModules(); *dm; ++dm) @@ -340,10 +345,9 @@ void W3DGhostObject::snapShot(int playerIndex) const ObjectDrawInterface* di = (*dm)->getObjectDrawInterface(); if (di) { - W3DModelDraw *w3dDraw= (W3DModelDraw *)di; - RenderObjClass *robj=NULL; + W3DModelDraw *w3dDraw = (W3DModelDraw *)di; + RenderObjClass *robj = w3dDraw->getRenderObject(); - robj=w3dDraw->getRenderObject(); //robj may be null for modules which have no render objects such //as for build-ups that are currently disabled. if (robj) @@ -352,9 +356,9 @@ void W3DGhostObject::snapShot(int playerIndex) { snap = NEW W3DRenderObjectSnapshot(robj, &m_drawableInfo); // poolify if (prevSnap) - prevSnap->m_next=snap; + prevSnap->m_next = snap; else - m_parentSnapshots[playerIndex]=snap; + m_parentSnapshots[playerIndex] = snap; } else m_parentSnapshots[playerIndex]->update(robj, &m_drawableInfo); @@ -369,7 +373,7 @@ void W3DGhostObject::snapShot(int playerIndex) snap->addToScene(); } - prevSnap=snap; + prevSnap = snap; snap = snap->m_next; } } @@ -377,16 +381,17 @@ void W3DGhostObject::snapShot(int playerIndex) //Check if we captured at least one snapshot if (snap != m_parentSnapshots[playerIndex]) - { //save off other info we may need in case the parent object is destroyed. + { + //save off other info we may need in case the parent object is destroyed. ///@todo: We're going to ignore the case where each player index could be - //looking at a different geometry info/orientation because ghostobjects + //looking at a different geometry info/orientation because ghost objects //are supposed to be used on immobile buildings. - m_parentGeometryType=m_parentObject->getGeometryInfo().getGeomType(); - m_parentGeometryIsSmall=m_parentObject->getGeometryInfo().getIsSmall(); - m_parentGeometryMajorRadius=m_parentObject->getGeometryInfo().getMajorRadius(); - m_parentGeometryminorRadius=m_parentObject->getGeometryInfo().getMinorRadius(); - m_parentPosition=*m_parentObject->getPosition(); - m_parentAngle=m_parentObject->getOrientation(); + m_parentGeometryType = m_parentObject->getGeometryInfo().getGeomType(); + m_parentGeometryIsSmall = m_parentObject->getGeometryInfo().getIsSmall(); + m_parentGeometryMajorRadius = m_parentObject->getGeometryInfo().getMajorRadius(); + m_parentGeometryminorRadius = m_parentObject->getGeometryInfo().getMinorRadius(); + m_parentPosition = *m_parentObject->getPosition(); + m_parentAngle = m_parentObject->getOrientation(); } } @@ -395,12 +400,11 @@ void W3DGhostObject::snapShot(int playerIndex) // ------------------------------------------------------------------------------------------------ void W3DGhostObject::removeParentObject(void) { - // sanity if( m_parentObject == NULL ) return; - Drawable *draw=m_parentObject->getDrawable(); + Drawable *draw = m_parentObject->getDrawable(); //After we remove the unfogged object, we also disable //anything that should be hidden inside fog - shadow, particles, etc. @@ -412,10 +416,8 @@ void W3DGhostObject::removeParentObject(void) const ObjectDrawInterface* di = (*dm)->getObjectDrawInterface(); if (di) { - W3DModelDraw *w3dDraw= (W3DModelDraw *)di; - RenderObjClass *robj=NULL; - - robj=w3dDraw->getRenderObject(); + W3DModelDraw *w3dDraw = (W3DModelDraw *)di; + RenderObjClass *robj = w3dDraw->getRenderObject(); if (robj) { DEBUG_ASSERTCRASH(robj->Peek_Scene() != NULL, ("Removing GhostObject parent not in scene")); @@ -432,7 +434,11 @@ void W3DGhostObject::restoreParentObject(void) { if (TheGlobalData->m_headless) return; - Drawable *draw=m_parentObject->getDrawable(); + + if (!m_parentObject) + return; + + Drawable *draw = m_parentObject->getDrawable(); if (!draw) return; @@ -445,19 +451,19 @@ void W3DGhostObject::restoreParentObject(void) const ObjectDrawInterface* di = (*dm)->getObjectDrawInterface(); if (di) { - W3DModelDraw *w3dDraw= (W3DModelDraw *)di; - RenderObjClass *robj=NULL; + W3DModelDraw *w3dDraw = (W3DModelDraw *)di; + RenderObjClass *robj = w3dDraw->getRenderObject(); - robj=w3dDraw->getRenderObject(); //robj may be null for modules which have no render objects such //as for build-ups that are currently disabled. if (robj) - { //if we have a render object that's not in the scene, it must have been + { + //if we have a render object that's not in the scene, it must have been //removed by the ghost object manager, so restore it. If we have a render //object that is in the scene, then it was probably added because the model //changed while the object was ghosted (for damage states, garrison, etc.). - if (robj->Peek_Scene() == NULL) - ((SimpleSceneClass *)W3DDisplay::m_3DScene)->Add_Render_Object(robj); + if (!robj->Is_In_Scene()) + W3DDisplay::m_3DScene->Add_Render_Object(robj); } } } @@ -470,27 +476,28 @@ void W3DGhostObject::freeAllSnapShots(void) Int playerIndex; #ifdef DEBUG_FOG_MEMORY - for (playerIndex=0; playerIndexgetLocalPlayerIndex(); #endif if (m_parentSnapshots[playerIndex]) - { //if we have a snapshot for this object, remove it from + { + //if we have a snapshot for this object, remove it from //scene. removeFromScene(playerIndex); //Restore actual objects assuming they are still alive. - if (m_parentObject) - restoreParentObject(); + restoreParentObject(); - W3DRenderObjectSnapshot *snap=m_parentSnapshots[playerIndex]; + W3DRenderObjectSnapshot *snap = m_parentSnapshots[playerIndex]; W3DRenderObjectSnapshot *nextSnap; while (snap) - { nextSnap = snap->m_next; + { + nextSnap = snap->m_next; delete snap; snap = nextSnap; } - m_parentSnapshots[playerIndex]=NULL; + m_parentSnapshots[playerIndex] = NULL; } } @@ -505,7 +512,8 @@ void W3DGhostObject::freeSnapShot(int playerIndex) #endif if (m_parentSnapshots[playerIndex]) - { //if we have a snapshot for this object, remove it from + { + //if we have a snapshot for this object, remove it from //scene and put back the original object if it still exists. if (playerIndex == TheGhostObjectManager->getLocalPlayerIndex()) { @@ -516,18 +524,18 @@ void W3DGhostObject::freeSnapShot(int playerIndex) removeFromScene(playerIndex); //Restore actual objects assuming they are still alive. - if (m_parentObject) - restoreParentObject(); + restoreParentObject(); } - W3DRenderObjectSnapshot *snap=m_parentSnapshots[playerIndex]; + W3DRenderObjectSnapshot *snap = m_parentSnapshots[playerIndex]; W3DRenderObjectSnapshot *nextSnap; while (snap) - { nextSnap = snap->m_next; + { + nextSnap = snap->m_next; delete snap; snap = nextSnap; } - m_parentSnapshots[playerIndex]=NULL; + m_parentSnapshots[playerIndex] = NULL; } } @@ -544,12 +552,12 @@ void W3DGhostObject::updateParentObject(Object *object, PartitionData *mod) // ------------------------------------------------------------------------------------------------ void W3DGhostObject::removeFromScene(int playerIndex) { - W3DRenderObjectSnapshot *snap=m_parentSnapshots[playerIndex]; + W3DRenderObjectSnapshot *snap = m_parentSnapshots[playerIndex]; while (snap) { - snap->m_robj->Remove(); - snap=snap->m_next; + snap->removeFromScene(); + snap = snap->m_next; } } @@ -558,38 +566,20 @@ void W3DGhostObject::removeFromScene(int playerIndex) // ------------------------------------------------------------------------------------------------ void W3DGhostObject::addToScene(int playerIndex) { - W3DRenderObjectSnapshot *snap=m_parentSnapshots[playerIndex]; + W3DRenderObjectSnapshot *snap = m_parentSnapshots[playerIndex]; while (snap) { - ((SimpleSceneClass *)W3DDisplay::m_3DScene)->Add_Render_Object(snap->m_robj); - snap=snap->m_next; + snap->addToScene(); + snap = snap->m_next; } } // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ -void W3DGhostObject::release(void) +ObjectShroudStatus W3DGhostObject::getShroudStatus(int playerIndex) { - W3DRenderObjectSnapshot *snap,*nextSnap; - - for (Int i=0; im_next; - delete snap; - snap=nextSnap; - } - m_parentSnapshots[i]=NULL; - } -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void W3DGhostObject::getShroudStatus(int playerIndex) -{ - m_partitionData->getShroudedStatus(playerIndex); + return m_partitionData->getShroudedStatus(playerIndex); } // ------------------------------------------------------------------------------------------------ @@ -597,10 +587,8 @@ void W3DGhostObject::getShroudStatus(int playerIndex) // ------------------------------------------------------------------------------------------------ void W3DGhostObject::crc( Xfer *xfer ) { - // extend base class GhostObject::crc( xfer ); - } // ------------------------------------------------------------------------------------------------ @@ -610,7 +598,6 @@ void W3DGhostObject::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ void W3DGhostObject::xfer( Xfer *xfer ) { - // version XferVersion currentVersion = 1; XferVersion version = currentVersion; @@ -630,14 +617,12 @@ void W3DGhostObject::xfer( Xfer *xfer ) xfer->xferDrawableID( &drawableID ); if( xfer->getXferMode() == XFER_LOAD ) { - // reconnect the drawable pointer m_drawableInfo.m_drawable = TheGameClient->findDrawableByID( drawableID ); // sanity if( drawableID != INVALID_DRAWABLE_ID && m_drawableInfo.m_drawable == NULL ) DEBUG_CRASH(( "W3DGhostObject::xfer - Unable to find drawable for ghost object" )); - } // @@ -650,19 +635,16 @@ void W3DGhostObject::xfer( Xfer *xfer ) UnsignedByte snapshotCount; for( Int i = 0; i < MAX_PLAYER_COUNT; ++i ) { - // count the snapshots at this index snapshotCount = 0; W3DRenderObjectSnapshot *objectSnapshot = m_parentSnapshots[ i ]; while( objectSnapshot ) { - // increment count snapshotCount++; // on to the next snapshot objectSnapshot = objectSnapshot->m_next; - } // xfer the snapshot count at this index @@ -674,24 +656,21 @@ void W3DGhostObject::xfer( Xfer *xfer ) // if( snapshotCount == 0 && m_parentSnapshots[ i ] != NULL ) { - DEBUG_CRASH(( "W3DGhostObject::xfer - m_parentShapshots[ %d ] has data present but the count from the xfer stream is empty", i )); throw INI_INVALID_DATA; - } // xfer each of the snapshots at this index Real scale; UnsignedInt color; AsciiString name; + if( xfer->getXferMode() == XFER_SAVE ) { - // iterate through list objectSnapshot = m_parentSnapshots[ i ]; while( objectSnapshot ) { - // write name from render object name.set( objectSnapshot->m_robj->Get_Name() ); xfer->xferAsciiString( &name ); @@ -709,9 +688,7 @@ void W3DGhostObject::xfer( Xfer *xfer ) // onto the next objectSnapshot = objectSnapshot->m_next; - } - } else { @@ -720,7 +697,6 @@ void W3DGhostObject::xfer( Xfer *xfer ) for( UnsignedByte j = 0; j < snapshotCount; ++j ) { - // read render object name xfer->xferAsciiString( &name ); @@ -749,11 +725,8 @@ void W3DGhostObject::xfer( Xfer *xfer ) // add snapshot to the scene objectSnapshot->addToScene(); - } - } - } // @@ -777,15 +750,12 @@ void W3DGhostObject::xfer( Xfer *xfer ) ObjectShroudStatus status; if( xfer->getXferMode() == XFER_SAVE ) { - // iterate through all array points for( playerIndex = 0; playerIndex < MAX_PLAYER_COUNT; ++playerIndex ) { - // is this a location with any info if( m_parentSnapshots[ playerIndex ] ) { - // write this index xfer->xferUnsignedByte( &playerIndex ); @@ -796,11 +766,8 @@ void W3DGhostObject::xfer( Xfer *xfer ) // write previous shroudedness status = m_partitionData->friend_getShroudednessPrevious( playerIndex ); xfer->xferUser( &status, sizeof( ObjectShroudStatus ) ); - } - } - } else { @@ -820,11 +787,8 @@ void W3DGhostObject::xfer( Xfer *xfer ) // read shroudedness previous and set xfer->xferUser( &status, sizeof( ObjectShroudStatus ) ); m_partitionData->friend_setShroudednessPrevious( playerIndex, status ); - } - } - } // ------------------------------------------------------------------------------------------------ @@ -832,20 +796,16 @@ void W3DGhostObject::xfer( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ void W3DGhostObject::loadPostProcess( void ) { - // extend base class GhostObject::loadPostProcess(); - } // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ W3DGhostObjectManager::W3DGhostObjectManager(void) { - m_freeModules = NULL; m_usedModules = NULL; - } // ------------------------------------------------------------------------------------------------ @@ -859,9 +819,9 @@ W3DGhostObjectManager::~W3DGhostObjectManager() while (mod) { - nextmod=mod->m_nextSystem; + nextmod = mod->m_nextSystem; delete mod; - mod=nextmod; + mod = nextmod; } } @@ -875,24 +835,24 @@ void W3DGhostObjectManager::reset(void) //Remove any orphaned modules that were not deleted with their parent object because player had fogged memory of them. while (mod) { - nextmod=mod->m_nextSystem; + nextmod = mod->m_nextSystem; if (!mod->m_parentObject) //make sure it has no parent object { ThePartitionManager->unRegisterGhostObject(mod); removeGhostObject(mod); } - mod=nextmod; + mod = nextmod; } DEBUG_ASSERTCRASH(m_usedModules == NULL, ("Reset of Non-Empty GhostObjectManager")); //Delete any remaining modules (should be none) - mod=m_usedModules; + mod = m_usedModules; while (mod) { - nextmod=mod->m_nextSystem; + nextmod = mod->m_nextSystem; removeGhostObject(mod); - mod=nextmod; + mod = nextmod; } } @@ -927,7 +887,6 @@ void W3DGhostObjectManager::removeGhostObject(GhostObject *object) // ------------------------------------------------------------------------------------------------ GhostObject *W3DGhostObjectManager::addGhostObject(Object *object, PartitionData *pd) { - // we disabled adding new ghost objects - used during map border resizing and loading if (m_lockGhostObjects || m_saveLockGhostObjects ) return NULL; @@ -936,17 +895,13 @@ GhostObject *W3DGhostObjectManager::addGhostObject(Object *object, PartitionData // sanity if( object != NULL ) { - W3DGhostObject *sanity = m_usedModules; while( sanity ) { - DEBUG_ASSERTCRASH( sanity->m_parentObject != object, - ("W3DGhostObjectManager::addGhostObject - Duplicate ghost object detected\n") ); + ("W3DGhostObjectManager::addGhostObject - Duplicate ghost object detected") ); sanity = sanity->m_nextSystem; - } - } #endif @@ -973,17 +928,17 @@ GhostObject *W3DGhostObjectManager::addGhostObject(Object *object, PartitionData m_usedModules = mod; //Copy settings from parent object - mod->m_parentObject=object; - mod->m_drawableInfo.m_drawable=NULL; //these dummy render objects don't have drawables. + mod->m_parentObject = object; + mod->m_drawableInfo.m_drawable = NULL; //these dummy render objects don't have drawables. mod->m_drawableInfo.m_ghostObject = mod; - mod->m_partitionData=pd; + mod->m_partitionData = pd; return mod; } // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ -void W3DGhostObjectManager::setLocalPlayerIndex(int index) +void W3DGhostObjectManager::setLocalPlayerIndex(int playerIndex) { //Whenever we switch local players, we need to remove all ghost objects belonging //to another player from the map. We then insert the current local player's @@ -994,25 +949,29 @@ void W3DGhostObjectManager::setLocalPlayerIndex(int index) while (mod) { mod->removeFromScene(m_localPlayer); - if (mod->m_parentSnapshots[index]) - { //new player has his own snapshot - if (!mod->m_parentSnapshots[m_localPlayer] && mod->m_parentObject) - { //previous player didn't have a snapshot so real object must + + if (mod->m_parentSnapshots[playerIndex]) + { + //new player has his own snapshot + if (!mod->m_parentSnapshots[m_localPlayer]) + { + //previous player didn't have a snapshot so real object must //have been in the scene. Replace it with our snapshot. mod->removeParentObject(); } - mod->addToScene(index); + mod->addToScene(playerIndex); } - //new player doesn't have a snapshot which means restore original object - //if it was replaced by a snapshot by the previous player. - else - if (mod->m_parentSnapshots[m_localPlayer] && mod->m_parentObject) + else if (mod->m_parentSnapshots[m_localPlayer]) + { + //new player doesn't have a snapshot which means restore original object + //if it was replaced by a snapshot by the previous player. mod->restoreParentObject(); + } - mod=mod->m_nextSystem; + mod = mod->m_nextSystem; } - m_localPlayer = index; + GhostObjectManager::setLocalPlayerIndex(playerIndex); } // ------------------------------------------------------------------------------------------------ @@ -1021,40 +980,44 @@ a GhostObject in case any players didn't see the death and have a fogged view of We need to manually determine if these orphaned GhostObjects ever become visible and are no longer needed*/ // ------------------------------------------------------------------------------------------------ -void W3DGhostObjectManager::updateOrphanedObjects(int *playerIndexList, int numNonLocalPlayers) +void W3DGhostObjectManager::updateOrphanedObjects(int *playerIndexList, int playerIndexCount) { - W3DGhostObject *mod = m_usedModules, *nextmod; int numStoredSnapshots; while (mod) { - //updating the shroud status of this ghostobject could remove + //updating the shroud status of this ghost object could remove //it from the scene if it becomes visible but parent object is gone. - nextmod=mod->m_nextSystem; + nextmod = mod->m_nextSystem; if (!mod->m_parentObject) { - numStoredSnapshots=0; + numStoredSnapshots = 0; + #ifdef DEBUG_FOG_MEMORY - for (int i=0; im_parentSnapshots[*playerIndexList]) mod->getShroudStatus(*playerIndexList); + if (mod->m_parentSnapshots[*playerIndexList]) numStoredSnapshots++; } #endif mod->getShroudStatus(m_localPlayer); + if (mod->m_parentSnapshots[m_localPlayer]) numStoredSnapshots++; + if (!numStoredSnapshots) - { ThePartitionManager->unRegisterGhostObject(mod); - mod->m_partitionData=NULL; + { + ThePartitionManager->unRegisterGhostObject(mod); + mod->m_partitionData = NULL; removeGhostObject(mod); } } - mod=nextmod; + mod = nextmod; } } @@ -1070,7 +1033,8 @@ void W3DGhostObjectManager::releasePartitionData(void) while (mod) { - nextmod=mod->m_nextSystem; + nextmod = mod->m_nextSystem; + //if module has no parent object, then its holding a ghost object which //needs to have it's own partition data. if (!mod->m_parentObject) @@ -1079,7 +1043,8 @@ void W3DGhostObjectManager::releasePartitionData(void) mod->m_partitionData = NULL; } else - { //The parent object will handle unregistering so just tell to break the + { + //The parent object will handle unregistering so just tell to break the //ghost object link. mod->friend_getPartitionData()->friend_setGhostObject(NULL); mod->m_partitionData = NULL; @@ -1099,13 +1064,14 @@ void W3DGhostObjectManager::restorePartitionData(void) while (mod) { nextmod=mod->m_nextSystem; + //if module has no parent object, then its holding a ghost object which //needs to have it's own partition data. if (mod->m_parentObject) { //restore into parent's partition data mod->m_parentObject->friend_getPartitionData()->friend_setGhostObject(mod); - mod->m_partitionData=mod->m_parentObject->friend_getPartitionData(); + mod->m_partitionData = mod->m_parentObject->friend_getPartitionData(); } else { @@ -1115,12 +1081,13 @@ void W3DGhostObjectManager::restorePartitionData(void) //set partition data to reflect that we've seen a fogged version //of this object if one exists. - for (Int i=0; im_parentSnapshots[i]) + for (Int i = 0; i < MAX_PLAYER_COUNT; i++) + { + if (mod->m_parentSnapshots[i]) mod->m_partitionData->friend_setShroudednessPrevious(i,OBJECTSHROUD_FOGGED); } - mod=nextmod; + mod = nextmod; } } @@ -1129,10 +1096,8 @@ void W3DGhostObjectManager::restorePartitionData(void) // ------------------------------------------------------------------------------------------------ void W3DGhostObjectManager::crc( Xfer *xfer ) { - // extend base class GhostObjectManager::crc( xfer ); - } // ------------------------------------------------------------------------------------------------ @@ -1142,7 +1107,6 @@ void W3DGhostObjectManager::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ void W3DGhostObjectManager::xfer( Xfer *xfer ) { - // version XferVersion currentVersion = 1; XferVersion version = currentVersion; @@ -1164,11 +1128,9 @@ void W3DGhostObjectManager::xfer( Xfer *xfer ) ObjectID objectID; if( xfer->getXferMode() == XFER_SAVE ) { - // iterate all ghost objects for( w3dGhostObject = m_usedModules; w3dGhostObject; w3dGhostObject = w3dGhostObject->m_nextSystem ) { - // write out object ID if( w3dGhostObject->m_parentObject ) objectID = w3dGhostObject->m_parentObject->getID(); @@ -1178,28 +1140,26 @@ void W3DGhostObjectManager::xfer( Xfer *xfer ) // write out ghost object data xfer->xferSnapshot( w3dGhostObject ); - } - } else { - // sanity, there should be no ghost objects loaded at this time DEBUG_ASSERTCRASH( m_usedModules == NULL, - ("W3DGhostObjectManager::xfer - The used module list is not NULL upon load, but should be!\n") ); + ("W3DGhostObjectManager::xfer - The used module list is not NULL upon load, but should be!") ); // now it's time to unlock the ghost objects for loading DEBUG_ASSERTCRASH( m_saveLockGhostObjects == TRUE, - ("W3DGhostObjectManager::xfer - Ghost object manager is not save locked, but should be\n") ); + ("W3DGhostObjectManager::xfer - Ghost object manager is not save locked, but should be") ); + TheGhostObjectManager->saveLockGhostObjects( FALSE ); // read all ghost objects GhostObject *ghostObject; Object *object; + for( UnsignedShort i = 0; i < count; ++i ) { - // read object id xfer->xferObjectID( &objectID ); @@ -1209,40 +1169,32 @@ void W3DGhostObjectManager::xfer( Xfer *xfer ) // create ghost object data if( object ) { - // create ghost object ghostObject = addGhostObject( object, object->friend_getPartitionData() ); // sanity DEBUG_ASSERTCRASH( ghostObject != NULL, - ("W3DGhostObjectManager::xfer - Could not create ghost object for object '%s'\n", - object->getTemplate()->getName().str()) ); + ("W3DGhostObjectManager::xfer - Could not create ghost object for object '%s'", object->getTemplate()->getName().str()) ); // link the ghost object and logical object togehter through partition/ghostObject dat DEBUG_ASSERTCRASH( object->friend_getPartitionData()->getGhostObject() == NULL, - ("W3DGhostObjectManager::xfer - Ghost object already on object '%s'\n", - object->getTemplate()->getName().str()) ); - object->friend_getPartitionData()->friend_setGhostObject( ghostObject ); + ("W3DGhostObjectManager::xfer - Ghost object already on object '%s'", object->getTemplate()->getName().str()) ); + object->friend_getPartitionData()->friend_setGhostObject( ghostObject ); } else { - // create object with no object or partition data ghostObject = addGhostObject( NULL, NULL ); // register ghost object object with partition system and fill out partition data ThePartitionManager->registerGhostObject( ghostObject ); - } // read ghost object data xfer->xferSnapshot( ghostObject ); - } - } - } // ------------------------------------------------------------------------------------------------ @@ -1250,8 +1202,6 @@ void W3DGhostObjectManager::xfer( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ void W3DGhostObjectManager::loadPostProcess( void ) { - // extend base class GhostObjectManager::loadPostProcess(); - } From 71e56f63d135fb59c906858efb4539a9c657f08f Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 12 Sep 2025 12:13:07 +0200 Subject: [PATCH 186/343] build(ghostobject): Fix compile error when enabling DEBUG_FOG_MEMORY (#1569) --- .../Source/GameClient/GameClient.cpp | 34 +++++++++++-------- .../Source/GameClient/GameClient.cpp | 34 +++++++++++-------- 2 files changed, 40 insertions(+), 28 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp index 6f47b700f57..29c5eefeaa8 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -604,26 +604,28 @@ void GameClient::update( void ) if (!freezeTime) { +#ifdef DEBUG_FOG_MEMORY + Int numPlayers = ThePlayerList->getPlayerCount(); + Int numNonLocalPlayers = 0; + Int nonLocalPlayerIndices[MAX_PLAYER_COUNT]; +#endif + #if ENABLE_CONFIGURABLE_SHROUD if (TheGlobalData->m_shroudOn) #else if (true) #endif { - //localPlayerIndex=TheGhostObjectManager->getLocalPlayerIndex(); //always use the first local player set since normally can't change. Doesn't work with debug "CTRL_SHIFT_SPACE" #ifdef DEBUG_FOG_MEMORY //Find indices of all active players - Int numPlayers=ThePlayerList->getPlayerCount(); - Int numNonLocalPlayers=0; - Int nonLocalPlayerIndices[MAX_PLAYER_COUNT]; - for (Int i=0; igetNthPlayer(i); - //if (player->getPlayerType == PLAYER_HUMAN) - if (player->getPlayerIndex() != localPlayerIndex) - nonLocalPlayerIndices[numNonLocalPlayers++]=player->getPlayerIndex(); + for (Int i=0; i < numPlayers; i++) + { + Player *player = ThePlayerList->getNthPlayer(i); + if (player->getPlayerTemplate() != NULL && player->getPlayerIndex() != localPlayerIndex) + nonLocalPlayerIndices[numNonLocalPlayers++] = player->getPlayerIndex(); } - //update ghostObjects which don't have drawables or objects. - TheGhostObjectManager->updateOrphanedObjects(nonLocalPlayerIndices,numNonLocalPlayers); + //update ghost objects which don't have drawables or objects. + TheGhostObjectManager->updateOrphanedObjects(nonLocalPlayerIndices, numNonLocalPlayers); #else TheGhostObjectManager->updateOrphanedObjects(NULL,0); #endif @@ -640,7 +642,8 @@ void GameClient::update( void ) #else if (true) #endif - { //immobile objects need to take snapshots whenever they become fogged + { + //immobile objects need to take snapshots whenever they become fogged //so need to refresh their status. We can't rely on external calls //to getShroudStatus() because they are only made for visible on-screen //objects. @@ -648,9 +651,12 @@ void GameClient::update( void ) if (object) { #ifdef DEBUG_FOG_MEMORY - Int *playerIndex=nonLocalPlayerIndices; - for (i=0; igetShroudedStatus(*playerIndex); + } #endif ObjectShroudStatus ss=object->getShroudedStatus(localPlayerIndex); if (ss >= OBJECTSHROUD_FOGGED && draw->getShroudClearFrame()!=0) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp index b22987b2350..adf11303aaf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -642,26 +642,28 @@ void GameClient::update( void ) if (!freezeTime) { +#ifdef DEBUG_FOG_MEMORY + Int numPlayers = ThePlayerList->getPlayerCount(); + Int numNonLocalPlayers = 0; + Int nonLocalPlayerIndices[MAX_PLAYER_COUNT]; +#endif + #if ENABLE_CONFIGURABLE_SHROUD if (TheGlobalData->m_shroudOn) #else if (true) #endif { - //localPlayerIndex=TheGhostObjectManager->getLocalPlayerIndex(); //always use the first local player set since normally can't change. Doesn't work with debug "CTRL_SHIFT_SPACE" #ifdef DEBUG_FOG_MEMORY //Find indices of all active players - Int numPlayers=ThePlayerList->getPlayerCount(); - Int numNonLocalPlayers=0; - Int nonLocalPlayerIndices[MAX_PLAYER_COUNT]; - for (Int i=0; igetNthPlayer(i); - //if (player->getPlayerType == PLAYER_HUMAN) - if (player->getPlayerIndex() != localPlayerIndex) - nonLocalPlayerIndices[numNonLocalPlayers++]=player->getPlayerIndex(); + for (Int i=0; i < numPlayers; i++) + { + Player *player = ThePlayerList->getNthPlayer(i); + if (player->getPlayerTemplate() != NULL && player->getPlayerIndex() != localPlayerIndex) + nonLocalPlayerIndices[numNonLocalPlayers++] = player->getPlayerIndex(); } - //update ghostObjects which don't have drawables or objects. - TheGhostObjectManager->updateOrphanedObjects(nonLocalPlayerIndices,numNonLocalPlayers); + //update ghost objects which don't have drawables or objects. + TheGhostObjectManager->updateOrphanedObjects(nonLocalPlayerIndices, numNonLocalPlayers); #else TheGhostObjectManager->updateOrphanedObjects(NULL,0); #endif @@ -678,7 +680,8 @@ void GameClient::update( void ) #else if (true) #endif - { //immobile objects need to take snapshots whenever they become fogged + { + //immobile objects need to take snapshots whenever they become fogged //so need to refresh their status. We can't rely on external calls //to getShroudStatus() because they are only made for visible on-screen //objects. @@ -686,9 +689,12 @@ void GameClient::update( void ) if (object) { #ifdef DEBUG_FOG_MEMORY - Int *playerIndex=nonLocalPlayerIndices; - for (i=0; igetShroudedStatus(*playerIndex); + } #endif ObjectShroudStatus ss=object->getShroudedStatus(localPlayerIndex); if (ss >= OBJECTSHROUD_FOGGED && draw->getShroudClearFrame()!=0) { From 7ba59bf473a811afda04ce41b4cf854bbb1fbab6 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 12 Sep 2025 12:24:32 +0200 Subject: [PATCH 187/343] feat(client): Enable shroud for observed players (#1569) Adds new option PlayerObserverEnabled=yes to Options.ini --- Core/GameEngine/Include/Common/GameUtility.h | 6 ++ .../Source/Common/Audio/GameSounds.cpp | 6 +- Core/GameEngine/Source/Common/GameUtility.cpp | 47 ++++++++++++++- .../GameEngine/Include/Common/GlobalData.h | 4 ++ .../Include/Common/UserPreferences.h | 1 + .../Include/GameClient/ControlBar.h | 13 ++-- .../Include/GameClient/GameClient.h | 1 + .../GameEngine/Source/Common/GlobalData.cpp | 2 + .../GameEngine/Source/Common/System/Radar.cpp | 14 +++-- .../GameEngine/Source/GameClient/Drawable.cpp | 1 + .../GameEngine/Source/GameClient/FXList.cpp | 9 ++- .../GameClient/GUI/ControlBar/ControlBar.cpp | 6 +- .../GUI/ControlBar/ControlBarObserver.cpp | 59 ++++++++++++++++++- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 19 ++++++ .../Source/GameClient/GameClient.cpp | 11 +++- .../GameEngine/Source/GameClient/InGameUI.cpp | 15 ++--- .../GameClient/MessageStream/CommandXlat.cpp | 22 ++----- .../Behavior/PropagandaTowerBehavior.cpp | 1 + .../GameLogic/Object/PartitionManager.cpp | 13 ++-- .../Update/AIUpdate/ChinookAIUpdate.cpp | 1 + .../GameLogic/Object/Update/LaserUpdate.cpp | 1 + .../Update/ParticleUplinkCannonUpdate.cpp | 3 +- .../Object/Update/StealthDetectorUpdate.cpp | 10 +++- .../GameLogic/Object/Update/StealthUpdate.cpp | 5 +- .../Source/GameLogic/System/GameLogic.cpp | 13 ++-- .../W3DDevice/Common/System/W3DRadar.cpp | 19 +++--- .../Drawable/Draw/W3DScienceModelDraw.cpp | 7 ++- .../Source/W3DDevice/GameClient/W3DScene.cpp | 11 ++-- .../W3DDevice/GameClient/W3DTreeBuffer.cpp | 1 + .../Source/W3DDevice/GameClient/W3DView.cpp | 3 +- .../W3DDevice/GameLogic/W3DGhostObject.cpp | 2 +- .../GameEngine/Include/Common/GlobalData.h | 4 ++ .../Include/Common/UserPreferences.h | 1 + .../Include/GameClient/ControlBar.h | 13 ++-- .../GameEngine/Source/Common/GlobalData.cpp | 2 + .../GameEngine/Source/Common/System/Radar.cpp | 14 +++-- .../GameEngine/Source/GameClient/Drawable.cpp | 5 +- .../GameEngine/Source/GameClient/FXList.cpp | 9 ++- .../GameClient/GUI/ControlBar/ControlBar.cpp | 6 +- .../GUI/ControlBar/ControlBarObserver.cpp | 59 ++++++++++++++++++- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 19 ++++++ .../Source/GameClient/GameClient.cpp | 6 +- .../GameEngine/Source/GameClient/InGameUI.cpp | 15 ++--- .../GameClient/MessageStream/CommandXlat.cpp | 33 +++-------- .../Behavior/PropagandaTowerBehavior.cpp | 7 ++- .../GameLogic/Object/PartitionManager.cpp | 13 ++-- .../Update/AIUpdate/ChinookAIUpdate.cpp | 5 +- .../GameLogic/Object/Update/LaserUpdate.cpp | 3 +- .../Update/ParticleUplinkCannonUpdate.cpp | 3 +- .../Object/Update/SpectreGunshipUpdate.cpp | 4 +- .../Object/Update/StealthDetectorUpdate.cpp | 7 ++- .../GameLogic/Object/Update/StealthUpdate.cpp | 5 +- .../Source/GameLogic/System/GameLogic.cpp | 13 ++-- .../W3DDevice/Common/System/W3DRadar.cpp | 19 +++--- .../Drawable/Draw/W3DScienceModelDraw.cpp | 7 ++- .../W3DDevice/GameClient/W3DPropBuffer.cpp | 3 +- .../Source/W3DDevice/GameClient/W3DScene.cpp | 11 ++-- .../W3DDevice/GameClient/W3DTreeBuffer.cpp | 3 +- .../Source/W3DDevice/GameClient/W3DView.cpp | 3 +- .../W3DDevice/GameLogic/W3DGhostObject.cpp | 2 +- 60 files changed, 434 insertions(+), 186 deletions(-) diff --git a/Core/GameEngine/Include/Common/GameUtility.h b/Core/GameEngine/Include/Common/GameUtility.h index 8d5f979cf5f..63f1cbf417d 100644 --- a/Core/GameEngine/Include/Common/GameUtility.h +++ b/Core/GameEngine/Include/Common/GameUtility.h @@ -20,9 +20,15 @@ // For miscellaneous game utility functions. +class Player; + namespace rts { Bool localPlayerIsObserving(); +Player* getObservedOrLocalPlayer(); ///< Get the current observed or local player. Is never null. + +void changeLocalPlayer(Player* player); //< Change local player during game +void changeObservedPlayer(Player* player); ///< Change observed player during game } // namespace rts diff --git a/Core/GameEngine/Source/Common/Audio/GameSounds.cpp b/Core/GameEngine/Source/Common/Audio/GameSounds.cpp index 3f16318ed92..63519dd4d85 100644 --- a/Core/GameEngine/Source/Common/Audio/GameSounds.cpp +++ b/Core/GameEngine/Source/Common/Audio/GameSounds.cpp @@ -50,6 +50,7 @@ #include "Common/AudioEventInfo.h" #include "Common/AudioEventRTS.h" #include "Common/AudioRequest.h" +#include "Common/GameUtility.h" #include "Common/Player.h" #include "Common/PlayerList.h" @@ -228,9 +229,10 @@ Bool SoundManager::canPlayNow( AudioEventRTS *event ) return false; } - Int localPlayerNdx = ThePlayerList->getLocalPlayer()->getPlayerIndex(); + const Int localPlayerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); + if( (event->getAudioEventInfo()->m_type & ST_SHROUDED) && - ThePartitionManager->getShroudStatusForPlayer(localPlayerNdx, pos) != CELLSHROUD_CLEAR ) + ThePartitionManager->getShroudStatusForPlayer(localPlayerIndex, pos) != CELLSHROUD_CLEAR ) { #ifdef INTENSIVE_AUDIO_DEBUG DEBUG_LOG(("- culled due to shroud.")); diff --git a/Core/GameEngine/Source/Common/GameUtility.cpp b/Core/GameEngine/Source/Common/GameUtility.cpp index 8fff8622f84..e1e5e2cca9d 100644 --- a/Core/GameEngine/Source/Common/GameUtility.cpp +++ b/Core/GameEngine/Source/Common/GameUtility.cpp @@ -21,13 +21,33 @@ #include "Common/GameUtility.h" #include "Common/PlayerList.h" #include "Common/Player.h" +#include "Common/Radar.h" -#include "GameLogic/GameLogic.h" +#include "GameClient/ControlBar.h" +#include "GameClient/GameClient.h" +#include "GameClient/InGameUI.h" +#include "GameClient/ParticleSys.h" +#include "GameLogic/GameLogic.h" +#include "GameLogic/GhostObject.h" +#include "GameLogic/PartitionManager.h" namespace rts { +namespace detail +{ +static void changePlayerCommon(Player* player) +{ + TheParticleSystemManager->setLocalPlayerIndex(player->getPlayerIndex()); + ThePartitionManager->refreshShroudForLocalPlayer(); + TheGhostObjectManager->setLocalPlayerIndex(player->getPlayerIndex()); + TheGameClient->updateFakeDrawables(); + TheInGameUI->deselectAllDrawables(); +} + +} // namespace detail + Bool localPlayerIsObserving() { if (TheGameLogic->isInReplayGame() || TheGameLogic->isInShellGame()) @@ -39,4 +59,29 @@ Bool localPlayerIsObserving() return false; } +Player* getObservedOrLocalPlayer() +{ + Player* player = TheControlBar->getObservedPlayer(); + if (player == NULL) + player = ThePlayerList->getLocalPlayer(); + return player; +} + +void changeLocalPlayer(Player* player) +{ + ThePlayerList->setLocalPlayer(player); + TheControlBar->setControlBarSchemeByPlayer(player); + TheControlBar->initSpecialPowershortcutBar(player); + + detail::changePlayerCommon(player); +} + +void changeObservedPlayer(Player* player) +{ + TheControlBar->setObserverLookAtPlayer(player); + TheControlBar->setObservedPlayer(player); + + detail::changePlayerCommon(player); +} + } // namespace rts diff --git a/Generals/Code/GameEngine/Include/Common/GlobalData.h b/Generals/Code/GameEngine/Include/Common/GlobalData.h index c56d1b48166..30d3cf663bf 100644 --- a/Generals/Code/GameEngine/Include/Common/GlobalData.h +++ b/Generals/Code/GameEngine/Include/Common/GlobalData.h @@ -399,6 +399,10 @@ class GlobalData : public SubsystemInterface Bool m_saveCameraInReplay; Bool m_useCameraInReplay; + // TheSuperHackers @feature xezon 09/09/2025 Enable the shroud and everything related for observing individual players in any game mode. + // Enabling this does have a performance cost because the ghost object manager must keep track of all relevant objects for all players. + Bool m_enablePlayerObserver; + // TheSuperHackers @feature L3-M 05/09/2025 allow the network latency counter and render fps counter font size to be set, a size of zero disables them Int m_networkLatencyFontSize; Int m_renderFpsFontSize; diff --git a/Generals/Code/GameEngine/Include/Common/UserPreferences.h b/Generals/Code/GameEngine/Include/Common/UserPreferences.h index 79d22b3feef..abe79797fb0 100644 --- a/Generals/Code/GameEngine/Include/Common/UserPreferences.h +++ b/Generals/Code/GameEngine/Include/Common/UserPreferences.h @@ -118,6 +118,7 @@ class OptionPreferences : public UserPreferences Real getMoneyTransactionVolume(void) const; Bool saveCameraInReplays(void); Bool useCameraInReplays(void); + Bool getPlayerObserverEnabled() const; Int getStaticGameDetail(void); // detail level selected by the user. Int getIdealStaticGameDetail(void); // detail level detected for user. Real getGammaValue(void); diff --git a/Generals/Code/GameEngine/Include/GameClient/ControlBar.h b/Generals/Code/GameEngine/Include/GameClient/ControlBar.h index 681a46daa0b..dc8d880f688 100644 --- a/Generals/Code/GameEngine/Include/GameClient/ControlBar.h +++ b/Generals/Code/GameEngine/Include/GameClient/ControlBar.h @@ -723,12 +723,16 @@ class ControlBar : public SubsystemInterface // Initialize the Observer controls Must be called after we've already loaded the window void initObserverControls( void ); - void setObserverLookAtPlayer (Player *p) { m_observerLookAtPlayer = p;} - Player *getObserverLookAtPlayer (void ) { return m_observerLookAtPlayer;} void populateObserverInfoWindow ( void ); void populateObserverList( void ); Bool isObserverControlBarOn( void ) { return m_isObserverCommandBar;} + void setObserverLookAtPlayer (Player *player); ///< Sets the looked at player. Used to present information about the player. + Player *getObserverLookAtPlayer (void ) const { return m_observerLookAtPlayer; } ///< Returns the looked at player. Can return null. + + void setObservedPlayer(Player *player); ///< Sets the observed player. Used to present the game world as if that player was the local player. + Player *getObservedPlayer() const { return m_observedPlayer; } ///< Return the observed player. Can return null. + /// Returns the currently viewed player. May return NULL if no player is selected while observing. Player* getCurrentlyViewedPlayer(); /// Returns the relationship with the currently viewed player. May return NEUTRAL if no player is selected while observing. @@ -951,11 +955,12 @@ class ControlBar : public SubsystemInterface Color m_buildUpClockColor; - Bool m_isObserverCommandBar; ///< If this is true, the command bar behaves greatly differnt + Bool m_isObserverCommandBar; ///< If this is true, the command bar behaves greatly different Player *m_observerLookAtPlayer; ///< The current player we're looking at, Null if we're not looking at anyone. + Player *m_observedPlayer; ///< The current player we're observing, Null if we're not observing anyone. WindowLayout *m_buildToolTipLayout; ///< The window that will slide on/display tooltips - Bool m_showBuildToolTipLayout; ///< every frame we test to see if we aregoing to continue showing this or not. + Bool m_showBuildToolTipLayout; ///< every frame we test to see if we are going to continue showing this or not. public: void showBuildTooltipLayout( GameWindow *cmdButton ); void hideBuildTooltipLayout( void ); diff --git a/Generals/Code/GameEngine/Include/GameClient/GameClient.h b/Generals/Code/GameEngine/Include/GameClient/GameClient.h index 7d30b1fbfde..d2aa198e5a6 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GameClient.h +++ b/Generals/Code/GameEngine/Include/GameClient/GameClient.h @@ -114,6 +114,7 @@ class GameClient : public SubsystemInterface, CommandTranslator::CommandEvaluateType cmdType ); void addTextBearingDrawable( Drawable *tbd ); void flushTextBearingDrawables( void); + void updateFakeDrawables(void); virtual void removeFromRayEffects( Drawable *draw ); ///< remove the drawable from the ray effect system if present virtual void getRayEffectData( Drawable *draw, RayEffectData *effectData ); ///< get ray effect data for a drawable diff --git a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp index 28f5250f919..8ad763222e7 100644 --- a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp @@ -932,6 +932,7 @@ GlobalData::GlobalData() m_saveCameraInReplay = FALSE; m_useCameraInReplay = FALSE; + m_enablePlayerObserver = FALSE; m_networkLatencyFontSize = 8; m_renderFpsFontSize = 8; @@ -1185,6 +1186,7 @@ void GlobalData::parseGameDataDefinition( INI* ini ) TheWritableGlobalData->m_saveCameraInReplay = optionPref.saveCameraInReplays(); TheWritableGlobalData->m_useCameraInReplay = optionPref.useCameraInReplays(); + TheWritableGlobalData->m_enablePlayerObserver = optionPref.getPlayerObserverEnabled(); TheWritableGlobalData->m_networkLatencyFontSize = optionPref.getNetworkLatencyFontSize(); TheWritableGlobalData->m_renderFpsFontSize = optionPref.getRenderFpsFontSize(); diff --git a/Generals/Code/GameEngine/Source/Common/System/Radar.cpp b/Generals/Code/GameEngine/Source/Common/System/Radar.cpp index e61684b85cb..e94cf351348 100644 --- a/Generals/Code/GameEngine/Source/Common/System/Radar.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/Radar.cpp @@ -32,6 +32,7 @@ #include "Common/GameAudio.h" #include "Common/GameState.h" +#include "Common/GameUtility.h" #include "Common/MiscAudio.h" #include "Common/Radar.h" #include "Common/Player.h" @@ -421,6 +422,7 @@ RadarObjectType Radar::addObject( Object *obj ) // set color for this object on the radar const Player *player = obj->getControllingPlayer(); + Player *clientPlayer = rts::getObservedOrLocalPlayer(); Bool useIndicatorColor = true; if( obj->isKindOf( KINDOF_DISGUISER ) ) @@ -433,7 +435,6 @@ RadarObjectType Radar::addObject( Object *obj ) { if( update->isDisguised() ) { - Player *clientPlayer = ThePlayerList->getLocalPlayer(); Player *disguisedPlayer = ThePlayerList->getNthPlayer( update->getDisguisedPlayerIndex() ); if( player->getRelationship( clientPlayer->getDefaultTeam() ) != ALLIES && clientPlayer->isPlayerActive() ) { @@ -451,7 +452,7 @@ RadarObjectType Radar::addObject( Object *obj ) { // To handle Stealth garrison, ask containers what color they are drawing with to the local player. // Local is okay because radar display is not synced. - player = obj->getContain()->getApparentControllingPlayer( ThePlayerList->getLocalPlayer() ); + player = obj->getContain()->getApparentControllingPlayer( clientPlayer ); if( player ) useIndicatorColor = false; } @@ -1197,7 +1198,7 @@ void Radar::tryUnderAttackEvent( const Object *obj ) // UI feedback for being under attack (note that we display these messages and audio // queues even if we don't have a radar) // - Player *player = ThePlayerList->getLocalPlayer(); + Player *player = rts::getObservedOrLocalPlayer(); // create a message for the attack event if( obj->isKindOf( KINDOF_INFANTRY ) || obj->isKindOf( KINDOF_VEHICLE ) ) @@ -1228,7 +1229,7 @@ void Radar::tryUnderAttackEvent( const Object *obj ) // play EVA. If its our object, play Base under attack. if (obj->getControllingPlayer()->isLocalPlayer()) TheEva->setShouldPlay(EVA_BaseUnderAttack); - else if (ThePlayerList->getLocalPlayer()->getRelationship(obj->getTeam()) == ALLIES) + else if (player->getRelationship(obj->getTeam()) == ALLIES) TheEva->setShouldPlay(EVA_AllyUnderAttack); // display message @@ -1271,8 +1272,10 @@ void Radar::tryInfiltrationEvent( const Object *obj ) return; } + Player *player = rts::getObservedOrLocalPlayer(); + // We should only be warned against infiltrations that are taking place against us. - if( obj->getControllingPlayer() != ThePlayerList->getLocalPlayer() ) + if( obj->getControllingPlayer() != player ) return; // create the radar event @@ -1284,7 +1287,6 @@ void Radar::tryInfiltrationEvent( const Object *obj ) // UI feedback for being under attack (note that we display these messages and audio // queues even if we don't have a radar) // - Player *player = ThePlayerList->getLocalPlayer(); // display message TheInGameUI->message( "RADAR:Infiltration" ); diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index f8c9bbe9a5c..72e4dfd4ae7 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -39,6 +39,7 @@ #include "Common/GameAudio.h" #include "Common/GameLOD.h" #include "Common/GameState.h" +#include "Common/GameUtility.h" #include "Common/GlobalData.h" #include "Common/ModuleFactory.h" #include "Common/PerfTimer.h" diff --git a/Generals/Code/GameEngine/Source/GameClient/FXList.cpp b/Generals/Code/GameEngine/Source/GameClient/FXList.cpp index 95d33879c79..89bf6fbb7e2 100644 --- a/Generals/Code/GameEngine/Source/GameClient/FXList.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/FXList.cpp @@ -34,6 +34,7 @@ #include "Common/DrawModule.h" #include "Common/GameAudio.h" +#include "Common/GameUtility.h" #include "Common/INI.h" #include "Common/Player.h" #include "Common/PlayerList.h" @@ -803,7 +804,9 @@ void FXList::clear() //------------------------------------------------------------------------------------------------- void FXList::doFXPos(const Coord3D *primary, const Matrix3D* primaryMtx, const Real primarySpeed, const Coord3D *secondary, const Real overrideRadius ) const { - if (ThePartitionManager->getShroudStatusForPlayer(ThePlayerList->getLocalPlayer()->getPlayerIndex(), primary) != CELLSHROUD_CLEAR) + const Int playerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); + + if (ThePartitionManager->getShroudStatusForPlayer(playerIndex, primary) != CELLSHROUD_CLEAR) return; for (FXNuggetList::const_iterator it = m_nuggets.begin(); it != m_nuggets.end(); ++it) @@ -815,7 +818,9 @@ void FXList::doFXPos(const Coord3D *primary, const Matrix3D* primaryMtx, const R //------------------------------------------------------------------------------------------------- void FXList::doFXObj(const Object* primary, const Object* secondary) const { - if (primary && primary->getShroudedStatus(ThePlayerList->getLocalPlayer()->getPlayerIndex()) > OBJECTSHROUD_PARTIAL_CLEAR) + const Int playerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); + + if (primary && primary->getShroudedStatus(playerIndex) > OBJECTSHROUD_PARTIAL_CLEAR) return; //the primary object is fogged or shrouded so don't bother with the effect. for (FXNuggetList::const_iterator it = m_nuggets.begin(); it != m_nuggets.end(); ++it) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 366b5861d73..068ef537737 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -159,8 +159,8 @@ void ControlBar::markUIDirty( void ) Player* ControlBar::getCurrentlyViewedPlayer() { - if (TheControlBar->isObserverControlBarOn()) - return TheControlBar->getObserverLookAtPlayer(); + if (isObserverControlBarOn()) + return getObserverLookAtPlayer(); return ThePlayerList->getLocalPlayer(); } @@ -865,6 +865,7 @@ ControlBar::ControlBar( void ) m_controlBarSchemeManager = NULL; m_isObserverCommandBar = FALSE; m_observerLookAtPlayer = NULL; + m_observedPlayer = NULL; m_buildToolTipLayout = NULL; m_showBuildToolTipLayout = FALSE; @@ -1300,6 +1301,7 @@ void ControlBar::reset( void ) m_isObserverCommandBar = FALSE; // reset us to use a normal command bar m_observerLookAtPlayer = NULL; + m_observedPlayer = NULL; if(m_buildToolTipLayout) m_buildToolTipLayout->hide(TRUE); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp index c9dca76d745..9a53e706509 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp @@ -52,6 +52,7 @@ //----------------------------------------------------------------------------- #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine +#include "Common/GameUtility.h" #include "Common/NameKeyGenerator.h" #include "Common/PlayerList.h" #include "Common/Player.h" @@ -97,6 +98,8 @@ static GameWindow *staticTextNumberOfUnitsKilled = NULL; static GameWindow *staticTextNumberOfUnitsLost = NULL; static GameWindow *staticTextPlayerName = NULL; +static NameKeyType s_replayObserverNameKey = NAMEKEY_INVALID; + //----------------------------------------------------------------------------- // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- @@ -128,6 +131,36 @@ void ControlBar::initObserverControls( void ) buttonIdleWorker = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonIdleWorker")); buttonCancelID = TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonCancel"); + + s_replayObserverNameKey = TheNameKeyGenerator->nameToKey("ReplayObserver"); +} + +//------------------------------------------------------------------------------------------------- +void ControlBar::setObserverLookAtPlayer(Player *player) +{ + if (player == ThePlayerList->findPlayerWithNameKey(s_replayObserverNameKey)) + { + // Looking at the observer. Treat as not looking at player. + m_observerLookAtPlayer = NULL; + } + else + { + m_observerLookAtPlayer = player; + } +} + +//------------------------------------------------------------------------------------------------- +void ControlBar::setObservedPlayer(Player *player) +{ + if (player == ThePlayerList->findPlayerWithNameKey(s_replayObserverNameKey)) + { + // Looking at the observer. Treat as not observing player. + m_observedPlayer = NULL; + } + else + { + m_observedPlayer = player; + } } //------------------------------------------------------------------------------------------------- @@ -163,22 +196,42 @@ WindowMsgHandledType ControlBarObserverSystem( GameWindow *window, UnsignedInt m Int controlID = control->winGetWindowId(); if( controlID == buttonCancelID) { - TheControlBar->setObserverLookAtPlayer(NULL); + if (TheGlobalData->m_enablePlayerObserver || TheControlBar->getObservedPlayer() != NULL) + { + Player* observerPlayer = ThePlayerList->findPlayerWithNameKey(s_replayObserverNameKey); + rts::changeObservedPlayer(observerPlayer); + } + else + { + TheControlBar->setObserverLookAtPlayer(NULL); + } + ObserverPlayerInfoWindow->winHide(TRUE); ObserverPlayerListWindow->winHide(FALSE); buttonIdleWorker->winHide(TRUE); TheControlBar->populateObserverList(); - } + for(Int i = 0; i winHide(FALSE); ObserverPlayerListWindow->winHide(TRUE); - TheControlBar->setObserverLookAtPlayer((Player *) GadgetButtonGetData( buttonPlayer[i])); + Player* player = reinterpret_cast(GadgetButtonGetData(buttonPlayer[i])); + + if (TheGlobalData->m_enablePlayerObserver) + { + rts::changeObservedPlayer(player); + } + else + { + TheControlBar->setObserverLookAtPlayer(player); + } + if(TheControlBar->getObserverLookAtPlayer()) TheControlBar->populateObserverInfoWindow(); + return MSG_HANDLED; } } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index 66914476a5c..d884d867e01 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -492,6 +492,18 @@ Bool OptionPreferences::useCameraInReplays(void) return FALSE; } +Bool OptionPreferences::getPlayerObserverEnabled() const +{ + OptionPreferences::const_iterator it = find("PlayerObserverEnabled"); + if (it == end()) + return TRUE; + + if (stricmp(it->second.str(), "yes") == 0) + return TRUE; + + return FALSE; +} + Int OptionPreferences::getIdealStaticGameDetail(void) { OptionPreferences::const_iterator it = find("IdealStaticGameLOD"); @@ -1277,6 +1289,13 @@ static void saveOptions( void ) TheLookAtTranslator->setScreenEdgeScrollMode(mode); } + // TheSuperHackers @todo Add checkbox ? + { + Bool enabled = pref->getPlayerObserverEnabled(); + (*pref)["PlayerObserverEnabled"] = enabled ? "yes" : "no"; + TheWritableGlobalData->m_enablePlayerObserver = enabled; + } + //------------------------------------------------------------------------------------------------- // scroll speed val val = GadgetSliderGetPosition(sliderScrollSpeed); diff --git a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp index 29c5eefeaa8..b78d2e9d50e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -35,6 +35,7 @@ #include "Common/ActionManager.h" #include "Common/GameEngine.h" #include "Common/GameState.h" +#include "Common/GameUtility.h" #include "Common/GlobalData.h" #include "Common/PerfTimer.h" #include "Common/Player.h" @@ -600,7 +601,8 @@ void GameClient::update( void ) } const Bool freezeTime = TheGameEngine->isTimeFrozen() || TheGameEngine->isGameHalted(); - Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0; + + const Int localPlayerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); if (!freezeTime) { @@ -769,6 +771,13 @@ void GameClient::iterateDrawablesInRegion( Region3D *region, GameClientFuncPtr u } } +/**Helper function to update fake GLA structures to become visible to certain players. +We should only call this during critical moments, such as changing teams, changing to +observer, etc.*/ +void GameClient::updateFakeDrawables(void) +{ +} + /** ----------------------------------------------------------------------------------------------- * Given an object id, return the associated object. * For efficiency, a small Least Recently Used cache is incorporated. diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index 0cd5764c2a6..c421b253250 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -35,6 +35,7 @@ #include "Common/FramePacer.h" #include "Common/GameAudio.h" #include "Common/GameType.h" +#include "Common/GameUtility.h" #include "Common/MessageStream.h" #include "Common/PerfTimer.h" #include "Common/Player.h" @@ -2518,7 +2519,7 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) else tooltip = str; - Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0; + const Int localPlayerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); Int x, y; ThePartitionManager->worldToCell(obj->getPosition()->x, obj->getPosition()->y, &x, &y); @@ -2620,7 +2621,7 @@ void InGameUI::createCommandHint( const GameMessage *msg ) if( draw && (t == GameMessage::MSG_DO_ATTACK_OBJECT_HINT || t == GameMessage::MSG_DO_ATTACK_OBJECT_AFTER_MOVING_HINT) ) { const Object* obj = draw->getObject(); - Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0; + const Int localPlayerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); #if ENABLE_CONFIGURABLE_SHROUD ObjectShroudStatus ss = (!obj || !TheGlobalData->m_shroudOn) ? OBJECTSHROUD_CLEAR : obj->getShroudedStatus(localPlayerIndex); #else @@ -5116,7 +5117,7 @@ void InGameUI::updateFloatingText( void ) } //------------------------------------------------------------------------------------------------- -/** Itterates through and draws each floating text */ +/** Iterates through and draws each floating text */ //------------------------------------------------------------------------------------------------- void InGameUI::drawFloatingText( void ) { @@ -5126,8 +5127,7 @@ void InGameUI::drawFloatingText( void ) { ftd = *it; ICoord2D pos; - // get the local player's index - Int playerNdx = ThePlayerList->getLocalPlayer()->getPlayerIndex(); + const Int playerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); // which PartitionManager cells are we looking at? Int pCX, pCY; @@ -5136,7 +5136,7 @@ void InGameUI::drawFloatingText( void ) // translate it's 3d pos into a 2d screen pos if( TheTacticalView->worldToScreen(&ftd->m_pos3D, &pos) && ftd->m_dString - && ThePartitionManager->getShroudStatusForPlayer(playerNdx, pCX, pCY) == CELLSHROUD_CLEAR ) + && ThePartitionManager->getShroudStatusForPlayer(playerIndex, pCX, pCY) == CELLSHROUD_CLEAR ) { pos.y -= ftd->m_frameCount * m_floatingTextMoveUpSpeed; Color dropColor; @@ -5394,7 +5394,8 @@ void InGameUI::updateAndDrawWorldAnimations( void ) // don't bother going forward with the draw process if this location is shrouded for // the local player // - Int playerIndex = ThePlayerList->getLocalPlayer()->getPlayerIndex(); + const Int playerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); + if( ThePartitionManager->getShroudStatusForPlayer( playerIndex, &wad->m_worldPos ) != CELLSHROUD_CLEAR ) { diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 678cd666533..2e791bb8338 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -36,6 +36,7 @@ #include "Common/GameAudio.h" #include "Common/GameEngine.h" #include "Common/GameType.h" +#include "Common/GameUtility.h" #include "Common/GlobalData.h" #include "Common/MessageStream.h" #include "Common/MiscAudio.h" @@ -3724,14 +3725,8 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } while (ThePlayerList->getNthPlayer(idx) == ThePlayerList->getNeutralPlayer()); - ThePlayerList->setLocalPlayer(ThePlayerList->getNthPlayer(idx)); - TheInGameUI->deselectAllDrawables(); -#ifdef DEBUG_FOG_MEMORY - TheGhostObjectManager->setLocalPlayerIndex(idx); -#endif - ThePartitionManager->refreshShroudForLocalPlayer(); - TheControlBar->initSpecialPowershortcutBar(ThePlayerList->getLocalPlayer()); - TheControlBar->setControlBarSchemeByPlayer(ThePlayerList->getLocalPlayer()); + Player* player = ThePlayerList->getNthPlayer(idx); + rts::changeLocalPlayer(player); } disp = DESTROY_MESSAGE; break; @@ -3752,11 +3747,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage Player *pt = ThePlayerList->getNthPlayer(i); if(pt->getSide().compareNoCase("China") == 0) { - ThePlayerList->setLocalPlayer(pt); - TheInGameUI->deselectAllDrawables(); - ThePartitionManager->refreshShroudForLocalPlayer(); - TheControlBar->setControlBarSchemeByPlayer(ThePlayerList->getLocalPlayer()); - + rts::changeLocalPlayer(pt); break; } } @@ -3769,10 +3760,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage Player *pt = ThePlayerList->getNthPlayer(i); if(pt->getSide().compareNoCase("America") == 0) { - ThePlayerList->setLocalPlayer(pt); - TheInGameUI->deselectAllDrawables(); - ThePartitionManager->refreshShroudForLocalPlayer(); - TheControlBar->setControlBarSchemeByPlayer(ThePlayerList->getLocalPlayer()); + rts::changeLocalPlayer(pt); break; } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp index f10dd04960a..8b940b7d2ab 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp @@ -30,6 +30,7 @@ // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include "PreRTS.h" #include "Common/GameState.h" +#include "Common/GameUtility.h" #include "Common/Player.h" #include "Common/PlayerList.h" #include "Common/Upgrade.h" diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index c66f797ea30..af742aa8ff7 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -53,6 +53,7 @@ #include "Common/DiscreteCircle.h" #include "Common/GameEngine.h" #include "Common/GameState.h" +#include "Common/GameUtility.h" #include "Common/MessageStream.h" #include "Common/NameKeyGenerator.h" #include "Common/PerfTimer.h" @@ -1289,7 +1290,7 @@ void PartitionCell::addLooker(Int playerIndex) // On an edge trigger, tell all objects to think about their shroudedness invalidateShroudedStatusForAllCois( playerIndex ); - if( playerIndex == ThePlayerList->getLocalPlayer()->getPlayerIndex() ) + if( playerIndex == rts::getObservedOrLocalPlayer()->getPlayerIndex() ) { // and if this is the local player, do the Client update. TheDisplay->setShroudLevel(m_cellX, m_cellY, newShroud); @@ -1325,7 +1326,7 @@ void PartitionCell::removeLooker(Int playerIndex) // On an edge trigger, tell all objects to think about their shroudedness invalidateShroudedStatusForAllCois( playerIndex ); - if( playerIndex == ThePlayerList->getLocalPlayer()->getPlayerIndex() ) + if( playerIndex == rts::getObservedOrLocalPlayer()->getPlayerIndex() ) { // and if this is the local player, do the Client update. TheDisplay->setShroudLevel(m_cellX, m_cellY, newShroud); @@ -1353,7 +1354,7 @@ void PartitionCell::addShrouder( Int playerIndex ) invalidateShroudedStatusForAllCois( playerIndex ); // and update the client if we are on the local player - if( playerIndex == ThePlayerList->getLocalPlayer()->getPlayerIndex() ) + if( playerIndex == rts::getObservedOrLocalPlayer()->getPlayerIndex() ) { TheDisplay->setShroudLevel(m_cellX, m_cellY, newShroud); TheRadar->setShroudLevel(m_cellX, m_cellY, newShroud); @@ -2796,7 +2797,7 @@ void PartitionManager::update() Int cellCount = m_cellCountX * m_cellCountY; for (int i = 0; i < cellCount; ++i) { - UnsignedInt threat = m_cells[i].getThreatValue(ThePlayerList->getLocalPlayer()->getPlayerIndex()); + UnsignedInt threat = m_cells[i].getThreatValue(rts::getObservedOrLocalPlayer()->getPlayerIndex()); if (threat > 0) { Real threatMul = INT_TO_REAL(threat) / TheGlobalData->m_maxDebugThreat; @@ -2826,7 +2827,7 @@ void PartitionManager::update() Int cellCount = m_cellCountX * m_cellCountY; for (int i = 0; i < cellCount; ++i) { - UnsignedInt value = m_cells[i].getCashValue(ThePlayerList->getLocalPlayer()->getPlayerIndex()); + UnsignedInt value = m_cells[i].getCashValue(rts::getObservedOrLocalPlayer()->getPlayerIndex()); if (value > 0) { Real valueMul = INT_TO_REAL(value) / TheGlobalData->m_maxDebugValue; @@ -3050,7 +3051,7 @@ void PartitionManager::refreshShroudForLocalPlayer() TheDisplay->clearShroud(); TheRadar->clearShroud(); - Int playerIndex = ThePlayerList->getLocalPlayer()->getPlayerIndex(); + const Int playerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); for (int i = 0; i < m_totalCellCount; ++i) { Int x = m_cells[i].getCellX(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index c1d3fb03e85..7c13cab791c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -31,6 +31,7 @@ #include "Common/ActionManager.h" #include "Common/DrawModule.h" #include "Common/GameState.h" +#include "Common/GameUtility.h" #include "Common/GlobalData.h" #include "Common/RandomValue.h" #include "Common/Team.h" diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp index ddfa4917ebb..7054b881f1c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp @@ -30,6 +30,7 @@ // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine +#include "Common/GameUtility.h" #include "Common/Xfer.h" #include "Common/DrawModule.h" #include "GameClient/Drawable.h" diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp index 88b67ce4e50..8c626727cd3 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp @@ -33,6 +33,7 @@ #define DEFINE_DEATH_NAMES // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// +#include "Common/GameUtility.h" #include "Common/ThingTemplate.h" #include "Common/ThingFactory.h" #include "Common/Player.h" @@ -704,7 +705,7 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update() } //Handle shrouded status changes for the client player. - Player *localPlayer = ThePlayerList->getLocalPlayer(); + Player *localPlayer = rts::getObservedOrLocalPlayer(); if( localPlayer ) { Bool shrouded = me->getShroudedStatus( localPlayer->getPlayerIndex() ) != OBJECTSHROUD_CLEAR; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp index c3fa866afae..68352f204f7 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp @@ -32,6 +32,7 @@ #define DEFINE_STEALTHLEVEL_NAMES // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// +#include "Common/GameUtility.h" #include "Common/MiscAudio.h" #include "Common/Radar.h" #include "Common/ThingTemplate.h" @@ -217,7 +218,7 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) { // for the player revealing the stealth unit do some UI feedback - if( ThePlayerList->getLocalPlayer() == self->getControllingPlayer() && + if( rts::getObservedOrLocalPlayer() == self->getControllingPlayer() && self->getRelationship( them ) != ALLIES ) { Bool doFeedback = TRUE; @@ -247,7 +248,7 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) } // for the unit being revealed, do some UI feedback - if( ThePlayerList->getLocalPlayer() == them->getControllingPlayer() && + if( rts::getObservedOrLocalPlayer() == them->getControllingPlayer() && self->getRelationship( them ) != ALLIES ) { Bool doFeedback = TRUE; @@ -334,8 +335,11 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) } } + + const Player *localPlayer = rts::getObservedOrLocalPlayer(); + //Make sure the detector is visible to the local player before we add effects or sounds. - if (data->m_IRGridParticleSysTmpl && self->getShroudedStatus(ThePlayerList->getLocalPlayer()->getPlayerIndex()) <= OBJECTSHROUD_PARTIAL_CLEAR) + if (data->m_IRGridParticleSysTmpl && self->getShroudedStatus(localPlayer->getPlayerIndex()) <= OBJECTSHROUD_PARTIAL_CLEAR) { Drawable *myDraw = self->getDrawable(); Coord3D bonePosition = {-1.66f,5.5f,15};//@todo use bone position diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp index ca34b598f1e..661375a25dd 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp @@ -34,6 +34,7 @@ // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include "Common/GameState.h" +#include "Common/GameUtility.h" #include "Common/Player.h" #include "Common/PlayerList.h" #include "Common/Radar.h" @@ -218,7 +219,7 @@ void StealthUpdate::hintDetectableWhileUnstealthed() if( self && md->m_hintDetectableStates.testForAny( self->getStatusBits() ) ) { - if ( self->getControllingPlayer() == ThePlayerList->getLocalPlayer() ) + if ( self->getControllingPlayer() == rts::getObservedOrLocalPlayer() ) { Drawable *selfDraw = self->getDrawable(); if ( selfDraw ) @@ -556,7 +557,7 @@ UpdateSleepTime StealthUpdate::update( void ) if (draw) { - StealthLookType stealthLook = calcStealthedStatusForPlayer( self, ThePlayerList->getLocalPlayer() ); + StealthLookType stealthLook = calcStealthedStatusForPlayer( self, rts::getObservedOrLocalPlayer() ); draw->setStealthLook( stealthLook ); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index fec53639343..4d3774bc570 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -37,6 +37,7 @@ #include "Common/GameAudio.h" #include "Common/GameEngine.h" #include "Common/GameState.h" +#include "Common/GameUtility.h" #include "Common/INI.h" #include "Common/LatchRestore.h" #include "Common/MapObject.h" @@ -70,7 +71,6 @@ #include "GameClient/Mouse.h" #include "GameClient/ParticleSys.h" #include "GameClient/View.h" -#include "GameClient/ControlBar.h" #include "GameClient/CampaignManager.h" #include "GameClient/GameWindowTransitions.h" @@ -1994,15 +1994,17 @@ void GameLogic::startNewGame( Bool saveGame ) // explicitly set the Control bar to Observer Mode if(m_gameMode == GAME_REPLAY ) { - - ThePlayerList->setLocalPlayer(ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey("ReplayObserver"))); + Player* observerPlayer = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey("ReplayObserver")); + rts::changeLocalPlayer(observerPlayer); TheRadar->forceOn(TRUE); - ThePartitionManager->refreshShroudForLocalPlayer(); - TheControlBar->setControlBarSchemeByPlayer( ThePlayerList->getLocalPlayer()); + DEBUG_LOG(("Start of a replay game %ls, %d",ThePlayerList->getLocalPlayer()->getPlayerDisplayName().str(), ThePlayerList->getLocalPlayer()->getPlayerIndex())); } else + { TheControlBar->setControlBarSchemeByPlayer(ThePlayerList->getLocalPlayer()); + TheControlBar->initSpecialPowershortcutBar(ThePlayerList->getLocalPlayer()); + } // ShowControlBar(); } @@ -2053,7 +2055,6 @@ void GameLogic::startNewGame( Bool saveGame ) } } } - TheControlBar->initSpecialPowershortcutBar(ThePlayerList->getLocalPlayer()); if(m_gameMode == GAME_SHELL) { diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp index 098dfbc14bd..9d8ea110d2f 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp @@ -32,6 +32,7 @@ #include "Common/AudioEventRTS.h" #include "Common/Debug.h" #include "Common/GlobalData.h" +#include "Common/GameUtility.h" #include "Common/Player.h" #include "Common/PlayerList.h" @@ -628,10 +629,8 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text // loop through all objects and draw ICoord2D radarPoint; - Player *player = ThePlayerList->getLocalPlayer(); - Int playerIndex=0; - if (player) - playerIndex=player->getPlayerIndex(); + Player *player = rts::getObservedOrLocalPlayer(); + const Int playerIndex = player->getPlayerIndex(); if( calcHero ) { @@ -1399,7 +1398,7 @@ void W3DRadar::draw( Int pixelX, Int pixelY, Int width, Int height ) { // if the local player does not have a radar then we can't draw anything - Player *player = ThePlayerList->getLocalPlayer(); + Player *player = rts::getObservedOrLocalPlayer(); if( !player->hasRadar() && !TheRadar->isRadarForced() ) return; @@ -1523,10 +1522,8 @@ void W3DRadar::refreshTerrain( TerrainLogic *terrain ) // loop through all objects and draw ICoord2D radarPoint; - Player *player = ThePlayerList->getLocalPlayer(); - Int playerIndex=0; - if (player) - playerIndex=player->getPlayerIndex(); + Player *player = rts::getObservedOrLocalPlayer(); + const Int playerIndex = player->getPlayerIndex(); UnsignedByte minAlpha = 8; @@ -1557,8 +1554,8 @@ void W3DRadar::refreshTerrain( TerrainLogic *terrain ) // they are godlike and can see everything) // if( obj->getRadarPriority() == RADAR_PRIORITY_LOCAL_UNIT_ONLY && - obj->getControllingPlayer() != ThePlayerList->getLocalPlayer() && - ThePlayerList->getLocalPlayer()->isPlayerActive() ) + obj->getControllingPlayer() != player && + player->isPlayerActive() ) continue; UnsignedByte g = c|a; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp index 776bcde3160..e809aac0331 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp @@ -29,6 +29,7 @@ #include "W3DDevice/GameClient/Module/W3DScienceModelDraw.h" +#include "Common/GameUtility.h" #include "Common/Player.h" #include "Common/PlayerList.h" #include "Common/Science.h" @@ -82,9 +83,9 @@ void W3DScienceModelDraw::doDrawModule(const Matrix3D* transformMtx) return; } - if( !ThePlayerList->getLocalPlayer()->hasScience(science) - && ThePlayerList->getLocalPlayer()->isPlayerActive() - ) + Player* player = rts::getObservedOrLocalPlayer(); + + if( !player->hasScience(science) && player->isPlayerActive() ) { // We just don't draw for people without our science except for Observers setHidden( TRUE ); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp index a20c12bc111..0b792eaed86 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp @@ -36,6 +36,7 @@ // USER INCLUDES ////////////////////////////////////////////////////////////// #include "Lib/BaseType.h" +#include "Common/GameUtility.h" #include "Common/GlobalData.h" #include "Common/PerfTimer.h" #include "Common/Player.h" @@ -512,7 +513,7 @@ void RTS3DScene::renderSpecificDrawables(RenderInfoClass &rinfo, Int numDrawable #ifdef DIRTY_CONDITION_FLAGS StDrawableDirtyStuffLocker lockDirtyStuff; #endif - Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0; + const Int localPlayerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); RefRenderObjListIterator it(&UpdateList); // loop through all render objects in the list: for (it.First(&RenderList); !it.Is_Done();) @@ -1040,7 +1041,7 @@ void RTS3DScene::Customized_Render( RenderInfoClass &rinfo ) m_translucentObjectsCount = 0; //start of new frame so no translucent objects m_occludedObjectsCount = 0; - Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0; + const Int localPlayerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); #define USE_LIGHT_ENV 1 @@ -1291,7 +1292,7 @@ void RTS3DScene::flushOccludedObjectsIntoStencil(RenderInfoClass & rinfo) //Assume no player colors are visible and all stencil bits are free for use by shadows. TheW3DShadowManager->setStencilShadowMask(0); - Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0; + const Int localPlayerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); if (m_numPotentialOccludees && m_numPotentialOccluders) { @@ -1469,7 +1470,7 @@ void RTS3DScene::flushOccludedObjects(RenderInfoClass & rinfo) if (m_occludedObjectsCount) { - Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0; + const Int localPlayerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); if (DX8Wrapper::Has_Stencil()) //just in case we have shadows, disable them over occluded pixels. { @@ -1539,7 +1540,7 @@ void RTS3DScene::flushTranslucentObjects(RenderInfoClass & rinfo) if (m_translucentObjectsCount) { - Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0; + const Int localPlayerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); for (Int i=0; i #include #include +#include "Common/GameUtility.h" #include "Common/GlobalData.h" #include "GameClient/ClientRandomValue.h" #include "W3DDevice/GameClient/TerrainTex.h" diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 538368eface..99a6c908420 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -39,6 +39,7 @@ // USER INCLUDES ////////////////////////////////////////////////////////////////////////////////// #include "Common/BuildAssistant.h" #include "Common/FramePacer.h" +#include "Common/GameUtility.h" #include "Common/GlobalData.h" #include "Common/Module.h" #include "Common/RandomValue.h" @@ -838,7 +839,7 @@ static void drawablePostDraw( Drawable *draw, void *userData ) return; Object* obj = draw->getObject(); - Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0; + const Int localPlayerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); #if ENABLE_CONFIGURABLE_SHROUD ObjectShroudStatus ss = (!obj || !TheGlobalData->m_shroudOn) ? OBJECTSHROUD_CLEAR : obj->getShroudedStatus(localPlayerIndex); #else diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index 8781a1779ca..3e54f12d451 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -730,7 +730,7 @@ void W3DGhostObject::xfer( Xfer *xfer ) // in the world, we need to remove it // if( m_parentObject && - m_parentSnapshots[ ThePlayerList->getLocalPlayer()->getPlayerIndex() ] != NULL && + m_parentSnapshots[TheGhostObjectManager->getLocalPlayerIndex()] != NULL && xfer->getXferMode() == XFER_LOAD ) removeParentObject(); diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h index 7bb3e5a0b4c..60573a5ab9f 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h @@ -407,6 +407,10 @@ class GlobalData : public SubsystemInterface Bool m_saveCameraInReplay; Bool m_useCameraInReplay; + // TheSuperHackers @feature xezon 09/09/2025 Enable the shroud and everything related for observing individual players in any game mode. + // Enabling this does have a performance cost because the ghost object manager must keep track of all relevant objects for all players. + Bool m_enablePlayerObserver; + // TheSuperHackers @feature L3-M 05/09/2025 allow the network latency counter and render fps counter font size to be set, a size of zero disables them Int m_networkLatencyFontSize; Int m_renderFpsFontSize; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h b/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h index 49bd0cbf3ab..b62a0afbe29 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h @@ -121,6 +121,7 @@ class OptionPreferences : public UserPreferences Real getMoneyTransactionVolume(void) const; Bool saveCameraInReplays(void); Bool useCameraInReplays(void); + Bool getPlayerObserverEnabled() const; Int getStaticGameDetail(void); // detail level selected by the user. Int getIdealStaticGameDetail(void); // detail level detected for user. Real getGammaValue(void); diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h index 077d845ab02..770a70f4e51 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h @@ -737,12 +737,16 @@ class ControlBar : public SubsystemInterface // Initialize the Observer controls Must be called after we've already loaded the window void initObserverControls( void ); - void setObserverLookAtPlayer (Player *p) { m_observerLookAtPlayer = p;} - Player *getObserverLookAtPlayer (void ) { return m_observerLookAtPlayer;} void populateObserverInfoWindow ( void ); void populateObserverList( void ); Bool isObserverControlBarOn( void ) { return m_isObserverCommandBar;} + void setObserverLookAtPlayer (Player *player); ///< Sets the looked at player. Used to present information about the player. + Player *getObserverLookAtPlayer (void ) const { return m_observerLookAtPlayer; } ///< Returns the looked at player. Can return null. + + void setObservedPlayer(Player *player); ///< Sets the observed player. Used to present the game world as if that player was the local player. + Player *getObservedPlayer() const { return m_observedPlayer; } ///< Return the observed player. Can return null. + /// Returns the currently viewed player. May return NULL if no player is selected while observing. Player* getCurrentlyViewedPlayer(); /// Returns the relationship with the currently viewed player. May return NEUTRAL if no player is selected while observing. @@ -971,11 +975,12 @@ class ControlBar : public SubsystemInterface Color m_buildUpClockColor; - Bool m_isObserverCommandBar; ///< If this is true, the command bar behaves greatly differnt + Bool m_isObserverCommandBar; ///< If this is true, the command bar behaves greatly different Player *m_observerLookAtPlayer; ///< The current player we're looking at, Null if we're not looking at anyone. + Player *m_observedPlayer; ///< The current player we're observing, Null if we're not observing anyone. WindowLayout *m_buildToolTipLayout; ///< The window that will slide on/display tooltips - Bool m_showBuildToolTipLayout; ///< every frame we test to see if we aregoing to continue showing this or not. + Bool m_showBuildToolTipLayout; ///< every frame we test to see if we are going to continue showing this or not. public: void showBuildTooltipLayout( GameWindow *cmdButton ); void hideBuildTooltipLayout( void ); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp index bc4ac4f2bbe..264a0ddab8c 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp @@ -941,6 +941,7 @@ GlobalData::GlobalData() m_saveCameraInReplay = FALSE; m_useCameraInReplay = FALSE; + m_enablePlayerObserver = FALSE; m_networkLatencyFontSize = 8; m_renderFpsFontSize = 8; @@ -1213,6 +1214,7 @@ void GlobalData::parseGameDataDefinition( INI* ini ) TheWritableGlobalData->m_saveCameraInReplay = optionPref.saveCameraInReplays(); TheWritableGlobalData->m_useCameraInReplay = optionPref.useCameraInReplays(); + TheWritableGlobalData->m_enablePlayerObserver = optionPref.getPlayerObserverEnabled(); TheWritableGlobalData->m_networkLatencyFontSize = optionPref.getNetworkLatencyFontSize(); TheWritableGlobalData->m_renderFpsFontSize = optionPref.getRenderFpsFontSize(); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/Radar.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/Radar.cpp index 5408d7e4fb6..09f9fabce7f 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/Radar.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/Radar.cpp @@ -32,6 +32,7 @@ #include "Common/GameAudio.h" #include "Common/GameState.h" +#include "Common/GameUtility.h" #include "Common/MiscAudio.h" #include "Common/Radar.h" #include "Common/Player.h" @@ -424,6 +425,7 @@ RadarObjectType Radar::addObject( Object *obj ) // set color for this object on the radar const Player *player = obj->getControllingPlayer(); + Player *clientPlayer = rts::getObservedOrLocalPlayer(); Bool useIndicatorColor = true; if( obj->isKindOf( KINDOF_DISGUISER ) ) @@ -436,7 +438,6 @@ RadarObjectType Radar::addObject( Object *obj ) { if( update->isDisguised() ) { - Player *clientPlayer = ThePlayerList->getLocalPlayer(); Player *disguisedPlayer = ThePlayerList->getNthPlayer( update->getDisguisedPlayerIndex() ); if( player->getRelationship( clientPlayer->getDefaultTeam() ) != ALLIES && clientPlayer->isPlayerActive() ) { @@ -454,7 +455,7 @@ RadarObjectType Radar::addObject( Object *obj ) { // To handle Stealth garrison, ask containers what color they are drawing with to the local player. // Local is okay because radar display is not synced. - player = obj->getContain()->getApparentControllingPlayer( ThePlayerList->getLocalPlayer() ); + player = obj->getContain()->getApparentControllingPlayer( clientPlayer ); if( player ) useIndicatorColor = false; } @@ -1200,7 +1201,7 @@ void Radar::tryUnderAttackEvent( const Object *obj ) // UI feedback for being under attack (note that we display these messages and audio // queues even if we don't have a radar) // - Player *player = ThePlayerList->getLocalPlayer(); + Player *player = rts::getObservedOrLocalPlayer(); // create a message for the attack event if( obj->isKindOf( KINDOF_INFANTRY ) || obj->isKindOf( KINDOF_VEHICLE ) ) @@ -1231,7 +1232,7 @@ void Radar::tryUnderAttackEvent( const Object *obj ) // play EVA. If its our object, play Base under attack. if (obj->getControllingPlayer()->isLocalPlayer()) TheEva->setShouldPlay(EVA_BaseUnderAttack); - else if (ThePlayerList->getLocalPlayer()->getRelationship(obj->getTeam()) == ALLIES) + else if (player->getRelationship(obj->getTeam()) == ALLIES) TheEva->setShouldPlay(EVA_AllyUnderAttack); // display message @@ -1274,8 +1275,10 @@ void Radar::tryInfiltrationEvent( const Object *obj ) return; } + Player *player = rts::getObservedOrLocalPlayer(); + // We should only be warned against infiltrations that are taking place against us. - if( obj->getControllingPlayer() != ThePlayerList->getLocalPlayer() ) + if( obj->getControllingPlayer() != player ) return; // create the radar event @@ -1287,7 +1290,6 @@ void Radar::tryInfiltrationEvent( const Object *obj ) // UI feedback for being under attack (note that we display these messages and audio // queues even if we don't have a radar) // - Player *player = ThePlayerList->getLocalPlayer(); // display message TheInGameUI->message( "RADAR:Infiltration" ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index ed091e87c8c..cfbc46194d1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -40,6 +40,7 @@ #include "Common/GameAudio.h" #include "Common/GameLOD.h" #include "Common/GameState.h" +#include "Common/GameUtility.h" #include "Common/GlobalData.h" #include "Common/ModuleFactory.h" #include "Common/PerfTimer.h" @@ -4162,7 +4163,7 @@ void Drawable::friend_bindToObject( Object *obj ) ///< bind this drawable to an if (getObject()->isKindOf(KINDOF_FS_FAKE)) { - Relationship rel=ThePlayerList->getLocalPlayer()->getRelationship(getObject()->getTeam()); + Relationship rel = rts::getObservedOrLocalPlayer()->getRelationship(getObject()->getTeam()); if (rel == ALLIES || rel == NEUTRAL) setTerrainDecal(TERRAIN_DECAL_SHADOW_TEXTURE); else @@ -4200,7 +4201,7 @@ void Drawable::changedTeam() if (object->isKindOf(KINDOF_FS_FAKE)) { - Relationship rel=ThePlayerList->getLocalPlayer()->getRelationship(object->getTeam()); + Relationship rel = rts::getObservedOrLocalPlayer()->getRelationship(object->getTeam()); if (rel == ALLIES || rel == NEUTRAL) setTerrainDecal(TERRAIN_DECAL_SHADOW_TEXTURE); else diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp index 125b16c72f7..980ef22797d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp @@ -34,6 +34,7 @@ #include "Common/DrawModule.h" #include "Common/GameAudio.h" +#include "Common/GameUtility.h" #include "Common/INI.h" #include "Common/Player.h" #include "Common/PlayerList.h" @@ -803,7 +804,9 @@ void FXList::clear() //------------------------------------------------------------------------------------------------- void FXList::doFXPos(const Coord3D *primary, const Matrix3D* primaryMtx, const Real primarySpeed, const Coord3D *secondary, const Real overrideRadius ) const { - if (ThePartitionManager->getShroudStatusForPlayer(ThePlayerList->getLocalPlayer()->getPlayerIndex(), primary) != CELLSHROUD_CLEAR) + const Int playerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); + + if (ThePartitionManager->getShroudStatusForPlayer(playerIndex, primary) != CELLSHROUD_CLEAR) return; for (FXNuggetList::const_iterator it = m_nuggets.begin(); it != m_nuggets.end(); ++it) @@ -815,7 +818,9 @@ void FXList::doFXPos(const Coord3D *primary, const Matrix3D* primaryMtx, const R //------------------------------------------------------------------------------------------------- void FXList::doFXObj(const Object* primary, const Object* secondary) const { - if (primary && primary->getShroudedStatus(ThePlayerList->getLocalPlayer()->getPlayerIndex()) > OBJECTSHROUD_PARTIAL_CLEAR) + const Int playerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); + + if (primary && primary->getShroudedStatus(playerIndex) > OBJECTSHROUD_PARTIAL_CLEAR) return; //the primary object is fogged or shrouded so don't bother with the effect. for (FXNuggetList::const_iterator it = m_nuggets.begin(); it != m_nuggets.end(); ++it) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 5064ac7afe2..efce005ebd3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -160,8 +160,8 @@ void ControlBar::markUIDirty( void ) Player* ControlBar::getCurrentlyViewedPlayer() { - if (TheControlBar->isObserverControlBarOn()) - return TheControlBar->getObserverLookAtPlayer(); + if (isObserverControlBarOn()) + return getObserverLookAtPlayer(); return ThePlayerList->getLocalPlayer(); } @@ -888,6 +888,7 @@ ControlBar::ControlBar( void ) m_controlBarSchemeManager = NULL; m_isObserverCommandBar = FALSE; m_observerLookAtPlayer = NULL; + m_observedPlayer = NULL; m_buildToolTipLayout = NULL; m_showBuildToolTipLayout = FALSE; @@ -1323,6 +1324,7 @@ void ControlBar::reset( void ) m_isObserverCommandBar = FALSE; // reset us to use a normal command bar m_observerLookAtPlayer = NULL; + m_observedPlayer = NULL; if(m_buildToolTipLayout) m_buildToolTipLayout->hide(TRUE); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp index 15873ceb3ee..cb040902a2e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp @@ -52,6 +52,7 @@ //----------------------------------------------------------------------------- #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine +#include "Common/GameUtility.h" #include "Common/NameKeyGenerator.h" #include "Common/PlayerList.h" #include "Common/Player.h" @@ -97,6 +98,8 @@ static GameWindow *staticTextNumberOfUnitsKilled = NULL; static GameWindow *staticTextNumberOfUnitsLost = NULL; static GameWindow *staticTextPlayerName = NULL; +static NameKeyType s_replayObserverNameKey = NAMEKEY_INVALID; + //----------------------------------------------------------------------------- // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- @@ -128,6 +131,36 @@ void ControlBar::initObserverControls( void ) buttonIdleWorker = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonIdleWorker")); buttonCancelID = TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonCancel"); + + s_replayObserverNameKey = TheNameKeyGenerator->nameToKey("ReplayObserver"); +} + +//------------------------------------------------------------------------------------------------- +void ControlBar::setObserverLookAtPlayer(Player *player) +{ + if (player == ThePlayerList->findPlayerWithNameKey(s_replayObserverNameKey)) + { + // Looking at the observer. Treat as not looking at player. + m_observerLookAtPlayer = NULL; + } + else + { + m_observerLookAtPlayer = player; + } +} + +//------------------------------------------------------------------------------------------------- +void ControlBar::setObservedPlayer(Player *player) +{ + if (player == ThePlayerList->findPlayerWithNameKey(s_replayObserverNameKey)) + { + // Looking at the observer. Treat as not observing player. + m_observedPlayer = NULL; + } + else + { + m_observedPlayer = player; + } } //------------------------------------------------------------------------------------------------- @@ -163,22 +196,42 @@ WindowMsgHandledType ControlBarObserverSystem( GameWindow *window, UnsignedInt m Int controlID = control->winGetWindowId(); if( controlID == buttonCancelID) { - TheControlBar->setObserverLookAtPlayer(NULL); + if (TheGlobalData->m_enablePlayerObserver || TheControlBar->getObservedPlayer() != NULL) + { + Player* observerPlayer = ThePlayerList->findPlayerWithNameKey(s_replayObserverNameKey); + rts::changeObservedPlayer(observerPlayer); + } + else + { + TheControlBar->setObserverLookAtPlayer(NULL); + } + ObserverPlayerInfoWindow->winHide(TRUE); ObserverPlayerListWindow->winHide(FALSE); buttonIdleWorker->winHide(TRUE); TheControlBar->populateObserverList(); - } + for(Int i = 0; i winHide(FALSE); ObserverPlayerListWindow->winHide(TRUE); - TheControlBar->setObserverLookAtPlayer((Player *) GadgetButtonGetData( buttonPlayer[i])); + Player* player = reinterpret_cast(GadgetButtonGetData(buttonPlayer[i])); + + if (TheGlobalData->m_enablePlayerObserver) + { + rts::changeObservedPlayer(player); + } + else + { + TheControlBar->setObserverLookAtPlayer(player); + } + if(TheControlBar->getObserverLookAtPlayer()) TheControlBar->populateObserverInfoWindow(); + return MSG_HANDLED; } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index 627633d0fe9..1e0498ea1c4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -524,6 +524,18 @@ Bool OptionPreferences::useCameraInReplays(void) return FALSE; } +Bool OptionPreferences::getPlayerObserverEnabled() const +{ + OptionPreferences::const_iterator it = find("PlayerObserverEnabled"); + if (it == end()) + return TRUE; + + if (stricmp(it->second.str(), "yes") == 0) + return TRUE; + + return FALSE; +} + Int OptionPreferences::getIdealStaticGameDetail(void) { OptionPreferences::const_iterator it = find("IdealStaticGameLOD"); @@ -1337,6 +1349,13 @@ static void saveOptions( void ) TheLookAtTranslator->setScreenEdgeScrollMode(mode); } + // TheSuperHackers @todo Add checkbox ? + { + Bool enabled = pref->getPlayerObserverEnabled(); + (*pref)["PlayerObserverEnabled"] = enabled ? "yes" : "no"; + TheWritableGlobalData->m_enablePlayerObserver = enabled; + } + //------------------------------------------------------------------------------------------------- // scroll speed val val = GadgetSliderGetPosition(sliderScrollSpeed); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp index adf11303aaf..34d06b90eae 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -35,6 +35,7 @@ #include "Common/ActionManager.h" #include "Common/GameEngine.h" #include "Common/GameState.h" +#include "Common/GameUtility.h" #include "Common/GlobalData.h" #include "Common/PerfTimer.h" #include "Common/Player.h" @@ -638,7 +639,8 @@ void GameClient::update( void ) } const Bool freezeTime = TheGameEngine->isTimeFrozen() || TheGameEngine->isGameHalted(); - Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0; + + const Int localPlayerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); if (!freezeTime) { @@ -818,7 +820,7 @@ void GameClient::updateFakeDrawables(void) if( object && object->isKindOf( KINDOF_FS_FAKE ) ) { - Relationship rel=ThePlayerList->getLocalPlayer()->getRelationship(object->getTeam()); + Relationship rel = rts::getObservedOrLocalPlayer()->getRelationship(object->getTeam()); if (rel == ALLIES || rel == NEUTRAL) draw->setTerrainDecal(TERRAIN_DECAL_SHADOW_TEXTURE); else diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index 4c331e3f88a..71ad8d1bc0a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -35,6 +35,7 @@ #include "Common/FramePacer.h" #include "Common/GameAudio.h" #include "Common/GameType.h" +#include "Common/GameUtility.h" #include "Common/MessageStream.h" #include "Common/PerfTimer.h" #include "Common/Player.h" @@ -2579,7 +2580,7 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) else tooltip = str; - Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0; + const Int localPlayerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); Int x, y; ThePartitionManager->worldToCell(obj->getPosition()->x, obj->getPosition()->y, &x, &y); @@ -2681,7 +2682,7 @@ void InGameUI::createCommandHint( const GameMessage *msg ) if( draw && (t == GameMessage::MSG_DO_ATTACK_OBJECT_HINT || t == GameMessage::MSG_DO_ATTACK_OBJECT_AFTER_MOVING_HINT) ) { const Object* obj = draw->getObject(); - Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0; + const Int localPlayerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); #if ENABLE_CONFIGURABLE_SHROUD ObjectShroudStatus ss = (!obj || !TheGlobalData->m_shroudOn) ? OBJECTSHROUD_CLEAR : obj->getShroudedStatus(localPlayerIndex); #else @@ -5289,7 +5290,7 @@ void InGameUI::updateFloatingText( void ) } //------------------------------------------------------------------------------------------------- -/** Itterates through and draws each floating text */ +/** Iterates through and draws each floating text */ //------------------------------------------------------------------------------------------------- void InGameUI::drawFloatingText( void ) { @@ -5299,8 +5300,7 @@ void InGameUI::drawFloatingText( void ) { ftd = *it; ICoord2D pos; - // get the local player's index - Int playerNdx = ThePlayerList->getLocalPlayer()->getPlayerIndex(); + const Int playerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); // which PartitionManager cells are we looking at? Int pCX, pCY; @@ -5309,7 +5309,7 @@ void InGameUI::drawFloatingText( void ) // translate it's 3d pos into a 2d screen pos if( TheTacticalView->worldToScreen(&ftd->m_pos3D, &pos) && ftd->m_dString - && ThePartitionManager->getShroudStatusForPlayer(playerNdx, pCX, pCY) == CELLSHROUD_CLEAR ) + && ThePartitionManager->getShroudStatusForPlayer(playerIndex, pCX, pCY) == CELLSHROUD_CLEAR ) { pos.y -= ftd->m_frameCount * m_floatingTextMoveUpSpeed; Color dropColor; @@ -5567,7 +5567,8 @@ void InGameUI::updateAndDrawWorldAnimations( void ) // don't bother going forward with the draw process if this location is shrouded for // the local player // - Int playerIndex = ThePlayerList->getLocalPlayer()->getPlayerIndex(); + const Int playerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); + if( ThePartitionManager->getShroudStatusForPlayer( playerIndex, &wad->m_worldPos ) != CELLSHROUD_CLEAR ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index fadbc5f2320..ed8fff0c7c5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -36,6 +36,7 @@ #include "Common/GameAudio.h" #include "Common/GameEngine.h" #include "Common/GameType.h" +#include "Common/GameUtility.h" #include "Common/GlobalData.h" #include "Common/MessageStream.h" #include "Common/MiscAudio.h" @@ -3558,15 +3559,8 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } while (ThePlayerList->getNthPlayer(idx) == ThePlayerList->getNeutralPlayer()); - ThePlayerList->setLocalPlayer(ThePlayerList->getNthPlayer(idx)); - TheInGameUI->deselectAllDrawables(); - #ifdef DEBUG_FOG_MEMORY - TheGhostObjectManager->setLocalPlayerIndex(idx); - #endif - ThePartitionManager->refreshShroudForLocalPlayer(); - TheControlBar->initSpecialPowershortcutBar(ThePlayerList->getLocalPlayer()); - TheControlBar->setControlBarSchemeByPlayer(ThePlayerList->getLocalPlayer()); - TheGameClient->updateFakeDrawables(); + Player* player = ThePlayerList->getNthPlayer(idx); + rts::changeLocalPlayer(player); } disp = DESTROY_MESSAGE; } @@ -4117,14 +4111,8 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } while (ThePlayerList->getNthPlayer(idx) == ThePlayerList->getNeutralPlayer()); - ThePlayerList->setLocalPlayer(ThePlayerList->getNthPlayer(idx)); - TheInGameUI->deselectAllDrawables(); -#ifdef DEBUG_FOG_MEMORY - TheGhostObjectManager->setLocalPlayerIndex(idx); -#endif - ThePartitionManager->refreshShroudForLocalPlayer(); - TheControlBar->initSpecialPowershortcutBar(ThePlayerList->getLocalPlayer()); - TheControlBar->setControlBarSchemeByPlayer(ThePlayerList->getLocalPlayer()); + Player* player = ThePlayerList->getNthPlayer(idx); + rts::changeLocalPlayer(player); } disp = DESTROY_MESSAGE; break; @@ -4145,11 +4133,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage Player *pt = ThePlayerList->getNthPlayer(i); if(pt->getSide().compareNoCase("China") == 0) { - ThePlayerList->setLocalPlayer(pt); - TheInGameUI->deselectAllDrawables(); - ThePartitionManager->refreshShroudForLocalPlayer(); - TheControlBar->setControlBarSchemeByPlayer(ThePlayerList->getLocalPlayer()); - + rts::changeLocalPlayer(pt); break; } } @@ -4162,10 +4146,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage Player *pt = ThePlayerList->getNthPlayer(i); if(pt->getSide().compareNoCase("America") == 0) { - ThePlayerList->setLocalPlayer(pt); - TheInGameUI->deselectAllDrawables(); - ThePartitionManager->refreshShroudForLocalPlayer(); - TheControlBar->setControlBarSchemeByPlayer(ThePlayerList->getLocalPlayer()); + rts::changeLocalPlayer(pt); break; } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp index abd971772e4..67281f16122 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp @@ -30,6 +30,7 @@ // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include "PreRTS.h" #include "Common/GameState.h" +#include "Common/GameUtility.h" #include "Common/Player.h" #include "Common/PlayerList.h" #include "Common/Upgrade.h" @@ -435,7 +436,7 @@ void PropagandaTowerBehavior::doScan( void ) Object *overlord = us->getContainedBy(); if ( overlord ) { - if ( us->getControllingPlayer() != ThePlayerList->getLocalPlayer() )// daling with someone else's tower + if ( us->getControllingPlayer() != rts::getObservedOrLocalPlayer() )// dealing with someone else's tower { if ( overlord->testStatus( OBJECT_STATUS_STEALTHED ) && !overlord->testStatus( OBJECT_STATUS_DETECTED ) ) doFX = FALSE;// so they don't give up their position @@ -461,11 +462,11 @@ void PropagandaTowerBehavior::doScan( void ) } - if ( us->getControllingPlayer() != ThePlayerList->getLocalPlayer() )// daling with someone else's tower + if ( us->getControllingPlayer() != rts::getObservedOrLocalPlayer() )// dealing with someone else's tower { if ( us->testStatus( OBJECT_STATUS_STEALTHED ) && !us->testStatus( OBJECT_STATUS_DETECTED ) ) { - doFX = FALSE;// Certainly don't play if we ourselves are stelthed. + doFX = FALSE;// Certainly don't play if we ourselves are stealthed. } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index 94a148555e4..36ff2100563 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -53,6 +53,7 @@ #include "Common/DiscreteCircle.h" #include "Common/GameEngine.h" #include "Common/GameState.h" +#include "Common/GameUtility.h" #include "Common/MessageStream.h" #include "Common/NameKeyGenerator.h" #include "Common/PerfTimer.h" @@ -1293,7 +1294,7 @@ void PartitionCell::addLooker(Int playerIndex) // On an edge trigger, tell all objects to think about their shroudedness invalidateShroudedStatusForAllCois( playerIndex ); - if( playerIndex == ThePlayerList->getLocalPlayer()->getPlayerIndex() ) + if( playerIndex == rts::getObservedOrLocalPlayer()->getPlayerIndex() ) { // and if this is the local player, do the Client update. TheDisplay->setShroudLevel(m_cellX, m_cellY, newShroud); @@ -1329,7 +1330,7 @@ void PartitionCell::removeLooker(Int playerIndex) // On an edge trigger, tell all objects to think about their shroudedness invalidateShroudedStatusForAllCois( playerIndex ); - if( playerIndex == ThePlayerList->getLocalPlayer()->getPlayerIndex() ) + if( playerIndex == rts::getObservedOrLocalPlayer()->getPlayerIndex() ) { // and if this is the local player, do the Client update. TheDisplay->setShroudLevel(m_cellX, m_cellY, newShroud); @@ -1357,7 +1358,7 @@ void PartitionCell::addShrouder( Int playerIndex ) invalidateShroudedStatusForAllCois( playerIndex ); // and update the client if we are on the local player - if( playerIndex == ThePlayerList->getLocalPlayer()->getPlayerIndex() ) + if( playerIndex == rts::getObservedOrLocalPlayer()->getPlayerIndex() ) { TheDisplay->setShroudLevel(m_cellX, m_cellY, newShroud); TheRadar->setShroudLevel(m_cellX, m_cellY, newShroud); @@ -2803,7 +2804,7 @@ void PartitionManager::update() Int cellCount = m_cellCountX * m_cellCountY; for (int i = 0; i < cellCount; ++i) { - UnsignedInt threat = m_cells[i].getThreatValue(ThePlayerList->getLocalPlayer()->getPlayerIndex()); + UnsignedInt threat = m_cells[i].getThreatValue(rts::getObservedOrLocalPlayer()->getPlayerIndex()); if (threat > 0) { Real threatMul = INT_TO_REAL(threat) / TheGlobalData->m_maxDebugThreat; @@ -2833,7 +2834,7 @@ void PartitionManager::update() Int cellCount = m_cellCountX * m_cellCountY; for (int i = 0; i < cellCount; ++i) { - UnsignedInt value = m_cells[i].getCashValue(ThePlayerList->getLocalPlayer()->getPlayerIndex()); + UnsignedInt value = m_cells[i].getCashValue(rts::getObservedOrLocalPlayer()->getPlayerIndex()); if (value > 0) { Real valueMul = INT_TO_REAL(value) / TheGlobalData->m_maxDebugValue; @@ -3057,7 +3058,7 @@ void PartitionManager::refreshShroudForLocalPlayer() TheDisplay->clearShroud(); TheRadar->clearShroud(); - Int playerIndex = ThePlayerList->getLocalPlayer()->getPlayerIndex(); + const Int playerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); for (int i = 0; i < m_totalCellCount; ++i) { Int x = m_cells[i].getCellX(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index 733188b8f54..c6fca758211 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -31,6 +31,7 @@ #include "Common/ActionManager.h" #include "Common/DrawModule.h" #include "Common/GameState.h" +#include "Common/GameUtility.h" #include "Common/GlobalData.h" #include "Common/RandomValue.h" #include "Common/Team.h" @@ -1151,7 +1152,9 @@ UpdateSleepTime ChinookAIUpdate::update() // Just a handy spot to handle that groovy client effect of the rotor wash - if ( getObject()->getShroudedStatus( ThePlayerList->getLocalPlayer()->getPlayerIndex()) == OBJECTSHROUD_CLEAR ) + const Int playerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); + + if ( getObject()->getShroudedStatus(playerIndex) == OBJECTSHROUD_CLEAR ) { if ( m_flightStatus == CHINOOK_LANDING || m_flightStatus == CHINOOK_TAKING_OFF || m_flightStatus == CHINOOK_LANDED ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp index 130ba9f0b1a..590b26b4bcc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp @@ -30,6 +30,7 @@ // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine +#include "Common/GameUtility.h" #include "Common/Player.h" #include "Common/PlayerList.h" #include "Common/Xfer.h" @@ -349,7 +350,7 @@ void LaserUpdate::initLaser( const Object *parent, const Object *target, const C //PLEASE NOTE You cannot check an ID for NULL. This should be a check against INVALID_PARTICLE_SYSTEM_ID. Can't change it on the last day without a bug though. if( !m_particleSystemID ) { - const Player *localPlayer = ThePlayerList->getLocalPlayer(); + const Player *localPlayer = rts::getObservedOrLocalPlayer(); //Make sure the laser flare is visible to the player. If no parent, assume laser owner will handle it. if (!parent || parent->getShroudedStatus( localPlayer->getPlayerIndex() ) <= OBJECTSHROUD_PARTIAL_CLEAR ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp index 359874cc9c3..66f33ffe815 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp @@ -32,6 +32,7 @@ #define DEFINE_DEATH_NAMES // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// +#include "Common/GameUtility.h" #include "Common/ThingTemplate.h" #include "Common/ThingFactory.h" #include "Common/Player.h" @@ -788,7 +789,7 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update() } //Handle shrouded status changes for the client player. - Player *localPlayer = ThePlayerList->getLocalPlayer(); + Player *localPlayer = rts::getObservedOrLocalPlayer(); if( localPlayer ) { Bool shrouded = me->getShroudedStatus( localPlayer->getPlayerIndex() ) != OBJECTSHROUD_CLEAR; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipUpdate.cpp index 9205b1c68c3..03b144fb66d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipUpdate.cpp @@ -33,6 +33,7 @@ // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include "Common/GameAudio.h" +#include "Common/GameUtility.h" #include "Common/ThingTemplate.h" #include "Common/ThingFactory.h" #include "Common/Player.h" @@ -45,7 +46,6 @@ #include "GameClient/Drawable.h" #include "GameClient/ParticleSys.h" #include "GameClient/FXList.h" -#include "GameClient/ParticleSys.h" #include "GameLogic/Locomotor.h" #include "GameLogic/GameLogic.h" @@ -642,7 +642,7 @@ UpdateSleepTime SpectreGunshipUpdate::update() } - const Player *localPlayer = ThePlayerList->getLocalPlayer(); + const Player *localPlayer = rts::getObservedOrLocalPlayer(); //Make sure the gunship is visible to the player before drawing effects. if ( gunship->getShroudedStatus( localPlayer->getPlayerIndex() ) <= OBJECTSHROUD_PARTIAL_CLEAR ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp index 99bac7d88ea..c556e0036d7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp @@ -32,6 +32,7 @@ #define DEFINE_STEALTHLEVEL_NAMES // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// +#include "Common/GameUtility.h" #include "Common/MiscAudio.h" #include "Common/Radar.h" #include "Common/ThingTemplate.h" @@ -218,7 +219,7 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) { // for the player revealing the stealth unit do some UI feedback - if( ThePlayerList->getLocalPlayer() == self->getControllingPlayer() && + if( rts::getObservedOrLocalPlayer() == self->getControllingPlayer() && self->getRelationship( them ) != ALLIES ) { Bool doFeedback = TRUE; @@ -260,7 +261,7 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) } // for the unit being revealed, do some UI feedback - if( ThePlayerList->getLocalPlayer() == them->getControllingPlayer() && + if( rts::getObservedOrLocalPlayer() == them->getControllingPlayer() && self->getRelationship( them ) != ALLIES ) { Bool doFeedback = TRUE; @@ -354,7 +355,7 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) } - const Player *localPlayer = ThePlayerList->getLocalPlayer(); + const Player *localPlayer = rts::getObservedOrLocalPlayer(); //Make sure the detector is visible to the local player before we add effects or sounds. if ( self->getShroudedStatus( localPlayer->getPlayerIndex() ) <= OBJECTSHROUD_PARTIAL_CLEAR ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp index 81aa722ebb2..25a9b7db5d7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp @@ -34,6 +34,7 @@ // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include "Common/GameState.h" +#include "Common/GameUtility.h" #include "Common/Player.h" #include "Common/PlayerList.h" #include "Common/Radar.h" @@ -432,7 +433,7 @@ void StealthUpdate::hintDetectableWhileUnstealthed() if( self && md->m_hintDetectableStates.testForAny( self->getStatusBits() ) ) { - if ( self->getControllingPlayer() == ThePlayerList->getLocalPlayer() ) + if ( self->getControllingPlayer() == rts::getObservedOrLocalPlayer() ) { Drawable *selfDraw = self->getDrawable(); if ( selfDraw ) @@ -831,7 +832,7 @@ UpdateSleepTime StealthUpdate::update( void ) if (draw) { - StealthLookType stealthLook = calcStealthedStatusForPlayer( self, ThePlayerList->getLocalPlayer() ); + StealthLookType stealthLook = calcStealthedStatusForPlayer( self, rts::getObservedOrLocalPlayer() ); draw->setStealthLook( stealthLook ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 6e9ec822f27..c0966d1ade5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -38,6 +38,7 @@ #include "Common/GameEngine.h" #include "Common/GameLOD.h" #include "Common/GameState.h" +#include "Common/GameUtility.h" #include "Common/INI.h" #include "Common/LatchRestore.h" #include "Common/MapObject.h" @@ -74,7 +75,6 @@ #include "GameClient/ParticleSys.h" #include "GameClient/TerrainVisual.h" #include "GameClient/View.h" -#include "GameClient/ControlBar.h" #include "GameClient/CampaignManager.h" #include "GameClient/GameWindowTransitions.h" @@ -2285,15 +2285,17 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) // explicitly set the Control bar to Observer Mode if(m_gameMode == GAME_REPLAY ) { - - ThePlayerList->setLocalPlayer(ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey("ReplayObserver"))); + Player* observerPlayer = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey("ReplayObserver")); + rts::changeLocalPlayer(observerPlayer); TheRadar->forceOn(TRUE); - ThePartitionManager->refreshShroudForLocalPlayer(); - TheControlBar->setControlBarSchemeByPlayer( ThePlayerList->getLocalPlayer()); + DEBUG_LOG(("Start of a replay game %ls, %d",ThePlayerList->getLocalPlayer()->getPlayerDisplayName().str(), ThePlayerList->getLocalPlayer()->getPlayerIndex())); } else + { TheControlBar->setControlBarSchemeByPlayer(ThePlayerList->getLocalPlayer()); + TheControlBar->initSpecialPowershortcutBar(ThePlayerList->getLocalPlayer()); + } // ShowControlBar(); } @@ -2344,7 +2346,6 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) } } } - TheControlBar->initSpecialPowershortcutBar(ThePlayerList->getLocalPlayer()); if(m_gameMode == GAME_SHELL) { diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp index 59777508869..d0b42fe9a3b 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp @@ -32,6 +32,7 @@ #include "Common/AudioEventRTS.h" #include "Common/Debug.h" #include "Common/GlobalData.h" +#include "Common/GameUtility.h" #include "Common/Player.h" #include "Common/PlayerList.h" @@ -626,10 +627,8 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text // loop through all objects and draw ICoord2D radarPoint; - Player *player = ThePlayerList->getLocalPlayer(); - Int playerIndex=0; - if (player) - playerIndex=player->getPlayerIndex(); + Player *player = rts::getObservedOrLocalPlayer(); + const Int playerIndex = player->getPlayerIndex(); if( calcHero ) { @@ -1387,7 +1386,7 @@ void W3DRadar::draw( Int pixelX, Int pixelY, Int width, Int height ) { // if the local player does not have a radar then we can't draw anything - Player *player = ThePlayerList->getLocalPlayer(); + Player *player = rts::getObservedOrLocalPlayer(); if( !player->hasRadar() && !TheRadar->isRadarForced() ) return; @@ -1511,10 +1510,8 @@ void W3DRadar::refreshTerrain( TerrainLogic *terrain ) // loop through all objects and draw ICoord2D radarPoint; - Player *player = ThePlayerList->getLocalPlayer(); - Int playerIndex=0; - if (player) - playerIndex=player->getPlayerIndex(); + Player *player = rts::getObservedOrLocalPlayer(); + const Int playerIndex = player->getPlayerIndex(); UnsignedByte minAlpha = 8; @@ -1545,8 +1542,8 @@ void W3DRadar::refreshTerrain( TerrainLogic *terrain ) // they are godlike and can see everything) // if( obj->getRadarPriority() == RADAR_PRIORITY_LOCAL_UNIT_ONLY && - obj->getControllingPlayer() != ThePlayerList->getLocalPlayer() && - ThePlayerList->getLocalPlayer()->isPlayerActive() ) + obj->getControllingPlayer() != player && + player->isPlayerActive() ) continue; UnsignedByte g = c|a; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp index 08d5abe3f70..d94d3ced65f 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp @@ -29,6 +29,7 @@ #include "W3DDevice/GameClient/Module/W3DScienceModelDraw.h" +#include "Common/GameUtility.h" #include "Common/Player.h" #include "Common/PlayerList.h" #include "Common/Science.h" @@ -82,9 +83,9 @@ void W3DScienceModelDraw::doDrawModule(const Matrix3D* transformMtx) return; } - if( !ThePlayerList->getLocalPlayer()->hasScience(science) - && ThePlayerList->getLocalPlayer()->isPlayerActive() - ) + Player* player = rts::getObservedOrLocalPlayer(); + + if( !player->hasScience(science) && player->isPlayerActive() ) { // We just don't draw for people without our science except for Observers setHidden( TRUE ); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DPropBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DPropBuffer.cpp index 2f09ca61b2e..150486810b4 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DPropBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DPropBuffer.cpp @@ -50,6 +50,7 @@ #include #include #include +#include "Common/GameUtility.h" #include "Common/Geometry.h" #include "Common/PerfTimer.h" #include "Common/Player.h" @@ -364,7 +365,7 @@ void W3DPropBuffer::drawProps(RenderInfoClass &rinfo) m_props[i].ss = OBJECTSHROUD_CLEAR; } if (m_props[i].ss == OBJECTSHROUD_INVALID) { - Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0; + const Int localPlayerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); m_props[i].ss = ThePartitionManager->getPropShroudStatusForPlayer(localPlayerIndex, &m_props[i].location); } if (m_props[i].ss >= OBJECTSHROUD_SHROUDED) { diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp index 5bdbe1ab5a0..0dd867615e2 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp @@ -36,6 +36,7 @@ // USER INCLUDES ////////////////////////////////////////////////////////////// #include "Lib/BaseType.h" +#include "Common/GameUtility.h" #include "Common/GlobalData.h" #include "Common/PerfTimer.h" #include "Common/Player.h" @@ -536,7 +537,7 @@ void RTS3DScene::renderSpecificDrawables(RenderInfoClass &rinfo, Int numDrawable #ifdef DIRTY_CONDITION_FLAGS StDrawableDirtyStuffLocker lockDirtyStuff; #endif - Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0; + const Int localPlayerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); RefRenderObjListIterator it(&UpdateList); // loop through all render objects in the list: for (it.First(&RenderList); !it.Is_Done();) @@ -1088,7 +1089,7 @@ void RTS3DScene::Customized_Render( RenderInfoClass &rinfo ) m_translucentObjectsCount = 0; //start of new frame so no translucent objects m_occludedObjectsCount = 0; - Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0; + const Int localPlayerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); #define USE_LIGHT_ENV 1 @@ -1338,7 +1339,7 @@ void RTS3DScene::flushOccludedObjectsIntoStencil(RenderInfoClass & rinfo) //Assume no player colors are visible and all stencil bits are free for use by shadows. TheW3DShadowManager->setStencilShadowMask(0); - Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0; + const Int localPlayerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); if (m_numPotentialOccludees && m_numPotentialOccluders) { @@ -1532,7 +1533,7 @@ void RTS3DScene::flushOccludedObjects(RenderInfoClass & rinfo) if (m_occludedObjectsCount) { - Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0; + const Int localPlayerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); if (DX8Wrapper::Has_Stencil()) //just in case we have shadows, disable them over occluded pixels. { @@ -1602,7 +1603,7 @@ void RTS3DScene::flushTranslucentObjects(RenderInfoClass & rinfo) if (m_translucentObjectsCount) { - Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0; + const Int localPlayerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); for (Int i=0; i #include #include "Common/FramePacer.h" +#include "Common/GameUtility.h" #include "Common/MapReaderWriterInfo.h" #include "Common/FileSystem.h" #include "Common/file.h" @@ -1848,7 +1849,7 @@ void W3DTreeBuffer::updateTopplingTree(TTree *tree, Real timeScale) return; const W3DTreeDrawModuleData* d = m_treeTypes[tree->treeType].m_data; - Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0; + const Int localPlayerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); Coord3D pos; pos.set(tree->location.X, tree->location.Y, tree->location.Z); ObjectShroudStatus ss = ThePartitionManager->getPropShroudStatusForPlayer(localPlayerIndex, &pos); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 3cf288e5da2..096e64d0d51 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -39,6 +39,7 @@ // USER INCLUDES ////////////////////////////////////////////////////////////////////////////////// #include "Common/BuildAssistant.h" #include "Common/FramePacer.h" +#include "Common/GameUtility.h" #include "Common/GlobalData.h" #include "Common/Module.h" #include "Common/RandomValue.h" @@ -979,7 +980,7 @@ static void drawablePostDraw( Drawable *draw, void *userData ) return; Object* obj = draw->getObject(); - Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0; + const Int localPlayerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); #if ENABLE_CONFIGURABLE_SHROUD ObjectShroudStatus ss = (!obj || !TheGlobalData->m_shroudOn) ? OBJECTSHROUD_CLEAR : obj->getShroudedStatus(localPlayerIndex); #else diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index d5a1182d966..3bc11fee782 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -734,7 +734,7 @@ void W3DGhostObject::xfer( Xfer *xfer ) // in the world, we need to remove it // if( m_parentObject && - m_parentSnapshots[ ThePlayerList->getLocalPlayer()->getPlayerIndex() ] != NULL && + m_parentSnapshots[TheGhostObjectManager->getLocalPlayerIndex()] != NULL && xfer->getXferMode() == XFER_LOAD ) removeParentObject(); From 15cce0bc2e1cff444f88b36b077af7f0939734a4 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 12 Sep 2025 12:32:06 +0200 Subject: [PATCH 188/343] bugfix(ghostobject): No longer try to restore ghosted objects for a non-local player and simplify code in W3DGhostObject::freeSnapShot, W3DGhostObject::freeAllSnapShots (#1569) --- .../W3DDevice/GameLogic/W3DGhostObject.cpp | 27 +++---------------- .../W3DDevice/GameLogic/W3DGhostObject.cpp | 27 +++---------------- 2 files changed, 6 insertions(+), 48 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index 3e54f12d451..671c1a31697 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -476,25 +476,9 @@ void W3DGhostObject::freeAllSnapShots(void) #else playerIndex = TheGhostObjectManager->getLocalPlayerIndex(); #endif - if (m_parentSnapshots[playerIndex]) - { - //if we have a snapshot for this object, remove it from - //scene. - removeFromScene(playerIndex); - - //Restore actual objects assuming they are still alive. - restoreParentObject(); - - W3DRenderObjectSnapshot *snap = m_parentSnapshots[playerIndex]; - W3DRenderObjectSnapshot *nextSnap; - while (snap) - { - nextSnap = snap->m_next; - delete snap; - snap = nextSnap; - } - m_parentSnapshots[playerIndex] = NULL; - } + { + freeSnapShot(playerIndex); + } } // ------------------------------------------------------------------------------------------------ @@ -502,11 +486,6 @@ void W3DGhostObject::freeAllSnapShots(void) // ------------------------------------------------------------------------------------------------ void W3DGhostObject::freeSnapShot(int playerIndex) { -#ifndef DEBUG_FOG_MEMORY - if (playerIndex != TheGhostObjectManager->getLocalPlayerIndex()) - return; //we only snapshot things for the local player -#endif - if (m_parentSnapshots[playerIndex]) { //if we have a snapshot for this object, remove it from diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index 3bc11fee782..fe3700d6a17 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -480,25 +480,9 @@ void W3DGhostObject::freeAllSnapShots(void) #else playerIndex = TheGhostObjectManager->getLocalPlayerIndex(); #endif - if (m_parentSnapshots[playerIndex]) - { - //if we have a snapshot for this object, remove it from - //scene. - removeFromScene(playerIndex); - - //Restore actual objects assuming they are still alive. - restoreParentObject(); - - W3DRenderObjectSnapshot *snap = m_parentSnapshots[playerIndex]; - W3DRenderObjectSnapshot *nextSnap; - while (snap) - { - nextSnap = snap->m_next; - delete snap; - snap = nextSnap; - } - m_parentSnapshots[playerIndex] = NULL; - } + { + freeSnapShot(playerIndex); + } } // ------------------------------------------------------------------------------------------------ @@ -506,11 +490,6 @@ void W3DGhostObject::freeAllSnapShots(void) // ------------------------------------------------------------------------------------------------ void W3DGhostObject::freeSnapShot(int playerIndex) { -#ifndef DEBUG_FOG_MEMORY - if (playerIndex != TheGhostObjectManager->getLocalPlayerIndex()) - return; //we only snapshot things for the local player -#endif - if (m_parentSnapshots[playerIndex]) { //if we have a snapshot for this object, remove it from From d1b0afd0d5556531d9a5020b195c5412a6e30451 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 12 Sep 2025 12:43:51 +0200 Subject: [PATCH 189/343] tweak(ghostobject): Decouple DEBUG_FOG_MEMORY from tracking ghost object states for all players when required (#1569) --- Core/GameEngine/Source/Common/GameUtility.cpp | 10 +++- .../Include/GameLogic/GhostObject.h | 11 ++++ .../GUI/ControlBar/ControlBarObserver.cpp | 24 ++------ .../Source/GameClient/GameClient.cpp | 41 +++++++------- .../Source/GameLogic/Object/GhostObject.cpp | 2 + .../W3DDevice/GameLogic/W3DGhostObject.cpp | 56 ++++++++++--------- .../Include/GameLogic/GhostObject.h | 11 ++++ .../GUI/ControlBar/ControlBarObserver.cpp | 24 ++------ .../Source/GameClient/GameClient.cpp | 41 +++++++------- .../Source/GameLogic/Object/GhostObject.cpp | 2 + .../W3DDevice/GameLogic/W3DGhostObject.cpp | 56 ++++++++++--------- 11 files changed, 150 insertions(+), 128 deletions(-) diff --git a/Core/GameEngine/Source/Common/GameUtility.cpp b/Core/GameEngine/Source/Common/GameUtility.cpp index e1e5e2cca9d..f7421aaf6a7 100644 --- a/Core/GameEngine/Source/Common/GameUtility.cpp +++ b/Core/GameEngine/Source/Common/GameUtility.cpp @@ -79,9 +79,15 @@ void changeLocalPlayer(Player* player) void changeObservedPlayer(Player* player) { TheControlBar->setObserverLookAtPlayer(player); - TheControlBar->setObservedPlayer(player); - detail::changePlayerCommon(player); + const Bool canBeginObservePlayer = TheGlobalData->m_enablePlayerObserver && TheGhostObjectManager->trackAllPlayers(); + const Bool canEndObservePlayer = TheControlBar->getObservedPlayer() != NULL && TheControlBar->getObserverLookAtPlayer() == NULL; + + if (canBeginObservePlayer || canEndObservePlayer) + { + TheControlBar->setObservedPlayer(player); + detail::changePlayerCommon(player); + } } } // namespace rts diff --git a/Generals/Code/GameEngine/Include/GameLogic/GhostObject.h b/Generals/Code/GameEngine/Include/GameLogic/GhostObject.h index 8e7eb9fcee6..1d36beb225a 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/GhostObject.h +++ b/Generals/Code/GameEngine/Include/GameLogic/GhostObject.h @@ -89,6 +89,7 @@ class GhostObjectManager : public Snapshot virtual void restorePartitionData(void); ///winGetWindowId(); if( controlID == buttonCancelID) { - if (TheGlobalData->m_enablePlayerObserver || TheControlBar->getObservedPlayer() != NULL) - { - Player* observerPlayer = ThePlayerList->findPlayerWithNameKey(s_replayObserverNameKey); - rts::changeObservedPlayer(observerPlayer); - } - else - { - TheControlBar->setObserverLookAtPlayer(NULL); - } + Player* observerPlayer = ThePlayerList->findPlayerWithNameKey(s_replayObserverNameKey); + rts::changeObservedPlayer(observerPlayer); ObserverPlayerInfoWindow->winHide(TRUE); ObserverPlayerListWindow->winHide(FALSE); @@ -216,18 +209,11 @@ WindowMsgHandledType ControlBarObserverSystem( GameWindow *window, UnsignedInt m { if( controlID == buttonPlayerID[i]) { - ObserverPlayerInfoWindow->winHide(FALSE); - ObserverPlayerListWindow->winHide(TRUE); Player* player = reinterpret_cast(GadgetButtonGetData(buttonPlayer[i])); + rts::changeObservedPlayer(player); - if (TheGlobalData->m_enablePlayerObserver) - { - rts::changeObservedPlayer(player); - } - else - { - TheControlBar->setObserverLookAtPlayer(player); - } + ObserverPlayerInfoWindow->winHide(FALSE); + ObserverPlayerListWindow->winHide(TRUE); if(TheControlBar->getObserverLookAtPlayer()) TheControlBar->populateObserverInfoWindow(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp index b78d2e9d50e..d331e6a9bf6 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -606,11 +606,9 @@ void GameClient::update( void ) if (!freezeTime) { -#ifdef DEBUG_FOG_MEMORY Int numPlayers = ThePlayerList->getPlayerCount(); Int numNonLocalPlayers = 0; Int nonLocalPlayerIndices[MAX_PLAYER_COUNT]; -#endif #if ENABLE_CONFIGURABLE_SHROUD if (TheGlobalData->m_shroudOn) @@ -618,19 +616,22 @@ void GameClient::update( void ) if (true) #endif { -#ifdef DEBUG_FOG_MEMORY - //Find indices of all active players - for (Int i=0; i < numPlayers; i++) + if (TheGhostObjectManager->trackAllPlayers()) { - Player *player = ThePlayerList->getNthPlayer(i); - if (player->getPlayerTemplate() != NULL && player->getPlayerIndex() != localPlayerIndex) - nonLocalPlayerIndices[numNonLocalPlayers++] = player->getPlayerIndex(); + //Find indices of all active players + for (Int i=0; i < numPlayers; i++) + { + Player *player = ThePlayerList->getNthPlayer(i); + if (player->getPlayerTemplate() != NULL && player->getPlayerIndex() != localPlayerIndex) + nonLocalPlayerIndices[numNonLocalPlayers++] = player->getPlayerIndex(); + } + //update ghost objects which don't have drawables or objects. + TheGhostObjectManager->updateOrphanedObjects(nonLocalPlayerIndices, numNonLocalPlayers); + } + else + { + TheGhostObjectManager->updateOrphanedObjects(NULL, 0); } - //update ghost objects which don't have drawables or objects. - TheGhostObjectManager->updateOrphanedObjects(nonLocalPlayerIndices, numNonLocalPlayers); -#else - TheGhostObjectManager->updateOrphanedObjects(NULL,0); -#endif } @@ -652,14 +653,16 @@ void GameClient::update( void ) Object *object=draw->getObject(); if (object) { - #ifdef DEBUG_FOG_MEMORY - Int *playerIndex = nonLocalPlayerIndices; - Int *const playerIndexEnd = nonLocalPlayerIndices + numNonLocalPlayers; - for (; playerIndex < playerIndexEnd; ++playerIndex) + if (TheGhostObjectManager->trackAllPlayers()) { - object->getShroudedStatus(*playerIndex); + Int *playerIndex = nonLocalPlayerIndices; + Int *const playerIndexEnd = nonLocalPlayerIndices + numNonLocalPlayers; + for (; playerIndex < playerIndexEnd; ++playerIndex) + { + object->getShroudedStatus(*playerIndex); + } } - #endif + ObjectShroudStatus ss=object->getShroudedStatus(localPlayerIndex); if (ss >= OBJECTSHROUD_FOGGED && draw->getShroudClearFrame()!=0) { UnsignedInt limit = 2*LOGICFRAMES_PER_SECOND; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp index 96994bb8110..b250170c798 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp @@ -133,6 +133,7 @@ GhostObjectManager::GhostObjectManager(void) { m_lockGhostObjects = FALSE; m_saveLockGhostObjects = FALSE; + m_trackAllPlayers = TheGlobalData->m_enablePlayerObserver; m_localPlayer = 0; } @@ -146,6 +147,7 @@ GhostObjectManager::~GhostObjectManager() // ------------------------------------------------------------------------------------------------ void GhostObjectManager::reset(void) { + m_trackAllPlayers = TheGlobalData->m_enablePlayerObserver; } // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index 671c1a31697..a422b8f93ed 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -305,13 +305,18 @@ W3DGhostObject::W3DGhostObject() // ------------------------------------------------------------------------------------------------ W3DGhostObject::~W3DGhostObject() { -#ifdef DEBUG_FOG_MEMORY - for (Int i=0; i < MAX_PLAYER_COUNT; i++) +#ifdef DEBUG_CRASHING + if (TheGhostObjectManager->trackAllPlayers()) { - DEBUG_ASSERTCRASH(m_parentSnapshots[i] == NULL, ("Delete of non-empty GhostObject")); + for (Int i = 0; i < MAX_PLAYER_COUNT; i++) + { + DEBUG_ASSERTCRASH(m_parentSnapshots[i] == NULL, ("Delete of non-empty GhostObject")); + } + } + else + { + DEBUG_ASSERTCRASH(m_parentSnapshots[TheGhostObjectManager->getLocalPlayerIndex()] == NULL, ("Delete of non-empty GhostObject")); } -#else - DEBUG_ASSERTCRASH(m_parentSnapshots[TheGhostObjectManager->getLocalPlayerIndex()] == NULL, ("Delete of non-empty GhostObject")); #endif } @@ -322,10 +327,8 @@ Should only be called when object enters the fogged state.*/ // ------------------------------------------------------------------------------------------------ void W3DGhostObject::snapShot(int playerIndex) { -#ifndef DEBUG_FOG_MEMORY - if (playerIndex != TheGhostObjectManager->getLocalPlayerIndex()) - return; //we only snapshot things for the initial local player because local player can't change in non-debug game. -#endif + DEBUG_ASSERTCRASH(TheGhostObjectManager->trackAllPlayers() || playerIndex == TheGhostObjectManager->getLocalPlayerIndex(), + ("We are supposed to only snapshot things for the initial local player because local player can't change in non-debug game.")); Drawable *draw = m_parentObject->getDrawable(); @@ -469,15 +472,14 @@ void W3DGhostObject::restoreParentObject(void) // ------------------------------------------------------------------------------------------------ void W3DGhostObject::freeAllSnapShots(void) { - Int playerIndex; - -#ifdef DEBUG_FOG_MEMORY - for (playerIndex = 0; playerIndex < MAX_PLAYER_COUNT; playerIndex++) -#else - playerIndex = TheGhostObjectManager->getLocalPlayerIndex(); -#endif + if (TheGhostObjectManager->trackAllPlayers()) { - freeSnapShot(playerIndex); + for (Int playerIndex = 0; playerIndex < MAX_PLAYER_COUNT; playerIndex++) + freeSnapShot(playerIndex); + } + else + { + freeSnapShot(TheGhostObjectManager->getLocalPlayerIndex()); } } @@ -804,6 +806,8 @@ W3DGhostObjectManager::~W3DGhostObjectManager() // ------------------------------------------------------------------------------------------------ void W3DGhostObjectManager::reset(void) { + GhostObjectManager::reset(); + W3DGhostObject *mod = m_usedModules; W3DGhostObject *nextmod; @@ -866,7 +870,7 @@ GhostObject *W3DGhostObjectManager::addGhostObject(Object *object, PartitionData if (m_lockGhostObjects || m_saveLockGhostObjects ) return NULL; -#ifdef DEBUG_FOG_MEMORY +#if defined(DEBUG_FOG_MEMORY) && defined(DEBUG_CRASHING) // sanity if( object != NULL ) { @@ -969,16 +973,18 @@ void W3DGhostObjectManager::updateOrphanedObjects(int *playerIndexList, int play { numStoredSnapshots = 0; -#ifdef DEBUG_FOG_MEMORY - for (int i=0; i 0) { - if (mod->m_parentSnapshots[*playerIndexList]) - mod->getShroudStatus(*playerIndexList); + for (int i=0; im_parentSnapshots[*playerIndexList]) + mod->getShroudStatus(*playerIndexList); - if (mod->m_parentSnapshots[*playerIndexList]) - numStoredSnapshots++; + if (mod->m_parentSnapshots[*playerIndexList]) + numStoredSnapshots++; + } } -#endif + mod->getShroudStatus(m_localPlayer); if (mod->m_parentSnapshots[m_localPlayer]) diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/GhostObject.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/GhostObject.h index 822412a67ac..097dca63857 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/GhostObject.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/GhostObject.h @@ -89,6 +89,7 @@ class GhostObjectManager : public Snapshot virtual void restorePartitionData(void); ///winGetWindowId(); if( controlID == buttonCancelID) { - if (TheGlobalData->m_enablePlayerObserver || TheControlBar->getObservedPlayer() != NULL) - { - Player* observerPlayer = ThePlayerList->findPlayerWithNameKey(s_replayObserverNameKey); - rts::changeObservedPlayer(observerPlayer); - } - else - { - TheControlBar->setObserverLookAtPlayer(NULL); - } + Player* observerPlayer = ThePlayerList->findPlayerWithNameKey(s_replayObserverNameKey); + rts::changeObservedPlayer(observerPlayer); ObserverPlayerInfoWindow->winHide(TRUE); ObserverPlayerListWindow->winHide(FALSE); @@ -216,18 +209,11 @@ WindowMsgHandledType ControlBarObserverSystem( GameWindow *window, UnsignedInt m { if( controlID == buttonPlayerID[i]) { - ObserverPlayerInfoWindow->winHide(FALSE); - ObserverPlayerListWindow->winHide(TRUE); Player* player = reinterpret_cast(GadgetButtonGetData(buttonPlayer[i])); + rts::changeObservedPlayer(player); - if (TheGlobalData->m_enablePlayerObserver) - { - rts::changeObservedPlayer(player); - } - else - { - TheControlBar->setObserverLookAtPlayer(player); - } + ObserverPlayerInfoWindow->winHide(FALSE); + ObserverPlayerListWindow->winHide(TRUE); if(TheControlBar->getObserverLookAtPlayer()) TheControlBar->populateObserverInfoWindow(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp index 34d06b90eae..bdfb31382b4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -644,11 +644,9 @@ void GameClient::update( void ) if (!freezeTime) { -#ifdef DEBUG_FOG_MEMORY Int numPlayers = ThePlayerList->getPlayerCount(); Int numNonLocalPlayers = 0; Int nonLocalPlayerIndices[MAX_PLAYER_COUNT]; -#endif #if ENABLE_CONFIGURABLE_SHROUD if (TheGlobalData->m_shroudOn) @@ -656,19 +654,22 @@ void GameClient::update( void ) if (true) #endif { -#ifdef DEBUG_FOG_MEMORY - //Find indices of all active players - for (Int i=0; i < numPlayers; i++) + if (TheGhostObjectManager->trackAllPlayers()) { - Player *player = ThePlayerList->getNthPlayer(i); - if (player->getPlayerTemplate() != NULL && player->getPlayerIndex() != localPlayerIndex) - nonLocalPlayerIndices[numNonLocalPlayers++] = player->getPlayerIndex(); + //Find indices of all active players + for (Int i=0; i < numPlayers; i++) + { + Player *player = ThePlayerList->getNthPlayer(i); + if (player->getPlayerTemplate() != NULL && player->getPlayerIndex() != localPlayerIndex) + nonLocalPlayerIndices[numNonLocalPlayers++] = player->getPlayerIndex(); + } + //update ghost objects which don't have drawables or objects. + TheGhostObjectManager->updateOrphanedObjects(nonLocalPlayerIndices, numNonLocalPlayers); + } + else + { + TheGhostObjectManager->updateOrphanedObjects(NULL, 0); } - //update ghost objects which don't have drawables or objects. - TheGhostObjectManager->updateOrphanedObjects(nonLocalPlayerIndices, numNonLocalPlayers); -#else - TheGhostObjectManager->updateOrphanedObjects(NULL,0); -#endif } @@ -690,14 +691,16 @@ void GameClient::update( void ) Object *object=draw->getObject(); if (object) { - #ifdef DEBUG_FOG_MEMORY - Int *playerIndex = nonLocalPlayerIndices; - Int *const playerIndexEnd = nonLocalPlayerIndices + numNonLocalPlayers; - for (; playerIndex < playerIndexEnd; ++playerIndex) + if (TheGhostObjectManager->trackAllPlayers()) { - object->getShroudedStatus(*playerIndex); + Int *playerIndex = nonLocalPlayerIndices; + Int *const playerIndexEnd = nonLocalPlayerIndices + numNonLocalPlayers; + for (; playerIndex < playerIndexEnd; ++playerIndex) + { + object->getShroudedStatus(*playerIndex); + } } - #endif + ObjectShroudStatus ss=object->getShroudedStatus(localPlayerIndex); if (ss >= OBJECTSHROUD_FOGGED && draw->getShroudClearFrame()!=0) { UnsignedInt limit = 2*LOGICFRAMES_PER_SECOND; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp index 8b98fd97f05..d04a9af13be 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp @@ -133,6 +133,7 @@ GhostObjectManager::GhostObjectManager(void) { m_lockGhostObjects = FALSE; m_saveLockGhostObjects = FALSE; + m_trackAllPlayers = TheGlobalData->m_enablePlayerObserver; m_localPlayer = 0; } @@ -146,6 +147,7 @@ GhostObjectManager::~GhostObjectManager() // ------------------------------------------------------------------------------------------------ void GhostObjectManager::reset(void) { + m_trackAllPlayers = TheGlobalData->m_enablePlayerObserver; } // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index fe3700d6a17..b23dad685e0 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -309,13 +309,18 @@ W3DGhostObject::W3DGhostObject() // ------------------------------------------------------------------------------------------------ W3DGhostObject::~W3DGhostObject() { -#ifdef DEBUG_FOG_MEMORY - for (Int i=0; i < MAX_PLAYER_COUNT; i++) +#ifdef DEBUG_CRASHING + if (TheGhostObjectManager->trackAllPlayers()) { - DEBUG_ASSERTCRASH(m_parentSnapshots[i] == NULL, ("Delete of non-empty GhostObject")); + for (Int i = 0; i < MAX_PLAYER_COUNT; i++) + { + DEBUG_ASSERTCRASH(m_parentSnapshots[i] == NULL, ("Delete of non-empty GhostObject")); + } + } + else + { + DEBUG_ASSERTCRASH(m_parentSnapshots[TheGhostObjectManager->getLocalPlayerIndex()] == NULL, ("Delete of non-empty GhostObject")); } -#else - DEBUG_ASSERTCRASH(m_parentSnapshots[TheGhostObjectManager->getLocalPlayerIndex()] == NULL, ("Delete of non-empty GhostObject")); #endif } @@ -326,10 +331,8 @@ Should only be called when object enters the fogged state.*/ // ------------------------------------------------------------------------------------------------ void W3DGhostObject::snapShot(int playerIndex) { -#ifndef DEBUG_FOG_MEMORY - if (playerIndex != TheGhostObjectManager->getLocalPlayerIndex()) - return; //we only snapshot things for the initial local player because local player can't change in non-debug game. -#endif + DEBUG_ASSERTCRASH(TheGhostObjectManager->trackAllPlayers() || playerIndex == TheGhostObjectManager->getLocalPlayerIndex(), + ("We are supposed to only snapshot things for the initial local player because local player can't change in non-debug game.")); Drawable *draw = m_parentObject->getDrawable(); @@ -473,15 +476,14 @@ void W3DGhostObject::restoreParentObject(void) // ------------------------------------------------------------------------------------------------ void W3DGhostObject::freeAllSnapShots(void) { - Int playerIndex; - -#ifdef DEBUG_FOG_MEMORY - for (playerIndex = 0; playerIndex < MAX_PLAYER_COUNT; playerIndex++) -#else - playerIndex = TheGhostObjectManager->getLocalPlayerIndex(); -#endif + if (TheGhostObjectManager->trackAllPlayers()) { - freeSnapShot(playerIndex); + for (Int playerIndex = 0; playerIndex < MAX_PLAYER_COUNT; playerIndex++) + freeSnapShot(playerIndex); + } + else + { + freeSnapShot(TheGhostObjectManager->getLocalPlayerIndex()); } } @@ -808,6 +810,8 @@ W3DGhostObjectManager::~W3DGhostObjectManager() // ------------------------------------------------------------------------------------------------ void W3DGhostObjectManager::reset(void) { + GhostObjectManager::reset(); + W3DGhostObject *mod = m_usedModules; W3DGhostObject *nextmod; @@ -870,7 +874,7 @@ GhostObject *W3DGhostObjectManager::addGhostObject(Object *object, PartitionData if (m_lockGhostObjects || m_saveLockGhostObjects ) return NULL; -#ifdef DEBUG_FOG_MEMORY +#if defined(DEBUG_FOG_MEMORY) && defined(DEBUG_CRASHING) // sanity if( object != NULL ) { @@ -973,16 +977,18 @@ void W3DGhostObjectManager::updateOrphanedObjects(int *playerIndexList, int play { numStoredSnapshots = 0; -#ifdef DEBUG_FOG_MEMORY - for (int i=0; i 0) { - if (mod->m_parentSnapshots[*playerIndexList]) - mod->getShroudStatus(*playerIndexList); + for (int i=0; im_parentSnapshots[*playerIndexList]) + mod->getShroudStatus(*playerIndexList); - if (mod->m_parentSnapshots[*playerIndexList]) - numStoredSnapshots++; + if (mod->m_parentSnapshots[*playerIndexList]) + numStoredSnapshots++; + } } -#endif + mod->getShroudStatus(m_localPlayer); if (mod->m_parentSnapshots[m_localPlayer]) From 9ee190c7814e8975a85b739c9194072bf0f79b18 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 12 Sep 2025 12:45:43 +0200 Subject: [PATCH 190/343] bugfix(ghostobject): Fix incorrect snapshot update in W3DGhostObject::snapShot (#1569) --- .../Source/W3DDevice/GameLogic/W3DGhostObject.cpp | 4 +++- .../Source/W3DDevice/GameLogic/W3DGhostObject.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index a422b8f93ed..eb8ce090fd6 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -360,7 +360,9 @@ void W3DGhostObject::snapShot(int playerIndex) m_parentSnapshots[playerIndex] = snap; } else - m_parentSnapshots[playerIndex]->update(robj, &m_drawableInfo); + { + snap->update(robj, &m_drawableInfo); + } //Adding and removing render objects to the scene is expensive //so only do it for the real player watching the screen. There is diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index b23dad685e0..b8eb255e838 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -364,7 +364,9 @@ void W3DGhostObject::snapShot(int playerIndex) m_parentSnapshots[playerIndex] = snap; } else - m_parentSnapshots[playerIndex]->update(robj, &m_drawableInfo); + { + snap->update(robj, &m_drawableInfo); + } //Adding and removing render objects to the scene is expensive //so only do it for the real player watching the screen. There is From 98de109f0a586f23e6e45fbf3466398e7f3aae1d Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 12 Sep 2025 12:48:38 +0200 Subject: [PATCH 191/343] bugfix(ghostobject): Fix crash in W3DGhostObjectManager::updateOrphanedObjects (#1569) --- .../Source/W3DDevice/GameLogic/W3DGhostObject.cpp | 10 ++++++---- .../Source/W3DDevice/GameLogic/W3DGhostObject.cpp | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index eb8ce090fd6..1a4b3b7ddf0 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -977,12 +977,14 @@ void W3DGhostObjectManager::updateOrphanedObjects(int *playerIndexList, int play if (playerIndexList != NULL && playerIndexCount > 0) { - for (int i=0; im_parentSnapshots[*playerIndexList]) - mod->getShroudStatus(*playerIndexList); + if (mod->m_parentSnapshots[*playerIndex]) + mod->getShroudStatus(*playerIndex); - if (mod->m_parentSnapshots[*playerIndexList]) + if (mod->m_parentSnapshots[*playerIndex]) numStoredSnapshots++; } } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index b8eb255e838..e51e1a96249 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -981,12 +981,14 @@ void W3DGhostObjectManager::updateOrphanedObjects(int *playerIndexList, int play if (playerIndexList != NULL && playerIndexCount > 0) { - for (int i=0; im_parentSnapshots[*playerIndexList]) - mod->getShroudStatus(*playerIndexList); + if (mod->m_parentSnapshots[*playerIndex]) + mod->getShroudStatus(*playerIndex); - if (mod->m_parentSnapshots[*playerIndexList]) + if (mod->m_parentSnapshots[*playerIndex]) numStoredSnapshots++; } } From 98f6cd100f87fb5569d17f4e03d6ee2c392be3af Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 6 Sep 2025 12:21:38 +0200 Subject: [PATCH 192/343] fix(ghostobject): Add additional tests in W3DRenderObjectSnapshot::addToScene, W3DGhostObject::removeParentObject for robustness (#1569) --- .../Source/W3DDevice/GameLogic/W3DGhostObject.cpp | 4 +++- .../Source/W3DDevice/GameLogic/W3DGhostObject.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index 1a4b3b7ddf0..de021ded25c 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -153,7 +153,7 @@ void W3DRenderObjectSnapshot::update(RenderObjClass *robj, DrawableInfo *drawInf // ------------------------------------------------------------------------------------------------ void W3DRenderObjectSnapshot::addToScene(void) { - if (W3DDisplay::m_3DScene != NULL) + if (!m_robj->Is_In_Scene()) W3DDisplay::m_3DScene->Add_Render_Object(m_robj); } @@ -406,6 +406,8 @@ void W3DGhostObject::removeParentObject(void) return; Drawable *draw = m_parentObject->getDrawable(); + if (!draw) + return; //After we remove the unfogged object, we also disable //anything that should be hidden inside fog - shadow, particles, etc. diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index e51e1a96249..34c21148e1f 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -157,7 +157,7 @@ void W3DRenderObjectSnapshot::update(RenderObjClass *robj, DrawableInfo *drawInf // ------------------------------------------------------------------------------------------------ void W3DRenderObjectSnapshot::addToScene(void) { - if (W3DDisplay::m_3DScene != NULL) + if (!m_robj->Is_In_Scene()) W3DDisplay::m_3DScene->Add_Render_Object(m_robj); } @@ -410,6 +410,8 @@ void W3DGhostObject::removeParentObject(void) return; Drawable *draw = m_parentObject->getDrawable(); + if (!draw) + return; //After we remove the unfogged object, we also disable //anything that should be hidden inside fog - shadow, particles, etc. From 743f11d52f09ce047e28e87677983d04abe9fe25 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 12 Sep 2025 12:54:08 +0200 Subject: [PATCH 193/343] bugfix(ghostobject): Properly refresh real and ghost objects when changing the local player in the Ghost Object Manager (#1569) --- .../Source/WWVegas/WW3D2/rendobj.cpp | 11 ++- Core/Libraries/Source/WWVegas/WW3D2/rendobj.h | 2 +- .../GameEngine/Include/GameLogic/Object.h | 1 + .../Source/GameClient/GameClient.cpp | 13 +++- .../Source/GameLogic/Object/Object.cpp | 9 +++ .../W3DDevice/GameLogic/W3DGhostObject.h | 4 +- .../W3DDevice/GameLogic/W3DGhostObject.cpp | 77 +++++++++++++------ .../GameEngine/Include/GameLogic/Object.h | 1 + .../Source/GameClient/GameClient.cpp | 13 +++- .../Source/GameLogic/Object/Object.cpp | 9 +++ .../W3DDevice/GameLogic/W3DGhostObject.h | 4 +- .../W3DDevice/GameLogic/W3DGhostObject.cpp | 77 +++++++++++++------ 12 files changed, 158 insertions(+), 63 deletions(-) diff --git a/Core/Libraries/Source/WWVegas/WW3D2/rendobj.cpp b/Core/Libraries/Source/WWVegas/WW3D2/rendobj.cpp index 1fa114bb545..b5d0671fc17 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/rendobj.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/rendobj.cpp @@ -807,7 +807,7 @@ void RenderObjClass::Add(SceneClass * scene) * 11/04/1997 GH : Created. * * 2/25/99 GTH : moved to the base RenderObjClass * *=============================================================================================*/ -void RenderObjClass::Remove(void) +bool RenderObjClass::Remove(void) { // All render objects have their scene pointers set. To check if this is a "top level" // object, (i.e. directly in the scene) you see if its Container pointer is NULL. @@ -815,16 +815,19 @@ void RenderObjClass::Remove(void) if (Container == NULL) { if (Scene != NULL) { Scene->Remove_Render_Object(this); - return; + return true; } + return false; } else { Container->Remove_Sub_Object(this); - return; + return true; } #else - if (!Scene) return; + if (!Scene) + return false; Scene->Remove_Render_Object(this); Scene = NULL; + return true; #endif } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/rendobj.h b/Core/Libraries/Source/WWVegas/WW3D2/rendobj.h index 43758e4e085..ab0edb7eacf 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/rendobj.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/rendobj.h @@ -265,7 +265,7 @@ class RenderObjClass : public RefCountClass , public PersistClass, public MultiL // as small as possible /////////////////////////////////////////////////////////////////////////////////////////////////////////////// virtual void Add(SceneClass * scene); - virtual void Remove(void); + virtual bool Remove(void); virtual SceneClass * Get_Scene(void); virtual SceneClass * Peek_Scene(void) { return Scene; } virtual void Set_Container(RenderObjClass * con); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Object.h b/Generals/Code/GameEngine/Include/GameLogic/Object.h index 6f9781964f3..9719adc2fa8 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Object.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Object.h @@ -391,6 +391,7 @@ class Object : public Thing, public Snapshot void friend_setPartitionData(PartitionData *pd) { m_partitionData = pd; } PartitionData *friend_getPartitionData() const { return m_partitionData; } const PartitionData *friend_getConstPartitionData() const { return m_partitionData; } + Bool hasGhostObject() const; ///< This object has a ghost object. This does not imply that a ghost snapshot is taken or active. void onPartitionCellChange();///< We have moved a 'significant' amount, so do maintenence that can be considered 'cell-based' void handlePartitionCellMaintenance(); ///< Undo and redo all shroud actions. Call when something has changed, like position or ownership or Death diff --git a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp index d331e6a9bf6..521f5b2568c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -655,11 +655,16 @@ void GameClient::update( void ) { if (TheGhostObjectManager->trackAllPlayers()) { - Int *playerIndex = nonLocalPlayerIndices; - Int *const playerIndexEnd = nonLocalPlayerIndices + numNonLocalPlayers; - for (; playerIndex < playerIndexEnd; ++playerIndex) + // TheSuperHackers @info Update the shrouded status for all objects + // that own a ghost object for all non local players. This is costly. + if (object->hasGhostObject()) { - object->getShroudedStatus(*playerIndex); + Int *playerIndex = nonLocalPlayerIndices; + Int *const playerIndexEnd = nonLocalPlayerIndices + numNonLocalPlayers; + for (; playerIndex < playerIndexEnd; ++playerIndex) + { + object->getShroudedStatus(*playerIndex); + } } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp index c0dbd47221c..7690663cb95 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -4198,6 +4198,15 @@ void Object::adjustModelConditionForWeaponStatus() } } +//------------------------------------------------------------------------------------------------- +Bool Object::hasGhostObject() const +{ + if (m_partitionData == NULL) + return false; + + return m_partitionData->getGhostObject() != NULL; +} + //------------------------------------------------------------------------------------------------- /// We have moved a 'significant' amount, so do maintenence that can be considered 'cell-based' void Object::onPartitionCellChange() diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGhostObject.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGhostObject.h index 1c4d4378b92..8630f894907 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGhostObject.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGhostObject.h @@ -59,8 +59,8 @@ class W3DGhostObject: public GhostObject virtual void loadPostProcess( void ); void removeParentObject(void); void restoreParentObject(void); ///< restore the original non-ghosted object to scene. - void addToScene(int playerIndex); - void removeFromScene(int playerIndex); + Bool addToScene(int playerIndex); + Bool removeFromScene(int playerIndex); ObjectShroudStatus getShroudStatus(int playerIndex); ///< used to get the partition manager to update ghost objects without parent objects. void freeAllSnapShots(void); ///< used to free all snapshots from all players. diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index de021ded25c..62b3681a491 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -63,8 +63,8 @@ class W3DRenderObjectSnapshot : public Snapshot ~W3DRenderObjectSnapshot() {REF_PTR_RELEASE(m_robj);} inline void update(RenderObjClass *robj, DrawableInfo *drawInfo, Bool cloneParentRobj = TRUE); ///Is_In_Scene()) + { W3DDisplay::m_3DScene->Add_Render_Object(m_robj); + return true; + } + return false; } // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ -void W3DRenderObjectSnapshot::removeFromScene() +Bool W3DRenderObjectSnapshot::removeFromScene() { - m_robj->Remove(); + return m_robj->Remove(); } // ------------------------------------------------------------------------------------------------ @@ -531,29 +535,37 @@ void W3DGhostObject::updateParentObject(Object *object, PartitionData *mod) // ------------------------------------------------------------------------------------------------ /**Remove the dummy render objects from scene that belong to given player*/ // ------------------------------------------------------------------------------------------------ -void W3DGhostObject::removeFromScene(int playerIndex) +Bool W3DGhostObject::removeFromScene(int playerIndex) { W3DRenderObjectSnapshot *snap = m_parentSnapshots[playerIndex]; + Bool removed = false; + while (snap) { - snap->removeFromScene(); + removed |= snap->removeFromScene(); snap = snap->m_next; } + + return removed; } // ------------------------------------------------------------------------------------------------ /**Add the dummy render objects to scene so player sees the correct version within the fog*/ // ------------------------------------------------------------------------------------------------ -void W3DGhostObject::addToScene(int playerIndex) +Bool W3DGhostObject::addToScene(int playerIndex) { W3DRenderObjectSnapshot *snap = m_parentSnapshots[playerIndex]; + Bool added = false; + while (snap) { - snap->addToScene(); + added |= snap->addToScene(); snap = snap->m_next; } + + return added; } // ------------------------------------------------------------------------------------------------ @@ -923,38 +935,57 @@ GhostObject *W3DGhostObjectManager::addGhostObject(Object *object, PartitionData // ------------------------------------------------------------------------------------------------ void W3DGhostObjectManager::setLocalPlayerIndex(int playerIndex) { + const int oldPlayerIndex = getLocalPlayerIndex(); + + if (playerIndex == oldPlayerIndex) + return; + + GhostObjectManager::setLocalPlayerIndex(playerIndex); + //Whenever we switch local players, we need to remove all ghost objects belonging //to another player from the map. We then insert the current local player's //ghost objects into the map. + // TheSuperHackers @bugfix xezon 06/09/2025 This function now properly + // updates ghost objects and real objects when changing players. W3DGhostObject *mod = m_usedModules; while (mod) { - mod->removeFromScene(m_localPlayer); + const Bool oldGhostRemoved = mod->removeFromScene(oldPlayerIndex); + const ObjectShroudStatus newShroudStatus = mod->getShroudStatus(playerIndex); + Bool newGhostAdded = false; - if (mod->m_parentSnapshots[playerIndex]) + if (newShroudStatus >= OBJECTSHROUD_FOGGED) { - //new player has his own snapshot - if (!mod->m_parentSnapshots[m_localPlayer]) - { - //previous player didn't have a snapshot so real object must - //have been in the scene. Replace it with our snapshot. - mod->removeParentObject(); - } - mod->addToScene(playerIndex); + newGhostAdded = mod->addToScene(playerIndex); } - else if (mod->m_parentSnapshots[m_localPlayer]) + + if (oldGhostRemoved && !newGhostAdded) { - //new player doesn't have a snapshot which means restore original object - //if it was replaced by a snapshot by the previous player. mod->restoreParentObject(); } + else if (!oldGhostRemoved && newGhostAdded) + { + mod->removeParentObject(); + } mod = mod->m_nextSystem; } - GhostObjectManager::setLocalPlayerIndex(playerIndex); + // TheSuperHackers @bugfix xezon 06/09/2025 This function now properly updates + // all real objects when changing players without waiting for another logic step. + // This is particularly noticeable when changing the player while the game is paused. + for (Drawable* draw = TheGameClient->firstDrawable(); draw != NULL; draw = draw->getNextDrawable()) + { + Object* obj = draw->getObject(); + if (obj == NULL) + continue; + + const ObjectShroudStatus shroudStatus = obj->getShroudedStatus(playerIndex); + const Bool shrouded = shroudStatus >= OBJECTSHROUD_FOGGED; + draw->setFullyObscuredByShroud(shrouded); + } } // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h index 24cdb68781d..2c551ded487 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h @@ -416,6 +416,7 @@ class Object : public Thing, public Snapshot void friend_setPartitionData(PartitionData *pd) { m_partitionData = pd; } PartitionData *friend_getPartitionData() const { return m_partitionData; } const PartitionData *friend_getConstPartitionData() const { return m_partitionData; } + Bool hasGhostObject() const; ///< This object has a ghost object. This does not imply that a ghost snapshot is taken or active. void onPartitionCellChange();///< We have moved a 'significant' amount, so do maintenence that can be considered 'cell-based' void handlePartitionCellMaintenance(); ///< Undo and redo all shroud actions. Call when something has changed, like position or ownership or Death diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp index bdfb31382b4..a827982ec20 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -693,11 +693,16 @@ void GameClient::update( void ) { if (TheGhostObjectManager->trackAllPlayers()) { - Int *playerIndex = nonLocalPlayerIndices; - Int *const playerIndexEnd = nonLocalPlayerIndices + numNonLocalPlayers; - for (; playerIndex < playerIndexEnd; ++playerIndex) + // TheSuperHackers @info Update the shrouded status for all objects + // that own a ghost object for all non local players. This is costly. + if (object->hasGhostObject()) { - object->getShroudedStatus(*playerIndex); + Int *playerIndex = nonLocalPlayerIndices; + Int *const playerIndexEnd = nonLocalPlayerIndices + numNonLocalPlayers; + for (; playerIndex < playerIndexEnd; ++playerIndex) + { + object->getShroudedStatus(*playerIndex); + } } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp index 039b8581174..39c0ba7d79d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -4763,6 +4763,15 @@ void Object::adjustModelConditionForWeaponStatus() } } +//------------------------------------------------------------------------------------------------- +Bool Object::hasGhostObject() const +{ + if (m_partitionData == NULL) + return false; + + return m_partitionData->getGhostObject() != NULL; +} + //------------------------------------------------------------------------------------------------- /// We have moved a 'significant' amount, so do maintenence that can be considered 'cell-based' void Object::onPartitionCellChange() diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGhostObject.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGhostObject.h index d3c0df05b89..87438b20617 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGhostObject.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGhostObject.h @@ -59,8 +59,8 @@ class W3DGhostObject: public GhostObject virtual void loadPostProcess( void ); void removeParentObject(void); void restoreParentObject(void); ///< restore the original non-ghosted object to scene. - void addToScene(int playerIndex); - void removeFromScene(int playerIndex); + Bool addToScene(int playerIndex); + Bool removeFromScene(int playerIndex); ObjectShroudStatus getShroudStatus(int playerIndex); ///< used to get the partition manager to update ghost objects without parent objects. void freeAllSnapShots(void); ///< used to free all snapshots from all players. diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index 34c21148e1f..607d6c7ba90 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -63,8 +63,8 @@ class W3DRenderObjectSnapshot : public Snapshot ~W3DRenderObjectSnapshot() {REF_PTR_RELEASE(m_robj);} inline void update(RenderObjClass *robj, DrawableInfo *drawInfo, Bool cloneParentRobj = TRUE); ///Is_In_Scene()) + { W3DDisplay::m_3DScene->Add_Render_Object(m_robj); + return true; + } + return false; } // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ -void W3DRenderObjectSnapshot::removeFromScene() +Bool W3DRenderObjectSnapshot::removeFromScene() { - m_robj->Remove(); + return m_robj->Remove(); } // ------------------------------------------------------------------------------------------------ @@ -535,29 +539,37 @@ void W3DGhostObject::updateParentObject(Object *object, PartitionData *mod) // ------------------------------------------------------------------------------------------------ /**Remove the dummy render objects from scene that belong to given player*/ // ------------------------------------------------------------------------------------------------ -void W3DGhostObject::removeFromScene(int playerIndex) +Bool W3DGhostObject::removeFromScene(int playerIndex) { W3DRenderObjectSnapshot *snap = m_parentSnapshots[playerIndex]; + Bool removed = false; + while (snap) { - snap->removeFromScene(); + removed |= snap->removeFromScene(); snap = snap->m_next; } + + return removed; } // ------------------------------------------------------------------------------------------------ /**Add the dummy render objects to scene so player sees the correct version within the fog*/ // ------------------------------------------------------------------------------------------------ -void W3DGhostObject::addToScene(int playerIndex) +Bool W3DGhostObject::addToScene(int playerIndex) { W3DRenderObjectSnapshot *snap = m_parentSnapshots[playerIndex]; + Bool added = false; + while (snap) { - snap->addToScene(); + added |= snap->addToScene(); snap = snap->m_next; } + + return added; } // ------------------------------------------------------------------------------------------------ @@ -927,38 +939,57 @@ GhostObject *W3DGhostObjectManager::addGhostObject(Object *object, PartitionData // ------------------------------------------------------------------------------------------------ void W3DGhostObjectManager::setLocalPlayerIndex(int playerIndex) { + const int oldPlayerIndex = getLocalPlayerIndex(); + + if (playerIndex == oldPlayerIndex) + return; + + GhostObjectManager::setLocalPlayerIndex(playerIndex); + //Whenever we switch local players, we need to remove all ghost objects belonging //to another player from the map. We then insert the current local player's //ghost objects into the map. + // TheSuperHackers @bugfix xezon 06/09/2025 This function now properly + // updates ghost objects and real objects when changing players. W3DGhostObject *mod = m_usedModules; while (mod) { - mod->removeFromScene(m_localPlayer); + const Bool oldGhostRemoved = mod->removeFromScene(oldPlayerIndex); + const ObjectShroudStatus newShroudStatus = mod->getShroudStatus(playerIndex); + Bool newGhostAdded = false; - if (mod->m_parentSnapshots[playerIndex]) + if (newShroudStatus >= OBJECTSHROUD_FOGGED) { - //new player has his own snapshot - if (!mod->m_parentSnapshots[m_localPlayer]) - { - //previous player didn't have a snapshot so real object must - //have been in the scene. Replace it with our snapshot. - mod->removeParentObject(); - } - mod->addToScene(playerIndex); + newGhostAdded = mod->addToScene(playerIndex); } - else if (mod->m_parentSnapshots[m_localPlayer]) + + if (oldGhostRemoved && !newGhostAdded) { - //new player doesn't have a snapshot which means restore original object - //if it was replaced by a snapshot by the previous player. mod->restoreParentObject(); } + else if (!oldGhostRemoved && newGhostAdded) + { + mod->removeParentObject(); + } mod = mod->m_nextSystem; } - GhostObjectManager::setLocalPlayerIndex(playerIndex); + // TheSuperHackers @bugfix xezon 06/09/2025 This function now properly updates + // all real objects when changing players without waiting for another logic step. + // This is particularly noticeable when changing the player while the game is paused. + for (Drawable* draw = TheGameClient->firstDrawable(); draw != NULL; draw = draw->getNextDrawable()) + { + Object* obj = draw->getObject(); + if (obj == NULL) + continue; + + const ObjectShroudStatus shroudStatus = obj->getShroudedStatus(playerIndex); + const Bool shrouded = shroudStatus >= OBJECTSHROUD_FOGGED; + draw->setFullyObscuredByShroud(shrouded); + } } // ------------------------------------------------------------------------------------------------ From 86eccd74e6a9065317c87b452533c46543857623 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 12 Sep 2025 12:56:23 +0200 Subject: [PATCH 194/343] bugfix(ghostobject): Properly keep ghosted and shrouded objects hidden when taking a ghost snapshot or changing the local player (#1569) --- .../GameEngine/Include/GameClient/Drawable.h | 2 ++ .../GameEngine/Source/GameClient/Drawable.cpp | 2 +- .../GameEngine/Source/GameClient/GameClient.cpp | 2 +- .../Source/W3DDevice/GameClient/W3DScene.cpp | 2 +- .../W3DDevice/GameLogic/W3DGhostObject.cpp | 16 ++++++++++++++++ .../GameEngine/Include/GameClient/Drawable.h | 2 ++ .../GameEngine/Source/GameClient/Drawable.cpp | 2 +- .../GameEngine/Source/GameClient/GameClient.cpp | 2 +- .../Source/W3DDevice/GameClient/W3DScene.cpp | 2 +- .../W3DDevice/GameLogic/W3DGhostObject.cpp | 16 ++++++++++++++++ 10 files changed, 42 insertions(+), 6 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/Drawable.h b/Generals/Code/GameEngine/Include/GameClient/Drawable.h index 9eb79d2058d..aad6bf2b9ea 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Drawable.h +++ b/Generals/Code/GameEngine/Include/GameClient/Drawable.h @@ -270,6 +270,8 @@ enum TerrainDecalType CPP_11(: Int) //----------------------------------------------------------------------------- +constexpr const UnsignedInt InvalidShroudClearFrame = ~0u; + const Int DRAWABLE_FRAMES_PER_FLASH = LOGICFRAMES_PER_SECOND / 2; //----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index 72e4dfd4ae7..2d5c66ac2d1 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -362,7 +362,7 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusBits statu m_timeElapsedFade = 0; m_timeToFade = 0; - m_shroudClearFrame = 0; + m_shroudClearFrame = InvalidShroudClearFrame; for (i = 0; i < NUM_DRAWABLE_MODULE_TYPES; ++i) m_modules[i] = NULL; diff --git a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp index 521f5b2568c..ddfbdff659a 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -669,7 +669,7 @@ void GameClient::update( void ) } ObjectShroudStatus ss=object->getShroudedStatus(localPlayerIndex); - if (ss >= OBJECTSHROUD_FOGGED && draw->getShroudClearFrame()!=0) { + if (ss >= OBJECTSHROUD_FOGGED && draw->getShroudClearFrame() != InvalidShroudClearFrame) { UnsignedInt limit = 2*LOGICFRAMES_PER_SECOND; if (object->isEffectivelyDead()) { // extend the time, so we can see the dead plane blow up & crash. diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp index 0b792eaed86..9e8a032fe07 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp @@ -595,7 +595,7 @@ void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, I // so the player can see them and missiles chasing them. jba. if (ss == OBJECTSHROUD_CLEAR) { draw->setShroudClearFrame(TheGameLogic->getFrame()); - } else if (ss >= OBJECTSHROUD_FOGGED && draw->getShroudClearFrame()!=0) { + } else if (ss >= OBJECTSHROUD_FOGGED && draw->getShroudClearFrame() != InvalidShroudClearFrame) { UnsignedInt limit = 2*LOGICFRAMES_PER_SECOND; if (obj->isEffectivelyDead()) { limit += 3*LOGICFRAMES_PER_SECOND; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index 62b3681a491..ec1e2521ac2 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -339,6 +339,13 @@ void W3DGhostObject::snapShot(int playerIndex) if (draw->isDrawableEffectivelyHidden()) return; //don't bother to snapshot things which nobody can see. + //After we remove the unfogged object, we also disable + //anything that should be hidden inside fog - shadow, particles, etc. + draw->setFullyObscuredByShroud(true); + + // TheSuperHackers @bugfix Definitely keep this shrouded from here on until the shroud becomes clear again. + draw->setShroudClearFrame(InvalidShroudClearFrame); + W3DRenderObjectSnapshot *snap = m_parentSnapshots[playerIndex]; W3DRenderObjectSnapshot *prevSnap = NULL; @@ -417,6 +424,9 @@ void W3DGhostObject::removeParentObject(void) //anything that should be hidden inside fog - shadow, particles, etc. draw->setFullyObscuredByShroud(true); + // TheSuperHackers @bugfix Definitely keep this shrouded from here on until the shroud becomes clear again. + draw->setShroudClearFrame(InvalidShroudClearFrame); + //walk through all W3D render objects used by this object for (DrawModule ** dm = draw->getDrawModules(); *dm; ++dm) { @@ -985,6 +995,12 @@ void W3DGhostObjectManager::setLocalPlayerIndex(int playerIndex) const ObjectShroudStatus shroudStatus = obj->getShroudedStatus(playerIndex); const Bool shrouded = shroudStatus >= OBJECTSHROUD_FOGGED; draw->setFullyObscuredByShroud(shrouded); + + if (shrouded) + { + // TheSuperHackers @bugfix Definitely keep this shrouded from here on until the shroud becomes clear again. + draw->setShroudClearFrame(InvalidShroudClearFrame); + } } } diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h index 56ac630babd..0a2dd69f380 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h @@ -278,6 +278,8 @@ enum TerrainDecalType CPP_11(: Int) //----------------------------------------------------------------------------- +constexpr const UnsignedInt InvalidShroudClearFrame = ~0u; + const Int DRAWABLE_FRAMES_PER_FLASH = LOGICFRAMES_PER_SECOND / 2; //----------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index cfbc46194d1..656e7d18528 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -399,7 +399,7 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusBits statu m_timeElapsedFade = 0; m_timeToFade = 0; - m_shroudClearFrame = 0; + m_shroudClearFrame = InvalidShroudClearFrame; for (i = 0; i < NUM_DRAWABLE_MODULE_TYPES; ++i) m_modules[i] = NULL; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp index a827982ec20..2dfca32504d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -707,7 +707,7 @@ void GameClient::update( void ) } ObjectShroudStatus ss=object->getShroudedStatus(localPlayerIndex); - if (ss >= OBJECTSHROUD_FOGGED && draw->getShroudClearFrame()!=0) { + if (ss >= OBJECTSHROUD_FOGGED && draw->getShroudClearFrame() != InvalidShroudClearFrame) { UnsignedInt limit = 2*LOGICFRAMES_PER_SECOND; if (object->isEffectivelyDead()) { // extend the time, so we can see the dead plane blow up & crash. diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp index 0dd867615e2..63755c1b16f 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp @@ -621,7 +621,7 @@ void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, I // so the player can see them and missiles chasing them. jba. if (ss == OBJECTSHROUD_CLEAR) { draw->setShroudClearFrame(TheGameLogic->getFrame()); - } else if (ss >= OBJECTSHROUD_FOGGED && draw->getShroudClearFrame()!=0) { + } else if (ss >= OBJECTSHROUD_FOGGED && draw->getShroudClearFrame() != InvalidShroudClearFrame) { UnsignedInt limit = 2*LOGICFRAMES_PER_SECOND; if (obj->isEffectivelyDead()) { limit += 3*LOGICFRAMES_PER_SECOND; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index 607d6c7ba90..7ef77aff298 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -343,6 +343,13 @@ void W3DGhostObject::snapShot(int playerIndex) if (draw->isDrawableEffectivelyHidden()) return; //don't bother to snapshot things which nobody can see. + //After we remove the unfogged object, we also disable + //anything that should be hidden inside fog - shadow, particles, etc. + draw->setFullyObscuredByShroud(true); + + // TheSuperHackers @bugfix Definitely keep this shrouded from here on until the shroud becomes clear again. + draw->setShroudClearFrame(InvalidShroudClearFrame); + W3DRenderObjectSnapshot *snap = m_parentSnapshots[playerIndex]; W3DRenderObjectSnapshot *prevSnap = NULL; @@ -421,6 +428,9 @@ void W3DGhostObject::removeParentObject(void) //anything that should be hidden inside fog - shadow, particles, etc. draw->setFullyObscuredByShroud(true); + // TheSuperHackers @bugfix Definitely keep this shrouded from here on until the shroud becomes clear again. + draw->setShroudClearFrame(InvalidShroudClearFrame); + //walk through all W3D render objects used by this object for (DrawModule ** dm = draw->getDrawModules(); *dm; ++dm) { @@ -989,6 +999,12 @@ void W3DGhostObjectManager::setLocalPlayerIndex(int playerIndex) const ObjectShroudStatus shroudStatus = obj->getShroudedStatus(playerIndex); const Bool shrouded = shroudStatus >= OBJECTSHROUD_FOGGED; draw->setFullyObscuredByShroud(shrouded); + + if (shrouded) + { + // TheSuperHackers @bugfix Definitely keep this shrouded from here on until the shroud becomes clear again. + draw->setShroudClearFrame(InvalidShroudClearFrame); + } } } From b4d1013ac08ef5c8d2fc7c018808b0b56cbfb9ed Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 12 Sep 2025 12:59:23 +0200 Subject: [PATCH 195/343] bugfix(radar): Refresh radar objects without delay when changing player (#1569) --- Core/GameEngine/Source/Common/GameUtility.cpp | 1 + .../Code/GameEngine/Include/Common/Radar.h | 3 ++ .../Include/W3DDevice/Common/W3DRadar.h | 2 + .../W3DDevice/Common/System/W3DRadar.cpp | 37 ++++++++++++++----- .../Code/GameEngine/Include/Common/Radar.h | 3 ++ .../Include/W3DDevice/Common/W3DRadar.h | 2 + .../W3DDevice/Common/System/W3DRadar.cpp | 37 ++++++++++++++----- 7 files changed, 65 insertions(+), 20 deletions(-) diff --git a/Core/GameEngine/Source/Common/GameUtility.cpp b/Core/GameEngine/Source/Common/GameUtility.cpp index f7421aaf6a7..de4fff17e12 100644 --- a/Core/GameEngine/Source/Common/GameUtility.cpp +++ b/Core/GameEngine/Source/Common/GameUtility.cpp @@ -43,6 +43,7 @@ static void changePlayerCommon(Player* player) ThePartitionManager->refreshShroudForLocalPlayer(); TheGhostObjectManager->setLocalPlayerIndex(player->getPlayerIndex()); TheGameClient->updateFakeDrawables(); + TheRadar->refreshObjects(); TheInGameUI->deselectAllDrawables(); } diff --git a/Generals/Code/GameEngine/Include/Common/Radar.h b/Generals/Code/GameEngine/Include/Common/Radar.h index aae4e8d102f..92099de16ce 100644 --- a/Generals/Code/GameEngine/Include/Common/Radar.h +++ b/Generals/Code/GameEngine/Include/Common/Radar.h @@ -215,6 +215,9 @@ class Radar : public Snapshot, /// refresh the water values for the radar virtual void refreshTerrain( TerrainLogic *terrain ); + /// refresh the radar when the state of world objects changes drastically + virtual void refreshObjects() {}; + /// queue a refresh of the terran at the next available time virtual void queueTerrainRefresh( void ); diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h index 2df74cc2d1b..e1e0b41b6fa 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h @@ -72,6 +72,7 @@ class W3DRadar : public Radar virtual void setShroudLevel(Int x, Int y, CellShroudStatus setting); virtual void refreshTerrain( TerrainLogic *terrain ); + virtual void refreshObjects(); protected: @@ -85,6 +86,7 @@ class W3DRadar : public Radar void drawViewBox( Int pixelX, Int pixelY, Int width, Int height ); ///< draw view box void buildTerrainTexture( TerrainLogic *terrain ); ///< create the terrain texture of the radar void drawIcons( Int pixelX, Int pixelY, Int width, Int height ); ///< draw all of the radar icons + void updateObjectTexture(TextureClass *texture); void renderObjectList( const RadarObject *listHead, TextureClass *texture, Bool calcHero = FALSE ); ///< render an object list to the texture void interpolateColorForHeight( RGBColor *color, Real height, diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp index 9d8ea110d2f..813288d3278 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp @@ -613,6 +613,20 @@ void W3DRadar::drawIcons( Int pixelX, Int pixelY, Int width, Int height ) } } +//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------------------------- +void W3DRadar::updateObjectTexture(TextureClass *texture) +{ + // reset the overlay texture + SurfaceClass *surface = texture->Get_Surface_Level(); + surface->Clear(); + REF_PTR_RELEASE(surface); + + // rebuild the object overlay + renderObjectList( getObjectList(), texture ); + renderObjectList( getLocalObjectList(), texture, TRUE ); +} + //------------------------------------------------------------------------------------------------- /** Render an object list into the texture passed in */ //------------------------------------------------------------------------------------------------- @@ -1443,16 +1457,7 @@ void W3DRadar::draw( Int pixelX, Int pixelY, Int width, Int height ) // refresh the overlay texture once every so many frames if( TheGameClient->getFrame() % OVERLAY_REFRESH_RATE == 0 ) { - - // reset the overlay texture - SurfaceClass *surface = m_overlayTexture->Get_Surface_Level(); - surface->Clear(); - REF_PTR_RELEASE(surface); - - // rebuild the object overlay - renderObjectList( getObjectList(), m_overlayTexture ); - renderObjectList( getLocalObjectList(), m_overlayTexture, TRUE ); - + updateObjectTexture(m_overlayTexture); } // draw the overlay image @@ -1501,6 +1506,18 @@ void W3DRadar::refreshTerrain( TerrainLogic *terrain ) } +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +void W3DRadar::refreshObjects() +{ + if constexpr (OVERLAY_REFRESH_RATE > 1) + { + if (m_overlayTexture != NULL) + { + updateObjectTexture(m_overlayTexture); + } + } +} diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Radar.h b/GeneralsMD/Code/GameEngine/Include/Common/Radar.h index 43afe9a55db..a180be8cfda 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Radar.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Radar.h @@ -215,6 +215,9 @@ class Radar : public Snapshot, /// refresh the water values for the radar virtual void refreshTerrain( TerrainLogic *terrain ); + /// refresh the radar when the state of world objects changes drastically + virtual void refreshObjects() {}; + /// queue a refresh of the terran at the next available time virtual void queueTerrainRefresh( void ); diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h index 3987348f3e4..c52b5b74000 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h @@ -72,6 +72,7 @@ class W3DRadar : public Radar virtual void setShroudLevel(Int x, Int y, CellShroudStatus setting); virtual void refreshTerrain( TerrainLogic *terrain ); + virtual void refreshObjects(); protected: @@ -85,6 +86,7 @@ class W3DRadar : public Radar void drawViewBox( Int pixelX, Int pixelY, Int width, Int height ); ///< draw view box void buildTerrainTexture( TerrainLogic *terrain ); ///< create the terrain texture of the radar void drawIcons( Int pixelX, Int pixelY, Int width, Int height ); ///< draw all of the radar icons + void updateObjectTexture(TextureClass *texture); void renderObjectList( const RadarObject *listHead, TextureClass *texture, Bool calcHero = FALSE ); ///< render an object list to the texture void interpolateColorForHeight( RGBColor *color, Real height, diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp index d0b42fe9a3b..113575e0628 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp @@ -611,6 +611,20 @@ void W3DRadar::drawIcons( Int pixelX, Int pixelY, Int width, Int height ) } } +//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------------------------- +void W3DRadar::updateObjectTexture(TextureClass *texture) +{ + // reset the overlay texture + SurfaceClass *surface = texture->Get_Surface_Level(); + surface->Clear(); + REF_PTR_RELEASE(surface); + + // rebuild the object overlay + renderObjectList( getObjectList(), texture ); + renderObjectList( getLocalObjectList(), texture, TRUE ); +} + //------------------------------------------------------------------------------------------------- /** Render an object list into the texture passed in */ //------------------------------------------------------------------------------------------------- @@ -1431,16 +1445,7 @@ void W3DRadar::draw( Int pixelX, Int pixelY, Int width, Int height ) // refresh the overlay texture once every so many frames if( TheGameClient->getFrame() % OVERLAY_REFRESH_RATE == 0 ) { - - // reset the overlay texture - SurfaceClass *surface = m_overlayTexture->Get_Surface_Level(); - surface->Clear(); - REF_PTR_RELEASE(surface); - - // rebuild the object overlay - renderObjectList( getObjectList(), m_overlayTexture ); - renderObjectList( getLocalObjectList(), m_overlayTexture, TRUE ); - + updateObjectTexture(m_overlayTexture); } // draw the overlay image @@ -1489,6 +1494,18 @@ void W3DRadar::refreshTerrain( TerrainLogic *terrain ) } +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +void W3DRadar::refreshObjects() +{ + if constexpr (OVERLAY_REFRESH_RATE > 1) + { + if (m_overlayTexture != NULL) + { + updateObjectTexture(m_overlayTexture); + } + } +} From ee9841bf59635fc1b883c2ec7e4f5e9d267cca08 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 12 Sep 2025 12:59:56 +0200 Subject: [PATCH 196/343] bugfix(radar): No longer show hero radar icons in shroud (#1569) --- .../W3DDevice/Common/System/W3DRadar.cpp | 37 ++++++------------- .../W3DDevice/Common/System/W3DRadar.cpp | 37 ++++++------------- 2 files changed, 24 insertions(+), 50 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp index 813288d3278..b6371ff64b5 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp @@ -661,28 +661,19 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text // get object const Object *obj = rObj->friend_getObject(); - // cache hero objects for drawing in icon layer - if( calcHero && obj->isHero() ) - { - m_cachedHeroObjectList.push_back(obj); - } - Bool skip = FALSE; - // check for shrouded status if (obj->getShroudedStatus(playerIndex) > OBJECTSHROUD_PARTIAL_CLEAR) - skip = TRUE; //object is fogged or shrouded, don't render it. + continue; //object is fogged or shrouded, don't render it. // // objects with a local only unit priority will only appear on the radar if they // are controlled by the local player, or if the local player is an observer (cause // they are godlike and can see everything) // - - if( obj->getRadarPriority() == RADAR_PRIORITY_LOCAL_UNIT_ONLY && - obj->getControllingPlayer() != ThePlayerList->getLocalPlayer() && - ThePlayerList->getLocalPlayer()->isPlayerActive() ) - skip = TRUE; + obj->getControllingPlayer() != player && + player->isPlayerActive() ) + continue; // get object position const Coord3D *pos = obj->getPosition(); @@ -691,10 +682,6 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text radarPoint.x = pos->x / (m_mapExtent.width() / RADAR_CELL_WIDTH); radarPoint.y = pos->y / (m_mapExtent.height() / RADAR_CELL_HEIGHT); - - if ( skip ) - continue; - // get the color we're going to draw in Color c = rObj->getColor(); @@ -702,8 +689,8 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text // adjust the alpha for stealth units so they "fade/blink" on the radar for the controller // if( obj->getRadarPriority() == RADAR_PRIORITY_LOCAL_UNIT_ONLY ) - // ML-- What the heck is this? local-only and neutral-observier-viewed units are stealthy?? Since when? - // Now it twinkles for any stealthed object, whether locally controlled or neutral-observier-viewed + // ML-- What the heck is this? local-only and neutral-observer-viewed units are stealthy?? Since when? + // Now it twinkles for any stealthed object, whether locally controlled or neutral-observer-viewed if( obj->testStatus( OBJECT_STATUS_STEALTHED ) ) { StealthUpdate* stealth = obj->getStealth(); @@ -712,7 +699,7 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text if ( TheControlBar->getCurrentlyViewedPlayerRelationship(obj->getTeam()) == ENEMIES ) if( !obj->testStatus( OBJECT_STATUS_DETECTED ) && !stealth->isDisguised() ) - skip = TRUE; + continue; UnsignedByte r, g, b, a; GameGetColorComponents( c, &r, &g, &b, &a ); @@ -720,9 +707,6 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text const UnsignedInt framesForTransition = LOGICFRAMES_PER_SECOND; const UnsignedByte minAlpha = 32; - if (skip) - continue; - Real alphaScale = INT_TO_REAL(TheGameLogic->getFrame() % framesForTransition) / (framesForTransition / 2.0f); if( alphaScale > 0.0f ) a = REAL_TO_UNSIGNEDBYTE( ((alphaScale - 1.0f) * (255.0f - minAlpha)) + minAlpha ); @@ -732,8 +716,11 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text } - - + // cache hero objects for drawing in icon layer + if( calcHero && obj->isHero() ) + { + m_cachedHeroObjectList.push_back(obj); + } // draw the blip, but make sure the points are legal if( legalRadarPoint( radarPoint.x, radarPoint.y ) ) diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp index 113575e0628..9f2118f629b 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp @@ -659,28 +659,19 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text // get object const Object *obj = rObj->friend_getObject(); - // cache hero objects for drawing in icon layer - if( calcHero && obj->isHero() ) - { - m_cachedHeroObjectList.push_back(obj); - } - Bool skip = FALSE; - // check for shrouded status if (obj->getShroudedStatus(playerIndex) > OBJECTSHROUD_PARTIAL_CLEAR) - skip = TRUE; //object is fogged or shrouded, don't render it. + continue; //object is fogged or shrouded, don't render it. // // objects with a local only unit priority will only appear on the radar if they // are controlled by the local player, or if the local player is an observer (cause // they are godlike and can see everything) // - - if( obj->getRadarPriority() == RADAR_PRIORITY_LOCAL_UNIT_ONLY && - obj->getControllingPlayer() != ThePlayerList->getLocalPlayer() && - ThePlayerList->getLocalPlayer()->isPlayerActive() ) - skip = TRUE; + obj->getControllingPlayer() != player && + player->isPlayerActive() ) + continue; // get object position const Coord3D *pos = obj->getPosition(); @@ -689,10 +680,6 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text radarPoint.x = pos->x / (m_mapExtent.width() / RADAR_CELL_WIDTH); radarPoint.y = pos->y / (m_mapExtent.height() / RADAR_CELL_HEIGHT); - - if ( skip ) - continue; - // get the color we're going to draw in Color c = rObj->getColor(); @@ -700,13 +687,13 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text // adjust the alpha for stealth units so they "fade/blink" on the radar for the controller // if( obj->getRadarPriority() == RADAR_PRIORITY_LOCAL_UNIT_ONLY ) - // ML-- What the heck is this? local-only and neutral-observier-viewed units are stealthy?? Since when? - // Now it twinkles for any stealthed object, whether locally controlled or neutral-observier-viewed + // ML-- What the heck is this? local-only and neutral-observer-viewed units are stealthy?? Since when? + // Now it twinkles for any stealthed object, whether locally controlled or neutral-observer-viewed if( obj->testStatus( OBJECT_STATUS_STEALTHED ) ) { if ( TheControlBar->getCurrentlyViewedPlayerRelationship(obj->getTeam()) == ENEMIES ) if( !obj->testStatus( OBJECT_STATUS_DETECTED ) && !obj->testStatus( OBJECT_STATUS_DISGUISED ) ) - skip = TRUE; + continue; UnsignedByte r, g, b, a; GameGetColorComponents( c, &r, &g, &b, &a ); @@ -714,9 +701,6 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text const UnsignedInt framesForTransition = LOGICFRAMES_PER_SECOND; const UnsignedByte minAlpha = 32; - if (skip) - continue; - Real alphaScale = INT_TO_REAL(TheGameLogic->getFrame() % framesForTransition) / (framesForTransition / 2.0f); if( alphaScale > 0.0f ) a = REAL_TO_UNSIGNEDBYTE( ((alphaScale - 1.0f) * (255.0f - minAlpha)) + minAlpha ); @@ -726,8 +710,11 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text } - - + // cache hero objects for drawing in icon layer + if( calcHero && obj->isHero() ) + { + m_cachedHeroObjectList.push_back(obj); + } // draw the blip, but make sure the points are legal if( legalRadarPoint( radarPoint.x, radarPoint.y ) ) From df6ebbd39bcf5a9f1a98f6e9d9071f51a595dcbb Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 12 Sep 2025 13:00:28 +0200 Subject: [PATCH 197/343] bugfix(drawable): Fix duplicated terrain decals applied after call to W3DModelDraw::replaceModelConditionState (#1569) --- .../GameEngine/Include/GameClient/Drawable.h | 4 +- .../GameEngine/Source/GameClient/Drawable.cpp | 53 +++++++++---------- .../GameClient/Drawable/Draw/W3DModelDraw.cpp | 2 - .../GameEngine/Include/GameClient/Drawable.h | 4 +- .../GameEngine/Source/GameClient/Drawable.cpp | 53 +++++++++---------- .../GameClient/Drawable/Draw/W3DModelDraw.cpp | 2 - 6 files changed, 54 insertions(+), 64 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/Drawable.h b/Generals/Code/GameEngine/Include/GameClient/Drawable.h index aad6bf2b9ea..d1b46bd278c 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Drawable.h +++ b/Generals/Code/GameEngine/Include/GameClient/Drawable.h @@ -603,6 +603,8 @@ class Drawable : public Thing, virtual void reactToTransformChange(const Matrix3D* oldMtx, const Coord3D* oldPos, Real oldAngle); void updateHiddenStatus(); + void replaceModelConditionStateInDrawable(); + private: const Locomotor* getLocomotor() const; @@ -686,7 +688,7 @@ class Drawable : public Thing, Bool m_instanceIsIdentity; ///< If true, instance matrix can be skipped Bool m_drawableFullyObscuredByShroud; ///