summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-02-22 00:30:36 +0000
committerrubidium <rubidium@openttd.org>2009-02-22 00:30:36 +0000
commit731c1e90e85fbc48c59a6c94e293ca211083b1e6 (patch)
tree3e6915e566e85a864b45d09288b913aea4f16f63 /src
parentb68a870fe3c000e8766e589dc8266fe713c934e3 (diff)
downloadopenttd-731c1e90e85fbc48c59a6c94e293ca211083b1e6.tar.xz
(svn r15551) -Fix [FS#2656]: [NoAI] crash when setting a depot order to the southern part of a ship depot
Diffstat (limited to 'src')
-rw-r--r--src/depot.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/depot.cpp b/src/depot.cpp
index e8b6b3e5c..e73490071 100644
--- a/src/depot.cpp
+++ b/src/depot.cpp
@@ -7,6 +7,9 @@
#include "order_func.h"
#include "window_func.h"
#include "oldpool_func.h"
+#include "core/bitmath_func.hpp"
+#include "tile_map.h"
+#include "water_map.h"
DEFINE_OLD_POOL_GENERIC(Depot, Depot)
@@ -17,6 +20,13 @@ DEFINE_OLD_POOL_GENERIC(Depot, Depot)
*/
Depot *GetDepotByTile(TileIndex tile)
{
+ /* A ship depot is multiple tiles. The north most tile is
+ * always the ->xy tile, so make sure we always look for
+ * the nothern tile and not the southern one. */
+ if (IsShipDepotTile(tile)) {
+ tile = min(tile, GetOtherShipDepotTile(tile));
+ }
+
Depot *depot;
FOR_ALL_DEPOTS(depot) {