OpenTTD Source  20240917-master-g9ab0a47812
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"
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 
46 {
47  CompanyManagerFace cmf = 0;
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 
97 {
98  /* Reset infrastructure statistics to zero. */
99  for (Company *c : Company::Iterate()) c->infrastructure = {};
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:
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 
123  }
124  break;
125 
126  case MP_ROAD: {
127  if (IsLevelCrossing(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:
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  case STATION_ROADWAYPOINT: {
156  /* Iterate all present road types as each can have a different owner. */
157  for (RoadTramType rtt : _roadtramtypes) {
158  RoadType rt = GetRoadType(tile, rtt);
159  if (rt == INVALID_ROADTYPE) continue;
160  c = Company::GetIfValid(GetRoadOwner(tile, rtt));
161  if (c != nullptr) c->infrastructure.road[rt] += 2; // A road stop has two road bits.
162  }
163  break;
164  }
165 
166  case STATION_DOCK:
167  case STATION_BUOY:
168  if (GetWaterClass(tile) == WATER_CLASS_CANAL) {
169  if (c != nullptr) c->infrastructure.water++;
170  }
171  break;
172 
173  default:
174  break;
175  }
176  break;
177 
178  case MP_WATER:
179  if (IsShipDepot(tile) || IsLock(tile)) {
181  if (c != nullptr) {
183  if (IsLock(tile) && GetLockPart(tile) == LOCK_PART_MIDDLE) {
184  /* The middle tile specifies the owner of the lock. */
185  c->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // the middle tile specifies the owner of the
186  break; // do not count the middle tile as canal
187  }
188  }
189  }
190  [[fallthrough]];
191 
192  case MP_OBJECT:
193  if (GetWaterClass(tile) == WATER_CLASS_CANAL) {
195  if (c != nullptr) c->infrastructure.water++;
196  }
197  break;
198 
199  case MP_TUNNELBRIDGE: {
200  /* Only count the tunnel/bridge if we're on the northern end tile. */
201  TileIndex other_end = GetOtherTunnelBridgeEnd(tile);
202  if (tile < other_end) {
203  /* Count each tunnel/bridge TUNNELBRIDGE_TRACKBIT_FACTOR times to simulate
204  * the higher structural maintenance needs, and don't forget the end tiles. */
205  uint len = (GetTunnelBridgeLength(tile, other_end) + 2) * TUNNELBRIDGE_TRACKBIT_FACTOR;
206 
207  switch (GetTunnelBridgeTransportType(tile)) {
208  case TRANSPORT_RAIL:
210  if (c != nullptr) c->infrastructure.rail[GetRailType(tile)] += len;
211  break;
212 
213  case TRANSPORT_ROAD: {
214  /* Iterate all present road types as each can have a different owner. */
215  for (RoadTramType rtt : _roadtramtypes) {
216  RoadType rt = GetRoadType(tile, rtt);
217  if (rt == INVALID_ROADTYPE) continue;
218  c = Company::GetIfValid(GetRoadOwner(tile, rtt));
219  if (c != nullptr) c->infrastructure.road[rt] += len * 2; // A full diagonal road has two road bits.
220  }
221  break;
222  }
223 
224  case TRANSPORT_WATER:
226  if (c != nullptr) c->infrastructure.water += len;
227  break;
228 
229  default:
230  break;
231  }
232  }
233  break;
234  }
235 
236  default:
237  break;
238  }
239  }
240 }
241 
242 /* We do need to read this single value, as the bigger it gets, the more data is stored */
243 struct CompanyOldAI {
244  uint8_t num_build_rec;
245 };
246 
247 class SlCompanyOldAIBuildRec : public DefaultSaveLoadHandler<SlCompanyOldAIBuildRec, CompanyOldAI> {
248 public:
249  inline static const SaveLoad description[] = {{}}; // Needed to keep DefaultSaveLoadHandler happy.
250  inline const static SaveLoadCompatTable compat_description = _company_old_ai_buildrec_compat;
251 
252  SaveLoadTable GetDescription() const override { return {}; }
253 
254  void Load(CompanyOldAI *old_ai) const override
255  {
256  for (int i = 0; i != old_ai->num_build_rec; i++) {
257  SlObject(nullptr, this->GetLoadDescription());
258  }
259  }
260 
261  void LoadCheck(CompanyOldAI *old_ai) const override { this->Load(old_ai); }
262 };
263 
264 class SlCompanyOldAI : public DefaultSaveLoadHandler<SlCompanyOldAI, CompanyProperties> {
265 public:
266  inline static const SaveLoad description[] = {
267  SLE_CONDVAR(CompanyOldAI, num_build_rec, SLE_UINT8, SL_MIN_VERSION, SLV_107),
269  };
270  inline const static SaveLoadCompatTable compat_description = _company_old_ai_compat;
271 
272  void Load(CompanyProperties *c) const override
273  {
274  if (!c->is_ai) return;
275 
276  CompanyOldAI old_ai;
277  SlObject(&old_ai, this->GetLoadDescription());
278  }
279 
280  void LoadCheck(CompanyProperties *c) const override { this->Load(c); }
281 };
282 
283 class SlCompanySettings : public DefaultSaveLoadHandler<SlCompanySettings, CompanyProperties> {
284 public:
285  inline static const SaveLoad description[] = {
286  /* Engine renewal settings */
288  SLE_CONDVAR(CompanyProperties, settings.engine_renew, SLE_BOOL, SLV_16, SL_MAX_VERSION),
289  SLE_CONDVAR(CompanyProperties, settings.engine_renew_months, SLE_INT16, SLV_16, SL_MAX_VERSION),
290  SLE_CONDVAR(CompanyProperties, settings.engine_renew_money, SLE_UINT32, SLV_16, SL_MAX_VERSION),
291  SLE_CONDVAR(CompanyProperties, settings.renew_keep_length, SLE_BOOL, SLV_2, SL_MAX_VERSION),
292 
293  /* Default vehicle settings */
294  SLE_CONDVAR(CompanyProperties, settings.vehicle.servint_ispercent, SLE_BOOL, SLV_120, SL_MAX_VERSION),
295  SLE_CONDVAR(CompanyProperties, settings.vehicle.servint_trains, SLE_UINT16, SLV_120, SL_MAX_VERSION),
296  SLE_CONDVAR(CompanyProperties, settings.vehicle.servint_roadveh, SLE_UINT16, SLV_120, SL_MAX_VERSION),
297  SLE_CONDVAR(CompanyProperties, settings.vehicle.servint_aircraft, SLE_UINT16, SLV_120, SL_MAX_VERSION),
298  SLE_CONDVAR(CompanyProperties, settings.vehicle.servint_ships, SLE_UINT16, SLV_120, SL_MAX_VERSION),
299  };
300  inline const static SaveLoadCompatTable compat_description = _company_settings_compat;
301 
302  void Save(CompanyProperties *c) const override
303  {
304  SlObject(c, this->GetDescription());
305  }
306 
307  void Load(CompanyProperties *c) const override
308  {
309  SlObject(c, this->GetLoadDescription());
310  }
311 
312  void FixPointers(CompanyProperties *c) const override
313  {
314  SlObject(c, this->GetDescription());
315  }
316 
317  void LoadCheck(CompanyProperties *c) const override { this->Load(c); }
318 };
319 
320 class SlCompanyEconomy : public DefaultSaveLoadHandler<SlCompanyEconomy, CompanyProperties> {
321 public:
322  inline static const SaveLoad description[] = {
323  SLE_CONDVAR(CompanyEconomyEntry, income, SLE_FILE_I32 | SLE_VAR_I64, SL_MIN_VERSION, SLV_2),
324  SLE_CONDVAR(CompanyEconomyEntry, income, SLE_INT64, SLV_2, SL_MAX_VERSION),
325  SLE_CONDVAR(CompanyEconomyEntry, expenses, SLE_FILE_I32 | SLE_VAR_I64, SL_MIN_VERSION, SLV_2),
326  SLE_CONDVAR(CompanyEconomyEntry, expenses, SLE_INT64, SLV_2, SL_MAX_VERSION),
327  SLE_CONDVAR(CompanyEconomyEntry, company_value, SLE_FILE_I32 | SLE_VAR_I64, SL_MIN_VERSION, SLV_2),
328  SLE_CONDVAR(CompanyEconomyEntry, company_value, SLE_INT64, SLV_2, SL_MAX_VERSION),
329 
330  SLE_CONDVAR(CompanyEconomyEntry, delivered_cargo[NUM_CARGO - 1], SLE_INT32, SL_MIN_VERSION, SLV_170),
331  SLE_CONDARR(CompanyEconomyEntry, delivered_cargo, SLE_UINT32, 32, SLV_170, SLV_EXTEND_CARGOTYPES),
333  SLE_VAR(CompanyEconomyEntry, performance_history, SLE_INT32),
334  };
335  inline const static SaveLoadCompatTable compat_description = _company_economy_compat;
336 
337  void Save(CompanyProperties *c) const override
338  {
339  SlObject(&c->cur_economy, this->GetDescription());
340  }
341 
342  void Load(CompanyProperties *c) const override
343  {
344  SlObject(&c->cur_economy, this->GetLoadDescription());
345  }
346 
347  void FixPointers(CompanyProperties *c) const override
348  {
349  SlObject(&c->cur_economy, this->GetDescription());
350  }
351 
352  void LoadCheck(CompanyProperties *c) const override { this->Load(c); }
353 };
354 
356 public:
357  void Save(CompanyProperties *c) const override
358  {
360  for (int i = 0; i < c->num_valid_stat_ent; i++) {
361  SlObject(&c->old_economy[i], this->GetDescription());
362  }
363  }
364 
365  void Load(CompanyProperties *c) const override
366  {
368  c->num_valid_stat_ent = (uint8_t)SlGetStructListLength(UINT8_MAX);
369  }
370  if (c->num_valid_stat_ent > lengthof(c->old_economy)) SlErrorCorrupt("Too many old economy entries");
371 
372  for (int i = 0; i < c->num_valid_stat_ent; i++) {
373  SlObject(&c->old_economy[i], this->GetLoadDescription());
374  }
375  }
376 
377  void LoadCheck(CompanyProperties *c) const override { this->Load(c); }
378 };
379 
380 class SlCompanyLiveries : public DefaultSaveLoadHandler<SlCompanyLiveries, CompanyProperties> {
381 public:
382  inline static const SaveLoad description[] = {
383  SLE_CONDVAR(Livery, in_use, SLE_UINT8, SLV_34, SL_MAX_VERSION),
384  SLE_CONDVAR(Livery, colour1, SLE_UINT8, SLV_34, SL_MAX_VERSION),
385  SLE_CONDVAR(Livery, colour2, SLE_UINT8, SLV_34, SL_MAX_VERSION),
386  };
387  inline const static SaveLoadCompatTable compat_description = _company_liveries_compat;
388 
393  size_t GetNumLiveries() const
394  {
395  if (IsSavegameVersionBefore(SLV_63)) return LS_END - 4;
396  if (IsSavegameVersionBefore(SLV_85)) return LS_END - 2;
398  /* Read from the savegame how long the list is. */
399  return SlGetStructListLength(LS_END);
400  }
401 
402  void Save(CompanyProperties *c) const override
403  {
404  SlSetStructListLength(LS_END);
405  for (int i = 0; i < LS_END; i++) {
406  SlObject(&c->livery[i], this->GetDescription());
407  }
408  }
409 
410  void Load(CompanyProperties *c) const override
411  {
412  size_t num_liveries = this->GetNumLiveries();
413  bool update_in_use = IsSavegameVersionBefore(SLV_GROUP_LIVERIES);
414 
415  for (size_t i = 0; i < num_liveries; i++) {
416  SlObject(&c->livery[i], this->GetLoadDescription());
417  if (update_in_use && i != LS_DEFAULT) {
418  if (c->livery[i].in_use == 0) {
419  c->livery[i].colour1 = c->livery[LS_DEFAULT].colour1;
420  c->livery[i].colour2 = c->livery[LS_DEFAULT].colour2;
421  } else {
422  c->livery[i].in_use = 3;
423  }
424  }
425  }
426 
428  /* We want to insert some liveries somewhere in between. This means some have to be moved. */
429  memmove(&c->livery[LS_FREIGHT_WAGON], &c->livery[LS_PASSENGER_WAGON_MONORAIL], (LS_END - LS_FREIGHT_WAGON) * sizeof(c->livery[0]));
430  c->livery[LS_PASSENGER_WAGON_MONORAIL] = c->livery[LS_MONORAIL];
431  c->livery[LS_PASSENGER_WAGON_MAGLEV] = c->livery[LS_MAGLEV];
432  }
433 
435  /* Copy bus/truck liveries over to trams */
436  c->livery[LS_PASSENGER_TRAM] = c->livery[LS_BUS];
437  c->livery[LS_FREIGHT_TRAM] = c->livery[LS_TRUCK];
438  }
439  }
440 
441  void LoadCheck(CompanyProperties *c) const override { this->Load(c); }
442 };
443 
444 class SlAllowListData : public DefaultSaveLoadHandler<SlAllowListData, CompanyProperties> {
445 public:
446  struct KeyWrapper {
447  std::string key;
448  };
449 
450  inline static const SaveLoad description[] = {
451  SLE_SSTR(KeyWrapper, key, SLE_STR),
452  };
453  inline const static SaveLoadCompatTable compat_description = {};
454 
455  void Save(CompanyProperties *cprops) const override
456  {
457  SlSetStructListLength(cprops->allow_list.size());
458  for (std::string &str : cprops->allow_list) {
459  SlObject(&str, this->GetDescription());
460  }
461  }
462 
463  void Load(CompanyProperties *cprops) const override
464  {
465  size_t num_keys = SlGetStructListLength(UINT32_MAX);
466  cprops->allow_list.clear();
467  cprops->allow_list.resize(num_keys);
468  for (std::string &str : cprops->allow_list) {
469  SlObject(&str, this->GetLoadDescription());
470  }
471  }
472 
473  void LoadCheck(CompanyProperties *cprops) const override { this->Load(cprops); }
474 };
475 
476 /* Save/load of companies */
477 static const SaveLoad _company_desc[] = {
478  SLE_VAR(CompanyProperties, name_2, SLE_UINT32),
479  SLE_VAR(CompanyProperties, name_1, SLE_STRINGID),
481 
482  SLE_VAR(CompanyProperties, president_name_1, SLE_STRINGID),
483  SLE_VAR(CompanyProperties, president_name_2, SLE_UINT32),
485 
488 
489  SLE_VAR(CompanyProperties, face, SLE_UINT32),
490 
491  /* money was changed to a 64 bit field in savegame version 1. */
492  SLE_CONDVAR(CompanyProperties, money, SLE_VAR_I64 | SLE_FILE_I32, SL_MIN_VERSION, SLV_1),
493  SLE_CONDVAR(CompanyProperties, money, SLE_INT64, SLV_1, SL_MAX_VERSION),
494 
495  SLE_CONDVAR(CompanyProperties, current_loan, SLE_VAR_I64 | SLE_FILE_I32, SL_MIN_VERSION, SLV_65),
496  SLE_CONDVAR(CompanyProperties, current_loan, SLE_INT64, SLV_65, SL_MAX_VERSION),
498 
499  SLE_VAR(CompanyProperties, colour, SLE_UINT8),
500  SLE_VAR(CompanyProperties, money_fraction, SLE_UINT8),
501  SLE_VAR(CompanyProperties, block_preview, SLE_UINT8),
502 
503  SLE_CONDVAR(CompanyProperties, location_of_HQ, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
504  SLE_CONDVAR(CompanyProperties, location_of_HQ, SLE_UINT32, SLV_6, SL_MAX_VERSION),
505  SLE_CONDVAR(CompanyProperties, last_build_coordinate, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
506  SLE_CONDVAR(CompanyProperties, last_build_coordinate, SLE_UINT32, SLV_6, SL_MAX_VERSION),
507  SLE_CONDVAR(CompanyProperties, inaugurated_year, SLE_FILE_U8 | SLE_VAR_I32, SL_MIN_VERSION, SLV_31),
508  SLE_CONDVAR(CompanyProperties, inaugurated_year, SLE_INT32, SLV_31, SL_MAX_VERSION),
509 
510  SLE_CONDVAR(CompanyProperties, num_valid_stat_ent, SLE_UINT8, SL_MIN_VERSION, SLV_SAVELOAD_LIST_LENGTH),
511 
512  SLE_VAR(CompanyProperties, months_of_bankruptcy, SLE_UINT8),
513  SLE_CONDVAR(CompanyProperties, bankrupt_asked, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_104),
514  SLE_CONDVAR(CompanyProperties, bankrupt_asked, SLE_UINT16, SLV_104, SL_MAX_VERSION),
515  SLE_VAR(CompanyProperties, bankrupt_timeout, SLE_INT16),
516  SLE_CONDVAR(CompanyProperties, bankrupt_value, SLE_VAR_I64 | SLE_FILE_I32, SL_MIN_VERSION, SLV_65),
517  SLE_CONDVAR(CompanyProperties, bankrupt_value, SLE_INT64, SLV_65, SL_MAX_VERSION),
518 
519  /* yearly expenses was changed to 64-bit in savegame version 2. */
520  SLE_CONDARR(CompanyProperties, yearly_expenses, SLE_FILE_I32 | SLE_VAR_I64, 3 * 13, SL_MIN_VERSION, SLV_2),
521  SLE_CONDARR(CompanyProperties, yearly_expenses, SLE_INT64, 3 * 13, SLV_2, SL_MAX_VERSION),
522 
524 
525  SLE_CONDVAR(CompanyProperties, terraform_limit, SLE_UINT32, SLV_156, SL_MAX_VERSION),
526  SLE_CONDVAR(CompanyProperties, clear_limit, SLE_UINT32, SLV_156, SL_MAX_VERSION),
527  SLE_CONDVAR(CompanyProperties, tree_limit, SLE_UINT32, SLV_175, SL_MAX_VERSION),
528  SLEG_STRUCT("settings", SlCompanySettings),
530  SLEG_STRUCT("cur_economy", SlCompanyEconomy),
531  SLEG_STRUCTLIST("old_economy", SlCompanyOldEconomy),
533 };
534 
536  PLYRChunkHandler() : ChunkHandler('PLYR', CH_TABLE) {}
537 
538  void Save() const override
539  {
540  SlTableHeader(_company_desc);
541 
542  for (Company *c : Company::Iterate()) {
543  SlSetArrayIndex(c->index);
544  SlObject(c, _company_desc);
545  }
546  }
547 
548  void Load() const override
549  {
550  const std::vector<SaveLoad> slt = SlCompatTableHeader(_company_desc, _company_sl_compat);
551 
552  int index;
553  while ((index = SlIterateArray()) != -1) {
554  Company *c = new (index) Company();
555  SlObject(c, slt);
556  _company_colours[index] = c->colour;
557  }
558  }
559 
560 
561  void LoadCheck(size_t) const override
562  {
563  const std::vector<SaveLoad> slt = SlCompatTableHeader(_company_desc, _company_sl_compat);
564 
565  int index;
566  while ((index = SlIterateArray()) != -1) {
567  std::unique_ptr<CompanyProperties> cprops = std::make_unique<CompanyProperties>();
568  SlObject(cprops.get(), slt);
569 
570  /* We do not load old custom names */
572  if (GetStringTab(cprops->name_1) == TEXT_TAB_OLD_CUSTOM) {
573  cprops->name_1 = STR_GAME_SAVELOAD_NOT_AVAILABLE;
574  }
575 
576  if (GetStringTab(cprops->president_name_1) == TEXT_TAB_OLD_CUSTOM) {
577  cprops->president_name_1 = STR_GAME_SAVELOAD_NOT_AVAILABLE;
578  }
579  }
580 
581  if (cprops->name.empty() && !IsInsideMM(cprops->name_1, SPECSTR_COMPANY_NAME_START, SPECSTR_COMPANY_NAME_LAST + 1) &&
582  cprops->name_1 != STR_GAME_SAVELOAD_NOT_AVAILABLE && cprops->name_1 != STR_SV_UNNAMED &&
583  cprops->name_1 != SPECSTR_ANDCO_NAME && cprops->name_1 != SPECSTR_PRESIDENT_NAME &&
584  cprops->name_1 != SPECSTR_SILLY_NAME) {
585  cprops->name_1 = STR_GAME_SAVELOAD_NOT_AVAILABLE;
586  }
587 
588  if (_load_check_data.companies.count(index) == 0) {
589  _load_check_data.companies[index] = std::move(cprops);
590  }
591  }
592  }
593 
594  void FixPointers() const override
595  {
596  for (Company *c : Company::Iterate()) {
597  SlObject(c, _company_desc);
598  }
599  }
600 };
601 
602 static const PLYRChunkHandler PLYR;
603 static const ChunkHandlerRef company_chunk_handlers[] = {
604  PLYR,
605 };
606 
607 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:1139
CompanyProperties::is_ai
bool is_ai
If true, the company is (also) controlled by the computer (a NoAI program).
Definition: company_base.h:112
DefaultSaveLoadHandler
Default handler for saving/loading an object to/from disk.
Definition: saveload.h:573
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
SLV_COMPANY_ALLOW_LIST_V2
@ SLV_COMPANY_ALLOW_LIST_V2
341 PR#12908 Fixed savegame format for saving of list of client keys that are allowed to join this co...
Definition: saveload.h:389
SlCompanyLiveries
Definition: company_sl.cpp:380
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
GetLockPart
uint8_t GetLockPart(Tile t)
Get the part of a lock.
Definition: water_map.h:329
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:283
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:507
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
PLYRChunkHandler::FixPointers
void FixPointers() const override
Fix the pointers.
Definition: company_sl.cpp:594
SLE_CONDSSTR
#define SLE_CONDSSTR(base, variable, type, from, to)
Storage of a std::string in some savegame versions.
Definition: saveload.h:922
Station
Station data structure.
Definition: station_base.h:439
TRANSPORT_WATER
@ TRANSPORT_WATER
Transport over water.
Definition: transport_type.h:29
ChunkHandlerRef
std::reference_wrapper< const ChunkHandler > ChunkHandlerRef
A reference to ChunkHandler.
Definition: saveload.h:501
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:889
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:538
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:41
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:857
SlErrorCorrupt
void SlErrorCorrupt(const std::string &msg)
Error handler for corrupt savegames.
Definition: saveload.cpp:351
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:3288
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:510
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:147
SLV_COMPANY_ALLOW_LIST
@ SLV_COMPANY_ALLOW_LIST
335 PR#12337 Saving of list of client keys that are allowed to join this company.
Definition: saveload.h:382
ChunkHandler
Handlers and description of chunk.
Definition: saveload.h:455
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
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:305
TRANSPORT_ROAD
@ TRANSPORT_ROAD
Transport by road vehicle.
Definition: transport_type.h:28
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:54
PLYRChunkHandler
Definition: company_sl.cpp:535
SLF_ALLOW_CONTROL
@ SLF_ALLOW_CONTROL
Allow control codes in the strings.
Definition: saveload.h:680
CompanyOldAI
Definition: company_sl.cpp:243
Livery::in_use
uint8_t 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
TrackBits
TrackBits
Allow incrementing of Track variables.
Definition: track_type.h:35
SlCompanyOldAI
Definition: company_sl.cpp:264
SLV_85
@ SLV_85
85 11874
Definition: saveload.h:145
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:87
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
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
SlCompanyOldEconomy
Definition: company_sl.cpp:355
RoadType
RoadType
The different roadtypes we support.
Definition: road_type.h:25
lengthof
#define lengthof(array)
Return the length of an fixed size array.
Definition: stdafx.h:280
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:878
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:391
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:599
INVALID_ROADTYPE
@ INVALID_ROADTYPE
flag for invalid roadtype
Definition: road_type.h:30
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:262
CompanyInfrastructure::rail
std::array< uint32_t, RAILTYPE_END > rail
Count of company owned track bits for each rail type.
Definition: company_base.h:33
SlAllowListData::KeyWrapper
Definition: company_sl.cpp:446
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:1684
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
SlAllowListData
Definition: company_sl.cpp:444
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:971
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:393
_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:115
WATER_CLASS_CANAL
@ WATER_CLASS_CANAL
Canal.
Definition: water_map.h:49
company_sl_compat.h
CompanyInfrastructure::signal
uint32_t signal
Count of company owned signals.
Definition: company_base.h:35
TRANSPORT_RAIL
@ TRANSPORT_RAIL
Transport by train.
Definition: transport_type.h:27
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:575
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
CompanyInfrastructure::road
std::array< uint32_t, ROADTYPE_END > road
Count of company owned track bits for each road type.
Definition: company_base.h:34
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:252
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:504
GetRoadBits
RoadBits GetRoadBits(Tile t, RoadTramType rtt)
Get the present road bits for a specific road type.
Definition: road_map.h:128
CompanyProperties::num_valid_stat_ent
uint8_t num_valid_stat_ent
Number of valid statistical entries in old_economy.
Definition: company_base.h:117
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
SLE_SSTR
#define SLE_SSTR(base, variable, type)
Storage of a std::string in every savegame version.
Definition: saveload.h:1015
CompanyProperties::allow_list
NetworkAuthorizedKeys allow_list
Public keys of clients that are allowed to join this company.
Definition: company_base.h:78
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
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:424
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:1888
SlCompanyEconomy
Definition: company_sl.cpp:320
SlCompanyOldAIBuildRec
Definition: company_sl.cpp:247
SLV_156
@ SLV_156
156 21728
Definition: saveload.h:230
SLE_CONDVECTOR
#define SLE_CONDVECTOR(base, variable, type, from, to)
Storage of a vector of SL_VAR elements in some savegame versions.
Definition: saveload.h:963
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
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:1697
IsSavegameVersionBefore
bool IsSavegameVersionBefore(SaveLoadVersion major, uint8_t minor=0)
Checks whether the savegame is below major.
Definition: saveload.h:1234
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:1750
SLEG_CONDSTRUCT
#define SLEG_CONDSTRUCT(name, handler, from, to)
Storage of a structs in some savegame versions.
Definition: saveload.h:1110
SlSetStructListLength
void SlSetStructListLength(size_t length)
Set the length of this list.
Definition: saveload.cpp:1668
SaveLoad
SaveLoad type struct.
Definition: saveload.h:707
_company_economy_compat
const SaveLoadCompat _company_economy_compat[]
Original field order for SlCompanyEconomy.
Definition: company_sl_compat.h:73
Company
Definition: company_base.h:133
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:116
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:548
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:393
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:561
SlIterateArray
int SlIterateArray()
Iterate through the elements of an array and read the whole thing.
Definition: saveload.cpp:658
GE_WF
@ GE_WF
A female of Caucasian origin (white)
Definition: company_manager_face.h:24
SLEG_STRUCTLIST
#define SLEG_STRUCTLIST(name, handler)
Storage of a list of structs in every savegame version.
Definition: saveload.h:1201
SLEG_STRUCT
#define SLEG_STRUCT(name, handler)
Storage of a structs in every savegame version.
Definition: saveload.h:1178
FACIL_AIRPORT
@ FACIL_AIRPORT
Station with an airport.
Definition: station_type.h:57
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