diff --git a/Core/GameEngine/Source/Common/System/Xfer.cpp b/Core/GameEngine/Source/Common/System/Xfer.cpp index a9c55059a73..8be5d81d389 100644 --- a/Core/GameEngine/Source/Common/System/Xfer.cpp +++ b/Core/GameEngine/Source/Common/System/Xfer.cpp @@ -791,7 +791,7 @@ void Xfer::xferUpgradeMask( UpgradeMaskType *upgradeMaskData ) xferAsciiString( &upgradeName ); // find this upgrade template - upgradeTemplate = TheUpgradeCenter->findUpgrade( upgradeName ); + upgradeTemplate = TheUpgradeCenter->findUpgrade( upgradeName.str() ); if( upgradeTemplate == NULL ) { diff --git a/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp index 7b3450a960b..1da1168ad0e 100644 --- a/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp +++ b/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp @@ -648,7 +648,7 @@ void ConnectionManager::processChat(NetChatCommandMsg *msg) AsciiString playerName; playerName.format("player%d", msg->getPlayerID()); - const Player *player = ThePlayerList->findPlayerWithNameKey( TheNameKeyGenerator->nameToKey( playerName ) ); + const Player *player = ThePlayerList->findPlayerWithNameKey( TheNameKeyGenerator->nameToKey( playerName.str() ) ); if (!player) { TheInGameUI->message(L"%ls", unitext.str()); diff --git a/Core/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp b/Core/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp index dc0aea8b3f3..7e22fb87387 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp @@ -602,7 +602,7 @@ AsciiString GameSpyStagingRoom::generateGameSpyGameResultsPacket( void ) { AsciiString playerName; playerName.format("player%d", i); - Player *p = ThePlayerList->findPlayerWithNameKey(NAMEKEY(playerName)); + Player *p = ThePlayerList->findPlayerWithNameKey(NAMEKEY(playerName.str())); if (p) { ++numHumans; @@ -648,7 +648,7 @@ AsciiString GameSpyStagingRoom::generateGameSpyGameResultsPacket( void ) { AsciiString playerName; playerName.format("player%d", i); - Player *p = ThePlayerList->findPlayerWithNameKey(NAMEKEY(playerName)); + Player *p = ThePlayerList->findPlayerWithNameKey(NAMEKEY(playerName.str())); if (p) { GameSpyGameSlot *slot = &(m_GameSpySlot[i]); @@ -696,7 +696,7 @@ AsciiString GameSpyStagingRoom::generateLadderGameResultsPacket( void ) { AsciiString playerName; playerName.format("player%d", i); - p[i] = ThePlayerList->findPlayerWithNameKey(NAMEKEY(playerName)); + p[i] = ThePlayerList->findPlayerWithNameKey(NAMEKEY(playerName.str())); if (p[i]) { ++numPlayers; diff --git a/Core/GameEngine/Source/GameNetwork/NetCommandMsg.cpp b/Core/GameEngine/Source/GameNetwork/NetCommandMsg.cpp index ea6d56b7285..e60c13a0d47 100644 --- a/Core/GameEngine/Source/GameNetwork/NetCommandMsg.cpp +++ b/Core/GameEngine/Source/GameNetwork/NetCommandMsg.cpp @@ -167,7 +167,7 @@ GameMessage *NetGameCommandMsg::constructGameMessage() AsciiString name; name.format("player%d", getPlayerID()); - retval->friend_setPlayerIndex( ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(name))->getPlayerIndex()); + retval->friend_setPlayerIndex( ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(name.str()))->getPlayerIndex()); GameMessageArgument *arg = m_argList; while (arg != NULL) { diff --git a/Core/GameEngine/Source/GameNetwork/Network.cpp b/Core/GameEngine/Source/GameNetwork/Network.cpp index de436e7b58d..8126350592a 100644 --- a/Core/GameEngine/Source/GameNetwork/Network.cpp +++ b/Core/GameEngine/Source/GameNetwork/Network.cpp @@ -661,7 +661,7 @@ void Network::processDestroyPlayerCommand(NetDestroyPlayerCommandMsg *msg) AsciiString playerName; playerName.format("player%d", playerIndex); - Player *pPlayer = ThePlayerList->findPlayerWithNameKey(NAMEKEY(playerName)); + Player *pPlayer = ThePlayerList->findPlayerWithNameKey(NAMEKEY(playerName.str())); if (pPlayer) { GameMessage *msg = newInstance(GameMessage)(GameMessage::MSG_SELF_DESTRUCT); diff --git a/Generals/Code/GameEngine/Include/Common/DamageFX.h b/Generals/Code/GameEngine/Include/Common/DamageFX.h index 0b6e3ad711d..3cf4b15be9b 100644 --- a/Generals/Code/GameEngine/Include/Common/DamageFX.h +++ b/Generals/Code/GameEngine/Include/Common/DamageFX.h @@ -147,7 +147,7 @@ class DamageFXStore : public SubsystemInterface /** Find the DamageFX with the given name. If no such DamageFX exists, return null. */ - const DamageFX *findDamageFX( AsciiString name ) const; + const DamageFX *findDamageFX( const char* name ) const; static void parseDamageFXDefinition(INI* ini); diff --git a/Generals/Code/GameEngine/Include/Common/NameKeyGenerator.h b/Generals/Code/GameEngine/Include/Common/NameKeyGenerator.h index 01d237638dd..4442990f513 100644 --- a/Generals/Code/GameEngine/Include/Common/NameKeyGenerator.h +++ b/Generals/Code/GameEngine/Include/Common/NameKeyGenerator.h @@ -91,10 +91,6 @@ class NameKeyGenerator : public SubsystemInterface virtual void reset(); virtual void update() { } - /// Given a string, convert into a unique integer key. - NameKeyType nameToKey(const AsciiString& name) { return nameToKey(name.str()); } - NameKeyType nameToLowercaseKey(const AsciiString& name) { return nameToLowercaseKey(name.str()); } - /// Given a string, convert into a unique integer key. NameKeyType nameToKey(const char* name); NameKeyType nameToLowercaseKey(const char *name); @@ -140,7 +136,7 @@ class NameKeyGenerator : public SubsystemInterface extern NameKeyGenerator *TheNameKeyGenerator; ///< just one namespace for now // typing "TheNameKeyGenerator->nameToKey()" is awfully wordy. Here are shorter synonyms: -inline NameKeyType NAMEKEY(const AsciiString& name) { return TheNameKeyGenerator->nameToKey(name); } + inline NameKeyType NAMEKEY(const char* name) { return TheNameKeyGenerator->nameToKey(name); } inline AsciiString KEYNAME(NameKeyType nk) { return TheNameKeyGenerator->keyToName(nk); } diff --git a/Generals/Code/GameEngine/Include/Common/Upgrade.h b/Generals/Code/GameEngine/Include/Common/Upgrade.h index f85b56389cf..28b8c793b99 100644 --- a/Generals/Code/GameEngine/Include/Common/Upgrade.h +++ b/Generals/Code/GameEngine/Include/Common/Upgrade.h @@ -234,7 +234,7 @@ class UpgradeCenter : public SubsystemInterface UpgradeTemplate *firstUpgradeTemplate( void ); ///< return the first upgrade template const UpgradeTemplate *findUpgradeByKey( NameKeyType key ) const; ///< find upgrade by name key - const UpgradeTemplate *findUpgrade( const AsciiString& name ) const; ///< find and return upgrade by name + const UpgradeTemplate *findUpgrade( const char* name ) const; ///< find and return upgrade by name const UpgradeTemplate *findVeterancyUpgrade(VeterancyLevel level) const; ///< find and return upgrade by name UpgradeTemplate *newUpgrade( const AsciiString& name ); ///< allocate, link, and return new upgrade diff --git a/Generals/Code/GameEngine/Include/GameClient/Image.h b/Generals/Code/GameEngine/Include/GameClient/Image.h index c4e0876cb59..25d1294150a 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Image.h +++ b/Generals/Code/GameEngine/Include/GameClient/Image.h @@ -116,6 +116,7 @@ friend class ImageCollection; //------------------------------------------------------------------------------------------------- class ImageCollection : public SubsystemInterface { + typedef std::map ImageMap; public: @@ -128,7 +129,7 @@ class ImageCollection : public SubsystemInterface void load( Int textureSize ); ///< load images - const Image *findImageByName( const AsciiString& name ); ///< find image based on name + const Image *findImageByName( const char* name ) const; ///< find image based on name /// adds the given image to the collection, transfers ownership to this object void addImage(Image *image); @@ -136,14 +137,14 @@ class ImageCollection : public SubsystemInterface /// enumerates the list of existing images Image *Enum(unsigned index) { - for (std::map::iterator i=m_imageMap.begin();i!=m_imageMap.end();++i) + for (ImageMap::iterator i=m_imageMap.begin();i!=m_imageMap.end();++i) if (!index--) return i->second; return NULL; } protected: - std::map m_imageMap; ///< maps named keys to images + ImageMap m_imageMap; ///< maps named keys to images }; // INLINING /////////////////////////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameLogic/Armor.h b/Generals/Code/GameEngine/Include/GameLogic/Armor.h index 798de573a99..273332ed416 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Armor.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Armor.h @@ -108,7 +108,7 @@ class ArmorStore : public SubsystemInterface /** Find the Armor with the given name. If no such Armor exists, return null. */ - const ArmorTemplate* findArmorTemplate(AsciiString name) const; + const ArmorTemplate* findArmorTemplate(const char* name) const; inline Armor makeArmor(const ArmorTemplate *tmpl) const { diff --git a/Generals/Code/GameEngine/Include/GameLogic/Weapon.h b/Generals/Code/GameEngine/Include/GameLogic/Weapon.h index ca98a412f6e..9a588e0863f 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Weapon.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Weapon.h @@ -814,7 +814,7 @@ class WeaponStore : public SubsystemInterface /** Find the WeaponTemplate with the given name. If no such WeaponTemplate exists, return null. */ - const WeaponTemplate *findWeaponTemplate(AsciiString name) const; + const WeaponTemplate *findWeaponTemplate(const char* name) const; const WeaponTemplate *findWeaponTemplateByNameKey( NameKeyType key ) const { return findWeaponTemplatePrivate( key ); } // this dynamically allocates a new Weapon, which is owned (and must be freed!) by the caller. diff --git a/Generals/Code/GameEngine/Source/Common/DamageFX.cpp b/Generals/Code/GameEngine/Source/Common/DamageFX.cpp index a1070204064..71a4acbef6c 100644 --- a/Generals/Code/GameEngine/Source/Common/DamageFX.cpp +++ b/Generals/Code/GameEngine/Source/Common/DamageFX.cpp @@ -274,7 +274,7 @@ DamageFXStore::~DamageFXStore() } //------------------------------------------------------------------------------------------------- -const DamageFX *DamageFXStore::findDamageFX(AsciiString name) const +const DamageFX *DamageFXStore::findDamageFX(const char* name) const { NameKeyType namekey = TheNameKeyGenerator->nameToKey(name); DamageFXMap::const_iterator it = m_dfxmap.find(namekey); diff --git a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp index 628a9453acb..8e39f00c659 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp @@ -872,7 +872,7 @@ void INI::parseMappedImage( INI *ini, void * /*instance*/, void *store, const vo if( TheMappedImageCollection ) { typedef const Image* ConstImagePtr; - *(ConstImagePtr*)store = TheMappedImageCollection->findImageByName( AsciiString( token ) ); + *(ConstImagePtr*)store = TheMappedImageCollection->findImageByName( token ); } //KM: If we are in the worldbuilder, we want to parse commandbuttons for informational purposes, @@ -1377,7 +1377,7 @@ void INI::parseUpgradeTemplate( INI* ini, void * /*instance*/, void *store, cons throw ERROR_BUG; } - const UpgradeTemplate *uu = TheUpgradeCenter->findUpgrade( AsciiString( token ) ); + const UpgradeTemplate *uu = TheUpgradeCenter->findUpgrade( token ); DEBUG_ASSERTCRASH( uu || stricmp( token, "None" ) == 0, ("Upgrade %s not found!",token) ); typedef const UpgradeTemplate* ConstUpgradeTemplatePtr; diff --git a/Generals/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp b/Generals/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp index 5614b2c8795..8d044752ae2 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp @@ -42,11 +42,8 @@ //------------------------------------------------------------------------------------------------- void INI::parseMappedImageDefinition( INI* ini ) { - AsciiString name; - // read the name - const char* c = ini->getNextToken(); - name.set( c ); + const char* name = ini->getNextToken(); // // find existing item if present, note that we do not support overrides @@ -66,11 +63,10 @@ void INI::parseMappedImageDefinition( INI* ini ) { // image not found, create a new one - image = newInstance(Image); + image = newInstance(Image); image->setName( name ); TheMappedImageCollection->addImage(image); - DEBUG_ASSERTCRASH( image, ("parseMappedImage: unable to allocate image for '%s'", - name.str()) ); + DEBUG_ASSERTCRASH( image, ("parseMappedImage: unable to allocate image for '%s'", name) ); } diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Handicap.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Handicap.cpp index 85420402741..2976e8a9846 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Handicap.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Handicap.cpp @@ -99,7 +99,7 @@ void Handicap::readFromDict(const Dict* d) c.concat(htNames[i]); c.concat("_"); c.concat(ttNames[j]); - NameKeyType k = TheNameKeyGenerator->nameToKey(c); + NameKeyType k = TheNameKeyGenerator->nameToKey(c.str()); Bool exists; Real r = d->getReal(k, &exists); if (exists) diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp index 90b9fc6008b..daea56d6dff 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp @@ -461,7 +461,7 @@ void Player::init(const PlayerTemplate* pt) m_playerDisplayName = UnicodeString::TheEmptyString; m_playerName = AsciiString::TheEmptyString; - m_playerNameKey = NAMEKEY(AsciiString::TheEmptyString); + m_playerNameKey = NAMEKEY(""); m_playerType = PLAYER_COMPUTER; // neutral is always "allied" with self -- this is the only thing ever allied with neutral! @@ -740,7 +740,7 @@ void Player::deletePlayerAI() void Player::initFromDict(const Dict* d) { AsciiString tmplname = d->getAsciiString(TheKey_playerFaction); - const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname)); + const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname.str())); DEBUG_ASSERTCRASH(pt != NULL, ("PlayerTemplate %s not found -- this is an obsolete map (please open and resave in WB)",tmplname.str())); init(pt); @@ -748,7 +748,7 @@ void Player::initFromDict(const Dict* d) m_playerDisplayName = d->getUnicodeString(TheKey_playerDisplayName); AsciiString pname = d->getAsciiString(TheKey_playerName); m_playerName = pname; - m_playerNameKey = NAMEKEY(pname); + m_playerNameKey = NAMEKEY(pname.str()); Bool exists; Bool skirmish = false; @@ -763,7 +763,7 @@ void Player::initFromDict(const Dict* d) for (Int spIdx = 0; spIdx < TheSidesList->getNumSkirmishSides(); ++spIdx) { AsciiString spTemplateName = TheSidesList->getSkirmishSideInfo(spIdx)->getDict()->getAsciiString(TheKey_playerFaction); - const PlayerTemplate* spt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(spTemplateName)); + const PlayerTemplate* spt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(spTemplateName.str())); if (spt && spt->getSide() == getSide()) { skirmish = true; @@ -792,7 +792,7 @@ void Player::initFromDict(const Dict* d) AsciiString qualTemplatePlayerName; for (i=0; igetNumSkirmishSides(); i++) { AsciiString templateName = TheSidesList->getSkirmishSideInfo(i)->getDict()->getAsciiString(TheKey_playerFaction); - pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(templateName)); + pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(templateName.str())); if (pt && pt->getSide() == mySide) { qualTemplatePlayerName.format("%s%d", TheSidesList->getSkirmishSideInfo(i)->getDict()->getAsciiString(TheKey_playerName).str(), m_mpStartIndex); found = true; @@ -830,7 +830,7 @@ void Player::initFromDict(const Dict* d) AsciiString qualTemplatePlayerName; for (skirmishNdx=0; skirmishNdxgetNumSkirmishSides(); skirmishNdx++) { AsciiString templateName = TheSidesList->getSkirmishSideInfo(skirmishNdx)->getDict()->getAsciiString(TheKey_playerFaction); - pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(templateName)); + pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(templateName.str())); if (pt && pt->getSide() == mySide) { qualTemplatePlayerName.format("%s%d", TheSidesList->getSkirmishSideInfo(skirmishNdx)->getDict()->getAsciiString(TheKey_playerName).str(), m_mpStartIndex); found = true; @@ -910,11 +910,11 @@ void Player::initFromDict(const Dict* d) for (j = 0; j < MAX_GENERIC_SCRIPTS; ++j) { AsciiString keyName; keyName.format("%s%d", TheNameKeyGenerator->keyToName(TheKey_teamGenericScriptHook).str(), j); - tmpStr = teamDict.getAsciiString(NAMEKEY(keyName), &exists); + tmpStr = teamDict.getAsciiString(NAMEKEY(keyName.str()), &exists); if (exists && !tmpStr.isEmpty()) { newName.format("%s%d", tmpStr.str(), m_mpStartIndex); - teamDict.setAsciiString(NAMEKEY(keyName), newName); + teamDict.setAsciiString(NAMEKEY(keyName.str()), newName); } } @@ -1545,7 +1545,7 @@ UnsignedInt Player::getSupplyBoxValue() //============================================================================= Real Player::getProductionCostChangePercent( AsciiString buildTemplateName ) const { - ProductionChangeMap::const_iterator it = m_productionCostChanges.find(NAMEKEY(buildTemplateName)); + ProductionChangeMap::const_iterator it = m_productionCostChanges.find(NAMEKEY(buildTemplateName.str())); if (it != m_productionCostChanges.end()) { return (*it).second; @@ -1557,7 +1557,7 @@ Real Player::getProductionCostChangePercent( AsciiString buildTemplateName ) con //============================================================================= Real Player::getProductionTimeChangePercent( AsciiString buildTemplateName ) const { - ProductionChangeMap::const_iterator it = m_productionTimeChanges.find(NAMEKEY(buildTemplateName)); + ProductionChangeMap::const_iterator it = m_productionTimeChanges.find(NAMEKEY(buildTemplateName.str())); if (it != m_productionTimeChanges.end()) { return (*it).second; @@ -1569,7 +1569,7 @@ Real Player::getProductionTimeChangePercent( AsciiString buildTemplateName ) con //============================================================================= VeterancyLevel Player::getProductionVeterancyLevel( AsciiString buildTemplateName ) const { - NameKeyType templateNameKey = NAMEKEY(buildTemplateName); + NameKeyType templateNameKey = NAMEKEY(buildTemplateName.str()); ProductionVeterancyMap::const_iterator it = m_productionVeterancyLevels.find(templateNameKey); if (it != m_productionVeterancyLevels.end()) { @@ -3576,7 +3576,7 @@ void Player::xfer( Xfer *xfer ) xfer->xferAsciiString( &upgradeName ); // find template for this upgrade - upgradeTemplate = TheUpgradeCenter->findUpgrade( upgradeName ); + upgradeTemplate = TheUpgradeCenter->findUpgrade( upgradeName.str() ); // sanity if( upgradeTemplate == NULL ) diff --git a/Generals/Code/GameEngine/Source/Common/RTS/PlayerList.cpp b/Generals/Code/GameEngine/Source/Common/RTS/PlayerList.cpp index a14fce84fe5..10545441cb5 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/PlayerList.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/PlayerList.cpp @@ -186,14 +186,14 @@ void PlayerList::newGame() for( i = 0; i < TheSidesList->getNumSides(); i++) { Dict *d = TheSidesList->getSideInfo(i)->getDict(); - Player* p = findPlayerWithNameKey(NAMEKEY(d->getAsciiString(TheKey_playerName))); + Player* p = findPlayerWithNameKey(NAMEKEY(d->getAsciiString(TheKey_playerName).str())); AsciiString tok; AsciiString enemies = d->getAsciiString(TheKey_playerEnemies); while (enemies.nextToken(&tok)) { - Player *p2 = findPlayerWithNameKey(NAMEKEY(tok)); + Player *p2 = findPlayerWithNameKey(NAMEKEY(tok.str())); if (p2) { p->setPlayerRelationship(p2, ENEMIES); @@ -207,7 +207,7 @@ void PlayerList::newGame() AsciiString allies = d->getAsciiString(TheKey_playerAllies); while (allies.nextToken(&tok)) { - Player *p2 = findPlayerWithNameKey(NAMEKEY(tok)); + Player *p2 = findPlayerWithNameKey(NAMEKEY(tok.str())); if (p2) { p->setPlayerRelationship(p2, ALLIES); diff --git a/Generals/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp b/Generals/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp index 3a07fa73bf9..91fe4114a83 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp @@ -193,43 +193,43 @@ PlayerTemplate::PlayerTemplate() : //----------------------------------------------------------------------------- const Image *PlayerTemplate::getHeadWaterMarkImage( void ) const { - return TheMappedImageCollection->findImageByName(m_headWaterMark); + return TheMappedImageCollection->findImageByName(m_headWaterMark.str()); } //----------------------------------------------------------------------------- const Image *PlayerTemplate::getFlagWaterMarkImage( void ) const { - return TheMappedImageCollection->findImageByName(m_flagWaterMark); + return TheMappedImageCollection->findImageByName(m_flagWaterMark.str()); } //----------------------------------------------------------------------------- const Image *PlayerTemplate::getSideIconImage( void ) const { - return TheMappedImageCollection->findImageByName(m_sideIconImage); + return TheMappedImageCollection->findImageByName(m_sideIconImage.str()); } //----------------------------------------------------------------------------- const Image *PlayerTemplate::getEnabledImage( void ) const { - return TheMappedImageCollection->findImageByName(m_enabledImage); + return TheMappedImageCollection->findImageByName(m_enabledImage.str()); } //----------------------------------------------------------------------------- //const Image *PlayerTemplate::getDisabledImage( void ) const //{ -// return TheMappedImageCollection->findImageByName(m_disabledImage); +// return TheMappedImageCollection->findImageByName(m_disabledImage.str()); //} //----------------------------------------------------------------------------- //const Image *PlayerTemplate::getHiliteImage( void ) const //{ -// return TheMappedImageCollection->findImageByName(m_hiliteImage); +// return TheMappedImageCollection->findImageByName(m_hiliteImage.str()); //} //----------------------------------------------------------------------------- //const Image *PlayerTemplate::getPushedImage( void ) const //{ -// return TheMappedImageCollection->findImageByName(m_pushedImage); +// return TheMappedImageCollection->findImageByName(m_pushedImage.str()); //} //----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Science.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Science.cpp index 2951c86dd8c..8f89eabd43f 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Science.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Science.cpp @@ -85,7 +85,7 @@ ScienceType ScienceStore::getScienceFromInternalName(const AsciiString& name) co { if (name.isEmpty()) return SCIENCE_INVALID; - NameKeyType nkt = TheNameKeyGenerator->nameToKey(name); + NameKeyType nkt = TheNameKeyGenerator->nameToKey(name.str()); ScienceType st = (ScienceType)nkt; return st; } diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp index f81283fdae8..e13ef607e3e 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp @@ -235,7 +235,7 @@ void TeamFactory::initFromSides(SidesList *sides) void TeamFactory::initTeam(const AsciiString& name, const AsciiString& owner, Bool isSingleton, Dict *d) { DEBUG_ASSERTCRASH(findTeamPrototype(name)==NULL,("team already exists")); - Player *pOwner = ThePlayerList->findPlayerWithNameKey(NAMEKEY(owner)); + Player *pOwner = ThePlayerList->findPlayerWithNameKey(NAMEKEY(owner.str())); DEBUG_ASSERTCRASH(pOwner, ("no owner found for team %s (%s)",name.str(),owner.str())); if (!pOwner) pOwner = ThePlayerList->getNeutralPlayer(); @@ -249,7 +249,7 @@ void TeamFactory::initTeam(const AsciiString& name, const AsciiString& owner, Bo //============================================================================= void TeamFactory::addTeamPrototypeToList(TeamPrototype* team) { - NameKeyType nk = NAMEKEY(team->getName()); + NameKeyType nk = NAMEKEY(team->getName().str()); TeamPrototypeMap::iterator it = m_prototypes.find(nk); if (it != m_prototypes.end()) { @@ -263,7 +263,7 @@ void TeamFactory::addTeamPrototypeToList(TeamPrototype* team) //============================================================================= void TeamFactory::removeTeamPrototypeFromList(TeamPrototype* team) { - NameKeyType nk = NAMEKEY(team->getName()); + NameKeyType nk = NAMEKEY(team->getName().str()); TeamPrototypeMap::iterator it = m_prototypes.find(nk); if (it != m_prototypes.end()) m_prototypes.erase(it); @@ -272,7 +272,7 @@ void TeamFactory::removeTeamPrototypeFromList(TeamPrototype* team) // ------------------------------------------------------------------------ TeamPrototype *TeamFactory::findTeamPrototype(const AsciiString& name) { - NameKeyType nk = NAMEKEY(name); + NameKeyType nk = NAMEKEY(name.str()); TeamPrototypeMap::iterator it = m_prototypes.find(nk); if (it != m_prototypes.end()) return it->second; @@ -745,7 +745,7 @@ TeamTemplateInfo::TeamTemplateInfo(Dict *d) : for (int i = 0; i < MAX_GENERIC_SCRIPTS; ++i) { AsciiString keyName; keyName.format("%s%d", TheNameKeyGenerator->keyToName(TheKey_teamGenericScriptHook).str(), i); - m_teamGenericScripts[i] = d->getAsciiString(NAMEKEY(keyName), &exists); + m_teamGenericScripts[i] = d->getAsciiString(NAMEKEY(keyName.str()), &exists); if (!exists) { m_teamGenericScripts[i].clear(); } diff --git a/Generals/Code/GameEngine/Source/Common/Recorder.cpp b/Generals/Code/GameEngine/Source/Common/Recorder.cpp index 4e0c7aa5ced..20c7db3768c 100644 --- a/Generals/Code/GameEngine/Source/Common/Recorder.cpp +++ b/Generals/Code/GameEngine/Source/Common/Recorder.cpp @@ -1097,7 +1097,7 @@ void RecorderClass::handleCRCMessage(UnsignedInt newCRC, Int playerIndex, Bool f AsciiString playerName; playerName.format("player%d", localPlayerIndex); const Player *p = ThePlayerList->getNthPlayer(playerIndex); - if (!p || (p->getPlayerNameKey() == NAMEKEY(playerName))) + if (!p || (p->getPlayerNameKey() == NAMEKEY(playerName.str()))) samePlayer = TRUE; if (samePlayer || (localPlayerIndex < 0)) { diff --git a/Generals/Code/GameEngine/Source/Common/System/DataChunk.cpp b/Generals/Code/GameEngine/Source/Common/System/DataChunk.cpp index 63f980cb58e..650ba9d7412 100644 --- a/Generals/Code/GameEngine/Source/Common/System/DataChunk.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/DataChunk.cpp @@ -892,7 +892,7 @@ NameKeyType DataChunkInput::readNameKey(void) keyAndType >>= 8; AsciiString kname = m_contents.getName(keyAndType); - NameKeyType k = TheNameKeyGenerator->nameToKey(kname); + NameKeyType k = TheNameKeyGenerator->nameToKey(kname.str()); return k; } @@ -913,7 +913,7 @@ Dict DataChunkInput::readDict() keyAndType >>= 8; AsciiString kname = m_contents.getName(keyAndType); - NameKeyType k = TheNameKeyGenerator->nameToKey(kname); + NameKeyType k = TheNameKeyGenerator->nameToKey(kname.str()); switch(t) { diff --git a/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp b/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp index 435e71aeb2e..093f5e068a0 100644 --- a/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp @@ -389,7 +389,7 @@ void FunctionLexicon::loadTable( TableEntry *table, { // assign key from name key based on name provided in table - entry->key = TheNameKeyGenerator->nameToKey( AsciiString(entry->name) ); + entry->key = TheNameKeyGenerator->nameToKey( entry->name ); // next table entry please entry++; diff --git a/Generals/Code/GameEngine/Source/Common/System/Upgrade.cpp b/Generals/Code/GameEngine/Source/Common/System/Upgrade.cpp index f3cbb377fe4..7805a1c2ec9 100644 --- a/Generals/Code/GameEngine/Source/Common/System/Upgrade.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/Upgrade.cpp @@ -192,7 +192,7 @@ void UpgradeTemplate::friend_makeVeterancyUpgrade(VeterancyLevel v) { m_type = UPGRADE_TYPE_OBJECT; // veterancy "upgrades" are always per-object, not per-player m_name = getVetUpgradeName(v); - m_nameKey = TheNameKeyGenerator->nameToKey( m_name ); + m_nameKey = TheNameKeyGenerator->nameToKey( m_name.str() ); m_displayNameLabel.clear(); // should never be displayed m_buildTime = 0.0f; m_cost = 0.0f; @@ -206,7 +206,7 @@ void UpgradeTemplate::cacheButtonImage() { if( m_buttonImageName.isNotEmpty() ) { - m_buttonImage = TheMappedImageCollection->findImageByName( m_buttonImageName ); + m_buttonImage = TheMappedImageCollection->findImageByName( m_buttonImageName.str() ); DEBUG_ASSERTCRASH( m_buttonImage, ("UpgradeTemplate: %s is looking for button image %s but can't find it. Skipping...", m_name.str(), m_buttonImageName.str() ) ); m_buttonImageName.clear(); // we're done with this, so nuke it } @@ -297,7 +297,7 @@ void UpgradeCenter::reset( void ) const UpgradeTemplate *UpgradeCenter::findVeterancyUpgrade( VeterancyLevel level ) const { AsciiString tmp = getVetUpgradeName(level); - return findUpgrade(tmp); + return findUpgrade(tmp.str()); } //------------------------------------------------------------------------------------------------- @@ -346,7 +346,7 @@ const UpgradeTemplate *UpgradeCenter::findUpgradeByKey( NameKeyType key ) const //------------------------------------------------------------------------------------------------- /** Find upgrade matching name */ //------------------------------------------------------------------------------------------------- -const UpgradeTemplate *UpgradeCenter::findUpgrade( const AsciiString& name ) const +const UpgradeTemplate *UpgradeCenter::findUpgrade( const char* name ) const { return findUpgradeByKey( TheNameKeyGenerator->nameToKey( name ) ); @@ -367,7 +367,7 @@ UpgradeTemplate *UpgradeCenter::newUpgrade( const AsciiString& name ) // assign name and starting data newUpgrade->setUpgradeName( name ); - newUpgrade->setUpgradeNameKey( TheNameKeyGenerator->nameToKey( name ) ); + newUpgrade->setUpgradeNameKey( TheNameKeyGenerator->nameToKey( name.str() ) ); // Make a unique bitmask for this new template by keeping track of what bits have been assigned // damn MSFT! proper ANSI syntax for a proper 64-bit constant is "1LL", but MSVC doesn't recognize it @@ -472,8 +472,7 @@ std::vector UpgradeCenter::getUpgradeNames( void ) const void UpgradeCenter::parseUpgradeDefinition( INI *ini ) { // read the name - const char* c = ini->getNextToken(); - AsciiString name = c; + const char* name = ini->getNextToken(); // find existing item if present UpgradeTemplate* upgrade = TheUpgradeCenter->findNonConstUpgradeByKey( NAMEKEY(name) ); @@ -486,7 +485,7 @@ void UpgradeCenter::parseUpgradeDefinition( INI *ini ) } // sanity - DEBUG_ASSERTCRASH( upgrade, ("parseUpgradeDefinition: Unable to allocate upgrade '%s'", name.str()) ); + DEBUG_ASSERTCRASH( upgrade, ("parseUpgradeDefinition: Unable to allocate upgrade '%s'", name) ); // parse the ini definition ini->initFromINI( upgrade, upgrade->getFieldParse() ); diff --git a/Generals/Code/GameEngine/Source/Common/Thing/Module.cpp b/Generals/Code/GameEngine/Source/Common/Thing/Module.cpp index 2b421987582..76a01d2326f 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/Module.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/Module.cpp @@ -255,7 +255,7 @@ void UpgradeMuxData::getUpgradeActivationMasks(UpgradeMaskType& activation, Upgr it != m_activationUpgradeNames.end(); it++) { - const UpgradeTemplate* theTemplate = TheUpgradeCenter->findUpgrade( *it ); + const UpgradeTemplate* theTemplate = TheUpgradeCenter->findUpgrade( it->str() ); if( !theTemplate ) { DEBUG_CRASH(("An upgrade module references '%s', which is not an Upgrade", it->str())); @@ -269,7 +269,7 @@ void UpgradeMuxData::getUpgradeActivationMasks(UpgradeMaskType& activation, Upgr it != m_conflictingUpgradeNames.end(); it++) { - const UpgradeTemplate* theTemplate = TheUpgradeCenter->findUpgrade( *it ); + const UpgradeTemplate* theTemplate = TheUpgradeCenter->findUpgrade( it->str() ); if( !theTemplate ) { DEBUG_CRASH(("An upgrade module references '%s', which is not an Upgrade", it->str())); diff --git a/Generals/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp b/Generals/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp index 55a6abb1df4..784b6bc5644 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp @@ -531,7 +531,7 @@ ModuleData* ModuleFactory::newModuleDataFromINI(INI* ini, const AsciiString& nam if (moduleTemplate) { ModuleData* md = (*moduleTemplate->m_createDataProc)(ini); - md->setModuleTagNameKey( NAMEKEY( moduleTag ) ); + md->setModuleTagNameKey( NAMEKEY( moduleTag.str() ) ); m_moduleDataList.push_back(md); return md; } diff --git a/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp b/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp index 854f5e971e5..75a72a6ac05 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp @@ -1156,13 +1156,13 @@ void ThingTemplate::resolveNames() { if( m_selectedPortraitImageName.isNotEmpty() ) { - m_selectedPortraitImage = TheMappedImageCollection->findImageByName( m_selectedPortraitImageName ); + m_selectedPortraitImage = TheMappedImageCollection->findImageByName( m_selectedPortraitImageName.str() ); DEBUG_ASSERTCRASH( m_selectedPortraitImage, ("%s is looking for Portrait %s but can't find it. Skipping...", getName().str(), m_buttonImageName.str() ) ); m_selectedPortraitImageName.clear(); // we're done with this, so nuke it } if( m_buttonImageName.isNotEmpty() ) { - m_buttonImage = TheMappedImageCollection->findImageByName( m_buttonImageName ); + m_buttonImage = TheMappedImageCollection->findImageByName( m_buttonImageName.str() ); DEBUG_ASSERTCRASH( m_buttonImage, ("%s is looking for ButtonImage %s but can't find it. Skipping...", getName().str(), m_buttonImageName.str() ) ); m_buttonImageName.clear(); // we're done with this, so nuke it } diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index 10e680001be..68c0a12995b 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -4186,7 +4186,7 @@ void Drawable::xferDrawableModules( Xfer *xfer ) // read module identifier xfer->xferAsciiString( &moduleIdentifier ); - NameKeyType moduleIdentifierKey = TheNameKeyGenerator->nameToKey(moduleIdentifier); + NameKeyType moduleIdentifierKey = TheNameKeyGenerator->nameToKey(moduleIdentifier.str()); // find module in the drawable module list Module* module = NULL; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index dfc5f077e13..51a8876e6a5 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -2495,7 +2495,7 @@ void CommandButton::cacheButtonImage() } if( m_buttonImageName.isNotEmpty() ) { - m_buttonImage = TheMappedImageCollection->findImageByName( m_buttonImageName ); + m_buttonImage = TheMappedImageCollection->findImageByName( m_buttonImageName.str() ); DEBUG_ASSERTCRASH( m_buttonImage, ("CommandButton: %s is looking for button image %s but can't find it. Skipping...", m_name.str(), m_buttonImageName.str() ) ); m_buttonImageName.clear(); // we're done with this, so nuke it } @@ -2520,7 +2520,7 @@ void ControlBar::postProcessCommands( void ) void ControlBar::setControlCommand( const AsciiString& buttonWindowName, GameWindow *parent, const CommandButton *commandButton ) { - UnsignedInt winID = TheNameKeyGenerator->nameToKey( buttonWindowName ); + UnsignedInt winID = TheNameKeyGenerator->nameToKey( buttonWindowName.str() ); GameWindow *win = TheWindowManager->winGetWindowFromId( parent, winID ); if( win == NULL ) @@ -2628,7 +2628,7 @@ void ControlBar::setPortraitByObject( Object *obj ) m_rightHUDUpgradeCameos[i]->winHide(TRUE); continue; } - const UpgradeTemplate *ut = TheUpgradeCenter->findUpgrade(upgradeName); + const UpgradeTemplate *ut = TheUpgradeCenter->findUpgrade(upgradeName.str()); if(!ut) { m_rightHUDUpgradeCameos[i]->winHide(TRUE); @@ -2850,7 +2850,7 @@ void ControlBar::updateBuildQueueDisabledImages( const Image *image ) { buttonName.format( "ControlBar.wnd:ButtonQueue%02d", i + 1 ); - buildQueueIDs[ i ] = TheNameKeyGenerator->nameToKey( buttonName ); + buildQueueIDs[ i ] = TheNameKeyGenerator->nameToKey( buttonName.str() ); } @@ -3210,7 +3210,7 @@ void ControlBar::initSpecialPowershortcutBar( Player *player) tempName = layoutName; tempName.concat(":GenPowersShortcutBarParent"); - NameKeyType id = TheNameKeyGenerator->nameToKey( tempName ); + NameKeyType id = TheNameKeyGenerator->nameToKey( tempName.str() ); m_specialPowerShortcutParent = TheWindowManager->winGetWindowFromId( NULL, id );//m_scienceLayout->getFirstWindow(); tempName = layoutName; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp index f70dcc6612d..f040b18cc26 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp @@ -495,7 +495,7 @@ void ControlBar::populateBuildQueue( Object *producer ) { buttonName.format( "ControlBar.wnd:ButtonQueue%02d", i + 1 ); - buildQueueIDs[ i ] = TheNameKeyGenerator->nameToKey( buttonName ); + buildQueueIDs[ i ] = TheNameKeyGenerator->nameToKey( buttonName.str() ); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp index d15d40b7d2c..bdb820bf68e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp @@ -114,10 +114,10 @@ void ControlBar::initObserverControls( void ) { AsciiString tmpString; tmpString.format("ControlBar.wnd:ButtonPlayer%d", i); - buttonPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + buttonPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); buttonPlayer[i] = TheWindowManager->winGetWindowFromId( ObserverPlayerListWindow, buttonPlayerID[i] ); tmpString.format("ControlBar.wnd:StaticTextPlayer%d", i); - staticTextPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + staticTextPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); staticTextPlayer[i] = TheWindowManager->winGetWindowFromId( ObserverPlayerListWindow, staticTextPlayerID[i] ); } @@ -259,7 +259,7 @@ void ControlBar::populateObserverList( void ) { AsciiString name; name.format("player%d", i); - Player *p = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(name)); + Player *p = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(name.str())); if(p) { if(p->isPlayerObserver()) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp index fc8b35ad5f2..5923ccd33ed 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp @@ -139,7 +139,7 @@ ResizerWindow *ControlBarResizer::newResizerWindow( AsciiString name ) newRwin->m_name = name; GameWindow *win = NULL; - win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(name)); + win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(name.str())); if( !win ) { DEBUG_ASSERTCRASH(win,("ControlBarResizer::newResizerWindow could not find window %s Are you sure that window is loaded yet?", name.str()) ); @@ -164,7 +164,7 @@ void ControlBarResizer::sizeWindowsDefault( void ) it++; continue; } - win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(rWin->m_name)); + win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(rWin->m_name.str())); if(!win) { it++; @@ -191,7 +191,7 @@ void ControlBarResizer::sizeWindowsAlt( void ) it++; continue; } - win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(rWin->m_name)); + win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(rWin->m_name.str())); if(!win) { it++; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp index f5ec055e12c..d76fc606ff3 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp @@ -978,7 +978,7 @@ void ControlBarSchemeManager::preloadAssets( TimeOfDay timeOfDay ) ControlBarSchemeImage *cbImage = *listIt; if (cbImage) { - const Image *image = TheMappedImageCollection->findImageByName( cbImage->m_name ); + const Image *image = TheMappedImageCollection->findImageByName( cbImage->m_name.str() ); if (image) { TheDisplay->preloadTextureAssets(image->getFilename()); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp index 660e96b7bf2..a2a0db2c9f8 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp @@ -99,17 +99,17 @@ static void grabWindowPointers( void ) { AsciiString temp; temp.format("Diplomacy.wnd:StaticTextPlayer%d", i); - staticTextPlayerID[i] = NAMEKEY(temp); + staticTextPlayerID[i] = NAMEKEY(temp.str()); temp.format("Diplomacy.wnd:StaticTextSide%d", i); - staticTextSideID[i] = NAMEKEY(temp); + staticTextSideID[i] = NAMEKEY(temp.str()); temp.format("Diplomacy.wnd:StaticTextTeam%d", i); - staticTextTeamID[i] = NAMEKEY(temp); + staticTextTeamID[i] = NAMEKEY(temp.str()); temp.format("Diplomacy.wnd:StaticTextStatus%d", i); - staticTextStatusID[i] = NAMEKEY(temp); + staticTextStatusID[i] = NAMEKEY(temp.str()); temp.format("Diplomacy.wnd:ButtonMute%d", i); - buttonMuteID[i] = NAMEKEY(temp); + buttonMuteID[i] = NAMEKEY(temp.str()); temp.format("Diplomacy.wnd:ButtonUnMute%d", i); - buttonUnMuteID[i] = NAMEKEY(temp); + buttonUnMuteID[i] = NAMEKEY(temp.str()); staticTextPlayer[i] = TheWindowManager->winGetWindowFromId(theWindow, staticTextPlayerID[i]); staticTextSide[i] = TheWindowManager->winGetWindowFromId(theWindow, staticTextSideID[i]); @@ -477,7 +477,7 @@ void PopulateInGameDiplomacyPopup( void ) isInGame = true; AsciiString playerName; playerName.format("player%d", slotNum); - Player *player = ThePlayerList->findPlayerWithNameKey(NAMEKEY(playerName)); + Player *player = ThePlayerList->findPlayerWithNameKey(NAMEKEY(playerName.str())); Bool isAlive = !TheVictoryConditions->hasSinglePlayerBeenDefeated(player); Bool isObserver = player->isPlayerObserver(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp index 9311f81063e..7fcaf837f78 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp @@ -223,7 +223,7 @@ void ToggleInGameChat( Bool immediate ) for (Int i=0; ifindPlayerWithNameKey( TheNameKeyGenerator->nameToKey( playerName ) ); + const Player *player = ThePlayerList->findPlayerWithNameKey( TheNameKeyGenerator->nameToKey( playerName.str() ) ); if (player && localPlayer) { switch (inGameChatType) 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 46446f8dbde..73cef4cd845 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp @@ -125,8 +125,7 @@ static void SetDifficultyRadioButton( void ) void DifficultySelectInit( WindowLayout *layout, void *userData ) { - AsciiString parentName( "DifficultySelect.wnd:DifficultySelectParent" ); - NameKeyType parentID = TheNameKeyGenerator->nameToKey( parentName ); + NameKeyType parentID = TheNameKeyGenerator->nameToKey( "DifficultySelect.wnd:DifficultySelectParent" ); GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); buttonOkID = TheNameKeyGenerator->nameToKey( "DifficultySelect.wnd:ButtonOk" ); 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 ac97cee7052..0c6d03a2670 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp @@ -349,8 +349,7 @@ WindowMsgHandledType DownloadMenuInput( GameWindow *window, UnsignedInt msg, // if( BitIsSet( state, KEY_STATE_UP ) ) { - AsciiString buttonName( "DownloadMenu.wnd:ButtonCancel" ); - NameKeyType buttonID = TheNameKeyGenerator->nameToKey( buttonName ); + NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "DownloadMenu.wnd:ButtonCancel" ); GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonID ); TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, 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 1bc075b6f27..b88f31dd093 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp @@ -499,8 +499,7 @@ WindowMsgHandledType KeyboardOptionsMenuInput( GameWindow *window, UnsignedInt m // if( BitIsSet( state, KEY_STATE_UP ) ) { - AsciiString buttonName( "KeyboardOptionsMenu.wnd:ButtonBack" ); - NameKeyType buttonID = TheNameKeyGenerator->nameToKey( buttonName ); + NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:ButtonBack" ); GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonID ); TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, 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 0fdce08eaa1..66499f191ae 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp @@ -656,7 +656,7 @@ void InitLanGameGadgets( void ) { AsciiString tmpString; tmpString.format("LanGameOptionsMenu.wnd:ComboBoxPlayer%d", i); - comboBoxPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxPlayer[i] = TheWindowManager->winGetWindowFromId( parentLanGameOptions, comboBoxPlayerID[i] ); GadgetComboBoxReset(comboBoxPlayer[i]); GadgetComboBoxGetEditBox(comboBoxPlayer[i])->winSetTooltipFunc(playerTooltip); @@ -678,38 +678,38 @@ void InitLanGameGadgets( void ) */ tmpString.format("LanGameOptionsMenu.wnd:ComboBoxColor%d", i); - comboBoxColorID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxColorID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxColor[i] = TheWindowManager->winGetWindowFromId( parentLanGameOptions, comboBoxColorID[i] ); DEBUG_ASSERTCRASH(comboBoxColor[i], ("Could not find the comboBoxColor[%d]",i )); PopulateColorComboBox(i, comboBoxColor, TheLAN->GetMyGame()); GadgetComboBoxSetSelectedPos(comboBoxColor[i], 0); tmpString.format("LanGameOptionsMenu.wnd:ComboBoxPlayerTemplate%d", i); - comboBoxPlayerTemplateID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxPlayerTemplateID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxPlayerTemplate[i] = TheWindowManager->winGetWindowFromId( parentLanGameOptions, comboBoxPlayerTemplateID[i] ); DEBUG_ASSERTCRASH(comboBoxPlayerTemplate[i], ("Could not find the comboBoxPlayerTemplate[%d]",i )); PopulatePlayerTemplateComboBox(i, comboBoxPlayerTemplate, TheLAN->GetMyGame(), TRUE); tmpString.format("LanGameOptionsMenu.wnd:ComboBoxTeam%d", i); - comboBoxTeamID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxTeamID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxTeam[i] = TheWindowManager->winGetWindowFromId( parentLanGameOptions, comboBoxTeamID[i] ); DEBUG_ASSERTCRASH(comboBoxTeam[i], ("Could not find the comboBoxTeam[%d]",i )); PopulateTeamComboBox(i, comboBoxTeam, TheLAN->GetMyGame()); tmpString.clear(); tmpString.format("LanGameOptionsMenu.wnd:ButtonAccept%d", i); - buttonAcceptID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + buttonAcceptID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); buttonAccept[i] = TheWindowManager->winGetWindowFromId( parentLanGameOptions, buttonAcceptID[i] ); DEBUG_ASSERTCRASH(buttonAccept[i], ("Could not find the buttonAccept[%d]",i )); buttonAccept[i]->winSetTooltipFunc(gameAcceptTooltip); // // tmpString.format("LanGameOptionsMenu.wnd:ButtonStartPosition%d", i); -// buttonStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString ); +// buttonStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); // buttonStartPosition[i] = TheWindowManager->winGetWindowFromId( parentLanGameOptions, buttonStartPositionID[i] ); // DEBUG_ASSERTCRASH(buttonStartPosition[i], ("Could not find the ButtonStartPosition[%d]",i )); tmpString.format("LanGameOptionsMenu.wnd:ButtonMapStartPosition%d", i); - buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); buttonMapStartPosition[i] = TheWindowManager->winGetWindowFromId( parentLanGameOptions, buttonMapStartPositionID[i] ); DEBUG_ASSERTCRASH(buttonMapStartPosition[i], ("Could not find the ButtonMapStartPosition[%d]",i )); 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 ff48c172f71..a66698cd886 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp @@ -122,8 +122,7 @@ void LanMapSelectMenuInit( WindowLayout *layout, void *userData ) showLANGameOptionsUnderlyingGUIElements(FALSE); // set keyboard focus to main parent - AsciiString parentName( "LanMapSelectMenu.wnd:LanMapSelectMenuParent" ); - NameKeyType parentID = TheNameKeyGenerator->nameToKey( parentName ); + NameKeyType parentID = TheNameKeyGenerator->nameToKey( "LanMapSelectMenu.wnd:LanMapSelectMenuParent" ); parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); TheWindowManager->winSetFocus( parent ); @@ -157,7 +156,7 @@ void LanMapSelectMenuInit( WindowLayout *layout, void *userData ) for (Int i = 0; i < MAX_SLOTS; i++) { tmpString.format("LanMapSelectMenu.wnd:ButtonMapStartPosition%d", i); - buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); buttonMapStartPosition[i] = TheWindowManager->winGetWindowFromId( winMapPreview, buttonMapStartPositionID[i] ); DEBUG_ASSERTCRASH(buttonMapStartPosition[i], ("Could not find the ButtonMapStartPosition[%d]",i )); buttonMapStartPosition[i]->winHide(TRUE); @@ -165,8 +164,7 @@ void LanMapSelectMenuInit( WindowLayout *layout, void *userData ) } // get the listbox window - AsciiString listString( "LanMapSelectMenu.wnd:ListboxMap" ); - NameKeyType mapListID = TheNameKeyGenerator->nameToKey( listString ); + NameKeyType mapListID = TheNameKeyGenerator->nameToKey( "LanMapSelectMenu.wnd:ListboxMap" ); mapList = TheWindowManager->winGetWindowFromId( parent, mapListID ); if( mapList ) { @@ -228,8 +226,7 @@ WindowMsgHandledType LanMapSelectMenuInput( GameWindow *window, UnsignedInt msg, // if( BitIsSet( state, KEY_STATE_UP ) ) { - AsciiString buttonName( "LanMapSelectMenu.wnd:ButtonBack" ); - NameKeyType buttonID = TheNameKeyGenerator->nameToKey( buttonName ); + NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "LanMapSelectMenu.wnd:ButtonBack" ); GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonID ); TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, 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 563f242a47c..3c6f985275c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp @@ -108,8 +108,7 @@ static void shutdownComplete( WindowLayout *layout ) void SetDifficultyRadioButton( void ) { - AsciiString parentName( "MapSelectMenu.wnd:MapSelectMenuParent" ); - NameKeyType parentID = TheNameKeyGenerator->nameToKey( parentName ); + NameKeyType parentID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:MapSelectMenuParent" ); GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); if (!TheScriptEngine) @@ -171,8 +170,7 @@ void MapSelectMenuInit( WindowLayout *layout, void *userData ) Bool usesSystemMapDir = pref.usesSystemMapDir(); // get the listbox window - AsciiString listString( "MapSelectMenu.wnd:ListboxMap" ); - NameKeyType mapListID = TheNameKeyGenerator->nameToKey( listString ); + NameKeyType mapListID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:ListboxMap" ); mapList = TheWindowManager->winGetWindowFromId( NULL, mapListID ); if( mapList ) { @@ -183,8 +181,7 @@ void MapSelectMenuInit( WindowLayout *layout, void *userData ) // set keyboard focus to main parent - AsciiString parentName( "MapSelectMenu.wnd:MapSelectMenuParent" ); - NameKeyType parentID = TheNameKeyGenerator->nameToKey( parentName ); + NameKeyType parentID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:MapSelectMenuParent" ); GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); TheWindowManager->winSetFocus( parent ); @@ -280,8 +277,7 @@ WindowMsgHandledType MapSelectMenuInput( GameWindow *window, UnsignedInt msg, // if( BitIsSet( state, KEY_STATE_UP ) ) { - AsciiString buttonName( "MapSelectMenu.wnd:ButtonBack" ); - NameKeyType buttonID = TheNameKeyGenerator->nameToKey( buttonName ); + NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:ButtonBack" ); GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonID ); TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, 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 32bb9002f31..0f714c3f75b 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -2046,8 +2046,7 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) layout->hide( FALSE ); // set keyboard focus to main parent - AsciiString parentName( "OptionsMenu.wnd:OptionsMenuParent" ); - NameKeyType parentID = TheNameKeyGenerator->nameToKey( parentName ); + NameKeyType parentID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:OptionsMenuParent" ); GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); TheWindowManager->winSetFocus( parent ); @@ -2148,8 +2147,7 @@ WindowMsgHandledType OptionsMenuInput( GameWindow *window, UnsignedInt msg, // if( BitIsSet( state, KEY_STATE_UP ) ) { - AsciiString buttonName( "OptionsMenu.wnd:ButtonBack" ); - NameKeyType buttonID = TheNameKeyGenerator->nameToKey( buttonName ); + NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ButtonBack" ); GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonID ); TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, 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 2b08e31bf43..b3a45cfec67 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp @@ -127,7 +127,7 @@ static const Image* lookupRankImage(AsciiString side, Int rank) fullImageName.format("Rank_%s%s", rankNames[rank], side.str()); if(strcmp(fullImageName.str(),"Rank_PrivateElite") == 0) fullImageName = "Rank";//_Private_Elite"; - const Image *img = TheMappedImageCollection->findImageByName(fullImageName); + const Image *img = TheMappedImageCollection->findImageByName(fullImageName.str()); if (img) { DEBUG_LOG(("*** Loaded rank image '%s' from TheMappedImageCollection!", fullImageName.str())); @@ -731,7 +731,7 @@ static GameWindow* findWindow(GameWindow *parent, AsciiString baseWindow, AsciiS { AsciiString fullPath; fullPath.format("%s:%s", baseWindow.str(), gadgetName.str()); - GameWindow *res = TheWindowManager->winGetWindowFromId(parent, NAMEKEY(fullPath)); + GameWindow *res = TheWindowManager->winGetWindowFromId(parent, NAMEKEY(fullPath.str())); DEBUG_ASSERTLOG(res, ("Cannot find window %s", fullPath.str())); return res; } 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 12f22f49c1f..a60019b6ecb 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp @@ -517,7 +517,7 @@ WindowMsgHandledType ScoreScreenSystem( GameWindow *window, UnsignedInt msg, { AsciiString name; name.format("ScoreScreen.wnd:ButtonAdd%d", i); - if( controlID == TheNameKeyGenerator->nameToKey(name)) + if( controlID == TheNameKeyGenerator->nameToKey(name.str())) { Bool notBuddy = TRUE; Int playerID = (Int)GadgetButtonGetData(TheWindowManager->winGetWindowFromId(NULL,controlID)); @@ -1196,7 +1196,7 @@ void populatePlayerInfo( Player *player, Int pos) GameWindow *win; // set the player name winName.format("ScoreScreen.wnd:StaticTextPlayer%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); if(overidePlayerDisplayName) { @@ -1209,13 +1209,13 @@ void populatePlayerInfo( Player *player, Int pos) // set the player name winName.format("ScoreScreen.wnd:StaticTextObserver%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total units built winName.format("ScoreScreen.wnd:StaticTextUnitsBuilt%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", scoreKpr->getTotalUnitsBuilt()); GadgetStaticTextSetText(win, winValue); @@ -1224,7 +1224,7 @@ void populatePlayerInfo( Player *player, Int pos) // set the total units Lost winName.format("ScoreScreen.wnd:StaticTextUnitsLost%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", scoreKpr->getTotalUnitsLost()); GadgetStaticTextSetText(win, winValue); @@ -1233,7 +1233,7 @@ void populatePlayerInfo( Player *player, Int pos) // set the total units Destroyed winName.format("ScoreScreen.wnd:StaticTextUnitsDestroyed%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", scoreKpr->getTotalUnitsDestroyed()); GadgetStaticTextSetText(win, winValue); @@ -1242,7 +1242,7 @@ void populatePlayerInfo( Player *player, Int pos) // set the total BuildingsBuilt winName.format("ScoreScreen.wnd:StaticTextBuildingsBuilt%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", scoreKpr->getTotalBuildingsBuilt()); GadgetStaticTextSetText(win, winValue); @@ -1251,7 +1251,7 @@ void populatePlayerInfo( Player *player, Int pos) // set the total BuildingsLost winName.format("ScoreScreen.wnd:StaticTextBuildingsLost%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", scoreKpr->getTotalBuildingsLost()); GadgetStaticTextSetText(win, winValue); @@ -1260,7 +1260,7 @@ void populatePlayerInfo( Player *player, Int pos) // set the total BuildingsDestroyed winName.format("ScoreScreen.wnd:StaticTextBuildingsDestroyed%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", scoreKpr->getTotalBuildingsDestroyed()); GadgetStaticTextSetText(win, winValue); @@ -1269,7 +1269,7 @@ void populatePlayerInfo( Player *player, Int pos) // set the total Resources winName.format("ScoreScreen.wnd:StaticTextResources%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", scoreKpr->getTotalMoneyEarned()); GadgetStaticTextSetText(win, winValue); @@ -1279,7 +1279,7 @@ void populatePlayerInfo( Player *player, Int pos) // set the Score /* winName.format("ScoreScreen.wnd:StaticTextScore%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", scoreKpr->calculateScore()); GadgetStaticTextSetText(win, winValue); @@ -1288,7 +1288,7 @@ winName.format("ScoreScreen.wnd:StaticTextScore%d", pos); */ // set the Buttons // winName.format("ScoreScreen.wnd:ButtonAdd%d", pos); - // win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + // win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); // DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); // if(screenType == SCORESCREEN_INTERNET && TheGameSpyInfo && TheGameSpyInfo->getLocalProfileID() != 0) // { @@ -1326,7 +1326,7 @@ winName.format("ScoreScreen.wnd:StaticTextScore%d", pos); // set a marker for who won and lost winName.format("ScoreScreen.wnd:GameWindowWinner%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(FALSE); // if(TheVictoryConditions->hasAchievedVictory(player)) @@ -1803,7 +1803,7 @@ void grabMultiPlayerInfo( void ) for( Int i = 0; i < MAX_SLOTS; ++i) { playerName.format("player%d",i); - player = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(playerName)); + player = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(playerName.str())); if(player) { Int score = player->getScoreKeeper()->calculateScore(); @@ -1875,7 +1875,7 @@ void grabSinglePlayerInfo( void ) PlayerTemplate const *fact = ThePlayerList->getLocalPlayer()->getPlayerTemplate(); if(fact != NULL) { - const Image *image = TheMappedImageCollection->findImageByName(ThePlayerList->getLocalPlayer()->getPlayerTemplate()->getScoreScreen()); + const Image *image = TheMappedImageCollection->findImageByName(ThePlayerList->getLocalPlayer()->getPlayerTemplate()->getScoreScreen().str()); if(image) { parent->winSetEnabledImage(0, image); @@ -1982,76 +1982,76 @@ void hideWindows( Int pos ) // set the player name winName.format("ScoreScreen.wnd:StaticTextPlayer%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the player name winName.format("ScoreScreen.wnd:StaticTextObserver%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total units built winName.format("ScoreScreen.wnd:StaticTextUnitsBuilt%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total units Lost winName.format("ScoreScreen.wnd:StaticTextUnitsLost%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total units Destroyed winName.format("ScoreScreen.wnd:StaticTextUnitsDestroyed%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total BuildingsBuilt winName.format("ScoreScreen.wnd:StaticTextBuildingsBuilt%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total BuildingsLost winName.format("ScoreScreen.wnd:StaticTextBuildingsLost%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); 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 ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); 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 ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total score /* winName.format("ScoreScreen.wnd:StaticTextScore%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); */ // Set the Game Winner marker winName.format("ScoreScreen.wnd:GameWindowWinner%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // // Set the Game Add Buttons // winName.format("ScoreScreen.wnd:ButtonAdd%d", i); -// win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); +// win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); // DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); // win->winHide(TRUE); } @@ -2070,7 +2070,7 @@ void setObserverWindows( Player *player, Int i ) // set the player name winName.format("ScoreScreen.wnd:StaticTextPlayer%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); GadgetStaticTextSetText(win, player->getPlayerDisplayName()); @@ -2079,64 +2079,64 @@ void setObserverWindows( Player *player, Int i ) // set the player name winName.format("ScoreScreen.wnd:StaticTextObserver%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(FALSE); // set the total units built winName.format("ScoreScreen.wnd:StaticTextUnitsBuilt%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total units Lost winName.format("ScoreScreen.wnd:StaticTextUnitsLost%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total units Destroyed winName.format("ScoreScreen.wnd:StaticTextUnitsDestroyed%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total BuildingsBuilt winName.format("ScoreScreen.wnd:StaticTextBuildingsBuilt%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total BuildingsLost winName.format("ScoreScreen.wnd:StaticTextBuildingsLost%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); 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 ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); 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 ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total score /* winName.format("ScoreScreen.wnd:StaticTextScore%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); */ // Set the Game Winner marker winName.format("ScoreScreen.wnd:GameWindowWinner%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(FALSE); const PlayerTemplate *fact = player->getPlayerTemplate(); @@ -2147,7 +2147,7 @@ winName.format("ScoreScreen.wnd:StaticTextScore%d", i); // // set the Buttons // winName.format("ScoreScreen.wnd:ButtonAdd%d", i); -// win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); +// win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); // DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); //// if(screenType == SCORESCREEN_INTERNET) //// win->winHide(FALSE); @@ -2202,7 +2202,7 @@ void populateSideInfo( UnicodeString side,ScoreGather *sg, Int pos, Color color) GameWindow *win; // set the player name winName.format("ScoreScreen.wnd:StaticTextPlayer%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); GadgetStaticTextSetText(win, side); win->winHide(FALSE); @@ -2210,13 +2210,13 @@ void populateSideInfo( UnicodeString side,ScoreGather *sg, Int pos, Color color) // set the player name winName.format("ScoreScreen.wnd:StaticTextObserver%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total units built winName.format("ScoreScreen.wnd:StaticTextUnitsBuilt%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", sg->m_totalUnitsBuilt); GadgetStaticTextSetText(win, winValue); @@ -2225,7 +2225,7 @@ void populateSideInfo( UnicodeString side,ScoreGather *sg, Int pos, Color color) // set the total units Lost winName.format("ScoreScreen.wnd:StaticTextUnitsLost%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", sg->m_totalUnitsLost); GadgetStaticTextSetText(win, winValue); @@ -2234,7 +2234,7 @@ void populateSideInfo( UnicodeString side,ScoreGather *sg, Int pos, Color color) // set the total units Destroyed winName.format("ScoreScreen.wnd:StaticTextUnitsDestroyed%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", sg->m_totalUnitsDestroyed); GadgetStaticTextSetText(win, winValue); @@ -2243,7 +2243,7 @@ void populateSideInfo( UnicodeString side,ScoreGather *sg, Int pos, Color color) // set the total BuildingsBuilt winName.format("ScoreScreen.wnd:StaticTextBuildingsBuilt%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", sg->m_totalBuildingsBuilt); GadgetStaticTextSetText(win, winValue); @@ -2252,7 +2252,7 @@ void populateSideInfo( UnicodeString side,ScoreGather *sg, Int pos, Color color) // set the total BuildingsLost winName.format("ScoreScreen.wnd:StaticTextBuildingsLost%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", sg->m_totalBuildingsLost); GadgetStaticTextSetText(win, winValue); @@ -2261,7 +2261,7 @@ void populateSideInfo( UnicodeString side,ScoreGather *sg, Int pos, Color color) // set the total BuildingsDestroyed winName.format("ScoreScreen.wnd:StaticTextBuildingsDestroyed%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", sg->m_totalBuildingsDestroyed); GadgetStaticTextSetText(win, winValue); @@ -2270,7 +2270,7 @@ void populateSideInfo( UnicodeString side,ScoreGather *sg, Int pos, Color color) // set the total Resources winName.format("ScoreScreen.wnd:StaticTextResources%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", sg->m_totalMoneyEarned); GadgetStaticTextSetText(win, winValue); @@ -2280,7 +2280,7 @@ void populateSideInfo( UnicodeString side,ScoreGather *sg, Int pos, Color color) // set the Score /* winName.format("ScoreScreen.wnd:StaticTextScore%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", scoreKpr->calculateScore()); GadgetStaticTextSetText(win, winValue); @@ -2290,7 +2290,7 @@ winName.format("ScoreScreen.wnd:StaticTextScore%d", pos); // set a marker for who won and lost winName.format("ScoreScreen.wnd:GameWindowWinner%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); if(sg->m_sideImage) { @@ -2300,7 +2300,7 @@ winName.format("ScoreScreen.wnd:StaticTextScore%d", pos); // // set the Buttons // winName.format("ScoreScreen.wnd:ButtonAdd%d", pos); -// win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); +// win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); // DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); // if(screenType == SCORESCREEN_INTERNET) // win->winHide(FALSE); 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 43b4bc6f62d..50789948919 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp @@ -69,8 +69,7 @@ void SinglePlayerMenuInit( WindowLayout *layout, void *userData ) layout->hide( FALSE ); // set keyboard focus to main parent - AsciiString parentName( "SinglePlayerMenu.wnd:SinglePlayerMenuParent" ); - NameKeyType parentID = TheNameKeyGenerator->nameToKey( parentName ); + NameKeyType parentID = TheNameKeyGenerator->nameToKey( "SinglePlayerMenu.wnd:SinglePlayerMenuParent" ); GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); TheWindowManager->winSetFocus( parent ); @@ -155,8 +154,7 @@ WindowMsgHandledType SinglePlayerMenuInput( GameWindow *window, UnsignedInt msg, // if( BitIsSet( state, KEY_STATE_UP ) ) { - AsciiString buttonName( "SinglePlayerMenu.wnd:ButtonBack" ); - NameKeyType buttonID = TheNameKeyGenerator->nameToKey( buttonName ); + NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "SinglePlayerMenu.wnd:ButtonBack" ); GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonID ); TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, 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 4386c5fd91c..adba52b414c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp @@ -1064,7 +1064,7 @@ void InitSkirmishGameGadgets( void ) tmpString.format("SkirmishGameOptionsMenu.wnd:ComboBoxPlayer%d", i); if(i != 0) { - comboBoxPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxPlayer[i] = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, comboBoxPlayerID[i] ); GadgetComboBoxReset(comboBoxPlayer[i]); //GadgetComboBoxGetEditBox(comboBoxPlayer[i])->winSetTooltipFunc(playerTooltip); @@ -1094,28 +1094,28 @@ void InitSkirmishGameGadgets( void ) } tmpString.format("SkirmishGameOptionsMenu.wnd:ComboBoxColor%d", i); - comboBoxColorID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxColorID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxColor[i] = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, comboBoxColorID[i] ); DEBUG_ASSERTCRASH(comboBoxColor[i], ("Could not find the comboBoxColor[%d]",i )); tmpString.format("SkirmishGameOptionsMenu.wnd:ComboBoxPlayerTemplate%d", i); - comboBoxPlayerTemplateID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxPlayerTemplateID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxPlayerTemplate[i] = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, comboBoxPlayerTemplateID[i] ); DEBUG_ASSERTCRASH(comboBoxPlayerTemplate[i], ("Could not find the comboBoxPlayerTemplate[%d]",i )); tmpString.format("SkirmishGameOptionsMenu.wnd:ComboBoxTeam%d", i); - comboBoxTeamID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxTeamID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxTeam[i] = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, comboBoxTeamID[i] ); DEBUG_ASSERTCRASH(comboBoxTeam[i], ("Could not find the comboBoxTeam[%d]",i )); // tmpString.format("SkirmishGameOptionsMenu.wnd:ButtonStartPosition%d", i); -// buttonStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString ); +// buttonStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); // buttonStartPosition[i] = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, buttonStartPositionID[i] ); // DEBUG_ASSERTCRASH(buttonStartPosition[i], ("Could not find the ButtonStartPosition[%d]",i )); // tmpString.format("SkirmishGameOptionsMenu.wnd:ButtonMapStartPosition%d", i); - buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); buttonMapStartPosition[i] = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, buttonMapStartPositionID[i] ); DEBUG_ASSERTCRASH(buttonMapStartPosition[i], ("Could not find the ButtonMapStartPosition[%d]",i )); } 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 1bf54db904a..3d8c1d8d24e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp @@ -127,8 +127,7 @@ void skirmishPositionStartSpots( void ); void skirmishUpdateSlotList( void ); void showSkirmishGameOptionsUnderlyingGUIElements( Bool show ) { - AsciiString parentName( "SkirmishGameOptionsMenu.wnd:SkirmishGameOptionsMenuParent" ); - NameKeyType parentID = TheNameKeyGenerator->nameToKey( parentName ); + NameKeyType parentID = TheNameKeyGenerator->nameToKey( "SkirmishGameOptionsMenu.wnd:SkirmishGameOptionsMenuParent" ); GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); if (!parent) return; @@ -249,8 +248,7 @@ void SkirmishMapSelectMenuInit( WindowLayout *layout, void *userData ) { // set keyboard focus to main parent - AsciiString parentName( "SkirmishMapSelectMenu.wnd:SkrimishMapSelectMenuParent" ); - NameKeyType parentID = TheNameKeyGenerator->nameToKey( parentName ); + NameKeyType parentID = TheNameKeyGenerator->nameToKey( "SkirmishMapSelectMenu.wnd:SkrimishMapSelectMenuParent" ); parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); TheWindowManager->winSetFocus( parent ); @@ -285,7 +283,7 @@ void SkirmishMapSelectMenuInit( WindowLayout *layout, void *userData ) for (Int i = 0; i < MAX_SLOTS; i++) { tmpString.format("SkirmishMapSelectMenu.wnd:ButtonMapStartPosition%d", i); - buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); buttonMapStartPosition[i] = TheWindowManager->winGetWindowFromId( winMapPreview, buttonMapStartPositionID[i] ); DEBUG_ASSERTCRASH(buttonMapStartPosition[i], ("Could not find the ButtonMapStartPosition[%d]",i )); buttonMapStartPosition[i]->winHide(TRUE); @@ -295,8 +293,7 @@ void SkirmishMapSelectMenuInit( WindowLayout *layout, void *userData ) showSkirmishGameOptionsUnderlyingGUIElements(FALSE); // get the listbox window - AsciiString listString( "SkirmishMapSelectMenu.wnd:ListboxMap" ); - NameKeyType mapListID = TheNameKeyGenerator->nameToKey( listString ); + NameKeyType mapListID = TheNameKeyGenerator->nameToKey( "SkirmishMapSelectMenu.wnd:ListboxMap" ); mapList = TheWindowManager->winGetWindowFromId( parent, mapListID ); if( mapList ) { @@ -369,8 +366,7 @@ WindowMsgHandledType SkirmishMapSelectMenuInput( GameWindow *window, UnsignedInt // if( BitIsSet( state, KEY_STATE_UP ) ) { - AsciiString buttonName( "SkirmishMapSelectMenu.wnd:ButtonBack" ); - NameKeyType buttonID = TheNameKeyGenerator->nameToKey( buttonName ); + NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "SkirmishMapSelectMenu.wnd:ButtonBack" ); GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonID ); TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, 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 6da46946c03..6c2b35d91f5 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp @@ -1150,15 +1150,15 @@ void WOLBuddyOverlayRCMenuInit( WindowLayout *layout, void *userData ) { AsciiString controlName; controlName.format("%s:ButtonAdd",layout->getFilename().str()+6); - buttonAddID = TheNameKeyGenerator->nameToKey( controlName ); + buttonAddID = TheNameKeyGenerator->nameToKey( controlName.str() ); controlName.format("%s:ButtonDelete",layout->getFilename().str()+6); - buttonDeleteID = TheNameKeyGenerator->nameToKey( controlName ); + buttonDeleteID = TheNameKeyGenerator->nameToKey( controlName.str() ); controlName.format("%s:ButtonPlay",layout->getFilename().str()+6); - buttonPlayID = TheNameKeyGenerator->nameToKey( controlName ); + buttonPlayID = TheNameKeyGenerator->nameToKey( controlName.str() ); controlName.format("%s:ButtonIgnore",layout->getFilename().str()+6); - buttonIgnoreID = TheNameKeyGenerator->nameToKey( controlName ); + buttonIgnoreID = TheNameKeyGenerator->nameToKey( controlName.str() ); controlName.format("%s:ButtonStats",layout->getFilename().str()+6); - buttonStatsID = TheNameKeyGenerator->nameToKey( controlName ); + buttonStatsID = TheNameKeyGenerator->nameToKey( controlName.str() ); } static void closeRightClickMenu(GameWindow *win) { @@ -1391,7 +1391,7 @@ void setUnignoreText( WindowLayout *layout, AsciiString nick, GPProfile id) { AsciiString controlName; controlName.format("%s:ButtonIgnore",layout->getFilename().str()+6); - NameKeyType ID = TheNameKeyGenerator->nameToKey( controlName ); + NameKeyType ID = TheNameKeyGenerator->nameToKey( controlName.str() ); GameWindow *win = TheWindowManager->winGetWindowFromId(layout->getFirstWindow(), ID); if(win) { 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 db5ffbd2a28..aeab24c50c1 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp @@ -1042,13 +1042,13 @@ void InitWOLGameGadgets( void ) { AsciiString tmpString; tmpString.format("GameSpyGameOptionsMenu.wnd:ComboBoxPlayer%d", i); - comboBoxPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxPlayer[i] = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, comboBoxPlayerID[i] ); GadgetComboBoxReset(comboBoxPlayer[i]); comboBoxPlayer[i]->winSetTooltipFunc(playerTooltip); tmpString.format("GameSpyGameOptionsMenu.wnd:StaticTextPlayer%d", i); - staticTextPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + staticTextPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); staticTextPlayer[i] = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, staticTextPlayerID[i] ); staticTextPlayer[i]->winSetTooltipFunc(playerTooltip); if (TheGameSpyInfo->amIHost()) @@ -1065,43 +1065,43 @@ void InitWOLGameGadgets( void ) } tmpString.format("GameSpyGameOptionsMenu.wnd:ComboBoxColor%d", i); - comboBoxColorID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxColorID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxColor[i] = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, comboBoxColorID[i] ); DEBUG_ASSERTCRASH(comboBoxColor[i], ("Could not find the comboBoxColor[%d]",i )); PopulateColorComboBox(i, comboBoxColor, theGameInfo); GadgetComboBoxSetSelectedPos(comboBoxColor[i], 0); tmpString.format("GameSpyGameOptionsMenu.wnd:ComboBoxPlayerTemplate%d", i); - comboBoxPlayerTemplateID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxPlayerTemplateID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxPlayerTemplate[i] = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, comboBoxPlayerTemplateID[i] ); DEBUG_ASSERTCRASH(comboBoxPlayerTemplate[i], ("Could not find the comboBoxPlayerTemplate[%d]",i )); PopulatePlayerTemplateComboBox(i, comboBoxPlayerTemplate, theGameInfo, theGameInfo->getAllowObservers()); tmpString.format("GameSpyGameOptionsMenu.wnd:ComboBoxTeam%d", i); - comboBoxTeamID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxTeamID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxTeam[i] = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, comboBoxTeamID[i] ); DEBUG_ASSERTCRASH(comboBoxTeam[i], ("Could not find the comboBoxTeam[%d]",i )); PopulateTeamComboBox(i, comboBoxTeam, theGameInfo); tmpString.format("GameSpyGameOptionsMenu.wnd:ButtonAccept%d", i); - buttonAcceptID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + buttonAcceptID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); buttonAccept[i] = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, buttonAcceptID[i] ); DEBUG_ASSERTCRASH(buttonAccept[i], ("Could not find the buttonAccept[%d]",i )); buttonAccept[i]->winSetTooltipFunc(gameAcceptTooltip); tmpString.format("GameSpyGameOptionsMenu.wnd:GenericPing%d", i); - genericPingWindowID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + genericPingWindowID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); genericPingWindow[i] = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, genericPingWindowID[i] ); DEBUG_ASSERTCRASH(genericPingWindow[i], ("Could not find the genericPingWindow[%d]",i )); genericPingWindow[i]->winSetTooltipFunc(pingTooltip); // tmpString.format("GameSpyGameOptionsMenu.wnd:ButtonStartPosition%d", i); -// buttonStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString ); +// buttonStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); // buttonStartPosition[i] = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, buttonStartPositionID[i] ); // DEBUG_ASSERTCRASH(buttonStartPosition[i], ("Could not find the ButtonStartPosition[%d]",i )); tmpString.format("GameSpyGameOptionsMenu.wnd:ButtonMapStartPosition%d", i); - buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); buttonMapStartPosition[i] = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, buttonMapStartPositionID[i] ); DEBUG_ASSERTCRASH(buttonMapStartPosition[i], ("Could not find the ButtonMapStartPosition[%d]",i )); 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 e719999f2f0..e24c934f52d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp @@ -411,7 +411,7 @@ const Image* LookupSmallRankImage(Int side, Int rankPoints) AsciiString fullImageName; fullImageName.format("%s-%s", rankNames[rank], sideStr.str()); - const Image *img = TheMappedImageCollection->findImageByName(fullImageName); + const Image *img = TheMappedImageCollection->findImageByName(fullImageName.str()); DEBUG_ASSERTLOG(img, ("*** Could not load small rank image '%s' from TheMappedImageCollection!", fullImageName.str())); return img; } 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 98d1d12fa5b..f40b28033f5 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp @@ -127,8 +127,7 @@ void WOLMapSelectMenuInit( WindowLayout *layout, void *userData ) { // set keyboard focus to main parent - AsciiString parentName( "WOLMapSelectMenu.wnd:WOLMapSelectMenuParent" ); - NameKeyType parentID = TheNameKeyGenerator->nameToKey( parentName ); + NameKeyType parentID = TheNameKeyGenerator->nameToKey( "WOLMapSelectMenu.wnd:WOLMapSelectMenuParent" ); parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); TheWindowManager->winSetFocus( parent ); @@ -162,7 +161,7 @@ void WOLMapSelectMenuInit( WindowLayout *layout, void *userData ) for (Int i = 0; i < MAX_SLOTS; i++) { tmpString.format("WOLMapSelectMenu.wnd:ButtonMapStartPosition%d", i); - buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); buttonMapStartPosition[i] = TheWindowManager->winGetWindowFromId( winMapPreview, buttonMapStartPositionID[i] ); DEBUG_ASSERTCRASH(buttonMapStartPosition[i], ("Could not find the ButtonMapStartPosition[%d]",i )); buttonMapStartPosition[i]->winHide(TRUE); @@ -173,8 +172,7 @@ void WOLMapSelectMenuInit( WindowLayout *layout, void *userData ) showGameSpyGameOptionsUnderlyingGUIElements( FALSE ); // get the listbox window - AsciiString listString( "WOLMapSelectMenu.wnd:ListboxMap" ); - NameKeyType mapListID = TheNameKeyGenerator->nameToKey( listString ); + NameKeyType mapListID = TheNameKeyGenerator->nameToKey( "WOLMapSelectMenu.wnd:ListboxMap" ); mapList = TheWindowManager->winGetWindowFromId( parent, mapListID ); if( mapList ) { @@ -245,8 +243,7 @@ WindowMsgHandledType WOLMapSelectMenuInput( GameWindow *window, UnsignedInt msg, // if( BitIsSet( state, KEY_STATE_UP ) ) { - AsciiString buttonName( "WOLMapSelectMenu.wnd:ButtonBack" ); - NameKeyType buttonID = TheNameKeyGenerator->nameToKey( buttonName ); + NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "WOLMapSelectMenu.wnd:ButtonBack" ); GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonID ); TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp index 38202040834..c6a8a72b642 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp @@ -131,7 +131,7 @@ const Image *GameWindowManager::winFindImage( const char *name ) assert( TheMappedImageCollection ); if( TheMappedImageCollection ) - return TheMappedImageCollection->findImageByName( AsciiString( name ) ); + return TheMappedImageCollection->findImageByName( name ); return NULL; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp index ddddb593670..55660e03f4b 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp @@ -1633,7 +1633,7 @@ GameWindow *GameWindowManager::gogoMessageBox(Int x, Int y, Int width, Int heigh tempName = menuName; tempName.concat("MessageBoxParent"); - parent = TheWindowManager->winGetWindowFromId(trueParent, TheNameKeyGenerator->nameToKey( tempName )); + parent = TheWindowManager->winGetWindowFromId(trueParent, TheNameKeyGenerator->nameToKey( tempName.str() )); TheWindowManager->winSetModal( trueParent ); TheWindowManager->winSetFocus( NULL ); // make sure we lose focus from other windows even if we refuse focus ourselves TheWindowManager->winSetFocus( parent ); @@ -1679,25 +1679,25 @@ GameWindow *GameWindowManager::gogoMessageBox(Int x, Int y, Int width, Int heigh tempName = menuName; tempName.concat("ButtonOk"); - buttonOkID = TheNameKeyGenerator->nameToKey( tempName ); + buttonOkID = TheNameKeyGenerator->nameToKey( tempName.str() ); GameWindow *buttonOk = TheWindowManager->winGetWindowFromId(parent, buttonOkID); buttonOk->winGetPosition(&buttonX[0], &buttonY[0]); tempName = menuName; tempName.concat("ButtonYes"); - NameKeyType buttonYesID = TheNameKeyGenerator->nameToKey( tempName ); + NameKeyType buttonYesID = TheNameKeyGenerator->nameToKey( tempName.str() ); GameWindow *buttonYes = TheWindowManager->winGetWindowFromId(parent, buttonYesID); //buttonNo in the second position tempName = menuName; tempName.concat("ButtonNo"); - NameKeyType buttonNoID = TheNameKeyGenerator->nameToKey(tempName); + NameKeyType buttonNoID = TheNameKeyGenerator->nameToKey(tempName.str()); GameWindow *buttonNo = TheWindowManager->winGetWindowFromId(parent, buttonNoID); buttonNo->winGetPosition(&buttonX[1], &buttonY[1]); //and buttonCancel in the third tempName = menuName; tempName.concat("ButtonCancel"); - NameKeyType buttonCancelID = TheNameKeyGenerator->nameToKey( tempName ); + NameKeyType buttonCancelID = TheNameKeyGenerator->nameToKey( tempName.str() ); GameWindow *buttonCancel = TheWindowManager->winGetWindowFromId(parent, buttonCancelID); buttonCancel->winGetPosition(&buttonX[2], &buttonY[2]); @@ -1744,12 +1744,12 @@ GameWindow *GameWindowManager::gogoMessageBox(Int x, Int y, Int width, Int heigh // Fill the text into the text boxes tempName = menuName; tempName.concat("StaticTextTitle"); - NameKeyType staticTextTitleID = TheNameKeyGenerator->nameToKey( tempName ); + NameKeyType staticTextTitleID = TheNameKeyGenerator->nameToKey( tempName.str() ); GameWindow *staticTextTitle = TheWindowManager->winGetWindowFromId(parent, staticTextTitleID); GadgetStaticTextSetText(staticTextTitle,titleString); tempName = menuName; tempName.concat("StaticTextMessage"); - NameKeyType staticTextMessageID = TheNameKeyGenerator->nameToKey( tempName ); + NameKeyType staticTextMessageID = TheNameKeyGenerator->nameToKey( tempName.str() ); GameWindow *staticTextMessage = TheWindowManager->winGetWindowFromId(parent, staticTextMessageID); GadgetStaticTextSetText(staticTextMessage,bodyString); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp index f994ee3bd50..5bc37fa03b4 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp @@ -648,7 +648,7 @@ static Bool parseName( const char *token, WinInstanceData *instData, // given the name assign a window ID from the assert( TheNameKeyGenerator ); if( TheNameKeyGenerator ) - instData->m_id = (Int)TheNameKeyGenerator->nameToKey( instData->m_decoratedNameString ); + instData->m_id = (Int)TheNameKeyGenerator->nameToKey( instData->m_decoratedNameString.str() ); return TRUE; @@ -702,7 +702,7 @@ static Bool parseSystemCallback( const char *token, WinInstanceData *instData, // save a pointer of the function address DEBUG_ASSERTCRASH( TheNameKeyGenerator && TheFunctionLexicon, ("Invalid singletons") ); theSystemString = c; - NameKeyType key = TheNameKeyGenerator->nameToKey( theSystemString ); + NameKeyType key = TheNameKeyGenerator->nameToKey( theSystemString.str() ); systemFunc = TheFunctionLexicon->gameWinSystemFunc( key ); return TRUE; @@ -729,7 +729,7 @@ static Bool parseInputCallback( const char *token, WinInstanceData *instData, // save a pointer of the function address DEBUG_ASSERTCRASH( TheNameKeyGenerator && TheFunctionLexicon, ("Invalid singletons") ); theInputString = c; - NameKeyType key = TheNameKeyGenerator->nameToKey( theInputString ); + NameKeyType key = TheNameKeyGenerator->nameToKey( theInputString.str() ); inputFunc = TheFunctionLexicon->gameWinInputFunc( key ); return TRUE; @@ -756,7 +756,7 @@ static Bool parseTooltipCallback( const char *token, WinInstanceData *instData, // save a pointer of the function address DEBUG_ASSERTCRASH( TheNameKeyGenerator && TheFunctionLexicon, ("Invalid singletons") ); theTooltipString = c; - NameKeyType key = TheNameKeyGenerator->nameToKey( theTooltipString ); + NameKeyType key = TheNameKeyGenerator->nameToKey( theTooltipString.str() ); tooltipFunc = TheFunctionLexicon->gameWinTooltipFunc( key ); return TRUE; @@ -783,7 +783,7 @@ static Bool parseDrawCallback( const char *token, WinInstanceData *instData, // save a pointer of the function address DEBUG_ASSERTCRASH( TheNameKeyGenerator && TheFunctionLexicon, ("Invalid singletons") ); theDrawString = c; - NameKeyType key = TheNameKeyGenerator->nameToKey( theDrawString ); + NameKeyType key = TheNameKeyGenerator->nameToKey( theDrawString.str() ); drawFunc = TheFunctionLexicon->gameWinDrawFunc( key ); return TRUE; @@ -1315,7 +1315,7 @@ static Bool parseDrawData( const char *token, WinInstanceData *instData, c = strtok( NULL, seps ); // value if( strcmp( c, "NoImage" ) ) - drawData->image = TheMappedImageCollection->findImageByName( AsciiString( c ) ); + drawData->image = TheMappedImageCollection->findImageByName( c ); else drawData->image = NULL; // COLOR: R G B A @@ -1644,7 +1644,7 @@ static GameWindow *createGadget( char *type, *c = 0; // terminate after filename (format is filename:gadgetname) assert( TheNameKeyGenerator ); if( TheNameKeyGenerator ) - rData->screen = (Int)(TheNameKeyGenerator->nameToKey( AsciiString(filename) )); + rData->screen = (Int)(TheNameKeyGenerator->nameToKey( filename )); instData->m_style |= GWS_RADIO_BUTTON; window = TheWindowManager->gogoGadgetRadioButton( parent, status, x, y, @@ -2510,7 +2510,7 @@ Bool parseInit( const char *token, char *buffer, UnsignedInt version, WindowLayo // translate string to function address info->initNameString = c; - info->init = TheFunctionLexicon->winLayoutInitFunc( TheNameKeyGenerator->nameToKey( info->initNameString ) ); + info->init = TheFunctionLexicon->winLayoutInitFunc( TheNameKeyGenerator->nameToKey( info->initNameString.str() ) ); return TRUE; // success @@ -2529,7 +2529,7 @@ Bool parseUpdate( const char *token, char *buffer, UnsignedInt version, WindowLa // translate string to function address info->updateNameString = c; - info->update = TheFunctionLexicon->winLayoutUpdateFunc( TheNameKeyGenerator->nameToKey( info->updateNameString ) ); + info->update = TheFunctionLexicon->winLayoutUpdateFunc( TheNameKeyGenerator->nameToKey( info->updateNameString.str() ) ); return TRUE; // success @@ -2548,7 +2548,7 @@ Bool parseShutdown( const char *token, char *buffer, UnsignedInt version, Window // translate string to function address info->shutdownNameString = c; - info->shutdown = TheFunctionLexicon->winLayoutShutdownFunc( TheNameKeyGenerator->nameToKey( info->shutdownNameString ) ); + info->shutdown = TheFunctionLexicon->winLayoutShutdownFunc( TheNameKeyGenerator->nameToKey( info->shutdownNameString.str() ) ); return TRUE; // success diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp index deb9c35465a..9d5096f0b7e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp @@ -164,7 +164,7 @@ TransitionWindow::~TransitionWindow( void ) Bool TransitionWindow::init( void ) { - m_winID = TheNameKeyGenerator->nameToKey(m_winName); + m_winID = TheNameKeyGenerator->nameToKey(m_winName.str()); m_win = TheWindowManager->winGetWindowFromId(NULL, m_winID); m_currentFrameDelay = m_frameDelay; // DEBUG_ASSERTCRASH( m_win, ("TransitionWindow::init Failed to find window %s", m_winName.str())); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp index 72fe21b80d7..d3f587a6da4 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp @@ -1134,7 +1134,7 @@ void MainMenuMediumScaleUpTransition::init( GameWindow *win ) AsciiString growWinName; growWinName = m_win->winGetInstanceData()->m_decoratedNameString; growWinName.concat("Medium"); - m_growWin = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(growWinName)); + m_growWin = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(growWinName.str())); if(!m_growWin) return; @@ -1253,7 +1253,7 @@ void MainMenuSmallScaleDownTransition::init( GameWindow *win ) AsciiString growWinName; growWinName = m_win->winGetInstanceData()->m_decoratedNameString; growWinName.concat("Small"); - m_growWin = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(growWinName)); + m_growWin = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(growWinName.str())); if(!m_growWin) return; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp index 5515b6cc216..e4d375d64c9 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp @@ -394,7 +394,7 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) for(; i < MAX_OBJECTIVE_LINES; ++i) { lineName.format("SinglePlayerLoadScreen.wnd:StaticTextLine%d",i); - m_objectiveLines[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( lineName )); + m_objectiveLines[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( lineName.str() )); DEBUG_ASSERTCRASH(m_objectiveLines[i], ("Can't initialize the m_objectiveLines[%d] for the single player loadscreen", i)); GadgetStaticTextSetText(m_objectiveLines[i],UnicodeString::TheEmptyString); @@ -406,7 +406,7 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) for(i = 0; i < MAX_DISPLAYED_UNITS; ++i) { lineName.format("SinglePlayerLoadScreen.wnd:StaticTextCameoText%d",i); - m_unitDesc[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( lineName )); + m_unitDesc[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( lineName.str() )); DEBUG_ASSERTCRASH(m_unitDesc[i], ("Can't initialize the m_objectiveLines[%d] for the single player loadscreen", i)); GadgetStaticTextSetText(m_unitDesc[i],TheGameText->fetch(mission->m_unitNames[i])); m_unitDesc[i]->winHide(TRUE); @@ -720,7 +720,7 @@ void MultiPlayerLoadScreen::init( GameInfo *game ) pt = ThePlayerTemplateStore->getNthPlayerTemplate(lSlot->getPlayerTemplate()); else pt = ThePlayerTemplateStore->findPlayerTemplate( TheNameKeyGenerator->nameToKey("FactionObserver") ); - const Image *loadScreenImage = TheMappedImageCollection->findImageByName(pt->getLoadScreen()); + const Image *loadScreenImage = TheMappedImageCollection->findImageByName(pt->getLoadScreen().str()); AsciiString musicName = pt->getLoadScreenMusic(); @@ -755,29 +755,29 @@ void MultiPlayerLoadScreen::init( GameInfo *game ) // Load the Progress Bar AsciiString winName; winName.format( "MultiplayerLoadScreen.wnd:ProgressLoad%d",i); - m_progressBars[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_progressBars[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_progressBars[i], ("Can't initialize the progressbars for the Multiplayer loadscreen")); // set the progressbar to zero GadgetProgressBarSetProgress(m_progressBars[i], 0 ); // Load MapStart Positions winName.format( "MultiplayerLoadScreen.wnd:ButtonMapStartPosition%d",i); - m_buttonMapStartPosition[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_buttonMapStartPosition[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_buttonMapStartPosition[i], ("Can't initialize the MapStart Positions for the MultiplayerLoadScreen loadscreen")); // Load the Player's name winName.format( "MultiplayerLoadScreen.wnd:StaticTextPlayer%d",i); - m_playerNames[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_playerNames[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_playerNames[i], ("Can't initialize the Names for the Multiplayer loadscreen")); // Load the Player's Side winName.format( "MultiplayerLoadScreen.wnd:StaticTextSide%d",i); - m_playerSide[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_playerSide[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_playerSide[i], ("Can't initialize the Sides for the Multiplayer loadscreen")); winName.format( "MultiplayerLoadScreen.wnd:StaticTextTeam%d",i); - teamWin[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + teamWin[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); // get the slot man! GameSlot *slot = game->getSlot(i); @@ -950,7 +950,7 @@ GameSlot *lSlot = game->getSlot(game->getLocalSlotNum()); pt = ThePlayerTemplateStore->getNthPlayerTemplate(lSlot->getPlayerTemplate()); else pt = ThePlayerTemplateStore->findPlayerTemplate( TheNameKeyGenerator->nameToKey("FactionObserver") ); - const Image *loadScreenImage = TheMappedImageCollection->findImageByName(pt->getLoadScreen()); + const Image *loadScreenImage = TheMappedImageCollection->findImageByName(pt->getLoadScreen().str()); if(loadScreenImage) m_loadScreen->winSetEnabledImage(0, loadScreenImage); @@ -968,59 +968,59 @@ GameSlot *lSlot = game->getSlot(game->getLocalSlotNum()); // Load the Progress Bar AsciiString winName; winName.format( "GameSpyLoadScreen.wnd:ProgressLoad%d",i); - m_progressBars[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_progressBars[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_progressBars[i], ("Can't initialize the progressbars for the GameSpyLoadScreen loadscreen")); // set the progressbar to zero GadgetProgressBarSetProgress(m_progressBars[i], 0 ); // Load the Player's name winName.format( "GameSpyLoadScreen.wnd:StaticTextPlayer%d",i); - m_playerNames[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_playerNames[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_playerNames[i], ("Can't initialize the Names for the GameSpyLoadScreen loadscreen")); // Load MapStart Positions winName.format( "GameSpyLoadScreen.wnd:ButtonMapStartPosition%d",i); - m_buttonMapStartPosition[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_buttonMapStartPosition[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_buttonMapStartPosition[i], ("Can't initialize the MapStart Positions for the GameSpyLoadScreen loadscreen")); // Load the Player's Side winName.format( "GameSpyLoadScreen.wnd:StaticTextSide%d",i); - m_playerSide[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_playerSide[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_playerSide[i], ("Can't initialize the Sides for the GameSpyLoadScreen loadscreen")); // Load the Player's window winName.format( "GameSpyLoadScreen.wnd:WinPlayer%d",i); - m_playerWin[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_playerWin[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_playerWin[i], ("Can't initialize the WinPlayer for the GameSpyLoadScreen loadscreen")); // Load the Player's m_playerTotalDisconnects winName.format( "GameSpyLoadScreen.wnd:StaticTextTotalDisconnects%d",i); - m_playerTotalDisconnects[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_playerTotalDisconnects[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_playerTotalDisconnects[i], ("Can't initialize the m_playerTotalDisconnects for the GameSpyLoadScreen loadscreen")); // // Load the Player's m_playerFavoriteFactions // winName.format( "GameSpyLoadScreen.wnd:StaticTextFavoriteFaction%d",i); -// m_playerFavoriteFactions[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); +// m_playerFavoriteFactions[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); // DEBUG_ASSERTCRASH(m_playerFavoriteFactions[i], ("Can't initialize the StaticTextFavoriteFaction for the GameSpyLoadScreen loadscreen")); // Load the Player's m_playerWinLosses winName.format( "GameSpyLoadScreen.wnd:StaticTextWinLoss%d",i); - m_playerWinLosses[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_playerWinLosses[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_playerWinLosses[i], ("Can't initialize the m_playerWinLosses for the GameSpyLoadScreen loadscreen")); // Load the Player's m_playerWinLosses winName.format( "GameSpyLoadScreen.wnd:WinRank%d",i); - m_playerRank[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_playerRank[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_playerRank[i], ("Can't initialize the m_playerRank for the GameSpyLoadScreen loadscreen")); // Load the Player's m_playerOfficerMedal winName.format( "GameSpyLoadScreen.wnd:WinOfficer%d",i); - m_playerOfficerMedal[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_playerOfficerMedal[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_playerOfficerMedal[i], ("Can't initialize the m_playerOfficerMedal for the GameSpyLoadScreen loadscreen")); winName.format( "MultiplayerLoadScreen.wnd:StaticTextTeam%d",i); - teamWin[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + teamWin[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); // get the slot man! GameSpyGameSlot *slot = (GameSpyGameSlot *)game->getSlot(i); @@ -1258,13 +1258,11 @@ void MapTransferLoadScreen::init( GameInfo *game ) Int i; // Load the Filename Text - winName.format( "MapTransferScreen.wnd:StaticTextCurrentFile"); - m_fileNameText = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_fileNameText = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( "MapTransferScreen.wnd:StaticTextCurrentFile" )); DEBUG_ASSERTCRASH(m_fileNameText, ("Can't initialize the filename for the map transfer loadscreen")); // Load the Timeout Text - winName.format( "MapTransferScreen.wnd:StaticTextTimeout"); - m_timeoutText = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_timeoutText = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( "MapTransferScreen.wnd:StaticTextTimeout" )); DEBUG_ASSERTCRASH(m_timeoutText, ("Can't initialize the timeout for the map transfer loadscreen")); Int netSlot = 0; @@ -1273,19 +1271,19 @@ void MapTransferLoadScreen::init( GameInfo *game ) { // Load the Progress Bar winName.format( "MapTransferScreen.wnd:ProgressLoad%d",i); - m_progressBars[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_progressBars[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_progressBars[i], ("Can't initialize the progressbars for the map transfer loadscreen")); // set the progressbar to zero GadgetProgressBarSetProgress(m_progressBars[i], 0 ); // Load the Player's name winName.format( "MapTransferScreen.wnd:StaticTextPlayer%d",i); - m_playerNames[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_playerNames[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_playerNames[i], ("Can't initialize the Names for the map transfer loadscreen")); // Load the Progress Text winName.format( "MapTransferScreen.wnd:StaticTextProgress%d",i); - m_progressText[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_progressText[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_progressText[i], ("Can't initialize the progress text for the map transfer loadscreen")); // get the slot man! diff --git a/Generals/Code/GameEngine/Source/GameClient/MapUtil.cpp b/Generals/Code/GameEngine/Source/GameClient/MapUtil.cpp index 41fcbb25783..1daf79b2f28 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MapUtil.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MapUtil.cpp @@ -1169,7 +1169,7 @@ Image *getMapPreviewImage( AsciiString mapName ) // copy file over // copy source tgaName, to name - Image *image = (Image *)TheMappedImageCollection->findImageByName(tempName); + Image *image = (Image *)TheMappedImageCollection->findImageByName(tempName.str()); if(!image) { diff --git a/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp b/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp index dc3cf083120..ed8130bf06c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp @@ -207,7 +207,7 @@ void Anim2DTemplate::parseImage( INI *ini, void *instance, void *store, const vo imageName.format( "%s%03d", imageBaseName.str(), i ); // search for this image - image = TheMappedImageCollection->findImageByName( imageName ); + image = TheMappedImageCollection->findImageByName( imageName.str() ); // sanity if( image == NULL ) diff --git a/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp b/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp index 29664571b15..bc01d965312 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp @@ -204,7 +204,7 @@ ImageCollection::ImageCollection( void ) //------------------------------------------------------------------------------------------------- ImageCollection::~ImageCollection( void ) { - for (std::map::iterator i=m_imageMap.begin();i!=m_imageMap.end();++i) + for (ImageMap::iterator i=m_imageMap.begin();i!=m_imageMap.end();++i) deleteInstance(i->second); } @@ -213,15 +213,15 @@ ImageCollection::~ImageCollection( void ) //------------------------------------------------------------------------------------------------- void ImageCollection::addImage( Image *image ) { - m_imageMap[TheNameKeyGenerator->nameToLowercaseKey(image->getName())]=image; + m_imageMap[TheNameKeyGenerator->nameToLowercaseKey(image->getName().str())]=image; } //------------------------------------------------------------------------------------------------- /** Find an image given the image name */ //------------------------------------------------------------------------------------------------- -const Image *ImageCollection::findImageByName( const AsciiString& name ) +const Image *ImageCollection::findImageByName( const char* name ) const { - std::map::iterator i=m_imageMap.find(TheNameKeyGenerator->nameToLowercaseKey(name)); + ImageMap::const_iterator i=m_imageMap.find(TheNameKeyGenerator->nameToLowercaseKey(name)); return i==m_imageMap.end()?NULL:i->second; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp index 9bd88bcb319..600505bfb23 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp @@ -1637,7 +1637,7 @@ void AIPlayer::buildSpecificAIBuilding(const AsciiString &thingName) // ------------------------------------------------------------------------------------------------ void AIPlayer::buildUpgrade(const AsciiString &upgrade) { - const UpgradeTemplate *curUpgrade = TheUpgradeCenter->findUpgrade(upgrade); + const UpgradeTemplate *curUpgrade = TheUpgradeCenter->findUpgrade(upgrade.str()); if (curUpgrade==NULL) { AsciiString msg = "Upgrade "; msg.concat(upgrade); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Armor.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Armor.cpp index 2965f21ea54..b01be9d6de1 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Armor.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Armor.cpp @@ -115,7 +115,7 @@ ArmorStore::~ArmorStore() } //------------------------------------------------------------------------------------------------- -const ArmorTemplate* ArmorStore::findArmorTemplate(AsciiString name) const +const ArmorTemplate* ArmorStore::findArmorTemplate(const char* name) const { NameKeyType namekey = TheNameKeyGenerator->nameToKey(name); ArmorTemplateMap::const_iterator it = m_armorTemplates.find(namekey); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp index e4096fcab7d..e13f8eb0fd3 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp @@ -734,7 +734,7 @@ void DumbProjectileBehavior::xfer( Xfer *xfer ) { // find template - m_detonationWeaponTmpl = TheWeaponStore->findWeaponTemplate( weaponTemplateName ); + m_detonationWeaponTmpl = TheWeaponStore->findWeaponTemplate( weaponTemplateName.str() ); // sanity if( m_detonationWeaponTmpl == NULL ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp index 3d0ee6d9b27..6764df7ac6a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp @@ -151,7 +151,7 @@ void PropagandaTowerBehavior::onObjectCreated( void ) const PropagandaTowerBehaviorModuleData *modData = getPropagandaTowerBehaviorModuleData(); // convert module upgrade name to a pointer - m_upgradeRequired = TheUpgradeCenter->findUpgrade( modData->m_upgradeRequired ); + m_upgradeRequired = TheUpgradeCenter->findUpgrade( modData->m_upgradeRequired.str() ); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp index c8bcb5ded2e..0f72a215d2e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp @@ -88,7 +88,7 @@ void GrantUpgradeCreate::onCreate( void ) { if( !currentStatus.test( OBJECT_STATUS_UNDER_CONSTRUCTION ) ) { - const UpgradeTemplate *upgradeTemplate = TheUpgradeCenter->findUpgrade( getGrantUpgradeCreateModuleData()->m_upgradeName ); + const UpgradeTemplate *upgradeTemplate = TheUpgradeCenter->findUpgrade( getGrantUpgradeCreateModuleData()->m_upgradeName.str() ); if( !upgradeTemplate ) { DEBUG_ASSERTCRASH( 0, ("GrantUpdateCreate for %s can't find upgrade template %s.", getObject()->getName().str(), getGrantUpgradeCreateModuleData()->m_upgradeName.str() ) ); @@ -119,7 +119,7 @@ void GrantUpgradeCreate::onBuildComplete( void ) CreateModule::onBuildComplete(); // extend - const UpgradeTemplate *upgradeTemplate = TheUpgradeCenter->findUpgrade( getGrantUpgradeCreateModuleData()->m_upgradeName ); + const UpgradeTemplate *upgradeTemplate = TheUpgradeCenter->findUpgrade( getGrantUpgradeCreateModuleData()->m_upgradeName.str() ); if( !upgradeTemplate ) { DEBUG_ASSERTCRASH( 0, ("GrantUpdateCreate for %s can't find upgrade template %s.", getObject()->getName().str(), getGrantUpgradeCreateModuleData()->m_upgradeName.str() ) ); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/UpgradeDie.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/UpgradeDie.cpp index 737dd9cb2d9..70fce256e52 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/UpgradeDie.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/UpgradeDie.cpp @@ -64,7 +64,7 @@ void UpgradeDie::onDie( const DamageInfo *damageInfo ) if( producer ) { //Okay, we found our parent... now look for the upgrade. - const UpgradeTemplate *upgrade = TheUpgradeCenter->findUpgrade( getUpgradeDieModuleData()->m_upgradeName ); + const UpgradeTemplate *upgrade = TheUpgradeCenter->findUpgrade( getUpgradeDieModuleData()->m_upgradeName.str() ); if( upgrade ) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp index 06d42d780c1..b34a8054b54 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp @@ -2647,7 +2647,7 @@ void LocomotorSet::xfer( Xfer *xfer ) AsciiString name; xfer->xferAsciiString(&name); - const LocomotorTemplate* lt = TheLocomotorStore->findLocomotorTemplate(NAMEKEY(name)); + const LocomotorTemplate* lt = TheLocomotorStore->findLocomotorTemplate(NAMEKEY(name.str())); if (lt == NULL) { DEBUG_CRASH(( "LocomotorSet::xfer - template %s not found", name.str() )); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp index d0f4b523013..e2dc6aac578 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -3280,11 +3280,11 @@ void Object::updateObjValuesFromMapProperties(Dict* properties) { AsciiString keyName; keyName.format("%s%d", TheNameKeyGenerator->keyToName(TheKey_objectGrantUpgrade).str(), upgradeNum); - valStr = properties->getAsciiString(NAMEKEY(keyName), &exists); + valStr = properties->getAsciiString(NAMEKEY(keyName.str()), &exists); if (exists) { - const UpgradeTemplate *ut = TheUpgradeCenter->findUpgrade(valStr); + const UpgradeTemplate *ut = TheUpgradeCenter->findUpgrade(valStr.str()); if (ut) giveUpgrade(ut); } @@ -3803,7 +3803,7 @@ void Object::xfer( Xfer *xfer ) // read module name xfer->xferAsciiString( &moduleIdentifier ); - NameKeyType moduleIdentifierKey = TheNameKeyGenerator->nameToKey(moduleIdentifier); + NameKeyType moduleIdentifierKey = TheNameKeyGenerator->nameToKey(moduleIdentifier.str()); // find the module with this identifier in the module list module = NULL; 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 51d2a7813e1..23c291d4822 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp @@ -448,7 +448,7 @@ void DeliverPayloadAIUpdate::xfer( Xfer *xfer ) xfer->xferAsciiString(&weaponTemplateName); if( xfer->getXferMode() == XFER_LOAD && weaponTemplateName.isNotEmpty()) { - data.m_visiblePayloadWeaponTemplate = TheWeaponStore->findWeaponTemplate(weaponTemplateName); + data.m_visiblePayloadWeaponTemplate = TheWeaponStore->findWeaponTemplate(weaponTemplateName.str()); } data.m_deliveryDecalTemplate.xferRadiusDecalTemplate(xfer); xfer->xferReal(&data.m_deliveryDecalRadius); 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 1b42513fc2a..fcb55b8021f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp @@ -776,7 +776,7 @@ void MissileAIUpdate::xfer( Xfer *xfer ) xfer->xferAsciiString(&weaponName); if (weaponName.isNotEmpty() && m_detonationWeaponTmpl == NULL) { - m_detonationWeaponTmpl = TheWeaponStore->findWeaponTemplate(weaponName); + m_detonationWeaponTmpl = TheWeaponStore->findWeaponTemplate(weaponName.str()); } AsciiString exhaustName; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp index 179b61d1395..a293022e345 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp @@ -952,7 +952,7 @@ UpdateSleepTime ProductionUpdate::update( void ) for( Int i = 0; i < MAX_UPGRADE_CAMEO_UPGRADES; i++ ) { AsciiString upgradeName = thing->getUpgradeCameoName( i ); - const UpgradeTemplate *testUpgrade = TheUpgradeCenter->findUpgrade( upgradeName ); + const UpgradeTemplate *testUpgrade = TheUpgradeCenter->findUpgrade( upgradeName.str() ); if( testUpgrade == upgrade ) { //Our selected object has the upgrade @@ -1329,7 +1329,7 @@ void ProductionUpdate::xfer( Xfer *xfer ) else { - production->m_upgradeToResearch = TheUpgradeCenter->findUpgrade( name ); + production->m_upgradeToResearch = TheUpgradeCenter->findUpgrade( name.str() ); if( production->m_upgradeToResearch == NULL ) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp index ec95774da6d..6e05476dce8 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp @@ -379,7 +379,7 @@ void StructureToppleUpdate::applyCrushingDamage(Real theta) Real facingWidth = temp3D.length() / 2; // Get the crushing weapon. - const WeaponTemplate* wt = TheWeaponStore->findWeaponTemplate(d->m_crushingWeaponName); + const WeaponTemplate* wt = TheWeaponStore->findWeaponTemplate(d->m_crushingWeaponName.str()); if (wt == NULL) { return; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index 005d5ace984..6e889f7bd79 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -1477,12 +1477,12 @@ void WeaponStore::createAndFireTempWeapon(const WeaponTemplate* wt, const Object } //------------------------------------------------------------------------------------------------- -const WeaponTemplate *WeaponStore::findWeaponTemplate( AsciiString name ) const +const WeaponTemplate *WeaponStore::findWeaponTemplate( const char* name ) const { - if (stricmp(name.str(), "None") == 0) + if (stricmp(name, "None") == 0) return NULL; const WeaponTemplate * wt = findWeaponTemplatePrivate( TheNameKeyGenerator->nameToKey( name ) ); - DEBUG_ASSERTCRASH(wt != NULL, ("Weapon %s not found!",name.str())); + DEBUG_ASSERTCRASH(wt != NULL, ("Weapon %s not found!",name)); return wt; } @@ -1509,7 +1509,7 @@ WeaponTemplate *WeaponStore::newWeaponTemplate(AsciiString name) // allocate a new weapon WeaponTemplate *wt = newInstance(WeaponTemplate); wt->m_name = name; - wt->m_nameKey = TheNameKeyGenerator->nameToKey( name ); + wt->m_nameKey = TheNameKeyGenerator->nameToKey( name.str() ); m_weaponTemplateVector.push_back(wt); return wt; @@ -1627,7 +1627,7 @@ void WeaponStore::postProcessLoad() name.set(c); // find existing item if present - WeaponTemplate *weapon = TheWeaponStore->findWeaponTemplatePrivate( TheNameKeyGenerator->nameToKey( name ) ); + WeaponTemplate *weapon = TheWeaponStore->findWeaponTemplatePrivate( TheNameKeyGenerator->nameToKey( name.str() ) ); if (weapon) { if (ini->getLoadType() == INI_LOAD_CREATE_OVERRIDES) @@ -3213,7 +3213,7 @@ void Weapon::xfer( Xfer *xfer ) xfer->xferAsciiString(&tmplName); if (xfer->getXferMode() == XFER_LOAD) { - m_template = TheWeaponStore->findWeaponTemplate(tmplName); + m_template = TheWeaponStore->findWeaponTemplate(tmplName.str()); if (m_template == NULL) throw INI_INVALID_DATA; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp index e0242d431c4..76b525d706c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp @@ -4368,7 +4368,7 @@ void ScriptActions::doTeamRemoveOverrideRelationToTeam(const AsciiString& teamNa //------------------------------------------------------------------------------------------------- void ScriptActions::doPlayerSetOverrideRelationToTeam(const AsciiString& playerName, const AsciiString& otherTeam, Int relation) { - Player *thePlayer = ThePlayerList->findPlayerWithNameKey(NAMEKEY(playerName)); + Player *thePlayer = ThePlayerList->findPlayerWithNameKey(NAMEKEY(playerName.str())); Team *theOtherTeam = TheScriptEngine->getTeamNamed( otherTeam ); if (thePlayer && theOtherTeam) { thePlayer->setTeamRelationship(theOtherTeam, (Relationship)relation); @@ -4380,7 +4380,7 @@ void ScriptActions::doPlayerSetOverrideRelationToTeam(const AsciiString& playerN //------------------------------------------------------------------------------------------------- void ScriptActions::doPlayerRemoveOverrideRelationToTeam(const AsciiString& playerName, const AsciiString& otherTeam) { - Player *thePlayer = ThePlayerList->findPlayerWithNameKey(NAMEKEY(playerName)); + Player *thePlayer = ThePlayerList->findPlayerWithNameKey(NAMEKEY(playerName.str())); Team *theOtherTeam = TheScriptEngine->getTeamNamed( otherTeam ); if (thePlayer && theOtherTeam) { thePlayer->removeTeamRelationship(theOtherTeam); @@ -4393,7 +4393,7 @@ void ScriptActions::doPlayerRemoveOverrideRelationToTeam(const AsciiString& play void ScriptActions::doTeamSetOverrideRelationToPlayer(const AsciiString& teamName, const AsciiString& otherPlayer, Int relation) { Team *theTeam = TheScriptEngine->getTeamNamed( teamName ); - Player *theOtherPlayer = ThePlayerList->findPlayerWithNameKey(NAMEKEY(otherPlayer)); + Player *theOtherPlayer = ThePlayerList->findPlayerWithNameKey(NAMEKEY(otherPlayer.str())); if (theTeam && theOtherPlayer) { theTeam->setOverridePlayerRelationship(theOtherPlayer->getPlayerIndex(), (Relationship)relation); } @@ -4405,7 +4405,7 @@ void ScriptActions::doTeamSetOverrideRelationToPlayer(const AsciiString& teamNam void ScriptActions::doTeamRemoveOverrideRelationToPlayer(const AsciiString& teamName, const AsciiString& otherPlayer) { Team *theTeam = TheScriptEngine->getTeamNamed( teamName ); - Player *theOtherPlayer = ThePlayerList->findPlayerWithNameKey(NAMEKEY(otherPlayer)); + Player *theOtherPlayer = ThePlayerList->findPlayerWithNameKey(NAMEKEY(otherPlayer.str())); if (theTeam && theOtherPlayer) { theTeam->removeOverridePlayerRelationship(theOtherPlayer->getPlayerIndex()); } @@ -5005,7 +5005,7 @@ void ScriptActions::doUnitReceiveUpgrade( const AsciiString& unitName, const Asc return; } - const UpgradeTemplate *templ = TheUpgradeCenter->findUpgrade(upgradeName); + const UpgradeTemplate *templ = TheUpgradeCenter->findUpgrade(upgradeName.str()); if (!templ) { return; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index 6ff9d7e76ef..4124ffb9db3 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -5120,7 +5120,7 @@ Player *ScriptEngine::getPlayerFromAsciiString(const AsciiString& playerString) return getSkirmishEnemyPlayer(); } else { - NameKeyType key = NAMEKEY(playerString); + NameKeyType key = NAMEKEY(playerString.str()); Player *pPlayer = ThePlayerList->findPlayerWithNameKey(key); if (pPlayer!=NULL) { return pPlayer; diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/VictoryConditions.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/VictoryConditions.cpp index c3f70c082cb..31eb7e37ce9 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/VictoryConditions.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/VictoryConditions.cpp @@ -199,7 +199,7 @@ void VictoryConditions::update( void ) { AsciiString pName; pName.format("player%d", idx); - if (p->getPlayerNameKey() == NAMEKEY(pName)) + if (p->getPlayerNameKey() == NAMEKEY(pName.str())) { GameSlot *slot = (TheGameInfo)?TheGameInfo->getSlot(idx):NULL; if (slot && slot->isAI()) diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 03b6cfda0fb..d974c1d74a4 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -1636,7 +1636,7 @@ void GameLogic::startNewGame( Bool saveGame ) AsciiString playerName; playerName.format("player%d", i); - Player *player = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(playerName)); + Player *player = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(playerName.str())); if (slot->getPlayerTemplate() == PLAYERTEMPLATE_OBSERVER) { @@ -1774,7 +1774,7 @@ void GameLogic::startNewGame( Bool saveGame ) AsciiString playerName; playerName.format("player%d", i); - Player *player = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(playerName)); + Player *player = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(playerName.str())); if (slot->getPlayerTemplate() == PLAYERTEMPLATE_OBSERVER) { diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp index 7ead7cd440d..6b63d05dcf3 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp @@ -131,7 +131,7 @@ void ShowUnderlyingGUIElements( Bool show, const char *layoutFilename, const cha { AsciiString parentNameStr; parentNameStr.format("%s:%s", layoutFilename, parentName); - NameKeyType parentID = NAMEKEY(parentNameStr); + NameKeyType parentID = NAMEKEY(parentNameStr.str()); GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); if (!parent) { @@ -150,7 +150,7 @@ void ShowUnderlyingGUIElements( Bool show, const char *layoutFilename, const cha { AsciiString gadgetName; gadgetName.format("%s:%s", layoutFilename, *text); - win = TheWindowManager->winGetWindowFromId( parent, NAMEKEY(gadgetName) ); + win = TheWindowManager->winGetWindowFromId( parent, NAMEKEY(gadgetName.str()) ); //DEBUG_ASSERTCRASH(win, ("Cannot find %s to show/hide it", gadgetName.str())); if (win) { @@ -166,7 +166,7 @@ void ShowUnderlyingGUIElements( Bool show, const char *layoutFilename, const cha { AsciiString gadgetName; gadgetName.format("%s:%s%d", layoutFilename, *text, player); - win = TheWindowManager->winGetWindowFromId( parent, NAMEKEY(gadgetName) ); + win = TheWindowManager->winGetWindowFromId( parent, NAMEKEY(gadgetName.str()) ); //DEBUG_ASSERTCRASH(win, ("Cannot find %s to show/hide it", gadgetName.str())); if (win) { 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 c94752fe169..bf9389af4ce 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp @@ -512,7 +512,7 @@ static Bool doSingleBoneName(RenderObjClass* robj, const AsciiString& boneName, BONEPOS_LOG(("Caching bone %s (index %d)", boneNameTmp.str(), info.boneIndex)); BONEPOS_DUMPMATRIX3D(&(info.mtx)); - map[NAMEKEY(boneNameTmp)] = info; + map[NAMEKEY(boneNameTmp.str())] = info; foundAsBone = true; } @@ -524,7 +524,7 @@ static Bool doSingleBoneName(RenderObjClass* robj, const AsciiString& boneName, //DEBUG_LOG(("added bone %s",tmp.str())); BONEPOS_LOG(("Caching bone %s (index %d)", tmp.str(), info.boneIndex)); BONEPOS_DUMPMATRIX3D(&(info.mtx)); - map[NAMEKEY(tmp)] = info; + map[NAMEKEY(tmp.str())] = info; foundAsBone = true; } else @@ -540,7 +540,7 @@ static Bool doSingleBoneName(RenderObjClass* robj, const AsciiString& boneName, //DEBUG_LOG(("added subobj %s",boneNameTmp.str())); BONEPOS_LOG(("Caching bone from subobject %s (index %d)", boneNameTmp.str(), info.boneIndex)); BONEPOS_DUMPMATRIX3D(&(info.mtx)); - map[NAMEKEY(boneNameTmp)] = info; + map[NAMEKEY(boneNameTmp.str())] = info; foundAsSubObj = true; } @@ -552,7 +552,7 @@ static Bool doSingleBoneName(RenderObjClass* robj, const AsciiString& boneName, //DEBUG_LOG(("added subobj %s",tmp.str())); BONEPOS_LOG(("Caching bone from subobject %s (index %d)", tmp.str(), info.boneIndex)); BONEPOS_DUMPMATRIX3D(&(info.mtx)); - map[NAMEKEY(tmp)] = info; + map[NAMEKEY(tmp.str())] = info; foundAsSubObj = true; } else @@ -796,24 +796,24 @@ void ModelConditionInfo::validateWeaponBarrelInfo() const // try the unadorned names WeaponBarrelInfo info; if (!recoilBoneName.isEmpty()) - findPristineBone(NAMEKEY(recoilBoneName), &info.m_recoilBone); + findPristineBone(NAMEKEY(recoilBoneName.str()), &info.m_recoilBone); if (!mfName.isEmpty()) - findPristineBone(NAMEKEY(mfName), &info.m_muzzleFlashBone); + findPristineBone(NAMEKEY(mfName.str()), &info.m_muzzleFlashBone); #if defined(RTS_DEBUG) || defined(DEBUG_CRASHING) if (info.m_muzzleFlashBone) info.m_muzzleFlashBoneName = mfName; #endif - const Matrix3D* plbMtx = plbName.isEmpty() ? NULL : findPristineBone(NAMEKEY(plbName), NULL); + const Matrix3D* plbMtx = plbName.isEmpty() ? NULL : findPristineBone(NAMEKEY(plbName.str()), NULL); if (plbMtx != NULL) info.m_projectileOffsetMtx = *plbMtx; else info.m_projectileOffsetMtx.Make_Identity(); if (!fxBoneName.isEmpty()) - findPristineBone(NAMEKEY(fxBoneName), &info.m_fxBone); + findPristineBone(NAMEKEY(fxBoneName.str()), &info.m_fxBone); if (info.m_fxBone != 0 || info.m_recoilBone != 0 || info.m_muzzleFlashBone != 0 || plbMtx != NULL) { @@ -1466,10 +1466,12 @@ void W3DModelDrawModuleData::parseConditionState(INI* ini, void *instance, void case PARSE_TRANSITION: { - AsciiString firstNm = ini->getNextToken(); firstNm.toLower(); - AsciiString secondNm = ini->getNextToken(); secondNm.toLower(); - NameKeyType firstKey = NAMEKEY(firstNm); - NameKeyType secondKey = NAMEKEY(secondNm); + AsciiString firstNm = ini->getNextToken(); + AsciiString secondNm = ini->getNextToken(); + firstNm.toLower(); + secondNm.toLower(); + NameKeyType firstKey = NAMEKEY(firstNm.str()); + NameKeyType secondKey = NAMEKEY(secondNm.str()); if (firstKey == secondKey) { diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp index 260558f8cb6..d6c86da3e6c 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp @@ -139,7 +139,7 @@ void W3DMouse::initPolygonAssets(void) { m_currentPolygonCursor = m_currentCursor; if (!m_cursorInfo[i].imageName.isEmpty()) - cursorImages[i]=TheMappedImageCollection->findImageByName(m_cursorInfo[i].imageName); + cursorImages[i]=TheMappedImageCollection->findImageByName(m_cursorInfo[i].imageName.str()); } } } diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp index c9514c44b2e..762e869b3ed 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp @@ -177,7 +177,7 @@ static LRESULT CALLBACK radioButtonPropertiesCallback( HWND hWndDialog, // save group Int group = GetDlgItemInt( hWndDialog, COMBO_GROUP, NULL, FALSE ); - Int screen = TheNameKeyGenerator->nameToKey( AsciiString(TheEditor->getSaveFilename()) ); + Int screen = TheNameKeyGenerator->nameToKey( TheEditor->getSaveFilename() ); GadgetRadioSetGroup( window, group, screen ); } diff --git a/Generals/Code/Tools/GUIEdit/Source/LayoutScheme.cpp b/Generals/Code/Tools/GUIEdit/Source/LayoutScheme.cpp index f9f674f9305..9ede862b0f7 100644 --- a/Generals/Code/Tools/GUIEdit/Source/LayoutScheme.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/LayoutScheme.cpp @@ -2433,7 +2433,7 @@ Bool LayoutScheme::loadScheme( char *filename ) // store the info storeImageAndColor( (StateIdentifier)state, - TheMappedImageCollection->findImageByName( AsciiString( imageBuffer ) ), + TheMappedImageCollection->findImageByName( imageBuffer ), GameMakeColor( colorR, colorG, colorB, colorA ), GameMakeColor( bColorR, bColorG, bColorB, bColorA ) ); } diff --git a/Generals/Code/Tools/GUIEdit/Source/Properties.cpp b/Generals/Code/Tools/GUIEdit/Source/Properties.cpp index 6cf9dcf002e..3a85e204118 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Properties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Properties.cpp @@ -1258,7 +1258,7 @@ const Image *ComboBoxSelectionToImage( HWND comboBox ) SendMessage( comboBox, CB_GETLBTEXT, selected, (LPARAM)buffer ); // return the image loc that matches the string - return TheMappedImageCollection->findImageByName( AsciiString( buffer ) ); + return TheMappedImageCollection->findImageByName( buffer ); } diff --git a/Generals/Code/Tools/GUIEdit/Source/Save.cpp b/Generals/Code/Tools/GUIEdit/Source/Save.cpp index 41b68e1805e..ad880c32114 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Save.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Save.cpp @@ -1235,7 +1235,7 @@ Bool GUIEdit::saveData( char *filePathAndFilename, char *filename ) // update all radio button screen identifiers with the filename updateRadioScreenIdentifiers( TheWindowManager->winGetWindowList(), - TheNameKeyGenerator->nameToKey( AsciiString(m_saveFilename) ) ); + TheNameKeyGenerator->nameToKey( m_saveFilename ) ); // open the file fp = fopen( filePathAndFilename, "w" ); diff --git a/Generals/Code/Tools/WorldBuilder/src/BuildList.cpp b/Generals/Code/Tools/WorldBuilder/src/BuildList.cpp index 3b677d78e54..982776d0dfc 100644 --- a/Generals/Code/Tools/WorldBuilder/src/BuildList.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/BuildList.cpp @@ -755,7 +755,7 @@ void BuildList::OnExport() throw; AsciiString tmplname = d->getAsciiString(TheKey_playerFaction); - const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname)); + const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname.str())); DEBUG_ASSERTCRASH(pt != NULL, ("PlayerTemplate %s not found -- this is an obsolete map (please open and resave in WB)",tmplname.str())); fprintf(theLogFile, ";Skirmish AI Build List\n"); diff --git a/Generals/Code/Tools/WorldBuilder/src/CUndoable.cpp b/Generals/Code/Tools/WorldBuilder/src/CUndoable.cpp index 1ba555be5d3..45e265c9e92 100644 --- a/Generals/Code/Tools/WorldBuilder/src/CUndoable.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/CUndoable.cpp @@ -822,7 +822,7 @@ void DictItemUndoable::Undo(void) /*static*/ Dict DictItemUndoable::buildSingleItemDict(AsciiString k, Dict::DataType t, AsciiString v) { Dict d; - NameKeyType key = TheNameKeyGenerator->nameToKey(k); + NameKeyType key = TheNameKeyGenerator->nameToKey(k.str()); switch(t) { case Dict::DICT_BOOL: diff --git a/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp index 44904245187..5102dac449d 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp @@ -92,7 +92,7 @@ static Int findSideListEntryWithPlayerOfSide(AsciiString side) for (int i = 0; i < TheSidesList->getNumSides(); i++) { AsciiString ptname = TheSidesList->getSideInfo(i)->getDict()->getAsciiString(TheKey_playerFaction); - const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(ptname)); + const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(ptname.str())); if (pt && pt->getSide() == side) { return i; diff --git a/Generals/Code/Tools/WorldBuilder/src/TeamGeneric.cpp b/Generals/Code/Tools/WorldBuilder/src/TeamGeneric.cpp index 803b19d7e57..d61ab258f85 100644 --- a/Generals/Code/Tools/WorldBuilder/src/TeamGeneric.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/TeamGeneric.cpp @@ -107,7 +107,7 @@ void TeamGeneric::_dictToScripts() AsciiString scriptString; AsciiString keyName; keyName.format("%s%d", TheNameKeyGenerator->keyToName(TheKey_teamGenericScriptHook).str(), i); - scriptString = m_teamDict->getAsciiString(NAMEKEY(keyName), &exists); + scriptString = m_teamDict->getAsciiString(NAMEKEY(keyName.str()), &exists); pText->ShowWindow(SW_SHOW); pCombo->ShowWindow(SW_SHOW); @@ -188,9 +188,9 @@ void TeamGeneric::_scriptsToDict() int curSel = pCombo->GetCurSel(); if (curSel == CB_ERR || curSel == 0) { - if (m_teamDict->known(NAMEKEY(keyName), Dict::DICT_ASCIISTRING)) { + if (m_teamDict->known(NAMEKEY(keyName.str()), Dict::DICT_ASCIISTRING)) { // remove it if we know it. - m_teamDict->remove(NAMEKEY(keyName)); + m_teamDict->remove(NAMEKEY(keyName.str())); } continue; @@ -200,7 +200,7 @@ void TeamGeneric::_scriptsToDict() pCombo->GetLBText(curSel, cstr); AsciiString scriptString = static_cast(cstr); - m_teamDict->setAsciiString(NAMEKEY(keyName), scriptString); + m_teamDict->setAsciiString(NAMEKEY(keyName.str()), scriptString); ++scriptNum; } @@ -208,8 +208,8 @@ void TeamGeneric::_scriptsToDict() AsciiString keyName; keyName.format("%s%d", TheNameKeyGenerator->keyToName(TheKey_teamGenericScriptHook).str(), scriptNum); - if (m_teamDict->known(NAMEKEY(keyName), Dict::DICT_ASCIISTRING)) { - m_teamDict->remove(NAMEKEY(keyName)); + if (m_teamDict->known(NAMEKEY(keyName.str()), Dict::DICT_ASCIISTRING)) { + m_teamDict->remove(NAMEKEY(keyName.str())); } } } diff --git a/Generals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp b/Generals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp index 833e10e66c9..dc440de947a 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp @@ -445,7 +445,7 @@ AsciiString ConvertFaction(AsciiString name) strlcat(newName, name.str() + offset, ARRAY_SIZE(newName)); AsciiString swapName; swapName.set(newName); - const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(swapName)); + const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(swapName.str())); if (pt) { return swapName; } @@ -465,7 +465,7 @@ void CWorldBuilderDoc::validate(void) SidesInfo *pSide = TheSidesList->getSideInfo(side); AsciiString tmplname = pSide->getDict()->getAsciiString(TheKey_playerFaction); - const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname)); + const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname.str())); if (!pt) { DEBUG_LOG(("Faction %s could not be found in sides list!", tmplname.str())); if (tmplname.startsWith("FactionFundamentalist")) { @@ -539,13 +539,13 @@ void CWorldBuilderDoc::validate(void) if (pMapObj->getThingTemplate() == NULL) { Bool exists = false; - swapName = swapDict.getAsciiString(NAMEKEY(name), &exists); + swapName = swapDict.getAsciiString(NAMEKEY(name.str()), &exists); // quick hack to make loading models with "Fundamentalist" switch to "GLA" if (name.startsWith("Fundamentalist")) { swapName = ConvertName(name); if (swapName != AsciiString::TheEmptyString) { - swapDict.setAsciiString(NAMEKEY(name), swapName); + swapDict.setAsciiString(NAMEKEY(name.str()), swapName); exists = true; } } @@ -561,11 +561,11 @@ void CWorldBuilderDoc::validate(void) const ThingTemplate* thing = dlg.getPickedThing(); if (thing) { swapName = thing->getName(); - swapDict.setAsciiString(NAMEKEY(name), swapName); + swapDict.setAsciiString(NAMEKEY(name.str()), swapName); } } } - swapName = swapDict.getAsciiString(NAMEKEY(name), &exists); + swapName = swapDict.getAsciiString(NAMEKEY(name.str()), &exists); if (exists) { const ThingTemplate *tt = TheThingFactory->findTemplate(swapName); @@ -590,7 +590,7 @@ void CWorldBuilderDoc::validate(void) if (pSide) { // Bool hasColor = false; AsciiString tmplname = pSide->getDict()->getAsciiString(TheKey_playerFaction); - const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname)); + const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname.str())); if (!pt) { DEBUG_LOG(("Faction %s could not be found in sides list!", tmplname.str())); if (tmplname.startsWith("FactionFundamentalist")) { diff --git a/Generals/Code/Tools/WorldBuilder/src/addplayerdialog.cpp b/Generals/Code/Tools/WorldBuilder/src/addplayerdialog.cpp index dd02f67f9a1..0c0abb1afa6 100644 --- a/Generals/Code/Tools/WorldBuilder/src/addplayerdialog.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/addplayerdialog.cpp @@ -76,9 +76,8 @@ void AddPlayerDialog::OnOK() } else { faction->GetWindowText(theText); } - AsciiString name((LPCTSTR)theText); - const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(name)); + const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY((LPCTSTR)theText)); if (pt) { m_addedSide = pt ? pt->getName() : AsciiString::TheEmptyString; diff --git a/Generals/Code/Tools/WorldBuilder/src/mapobjectprops.cpp b/Generals/Code/Tools/WorldBuilder/src/mapobjectprops.cpp index fe8c46bd545..746647948b5 100644 --- a/Generals/Code/Tools/WorldBuilder/src/mapobjectprops.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/mapobjectprops.cpp @@ -778,7 +778,7 @@ void MapObjectProps::_DictToPrebuiltUpgrades(void) do { AsciiString keyName; keyName.format("%s%d", TheNameKeyGenerator->keyToName(TheKey_objectGrantUpgrade).str(), upgradeNum); - upgradeString = m_dictToEdit->getAsciiString(NAMEKEY(keyName), &exists); + upgradeString = m_dictToEdit->getAsciiString(NAMEKEY(keyName.str()), &exists); if (exists) { Int selNdx = pBox->FindStringExact(-1, upgradeString.str()); @@ -902,10 +902,10 @@ void MapObjectProps::_PrebuiltUpgradesToDict(void) do { AsciiString keyName; keyName.format("%s%d", TheNameKeyGenerator->keyToName(TheKey_objectGrantUpgrade).str(), upgradeNum); - upgradeString = newDict.getAsciiString(NAMEKEY(keyName), &exists); + upgradeString = newDict.getAsciiString(NAMEKEY(keyName.str()), &exists); if (exists) { - newDict.remove(NAMEKEY(keyName)); + newDict.remove(NAMEKEY(keyName.str())); } ++upgradeNum; @@ -922,7 +922,7 @@ void MapObjectProps::_PrebuiltUpgradesToDict(void) AsciiString keyName; keyName.format("%s%d", TheNameKeyGenerator->keyToName(TheKey_objectGrantUpgrade).str(), upgradeNum); - newDict.setAsciiString(NAMEKEY(keyName), AsciiString(selTxt.GetBuffer(0))); + newDict.setAsciiString(NAMEKEY(keyName.str()), AsciiString(selTxt.GetBuffer(0))); ++upgradeNum; } } diff --git a/Generals/Code/Tools/WorldBuilder/src/playerlistdlg.cpp b/Generals/Code/Tools/WorldBuilder/src/playerlistdlg.cpp index ec1855d77a5..b10534b35ba 100644 --- a/Generals/Code/Tools/WorldBuilder/src/playerlistdlg.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/playerlistdlg.cpp @@ -505,7 +505,7 @@ void PlayerListDlg::updateTheUI(void) rgb.setFromInt(color); } else { AsciiString tmplname = pdict->getAsciiString(TheKey_playerFaction); - const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname)); + const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname.str())); if (pt) { rgb = *pt->getPreferredColor(); } diff --git a/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp b/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp index ee07f29dfb0..865388ccbf4 100644 --- a/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -1360,7 +1360,7 @@ void WbView3d::invalObjectInView(MapObject *pMapObjIn) playerColor = color; } else { AsciiString tmplname = pSide->getDict()->getAsciiString(TheKey_playerFaction); - const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname)); + const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname.str())); if (pt) { playerColor = pt->getPreferredColor()->getAsInt(); } diff --git a/GeneralsMD/Code/GameEngine/Include/Common/DamageFX.h b/GeneralsMD/Code/GameEngine/Include/Common/DamageFX.h index bca57a3ce75..9608b0a3f32 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/DamageFX.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/DamageFX.h @@ -147,7 +147,7 @@ class DamageFXStore : public SubsystemInterface /** Find the DamageFX with the given name. If no such DamageFX exists, return null. */ - const DamageFX *findDamageFX( AsciiString name ) const; + const DamageFX *findDamageFX( const char* name ) const; static void parseDamageFXDefinition(INI* ini); diff --git a/GeneralsMD/Code/GameEngine/Include/Common/NameKeyGenerator.h b/GeneralsMD/Code/GameEngine/Include/Common/NameKeyGenerator.h index bc98672b293..e039d94196c 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/NameKeyGenerator.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/NameKeyGenerator.h @@ -91,10 +91,6 @@ class NameKeyGenerator : public SubsystemInterface virtual void reset(); virtual void update() { } - /// Given a string, convert into a unique integer key. - NameKeyType nameToKey(const AsciiString& name) { return nameToKey(name.str()); } - NameKeyType nameToLowercaseKey(const AsciiString& name) { return nameToLowercaseKey(name.str()); } - /// Given a string, convert into a unique integer key. NameKeyType nameToKey(const char* name); NameKeyType nameToLowercaseKey(const char *name); @@ -138,7 +134,7 @@ class NameKeyGenerator : public SubsystemInterface extern NameKeyGenerator *TheNameKeyGenerator; ///< just one namespace for now // typing "TheNameKeyGenerator->nameToKey()" is awfully wordy. Here are shorter synonyms: -inline NameKeyType NAMEKEY(const AsciiString& name) { return TheNameKeyGenerator->nameToKey(name); } + inline NameKeyType NAMEKEY(const char* name) { return TheNameKeyGenerator->nameToKey(name); } inline AsciiString KEYNAME(NameKeyType nk) { return TheNameKeyGenerator->keyToName(nk); } diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Upgrade.h b/GeneralsMD/Code/GameEngine/Include/Common/Upgrade.h index 07aa657a655..95c7ffc0017 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Upgrade.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Upgrade.h @@ -237,7 +237,7 @@ class UpgradeCenter : public SubsystemInterface UpgradeTemplate *firstUpgradeTemplate( void ); ///< return the first upgrade template const UpgradeTemplate *findUpgradeByKey( NameKeyType key ) const; ///< find upgrade by name key - const UpgradeTemplate *findUpgrade( const AsciiString& name ) const; ///< find and return upgrade by name + const UpgradeTemplate *findUpgrade( const char* name ) const; ///< find and return upgrade by name const UpgradeTemplate *findVeterancyUpgrade(VeterancyLevel level) const; ///< find and return upgrade by name UpgradeTemplate *newUpgrade( const AsciiString& name ); ///< allocate, link, and return new upgrade diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Image.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Image.h index 25ec6e0cf36..2f1ae4bf437 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Image.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Image.h @@ -116,6 +116,7 @@ friend class ImageCollection; //------------------------------------------------------------------------------------------------- class ImageCollection : public SubsystemInterface { + typedef std::map ImageMap; public: @@ -128,7 +129,7 @@ class ImageCollection : public SubsystemInterface void load( Int textureSize ); ///< load images - const Image *findImageByName( const AsciiString& name ); ///< find image based on name + const Image *findImageByName( const char* name ) const; ///< find image based on name /// adds the given image to the collection, transfers ownership to this object void addImage(Image *image); @@ -136,14 +137,14 @@ class ImageCollection : public SubsystemInterface /// enumerates the list of existing images Image *Enum(unsigned index) { - for (std::map::iterator i=m_imageMap.begin();i!=m_imageMap.end();++i) + for (ImageMap::iterator i=m_imageMap.begin();i!=m_imageMap.end();++i) if (!index--) return i->second; return NULL; } protected: - std::map m_imageMap; ///< maps named keys to images + ImageMap m_imageMap; ///< maps named keys to images }; // INLINING /////////////////////////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Armor.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Armor.h index 8e876d7813d..53d9f5dd2a6 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Armor.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Armor.h @@ -108,7 +108,7 @@ class ArmorStore : public SubsystemInterface /** Find the Armor with the given name. If no such Armor exists, return null. */ - const ArmorTemplate* findArmorTemplate(AsciiString name) const; + const ArmorTemplate* findArmorTemplate(const char* name) const; inline Armor makeArmor(const ArmorTemplate *tmpl) const { diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h index fa608967f44..29242bdebdc 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h @@ -839,7 +839,7 @@ class WeaponStore : public SubsystemInterface /** Find the WeaponTemplate with the given name. If no such WeaponTemplate exists, return null. */ - const WeaponTemplate *findWeaponTemplate(AsciiString name) const; + const WeaponTemplate *findWeaponTemplate(const char* name) const; const WeaponTemplate *findWeaponTemplateByNameKey( NameKeyType key ) const { return findWeaponTemplatePrivate( key ); } // this dynamically allocates a new Weapon, which is owned (and must be freed!) by the caller. diff --git a/GeneralsMD/Code/GameEngine/Source/Common/DamageFX.cpp b/GeneralsMD/Code/GameEngine/Source/Common/DamageFX.cpp index 6ba5997c445..c5cabcad8da 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/DamageFX.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/DamageFX.cpp @@ -272,7 +272,7 @@ DamageFXStore::~DamageFXStore() } //------------------------------------------------------------------------------------------------- -const DamageFX *DamageFXStore::findDamageFX(AsciiString name) const +const DamageFX *DamageFXStore::findDamageFX(const char* name) const { NameKeyType namekey = TheNameKeyGenerator->nameToKey(name); DamageFXMap::const_iterator it = m_dfxmap.find(namekey); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp index 890eeb4f650..edda2599bfc 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp @@ -871,7 +871,7 @@ void INI::parseMappedImage( INI *ini, void * /*instance*/, void *store, const vo if( TheMappedImageCollection ) { typedef const Image* ConstImagePtr; - *(ConstImagePtr*)store = TheMappedImageCollection->findImageByName( AsciiString( token ) ); + *(ConstImagePtr*)store = TheMappedImageCollection->findImageByName( token ); } //KM: If we are in the worldbuilder, we want to parse commandbuttons for informational purposes, @@ -1376,7 +1376,7 @@ void INI::parseUpgradeTemplate( INI* ini, void * /*instance*/, void *store, cons throw ERROR_BUG; } - const UpgradeTemplate *uu = TheUpgradeCenter->findUpgrade( AsciiString( token ) ); + const UpgradeTemplate *uu = TheUpgradeCenter->findUpgrade( token ); DEBUG_ASSERTCRASH( uu || stricmp( token, "None" ) == 0, ("Upgrade %s not found!",token) ); typedef const UpgradeTemplate* ConstUpgradeTemplatePtr; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp index 159da910fad..f7a4c801543 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp @@ -42,11 +42,8 @@ //------------------------------------------------------------------------------------------------- void INI::parseMappedImageDefinition( INI* ini ) { - AsciiString name; - // read the name - const char* c = ini->getNextToken(); - name.set( c ); + const char* name = ini->getNextToken(); // // find existing item if present, note that we do not support overrides @@ -66,11 +63,10 @@ void INI::parseMappedImageDefinition( INI* ini ) { // image not found, create a new one - image = newInstance(Image); + image = newInstance(Image); image->setName( name ); TheMappedImageCollection->addImage(image); - DEBUG_ASSERTCRASH( image, ("parseMappedImage: unable to allocate image for '%s'", - name.str()) ); + DEBUG_ASSERTCRASH( image, ("parseMappedImage: unable to allocate image for '%s'", name) ); } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Handicap.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Handicap.cpp index 4261129cf8a..effe23bf3fe 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Handicap.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Handicap.cpp @@ -99,7 +99,7 @@ void Handicap::readFromDict(const Dict* d) c.concat(htNames[i]); c.concat("_"); c.concat(ttNames[j]); - NameKeyType k = TheNameKeyGenerator->nameToKey(c); + NameKeyType k = TheNameKeyGenerator->nameToKey(c.str()); Bool exists; Real r = d->getReal(k, &exists); if (exists) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp index 9088ec4bd1d..05ed4ef7e47 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp @@ -466,7 +466,7 @@ void Player::init(const PlayerTemplate* pt) m_playerDisplayName = UnicodeString::TheEmptyString; m_playerName = AsciiString::TheEmptyString; - m_playerNameKey = NAMEKEY(AsciiString::TheEmptyString); + m_playerNameKey = NAMEKEY(""); m_playerType = PLAYER_COMPUTER; // neutral is always "allied" with self -- this is the only thing ever allied with neutral! @@ -780,7 +780,7 @@ void Player::deletePlayerAI() void Player::initFromDict(const Dict* d) { AsciiString tmplname = d->getAsciiString(TheKey_playerFaction); - const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname)); + const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname.str())); DEBUG_ASSERTCRASH(pt != NULL, ("PlayerTemplate %s not found -- this is an obsolete map (please open and resave in WB)",tmplname.str())); init(pt); @@ -788,7 +788,7 @@ void Player::initFromDict(const Dict* d) m_playerDisplayName = d->getUnicodeString(TheKey_playerDisplayName); AsciiString pname = d->getAsciiString(TheKey_playerName); m_playerName = pname; - m_playerNameKey = NAMEKEY(pname); + m_playerNameKey = NAMEKEY(pname.str()); Bool exists; Bool skirmish = false; @@ -803,7 +803,7 @@ void Player::initFromDict(const Dict* d) for (Int spIdx = 0; spIdx < TheSidesList->getNumSkirmishSides(); ++spIdx) { AsciiString spTemplateName = TheSidesList->getSkirmishSideInfo(spIdx)->getDict()->getAsciiString(TheKey_playerFaction); - const PlayerTemplate* spt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(spTemplateName)); + const PlayerTemplate* spt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(spTemplateName.str())); if (spt && spt->getSide() == getSide()) { skirmish = true; @@ -832,7 +832,7 @@ void Player::initFromDict(const Dict* d) AsciiString qualTemplatePlayerName; for (i=0; igetNumSkirmishSides(); i++) { AsciiString templateName = TheSidesList->getSkirmishSideInfo(i)->getDict()->getAsciiString(TheKey_playerFaction); - pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(templateName)); + pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(templateName.str())); if (pt && pt->getSide() == mySide) { qualTemplatePlayerName.format("%s%d", TheSidesList->getSkirmishSideInfo(i)->getDict()->getAsciiString(TheKey_playerName).str(), m_mpStartIndex); found = true; @@ -870,7 +870,7 @@ void Player::initFromDict(const Dict* d) AsciiString qualTemplatePlayerName; for (skirmishNdx=0; skirmishNdxgetNumSkirmishSides(); skirmishNdx++) { AsciiString templateName = TheSidesList->getSkirmishSideInfo(skirmishNdx)->getDict()->getAsciiString(TheKey_playerFaction); - pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(templateName)); + pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(templateName.str())); if (pt && pt->getSide() == mySide) { qualTemplatePlayerName.format("%s%d", TheSidesList->getSkirmishSideInfo(skirmishNdx)->getDict()->getAsciiString(TheKey_playerName).str(), m_mpStartIndex); found = true; @@ -953,11 +953,11 @@ void Player::initFromDict(const Dict* d) for (j = 0; j < MAX_GENERIC_SCRIPTS; ++j) { AsciiString keyName; keyName.format("%s%d", TheNameKeyGenerator->keyToName(TheKey_teamGenericScriptHook).str(), j); - tmpStr = teamDict.getAsciiString(NAMEKEY(keyName), &exists); + tmpStr = teamDict.getAsciiString(NAMEKEY(keyName.str()), &exists); if (exists && !tmpStr.isEmpty()) { newName.format("%s%d", tmpStr.str(), m_mpStartIndex); - teamDict.setAsciiString(NAMEKEY(keyName), newName); + teamDict.setAsciiString(NAMEKEY(keyName.str()), newName); } } @@ -1930,7 +1930,7 @@ UnsignedInt Player::getSupplyBoxValue() //============================================================================= Real Player::getProductionCostChangePercent( AsciiString buildTemplateName ) const { - ProductionChangeMap::const_iterator it = m_productionCostChanges.find(NAMEKEY(buildTemplateName)); + ProductionChangeMap::const_iterator it = m_productionCostChanges.find(NAMEKEY(buildTemplateName.str())); if (it != m_productionCostChanges.end()) { return (*it).second; @@ -1942,7 +1942,7 @@ Real Player::getProductionCostChangePercent( AsciiString buildTemplateName ) con //============================================================================= Real Player::getProductionTimeChangePercent( AsciiString buildTemplateName ) const { - ProductionChangeMap::const_iterator it = m_productionTimeChanges.find(NAMEKEY(buildTemplateName)); + ProductionChangeMap::const_iterator it = m_productionTimeChanges.find(NAMEKEY(buildTemplateName.str())); if (it != m_productionTimeChanges.end()) { return (*it).second; @@ -1954,7 +1954,7 @@ Real Player::getProductionTimeChangePercent( AsciiString buildTemplateName ) con //============================================================================= VeterancyLevel Player::getProductionVeterancyLevel( AsciiString buildTemplateName ) const { - NameKeyType templateNameKey = NAMEKEY(buildTemplateName); + NameKeyType templateNameKey = NAMEKEY(buildTemplateName.str()); ProductionVeterancyMap::const_iterator it = m_productionVeterancyLevels.find(templateNameKey); if (it != m_productionVeterancyLevels.end()) { @@ -4050,7 +4050,7 @@ void Player::xfer( Xfer *xfer ) xfer->xferAsciiString( &upgradeName ); // find template for this upgrade - upgradeTemplate = TheUpgradeCenter->findUpgrade( upgradeName ); + upgradeTemplate = TheUpgradeCenter->findUpgrade( upgradeName.str() ); // sanity if( upgradeTemplate == NULL ) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerList.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerList.cpp index 7b33095bc6d..9a509fc9fd0 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerList.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerList.cpp @@ -186,14 +186,14 @@ void PlayerList::newGame() for( i = 0; i < TheSidesList->getNumSides(); i++) { Dict *d = TheSidesList->getSideInfo(i)->getDict(); - Player* p = findPlayerWithNameKey(NAMEKEY(d->getAsciiString(TheKey_playerName))); + Player* p = findPlayerWithNameKey(NAMEKEY(d->getAsciiString(TheKey_playerName).str())); AsciiString tok; AsciiString enemies = d->getAsciiString(TheKey_playerEnemies); while (enemies.nextToken(&tok)) { - Player *p2 = findPlayerWithNameKey(NAMEKEY(tok)); + Player *p2 = findPlayerWithNameKey(NAMEKEY(tok.str())); if (p2) { p->setPlayerRelationship(p2, ENEMIES); @@ -207,7 +207,7 @@ void PlayerList::newGame() AsciiString allies = d->getAsciiString(TheKey_playerAllies); while (allies.nextToken(&tok)) { - Player *p2 = findPlayerWithNameKey(NAMEKEY(tok)); + Player *p2 = findPlayerWithNameKey(NAMEKEY(tok.str())); if (p2) { p->setPlayerRelationship(p2, ALLIES); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp index ef8be636a69..1cd54c23776 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp @@ -204,49 +204,49 @@ PlayerTemplate::PlayerTemplate() : //----------------------------------------------------------------------------- const Image *PlayerTemplate::getHeadWaterMarkImage( void ) const { - return TheMappedImageCollection->findImageByName(m_headWaterMark); + return TheMappedImageCollection->findImageByName(m_headWaterMark.str()); } //----------------------------------------------------------------------------- const Image *PlayerTemplate::getFlagWaterMarkImage( void ) const { - return TheMappedImageCollection->findImageByName(m_flagWaterMark); + return TheMappedImageCollection->findImageByName(m_flagWaterMark.str()); } //----------------------------------------------------------------------------- const Image *PlayerTemplate::getSideIconImage( void ) const { - return TheMappedImageCollection->findImageByName(m_sideIconImage); + return TheMappedImageCollection->findImageByName(m_sideIconImage.str()); } //----------------------------------------------------------------------------- const Image *PlayerTemplate::getGeneralImage( void ) const { - return TheMappedImageCollection->findImageByName(m_generalImage); + return TheMappedImageCollection->findImageByName(m_generalImage.str()); } //----------------------------------------------------------------------------- const Image *PlayerTemplate::getEnabledImage( void ) const { - return TheMappedImageCollection->findImageByName(m_enabledImage); + return TheMappedImageCollection->findImageByName(m_enabledImage.str()); } //----------------------------------------------------------------------------- //const Image *PlayerTemplate::getDisabledImage( void ) const //{ -// return TheMappedImageCollection->findImageByName(m_disabledImage); +// return TheMappedImageCollection->findImageByName(m_disabledImage.str()); //} //----------------------------------------------------------------------------- //const Image *PlayerTemplate::getHiliteImage( void ) const //{ -// return TheMappedImageCollection->findImageByName(m_hiliteImage); +// return TheMappedImageCollection->findImageByName(m_hiliteImage.str()); //} //----------------------------------------------------------------------------- //const Image *PlayerTemplate::getPushedImage( void ) const //{ -// return TheMappedImageCollection->findImageByName(m_pushedImage); +// return TheMappedImageCollection->findImageByName(m_pushedImage.str()); //} //----------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp index c2f75e58c22..2cb9a896a7c 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp @@ -85,7 +85,7 @@ ScienceType ScienceStore::getScienceFromInternalName(const AsciiString& name) co { if (name.isEmpty()) return SCIENCE_INVALID; - NameKeyType nkt = TheNameKeyGenerator->nameToKey(name); + NameKeyType nkt = TheNameKeyGenerator->nameToKey(name.str()); ScienceType st = (ScienceType)nkt; return st; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp index 701debf163d..c1415c9b818 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp @@ -235,7 +235,7 @@ void TeamFactory::initFromSides(SidesList *sides) void TeamFactory::initTeam(const AsciiString& name, const AsciiString& owner, Bool isSingleton, Dict *d) { DEBUG_ASSERTCRASH(findTeamPrototype(name)==NULL,("team already exists")); - Player *pOwner = ThePlayerList->findPlayerWithNameKey(NAMEKEY(owner)); + Player *pOwner = ThePlayerList->findPlayerWithNameKey(NAMEKEY(owner.str())); DEBUG_ASSERTCRASH(pOwner, ("no owner found for team %s (%s)",name.str(),owner.str())); if (!pOwner) pOwner = ThePlayerList->getNeutralPlayer(); @@ -249,7 +249,7 @@ void TeamFactory::initTeam(const AsciiString& name, const AsciiString& owner, Bo //============================================================================= void TeamFactory::addTeamPrototypeToList(TeamPrototype* team) { - NameKeyType nk = NAMEKEY(team->getName()); + NameKeyType nk = NAMEKEY(team->getName().str()); TeamPrototypeMap::iterator it = m_prototypes.find(nk); if (it != m_prototypes.end()) { @@ -263,7 +263,7 @@ void TeamFactory::addTeamPrototypeToList(TeamPrototype* team) //============================================================================= void TeamFactory::removeTeamPrototypeFromList(TeamPrototype* team) { - NameKeyType nk = NAMEKEY(team->getName()); + NameKeyType nk = NAMEKEY(team->getName().str()); TeamPrototypeMap::iterator it = m_prototypes.find(nk); if (it != m_prototypes.end()) m_prototypes.erase(it); @@ -272,7 +272,7 @@ void TeamFactory::removeTeamPrototypeFromList(TeamPrototype* team) // ------------------------------------------------------------------------ TeamPrototype *TeamFactory::findTeamPrototype(const AsciiString& name) { - NameKeyType nk = NAMEKEY(name); + NameKeyType nk = NAMEKEY(name.str()); TeamPrototypeMap::iterator it = m_prototypes.find(nk); if (it != m_prototypes.end()) return it->second; @@ -745,7 +745,7 @@ TeamTemplateInfo::TeamTemplateInfo(Dict *d) : for (int i = 0; i < MAX_GENERIC_SCRIPTS; ++i) { AsciiString keyName; keyName.format("%s%d", TheNameKeyGenerator->keyToName(TheKey_teamGenericScriptHook).str(), i); - m_teamGenericScripts[i] = d->getAsciiString(NAMEKEY(keyName), &exists); + m_teamGenericScripts[i] = d->getAsciiString(NAMEKEY(keyName.str()), &exists); if (!exists) { m_teamGenericScripts[i].clear(); } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp index a90b4903f72..97602d66f60 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp @@ -1099,7 +1099,7 @@ void RecorderClass::handleCRCMessage(UnsignedInt newCRC, Int playerIndex, Bool f AsciiString playerName; playerName.format("player%d", localPlayerIndex); const Player *p = ThePlayerList->getNthPlayer(playerIndex); - if (!p || (p->getPlayerNameKey() == NAMEKEY(playerName))) + if (!p || (p->getPlayerNameKey() == NAMEKEY(playerName.str()))) samePlayer = TRUE; if (samePlayer || (localPlayerIndex < 0)) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/DataChunk.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/DataChunk.cpp index 6f04f71e8d7..287416723fb 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/DataChunk.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/DataChunk.cpp @@ -892,7 +892,7 @@ NameKeyType DataChunkInput::readNameKey(void) keyAndType >>= 8; AsciiString kname = m_contents.getName(keyAndType); - NameKeyType k = TheNameKeyGenerator->nameToKey(kname); + NameKeyType k = TheNameKeyGenerator->nameToKey(kname.str()); return k; } @@ -913,7 +913,7 @@ Dict DataChunkInput::readDict() keyAndType >>= 8; AsciiString kname = m_contents.getName(keyAndType); - NameKeyType k = TheNameKeyGenerator->nameToKey(kname); + NameKeyType k = TheNameKeyGenerator->nameToKey(kname.str()); switch(t) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp index f922900cd17..3eccb5ef087 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp @@ -395,7 +395,7 @@ void FunctionLexicon::loadTable( TableEntry *table, { // assign key from name key based on name provided in table - entry->key = TheNameKeyGenerator->nameToKey( AsciiString(entry->name) ); + entry->key = TheNameKeyGenerator->nameToKey( entry->name ); // next table entry please entry++; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp index b93fb4de030..89a826b6d33 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp @@ -193,7 +193,7 @@ void UpgradeTemplate::friend_makeVeterancyUpgrade(VeterancyLevel v) { m_type = UPGRADE_TYPE_OBJECT; // veterancy "upgrades" are always per-object, not per-player m_name = getVetUpgradeName(v); - m_nameKey = TheNameKeyGenerator->nameToKey( m_name ); + m_nameKey = TheNameKeyGenerator->nameToKey( m_name.str() ); m_displayNameLabel.clear(); // should never be displayed m_buildTime = 0.0f; m_cost = 0.0f; @@ -207,7 +207,7 @@ void UpgradeTemplate::cacheButtonImage() { if( m_buttonImageName.isNotEmpty() ) { - m_buttonImage = TheMappedImageCollection->findImageByName( m_buttonImageName ); + m_buttonImage = TheMappedImageCollection->findImageByName( m_buttonImageName.str() ); DEBUG_ASSERTCRASH( m_buttonImage, ("UpgradeTemplate: %s is looking for button image %s but can't find it. Skipping...", m_name.str(), m_buttonImageName.str() ) ); m_buttonImageName.clear(); // we're done with this, so nuke it } @@ -298,7 +298,7 @@ void UpgradeCenter::reset( void ) const UpgradeTemplate *UpgradeCenter::findVeterancyUpgrade( VeterancyLevel level ) const { AsciiString tmp = getVetUpgradeName(level); - return findUpgrade(tmp); + return findUpgrade(tmp.str()); } //------------------------------------------------------------------------------------------------- @@ -347,7 +347,7 @@ const UpgradeTemplate *UpgradeCenter::findUpgradeByKey( NameKeyType key ) const //------------------------------------------------------------------------------------------------- /** Find upgrade matching name */ //------------------------------------------------------------------------------------------------- -const UpgradeTemplate *UpgradeCenter::findUpgrade( const AsciiString& name ) const +const UpgradeTemplate *UpgradeCenter::findUpgrade( const char* name ) const { return findUpgradeByKey( TheNameKeyGenerator->nameToKey( name ) ); @@ -368,7 +368,7 @@ UpgradeTemplate *UpgradeCenter::newUpgrade( const AsciiString& name ) // assign name and starting data newUpgrade->setUpgradeName( name ); - newUpgrade->setUpgradeNameKey( TheNameKeyGenerator->nameToKey( name ) ); + newUpgrade->setUpgradeNameKey( TheNameKeyGenerator->nameToKey( name.str() ) ); // Make a unique bitmask for this new template by keeping track of what bits have been assigned // damn MSFT! proper ANSI syntax for a proper 64-bit constant is "1LL", but MSVC doesn't recognize it @@ -473,8 +473,7 @@ std::vector UpgradeCenter::getUpgradeNames( void ) const void UpgradeCenter::parseUpgradeDefinition( INI *ini ) { // read the name - const char* c = ini->getNextToken(); - AsciiString name = c; + const char* name = ini->getNextToken(); // find existing item if present UpgradeTemplate* upgrade = TheUpgradeCenter->findNonConstUpgradeByKey( NAMEKEY(name) ); @@ -487,7 +486,7 @@ void UpgradeCenter::parseUpgradeDefinition( INI *ini ) } // sanity - DEBUG_ASSERTCRASH( upgrade, ("parseUpgradeDefinition: Unable to allocate upgrade '%s'", name.str()) ); + DEBUG_ASSERTCRASH( upgrade, ("parseUpgradeDefinition: Unable to allocate upgrade '%s'", name) ); // parse the ini definition ini->initFromINI( upgrade, upgrade->getFieldParse() ); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/Module.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/Module.cpp index 0607cddd1d4..c04fa411eba 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/Module.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/Module.cpp @@ -251,7 +251,7 @@ void UpgradeMuxData::muxDataProcessUpgradeRemoval(Object* obj) const it != m_removalUpgradeNames.end(); it++) { - const UpgradeTemplate* theTemplate = TheUpgradeCenter->findUpgrade( *it ); + const UpgradeTemplate* theTemplate = TheUpgradeCenter->findUpgrade( it->str() ); if( !theTemplate ) { DEBUG_CRASH(("An upgrade module references '%s', which is not an Upgrade", it->str())); @@ -293,7 +293,7 @@ void UpgradeMuxData::getUpgradeActivationMasks(UpgradeMaskType& activation, Upgr it != m_activationUpgradeNames.end(); it++) { - const UpgradeTemplate* theTemplate = TheUpgradeCenter->findUpgrade( *it ); + const UpgradeTemplate* theTemplate = TheUpgradeCenter->findUpgrade( it->str() ); if( !theTemplate ) { DEBUG_CRASH(("An upgrade module references '%s', which is not an Upgrade", it->str())); @@ -307,7 +307,7 @@ void UpgradeMuxData::getUpgradeActivationMasks(UpgradeMaskType& activation, Upgr it != m_conflictingUpgradeNames.end(); it++) { - const UpgradeTemplate* theTemplate = TheUpgradeCenter->findUpgrade( *it ); + const UpgradeTemplate* theTemplate = TheUpgradeCenter->findUpgrade( it->str() ); if( !theTemplate ) { DEBUG_CRASH(("An upgrade module references '%s', which is not an Upgrade", it->str())); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp index 7d85052fd7c..48e1e13bcfb 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp @@ -586,7 +586,7 @@ ModuleData* ModuleFactory::newModuleDataFromINI(INI* ini, const AsciiString& nam if (moduleTemplate) { ModuleData* md = (*moduleTemplate->m_createDataProc)(ini); - md->setModuleTagNameKey( NAMEKEY( moduleTag ) ); + md->setModuleTagNameKey( NAMEKEY( moduleTag.str() ) ); m_moduleDataList.push_back(md); return md; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp index 70d8c1b2b9e..99f6e20becf 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp @@ -1295,13 +1295,13 @@ void ThingTemplate::resolveNames() { if( m_selectedPortraitImageName.isNotEmpty() ) { - m_selectedPortraitImage = TheMappedImageCollection->findImageByName( m_selectedPortraitImageName ); + m_selectedPortraitImage = TheMappedImageCollection->findImageByName( m_selectedPortraitImageName.str() ); DEBUG_ASSERTCRASH( m_selectedPortraitImage, ("%s is looking for Portrait %s but can't find it. Skipping...", getName().str(), m_buttonImageName.str() ) ); m_selectedPortraitImageName.clear(); // we're done with this, so nuke it } if( m_buttonImageName.isNotEmpty() ) { - m_buttonImage = TheMappedImageCollection->findImageByName( m_buttonImageName ); + m_buttonImage = TheMappedImageCollection->findImageByName( m_buttonImageName.str() ); DEBUG_ASSERTCRASH( m_buttonImage, ("%s is looking for ButtonImage %s but can't find it. Skipping...", getName().str(), m_buttonImageName.str() ) ); m_buttonImageName.clear(); // we're done with this, so nuke it } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index 9f1f5f7eafe..7fdbae7a1be 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -4842,7 +4842,7 @@ void Drawable::xferDrawableModules( Xfer *xfer ) // read module identifier xfer->xferAsciiString( &moduleIdentifier ); - NameKeyType moduleIdentifierKey = TheNameKeyGenerator->nameToKey(moduleIdentifier); + NameKeyType moduleIdentifierKey = TheNameKeyGenerator->nameToKey(moduleIdentifier.str()); // find module in the drawable module list Module* module = NULL; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index c6f3972b40b..60b839cacb3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -2520,7 +2520,7 @@ void CommandButton::cacheButtonImage() } if( m_buttonImageName.isNotEmpty() ) { - m_buttonImage = TheMappedImageCollection->findImageByName( m_buttonImageName ); + m_buttonImage = TheMappedImageCollection->findImageByName( m_buttonImageName.str() ); DEBUG_ASSERTCRASH( m_buttonImage, ("CommandButton: %s is looking for button image %s but can't find it. Skipping...", m_name.str(), m_buttonImageName.str() ) ); m_buttonImageName.clear(); // we're done with this, so nuke it } @@ -2545,7 +2545,7 @@ void ControlBar::postProcessCommands( void ) void ControlBar::setControlCommand( const AsciiString& buttonWindowName, GameWindow *parent, const CommandButton *commandButton ) { - UnsignedInt winID = TheNameKeyGenerator->nameToKey( buttonWindowName ); + UnsignedInt winID = TheNameKeyGenerator->nameToKey( buttonWindowName.str() ); GameWindow *win = TheWindowManager->winGetWindowFromId( parent, winID ); if( win == NULL ) @@ -2653,7 +2653,7 @@ void ControlBar::setPortraitByObject( Object *obj ) m_rightHUDUpgradeCameos[i]->winHide(TRUE); continue; } - const UpgradeTemplate *ut = TheUpgradeCenter->findUpgrade(upgradeName); + const UpgradeTemplate *ut = TheUpgradeCenter->findUpgrade(upgradeName.str()); if(!ut) { m_rightHUDUpgradeCameos[i]->winHide(TRUE); @@ -2875,7 +2875,7 @@ void ControlBar::updateBuildQueueDisabledImages( const Image *image ) { buttonName.format( "ControlBar.wnd:ButtonQueue%02d", i + 1 ); - buildQueueIDs[ i ] = TheNameKeyGenerator->nameToKey( buttonName ); + buildQueueIDs[ i ] = TheNameKeyGenerator->nameToKey( buttonName.str() ); } @@ -3253,7 +3253,7 @@ void ControlBar::initSpecialPowershortcutBar( Player *player) tempName = layoutName; tempName.concat(":GenPowersShortcutBarParent"); - NameKeyType id = TheNameKeyGenerator->nameToKey( tempName ); + NameKeyType id = TheNameKeyGenerator->nameToKey( tempName.str() ); m_specialPowerShortcutParent = TheWindowManager->winGetWindowFromId( NULL, id );//m_scienceLayout->getFirstWindow(); tempName = layoutName; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp index d76112978de..d7d6e94786a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp @@ -565,7 +565,7 @@ void ControlBar::populateBuildQueue( Object *producer ) { buttonName.format( "ControlBar.wnd:ButtonQueue%02d", i + 1 ); - buildQueueIDs[ i ] = TheNameKeyGenerator->nameToKey( buttonName ); + buildQueueIDs[ i ] = TheNameKeyGenerator->nameToKey( buttonName.str() ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp index bd7a154d681..8037c661d86 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp @@ -114,10 +114,10 @@ void ControlBar::initObserverControls( void ) { AsciiString tmpString; tmpString.format("ControlBar.wnd:ButtonPlayer%d", i); - buttonPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + buttonPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); buttonPlayer[i] = TheWindowManager->winGetWindowFromId( ObserverPlayerListWindow, buttonPlayerID[i] ); tmpString.format("ControlBar.wnd:StaticTextPlayer%d", i); - staticTextPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + staticTextPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); staticTextPlayer[i] = TheWindowManager->winGetWindowFromId( ObserverPlayerListWindow, staticTextPlayerID[i] ); } @@ -259,7 +259,7 @@ void ControlBar::populateObserverList( void ) { AsciiString name; name.format("player%d", i); - Player *p = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(name)); + Player *p = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(name.str())); if(p) { if(p->isPlayerObserver()) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp index 2eee2dd5312..d476053a3dd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp @@ -139,7 +139,7 @@ ResizerWindow *ControlBarResizer::newResizerWindow( AsciiString name ) newRwin->m_name = name; GameWindow *win = NULL; - win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(name)); + win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(name.str())); if( !win ) { DEBUG_ASSERTCRASH(win,("ControlBarResizer::newResizerWindow could not find window %s Are you sure that window is loaded yet?", name.str()) ); @@ -164,7 +164,7 @@ void ControlBarResizer::sizeWindowsDefault( void ) it++; continue; } - win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(rWin->m_name)); + win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(rWin->m_name.str())); if(!win) { it++; @@ -191,7 +191,7 @@ void ControlBarResizer::sizeWindowsAlt( void ) it++; continue; } - win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(rWin->m_name)); + win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(rWin->m_name.str())); if(!win) { it++; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp index dd3ff335ae5..422e879c51b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp @@ -991,7 +991,7 @@ void ControlBarSchemeManager::preloadAssets( TimeOfDay timeOfDay ) ControlBarSchemeImage *cbImage = *listIt; if (cbImage) { - const Image *image = TheMappedImageCollection->findImageByName( cbImage->m_name ); + const Image *image = TheMappedImageCollection->findImageByName( cbImage->m_name.str() ); if (image) { TheDisplay->preloadTextureAssets(image->getFilename()); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp index da73cce360b..48f6abb8656 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp @@ -99,17 +99,17 @@ static void grabWindowPointers( void ) { AsciiString temp; temp.format("Diplomacy.wnd:StaticTextPlayer%d", i); - staticTextPlayerID[i] = NAMEKEY(temp); + staticTextPlayerID[i] = NAMEKEY(temp.str()); temp.format("Diplomacy.wnd:StaticTextSide%d", i); - staticTextSideID[i] = NAMEKEY(temp); + staticTextSideID[i] = NAMEKEY(temp.str()); temp.format("Diplomacy.wnd:StaticTextTeam%d", i); - staticTextTeamID[i] = NAMEKEY(temp); + staticTextTeamID[i] = NAMEKEY(temp.str()); temp.format("Diplomacy.wnd:StaticTextStatus%d", i); - staticTextStatusID[i] = NAMEKEY(temp); + staticTextStatusID[i] = NAMEKEY(temp.str()); temp.format("Diplomacy.wnd:ButtonMute%d", i); - buttonMuteID[i] = NAMEKEY(temp); + buttonMuteID[i] = NAMEKEY(temp.str()); temp.format("Diplomacy.wnd:ButtonUnMute%d", i); - buttonUnMuteID[i] = NAMEKEY(temp); + buttonUnMuteID[i] = NAMEKEY(temp.str()); staticTextPlayer[i] = TheWindowManager->winGetWindowFromId(theWindow, staticTextPlayerID[i]); staticTextSide[i] = TheWindowManager->winGetWindowFromId(theWindow, staticTextSideID[i]); @@ -477,7 +477,7 @@ void PopulateInGameDiplomacyPopup( void ) isInGame = true; AsciiString playerName; playerName.format("player%d", slotNum); - Player *player = ThePlayerList->findPlayerWithNameKey(NAMEKEY(playerName)); + Player *player = ThePlayerList->findPlayerWithNameKey(NAMEKEY(playerName.str())); Bool isAlive = !TheVictoryConditions->hasSinglePlayerBeenDefeated(player); Bool isObserver = player->isPlayerObserver(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp index 09336b14179..ecae9b2ca1a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp @@ -223,7 +223,7 @@ void ToggleInGameChat( Bool immediate ) for (Int i=0; ifindPlayerWithNameKey( TheNameKeyGenerator->nameToKey( playerName ) ); + const Player *player = ThePlayerList->findPlayerWithNameKey( TheNameKeyGenerator->nameToKey( playerName.str() ) ); if (player && localPlayer) { switch (inGameChatType) 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 8a7ca7b216d..3a728a9d3b4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ChallengeMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ChallengeMenu.cpp @@ -152,17 +152,17 @@ void setEnabledButtons() const PlayerTemplate *playerTemplate = ThePlayerTemplateStore->getNthPlayerTemplate(templateNum); if (playerTemplate) { - const Image *enabledImage = TheMappedImageCollection->findImageByName( playerTemplate->getMedallionNormal() ); + const Image *enabledImage = TheMappedImageCollection->findImageByName( playerTemplate->getMedallionNormal().str() ); GadgetCheckBoxSetEnabledImage( buttonGeneralPosition[i], enabledImage ); if (enabledImage) // image size keeps changing, so it'll drive the window size directly buttonGeneralPosition[i]->winSetSize( enabledImage->getImageWidth(), enabledImage->getImageWidth() ); - const Image *selectedImage = TheMappedImageCollection->findImageByName( playerTemplate->getMedallionSelected() ); + const Image *selectedImage = TheMappedImageCollection->findImageByName( playerTemplate->getMedallionSelected().str() ); GadgetCheckBoxSetHiliteUncheckedBoxImage( buttonGeneralPosition[i], selectedImage); GadgetCheckBoxSetDisabledUncheckedBoxImage( buttonGeneralPosition[i], selectedImage); - const Image *hilitedImage = TheMappedImageCollection->findImageByName( playerTemplate->getMedallionHilite() ); + const Image *hilitedImage = TheMappedImageCollection->findImageByName( playerTemplate->getMedallionHilite().str() ); GadgetCheckBoxSetHiliteImage( buttonGeneralPosition[i], hilitedImage); } } @@ -243,7 +243,7 @@ void updateButtonSequence(Int stepsPerUpdate) Int templateNum = ThePlayerTemplateStore->getTemplateNumByName(generals[pos].getPlayerTemplateName()); const PlayerTemplate *playerTemplate = ThePlayerTemplateStore->getNthPlayerTemplate(templateNum); if (playerTemplate) - GadgetCheckBoxSetEnabledImage( buttonGeneralPosition[pos], TheMappedImageCollection->findImageByName( playerTemplate->getMedallionSelected() ) ); + GadgetCheckBoxSetEnabledImage( buttonGeneralPosition[pos], TheMappedImageCollection->findImageByName( playerTemplate->getMedallionSelected().str() ) ); } // mouseover look @@ -252,7 +252,7 @@ void updateButtonSequence(Int stepsPerUpdate) Int templateNum = ThePlayerTemplateStore->getTemplateNumByName(generals[pos].getPlayerTemplateName()); const PlayerTemplate *playerTemplate = ThePlayerTemplateStore->getNthPlayerTemplate(templateNum); if (playerTemplate) - GadgetCheckBoxSetEnabledImage( buttonGeneralPosition[pos], TheMappedImageCollection->findImageByName( playerTemplate->getMedallionHilite() ) ); + GadgetCheckBoxSetEnabledImage( buttonGeneralPosition[pos], TheMappedImageCollection->findImageByName( playerTemplate->getMedallionHilite().str() ) ); } // regular look @@ -261,7 +261,7 @@ void updateButtonSequence(Int stepsPerUpdate) Int templateNum = ThePlayerTemplateStore->getTemplateNumByName(generals[pos].getPlayerTemplateName()); const PlayerTemplate *playerTemplate = ThePlayerTemplateStore->getNthPlayerTemplate(templateNum); if (playerTemplate) - GadgetCheckBoxSetEnabledImage( buttonGeneralPosition[pos], TheMappedImageCollection->findImageByName( playerTemplate->getMedallionNormal() ) ); + GadgetCheckBoxSetEnabledImage( buttonGeneralPosition[pos], TheMappedImageCollection->findImageByName( playerTemplate->getMedallionNormal().str() ) ); } buttonSequenceStep++; @@ -363,7 +363,7 @@ void ChallengeMenuInit( WindowLayout *layout, void *userData ) for (Int i = 0; i < NUM_GENERALS; i++) { strButtonName.format("ChallengeMenu.wnd:GeneralPosition%d", i); - buttonGeneralPositionID[i] = TheNameKeyGenerator->nameToKey( strButtonName ); + buttonGeneralPositionID[i] = TheNameKeyGenerator->nameToKey( strButtonName.str() ); buttonGeneralPosition[i] = TheWindowManager->winGetWindowFromId( parentMenu, buttonGeneralPositionID[i] ); DEBUG_ASSERTCRASH(buttonGeneralPosition[i], ("Could not find the ButtonGeneralPosition[%d]",i )); 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 ae20452c8ee..4e8d80624a0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp @@ -125,8 +125,7 @@ static void SetDifficultyRadioButton( void ) void DifficultySelectInit( WindowLayout *layout, void *userData ) { - AsciiString parentName( "DifficultySelect.wnd:DifficultySelectParent" ); - NameKeyType parentID = TheNameKeyGenerator->nameToKey( parentName ); + NameKeyType parentID = TheNameKeyGenerator->nameToKey( "DifficultySelect.wnd:DifficultySelectParent" ); GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); buttonOkID = TheNameKeyGenerator->nameToKey( "DifficultySelect.wnd:ButtonOk" ); 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 b1b12b87fe5..61a4e89ee71 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp @@ -349,8 +349,7 @@ WindowMsgHandledType DownloadMenuInput( GameWindow *window, UnsignedInt msg, // if( BitIsSet( state, KEY_STATE_UP ) ) { - AsciiString buttonName( "DownloadMenu.wnd:ButtonCancel" ); - NameKeyType buttonID = TheNameKeyGenerator->nameToKey( buttonName ); + NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "DownloadMenu.wnd:ButtonCancel" ); GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonID ); TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, 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 9468c4500f5..0c466741cc5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp @@ -499,8 +499,7 @@ WindowMsgHandledType KeyboardOptionsMenuInput( GameWindow *window, UnsignedInt m // if( BitIsSet( state, KEY_STATE_UP ) ) { - AsciiString buttonName( "KeyboardOptionsMenu.wnd:ButtonBack" ); - NameKeyType buttonID = TheNameKeyGenerator->nameToKey( buttonName ); + NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:ButtonBack" ); GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonID ); TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, 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 2541ecafb9e..d8362d410da 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp @@ -726,7 +726,7 @@ void InitLanGameGadgets( void ) { AsciiString tmpString; tmpString.format("LanGameOptionsMenu.wnd:ComboBoxPlayer%d", i); - comboBoxPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxPlayer[i] = TheWindowManager->winGetWindowFromId( parentLanGameOptions, comboBoxPlayerID[i] ); GadgetComboBoxReset(comboBoxPlayer[i]); GadgetComboBoxGetEditBox(comboBoxPlayer[i])->winSetTooltipFunc(playerTooltip); @@ -748,14 +748,14 @@ void InitLanGameGadgets( void ) */ tmpString.format("LanGameOptionsMenu.wnd:ComboBoxColor%d", i); - comboBoxColorID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxColorID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxColor[i] = TheWindowManager->winGetWindowFromId( parentLanGameOptions, comboBoxColorID[i] ); DEBUG_ASSERTCRASH(comboBoxColor[i], ("Could not find the comboBoxColor[%d]",i )); PopulateColorComboBox(i, comboBoxColor, TheLAN->GetMyGame()); GadgetComboBoxSetSelectedPos(comboBoxColor[i], 0); tmpString.format("LanGameOptionsMenu.wnd:ComboBoxPlayerTemplate%d", i); - comboBoxPlayerTemplateID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxPlayerTemplateID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxPlayerTemplate[i] = TheWindowManager->winGetWindowFromId( parentLanGameOptions, comboBoxPlayerTemplateID[i] ); DEBUG_ASSERTCRASH(comboBoxPlayerTemplate[i], ("Could not find the comboBoxPlayerTemplate[%d]",i )); PopulatePlayerTemplateComboBox(i, comboBoxPlayerTemplate, TheLAN->GetMyGame(), TRUE); @@ -765,25 +765,25 @@ void InitLanGameGadgets( void ) GadgetComboBoxGetListBox(comboBoxPlayerTemplate[i])->winSetTooltipFunc(playerTemplateListBoxTooltip); tmpString.format("LanGameOptionsMenu.wnd:ComboBoxTeam%d", i); - comboBoxTeamID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxTeamID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxTeam[i] = TheWindowManager->winGetWindowFromId( parentLanGameOptions, comboBoxTeamID[i] ); DEBUG_ASSERTCRASH(comboBoxTeam[i], ("Could not find the comboBoxTeam[%d]",i )); PopulateTeamComboBox(i, comboBoxTeam, TheLAN->GetMyGame()); tmpString.clear(); tmpString.format("LanGameOptionsMenu.wnd:ButtonAccept%d", i); - buttonAcceptID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + buttonAcceptID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); buttonAccept[i] = TheWindowManager->winGetWindowFromId( parentLanGameOptions, buttonAcceptID[i] ); DEBUG_ASSERTCRASH(buttonAccept[i], ("Could not find the buttonAccept[%d]",i )); buttonAccept[i]->winSetTooltipFunc(gameAcceptTooltip); // // tmpString.format("LanGameOptionsMenu.wnd:ButtonStartPosition%d", i); -// buttonStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString ); +// buttonStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); // buttonStartPosition[i] = TheWindowManager->winGetWindowFromId( parentLanGameOptions, buttonStartPositionID[i] ); // DEBUG_ASSERTCRASH(buttonStartPosition[i], ("Could not find the ButtonStartPosition[%d]",i )); tmpString.format("LanGameOptionsMenu.wnd:ButtonMapStartPosition%d", i); - buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); buttonMapStartPosition[i] = TheWindowManager->winGetWindowFromId( parentLanGameOptions, buttonMapStartPositionID[i] ); DEBUG_ASSERTCRASH(buttonMapStartPosition[i], ("Could not find the ButtonMapStartPosition[%d]",i )); 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 537352824ca..e0063819b67 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp @@ -122,8 +122,7 @@ void LanMapSelectMenuInit( WindowLayout *layout, void *userData ) showLANGameOptionsUnderlyingGUIElements(FALSE); // set keyboard focus to main parent - AsciiString parentName( "LanMapSelectMenu.wnd:LanMapSelectMenuParent" ); - NameKeyType parentID = TheNameKeyGenerator->nameToKey( parentName ); + NameKeyType parentID = TheNameKeyGenerator->nameToKey( "LanMapSelectMenu.wnd:LanMapSelectMenuParent" ); parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); TheWindowManager->winSetFocus( parent ); @@ -157,7 +156,7 @@ void LanMapSelectMenuInit( WindowLayout *layout, void *userData ) for (Int i = 0; i < MAX_SLOTS; i++) { tmpString.format("LanMapSelectMenu.wnd:ButtonMapStartPosition%d", i); - buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); buttonMapStartPosition[i] = TheWindowManager->winGetWindowFromId( winMapPreview, buttonMapStartPositionID[i] ); DEBUG_ASSERTCRASH(buttonMapStartPosition[i], ("Could not find the ButtonMapStartPosition[%d]",i )); buttonMapStartPosition[i]->winHide(TRUE); @@ -165,8 +164,7 @@ void LanMapSelectMenuInit( WindowLayout *layout, void *userData ) } // get the listbox window - AsciiString listString( "LanMapSelectMenu.wnd:ListboxMap" ); - NameKeyType mapListID = TheNameKeyGenerator->nameToKey( listString ); + NameKeyType mapListID = TheNameKeyGenerator->nameToKey( "LanMapSelectMenu.wnd:ListboxMap" ); mapList = TheWindowManager->winGetWindowFromId( parent, mapListID ); if( mapList ) { @@ -228,8 +226,7 @@ WindowMsgHandledType LanMapSelectMenuInput( GameWindow *window, UnsignedInt msg, // if( BitIsSet( state, KEY_STATE_UP ) ) { - AsciiString buttonName( "LanMapSelectMenu.wnd:ButtonBack" ); - NameKeyType buttonID = TheNameKeyGenerator->nameToKey( buttonName ); + NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "LanMapSelectMenu.wnd:ButtonBack" ); GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonID ); TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, 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 ca0cf4fe1f0..429d921a4fd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp @@ -108,8 +108,7 @@ static void shutdownComplete( WindowLayout *layout ) void SetDifficultyRadioButton( void ) { - AsciiString parentName( "MapSelectMenu.wnd:MapSelectMenuParent" ); - NameKeyType parentID = TheNameKeyGenerator->nameToKey( parentName ); + NameKeyType parentID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:MapSelectMenuParent" ); GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); if (!TheScriptEngine) @@ -171,8 +170,7 @@ void MapSelectMenuInit( WindowLayout *layout, void *userData ) Bool usesSystemMapDir = pref.usesSystemMapDir(); // get the listbox window - AsciiString listString( "MapSelectMenu.wnd:ListboxMap" ); - NameKeyType mapListID = TheNameKeyGenerator->nameToKey( listString ); + NameKeyType mapListID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:ListboxMap" ); mapList = TheWindowManager->winGetWindowFromId( NULL, mapListID ); if( mapList ) { @@ -183,8 +181,7 @@ void MapSelectMenuInit( WindowLayout *layout, void *userData ) // set keyboard focus to main parent - AsciiString parentName( "MapSelectMenu.wnd:MapSelectMenuParent" ); - NameKeyType parentID = TheNameKeyGenerator->nameToKey( parentName ); + NameKeyType parentID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:MapSelectMenuParent" ); GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); TheWindowManager->winSetFocus( parent ); @@ -280,8 +277,7 @@ WindowMsgHandledType MapSelectMenuInput( GameWindow *window, UnsignedInt msg, // if( BitIsSet( state, KEY_STATE_UP ) ) { - AsciiString buttonName( "MapSelectMenu.wnd:ButtonBack" ); - NameKeyType buttonID = TheNameKeyGenerator->nameToKey( buttonName ); + NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:ButtonBack" ); GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonID ); TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, 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 14d6063f8eb..a37446fec3f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -2117,8 +2117,7 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) layout->hide( FALSE ); // set keyboard focus to main parent - AsciiString parentName( "OptionsMenu.wnd:OptionsMenuParent" ); - NameKeyType parentID = TheNameKeyGenerator->nameToKey( parentName ); + NameKeyType parentID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:OptionsMenuParent" ); GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); TheWindowManager->winSetFocus( parent ); @@ -2219,8 +2218,7 @@ WindowMsgHandledType OptionsMenuInput( GameWindow *window, UnsignedInt msg, // if( BitIsSet( state, KEY_STATE_UP ) ) { - AsciiString buttonName( "OptionsMenu.wnd:ButtonBack" ); - NameKeyType buttonID = TheNameKeyGenerator->nameToKey( buttonName ); + NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ButtonBack" ); GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonID ); TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, 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 3dd610bcfdc..815d180d575 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp @@ -127,7 +127,7 @@ static const Image* lookupRankImage(AsciiString side, Int rank) fullImageName.format("Rank_%s%s", rankNames[rank], side.str()); if(strcmp(fullImageName.str(),"Rank_PrivateElite") == 0) fullImageName = "Rank";//_Private_Elite"; - const Image *img = TheMappedImageCollection->findImageByName(fullImageName); + const Image *img = TheMappedImageCollection->findImageByName(fullImageName.str()); DEBUG_ASSERTCRASH( img, ("Could not load rank image: %s", fullImageName.str())); return img; } @@ -800,7 +800,7 @@ static GameWindow* findWindow(GameWindow *parent, AsciiString baseWindow, AsciiS { AsciiString fullPath; fullPath.format("%s:%s", baseWindow.str(), gadgetName.str()); - GameWindow *res = TheWindowManager->winGetWindowFromId(parent, NAMEKEY(fullPath)); + GameWindow *res = TheWindowManager->winGetWindowFromId(parent, NAMEKEY(fullPath.str())); DEBUG_ASSERTLOG(res, ("Cannot find window %s", fullPath.str())); return res; } 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 d1edfbd099f..ec0604d66fe 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp @@ -611,7 +611,7 @@ WindowMsgHandledType ScoreScreenSystem( GameWindow *window, UnsignedInt msg, { AsciiString name; name.format("ScoreScreen.wnd:ButtonAdd%d", i); - if( controlID == TheNameKeyGenerator->nameToKey(name)) + if( controlID == TheNameKeyGenerator->nameToKey(name.str())) { Bool notBuddy = TRUE; Int playerID = (Int)GadgetButtonGetData(TheWindowManager->winGetWindowFromId(NULL,controlID)); @@ -1432,7 +1432,7 @@ void populatePlayerInfo( Player *player, Int pos) GameWindow *win; // set the player name winName.format("ScoreScreen.wnd:StaticTextPlayer%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); if(overidePlayerDisplayName) { @@ -1445,13 +1445,13 @@ void populatePlayerInfo( Player *player, Int pos) // set the player name winName.format("ScoreScreen.wnd:StaticTextObserver%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total units built winName.format("ScoreScreen.wnd:StaticTextUnitsBuilt%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", scoreKpr->getTotalUnitsBuilt()); GadgetStaticTextSetText(win, winValue); @@ -1460,7 +1460,7 @@ void populatePlayerInfo( Player *player, Int pos) // set the total units Lost winName.format("ScoreScreen.wnd:StaticTextUnitsLost%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", scoreKpr->getTotalUnitsLost()); GadgetStaticTextSetText(win, winValue); @@ -1469,7 +1469,7 @@ void populatePlayerInfo( Player *player, Int pos) // set the total units Destroyed winName.format("ScoreScreen.wnd:StaticTextUnitsDestroyed%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", scoreKpr->getTotalUnitsDestroyed()); GadgetStaticTextSetText(win, winValue); @@ -1478,7 +1478,7 @@ void populatePlayerInfo( Player *player, Int pos) // set the total BuildingsBuilt winName.format("ScoreScreen.wnd:StaticTextBuildingsBuilt%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", scoreKpr->getTotalBuildingsBuilt()); GadgetStaticTextSetText(win, winValue); @@ -1487,7 +1487,7 @@ void populatePlayerInfo( Player *player, Int pos) // set the total BuildingsLost winName.format("ScoreScreen.wnd:StaticTextBuildingsLost%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", scoreKpr->getTotalBuildingsLost()); GadgetStaticTextSetText(win, winValue); @@ -1496,7 +1496,7 @@ void populatePlayerInfo( Player *player, Int pos) // set the total BuildingsDestroyed winName.format("ScoreScreen.wnd:StaticTextBuildingsDestroyed%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", scoreKpr->getTotalBuildingsDestroyed()); GadgetStaticTextSetText(win, winValue); @@ -1505,7 +1505,7 @@ void populatePlayerInfo( Player *player, Int pos) // set the total Resources winName.format("ScoreScreen.wnd:StaticTextResources%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", scoreKpr->getTotalMoneyEarned()); GadgetStaticTextSetText(win, winValue); @@ -1537,7 +1537,7 @@ void populatePlayerInfo( Player *player, Int pos) // set the Score /* winName.format("ScoreScreen.wnd:StaticTextScore%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", scoreKpr->calculateScore()); GadgetStaticTextSetText(win, winValue); @@ -1546,7 +1546,7 @@ winName.format("ScoreScreen.wnd:StaticTextScore%d", pos); */ // set the Buttons // winName.format("ScoreScreen.wnd:ButtonAdd%d", pos); - // win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + // win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); // DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); // if(screenType == SCORESCREEN_INTERNET && TheGameSpyInfo && TheGameSpyInfo->getLocalProfileID() != 0) // { @@ -1584,7 +1584,7 @@ winName.format("ScoreScreen.wnd:StaticTextScore%d", pos); // set a marker for who won and lost winName.format("ScoreScreen.wnd:GameWindowWinner%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(FALSE); // if(TheVictoryConditions->hasAchievedVictory(player)) @@ -2073,7 +2073,7 @@ void grabMultiPlayerInfo( void ) for( Int i = 0; i < MAX_SLOTS; ++i) { playerName.format("player%d",i); - player = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(playerName)); + player = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(playerName.str())); if(player) { Int score = player->getScoreKeeper()->calculateScore(); @@ -2145,7 +2145,7 @@ void grabSinglePlayerInfo( void ) PlayerTemplate const *fact = ThePlayerList->getLocalPlayer()->getPlayerTemplate(); if(fact != NULL) { - const Image *image = TheMappedImageCollection->findImageByName(ThePlayerList->getLocalPlayer()->getPlayerTemplate()->getScoreScreen()); + const Image *image = TheMappedImageCollection->findImageByName(ThePlayerList->getLocalPlayer()->getPlayerTemplate()->getScoreScreen().str()); if(image) { parent->winSetEnabledImage(0, image); @@ -2252,76 +2252,76 @@ void hideWindows( Int pos ) // set the player name winName.format("ScoreScreen.wnd:StaticTextPlayer%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the player name winName.format("ScoreScreen.wnd:StaticTextObserver%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total units built winName.format("ScoreScreen.wnd:StaticTextUnitsBuilt%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total units Lost winName.format("ScoreScreen.wnd:StaticTextUnitsLost%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total units Destroyed winName.format("ScoreScreen.wnd:StaticTextUnitsDestroyed%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total BuildingsBuilt winName.format("ScoreScreen.wnd:StaticTextBuildingsBuilt%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total BuildingsLost winName.format("ScoreScreen.wnd:StaticTextBuildingsLost%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); 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 ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); 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 ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total score /* winName.format("ScoreScreen.wnd:StaticTextScore%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); */ // Set the Game Winner marker winName.format("ScoreScreen.wnd:GameWindowWinner%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // // Set the Game Add Buttons // winName.format("ScoreScreen.wnd:ButtonAdd%d", i); -// win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); +// win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); // DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); // win->winHide(TRUE); } @@ -2340,7 +2340,7 @@ void setObserverWindows( Player *player, Int i ) // set the player name winName.format("ScoreScreen.wnd:StaticTextPlayer%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); GadgetStaticTextSetText(win, player->getPlayerDisplayName()); @@ -2349,64 +2349,64 @@ void setObserverWindows( Player *player, Int i ) // set the player name winName.format("ScoreScreen.wnd:StaticTextObserver%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(FALSE); // set the total units built winName.format("ScoreScreen.wnd:StaticTextUnitsBuilt%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total units Lost winName.format("ScoreScreen.wnd:StaticTextUnitsLost%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total units Destroyed winName.format("ScoreScreen.wnd:StaticTextUnitsDestroyed%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total BuildingsBuilt winName.format("ScoreScreen.wnd:StaticTextBuildingsBuilt%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total BuildingsLost winName.format("ScoreScreen.wnd:StaticTextBuildingsLost%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); 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 ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); 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 ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total score /* winName.format("ScoreScreen.wnd:StaticTextScore%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); */ // Set the Game Winner marker winName.format("ScoreScreen.wnd:GameWindowWinner%d", i); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(FALSE); const PlayerTemplate *fact = player->getPlayerTemplate(); @@ -2417,7 +2417,7 @@ winName.format("ScoreScreen.wnd:StaticTextScore%d", i); // // set the Buttons // winName.format("ScoreScreen.wnd:ButtonAdd%d", i); -// win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); +// win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); // DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); //// if(screenType == SCORESCREEN_INTERNET) //// win->winHide(FALSE); @@ -2472,7 +2472,7 @@ void populateSideInfo( UnicodeString side,ScoreGather *sg, Int pos, Color color) GameWindow *win; // set the player name winName.format("ScoreScreen.wnd:StaticTextPlayer%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); GadgetStaticTextSetText(win, side); win->winHide(FALSE); @@ -2480,13 +2480,13 @@ void populateSideInfo( UnicodeString side,ScoreGather *sg, Int pos, Color color) // set the player name winName.format("ScoreScreen.wnd:StaticTextObserver%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(TRUE); // set the total units built winName.format("ScoreScreen.wnd:StaticTextUnitsBuilt%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", sg->m_totalUnitsBuilt); GadgetStaticTextSetText(win, winValue); @@ -2495,7 +2495,7 @@ void populateSideInfo( UnicodeString side,ScoreGather *sg, Int pos, Color color) // set the total units Lost winName.format("ScoreScreen.wnd:StaticTextUnitsLost%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", sg->m_totalUnitsLost); GadgetStaticTextSetText(win, winValue); @@ -2504,7 +2504,7 @@ void populateSideInfo( UnicodeString side,ScoreGather *sg, Int pos, Color color) // set the total units Destroyed winName.format("ScoreScreen.wnd:StaticTextUnitsDestroyed%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", sg->m_totalUnitsDestroyed); GadgetStaticTextSetText(win, winValue); @@ -2513,7 +2513,7 @@ void populateSideInfo( UnicodeString side,ScoreGather *sg, Int pos, Color color) // set the total BuildingsBuilt winName.format("ScoreScreen.wnd:StaticTextBuildingsBuilt%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", sg->m_totalBuildingsBuilt); GadgetStaticTextSetText(win, winValue); @@ -2522,7 +2522,7 @@ void populateSideInfo( UnicodeString side,ScoreGather *sg, Int pos, Color color) // set the total BuildingsLost winName.format("ScoreScreen.wnd:StaticTextBuildingsLost%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", sg->m_totalBuildingsLost); GadgetStaticTextSetText(win, winValue); @@ -2531,7 +2531,7 @@ void populateSideInfo( UnicodeString side,ScoreGather *sg, Int pos, Color color) // set the total BuildingsDestroyed winName.format("ScoreScreen.wnd:StaticTextBuildingsDestroyed%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", sg->m_totalBuildingsDestroyed); GadgetStaticTextSetText(win, winValue); @@ -2540,7 +2540,7 @@ void populateSideInfo( UnicodeString side,ScoreGather *sg, Int pos, Color color) // set the total Resources winName.format("ScoreScreen.wnd:StaticTextResources%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", sg->m_totalMoneyEarned); GadgetStaticTextSetText(win, winValue); @@ -2550,7 +2550,7 @@ void populateSideInfo( UnicodeString side,ScoreGather *sg, Int pos, Color color) // set the Score /* winName.format("ScoreScreen.wnd:StaticTextScore%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); winValue.format(L"%d", scoreKpr->calculateScore()); GadgetStaticTextSetText(win, winValue); @@ -2560,7 +2560,7 @@ winName.format("ScoreScreen.wnd:StaticTextScore%d", pos); // set a marker for who won and lost winName.format("ScoreScreen.wnd:GameWindowWinner%d", pos); - win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); + win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); if(sg->m_sideImage) { @@ -2570,7 +2570,7 @@ winName.format("ScoreScreen.wnd:StaticTextScore%d", pos); // // set the Buttons // winName.format("ScoreScreen.wnd:ButtonAdd%d", pos); -// win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) ); +// win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName.str() ) ); // DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); // if(screenType == SCORESCREEN_INTERNET) // win->winHide(FALSE); 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 e30311d80de..5f72983f75d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp @@ -69,8 +69,7 @@ void SinglePlayerMenuInit( WindowLayout *layout, void *userData ) layout->hide( FALSE ); // set keyboard focus to main parent - AsciiString parentName( "SinglePlayerMenu.wnd:SinglePlayerMenuParent" ); - NameKeyType parentID = TheNameKeyGenerator->nameToKey( parentName ); + NameKeyType parentID = TheNameKeyGenerator->nameToKey( "SinglePlayerMenu.wnd:SinglePlayerMenuParent" ); GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); TheWindowManager->winSetFocus( parent ); @@ -155,8 +154,7 @@ WindowMsgHandledType SinglePlayerMenuInput( GameWindow *window, UnsignedInt msg, // if( BitIsSet( state, KEY_STATE_UP ) ) { - AsciiString buttonName( "SinglePlayerMenu.wnd:ButtonBack" ); - NameKeyType buttonID = TheNameKeyGenerator->nameToKey( buttonName ); + NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "SinglePlayerMenu.wnd:ButtonBack" ); GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonID ); TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, 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 d99f370cc3a..907cc25232a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp @@ -1119,7 +1119,7 @@ void InitSkirmishGameGadgets( void ) tmpString.format("SkirmishGameOptionsMenu.wnd:ComboBoxPlayer%d", i); if(i != 0) { - comboBoxPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxPlayer[i] = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, comboBoxPlayerID[i] ); GadgetComboBoxReset(comboBoxPlayer[i]); //GadgetComboBoxGetEditBox(comboBoxPlayer[i])->winSetTooltipFunc(playerTooltip); @@ -1149,12 +1149,12 @@ void InitSkirmishGameGadgets( void ) } tmpString.format("SkirmishGameOptionsMenu.wnd:ComboBoxColor%d", i); - comboBoxColorID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxColorID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxColor[i] = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, comboBoxColorID[i] ); DEBUG_ASSERTCRASH(comboBoxColor[i], ("Could not find the comboBoxColor[%d]",i )); tmpString.format("SkirmishGameOptionsMenu.wnd:ComboBoxPlayerTemplate%d", i); - comboBoxPlayerTemplateID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxPlayerTemplateID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxPlayerTemplate[i] = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, comboBoxPlayerTemplateID[i] ); DEBUG_ASSERTCRASH(comboBoxPlayerTemplate[i], ("Could not find the comboBoxPlayerTemplate[%d]",i )); @@ -1163,18 +1163,18 @@ void InitSkirmishGameGadgets( void ) GadgetComboBoxGetListBox(comboBoxPlayerTemplate[i])->winSetTooltipFunc(playerTemplateListBoxTooltip); tmpString.format("SkirmishGameOptionsMenu.wnd:ComboBoxTeam%d", i); - comboBoxTeamID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxTeamID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxTeam[i] = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, comboBoxTeamID[i] ); DEBUG_ASSERTCRASH(comboBoxTeam[i], ("Could not find the comboBoxTeam[%d]",i )); // tmpString.format("SkirmishGameOptionsMenu.wnd:ButtonStartPosition%d", i); -// buttonStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString ); +// buttonStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); // buttonStartPosition[i] = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, buttonStartPositionID[i] ); // DEBUG_ASSERTCRASH(buttonStartPosition[i], ("Could not find the ButtonStartPosition[%d]",i )); // tmpString.format("SkirmishGameOptionsMenu.wnd:ButtonMapStartPosition%d", i); - buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); buttonMapStartPosition[i] = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, buttonMapStartPositionID[i] ); DEBUG_ASSERTCRASH(buttonMapStartPosition[i], ("Could not find the ButtonMapStartPosition[%d]",i )); } 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 8d66cac120c..773bc6cee72 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp @@ -130,8 +130,7 @@ void skirmishPositionStartSpots( void ); void skirmishUpdateSlotList( void ); void showSkirmishGameOptionsUnderlyingGUIElements( Bool show ) { - AsciiString parentName( "SkirmishGameOptionsMenu.wnd:SkirmishGameOptionsMenuParent" ); - NameKeyType parentID = TheNameKeyGenerator->nameToKey( parentName ); + NameKeyType parentID = TheNameKeyGenerator->nameToKey( "SkirmishGameOptionsMenu.wnd:SkirmishGameOptionsMenuParent" ); GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); if (!parent) return; @@ -252,8 +251,7 @@ void SkirmishMapSelectMenuInit( WindowLayout *layout, void *userData ) { // set keyboard focus to main parent - AsciiString parentName( "SkirmishMapSelectMenu.wnd:SkrimishMapSelectMenuParent" ); - NameKeyType parentID = TheNameKeyGenerator->nameToKey( parentName ); + NameKeyType parentID = TheNameKeyGenerator->nameToKey( "SkirmishMapSelectMenu.wnd:SkrimishMapSelectMenuParent" ); parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); TheWindowManager->winSetFocus( parent ); @@ -288,7 +286,7 @@ void SkirmishMapSelectMenuInit( WindowLayout *layout, void *userData ) for (Int i = 0; i < MAX_SLOTS; i++) { tmpString.format("SkirmishMapSelectMenu.wnd:ButtonMapStartPosition%d", i); - buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); buttonMapStartPosition[i] = TheWindowManager->winGetWindowFromId( winMapPreview, buttonMapStartPositionID[i] ); DEBUG_ASSERTCRASH(buttonMapStartPosition[i], ("Could not find the ButtonMapStartPosition[%d]",i )); buttonMapStartPosition[i]->winHide(TRUE); @@ -298,8 +296,7 @@ void SkirmishMapSelectMenuInit( WindowLayout *layout, void *userData ) showSkirmishGameOptionsUnderlyingGUIElements(FALSE); // get the listbox window - AsciiString listString( "SkirmishMapSelectMenu.wnd:ListboxMap" ); - NameKeyType mapListID = TheNameKeyGenerator->nameToKey( listString ); + NameKeyType mapListID = TheNameKeyGenerator->nameToKey( "SkirmishMapSelectMenu.wnd:ListboxMap" ); mapList = TheWindowManager->winGetWindowFromId( parent, mapListID ); if( mapList ) { @@ -372,8 +369,7 @@ WindowMsgHandledType SkirmishMapSelectMenuInput( GameWindow *window, UnsignedInt // if( BitIsSet( state, KEY_STATE_UP ) ) { - AsciiString buttonName( "SkirmishMapSelectMenu.wnd:ButtonBack" ); - NameKeyType buttonID = TheNameKeyGenerator->nameToKey( buttonName ); + NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "SkirmishMapSelectMenu.wnd:ButtonBack" ); GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonID ); TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, 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 166659a9500..7f991926e4b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp @@ -1151,15 +1151,15 @@ void WOLBuddyOverlayRCMenuInit( WindowLayout *layout, void *userData ) { AsciiString controlName; controlName.format("%s:ButtonAdd",layout->getFilename().str()+6); - buttonAddID = TheNameKeyGenerator->nameToKey( controlName ); + buttonAddID = TheNameKeyGenerator->nameToKey( controlName.str() ); controlName.format("%s:ButtonDelete",layout->getFilename().str()+6); - buttonDeleteID = TheNameKeyGenerator->nameToKey( controlName ); + buttonDeleteID = TheNameKeyGenerator->nameToKey( controlName.str() ); controlName.format("%s:ButtonPlay",layout->getFilename().str()+6); - buttonPlayID = TheNameKeyGenerator->nameToKey( controlName ); + buttonPlayID = TheNameKeyGenerator->nameToKey( controlName.str() ); controlName.format("%s:ButtonIgnore",layout->getFilename().str()+6); - buttonIgnoreID = TheNameKeyGenerator->nameToKey( controlName ); + buttonIgnoreID = TheNameKeyGenerator->nameToKey( controlName.str() ); controlName.format("%s:ButtonStats",layout->getFilename().str()+6); - buttonStatsID = TheNameKeyGenerator->nameToKey( controlName ); + buttonStatsID = TheNameKeyGenerator->nameToKey( controlName.str() ); } static void closeRightClickMenu(GameWindow *win) { @@ -1392,7 +1392,7 @@ void setUnignoreText( WindowLayout *layout, AsciiString nick, GPProfile id) { AsciiString controlName; controlName.format("%s:ButtonIgnore",layout->getFilename().str()+6); - NameKeyType ID = TheNameKeyGenerator->nameToKey( controlName ); + NameKeyType ID = TheNameKeyGenerator->nameToKey( controlName.str() ); GameWindow *win = TheWindowManager->winGetWindowFromId(layout->getFirstWindow(), ID); if(win) { 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 bb36b3501fb..d6520a8b884 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp @@ -1191,13 +1191,13 @@ void InitWOLGameGadgets( void ) { AsciiString tmpString; tmpString.format("GameSpyGameOptionsMenu.wnd:ComboBoxPlayer%d", i); - comboBoxPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxPlayer[i] = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, comboBoxPlayerID[i] ); GadgetComboBoxReset(comboBoxPlayer[i]); comboBoxPlayer[i]->winSetTooltipFunc(playerTooltip); tmpString.format("GameSpyGameOptionsMenu.wnd:StaticTextPlayer%d", i); - staticTextPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + staticTextPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); staticTextPlayer[i] = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, staticTextPlayerID[i] ); staticTextPlayer[i]->winSetTooltipFunc(playerTooltip); if (TheGameSpyInfo->amIHost()) @@ -1214,14 +1214,14 @@ void InitWOLGameGadgets( void ) } tmpString.format("GameSpyGameOptionsMenu.wnd:ComboBoxColor%d", i); - comboBoxColorID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxColorID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxColor[i] = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, comboBoxColorID[i] ); DEBUG_ASSERTCRASH(comboBoxColor[i], ("Could not find the comboBoxColor[%d]",i )); PopulateColorComboBox(i, comboBoxColor, theGameInfo); GadgetComboBoxSetSelectedPos(comboBoxColor[i], 0); tmpString.format("GameSpyGameOptionsMenu.wnd:ComboBoxPlayerTemplate%d", i); - comboBoxPlayerTemplateID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxPlayerTemplateID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxPlayerTemplate[i] = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, comboBoxPlayerTemplateID[i] ); DEBUG_ASSERTCRASH(comboBoxPlayerTemplate[i], ("Could not find the comboBoxPlayerTemplate[%d]",i )); PopulatePlayerTemplateComboBox(i, comboBoxPlayerTemplate, theGameInfo, theGameInfo->getAllowObservers() ); @@ -1231,30 +1231,30 @@ void InitWOLGameGadgets( void ) GadgetComboBoxGetListBox(comboBoxPlayerTemplate[i])->winSetTooltipFunc(playerTemplateListBoxTooltip); tmpString.format("GameSpyGameOptionsMenu.wnd:ComboBoxTeam%d", i); - comboBoxTeamID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + comboBoxTeamID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); comboBoxTeam[i] = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, comboBoxTeamID[i] ); DEBUG_ASSERTCRASH(comboBoxTeam[i], ("Could not find the comboBoxTeam[%d]",i )); PopulateTeamComboBox(i, comboBoxTeam, theGameInfo); tmpString.format("GameSpyGameOptionsMenu.wnd:ButtonAccept%d", i); - buttonAcceptID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + buttonAcceptID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); buttonAccept[i] = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, buttonAcceptID[i] ); DEBUG_ASSERTCRASH(buttonAccept[i], ("Could not find the buttonAccept[%d]",i )); buttonAccept[i]->winSetTooltipFunc(gameAcceptTooltip); tmpString.format("GameSpyGameOptionsMenu.wnd:GenericPing%d", i); - genericPingWindowID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + genericPingWindowID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); genericPingWindow[i] = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, genericPingWindowID[i] ); DEBUG_ASSERTCRASH(genericPingWindow[i], ("Could not find the genericPingWindow[%d]",i )); genericPingWindow[i]->winSetTooltipFunc(pingTooltip); // tmpString.format("GameSpyGameOptionsMenu.wnd:ButtonStartPosition%d", i); -// buttonStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString ); +// buttonStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); // buttonStartPosition[i] = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, buttonStartPositionID[i] ); // DEBUG_ASSERTCRASH(buttonStartPosition[i], ("Could not find the ButtonStartPosition[%d]",i )); tmpString.format("GameSpyGameOptionsMenu.wnd:ButtonMapStartPosition%d", i); - buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); buttonMapStartPosition[i] = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, buttonMapStartPositionID[i] ); DEBUG_ASSERTCRASH(buttonMapStartPosition[i], ("Could not find the ButtonMapStartPosition[%d]",i )); 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 da15a065ab9..6fb857474bb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp @@ -422,7 +422,7 @@ const Image* LookupSmallRankImage(Int side, Int rankPoints) AsciiString fullImageName; fullImageName.format("%s-%s", rankNames[rank], sideStr.str()); - const Image *img = TheMappedImageCollection->findImageByName(fullImageName); + const Image *img = TheMappedImageCollection->findImageByName(fullImageName.str()); DEBUG_ASSERTLOG(img, ("*** Could not load small rank image '%s' from TheMappedImageCollection!", fullImageName.str())); return img; } 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 fffd934564d..0de0476d4c0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp @@ -127,8 +127,7 @@ void WOLMapSelectMenuInit( WindowLayout *layout, void *userData ) { // set keyboard focus to main parent - AsciiString parentName( "WOLMapSelectMenu.wnd:WOLMapSelectMenuParent" ); - NameKeyType parentID = TheNameKeyGenerator->nameToKey( parentName ); + NameKeyType parentID = TheNameKeyGenerator->nameToKey( "WOLMapSelectMenu.wnd:WOLMapSelectMenuParent" ); parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); TheWindowManager->winSetFocus( parent ); @@ -171,7 +170,7 @@ void WOLMapSelectMenuInit( WindowLayout *layout, void *userData ) for (Int i = 0; i < MAX_SLOTS; i++) { tmpString.format("WOLMapSelectMenu.wnd:ButtonMapStartPosition%d", i); - buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString ); + buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString.str() ); buttonMapStartPosition[i] = TheWindowManager->winGetWindowFromId( winMapPreview, buttonMapStartPositionID[i] ); DEBUG_ASSERTCRASH(buttonMapStartPosition[i], ("Could not find the ButtonMapStartPosition[%d]",i )); buttonMapStartPosition[i]->winHide(TRUE); @@ -182,8 +181,7 @@ void WOLMapSelectMenuInit( WindowLayout *layout, void *userData ) showGameSpyGameOptionsUnderlyingGUIElements( FALSE ); // get the listbox window - AsciiString listString( "WOLMapSelectMenu.wnd:ListboxMap" ); - NameKeyType mapListID = TheNameKeyGenerator->nameToKey( listString ); + NameKeyType mapListID = TheNameKeyGenerator->nameToKey( "WOLMapSelectMenu.wnd:ListboxMap" ); mapList = TheWindowManager->winGetWindowFromId( parent, mapListID ); if( mapList ) { @@ -254,8 +252,7 @@ WindowMsgHandledType WOLMapSelectMenuInput( GameWindow *window, UnsignedInt msg, // if( BitIsSet( state, KEY_STATE_UP ) ) { - AsciiString buttonName( "WOLMapSelectMenu.wnd:ButtonBack" ); - NameKeyType buttonID = TheNameKeyGenerator->nameToKey( buttonName ); + NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "WOLMapSelectMenu.wnd:ButtonBack" ); GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonID ); TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, 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 f098089806f..b514900597e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp @@ -383,7 +383,7 @@ static void updateOverallStats(void) int percent = REAL_TO_INT(100.0f * (it->second / s_totalWinPercent)); percStr.format( TheGameText->fetch("GUI:WinPercent"), percent ); wndName.format( "WOLWelcomeMenu.wnd:Percent%s", it->first.str() ); - pWin = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY(wndName) ); + pWin = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY(wndName.str()) ); GadgetCheckBoxSetText( pWin, percStr ); //x DEBUG_LOG(("Initialized win percent: %s -> %s %f=%s", wndName.str(), it->first.str(), it->second, percStr.str() )); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp index 8125a7c4fb5..d0fb42146af 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp @@ -131,7 +131,7 @@ const Image *GameWindowManager::winFindImage( const char *name ) assert( TheMappedImageCollection ); if( TheMappedImageCollection ) - return TheMappedImageCollection->findImageByName( AsciiString( name ) ); + return TheMappedImageCollection->findImageByName( name ); return NULL; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp index a0d01be715d..ef558a91088 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp @@ -1633,7 +1633,7 @@ GameWindow *GameWindowManager::gogoMessageBox(Int x, Int y, Int width, Int heigh tempName = menuName; tempName.concat("MessageBoxParent"); - parent = TheWindowManager->winGetWindowFromId(trueParent, TheNameKeyGenerator->nameToKey( tempName )); + parent = TheWindowManager->winGetWindowFromId(trueParent, TheNameKeyGenerator->nameToKey( tempName.str() )); TheWindowManager->winSetModal( trueParent ); TheWindowManager->winSetFocus( NULL ); // make sure we lose focus from other windows even if we refuse focus ourselves TheWindowManager->winSetFocus( parent ); @@ -1679,25 +1679,25 @@ GameWindow *GameWindowManager::gogoMessageBox(Int x, Int y, Int width, Int heigh tempName = menuName; tempName.concat("ButtonOk"); - buttonOkID = TheNameKeyGenerator->nameToKey( tempName ); + buttonOkID = TheNameKeyGenerator->nameToKey( tempName.str() ); GameWindow *buttonOk = TheWindowManager->winGetWindowFromId(parent, buttonOkID); buttonOk->winGetPosition(&buttonX[0], &buttonY[0]); tempName = menuName; tempName.concat("ButtonYes"); - NameKeyType buttonYesID = TheNameKeyGenerator->nameToKey( tempName ); + NameKeyType buttonYesID = TheNameKeyGenerator->nameToKey( tempName.str() ); GameWindow *buttonYes = TheWindowManager->winGetWindowFromId(parent, buttonYesID); //buttonNo in the second position tempName = menuName; tempName.concat("ButtonNo"); - NameKeyType buttonNoID = TheNameKeyGenerator->nameToKey(tempName); + NameKeyType buttonNoID = TheNameKeyGenerator->nameToKey(tempName.str()); GameWindow *buttonNo = TheWindowManager->winGetWindowFromId(parent, buttonNoID); buttonNo->winGetPosition(&buttonX[1], &buttonY[1]); //and buttonCancel in the third tempName = menuName; tempName.concat("ButtonCancel"); - NameKeyType buttonCancelID = TheNameKeyGenerator->nameToKey( tempName ); + NameKeyType buttonCancelID = TheNameKeyGenerator->nameToKey( tempName.str() ); GameWindow *buttonCancel = TheWindowManager->winGetWindowFromId(parent, buttonCancelID); buttonCancel->winGetPosition(&buttonX[2], &buttonY[2]); @@ -1744,12 +1744,12 @@ GameWindow *GameWindowManager::gogoMessageBox(Int x, Int y, Int width, Int heigh // Fill the text into the text boxes tempName = menuName; tempName.concat("StaticTextTitle"); - NameKeyType staticTextTitleID = TheNameKeyGenerator->nameToKey( tempName ); + NameKeyType staticTextTitleID = TheNameKeyGenerator->nameToKey( tempName.str() ); GameWindow *staticTextTitle = TheWindowManager->winGetWindowFromId(parent, staticTextTitleID); GadgetStaticTextSetText(staticTextTitle,titleString); tempName = menuName; tempName.concat("StaticTextMessage"); - NameKeyType staticTextMessageID = TheNameKeyGenerator->nameToKey( tempName ); + NameKeyType staticTextMessageID = TheNameKeyGenerator->nameToKey( tempName.str() ); GameWindow *staticTextMessage = TheWindowManager->winGetWindowFromId(parent, staticTextMessageID); GadgetStaticTextSetText(staticTextMessage,bodyString); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp index 2684dfd8324..0c0260a6c66 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp @@ -649,7 +649,7 @@ static Bool parseName( const char *token, WinInstanceData *instData, // given the name assign a window ID from the assert( TheNameKeyGenerator ); if( TheNameKeyGenerator ) - instData->m_id = (Int)TheNameKeyGenerator->nameToKey( instData->m_decoratedNameString ); + instData->m_id = (Int)TheNameKeyGenerator->nameToKey( instData->m_decoratedNameString.str() ); return TRUE; @@ -703,7 +703,7 @@ static Bool parseSystemCallback( const char *token, WinInstanceData *instData, // save a pointer of the function address DEBUG_ASSERTCRASH( TheNameKeyGenerator && TheFunctionLexicon, ("Invalid singletons") ); theSystemString = c; - NameKeyType key = TheNameKeyGenerator->nameToKey( theSystemString ); + NameKeyType key = TheNameKeyGenerator->nameToKey( theSystemString.str() ); systemFunc = TheFunctionLexicon->gameWinSystemFunc( key ); return TRUE; @@ -730,7 +730,7 @@ static Bool parseInputCallback( const char *token, WinInstanceData *instData, // save a pointer of the function address DEBUG_ASSERTCRASH( TheNameKeyGenerator && TheFunctionLexicon, ("Invalid singletons") ); theInputString = c; - NameKeyType key = TheNameKeyGenerator->nameToKey( theInputString ); + NameKeyType key = TheNameKeyGenerator->nameToKey( theInputString.str() ); inputFunc = TheFunctionLexicon->gameWinInputFunc( key ); return TRUE; @@ -757,7 +757,7 @@ static Bool parseTooltipCallback( const char *token, WinInstanceData *instData, // save a pointer of the function address DEBUG_ASSERTCRASH( TheNameKeyGenerator && TheFunctionLexicon, ("Invalid singletons") ); theTooltipString = c; - NameKeyType key = TheNameKeyGenerator->nameToKey( theTooltipString ); + NameKeyType key = TheNameKeyGenerator->nameToKey( theTooltipString.str() ); tooltipFunc = TheFunctionLexicon->gameWinTooltipFunc( key ); return TRUE; @@ -784,7 +784,7 @@ static Bool parseDrawCallback( const char *token, WinInstanceData *instData, // save a pointer of the function address DEBUG_ASSERTCRASH( TheNameKeyGenerator && TheFunctionLexicon, ("Invalid singletons") ); theDrawString = c; - NameKeyType key = TheNameKeyGenerator->nameToKey( theDrawString ); + NameKeyType key = TheNameKeyGenerator->nameToKey( theDrawString.str() ); drawFunc = TheFunctionLexicon->gameWinDrawFunc( key ); return TRUE; @@ -1323,7 +1323,7 @@ static Bool parseDrawData( const char *token, WinInstanceData *instData, c = strtok( NULL, seps ); // value if( strcmp( c, "NoImage" ) ) - drawData->image = TheMappedImageCollection->findImageByName( AsciiString( c ) ); + drawData->image = TheMappedImageCollection->findImageByName( c ); else drawData->image = NULL; // COLOR: R G B A @@ -1652,7 +1652,7 @@ static GameWindow *createGadget( char *type, *c = 0; // terminate after filename (format is filename:gadgetname) assert( TheNameKeyGenerator ); if( TheNameKeyGenerator ) - rData->screen = (Int)(TheNameKeyGenerator->nameToKey( AsciiString(filename) )); + rData->screen = (Int)(TheNameKeyGenerator->nameToKey( filename )); instData->m_style |= GWS_RADIO_BUTTON; window = TheWindowManager->gogoGadgetRadioButton( parent, status, x, y, @@ -2518,7 +2518,7 @@ Bool parseInit( const char *token, char *buffer, UnsignedInt version, WindowLayo // translate string to function address info->initNameString = c; - info->init = TheFunctionLexicon->winLayoutInitFunc( TheNameKeyGenerator->nameToKey( info->initNameString ) ); + info->init = TheFunctionLexicon->winLayoutInitFunc( TheNameKeyGenerator->nameToKey( info->initNameString.str() ) ); return TRUE; // success @@ -2537,7 +2537,7 @@ Bool parseUpdate( const char *token, char *buffer, UnsignedInt version, WindowLa // translate string to function address info->updateNameString = c; - info->update = TheFunctionLexicon->winLayoutUpdateFunc( TheNameKeyGenerator->nameToKey( info->updateNameString ) ); + info->update = TheFunctionLexicon->winLayoutUpdateFunc( TheNameKeyGenerator->nameToKey( info->updateNameString.str() ) ); return TRUE; // success @@ -2556,7 +2556,7 @@ Bool parseShutdown( const char *token, char *buffer, UnsignedInt version, Window // translate string to function address info->shutdownNameString = c; - info->shutdown = TheFunctionLexicon->winLayoutShutdownFunc( TheNameKeyGenerator->nameToKey( info->shutdownNameString ) ); + info->shutdown = TheFunctionLexicon->winLayoutShutdownFunc( TheNameKeyGenerator->nameToKey( info->shutdownNameString.str() ) ); return TRUE; // success diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp index 684b10dff8b..bf60aab1c79 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp @@ -164,7 +164,7 @@ TransitionWindow::~TransitionWindow( void ) Bool TransitionWindow::init( void ) { - m_winID = TheNameKeyGenerator->nameToKey(m_winName); + m_winID = TheNameKeyGenerator->nameToKey(m_winName.str()); m_win = TheWindowManager->winGetWindowFromId(NULL, m_winID); m_currentFrameDelay = m_frameDelay; // DEBUG_ASSERTCRASH( m_win, ("TransitionWindow::init Failed to find window %s", m_winName.str())); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp index dfedf3d0954..9c899b13698 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp @@ -1134,7 +1134,7 @@ void MainMenuMediumScaleUpTransition::init( GameWindow *win ) AsciiString growWinName; growWinName = m_win->winGetInstanceData()->m_decoratedNameString; growWinName.concat("Medium"); - m_growWin = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(growWinName)); + m_growWin = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(growWinName.str())); if(!m_growWin) return; @@ -1253,7 +1253,7 @@ void MainMenuSmallScaleDownTransition::init( GameWindow *win ) AsciiString growWinName; growWinName = m_win->winGetInstanceData()->m_decoratedNameString; growWinName.concat("Small"); - m_growWin = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(growWinName)); + m_growWin = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(growWinName.str())); if(!m_growWin) return; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp index 19cb7a2aea4..06828115c1f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp @@ -415,7 +415,7 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) for(; i < MAX_OBJECTIVE_LINES; ++i) { lineName.format("SinglePlayerLoadScreen.wnd:StaticTextLine%d",i); - m_objectiveLines[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( lineName )); + m_objectiveLines[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( lineName.str() )); DEBUG_ASSERTCRASH(m_objectiveLines[i], ("Can't initialize the m_objectiveLines[%d] for the single player loadscreen", i)); GadgetStaticTextSetText(m_objectiveLines[i],UnicodeString::TheEmptyString); @@ -427,7 +427,7 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) for(i = 0; i < MAX_DISPLAYED_UNITS; ++i) { lineName.format("SinglePlayerLoadScreen.wnd:StaticTextCameoText%d",i); - m_unitDesc[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( lineName )); + m_unitDesc[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( lineName.str() )); DEBUG_ASSERTCRASH(m_unitDesc[i], ("Can't initialize the m_objectiveLines[%d] for the single player loadscreen", i)); GadgetStaticTextSetText(m_unitDesc[i],TheGameText->fetch(mission->m_unitNames[i])); m_unitDesc[i]->winHide(TRUE); @@ -1352,29 +1352,29 @@ void MultiPlayerLoadScreen::init( GameInfo *game ) // Load the Progress Bar AsciiString winName; winName.format( "MultiplayerLoadScreen.wnd:ProgressLoad%d",i); - m_progressBars[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_progressBars[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_progressBars[i], ("Can't initialize the progressbars for the Multiplayer loadscreen")); // set the progressbar to zero GadgetProgressBarSetProgress(m_progressBars[i], 0 ); // Load MapStart Positions winName.format( "MultiplayerLoadScreen.wnd:ButtonMapStartPosition%d",i); - m_buttonMapStartPosition[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_buttonMapStartPosition[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_buttonMapStartPosition[i], ("Can't initialize the MapStart Positions for the MultiplayerLoadScreen loadscreen")); // Load the Player's name winName.format( "MultiplayerLoadScreen.wnd:StaticTextPlayer%d",i); - m_playerNames[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_playerNames[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_playerNames[i], ("Can't initialize the Names for the Multiplayer loadscreen")); // Load the Player's Side winName.format( "MultiplayerLoadScreen.wnd:StaticTextSide%d",i); - m_playerSide[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_playerSide[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_playerSide[i], ("Can't initialize the Sides for the Multiplayer loadscreen")); winName.format( "MultiplayerLoadScreen.wnd:StaticTextTeam%d",i); - teamWin[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + teamWin[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); // get the slot man! GameSlot *slot = game->getSlot(i); @@ -1386,7 +1386,7 @@ void MultiPlayerLoadScreen::init( GameInfo *game ) // format the progress bar to house colors AsciiString imageName; imageName.format("LoadingBar_ProgressCenter%d", slot->getApparentColor()); - const Image *houseImage = TheMappedImageCollection->findImageByName(imageName); + const Image *houseImage = TheMappedImageCollection->findImageByName(imageName.str()); if (! houseImage) houseImage = TheMappedImageCollection->findImageByName("LoadingBar_Progress"); m_progressBars[netSlot]->winSetEnabledImage( 6, houseImage ); @@ -1605,59 +1605,59 @@ GameSlot *lSlot = game->getSlot(game->getLocalSlotNum()); // Load the Progress Bar AsciiString winName; winName.format( "GameSpyLoadScreen.wnd:ProgressLoad%d",i); - m_progressBars[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_progressBars[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_progressBars[i], ("Can't initialize the progressbars for the GameSpyLoadScreen loadscreen")); // set the progressbar to zero GadgetProgressBarSetProgress(m_progressBars[i], 0 ); // Load the Player's name winName.format( "GameSpyLoadScreen.wnd:StaticTextPlayer%d",i); - m_playerNames[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_playerNames[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_playerNames[i], ("Can't initialize the Names for the GameSpyLoadScreen loadscreen")); // Load MapStart Positions winName.format( "GameSpyLoadScreen.wnd:ButtonMapStartPosition%d",i); - m_buttonMapStartPosition[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_buttonMapStartPosition[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_buttonMapStartPosition[i], ("Can't initialize the MapStart Positions for the GameSpyLoadScreen loadscreen")); // Load the Player's Side winName.format( "GameSpyLoadScreen.wnd:StaticTextSide%d",i); - m_playerSide[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_playerSide[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_playerSide[i], ("Can't initialize the Sides for the GameSpyLoadScreen loadscreen")); // Load the Player's window winName.format( "GameSpyLoadScreen.wnd:WinPlayer%d",i); - m_playerWin[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_playerWin[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_playerWin[i], ("Can't initialize the WinPlayer for the GameSpyLoadScreen loadscreen")); // Load the Player's m_playerTotalDisconnects winName.format( "GameSpyLoadScreen.wnd:StaticTextTotalDisconnects%d",i); - m_playerTotalDisconnects[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_playerTotalDisconnects[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_playerTotalDisconnects[i], ("Can't initialize the m_playerTotalDisconnects for the GameSpyLoadScreen loadscreen")); // // Load the Player's m_playerFavoriteFactions // winName.format( "GameSpyLoadScreen.wnd:StaticTextFavoriteFaction%d",i); -// m_playerFavoriteFactions[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); +// m_playerFavoriteFactions[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); // DEBUG_ASSERTCRASH(m_playerFavoriteFactions[i], ("Can't initialize the StaticTextFavoriteFaction for the GameSpyLoadScreen loadscreen")); // Load the Player's m_playerWinLosses winName.format( "GameSpyLoadScreen.wnd:StaticTextWinLoss%d",i); - m_playerWinLosses[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_playerWinLosses[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_playerWinLosses[i], ("Can't initialize the m_playerWinLosses for the GameSpyLoadScreen loadscreen")); // Load the Player's m_playerWinLosses winName.format( "GameSpyLoadScreen.wnd:WinRank%d",i); - m_playerRank[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_playerRank[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_playerRank[i], ("Can't initialize the m_playerRank for the GameSpyLoadScreen loadscreen")); // Load the Player's m_playerOfficerMedal winName.format( "GameSpyLoadScreen.wnd:WinOfficer%d",i); - m_playerOfficerMedal[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_playerOfficerMedal[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_playerOfficerMedal[i], ("Can't initialize the m_playerOfficerMedal for the GameSpyLoadScreen loadscreen")); winName.format( "MultiplayerLoadScreen.wnd:StaticTextTeam%d",i); - teamWin[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + teamWin[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); // get the slot man! GameSpyGameSlot *slot = (GameSpyGameSlot *)game->getSlot(i); @@ -1669,7 +1669,7 @@ GameSlot *lSlot = game->getSlot(game->getLocalSlotNum()); // format the progress bar to house colors AsciiString imageName; imageName.format("LoadingBar_ProgressCenter%d", slot->getApparentColor()); - const Image *houseImage = TheMappedImageCollection->findImageByName(imageName); + const Image *houseImage = TheMappedImageCollection->findImageByName(imageName.str()); if (! houseImage) houseImage = TheMappedImageCollection->findImageByName("LoadingBar_Progress"); m_progressBars[netSlot]->winSetEnabledImage( 6, houseImage ); @@ -1903,13 +1903,11 @@ void MapTransferLoadScreen::init( GameInfo *game ) Int i; // Load the Filename Text - winName.format( "MapTransferScreen.wnd:StaticTextCurrentFile"); - m_fileNameText = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_fileNameText = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( "MapTransferScreen.wnd:StaticTextCurrentFile" )); DEBUG_ASSERTCRASH(m_fileNameText, ("Can't initialize the filename for the map transfer loadscreen")); // Load the Timeout Text - winName.format( "MapTransferScreen.wnd:StaticTextTimeout"); - m_timeoutText = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_timeoutText = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( "MapTransferScreen.wnd:StaticTextTimeout" )); DEBUG_ASSERTCRASH(m_timeoutText, ("Can't initialize the timeout for the map transfer loadscreen")); Int netSlot = 0; @@ -1918,19 +1916,19 @@ void MapTransferLoadScreen::init( GameInfo *game ) { // Load the Progress Bar winName.format( "MapTransferScreen.wnd:ProgressLoad%d",i); - m_progressBars[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_progressBars[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_progressBars[i], ("Can't initialize the progressbars for the map transfer loadscreen")); // set the progressbar to zero GadgetProgressBarSetProgress(m_progressBars[i], 0 ); // Load the Player's name winName.format( "MapTransferScreen.wnd:StaticTextPlayer%d",i); - m_playerNames[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_playerNames[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_playerNames[i], ("Can't initialize the Names for the map transfer loadscreen")); // Load the Progress Text winName.format( "MapTransferScreen.wnd:StaticTextProgress%d",i); - m_progressText[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName )); + m_progressText[i] = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( winName.str() )); DEBUG_ASSERTCRASH(m_progressText[i], ("Can't initialize the progress text for the map transfer loadscreen")); // get the slot man! diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp index a99f1cdc36f..de51276ebef 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp @@ -1169,7 +1169,7 @@ Image *getMapPreviewImage( AsciiString mapName ) // copy file over // copy source tgaName, to name - Image *image = (Image *)TheMappedImageCollection->findImageByName(tempName); + Image *image = (Image *)TheMappedImageCollection->findImageByName(tempName.str()); if(!image) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp index cabff15a158..4e748db0e68 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp @@ -207,7 +207,7 @@ void Anim2DTemplate::parseImage( INI *ini, void *instance, void *store, const vo imageName.format( "%s%03d", imageBaseName.str(), i ); // search for this image - image = TheMappedImageCollection->findImageByName( imageName ); + image = TheMappedImageCollection->findImageByName( imageName.str() ); // sanity if( image == NULL ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp index bcd7b6f79c7..94fd7a7fb06 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp @@ -204,7 +204,7 @@ ImageCollection::ImageCollection( void ) //------------------------------------------------------------------------------------------------- ImageCollection::~ImageCollection( void ) { - for (std::map::iterator i=m_imageMap.begin();i!=m_imageMap.end();++i) + for (ImageMap::iterator i=m_imageMap.begin();i!=m_imageMap.end();++i) deleteInstance(i->second); } @@ -213,15 +213,15 @@ ImageCollection::~ImageCollection( void ) //------------------------------------------------------------------------------------------------- void ImageCollection::addImage( Image *image ) { - m_imageMap[TheNameKeyGenerator->nameToLowercaseKey(image->getName())]=image; + m_imageMap[TheNameKeyGenerator->nameToLowercaseKey(image->getName().str())]=image; } //------------------------------------------------------------------------------------------------- /** Find an image given the image name */ //------------------------------------------------------------------------------------------------- -const Image *ImageCollection::findImageByName( const AsciiString& name ) +const Image *ImageCollection::findImageByName( const char* name ) const { - std::map::iterator i=m_imageMap.find(TheNameKeyGenerator->nameToLowercaseKey(name)); + ImageMap::const_iterator i=m_imageMap.find(TheNameKeyGenerator->nameToLowercaseKey(name)); return i==m_imageMap.end()?NULL:i->second; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp index 74ed1cf47eb..0090b1dc536 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp @@ -1761,7 +1761,7 @@ void AIPlayer::buildSpecificAIBuilding(const AsciiString &thingName) // ------------------------------------------------------------------------------------------------ void AIPlayer::buildUpgrade(const AsciiString &upgrade) { - const UpgradeTemplate *curUpgrade = TheUpgradeCenter->findUpgrade(upgrade); + const UpgradeTemplate *curUpgrade = TheUpgradeCenter->findUpgrade(upgrade.str()); if (curUpgrade==NULL) { AsciiString msg = "Upgrade "; msg.concat(upgrade); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Armor.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Armor.cpp index a313d54b676..0219145aec5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Armor.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Armor.cpp @@ -116,7 +116,7 @@ ArmorStore::~ArmorStore() } //------------------------------------------------------------------------------------------------- -const ArmorTemplate* ArmorStore::findArmorTemplate(AsciiString name) const +const ArmorTemplate* ArmorStore::findArmorTemplate(const char* name) const { NameKeyType namekey = TheNameKeyGenerator->nameToKey(name); ArmorTemplateMap::const_iterator it = m_armorTemplates.find(namekey); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BunkerBusterBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BunkerBusterBehavior.cpp index bfed83b3a9c..77820df1f11 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BunkerBusterBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BunkerBusterBehavior.cpp @@ -119,7 +119,7 @@ void BunkerBusterBehavior::onObjectCreated( void ) const BunkerBusterBehaviorModuleData *modData = getBunkerBusterBehaviorModuleData(); // convert module upgrade name to a pointer - m_upgradeRequired = TheUpgradeCenter->findUpgrade( modData->m_upgradeRequired ); + m_upgradeRequired = TheUpgradeCenter->findUpgrade( modData->m_upgradeRequired.str() ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp index f53b524ee03..d50f651aa41 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp @@ -761,7 +761,7 @@ void DumbProjectileBehavior::xfer( Xfer *xfer ) { // find template - m_detonationWeaponTmpl = TheWeaponStore->findWeaponTemplate( weaponTemplateName ); + m_detonationWeaponTmpl = TheWeaponStore->findWeaponTemplate( weaponTemplateName.str() ); // sanity if( m_detonationWeaponTmpl == NULL ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp index 0283d17197f..1b00c36b219 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp @@ -153,7 +153,7 @@ void PropagandaTowerBehavior::onObjectCreated( void ) const PropagandaTowerBehaviorModuleData *modData = getPropagandaTowerBehaviorModuleData(); // convert module upgrade name to a pointer - m_upgradeRequired = TheUpgradeCenter->findUpgrade( modData->m_upgradeRequired ); + m_upgradeRequired = TheUpgradeCenter->findUpgrade( modData->m_upgradeRequired.str() ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp index 2c4e347f274..da0c7a75ea0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp @@ -88,7 +88,7 @@ void GrantUpgradeCreate::onCreate( void ) { if( !currentStatus.test( OBJECT_STATUS_UNDER_CONSTRUCTION ) ) { - const UpgradeTemplate *upgradeTemplate = TheUpgradeCenter->findUpgrade( getGrantUpgradeCreateModuleData()->m_upgradeName ); + const UpgradeTemplate *upgradeTemplate = TheUpgradeCenter->findUpgrade( getGrantUpgradeCreateModuleData()->m_upgradeName.str() ); if( !upgradeTemplate ) { DEBUG_ASSERTCRASH( 0, ("GrantUpdateCreate for %s can't find upgrade template %s.", getObject()->getName().str(), getGrantUpgradeCreateModuleData()->m_upgradeName.str() ) ); @@ -121,7 +121,7 @@ void GrantUpgradeCreate::onBuildComplete( void ) CreateModule::onBuildComplete(); // extend - const UpgradeTemplate *upgradeTemplate = TheUpgradeCenter->findUpgrade( getGrantUpgradeCreateModuleData()->m_upgradeName ); + const UpgradeTemplate *upgradeTemplate = TheUpgradeCenter->findUpgrade( getGrantUpgradeCreateModuleData()->m_upgradeName.str() ); if( !upgradeTemplate ) { DEBUG_ASSERTCRASH( 0, ("GrantUpdateCreate for %s can't find upgrade template %s.", getObject()->getName().str(), getGrantUpgradeCreateModuleData()->m_upgradeName.str() ) ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/UpgradeDie.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/UpgradeDie.cpp index f94b69a5db0..e0793d1222d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/UpgradeDie.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/UpgradeDie.cpp @@ -64,7 +64,7 @@ void UpgradeDie::onDie( const DamageInfo *damageInfo ) if( producer ) { //Okay, we found our parent... now look for the upgrade. - const UpgradeTemplate *upgrade = TheUpgradeCenter->findUpgrade( getUpgradeDieModuleData()->m_upgradeName ); + const UpgradeTemplate *upgrade = TheUpgradeCenter->findUpgrade( getUpgradeDieModuleData()->m_upgradeName.str() ); if( upgrade ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp index 9b2a9bba467..67059520aa2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp @@ -2686,7 +2686,7 @@ void LocomotorSet::xfer( Xfer *xfer ) AsciiString name; xfer->xferAsciiString(&name); - const LocomotorTemplate* lt = TheLocomotorStore->findLocomotorTemplate(NAMEKEY(name)); + const LocomotorTemplate* lt = TheLocomotorStore->findLocomotorTemplate(NAMEKEY(name.str())); if (lt == NULL) { DEBUG_CRASH(( "LocomotorSet::xfer - template %s not found", name.str() )); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp index 598e266beae..1d322737570 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -3592,11 +3592,11 @@ void Object::updateObjValuesFromMapProperties(Dict* properties) { AsciiString keyName; keyName.format("%s%d", TheNameKeyGenerator->keyToName(TheKey_objectGrantUpgrade).str(), upgradeNum); - valStr = properties->getAsciiString(NAMEKEY(keyName), &exists); + valStr = properties->getAsciiString(NAMEKEY(keyName.str()), &exists); if (exists) { - const UpgradeTemplate *ut = TheUpgradeCenter->findUpgrade(valStr); + const UpgradeTemplate *ut = TheUpgradeCenter->findUpgrade(valStr.str()); if (ut) giveUpgrade(ut); } @@ -4324,7 +4324,7 @@ void Object::xfer( Xfer *xfer ) // read module name xfer->xferAsciiString( &moduleIdentifier ); - NameKeyType moduleIdentifierKey = TheNameKeyGenerator->nameToKey(moduleIdentifier); + NameKeyType moduleIdentifierKey = TheNameKeyGenerator->nameToKey(moduleIdentifier.str()); // find the module with this identifier in the module list module = NULL; 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 63cf5c78cb1..d07664c30c7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp @@ -453,7 +453,7 @@ void DeliverPayloadAIUpdate::xfer( Xfer *xfer ) xfer->xferAsciiString(&weaponTemplateName); if( xfer->getXferMode() == XFER_LOAD && weaponTemplateName.isNotEmpty()) { - data.m_visiblePayloadWeaponTemplate = TheWeaponStore->findWeaponTemplate(weaponTemplateName); + data.m_visiblePayloadWeaponTemplate = TheWeaponStore->findWeaponTemplate(weaponTemplateName.str()); } data.m_deliveryDecalTemplate.xferRadiusDecalTemplate(xfer); xfer->xferReal(&data.m_deliveryDecalRadius); 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 385fadf28e4..d27b45dc2bb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp @@ -875,7 +875,7 @@ void MissileAIUpdate::xfer( Xfer *xfer ) xfer->xferAsciiString(&weaponName); if (weaponName.isNotEmpty() && m_detonationWeaponTmpl == NULL) { - m_detonationWeaponTmpl = TheWeaponStore->findWeaponTemplate(weaponName); + m_detonationWeaponTmpl = TheWeaponStore->findWeaponTemplate(weaponName.str()); } AsciiString exhaustName; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp index 9eb841a70bf..50a53333534 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp @@ -957,7 +957,7 @@ UpdateSleepTime ProductionUpdate::update( void ) for( Int i = 0; i < MAX_UPGRADE_CAMEO_UPGRADES; i++ ) { AsciiString upgradeName = thing->getUpgradeCameoName( i ); - const UpgradeTemplate *testUpgrade = TheUpgradeCenter->findUpgrade( upgradeName ); + const UpgradeTemplate *testUpgrade = TheUpgradeCenter->findUpgrade( upgradeName.str() ); if( testUpgrade == upgrade ) { //Our selected object has the upgrade @@ -1333,7 +1333,7 @@ void ProductionUpdate::xfer( Xfer *xfer ) else { - production->m_upgradeToResearch = TheUpgradeCenter->findUpgrade( name ); + production->m_upgradeToResearch = TheUpgradeCenter->findUpgrade( name.str() ); if( production->m_upgradeToResearch == NULL ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp index 005fa4a8afa..48830887b67 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp @@ -379,7 +379,7 @@ void StructureToppleUpdate::applyCrushingDamage(Real theta) Real facingWidth = temp3D.length() / 2; // Get the crushing weapon. - const WeaponTemplate* wt = TheWeaponStore->findWeaponTemplate(d->m_crushingWeaponName); + const WeaponTemplate* wt = TheWeaponStore->findWeaponTemplate(d->m_crushingWeaponName.str()); if (wt == NULL) { return; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp index 7d0286eb183..8e6efa7aaee 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp @@ -68,8 +68,8 @@ void CommandSetUpgrade::upgradeImplementation( ) { Object *obj = getObject(); - const char * upgradeAlt = getCommandSetUpgradeModuleData()->m_triggerAlt.str(); - const UpgradeTemplate *upgradeTemplate = TheUpgradeCenter->findUpgrade( upgradeAlt ); + const AsciiString& upgradeAlt = getCommandSetUpgradeModuleData()->m_triggerAlt; + const UpgradeTemplate *upgradeTemplate = TheUpgradeCenter->findUpgrade( upgradeAlt.str() ); if (upgradeTemplate) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index d9b9431ad87..fbe8fd3fbff 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -1622,12 +1622,12 @@ void WeaponStore::createAndFireTempWeapon(const WeaponTemplate* wt, const Object } //------------------------------------------------------------------------------------------------- -const WeaponTemplate *WeaponStore::findWeaponTemplate( AsciiString name ) const +const WeaponTemplate *WeaponStore::findWeaponTemplate( const char* name ) const { - if (stricmp(name.str(), "None") == 0) + if (stricmp(name, "None") == 0) return NULL; const WeaponTemplate * wt = findWeaponTemplatePrivate( TheNameKeyGenerator->nameToKey( name ) ); - DEBUG_ASSERTCRASH(wt != NULL, ("Weapon %s not found!",name.str())); + DEBUG_ASSERTCRASH(wt != NULL, ("Weapon %s not found!",name)); return wt; } @@ -1654,7 +1654,7 @@ WeaponTemplate *WeaponStore::newWeaponTemplate(AsciiString name) // allocate a new weapon WeaponTemplate *wt = newInstance(WeaponTemplate); wt->m_name = name; - wt->m_nameKey = TheNameKeyGenerator->nameToKey( name ); + wt->m_nameKey = TheNameKeyGenerator->nameToKey( name.str() ); m_weaponTemplateVector.push_back(wt); return wt; @@ -1772,7 +1772,7 @@ void WeaponStore::postProcessLoad() name.set(c); // find existing item if present - WeaponTemplate *weapon = TheWeaponStore->findWeaponTemplatePrivate( TheNameKeyGenerator->nameToKey( name ) ); + WeaponTemplate *weapon = TheWeaponStore->findWeaponTemplatePrivate( TheNameKeyGenerator->nameToKey( name.str() ) ); if (weapon) { if (ini->getLoadType() == INI_LOAD_CREATE_OVERRIDES) @@ -3442,7 +3442,7 @@ void Weapon::xfer( Xfer *xfer ) xfer->xferAsciiString(&tmplName); if (xfer->getXferMode() == XFER_LOAD) { - m_template = TheWeaponStore->findWeaponTemplate(tmplName); + m_template = TheWeaponStore->findWeaponTemplate(tmplName.str()); if (m_template == NULL) throw INI_INVALID_DATA; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp index 753a0d57cec..441b9d63a5d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp @@ -4699,7 +4699,7 @@ void ScriptActions::doTeamRemoveOverrideRelationToTeam(const AsciiString& teamNa //------------------------------------------------------------------------------------------------- void ScriptActions::doPlayerSetOverrideRelationToTeam(const AsciiString& playerName, const AsciiString& otherTeam, Int relation) { - Player *thePlayer = ThePlayerList->findPlayerWithNameKey(NAMEKEY(playerName)); + Player *thePlayer = ThePlayerList->findPlayerWithNameKey(NAMEKEY(playerName.str())); Team *theOtherTeam = TheScriptEngine->getTeamNamed( otherTeam ); if (thePlayer && theOtherTeam) { thePlayer->setTeamRelationship(theOtherTeam, (Relationship)relation); @@ -4711,7 +4711,7 @@ void ScriptActions::doPlayerSetOverrideRelationToTeam(const AsciiString& playerN //------------------------------------------------------------------------------------------------- void ScriptActions::doPlayerRemoveOverrideRelationToTeam(const AsciiString& playerName, const AsciiString& otherTeam) { - Player *thePlayer = ThePlayerList->findPlayerWithNameKey(NAMEKEY(playerName)); + Player *thePlayer = ThePlayerList->findPlayerWithNameKey(NAMEKEY(playerName.str())); Team *theOtherTeam = TheScriptEngine->getTeamNamed( otherTeam ); if (thePlayer && theOtherTeam) { thePlayer->removeTeamRelationship(theOtherTeam); @@ -4724,7 +4724,7 @@ void ScriptActions::doPlayerRemoveOverrideRelationToTeam(const AsciiString& play void ScriptActions::doTeamSetOverrideRelationToPlayer(const AsciiString& teamName, const AsciiString& otherPlayer, Int relation) { Team *theTeam = TheScriptEngine->getTeamNamed( teamName ); - Player *theOtherPlayer = ThePlayerList->findPlayerWithNameKey(NAMEKEY(otherPlayer)); + Player *theOtherPlayer = ThePlayerList->findPlayerWithNameKey(NAMEKEY(otherPlayer.str())); if (theTeam && theOtherPlayer) { theTeam->setOverridePlayerRelationship(theOtherPlayer->getPlayerIndex(), (Relationship)relation); } @@ -4736,7 +4736,7 @@ void ScriptActions::doTeamSetOverrideRelationToPlayer(const AsciiString& teamNam void ScriptActions::doTeamRemoveOverrideRelationToPlayer(const AsciiString& teamName, const AsciiString& otherPlayer) { Team *theTeam = TheScriptEngine->getTeamNamed( teamName ); - Player *theOtherPlayer = ThePlayerList->findPlayerWithNameKey(NAMEKEY(otherPlayer)); + Player *theOtherPlayer = ThePlayerList->findPlayerWithNameKey(NAMEKEY(otherPlayer.str())); if (theTeam && theOtherPlayer) { theTeam->removeOverridePlayerRelationship(theOtherPlayer->getPlayerIndex()); } @@ -5429,7 +5429,7 @@ void ScriptActions::doUnitReceiveUpgrade( const AsciiString& unitName, const Asc return; } - const UpgradeTemplate *templ = TheUpgradeCenter->findUpgrade(upgradeName); + const UpgradeTemplate *templ = TheUpgradeCenter->findUpgrade(upgradeName.str()); if (!templ) { return; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index ee2d05bf229..4f82188d96d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -5241,14 +5241,14 @@ void ScriptEngine::init( void ) AsciiString str; str.format("[%d]", i); m_conditionTemplates[i].m_uiName.concat(str); - m_conditionTemplates[i].m_internalNameKey = NAMEKEY(m_conditionTemplates[i].m_internalName); + m_conditionTemplates[i].m_internalNameKey = NAMEKEY(m_conditionTemplates[i].m_internalName.str()); } for (i=0; ifindPlayerWithNameKey(key); if (pPlayer!=NULL) { return pPlayer; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/VictoryConditions.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/VictoryConditions.cpp index 901ea818d55..d9271975db0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/VictoryConditions.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/VictoryConditions.cpp @@ -201,7 +201,7 @@ void VictoryConditions::update( void ) { AsciiString pName; pName.format("player%d", idx); - if (p->getPlayerNameKey() == NAMEKEY(pName)) + if (p->getPlayerNameKey() == NAMEKEY(pName.str())) { GameSlot *slot = (TheGameInfo)?TheGameInfo->getSlot(idx):NULL; if (slot && slot->isAI()) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index a6001e2206b..d2adc37bc81 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -1798,7 +1798,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) AsciiString playerName; playerName.format("player%d", i); - Player *player = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(playerName)); + Player *player = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(playerName.str())); if (slot->getPlayerTemplate() == PLAYERTEMPLATE_OBSERVER) { @@ -1988,7 +1988,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) AsciiString playerName; playerName.format("player%d", i); - Player *player = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(playerName)); + Player *player = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(playerName.str())); if (slot->getPlayerTemplate() == PLAYERTEMPLATE_OBSERVER) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp index 40eab1badfe..f6822ba6a61 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp @@ -133,7 +133,7 @@ void ShowUnderlyingGUIElements( Bool show, const char *layoutFilename, const cha { AsciiString parentNameStr; parentNameStr.format("%s:%s", layoutFilename, parentName); - NameKeyType parentID = NAMEKEY(parentNameStr); + NameKeyType parentID = NAMEKEY(parentNameStr.str()); GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); if (!parent) { @@ -152,7 +152,7 @@ void ShowUnderlyingGUIElements( Bool show, const char *layoutFilename, const cha { AsciiString gadgetName; gadgetName.format("%s:%s", layoutFilename, *text); - win = TheWindowManager->winGetWindowFromId( parent, NAMEKEY(gadgetName) ); + win = TheWindowManager->winGetWindowFromId( parent, NAMEKEY(gadgetName.str()) ); //DEBUG_ASSERTCRASH(win, ("Cannot find %s to show/hide it", gadgetName.str())); if (win) { @@ -168,7 +168,7 @@ void ShowUnderlyingGUIElements( Bool show, const char *layoutFilename, const cha { AsciiString gadgetName; gadgetName.format("%s:%s%d", layoutFilename, *text, player); - win = TheWindowManager->winGetWindowFromId( parent, NAMEKEY(gadgetName) ); + win = TheWindowManager->winGetWindowFromId( parent, NAMEKEY(gadgetName.str()) ); //DEBUG_ASSERTCRASH(win, ("Cannot find %s to show/hide it", gadgetName.str())); if (win) { 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 469b401b456..0fca095cdf4 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp @@ -512,7 +512,7 @@ static Bool doSingleBoneName(RenderObjClass* robj, const AsciiString& boneName, BONEPOS_LOG(("Caching bone %s (index %d)", boneNameTmp.str(), info.boneIndex)); BONEPOS_DUMPMATRIX3D(&(info.mtx)); - map[NAMEKEY(boneNameTmp)] = info; + map[NAMEKEY(boneNameTmp.str())] = info; foundAsBone = true; } @@ -524,7 +524,7 @@ static Bool doSingleBoneName(RenderObjClass* robj, const AsciiString& boneName, //DEBUG_LOG(("added bone %s",tmp.str())); BONEPOS_LOG(("Caching bone %s (index %d)", tmp.str(), info.boneIndex)); BONEPOS_DUMPMATRIX3D(&(info.mtx)); - map[NAMEKEY(tmp)] = info; + map[NAMEKEY(tmp.str())] = info; foundAsBone = true; } else @@ -540,7 +540,7 @@ static Bool doSingleBoneName(RenderObjClass* robj, const AsciiString& boneName, //DEBUG_LOG(("added subobj %s",boneNameTmp.str())); BONEPOS_LOG(("Caching bone from subobject %s (index %d)", boneNameTmp.str(), info.boneIndex)); BONEPOS_DUMPMATRIX3D(&(info.mtx)); - map[NAMEKEY(boneNameTmp)] = info; + map[NAMEKEY(boneNameTmp.str())] = info; foundAsSubObj = true; } @@ -552,7 +552,7 @@ static Bool doSingleBoneName(RenderObjClass* robj, const AsciiString& boneName, //DEBUG_LOG(("added subobj %s",tmp.str())); BONEPOS_LOG(("Caching bone from subobject %s (index %d)", tmp.str(), info.boneIndex)); BONEPOS_DUMPMATRIX3D(&(info.mtx)); - map[NAMEKEY(tmp)] = info; + map[NAMEKEY(tmp.str())] = info; foundAsSubObj = true; } else @@ -813,24 +813,24 @@ void ModelConditionInfo::validateWeaponBarrelInfo() const // try the unadorned names WeaponBarrelInfo info; if (!recoilBoneName.isEmpty()) - findPristineBone(NAMEKEY(recoilBoneName), &info.m_recoilBone); + findPristineBone(NAMEKEY(recoilBoneName.str()), &info.m_recoilBone); if (!mfName.isEmpty()) - findPristineBone(NAMEKEY(mfName), &info.m_muzzleFlashBone); + findPristineBone(NAMEKEY(mfName.str()), &info.m_muzzleFlashBone); #if defined(RTS_DEBUG) || defined(DEBUG_CRASHING) if (info.m_muzzleFlashBone) info.m_muzzleFlashBoneName = mfName; #endif - const Matrix3D* plbMtx = plbName.isEmpty() ? NULL : findPristineBone(NAMEKEY(plbName), NULL); + const Matrix3D* plbMtx = plbName.isEmpty() ? NULL : findPristineBone(NAMEKEY(plbName.str()), NULL); if (plbMtx != NULL) info.m_projectileOffsetMtx = *plbMtx; else info.m_projectileOffsetMtx.Make_Identity(); if (!fxBoneName.isEmpty()) - findPristineBone(NAMEKEY(fxBoneName), &info.m_fxBone); + findPristineBone(NAMEKEY(fxBoneName.str()), &info.m_fxBone); if (info.m_fxBone != 0 || info.m_recoilBone != 0 || info.m_muzzleFlashBone != 0 || plbMtx != NULL) { @@ -1490,10 +1490,12 @@ void W3DModelDrawModuleData::parseConditionState(INI* ini, void *instance, void case PARSE_TRANSITION: { - AsciiString firstNm = ini->getNextToken(); firstNm.toLower(); - AsciiString secondNm = ini->getNextToken(); secondNm.toLower(); - NameKeyType firstKey = NAMEKEY(firstNm); - NameKeyType secondKey = NAMEKEY(secondNm); + AsciiString firstNm = ini->getNextToken(); + AsciiString secondNm = ini->getNextToken(); + firstNm.toLower(); + secondNm.toLower(); + NameKeyType firstKey = NAMEKEY(firstNm.str()); + NameKeyType secondKey = NAMEKEY(secondNm.str()); if (firstKey == secondKey) { diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp index b9c75e78378..565f67aa203 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp @@ -139,7 +139,7 @@ void W3DMouse::initPolygonAssets(void) { m_currentPolygonCursor = m_currentCursor; if (!m_cursorInfo[i].imageName.isEmpty()) - cursorImages[i]=TheMappedImageCollection->findImageByName(m_cursorInfo[i].imageName); + cursorImages[i]=TheMappedImageCollection->findImageByName(m_cursorInfo[i].imageName.str()); } } } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp index 5695ad07819..524f483be84 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp @@ -177,7 +177,7 @@ static LRESULT CALLBACK radioButtonPropertiesCallback( HWND hWndDialog, // save group Int group = GetDlgItemInt( hWndDialog, COMBO_GROUP, NULL, FALSE ); - Int screen = TheNameKeyGenerator->nameToKey( AsciiString(TheEditor->getSaveFilename()) ); + Int screen = TheNameKeyGenerator->nameToKey( TheEditor->getSaveFilename() ); GadgetRadioSetGroup( window, group, screen ); } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/LayoutScheme.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/LayoutScheme.cpp index 5e828d1837e..bb83dbe0d30 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/LayoutScheme.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/LayoutScheme.cpp @@ -2433,7 +2433,7 @@ Bool LayoutScheme::loadScheme( char *filename ) // store the info storeImageAndColor( (StateIdentifier)state, - TheMappedImageCollection->findImageByName( AsciiString( imageBuffer ) ), + TheMappedImageCollection->findImageByName( imageBuffer ), GameMakeColor( colorR, colorG, colorB, colorA ), GameMakeColor( bColorR, bColorG, bColorB, bColorA ) ); } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp index f5c1815382f..1b6c26daf0a 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp @@ -1258,7 +1258,7 @@ const Image *ComboBoxSelectionToImage( HWND comboBox ) SendMessage( comboBox, CB_GETLBTEXT, selected, (LPARAM)buffer ); // return the image loc that matches the string - return TheMappedImageCollection->findImageByName( AsciiString( buffer ) ); + return TheMappedImageCollection->findImageByName( buffer ); } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp index 02f7e27f3d8..7849582e6bd 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp @@ -1235,7 +1235,7 @@ Bool GUIEdit::saveData( char *filePathAndFilename, char *filename ) // update all radio button screen identifiers with the filename updateRadioScreenIdentifiers( TheWindowManager->winGetWindowList(), - TheNameKeyGenerator->nameToKey( AsciiString(m_saveFilename) ) ); + TheNameKeyGenerator->nameToKey( m_saveFilename ) ); // open the file fp = fopen( filePathAndFilename, "w" ); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/BuildList.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/BuildList.cpp index 99ff8ccd63a..cbda198b360 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/BuildList.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/BuildList.cpp @@ -755,7 +755,7 @@ void BuildList::OnExport() throw; AsciiString tmplname = d->getAsciiString(TheKey_playerFaction); - const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname)); + const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname.str())); DEBUG_ASSERTCRASH(pt != NULL, ("PlayerTemplate %s not found -- this is an obsolete map (please open and resave in WB)",tmplname.str())); fprintf(theLogFile, ";Skirmish AI Build List\n"); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp index 406793275f5..621ea8fe85a 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp @@ -822,7 +822,7 @@ void DictItemUndoable::Undo(void) /*static*/ Dict DictItemUndoable::buildSingleItemDict(AsciiString k, Dict::DataType t, AsciiString v) { Dict d; - NameKeyType key = TheNameKeyGenerator->nameToKey(k); + NameKeyType key = TheNameKeyGenerator->nameToKey(k.str()); switch(t) { case Dict::DICT_BOOL: diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp index cbb6f666df5..7481b0a6ae7 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp @@ -92,7 +92,7 @@ static Int findSideListEntryWithPlayerOfSide(AsciiString side) for (int i = 0; i < TheSidesList->getNumSides(); i++) { AsciiString ptname = TheSidesList->getSideInfo(i)->getDict()->getAsciiString(TheKey_playerFaction); - const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(ptname)); + const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(ptname.str())); if (pt && pt->getSide() == side) { return i; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/TeamGeneric.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/TeamGeneric.cpp index d577f9c7a9e..900071f1c5e 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/TeamGeneric.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/TeamGeneric.cpp @@ -108,7 +108,7 @@ void TeamGeneric::_dictToScripts() AsciiString scriptString; AsciiString keyName; keyName.format("%s%d", TheNameKeyGenerator->keyToName(TheKey_teamGenericScriptHook).str(), i); - scriptString = m_teamDict->getAsciiString(NAMEKEY(keyName), &exists); + scriptString = m_teamDict->getAsciiString(NAMEKEY(keyName.str()), &exists); pText->ShowWindow(SW_SHOW); pCombo->ShowWindow(SW_SHOW); @@ -189,9 +189,9 @@ void TeamGeneric::_scriptsToDict() int curSel = pCombo->GetCurSel(); if (curSel == CB_ERR || curSel == 0) { - if (m_teamDict->known(NAMEKEY(keyName), Dict::DICT_ASCIISTRING)) { + if (m_teamDict->known(NAMEKEY(keyName.str()), Dict::DICT_ASCIISTRING)) { // remove it if we know it. - m_teamDict->remove(NAMEKEY(keyName)); + m_teamDict->remove(NAMEKEY(keyName.str())); } continue; @@ -201,7 +201,7 @@ void TeamGeneric::_scriptsToDict() pCombo->GetLBText(curSel, cstr); AsciiString scriptString = static_cast(cstr); - m_teamDict->setAsciiString(NAMEKEY(keyName), scriptString); + m_teamDict->setAsciiString(NAMEKEY(keyName.str()), scriptString); ++scriptNum; } @@ -209,8 +209,8 @@ void TeamGeneric::_scriptsToDict() AsciiString keyName; keyName.format("%s%d", TheNameKeyGenerator->keyToName(TheKey_teamGenericScriptHook).str(), scriptNum); - if (m_teamDict->known(NAMEKEY(keyName), Dict::DICT_ASCIISTRING)) { - m_teamDict->remove(NAMEKEY(keyName)); + if (m_teamDict->known(NAMEKEY(keyName.str()), Dict::DICT_ASCIISTRING)) { + m_teamDict->remove(NAMEKEY(keyName.str())); } } } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp index a2c5d7836c0..38e645859de 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp @@ -476,7 +476,7 @@ AsciiString ConvertFaction(AsciiString name) strlcat(newName, name.str() + offset, ARRAY_SIZE(newName)); AsciiString swapName; swapName.set(newName); - const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(swapName)); + const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(swapName.str())); if (pt) { return swapName; } @@ -502,7 +502,7 @@ void CWorldBuilderDoc::validate(void) if (tmplname.isEmpty()) { continue; // Neutral player has empty template. jba. [8/8/2003] } - const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname)); + const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname.str())); if (!pt) { DEBUG_LOG(("Player '%s' Faction '%s' could not be found in sides list!", playername.str(), tmplname.str())); if (tmplname.startsWith("FactionFundamentalist")) { @@ -576,13 +576,13 @@ void CWorldBuilderDoc::validate(void) if (pMapObj->getThingTemplate() == NULL) { Bool exists = false; - swapName = swapDict.getAsciiString(NAMEKEY(name), &exists); + swapName = swapDict.getAsciiString(NAMEKEY(name.str()), &exists); // quick hack to make loading models with "Fundamentalist" switch to "GLA" if (name.startsWith("Fundamentalist")) { swapName = ConvertName(name); if (swapName != AsciiString::TheEmptyString) { - swapDict.setAsciiString(NAMEKEY(name), swapName); + swapDict.setAsciiString(NAMEKEY(name.str()), swapName); exists = true; } } @@ -591,7 +591,7 @@ void CWorldBuilderDoc::validate(void) if (name.startsWith("GC_")) { swapName = ConvertToNonGCName(name); if (swapName != AsciiString::TheEmptyString) { - swapDict.setAsciiString(NAMEKEY(name), swapName); + swapDict.setAsciiString(NAMEKEY(name.str()), swapName); exists = true; } } @@ -607,11 +607,11 @@ void CWorldBuilderDoc::validate(void) const ThingTemplate* thing = dlg.getPickedThing(); if (thing) { swapName = thing->getName(); - swapDict.setAsciiString(NAMEKEY(name), swapName); + swapDict.setAsciiString(NAMEKEY(name.str()), swapName); } } } - swapName = swapDict.getAsciiString(NAMEKEY(name), &exists); + swapName = swapDict.getAsciiString(NAMEKEY(name.str()), &exists); if (exists) { const ThingTemplate *tt = TheThingFactory->findTemplate(swapName); @@ -640,7 +640,7 @@ void CWorldBuilderDoc::validate(void) if (tmplname.isEmpty()) { continue; // Neutral player has empty template. jba. [8/8/2003] } - const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname)); + const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname.str())); if (!pt) { DEBUG_LOG(("Player '%s' Faction '%s' could not be found in sides list!", playername.str(), tmplname.str())); if (tmplname.startsWith("FactionFundamentalist")) { diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/addplayerdialog.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/addplayerdialog.cpp index bf608910a08..21e6149dc0f 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/addplayerdialog.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/addplayerdialog.cpp @@ -76,9 +76,8 @@ void AddPlayerDialog::OnOK() } else { faction->GetWindowText(theText); } - AsciiString name((LPCTSTR)theText); - const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(name)); + const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY((LPCTSTR)theText)); if (pt) { m_addedSide = pt ? pt->getName() : AsciiString::TheEmptyString; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp index 9917fa1ec4d..fbdb39ab8c1 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp @@ -714,10 +714,10 @@ void MapObjectProps::_PrebuiltUpgradesToDict(void) do { AsciiString keyName; keyName.format("%s%d", TheNameKeyGenerator->keyToName(TheKey_objectGrantUpgrade).str(), upgradeNum); - upgradeString = newDict.getAsciiString(NAMEKEY(keyName), &exists); + upgradeString = newDict.getAsciiString(NAMEKEY(keyName.str()), &exists); if (exists) { - newDict.remove(NAMEKEY(keyName)); + newDict.remove(NAMEKEY(keyName.str())); } ++upgradeNum; @@ -734,7 +734,7 @@ void MapObjectProps::_PrebuiltUpgradesToDict(void) AsciiString keyName; keyName.format("%s%d", TheNameKeyGenerator->keyToName(TheKey_objectGrantUpgrade).str(), upgradeNum); - newDict.setAsciiString(NAMEKEY(keyName), AsciiString(selTxt.GetBuffer(0))); + newDict.setAsciiString(NAMEKEY(keyName.str()), AsciiString(selTxt.GetBuffer(0))); ++upgradeNum; } } @@ -831,7 +831,7 @@ void MapObjectProps::_DictToPrebuiltUpgrades(void) do { AsciiString keyName; keyName.format("%s%d", TheNameKeyGenerator->keyToName(TheKey_objectGrantUpgrade).str(), upgradeNum); - upgradeString = m_dictToEdit->getAsciiString(NAMEKEY(keyName), &exists); + upgradeString = m_dictToEdit->getAsciiString(NAMEKEY(keyName.str()), &exists); if (exists) { Int selNdx = pBox->FindStringExact(-1, upgradeString.str()); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/playerlistdlg.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/playerlistdlg.cpp index a7e33d0ab9d..ba4977bae74 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/playerlistdlg.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/playerlistdlg.cpp @@ -506,7 +506,7 @@ void PlayerListDlg::updateTheUI(void) rgb.setFromInt(color); } else { AsciiString tmplname = pdict->getAsciiString(TheKey_playerFaction); - const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname)); + const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname.str())); if (pt) { rgb = *pt->getPreferredColor(); } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp index c33edb6fee3..16345ce57e5 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -1425,7 +1425,7 @@ void WbView3d::invalObjectInView(MapObject *pMapObjIn) playerColor = color; } else { AsciiString tmplname = pSide->getDict()->getAsciiString(TheKey_playerFaction); - const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname)); + const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname.str())); if (pt) { playerColor = pt->getPreferredColor()->getAsInt(); }