diff options
author | truelight <truelight@openttd.org> | 2005-02-04 15:31:30 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2005-02-04 15:31:30 +0000 |
commit | 10adda0d739203e0933d89d5c7d3bcb10b67fe51 (patch) | |
tree | cafae3f0441df07e0ca55f81e311d585b1fe5df2 /saveload.c | |
parent | 4f5255c36eb39744a0fb0ceda0364ff8d4d3524f (diff) | |
download | openttd-10adda0d739203e0933d89d5c7d3bcb10b67fe51.tar.xz |
(svn r1788) -Add: Made RoadStops dynamic. You can now create up to 64k roadstops.
Diffstat (limited to 'saveload.c')
-rw-r--r-- | saveload.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/saveload.c b/saveload.c index 71596a883..ef621afcd 100644 --- a/saveload.c +++ b/saveload.c @@ -917,10 +917,7 @@ static uint ReferenceToInt(void *v, uint t) case REF_STATION: return ((Station *)v)->index + 1; case REF_TOWN: return ((Town *)v)->index + 1; case REF_ORDER: return ((Order *)v)->index + 1; - - case REF_ROADSTOPS: - //return ((byte*)v - (byte*)_roadstops) / sizeof(_roadstops[0]) + 1; - return (RoadStop *)v - _roadstops + 1; + case REF_ROADSTOPS: return ((RoadStop *)v)->index + 1; default: NOT_REACHED(); @@ -957,10 +954,12 @@ static void *IntToReference(uint r, uint t) error("Towns: failed loading savegame: too many towns"); return GetTown(r - 1); } + case REF_ROADSTOPS: { + if (!AddBlockIfNeeded(&_roadstop_pool, r - 1)) + error("RoadStop: failed loading savegame: too many RoadStops"); + return GetRoadStop(r - 1); + } - case REF_ROADSTOPS: - //return (byte*)_roadstops + (r - 1) * sizeof(_roadstops[0]); - return &_roadstops[r - 1]; case REF_VEHICLE_OLD: { /* Old vehicles were saved differently: invalid vehicle was 0xFFFF, and the index was not - 1.. correct for this */ |