summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-01-27 22:08:51 +0000
committerfrosch <frosch@openttd.org>2012-01-27 22:08:51 +0000
commita60f19ae14935e4f68667e67b650219380f5a86f (patch)
tree4f7619949d9b87678aa5fcde1a269f8187fa82ab /src
parent0b4d40b30e4d101180c6ea2259d4d0b5da24ebd0 (diff)
downloadopenttd-a60f19ae14935e4f68667e67b650219380f5a86f.tar.xz
(svn r23859) -Fix: Inserting conditional orders for ships checked the wrong orders wrt. maximum distance.
Diffstat (limited to 'src')
-rw-r--r--src/order_cmd.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index aed5195fe..824d82045 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -812,7 +812,14 @@ CommandCost CmdInsertOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
if (++n == sel_ord && prev != NULL) break;
}
if (prev != NULL) {
- uint dist = GetOrderDistance(prev, &new_order, v);
+ uint dist;
+ if (new_order.IsType(OT_CONDITIONAL)) {
+ /* The order is not yet inserted, so we have to do the first iteration here. */
+ dist = GetOrderDistance(prev, v->GetOrder(new_order.GetConditionSkipToOrder()), v);
+ } else {
+ dist = GetOrderDistance(prev, &new_order, v);
+ }
+
if (dist >= 130) {
return_cmd_error(STR_ERROR_TOO_FAR_FROM_PREVIOUS_DESTINATION);
}