File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 1515#include < optional>
1616#include < variant>
1717
18+ #ifdef _WIN32
19+ # define strcasecmp _stricmp
20+ #endif
21+
1822Variable sar_speedrun_draw_triggers (" sar_speedrun_draw_triggers" , " 0" , " Draw the triggers associated with speedrun rules in the world.\n " );
1923
2024static std::optional<std::vector<std::string>> extractPartialArgs (const char *str, const char *cmd) {
@@ -256,8 +260,9 @@ ON_EVENT(RENDER) {
256260 for (std::string ruleName : g_categories[g_currentCategory].rules ) {
257261 auto rule = SpeedrunTimer::GetRule (ruleName);
258262 if (!rule) continue ;
259- if (std::find (rule->maps .begin (), rule->maps .end (), " *" ) == rule->maps .end () &&
260- std::find (rule->maps .begin (), rule->maps .end (), engine->GetCurrentMapName ()) == rule->maps .end ()) continue ;
263+ if (std::find_if (rule->maps .begin (), rule->maps .end (), [](std::string map) {
264+ return map == " *" || !strcasecmp (map.c_str (), engine->GetCurrentMapName ().c_str ());
265+ }) == rule->maps .end ()) continue ;
261266 if (std::holds_alternative<ZoneTriggerRule>(rule->rule )) {
262267 std::get<ZoneTriggerRule>(rule->rule ).DrawInWorld ();
263268 std::get<ZoneTriggerRule>(rule->rule ).OverlayInfo (rule);
Original file line number Diff line number Diff line change 1313
1414#define TAU 6.28318530718
1515
16+ #ifdef _WIN32
17+ # define strcasecmp _stricmp
18+ #endif
19+
1620template <typename V>
1721static inline V *lookupMap (std::map<std::string, V> &m, std::string k) {
1822 auto search = m.find (k);
@@ -343,8 +347,9 @@ bool SpeedrunRule::TestGeneral(std::optional<int> slot) {
343347 auto prereq = SpeedrunTimer::GetRule (*this ->onlyAfter );
344348 if (!prereq || !prereq->fired ) return false ;
345349 }
346- if (std::find (this ->maps .begin (), this ->maps .end (), " *" ) == this ->maps .end () &&
347- std::find (this ->maps .begin (), this ->maps .end (), engine->GetCurrentMapName ()) == this ->maps .end ()) return false ;
350+ if (std::find_if (this ->maps .begin (), this ->maps .end (), [](std::string map) {
351+ return map == " *" || !strcasecmp (map.c_str (), engine->GetCurrentMapName ().c_str ());
352+ }) == this ->maps .end ()) return false ;
348353 if (this ->slot ) {
349354 if (this ->slot != slot) return false ;
350355 }
You can’t perform that action at this time.
0 commit comments