Skip to content

Commit

Permalink
TEAMLOCK: Don't use HUD_FirstTeam() when HUD hasn't initialised
Browse files Browse the repository at this point in the history
  • Loading branch information
meag committed Nov 14, 2018
1 parent eb2a5fb commit b83dd8a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion cl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ void CL_MakeActive(void)
if (!cls.demoseeking) {
Con_ClearNotify ();
}
TP_ExecTrigger ("f_spawn");
TP_ExecTrigger("f_spawn");
}

// Cvar system calls this when a CVAR_USERINFO cvar changes
Expand Down
18 changes: 10 additions & 8 deletions cl_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -2035,19 +2035,21 @@ void CL_NewTranslation (int slot)
teammate = true;
}

if (teammate)
{
if (cl_teamtopcolor.integer != -1)
if (teammate) {
if (cl_teamtopcolor.integer != -1) {
player->topcolor = cl_teamtopcolor.value;
if (cl_teambottomcolor.integer != -1)
}
if (cl_teambottomcolor.integer != -1) {
player->bottomcolor = cl_teambottomcolor.value;
}
}
else if (slot != cl.playernum)
{
if (cl_enemytopcolor.integer != -1)
else if (slot != cl.playernum) {
if (cl_enemytopcolor.integer != -1) {
player->topcolor = cl_enemytopcolor.value;
if (cl_enemybottomcolor.integer != -1)
}
if (cl_enemybottomcolor.integer != -1) {
player->bottomcolor = cl_enemybottomcolor.value;
}
}
}

Expand Down
4 changes: 1 addition & 3 deletions hud_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -7159,7 +7159,5 @@ const char* HUD_FirstTeam(void)
if (n_teams) {
return sorted_teams[0].name;
}
else {
return "";
}
return "";
}
15 changes: 7 additions & 8 deletions teamplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -1706,17 +1706,16 @@ char *TP_SkinForcingTeam(void)
return cl.players[cl.playernum].team;
}
else if (cl_teamlock.integer == 1) {
if (cls.mvdplayback) {
extern const char* HUD_FirstTeam(void);
extern const char* HUD_FirstTeam(void);
int i;

if (cls.mvdplayback && HUD_FirstTeam()[0]) {
return (char*) HUD_FirstTeam();
}
else {
int i;
for (i = 0; i < MAX_CLIENTS; i++) {
if (cl.players[i].name[0] && !cl.players[i].spectator && cl.players[i].team[0]) {
return cl.players[i].team;
}

for (i = 0; i < MAX_CLIENTS; i++) {
if (cl.players[i].name[0] && !cl.players[i].spectator && cl.players[i].team[0]) {
return cl.players[i].team;
}
}
}
Expand Down

0 comments on commit b83dd8a

Please sign in to comment.