mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-09-02 11:29:10 +00:00
(svn r1817) -Codechange: Moved depot-functions to depot.c
-Codechange: Added wrappers around depot-access (GetDepot no exists) -Codechange: Made depot-functions a bit more logic (no longer GetDepotByTile crashes your game when you request it on a non-depot tile) -Add: made depots dynamic (yes, 64k depots are possible now)
This commit is contained in:
19
oldloader.c
19
oldloader.c
@@ -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 @@ static void FixStation(OldStation *o, int num)
|
||||
} 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 @@ bool LoadOldSaveGame(const char *file)
|
||||
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));
|
||||
|
Reference in New Issue
Block a user