src/industry_cmd.cpp
changeset 7806 2876d9bfa05a
parent 7799 72e48b8cf207
child 7821 dbdfb0db23ba
--- a/src/industry_cmd.cpp	Mon Oct 29 23:02:31 2007 +0000
+++ b/src/industry_cmd.cpp	Mon Oct 29 23:29:06 2007 +0000
@@ -1570,7 +1570,7 @@
  * @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 @@
 	} 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 {