diff -r 8defbb525d09 -r bba6afb8a995 oldloader.c --- a/oldloader.c Sun Feb 06 09:52:06 2005 +0000 +++ b/oldloader.c Sun Feb 06 10:18:47 2005 +0000 @@ -11,6 +11,7 @@ #include "engine.h" #include "vehicle.h" #include "signs.h" +#include "depot.h" extern byte _name_array[512][32]; extern TileIndex _animated_tile_list[256]; @@ -777,15 +778,23 @@ } while (i++,o++,--num); } -static void FixDepot(Depot *n, OldDepot *o, int num) +static void FixDepot(OldDepot *o, int num) { + Depot *depot; + uint i = 0; + do { if (o->xy == 0) continue; - n->town_index = REMAP_TOWN_IDX(o->town); - n->xy = o->xy; - } while (n++,o++,--num); + if (!AddBlockIfNeeded(&_depot_pool, i)) + error("Depots: failed loading savegame: too many depots"); + + depot = GetDepot(i); + + depot->town_index = REMAP_TOWN_IDX(o->town); + depot->xy = o->xy; + } while (i++,o++,--num); } static void FixOrder(uint16 *o, int num) @@ -1533,7 +1542,7 @@ FixIndustry(m->industries, lengthof(m->industries)); FixStation(m->stations, lengthof(m->stations)); - FixDepot(_depots, m->depots, lengthof(m->depots)); + FixDepot(m->depots, lengthof(m->depots)); FixOrder(m->order_list, lengthof(m->order_list)); FixVehicle(m->vehicles, lengthof(m->vehicles)); FixSubsidy(_subsidies, m->subsidies, lengthof(m->subsidies));