diff --git a/Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp b/Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp index 666b8e6021..eda40c71c7 100644 --- a/Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp +++ b/Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp @@ -329,7 +329,7 @@ void AudioEventRTS::generateFilename( void ) adjustForLocalization(m_filenameToLoad); return; } else { - if (m_eventInfo->m_sounds.size() == 0) { + if (m_eventInfo->m_sounds.empty()) { m_filenameToLoad = AsciiString::TheEmptyString; return; } diff --git a/Core/GameEngine/Source/Common/System/Xfer.cpp b/Core/GameEngine/Source/Common/System/Xfer.cpp index a9c55059a7..4427a7dd0a 100644 --- a/Core/GameEngine/Source/Common/System/Xfer.cpp +++ b/Core/GameEngine/Source/Common/System/Xfer.cpp @@ -395,7 +395,7 @@ void Xfer::xferSTLObjectIDVector( std::vector *objectIDVectorData ) { // sanity, the list should be empty before we transfer more data into it - if( objectIDVectorData->size() != 0 ) + if( !objectIDVectorData->empty() ) { DEBUG_CRASH(( "Xfer::xferSTLObjectIDList - object vector should be empty before loading" )); @@ -462,7 +462,7 @@ void Xfer::xferSTLObjectIDList( std::list< ObjectID > *objectIDListData ) { // sanity, the list should be empty before we transfer more data into it - if( objectIDListData->size() != 0 ) + if( !objectIDListData->empty() ) { DEBUG_CRASH(( "Xfer::xferSTLObjectIDList - object list should be empty before loading" )); @@ -528,7 +528,7 @@ void Xfer::xferSTLIntList( std::list< Int > *intListData ) { // sanity, the list should be empty before we transfer more data into it - if( intListData->size() != 0 ) + if( !intListData->empty() ) { DEBUG_CRASH(( "Xfer::xferSTLIntList - int list should be empty before loading" )); diff --git a/Core/GameEngine/Source/GameNetwork/GameSpy/LadderDefs.cpp b/Core/GameEngine/Source/GameNetwork/GameSpy/LadderDefs.cpp index 5c566feb60..c59f0613a2 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpy/LadderDefs.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpy/LadderDefs.cpp @@ -163,7 +163,7 @@ static LadderInfo *parseLadder(AsciiString raw) // end of a ladder if (lad->playersPerTeam >= 1 && lad->playersPerTeam <= MAX_SLOTS/2) { - if (lad->validFactions.size() == 0) + if (lad->validFactions.empty()) { DEBUG_LOG(("No factions specified. Using all.")); lad->validFactions.clear(); @@ -190,7 +190,7 @@ static LadderInfo *parseLadder(AsciiString raw) } } - if (lad->validMaps.size() == 0) + if (lad->validMaps.empty()) { DEBUG_LOG(("No maps specified. Using all.")); std::list qmMaps = TheGameSpyConfig->getQMMaps(); @@ -503,9 +503,9 @@ void LadderList::checkLadder( AsciiString fname, Int index ) return; } - if (li->validMaps.size() == 0) + if (li->validMaps.empty()) { - DEBUG_LOG(("Bailing because of li->validMaps.size() == 0")); + DEBUG_LOG(("Bailing because of li->validMaps.empty()")); delete li; return; } diff --git a/Core/GameEngine/Source/GameNetwork/GameSpy/MainMenuUtils.cpp b/Core/GameEngine/Source/GameNetwork/GameSpy/MainMenuUtils.cpp index 81c8ebcc69..c6585cef93 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpy/MainMenuUtils.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpy/MainMenuUtils.cpp @@ -191,7 +191,7 @@ static void startOnline( void ) noPatchBeforeOnlineCallback); return; } - if (queuedDownloads.size()) + if (!queuedDownloads.empty()) { if (!hasWriteAccess()) { diff --git a/Core/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp b/Core/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp index 047ddd1bb1..4e64c1b167 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp @@ -378,7 +378,7 @@ void GameSpyInfo::joinBestGroupRoom( void ) return; } - if (m_groupRooms.size()) + if (!m_groupRooms.empty()) { int minID = -1; int minPlayers = 1000; diff --git a/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp b/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp index 05f7bbb75f..40c5c660e9 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp @@ -1663,7 +1663,7 @@ void PeerThreadClass::Thread_Function() m_playerFactions[i] = 0; m_playerColors[i] = 0; } - if (incomingRequest.password.length() > 0) + if (!incomingRequest.password.empty()) m_hasPassword = true; else m_hasPassword = false; @@ -1714,7 +1714,7 @@ void PeerThreadClass::Thread_Function() case PeerRequest::PEERREQUEST_UTMPLAYER: { - if (incomingRequest.nick.length() > 0) + if (!incomingRequest.nick.empty()) { peerUTMPlayer( peer, incomingRequest.nick.c_str(), incomingRequest.id.c_str(), incomingRequest.options.c_str(), PEERFalse ); } diff --git a/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PersistentStorageThread.cpp b/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PersistentStorageThread.cpp index d21dc20533..959004fc32 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PersistentStorageThread.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PersistentStorageThread.cpp @@ -102,12 +102,12 @@ static void debugDumpPlayerStats( const PSPlayerStats& stats ) DEBUG_LOG(("gamesAsRandom: %d", stats.gamesAsRandom)); } - if (stats.options.length()) + if (!stats.options.empty()) { DEBUG_LOG(("Options: %s", stats.options.c_str())); } - if (stats.systemSpec.length()) + if (!stats.systemSpec.empty()) { DEBUG_LOG(("systemSpec: %s", stats.systemSpec.c_str())); } @@ -184,7 +184,7 @@ static void debugDumpPlayerStats( const PSPlayerStats& stats ) DEBUG_LOG(("lastLadderPort: %d", stats.lastLadderPort)); } - if (stats.lastLadderHost.length()) + if (!stats.lastLadderHost.empty()) { DEBUG_LOG(("lastLadderHost: %s", stats.lastLadderHost.c_str())); } @@ -246,12 +246,12 @@ void PSPlayerStats::incorporate( const PSPlayerStats& other ) gamesAsRandom = other.gamesAsRandom; } - if (other.options.length()) + if (!other.options.empty()) { options = other.options; } - if (other.systemSpec.length()) + if (!other.systemSpec.empty()) { systemSpec = other.systemSpec; } @@ -325,7 +325,7 @@ void PSPlayerStats::incorporate( const PSPlayerStats& other ) { lastLadderPort = other.lastLadderPort; } - if (other.lastLadderHost.length()) + if (!other.lastLadderHost.empty()) { lastLadderHost = other.lastLadderHost; } @@ -971,7 +971,7 @@ void PSThreadClass::Thread_Function() addedInDesyncs4 + req.addDesync, addedInDiscons4 + req.addDiscon)); } pref.write(); - if (req.password.size() == 0) + if (req.password.empty()) return; } if (!req.player.id) @@ -1370,13 +1370,13 @@ std::string GameSpyPSMessageQueueInterface::formatPlayerKVPairs( PSPlayerStats s s.append(kvbuf); } - if (stats.options.length()) + if (!stats.options.empty()) { snprintf(kvbuf, 256, "\\options\\%s", stats.options.c_str()); s.append(kvbuf); } - if (stats.systemSpec.length()) + if (!stats.systemSpec.empty()) { snprintf(kvbuf, 256, "\\systemSpec\\%s", stats.systemSpec.c_str()); s.append(kvbuf); @@ -1472,7 +1472,7 @@ std::string GameSpyPSMessageQueueInterface::formatPlayerKVPairs( PSPlayerStats s sprintf(kvbuf, "\\ladderPort\\%d", stats.lastLadderPort); s.append(kvbuf); } - if (stats.lastLadderHost.length()) + if (!stats.lastLadderHost.empty()) { snprintf(kvbuf, 256, "\\ladderHost\\%s", stats.lastLadderHost.c_str()); s.append(kvbuf); diff --git a/Core/GameEngineDevice/Source/StdDevice/Common/StdLocalFileSystem.cpp b/Core/GameEngineDevice/Source/StdDevice/Common/StdLocalFileSystem.cpp index a9a3362c6c..b20aa0eda6 100644 --- a/Core/GameEngineDevice/Source/StdDevice/Common/StdLocalFileSystem.cpp +++ b/Core/GameEngineDevice/Source/StdDevice/Common/StdLocalFileSystem.cpp @@ -323,7 +323,7 @@ Bool StdLocalFileSystem::createDirectory(AsciiString directory) std::replace(fixedDirectory.begin(), fixedDirectory.end(), '\\', '/'); #endif - if ((fixedDirectory.length() > 0) && (fixedDirectory.length() < _MAX_DIR)) { + if ((!fixedDirectory.empty()) && (fixedDirectory.length() < _MAX_DIR)) { // Convert to host path std::filesystem::path path(std::move(fixedDirectory)); diff --git a/Core/Libraries/Source/WWVegas/WWLib/notifier.h b/Core/Libraries/Source/WWVegas/WWLib/notifier.h index 037dceb2c4..97aaca0831 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/notifier.h +++ b/Core/Libraries/Source/WWVegas/WWLib/notifier.h @@ -88,7 +88,7 @@ template class Observer //! Stop observing event void StopObserving() { - while (mNotifiers.size() > 0) + while (!mNotifiers.empty()) { Notifier* notifier = mNotifiers.back(); assert(notifier && "ERROR: NULL pointer in collection."); diff --git a/Generals/Code/GameEngine/Include/GameClient/AnimateWindowManager.h b/Generals/Code/GameEngine/Include/GameClient/AnimateWindowManager.h index a3e72e0dae..523a4276f5 100644 --- a/Generals/Code/GameEngine/Include/GameClient/AnimateWindowManager.h +++ b/Generals/Code/GameEngine/Include/GameClient/AnimateWindowManager.h @@ -229,7 +229,7 @@ namespace wnd inline Bool AnimateWindowManager::isFinished( void ) { return !m_needsUpdate; }; inline Bool AnimateWindowManager::isReversed( void ) { return m_reverse; }; - inline Bool AnimateWindowManager::isEmpty( void ){return (m_winList.size() == 0 && m_winMustFinishList.size() == 0); } + inline Bool AnimateWindowManager::isEmpty( void ){return (m_winList.empty() && m_winMustFinishList.empty()); } //----------------------------------------------------------------------------- // EXTERNALS ////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp index 90b9fc6008..6fe1d4fca4 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp @@ -352,7 +352,7 @@ Player::Player( Int playerIndex ) void Player::init(const PlayerTemplate* pt) { - DEBUG_ASSERTCRASH(m_playerTeamPrototypes.size() == 0, ("Player::m_playerTeamPrototypes is not empty at game start!")); + DEBUG_ASSERTCRASH(m_playerTeamPrototypes.empty(), ("Player::m_playerTeamPrototypes is not empty at game start!")); m_skillPointsModifier = 1.0f; m_attackedFrame = 0; @@ -3913,7 +3913,7 @@ void Player::xfer( Xfer *xfer ) { // sanity, list must be empty right now - if( m_kindOfPercentProductionChangeList.size() != 0 ) + if( !m_kindOfPercentProductionChangeList.empty() ) { DEBUG_CRASH(( "Player::xfer - m_kindOfPercentProductionChangeList should be empty but is not" )); @@ -3966,7 +3966,7 @@ void Player::xfer( Xfer *xfer ) } else { - if( m_specialPowerReadyTimerList.size() != 0 ) // sanity, list must be empty right now + if( !m_specialPowerReadyTimerList.empty() ) // sanity, list must be empty right now { DEBUG_CRASH(( "Player::xfer - m_specialPowerReadyTimerList should be empty but is not" )); throw SC_INVALID_DATA; diff --git a/Generals/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp b/Generals/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp index bc70cbb12b..1decc6c6e6 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp @@ -128,7 +128,7 @@ Int ProductionPrerequisite::getAllPossibleBuildFacilityTemplates(const ThingTemp const ThingTemplate *ProductionPrerequisite::getExistingBuildFacilityTemplate( const Player *player ) const { DEBUG_ASSERTCRASH(player, ("player may not be null")); - if (m_prereqUnits.size()) + if (!m_prereqUnits.empty()) { Int ownCount[MAX_PREREQ]; Int cnt = calcNumPrereqUnitsOwned(player, ownCount); diff --git a/Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp b/Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp index cac0a999b1..541d644a7c 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp @@ -414,7 +414,7 @@ void TunnelTracker::loadPostProcess( void ) { // sanity, the contain list should be empty until we post process the id list - if( m_containList.size() != 0 ) + if( !m_containList.empty() ) { DEBUG_CRASH(( "TunnelTracker::loadPostProcess - m_containList should be empty but is not" )); diff --git a/Generals/Code/GameEngine/Source/GameClient/Credits.cpp b/Generals/Code/GameEngine/Source/GameClient/Credits.cpp index 7d132eae2b..2774ced465 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Credits.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Credits.cpp @@ -221,7 +221,7 @@ void CreditsManager::update( void ) if(!((m_scrollDown && (yTest >= start)) || (!m_scrollDown && (yTest <= start)))) return; - if(m_displayedCreditLineList.size() == 0 && m_creditLineListIt == m_creditLineList.end()) + if(m_displayedCreditLineList.empty() && m_creditLineListIt == m_creditLineList.end()) m_isFinished = TRUE; if(m_creditLineListIt == m_creditLineList.end()) diff --git a/Generals/Code/GameEngine/Source/GameClient/Eva.cpp b/Generals/Code/GameEngine/Source/GameClient/Eva.cpp index f2e86d0498..60c7ec34f5 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Eva.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Eva.cpp @@ -436,7 +436,7 @@ void Eva::processPlayingMessages(UnsignedInt currentFrame) for (Int i = 0; i < numSides; ++i) { if (side.compareNoCase(storedIt->m_evaInfo->m_evaSideSounds[i].m_side) == 0) { // Its this one. - if (storedIt->m_evaInfo->m_evaSideSounds[i].m_soundNames.size() > 0) { + if (!storedIt->m_evaInfo->m_evaSideSounds[i].m_soundNames.empty()) { Int soundToPlay = GameClientRandomValue(0, storedIt->m_evaInfo->m_evaSideSounds[i].m_soundNames.size() - 1); m_evaSpeech.setEventName(storedIt->m_evaInfo->m_evaSideSounds[i].m_soundNames[soundToPlay]); } else { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp index f5ec055e12..949284420c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp @@ -1009,7 +1009,7 @@ void ControlBarSchemeManager::init( void ) // if (FindFirstFile(userDataPath.str(), &findData) !=INVALID_HANDLE_VALUE) // ini.loadFileDirectory(userDataPath, INI_LOAD_OVERWRITE, NULL ); // } - if( m_schemeList.size() <= 0 ) + if( m_schemeList.empty() ) { DEBUG_ASSERTCRASH(FALSE,("There's no ControlBarScheme in the ControlBarSchemeList:m_schemeList that was just read from the INI file")); return; 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 e719999f2f..ee6569ab86 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp @@ -563,7 +563,7 @@ void PopulateLobbyPlayerListbox(void) } // restore selection - if (indicesToSelect.size()) + if (!indicesToSelect.empty()) { std::set::const_iterator indexIt = indicesToSelect.begin(); const size_t count = indicesToSelect.size(); @@ -1148,7 +1148,7 @@ void WOLLobbyMenuUpdate( WindowLayout * layout, void *userData) //if (ParseAsciiStringToGameInfo(&room, resp.stagingRoomMapName.c_str())) //if (ParseAsciiStringToGameInfo(&room, resp.stagingServerGameOptions.c_str())) Bool serverOk = TRUE; - if (!resp.stagingRoomMapName.length()) + if (resp.stagingRoomMapName.empty()) { serverOk = FALSE; } @@ -1220,7 +1220,7 @@ void WOLLobbyMenuUpdate( WindowLayout * layout, void *userData) slot->setState(SLOT_BRUTAL_AI); ++numPlayers; } - else if (resp.stagingRoomPlayerNames[i].length()) + else if (!resp.stagingRoomPlayerNames[i].empty()) { UnicodeString nameUStr; nameUStr.translate(resp.stagingRoomPlayerNames[i].c_str()); 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 35d8a0bf6e..10018d7577 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp @@ -786,9 +786,9 @@ void WOLQuickMatchMenuInit( WindowLayout *layout, void *userData ) comboBoxSide = TheWindowManager->winGetWindowFromId( parentWOLQuickMatch, comboBoxSideID ); comboBoxColor = TheWindowManager->winGetWindowFromId( parentWOLQuickMatch, comboBoxColorID ); - if (TheLadderList->getStandardLadders()->size() == 0 - && TheLadderList->getSpecialLadders()->size() == 0 - && TheLadderList->getLocalLadders()->size() == 0) + if (TheLadderList->getStandardLadders()->empty() + && TheLadderList->getSpecialLadders()->empty() + && TheLadderList->getLocalLadders()->empty()) { // no ladders, so just disable them comboBoxDisabledLadder = comboBoxLadder; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp index ddddb59367..de8aa1c029 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp @@ -3976,7 +3976,7 @@ Bool GameWindowManager::initTestGUI( void ) void GameWindowManager::winNextTab( GameWindow *window ) { - if(m_tabList.size() == 0|| m_modalHead) + if(m_tabList.empty()|| m_modalHead) return; GameWindowList::iterator it = m_tabList.begin(); @@ -4000,7 +4000,7 @@ void GameWindowManager::winNextTab( GameWindow *window ) void GameWindowManager::winPrevTab( GameWindow *window ) { - if(m_tabList.size() == 0 || m_modalHead) + if(m_tabList.empty() || m_modalHead) return; GameWindowList::reverse_iterator it = m_tabList.rbegin(); diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index 773aed31c2..32df1e7dd2 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -623,7 +623,7 @@ Bool InGameUI::removeSuperweapon(Int playerIndex, const AsciiString& powerName, SuperweaponInfo *info = *listIt; swList.erase(listIt); deleteInstance(info); - if (swList.size() == 0) + if (swList.empty()) { m_superweapons[playerIndex].erase(mapIt); } @@ -4522,7 +4522,7 @@ Bool InGameUI::canSelectedObjectsDoSpecialPower( const CommandButton *command, c if (ignoreSelDraw) tmpList.push_back(ignoreSelDraw); - const DrawableList* selected = (tmpList.size() > 0) ? &tmpList : TheInGameUI->getAllSelectedDrawables(); + const DrawableList* selected = (!tmpList.empty()) ? &tmpList : TheInGameUI->getAllSelectedDrawables(); // set up counters for rule checking Int count = 0; @@ -4785,7 +4785,7 @@ Int InGameUI::selectMatchingAcrossRegion( IRegion2D *region ) } } - if (drawableList.size() == 0) + if (drawableList.empty()) return -1; // nothing useful selected to begin with - don't bother iterating std::set::iterator iter; diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp index 72ba53e678..430028eb38 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp @@ -324,7 +324,7 @@ void AI::reset( void ) } #if RETAIL_COMPATIBLE_AIGROUP - while (m_groupList.size()) + while (!m_groupList.empty()) { AIGroup *groupToRemove = m_groupList.front(); if (groupToRemove) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp index abe1e67bf6..aa09e57472 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp @@ -1042,7 +1042,7 @@ Bool AIGroup::friend_moveInfantryToPos( const Coord3D *pos, CommandSourceType cm dest.y -= factor*offset*endVector.y; dest.z = TheTerrainLogic->getLayerHeight( dest.x, dest.y, layer ); - while (path.size()>0) { + while (!path.empty()) { Coord2D curVector; prevPos = path[path.size()-1]; curVector.x = dest.x-prevPos.x; @@ -1520,7 +1520,7 @@ Bool AIGroup::friend_moveVehicleToPos( const Coord3D *pos, CommandSourceType cmd dest.y -= factor*offset*endVector.y; dest.z = TheTerrainLogic->getLayerHeight( dest.x, dest.y, layer ); - while (path.size()>0) { + while (!path.empty()) { Coord2D curVector; prevPos = path[path.size()-1]; curVector.x = dest.x-prevPos.x; diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 79913a7c7d..05ce1ea359 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -966,7 +966,7 @@ StateReturnType AIStateMachine::setTemporaryState( StateID newStateID, Int frame */ void AIStateMachine::addToGoalPath( const Coord3D *pathPoint) { - if (m_goalPath.size()==0) { + if (m_goalPath.empty()) { m_goalPath.push_back(*pathPoint); } else { Coord3D *finalPoint = &m_goalPath[ m_goalPath.size() - 1 ]; @@ -5793,7 +5793,7 @@ Object *AIAttackSquadState::chooseVictim(void) { // everyone picks the same unit VecObjectPtr objects = victimSquad->getLiveObjects(); - if (objects.size() > 0) + if (!objects.empty()) { return objects[0]; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/Squad.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/Squad.cpp index 6db457e90f..157899e690 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/Squad.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/Squad.cpp @@ -233,7 +233,7 @@ void Squad::xfer( Xfer *xfer ) { // the cached objects list should be empty - if( m_objectsCached.size() != 0 ) + if( !m_objectsCached.empty() ) { DEBUG_CRASH(( "Squad::xfer - m_objectsCached should be emtpy, but is not" )); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp index af4d7ea89f..1bdc37c657 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp @@ -1451,7 +1451,7 @@ void BridgeBehavior::xfer( Xfer *xfer ) { // read all object IDs - DEBUG_ASSERTCRASH( m_scaffoldObjectIDList.size() == 0, + DEBUG_ASSERTCRASH( m_scaffoldObjectIDList.empty(), ("BridgeBehavior::xfer - scaffold object list should be empty") ); for( Int i = 0; i < scaffoldObjectCount; ++i ) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp index 93e792bb46..2398127315 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp @@ -938,7 +938,7 @@ class GenericObjectCreationNugget : public ObjectCreationNugget if (di) { di->setModelName(modelName, m_okToChangeModelColor ? obj->getIndicatorColor() : 0, m_shadowType); - if (m_animSets.size() > 0) + if (!m_animSets.empty()) { Int which = GameLogicRandomValue(0, m_animSets.size()-1); di->setAnimNames(m_animSets[which].m_animInitial, m_animSets[which].m_animFlying, m_animSets[which].m_animFinal, m_fxFinal); @@ -1217,7 +1217,7 @@ class GenericObjectCreationNugget : public ObjectCreationNugget { static const ThingTemplate* debrisTemplate = TheThingFactory->findTemplate("GenericDebris"); - if (m_names.size() <= 0) + if (m_names.empty()) return NULL; if (m_requiresLivePlayer && (!sourceObj || !sourceObj->getControllingPlayer()->isPlayerActive())) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index ce28b73cbe..b2c353701d 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -4653,7 +4653,7 @@ void PartitionManager::xfer( Xfer *xfer ) // have to remove this assert, because during load there is a setTeam call for each guy on a sub-team, and that results // in a queued unlook, so we actually have stuff in here at the start. I am fairly certain that setTeam should wait // until loadPostProcess, but I ain't gonna change it now. -// DEBUG_ASSERTCRASH(m_pendingUndoShroudReveals.size() == 0, ("At load, we appear to not be in a reset state.") ); +// DEBUG_ASSERTCRASH(m_pendingUndoShroudReveals.empty(), ("At load, we appear to not be in a reset state.") ); // I have to split this up though, since on Load I need to make new instances. for( Int infoIndex = 0; infoIndex < queueSize; infoIndex++ ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index e515ff54a4..678d87cfeb 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -3254,7 +3254,7 @@ void AIUpdateInterface::privateFollowPath( const std::vector* path, Obj // clear current state machine getStateMachine()->clear(); - if (path->size()>0) { + if (!path->empty()) { const Coord3D goal = (*path)[path->size()-1]; getStateMachine()->setGoalPosition(&goal); } 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 51d2a7813e..a8c7c8876c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp @@ -681,7 +681,7 @@ StateReturnType DeliveringState::update() // Kick a dude out every so often return STATE_FAILURE; const ContainedItemsList* items = owner->getContain() ? owner->getContain()->getContainedItemsList() : NULL; - if( (!items || !items->size()) && ai->getVisibleItemsDelivered() == ai->getData()->m_visibleNumBones ) + if( (!items || items->empty()) && ai->getVisibleItemsDelivered() == ai->getData()->m_visibleNumBones ) { //We are out of payload to drop AND our visible payload is empty. It's possible for deliverers to //have one or the other or even both. diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index 45aadbb0e9..7bae95eebb 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -1103,7 +1103,7 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate void WeaponTemplate::trimOldHistoricDamage() const { UnsignedInt expirationDate = TheGameLogic->getFrame() - TheGlobalData->m_historicDamageLimit; - while (m_historicDamage.size() > 0) + while (!m_historicDamage.empty()) { HistoricWeaponDamageInfo& h = m_historicDamage.front(); if (h.frame <= expirationDate) @@ -2471,7 +2471,7 @@ Bool Weapon::privateFireWeapon( m_numShotsForCurBarrel = m_template->getShotsPerBarrel(); } - if( m_scatterTargetsUnused.size() ) + if( !m_scatterTargetsUnused.empty() ) { // If I have a set scatter pattern, I need to offset the target by a random pick from that pattern if( victimObj ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index 6ff9d7e76e..3430b6352a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -8147,7 +8147,7 @@ void ScriptEngine::xfer( Xfer *xfer ) { // this list should be empty on loading - if( m_sequentialScripts.size() != 0 ) + if( !m_sequentialScripts.empty() ) { DEBUG_CRASH(( "ScriptEngine::xfer - m_sequentialScripts should be empty but is not" )); diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h index 3db0b660f3..226dc9c769 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h @@ -245,7 +245,7 @@ struct ModelConditionInfo void loadAnimations() const; void preloadAssets( TimeOfDay timeOfDay, Real scale ); ///< preload any assets for time of day - Int getConditionsYesCount() const { DEBUG_ASSERTCRASH(m_conditionsYesVec.size() > 0, ("empty m_conditionsYesVec.size(), see srj")); return m_conditionsYesVec.size(); } + Int getConditionsYesCount() const { DEBUG_ASSERTCRASH(!m_conditionsYesVec.empty(), ("empty m_conditionsYesVec.size(), see srj")); return m_conditionsYesVec.size(); } const ModelConditionFlags& getNthConditionsYes(Int i) const { return m_conditionsYesVec[i]; } #if defined(RTS_DEBUG) inline AsciiString getDescription() const { return m_description; } 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 9bab297741..aab8c0ebf9 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp @@ -647,7 +647,7 @@ void ModelConditionInfo::validateCachedBones(RenderObjClass* robj, Real scale) c // if we have any animations in this state, always choose the first, since the animations // vary on a per-client basis. HAnimClass* animToUse; - if (m_animations.size() > 0) + if (!m_animations.empty()) { animToUse = m_animations.front().getAnimHandle(); // return an AddRef'ed handle } @@ -1601,7 +1601,7 @@ void W3DModelDrawModuleData::parseConditionState(INI* ini, void *instance, void throw INI_INVALID_DATA; } - DEBUG_ASSERTCRASH(info.m_conditionsYesVec.size() == 0, ("*** ASSET ERROR: nonempty m_conditionsYesVec.size(), see srj")); + DEBUG_ASSERTCRASH(info.m_conditionsYesVec.empty(), ("*** ASSET ERROR: nonempty m_conditionsYesVec.size(), see srj")); info.m_conditionsYesVec.clear(); info.m_conditionsYesVec.push_back(conditionsYes); } @@ -3750,8 +3750,8 @@ void W3DModelDraw::setAnimationLoopDuration(UnsignedInt numFrames) */ void W3DModelDraw::setAnimationCompletionTime(UnsignedInt numFrames) { - if (m_curState != NULL && m_curState->m_transitionSig != NO_TRANSITION && m_curState->m_animations.size() > 0 && - m_nextState != NULL && m_nextState->m_transitionSig == NO_TRANSITION && m_nextState->m_animations.size() > 0) + if (m_curState != NULL && m_curState->m_transitionSig != NO_TRANSITION && !m_curState->m_animations.empty() && + m_nextState != NULL && m_nextState->m_transitionSig == NO_TRANSITION && !m_nextState->m_animations.empty()) { // we have a transition; split up the time suitably. // note that this is just a guess, and assumes that the states diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp index cb4ed6f216..6ece16cdf7 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp @@ -183,7 +183,7 @@ void W3DTerrainLogic::getExtent( Region3D *extent ) const // Note - m_boundaries are stored in height map grids wide, so we have to // multiply by the grid width. - if (m_boundaries.size() > 0) { + if (!m_boundaries.empty()) { extent->hi.x = m_boundaries[m_activeBoundary].x*MAP_XY_FACTOR; extent->hi.y = m_boundaries[m_activeBoundary].y*MAP_XY_FACTOR; } else { diff --git a/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp b/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp index 5ce153562c..670b92543b 100644 --- a/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp +++ b/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp @@ -336,7 +336,7 @@ void DebugWindowDialog::getSelectedParticleAsciiStringParm( IN int parmNum, OUT return; } - if (m_particleParmValues[parmNum].length()) { + if (!m_particleParmValues[parmNum].empty()) { strcpy(bufferToCopyInto, m_particleParmValues[parmNum].c_str()); } else { bufferToCopyInto[0] = 0; diff --git a/Generals/Code/Tools/WorldBuilder/src/LayersList.cpp b/Generals/Code/Tools/WorldBuilder/src/LayersList.cpp index a055af1b36..5a44b9c464 100644 --- a/Generals/Code/Tools/WorldBuilder/src/LayersList.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/LayersList.cpp @@ -826,7 +826,7 @@ void LayersList::OnMergeViewSelection(UINT commandID) mapObject = mapObject->getNext(); } - while (allSelectedObjects.size() > 0) { + while (!allSelectedObjects.empty()) { changeMapObjectLayer(allSelectedObjects.top(), layerIt->layerName); allSelectedObjects.pop(); } diff --git a/Generals/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp index a8018940ae..fc0ec4df85 100644 --- a/Generals/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp @@ -86,7 +86,7 @@ BOOL MeshMoldOptions::OnInitDialog() FilenameList filenameList; TheFileSystem->getFileListInDirectory(".\\data\\Editor\\Molds\\", "*.w3d", filenameList, FALSE); - if (filenameList.size() > 0) { + if (!filenameList.empty()) { HTREEITEM child = NULL; FilenameList::iterator it = filenameList.begin(); do { diff --git a/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp index 4490424518..941cee4d11 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp @@ -283,7 +283,7 @@ BOOL ObjectOptions::OnInitDialog() FilenameList filenameList; TheFileSystem->getFileListInDirectory(TEST_W3D_DIR_PATH, "*.w3d", filenameList, FALSE); - if (filenameList.size() > 0) { + if (!filenameList.empty()) { FilenameList::iterator it = filenameList.begin(); do { AsciiString filename = *it; diff --git a/Generals/Code/Tools/WorldBuilder/src/RoadOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/RoadOptions.cpp index 744d8d857a..68d0820454 100644 --- a/Generals/Code/Tools/WorldBuilder/src/RoadOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/RoadOptions.cpp @@ -247,7 +247,7 @@ BOOL RoadOptions::OnInitDialog() FilenameList filenameList; TheFileSystem->getFileListInDirectory(ROAD_DIRECTORY, "*.tga", filenameList, FALSE); - if (filenameList.size() > 0) { + if (!filenameList.empty()) { FilenameList::iterator it = filenameList.begin(); do { AsciiString filename = *it; diff --git a/Generals/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp b/Generals/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp index fe8584c298..d2de095c9e 100644 --- a/Generals/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp @@ -78,7 +78,7 @@ BOOL SelectMacrotexture::OnInitDialog() FilenameList filenameList; TheFileSystem->getFileListInDirectory("..\\TestArt\\", "*.tga", filenameList, FALSE); - if (filenameList.size() > 0) { + if (!filenameList.empty()) { TVINSERTSTRUCT ins; HTREEITEM child = NULL; FilenameList::iterator it = filenameList.begin(); diff --git a/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp b/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp index 9a8ed55116..e667ac3f90 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp @@ -427,7 +427,7 @@ void WorldHeightMapEdit::loadDirectoryOfImages(const char *pFilePath) FilenameList filenameList; TheFileSystem->getFileListInDirectory(AsciiString(dirBuf), "*.*", filenameList, TRUE); - if (filenameList.size() == 0) { + if (filenameList.empty()) { return; } FilenameList::iterator it = filenameList.begin(); @@ -3378,7 +3378,7 @@ void WorldHeightMapEdit::changeBoundary(Int ndx, ICoord2D *border) void WorldHeightMapEdit::removeLastBoundary(void) { - if (m_boundaries.size() == 0) { + if (m_boundaries.empty()) { DEBUG_CRASH(("Invalid border remove request. jkmcd")); return; } diff --git a/Generals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp b/Generals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp index 833e10e66c..da3eb6fb1c 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp @@ -194,7 +194,7 @@ class CachedMFCFileOutputStream : public OutputStream return(numBytes); }; virtual void flush(void) { - while (m_cachedChunks.size() != 0)//!m_cachedChunks.empty()) + while (!m_cachedChunks.empty())//!m_cachedChunks.empty()) { CachedChunk c = m_cachedChunks.front(); m_cachedChunks.pop_front(); @@ -232,7 +232,7 @@ class CompressedCachedMFCFileOutputStream : public OutputStream return; UnsignedByte *srcBuffer = NEW UnsignedByte[m_totalBytes]; UnsignedByte *insertPos = srcBuffer; - while (m_cachedChunks.size() != 0) + while (!m_cachedChunks.empty()) { CachedChunk c = m_cachedChunks.front(); m_cachedChunks.pop_front(); @@ -1474,7 +1474,7 @@ Bool CWorldBuilderDoc::getAllIndexesInRect(const Coord3D* bl, const Coord3D* br, FindIndexNearest(this, ¢er, &ndx, PREFER_BOTTOM); AddUniqueAndNeighbors(this, bl, br, tl, tr, ndx, allIndices); - return (allIndices->size() > 0); + return (!allIndices->empty()); } @@ -2245,7 +2245,7 @@ void CWorldBuilderDoc::OnDumpDocToText(void) fprintf(theLogFile, "Total Map Objects (with ThingTemplates): %d\n", totalObjectCount); - while (mapOfTemplates.size() > 0) { + while (!mapOfTemplates.empty()) { std::map::iterator storedIt = mapOfTemplates.begin(); for (it = mapOfTemplates.begin(); it != mapOfTemplates.end(); ++it) { diff --git a/Generals/Code/Tools/WorldBuilder/src/mapobjectprops.cpp b/Generals/Code/Tools/WorldBuilder/src/mapobjectprops.cpp index fe8c46bd54..59d8b88363 100644 --- a/Generals/Code/Tools/WorldBuilder/src/mapobjectprops.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/mapobjectprops.cpp @@ -749,7 +749,7 @@ void MapObjectProps::_DictToPrebuiltUpgrades(void) if (!gmbmd) { continue; } - if (gmbmd->m_upgradeMuxData.m_activationUpgradeNames.size() > 0) { + if (!gmbmd->m_upgradeMuxData.m_activationUpgradeNames.empty()) { cstr = gmbmd->m_upgradeMuxData.m_activationUpgradeNames[0].str(); if (pBox->FindString(-1, cstr) == LB_ERR) { pBox->AddString(cstr); diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/AnimateWindowManager.h b/GeneralsMD/Code/GameEngine/Include/GameClient/AnimateWindowManager.h index bd74f4c3d8..a43b0c8222 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/AnimateWindowManager.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/AnimateWindowManager.h @@ -229,7 +229,7 @@ namespace wnd inline Bool AnimateWindowManager::isFinished( void ) { return !m_needsUpdate; }; inline Bool AnimateWindowManager::isReversed( void ) { return m_reverse; }; - inline Bool AnimateWindowManager::isEmpty( void ){return (m_winList.size() == 0 && m_winMustFinishList.size() == 0); } + inline Bool AnimateWindowManager::isEmpty( void ){return (m_winList.empty() && m_winMustFinishList.empty()); } //----------------------------------------------------------------------------- // EXTERNALS ////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp index 9088ec4bd1..ec98aa370d 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp @@ -352,7 +352,7 @@ Player::Player( Int playerIndex ) void Player::init(const PlayerTemplate* pt) { - DEBUG_ASSERTCRASH(m_playerTeamPrototypes.size() == 0, ("Player::m_playerTeamPrototypes is not empty at game start!")); + DEBUG_ASSERTCRASH(m_playerTeamPrototypes.empty(), ("Player::m_playerTeamPrototypes is not empty at game start!")); m_skillPointsModifier = 1.0f; m_attackedFrame = 0; @@ -4376,7 +4376,7 @@ void Player::xfer( Xfer *xfer ) { // sanity, list must be empty right now - if( m_kindOfPercentProductionChangeList.size() != 0 ) + if( !m_kindOfPercentProductionChangeList.empty() ) { DEBUG_CRASH(( "Player::xfer - m_kindOfPercentProductionChangeList should be empty but is not" )); @@ -4429,7 +4429,7 @@ void Player::xfer( Xfer *xfer ) } else { - if( m_specialPowerReadyTimerList.size() != 0 ) // sanity, list must be empty right now + if( !m_specialPowerReadyTimerList.empty() ) // sanity, list must be empty right now { DEBUG_CRASH(( "Player::xfer - m_specialPowerReadyTimerList should be empty but is not" )); throw SC_INVALID_DATA; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp index 61770bd035..0e5bc0904e 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp @@ -131,7 +131,7 @@ Int ProductionPrerequisite::getAllPossibleBuildFacilityTemplates(const ThingTemp const ThingTemplate *ProductionPrerequisite::getExistingBuildFacilityTemplate( const Player *player ) const { DEBUG_ASSERTCRASH(player, ("player may not be null")); - if (m_prereqUnits.size()) + if (!m_prereqUnits.empty()) { Int ownCount[MAX_PREREQ]; Int cnt = calcNumPrereqUnitsOwned(player, ownCount); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp index 55bc3f6671..72ea6a2822 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp @@ -415,7 +415,7 @@ void TunnelTracker::loadPostProcess( void ) { // sanity, the contain list should be empty until we post process the id list - if( m_containList.size() != 0 ) + if( !m_containList.empty() ) { DEBUG_CRASH(( "TunnelTracker::loadPostProcess - m_containList should be empty but is not" )); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp index a26d9eee66..14c845436a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp @@ -221,7 +221,7 @@ void CreditsManager::update( void ) if(!((m_scrollDown && (yTest >= start)) || (!m_scrollDown && (yTest <= start)))) return; - if(m_displayedCreditLineList.size() == 0 && m_creditLineListIt == m_creditLineList.end()) + if(m_displayedCreditLineList.empty() && m_creditLineListIt == m_creditLineList.end()) m_isFinished = TRUE; if(m_creditLineListIt == m_creditLineList.end()) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp index 25b02f109a..31db3b8761 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp @@ -513,7 +513,7 @@ void Eva::processPlayingMessages(UnsignedInt currentFrame) for (Int i = 0; i < numSides; ++i) { if (side.compareNoCase(storedIt->m_evaInfo->m_evaSideSounds[i].m_side) == 0) { // Its this one. - if (storedIt->m_evaInfo->m_evaSideSounds[i].m_soundNames.size() > 0) { + if (!storedIt->m_evaInfo->m_evaSideSounds[i].m_soundNames.empty()) { Int soundToPlay = GameClientRandomValue(0, storedIt->m_evaInfo->m_evaSideSounds[i].m_soundNames.size() - 1); m_evaSpeech.setEventName(storedIt->m_evaInfo->m_evaSideSounds[i].m_soundNames[soundToPlay]); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp index dd3ff335ae..32b2752719 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp @@ -1022,7 +1022,7 @@ void ControlBarSchemeManager::init( void ) // if (FindFirstFile(userDataPath.str(), &findData) !=INVALID_HANDLE_VALUE) // ini.loadFileDirectory(userDataPath, INI_LOAD_OVERWRITE, NULL ); // } - if( m_schemeList.size() <= 0 ) + if( m_schemeList.empty() ) { DEBUG_ASSERTCRASH(FALSE,("There's no ControlBarScheme in the ControlBarSchemeList:m_schemeList that was just read from the INI file")); return; 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 da15a065ab..6ad99be4c4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp @@ -580,7 +580,7 @@ void PopulateLobbyPlayerListbox(void) } // restore selection - if (indicesToSelect.size()) + if (!indicesToSelect.empty()) { std::set::const_iterator indexIt = indicesToSelect.begin(); const size_t count = indicesToSelect.size(); @@ -1166,7 +1166,7 @@ void WOLLobbyMenuUpdate( WindowLayout * layout, void *userData) //if (ParseAsciiStringToGameInfo(&room, resp.stagingRoomMapName.c_str())) //if (ParseAsciiStringToGameInfo(&room, resp.stagingServerGameOptions.c_str())) Bool serverOk = TRUE; - if (!resp.stagingRoomMapName.length()) + if (resp.stagingRoomMapName.empty()) { serverOk = FALSE; } @@ -1238,7 +1238,7 @@ void WOLLobbyMenuUpdate( WindowLayout * layout, void *userData) slot->setState(SLOT_BRUTAL_AI); ++numPlayers; } - else if (resp.stagingRoomPlayerNames[i].length()) + else if (!resp.stagingRoomPlayerNames[i].empty()) { UnicodeString nameUStr; nameUStr.translate(resp.stagingRoomPlayerNames[i].c_str()); 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 d793702957..5557eade74 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp @@ -765,9 +765,9 @@ void WOLQuickMatchMenuInit( WindowLayout *layout, void *userData ) comboBoxSide = TheWindowManager->winGetWindowFromId( parentWOLQuickMatch, comboBoxSideID ); comboBoxColor = TheWindowManager->winGetWindowFromId( parentWOLQuickMatch, comboBoxColorID ); - if (TheLadderList->getStandardLadders()->size() == 0 - && TheLadderList->getSpecialLadders()->size() == 0 - && TheLadderList->getLocalLadders()->size() == 0) + if (TheLadderList->getStandardLadders()->empty() + && TheLadderList->getSpecialLadders()->empty() + && TheLadderList->getLocalLadders()->empty()) { // no ladders, so just disable them comboBoxDisabledLadder = comboBoxLadder; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp index a0d01be715..197fdd05ec 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp @@ -3976,7 +3976,7 @@ Bool GameWindowManager::initTestGUI( void ) void GameWindowManager::winNextTab( GameWindow *window ) { - if(m_tabList.size() == 0|| m_modalHead) + if(m_tabList.empty()|| m_modalHead) return; GameWindowList::iterator it = m_tabList.begin(); @@ -4000,7 +4000,7 @@ void GameWindowManager::winNextTab( GameWindow *window ) void GameWindowManager::winPrevTab( GameWindow *window ) { - if(m_tabList.size() == 0 || m_modalHead) + if(m_tabList.empty() || m_modalHead) return; GameWindowList::reverse_iterator it = m_tabList.rbegin(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index 8bbebf42c0..de61454f1d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -647,7 +647,7 @@ Bool InGameUI::removeSuperweapon(Int playerIndex, const AsciiString& powerName, SuperweaponInfo *info = *listIt; swList.erase(listIt); deleteInstance(info); - if (swList.size() == 0) + if (swList.empty()) { m_superweapons[playerIndex].erase(mapIt); } @@ -4695,7 +4695,7 @@ Bool InGameUI::canSelectedObjectsDoSpecialPower( const CommandButton *command, c if (ignoreSelDraw) tmpList.push_back(ignoreSelDraw); - const DrawableList* selected = (tmpList.size() > 0) ? &tmpList : TheInGameUI->getAllSelectedDrawables(); + const DrawableList* selected = (!tmpList.empty()) ? &tmpList : TheInGameUI->getAllSelectedDrawables(); // set up counters for rule checking Int count = 0; @@ -4958,7 +4958,7 @@ Int InGameUI::selectMatchingAcrossRegion( IRegion2D *region ) } } - if (drawableList.size() == 0) + if (drawableList.empty()) return -1; // nothing useful selected to begin with - don't bother iterating std::set::iterator iter; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp index fa9ad40747..5cf8868c99 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp @@ -327,7 +327,7 @@ void AI::reset( void ) } #if RETAIL_COMPATIBLE_AIGROUP - while (m_groupList.size()) + while (!m_groupList.empty()) { AIGroup *groupToRemove = m_groupList.front(); if (groupToRemove) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp index cb9569d3a2..e09a4f24a7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp @@ -1046,7 +1046,7 @@ Bool AIGroup::friend_moveInfantryToPos( const Coord3D *pos, CommandSourceType cm dest.y -= factor*offset*endVector.y; dest.z = TheTerrainLogic->getLayerHeight( dest.x, dest.y, layer ); - while (path.size()>0) { + while (!path.empty()) { Coord2D curVector; prevPos = path[path.size()-1]; curVector.x = dest.x-prevPos.x; @@ -1529,7 +1529,7 @@ Bool AIGroup::friend_moveVehicleToPos( const Coord3D *pos, CommandSourceType cmd dest.y -= factor*offset*endVector.y; dest.z = TheTerrainLogic->getLayerHeight( dest.x, dest.y, layer ); - while (path.size()>0) { + while (!path.empty()) { Coord2D curVector; prevPos = path[path.size()-1]; curVector.x = dest.x-prevPos.x; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 6988747599..63b3474662 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -971,7 +971,7 @@ StateReturnType AIStateMachine::setTemporaryState( StateID newStateID, Int frame */ void AIStateMachine::addToGoalPath( const Coord3D *pathPoint) { - if (m_goalPath.size()==0) { + if (m_goalPath.empty()) { m_goalPath.push_back(*pathPoint); } else { Coord3D *finalPoint = &m_goalPath[ m_goalPath.size() - 1 ]; @@ -6005,7 +6005,7 @@ Object *AIAttackSquadState::chooseVictim(void) { // everyone picks the same unit VecObjectPtr objects = victimSquad->getLiveObjects(); - if (objects.size() > 0) + if (!objects.empty()) { return objects[0]; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/Squad.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/Squad.cpp index 293a6dbce8..291e622e71 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/Squad.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/Squad.cpp @@ -233,7 +233,7 @@ void Squad::xfer( Xfer *xfer ) { // the cached objects list should be empty - if( m_objectsCached.size() != 0 ) + if( !m_objectsCached.empty() ) { DEBUG_CRASH(( "Squad::xfer - m_objectsCached should be emtpy, but is not" )); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp index df75da3aa3..464e4f11b5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp @@ -1451,7 +1451,7 @@ void BridgeBehavior::xfer( Xfer *xfer ) { // read all object IDs - DEBUG_ASSERTCRASH( m_scaffoldObjectIDList.size() == 0, + DEBUG_ASSERTCRASH( m_scaffoldObjectIDList.empty(), ("BridgeBehavior::xfer - scaffold object list should be empty") ); for( Int i = 0; i < scaffoldObjectCount; ++i ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp index 78847445fc..215763f9c5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp @@ -953,7 +953,7 @@ class GenericObjectCreationNugget : public ObjectCreationNugget if (di) { di->setModelName(modelName, m_okToChangeModelColor ? obj->getIndicatorColor() : 0, m_shadowType); - if (m_animSets.size() > 0) + if (!m_animSets.empty()) { Int which = GameLogicRandomValue(0, m_animSets.size()-1); di->setAnimNames(m_animSets[which].m_animInitial, m_animSets[which].m_animFlying, m_animSets[which].m_animFinal, m_fxFinal); @@ -1304,7 +1304,7 @@ class GenericObjectCreationNugget : public ObjectCreationNugget { static const ThingTemplate* debrisTemplate = TheThingFactory->findTemplate("GenericDebris"); - if (m_names.size() <= 0) + if (m_names.empty()) return NULL; if (m_requiresLivePlayer && (!sourceObj || !sourceObj->getControllingPlayer() || !sourceObj->getControllingPlayer()->isPlayerActive())) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index 4eb90530ce..e92ad16f32 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -4689,7 +4689,7 @@ void PartitionManager::xfer( Xfer *xfer ) // have to remove this assert, because during load there is a setTeam call for each guy on a sub-team, and that results // in a queued unlook, so we actually have stuff in here at the start. I am fairly certain that setTeam should wait // until loadPostProcess, but I ain't gonna change it now. -// DEBUG_ASSERTCRASH(m_pendingUndoShroudReveals.size() == 0, ("At load, we appear to not be in a reset state.") ); +// DEBUG_ASSERTCRASH(m_pendingUndoShroudReveals.empty(), ("At load, we appear to not be in a reset state.") ); // I have to split this up though, since on Load I need to make new instances. for( Int infoIndex = 0; infoIndex < queueSize; infoIndex++ ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index 797879498b..bfc97640c3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -3391,7 +3391,7 @@ void AIUpdateInterface::privateFollowPath( const std::vector* path, Obj // clear current state machine getStateMachine()->clear(); - if (path->size()>0) { + if (!path->empty()) { const Coord3D goal = (*path)[path->size()-1]; getStateMachine()->setGoalPosition(&goal); } 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 63cf5c78cb..f69f7004ad 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp @@ -697,7 +697,7 @@ StateReturnType DeliveringState::update() // Kick a dude out every so often return STATE_FAILURE; const ContainedItemsList* items = owner->getContain() ? owner->getContain()->getContainedItemsList() : NULL; - if( (!items || !items->size()) && ai->getVisibleItemsDelivered() == ai->getData()->m_visibleNumBones ) + if( (!items || items->empty()) && ai->getVisibleItemsDelivered() == ai->getData()->m_visibleNumBones ) { //We are out of payload to drop AND our visible payload is empty. It's possible for deliverers to //have one or the other or even both. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index 5d700cbb1f..69bcca6606 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -1180,7 +1180,7 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate void WeaponTemplate::trimOldHistoricDamage() const { UnsignedInt expirationDate = TheGameLogic->getFrame() - TheGlobalData->m_historicDamageLimit; - while (m_historicDamage.size() > 0) + while (!m_historicDamage.empty()) { HistoricWeaponDamageInfo& h = m_historicDamage.front(); if (h.frame <= expirationDate) @@ -2682,7 +2682,7 @@ Bool Weapon::privateFireWeapon( m_numShotsForCurBarrel = m_template->getShotsPerBarrel(); } - if( m_scatterTargetsUnused.size() ) + if( !m_scatterTargetsUnused.empty() ) { // If I have a set scatter pattern, I need to offset the target by a random pick from that pattern if( victimObj ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index ee2d05bf22..865d1bd2d8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -8870,7 +8870,7 @@ void ScriptEngine::xfer( Xfer *xfer ) { // this list should be empty on loading - if( m_sequentialScripts.size() != 0 ) + if( !m_sequentialScripts.empty() ) { DEBUG_CRASH(( "ScriptEngine::xfer - m_sequentialScripts should be empty but is not" )); diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h index 95c6db84f1..1d33cb947e 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h @@ -246,7 +246,7 @@ struct ModelConditionInfo void loadAnimations() const; void preloadAssets( TimeOfDay timeOfDay, Real scale ); ///< preload any assets for time of day - Int getConditionsYesCount() const { DEBUG_ASSERTCRASH(m_conditionsYesVec.size() > 0, ("empty m_conditionsYesVec.size(), see srj")); return m_conditionsYesVec.size(); } + Int getConditionsYesCount() const { DEBUG_ASSERTCRASH(!m_conditionsYesVec.empty(), ("empty m_conditionsYesVec.size(), see srj")); return m_conditionsYesVec.size(); } const ModelConditionFlags& getNthConditionsYes(Int i) const { return m_conditionsYesVec[i]; } #if defined(RTS_DEBUG) inline AsciiString getDescription() const { return m_description; } 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 d7ca602a5a..fccd5c32e0 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp @@ -647,7 +647,7 @@ void ModelConditionInfo::validateCachedBones(RenderObjClass* robj, Real scale) c // if we have any animations in this state, always choose the first, since the animations // vary on a per-client basis. HAnimClass* animToUse; - if (m_animations.size() > 0) + if (!m_animations.empty()) { animToUse = m_animations.front().getAnimHandle(); // return an AddRef'ed handle } @@ -1625,7 +1625,7 @@ void W3DModelDrawModuleData::parseConditionState(INI* ini, void *instance, void throw INI_INVALID_DATA; } - DEBUG_ASSERTCRASH(info.m_conditionsYesVec.size() == 0, ("*** ASSET ERROR: nonempty m_conditionsYesVec.size(), see srj")); + DEBUG_ASSERTCRASH(info.m_conditionsYesVec.empty(), ("*** ASSET ERROR: nonempty m_conditionsYesVec.size(), see srj")); info.m_conditionsYesVec.clear(); info.m_conditionsYesVec.push_back(conditionsYes); } @@ -3805,8 +3805,8 @@ void W3DModelDraw::setAnimationLoopDuration(UnsignedInt numFrames) */ void W3DModelDraw::setAnimationCompletionTime(UnsignedInt numFrames) { - if (m_curState != NULL && m_curState->m_transitionSig != NO_TRANSITION && m_curState->m_animations.size() > 0 && - m_nextState != NULL && m_nextState->m_transitionSig == NO_TRANSITION && m_nextState->m_animations.size() > 0) + if (m_curState != NULL && m_curState->m_transitionSig != NO_TRANSITION && !m_curState->m_animations.empty() && + m_nextState != NULL && m_nextState->m_transitionSig == NO_TRANSITION && !m_nextState->m_animations.empty()) { // we have a transition; split up the time suitably. // note that this is just a guess, and assumes that the states diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp index e65d5f7c5a..0b7a8ef24a 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp @@ -183,7 +183,7 @@ void W3DTerrainLogic::getExtent( Region3D *extent ) const // Note - m_boundaries are stored in height map grids wide, so we have to // multiply by the grid width. - if (m_boundaries.size() > 0) { + if (!m_boundaries.empty()) { extent->hi.x = m_boundaries[m_activeBoundary].x*MAP_XY_FACTOR; extent->hi.y = m_boundaries[m_activeBoundary].y*MAP_XY_FACTOR; } else { diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp b/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp index f059533d6b..b41df2cc2f 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp +++ b/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp @@ -336,7 +336,7 @@ void DebugWindowDialog::getSelectedParticleAsciiStringParm( IN int parmNum, OUT return; } - if (m_particleParmValues[parmNum].length()) { + if (!m_particleParmValues[parmNum].empty()) { strcpy(bufferToCopyInto, m_particleParmValues[parmNum].c_str()); } else { bufferToCopyInto[0] = 0; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/LayersList.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/LayersList.cpp index bc30af05a1..edd9ebd3e8 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/LayersList.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/LayersList.cpp @@ -1160,7 +1160,7 @@ void LayersList::OnMergeViewSelection(UINT commandID) mapObject = mapObject->getNext(); } - while (allSelectedObjects.size() > 0) { + while (!allSelectedObjects.empty()) { changeMapObjectLayer(allSelectedObjects.top(), layerIt->layerName); allSelectedObjects.pop(); } @@ -1177,7 +1177,7 @@ void LayersList::OnMergeViewSelection(UINT commandID) polygonTrigger = polygonTrigger->getNext(); } - while (allSelectedTriggers.size() > 0) { + while (!allSelectedTriggers.empty()) { changePolygonTriggerLayer(allSelectedTriggers.top(), layerIt->layerName); allSelectedTriggers.pop(); } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp index a21de4cd64..7dd0407756 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp @@ -86,7 +86,7 @@ BOOL MeshMoldOptions::OnInitDialog() FilenameList filenameList; TheFileSystem->getFileListInDirectory(".\\data\\Editor\\Molds\\", "*.w3d", filenameList, FALSE); - if (filenameList.size() > 0) { + if (!filenameList.empty()) { HTREEITEM child = NULL; FilenameList::iterator it = filenameList.begin(); do { diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp index cbb6f666df..dc1dc5b7f5 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp @@ -283,7 +283,7 @@ BOOL ObjectOptions::OnInitDialog() FilenameList filenameList; TheFileSystem->getFileListInDirectory(TEST_W3D_DIR_PATH, "*.w3d", filenameList, FALSE); - if (filenameList.size() > 0) { + if (!filenameList.empty()) { FilenameList::iterator it = filenameList.begin(); do { AsciiString filename = *it; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/RoadOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/RoadOptions.cpp index d1c31678f0..769a02996c 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/RoadOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/RoadOptions.cpp @@ -247,7 +247,7 @@ BOOL RoadOptions::OnInitDialog() FilenameList filenameList; TheFileSystem->getFileListInDirectory(ROAD_DIRECTORY, "*.tga", filenameList, FALSE); - if (filenameList.size() > 0) { + if (!filenameList.empty()) { FilenameList::iterator it = filenameList.begin(); do { AsciiString filename = *it; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp index 47eef54dcb..b5a2d134a2 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp @@ -78,7 +78,7 @@ BOOL SelectMacrotexture::OnInitDialog() FilenameList filenameList; TheFileSystem->getFileListInDirectory("..\\TestArt\\", "*.tga", filenameList, FALSE); - if (filenameList.size() > 0) { + if (!filenameList.empty()) { TVINSERTSTRUCT ins; HTREEITEM child = NULL; FilenameList::iterator it = filenameList.begin(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp index 42564af5e6..186fbd80e7 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp @@ -428,7 +428,7 @@ void WorldHeightMapEdit::loadDirectoryOfImages(const char *pFilePath) FilenameList filenameList; TheFileSystem->getFileListInDirectory(AsciiString(dirBuf), "*.*", filenameList, TRUE); - if (filenameList.size() == 0) { + if (filenameList.empty()) { return; } FilenameList::iterator it = filenameList.begin(); @@ -3350,7 +3350,7 @@ void WorldHeightMapEdit::changeBoundary(Int ndx, ICoord2D *border) void WorldHeightMapEdit::removeLastBoundary(void) { - if (m_boundaries.size() == 0) { + if (m_boundaries.empty()) { DEBUG_CRASH(("Invalid border remove request. jkmcd")); return; } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp index a2c5d7836c..dae135ea3e 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp @@ -196,7 +196,7 @@ class CachedMFCFileOutputStream : public OutputStream return(numBytes); }; virtual void flush(void) { - while (m_cachedChunks.size() != 0)//!m_cachedChunks.empty()) + while (!m_cachedChunks.empty())//!m_cachedChunks.empty()) { CachedChunk c = m_cachedChunks.front(); m_cachedChunks.pop_front(); @@ -234,7 +234,7 @@ class CompressedCachedMFCFileOutputStream : public OutputStream return; UnsignedByte *srcBuffer = NEW UnsignedByte[m_totalBytes]; UnsignedByte *insertPos = srcBuffer; - while (m_cachedChunks.size() != 0) + while (!m_cachedChunks.empty()) { CachedChunk c = m_cachedChunks.front(); m_cachedChunks.pop_front(); @@ -1531,7 +1531,7 @@ Bool CWorldBuilderDoc::getAllIndexesInRect(const Coord3D* bl, const Coord3D* br, FindIndexNearest(this, ¢er, &ndx, PREFER_BOTTOM); AddUniqueAndNeighbors(this, bl, br, tl, tr, ndx, allIndices); - return (allIndices->size() > 0); + return (!allIndices->empty()); } @@ -2302,7 +2302,7 @@ void CWorldBuilderDoc::OnDumpDocToText(void) fprintf(theLogFile, "Total Map Objects (with ThingTemplates): %d\n", totalObjectCount); - while (mapOfTemplates.size() > 0) { + while (!mapOfTemplates.empty()) { std::map::iterator storedIt = mapOfTemplates.begin(); for (it = mapOfTemplates.begin(); it != mapOfTemplates.end(); ++it) { diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp index 9917fa1ec4..2b0bab8720 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp @@ -802,7 +802,7 @@ void MapObjectProps::_DictToPrebuiltUpgrades(void) if (!gmbmd) { continue; } - if (gmbmd->m_upgradeMuxData.m_activationUpgradeNames.size() > 0) { + if (!gmbmd->m_upgradeMuxData.m_activationUpgradeNames.empty()) { cstr = gmbmd->m_upgradeMuxData.m_activationUpgradeNames[0].str(); if (pBox->FindString(-1, cstr) == LB_ERR) { pBox->AddString(cstr);