diff --git a/src/Features/Speedrun/Categories.cpp b/src/Features/Speedrun/Categories.cpp index 9aa5f2f0..b276154e 100644 --- a/src/Features/Speedrun/Categories.cpp +++ b/src/Features/Speedrun/Categories.cpp @@ -15,6 +15,10 @@ #include #include +#ifdef _WIN32 +# define strcasecmp _stricmp +#endif + Variable sar_speedrun_draw_triggers("sar_speedrun_draw_triggers", "0", "Draw the triggers associated with speedrun rules in the world.\n"); static std::optional> extractPartialArgs(const char *str, const char *cmd) { @@ -256,8 +260,9 @@ ON_EVENT(RENDER) { for (std::string ruleName : g_categories[g_currentCategory].rules) { auto rule = SpeedrunTimer::GetRule(ruleName); if (!rule) continue; - if (std::find(rule->maps.begin(), rule->maps.end(), "*") == rule->maps.end() && - std::find(rule->maps.begin(), rule->maps.end(), engine->GetCurrentMapName()) == rule->maps.end()) continue; + if (std::find_if(rule->maps.begin(), rule->maps.end(), [](std::string map) { + return map == "*" || !strcasecmp(map.c_str(), engine->GetCurrentMapName().c_str()); + }) == rule->maps.end()) continue; if (std::holds_alternative(rule->rule)) { std::get(rule->rule).DrawInWorld(); std::get(rule->rule).OverlayInfo(rule); diff --git a/src/Features/Speedrun/Rules.cpp b/src/Features/Speedrun/Rules.cpp index 3b234547..2fa8e035 100644 --- a/src/Features/Speedrun/Rules.cpp +++ b/src/Features/Speedrun/Rules.cpp @@ -13,6 +13,10 @@ #define TAU 6.28318530718 +#ifdef _WIN32 +# define strcasecmp _stricmp +#endif + template static inline V *lookupMap(std::map &m, std::string k) { auto search = m.find(k); @@ -343,8 +347,9 @@ bool SpeedrunRule::TestGeneral(std::optional slot) { auto prereq = SpeedrunTimer::GetRule(*this->onlyAfter); if (!prereq || !prereq->fired) return false; } - if (std::find(this->maps.begin(), this->maps.end(), "*") == this->maps.end() && - std::find(this->maps.begin(), this->maps.end(), engine->GetCurrentMapName()) == this->maps.end()) return false; + if (std::find_if(this->maps.begin(), this->maps.end(), [](std::string map) { + return map == "*" || !strcasecmp(map.c_str(), engine->GetCurrentMapName().c_str()); + }) == this->maps.end()) return false; if (this->slot) { if (this->slot != slot) return false; }