mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-22 03:41:45 +00:00
Move sphere redistribution to its own function
This commit is contained in:
parent
2b2797ec66
commit
dc39957539
1 changed files with 56 additions and 50 deletions
|
@ -2316,30 +2316,16 @@ static void UnlinkPlayerFromNode(INT32 playernum)
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// CL_RemovePlayer
|
||||
//
|
||||
// Removes a player from the current game
|
||||
//
|
||||
void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
|
||||
// If in a special stage, redistribute the player's
|
||||
// spheres across the remaining players.
|
||||
// I feel like this shouldn't even be in this file at all, but well.
|
||||
static void RedistributeSpecialStageSpheres(INT32 playernum)
|
||||
{
|
||||
// Sanity check: exceptional cases (i.e. c-fails) can cause multiple
|
||||
// kick commands to be issued for the same player.
|
||||
if (!playeringame[playernum])
|
||||
return;
|
||||
|
||||
if (server)
|
||||
UnlinkPlayerFromNode(playernum);
|
||||
|
||||
if (gametyperules & GTR_TEAMFLAGS)
|
||||
P_PlayerFlagBurst(&players[playernum], false); // Don't take the flag with you!
|
||||
|
||||
// If in a special stage, redistribute the player's spheres across
|
||||
// the remaining players.
|
||||
if (G_IsSpecialStage(gamemap))
|
||||
{
|
||||
INT32 i, count, sincrement, spheres, rincrement, rings;
|
||||
|
||||
if (!G_IsSpecialStage(gamemap))
|
||||
return;
|
||||
|
||||
for (i = 0, count = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i])
|
||||
|
@ -2383,7 +2369,27 @@ void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// CL_RemovePlayer
|
||||
//
|
||||
// Removes a player from the current game
|
||||
//
|
||||
void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
|
||||
{
|
||||
// Sanity check: exceptional cases (i.e. c-fails) can cause multiple
|
||||
// kick commands to be issued for the same player.
|
||||
if (!playeringame[playernum])
|
||||
return;
|
||||
|
||||
if (server)
|
||||
UnlinkPlayerFromNode(playernum);
|
||||
|
||||
if (gametyperules & GTR_TEAMFLAGS)
|
||||
P_PlayerFlagBurst(&players[playernum], false); // Don't take the flag with you!
|
||||
|
||||
RedistributeSpecialStageSpheres(playernum);
|
||||
|
||||
LUA_HookPlayerQuit(&players[playernum], reason); // Lua hook for player quitting
|
||||
|
||||
|
|
Loading…
Reference in a new issue