diff options
author | truelight <truelight@openttd.org> | 2005-01-06 22:31:58 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2005-01-06 22:31:58 +0000 |
commit | 63e97754fbf907cfefd277087bfbac5e0d4434e8 (patch) | |
tree | 254702245ba43d006f4823111d0c2c592fb701ca /ship_cmd.c | |
parent | a4111363c0def2ccec66ef28b5e8169e8a2df2f0 (diff) | |
download | openttd-63e97754fbf907cfefd277087bfbac5e0d4434e8.tar.xz |
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
(in prepare of dynamic arrays):
- DEREF_XXX is changed into GetXXX
- All direct call are directed via GetXXX
- struct Industry has now an index-field
- ENUM'd some stuff
- Replaced home built loops with FOR_ALL_XXX
- Added _stations_size, _vehicles_size, ... which gives the length of the
array (which will be dynamic in the near future)
- Changed lengtof(XXX) to _XXX_size (e.g. _stations_size)
- Removed all endof(XXX) (because mostly it was part of a FOR_ALL_XXX)
- Made the sort-functions of all 4 dynamic
- Made all 4 Initialize functions more of the same
- Some minor tab-fixing and stuff
(tnx to Tron for proof-reading my 100kb patch ;))
Note for all: please do NOT directly call _stations, _vehicles, _towns and
_industries, but use the right wrapper to access them. Thank you.
Ps: please also do not use 'v++', where v is of type Vehicle *.
Diffstat (limited to 'ship_cmd.c')
-rw-r--r-- | ship_cmd.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ship_cmd.c b/ship_cmd.c index d336031bb..7b22502fa 100644 --- a/ship_cmd.c +++ b/ship_cmd.c @@ -243,7 +243,7 @@ static void ProcessShipOrder(Vehicle *v) if (order.station == v->last_station_visited) v->last_station_visited = 0xFFFF; - st = DEREF_STATION(order.station); + st = GetStation(order.station); if (st->dock_tile != 0) { v->dest_tile = TILE_ADD(st->dock_tile, ToTileIndexDiff(_dock_offs[_map5[st->dock_tile]-0x4B])); } @@ -679,7 +679,7 @@ static void ShipController(Vehicle *v) v->last_station_visited = v->current_order.station; /* Process station in the schedule. Don't do that for buoys (HVOT_BUOY) */ - st = DEREF_STATION(v->current_order.station); + st = GetStation(v->current_order.station); if (!(st->had_vehicle_of_type & HVOT_BUOY) && (st->facilities & FACIL_DOCK)) { /* ugly, ugly workaround for problem with ships able to drop off cargo at wrong stations */ v->current_order.type = OT_LOADING; @@ -884,7 +884,7 @@ int32 CmdSellShip(int x, int y, uint32 flags, uint32 p1, uint32 p2) SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES); - v = &_vehicles[p1]; + v = GetVehicle(p1); if (!CheckOwnership(v->owner)) return CMD_ERROR; @@ -908,7 +908,7 @@ int32 CmdStartStopShip(int x, int y, uint32 flags, uint32 p1, uint32 p2) { Vehicle *v; - v = &_vehicles[p1]; + v = GetVehicle(p1); if (!CheckOwnership(v->owner)) return CMD_ERROR; @@ -927,7 +927,7 @@ int32 CmdSendShipToDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2) Vehicle *v; int depot; - v = &_vehicles[p1]; + v = GetVehicle(p1); if (!CheckOwnership(v->owner)) return CMD_ERROR; @@ -960,7 +960,7 @@ int32 CmdChangeShipServiceInt(int x, int y, uint32 flags, uint32 p1, uint32 p2) { Vehicle *v; - v = &_vehicles[p1]; + v = GetVehicle(p1); if (!CheckOwnership(v->owner)) return CMD_ERROR; @@ -986,7 +986,7 @@ int32 CmdRefitShip(int x, int y, uint32 flags, uint32 p1, uint32 p2) p2 = p2 & 0xFF; SET_EXPENSES_TYPE(EXPENSES_SHIP_RUN); - v = &_vehicles[p1]; + v = GetVehicle(p1); if (!CheckOwnership(v->owner)) return CMD_ERROR; |