Changeset - r18353:55e21e815cc4
[Not reviewed]
master
0 4 0
rubidium - 13 years ago 2011-11-12 18:06:34
rubidium@openttd.org
(svn r23199) -Fix [FS#4822]: oil rigs that "expired" did not get removed from the station list
4 files changed with 31 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/order_backup.cpp
Show inline comments
 
@@ -16,6 +16,7 @@
 
#include "network/network_func.h"
 
#include "order_backup.h"
 
#include "vehicle_base.h"
 
#include "window_func.h"
 

	
 
OrderBackupPool _order_backup_pool("BackupOrder");
 
INSTANTIATE_POOL_METHODS(OrderBackup)
 
@@ -84,6 +85,8 @@ void OrderBackup::DoRestore(Vehicle *v)
 
	} else if (this->orders != NULL && OrderList::CanAllocateItem()) {
 
		v->orders.list = new OrderList(this->orders, v);
 
		this->orders = NULL;
 
		/* Make sure buoys/oil rigs are updated in the station list. */
 
		InvalidateWindowClassesData(WC_STATION_LIST, 0);
 
	}
 

	
 
	uint num_orders = v->GetNumOrders();
src/order_base.h
Show inline comments
 
@@ -51,7 +51,7 @@ public:
 
	uint16 travel_time;  ///< How long in ticks the journey to this destination should take.
 

	
 
	Order() : refit_cargo(CT_NO_REFIT) {}
 
	~Order() {}
 
	~Order();
 

	
 
	Order(uint32 packed);
 

	
src/order_cmd.cpp
Show inline comments
 
@@ -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
 
	++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);
 
	}
 

	
 
}
 

	
 

	
src/station.cpp
Show inline comments
 
@@ -99,8 +99,12 @@ Station::~Station()
 
	/* Clear the persistent storage. */
 
	delete this->airport.psa;
 

	
 

	
 
	InvalidateWindowData(WC_STATION_LIST, this->owner, 0);
 
	if (this->owner == OWNER_NONE) {
 
		/* Invalidate all in case of oil rigs. */
 
		InvalidateWindowClassesData(WC_STATION_LIST, 0);
 
	} else {
 
		InvalidateWindowData(WC_STATION_LIST, this->owner, 0);
 
	}
 

	
 
	DeleteWindowById(WC_STATION_VIEW, index);
 

	
0 comments (0 inline, 0 general)