Don't save TNNC chunk if there are no town zone callback handlers

pull/507/head
Jonathan G Rennison 1 year ago
parent 062d57eadb
commit 5dd285b0d9

@ -285,6 +285,15 @@ uint16 GetTownZonesCallback(Town *t)
return CALLBACK_FAILED;
}
bool IsGetTownZonesCallbackHandlerPresent()
{
for (GenericCallbackList::const_iterator it = _gcl[GSF_FAKE_TOWNS].begin(); it != _gcl[GSF_FAKE_TOWNS].end(); ++it) {
if (HasBit(it->file->observed_feature_tests, GFTOF_TOWN_ZONE_CALLBACK)) return true;
}
return false;
}
void DumpGenericCallbackSpriteGroups(GrfSpecFeature feature, DumpSpriteGroupPrinter print)
{
SpriteGroupDumper dumper(print);

@ -22,6 +22,8 @@
static bool _town_zone_radii_no_update = false;
extern bool IsGetTownZonesCallbackHandlerPresent();
HouseID SLGetCleanHouseType(TileIndex t, bool old_map_position)
{
if (old_map_position && SlXvIsFeatureMissing(XSLFI_MORE_HOUSES)) {
@ -375,7 +377,7 @@ void SlResetTNNC()
void Save_TNNC()
{
if (!IsNetworkServerSave()) {
if (!IsNetworkServerSave() || !IsGetTownZonesCallbackHandlerPresent()) {
SlSetLength(0);
return;
}

Loading…
Cancel
Save