summaryrefslogtreecommitdiff
path: root/src/order_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-11-12 18:06:34 +0000
committerrubidium <rubidium@openttd.org>2011-11-12 18:06:34 +0000
commitfb63543e2a9659d186f20c0558394b17b1615830 (patch)
tree71ef0580f22c269e82995ab864400a0e68579b57 /src/order_cmd.cpp
parent7fd1e1df81c3ed45e176f1bbf46d873b6cff316e (diff)
downloadopenttd-fb63543e2a9659d186f20c0558394b17b1615830.tar.xz
(svn r23199) -Fix [FS#4822]: oil rigs that "expired" did not get removed from the station list
Diffstat (limited to 'src/order_cmd.cpp')
-rw-r--r--src/order_cmd.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index 11a968a8f..ad84b582c 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -41,6 +41,19 @@ INSTANTIATE_POOL_METHODS(Order)
OrderListPool _orderlist_pool("OrderList");
INSTANTIATE_POOL_METHODS(OrderList)
+/** Clean everything up. */
+Order::~Order()
+{
+ if (CleaningPool()) return;
+
+ /* We can visit oil rigs and buoys that are not our own. They will be shown in
+ * the list of stations. So, we need to invalidate that window if needed. */
+ if (this->IsType(OT_GOTO_STATION) || this->IsType(OT_GOTO_WAYPOINT)) {
+ BaseStation *bs = BaseStation::GetIfValid(this->GetDestination());
+ if (bs != NULL && bs->owner == OWNER_NONE) InvalidateWindowClassesData(WC_STATION_LIST, 0);
+ }
+}
+
/**
* 'Free' the order
* @note ONLY use on "current_order" vehicle orders!
@@ -367,6 +380,14 @@ void OrderList::InsertOrderAt(Order *new_order, int index)
++this->num_orders;
if (!new_order->IsType(OT_IMPLICIT)) ++this->num_manual_orders;
this->timetable_duration += new_order->wait_time + new_order->travel_time;
+
+ /* We can visit oil rigs and buoys that are not our own. They will be shown in
+ * the list of stations. So, we need to invalidate that window if needed. */
+ if (new_order->IsType(OT_GOTO_STATION) || new_order->IsType(OT_GOTO_WAYPOINT)) {
+ BaseStation *bs = BaseStation::Get(new_order->GetDestination());
+ if (bs->owner == OWNER_NONE) InvalidateWindowClassesData(WC_STATION_LIST, 0);
+ }
+
}