diff options
author | Patric Stout <truebrain@openttd.org> | 2021-05-31 22:26:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-31 22:26:44 +0200 |
commit | 9fff00ba205260ee5e11b50f87a3edee9b7e76a3 (patch) | |
tree | 2c6ee1eb6f0df2539c9ed17a2ae05541518a7dc9 /src/saveload/vehicle_sl.cpp | |
parent | 956d761e3ef1968c6470a9e78597c5531ed7c332 (diff) | |
download | openttd-9fff00ba205260ee5e11b50f87a3edee9b7e76a3.tar.xz |
Codechange: C++-ify lists for SaveLoad (#9323)
Basically, this changes "SaveLoad *" to either:
1) "SaveLoadTable" if a list of SaveLoads was meant
2) "SaveLoad &" if a single entry was meant
As added bonus, this removes SL_END / SLE_END / SLEG_END. This
also adds core/span.hpp, a "std::span"-lite.
Diffstat (limited to 'src/saveload/vehicle_sl.cpp')
-rw-r--r-- | src/saveload/vehicle_sl.cpp | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp index 131d31519..e637f03b2 100644 --- a/src/saveload/vehicle_sl.cpp +++ b/src/saveload/vehicle_sl.cpp @@ -578,7 +578,7 @@ static uint32 _cargo_loaded_at_xy; * @param vt the vehicle type. Can be VEH_END for the common vehicle description data * @return the saveload description */ -const SaveLoad *GetVehicleDescription(VehicleType vt) +SaveLoadTable GetVehicleDescription(VehicleType vt) { /** Save and load of vehicles */ static const SaveLoad _common_veh_desc[] = { @@ -712,11 +712,8 @@ const SaveLoad *GetVehicleDescription(VehicleType vt) SLE_CONDVAR(Vehicle, lateness_counter, SLE_INT32, SLV_67, SL_MAX_VERSION), SLE_CONDNULL(10, SLV_2, SLV_144), // old reserved space - - SLE_END() }; - static const SaveLoad _train_desc[] = { SLE_WRITEBYTE(Vehicle, type), SLE_VEH_INCLUDE(), @@ -734,8 +731,6 @@ const SaveLoad *GetVehicleDescription(VehicleType vt) SLE_CONDNULL(2, SLV_2, SLV_20), SLE_CONDVAR(Train, gv_flags, SLE_UINT16, SLV_139, SL_MAX_VERSION), SLE_CONDNULL(11, SLV_2, SLV_144), // old reserved space - - SLE_END() }; static const SaveLoad _roadveh_desc[] = { @@ -756,8 +751,6 @@ const SaveLoad *GetVehicleDescription(VehicleType vt) SLE_CONDNULL(4, SLV_69, SLV_131), SLE_CONDNULL(2, SLV_6, SLV_131), SLE_CONDNULL(16, SLV_2, SLV_144), // old reserved space - - SLE_END() }; static const SaveLoad _ship_desc[] = { @@ -768,8 +761,6 @@ const SaveLoad *GetVehicleDescription(VehicleType vt) SLE_CONDVAR(Ship, rotation, SLE_UINT8, SLV_SHIP_ROTATION, SL_MAX_VERSION), SLE_CONDNULL(16, SLV_2, SLV_144), // old reserved space - - SLE_END() }; static const SaveLoad _aircraft_desc[] = { @@ -791,8 +782,6 @@ const SaveLoad *GetVehicleDescription(VehicleType vt) SLE_CONDVAR(Aircraft, flags, SLE_UINT8, SLV_167, SL_MAX_VERSION), SLE_CONDNULL(13, SLV_2, SLV_144), // old reserved space - - SLE_END() }; static const SaveLoad _special_desc[] = { @@ -821,8 +810,6 @@ const SaveLoad *GetVehicleDescription(VehicleType vt) SLE_CONDVAR(Vehicle, spritenum, SLE_UINT8, SLV_2, SL_MAX_VERSION), SLE_CONDNULL(15, SLV_2, SLV_144), // old reserved space - - SLE_END() }; static const SaveLoad _disaster_desc[] = { @@ -862,12 +849,10 @@ const SaveLoad *GetVehicleDescription(VehicleType vt) SLE_CONDVAR(DisasterVehicle, flags, SLE_UINT8, SLV_194, SL_MAX_VERSION), SLE_CONDNULL(16, SLV_2, SLV_144), // old reserved space - - SLE_END() }; - static const SaveLoad * const _veh_descs[] = { + static const SaveLoadTable _veh_descs[] = { _train_desc, _roadveh_desc, _ship_desc, |