Merge pull request #143 from ClaudiuHKS/master
Colored Menus and GeoIP Bug Fix
This commit is contained in:
commit
d8fc093fd8
|
@ -143,6 +143,20 @@ int FF_InconsistentFile = -1;
|
||||||
int FF_ClientAuthorized = -1;
|
int FF_ClientAuthorized = -1;
|
||||||
int FF_ChangeLevel = -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<String *> & files, const char *name)
|
void ParseAndOrAdd(CStack<String *> & files, const char *name)
|
||||||
{
|
{
|
||||||
if (strncmp(name, "plugins-", 8) == 0)
|
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);
|
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 = ColoredMenus(g_mod_name); // whether or not to use colored menus
|
||||||
g_coloredmenus = true;
|
|
||||||
else
|
|
||||||
g_coloredmenus = false;
|
|
||||||
|
|
||||||
// ###### Print short GPL
|
// ###### Print short GPL
|
||||||
print_srvconsole("\n AMX Mod X version %s Copyright (c) 2004-2014 AMX Mod X Development Team \n"
|
print_srvconsole("\n AMX Mod X version %s Copyright (c) 2004-2014 AMX Mod X Development Team \n"
|
||||||
|
|
|
@ -155,13 +155,16 @@ int getContinentId(const char *code)
|
||||||
{
|
{
|
||||||
case 'A':
|
case 'A':
|
||||||
{
|
{
|
||||||
switch (code[1])
|
switch (code[1])
|
||||||
{
|
{
|
||||||
case 'F': index = CONTINENT_AFRICA; break;
|
case 'F': index = CONTINENT_AFRICA; break;
|
||||||
case 'N': index = CONTINENT_ANTARCTICA; break;
|
case 'N': index = CONTINENT_ANTARCTICA; break;
|
||||||
case 'S': index = CONTINENT_ASIA; break;
|
case 'S': index = CONTINENT_ASIA; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'E': index = CONTINENT_EUROPE; break;
|
case 'E': index = CONTINENT_EUROPE; break;
|
||||||
case 'O': index = CONTINENT_OCEANIA; break;
|
case 'O': index = CONTINENT_OCEANIA; break;
|
||||||
case 'N': index = CONTINENT_NORTH_AMERICA; break;
|
case 'N': index = CONTINENT_NORTH_AMERICA; break;
|
||||||
|
|
|
@ -420,12 +420,32 @@ stock show_activity_key(const KeyWithoutName[], const KeyWithName[], const ___Ad
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stock colored_menus()
|
stock colored_menus()
|
||||||
{
|
{
|
||||||
new mod_name[32];
|
static ColoredMenus = -1;
|
||||||
get_modname(mod_name,31);
|
|
||||||
|
|
||||||
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()
|
stock cstrike_running()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user