Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions Core/GameEngine/Source/Common/System/Xfer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ void Xfer::xferSTLObjectIDVector( std::vector<ObjectID> *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" ));
Expand Down Expand Up @@ -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" ));
Expand Down Expand Up @@ -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" ));
Expand Down
8 changes: 4 additions & 4 deletions Core/GameEngine/Source/GameNetwork/GameSpy/LadderDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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<AsciiString> qmMaps = TheGameSpyConfig->getQMMaps();
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ static void startOnline( void )
noPatchBeforeOnlineCallback);
return;
}
if (queuedDownloads.size())
if (!queuedDownloads.empty())
{
if (!hasWriteAccess())
{
Expand Down
2 changes: 1 addition & 1 deletion Core/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ void GameSpyInfo::joinBestGroupRoom( void )
return;
}

if (m_groupRooms.size())
if (!m_groupRooms.empty())
{
int minID = -1;
int minPlayers = 1000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}
Expand Down Expand Up @@ -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()));
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -325,7 +325,7 @@ void PSPlayerStats::incorporate( const PSPlayerStats& other )
{
lastLadderPort = other.lastLadderPort;
}
if (other.lastLadderHost.length())
if (!other.lastLadderHost.empty())
{
lastLadderHost = other.lastLadderHost;
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
2 changes: 1 addition & 1 deletion Core/Libraries/Source/WWVegas/WWLib/notifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ template<typename Event> class Observer
//! Stop observing event
void StopObserving()
{
while (mNotifiers.size() > 0)
while (!mNotifiers.empty())
{
Notifier<Event>* notifier = mNotifiers.back();
assert(notifier && "ERROR: NULL pointer in collection.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 //////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
6 changes: 3 additions & 3 deletions Generals/Code/GameEngine/Source/Common/RTS/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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" ));
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" ));
Expand Down
2 changes: 1 addition & 1 deletion Generals/Code/GameEngine/Source/GameClient/Credits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion Generals/Code/GameEngine/Source/GameClient/Eva.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ void PopulateLobbyPlayerListbox(void)
}

// restore selection
if (indicesToSelect.size())
if (!indicesToSelect.empty())
{
std::set<Int>::const_iterator indexIt = indicesToSelect.begin();
const size_t count = indicesToSelect.size();
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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<const ThingTemplate*>::iterator iter;
Expand Down
2 changes: 1 addition & 1 deletion Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Generals/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Loading
Loading