diff --git a/src/ObjLoading/Parsing/Menu/MenuFileParserState.h b/src/ObjLoading/Parsing/Menu/MenuFileParserState.h index 7eedb75c..71946524 100644 --- a/src/ObjLoading/Parsing/Menu/MenuFileParserState.h +++ b/src/ObjLoading/Parsing/Menu/MenuFileParserState.h @@ -36,7 +36,9 @@ namespace menu std::vector> m_functions; std::vector> m_menus; + // Function names are case-insensitive, therefore keys are always lowercase std::map m_functions_by_name; + std::map m_menus_by_name; bool m_in_global_scope; diff --git a/src/ObjLoading/Parsing/Menu/Sequence/FunctionScopeSequences.cpp b/src/ObjLoading/Parsing/Menu/Sequence/FunctionScopeSequences.cpp index 5459a3dd..45655f96 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/FunctionScopeSequences.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/FunctionScopeSequences.cpp @@ -34,10 +34,13 @@ namespace menu::function_scope_sequences throw ParsingException(result.NextCapture(CAPTURE_TOKEN).GetPos(), ss.str()); } - const auto existingFunction = state->m_functions_by_name.find(state->m_current_function->m_name); + auto lowerCaseName = state->m_current_function->m_name; + utils::MakeStringLowerCase(lowerCaseName); + + const auto existingFunction = state->m_functions_by_name.find(lowerCaseName); if (existingFunction == state->m_functions_by_name.end()) { - state->m_functions_by_name.emplace(std::make_pair(state->m_current_function->m_name, state->m_current_function)); + state->m_functions_by_name.emplace(std::make_pair(lowerCaseName, state->m_current_function)); state->m_current_function = nullptr; } else if (!state->m_current_function->m_value->Equals(existingFunction->second->m_value.get()))