* Create a new industry of random layout. * @param tile The location to build the industry. * @param type The industry type to build. * @param creation_type The circumstances the industry is created under. * @return the created industry or nullptr if it failed. */
| 2283 | * @return the created industry or nullptr if it failed. |
| 2284 | */ |
| 2285 | static Industry *CreateNewIndustry(TileIndex tile, IndustryType type, IndustryAvailabilityCallType creation_type) |
| 2286 | { |
| 2287 | const IndustrySpec *indspec = GetIndustrySpec(type); |
| 2288 | |
| 2289 | uint32_t seed = Random(); |
| 2290 | uint32_t seed2 = Random(); |
| 2291 | Industry *i = nullptr; |
| 2292 | size_t layout_index = RandomRange((uint32_t)indspec->layouts.size()); |
| 2293 | [[maybe_unused]] CommandCost ret = CreateNewIndustryHelper(tile, type, DoCommandFlag::Execute, indspec, layout_index, seed, GB(seed2, 0, 16), OWNER_NONE, creation_type, &i); |
| 2294 | assert(i != nullptr || ret.Failed()); |
| 2295 | return i; |
| 2296 | } |
| 2297 | |
| 2298 | /** |
| 2299 | * Compute the appearance probability for an industry during map creation. |
no test coverage detected