Ensure nearby stations list updated in CBID_HOUSE_DESTRUCTION callback
This commit is contained in:
@@ -719,9 +719,12 @@ bool NewHouseTileLoop(TileIndex tile)
|
|||||||
|
|
||||||
/* Check callback 21, which determines if a house should be destroyed. */
|
/* Check callback 21, which determines if a house should be destroyed. */
|
||||||
if (HasBit(hs->callback_mask, CBM_HOUSE_DESTRUCTION)) {
|
if (HasBit(hs->callback_mask, CBM_HOUSE_DESTRUCTION)) {
|
||||||
uint16 callback_res = GetHouseCallback(CBID_HOUSE_DESTRUCTION, 0, 0, GetHouseType(tile), Town::GetByTile(tile), tile);
|
Town *t = Town::GetByTile(tile);
|
||||||
|
uint16 callback_res = GetHouseCallback(CBID_HOUSE_DESTRUCTION, 0, 0, GetHouseType(tile), t, tile);
|
||||||
if (callback_res != CALLBACK_FAILED && Convert8bitBooleanCallback(hs->grf_prop.grffile, CBID_HOUSE_DESTRUCTION, callback_res)) {
|
if (callback_res != CALLBACK_FAILED && Convert8bitBooleanCallback(hs->grf_prop.grffile, CBID_HOUSE_DESTRUCTION, callback_res)) {
|
||||||
ClearTownHouse(Town::GetByTile(tile), tile);
|
ClearTownHouse(t, tile);
|
||||||
|
extern void RemoveNearbyStations(Town *t);
|
||||||
|
RemoveNearbyStations(t);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -572,7 +572,7 @@ uint32 GetWorldPopulation()
|
|||||||
* Remove stations from nearby station list if a town is no longer in the catchment area of each.
|
* Remove stations from nearby station list if a town is no longer in the catchment area of each.
|
||||||
* @param t Town to work on
|
* @param t Town to work on
|
||||||
*/
|
*/
|
||||||
static void RemoveNearbyStations(Town *t)
|
void RemoveNearbyStations(Town *t)
|
||||||
{
|
{
|
||||||
for (StationList::iterator it = t->stations_near.begin(); it != t->stations_near.end(); /* incremented inside loop */) {
|
for (StationList::iterator it = t->stations_near.begin(); it != t->stations_near.end(); /* incremented inside loop */) {
|
||||||
const Station *st = *it;
|
const Station *st = *it;
|
||||||
|
Reference in New Issue
Block a user