split up extremely large enums

This commit is contained in:
Ramen2X 2024-03-17 16:22:16 -04:00
parent 847339f7b0
commit e03e14f4e4

View file

@ -110,7 +110,7 @@ bool HeaderGenerator::WriteHeader(char *p_interleafName, std::map<size_t, std::s
bool isLast = false;
size_t i = 0;
ActionMap::iterator prev = p_actionMap->begin();
for (ActionMap::iterator it = p_actionMap->begin(); it != p_actionMap->end(); it++) {
for (ActionMap::iterator it = p_actionMap->begin(); it != p_actionMap->end(); ++it) {
isLast = it == (--p_actionMap->end());
// seperate distanced action ids with whitespace (styling)
@ -118,6 +118,12 @@ bool HeaderGenerator::WriteHeader(char *p_interleafName, std::map<size_t, std::s
m_fout << "\n";
}
if (i == 2000) {
// some compilers don't accept extremely large enums,
// so we split them up here in case of 2000+ entries
m_fout << "};\n\n#ifdef COMPAT_MODE\nenum Script2 : int {\n#else\nenum Script2 {\n#endif\n";
}
// actually write the enum entry
m_fout << "\t" << g_enumEntryPrefix << it->second << " = " << it->first;
if (!isLast) {