Codechange: Use std::vector for industry tile layouts

This commit is contained in:
Niels Martin Hansen
2019-10-04 21:26:44 +02:00
committed by Charles Pigott
parent e5f1755629
commit 53f8d0b815
11 changed files with 272 additions and 355 deletions

View File

@@ -647,6 +647,7 @@ public:
/* We do not need to protect ourselves against "Random Many Industries" in this mode */
const IndustrySpec *indsp = GetIndustrySpec(this->selected_type);
uint32 seed = InteractiveRandom();
uint32 layout_index = InteractiveRandomRange((uint32)indsp->layouts.size());
if (_game_mode == GM_EDITOR) {
/* Show error if no town exists at all */
@@ -660,14 +661,14 @@ public:
_generating_world = true;
_ignore_restrictions = true;
DoCommandP(tile, (InteractiveRandomRange(indsp->num_table) << 8) | this->selected_type, seed,
DoCommandP(tile, (layout_index << 8) | this->selected_type, seed,
CMD_BUILD_INDUSTRY | CMD_MSG(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY), &CcBuildIndustry);
cur_company.Restore();
_ignore_restrictions = false;
_generating_world = false;
} else {
success = DoCommandP(tile, (InteractiveRandomRange(indsp->num_table) << 8) | this->selected_type, seed, CMD_BUILD_INDUSTRY | CMD_MSG(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY));
success = DoCommandP(tile, (layout_index << 8) | this->selected_type, seed, CMD_BUILD_INDUSTRY | CMD_MSG(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY));
}
/* If an industry has been built, just reset the cursor and the system */