diff options
author | celestar <celestar@openttd.org> | 2006-03-31 10:47:06 +0000 |
---|---|---|
committer | celestar <celestar@openttd.org> | 2006-03-31 10:47:06 +0000 |
commit | 859fc1d7f0173102d16e3a31b3ceb5066870ccb5 (patch) | |
tree | 808efb13762904f8448bfc8db2678b9cd5171438 /order_gui.c | |
parent | 43c86cf33f0dddaebf9487f6ed2faffad15f884f (diff) | |
download | openttd-859fc1d7f0173102d16e3a31b3ceb5066870ccb5.tar.xz |
(svn r4200) -Codechange: Make use of water map accessors when getting the Index of a Ship Depot. TODO: Store the depot index in the map
Diffstat (limited to 'order_gui.c')
-rw-r--r-- | order_gui.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/order_gui.c b/order_gui.c index 399cf0fe0..af6f1ae33 100644 --- a/order_gui.c +++ b/order_gui.c @@ -20,6 +20,7 @@ #include "depot.h" #include "waypoint.h" #include "train.h" +#include "water_map.h" static int OrderGetSel(const Window* w) { @@ -232,13 +233,11 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile) if (v->type != VEH_Ship) break; if (IsTileDepotType(tile, TRANSPORT_WATER) && IsTileOwner(tile, _local_player)) { - switch (_m[tile].m5) { - case 0x81: tile -= TileDiffXY(1, 0); break; - case 0x83: tile -= TileDiffXY(0, 1); break; - } + TileIndex tile2 = GetOtherShipDepotTile(tile); + order.type = OT_GOTO_DEPOT; order.flags = OF_PART_OF_ORDERS; - order.station = GetDepotByTile(tile)->index; + order.station = GetDepotByTile(tile < tile2 ? tile : tile2)->index; return order; } |