Skip to content

Commit

Permalink
fixups for mapchooser nominate menu after sqlite support was added to…
Browse files Browse the repository at this point in the history
… shavit-rankings
  • Loading branch information
rtldg committed Mar 26, 2024
1 parent 1102a09 commit 66c730a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/shavit-mapchooser.sp
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,7 @@ public int SlowSortThatSkipsFolders(int index1, int index2, Handle array, Handle

void CreateNominateMenu()
{
if (gB_Rankings && (gI_Driver == Driver_mysql || gI_Driver == Driver_unknown) && !g_bTiersAssigned)
if (gB_Rankings && !g_bTiersAssigned)
{
g_bWaitingForTiers = true;
return;
Expand Down
13 changes: 11 additions & 2 deletions addons/sourcemod/scripting/shavit-rankings.sp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ int gI_Driver = Driver_unknown;
bool gB_Stats = false;
bool gB_Late = false;
bool gB_TierQueried = false;
bool gB_MapStarted = false;

int gI_Tier = 1; // No floating numbers for tiers, sorry.

Expand Down Expand Up @@ -234,6 +235,8 @@ public void Shavit_OnDatabaseLoaded()
}
}

DbStuffPostMapStart();

QueryLog(gH_SQL, SQL_Version_Callback,
gI_Driver == Driver_sqlite
? "WITH p AS (SELECT COUNT(*) FROM pragma_function_list WHERE name = 'pow') SELECT sqlite_version(), * FROM p;"
Expand Down Expand Up @@ -300,7 +303,7 @@ public void Trans_RankingsSetupError(Database db, any data, int numQueries, cons

public void Trans_RankingsSetupSuccess(Database db, any data, int numQueries, DBResultSet[] results, any[] queryData)
{
OnMapStart();
DbStuffPostMapStart();
}

public void OnClientConnected(int client)
Expand All @@ -326,8 +329,13 @@ public void OnMapStart()
{
GetLowercaseMapName(gS_Map);
Shavit_OnStyleConfigLoaded(Shavit_GetStyleCount()); // just in case :)
gB_MapStarted = true;
DbStuffPostMapStart();
}

if (gH_SQL == null)
void DbStuffPostMapStart()
{
if (gH_SQL == null || !gB_MapStarted)
{
return;
}
Expand Down Expand Up @@ -409,6 +417,7 @@ public void SQL_FillTierCache_Callback(Database db, DBResultSet results, const c
public void OnMapEnd()
{
gB_TierQueried = false;
gB_MapStarted = false;
gB_WRHoldersRefreshed = false;
gB_WRHoldersRefreshedTimer = false;
gB_WorldRecordsCached = false;
Expand Down

0 comments on commit 66c730a

Please sign in to comment.