Skip to content

Commit 409c253

Browse files
committed
Discard old server commands upon new gamestate
Fixes Unvanquished/Unvanquished#1102. This fixes a bug where the configstring state could be wrong due to `cs` server commands being executed out of order with respect to game state processing. Server commands are only processed when the cgame requests a snapshot, so commands received before the client loads the current map which were sent before the gamestate could be processed after the gamestate. Of course there are other commands besides setting configstrings. In general, processing a command from a previous game seems very likely to be a bad idea and unlikely to be good.
1 parent 6bf8baa commit 409c253

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/engine/client/cl_parse.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,9 @@ void CL_ParseGamestate( msg_t *msg )
409409

410410
// a gamestate always marks a server command sequence
411411
clc.serverCommandSequence = MSG_ReadLong( msg );
412+
413+
// trash any commands from previous game
414+
clc.lastExecutedServerCommand = clc.serverCommandSequence;
412415
}
413416

414417
// parse all the configstrings and baselines

src/engine/server/sv_client.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ void SV_SendClientGameState( client_t *client )
354354
// we have to do this cause we send the client->reliableSequence
355355
// with a gamestate and it sets the clc.serverCommandSequence at
356356
// the client side
357+
// TODO(0.57): remove. The client will just throw away old commands on getting a gamestate
357358
SV_UpdateServerCommandsToClient( client, &msg );
358359

359360
// send the gamestate

0 commit comments

Comments
 (0)