Skip to content

Commit 0410990

Browse files
authored
refactor: Remove all explicit UnicodeString instantiations from C strings (#1928)
1 parent 2a1f963 commit 0410990

File tree

60 files changed

+159
-159
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+159
-159
lines changed

Core/GameEngine/Source/Common/CRCDebug.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ CRCVerification::~CRCVerification()
8080
{
8181
if (TheInGameUI)
8282
{
83-
TheInGameUI->message(UnicodeString(L"GameLogic changed outside of GameLogic::update() - call Matt (x36804)!"));
83+
TheInGameUI->message(L"GameLogic changed outside of GameLogic::update() - call Matt (x36804)!");
8484
}
8585
CRCDEBUG_LOG(("GameLogic changed outside of GameLogic::update()!!!"));
8686
}

Core/GameEngine/Source/Common/System/UnicodeString.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ Bool UnicodeString::nextToken(UnicodeString* tok, UnicodeString delimiters)
437437
return false;
438438

439439
if (delimiters.isEmpty())
440-
delimiters = UnicodeString(L" \t\n\r");
440+
delimiters = L" \t\n\r";
441441

442442
Int offset;
443443

Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ void ConnectionManager::processChat(NetChatCommandMsg *msg)
651651
const Player *player = ThePlayerList->findPlayerWithNameKey( TheNameKeyGenerator->nameToKey( playerName ) );
652652
if (!player)
653653
{
654-
TheInGameUI->message(UnicodeString(L"%ls"), unitext.str());
654+
TheInGameUI->message(L"%ls", unitext.str());
655655
return;
656656
}
657657

@@ -663,7 +663,7 @@ void ConnectionManager::processChat(NetChatCommandMsg *msg)
663663
{
664664
RGBColor rgb;
665665
rgb.setFromInt(player->getPlayerColor());
666-
TheInGameUI->messageColor(&rgb, UnicodeString(L"%ls"), unitext.str());
666+
TheInGameUI->messageColor(&rgb, L"%ls", unitext.str());
667667

668668
// feedback for received chat messages in-game
669669
AudioEventRTS audioEvent("GUICommunicatorIncoming");
@@ -2120,7 +2120,7 @@ UnsignedShort ConnectionManager::sendFileAnnounce(AsciiString path, UnsignedByte
21202120
log.format(L"Not sending file '%hs' to %X", path.str(), playerMask);
21212121
DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("%ls", log.str()));
21222122
if (TheLAN)
2123-
TheLAN->OnChat(UnicodeString(L"sendFile"), 0, log, LANAPI::LANCHAT_SYSTEM);
2123+
TheLAN->OnChat(L"sendFile", 0, log, LANAPI::LANCHAT_SYSTEM);
21242124
return 0;
21252125
}
21262126

@@ -2158,7 +2158,7 @@ void ConnectionManager::sendFile(AsciiString path, UnsignedByte playerMask, Unsi
21582158
log.format(L"Not sending file '%hs' to %X", path.str(), playerMask);
21592159
DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("%ls", log.str()));
21602160
if (TheLAN)
2161-
TheLAN->OnChat(UnicodeString(L"sendFile"), 0, log, LANAPI::LANCHAT_SYSTEM);
2161+
TheLAN->OnChat(L"sendFile", 0, log, LANAPI::LANCHAT_SYSTEM);
21622162
return;
21632163
}
21642164

Core/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -613,8 +613,8 @@ static Int insertGame( GameWindow *win, GameSpyStagingRoom *game, Bool showMap )
613613
}
614614
else
615615
{
616-
GadgetListBoxAddEntryText(win, UnicodeString(L" "), gameColor, index, COLUMN_MAP);
617-
GadgetListBoxAddEntryText(win, UnicodeString(L" "), gameColor, index, COLUMN_LADDER);
616+
GadgetListBoxAddEntryText(win, L" ", gameColor, index, COLUMN_MAP);
617+
GadgetListBoxAddEntryText(win, L" ", gameColor, index, COLUMN_LADDER);
618618
}
619619

620620
s.format(L"%d/%d", game->getReportedNumPlayers(), game->getReportedMaxPlayers());
@@ -633,7 +633,7 @@ static Int insertGame( GameWindow *win, GameSpyStagingRoom *game, Bool showMap )
633633
}
634634
else
635635
{
636-
GadgetListBoxAddEntryText(win, UnicodeString(L" "), gameColor, index, COLUMN_PASSWORD);
636+
GadgetListBoxAddEntryText(win, L" ", gameColor, index, COLUMN_PASSWORD);
637637
}
638638

639639
if (game->getAllowObservers())
@@ -643,7 +643,7 @@ static Int insertGame( GameWindow *win, GameSpyStagingRoom *game, Bool showMap )
643643
}
644644
else
645645
{
646-
GadgetListBoxAddEntryText(win, UnicodeString(L" "), gameColor, index, COLUMN_OBSERVER);
646+
GadgetListBoxAddEntryText(win, L" ", gameColor, index, COLUMN_OBSERVER);
647647
}
648648

649649
#if !RTS_GENERALS

Core/GameEngine/Source/GameNetwork/LANAPI.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ void LANAPI::checkMOTD( void )
308308

309309
UnicodeString uniLine;
310310
uniLine.translate(line);
311-
OnChat( UnicodeString(L"MOTD"), 0, uniLine, LANCHAT_SYSTEM );
311+
OnChat( L"MOTD", 0, uniLine, LANCHAT_SYSTEM );
312312
}
313313
}
314314
}
@@ -773,7 +773,7 @@ void LANAPI::RequestHasMap( void )
773773
text.format(TheGameText->fetch("GUI:LocalPlayerNoMapWillTransfer"), mapDisplayName.str());
774774
else
775775
text.format(TheGameText->fetch("GUI:LocalPlayerNoMap"), mapDisplayName.str());
776-
OnChat(UnicodeString(L"SYSTEM"), m_localIP, text, LANCHAT_SYSTEM);
776+
OnChat(L"SYSTEM", m_localIP, text, LANCHAT_SYSTEM);
777777
}
778778
}
779779

@@ -921,7 +921,7 @@ void LANAPI::RequestGameCreate( UnicodeString gameName, Bool isDirectConnect )
921921
/// @todo: Need to initialize the players elsewere.
922922
/* for (int player = 1; player < MAX_SLOTS; ++player)
923923
{
924-
myGame->setPlayerName(player, UnicodeString(L""));
924+
myGame->setPlayerName(player, L"");
925925
myGame->setIP(player, 0);
926926
myGame->setAccepted(player, false);
927927
}*/

Core/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void LANAPI::OnAccept( UnsignedInt playerIP, Bool status )
124124
{
125125
UnicodeString text;
126126
text = TheGameText->fetch("GUI:HostWantsToStart");
127-
OnChat(UnicodeString(L"SYSTEM"), m_localIP, text, LANCHAT_SYSTEM);
127+
OnChat(L"SYSTEM", m_localIP, text, LANCHAT_SYSTEM);
128128
}
129129
}
130130
}
@@ -165,7 +165,7 @@ void LANAPI::OnHasMap( UnsignedInt playerIP, Bool status )
165165
text.format(TheGameText->fetch("GUI:PlayerNoMapWillTransfer"), m_currentGame->getLANSlot(i)->getName().str(), mapDisplayName.str());
166166
else
167167
text.format(TheGameText->fetch("GUI:PlayerNoMap"), m_currentGame->getLANSlot(i)->getName().str(), mapDisplayName.str());
168-
OnChat(UnicodeString(L"SYSTEM"), m_localIP, text, LANCHAT_SYSTEM);
168+
OnChat(L"SYSTEM", m_localIP, text, LANCHAT_SYSTEM);
169169
}
170170
lanUpdateSlotList();
171171
}
@@ -179,7 +179,7 @@ void LANAPI::OnGameStartTimer( Int seconds )
179179
text.format(TheGameText->fetch("LAN:GameStartTimerSingular"), seconds);
180180
else
181181
text.format(TheGameText->fetch("LAN:GameStartTimerPlural"), seconds);
182-
OnChat(UnicodeString(L"SYSTEM"), m_localIP, text, LANCHAT_SYSTEM);
182+
OnChat(L"SYSTEM", m_localIP, text, LANCHAT_SYSTEM);
183183
}
184184

185185
void LANAPI::OnGameStart( void )

Generals/Code/GameEngine/Source/Common/version.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ UnicodeString Version::getUnicodeBuildUserOrGitCommitAuthorName() const
309309
UnicodeString Version::getUnicodeProductTitle() const
310310
{
311311
// @todo Make configurable
312-
return UnicodeString(L"Community Patch");
312+
return L"Community Patch";
313313
}
314314

315315
UnicodeString Version::getUnicodeProductVersion() const

Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ void ControlBar::populatePurchaseScience( Player* player )
455455
u.translate(foo);
456456
GadgetListBoxAddEntryText(win, u, color, -1, -1);
457457
}
458-
GadgetListBoxAddEntryText(win, UnicodeString(L"Cancel"), color, -1, -1);*/
458+
GadgetListBoxAddEntryText(win, L"Cancel", color, -1, -1);*/
459459

460460
}
461461

@@ -2469,7 +2469,7 @@ void ControlBar::setControlCommand( GameWindow *button, const CommandButton *com
24692469
button->winSetTooltipFunc(commandButtonTooltip);
24702470
}
24712471
else
2472-
GadgetButtonSetText( button, UnicodeString( L"" ) );
2472+
GadgetButtonSetText( button, L"" );
24732473

24742474
// save the command in the user data of the window
24752475
GadgetButtonSetData(button, (void*)commandButton);

Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ void ControlBar::populateBuildQueue( Object *producer )
519519
m_queueData[ i ].control->winClearStatus( WIN_STATUS_USE_OVERLAY_STATES );
520520

521521
// set the text of the window to nothing by default
522-
GadgetButtonSetText( m_queueData[ i ].control, UnicodeString( L"" ) );
522+
GadgetButtonSetText( m_queueData[ i ].control, L"" );
523523

524524
//Clear any potential veterancy rank, or else we'll see it when it's empty!
525525
GadgetButtonDrawOverlayImage( m_queueData[ i ].control, NULL );

Generals/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void DisconnectMenu::setPlayerName(Int playerNum, UnicodeString name) {
133133

134134
if (control != NULL) {
135135
if (name.getLength() > 0) {
136-
GadgetStaticTextSetText(control, UnicodeString(L""));
136+
GadgetStaticTextSetText(control, L"");
137137
}
138138
}
139139

@@ -241,7 +241,7 @@ void DisconnectMenu::showPacketRouterTimeout() {
241241
control = TheWindowManager->winGetWindowFromId(NULL, id);
242242

243243
if (control != NULL) {
244-
GadgetStaticTextSetText(control, UnicodeString(L"")); // start it off with a blank string.
244+
GadgetStaticTextSetText(control, L""); // start it off with a blank string.
245245
control->winHide(FALSE);
246246
}
247247
}

0 commit comments

Comments
 (0)