Merge branch 'jgrpp' into jgrpp-nrt

# Conflicts:
#	.ottdrev-vc
#	README.md
#	jgrpp-changelog.md
This commit is contained in:
Jonathan G Rennison
2019-08-29 01:01:45 +01:00
17 changed files with 104 additions and 18 deletions

View File

@@ -2,15 +2,14 @@
* * * * * *
### v0.31.5 (2019-08-29)
* Fix multiplayer desync when when moving newly built wagon
### v0.32-rc2 (2019-08-24) ### v0.32-rc2 (2019-08-24)
* Fix crash when using query tool on non-road bridges. * Fix crash when using query tool on non-road bridges.
* Fix road vehicles not being limited by the road type max speed. * Fix road vehicles not being limited by the road type max speed.
* Bump trunk base from commit a52bbb72a8a2cbcbefb0ff91b559f33c34094239 to commit dabccf70b4c02f68ebf51aca807376ca4f2a0e15. * Bump trunk base from commit a52bbb72a8a2cbcbefb0ff91b559f33c34094239 to commit dabccf70b4c02f68ebf51aca807376ca4f2a0e15.
### v0.32-rc1 (2019-07-13)
* Include NotRoadTypes (NRT).
* Bump trunk base from commit 21edf67f89c60351d5a0d84625455aa296b6b950 to commit a52bbb72a8a2cbcbefb0ff91b559f33c34094239.
### v0.31.4 (2019-08-24) ### v0.31.4 (2019-08-24)
* Fix crash when removing signals from tunnel/bridge with trainless reservation. * Fix crash when removing signals from tunnel/bridge with trainless reservation.
* Fix various cases where reversing a train inside a signalled tunnel/bridge handled PBS reservations incorrectly. * Fix various cases where reversing a train inside a signalled tunnel/bridge handled PBS reservations incorrectly.
@@ -20,6 +19,10 @@
* Change network protocol to send server/join and rcon passwords in hashed form instead of in clear text. * Change network protocol to send server/join and rcon passwords in hashed form instead of in clear text.
* Fix various possible sources of non-determinism which could potentially cause multiplayer desyncs. * Fix various possible sources of non-determinism which could potentially cause multiplayer desyncs.
### v0.32-rc1 (2019-07-13)
* Include NotRoadTypes (NRT).
* Bump trunk base from commit 21edf67f89c60351d5a0d84625455aa296b6b950 to commit a52bbb72a8a2cbcbefb0ff91b559f33c34094239.
### v0.31.3 (2019-07-13) ### v0.31.3 (2019-07-13)
* Fix the target order number of conditional order jumps being loaded incorrectly from SpringPP savegames. * Fix the target order number of conditional order jumps being loaded incorrectly from SpringPP savegames.
* Fix order backups not being restored when using buy and refit. * Fix order backups not being restored when using buy and refit.

View File

@@ -492,6 +492,7 @@
<ClInclude Include="..\src\date_gui.h" /> <ClInclude Include="..\src\date_gui.h" />
<ClInclude Include="..\src\date_type.h" /> <ClInclude Include="..\src\date_type.h" />
<ClInclude Include="..\src\debug.h" /> <ClInclude Include="..\src\debug.h" />
<ClInclude Include="..\src\debug_settings.h" />
<ClInclude Include="..\src\video\dedicated_v.h" /> <ClInclude Include="..\src\video\dedicated_v.h" />
<ClInclude Include="..\src\departures_func.h" /> <ClInclude Include="..\src\departures_func.h" />
<ClInclude Include="..\src\departures_gui.h" /> <ClInclude Include="..\src\departures_gui.h" />
@@ -754,6 +755,7 @@
<ClInclude Include="..\src\core\backup_type.hpp" /> <ClInclude Include="..\src\core\backup_type.hpp" />
<ClCompile Include="..\src\core\bitmath_func.cpp" /> <ClCompile Include="..\src\core\bitmath_func.cpp" />
<ClInclude Include="..\src\core\bitmath_func.hpp" /> <ClInclude Include="..\src\core\bitmath_func.hpp" />
<ClInclude Include="..\src\core\checksum_func.hpp" />
<ClInclude Include="..\src\core\container_func.hpp" /> <ClInclude Include="..\src\core\container_func.hpp" />
<ClInclude Include="..\src\core\dyn_arena_alloc.hpp" /> <ClInclude Include="..\src\core\dyn_arena_alloc.hpp" />
<ClInclude Include="..\src\core\endian_func.hpp" /> <ClInclude Include="..\src\core\endian_func.hpp" />

View File

@@ -570,6 +570,9 @@
<ClInclude Include="..\src\debug.h"> <ClInclude Include="..\src\debug.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\src\debug_settings.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\video\dedicated_v.h"> <ClInclude Include="..\src\video\dedicated_v.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
@@ -1356,6 +1359,9 @@
<ClInclude Include="..\src\core\bitmath_func.hpp"> <ClInclude Include="..\src\core\bitmath_func.hpp">
<Filter>Core Source Code</Filter> <Filter>Core Source Code</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\src\core\checksum_func.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
<ClInclude Include="..\src\core\container_func.hpp"> <ClInclude Include="..\src\core\container_func.hpp">
<Filter>Core Source Code</Filter> <Filter>Core Source Code</Filter>
</ClInclude> </ClInclude>

View File

@@ -492,6 +492,7 @@
<ClInclude Include="..\src\date_gui.h" /> <ClInclude Include="..\src\date_gui.h" />
<ClInclude Include="..\src\date_type.h" /> <ClInclude Include="..\src\date_type.h" />
<ClInclude Include="..\src\debug.h" /> <ClInclude Include="..\src\debug.h" />
<ClInclude Include="..\src\debug_settings.h" />
<ClInclude Include="..\src\video\dedicated_v.h" /> <ClInclude Include="..\src\video\dedicated_v.h" />
<ClInclude Include="..\src\departures_func.h" /> <ClInclude Include="..\src\departures_func.h" />
<ClInclude Include="..\src\departures_gui.h" /> <ClInclude Include="..\src\departures_gui.h" />
@@ -754,6 +755,7 @@
<ClInclude Include="..\src\core\backup_type.hpp" /> <ClInclude Include="..\src\core\backup_type.hpp" />
<ClCompile Include="..\src\core\bitmath_func.cpp" /> <ClCompile Include="..\src\core\bitmath_func.cpp" />
<ClInclude Include="..\src\core\bitmath_func.hpp" /> <ClInclude Include="..\src\core\bitmath_func.hpp" />
<ClInclude Include="..\src\core\checksum_func.hpp" />
<ClInclude Include="..\src\core\container_func.hpp" /> <ClInclude Include="..\src\core\container_func.hpp" />
<ClInclude Include="..\src\core\dyn_arena_alloc.hpp" /> <ClInclude Include="..\src\core\dyn_arena_alloc.hpp" />
<ClInclude Include="..\src\core\endian_func.hpp" /> <ClInclude Include="..\src\core\endian_func.hpp" />

View File

@@ -570,6 +570,9 @@
<ClInclude Include="..\src\debug.h"> <ClInclude Include="..\src\debug.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\src\debug_settings.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\video\dedicated_v.h"> <ClInclude Include="..\src\video\dedicated_v.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
@@ -1356,6 +1359,9 @@
<ClInclude Include="..\src\core\bitmath_func.hpp"> <ClInclude Include="..\src\core\bitmath_func.hpp">
<Filter>Core Source Code</Filter> <Filter>Core Source Code</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\src\core\checksum_func.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
<ClInclude Include="..\src\core\container_func.hpp"> <ClInclude Include="..\src\core\container_func.hpp">
<Filter>Core Source Code</Filter> <Filter>Core Source Code</Filter>
</ClInclude> </ClInclude>

View File

@@ -492,6 +492,7 @@
<ClInclude Include="..\src\date_gui.h" /> <ClInclude Include="..\src\date_gui.h" />
<ClInclude Include="..\src\date_type.h" /> <ClInclude Include="..\src\date_type.h" />
<ClInclude Include="..\src\debug.h" /> <ClInclude Include="..\src\debug.h" />
<ClInclude Include="..\src\debug_settings.h" />
<ClInclude Include="..\src\video\dedicated_v.h" /> <ClInclude Include="..\src\video\dedicated_v.h" />
<ClInclude Include="..\src\departures_func.h" /> <ClInclude Include="..\src\departures_func.h" />
<ClInclude Include="..\src\departures_gui.h" /> <ClInclude Include="..\src\departures_gui.h" />
@@ -754,6 +755,7 @@
<ClInclude Include="..\src\core\backup_type.hpp" /> <ClInclude Include="..\src\core\backup_type.hpp" />
<ClCompile Include="..\src\core\bitmath_func.cpp" /> <ClCompile Include="..\src\core\bitmath_func.cpp" />
<ClInclude Include="..\src\core\bitmath_func.hpp" /> <ClInclude Include="..\src\core\bitmath_func.hpp" />
<ClInclude Include="..\src\core\checksum_func.hpp" />
<ClInclude Include="..\src\core\container_func.hpp" /> <ClInclude Include="..\src\core\container_func.hpp" />
<ClInclude Include="..\src\core\dyn_arena_alloc.hpp" /> <ClInclude Include="..\src\core\dyn_arena_alloc.hpp" />
<ClInclude Include="..\src\core\endian_func.hpp" /> <ClInclude Include="..\src\core\endian_func.hpp" />

View File

@@ -570,6 +570,9 @@
<ClInclude Include="..\src\debug.h"> <ClInclude Include="..\src\debug.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\src\debug_settings.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\video\dedicated_v.h"> <ClInclude Include="..\src\video\dedicated_v.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
@@ -1356,6 +1359,9 @@
<ClInclude Include="..\src\core\bitmath_func.hpp"> <ClInclude Include="..\src\core\bitmath_func.hpp">
<Filter>Core Source Code</Filter> <Filter>Core Source Code</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\src\core\checksum_func.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
<ClInclude Include="..\src\core\container_func.hpp"> <ClInclude Include="..\src\core\container_func.hpp">
<Filter>Core Source Code</Filter> <Filter>Core Source Code</Filter>
</ClInclude> </ClInclude>

View File

@@ -180,6 +180,7 @@ date_func.h
date_gui.h date_gui.h
date_type.h date_type.h
debug.h debug.h
debug_settings.h
video/dedicated_v.h video/dedicated_v.h
departures_func.h departures_func.h
departures_gui.h departures_gui.h

View File

@@ -227,6 +227,10 @@ char *CrashLog::LogConfiguration(char *buffer, const char *last) const
buffer += seprintf(buffer, last, "Map size: 0x%X (%u x %u)%s\n\n", MapSize(), MapSizeX(), MapSizeY(), (!_m || !_me) ? ", NO MAP ALLOCATED" : ""); buffer += seprintf(buffer, last, "Map size: 0x%X (%u x %u)%s\n\n", MapSize(), MapSizeX(), MapSizeY(), (!_m || !_me) ? ", NO MAP ALLOCATED" : "");
if (_settings_game.debug.chicken_bits != 0) {
buffer += seprintf(buffer, last, "Chicken bits: 0x%08X\n\n", _settings_game.debug.chicken_bits);
}
buffer += seprintf(buffer, last, "AI Configuration (local: %i) (current: %i):\n", (int)_local_company, (int)_current_company); buffer += seprintf(buffer, last, "AI Configuration (local: %i) (current: %i):\n", (int)_local_company, (int)_current_company);
const Company *c; const Company *c;
FOR_ALL_COMPANIES(c) { FOR_ALL_COMPANIES(c) {

28
src/debug_settings.h Normal file
View File

@@ -0,0 +1,28 @@
/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file debug_settings.h Debug settings. */
#ifndef DEBUG_SETTINGS_H
#define DEBUG_SETTINGS_H
#include "settings_type.h"
#include "core/bitmath_func.hpp"
enum ChickenBitFlags {
DCBF_VEH_TICK_CACHE = 0,
DCBF_MP_NO_STATE_CSUM_CHECK = 1,
};
inline bool HasChickenBit(ChickenBitFlags flag)
{
return HasBit(_settings_game.debug.chicken_bits, flag);
}
#endif /* DEBUG_SETTINGS_H */

View File

@@ -34,6 +34,7 @@
#include "../crashlog.h" #include "../crashlog.h"
#include "../core/checksum_func.hpp" #include "../core/checksum_func.hpp"
#include "../fileio_func.h" #include "../fileio_func.h"
#include "../debug_settings.h"
#include "table/strings.h" #include "table/strings.h"
@@ -302,9 +303,9 @@ void ClientNetworkGameSocketHandler::ClientError(NetworkRecvStatus res)
if (_sync_frame != 0) { if (_sync_frame != 0) {
if (_sync_frame == _frame_counter) { if (_sync_frame == _frame_counter) {
#ifdef NETWORK_SEND_DOUBLE_SEED #ifdef NETWORK_SEND_DOUBLE_SEED
if (_sync_seed_1 != _random.state[0] || _sync_seed_2 != _random.state[1] || _sync_state_checksum != _state_checksum.state) { if (_sync_seed_1 != _random.state[0] || _sync_seed_2 != _random.state[1] || (_sync_state_checksum != _state_checksum.state && !HasChickenBit(DCBF_MP_NO_STATE_CSUM_CHECK))) {
#else #else
if (_sync_seed_1 != _random.state[0] || _sync_state_checksum != _state_checksum.state) { if (_sync_seed_1 != _random.state[0] || (_sync_state_checksum != _state_checksum.state && !HasChickenBit(DCBF_MP_NO_STATE_CSUM_CHECK))) {
#endif #endif
DesyncExtraInfo info; DesyncExtraInfo info;
if (_sync_seed_1 != _random.state[0]) info.flags |= DesyncExtraInfo::DEIF_RAND1; if (_sync_seed_1 != _random.state[0]) info.flags |= DesyncExtraInfo::DEIF_RAND1;

View File

@@ -80,23 +80,13 @@ void ClearOrderDestinationRefcountMap()
_order_destination_refcount_map_valid = false; _order_destination_refcount_map_valid = false;
} }
static void UpdateOrderDestinationRefcount(const Order *order, VehicleType type, Owner owner, int delta) void UpdateOrderDestinationRefcount(const Order *order, VehicleType type, Owner owner, int delta)
{ {
if (order->IsType(OT_GOTO_STATION) || order->IsType(OT_GOTO_WAYPOINT) || order->IsType(OT_IMPLICIT)) { if (order->IsType(OT_GOTO_STATION) || order->IsType(OT_GOTO_WAYPOINT) || order->IsType(OT_IMPLICIT)) {
_order_destination_refcount_map[OrderDestinationRefcountMapKey(order->GetDestination(), owner, order->GetType(), type)] += delta; _order_destination_refcount_map[OrderDestinationRefcountMapKey(order->GetDestination(), owner, order->GetType(), type)] += delta;
} }
} }
inline void RegisterOrderDestination(const Order *order, VehicleType type, Owner owner)
{
if (_order_destination_refcount_map_valid) UpdateOrderDestinationRefcount(order, type, owner, 1);
}
inline void UnregisterOrderDestination(const Order *order, VehicleType type, Owner owner)
{
if (_order_destination_refcount_map_valid) UpdateOrderDestinationRefcount(order, type, owner, -1);
}
/** Clean everything up. */ /** Clean everything up. */
Order::~Order() Order::~Order()
{ {

View File

@@ -16,6 +16,18 @@
#include "order_func.h" #include "order_func.h"
#include "vehicle_base.h" #include "vehicle_base.h"
void UpdateOrderDestinationRefcount(const Order *order, VehicleType type, Owner owner, int delta);
inline void RegisterOrderDestination(const Order *order, VehicleType type, Owner owner)
{
if (_order_destination_refcount_map_valid) UpdateOrderDestinationRefcount(order, type, owner, 1);
}
inline void UnregisterOrderDestination(const Order *order, VehicleType type, Owner owner)
{
if (_order_destination_refcount_map_valid) UpdateOrderDestinationRefcount(order, type, owner, -1);
}
/** /**
* Removes all orders from a vehicle for which order_predicate returns true. * Removes all orders from a vehicle for which order_predicate returns true.
* Handles timetable updating, removing implicit orders correctly, etc. * Handles timetable updating, removing implicit orders correctly, etc.
@@ -41,6 +53,8 @@ restart:
break; break;
} }
UnregisterOrderDestination(order, v->type, v->owner);
/* Clear wait time */ /* Clear wait time */
if (!order->IsType(OT_CONDITIONAL)) v->orders.list->UpdateTotalDuration(-order->GetWaitTime()); if (!order->IsType(OT_CONDITIONAL)) v->orders.list->UpdateTotalDuration(-order->GetWaitTime());
if (order->IsWaitTimetabled()) { if (order->IsWaitTimetabled()) {

View File

@@ -643,6 +643,11 @@ struct CompanySettings {
bool advance_order_on_clone; ///< when cloning a vehicle or copying/sharing an order list, advance the current order to a suitable point bool advance_order_on_clone; ///< when cloning a vehicle or copying/sharing an order list, advance the current order to a suitable point
}; };
/** Debug settings. */
struct DebugSettings {
uint32 chicken_bits; ///< chicken bits
};
/** All settings together for the game. */ /** All settings together for the game. */
struct GameSettings { struct GameSettings {
DifficultySettings difficulty; ///< settings related to the difficulty DifficultySettings difficulty; ///< settings related to the difficulty
@@ -659,6 +664,7 @@ struct GameSettings {
LinkGraphSettings linkgraph; ///< settings for link graph calculations LinkGraphSettings linkgraph; ///< settings for link graph calculations
StationSettings station; ///< settings related to station management StationSettings station; ///< settings related to station management
LocaleSettings locale; ///< settings related to used currency/unit system in the current game LocaleSettings locale; ///< settings related to used currency/unit system in the current game
DebugSettings debug; ///< debug settings
}; };
/** All settings that are only important for the local client. */ /** All settings that are only important for the local client. */

View File

@@ -5299,5 +5299,17 @@ cat = SC_EXPERT
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_VEHICLE_REPAIR_COST) extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_VEHICLE_REPAIR_COST)
patxname = ""vehicle_repair_cost.vehicle.repair_cost"" patxname = ""vehicle_repair_cost.vehicle.repair_cost""
[SDT_VAR]
base = GameSettings
var = debug.chicken_bits
type = SLE_UINT32
flags = SLF_NOT_IN_CONFIG
guiflags = SGF_NO_NEWGAME
def = 0
min = 0
max = 0xFFFFFFFF
cat = SC_EXPERT
patxname = ""debug.chicken_bits""
[SDT_END] [SDT_END]

View File

@@ -869,6 +869,8 @@ static CommandCost CmdBuildRailWagon(TileIndex tile, DoCommandFlag flags, const
break; break;
} }
} }
InvalidateVehicleTickCaches();
} }
return CommandCost(); return CommandCost();

View File

@@ -59,6 +59,7 @@
#include "tbtr_template_vehicle_func.h" #include "tbtr_template_vehicle_func.h"
#include "string_func.h" #include "string_func.h"
#include "scope_info.h" #include "scope_info.h"
#include "debug_settings.h"
#include "3rdparty/cpp-btree/btree_set.h" #include "3rdparty/cpp-btree/btree_set.h"
#include "table/strings.h" #include "table/strings.h"
@@ -1273,7 +1274,7 @@ void CallVehicleTicks()
FOR_ALL_STATIONS(st) LoadUnloadStation(st); FOR_ALL_STATIONS(st) LoadUnloadStation(st);
} }
if (!_tick_caches_valid) RebuildVehicleTickCaches(); if (!_tick_caches_valid || HasChickenBit(DCBF_VEH_TICK_CACHE)) RebuildVehicleTickCaches();
Vehicle *v = nullptr; Vehicle *v = nullptr;
SCOPE_INFO_FMT([&v], "CallVehicleTicks: %s", scope_dumper().VehicleInfo(v)); SCOPE_INFO_FMT([&v], "CallVehicleTicks: %s", scope_dumper().VehicleInfo(v));