Changeset - r26777:e9eb58c75300
[Not reviewed]
master
0 1 0
PeterN - 17 months ago 2023-01-17 22:33:03
peter1138@openttd.org
Fix: Switch to OWNER_TOWN prevented OWNER_DEITY test during industry prospecting. (#10360)
1 file changed with 2 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/industry_cmd.cpp
Show inline comments
 
@@ -2046,6 +2046,7 @@ CommandCost CmdBuildIndustry(DoCommandFl
 
			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
 
@@ -2057,7 +2058,7 @@ CommandCost CmdBuildIndustry(DoCommandFl
 
					/* 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;
0 comments (0 inline, 0 general)