251 _generating_world = true; |
251 _generating_world = true; |
252 GenerateIndustries(); |
252 GenerateIndustries(); |
253 _generating_world = false; |
253 _generating_world = false; |
254 } |
254 } |
255 } else if (_game_mode != GM_EDITOR && _patches.raw_industry_construction == 2 && GetIndustrySpec(WP(w, fnd_d).select)->IsRawIndustry()) { |
255 } else if (_game_mode != GM_EDITOR && _patches.raw_industry_construction == 2 && GetIndustrySpec(WP(w, fnd_d).select)->IsRawIndustry()) { |
256 DoCommandP(0, WP(w, fnd_d).select, 0, NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY)); |
256 DoCommandP(0, WP(w, fnd_d).select, InteractiveRandom(), NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY)); |
257 w->HandleButtonClick(DPIW_FUND_WIDGET); |
257 w->HandleButtonClick(DPIW_FUND_WIDGET); |
258 } else { |
258 } else { |
259 HandlePlacePushButton(w, DPIW_FUND_WIDGET, SPR_CURSOR_INDUSTRY, VHM_RECT, NULL); |
259 HandlePlacePushButton(w, DPIW_FUND_WIDGET, SPR_CURSOR_INDUSTRY, VHM_RECT, NULL); |
260 } |
260 } |
261 } break; |
261 } break; |
270 |
270 |
271 case WE_PLACE_OBJ: { |
271 case WE_PLACE_OBJ: { |
272 bool success = true; |
272 bool success = true; |
273 /* We do not need to protect ourselves against "Random Many Industries" in this mode */ |
273 /* We do not need to protect ourselves against "Random Many Industries" in this mode */ |
274 const IndustrySpec *indsp = GetIndustrySpec(WP(w, fnd_d).select); |
274 const IndustrySpec *indsp = GetIndustrySpec(WP(w, fnd_d).select); |
|
275 uint32 seed = InteractiveRandom(); |
275 |
276 |
276 if (_game_mode == GM_EDITOR) { |
277 if (_game_mode == GM_EDITOR) { |
277 /* Show error if no town exists at all */ |
278 /* Show error if no town exists at all */ |
278 if (GetNumTowns() == 0) { |
279 if (GetNumTowns() == 0) { |
279 SetDParam(0, indsp->name); |
280 SetDParam(0, indsp->name); |
282 } |
283 } |
283 |
284 |
284 _current_player = OWNER_NONE; |
285 _current_player = OWNER_NONE; |
285 _generating_world = true; |
286 _generating_world = true; |
286 _ignore_restrictions = true; |
287 _ignore_restrictions = true; |
287 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)); |
288 success = DoCommandP(e->we.place.tile, (InteractiveRandomRange(indsp->num_table) << 16) | WP(w, fnd_d).select, seed, NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY)); |
288 if (!success) { |
289 if (!success) { |
289 SetDParam(0, indsp->name); |
290 SetDParam(0, indsp->name); |
290 ShowErrorMessage(_error_message, STR_0285_CAN_T_BUILD_HERE, e->we.place.pt.x, e->we.place.pt.y); |
291 ShowErrorMessage(_error_message, STR_0285_CAN_T_BUILD_HERE, e->we.place.pt.x, e->we.place.pt.y); |
291 } |
292 } |
292 |
293 |
293 _ignore_restrictions = false; |
294 _ignore_restrictions = false; |
294 _generating_world = false; |
295 _generating_world = false; |
295 } else { |
296 } else { |
296 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)); |
297 success = DoCommandP(e->we.place.tile, (InteractiveRandomRange(indsp->num_table) << 16) | WP(w, fnd_d).select, seed, NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY)); |
297 } |
298 } |
298 |
299 |
299 /* If an industry has been built, just reset the cursor and the system */ |
300 /* If an industry has been built, just reset the cursor and the system */ |
300 if (success) ResetObjectToPlace(); |
301 if (success) ResetObjectToPlace(); |
301 } break; |
302 } break; |