mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-09 19:38:25 +00:00
use lowercase strings when sending to GuessBestMapName
This commit is contained in:
parent
2733faf57d
commit
077cbe9a01
@ -485,25 +485,23 @@ stock void FormatSeconds(float time, char[] newtime, int newtimesize, bool preci
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stock bool GuessBestMapName(ArrayList maps, const char[] input, char[] output, int size)
|
stock bool GuessBestMapName(ArrayList maps, const char input[PLATFORM_MAX_PATH], char output[PLATFORM_MAX_PATH])
|
||||||
{
|
{
|
||||||
if(maps.FindString(input) != -1)
|
if(maps.FindString(input) != -1)
|
||||||
{
|
{
|
||||||
strcopy(output, size, input);
|
output = input;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
char sCache[128];
|
char sCache[PLATFORM_MAX_PATH];
|
||||||
|
|
||||||
for(int i = 0; i < maps.Length; i++)
|
for(int i = 0; i < maps.Length; i++)
|
||||||
{
|
{
|
||||||
maps.GetString(i, sCache, 128);
|
maps.GetString(i, sCache, PLATFORM_MAX_PATH);
|
||||||
|
|
||||||
if(StrContains(sCache, input) != -1)
|
if(StrContains(sCache, input) != -1)
|
||||||
{
|
{
|
||||||
strcopy(output, size, sCache);
|
output = sCache;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -441,6 +441,7 @@ public void SQL_FillTierCache_Callback(Database db, DBResultSet results, const c
|
|||||||
{
|
{
|
||||||
char sMap[PLATFORM_MAX_PATH];
|
char sMap[PLATFORM_MAX_PATH];
|
||||||
results.FetchString(0, sMap, sizeof(sMap));
|
results.FetchString(0, sMap, sizeof(sMap));
|
||||||
|
LowercaseString(sMap);
|
||||||
|
|
||||||
int tier = results.FetchInt(1);
|
int tier = results.FetchInt(1);
|
||||||
|
|
||||||
@ -564,8 +565,9 @@ public Action Command_Tier(int client, int args)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
GetCmdArgString(sMap, sizeof(sMap));
|
GetCmdArgString(sMap, sizeof(sMap));
|
||||||
|
LowercaseString(sMap);
|
||||||
|
|
||||||
if(!GuessBestMapName(gA_ValidMaps, sMap, sMap, sizeof(sMap)) || !gA_MapTiers.GetValue(sMap, tier))
|
if(!GuessBestMapName(gA_ValidMaps, sMap, sMap) || !gA_MapTiers.GetValue(sMap, tier))
|
||||||
{
|
{
|
||||||
Shavit_PrintToChat(client, "%t", "Map was not found", sMap);
|
Shavit_PrintToChat(client, "%t", "Map was not found", sMap);
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
|||||||
@ -1503,8 +1503,9 @@ public Action Command_WorldRecord(int client, int args)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
GetCmdArg(1, gA_WRCache[client].sClientMap, sizeof(wrcache_t::sClientMap));
|
GetCmdArg(1, gA_WRCache[client].sClientMap, sizeof(wrcache_t::sClientMap));
|
||||||
|
LowercaseString(gA_WRCache[client].sClientMap);
|
||||||
|
|
||||||
if (!GuessBestMapName(gA_ValidMaps, gA_WRCache[client].sClientMap, gA_WRCache[client].sClientMap, sizeof(wrcache_t::sClientMap)))
|
if (!GuessBestMapName(gA_ValidMaps, gA_WRCache[client].sClientMap, gA_WRCache[client].sClientMap))
|
||||||
{
|
{
|
||||||
Shavit_PrintToChat(client, "%t", "Map was not found", gA_WRCache[client].sClientMap);
|
Shavit_PrintToChat(client, "%t", "Map was not found", gA_WRCache[client].sClientMap);
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user