Skip to content

Commit

Permalink
Fix: Switch to OWNER_TOWN prevented OWNER_DEITY test during industry …
Browse files Browse the repository at this point in the history
…prospecting. (#10360)
  • Loading branch information
PeterN committed Jan 17, 2023
1 parent 8d8519c commit 5801442
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/industry_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<CompanyID> 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
Expand All @@ -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;
Expand Down

0 comments on commit 5801442

Please sign in to comment.