mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r14826) -Fix [FS#2494]: infinite loop in order lookahead when reserving a path (Swallow)
This commit is contained in:
parent
2283b8038f
commit
ce5304f9a2
@ -2849,6 +2849,8 @@ public:
|
|||||||
{
|
{
|
||||||
++this->index;
|
++this->index;
|
||||||
|
|
||||||
|
int conditional_depth = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
/* Wrap around. */
|
/* Wrap around. */
|
||||||
if (this->index >= this->v->GetNumOrders()) this->index = 0;
|
if (this->index >= this->v->GetNumOrders()) this->index = 0;
|
||||||
@ -2866,8 +2868,10 @@ public:
|
|||||||
UpdateOrderDest(this->v, order);
|
UpdateOrderDest(this->v, order);
|
||||||
return true;
|
return true;
|
||||||
case OT_CONDITIONAL: {
|
case OT_CONDITIONAL: {
|
||||||
|
if (conditional_depth > this->v->GetNumOrders()) return false;
|
||||||
VehicleOrderID next = ProcessConditionalOrder(order, this->v);
|
VehicleOrderID next = ProcessConditionalOrder(order, this->v);
|
||||||
if (next != INVALID_VEH_ORDER_ID) {
|
if (next != INVALID_VEH_ORDER_ID) {
|
||||||
|
conditional_depth++;
|
||||||
this->index = next;
|
this->index = next;
|
||||||
/* Don't increment next, so no break here. */
|
/* Don't increment next, so no break here. */
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user