summaryrefslogtreecommitdiff
path: root/src/industry_cmd.cpp
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2007-10-29 23:29:06 +0000
committerglx <glx@openttd.org>2007-10-29 23:29:06 +0000
commit0204f501df70b5e0f554cc9686555cfb603a2064 (patch)
tree6046645b9b68dded00d5d17f521b23ab307af06f /src/industry_cmd.cpp
parentb14c94867a121a5c6b9b69340953368aee8a8876 (diff)
downloadopenttd-0204f501df70b5e0f554cc9686555cfb603a2064.tar.xz
(svn r11356) -Fix (r11305): funding industries in MP game was causing desync
Diffstat (limited to 'src/industry_cmd.cpp')
-rw-r--r--src/industry_cmd.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index edce756fc..a7067702b 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -1570,7 +1570,7 @@ static Industry *CreateNewIndustryHelper(TileIndex tile, IndustryType type, uint
* @param tile tile where industry is built
* @param flags of operations to conduct
* @param p1 industry type see build_industry.h and see industry.h
- * @param p2 unused
+ * @param p2 first layout to try
* @return index of the newly create industry, or CMD_ERROR if it failed
*/
CommandCost CmdBuildIndustry(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
@@ -1618,7 +1618,7 @@ CommandCost CmdBuildIndustry(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
} else {
int count = indspec->num_table;
const IndustryTileTable * const *itt = indspec->table;
- int num = RandomRange(count);
+ int num = clamp(p2, 0, count - 1);
_error_message = STR_0239_SITE_UNSUITABLE;
do {