diff options
author | rubidium <rubidium@openttd.org> | 2009-01-04 14:36:19 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-01-04 14:36:19 +0000 |
commit | 183f8df5525d6eb6aba06e2327d59ba65562a7d2 (patch) | |
tree | c3bb5f424d1792fc8aec5389920ebe7cc7483e6c /src | |
parent | 1900ba908bbc63d8764bf6f60152603667601383 (diff) | |
download | openttd-183f8df5525d6eb6aba06e2327d59ba65562a7d2.tar.xz |
(svn r14826) -Fix [FS#2494]: infinite loop in order lookahead when reserving a path (Swallow)
Diffstat (limited to 'src')
-rw-r--r-- | src/train_cmd.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 5cf594716..432ef9e8e 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -2849,6 +2849,8 @@ public: { ++this->index; + int conditional_depth = 0; + do { /* Wrap around. */ if (this->index >= this->v->GetNumOrders()) this->index = 0; @@ -2866,8 +2868,10 @@ public: UpdateOrderDest(this->v, order); return true; case OT_CONDITIONAL: { + if (conditional_depth > this->v->GetNumOrders()) return false; VehicleOrderID next = ProcessConditionalOrder(order, this->v); if (next != INVALID_VEH_ORDER_ID) { + conditional_depth++; this->index = next; /* Don't increment next, so no break here. */ continue; |