diff options
author | rubidium <rubidium@openttd.org> | 2007-09-07 22:06:52 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-09-07 22:06:52 +0000 |
commit | 4eef590b15af2611865a96bb6fee0916304bb452 (patch) | |
tree | eadc6175d828f1bdb705e6081db525c8475a4b1d /src | |
parent | c25655d4aef70413a9cdb3619338b2b6356307dd (diff) | |
download | openttd-4eef590b15af2611865a96bb6fee0916304bb452.tar.xz |
(svn r11057) -Fix [FS#1215]: loading TTD savegames went into an infinite loop due to not yet properly set next and previous pointers.
Diffstat (limited to 'src')
-rw-r--r-- | src/oldloader.cpp | 4 | ||||
-rw-r--r-- | src/vehicle.h | 10 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/oldloader.cpp b/src/oldloader.cpp index b43011cf4..e6227d9a4 100644 --- a/src/oldloader.cpp +++ b/src/oldloader.cpp @@ -1175,7 +1175,7 @@ static const OldChunks vehicle_chunk[] = { OCL_END() }; -static bool LoadOldVehicle(LoadgameState *ls, int num) +bool LoadOldVehicle(LoadgameState *ls, int num) { uint i; @@ -1206,7 +1206,7 @@ static bool LoadOldVehicle(LoadgameState *ls, int num) default: v->spritenum >>= 1; break; } - if (_old_next_ptr != 0xFFFF) v->SetNext(GetVehicle(_old_next_ptr)); + if (_old_next_ptr != 0xFFFF) v->next = GetVehicle(_old_next_ptr); v->string_id = RemapOldStringID(_old_string_id); diff --git a/src/vehicle.h b/src/vehicle.h index 1526c5c9f..c9a805593 100644 --- a/src/vehicle.h +++ b/src/vehicle.h @@ -218,9 +218,12 @@ struct VehicleShip { struct Vehicle; DECLARE_OLD_POOL(Vehicle, Vehicle, 9, 125) +/* Some declarations of functions, so we can make them friendly */ struct SaveLoad; -const SaveLoad *GetVehicleDescription(VehicleType vt); -void AfterLoadVehicles(); +extern const SaveLoad *GetVehicleDescription(VehicleType vt); +extern void AfterLoadVehicles(); +struct LoadgameState; +extern bool LoadOldVehicle(LoadgameState *ls, int num); struct Vehicle : PoolItem<Vehicle, VehicleID, &_Vehicle_pool> { VehicleTypeByte type; ///< Type of vehicle @@ -232,7 +235,8 @@ private: Vehicle *first; // NOSAVE: pointer to the first vehicle in the chain public: friend const SaveLoad *GetVehicleDescription(VehicleType vt); // So we can use private/protected variables in the saveload code - friend void AfterLoadVehicles(); + friend void AfterLoadVehicles(); // 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 Vehicle *depot_list; // NOSAVE: linked list to tell what vehicles entered a depot during the last tick. Used by autoreplace |