Skip to content

Commit

Permalink
game: fixed taken objectives disappear when shuffling with no restart
Browse files Browse the repository at this point in the history
  • Loading branch information
rmarquis committed Dec 2, 2019
1 parent 131fa12 commit e44080a
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/game/g_svcmds.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -892,11 +892,28 @@ void Svcmd_SwapTeams_f(void)
*/ */
void Svcmd_ShuffleTeamsXP_f(qboolean restart) void Svcmd_ShuffleTeamsXP_f(qboolean restart)
{ {
int i;
gentity_t *ent;

if (restart) if (restart)
{ {
G_resetRoundState(); G_resetRoundState();
} }


// ensure objectives are dropped with no restart
if (!restart)
{
for (i = 0; i < level.numConnectedClients; i++)
{
ent = g_entities + level.sortedClients[i];

if (ent->client->ps.powerups[PW_BLUEFLAG] || ent->client->ps.powerups[PW_REDFLAG])
{
G_DropItems(ent);
}
}
}

G_shuffleTeamsXP(); G_shuffleTeamsXP();


if ((g_gamestate.integer == GS_INITIALIZE) || if ((g_gamestate.integer == GS_INITIALIZE) ||
Expand All @@ -905,6 +922,7 @@ void Svcmd_ShuffleTeamsXP_f(qboolean restart)
{ {
return; return;
} }

if (restart) if (restart)
{ {
G_resetModeState(); G_resetModeState();
Expand Down Expand Up @@ -935,11 +953,28 @@ void Svcmd_ShuffleTeamsXPNoRestart(void)
*/ */
void Svcmd_ShuffleTeamsSR_f(qboolean restart) void Svcmd_ShuffleTeamsSR_f(qboolean restart)
{ {
int i;
gentity_t *ent;

if (restart) if (restart)
{ {
G_resetRoundState(); G_resetRoundState();
} }


// ensure objectives are dropped with no restart
if (!restart)
{
for (i = 0; i < level.numConnectedClients; i++)
{
ent = g_entities + level.sortedClients[i];

if (ent->client->ps.powerups[PW_BLUEFLAG] || ent->client->ps.powerups[PW_REDFLAG])
{
G_DropItems(ent);
}
}
}

G_shuffleTeamsSR(); G_shuffleTeamsSR();


if ((g_gamestate.integer == GS_INITIALIZE) || if ((g_gamestate.integer == GS_INITIALIZE) ||
Expand All @@ -948,6 +983,7 @@ void Svcmd_ShuffleTeamsSR_f(qboolean restart)
{ {
return; return;
} }

if (restart) if (restart)
{ {
G_resetModeState(); G_resetModeState();
Expand Down

0 comments on commit e44080a

Please sign in to comment.