Merge pull request #609 from shavitush/css_hud_fixes

bug fixes
This commit is contained in:
shavit 2018-03-24 01:54:12 +03:00 committed by GitHub
commit c28de91fd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 39 deletions

View File

@ -23,7 +23,7 @@
#endif
#define _shavit_included
#define SHAVIT_VERSION "2.0.0"
#define SHAVIT_VERSION "2.0.1"
#define STYLE_LIMIT 256
#define MAX_ZONES 64

View File

@ -400,24 +400,11 @@ public void OnMapStart()
SetFailState("Could not load the styles configuration file. Make sure it exists (addons/sourcemod/configs/shavit-styles.cfg) and follows the proper syntax!");
}
else
{
Call_StartForward(gH_Forwards_OnStyleConfigLoaded);
Call_PushCell(gI_Styles);
Call_Finish();
}
// messages
if(!LoadMessages())
{
SetFailState("Could not load the chat messages configuration file. Make sure it exists (addons/sourcemod/configs/shavit-messages.cfg) and follows the proper syntax!");
}
else
{
Call_StartForward(gH_Forwards_OnChatConfigLoaded);
Call_Finish();
}
}
public void OnMapEnd()
@ -1511,6 +1498,10 @@ bool LoadStyles()
gI_Styles = i;
gB_Registered = true;
Call_StartForward(gH_Forwards_OnStyleConfigLoaded);
Call_PushCell(gI_Styles);
Call_Finish();
return true;
}
@ -1572,6 +1563,9 @@ bool LoadMessages()
ReplaceString(gS_ChatStrings[i], 128, "{RGBA}", "\x08");
}
Call_StartForward(gH_Forwards_OnChatConfigLoaded);
Call_Finish();
return true;
}

View File

@ -677,6 +677,7 @@ void UpdateHUD(int client)
{
int track = Shavit_GetClientTrack(target);
char[] sTrack = new char[32];
GetTrackName(client, track, sTrack, 32);
if(!IsFakeClient(target))
{
@ -728,7 +729,6 @@ void UpdateHUD(int client)
if(track != Track_Main)
{
GetTrackName(client, track, sTrack, 32);
Format(sHintText, 512, "%s[<font color='#FFFFFF'>%s</font>] ", sHintText, sTrack);
}

View File

@ -1498,19 +1498,6 @@ public Action Command_Tele(int client, int args)
}
}
CheckpointsCache cpcache[PCPCACHE_SIZE];
GetCheckpoint(client, index, cpcache);
float pos[3];
CopyArray(cpcache[fCPPosition], pos, 3);
if(IsNullVector(pos))
{
Shavit_PrintToChat(client, "%T", "MiscCheckpointsEmpty", client, (index + 1), gS_ChatStrings[sMessageWarning], gS_ChatStrings[sMessageText]);
return Plugin_Handled;
}
TeleportToCheckpoint(client, index, false);
return Plugin_Handled;
@ -1705,6 +1692,13 @@ bool SaveCheckpoint(int client, int index)
int style = Shavit_GetReplayBotStyle(target);
int track = Shavit_GetReplayBotTrack(target);
if(style < 0 || track < 0)
{
Shavit_PrintToChat(client, "%T", "CommandAliveSpectate", client, gS_ChatStrings[sMessageVariable], gS_ChatStrings[sMessageText], gS_ChatStrings[sMessageVariable], gS_ChatStrings[sMessageText]);
return false;
}
snapshot[bTimerEnabled] = true;
snapshot[fCurrentTime] = Shavit_GetReplayTime(style, track);
snapshot[bClientPaused] = false;
@ -1737,7 +1731,13 @@ void TeleportToCheckpoint(int client, int index, bool suppressMessage)
}
CheckpointsCache cpcache[PCPCACHE_SIZE];
GetCheckpoint(client, index, cpcache);
if(!GetCheckpoint(client, index, cpcache))
{
Shavit_PrintToChat(client, "%T", "MiscCheckpointsEmpty", client, (index + 1), gS_ChatStrings[sMessageWarning], gS_ChatStrings[sMessageText]);
return;
}
float pos[3];
CopyArray(cpcache[fCPPosition], pos, 3);

View File

@ -401,6 +401,11 @@ public int Native_GetReplayTime(Handle handler, int numParams)
int style = GetNativeCell(1);
int track = GetNativeCell(2);
if(style < 0 || track < 0)
{
return view_as<int>(0.0);
}
if(gB_CentralBot)
{
if(gA_CentralCache[iCentralReplayStatus] == Replay_End)

View File

@ -173,15 +173,6 @@ public void OnPluginStart()
// cache
gA_ValidMaps = new ArrayList(192);
for(int i = 0; i < STYLE_LIMIT; i++)
{
for(int j = 0; j < TRACKS_SIZE; j++)
{
gA_Leaderboard[i][j] = new ArrayList();
gI_RecordAmount[i][j] = 0;
}
}
SQL_SetPrefix();
}
@ -370,7 +361,13 @@ public void Shavit_OnStyleConfigLoaded(int styles)
{
if(i < styles)
{
if(gA_Leaderboard[i][j] == null)
{
gA_Leaderboard[i][j] = new ArrayList();
}
gA_Leaderboard[i][j].Clear();
gI_RecordAmount[i][j] = 0;
}
else
@ -544,7 +541,7 @@ public int Native_GetRankForTime(Handle handler, int numParams)
int style = GetNativeCell(1);
int track = GetNativeCell(3);
if(gA_Leaderboard[style][track].Length == 0)
if(gA_Leaderboard[style][track] == null || gA_Leaderboard[style][track].Length == 0)
{
return 1;
}