summaryrefslogtreecommitdiff
path: root/ttd.c
diff options
context:
space:
mode:
authorsignde <signde@openttd.org>2004-09-11 22:10:31 +0000
committersignde <signde@openttd.org>2004-09-11 22:10:31 +0000
commit34ecc0d7787523ad5d0f276fce5c562c71bcd6fb (patch)
tree9fe9145987d7dfd3c3ec017a53cf3141bf142996 /ttd.c
parent1c373cd0af8f5b5bbef28f01de2839ae66b6591c (diff)
downloadopenttd-34ecc0d7787523ad5d0f276fce5c562c71bcd6fb.tar.xz
(svn r209) -Fix: network code based desync
-Feature: framesync packets to hold the clients framecount near the servers -Fix: command queue now aligns the commands to be processed right after an sync or framesync packet -Fix: added stubs for compiling without network
Diffstat (limited to 'ttd.c')
-rw-r--r--ttd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ttd.c b/ttd.c
index 036cbb868..ffc747724 100644
--- a/ttd.c
+++ b/ttd.c
@@ -995,8 +995,10 @@ void GameLoop()
// client: make sure client's time is synched to the server by running frames quickly up to where the server is.
if (!_networking_server) {
while (_frame_counter < _frame_counter_srv) {
+ NetworkCoreLoop(true);
StateGameLoop();
NetworkProcessCommands(); // need to process queue to make sure that packets get executed.
+ NetworkCoreLoop(false);
}
// client: don't exceed the max count told by the server
if (_frame_counter < _frame_counter_max) {
@@ -1010,6 +1012,7 @@ void GameLoop()
if (_frame_counter < _frame_counter_max) {
StateGameLoop();
NetworkProcessCommands(); // to check if we got any new commands belonging to the current frame before we increase it.
+ NetworkSendFrameSyncPackets();
}
// server: wait until all clients were ready for going on
if (_frame_counter == _frame_counter_max) {