Skip to content

Commit 35a1f42

Browse files
committed
fix: case-insensitive maps in more places
1 parent 5fb6cb5 commit 35a1f42

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/Features/AutoSubmit.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,10 @@ void retrieveMtriggers(int rank, std::string map_name) {
476476
if (map_name.empty())
477477
return THREAD_PRINT("Not playing a map.\n");
478478

479+
std::string map_lower = map_name;
480+
std::transform(map_lower.begin(), map_lower.end(), map_lower.begin(), tolower);
479481
for (const auto &map : Game::maps) {
480-
if (map.fileName == map_name) {
482+
if (map.fileName == map_lower) {
481483
keyFound = true;
482484
break;
483485
}

src/Modules/Engine.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ bool Engine::IsGamePaused() {
191191
}
192192

193193
int Engine::GetMapIndex(const std::string map) {
194-
auto it = std::find(Game::mapNames.begin(), Game::mapNames.end(), map);
194+
std::string map_lower = map;
195+
std::transform(map_lower.begin(), map_lower.end(), map_lower.begin(), tolower);
196+
auto it = std::find(Game::mapNames.begin(), Game::mapNames.end(), map_lower);
195197
if (it != Game::mapNames.end()) {
196198
return std::distance(Game::mapNames.begin(), it);
197199
} else {
@@ -215,8 +217,10 @@ std::string Engine::GetCurrentMapName() {
215217
}
216218

217219
std::string Engine::GetMapTitle(std::string map) {
218-
auto it = std::find_if(Game::maps.begin(), Game::maps.end(), [&map](const MapData &data) {
219-
return data.fileName == map;
220+
std::string map_lower = map;
221+
std::transform(map_lower.begin(), map_lower.end(), map_lower.begin(), tolower);
222+
auto it = std::find_if(Game::maps.begin(), Game::maps.end(), [&map_lower](const MapData &data) {
223+
return data.fileName == map_lower;
220224
});
221225
if (it != Game::maps.end()) {
222226
return it->displayName;

0 commit comments

Comments
 (0)