Merge tag '14.0-beta2' into jgrpp
# Conflicts: # CMakeLists.txt # src/cargotype.cpp # src/console_cmds.cpp # src/graph_gui.cpp # src/industry_cmd.cpp # src/industrytype.h # src/misc_gui.cpp # src/network/network_client.cpp # src/newgrf.cpp # src/newgrf_town.cpp # src/object_cmd.cpp # src/openttd.cpp # src/pathfinder/water_regions.cpp # src/saveload/saveload.cpp # src/saveload/saveload.h # src/table/build_industry.h # src/table/engines.h # src/vehicle.cpp # src/vehicle_cmd.cpp # src/vehicle_gui.cpp
This commit is contained in:
@@ -193,14 +193,23 @@ SpriteID TileZoneCheckUnservedBuildingsEvaluation(TileIndex tile, Owner owner)
|
||||
return ZONING_INVALID_SPRITE_ID;
|
||||
}
|
||||
|
||||
auto has_town_cargo = [&](const CargoArray &dat) {
|
||||
for (auto tpe : {TPE_PASSENGERS, TPE_MAIL}) {
|
||||
for (const CargoSpec *cs : CargoSpec::town_production_cargoes[tpe]) {
|
||||
if (dat[cs->Index()] > 0) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
CargoArray dat{};
|
||||
dat.Clear();
|
||||
AddAcceptedCargo(tile, dat, nullptr);
|
||||
if (dat[CT_MAIL] + dat[CT_PASSENGERS] == 0) {
|
||||
// nothing is accepted, so now test if cargo is produced
|
||||
if (!has_town_cargo(dat)) {
|
||||
/* nothing is accepted, so now test if cargo is produced */
|
||||
AddProducedCargo(tile, dat);
|
||||
if (dat[CT_MAIL] + dat[CT_PASSENGERS] == 0) {
|
||||
// total is still 0, so give up
|
||||
if (!has_town_cargo(dat)) {
|
||||
/* still don't have town cargo, so give up */
|
||||
return ZONING_INVALID_SPRITE_ID;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user