* Try to place the industry in the game. * Since there is no feedback why placement fails, there is no other option * than to try a few times before concluding it does not work. * @param type Industry type of the desired industry. * @param try_hard Try very hard to find a place. (Used to place at least one industry per type.) * @return Pointer to created industry, or \c nullptr if creatio
| 2384 | * @return Pointer to created industry, or \c nullptr if creation failed. |
| 2385 | */ |
| 2386 | static Industry *PlaceIndustry(IndustryType type, IndustryAvailabilityCallType creation_type, bool try_hard) |
| 2387 | { |
| 2388 | uint tries = try_hard ? 10000u : 2000u; |
| 2389 | for (; tries > 0; tries--) { |
| 2390 | Industry *ind = CreateNewIndustry(RandomTile(), type, creation_type); |
| 2391 | if (ind != nullptr) return ind; |
| 2392 | } |
| 2393 | return nullptr; |
| 2394 | } |
| 2395 | |
| 2396 | /** |
| 2397 | * Try to build a industry on the map. |
no test coverage detected