OpenTTD Source: src/saveload/order_sl.cpp Source File

OpenTTD Source 15.3

order_sl.cpp
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#include "../stdafx.h"
11
12#include "saveload.h"
13#include "compat/order_sl_compat.h"
14
15#include "saveload_internal.h"
16#include "../order_backup.h"
17#include "../settings_type.h"
18#include "../network/network.h"
19
20#include "../safeguards.h"
21
26 void Order::ConvertFromOldSavegame()
27{
28 uint8_t old_flags = this->flags;
29 this->flags = 0;
30
31 /* First handle non-stop - use value from savegame if possible, else use value from config file */
32 if (_settings_client.gui.sg_new_nonstop || (IsSavegameVersionBefore(SLV_22) && _savegame_type != SGT_TTO && _savegame_type != SGT_TTD && _settings_client.gui.new_nonstop)) {
33 /* OFB_NON_STOP */
34 this->SetNonStopType((old_flags & 8) ? OrderNonStopFlags{OrderNonStopFlag::NoIntermediate, OrderNonStopFlag::NoDestination} : OrderNonStopFlag::NoIntermediate);
35 } else {
36 this->SetNonStopType((old_flags & 8) ? OrderNonStopFlag::NoIntermediate : OrderNonStopFlags{});
37 }
38
39 switch (this->GetType()) {
40 /* Only a few types need the other savegame conversions. */
41 case OT_GOTO_DEPOT: case OT_GOTO_STATION: case OT_LOADING: break;
42 default: return;
43 }
44
45 if (this->GetType() != OT_GOTO_DEPOT) {
46 /* Then the load flags */
47 if ((old_flags & 2) != 0) { // OFB_UNLOAD
48 this->SetLoadType(OrderLoadType::NoLoad);
49 } else if ((old_flags & 4) == 0) { // !OFB_FULL_LOAD
50 this->SetLoadType(OrderLoadType::LoadIfPossible);
51 } else {
52 /* old OTTD versions stored full_load_any in config file - assume it was enabled when loading */
53 this->SetLoadType(_settings_client.gui.sg_full_load_any || IsSavegameVersionBefore(SLV_22) ? OrderLoadType::FullLoadAny : OrderLoadType::FullLoad);
54 }
55
56 if (this->IsType(OT_GOTO_STATION)) this->SetStopLocation(OrderStopLocation::FarEnd);
57
58 /* Finally fix the unload flags */
59 if ((old_flags & 1) != 0) { // OFB_TRANSFER
60 this->SetUnloadType(OrderUnloadType::Transfer);
61 } else if ((old_flags & 2) != 0) { // OFB_UNLOAD
62 this->SetUnloadType(OrderUnloadType::Unload);
63 } else {
64 this->SetUnloadType(OrderUnloadType::UnloadIfPossible);
65 }
66 } else {
67 /* Then the depot action flags */
68 OrderDepotActionFlags action_flags{};
69 if ((old_flags & 6) == 4) action_flags.Set(OrderDepotActionFlag::Halt);
70 this->SetDepotActionType(action_flags);
71
72 /* Finally fix the depot type flags */
73 OrderDepotTypeFlags type_flags{};
74 if ((old_flags & 6) == 6) type_flags.Set(OrderDepotTypeFlag::Service);
75 if ((old_flags & 2) != 0) type_flags.Set(OrderDepotTypeFlag::PartOfOrders);
76 this->SetDepotOrderType(type_flags);
77 }
78}
79
85 static Order UnpackVersion4Order(uint16_t packed)
86{
87 return Order(GB(packed, 0, 4), GB(packed, 4, 4), GB(packed, 8, 8));
88}
89
95 Order UnpackOldOrder(uint16_t packed)
96{
97 Order order = UnpackVersion4Order(packed);
98
99 /*
100 * Sanity check
101 * TTD stores invalid orders as OT_NOTHING with non-zero flags/station
102 */
103 if (order.IsType(OT_NOTHING) && packed != 0) order.MakeDummy();
104
105 return order;
106}
107
109 static std::vector<OldOrderSaveLoadItem> _old_order_saveload_pool;
110
114 void ClearOldOrders()
115{
116 _old_order_saveload_pool.clear();
117 _old_order_saveload_pool.shrink_to_fit();
118}
119
125 OldOrderSaveLoadItem *GetOldOrder(size_t ref_index)
126{
127 if (ref_index == 0) return nullptr;
128 assert(ref_index <= _old_order_saveload_pool.size());
129 return &_old_order_saveload_pool[ref_index - 1];
130}
131
137 OldOrderSaveLoadItem &AllocateOldOrder(size_t pool_index)
138{
139 assert(pool_index < UINT32_MAX);
140 if (pool_index >= _old_order_saveload_pool.size()) _old_order_saveload_pool.resize(pool_index + 1);
141 return _old_order_saveload_pool[pool_index];
142}
143
144 SaveLoadTable GetOrderDescription()
145{
146 static const SaveLoad _order_desc[] = {
147 SLE_VARNAME(OldOrderSaveLoadItem, order.type, "type", SLE_UINT8),
148 SLE_VARNAME(OldOrderSaveLoadItem, order.flags, "flags", SLE_UINT8),
149 SLE_VARNAME(OldOrderSaveLoadItem, order.dest, "dest", SLE_UINT16),
150 SLE_CONDVARNAME(OldOrderSaveLoadItem, next, "next", SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_69),
151 SLE_CONDVARNAME(OldOrderSaveLoadItem, next, "next", SLE_UINT32, SLV_69, SL_MAX_VERSION),
152 SLE_CONDVARNAME(OldOrderSaveLoadItem, order.refit_cargo, "refit_cargo", SLE_UINT8, SLV_36, SL_MAX_VERSION),
153 SLE_CONDVARNAME(OldOrderSaveLoadItem, order.wait_time, "wait_time", SLE_UINT16, SLV_67, SL_MAX_VERSION),
154 SLE_CONDVARNAME(OldOrderSaveLoadItem, order.travel_time, "travel_time", SLE_UINT16, SLV_67, SL_MAX_VERSION),
155 SLE_CONDVARNAME(OldOrderSaveLoadItem, order.max_speed, "max_speed", SLE_UINT16, SLV_172, SL_MAX_VERSION),
156 };
157
158 return _order_desc;
159}
160
161 struct ORDRChunkHandler : ChunkHandler {
162 ORDRChunkHandler() : ChunkHandler('ORDR', CH_READONLY) {}
163
164 void Load() const override
165 {
166 if (IsSavegameVersionBefore(SLV_5, 2)) {
167 /* Version older than 5.2 did not have a ->next pointer. Convert them
168 * (in the old days, the orderlist was 5000 items big) */
169 size_t len = SlGetFieldLength();
170
171 if (IsSavegameVersionBefore(SLV_5)) {
172 /* Pre-version 5 had another layout for orders
173 * (uint16_t instead of uint32_t) */
174 len /= sizeof(uint16_t);
175 std::vector<uint16_t> orders(len);
176
177 SlCopy(&orders[0], len, SLE_UINT16);
178
179 for (size_t i = 0; i < len; ++i) {
180 auto &item = AllocateOldOrder(i);
181 item.order.AssignOrder(UnpackVersion4Order(orders[i]));
182 }
183 } else if (IsSavegameVersionBefore(SLV_5, 2)) {
184 len /= sizeof(uint32_t);
185 std::vector<uint32_t> orders(len);
186
187 SlCopy(&orders[0], len, SLE_UINT32);
188
189 for (size_t i = 0; i < len; ++i) {
190 auto &item = AllocateOldOrder(i);
191 item.order = Order(GB(orders[i], 0, 8), GB(orders[i], 8, 8), GB(orders[i], 16, 16));
192 }
193 }
194
195 /* Update all the next pointer. The orders were built like this:
196 * While the order is valid, the previous order will get its next pointer set */
197 for (uint32_t num = 1; const OldOrderSaveLoadItem &item : _old_order_saveload_pool) {
198 if (!item.order.IsType(OT_NOTHING) && num > 1) {
199 OldOrderSaveLoadItem *prev = GetOldOrder(num - 1);
200 if (prev != nullptr) prev->next = num;
201 }
202 ++num;
203 }
204 } else {
205 const std::vector<SaveLoad> slt = SlCompatTableHeader(GetOrderDescription(), _order_sl_compat);
206
207 int index;
208
209 while ((index = SlIterateArray()) != -1) {
210 auto &item = AllocateOldOrder(index);
211 SlObject(&item, slt);
212 }
213 }
214 }
215};
216
217template <typename T>
218 class SlOrders : public VectorSaveLoadHandler<SlOrders<T>, T, Order> {
219public:
220 static inline const SaveLoad description[] = {
221 SLE_VAR(Order, type, SLE_UINT8),
222 SLE_VAR(Order, flags, SLE_UINT8),
223 SLE_VAR(Order, dest, SLE_UINT16),
224 SLE_VAR(Order, refit_cargo, SLE_UINT8),
225 SLE_VAR(Order, wait_time, SLE_UINT16),
226 SLE_VAR(Order, travel_time, SLE_UINT16),
227 SLE_VAR(Order, max_speed, SLE_UINT16),
228 };
229 static inline const SaveLoadCompatTable compat_description = {};
230
231 std::vector<Order> &GetVector(T *container) const override { return container->orders; }
232
233 void LoadCheck(T *container) const override { this->Load(container); }
234};
235
236/* Instantiate SlOrders classes. */
237template class SlOrders<OrderList>;
238template class SlOrders<OrderBackup>;
239
240 SaveLoadTable GetOrderListDescription()
241{
242 static const SaveLoad _orderlist_desc[] = {
243 SLE_CONDVARNAME(OrderList, old_order_index, "first", SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_69),
244 SLE_CONDVARNAME(OrderList, old_order_index, "first", SLE_UINT32, SLV_69, SLV_ORDERS_OWNED_BY_ORDERLIST),
245 SLEG_CONDSTRUCTLIST("orders", SlOrders<OrderList>, SLV_ORDERS_OWNED_BY_ORDERLIST, SL_MAX_VERSION),
246 };
247
248 return _orderlist_desc;
249}
250
251 struct ORDLChunkHandler : ChunkHandler {
252 ORDLChunkHandler() : ChunkHandler('ORDL', CH_TABLE) {}
253
254 void Save() const override
255 {
256 const SaveLoadTable slt = GetOrderListDescription();
257 SlTableHeader(slt);
258
259 for (OrderList *list : OrderList::Iterate()) {
260 SlSetArrayIndex(list->index);
261 SlObject(list, slt);
262 }
263 }
264
265 void Load() const override
266 {
267 const std::vector<SaveLoad> slt = SlCompatTableHeader(GetOrderListDescription(), _orderlist_sl_compat);
268
269 int index;
270
271 while ((index = SlIterateArray()) != -1) {
272 OrderList *list = new (OrderListID(index)) OrderList();
273 SlObject(list, slt);
274 }
275
276 }
277
278 void FixPointers() const override
279 {
280 bool migrate_orders = IsSavegameVersionBefore(SLV_ORDERS_OWNED_BY_ORDERLIST);
281
282 for (OrderList *list : OrderList::Iterate()) {
283 SlObject(list, GetOrderListDescription());
284
285 if (migrate_orders) {
286 std::vector<Order> orders;
287 for (OldOrderSaveLoadItem *old_order = GetOldOrder(list->old_order_index); old_order != nullptr; old_order = GetOldOrder(old_order->next)) {
288 orders.push_back(std::move(old_order->order));
289 }
290 list->orders = std::move(orders);
291 }
292 }
293 }
294};
295
296 SaveLoadTable GetOrderBackupDescription()
297{
298 static const SaveLoad _order_backup_desc[] = {
299 SLE_VAR(OrderBackup, user, SLE_UINT32),
300 SLE_VAR(OrderBackup, tile, SLE_UINT32),
301 SLE_VAR(OrderBackup, group, SLE_UINT16),
302 SLE_CONDVAR(OrderBackup, service_interval, SLE_FILE_U32 | SLE_VAR_U16, SL_MIN_VERSION, SLV_192),
303 SLE_CONDVAR(OrderBackup, service_interval, SLE_UINT16, SLV_192, SL_MAX_VERSION),
304 SLE_SSTR(OrderBackup, name, SLE_STR),
305 SLE_CONDREF(OrderBackup, clone, REF_VEHICLE, SLV_192, SL_MAX_VERSION),
306 SLE_VAR(OrderBackup, cur_real_order_index, SLE_UINT8),
307 SLE_CONDVAR(OrderBackup, cur_implicit_order_index, SLE_UINT8, SLV_176, SL_MAX_VERSION),
308 SLE_CONDVAR(OrderBackup, current_order_time, SLE_UINT32, SLV_176, SL_MAX_VERSION),
309 SLE_CONDVAR(OrderBackup, lateness_counter, SLE_INT32, SLV_176, SL_MAX_VERSION),
310 SLE_CONDVAR(OrderBackup, timetable_start, SLE_FILE_I32 | SLE_VAR_U64, SLV_176, SLV_TIMETABLE_START_TICKS_FIX),
311 SLE_CONDVAR(OrderBackup, timetable_start, SLE_UINT64, SLV_TIMETABLE_START_TICKS_FIX, SL_MAX_VERSION),
312 SLE_CONDVAR(OrderBackup, vehicle_flags, SLE_FILE_U8 | SLE_VAR_U16, SLV_176, SLV_180),
313 SLE_CONDVAR(OrderBackup, vehicle_flags, SLE_UINT16, SLV_180, SL_MAX_VERSION),
314 SLE_CONDVARNAME(OrderBackup, old_order_index, "orders", SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_69),
315 SLE_CONDVARNAME(OrderBackup, old_order_index, "orders", SLE_UINT32, SLV_69, SLV_ORDERS_OWNED_BY_ORDERLIST),
316 SLEG_CONDSTRUCTLIST("orders", SlOrders<OrderBackup>, SLV_ORDERS_OWNED_BY_ORDERLIST, SL_MAX_VERSION),
317 };
318
319 return _order_backup_desc;
320}
321
322 struct BKORChunkHandler : ChunkHandler {
323 BKORChunkHandler() : ChunkHandler('BKOR', CH_TABLE) {}
324
325 void Save() const override
326 {
327 const SaveLoadTable slt = GetOrderBackupDescription();
328 SlTableHeader(slt);
329
330 /* We only save this when we're a network server
331 * as we want this information on our clients. For
332 * normal games this information isn't needed. */
333 if (!_networking || !_network_server) return;
334
335 for (OrderBackup *ob : OrderBackup::Iterate()) {
336 SlSetArrayIndex(ob->index);
337 SlObject(ob, slt);
338 }
339 }
340
341 void Load() const override
342 {
343 const std::vector<SaveLoad> slt = SlCompatTableHeader(GetOrderBackupDescription(), _order_backup_sl_compat);
344
345 int index;
346
347 while ((index = SlIterateArray()) != -1) {
348 /* set num_orders to 0 so it's a valid OrderList */
349 OrderBackup *ob = new (OrderBackupID(index)) OrderBackup();
350 SlObject(ob, slt);
351 }
352 }
353
354 void FixPointers() const override
355 {
356 bool migrate_orders = IsSavegameVersionBefore(SLV_ORDERS_OWNED_BY_ORDERLIST);
357
358 for (OrderBackup *ob : OrderBackup::Iterate()) {
359 SlObject(ob, GetOrderBackupDescription());
360
361 if (migrate_orders) {
362 std::vector<Order> orders;
363 for (OldOrderSaveLoadItem *old_order = GetOldOrder(ob->old_order_index); old_order != nullptr; old_order = GetOldOrder(old_order->next)) {
364 orders.push_back(std::move(old_order->order));
365 }
366 ob->orders = std::move(orders);
367 }
368 }
369 }
370};
371
372static const BKORChunkHandler BKOR;
373static const ORDRChunkHandler ORDR;
374static const ORDLChunkHandler ORDL;
375static const ChunkHandlerRef order_chunk_handlers[] = {
376 BKOR,
377 ORDR,
378 ORDL,
379};
380
381extern const ChunkHandlerTable _order_chunk_handlers(order_chunk_handlers);
GB
static constexpr uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
Definition bitmath_func.hpp:32
BaseBitSet::Set
constexpr Timpl & Set()
Set all bits.
Definition base_bitset_type.hpp:40
EnumBitSet
Enum-as-bit-set wrapper.
Definition enum_type.hpp:177
SlOrders
Definition order_sl.cpp:218
SlOrders::GetVector
std::vector< Order > & GetVector(T *container) const override
Get instance of vector to load/save.
Definition order_sl.cpp:231
VectorSaveLoadHandler
Default handler for saving/loading a vector to/from disk.
Definition saveload.h:1382
_savegame_type
SavegameType _savegame_type
type of savegame we are loading
Definition saveload.cpp:77
_networking
bool _networking
are we in networking mode?
Definition network.cpp:67
_network_server
bool _network_server
network-server is active
Definition network.cpp:68
OrderBackupID
PoolID< uint8_t, struct OrderBackupIDTag, 255, 0xFF > OrderBackupID
Unique identifier for an order backup.
Definition order_backup.h:21
_old_order_saveload_pool
static std::vector< OldOrderSaveLoadItem > _old_order_saveload_pool
Temporary storage for conversion from old order pool.
Definition order_sl.cpp:109
UnpackOldOrder
Order UnpackOldOrder(uint16_t packed)
Unpacks a order from savegames made with TTD(Patch)
Definition order_sl.cpp:95
UnpackVersion4Order
static Order UnpackVersion4Order(uint16_t packed)
Unpacks a order from savegames with version 4 and lower.
Definition order_sl.cpp:85
ClearOldOrders
void ClearOldOrders()
Clear all old orders.
Definition order_sl.cpp:114
AllocateOldOrder
OldOrderSaveLoadItem & AllocateOldOrder(size_t pool_index)
Allocate an old order with the given pool index.
Definition order_sl.cpp:137
GetOldOrder
OldOrderSaveLoadItem * GetOldOrder(size_t ref_index)
Get a pointer to an old order with the given reference index.
Definition order_sl.cpp:125
order_sl_compat.h
Loading of order chunks before table headers were added.
_order_sl_compat
const SaveLoadCompat _order_sl_compat[]
Original field order for _order_desc.
Definition order_sl_compat.h:16
_orderlist_sl_compat
const SaveLoadCompat _orderlist_sl_compat[]
Original field order for _orderlist_desc.
Definition order_sl_compat.h:30
_order_backup_sl_compat
const SaveLoadCompat _order_backup_sl_compat[]
Original field order for _order_backup_desc.
Definition order_sl_compat.h:35
OrderUnloadType::Transfer
@ Transfer
Transfer all cargo onto the platform.
OrderUnloadType::UnloadIfPossible
@ UnloadIfPossible
Unload all cargo that the station accepts.
OrderUnloadType::Unload
@ Unload
Force unloading all cargo onto the platform, possibly not getting paid.
OrderStopLocation::FarEnd
@ FarEnd
Stop at the far end of the platform.
OrderNonStopFlag::NoDestination
@ NoDestination
The vehicle will stop at any station it passes except the destination, aka via.
OrderNonStopFlag::NoIntermediate
@ NoIntermediate
The vehicle will not stop at any stations it passes except the destination, aka non-stop.
OrderLoadType::FullLoad
@ FullLoad
Full load all cargoes of the consist.
OrderLoadType::NoLoad
@ NoLoad
Do not load anything.
OrderLoadType::FullLoadAny
@ FullLoadAny
Full load a single cargo of the consist.
OrderLoadType::LoadIfPossible
@ LoadIfPossible
Load as long as there is cargo that fits in the train.
OrderDepotActionFlag::Halt
@ Halt
Service the vehicle and then halt it.
OrderDepotTypeFlag::PartOfOrders
@ PartOfOrders
This depot order is because of a regular order.
OrderDepotTypeFlag::Service
@ Service
This depot order is because of the servicing limit.
SlCompatTableHeader
std::vector< SaveLoad > SlCompatTableHeader(const SaveLoadTable &slt, const SaveLoadCompatTable &slct)
Load a table header in a savegame compatible way.
Definition saveload.cpp:2037
SlIterateArray
int SlIterateArray()
Iterate through the elements of an array and read the whole thing.
Definition saveload.cpp:677
SlCopy
void SlCopy(void *object, size_t length, VarType conv)
Copy a list of SL_VARs to/from a savegame.
Definition saveload.cpp:1150
SlGetFieldLength
size_t SlGetFieldLength()
Get the length of the current object.
Definition saveload.cpp:800
SlObject
void SlObject(void *object, const SaveLoadTable &slt)
Main SaveLoad function.
Definition saveload.cpp:1846
SlTableHeader
std::vector< SaveLoad > SlTableHeader(const SaveLoadTable &slt)
Save or Load a table header.
Definition saveload.cpp:1899
saveload.h
Functions/types related to saving and loading games.
SGT_TTD
@ SGT_TTD
TTD savegame (can be detected incorrectly)
Definition saveload.h:439
SGT_TTO
@ SGT_TTO
TTO savegame.
Definition saveload.h:443
SLE_VARNAME
#define SLE_VARNAME(base, variable, name, type)
Storage of a variable in every version of a savegame.
Definition saveload.h:1026
ChunkHandlerRef
std::reference_wrapper< const ChunkHandler > ChunkHandlerRef
A reference to ChunkHandler.
Definition saveload.h:524
REF_VEHICLE
@ REF_VEHICLE
Load/save a reference to a vehicle.
Definition saveload.h:616
ChunkHandlerTable
std::span< const ChunkHandlerRef > ChunkHandlerTable
A table of ChunkHandler entries.
Definition saveload.h:527
SaveLoadCompatTable
std::span< const struct SaveLoadCompat > SaveLoadCompatTable
A table of SaveLoadCompat entries.
Definition saveload.h:533
SLE_CONDVAR
#define SLE_CONDVAR(base, variable, type, from, to)
Storage of a variable in some savegame versions.
Definition saveload.h:883
IsSavegameVersionBefore
bool IsSavegameVersionBefore(SaveLoadVersion major, uint8_t minor=0)
Checks whether the savegame is below major.
Definition saveload.h:1278
SLE_SSTR
#define SLE_SSTR(base, variable, type)
Storage of a std::string in every savegame version.
Definition saveload.h:1061
SLV_69
@ SLV_69
69 10319
Definition saveload.h:125
SLV_172
@ SLV_172
172 23947
Definition saveload.h:249
SLV_67
@ SLV_67
67 10236
Definition saveload.h:123
SLV_36
@ SLV_36
36 6624
Definition saveload.h:86
SLV_180
@ SLV_180
180 24998 1.3.x
Definition saveload.h:259
SLV_176
@ SLV_176
176 24446
Definition saveload.h:254
SL_MAX_VERSION
@ SL_MAX_VERSION
Highest possible saveload version.
Definition saveload.h:416
SL_MIN_VERSION
@ SL_MIN_VERSION
First savegame version.
Definition saveload.h:31
SLV_22
@ SLV_22
22 3726
Definition saveload.h:69
SLV_192
@ SLV_192
192 26700 FS#6066 Fix saving of order backups
Definition saveload.h:274
SLV_TIMETABLE_START_TICKS_FIX
@ SLV_TIMETABLE_START_TICKS_FIX
322 PR#11557 Fix for missing convert timetable start from a date to ticks.
Definition saveload.h:366
SLV_ORDERS_OWNED_BY_ORDERLIST
@ SLV_ORDERS_OWNED_BY_ORDERLIST
354 PR#13948 Orders stored in OrderList, pool removed.
Definition saveload.h:404
SLV_5
@ SLV_5
5.0 1429 5.1 1440 5.2 1525 0.3.6
Definition saveload.h:43
SLE_CONDREF
#define SLE_CONDREF(base, variable, type, from, to)
Storage of a reference in some savegame versions.
Definition saveload.h:904
SaveLoadTable
std::span< const struct SaveLoad > SaveLoadTable
A table of SaveLoad entries.
Definition saveload.h:530
SLEG_CONDSTRUCTLIST
#define SLEG_CONDSTRUCTLIST(name, handler, from, to)
Storage of a list of structs in some savegame versions.
Definition saveload.h:1193
CH_READONLY
@ CH_READONLY
Chunk is never saved.
Definition saveload.h:474
SLE_VAR
#define SLE_VAR(base, variable, type)
Storage of a variable in every version of a savegame.
Definition saveload.h:1017
SLE_CONDVARNAME
#define SLE_CONDVARNAME(base, variable, name, type, from, to)
Storage of a variable in some savegame versions.
Definition saveload.h:894
saveload_internal.h
Declaration of functions used in more save/load files.
_settings_client
ClientSettings _settings_client
The current settings for this game.
Definition settings.cpp:60
BKORChunkHandler
Definition order_sl.cpp:322
BKORChunkHandler::Save
void Save() const override
Save the chunk.
Definition order_sl.cpp:325
BKORChunkHandler::Load
void Load() const override
Load the chunk.
Definition order_sl.cpp:341
BKORChunkHandler::FixPointers
void FixPointers() const override
Fix the pointers.
Definition order_sl.cpp:354
ChunkHandler
Handlers and description of chunk.
Definition saveload.h:478
ClientSettings::gui
GUISettings gui
settings related to the GUI
Definition settings_type.h:650
GUISettings::new_nonstop
bool new_nonstop
ttdpatch compatible nonstop handling
Definition settings_type.h:171
GUISettings::sg_new_nonstop
bool sg_new_nonstop
ttdpatch compatible nonstop handling read from pre v93 savegames
Definition settings_type.h:170
GUISettings::sg_full_load_any
bool sg_full_load_any
new full load calculation, any cargo must be full read from pre v93 savegames
Definition settings_type.h:164
ORDLChunkHandler
Definition order_sl.cpp:251
ORDLChunkHandler::FixPointers
void FixPointers() const override
Fix the pointers.
Definition order_sl.cpp:278
ORDLChunkHandler::Save
void Save() const override
Save the chunk.
Definition order_sl.cpp:254
ORDLChunkHandler::Load
void Load() const override
Load the chunk.
Definition order_sl.cpp:265
ORDRChunkHandler
Definition order_sl.cpp:161
ORDRChunkHandler::Load
void Load() const override
Load the chunk.
Definition order_sl.cpp:164
OldOrderSaveLoadItem
Compatibility struct to allow saveload of pool-based orders.
Definition order_base.h:258
OldOrderSaveLoadItem::next
uint32_t next
The next order index (1-based).
Definition order_base.h:260
OrderBackup
Data for backing up an order of a vehicle so it can be restored after a vehicle is rebuilt in the sam...
Definition order_backup.h:33
OrderList
Shared order list linking together the linked list of orders and the list of vehicles sharing this or...
Definition order_base.h:274
Order
Definition order_base.h:33
Order::ConvertFromOldSavegame
void ConvertFromOldSavegame()
Converts this order from an old savegame's version; it moves all bits to the new location.
Definition order_sl.cpp:26
Order::IsType
bool IsType(OrderType type) const
Check whether this order is of the given type.
Definition order_base.h:66
Order::SetNonStopType
void SetNonStopType(OrderNonStopFlags non_stop_type)
Set whether we must stop at stations or not.
Definition order_base.h:167
Order::GetType
OrderType GetType() const
Get the type of order of this order.
Definition order_base.h:72
Order::SetDepotOrderType
void SetDepotOrderType(OrderDepotTypeFlags depot_order_type)
Set the cause to go to the depot.
Definition order_base.h:171
Order::SetStopLocation
void SetStopLocation(OrderStopLocation stop_location)
Set where we must stop at the platform.
Definition order_base.h:169
Order::MakeDummy
void MakeDummy()
Makes this order a Dummy order.
Definition order_cmd.cpp:116
Order::flags
uint8_t flags
Load/unload types, depot order/action types.
Definition order_base.h:48
Order::SetDepotActionType
void SetDepotActionType(OrderDepotActionFlags depot_service_type)
Set what we are going to do in the depot.
Definition order_base.h:173
Order::SetUnloadType
void SetUnloadType(OrderUnloadType unload_type)
Set how the consist must be unloaded.
Definition order_base.h:165
Order::SetLoadType
void SetLoadType(OrderLoadType load_type)
Set how the consist must be loaded.
Definition order_base.h:163
PoolID
Templated helper to make a PoolID a single POD value.
Definition pool_type.hpp:43
Pool::PoolItem<&_orderlist_pool >::Iterate
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
Definition pool_type.hpp:436
SaveLoad
SaveLoad type struct.
Definition saveload.h:732