order_gui.c
changeset 3315 c9d989783c55
parent 3269 62fb247bf94b
child 3338 7cff208f0446
--- a/order_gui.c	Fri Mar 24 08:00:45 2006 +0000
+++ b/order_gui.c	Fri Mar 24 08:55:08 2006 +0000
@@ -3,6 +3,7 @@
 #include "stdafx.h"
 #include "openttd.h"
 #include "road_map.h"
+#include "station_map.h"
 #include "table/sprites.h"
 #include "table/strings.h"
 #include "functions.h"
@@ -190,7 +191,6 @@
 static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
 {
 	Order order;
-	int st_index;
 
 	// check depot first
 	if (_patches.gotodepot) {
@@ -221,7 +221,7 @@
 			if (IsAircraftHangarTile(tile) && IsTileOwner(tile, _local_player)) {
 				order.type = OT_GOTO_DEPOT;
 				order.flags = OF_PART_OF_ORDERS;
-				order.station = _m[tile].m2;
+				order.station = GetStationIndex(tile);
 				return order;
 			}
 			break;
@@ -257,7 +257,8 @@
 	}
 
 	if (IsTileType(tile, MP_STATION)) {
-		const Station* st = GetStation(st_index = _m[tile].m2);
+		StationID st_index = GetStationIndex(tile);
+		const Station* st = GetStation(st_index);
 
 		if (st->owner == _current_player || st->owner == OWNER_NONE) {
 			byte facil;