Mercurial > hg > openttd
changeset 19003:3effafcdac97 draft
(svn r23859) -Fix: Inserting conditional orders for ships checked the wrong orders wrt. maximum distance.
author | frosch <frosch@openttd.org> |
---|---|
date | Fri, 27 Jan 2012 22:08:51 +0000 |
parents | 1b20a0b3b77c |
children | 50f5f856455b |
files | src/order_cmd.cpp |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -812,7 +812,14 @@ 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); }