mirror of https://github.com/OpenTTD/OpenTTD
(svn r16745) -Fix [FS#3011]: invalidate JoinStation window after removing item from the pool
parent
4c6a4e3ab2
commit
c861d9b64b
|
@ -108,6 +108,7 @@ DEFINE_POOL_METHOD(void)::FreeItem(size_t index)
|
||||||
this->data[index] = NULL;
|
this->data[index] = NULL;
|
||||||
this->first_free = min(this->first_free, index);
|
this->first_free = min(this->first_free, index);
|
||||||
this->items--;
|
this->items--;
|
||||||
|
if (!this->cleaning) Titem::PostDestructor(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_POOL_METHOD(void)::CleanPool()
|
DEFINE_POOL_METHOD(void)::CleanPool()
|
||||||
|
|
|
@ -221,6 +221,15 @@ struct Pool {
|
||||||
{
|
{
|
||||||
return Tpool->items;
|
return Tpool->items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dummy function called after destructor of each member.
|
||||||
|
* If you want to use it, override it in PoolItem's subclass.
|
||||||
|
* @param index index of deleted item
|
||||||
|
* @note when this function is called, PoolItem::Get(index) == NULL.
|
||||||
|
* @note it's called only when !CleaningPool()
|
||||||
|
*/
|
||||||
|
static FORCEINLINE void PostDestructor(size_t index) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -94,8 +94,6 @@ Station::~Station()
|
||||||
/* Remove all news items */
|
/* Remove all news items */
|
||||||
DeleteStationNews(this->index);
|
DeleteStationNews(this->index);
|
||||||
|
|
||||||
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
|
|
||||||
|
|
||||||
for (CargoID c = 0; c < NUM_CARGO; c++) {
|
for (CargoID c = 0; c < NUM_CARGO; c++) {
|
||||||
goods[c].cargo.Truncate(0);
|
goods[c].cargo.Truncate(0);
|
||||||
}
|
}
|
||||||
|
@ -108,6 +106,16 @@ Station::~Station()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invalidating of the JoinStation window has to be done
|
||||||
|
* after removing item from the pool.
|
||||||
|
* @param index index of deleted item
|
||||||
|
*/
|
||||||
|
void Station::PostDestructor(size_t index)
|
||||||
|
{
|
||||||
|
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the primary road stop (the first road stop) that the given vehicle can load/unload.
|
* Get the primary road stop (the first road stop) that the given vehicle can load/unload.
|
||||||
* @param v the vehicle to get the first road stop for
|
* @param v the vehicle to get the first road stop for
|
||||||
|
|
|
@ -186,6 +186,8 @@ public:
|
||||||
{
|
{
|
||||||
return Station::Get(GetStationIndex(tile));
|
return Station::Get(GetStationIndex(tile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void PostDestructor(size_t index);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FOR_ALL_STATIONS_FROM(var, start) FOR_ALL_ITEMS_FROM(Station, station_index, var, start)
|
#define FOR_ALL_STATIONS_FROM(var, start) FOR_ALL_ITEMS_FROM(Station, station_index, var, start)
|
||||||
|
|
Loading…
Reference in New Issue