1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-12 09:09:09 +00:00

(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.

-Codechange: renamed all 'schedule' stuff to 'order(list)'
-Codechange: moved all order-stuff to order_cmd.c / order.h
-Codechange: vehicles that share orders are now linked to eachother
  with next_shared/prev_shared in Vehicle

  Developers: please use AssignOrder to assign data to an order. If not, 
   you _WILL_ make the save-routine to assert!
This commit is contained in:
truelight
2005-01-15 19:06:22 +00:00
parent 732c362dea
commit d275109e79
22 changed files with 1280 additions and 856 deletions

View File

@@ -8,7 +8,7 @@
enum {
SAVEGAME_MAJOR_VERSION = 5,
SAVEGAME_MINOR_VERSION = 1,
SAVEGAME_MINOR_VERSION = 2,
SAVEGAME_LOADABLE_VERSION = (SAVEGAME_MAJOR_VERSION << 8) + SAVEGAME_MINOR_VERSION
};
@@ -869,6 +869,7 @@ static void UninitWriteZlib()
extern const ChunkHandler _misc_chunk_handlers[];
extern const ChunkHandler _player_chunk_handlers[];
extern const ChunkHandler _veh_chunk_handlers[];
extern const ChunkHandler _order_chunk_handlers[];
extern const ChunkHandler _town_chunk_handlers[];
extern const ChunkHandler _sign_chunk_handlers[];
extern const ChunkHandler _station_chunk_handlers[];
@@ -880,6 +881,7 @@ extern const ChunkHandler _animated_tile_chunk_handlers[];
static const ChunkHandler * const _chunk_handlers[] = {
_misc_chunk_handlers,
_veh_chunk_handlers,
_order_chunk_handlers,
_industry_chunk_handlers,
_economy_chunk_handlers,
_engine_chunk_handlers,
@@ -912,9 +914,7 @@ static uint ReferenceToInt(void *v, uint t)
case REF_VEHICLE: return ((Vehicle *)v)->index + 1;
case REF_STATION: return ((Station *)v)->index + 1;
case REF_TOWN: return ((Town *)v)->index + 1;
case REF_SCHEDULE:
return ((byte*)v - (byte*)_order_array) / sizeof(_order_array[0]) + 1;
case REF_ORDER: return ((Order *)v)->index + 1;
default:
NOT_REACHED();
@@ -935,13 +935,11 @@ void *IntToReference(uint r, uint t)
return NULL;
switch (t) {
case REF_ORDER: return GetOrder(r - 1);
case REF_VEHICLE: return GetVehicle(r - 1);
case REF_STATION: return GetStation(r - 1);
case REF_TOWN: return GetTown(r - 1);
case REF_SCHEDULE:
return (byte*)_order_array + (r - 1) * sizeof(_order_array[0]);
case REF_VEHICLE_OLD: {
/* Old vehicles were saved differently: invalid vehicle was 0xFFFF,
and the index was not - 1.. correct for this */