289 w->vscroll.cap += e->we.sizing.diff.y / (int)w->resize.step_height; |
289 w->vscroll.cap += e->we.sizing.diff.y / (int)w->resize.step_height; |
290 w->widget[DYNA_INDU_MATRIX_WIDGET].data = (w->vscroll.cap << 8) + 1; |
290 w->widget[DYNA_INDU_MATRIX_WIDGET].data = (w->vscroll.cap << 8) + 1; |
291 } break; |
291 } break; |
292 |
292 |
293 case WE_PLACE_OBJ: { |
293 case WE_PLACE_OBJ: { |
|
294 bool success = true; |
294 /* We do not need to protect ourselves against "Random Many Industries" in this mode */ |
295 /* We do not need to protect ourselves against "Random Many Industries" in this mode */ |
295 const IndustrySpec *indsp = GetIndustrySpec(WP(w, fnd_d).select); |
296 const IndustrySpec *indsp = GetIndustrySpec(WP(w, fnd_d).select); |
296 |
297 |
297 if (_game_mode == GM_EDITOR) { |
298 if (_game_mode == GM_EDITOR) { |
298 /* Show error if no town exists at all */ |
299 /* Show error if no town exists at all */ |
303 } |
304 } |
304 |
305 |
305 _current_player = OWNER_NONE; |
306 _current_player = OWNER_NONE; |
306 _generating_world = true; |
307 _generating_world = true; |
307 _ignore_restrictions = true; |
308 _ignore_restrictions = true; |
308 if (!TryBuildIndustry(e->we.place.tile, WP(w, fnd_d).select)) { |
309 success = TryBuildIndustry(e->we.place.tile, WP(w, fnd_d).select); |
|
310 if (!success) { |
309 SetDParam(0, indsp->name); |
311 SetDParam(0, indsp->name); |
310 ShowErrorMessage(_error_message, STR_0285_CAN_T_BUILD_HERE, e->we.place.pt.x, e->we.place.pt.y); |
312 ShowErrorMessage(_error_message, STR_0285_CAN_T_BUILD_HERE, e->we.place.pt.x, e->we.place.pt.y); |
311 } |
313 } |
312 |
314 |
313 _ignore_restrictions = false; |
315 _ignore_restrictions = false; |
314 _generating_world = false; |
316 _generating_world = false; |
315 } else DoCommandP(e->we.place.tile, WP(w, fnd_d).select, 0, NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY)); |
317 } else { |
316 |
318 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)); |
317 /* Whatever the outcome of the actions, just reset the cursor and the system */ |
319 } |
318 ResetObjectToPlace(); |
320 |
|
321 /* If an industry has been built, just reset the cursor and the system */ |
|
322 if (success) ResetObjectToPlace(); |
319 } break; |
323 } break; |
320 |
324 |
321 case WE_TICK: |
325 case WE_TICK: |
322 if (!WP(w, fnd_d).timer_enabled) break; |
326 if (!WP(w, fnd_d).timer_enabled) break; |
323 if (--WP(w, fnd_d).callback_timer == 0) { |
327 if (--WP(w, fnd_d).callback_timer == 0) { |