diff options
author | rubidium <rubidium@openttd.org> | 2008-11-23 21:46:27 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-11-23 21:46:27 +0000 |
commit | 965d0428bd25ff7eb6307a5c521a8cce67cf470e (patch) | |
tree | a9c4bd302b0aaf9cede2d8466554fe160317248b /src | |
parent | 883e3f9b5826cca715f5224f196de4973470f583 (diff) | |
download | openttd-965d0428bd25ff7eb6307a5c521a8cce67cf470e.tar.xz |
(svn r14616) -Fix [FS#2424]: a nearest depot order should be "equal" to the resolved nearest depot order; otherwise we keep resolving the nearest depot order every tick.
Diffstat (limited to 'src')
-rw-r--r-- | src/order_cmd.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index 9d7f855ff..f0806f607 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -115,6 +115,19 @@ void Order::FreeChain() bool Order::Equals(const Order &other) const { + /* In case of go to nearest depot orders we need "only" compare the flags + * with the other and not the nearest depot order bit or the actual + * destination because those get clear/filled in during the order + * evaluation. If we do not do this the order will continuously be seen as + * a different order and it will try to find a "nearest depot" every tick. */ + if ((this->type == OT_GOTO_DEPOT && this->type == other.type) && + ((this->GetDepotActionType() & ODATFB_NEAREST_DEPOT) != 0 || + (other.GetDepotActionType() & ODATFB_NEAREST_DEPOT) != 0)) { + return + this->GetDepotOrderType() == other.GetDepotOrderType() && + (this->GetDepotActionType() & ~ODATFB_NEAREST_DEPOT) == (other.GetDepotActionType() & ~ODATFB_NEAREST_DEPOT); + } + return this->type == other.type && this->flags == other.flags && |