0x0045979C & 0x00459949
| 449 | |
| 450 | // 0x0045979C & 0x00459949 |
| 451 | void createNewIndustry(const uint8_t indObjId, const bool buildImmediately, const int32_t numAttempts) |
| 452 | { |
| 453 | // Try find valid coordinates for this industry |
| 454 | for (auto attempt = 0; attempt < numAttempts; ++attempt) |
| 455 | { |
| 456 | auto randomIndustryLoc = findRandomNewIndustryLocation(indObjId); |
| 457 | if (randomIndustryLoc.has_value()) |
| 458 | { |
| 459 | GameCommands::IndustryPlacementArgs args; |
| 460 | args.type = indObjId; |
| 461 | args.buildImmediately = buildImmediately; |
| 462 | args.pos = *randomIndustryLoc; |
| 463 | // To match vanilla we will do this. |
| 464 | // TODO: Once match confirmed replace with two randNext() calls |
| 465 | const auto temp = gPrng1().srand_0(); |
| 466 | gPrng1().randNext(); |
| 467 | args.srand0 = gPrng1().srand_0() - temp; |
| 468 | args.srand1 = gPrng1().srand_1(); |
| 469 | |
| 470 | auto res = GameCommands::doCommand(args, GameCommands::Flags::apply); |
| 471 | if (res != GameCommands::kFailure) |
| 472 | { |
| 473 | break; |
| 474 | } |
| 475 | } |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | // 0x00459659 |
| 480 | static void tryCreateNewIndustriesMonthly() |
no test coverage detected