diff options
author | truelight <truelight@openttd.org> | 2005-02-06 10:18:47 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2005-02-06 10:18:47 +0000 |
commit | e9c93f9c0ca76117ac1315b6aff03f1f138f62e4 (patch) | |
tree | 0b6bfe4dfd7abf3e94d0f7210b1b842e429c4a02 /ship_gui.c | |
parent | 6493e12bfbb147e41fc0f533bb3618b2931fed1f (diff) | |
download | openttd-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 'ship_gui.c')
-rw-r--r-- | ship_gui.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ship_gui.c b/ship_gui.c index 9c953e9f1..0e786aa93 100644 --- a/ship_gui.c +++ b/ship_gui.c @@ -12,6 +12,7 @@ #include "command.h" #include "player.h" #include "engine.h" +#include "depot.h" void Set_DPARAM_Ship_Build_Window(uint16 engine_number) { @@ -518,8 +519,8 @@ static void ShipViewWndProc(Window *w, WindowEvent *e) { } break; case OT_GOTO_DEPOT: { - Depot *dep = &_depots[v->current_order.station]; - SetDParam(0, dep->town_index); + Depot *depot = GetDepot(v->current_order.station); + SetDParam(0, depot->town_index); SetDParam(1, v->cur_speed * 10 >> 5); str = STR_HEADING_FOR_SHIP_DEPOT + _patches.vehicle_speed; } break; @@ -627,7 +628,7 @@ static void DrawShipDepotWindow(Window *w) uint tile; Vehicle *v; int num,x,y; - Depot *d; + Depot *depot; tile = w->window_number; @@ -644,11 +645,10 @@ static void DrawShipDepotWindow(Window *w) SetVScrollCount(w, (num + w->hscroll.cap - 1) / w->hscroll.cap); /* locate the depot struct */ - for (d = _depots; d->xy != (TileIndex)tile; d++) { - assert(d < endof(_depots)); - } + depot = GetDepotByTile(tile); + assert(depot != NULL); - SetDParam(0, d->town_index); + SetDParam(0, depot->town_index); DrawWindowWidgets(w); x = 2; |