mirror of
https://github.com/UberGames/ioef.git
synced 2025-01-18 23:21:37 +00:00
Patch from Tim Angus, to fix a longstanding bug
in the server, wherein running the server for more than 24 hours would cause the game to exhibit weirdness as described here: http://forums.wireheadstudios.org/index.php?act=ST&f=11&t=2749 That page would also indicate that more work needs to be done if the map isn't going to change for more than 24 hours.
This commit is contained in:
parent
40592957b4
commit
4bee7b4134
6 changed files with 21 additions and 13 deletions
|
@ -78,6 +78,7 @@ typedef struct {
|
||||||
int gameClientSize; // will be > sizeof(playerState_t) due to game private data
|
int gameClientSize; // will be > sizeof(playerState_t) due to game private data
|
||||||
|
|
||||||
int restartTime;
|
int restartTime;
|
||||||
|
int time;
|
||||||
} server_t;
|
} server_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -272,8 +272,10 @@ static void SV_MapRestart_f( void ) {
|
||||||
SV_RestartGameProgs();
|
SV_RestartGameProgs();
|
||||||
|
|
||||||
// run a few frames to allow everything to settle
|
// run a few frames to allow everything to settle
|
||||||
for ( i = 0 ;i < 3 ; i++ ) {
|
for (i = 0; i < 3; i++)
|
||||||
VM_Call( gvm, GAME_RUN_FRAME, svs.time );
|
{
|
||||||
|
VM_Call (gvm, GAME_RUN_FRAME, sv.time);
|
||||||
|
sv.time += 100;
|
||||||
svs.time += 100;
|
svs.time += 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,7 +316,8 @@ static void SV_MapRestart_f( void ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// run another frame to allow things to look at all the players
|
// run another frame to allow things to look at all the players
|
||||||
VM_Call( gvm, GAME_RUN_FRAME, svs.time );
|
VM_Call (gvm, GAME_RUN_FRAME, sv.time);
|
||||||
|
sv.time += 100;
|
||||||
svs.time += 100;
|
svs.time += 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -898,7 +898,7 @@ static void SV_InitGameVM( qboolean restart ) {
|
||||||
|
|
||||||
// use the current msec count for a random seed
|
// use the current msec count for a random seed
|
||||||
// init for this gamestate
|
// init for this gamestate
|
||||||
VM_Call( gvm, GAME_INIT, svs.time, Com_Milliseconds(), restart );
|
VM_Call (gvm, GAME_INIT, sv.time, Com_Milliseconds(), restart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -438,9 +438,11 @@ void SV_SpawnServer( char *server, qboolean killBots ) {
|
||||||
sv_gametype->modified = qfalse;
|
sv_gametype->modified = qfalse;
|
||||||
|
|
||||||
// run a few frames to allow everything to settle
|
// run a few frames to allow everything to settle
|
||||||
for ( i = 0 ;i < 3 ; i++ ) {
|
for (i = 0;i < 3; i++)
|
||||||
VM_Call( gvm, GAME_RUN_FRAME, svs.time );
|
{
|
||||||
SV_BotFrame( svs.time );
|
VM_Call (gvm, GAME_RUN_FRAME, sv.time);
|
||||||
|
SV_BotFrame (sv.time);
|
||||||
|
sv.time += 100;
|
||||||
svs.time += 100;
|
svs.time += 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,8 +497,9 @@ void SV_SpawnServer( char *server, qboolean killBots ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// run another frame to allow things to look at all the players
|
// run another frame to allow things to look at all the players
|
||||||
VM_Call( gvm, GAME_RUN_FRAME, svs.time );
|
VM_Call (gvm, GAME_RUN_FRAME, sv.time);
|
||||||
SV_BotFrame( svs.time );
|
SV_BotFrame (sv.time);
|
||||||
|
sv.time += 100;
|
||||||
svs.time += 100;
|
svs.time += 100;
|
||||||
|
|
||||||
if ( sv_pure->integer ) {
|
if ( sv_pure->integer ) {
|
||||||
|
|
|
@ -785,7 +785,7 @@ void SV_Frame( int msec ) {
|
||||||
|
|
||||||
sv.timeResidual += msec;
|
sv.timeResidual += msec;
|
||||||
|
|
||||||
if (!com_dedicated->integer) SV_BotFrame( svs.time + sv.timeResidual );
|
if (!com_dedicated->integer) SV_BotFrame (sv.time + sv.timeResidual);
|
||||||
|
|
||||||
if ( com_dedicated->integer && sv.timeResidual < frameMsec ) {
|
if ( com_dedicated->integer && sv.timeResidual < frameMsec ) {
|
||||||
// NET_Sleep will give the OS time slices until either get a packet
|
// NET_Sleep will give the OS time slices until either get a packet
|
||||||
|
@ -835,15 +835,16 @@ void SV_Frame( int msec ) {
|
||||||
// update ping based on the all received frames
|
// update ping based on the all received frames
|
||||||
SV_CalcPings();
|
SV_CalcPings();
|
||||||
|
|
||||||
if (com_dedicated->integer) SV_BotFrame( svs.time );
|
if (com_dedicated->integer) SV_BotFrame (sv.time);
|
||||||
|
|
||||||
// run the game simulation in chunks
|
// run the game simulation in chunks
|
||||||
while ( sv.timeResidual >= frameMsec ) {
|
while ( sv.timeResidual >= frameMsec ) {
|
||||||
sv.timeResidual -= frameMsec;
|
sv.timeResidual -= frameMsec;
|
||||||
svs.time += frameMsec;
|
svs.time += frameMsec;
|
||||||
|
sv.time += frameMsec;
|
||||||
|
|
||||||
// let everything in the world think and move
|
// let everything in the world think and move
|
||||||
VM_Call( gvm, GAME_RUN_FRAME, svs.time );
|
VM_Call (gvm, GAME_RUN_FRAME, sv.time);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( com_speeds->integer ) {
|
if ( com_speeds->integer ) {
|
||||||
|
|
|
@ -160,7 +160,7 @@ static void SV_WriteSnapshotToClient( client_t *client, msg_t *msg ) {
|
||||||
|
|
||||||
// send over the current server time so the client can drift
|
// send over the current server time so the client can drift
|
||||||
// its view of time to try to match
|
// its view of time to try to match
|
||||||
MSG_WriteLong (msg, svs.time);
|
MSG_WriteLong (msg, sv.time);
|
||||||
|
|
||||||
// what we are delta'ing from
|
// what we are delta'ing from
|
||||||
MSG_WriteByte (msg, lastframe);
|
MSG_WriteByte (msg, lastframe);
|
||||||
|
|
Loading…
Reference in a new issue