From bd7f37d5926ec9a5798134c4a39ef7b8cd3fd4ea Mon Sep 17 00:00:00 2001 From: truelight Date: Sun, 6 Feb 2005 10:18:47 +0000 Subject: (svn r1817) -Codechange: Moved depot-functions to depot.c -Codechange: Added wrappers around depot-access (GetDepot no exists) -Codechange: Made depot-functions a bit more logic (no longer GetDepotByTile crashes your game when you request it on a non-depot tile) -Add: made depots dynamic (yes, 64k depots are possible now) --- order_gui.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'order_gui.c') diff --git a/order_gui.c b/order_gui.c index df4db8f19..7cbd0089c 100644 --- a/order_gui.c +++ b/order_gui.c @@ -11,6 +11,7 @@ #include "town.h" #include "command.h" #include "viewport.h" +#include "depot.h" static int OrderGetSel(Window *w) { @@ -110,7 +111,7 @@ static void DrawOrdersWindow(Window *w) s = STR_GO_TO_AIRPORT_HANGAR; SetDParam(2, order->station); } else { - SetDParam(2, _depots[order->station].town_index); + SetDParam(2, GetDepot(order->station)->town_index); switch (v->type) { case VEH_Train: s = STR_880E_GO_TO_TRAIN_DEPOT; break; case VEH_Road: s = STR_9038_GO_TO_ROADVEH_DEPOT; break; @@ -189,7 +190,7 @@ static Order GetOrderCmdFromTile(Vehicle *v, uint tile) if ((_map5[tile]&0xFC)==0xC0) { order.type = OT_GOTO_DEPOT; order.flags = OF_UNLOAD; - order.station = GetDepotByTile(tile); + order.station = GetDepotByTile(tile)->index; return order; } } @@ -199,7 +200,7 @@ static Order GetOrderCmdFromTile(Vehicle *v, uint tile) if ((_map5[tile] & 0xF0) == 0x20 && v->type == VEH_Road && _map_owner[tile] == _local_player) { order.type = OT_GOTO_DEPOT; order.flags = OF_UNLOAD; - order.station = GetDepotByTile(tile); + order.station = GetDepotByTile(tile)->index; return order; } break; @@ -223,7 +224,7 @@ static Order GetOrderCmdFromTile(Vehicle *v, uint tile) } order.type = OT_GOTO_DEPOT; order.flags = OF_UNLOAD; - order.station = GetDepotByTile(tile); + order.station = GetDepotByTile(tile)->index; return order; } @@ -396,7 +397,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e) xy = GetStation(ord->station)->xy ; break; case OT_GOTO_DEPOT: /* goto depot order */ - xy = _depots[ord->station].xy; + xy = GetDepot(ord->station)->xy; break; case OT_GOTO_WAYPOINT: /* goto waypoint order */ xy = _waypoints[ord->station].xy; -- cgit v1.2.3-54-g00ecf