From afa75ded1c700f1fd40e9acfe2376b0c4428440b Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Mon, 24 Jan 2022 18:30:18 +0000 Subject: [PATCH] Zoning: Fix unserved industry mode with passenger-handling industries --- src/zoning_cmd.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/zoning_cmd.cpp b/src/zoning_cmd.cpp index 895956b7ce..1879e5a582 100644 --- a/src/zoning_cmd.cpp +++ b/src/zoning_cmd.cpp @@ -231,8 +231,21 @@ SpriteID TileZoneCheckUnservedIndustriesEvaluation(TileIndex tile, Owner owner) if (ind->neutral_station != nullptr) return ZONING_INVALID_SPRITE_ID; for (const Station *st : ind->stations_near) { - if (st->owner == owner && st->facilities & (~FACIL_BUS_STOP)) { - return ZONING_INVALID_SPRITE_ID; + if (st->owner == owner) { + if (st->facilities & (~(FACIL_BUS_STOP | FACIL_TRUCK_STOP)) || st->facilities == (FACIL_BUS_STOP | FACIL_TRUCK_STOP)) { + return ZONING_INVALID_SPRITE_ID; + } else if (st->facilities & (FACIL_BUS_STOP | FACIL_TRUCK_STOP)) { + for (uint i = 0; i < lengthof(ind->produced_cargo); i++) { + if (ind->produced_cargo[i] != CT_INVALID && st->facilities & (IsCargoInClass(ind->produced_cargo[i], CC_PASSENGERS) ? FACIL_BUS_STOP : FACIL_TRUCK_STOP)) { + return ZONING_INVALID_SPRITE_ID; + } + } + for (uint i = 0; i < lengthof(ind->accepts_cargo); i++) { + if (ind->accepts_cargo[i] != CT_INVALID && st->facilities & (IsCargoInClass(ind->accepts_cargo[i], CC_PASSENGERS) ? FACIL_BUS_STOP : FACIL_TRUCK_STOP)) { + return ZONING_INVALID_SPRITE_ID; + } + } + } } }