equal
deleted
inserted
replaced
1 /* $Id$ */ |
1 /* $Id$ */ |
2 |
2 |
3 #include "stdafx.h" |
3 #include "stdafx.h" |
4 #include "openttd.h" |
4 #include "openttd.h" |
5 #include "road_map.h" |
5 #include "road_map.h" |
|
6 #include "station_map.h" |
6 #include "table/sprites.h" |
7 #include "table/sprites.h" |
7 #include "table/strings.h" |
8 #include "table/strings.h" |
8 #include "functions.h" |
9 #include "functions.h" |
9 #include "map.h" |
10 #include "map.h" |
10 #include "tile.h" |
11 #include "tile.h" |
188 } |
189 } |
189 |
190 |
190 static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile) |
191 static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile) |
191 { |
192 { |
192 Order order; |
193 Order order; |
193 int st_index; |
|
194 |
194 |
195 // check depot first |
195 // check depot first |
196 if (_patches.gotodepot) { |
196 if (_patches.gotodepot) { |
197 switch (GetTileType(tile)) { |
197 switch (GetTileType(tile)) { |
198 case MP_RAILWAY: |
198 case MP_RAILWAY: |
219 case MP_STATION: |
219 case MP_STATION: |
220 if (v->type != VEH_Aircraft) break; |
220 if (v->type != VEH_Aircraft) break; |
221 if (IsAircraftHangarTile(tile) && IsTileOwner(tile, _local_player)) { |
221 if (IsAircraftHangarTile(tile) && IsTileOwner(tile, _local_player)) { |
222 order.type = OT_GOTO_DEPOT; |
222 order.type = OT_GOTO_DEPOT; |
223 order.flags = OF_PART_OF_ORDERS; |
223 order.flags = OF_PART_OF_ORDERS; |
224 order.station = _m[tile].m2; |
224 order.station = GetStationIndex(tile); |
225 return order; |
225 return order; |
226 } |
226 } |
227 break; |
227 break; |
228 |
228 |
229 case MP_WATER: |
229 case MP_WATER: |
255 order.station = GetWaypointByTile(tile)->index; |
255 order.station = GetWaypointByTile(tile)->index; |
256 return order; |
256 return order; |
257 } |
257 } |
258 |
258 |
259 if (IsTileType(tile, MP_STATION)) { |
259 if (IsTileType(tile, MP_STATION)) { |
260 const Station* st = GetStation(st_index = _m[tile].m2); |
260 StationID st_index = GetStationIndex(tile); |
|
261 const Station* st = GetStation(st_index); |
261 |
262 |
262 if (st->owner == _current_player || st->owner == OWNER_NONE) { |
263 if (st->owner == _current_player || st->owner == OWNER_NONE) { |
263 byte facil; |
264 byte facil; |
264 (facil=FACIL_DOCK, v->type == VEH_Ship) || |
265 (facil=FACIL_DOCK, v->type == VEH_Ship) || |
265 (facil=FACIL_TRAIN, v->type == VEH_Train) || |
266 (facil=FACIL_TRAIN, v->type == VEH_Train) || |