summaryrefslogtreecommitdiff
path: root/src/industry_gui.cpp
diff options
context:
space:
mode:
authorNiels Martin Hansen <nielsm@indvikleren.dk>2019-10-04 21:26:44 +0200
committerCharles Pigott <charlespigott@googlemail.com>2019-10-19 17:16:25 +0100
commit53f8d0b815a7be57fb6489d95e67b9002ade14d7 (patch)
tree0b712b7ddfb763497414d03475839b5185227acb /src/industry_gui.cpp
parente5f175562907efed0c958db76ca61145b838dc63 (diff)
downloadopenttd-53f8d0b815a7be57fb6489d95e67b9002ade14d7.tar.xz
Codechange: Use std::vector for industry tile layouts
Diffstat (limited to 'src/industry_gui.cpp')
-rw-r--r--src/industry_gui.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index c662bfef9..a9f3f51d2 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -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 */