Codechange: remove the special station/vehicle code from SaveLoad

With the new SLEG_STRUCT it is much easier to embed a struct
in a struct, where the sub-struct has limitations on when it is
being used.
This makes both the code easier to read (less magic) and avoids
the SaveLoad needing to know all these things about Stations
and Vehicles.
This commit is contained in:
Patric Stout
2021-06-06 16:03:56 +02:00
committed by Patric Stout
parent 4600d289b5
commit 4e4720f217
8 changed files with 381 additions and 256 deletions

View File

@@ -200,7 +200,6 @@ extern VehiclePool _vehicle_pool;
/* Some declarations of functions, so we can make them friendly */
struct GroundVehicleCache;
extern SaveLoadTable GetVehicleDescription(VehicleType vt);
struct LoadgameState;
extern bool LoadOldVehicle(LoadgameState *ls, int num);
extern void FixOldVehicles();
@@ -232,10 +231,13 @@ private:
Vehicle *previous_shared; ///< NOSAVE: pointer to the previous vehicle in the shared order chain
public:
friend SaveLoadTable GetVehicleDescription(VehicleType vt); ///< So we can use private/protected variables in the saveload code
friend void FixOldVehicles();
friend void AfterLoadVehicles(bool part_of_load); ///< So we can set the #previous and #first pointers while loading
friend bool LoadOldVehicle(LoadgameState *ls, int num); ///< So we can set the proper next pointer while loading
/* So we can use private/protected variables in the saveload code */
friend class SlVehicleCommon;
friend class SlVehicleDisaster;
friend void Ptrs_VEHS();
TileIndex tile; ///< Current tile index