Merge branch 'master' into jgrpp
Remove the viewport sign cache as this is now superseded by the kd tree implementation # Conflicts: # src/crashlog.cpp # src/lang/english.txt # src/misc.cpp # src/pathfinder/follow_track.hpp # src/pbs.cpp # src/rail_cmd.cpp # src/saveload/vehicle_sl.cpp # src/settings.cpp # src/settings_gui.cpp # src/ship_cmd.cpp # src/station.cpp # src/station_base.h # src/station_cmd.cpp # src/table/settings.ini # src/thread/thread_morphos.cpp # src/town_cmd.cpp # src/train_cmd.cpp # src/viewport.cpp # src/waypoint.cpp
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "../network/network_func.h"
|
||||
#include "../gfxinit.h"
|
||||
#include "../viewport_func.h"
|
||||
#include "../viewport_kdtree.h"
|
||||
#include "../industry.h"
|
||||
#include "../clear_map.h"
|
||||
#include "../vehicle_func.h"
|
||||
@@ -228,6 +229,7 @@ void UpdateAllVirtCoords()
|
||||
UpdateAllStationVirtCoords();
|
||||
UpdateAllSignVirtCoords();
|
||||
UpdateAllTownVirtCoords();
|
||||
RebuildViewportKdtree();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -292,7 +294,6 @@ static void InitializeWindowsAndCaches()
|
||||
|
||||
GroupStatistics::UpdateAfterLoad();
|
||||
|
||||
Station::RecomputeIndustriesNearForAll();
|
||||
RebuildSubsidisedSourceAndDestinationCache();
|
||||
|
||||
/* Towns have a noise controlled number of airports system
|
||||
@@ -605,6 +606,12 @@ bool AfterLoadGame()
|
||||
GamelogTestRevision();
|
||||
GamelogTestMode();
|
||||
|
||||
RebuildTownKdtree();
|
||||
RebuildStationKdtree();
|
||||
/* This needs to be done even before conversion, because some conversions will destroy objects
|
||||
* that otherwise won't exist in the tree. */
|
||||
RebuildViewportKdtree();
|
||||
|
||||
if (IsSavegameVersionBefore(SLV_98)) GamelogGRFAddList(_grfconfig);
|
||||
|
||||
if (IsSavegameVersionBefore(SLV_119)) {
|
||||
@@ -3529,6 +3536,33 @@ bool AfterLoadGame()
|
||||
}
|
||||
}
|
||||
|
||||
if (IsSavegameVersionBefore(SLV_TOWN_CARGOGEN)) {
|
||||
/* Ensure the original cargo generation mode is used */
|
||||
_settings_game.economy.town_cargogen_mode = TCGM_ORIGINAL;
|
||||
}
|
||||
|
||||
if (IsSavegameVersionBefore(SLV_SERVE_NEUTRAL_INDUSTRIES)) {
|
||||
/* Ensure the original neutral industry/station behaviour is used */
|
||||
_settings_game.station.serve_neutral_industries = true;
|
||||
|
||||
/* Link oil rigs to their industry and back. */
|
||||
Station *st;
|
||||
FOR_ALL_STATIONS(st) {
|
||||
if (IsTileType(st->xy, MP_STATION) && IsOilRig(st->xy)) {
|
||||
/* Industry tile is always adjacent during construction by TileDiffXY(0, 1) */
|
||||
st->industry = Industry::GetByTile(st->xy + TileDiffXY(0, 1));
|
||||
st->industry->neutral_station = st;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Link neutral station back to industry, as this is not saved. */
|
||||
Industry *ind;
|
||||
FOR_ALL_INDUSTRIES(ind) if (ind->neutral_station != NULL) ind->neutral_station->industry = ind;
|
||||
}
|
||||
|
||||
/* Compute station catchment areas. This is needed here in case UpdateStationAcceptance is called below. */
|
||||
Station::RecomputeCatchmentForAll();
|
||||
|
||||
/* Station acceptance is some kind of cache */
|
||||
if (IsSavegameVersionBefore(SLV_127)) {
|
||||
Station *st;
|
||||
|
@@ -25,6 +25,7 @@ static const SaveLoad _industry_desc[] = {
|
||||
SLE_VAR(Industry, location.w, SLE_FILE_U8 | SLE_VAR_U16),
|
||||
SLE_VAR(Industry, location.h, SLE_FILE_U8 | SLE_VAR_U16),
|
||||
SLE_REF(Industry, town, REF_TOWN),
|
||||
SLE_CONDREF(Industry, neutral_station, REF_STATION, SLV_SERVE_NEUTRAL_INDUSTRIES, SL_MAX_VERSION),
|
||||
SLE_CONDNULL( 2, SL_MIN_VERSION, SLV_61), ///< used to be industry's produced_cargo
|
||||
SLE_CONDARR(Industry, produced_cargo, SLE_UINT8, 2, SLV_78, SLV_EXTEND_INDUSTRY_CARGO_SLOTS),
|
||||
SLE_CONDARR(Industry, produced_cargo, SLE_UINT8, 16, SLV_EXTEND_INDUSTRY_CARGO_SLOTS, SL_MAX_VERSION),
|
||||
|
@@ -2426,7 +2426,7 @@ struct ZlibSaveFilter : SaveFilter {
|
||||
********** START OF LZMA CODE **************
|
||||
********************************************/
|
||||
|
||||
#if defined(WITH_LZMA)
|
||||
#if defined(WITH_LIBLZMA)
|
||||
#include <lzma.h>
|
||||
|
||||
/**
|
||||
@@ -2539,7 +2539,7 @@ struct LZMASaveFilter : SaveFilter {
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* WITH_LZMA */
|
||||
#endif /* WITH_LIBLZMA */
|
||||
|
||||
/*******************************************
|
||||
************* END OF CODE *****************
|
||||
@@ -2576,7 +2576,7 @@ static const SaveLoadFormat _saveload_formats[] = {
|
||||
#else
|
||||
{"zlib", TO_BE32X('OTTZ'), NULL, NULL, 0, 0, 0},
|
||||
#endif
|
||||
#if defined(WITH_LZMA)
|
||||
#if defined(WITH_LIBLZMA)
|
||||
/* Level 2 compression is speed wise as fast as zlib level 6 compression (old default), but results in ~10% smaller saves.
|
||||
* Higher compression levels are possible, and might improve savegame size by up to 25%, but are also up to 10 times slower.
|
||||
* The next significant reduction in file size is at level 4, but that is already 4 times slower. Level 3 is primarily 50%
|
||||
|
@@ -294,6 +294,11 @@ enum SaveLoadVersion : uint16 {
|
||||
SLV_GROUP_LIVERIES, ///< 205 PR#7108 Livery storage change and group liveries.
|
||||
SLV_SHIPS_STOP_IN_LOCKS, ///< 206 PR#7150 Ship/lock movement changes.
|
||||
SLV_FIX_CARGO_MONITOR, ///< 207 PR#7175 v1.9 Cargo monitor data packing fix to support 64 cargotypes.
|
||||
SLV_TOWN_CARGOGEN, ///< 208 PR#6965 New algorithms for town building cargo generation.
|
||||
SLV_SHIP_CURVE_PENALTY, ///< 209 PR#7289 Configurable ship curve penalties.
|
||||
|
||||
SLV_SERVE_NEUTRAL_INDUSTRIES, ///< 210 PR#7234 Company stations can serve industries with attached neutral stations.
|
||||
SLV_ROADVEH_PATH_CACHE, ///< 211 PR#7261 Add path cache for road vehicles.
|
||||
|
||||
SL_MAX_VERSION, ///< Highest possible saveload version
|
||||
};
|
||||
|
@@ -28,6 +28,7 @@ void RebuildTownCaches()
|
||||
{
|
||||
Town *town;
|
||||
InitializeBuildingCounts();
|
||||
RebuildTownKdtree();
|
||||
|
||||
/* Reset town population and num_houses */
|
||||
FOR_ALL_TOWNS(town) {
|
||||
|
@@ -790,22 +790,24 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
|
||||
static const SaveLoad _roadveh_desc[] = {
|
||||
SLE_WRITEBYTE(Vehicle, type),
|
||||
SLE_VEH_INCLUDE(),
|
||||
SLE_VAR(RoadVehicle, state, SLE_UINT8),
|
||||
SLE_VAR(RoadVehicle, frame, SLE_UINT8),
|
||||
SLE_VAR(RoadVehicle, blocked_ctr, SLE_UINT16),
|
||||
SLE_VAR(RoadVehicle, overtaking, SLE_UINT8),
|
||||
SLE_VAR(RoadVehicle, overtaking_ctr, SLE_UINT8),
|
||||
SLE_VAR(RoadVehicle, crashed_ctr, SLE_UINT16),
|
||||
SLE_VAR(RoadVehicle, reverse_ctr, SLE_UINT8),
|
||||
SLE_VAR(RoadVehicle, state, SLE_UINT8),
|
||||
SLE_VAR(RoadVehicle, frame, SLE_UINT8),
|
||||
SLE_VAR(RoadVehicle, blocked_ctr, SLE_UINT16),
|
||||
SLE_VAR(RoadVehicle, overtaking, SLE_UINT8),
|
||||
SLE_VAR(RoadVehicle, overtaking_ctr, SLE_UINT8),
|
||||
SLE_VAR(RoadVehicle, crashed_ctr, SLE_UINT16),
|
||||
SLE_VAR(RoadVehicle, reverse_ctr, SLE_UINT8),
|
||||
SLE_CONDDEQUE(RoadVehicle, path.td, SLE_UINT8, SLV_ROADVEH_PATH_CACHE, SL_MAX_VERSION),
|
||||
SLE_CONDDEQUE(RoadVehicle, path.tile, SLE_UINT32, SLV_ROADVEH_PATH_CACHE, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDNULL(2, SLV_6, SLV_69),
|
||||
SLE_CONDVAR(RoadVehicle, gv_flags, SLE_UINT16, SLV_139, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(4, SLV_69, SLV_131),
|
||||
SLE_CONDNULL(2, SLV_6, SLV_131),
|
||||
SLE_CONDNULL(16, SLV_2, SLV_144), // old reserved space
|
||||
SLE_CONDVAR_X(RoadVehicle, critical_breakdown_count, SLE_UINT8, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_IMPROVED_BREAKDOWNS, 6)),
|
||||
SLE_CONDNULL(2, SLV_6, SLV_69),
|
||||
SLE_CONDVAR(RoadVehicle, gv_flags, SLE_UINT16, SLV_139, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(4, SLV_69, SLV_131),
|
||||
SLE_CONDNULL(2, SLV_6, SLV_131),
|
||||
SLE_CONDNULL(16, SLV_2, SLV_144), // old reserved space
|
||||
SLE_CONDVAR_X(RoadVehicle, critical_breakdown_count, SLE_UINT8, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_IMPROVED_BREAKDOWNS, 6)),
|
||||
|
||||
SLE_END()
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
static const SaveLoad _ship_desc[] = {
|
||||
|
Reference in New Issue
Block a user