diff options
author | smatz <smatz@openttd.org> | 2009-01-20 16:40:19 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-01-20 16:40:19 +0000 |
commit | c8e26be649010b0c060ee5ec54c09e03105d08c6 (patch) | |
tree | 86d80fc1d60f3f64a05ee4621374df2cee831f17 /src | |
parent | cef41031376ae3e5535d338e792814df379f209a (diff) | |
download | openttd-c8e26be649010b0c060ee5ec54c09e03105d08c6.tar.xz |
(svn r15173) -Codechange: shuffle a few lines of code in oldloader.cpp
Diffstat (limited to 'src')
-rw-r--r-- | src/saveload/oldloader.cpp | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/saveload/oldloader.cpp b/src/saveload/oldloader.cpp index 24689e157..2ae3671bc 100644 --- a/src/saveload/oldloader.cpp +++ b/src/saveload/oldloader.cpp @@ -397,6 +397,16 @@ static void FixOldVehicles() Vehicle *v; FOR_ALL_VEHICLES(v) { + /* For some reason we need to correct for this */ + switch (v->spritenum) { + case 0xfd: break; + case 0xff: v->spritenum = 0xfe; break; + default: v->spritenum >>= 1; break; + } + + /* Vehicle-subtype is different in TTD(Patch) */ + if (v->type == VEH_EFFECT) v->subtype = v->subtype >> 1; + v->name = CopyFromOldName(_old_vehicle_names[v->index]); /* We haven't used this bit for stations for ages */ @@ -444,9 +454,9 @@ static void FixOldVehicles() #define OCL_ASSERT(size) { OC_ASSERT, 1, NULL, size, NULL } /* The savegames has some hard-coded pointers, because it always enters the same - piece of memory.. we don't.. so we need to remap ;) - Old Towns are 94 bytes big - Old Orders are 2 bytes big */ + * piece of memory.. we don't.. so we need to remap ;) + * Old Towns are 94 bytes big + * Old Orders are 2 bytes big */ #define REMAP_TOWN_IDX(x) ((x) - (0x0459154 - 0x0458EF0)) / 94 #define REMAP_ORDER_IDX(x) ((x) - (0x045AB08 - 0x0458EF0)) / 2 @@ -1127,12 +1137,10 @@ static const OldChunks vehicle_chunk[] = { bool LoadOldVehicle(LoadgameState *ls, int num) { - uint i; - /* Read the TTDPatch flags, because we need some info from it */ ReadTTDPatchFlags(); - for (i = 0; i < _old_vehicle_multiplier; i++) { + for (uint i = 0; i < _old_vehicle_multiplier; i++) { _current_vehicle_id = num * _old_vehicle_multiplier + i; /* Read the vehicle type and allocate the right vehicle */ @@ -1165,20 +1173,9 @@ bool LoadOldVehicle(LoadgameState *ls, int num) } v->current_order.AssignOrder(UnpackOldOrder(_old_order)); - /* For some reason we need to correct for this */ - switch (v->spritenum) { - case 0xfd: break; - case 0xff: v->spritenum = 0xfe; break; - default: v->spritenum >>= 1; break; - } - if (_old_next_ptr != 0xFFFF) v->next = GetVehiclePoolSize() <= _old_next_ptr ? new (_old_next_ptr) InvalidVehicle() : GetVehicle(_old_next_ptr); _old_vehicle_names[_current_vehicle_id] = RemapOldStringID(_old_string_id); - v->name = NULL; - - /* Vehicle-subtype is different in TTD(Patch) */ - if (v->type == VEH_EFFECT) v->subtype = v->subtype >> 1; if (_cargo_count != 0) { CargoPacket *cp = new CargoPacket((_cargo_source == 0xFF) ? INVALID_STATION : _cargo_source, _cargo_count); |