--- a/ship_gui.c Sun Feb 06 09:52:06 2005 +0000
+++ b/ship_gui.c Sun Feb 06 10:18:47 2005 +0000
@@ -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 @@
} 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 @@
uint tile;
Vehicle *v;
int num,x,y;
- Depot *d;
+ Depot *depot;
tile = w->window_number;
@@ -644,11 +645,10 @@
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;