From 58014427800685a4fbaf7b7a242841a78e4ae70c Mon Sep 17 00:00:00 2001 From: PeterN Date: Tue, 17 Jan 2023 22:33:03 +0000 Subject: [PATCH] Fix: Switch to OWNER_TOWN prevented OWNER_DEITY test during industry prospecting. (#10360) --- src/industry_cmd.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index cdf1f9d430..c382ed3691 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -2046,6 +2046,7 @@ CommandCost CmdBuildIndustry(DoCommandFlag flags, TileIndex tile, IndustryType i bool prospect_success = deity_prospect || Random() <= indspec->prospecting_chance; if (prospect_success) { /* Prospected industries are build as OWNER_TOWN to not e.g. be build on owned land of the founder */ + IndustryAvailabilityCallType calltype = _current_company == OWNER_DEITY ? IACT_RANDOMCREATION : IACT_PROSPECTCREATION; Backup cur_company(_current_company, OWNER_TOWN, FILE_LINE); for (int i = 0; i < 5000; i++) { /* We should not have more than one Random() in a function call @@ -2057,7 +2058,7 @@ CommandCost CmdBuildIndustry(DoCommandFlag flags, TileIndex tile, IndustryType i /* Check now each layout, starting with the random one */ for (size_t j = 0; j < num_layouts; j++) { layout = (layout + 1) % num_layouts; - ret = CreateNewIndustryHelper(tile, it, flags, indspec, layout, random_var8f, random_initial_bits, cur_company.GetOriginalValue(), _current_company == OWNER_DEITY ? IACT_RANDOMCREATION : IACT_PROSPECTCREATION, &ind); + ret = CreateNewIndustryHelper(tile, it, flags, indspec, layout, random_var8f, random_initial_bits, cur_company.GetOriginalValue(), calltype, &ind); if (ret.Succeeded()) break; } if (ret.Succeeded()) break;