summaryrefslogtreecommitdiff
path: root/order_gui.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2005-02-06 10:18:47 +0000
committertruelight <truelight@openttd.org>2005-02-06 10:18:47 +0000
commite9c93f9c0ca76117ac1315b6aff03f1f138f62e4 (patch)
tree0b6bfe4dfd7abf3e94d0f7210b1b842e429c4a02 /order_gui.c
parent6493e12bfbb147e41fc0f533bb3618b2931fed1f (diff)
downloadopenttd-e9c93f9c0ca76117ac1315b6aff03f1f138f62e4.tar.xz
(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)
Diffstat (limited to 'order_gui.c')
-rw-r--r--order_gui.c11
1 files changed, 6 insertions, 5 deletions
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;