mirror of https://github.com/OpenTTD/OpenTTD
Codechange: use infinite-fast-forward when rerunning command-log (#12519)
parent
151e80650f
commit
cd6946c5a8
|
@ -37,6 +37,9 @@
|
||||||
#include "../gfx_func.h"
|
#include "../gfx_func.h"
|
||||||
#include "../error.h"
|
#include "../error.h"
|
||||||
#include "../misc_cmd.h"
|
#include "../misc_cmd.h"
|
||||||
|
#ifdef DEBUG_DUMP_COMMANDS
|
||||||
|
# include "../fileio_func.h"
|
||||||
|
#endif
|
||||||
#include <charconv>
|
#include <charconv>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
@ -44,8 +47,11 @@
|
||||||
#include "../safeguards.h"
|
#include "../safeguards.h"
|
||||||
|
|
||||||
#ifdef DEBUG_DUMP_COMMANDS
|
#ifdef DEBUG_DUMP_COMMANDS
|
||||||
#include "../fileio_func.h"
|
/** Helper variable to make the dedicated server go fast until the (first) join.
|
||||||
/** When running the server till the wait point, run as fast as we can! */
|
* Used to load the desync debug logs, i.e. for reproducing a desync.
|
||||||
|
* There's basically no need to ever enable this, unless you really know what
|
||||||
|
* you are doing, i.e. debugging a desync.
|
||||||
|
* See docs/desync.txt for details. */
|
||||||
bool _ddc_fastforward = true;
|
bool _ddc_fastforward = true;
|
||||||
#endif /* DEBUG_DUMP_COMMANDS */
|
#endif /* DEBUG_DUMP_COMMANDS */
|
||||||
|
|
||||||
|
|
|
@ -37,19 +37,6 @@
|
||||||
#define NETWORK_SEND_DOUBLE_SEED
|
#define NETWORK_SEND_DOUBLE_SEED
|
||||||
#endif /* RANDOM_DEBUG */
|
#endif /* RANDOM_DEBUG */
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper variable to make the dedicated server go fast until the (first) join.
|
|
||||||
* Used to load the desync debug logs, i.e. for reproducing a desync.
|
|
||||||
* There's basically no need to ever enable this, unless you really know what
|
|
||||||
* you are doing, i.e. debugging a desync.
|
|
||||||
* See docs/desync.txt for details.
|
|
||||||
*/
|
|
||||||
#ifdef DEBUG_DUMP_COMMANDS
|
|
||||||
extern bool _ddc_fastforward;
|
|
||||||
#else
|
|
||||||
#define _ddc_fastforward (false)
|
|
||||||
#endif /* DEBUG_DUMP_COMMANDS */
|
|
||||||
|
|
||||||
typedef class ServerNetworkGameSocketHandler NetworkClientSocket;
|
typedef class ServerNetworkGameSocketHandler NetworkClientSocket;
|
||||||
|
|
||||||
/** Status of the clients during joining. */
|
/** Status of the clients during joining. */
|
||||||
|
|
|
@ -217,7 +217,6 @@ void VideoDriver_Dedicated::MainLoop()
|
||||||
if (!_dedicated_forks) DedicatedHandleKeyInput();
|
if (!_dedicated_forks) DedicatedHandleKeyInput();
|
||||||
this->DrainCommandQueue();
|
this->DrainCommandQueue();
|
||||||
|
|
||||||
ChangeGameSpeed(_ddc_fastforward);
|
|
||||||
this->Tick();
|
this->Tick();
|
||||||
this->SleepTillNextTick();
|
this->SleepTillNextTick();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "../gfx_func.h"
|
#include "../gfx_func.h"
|
||||||
#include "../settings_type.h"
|
#include "../settings_type.h"
|
||||||
#include "../zoom_type.h"
|
#include "../zoom_type.h"
|
||||||
|
#include "../network/network_func.h"
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
|
@ -311,6 +312,12 @@ protected:
|
||||||
|
|
||||||
std::chrono::steady_clock::duration GetGameInterval()
|
std::chrono::steady_clock::duration GetGameInterval()
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_DUMP_COMMANDS
|
||||||
|
/* When replaying, run as fast as we can. */
|
||||||
|
extern bool _ddc_fastforward;
|
||||||
|
if (_ddc_fastforward) return std::chrono::microseconds(0);
|
||||||
|
#endif /* DEBUG_DUMP_COMMANDS */
|
||||||
|
|
||||||
/* If we are paused, run on normal speed. */
|
/* If we are paused, run on normal speed. */
|
||||||
if (_pause_mode) return std::chrono::milliseconds(MILLISECONDS_PER_TICK);
|
if (_pause_mode) return std::chrono::milliseconds(MILLISECONDS_PER_TICK);
|
||||||
/* Infinite speed, as quickly as you can. */
|
/* Infinite speed, as quickly as you can. */
|
||||||
|
|
Loading…
Reference in New Issue