Mercurial > hg > openttd
changeset 2235:873288b3fbf3 draft
(svn r2755) Fix: Fix a desync issue with autoreplace
author | ludde <ludde@openttd.org> |
---|---|
date | Fri, 29 Jul 2005 21:55:49 +0000 |
parents | a5e44c6e40dd |
children | 8feebb438ade |
files | network.c network_server.c network_server.h |
diffstat | 3 files changed, 10 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/network.c +++ b/network.c @@ -1205,8 +1205,15 @@ 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 @@ _sync_seed_2 = _random_seeds[0][1]; #endif - NetworkServer_Tick(); + NetworkServer_Tick(send_frame); } else { // Client
--- a/network_server.c +++ b/network_server.c @@ -1499,20 +1499,13 @@ } // 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;
--- a/network_server.h +++ b/network_server.h @@ -16,7 +16,7 @@ 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);