diff options
author | truelight <truelight@openttd.org> | 2005-01-08 12:47:26 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2005-01-08 12:47:26 +0000 |
commit | 788f543bc3a778895a10480d4b9e65e3a488e41f (patch) | |
tree | eb8091f14551600fb73a27878ecd5163e0e72187 /vehicle.c | |
parent | 3be9515d846cdd62bbdac65d2eba2655ca207cda (diff) | |
download | openttd-788f543bc3a778895a10480d4b9e65e3a488e41f.tar.xz |
(svn r1429) Change: bumped savegame to revision 5.
- Now orders are bigger
- Now _map2 is official 16 bits
Diffstat (limited to 'vehicle.c')
-rw-r--r-- | vehicle.c | 42 |
1 files changed, 27 insertions, 15 deletions
@@ -598,7 +598,7 @@ static bool CanFillVehicle_FullLoadAny(Vehicle *v) uint32 full = 0, not_full = 0; //special handling of aircraft - + //if the aircraft carries passengers and is NOT full, then //continue loading, no matter how much mail is in if ((v->type == VEH_Aircraft) && (v->cargo_type == CT_PASSENGERS) && (v->cargo_cap != v->cargo_count)) { @@ -1507,7 +1507,7 @@ int32 CmdReplaceVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2) if it is a multiheaded engine (rear engine) (rvi->flags & RVI_MULTIHEAD && sprite - rvi2->image_index) is true if the engine is heading the other way, otherwise 0*/ v->spritenum = rvi->image_index + (( rvi->flags & RVI_MULTIHEAD && sprite - rvi2->image_index) ? 1 : 0); - + // turn the last engine in a multiheaded train if needed if ( v->next == NULL && rvi->flags & RVI_MULTIHEAD && v->spritenum == rvi->image_index ) v->spritenum++; @@ -2023,10 +2023,6 @@ static void Save_VEHS() // Write the vehicles FOR_ALL_VEHICLES(v) { if (v->type != 0) { - /* XXX - Here for now, because we did not bump the savegame to version 5 yet */ - if (_sl.version < 5 && v->last_station_visited == 0xFFFF) - v->last_station_visited = 0xFF; - SlSetArrayIndex(v->index); SlObject(v, _veh_descs[v->type - 0x10]); } @@ -2128,7 +2124,7 @@ static void Load_CHKP() static void Save_ORDR() { - uint16 orders[lengthof(_order_array)]; + uint32 orders[lengthof(_order_array)]; uint len = _ptr_to_next_order - _order_array; uint i; @@ -2137,22 +2133,38 @@ static void Save_ORDR() for (i = 0; i < len; ++i) orders[i] = PackOrder(&_order_array[i]); - SlArray(orders, len, SLE_UINT16); + SlArray(orders, len, SLE_UINT32); } static void Load_ORDR() { - uint16 orders[lengthof(_order_array)]; - uint len = SlGetFieldLength() >> 1; + uint len = SlGetFieldLength(); uint i; - assert (len <= lengthof(orders)); + if (_sl.version < 5) { + /* Older version had an other layout for orders.. convert them correctly */ + uint16 orders[lengthof(_order_array)]; - _ptr_to_next_order = _order_array + len; - SlArray(orders, len, SLE_UINT16); + len /= sizeof(uint16); + assert (len <= lengthof(orders)); - for (i = 0; i < len; ++i) - _order_array[i] = UnpackOrder(orders[i]); + SlArray(orders, len, SLE_UINT16); + + for (i = 0; i < len; ++i) + _order_array[i] = UnpackVersion4Order(orders[i]); + } else { + uint32 orders[lengthof(_order_array)]; + + len /= sizeof(uint32); + assert (len <= lengthof(orders)); + + SlArray(orders, len, SLE_UINT32); + + for (i = 0; i < len; ++i) + _order_array[i] = UnpackOrder(orders[i]); + } + + _ptr_to_next_order = _order_array + len; } const ChunkHandler _veh_chunk_handlers[] = { |