summaryrefslogtreecommitdiff
path: root/src/saveload/compat
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-06-07 11:35:21 +0200
committerPatric Stout <github@truebrain.nl>2021-07-02 22:21:58 +0200
commit3826703bc3807c8af7372b550760fcd8286b9a6c (patch)
treefdb2aa3b283050d4f9f94325e5df5794d851c124 /src/saveload/compat
parentcdb3dd0493749dd5c62378f318ea61bcb85f988f (diff)
downloadopenttd-3826703bc3807c8af7372b550760fcd8286b9a6c.tar.xz
Add: store headers for chunks with SL_STRUCTLIST
Diffstat (limited to 'src/saveload/compat')
-rw-r--r--src/saveload/compat/CMakeLists.txt3
-rw-r--r--src/saveload/compat/company_sl_compat.h129
-rw-r--r--src/saveload/compat/game_sl_compat.h12
-rw-r--r--src/saveload/compat/gamelog_sl_compat.h105
-rw-r--r--src/saveload/compat/linkgraph_sl_compat.h66
-rw-r--r--src/saveload/compat/station_sl_compat.h152
-rw-r--r--src/saveload/compat/town_sl_compat.h87
-rw-r--r--src/saveload/compat/vehicle_sl_compat.h207
8 files changed, 761 insertions, 0 deletions
diff --git a/src/saveload/compat/CMakeLists.txt b/src/saveload/compat/CMakeLists.txt
index 1737f9493..dc7c57e5c 100644
--- a/src/saveload/compat/CMakeLists.txt
+++ b/src/saveload/compat/CMakeLists.txt
@@ -4,6 +4,7 @@ add_files(
cargomonitor_sl_compat.h
cargopacket_sl_compat.h
cheat_sl_compat.h
+ company_sl_compat.h
depot_sl_compat.h
economy_sl_compat.h
engine_sl_compat.h
@@ -23,4 +24,6 @@ add_files(
storage_sl_compat.h
story_sl_compat.h
subsidy_sl_compat.h
+ town_sl_compat.h
+ vehicle_sl_compat.h
)
diff --git a/src/saveload/compat/company_sl_compat.h b/src/saveload/compat/company_sl_compat.h
new file mode 100644
index 000000000..9da01d3a4
--- /dev/null
+++ b/src/saveload/compat/company_sl_compat.h
@@ -0,0 +1,129 @@
+/*
+ * 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 company_sl_compat.h Loading of company chunks before table headers were added. */
+
+#ifndef SAVELOAD_COMPAT_COMPANY_H
+#define SAVELOAD_COMPAT_COMPANY_H
+
+#include "../saveload.h"
+
+/** Original field order for SlCompanyOldAIBuildRec. */
+const SaveLoadCompat _company_old_ai_buildrec_compat[] = {
+ SLC_NULL(2, SL_MIN_VERSION, SLV_6),
+ SLC_NULL(4, SLV_6, SLV_107),
+ SLC_NULL(2, SL_MIN_VERSION, SLV_6),
+ SLC_NULL(4, SLV_6, SLV_107),
+ SLC_NULL(8, SL_MIN_VERSION, SLV_107),
+};
+
+/** Original field order for SlCompanyOldAI. */
+const SaveLoadCompat _company_old_ai_compat[] = {
+ SLC_NULL(2, SL_MIN_VERSION, SLV_107),
+ SLC_NULL(2, SL_MIN_VERSION, SLV_13),
+ SLC_NULL(4, SLV_13, SLV_107),
+ SLC_NULL(8, SL_MIN_VERSION, SLV_107),
+ SLC_VAR("num_build_rec"),
+ SLC_NULL(3, SL_MIN_VERSION, SLV_107),
+
+ SLC_NULL(2, SL_MIN_VERSION, SLV_6),
+ SLC_NULL(4, SLV_6, SLV_107),
+ SLC_NULL(2, SL_MIN_VERSION, SLV_6),
+ SLC_NULL(4, SLV_6, SLV_107),
+ SLC_NULL(2, SL_MIN_VERSION, SLV_107),
+
+ SLC_NULL(2, SL_MIN_VERSION, SLV_6),
+ SLC_NULL(4, SLV_6, SLV_107),
+ SLC_NULL(2, SL_MIN_VERSION, SLV_6),
+ SLC_NULL(4, SLV_6, SLV_107),
+ SLC_NULL(2, SL_MIN_VERSION, SLV_107),
+
+ SLC_NULL(2, SL_MIN_VERSION, SLV_69),
+ SLC_NULL(4, SLV_69, SLV_107),
+
+ SLC_NULL(18, SL_MIN_VERSION, SLV_107),
+ SLC_NULL(20, SL_MIN_VERSION, SLV_107),
+ SLC_NULL(32, SL_MIN_VERSION, SLV_107),
+
+ SLC_NULL(64, SLV_2, SLV_107),
+ SLC_VAR("buildrec"),
+};
+
+/** Original field order for SlCompanySettings. */
+const SaveLoadCompat _company_settings_compat[] = {
+ SLC_NULL(512, SLV_16, SLV_19),
+ SLC_VAR("engine_renew_list"),
+ SLC_VAR("settings.engine_renew"),
+ SLC_VAR("settings.engine_renew_months"),
+ SLC_VAR("settings.engine_renew_money"),
+ SLC_VAR("settings.renew_keep_length"),
+ SLC_VAR("settings.vehicle.servint_ispercent"),
+ SLC_VAR("settings.vehicle.servint_trains"),
+ SLC_VAR("settings.vehicle.servint_roadveh"),
+ SLC_VAR("settings.vehicle.servint_aircraft"),
+ SLC_VAR("settings.vehicle.servint_ships"),
+ SLC_NULL(63, SLV_2, SLV_144),
+};
+
+/** Original field order for SlCompanyEconomy. */
+const SaveLoadCompat _company_economy_compat[] = {
+ SLC_VAR("income"),
+ SLC_VAR("expenses"),
+ SLC_VAR("company_value"),
+ SLC_VAR("delivered_cargo[NUM_CARGO - 1]"),
+ SLC_VAR("delivered_cargo"),
+ SLC_VAR("performance_history"),
+};
+
+/** Original field order for SlCompanyLiveries. */
+const SaveLoadCompat _company_liveries_compat[] = {
+ SLC_VAR("in_use"),
+ SLC_VAR("colour1"),
+ SLC_VAR("colour2"),
+};
+
+/** Original field order for company_desc. */
+const SaveLoadCompat _company_sl_compat[] = {
+ SLC_VAR("name_2"),
+ SLC_VAR("name_1"),
+ SLC_VAR("name"),
+ SLC_VAR("president_name_1"),
+ SLC_VAR("president_name_2"),
+ SLC_VAR("president_name"),
+ SLC_VAR("face"),
+ SLC_VAR("money"),
+ SLC_VAR("current_loan"),
+ SLC_VAR("colour"),
+ SLC_VAR("money_fraction"),
+ SLC_NULL(1, SL_MIN_VERSION, SLV_58),
+ SLC_VAR("block_preview"),
+ SLC_NULL(2, SL_MIN_VERSION, SLV_94),
+ SLC_NULL(4, SLV_94, SLV_170),
+ SLC_VAR("location_of_HQ"),
+ SLC_VAR("last_build_coordinate"),
+ SLC_VAR("inaugurated_year"),
+ SLC_VAR("share_owners"),
+ SLC_VAR("num_valid_stat_ent"),
+ SLC_VAR("months_of_bankruptcy"),
+ SLC_VAR("bankrupt_asked"),
+ SLC_VAR("bankrupt_timeout"),
+ SLC_VAR("bankrupt_value"),
+ SLC_VAR("yearly_expenses"),
+ SLC_VAR("is_ai"),
+ SLC_NULL(1, SLV_107, SLV_112),
+ SLC_NULL(1, SLV_4, SLV_100),
+ SLC_VAR("terraform_limit"),
+ SLC_VAR("clear_limit"),
+ SLC_VAR("tree_limit"),
+ SLC_VAR("settings"),
+ SLC_VAR("old_ai"),
+ SLC_VAR("cur_economy"),
+ SLC_VAR("old_economy"),
+ SLC_VAR("liveries"),
+};
+
+#endif /* SAVELOAD_COMPAT_COMPANY_H */
diff --git a/src/saveload/compat/game_sl_compat.h b/src/saveload/compat/game_sl_compat.h
index 204504e3b..cc05913d6 100644
--- a/src/saveload/compat/game_sl_compat.h
+++ b/src/saveload/compat/game_sl_compat.h
@@ -20,4 +20,16 @@ const SaveLoadCompat _game_script_sl_compat[] = {
SLC_VAR("is_random"),
};
+/** Original field order for SlGameLanguageString. */
+const SaveLoadCompat _game_language_string_sl_compat[] = {
+ SLC_VAR("string"),
+};
+
+/** Original field order for _game_language_desc. */
+const SaveLoadCompat _game_language_sl_compat[] = {
+ SLC_VAR("language"),
+ SLC_VAR("count"),
+ SLC_VAR("strings"),
+};
+
#endif /* SAVELOAD_COMPAT_GAME_H */
diff --git a/src/saveload/compat/gamelog_sl_compat.h b/src/saveload/compat/gamelog_sl_compat.h
new file mode 100644
index 000000000..f1298bf92
--- /dev/null
+++ b/src/saveload/compat/gamelog_sl_compat.h
@@ -0,0 +1,105 @@
+/*
+ * 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 gamelog_sl_compat.h Loading for gamelog chunks before table headers were added. */
+
+#ifndef SAVELOAD_COMPAT_GAMELOG_H
+#define SAVELOAD_COMPAT_GAMELOG_H
+
+#include "../saveload.h"
+
+/** Original field order for SlGamelogMode. */
+const SaveLoadCompat _gamelog_mode_sl_compat[] = {
+ SLC_VAR("mode.mode"),
+ SLC_VAR("mode.landscape"),
+};
+
+/** Original field order for SlGamelogRevision. */
+const SaveLoadCompat _gamelog_revision_sl_compat[] = {
+ SLC_VAR("revision.text"),
+ SLC_VAR("revision.newgrf"),
+ SLC_VAR("revision.slver"),
+ SLC_VAR("revision.modified"),
+};
+
+/** Original field order for SlGamelogOldver. */
+const SaveLoadCompat _gamelog_oldver_sl_compat[] = {
+ SLC_VAR("oldver.type"),
+ SLC_VAR("oldver.version"),
+};
+
+/** Original field order for SlGamelogSetting. */
+const SaveLoadCompat _gamelog_setting_sl_compat[] = {
+ SLC_VAR("setting.name"),
+ SLC_VAR("setting.oldval"),
+ SLC_VAR("setting.newval"),
+};
+
+/** Original field order for SlGamelogGrfadd. */
+const SaveLoadCompat _gamelog_grfadd_sl_compat[] = {
+ SLC_VAR("grfadd.grfid"),
+ SLC_VAR("grfadd.md5sum"),
+};
+
+/** Original field order for SlGamelogGrfrem. */
+const SaveLoadCompat _gamelog_grfrem_sl_compat[] = {
+ SLC_VAR("grfrem.grfid"),
+};
+
+/** Original field order for SlGamelogGrfcompat. */
+const SaveLoadCompat _gamelog_grfcompat_sl_compat[] = {
+ SLC_VAR("grfcompat.grfid"),
+ SLC_VAR("grfcompat.md5sum"),
+};
+
+/** Original field order for SlGamelogGrfparam. */
+const SaveLoadCompat _gamelog_grfparam_sl_compat[] = {
+ SLC_VAR("grfparam.grfid"),
+};
+
+/** Original field order for SlGamelogGrfmove. */
+const SaveLoadCompat _gamelog_grfmove_sl_compat[] = {
+ SLC_VAR("grfmove.grfid"),
+ SLC_VAR("grfmove.offset"),
+};
+
+/** Original field order for SlGamelogGrfbug. */
+const SaveLoadCompat _gamelog_grfbug_sl_compat[] = {
+ SLC_VAR("grfbug.data"),
+ SLC_VAR("grfbug.grfid"),
+ SLC_VAR("grfbug.bug"),
+};
+
+/** Original field order for SlGamelogEmergency. */
+const SaveLoadCompat _gamelog_emergency_sl_compat[] = {
+ SLC_VAR("is_emergency_save"),
+};
+
+/** Original field order for SlGamelogAction. */
+const SaveLoadCompat _gamelog_action_sl_compat[] = {
+ SLC_VAR("ct"),
+ SLC_VAR("mode"),
+ SLC_VAR("revision"),
+ SLC_VAR("oldver"),
+ SLC_VAR("setting"),
+ SLC_VAR("grfadd"),
+ SLC_VAR("grfrem"),
+ SLC_VAR("grfcompat"),
+ SLC_VAR("grfparam"),
+ SLC_VAR("grfmove"),
+ SLC_VAR("grfbug"),
+ SLC_VAR("emergency"),
+};
+
+/** Original field order for _gamelog_desc. */
+const SaveLoadCompat _gamelog_sl_compat[] = {
+ SLC_VAR("at"),
+ SLC_VAR("tick"),
+ SLC_VAR("action"),
+};
+
+#endif /* SAVELOAD_COMPAT_GAMELOG_H */
diff --git a/src/saveload/compat/linkgraph_sl_compat.h b/src/saveload/compat/linkgraph_sl_compat.h
new file mode 100644
index 000000000..eb455da8f
--- /dev/null
+++ b/src/saveload/compat/linkgraph_sl_compat.h
@@ -0,0 +1,66 @@
+/*
+ * 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 linkgraph_sl_compat.h Loading of linkgraph chunks before table headers were added. */
+
+#ifndef SAVELOAD_COMPAT_LINKGRAPH_H
+#define SAVELOAD_COMPAT_LINKGRAPH_H
+
+#include "../saveload.h"
+
+/** Original field order for SlLinkgraphEdge. */
+const SaveLoadCompat _linkgraph_edge_sl_compat[] = {
+ SLC_NULL(4, SL_MIN_VERSION, SLV_191),
+ SLC_VAR("capacity"),
+ SLC_VAR("usage"),
+ SLC_VAR("last_unrestricted_update"),
+ SLC_VAR("last_restricted_update"),
+ SLC_VAR("next_edge"),
+};
+
+/** Original field order for SlLinkgraphNode. */
+const SaveLoadCompat _linkgraph_node_sl_compat[] = {
+ SLC_VAR("xy"),
+ SLC_VAR("supply"),
+ SLC_VAR("demand"),
+ SLC_VAR("station"),
+ SLC_VAR("last_update"),
+ SLC_VAR("edges"),
+};
+
+/** Original field order for link_graph_desc. */
+const SaveLoadCompat _linkgraph_sl_compat[] = {
+ SLC_VAR("last_compression"),
+ SLC_VAR("num_nodes"),
+ SLC_VAR("cargo"),
+ SLC_VAR("nodes"),
+};
+
+/** Original field order for job_desc. */
+const SaveLoadCompat _linkgraph_job_sl_compat[] = {
+ SLC_VAR("linkgraph.recalc_interval"),
+ SLC_VAR("linkgraph.recalc_time"),
+ SLC_VAR("linkgraph.distribution_pax"),
+ SLC_VAR("linkgraph.distribution_mail"),
+ SLC_VAR("linkgraph.distribution_armoured"),
+ SLC_VAR("linkgraph.distribution_default"),
+ SLC_VAR("linkgraph.accuracy"),
+ SLC_VAR("linkgraph.demand_distance"),
+ SLC_VAR("linkgraph.demand_size"),
+ SLC_VAR("linkgraph.short_path_saturation"),
+ SLC_VAR("join_date"),
+ SLC_VAR("link_graph.index"),
+ SLC_VAR("linkgraph"),
+};
+
+/** Original field order for schedule_desc. */
+const SaveLoadCompat _linkgraph_schedule_sl_compat[] = {
+ SLC_VAR("schedule"),
+ SLC_VAR("running"),
+};
+
+#endif /* SAVELOAD_COMPAT_LINKGRAPH_H */
diff --git a/src/saveload/compat/station_sl_compat.h b/src/saveload/compat/station_sl_compat.h
index 397e1660f..1c24a8d5d 100644
--- a/src/saveload/compat/station_sl_compat.h
+++ b/src/saveload/compat/station_sl_compat.h
@@ -26,4 +26,156 @@ const SaveLoadCompat _roadstop_sl_compat[] = {
SLC_NULL(1, SLV_25, SLV_26),
};
+/** Original field order for SlStationSpecList. */
+const SaveLoadCompat _station_spec_list_sl_compat[] = {
+ SLC_VAR("grfid"),
+ SLC_VAR("localidx"),
+};
+
+/** Original field order for SlStationCargo. */
+const SaveLoadCompat _station_cargo_sl_compat[] = {
+ SLC_VAR("first"),
+ SLC_VAR("second"),
+};
+
+/** Original field order for SlStationFlow. */
+const SaveLoadCompat _station_flow_sl_compat[] = {
+ SLC_VAR("source"),
+ SLC_VAR("via"),
+ SLC_VAR("share"),
+ SLC_VAR("restricted"),
+};
+
+/** Original field order for SlStationGoods. */
+const SaveLoadCompat _station_goods_sl_compat[] = {
+ SLC_VAR("waiting_acceptance"),
+ SLC_VAR("status"),
+ SLC_NULL(2, SLV_51, SLV_68),
+ SLC_VAR("time_since_pickup"),
+ SLC_VAR("rating"),
+ SLC_VAR("cargo_source"),
+ SLC_VAR("cargo_source_xy"),
+ SLC_VAR("cargo_days"),
+ SLC_VAR("last_speed"),
+ SLC_VAR("last_age"),
+ SLC_VAR("cargo_feeder_share"),
+ SLC_VAR("amount_fract"),
+ SLC_VAR("packets"),
+ SLC_VAR("old_num_dests"),
+ SLC_VAR("cargo.reserved_count"),
+ SLC_VAR("link_graph"),
+ SLC_VAR("node"),
+ SLC_VAR("old_num_flows"),
+ SLC_VAR("max_waiting_cargo"),
+ SLC_VAR("flow"),
+ SLC_VAR("cargo"),
+};
+
+/** Original field order for SlStationBase. */
+const SaveLoadCompat _station_base_sl_compat[] = {
+ SLC_VAR("xy"),
+ SLC_VAR("town"),
+ SLC_VAR("string_id"),
+ SLC_VAR("name"),
+ SLC_VAR("delete_ctr"),
+ SLC_VAR("owner"),
+ SLC_VAR("facilities"),
+ SLC_VAR("build_date"),
+ SLC_VAR("random_bits"),
+ SLC_VAR("waiting_triggers"),
+ SLC_VAR("num_specs"),
+};
+
+/** Original field order for SlStationNormal. */
+const SaveLoadCompat _station_normal_sl_compat[] = {
+ SLC_VAR("base"),
+ SLC_VAR("train_station.tile"),
+ SLC_VAR("train_station.w"),
+ SLC_VAR("train_station.h"),
+ SLC_VAR("bus_stops"),
+ SLC_VAR("truck_stops"),
+ SLC_NULL(4, SL_MIN_VERSION, SLV_MULTITILE_DOCKS),
+ SLC_VAR("ship_station.tile"),
+ SLC_VAR("ship_station.w"),
+ SLC_VAR("ship_station.h"),
+ SLC_VAR("docking_station.tile"),
+ SLC_VAR("docking_station.w"),
+ SLC_VAR("docking_station.h"),
+ SLC_VAR("airport.tile"),
+ SLC_VAR("airport.w"),
+ SLC_VAR("airport.h"),
+ SLC_VAR("airport.type"),
+ SLC_VAR("airport.layout"),
+ SLC_VAR("airport.flags"),
+ SLC_VAR("airport.rotation"),
+ SLC_VAR("storage"),
+ SLC_VAR("airport.psa"),
+ SLC_VAR("indtype"),
+ SLC_VAR("time_since_load"),
+ SLC_VAR("time_since_unload"),
+ SLC_VAR("last_vehicle_type"),
+ SLC_VAR("had_vehicle_of_type"),
+ SLC_VAR("loading_vehicles"),
+ SLC_VAR("always_accepted"),
+ SLC_VAR("goods"),
+};
+
+/** Original field order for SlStationWaypoint. */
+const SaveLoadCompat _station_waypoint_sl_compat[] = {
+ SLC_VAR("base"),
+ SLC_VAR("town_cn"),
+ SLC_VAR("train_station.tile"),
+ SLC_VAR("train_station.w"),
+ SLC_VAR("train_station.h"),
+};
+
+/** Original field order for _station_desc. */
+const SaveLoadCompat _station_sl_compat[] = {
+ SLC_VAR("facilities"),
+ SLC_VAR("normal"),
+ SLC_VAR("waypoint"),
+ SLC_VAR("speclist"),
+};
+
+/** Original field order for _old_station_desc. */
+const SaveLoadCompat _old_station_sl_compat[] = {
+ SLC_VAR("xy"),
+ SLC_NULL(4, SL_MIN_VERSION, SLV_6),
+ SLC_VAR("train_station.tile"),
+ SLC_VAR("airport.tile"),
+ SLC_NULL(2, SL_MIN_VERSION, SLV_6),
+ SLC_NULL(4, SLV_6, SLV_MULTITILE_DOCKS),
+ SLC_VAR("town"),
+ SLC_VAR("train_station.w"),
+ SLC_VAR("train_station.h"),
+ SLC_NULL(1, SL_MIN_VERSION, SLV_4),
+ SLC_VAR("string_id"),
+ SLC_VAR("name"),
+ SLC_VAR("indtype"),
+ SLC_VAR("had_vehicle_of_type"),
+ SLC_VAR("time_since_load"),
+ SLC_VAR("time_since_unload"),
+ SLC_VAR("delete_ctr"),
+ SLC_VAR("owner"),
+ SLC_VAR("facilities"),
+ SLC_VAR("airport.type"),
+ SLC_NULL(2, SL_MIN_VERSION, SLV_6),
+ SLC_NULL(1, SL_MIN_VERSION, SLV_5),
+ SLC_VAR("airport.flags"),
+ SLC_NULL(2, SL_MIN_VERSION, SLV_26),
+ SLC_VAR("last_vehicle_type"),
+ SLC_NULL(2, SLV_3, SLV_26),
+ SLC_VAR("build_date"),
+ SLC_VAR("bus_stops"),
+ SLC_VAR("truck_stops"),
+ SLC_VAR("random_bits"),
+ SLC_VAR("waiting_triggers"),
+ SLC_VAR("num_specs"),
+ SLC_VAR("loading_vehicles"),
+ SLC_NULL(32, SLV_2, SL_MAX_VERSION),
+ SLC_VAR("goods"),
+ SLC_VAR("speclist"),
+
+};
+
#endif /* SAVELOAD_COMPAT_STATION_H */
diff --git a/src/saveload/compat/town_sl_compat.h b/src/saveload/compat/town_sl_compat.h
new file mode 100644
index 000000000..34a414102
--- /dev/null
+++ b/src/saveload/compat/town_sl_compat.h
@@ -0,0 +1,87 @@
+/*
+ * 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 town_sl_compat.h Loading of town chunks before table headers were added. */
+
+#ifndef SAVELOAD_COMPAT_TOWN_H
+#define SAVELOAD_COMPAT_TOWN_H
+
+#include "../saveload.h"
+
+/** Original field order for SlTownSupplied. */
+const SaveLoadCompat _town_supplied_sl_compat[] = {
+ SLC_VAR("old_max"),
+ SLC_VAR("new_max"),
+ SLC_VAR("old_act"),
+ SLC_VAR("new_act"),
+};
+
+/** Original field order for SlTownReceived. */
+const SaveLoadCompat _town_received_sl_compat[] = {
+ SLC_VAR("old_max"),
+ SLC_VAR("new_max"),
+ SLC_VAR("old_act"),
+ SLC_VAR("new_act"),
+};
+
+/** Original field order for SlTownAcceptanceMatrix. */
+const SaveLoadCompat _town_acceptance_matrix_sl_compat[] = {
+ SLC_VAR("area.tile"),
+ SLC_VAR("area.w"),
+ SLC_VAR("area.h"),
+};
+
+/** Original field order for town_desc. */
+const SaveLoadCompat _town_sl_compat[] = {
+ SLC_VAR("xy"),
+ SLC_NULL(2, SL_MIN_VERSION, SLV_3),
+ SLC_NULL(4, SLV_3, SLV_85),
+ SLC_NULL(2, SL_MIN_VERSION, SLV_92),
+ SLC_VAR("townnamegrfid"),
+ SLC_VAR("townnametype"),
+ SLC_VAR("townnameparts"),
+ SLC_VAR("name"),
+ SLC_VAR("flags"),
+ SLC_VAR("statues"),
+ SLC_NULL(1, SL_MIN_VERSION, SLV_2),
+ SLC_VAR("have_ratings"),
+ SLC_VAR("ratings"),
+ SLC_VAR("unwanted"),
+ SLC_VAR("supplied[CT_PASSENGERS].old_max"),
+ SLC_VAR("supplied[CT_MAIL].old_max"),
+ SLC_VAR("supplied[CT_PASSENGERS].new_max"),
+ SLC_VAR("supplied[CT_MAIL].new_max"),
+ SLC_VAR("supplied[CT_PASSENGERS].old_act"),
+ SLC_VAR("supplied[CT_MAIL].old_act"),
+ SLC_VAR("supplied[CT_PASSENGERS].new_act"),
+ SLC_VAR("supplied[CT_MAIL].new_act"),
+ SLC_NULL(2, SL_MIN_VERSION, SLV_164),
+ SLC_VAR("received[TE_FOOD].old_act"),
+ SLC_VAR("received[TE_WATER].old_act"),
+ SLC_VAR("received[TE_FOOD].new_act"),
+ SLC_VAR("received[TE_WATER].new_act"),
+ SLC_VAR("goal"),
+ SLC_VAR("text"),
+ SLC_VAR("time_until_rebuild"),
+ SLC_VAR("grow_counter"),
+ SLC_VAR("growth_rate"),
+ SLC_VAR("fund_buildings_months"),
+ SLC_VAR("road_build_months"),
+ SLC_VAR("exclusivity"),
+ SLC_VAR("exclusive_counter"),
+ SLC_VAR("larger_town"),
+ SLC_VAR("layout"),
+ SLC_VAR("psa_list"),
+ SLC_NULL(4, SLV_166, SLV_EXTEND_CARGOTYPES),
+ SLC_NULL(8, SLV_EXTEND_CARGOTYPES, SLV_REMOVE_TOWN_CARGO_CACHE),
+ SLC_NULL(30, SLV_2, SLV_REMOVE_TOWN_CARGO_CACHE),
+ SLC_VAR("supplied"),
+ SLC_VAR("received"),
+ SLC_VAR("acceptance_matrix"),
+};
+
+#endif /* SAVELOAD_COMPAT_TOWN_H */
diff --git a/src/saveload/compat/vehicle_sl_compat.h b/src/saveload/compat/vehicle_sl_compat.h
new file mode 100644
index 000000000..524ff1a3b
--- /dev/null
+++ b/src/saveload/compat/vehicle_sl_compat.h
@@ -0,0 +1,207 @@
+/*
+ * 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 vehicle_sl_compat.h Loading of vehicle chunks before table headers were added. */
+
+#ifndef SAVELOAD_COMPAT_VEHICLE_H
+#define SAVELOAD_COMPAT_VEHICLE_H
+
+#include "../saveload.h"
+
+/** Original field order for SlVehicleCommon. */
+const SaveLoadCompat _vehicle_common_sl_compat[] = {
+ SLC_VAR("subtype"),
+ SLC_VAR("next"),
+ SLC_VAR("name"),
+ SLC_VAR("unitnumber"),
+ SLC_VAR("owner"),
+ SLC_VAR("tile"),
+ SLC_VAR("dest_tile"),
+ SLC_VAR("x_pos"),
+ SLC_VAR("y_pos"),
+ SLC_VAR("z_pos"),
+ SLC_VAR("direction"),
+ SLC_NULL(2, SL_MIN_VERSION, SLV_58),
+ SLC_VAR("spritenum"),
+ SLC_NULL(5, SL_MIN_VERSION, SLV_58),
+ SLC_VAR("engine_type"),
+ SLC_NULL(2, SL_MIN_VERSION, SLV_152),
+ SLC_VAR("cur_speed"),
+ SLC_VAR("subspeed"),
+ SLC_VAR("acceleration"),
+ SLC_VAR("motion_counter"),
+ SLC_VAR("progress"),
+ SLC_VAR("vehstatus"),
+ SLC_VAR("last_station_visited"),
+ SLC_VAR("last_loading_station"),
+ SLC_VAR("cargo_type"),
+ SLC_VAR("cargo_subtype"),
+ SLC_VAR("cargo_days"),
+ SLC_VAR("cargo_source"),
+ SLC_VAR("cargo_source_xy"),
+ SLC_VAR("cargo_cap"),
+ SLC_VAR("refit_cap"),
+ SLC_VAR("cargo_count"),
+ SLC_VAR("cargo.packets"),
+ SLC_VAR("cargo.action_counts"),
+ SLC_VAR("cargo_age_counter"),
+ SLC_VAR("day_counter"),
+ SLC_VAR("tick_counter"),
+ SLC_VAR("running_ticks"),
+ SLC_VAR("cur_implicit_order_index"),
+ SLC_VAR("cur_real_order_index"),
+ SLC_NULL(1, SL_MIN_VERSION, SLV_105),
+ SLC_VAR("current_order.type"),
+ SLC_VAR("current_order.flags"),
+ SLC_VAR("current_order.dest"),
+ SLC_VAR("current_order.refit_cargo"),
+ SLC_NULL(1, SLV_36, SLV_182),
+ SLC_VAR("current_order.wait_time"),
+ SLC_VAR("current_order.travel_time"),
+ SLC_VAR("current_order.max_speed"),
+ SLC_VAR("timetable_start"),
+ SLC_VAR("orders"),
+ SLC_VAR("age"),
+ SLC_VAR("max_age"),
+ SLC_VAR("date_of_last_service"),
+ SLC_VAR("service_interval"),
+ SLC_VAR("reliability"),
+ SLC_VAR("reliability_spd_dec"),
+ SLC_VAR("breakdown_ctr"),
+ SLC_VAR("breakdown_delay"),
+ SLC_VAR("breakdowns_since_last_service"),
+ SLC_VAR("breakdown_chance"),
+ SLC_VAR("build_year"),
+ SLC_VAR("load_unload_ticks"),
+ SLC_VAR("cargo_paid_for"),
+ SLC_VAR("vehicle_flags"),
+ SLC_VAR("profit_this_year"),
+ SLC_VAR("profit_last_year"),
+ SLC_VAR("cargo_feeder_share"),
+ SLC_VAR("cargo_loaded_at_xy"),
+ SLC_VAR("value"),
+ SLC_VAR("random_bits"),
+ SLC_VAR("waiting_triggers"),
+ SLC_VAR("next_shared"),
+ SLC_NULL(2, SLV_2, SLV_69),
+ SLC_NULL(4, SLV_69, SLV_101),
+ SLC_VAR("group_id"),
+ SLC_VAR("current_order_time"),
+ SLC_VAR("lateness_counter"),
+ SLC_NULL(10, SLV_2, SLV_144),
+};
+
+/** Original field order for SlVehicleTrain. */
+const SaveLoadCompat _vehicle_train_sl_compat[] = {
+ SLC_VAR("common"),
+ SLC_VAR("crash_anim_pos"),
+ SLC_VAR("force_proceed"),
+ SLC_VAR("railtype"),
+ SLC_VAR("track"),
+ SLC_VAR("flags"),
+ SLC_NULL(2, SLV_2, SLV_60),
+ SLC_VAR("wait_counter"),
+ SLC_NULL(2, SLV_2, SLV_20),
+ SLC_VAR("gv_flags"),
+ SLC_NULL(11, SLV_2, SLV_144),
+};
+
+/** Original field order for SlVehicleRoadVeh. */
+const SaveLoadCompat _vehicle_roadveh_sl_compat[] = {
+ SLC_VAR("common"),
+ SLC_VAR("state"),
+ SLC_VAR("frame"),
+ SLC_VAR("blocked_ctr"),
+ SLC_VAR("overtaking"),
+ SLC_VAR("overtaking_ctr"),
+ SLC_VAR("crashed_ctr"),
+ SLC_VAR("reverse_ctr"),
+ SLC_VAR("path.td"),
+ SLC_VAR("path.tile"),
+ SLC_NULL(2, SLV_6, SLV_69),
+ SLC_VAR("gv_flags"),
+ SLC_NULL(4, SLV_69, SLV_131),
+ SLC_NULL(2, SLV_6, SLV_131),
+ SLC_NULL(16, SLV_2, SLV_144),
+};
+
+/** Original field order for SlVehicleShip. */
+const SaveLoadCompat _vehicle_ship_sl_compat[] = {
+ SLC_VAR("common"),
+ SLC_VAR("state"),
+ SLC_VAR("path"),
+ SLC_VAR("rotation"),
+ SLC_NULL(16, SLV_2, SLV_144),
+};
+
+/** Original field order for SlVehicleAircraft. */
+const SaveLoadCompat _vehicle_aircraft_sl_compat[] = {
+ SLC_VAR("common"),
+ SLC_VAR("crashed_counter"),
+ SLC_VAR("pos"),
+ SLC_VAR("targetairport"),
+ SLC_VAR("state"),
+ SLC_VAR("previous_pos"),
+ SLC_VAR("last_direction"),
+ SLC_VAR("number_consecutive_turns"),
+ SLC_VAR("turn_counter"),
+ SLC_VAR("flags"),
+ SLC_NULL(13, SLV_2, SLV_144),
+};
+
+/** Original field order for SlVehicleEffect. */
+const SaveLoadCompat _vehicle_effect_sl_compat[] = {
+ SLC_VAR("subtype"),
+ SLC_VAR("tile"),
+ SLC_VAR("x_pos"),
+ SLC_VAR("y_pos"),
+ SLC_VAR("z_pos"),
+ SLC_VAR("sprite_cache.sprite_seq.seq[0].sprite"),
+ SLC_NULL(5, SL_MIN_VERSION, SLV_59),
+ SLC_VAR("progress"),
+ SLC_VAR("vehstatus"),
+ SLC_VAR("animation_state"),
+ SLC_VAR("animation_substate"),
+ SLC_VAR("spritenum"),
+ SLC_NULL(15, SLV_2, SLV_144),
+};
+
+/** Original field order for SlVehicleDisaster. */
+const SaveLoadCompat _vehicle_disaster_sl_compat[] = {
+ SLC_VAR("next"),
+ SLC_VAR("subtype"),
+ SLC_VAR("tile"),
+ SLC_VAR("dest_tile"),
+ SLC_VAR("x_pos"),
+ SLC_VAR("y_pos"),
+ SLC_VAR("z_pos"),
+ SLC_VAR("direction"),
+ SLC_NULL(5, SL_MIN_VERSION, SLV_58),
+ SLC_VAR("owner"),
+ SLC_VAR("vehstatus"),
+ SLC_VAR("current_order.dest"),
+ SLC_VAR("sprite_cache.sprite_seq.seq[0].sprite"),
+ SLC_VAR("age"),
+ SLC_VAR("tick_counter"),
+ SLC_VAR("image_override"),
+ SLC_VAR("big_ufo_destroyer_target"),
+ SLC_VAR("flags"),
+ SLC_NULL(16, SLV_2, SLV_144),
+};
+
+/** Original field order for vehicle_desc. */
+const SaveLoadCompat _vehicle_sl_compat[] = {
+ SLC_VAR("type"),
+ SLC_VAR("train"),
+ SLC_VAR("roadveh"),
+ SLC_VAR("ship"),
+ SLC_VAR("aircraft"),
+ SLC_VAR("effect"),
+ SLC_VAR("disaster"),
+};
+
+#endif /* SAVELOAD_COMPAT_VEHICLE_H */