From 446363aac4c791cf39254c3da7f1bc34e2aebf57 Mon Sep 17 00:00:00 2001 From: rubidium Date: Tue, 6 Oct 2009 23:01:35 +0000 Subject: [PATCH] (svn r17734) -Fix (r17732): broke the assumption that 'this->packets == this', which broke loading old savegames. Now remove the (need for the) hack that needed that assumption. --- src/cargopacket.h | 6 +++++- src/economy_base.h | 1 - src/saveload/vehicle_sl.cpp | 2 +- src/station_base.h | 1 - 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/cargopacket.h b/src/cargopacket.h index b911e8d7c5..bbad42bff1 100644 --- a/src/cargopacket.h +++ b/src/cargopacket.h @@ -17,6 +17,7 @@ #include "tile_type.h" #include "station_type.h" #include "cargo_type.h" +#include "vehicle_type.h" #include /** Unique identifier for a single cargo packet. */ @@ -143,6 +144,7 @@ public: #define FOR_ALL_CARGOPACKETS(var) FOR_ALL_CARGOPACKETS_FROM(var, 0) extern const struct SaveLoad *GetGoodsDesc(); +extern const SaveLoad *GetVehicleDescription(VehicleType vt); /** * Simple collection class for a list of cargo packets @@ -168,8 +170,10 @@ private: List packets; ///< The cargo packets in this list public: - /** The GoodsEntry has a CargoList. */ + /** The stations, via GoodsEntry, have a CargoList. */ friend const struct SaveLoad *GetGoodsDesc(); + /** The vehicles have a cargo list too. */ + friend const SaveLoad *GetVehicleDescription(VehicleType vt); /** Create the cargo list */ FORCEINLINE CargoList() { this->InvalidateCache(); } diff --git a/src/economy_base.h b/src/economy_base.h index 7d447b23cf..5d7124c1b7 100644 --- a/src/economy_base.h +++ b/src/economy_base.h @@ -13,7 +13,6 @@ #define ECONOMY_BASE_H #include "cargopacket.h" -#include "vehicle_type.h" #include "company_type.h" /** Type of pool to store cargo payments in. */ diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp index fbca9332ff..f49d4c3851 100644 --- a/src/saveload/vehicle_sl.cpp +++ b/src/saveload/vehicle_sl.cpp @@ -447,7 +447,7 @@ const SaveLoad *GetVehicleDescription(VehicleType vt) SLEG_CONDVAR( _cargo_source_xy, SLE_UINT32, 44, 67), SLE_VAR(Vehicle, cargo_cap, SLE_UINT16), SLEG_CONDVAR( _cargo_count, SLE_UINT16, 0, 67), - SLE_CONDLST(Vehicle, cargo, REF_CARGO_PACKET, 68, SL_MAX_VERSION), + SLE_CONDLST(Vehicle, cargo.packets, REF_CARGO_PACKET, 68, SL_MAX_VERSION), SLE_VAR(Vehicle, day_counter, SLE_UINT8), SLE_VAR(Vehicle, tick_counter, SLE_UINT8), diff --git a/src/station_base.h b/src/station_base.h index ce87b2cf69..5c047f03f1 100644 --- a/src/station_base.h +++ b/src/station_base.h @@ -16,7 +16,6 @@ #include "airport.h" #include "cargopacket.h" #include "cargo_type.h" -#include "vehicle_type.h" #include "industry_type.h" #include "core/geometry_type.hpp" #include