Skip to content

Commit 9f11344

Browse files
committed
refactor: Use a unicode string instead of an ascii string for the map key
1 parent 928d540 commit 9f11344

File tree

2 files changed

+12
-10
lines changed
  • GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus
  • Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus

2 files changed

+12
-10
lines changed

Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct ReplayInfoCacheEntry
5656
UnicodeString extraStr;
5757
};
5858

59-
static std::map<AsciiString, ReplayInfoCacheEntry> replayInfoCache;
59+
static std::map<UnicodeString, ReplayInfoCacheEntry> replayInfoCache;
6060

6161
// window ids -------------------------------------------------------------------------------------
6262
static NameKeyType parentReplayMenuID = NAMEKEY_INVALID;
@@ -192,10 +192,8 @@ static void replayTooltip(GameWindow* window, WinInstanceData* instData, Unsigne
192192
}
193193

194194
UnicodeString replayFileName = GetReplayFilenameFromListbox(window, row);
195-
AsciiString replayFileNameAscii;
196-
replayFileNameAscii.translate(replayFileName);
197195

198-
std::map<AsciiString, ReplayInfoCacheEntry>::const_iterator it = replayInfoCache.find(replayFileNameAscii);
196+
std::map<UnicodeString, ReplayInfoCacheEntry>::const_iterator it = replayInfoCache.find(replayFileName);
199197
if (it != replayInfoCache.end())
200198
TheMouse->setCursorTooltip(it->second.extraStr, -1, NULL, 1.5f);
201199
else
@@ -300,7 +298,10 @@ void PopulateReplayFileListbox(GameWindow *listbox)
300298
entry.header = header;
301299
entry.info = info;
302300
entry.extraStr = extraStr;
303-
replayInfoCache[asciistr] = entry;
301+
302+
UnicodeString key;
303+
key.translate(asciistr);
304+
replayInfoCache[key] = entry;
304305

305306
// pick a color
306307
Color color;

GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct ReplayInfoCacheEntry
5656
UnicodeString extraStr;
5757
};
5858

59-
static std::map<AsciiString, ReplayInfoCacheEntry> replayInfoCache;
59+
static std::map<UnicodeString, ReplayInfoCacheEntry> replayInfoCache;
6060

6161
// window ids -------------------------------------------------------------------------------------
6262
static NameKeyType parentReplayMenuID = NAMEKEY_INVALID;
@@ -192,10 +192,8 @@ static void replayTooltip(GameWindow* window, WinInstanceData* instData, Unsigne
192192
}
193193

194194
UnicodeString replayFileName = GetReplayFilenameFromListbox(window, row);
195-
AsciiString replayFileNameAscii;
196-
replayFileNameAscii.translate(replayFileName);
197195

198-
std::map<AsciiString, ReplayInfoCacheEntry>::const_iterator it = replayInfoCache.find(replayFileNameAscii);
196+
std::map<UnicodeString, ReplayInfoCacheEntry>::const_iterator it = replayInfoCache.find(replayFileName);
199197
if (it != replayInfoCache.end())
200198
TheMouse->setCursorTooltip(it->second.extraStr, -1, NULL, 1.5f);
201199
else
@@ -300,7 +298,10 @@ void PopulateReplayFileListbox(GameWindow *listbox)
300298
entry.header = header;
301299
entry.info = info;
302300
entry.extraStr = extraStr;
303-
replayInfoCache[asciistr] = entry;
301+
302+
UnicodeString key;
303+
key.translate(asciistr);
304+
replayInfoCache[key] = entry;
304305

305306
// pick a color
306307
Color color;

0 commit comments

Comments
 (0)