diff --git a/developer/src/kmcmplib/src/CompMsg.cpp b/developer/src/kmcmplib/src/CompMsg.cpp index 86a9b4d475..5bfbeb9a09 100644 --- a/developer/src/kmcmplib/src/CompMsg.cpp +++ b/developer/src/kmcmplib/src/CompMsg.cpp @@ -1,11 +1,7 @@ #include +#include -struct CompilerError { - KMX_DWORD ErrorCode; - const KMX_CHAR* Text; - }; - -const struct CompilerError CompilerErrors[] = { +std::map CompilerErrorMap = { { CERR_InvalidLayoutLine , "Invalid 'layout' command"}, { CERR_NoVersionLine , "No version line found for file"}, { CERR_InvalidGroupLine , "Invalid 'group' command"}, @@ -150,14 +146,8 @@ const struct CompilerError CompilerErrors[] = { { CWARN_VirtualKeyInOutput , "Virtual keys are not supported in output"}, { 0, nullptr } - }; +}; -KMX_CHAR *GetCompilerErrorString(KMX_DWORD code) -{ - for(int i = 0; CompilerErrors[i].ErrorCode; i++) { - if(CompilerErrors[i].ErrorCode == code) { - return ( KMX_CHAR*) CompilerErrors[i].Text; - } - } - return nullptr; +KMX_CHAR *GetCompilerErrorString(KMX_DWORD code) { + return (KMX_CHAR*) CompilerErrorMap[code]; }