diff --git a/amxmodx/meta_api.cpp b/amxmodx/meta_api.cpp index 5393c884..8ae5611a 100755 --- a/amxmodx/meta_api.cpp +++ b/amxmodx/meta_api.cpp @@ -143,6 +143,20 @@ int FF_InconsistentFile = -1; int FF_ClientAuthorized = -1; int FF_ChangeLevel = -1; +bool ColoredMenus(String & ModName) +{ + const char * pModNames[] = { "cstrike", "czero", "dmc", "dod", "tfc", "valve" }; + const size_t ModsCount = sizeof(pModNames) / sizeof(const char *); + + for (int Iterator = 0u; Iterator < ModsCount; ++Iterator) + { + if (ModName.compare(pModNames[Iterator]) == 0u) + return true; // this game modification currently supports colored menus + } + + return false; // no colored menus are supported for this game modification +} + void ParseAndOrAdd(CStack & files, const char *name) { if (strncmp(name, "plugins-", 8) == 0) @@ -1440,10 +1454,7 @@ C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, m g_mod_name.assign(a); - if (g_mod_name.compare("cstrike") == 0 || g_mod_name.compare("czero") == 0 || g_mod_name.compare("dod") == 0) - g_coloredmenus = true; - else - g_coloredmenus = false; + g_coloredmenus = ColoredMenus(g_mod_name); // whether or not to use colored menus // ###### Print short GPL print_srvconsole("\n AMX Mod X version %s Copyright (c) 2004-2014 AMX Mod X Development Team \n" diff --git a/dlls/geoip/geoip_util.cpp b/dlls/geoip/geoip_util.cpp index 67b1b84f..aecdb864 100644 --- a/dlls/geoip/geoip_util.cpp +++ b/dlls/geoip/geoip_util.cpp @@ -155,13 +155,16 @@ int getContinentId(const char *code) { case 'A': { - switch (code[1]) - { - case 'F': index = CONTINENT_AFRICA; break; - case 'N': index = CONTINENT_ANTARCTICA; break; - case 'S': index = CONTINENT_ASIA; break; - } + switch (code[1]) + { + case 'F': index = CONTINENT_AFRICA; break; + case 'N': index = CONTINENT_ANTARCTICA; break; + case 'S': index = CONTINENT_ASIA; break; + } + + break; } + case 'E': index = CONTINENT_EUROPE; break; case 'O': index = CONTINENT_OCEANIA; break; case 'N': index = CONTINENT_NORTH_AMERICA; break; diff --git a/plugins/include/amxmisc.inc b/plugins/include/amxmisc.inc index ccd7a511..a4314f2f 100755 --- a/plugins/include/amxmisc.inc +++ b/plugins/include/amxmisc.inc @@ -420,12 +420,32 @@ stock show_activity_key(const KeyWithoutName[], const KeyWithName[], const ___Ad } } -stock colored_menus() +stock colored_menus() { - new mod_name[32]; - get_modname(mod_name,31); + static ColoredMenus = -1; - return ( equal(mod_name,"cstrike") || equal(mod_name,"czero") || equal(mod_name,"dod") ); + if (ColoredMenus == -1) + { + new const ModNames[][] = { "cstrike", "czero", "dmc", "dod", "tfc", "valve" }; + new ModName[32]; + + get_modname(ModName, charsmax(ModName)); + + for (new Iterator = 0; Iterator < sizeof(ModNames); Iterator++) + { + if (equal(ModName, ModNames[Iterator])) + { + ColoredMenus = 1; + + break; + } + } + + if (ColoredMenus == -1) + ColoredMenus = 0; + } + + return ColoredMenus; } stock cstrike_running()