Fix losing race rank after finishing if following other player

If you finish the race and then follow another player (fire and then
rear fire to switch to SPECTATOR_FOLLOW) and then after other player
finishes and there is no one else to follow the game switches you
to SPECTATOR_FREE. This calls ClientBegin() which clears most of the
game client data, including the finishRaceTime. This puts the player
in last place on the scoreboard.
This commit is contained in:
zturtleman 2021-06-15 10:30:30 +00:00
parent cad778cadc
commit 62467f97b9

View file

@ -1333,6 +1333,7 @@ void ClientSpawn(gentity_t *ent) {
int eventSequence;
char userinfo[MAX_INFO_STRING];
// STONELANCE
int savedFinishRaceTime;
int savedDamageTaken;
int savedDamageDealt;
gentity_t *savedCarPoints[4];
@ -1425,6 +1426,7 @@ void ClientSpawn(gentity_t *ent) {
savedSess = client->sess;
savedPing = client->ps.ping;
// STONELANCE
savedFinishRaceTime = client->finishRaceTime;
savedDamageDealt = client->ps.stats[STAT_DAMAGE_DEALT];
savedDamageTaken = client->ps.stats[STAT_DAMAGE_TAKEN];
// END
@ -1461,6 +1463,7 @@ void ClientSpawn(gentity_t *ent) {
client->carPoints[1] = savedCarPoints[1];
client->carPoints[2] = savedCarPoints[2];
client->carPoints[3] = savedCarPoints[3];
client->finishRaceTime = savedFinishRaceTime;
client->ps.stats[STAT_DAMAGE_DEALT] = savedDamageDealt;
client->ps.stats[STAT_DAMAGE_TAKEN] = savedDamageTaken;
client->ps.stats[STAT_NEXT_CHECKPOINT] = ent->number;