Ensure nearby stations list updated in CBID_HOUSE_DESTRUCTION callback

pull/104/head
Jonathan G Rennison 5 years ago
parent 515187058f
commit 5155afee9b

@ -719,9 +719,12 @@ bool NewHouseTileLoop(TileIndex tile)
/* Check callback 21, which determines if a house should be destroyed. */
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)) {
ClearTownHouse(Town::GetByTile(tile), tile);
ClearTownHouse(t, tile);
extern void RemoveNearbyStations(Town *t);
RemoveNearbyStations(t);
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.
* @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 */) {
const Station *st = *it;

Loading…
Cancel
Save