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

OpenTTD Source 14.1

company_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 <http://www.gnu.org/licenses/>.
6 */
7
10 #include "../stdafx.h"
11
12 #include "saveload.h"
13 #include "compat/company_sl_compat.h"
14
15 #include "../company_func.h"
16 #include "../company_manager_face.h"
17 #include "../fios.h"
18 #include "../tunnelbridge_map.h"
19 #include "../tunnelbridge.h"
20 #include "../station_base.h"
21 #include "../strings_func.h"
22
23 #include "table/strings.h"
24
25 #include "../safeguards.h"
26
45 CompanyManagerFace ConvertFromOldCompanyManagerFace(uint32_t face)
46 {
47 CompanyManagerFace cmf = 0;
48 GenderEthnicity ge = GE_WM;
49
50 if (HasBit(face, 31)) SetBit(ge, GENDER_FEMALE);
51 if (HasBit(face, 27) && (HasBit(face, 26) == HasBit(face, 19))) SetBit(ge, ETHNICITY_BLACK);
52
53 SetCompanyManagerFaceBits(cmf, CMFV_GEN_ETHN, ge, ge);
54 SetCompanyManagerFaceBits(cmf, CMFV_HAS_GLASSES, ge, GB(face, 28, 3) <= 1);
55 SetCompanyManagerFaceBits(cmf, CMFV_EYE_COLOUR, ge, HasBit(ge, ETHNICITY_BLACK) ? 0 : ClampU(GB(face, 20, 3), 5, 7) - 5);
56 SetCompanyManagerFaceBits(cmf, CMFV_CHIN, ge, ScaleCompanyManagerFaceValue(CMFV_CHIN, ge, GB(face, 4, 2)));
57 SetCompanyManagerFaceBits(cmf, CMFV_EYEBROWS, ge, ScaleCompanyManagerFaceValue(CMFV_EYEBROWS, ge, GB(face, 6, 4)));
58 SetCompanyManagerFaceBits(cmf, CMFV_HAIR, ge, ScaleCompanyManagerFaceValue(CMFV_HAIR, ge, GB(face, 16, 4)));
59 SetCompanyManagerFaceBits(cmf, CMFV_JACKET, ge, ScaleCompanyManagerFaceValue(CMFV_JACKET, ge, GB(face, 20, 2)));
60 SetCompanyManagerFaceBits(cmf, CMFV_COLLAR, ge, ScaleCompanyManagerFaceValue(CMFV_COLLAR, ge, GB(face, 22, 2)));
61 SetCompanyManagerFaceBits(cmf, CMFV_GLASSES, ge, GB(face, 28, 1));
62
63 uint lips = GB(face, 10, 4);
64 if (!HasBit(ge, GENDER_FEMALE) && lips < 4) {
65 SetCompanyManagerFaceBits(cmf, CMFV_HAS_MOUSTACHE, ge, true);
66 SetCompanyManagerFaceBits(cmf, CMFV_MOUSTACHE, ge, std::max(lips, 1U) - 1);
67 } else {
68 if (!HasBit(ge, GENDER_FEMALE)) {
69 lips = lips * 15 / 16;
70 lips -= 3;
71 if (HasBit(ge, ETHNICITY_BLACK) && lips > 8) lips = 0;
72 } else {
73 lips = ScaleCompanyManagerFaceValue(CMFV_LIPS, ge, lips);
74 }
75 SetCompanyManagerFaceBits(cmf, CMFV_LIPS, ge, lips);
76
77 uint nose = GB(face, 13, 3);
78 if (ge == GE_WF) {
79 nose = (nose * 3 >> 3) * 3 >> 2; // There is 'hole' in the nose sprites for females
80 } else {
81 nose = ScaleCompanyManagerFaceValue(CMFV_NOSE, ge, nose);
82 }
83 SetCompanyManagerFaceBits(cmf, CMFV_NOSE, ge, nose);
84 }
85
86 uint tie_earring = GB(face, 24, 4);
87 if (!HasBit(ge, GENDER_FEMALE) || tie_earring < 3) { // Not all females have an earring
88 if (HasBit(ge, GENDER_FEMALE)) SetCompanyManagerFaceBits(cmf, CMFV_HAS_TIE_EARRING, ge, true);
89 SetCompanyManagerFaceBits(cmf, CMFV_TIE_EARRING, ge, HasBit(ge, GENDER_FEMALE) ? tie_earring : ScaleCompanyManagerFaceValue(CMFV_TIE_EARRING, ge, tie_earring / 2));
90 }
91
92 return cmf;
93 }
94
96 void AfterLoadCompanyStats()
97 {
98 /* Reset infrastructure statistics to zero. */
99 for (Company *c : Company::Iterate()) MemSetT(&c->infrastructure, 0);
100
101 /* Collect airport count. */
102 for (const Station *st : Station::Iterate()) {
103 if ((st->facilities & FACIL_AIRPORT) && Company::IsValidID(st->owner)) {
104 Company::Get(st->owner)->infrastructure.airport++;
105 }
106 }
107
108 Company *c;
109 for (TileIndex tile = 0; tile < Map::Size(); tile++) {
110 switch (GetTileType(tile)) {
111 case MP_RAILWAY:
112 c = Company::GetIfValid(GetTileOwner(tile));
113 if (c != nullptr) {
114 uint pieces = 1;
115 if (IsPlainRail(tile)) {
116 TrackBits bits = GetTrackBits(tile);
117 pieces = CountBits(bits);
118 if (TracksOverlap(bits)) pieces *= pieces;
119 }
120 c->infrastructure.rail[GetRailType(tile)] += pieces;
121
122 if (HasSignals(tile)) c->infrastructure.signal += CountBits(GetPresentSignals(tile));
123 }
124 break;
125
126 case MP_ROAD: {
127 if (IsLevelCrossing(tile)) {
128 c = Company::GetIfValid(GetTileOwner(tile));
129 if (c != nullptr) c->infrastructure.rail[GetRailType(tile)] += LEVELCROSSING_TRACKBIT_FACTOR;
130 }
131
132 /* Iterate all present road types as each can have a different owner. */
133 for (RoadTramType rtt : _roadtramtypes) {
134 RoadType rt = GetRoadType(tile, rtt);
135 if (rt == INVALID_ROADTYPE) continue;
136 c = Company::GetIfValid(IsRoadDepot(tile) ? GetTileOwner(tile) : GetRoadOwner(tile, rtt));
137 /* A level crossings and depots have two road bits. */
138 if (c != nullptr) c->infrastructure.road[rt] += IsNormalRoad(tile) ? CountBits(GetRoadBits(tile, rtt)) : 2;
139 }
140 break;
141 }
142
143 case MP_STATION:
144 c = Company::GetIfValid(GetTileOwner(tile));
145 if (c != nullptr && GetStationType(tile) != STATION_AIRPORT && !IsBuoy(tile)) c->infrastructure.station++;
146
147 switch (GetStationType(tile)) {
148 case STATION_RAIL:
149 case STATION_WAYPOINT:
150 if (c != nullptr && !IsStationTileBlocked(tile)) c->infrastructure.rail[GetRailType(tile)]++;
151 break;
152
153 case STATION_BUS:
154 case STATION_TRUCK: {
155 /* Iterate all present road types as each can have a different owner. */
156 for (RoadTramType rtt : _roadtramtypes) {
157 RoadType rt = GetRoadType(tile, rtt);
158 if (rt == INVALID_ROADTYPE) continue;
159 c = Company::GetIfValid(GetRoadOwner(tile, rtt));
160 if (c != nullptr) c->infrastructure.road[rt] += 2; // A road stop has two road bits.
161 }
162 break;
163 }
164
165 case STATION_DOCK:
166 case STATION_BUOY:
167 if (GetWaterClass(tile) == WATER_CLASS_CANAL) {
168 if (c != nullptr) c->infrastructure.water++;
169 }
170 break;
171
172 default:
173 break;
174 }
175 break;
176
177 case MP_WATER:
178 if (IsShipDepot(tile) || IsLock(tile)) {
179 c = Company::GetIfValid(GetTileOwner(tile));
180 if (c != nullptr) {
181 if (IsShipDepot(tile)) c->infrastructure.water += LOCK_DEPOT_TILE_FACTOR;
182 if (IsLock(tile) && GetLockPart(tile) == LOCK_PART_MIDDLE) {
183 /* The middle tile specifies the owner of the lock. */
184 c->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // the middle tile specifies the owner of the
185 break; // do not count the middle tile as canal
186 }
187 }
188 }
189 [[fallthrough]];
190
191 case MP_OBJECT:
192 if (GetWaterClass(tile) == WATER_CLASS_CANAL) {
193 c = Company::GetIfValid(GetTileOwner(tile));
194 if (c != nullptr) c->infrastructure.water++;
195 }
196 break;
197
198 case MP_TUNNELBRIDGE: {
199 /* Only count the tunnel/bridge if we're on the northern end tile. */
200 TileIndex other_end = GetOtherTunnelBridgeEnd(tile);
201 if (tile < other_end) {
202 /* Count each tunnel/bridge TUNNELBRIDGE_TRACKBIT_FACTOR times to simulate
203 * the higher structural maintenance needs, and don't forget the end tiles. */
204 uint len = (GetTunnelBridgeLength(tile, other_end) + 2) * TUNNELBRIDGE_TRACKBIT_FACTOR;
205
206 switch (GetTunnelBridgeTransportType(tile)) {
207 case TRANSPORT_RAIL:
208 c = Company::GetIfValid(GetTileOwner(tile));
209 if (c != nullptr) c->infrastructure.rail[GetRailType(tile)] += len;
210 break;
211
212 case TRANSPORT_ROAD: {
213 /* Iterate all present road types as each can have a different owner. */
214 for (RoadTramType rtt : _roadtramtypes) {
215 RoadType rt = GetRoadType(tile, rtt);
216 if (rt == INVALID_ROADTYPE) continue;
217 c = Company::GetIfValid(GetRoadOwner(tile, rtt));
218 if (c != nullptr) c->infrastructure.road[rt] += len * 2; // A full diagonal road has two road bits.
219 }
220 break;
221 }
222
223 case TRANSPORT_WATER:
224 c = Company::GetIfValid(GetTileOwner(tile));
225 if (c != nullptr) c->infrastructure.water += len;
226 break;
227
228 default:
229 break;
230 }
231 }
232 break;
233 }
234
235 default:
236 break;
237 }
238 }
239 }
240
241 /* We do need to read this single value, as the bigger it gets, the more data is stored */
242 struct CompanyOldAI {
243 uint8_t num_build_rec;
244 };
245
246 class SlCompanyOldAIBuildRec : public DefaultSaveLoadHandler<SlCompanyOldAIBuildRec, CompanyOldAI> {
247 public:
248 inline static const SaveLoad description[] = {{}}; // Needed to keep DefaultSaveLoadHandler happy.
249 inline const static SaveLoadCompatTable compat_description = _company_old_ai_buildrec_compat;
250
251 SaveLoadTable GetDescription() const override { return {}; }
252
253 void Load(CompanyOldAI *old_ai) const override
254 {
255 for (int i = 0; i != old_ai->num_build_rec; i++) {
256 SlObject(nullptr, this->GetLoadDescription());
257 }
258 }
259
260 void LoadCheck(CompanyOldAI *old_ai) const override { this->Load(old_ai); }
261 };
262
263 class SlCompanyOldAI : public DefaultSaveLoadHandler<SlCompanyOldAI, CompanyProperties> {
264 public:
265 inline static const SaveLoad description[] = {
266 SLE_CONDVAR(CompanyOldAI, num_build_rec, SLE_UINT8, SL_MIN_VERSION, SLV_107),
267 SLEG_STRUCTLIST("buildrec", SlCompanyOldAIBuildRec),
268 };
269 inline const static SaveLoadCompatTable compat_description = _company_old_ai_compat;
270
271 void Load(CompanyProperties *c) const override
272 {
273 if (!c->is_ai) return;
274
275 CompanyOldAI old_ai;
276 SlObject(&old_ai, this->GetLoadDescription());
277 }
278
279 void LoadCheck(CompanyProperties *c) const override { this->Load(c); }
280 };
281
282 class SlCompanySettings : public DefaultSaveLoadHandler<SlCompanySettings, CompanyProperties> {
283 public:
284 inline static const SaveLoad description[] = {
285 /* Engine renewal settings */
286 SLE_CONDREF(CompanyProperties, engine_renew_list, REF_ENGINE_RENEWS, SLV_19, SL_MAX_VERSION),
287 SLE_CONDVAR(CompanyProperties, settings.engine_renew, SLE_BOOL, SLV_16, SL_MAX_VERSION),
288 SLE_CONDVAR(CompanyProperties, settings.engine_renew_months, SLE_INT16, SLV_16, SL_MAX_VERSION),
289 SLE_CONDVAR(CompanyProperties, settings.engine_renew_money, SLE_UINT32, SLV_16, SL_MAX_VERSION),
290 SLE_CONDVAR(CompanyProperties, settings.renew_keep_length, SLE_BOOL, SLV_2, SL_MAX_VERSION),
291
292 /* Default vehicle settings */
293 SLE_CONDVAR(CompanyProperties, settings.vehicle.servint_ispercent, SLE_BOOL, SLV_120, SL_MAX_VERSION),
294 SLE_CONDVAR(CompanyProperties, settings.vehicle.servint_trains, SLE_UINT16, SLV_120, SL_MAX_VERSION),
295 SLE_CONDVAR(CompanyProperties, settings.vehicle.servint_roadveh, SLE_UINT16, SLV_120, SL_MAX_VERSION),
296 SLE_CONDVAR(CompanyProperties, settings.vehicle.servint_aircraft, SLE_UINT16, SLV_120, SL_MAX_VERSION),
297 SLE_CONDVAR(CompanyProperties, settings.vehicle.servint_ships, SLE_UINT16, SLV_120, SL_MAX_VERSION),
298 };
299 inline const static SaveLoadCompatTable compat_description = _company_settings_compat;
300
301 void Save(CompanyProperties *c) const override
302 {
303 SlObject(c, this->GetDescription());
304 }
305
306 void Load(CompanyProperties *c) const override
307 {
308 SlObject(c, this->GetLoadDescription());
309 }
310
311 void FixPointers(CompanyProperties *c) const override
312 {
313 SlObject(c, this->GetDescription());
314 }
315
316 void LoadCheck(CompanyProperties *c) const override { this->Load(c); }
317 };
318
319 class SlCompanyEconomy : public DefaultSaveLoadHandler<SlCompanyEconomy, CompanyProperties> {
320 public:
321 inline static const SaveLoad description[] = {
322 SLE_CONDVAR(CompanyEconomyEntry, income, SLE_FILE_I32 | SLE_VAR_I64, SL_MIN_VERSION, SLV_2),
323 SLE_CONDVAR(CompanyEconomyEntry, income, SLE_INT64, SLV_2, SL_MAX_VERSION),
324 SLE_CONDVAR(CompanyEconomyEntry, expenses, SLE_FILE_I32 | SLE_VAR_I64, SL_MIN_VERSION, SLV_2),
325 SLE_CONDVAR(CompanyEconomyEntry, expenses, SLE_INT64, SLV_2, SL_MAX_VERSION),
326 SLE_CONDVAR(CompanyEconomyEntry, company_value, SLE_FILE_I32 | SLE_VAR_I64, SL_MIN_VERSION, SLV_2),
327 SLE_CONDVAR(CompanyEconomyEntry, company_value, SLE_INT64, SLV_2, SL_MAX_VERSION),
328
329 SLE_CONDVAR(CompanyEconomyEntry, delivered_cargo[NUM_CARGO - 1], SLE_INT32, SL_MIN_VERSION, SLV_170),
330 SLE_CONDARR(CompanyEconomyEntry, delivered_cargo, SLE_UINT32, 32, SLV_170, SLV_EXTEND_CARGOTYPES),
331 SLE_CONDARR(CompanyEconomyEntry, delivered_cargo, SLE_UINT32, NUM_CARGO, SLV_EXTEND_CARGOTYPES, SL_MAX_VERSION),
332 SLE_VAR(CompanyEconomyEntry, performance_history, SLE_INT32),
333 };
334 inline const static SaveLoadCompatTable compat_description = _company_economy_compat;
335
336 void Save(CompanyProperties *c) const override
337 {
338 SlObject(&c->cur_economy, this->GetDescription());
339 }
340
341 void Load(CompanyProperties *c) const override
342 {
343 SlObject(&c->cur_economy, this->GetLoadDescription());
344 }
345
346 void FixPointers(CompanyProperties *c) const override
347 {
348 SlObject(&c->cur_economy, this->GetDescription());
349 }
350
351 void LoadCheck(CompanyProperties *c) const override { this->Load(c); }
352 };
353
354 class SlCompanyOldEconomy : public SlCompanyEconomy {
355 public:
356 void Save(CompanyProperties *c) const override
357 {
358 SlSetStructListLength(c->num_valid_stat_ent);
359 for (int i = 0; i < c->num_valid_stat_ent; i++) {
360 SlObject(&c->old_economy[i], this->GetDescription());
361 }
362 }
363
364 void Load(CompanyProperties *c) const override
365 {
366 if (!IsSavegameVersionBefore(SLV_SAVELOAD_LIST_LENGTH)) {
367 c->num_valid_stat_ent = (uint8_t)SlGetStructListLength(UINT8_MAX);
368 }
369 if (c->num_valid_stat_ent > lengthof(c->old_economy)) SlErrorCorrupt("Too many old economy entries");
370
371 for (int i = 0; i < c->num_valid_stat_ent; i++) {
372 SlObject(&c->old_economy[i], this->GetLoadDescription());
373 }
374 }
375
376 void LoadCheck(CompanyProperties *c) const override { this->Load(c); }
377 };
378
379 class SlCompanyLiveries : public DefaultSaveLoadHandler<SlCompanyLiveries, CompanyProperties> {
380 public:
381 inline static const SaveLoad description[] = {
382 SLE_CONDVAR(Livery, in_use, SLE_UINT8, SLV_34, SL_MAX_VERSION),
383 SLE_CONDVAR(Livery, colour1, SLE_UINT8, SLV_34, SL_MAX_VERSION),
384 SLE_CONDVAR(Livery, colour2, SLE_UINT8, SLV_34, SL_MAX_VERSION),
385 };
386 inline const static SaveLoadCompatTable compat_description = _company_liveries_compat;
387
392 size_t GetNumLiveries() const
393 {
394 if (IsSavegameVersionBefore(SLV_63)) return LS_END - 4;
395 if (IsSavegameVersionBefore(SLV_85)) return LS_END - 2;
396 if (IsSavegameVersionBefore(SLV_SAVELOAD_LIST_LENGTH)) return LS_END;
397 /* Read from the savegame how long the list is. */
398 return SlGetStructListLength(LS_END);
399 }
400
401 void Save(CompanyProperties *c) const override
402 {
403 SlSetStructListLength(LS_END);
404 for (int i = 0; i < LS_END; i++) {
405 SlObject(&c->livery[i], this->GetDescription());
406 }
407 }
408
409 void Load(CompanyProperties *c) const override
410 {
411 size_t num_liveries = this->GetNumLiveries();
412 bool update_in_use = IsSavegameVersionBefore(SLV_GROUP_LIVERIES);
413
414 for (size_t i = 0; i < num_liveries; i++) {
415 SlObject(&c->livery[i], this->GetLoadDescription());
416 if (update_in_use && i != LS_DEFAULT) {
417 if (c->livery[i].in_use == 0) {
418 c->livery[i].colour1 = c->livery[LS_DEFAULT].colour1;
419 c->livery[i].colour2 = c->livery[LS_DEFAULT].colour2;
420 } else {
421 c->livery[i].in_use = 3;
422 }
423 }
424 }
425
426 if (IsSavegameVersionBefore(SLV_85)) {
427 /* We want to insert some liveries somewhere in between. This means some have to be moved. */
428 memmove(&c->livery[LS_FREIGHT_WAGON], &c->livery[LS_PASSENGER_WAGON_MONORAIL], (LS_END - LS_FREIGHT_WAGON) * sizeof(c->livery[0]));
429 c->livery[LS_PASSENGER_WAGON_MONORAIL] = c->livery[LS_MONORAIL];
430 c->livery[LS_PASSENGER_WAGON_MAGLEV] = c->livery[LS_MAGLEV];
431 }
432
433 if (IsSavegameVersionBefore(SLV_63)) {
434 /* Copy bus/truck liveries over to trams */
435 c->livery[LS_PASSENGER_TRAM] = c->livery[LS_BUS];
436 c->livery[LS_FREIGHT_TRAM] = c->livery[LS_TRUCK];
437 }
438 }
439
440 void LoadCheck(CompanyProperties *c) const override { this->Load(c); }
441 };
442
443 /* Save/load of companies */
444 static const SaveLoad _company_desc[] = {
445 SLE_VAR(CompanyProperties, name_2, SLE_UINT32),
446 SLE_VAR(CompanyProperties, name_1, SLE_STRINGID),
447 SLE_CONDSSTR(CompanyProperties, name, SLE_STR | SLF_ALLOW_CONTROL, SLV_84, SL_MAX_VERSION),
448
449 SLE_VAR(CompanyProperties, president_name_1, SLE_STRINGID),
450 SLE_VAR(CompanyProperties, president_name_2, SLE_UINT32),
451 SLE_CONDSSTR(CompanyProperties, president_name, SLE_STR | SLF_ALLOW_CONTROL, SLV_84, SL_MAX_VERSION),
452
453 SLE_VAR(CompanyProperties, face, SLE_UINT32),
454
455 /* money was changed to a 64 bit field in savegame version 1. */
456 SLE_CONDVAR(CompanyProperties, money, SLE_VAR_I64 | SLE_FILE_I32, SL_MIN_VERSION, SLV_1),
457 SLE_CONDVAR(CompanyProperties, money, SLE_INT64, SLV_1, SL_MAX_VERSION),
458
459 SLE_CONDVAR(CompanyProperties, current_loan, SLE_VAR_I64 | SLE_FILE_I32, SL_MIN_VERSION, SLV_65),
460 SLE_CONDVAR(CompanyProperties, current_loan, SLE_INT64, SLV_65, SL_MAX_VERSION),
461 SLE_CONDVAR(CompanyProperties, max_loan, SLE_INT64, SLV_MAX_LOAN_FOR_COMPANY, SL_MAX_VERSION),
462
463 SLE_VAR(CompanyProperties, colour, SLE_UINT8),
464 SLE_VAR(CompanyProperties, money_fraction, SLE_UINT8),
465 SLE_VAR(CompanyProperties, block_preview, SLE_UINT8),
466
467 SLE_CONDVAR(CompanyProperties, location_of_HQ, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
468 SLE_CONDVAR(CompanyProperties, location_of_HQ, SLE_UINT32, SLV_6, SL_MAX_VERSION),
469 SLE_CONDVAR(CompanyProperties, last_build_coordinate, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
470 SLE_CONDVAR(CompanyProperties, last_build_coordinate, SLE_UINT32, SLV_6, SL_MAX_VERSION),
471 SLE_CONDVAR(CompanyProperties, inaugurated_year, SLE_FILE_U8 | SLE_VAR_I32, SL_MIN_VERSION, SLV_31),
472 SLE_CONDVAR(CompanyProperties, inaugurated_year, SLE_INT32, SLV_31, SL_MAX_VERSION),
473
474 SLE_CONDVAR(CompanyProperties, num_valid_stat_ent, SLE_UINT8, SL_MIN_VERSION, SLV_SAVELOAD_LIST_LENGTH),
475
476 SLE_VAR(CompanyProperties, months_of_bankruptcy, SLE_UINT8),
477 SLE_CONDVAR(CompanyProperties, bankrupt_asked, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_104),
478 SLE_CONDVAR(CompanyProperties, bankrupt_asked, SLE_UINT16, SLV_104, SL_MAX_VERSION),
479 SLE_VAR(CompanyProperties, bankrupt_timeout, SLE_INT16),
480 SLE_CONDVAR(CompanyProperties, bankrupt_value, SLE_VAR_I64 | SLE_FILE_I32, SL_MIN_VERSION, SLV_65),
481 SLE_CONDVAR(CompanyProperties, bankrupt_value, SLE_INT64, SLV_65, SL_MAX_VERSION),
482
483 /* yearly expenses was changed to 64-bit in savegame version 2. */
484 SLE_CONDARR(CompanyProperties, yearly_expenses, SLE_FILE_I32 | SLE_VAR_I64, 3 * 13, SL_MIN_VERSION, SLV_2),
485 SLE_CONDARR(CompanyProperties, yearly_expenses, SLE_INT64, 3 * 13, SLV_2, SL_MAX_VERSION),
486
487 SLE_CONDVAR(CompanyProperties, is_ai, SLE_BOOL, SLV_2, SL_MAX_VERSION),
488
489 SLE_CONDVAR(CompanyProperties, terraform_limit, SLE_UINT32, SLV_156, SL_MAX_VERSION),
490 SLE_CONDVAR(CompanyProperties, clear_limit, SLE_UINT32, SLV_156, SL_MAX_VERSION),
491 SLE_CONDVAR(CompanyProperties, tree_limit, SLE_UINT32, SLV_175, SL_MAX_VERSION),
492 SLEG_STRUCT("settings", SlCompanySettings),
493 SLEG_CONDSTRUCT("old_ai", SlCompanyOldAI, SL_MIN_VERSION, SLV_107),
494 SLEG_STRUCT("cur_economy", SlCompanyEconomy),
495 SLEG_STRUCTLIST("old_economy", SlCompanyOldEconomy),
496 SLEG_CONDSTRUCTLIST("liveries", SlCompanyLiveries, SLV_34, SL_MAX_VERSION),
497 };
498
499 struct PLYRChunkHandler : ChunkHandler {
500 PLYRChunkHandler() : ChunkHandler('PLYR', CH_TABLE) {}
501
502 void Save() const override
503 {
504 SlTableHeader(_company_desc);
505
506 for (Company *c : Company::Iterate()) {
507 SlSetArrayIndex(c->index);
508 SlObject(c, _company_desc);
509 }
510 }
511
512 void Load() const override
513 {
514 const std::vector<SaveLoad> slt = SlCompatTableHeader(_company_desc, _company_sl_compat);
515
516 int index;
517 while ((index = SlIterateArray()) != -1) {
518 Company *c = new (index) Company();
519 SlObject(c, slt);
520 _company_colours[index] = c->colour;
521 }
522 }
523
524
525 void LoadCheck(size_t) const override
526 {
527 const std::vector<SaveLoad> slt = SlCompatTableHeader(_company_desc, _company_sl_compat);
528
529 int index;
530 while ((index = SlIterateArray()) != -1) {
531 std::unique_ptr<CompanyProperties> cprops = std::make_unique<CompanyProperties>();
532 SlObject(cprops.get(), slt);
533
534 /* We do not load old custom names */
535 if (IsSavegameVersionBefore(SLV_84)) {
536 if (GetStringTab(cprops->name_1) == TEXT_TAB_OLD_CUSTOM) {
537 cprops->name_1 = STR_GAME_SAVELOAD_NOT_AVAILABLE;
538 }
539
540 if (GetStringTab(cprops->president_name_1) == TEXT_TAB_OLD_CUSTOM) {
541 cprops->president_name_1 = STR_GAME_SAVELOAD_NOT_AVAILABLE;
542 }
543 }
544
545 if (cprops->name.empty() && !IsInsideMM(cprops->name_1, SPECSTR_COMPANY_NAME_START, SPECSTR_COMPANY_NAME_LAST + 1) &&
546 cprops->name_1 != STR_GAME_SAVELOAD_NOT_AVAILABLE && cprops->name_1 != STR_SV_UNNAMED &&
547 cprops->name_1 != SPECSTR_ANDCO_NAME && cprops->name_1 != SPECSTR_PRESIDENT_NAME &&
548 cprops->name_1 != SPECSTR_SILLY_NAME) {
549 cprops->name_1 = STR_GAME_SAVELOAD_NOT_AVAILABLE;
550 }
551
552 if (_load_check_data.companies.count(index) == 0) {
553 _load_check_data.companies[index] = std::move(cprops);
554 }
555 }
556 }
557
558 void FixPointers() const override
559 {
560 for (Company *c : Company::Iterate()) {
561 SlObject(c, _company_desc);
562 }
563 }
564 };
565
566 static const PLYRChunkHandler PLYR;
567 static const ChunkHandlerRef company_chunk_handlers[] = {
568 PLYR,
569 };
570
571 extern const ChunkHandlerTable _company_chunk_handlers(company_chunk_handlers);
SLEG_CONDSTRUCTLIST
#define SLEG_CONDSTRUCTLIST(name, handler, from, to)
Storage of a list of structs in some savegame versions.
Definition: saveload.h:1120
CompanyProperties::is_ai
bool is_ai
If true, the company is (also) controlled by the computer (a NoAI program).
Definition: company_base.h:108
DefaultSaveLoadHandler
Default handler for saving/loading an object to/from disk.
Definition: saveload.h:563
SetBit
constexpr T SetBit(T &x, const uint8_t y)
Set a bit in a variable.
Definition: bitmath_func.hpp:121
Pool::PoolItem<&_company_pool >::Get
static Titem * Get(size_t index)
Returns Titem with given index.
Definition: pool_type.hpp:339
SlCompanyLiveries
Definition: company_sl.cpp:379
IsInsideMM
constexpr bool IsInsideMM(const T x, const size_t min, const size_t max) noexcept
Checks if a value is in an interval.
Definition: math_func.hpp:268
GetTunnelBridgeLength
uint GetTunnelBridgeLength(TileIndex begin, TileIndex end)
Calculates the length of a tunnel or a bridge (without end tiles)
Definition: tunnelbridge.h:25
SlCompanySettings
Definition: company_sl.cpp:282
Pool::PoolItem<&_company_pool >::GetIfValid
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
Definition: pool_type.hpp:350
SaveLoadTable
std::span< const struct SaveLoad > SaveLoadTable
A table of SaveLoad entries.
Definition: saveload.h:497
SLV_63
@ SLV_63
63 9956
Definition: saveload.h:118
GetWaterClass
WaterClass GetWaterClass(Tile t)
Get the water class at a tile.
Definition: water_map.h:115
GetLockPart
byte GetLockPart(Tile t)
Get the part of a lock.
Definition: water_map.h:329
PLYRChunkHandler::FixPointers
void FixPointers() const override
Fix the pointers.
Definition: company_sl.cpp:558
SLE_CONDSSTR
#define SLE_CONDSSTR(base, variable, type, from, to)
Storage of a std::string in some savegame versions.
Definition: saveload.h:913
Station
Station data structure.
Definition: station_base.h:442
ChunkHandlerRef
std::reference_wrapper< const ChunkHandler > ChunkHandlerRef
A reference to ChunkHandler.
Definition: saveload.h:491
LEVELCROSSING_TRACKBIT_FACTOR
static const uint LEVELCROSSING_TRACKBIT_FACTOR
Multiplier for how many regular track bits a level crossing counts.
Definition: economy_type.h:243
IsPlainRail
static debug_inline bool IsPlainRail(Tile t)
Returns whether this is plain rails, with or without signals.
Definition: rail_map.h:49
SLE_CONDARR
#define SLE_CONDARR(base, variable, type, length, from, to)
Storage of a fixed-size array of SL_VAR elements in some savegame versions.
Definition: saveload.h:880
SL_MIN_VERSION
@ SL_MIN_VERSION
First savegame version.
Definition: saveload.h:31
PLYRChunkHandler::Save
void Save() const override
Save the chunk.
Definition: company_sl.cpp:502
GB
constexpr static debug_inline 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
_load_check_data
LoadCheckData _load_check_data
Data loaded from save during SL_LOAD_CHECK.
Definition: fios_gui.cpp:40
GenderEthnicity
GenderEthnicity
The gender/race combinations that we have faces for.
Definition: company_manager_face.h:19
SLE_CONDVAR
#define SLE_CONDVAR(base, variable, type, from, to)
Storage of a variable in some savegame versions.
Definition: saveload.h:848
SlErrorCorrupt
void SlErrorCorrupt(const std::string &msg)
Error handler for corrupt savegames.
Definition: saveload.cpp:364
MP_RAILWAY
@ MP_RAILWAY
A railway.
Definition: tile_type.h:49
SaveLoadHandler::GetLoadDescription
SaveLoadTable GetLoadDescription() const
Get the description for how to load the chunk.
Definition: saveload.cpp:3248
saveload.h
IsNormalRoad
static debug_inline bool IsNormalRoad(Tile t)
Return whether a tile is a normal road.
Definition: road_map.h:64
IsLevelCrossing
bool IsLevelCrossing(Tile t)
Return whether a tile is a level crossing.
Definition: road_map.h:85
SaveLoadCompatTable
std::span< const struct SaveLoadCompat > SaveLoadCompatTable
A table of SaveLoadCompat entries.
Definition: saveload.h:500
TRANSPORT_WATER
@ TRANSPORT_WATER
Transport over water.
Definition: transport_type.h:29
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
ClampU
constexpr uint ClampU(const uint a, const uint min, const uint max)
Clamp an unsigned integer between an interval.
Definition: math_func.hpp:150
Company::infrastructure
CompanyInfrastructure infrastructure
NOSAVE: Counts of company owned infrastructure.
Definition: company_base.h:143
CompanyInfrastructure::road
uint32_t road[ROADTYPE_END]
Count of company owned track bits for each road type.
Definition: company_base.h:33
ChunkHandler
Handlers and description of chunk.
Definition: saveload.h:445
GetRailType
RailType GetRailType(Tile t)
Gets the rail type of the given tile.
Definition: rail_map.h:115
MP_ROAD
@ MP_ROAD
A tile with road (or tram tracks)
Definition: tile_type.h:50
INVALID_ROADTYPE
@ INVALID_ROADTYPE
flag for invalid roadtype
Definition: road_type.h:30
IsLock
bool IsLock(Tile t)
Is there a lock on a given water tile?
Definition: water_map.h:306
CompanyInfrastructure::station
uint32_t station
Count of company owned station tiles.
Definition: company_base.h:37
CompanyEconomyEntry
Statistics about the economy.
Definition: company_base.h:24
TracksOverlap
bool TracksOverlap(TrackBits bits)
Checks if the given tracks overlap, ie form a crossing.
Definition: track_func.h:645
SLV_16
@ SLV_16
16.0 2817 16.1 3155
Definition: saveload.h:60
ScaleCompanyManagerFaceValue
uint ScaleCompanyManagerFaceValue(CompanyManagerFaceVariable cmfv, GenderEthnicity ge, uint val)
Scales a company manager's face bits variable to the correct scope.
Definition: company_manager_face.h:164
SLV_6
@ SLV_6
6.0 1721 6.1 1768
Definition: saveload.h:46
SpecializedStation< Station, false >::Iterate
static Pool::IterateWrapper< Station > Iterate(size_t from=0)
Returns an iterable ensemble of all valid stations of type T.
Definition: base_station_base.h:310
ConvertFromOldCompanyManagerFace
CompanyManagerFace ConvertFromOldCompanyManagerFace(uint32_t face)
Converts an old company manager's face format to the new company manager's face format.
Definition: company_sl.cpp:45
GENDER_FEMALE
@ GENDER_FEMALE
This bit set means a female, otherwise male.
Definition: company_manager_face.h:20
GetTileType
static debug_inline TileType GetTileType(Tile tile)
Get the tiletype of a given tile.
Definition: tile_map.h:96
_company_liveries_compat
const SaveLoadCompat _company_liveries_compat[]
Original field order for SlCompanyLiveries.
Definition: company_sl_compat.h:83
_company_colours
Colours _company_colours[MAX_COMPANIES]
NOSAVE: can be determined from company structs.
Definition: company_cmd.cpp:52
PLYRChunkHandler
Definition: company_sl.cpp:499
TRANSPORT_RAIL
@ TRANSPORT_RAIL
Transport by train.
Definition: transport_type.h:27
SLF_ALLOW_CONTROL
@ SLF_ALLOW_CONTROL
Allow control codes in the strings.
Definition: saveload.h:670
CompanyOldAI
Definition: company_sl.cpp:242
CompanyProperties::num_valid_stat_ent
byte num_valid_stat_ent
Number of valid statistical entries in old_economy.
Definition: company_base.h:113
SlCompanyOldAI
Definition: company_sl.cpp:263
SLV_85
@ SLV_85
85 11874
Definition: saveload.h:145
IsSavegameVersionBefore
bool IsSavegameVersionBefore(SaveLoadVersion major, byte minor=0)
Checks whether the savegame is below major.
Definition: saveload.h:1215
MP_OBJECT
@ MP_OBJECT
Contains objects such as transmitters and owned land.
Definition: tile_type.h:58
CompanyProperties::colour
Colours colour
Company colour.
Definition: company_base.h:85
MP_WATER
@ MP_WATER
Water tile.
Definition: tile_type.h:54
_company_old_ai_buildrec_compat
const SaveLoadCompat _company_old_ai_buildrec_compat[]
Original field order for SlCompanyOldAIBuildRec.
Definition: company_sl_compat.h:16
AfterLoadCompanyStats
void AfterLoadCompanyStats()
Rebuilding of company statistics after loading a savegame.
Definition: company_sl.cpp:96
WATER_CLASS_CANAL
@ WATER_CLASS_CANAL
Canal.
Definition: water_map.h:49
TUNNELBRIDGE_TRACKBIT_FACTOR
static const uint TUNNELBRIDGE_TRACKBIT_FACTOR
Multiplier for how many regular track bits a tunnel/bridge counts.
Definition: economy_type.h:241
LOCK_PART_MIDDLE
@ LOCK_PART_MIDDLE
Middle part of a lock.
Definition: water_map.h:74
Livery::in_use
byte in_use
Bit 0 set if this livery should override the default livery first colour, Bit 1 for the second colour...
Definition: livery.h:79
SlCompanyOldEconomy
Definition: company_sl.cpp:354
lengthof
#define lengthof(array)
Return the length of an fixed size array.
Definition: stdafx.h:303
SLV_SAVELOAD_LIST_LENGTH
@ SLV_SAVELOAD_LIST_LENGTH
293 PR#9374 Consistency in list length with SL_STRUCT / SL_STRUCTLIST / SL_DEQUE / SL_REFLIST.
Definition: saveload.h:331
SLV_65
@ SLV_65
65 10210
Definition: saveload.h:121
SLE_CONDREF
#define SLE_CONDREF(base, variable, type, from, to)
Storage of a reference in some savegame versions.
Definition: saveload.h:869
SLV_31
@ SLV_31
31 5999
Definition: saveload.h:80
settings
fluid_settings_t * settings
FluidSynth settings handle.
Definition: fluidsynth.cpp:21
CompanyManagerFace
uint32_t CompanyManagerFace
Company manager face bits, info see in company_manager_face.h.
Definition: company_type.h:52
GetTileOwner
Owner GetTileOwner(Tile tile)
Returns the owner of a tile.
Definition: tile_map.h:178
SL_MAX_VERSION
@ SL_MAX_VERSION
Highest possible saveload version.
Definition: saveload.h:382
MP_TUNNELBRIDGE
@ MP_TUNNELBRIDGE
Tunnel entry/exit and bridge heads.
Definition: tile_type.h:57
REF_ENGINE_RENEWS
@ REF_ENGINE_RENEWS
Load/save a reference to an engine renewal (autoreplace).
Definition: saveload.h:589
GetPresentSignals
uint GetPresentSignals(Tile tile)
Get whether the given signals are present (Along/AgainstTrackDir)
Definition: rail_map.h:393
SLV_175
@ SLV_175
175 24136
Definition: saveload.h:253
CountBits
constexpr uint CountBits(T value)
Counts the number of set bits in a variable.
Definition: bitmath_func.hpp:243
SLV_170
@ SLV_170
170 23826
Definition: saveload.h:247
GetStationType
StationType GetStationType(Tile t)
Get the station type of this tile.
Definition: station_map.h:44
SlGetStructListLength
size_t SlGetStructListLength(size_t limit)
Get the length of this list; if it exceeds the limit, error out.
Definition: saveload.cpp:1648
SLV_GROUP_LIVERIES
@ SLV_GROUP_LIVERIES
205 PR#7108 Livery storage change and group liveries.
Definition: saveload.h:290
GetTrackBits
TrackBits GetTrackBits(Tile tile)
Gets the track bits of the given tile.
Definition: rail_map.h:136
SLV_84
@ SLV_84
84 11822
Definition: saveload.h:143
SLV_120
@ SLV_120
120 16439
Definition: saveload.h:187
_company_old_ai_compat
const SaveLoadCompat _company_old_ai_compat[]
Original field order for SlCompanyOldAI.
Definition: company_sl_compat.h:25
LoadCheckData::companies
CompanyPropertiesMap companies
Company information.
Definition: fios.h:43
SLE_VAR
#define SLE_VAR(base, variable, type)
Storage of a variable in every version of a savegame.
Definition: saveload.h:952
SLV_34
@ SLV_34
34 6455
Definition: saveload.h:83
Pool::PoolItem<&_company_pool >::Iterate
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
Definition: pool_type.hpp:388
IsBuoy
bool IsBuoy(Tile t)
Is tile t a buoy tile?
Definition: station_map.h:307
_company_sl_compat
const SaveLoadCompat _company_sl_compat[]
Original field order for company_desc.
Definition: company_sl_compat.h:90
CompanyProperties::cur_economy
CompanyEconomyEntry cur_economy
Economic data of the company of this quarter.
Definition: company_base.h:111
company_sl_compat.h
CompanyInfrastructure::signal
uint32_t signal
Count of company owned signals.
Definition: company_base.h:34
Map::Size
static debug_inline uint Size()
Get the size of the map.
Definition: map_func.h:288
SLV_107
@ SLV_107
107 15027
Definition: saveload.h:171
SLV_1
@ SLV_1
1.0 0.1.x, 0.2.x
Definition: saveload.h:33
DefaultSaveLoadHandler< SlCompanySettings, CompanyProperties >::GetDescription
SaveLoadTable GetDescription() const override
Definition: saveload.h:565
Livery::colour1
Colours colour1
First colour, for all vehicles.
Definition: livery.h:80
HasSignals
bool HasSignals(Tile t)
Checks if a rail tile has signals.
Definition: rail_map.h:72
SLV_2
@ SLV_2
2.0 0.3.0 2.1 0.3.1, 0.3.2
Definition: saveload.h:34
MP_STATION
@ MP_STATION
A tile of a station.
Definition: tile_type.h:53
GetRoadOwner
Owner GetRoadOwner(Tile t, RoadTramType rtt)
Get the owner of a specific road type.
Definition: road_map.h:234
SlCompanyOldAIBuildRec::GetDescription
SaveLoadTable GetDescription() const override
Get the description of the fields in the savegame.
Definition: company_sl.cpp:251
GetTunnelBridgeTransportType
TransportType GetTunnelBridgeTransportType(Tile t)
Tunnel: Get the transport type of the tunnel (road or rail) Bridge: Get the transport type of the bri...
Definition: tunnelbridge_map.h:39
ChunkHandlerTable
std::span< const ChunkHandlerRef > ChunkHandlerTable
A table of ChunkHandler entries.
Definition: saveload.h:494
RoadType
RoadType
The different roadtypes we support.
Definition: road_type.h:25
GetRoadBits
RoadBits GetRoadBits(Tile t, RoadTramType rtt)
Get the present road bits for a specific road type.
Definition: road_map.h:128
GetOtherTunnelBridgeEnd
TileIndex GetOtherTunnelBridgeEnd(Tile t)
Determines type of the wormhole and returns its other end.
Definition: tunnelbridge_map.h:78
_company_settings_compat
const SaveLoadCompat _company_settings_compat[]
Original field order for SlCompanySettings.
Definition: company_sl_compat.h:57
LOCK_DEPOT_TILE_FACTOR
static const uint LOCK_DEPOT_TILE_FACTOR
Multiplier for how many regular tiles a lock counts.
Definition: economy_type.h:249
SetCompanyManagerFaceBits
void SetCompanyManagerFaceBits(CompanyManagerFace &cmf, CompanyManagerFaceVariable cmfv, [[maybe_unused]] GenderEthnicity ge, uint val)
Sets the company manager's face bits for the given company manager's face variable.
Definition: company_manager_face.h:111
TrackBits
TrackBits
Allow incrementing of Track variables.
Definition: track_type.h:35
SLV_104
@ SLV_104
104 14735
Definition: saveload.h:167
IsStationTileBlocked
bool IsStationTileBlocked(Tile t)
Is tile t a blocked tile?
Definition: station_map.h:338
MemSetT
void MemSetT(T *ptr, byte value, size_t num=1)
Type-safe version of memset().
Definition: mem_func.hpp:49
SLV_EXTEND_CARGOTYPES
@ SLV_EXTEND_CARGOTYPES
199 PR#6802 Extend cargotypes to 64
Definition: saveload.h:282
SlCompatTableHeader
std::vector< SaveLoad > SlCompatTableHeader(const SaveLoadTable &slt, const SaveLoadCompatTable &slct)
Load a table header in a savegame compatible way.
Definition: saveload.cpp:1852
TRANSPORT_ROAD
@ TRANSPORT_ROAD
Transport by road vehicle.
Definition: transport_type.h:28
SlCompanyEconomy
Definition: company_sl.cpp:319
SlCompanyOldAIBuildRec
Definition: company_sl.cpp:246
SLV_156
@ SLV_156
156 21728
Definition: saveload.h:230
Pool::PoolItem<&_company_pool >::IsValidID
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
Definition: pool_type.hpp:328
SLV_19
@ SLV_19
19 3396
Definition: saveload.h:65
GE_WM
@ GE_WM
A male of Caucasian origin (white)
Definition: company_manager_face.h:23
FACIL_AIRPORT
@ FACIL_AIRPORT
Station with an airport.
Definition: station_type.h:55
GetStringTab
StringTab GetStringTab(StringID str)
Extract the StringTab from a StringID.
Definition: strings_func.h:25
SlObject
void SlObject(void *object, const SaveLoadTable &slt)
Main SaveLoad function.
Definition: saveload.cpp:1661
NUM_CARGO
static const CargoID NUM_CARGO
Maximum number of cargo types in a game.
Definition: cargo_type.h:74
SlTableHeader
std::vector< SaveLoad > SlTableHeader(const SaveLoadTable &slt)
Save or Load a table header.
Definition: saveload.cpp:1714
SLEG_CONDSTRUCT
#define SLEG_CONDSTRUCT(name, handler, from, to)
Storage of a structs in some savegame versions.
Definition: saveload.h:1091
SlSetStructListLength
void SlSetStructListLength(size_t length)
Set the length of this list.
Definition: saveload.cpp:1632
SaveLoad
SaveLoad type struct.
Definition: saveload.h:697
_company_economy_compat
const SaveLoadCompat _company_economy_compat[]
Original field order for SlCompanyEconomy.
Definition: company_sl_compat.h:73
Company
Definition: company_base.h:129
Livery::colour2
Colours colour2
Second colour, for vehicles with 2CC support.
Definition: livery.h:81
CompanyProperties::old_economy
CompanyEconomyEntry old_economy[MAX_HISTORY_QUARTERS]
Economic data of the company of the last MAX_HISTORY_QUARTERS quarters.
Definition: company_base.h:112
ETHNICITY_BLACK
@ ETHNICITY_BLACK
This bit set means black, otherwise white.
Definition: company_manager_face.h:21
IsShipDepot
bool IsShipDepot(Tile t)
Is it a water tile with a ship depot on it?
Definition: water_map.h:225
Livery
Information about a particular livery.
Definition: livery.h:78
PLYRChunkHandler::Load
void Load() const override
Load the chunk.
Definition: company_sl.cpp:512
SLV_MAX_LOAN_FOR_COMPANY
@ SLV_MAX_LOAN_FOR_COMPANY
330 PR#11224 Separate max loan for each company.
Definition: saveload.h:376
CompanyProperties
Statically loadable part of Company pool item.
Definition: company_base.h:69
CompanyInfrastructure::water
uint32_t water
Count of company owned track bits for canals.
Definition: company_base.h:36
SlCompanyLiveries::GetNumLiveries
size_t GetNumLiveries() const
Get the number of liveries used by this savegame version.
Definition: company_sl.cpp:392
IsRoadDepot
static debug_inline bool IsRoadDepot(Tile t)
Return whether a tile is a road depot.
Definition: road_map.h:106
PLYRChunkHandler::LoadCheck
void LoadCheck(size_t) const override
Load the chunk for game preview.
Definition: company_sl.cpp:525
SlIterateArray
int SlIterateArray()
Iterate through the elements of an array and read the whole thing.
Definition: saveload.cpp:656
GE_WF
@ GE_WF
A female of Caucasian origin (white)
Definition: company_manager_face.h:24
CompanyInfrastructure::rail
uint32_t rail[RAILTYPE_END]
Count of company owned track bits for each rail type.
Definition: company_base.h:35
SLEG_STRUCTLIST
#define SLEG_STRUCTLIST(name, handler)
Storage of a list of structs in every savegame version.
Definition: saveload.h:1182
SLEG_STRUCT
#define SLEG_STRUCT(name, handler)
Storage of a structs in every savegame version.
Definition: saveload.h:1159
HasBit
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
Definition: bitmath_func.hpp:103