Merge branch 'master' into jgrpp

# Conflicts:
#	src/network/network.cpp
#	src/pathfinder/yapf/yapf.h
#	src/pathfinder/yapf/yapf_ship.cpp
#	src/saveload/afterload.cpp
#	src/ship_cmd.cpp
#	src/station_cmd.cpp
#	src/vehicle.cpp
#	src/vehicle_gui.cpp
This commit is contained in:
Jonathan G Rennison
2024-07-06 18:24:39 +01:00
91 changed files with 438 additions and 401 deletions

View File

@@ -41,16 +41,22 @@
#include "../core/serialisation.hpp"
#include "../3rdparty/monocypher/monocypher.h"
#include "../settings_internal.h"
#ifdef DEBUG_DUMP_COMMANDS
# include "../fileio_func.h"
# include "../command_aux.h"
# include "../3rdparty/nlohmann/json.hpp"
# include <charconv>
#endif
#include <sstream>
#include <iomanip>
#include <tuple>
#ifdef DEBUG_DUMP_COMMANDS
#include "../fileio_func.h"
#include "../command_aux.h"
#include "../3rdparty/nlohmann/json.hpp"
#include <charconv>
/** When running the server till the wait point, run as fast as we can! */
/** 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.md for details. */
bool _ddc_fastforward = true;
#endif /* DEBUG_DUMP_COMMANDS */
@@ -1238,7 +1244,7 @@ void NetworkGameLoop()
}
while (f != nullptr && !feof(f)) {
if (EconTime::CurDate() == next_date && EconTime::CurDateFract() == next_date_fract) {
if (EconTime::CurDate() == next_date && EconTime::CurDateFract() == next_date_fract && TickSkipCounter() == next_tick_skip_counter) {
if (cp != nullptr) {
NetworkSendCommand(cp->tile, cp->p1, cp->p2, cp->p3, cp->cmd & ~CMD_FLAGS_MASK, nullptr, cp->text.c_str(), cp->company, cp->aux_data.get());
DEBUG(net, 0, "injecting: %s; %02x; %06x; %08x; %08x; " OTTD_PRINTFHEX64PAD " %08x; \"%s\"%s (%s)",
@@ -1257,6 +1263,13 @@ void NetworkGameLoop()
}
}
/* Skip all entries in the command-log till we caught up with the current game again. */
if (std::make_tuple(EconTime::CurDate(), EconTime::CurDateFract(), TickSkipCounter()) > std::make_tuple(next_date, next_date_fract, next_tick_skip_counter)) {
DEBUG(net, 0, "Skipping to next command at %s", debug_date_dumper().HexDate(next_date, next_date_fract, next_tick_skip_counter));
cp.reset();
check_sync_state = false;
}
if (cp != nullptr || check_sync_state) break;
static char buff[65536];

View File

@@ -12,7 +12,7 @@
/**
* Uncomment the following define to enable command replaying.
* See docs/desync.txt for details.
* See docs/desync.md for details.
*/
// #define DEBUG_DUMP_COMMANDS
// #define DEBUG_FAILED_DUMP_COMMANDS

View File

@@ -36,19 +36,6 @@ static const uint32_t FIND_SERVER_EXTENDED_TOKEN = 0x2A49582A;
#define ENABLE_NETWORK_SYNC_EVERY_FRAME
#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;
/** Status of the clients during joining. */