diff options
author | ludde <ludde@openttd.org> | 2005-07-29 21:55:49 +0000 |
---|---|---|
committer | ludde <ludde@openttd.org> | 2005-07-29 21:55:49 +0000 |
commit | bb1e1f2b5f8f75dfe4b4026445a70a720b46ee8d (patch) | |
tree | e54247689fb0e4dc3a6c923797c3f345649582a2 | |
parent | 3a162799fda12c14a7c551f05a0515a3e9e7829b (diff) | |
download | openttd-bb1e1f2b5f8f75dfe4b4026445a70a720b46ee8d.tar.xz |
(svn r2755) Fix: Fix a desync issue with autoreplace
-rw-r--r-- | network.c | 9 | ||||
-rw-r--r-- | network_server.c | 9 | ||||
-rw-r--r-- | network_server.h | 2 |
3 files changed, 10 insertions, 10 deletions
@@ -1205,8 +1205,15 @@ void NetworkGameLoop(void) if (!NetworkReceive()) return; if (_network_server) { + bool send_frame = false; + // We first increase the _frame_counter _frame_counter++; + // Update max-frame-counter + if (_frame_counter > _frame_counter_max) { + _frame_counter_max = _frame_counter + _network_frame_freq; + send_frame = true; + } NetworkHandleLocalQueue(); @@ -1218,7 +1225,7 @@ void NetworkGameLoop(void) _sync_seed_2 = _random_seeds[0][1]; #endif - NetworkServer_Tick(); + NetworkServer_Tick(send_frame); } else { // Client diff --git a/network_server.c b/network_server.c index c6aa17f63..d53f7d575 100644 --- a/network_server.c +++ b/network_server.c @@ -1499,20 +1499,13 @@ void NetworkHandleCommandQueue(NetworkClientState *cs) { } // This is called every tick if this is a _network_server -void NetworkServer_Tick(void) +void NetworkServer_Tick(bool send_frame) { NetworkClientState *cs; - bool send_frame = false; #ifndef ENABLE_NETWORK_SYNC_EVERY_FRAME bool send_sync = false; #endif - // Update max-frame-counter - if (_frame_counter > _frame_counter_max) { - _frame_counter_max = _frame_counter + _network_frame_freq; - send_frame = true; - } - #ifndef ENABLE_NETWORK_SYNC_EVERY_FRAME if (_frame_counter >= _last_sync_frame + _network_sync_freq) { _last_sync_frame = _frame_counter; diff --git a/network_server.h b/network_server.h index dd9ebff5e..d1a1530b8 100644 --- a/network_server.h +++ b/network_server.h @@ -16,7 +16,7 @@ bool NetworkFindName(char new_name[NETWORK_NAME_LENGTH]); void NetworkServer_HandleChat(NetworkAction action, DestType desttype, int dest, const char *msg, uint16 from_index); bool NetworkServer_ReadPackets(NetworkClientState *cs); -void NetworkServer_Tick(void); +void NetworkServer_Tick(bool send_frame); void NetworkServerMonthlyLoop(void); void NetworkServerYearlyLoop(void); |