mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-09 11:28:26 +00:00
remove duplicate map tier retreival
This commit is contained in:
parent
838d33510b
commit
7383cba61f
@ -382,52 +382,12 @@ public void OnMapStart()
|
|||||||
gI_Tier = gCV_DefaultTier.IntValue;
|
gI_Tier = gCV_DefaultTier.IntValue;
|
||||||
|
|
||||||
char sQuery[512];
|
char sQuery[512];
|
||||||
FormatEx(sQuery, sizeof(sQuery), "SELECT tier FROM %smaptiers WHERE map = '%s';", gS_MySQLPrefix, gS_Map);
|
FormatEx(sQuery, sizeof(sQuery), "SELECT map, tier FROM %smaptiers;", gS_MySQLPrefix);
|
||||||
gH_SQL.Query(SQL_GetMapTier_Callback, sQuery);
|
gH_SQL.Query(SQL_FillTierCache_Callback, sQuery, 0, DBPrio_High);
|
||||||
|
|
||||||
gB_TierQueried = true;
|
gB_TierQueried = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SQL_GetMapTier_Callback(Database db, DBResultSet results, const char[] error, any data)
|
|
||||||
{
|
|
||||||
if(results == null)
|
|
||||||
{
|
|
||||||
LogError("Timer (rankings, get map tier) error! Reason: %s", error);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined DEBUG
|
|
||||||
PrintToServer("DEBUG: 2 (SQL_GetMapTier_Callback)");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(results.RowCount > 0 && results.FetchRow())
|
|
||||||
{
|
|
||||||
gI_Tier = results.FetchInt(0);
|
|
||||||
|
|
||||||
#if defined DEBUG
|
|
||||||
PrintToServer("DEBUG: 3 (tier: %d) (SQL_GetMapTier_Callback)", gI_Tier);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RecalculateCurrentMap();
|
|
||||||
UpdateAllPoints();
|
|
||||||
|
|
||||||
#if defined DEBUG
|
|
||||||
PrintToServer("DEBUG: 4 (SQL_GetMapTier_Callback)");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char sQuery[512];
|
|
||||||
FormatEx(sQuery, sizeof(sQuery), "REPLACE INTO %smaptiers (map, tier) VALUES ('%s', %d);", gS_MySQLPrefix, gS_Map, gI_Tier);
|
|
||||||
gH_SQL.Query(SQL_SetMapTier_Callback, sQuery, gI_Tier, DBPrio_High);
|
|
||||||
}
|
|
||||||
|
|
||||||
char sQuery[256];
|
|
||||||
FormatEx(sQuery, 256, "SELECT map, tier FROM %smaptiers;", gS_MySQLPrefix);
|
|
||||||
gH_SQL.Query(SQL_FillTierCache_Callback, sQuery, 0, DBPrio_High);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SQL_FillTierCache_Callback(Database db, DBResultSet results, const char[] error, any data)
|
public void SQL_FillTierCache_Callback(Database db, DBResultSet results, const char[] error, any data)
|
||||||
{
|
{
|
||||||
if(results == null)
|
if(results == null)
|
||||||
@ -458,6 +418,18 @@ public void SQL_FillTierCache_Callback(Database db, DBResultSet results, const c
|
|||||||
}
|
}
|
||||||
|
|
||||||
SortADTArray(gA_ValidMaps, Sort_Ascending, Sort_String);
|
SortADTArray(gA_ValidMaps, Sort_Ascending, Sort_String);
|
||||||
|
|
||||||
|
if (gA_MapTiers.GetValue(gS_Map, gI_Tier))
|
||||||
|
{
|
||||||
|
RecalculateCurrentMap();
|
||||||
|
UpdateAllPoints();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char sQuery[512];
|
||||||
|
FormatEx(sQuery, sizeof(sQuery), "REPLACE INTO %smaptiers (map, tier) VALUES ('%s', %d);", gS_MySQLPrefix, gS_Map, gI_Tier);
|
||||||
|
gH_SQL.Query(SQL_SetMapTier_Callback, sQuery, gI_Tier, DBPrio_High);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnMapEnd()
|
public void OnMapEnd()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user