mirror of https://github.com/OpenTTD/OpenTTD
(svn r11356) -Fix (r11305): funding industries in MP game was causing desync
parent
b14c94867a
commit
0204f501df
|
@ -1570,7 +1570,7 @@ static Industry *CreateNewIndustryHelper(TileIndex tile, IndustryType type, uint
|
||||||
* @param tile tile where industry is built
|
* @param tile tile where industry is built
|
||||||
* @param flags of operations to conduct
|
* @param flags of operations to conduct
|
||||||
* @param p1 industry type see build_industry.h and see industry.h
|
* @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
|
* @return index of the newly create industry, or CMD_ERROR if it failed
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildIndustry(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
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 {
|
} else {
|
||||||
int count = indspec->num_table;
|
int count = indspec->num_table;
|
||||||
const IndustryTileTable * const *itt = indspec->table;
|
const IndustryTileTable * const *itt = indspec->table;
|
||||||
int num = RandomRange(count);
|
int num = clamp(p2, 0, count - 1);
|
||||||
|
|
||||||
_error_message = STR_0239_SITE_UNSUITABLE;
|
_error_message = STR_0239_SITE_UNSUITABLE;
|
||||||
do {
|
do {
|
||||||
|
|
|
@ -315,7 +315,7 @@ static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e)
|
||||||
_ignore_restrictions = false;
|
_ignore_restrictions = false;
|
||||||
_generating_world = false;
|
_generating_world = false;
|
||||||
} else {
|
} else {
|
||||||
success = DoCommandP(e->we.place.tile, WP(w, fnd_d).select, 0, NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY));
|
success = DoCommandP(e->we.place.tile, WP(w, fnd_d).select, InteractiveRandomRange(indsp->num_table), NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If an industry has been built, just reset the cursor and the system */
|
/* If an industry has been built, just reset the cursor and the system */
|
||||||
|
|
Loading…
Reference in New Issue