OpenTTD
terraform_gui.cpp
Go to the documentation of this file.
1 /* $Id: terraform_gui.cpp 27893 2017-08-13 18:38:42Z frosch $ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8  */
9 
12 #include "stdafx.h"
13 #include "clear_map.h"
14 #include "company_func.h"
15 #include "company_base.h"
16 #include "gui.h"
17 #include "window_gui.h"
18 #include "window_func.h"
19 #include "viewport_func.h"
20 #include "command_func.h"
21 #include "signs_func.h"
22 #include "sound_func.h"
23 #include "base_station_base.h"
24 #include "textbuf_gui.h"
25 #include "genworld.h"
26 #include "tree_map.h"
27 #include "landscape_type.h"
28 #include "tilehighlight_func.h"
29 #include "strings_func.h"
30 #include "newgrf_object.h"
31 #include "object.h"
32 #include "hotkeys.h"
33 #include "engine_base.h"
34 #include "terraform_gui.h"
35 #include "zoom_func.h"
36 
38 
39 #include "table/strings.h"
40 
41 #include "safeguards.h"
42 
43 void CcTerraform(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
44 {
45  if (result.Succeeded()) {
46  if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, tile);
47  } else {
49  SetRedErrorSquare(_terraform_err_tile);
50  }
51 }
52 
53 
55 static void GenerateDesertArea(TileIndex end, TileIndex start)
56 {
57  if (_game_mode != GM_EDITOR) return;
58 
59  _generating_world = true;
60 
61  TileArea ta(start, end);
62  TILE_AREA_LOOP(tile, ta) {
64  DoCommandP(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
65  MarkTileDirtyByTile(tile);
66  }
67  _generating_world = false;
69 }
70 
72 static void GenerateRockyArea(TileIndex end, TileIndex start)
73 {
74  if (_game_mode != GM_EDITOR) return;
75 
76  bool success = false;
77  TileArea ta(start, end);
78 
79  TILE_AREA_LOOP(tile, ta) {
80  switch (GetTileType(tile)) {
81  case MP_TREES:
82  if (GetTreeGround(tile) == TREE_GROUND_SHORE) continue;
83  FALLTHROUGH;
84 
85  case MP_CLEAR:
86  MakeClear(tile, CLEAR_ROCKS, 3);
87  break;
88 
89  default:
90  continue;
91  }
92  MarkTileDirtyByTile(tile);
93  success = true;
94  }
95 
96  if (success && _settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, end);
97 }
98 
109 {
111  /* When end_tile is MP_VOID, the error tile will not be visible to the
112  * user. This happens when terraforming at the southern border. */
113  if (TileX(end_tile) == MapMaxX()) end_tile += TileDiffXY(-1, 0);
114  if (TileY(end_tile) == MapMaxY()) end_tile += TileDiffXY(0, -1);
115  }
116 
117  switch (proc) {
118  case DDSP_DEMOLISH_AREA:
119  DoCommandP(end_tile, start_tile, _ctrl_pressed ? 1 : 0, CMD_CLEAR_AREA | CMD_MSG(STR_ERROR_CAN_T_CLEAR_THIS_AREA), CcPlaySound_EXPLOSION);
120  break;
122  DoCommandP(end_tile, start_tile, LM_RAISE << 1 | (_ctrl_pressed ? 1 : 0), CMD_LEVEL_LAND | CMD_MSG(STR_ERROR_CAN_T_RAISE_LAND_HERE), CcTerraform);
123  break;
125  DoCommandP(end_tile, start_tile, LM_LOWER << 1 | (_ctrl_pressed ? 1 : 0), CMD_LEVEL_LAND | CMD_MSG(STR_ERROR_CAN_T_LOWER_LAND_HERE), CcTerraform);
126  break;
127  case DDSP_LEVEL_AREA:
128  DoCommandP(end_tile, start_tile, LM_LEVEL << 1 | (_ctrl_pressed ? 1 : 0), CMD_LEVEL_LAND | CMD_MSG(STR_ERROR_CAN_T_LEVEL_LAND_HERE), CcTerraform);
129  break;
130  case DDSP_CREATE_ROCKS:
131  GenerateRockyArea(end_tile, start_tile);
132  break;
133  case DDSP_CREATE_DESERT:
134  GenerateDesertArea(end_tile, start_tile);
135  break;
136  default:
137  return false;
138  }
139 
140  return true;
141 }
142 
148 {
150 }
151 
155 
157  {
158  /* This is needed as we like to have the tree available on OnInit. */
159  this->CreateNestedTree();
160  this->FinishInitNested(window_number);
161  this->last_user_action = WIDGET_LIST_END;
162  }
163 
165  {
166  }
167 
168  virtual void OnInit()
169  {
170  /* Don't show the place object button when there are no objects to place. */
171  NWidgetStacked *show_object = this->GetWidget<NWidgetStacked>(WID_TT_SHOW_PLACE_OBJECT);
172  show_object->SetDisplayedPlane(ObjectClass::GetUIClassCount() != 0 ? 0 : SZSP_NONE);
173  }
174 
175  virtual void OnClick(Point pt, int widget, int click_count)
176  {
177  if (widget < WID_TT_BUTTONS_START) return;
178 
179  switch (widget) {
180  case WID_TT_LOWER_LAND: // Lower land button
182  this->last_user_action = widget;
183  break;
184 
185  case WID_TT_RAISE_LAND: // Raise land button
187  this->last_user_action = widget;
188  break;
189 
190  case WID_TT_LEVEL_LAND: // Level land button
191  HandlePlacePushButton(this, WID_TT_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, HT_POINT | HT_DIAGONAL);
192  this->last_user_action = widget;
193  break;
194 
195  case WID_TT_DEMOLISH: // Demolish aka dynamite button
197  this->last_user_action = widget;
198  break;
199 
200  case WID_TT_BUY_LAND: // Buy land button
201  HandlePlacePushButton(this, WID_TT_BUY_LAND, SPR_CURSOR_BUY_LAND, HT_RECT);
202  this->last_user_action = widget;
203  break;
204 
205  case WID_TT_PLANT_TREES: // Plant trees button
206  ShowBuildTreesToolbar();
207  break;
208 
209  case WID_TT_PLACE_SIGN: // Place sign button
210  HandlePlacePushButton(this, WID_TT_PLACE_SIGN, SPR_CURSOR_SIGN, HT_RECT);
211  this->last_user_action = widget;
212  break;
213 
214  case WID_TT_PLACE_OBJECT: // Place object button
216  break;
217 
218  default: NOT_REACHED();
219  }
220  }
221 
222  virtual void OnPlaceObject(Point pt, TileIndex tile)
223  {
224  switch (this->last_user_action) {
225  case WID_TT_LOWER_LAND: // Lower land button
227  break;
228 
229  case WID_TT_RAISE_LAND: // Raise land button
231  break;
232 
233  case WID_TT_LEVEL_LAND: // Level land button
235  break;
236 
237  case WID_TT_DEMOLISH: // Demolish aka dynamite button
239  break;
240 
241  case WID_TT_BUY_LAND: // Buy land button
242  DoCommandP(tile, OBJECT_OWNED_LAND, 0, CMD_BUILD_OBJECT | CMD_MSG(STR_ERROR_CAN_T_PURCHASE_THIS_LAND), CcPlaySound_SPLAT_RAIL);
243  break;
244 
245  case WID_TT_PLACE_SIGN: // Place sign button
246  PlaceProc_Sign(tile);
247  break;
248 
249  default: NOT_REACHED();
250  }
251  }
252 
253  virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
254  {
255  VpSelectTilesWithMethod(pt.x, pt.y, select_method);
256  }
257 
258  virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number)
259  {
260  Point pt = GetToolbarAlignedWindowPosition(sm_width);
261  pt.y += sm_height;
262  return pt;
263  }
264 
265  virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
266  {
267  if (pt.x != -1) {
268  switch (select_proc) {
269  default: NOT_REACHED();
270  case DDSP_DEMOLISH_AREA:
273  case DDSP_LEVEL_AREA:
274  GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
275  break;
276  }
277  }
278  }
279 
280  virtual void OnPlaceObjectAbort()
281  {
282  this->RaiseButtons();
283  }
284 
285  static HotkeyList hotkeys;
286 };
287 
294 {
295  if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED;
296  Window *w = ShowTerraformToolbar(NULL);
297  if (w == NULL) return ES_NOT_HANDLED;
298  return w->OnHotkey(hotkey);
299 }
300 
301 static Hotkey terraform_hotkeys[] = {
302  Hotkey('Q' | WKC_GLOBAL_HOTKEY, "lower", WID_TT_LOWER_LAND),
303  Hotkey('W' | WKC_GLOBAL_HOTKEY, "raise", WID_TT_RAISE_LAND),
304  Hotkey('E' | WKC_GLOBAL_HOTKEY, "level", WID_TT_LEVEL_LAND),
305  Hotkey('D' | WKC_GLOBAL_HOTKEY, "dynamite", WID_TT_DEMOLISH),
306  Hotkey('U', "buyland", WID_TT_BUY_LAND),
307  Hotkey('I', "trees", WID_TT_PLANT_TREES),
308  Hotkey('O', "placesign", WID_TT_PLACE_SIGN),
309  Hotkey('P', "placeobject", WID_TT_PLACE_OBJECT),
310  HOTKEY_LIST_END
311 };
312 HotkeyList TerraformToolbarWindow::hotkeys("terraform", terraform_hotkeys, TerraformToolbarGlobalHotkeys);
313 
314 static const NWidgetPart _nested_terraform_widgets[] = {
316  NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
317  NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_LANDSCAPING_TOOLBAR, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
318  NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
319  EndContainer(),
321  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_LOWER_LAND), SetMinimalSize(22, 22),
322  SetFill(0, 1), SetDataTip(SPR_IMG_TERRAFORM_DOWN, STR_LANDSCAPING_TOOLTIP_LOWER_A_CORNER_OF_LAND),
323  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_RAISE_LAND), SetMinimalSize(22, 22),
324  SetFill(0, 1), SetDataTip(SPR_IMG_TERRAFORM_UP, STR_LANDSCAPING_TOOLTIP_RAISE_A_CORNER_OF_LAND),
325  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_LEVEL_LAND), SetMinimalSize(22, 22),
326  SetFill(0, 1), SetDataTip(SPR_IMG_LEVEL_LAND, STR_LANDSCAPING_LEVEL_LAND_TOOLTIP),
327 
328  NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(4, 22), EndContainer(),
329 
330  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_DEMOLISH), SetMinimalSize(22, 22),
331  SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
332  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_BUY_LAND), SetMinimalSize(22, 22),
333  SetFill(0, 1), SetDataTip(SPR_IMG_BUY_LAND, STR_LANDSCAPING_TOOLTIP_PURCHASE_LAND),
334  NWidget(WWT_PUSHIMGBTN, COLOUR_DARK_GREEN, WID_TT_PLANT_TREES), SetMinimalSize(22, 22),
335  SetFill(0, 1), SetDataTip(SPR_IMG_PLANTTREES, STR_SCENEDIT_TOOLBAR_PLANT_TREES),
336  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_PLACE_SIGN), SetMinimalSize(22, 22),
337  SetFill(0, 1), SetDataTip(SPR_IMG_SIGN, STR_SCENEDIT_TOOLBAR_PLACE_SIGN),
339  NWidget(WWT_PUSHIMGBTN, COLOUR_DARK_GREEN, WID_TT_PLACE_OBJECT), SetMinimalSize(22, 22),
340  SetFill(0, 1), SetDataTip(SPR_IMG_TRANSMITTER, STR_SCENEDIT_TOOLBAR_PLACE_OBJECT),
341  EndContainer(),
342  EndContainer(),
343 };
344 
345 static WindowDesc _terraform_desc(
346  WDP_MANUAL, "toolbar_landscape", 0, 0,
349  _nested_terraform_widgets, lengthof(_nested_terraform_widgets),
350  &TerraformToolbarWindow::hotkeys
351 );
352 
359 {
360  if (!Company::IsValidID(_local_company)) return NULL;
361 
362  Window *w;
363  if (link == NULL) {
364  w = AllocateWindowDescFront<TerraformToolbarWindow>(&_terraform_desc, 0);
365  return w;
366  }
367 
368  /* Delete the terraform toolbar to place it again. */
370  w = AllocateWindowDescFront<TerraformToolbarWindow>(&_terraform_desc, 0);
371  /* Align the terraform toolbar under the main toolbar. */
372  w->top -= w->height;
373  w->SetDirty();
374  /* Put the linked toolbar to the left / right of it. */
375  link->left = w->left + (_current_text_dir == TD_RTL ? w->width : -link->width);
376  link->top = w->top;
377  link->SetDirty();
378 
379  return w;
380 }
381 
382 static byte _terraform_size = 1;
383 
393 static void CommonRaiseLowerBigLand(TileIndex tile, int mode)
394 {
395  if (_terraform_size == 1) {
396  StringID msg =
397  mode ? STR_ERROR_CAN_T_RAISE_LAND_HERE : STR_ERROR_CAN_T_LOWER_LAND_HERE;
398 
399  DoCommandP(tile, SLOPE_N, (uint32)mode, CMD_TERRAFORM_LAND | CMD_MSG(msg), CcTerraform);
400  } else {
401  assert(_terraform_size != 0);
402  TileArea ta(tile, _terraform_size, _terraform_size);
403  ta.ClampToMap();
404 
405  if (ta.w == 0 || ta.h == 0) return;
406 
407  if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, tile);
408 
409  uint h;
410  if (mode != 0) {
411  /* Raise land */
412  h = MAX_TILE_HEIGHT;
413  TILE_AREA_LOOP(tile2, ta) {
414  h = min(h, TileHeight(tile2));
415  }
416  } else {
417  /* Lower land */
418  h = 0;
419  TILE_AREA_LOOP(tile2, ta) {
420  h = max(h, TileHeight(tile2));
421  }
422  }
423 
424  TILE_AREA_LOOP(tile2, ta) {
425  if (TileHeight(tile2) == h) {
426  DoCommandP(tile2, SLOPE_N, (uint32)mode, CMD_TERRAFORM_LAND);
427  }
428  }
429  }
430 }
431 
432 static const int8 _multi_terraform_coords[][2] = {
433  { 0, -2},
434  { 4, 0}, { -4, 0}, { 0, 2},
435  { -8, 2}, { -4, 4}, { 0, 6}, { 4, 4}, { 8, 2},
436  {-12, 0}, { -8, -2}, { -4, -4}, { 0, -6}, { 4, -4}, { 8, -2}, { 12, 0},
437  {-16, 2}, {-12, 4}, { -8, 6}, { -4, 8}, { 0, 10}, { 4, 8}, { 8, 6}, { 12, 4}, { 16, 2},
438  {-20, 0}, {-16, -2}, {-12, -4}, { -8, -6}, { -4, -8}, { 0,-10}, { 4, -8}, { 8, -6}, { 12, -4}, { 16, -2}, { 20, 0},
439  {-24, 2}, {-20, 4}, {-16, 6}, {-12, 8}, { -8, 10}, { -4, 12}, { 0, 14}, { 4, 12}, { 8, 10}, { 12, 8}, { 16, 6}, { 20, 4}, { 24, 2},
440  {-28, 0}, {-24, -2}, {-20, -4}, {-16, -6}, {-12, -8}, { -8,-10}, { -4,-12}, { 0,-14}, { 4,-12}, { 8,-10}, { 12, -8}, { 16, -6}, { 20, -4}, { 24, -2}, { 28, 0},
441 };
442 
443 static const NWidgetPart _nested_scen_edit_land_gen_widgets[] = {
445  NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
446  NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_TERRAFORM_TOOLBAR_LAND_GENERATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
447  NWidget(WWT_SHADEBOX, COLOUR_DARK_GREEN),
448  NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
449  EndContainer(),
450  NWidget(WWT_PANEL, COLOUR_DARK_GREEN),
451  NWidget(NWID_HORIZONTAL), SetPadding(2, 2, 7, 2),
452  NWidget(NWID_SPACER), SetFill(1, 0),
453  NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_DEMOLISH), SetMinimalSize(22, 22),
454  SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
455  NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_LOWER_LAND), SetMinimalSize(22, 22),
456  SetFill(0, 1), SetDataTip(SPR_IMG_TERRAFORM_DOWN, STR_LANDSCAPING_TOOLTIP_LOWER_A_CORNER_OF_LAND),
457  NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_RAISE_LAND), SetMinimalSize(22, 22),
458  SetFill(0, 1), SetDataTip(SPR_IMG_TERRAFORM_UP, STR_LANDSCAPING_TOOLTIP_RAISE_A_CORNER_OF_LAND),
459  NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_LEVEL_LAND), SetMinimalSize(22, 22),
460  SetFill(0, 1), SetDataTip(SPR_IMG_LEVEL_LAND, STR_LANDSCAPING_LEVEL_LAND_TOOLTIP),
461  NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_PLACE_ROCKS), SetMinimalSize(22, 22),
462  SetFill(0, 1), SetDataTip(SPR_IMG_ROCKS, STR_TERRAFORM_TOOLTIP_PLACE_ROCKY_AREAS_ON_LANDSCAPE),
464  NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_PLACE_DESERT), SetMinimalSize(22, 22),
465  SetFill(0, 1), SetDataTip(SPR_IMG_DESERT, STR_TERRAFORM_TOOLTIP_DEFINE_DESERT_AREA),
466  EndContainer(),
468  SetFill(0, 1), SetDataTip(SPR_IMG_TRANSMITTER, STR_SCENEDIT_TOOLBAR_PLACE_OBJECT),
469  NWidget(NWID_SPACER), SetFill(1, 0),
470  EndContainer(),
472  NWidget(NWID_SPACER), SetFill(1, 0),
473  NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_ETT_DOTS), SetMinimalSize(59, 31), SetDataTip(STR_EMPTY, STR_NULL),
474  NWidget(NWID_SPACER), SetFill(1, 0),
476  NWidget(NWID_SPACER), SetFill(0, 1),
477  NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_INCREASE_SIZE), SetMinimalSize(12, 12), SetDataTip(SPR_ARROW_UP, STR_TERRAFORM_TOOLTIP_INCREASE_SIZE_OF_LAND_AREA),
479  NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_DECREASE_SIZE), SetMinimalSize(12, 12), SetDataTip(SPR_ARROW_DOWN, STR_TERRAFORM_TOOLTIP_DECREASE_SIZE_OF_LAND_AREA),
480  NWidget(NWID_SPACER), SetFill(0, 1),
481  EndContainer(),
483  EndContainer(),
485  NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_ETT_NEW_SCENARIO), SetMinimalSize(160, 12),
486  SetFill(1, 0), SetDataTip(STR_TERRAFORM_SE_NEW_WORLD, STR_TERRAFORM_TOOLTIP_GENERATE_RANDOM_LAND), SetPadding(0, 2, 0, 2),
488  SetFill(1, 0), SetDataTip(STR_TERRAFORM_RESET_LANDSCAPE, STR_TERRAFORM_RESET_LANDSCAPE_TOOLTIP), SetPadding(1, 2, 2, 2),
489  EndContainer(),
490 };
491 
497 static void ResetLandscapeConfirmationCallback(Window *w, bool confirmed)
498 {
499  if (confirmed) {
500  /* Set generating_world to true to get instant-green grass after removing
501  * company property. */
502  _generating_world = true;
503 
504  /* Delete all companies */
505  Company *c;
506  FOR_ALL_COMPANIES(c) {
508  delete c;
509  }
510 
511  _generating_world = false;
512 
513  /* Delete all station signs */
514  BaseStation *st;
515  FOR_ALL_BASE_STATIONS(st) {
516  /* There can be buoys, remove them */
518  if (!st->IsInUse()) delete st;
519  }
520 
521  /* Now that all vehicles are gone, we can reset the engine pool. Maybe it reduces some NewGRF changing-mess */
523 
525  }
526 }
527 
531 
533  {
534  this->CreateNestedTree();
535  NWidgetStacked *show_desert = this->GetWidget<NWidgetStacked>(WID_ETT_SHOW_PLACE_DESERT);
536  show_desert->SetDisplayedPlane(_settings_game.game_creation.landscape == LT_TROPIC ? 0 : SZSP_NONE);
537  this->FinishInitNested(window_number);
538  this->last_user_action = WIDGET_LIST_END;
539  }
540 
541  virtual void OnPaint()
542  {
543  this->DrawWidgets();
544 
545  if (this->IsWidgetLowered(WID_ETT_LOWER_LAND) || this->IsWidgetLowered(WID_ETT_RAISE_LAND)) { // change area-size if raise/lower corner is selected
546  SetTileSelectSize(_terraform_size, _terraform_size);
547  }
548  }
549 
550  virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
551  {
552  if (widget != WID_ETT_DOTS) return;
553 
554  size->width = max<uint>(size->width, ScaleGUITrad(59));
555  size->height = max<uint>(size->height, ScaleGUITrad(31));
556  }
557 
558  virtual void DrawWidget(const Rect &r, int widget) const
559  {
560  if (widget != WID_ETT_DOTS) return;
561 
562  int center_x = RoundDivSU(r.left + r.right, 2);
563  int center_y = RoundDivSU(r.top + r.bottom, 2);
564 
565  int n = _terraform_size * _terraform_size;
566  const int8 *coords = &_multi_terraform_coords[0][0];
567 
568  assert(n != 0);
569  do {
570  DrawSprite(SPR_WHITE_POINT, PAL_NONE, center_x + ScaleGUITrad(coords[0]), center_y + ScaleGUITrad(coords[1]));
571  coords += 2;
572  } while (--n);
573  }
574 
575  virtual void OnClick(Point pt, int widget, int click_count)
576  {
577  if (widget < WID_ETT_BUTTONS_START) return;
578 
579  switch (widget) {
580  case WID_ETT_DEMOLISH: // Demolish aka dynamite button
582  this->last_user_action = widget;
583  break;
584 
585  case WID_ETT_LOWER_LAND: // Lower land button
587  this->last_user_action = widget;
588  break;
589 
590  case WID_ETT_RAISE_LAND: // Raise land button
592  this->last_user_action = widget;
593  break;
594 
595  case WID_ETT_LEVEL_LAND: // Level land button
596  HandlePlacePushButton(this, WID_ETT_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, HT_POINT | HT_DIAGONAL);
597  this->last_user_action = widget;
598  break;
599 
600  case WID_ETT_PLACE_ROCKS: // Place rocks button
601  HandlePlacePushButton(this, WID_ETT_PLACE_ROCKS, SPR_CURSOR_ROCKY_AREA, HT_RECT);
602  this->last_user_action = widget;
603  break;
604 
605  case WID_ETT_PLACE_DESERT: // Place desert button (in tropical climate)
606  HandlePlacePushButton(this, WID_ETT_PLACE_DESERT, SPR_CURSOR_DESERT, HT_RECT);
607  this->last_user_action = widget;
608  break;
609 
610  case WID_ETT_PLACE_OBJECT: // Place transmitter button
612  break;
613 
615  case WID_ETT_DECREASE_SIZE: { // Increase/Decrease terraform size
616  int size = (widget == WID_ETT_INCREASE_SIZE) ? 1 : -1;
617  this->HandleButtonClick(widget);
618  size += _terraform_size;
619 
620  if (!IsInsideMM(size, 1, 8 + 1)) return;
621  _terraform_size = size;
622 
623  if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
624  this->SetDirty();
625  break;
626  }
627 
628  case WID_ETT_NEW_SCENARIO: // gen random land
629  this->HandleButtonClick(widget);
631  break;
632 
633  case WID_ETT_RESET_LANDSCAPE: // Reset landscape
634  ShowQuery(STR_QUERY_RESET_LANDSCAPE_CAPTION, STR_RESET_LANDSCAPE_CONFIRMATION_TEXT, NULL, ResetLandscapeConfirmationCallback);
635  break;
636 
637  default: NOT_REACHED();
638  }
639  }
640 
641  virtual void OnTimeout()
642  {
643  for (uint i = WID_ETT_START; i < this->nested_array_size; i++) {
644  if (i == WID_ETT_BUTTONS_START) i = WID_ETT_BUTTONS_END; // skip the buttons
645  if (this->IsWidgetLowered(i)) {
646  this->RaiseWidget(i);
647  this->SetWidgetDirty(i);
648  }
649  }
650  }
651 
652  virtual void OnPlaceObject(Point pt, TileIndex tile)
653  {
654  switch (this->last_user_action) {
655  case WID_ETT_DEMOLISH: // Demolish aka dynamite button
657  break;
658 
659  case WID_ETT_LOWER_LAND: // Lower land button
660  CommonRaiseLowerBigLand(tile, 0);
661  break;
662 
663  case WID_ETT_RAISE_LAND: // Raise land button
664  CommonRaiseLowerBigLand(tile, 1);
665  break;
666 
667  case WID_ETT_LEVEL_LAND: // Level land button
669  break;
670 
671  case WID_ETT_PLACE_ROCKS: // Place rocks button
673  break;
674 
675  case WID_ETT_PLACE_DESERT: // Place desert button (in tropical climate)
677  break;
678 
679  default: NOT_REACHED();
680  }
681  }
682 
683  virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
684  {
685  VpSelectTilesWithMethod(pt.x, pt.y, select_method);
686  }
687 
688  virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
689  {
690  if (pt.x != -1) {
691  switch (select_proc) {
692  default: NOT_REACHED();
693  case DDSP_CREATE_ROCKS:
694  case DDSP_CREATE_DESERT:
697  case DDSP_LEVEL_AREA:
698  case DDSP_DEMOLISH_AREA:
699  GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
700  break;
701  }
702  }
703  }
704 
705  virtual void OnPlaceObjectAbort()
706  {
707  this->RaiseButtons();
708  this->SetDirty();
709  }
710 
711  static HotkeyList hotkeys;
712 };
713 
720 {
721  if (_game_mode != GM_EDITOR) return ES_NOT_HANDLED;
723  if (w == NULL) return ES_NOT_HANDLED;
724  return w->OnHotkey(hotkey);
725 }
726 
727 static Hotkey terraform_editor_hotkeys[] = {
728  Hotkey('D' | WKC_GLOBAL_HOTKEY, "dynamite", WID_ETT_DEMOLISH),
732  Hotkey('R', "rocky", WID_ETT_PLACE_ROCKS),
733  Hotkey('T', "desert", WID_ETT_PLACE_DESERT),
734  Hotkey('O', "object", WID_ETT_PLACE_OBJECT),
735  HOTKEY_LIST_END
736 };
737 
738 HotkeyList ScenarioEditorLandscapeGenerationWindow::hotkeys("terraform_editor", terraform_editor_hotkeys, TerraformToolbarEditorGlobalHotkeys);
739 
740 static WindowDesc _scen_edit_land_gen_desc(
741  WDP_AUTO, "toolbar_landscape_scen", 0, 0,
744  _nested_scen_edit_land_gen_widgets, lengthof(_nested_scen_edit_land_gen_widgets),
745  &ScenarioEditorLandscapeGenerationWindow::hotkeys
746 );
747 
753 {
754  return AllocateWindowDescFront<ScenarioEditorLandscapeGenerationWindow>(&_scen_edit_land_gen_desc, 0);
755 }
EventState
State of handling an event.
Definition: window_type.h:701
Functions related to OTTD&#39;s strings.
static TileType GetTileType(TileIndex tile)
Get the tiletype of a given tile.
Definition: tile_map.h:89
ViewportDragDropSelectionProcess
Drag and drop selection process, or, what to do with an area of land when you&#39;ve selected it...
Definition: viewport_type.h:97
Empty widget, place holder to reserve space in widget array.
Definition: widget_type.h:48
the north corner of the tile is raised
Definition: slope_type.h:55
void ClampToMap()
Clamp the tile area to map borders.
Definition: tilearea.cpp:123
Normal push-button (no toggle button) with image caption.
Definition: widget_type.h:105
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition: settings.cpp:77
Definition of stuff that is very close to a company, like the company struct itself.
Used for iterations.
virtual void OnClick(Point pt, int widget, int click_count)
A click with the left mouse button has been made on the window.
ResizeInfo resize
Resize information.
Definition: window_gui.h:317
Normal tropiczone.
Definition: tile_type.h:72
virtual EventState OnHotkey(int hotkey)
A hotkey has been pressed.
Definition: window.cpp:590
static const CursorID ANIMCURSOR_RAISELAND
696 - 698 - raise land tool
Definition: sprites.h:1469
byte landscape
the landscape we&#39;re currently in
Raise / level area.
Definition: viewport_type.h:99
Tile is desert.
Definition: tile_type.h:73
static const uint MAX_TILE_HEIGHT
Maximum allowed tile height.
Definition: tile_type.h:24
Should the place desert button be shown?
All data for a single hotkey.
Definition: hotkeys.h:24
High level window description.
Definition: window_gui.h:168
static const CursorID ANIMCURSOR_DEMOLISH
704 - 707 - demolish dynamite
Definition: sprites.h:1467
Landscape generation (in Scenario Editor); Window numbers:
Definition: window_type.h:444
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
Update size and resize step of a widget in the window.
Button for removing all company-owned property.
int left
x position of left edge of the window
Definition: window_gui.h:312
void DrawWidgets() const
Paint all widgets of a window.
Definition: widget.cpp:604
static void GenerateRockyArea(TileIndex end, TileIndex start)
Scenario editor command that generates rocky areas.
Hotkey related functions.
virtual void OnPaint()
The window must be repainted.
static bool IsInsideMM(const T x, const uint min, const uint max)
Checks if a value is in an interval.
Definition: math_func.hpp:266
Stacked widgets, widgets all occupying the same space in the window.
Definition: widget_type.h:405
Window * ShowTerraformToolbar(Window *link)
Show the toolbar for terraforming in the game.
void SetWidgetDirty(byte widget_index) const
Invalidate a widget, i.e.
Definition: window.cpp:577
Horizontal container.
Definition: widget_type.h:75
static const CursorID ANIMCURSOR_LOWERLAND
699 - 701 - lower land tool
Definition: sprites.h:1468
The passed event is not handled.
Definition: window_type.h:703
terraform a tile
Definition: command_type.h:188
Lower / level area.
void SetTileSelectSize(int w, int h)
Highlight w by h tiles at the cursor.
Definition: viewport.cpp:2295
static int ScaleGUITrad(int value)
Scale traditional pixel dimensions to GUI zoom level.
Definition: zoom_func.h:82
bool IsInUse() const
Check whether the base station currently is in use; in use means that it is not scheduled for deletio...
Lower the land.
Definition: map_type.h:84
Start of pushable buttons.
void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner)
Change the ownership of all the items of a company.
Definition: economy.cpp:289
static void ResetLandscapeConfirmationCallback(Window *w, bool confirmed)
Callback function for the scenario editor &#39;reset landscape&#39; confirmation window.
Level the land.
Definition: map_type.h:83
virtual void OnTimeout()
Called when this window&#39;s timeout has been reached.
static uint TileX(TileIndex tile)
Get the X component of a tile.
Definition: map_func.h:207
int top
y position of top edge of the window
Definition: window_gui.h:313
demolish a tile
Definition: command_type.h:182
Should the place object button be shown?
Tindex index
Index of this pool item.
Definition: pool_type.hpp:147
Close box (at top-left of a window)
Definition: widget_type.h:69
Place rocks button.
Map accessors for tree tiles.
Functions related to world/map generation.
Stuff related to the text buffer GUI.
Raise land button.
Common return value for all commands.
Definition: command_type.h:25
Functions related to signs.
static T max(const T a, const T b)
Returns the maximum of two values.
Definition: math_func.hpp:26
Raise the land.
Definition: map_type.h:85
void RaiseWidget(byte widget_index)
Marks a widget as raised.
Definition: window_gui.h:478
uint16 w
The width of the area.
Definition: tilearea_type.h:20
int last_user_action
Last started user action.
void CreateNestedTree(bool fill_nested=true)
Perform the first part of the initialization of a nested widget tree.
Definition: window.cpp:1804
static int RoundDivSU(int a, uint b)
Computes round(a / b) for signed a and unsigned b.
Definition: math_func.hpp:338
Functions, definitions and such used only by the GUI.
Buy land button.
CompanyByte _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Definition: company_cmd.cpp:46
company bankrupts, skip money check, skip vehicle on tile check in some cases
Definition: command_type.h:348
Fill area with rocks.
Partial widget specification to allow NWidgets to be written nested.
Definition: widget_type.h:910
Functions related to (drawing on) viewports.
Functions related to NewGRF objects.
bool freeform_edges
allow terraforming the tiles at the map edges
Data structure for an opened window.
Definition: window_gui.h:271
Clear area.
Definition: viewport_type.h:98
bool _ctrl_pressed
Is Ctrl pressed?
Definition: gfx.cpp:36
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
Definition: window.cpp:1820
static NWidgetPart SetPadding(uint8 top, uint8 right, uint8 bottom, uint8 left)
Widget part function for setting additional space around a widget.
Definition: widget_type.h:1046
void InvalidateWindowClassesData(WindowClass cls, int data, bool gui_scope)
Mark window data of all windows of a given class as invalid (in need of re-computing) Note that by de...
Definition: window.cpp:3238
Place sign button.
Invisible widget that takes some space.
Definition: widget_type.h:79
CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags)
Shorthand for calling the long DoCommand with a container.
Definition: command.cpp:436
This window is used for construction; close it whenever changing company.
Definition: window_gui.h:210
bool IsWidgetLowered(byte widget_index) const
Gets the lowered state of a widget.
Definition: window_gui.h:488
SoundSettings sound
sound effect settings
void SetRedErrorSquare(TileIndex tile)
Set a tile to display a red error square.
Definition: viewport.cpp:2277
void ShowQuery(StringID caption, StringID message, Window *parent, QueryCallbackProc *callback)
Show a modal confirmation window with standard &#39;yes&#39; and &#39;no&#39; buttons The window is aligned to the ce...
Definition: misc_gui.cpp:1206
virtual void OnInit()
Notification that the nested widget tree gets initialized.
ViewportPlaceMethod
Viewport place method (type of highlighted area and placed objects)
Definition: viewport_type.h:78
void RaiseButtons(bool autoraise=false)
Raise the buttons of the window.
Definition: window.cpp:553
Point GetToolbarAlignedWindowPosition(int window_width)
Computer the position of the top-left corner of a window to be opened right under the toolbar...
Definition: window.cpp:1708
static NWidgetPart SetDataTip(uint32 data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1014
ClientSettings _settings_client
The current settings for this game.
Definition: settings.cpp:76
static NWidgetPart SetMinimalSize(int16 x, int16 y)
Widget part function for setting the minimal size.
Definition: widget_type.h:947
bool Succeeded() const
Did this command succeed?
Definition: command_type.h:152
#define TILE_AREA_LOOP(var, ta)
A loop which iterates over the tiles of a TileArea.
Definition of base types and functions in a cross-platform compatible way.
Terra form toolbar managing class.
static EventState TerraformToolbarGlobalHotkeys(int hotkey)
Handler for global hotkeys of the TerraformToolbarWindow.
A number of safeguards to prevent using unsafe methods.
List of hotkeys for a window.
Definition: hotkeys.h:42
virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
The user is dragging over the map when the tile highlight mode has been set.
rectangle (stations, depots, ...)
Simple depressed panel.
Definition: widget_type.h:50
static void CommonRaiseLowerBigLand(TileIndex tile, int mode)
Raise/Lower a bigger chunk of land at the same time in the editor.
Demolish aka dynamite button.
Landscape generation window handler in the scenario editor.
uint nested_array_size
Size of the nested array.
Definition: window_gui.h:326
static bool IsBuoyTile(TileIndex t)
Is tile t a buoy tile?
Definition: station_map.h:317
Represents the covered area of e.g.
Definition: tilearea_type.h:18
Window * ShowEditorTerraformToolbar()
Show the toolbar for terraforming in the scenario editor.
Types related to the terraform widgets.
GUI stuff related to terraforming.
static const ObjectType OBJECT_OWNED_LAND
Owned land &#39;flag&#39;.
Definition: object_type.h:21
Lower land button.
static NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx=-1)
Widget part function for starting a new &#39;real&#39; widget.
Definition: widget_type.h:1114
Start of pushable buttons.
bool DoCommandP(const CommandContainer *container, bool my_cmd)
Shortcut for the long DoCommandP when having a container with the data.
Definition: command.cpp:527
void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, ViewportDragDropSelectionProcess process)
highlighting tiles while only going over them with the mouse
Definition: viewport.cpp:2471
#define lengthof(x)
Return the length of an fixed size array.
Definition: depend.cpp:42
void PlaceProc_DemolishArea(TileIndex tile)
Start a drag for demolishing an area.
Level land button.
static T min(const T a, const T b)
Returns the minimum of two values.
Definition: math_func.hpp:42
Display plane with zero size in both directions (none filling and resizing).
Definition: widget_type.h:390
Plant trees button (note: opens separate window, no place-push-button).
Also allow &#39;diagonal rectangles&#39;. Only usable in combination with HT_RECT or HT_POINT.
Functions related to sound.
virtual void OnPlaceObject(Point pt, TileIndex tile)
The user clicked some place on the map when a tile highlight mode has been set.
virtual void OnClick(Point pt, int widget, int click_count)
A click with the left mouse button has been made on the window.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:18
bool GUIPlaceProcDragXY(ViewportDragDropSelectionProcess proc, TileIndex start_tile, TileIndex end_tile)
A central place to handle all X_AND_Y dragged GUI functions.
virtual void OnPlaceObject(Point pt, TileIndex tile)
The user clicked some place on the map when a tile highlight mode has been set.
Invisible widget for rendering the terraform size on.
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method)
Selects tiles while dragging.
Definition: viewport.cpp:2940
static const int WIDGET_LIST_END
indicate the end of widgets&#39; list for vararg functions
Definition: widget_type.h:22
virtual void DrawWidget(const Rect &r, int widget) const
Draw the contents of a nested widget.
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
Definition: window.cpp:959
point (lower land, raise land, level land, ...)
void MarkTileDirtyByTile(TileIndex tile, int bridge_level_offset)
Mark a tile given by its index dirty for repaint.
Definition: viewport.cpp:1904
No window, redirects to WC_MAIN_WINDOW.
Definition: window_type.h:40
void DeleteWindowById(WindowClass cls, WindowNumber number, bool force)
Delete a window by its class and window number (if it is open).
Definition: window.cpp:1137
execute the given command
Definition: command_type.h:342
Fill area with desert.
Functions related to companies.
Tile got trees.
Definition: tile_type.h:47
int last_user_action
Last started user action.
bool _generating_world
Whether we are generating the map or not.
Definition: genworld.cpp:61
Base class for engines.
static void GenerateDesertArea(TileIndex end, TileIndex start)
Scenario editor command that generates desert areas.
area of land in X and Y directions
Definition: viewport_type.h:82
static bool ResetToCurrentNewGRFConfig()
Tries to reset the engine mapping to match the current NewGRF configuration.
Definition: engine.cpp:528
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:61
virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
The user has dragged over the map when the tile highlight mode has been set.
Types related to the landscape.
Level land button.
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:80
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyle mode)
This code is shared for the majority of the pushbuttons.
Definition: main_gui.cpp:103
Functions related to objects.
Map accessors for &#39;clear&#39; tiles.
void ShowCreateScenario()
Show the window to create a scenario.
virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
The user is dragging over the map when the tile highlight mode has been set.
TextDirection _current_text_dir
Text direction of the currently selected language.
Definition: strings.cpp:52
static TreeGround GetTreeGround(TileIndex t)
Returns the groundtype for tree tiles.
Definition: tree_map.h:89
static uint TileY(TileIndex tile)
Get the Y component of a tile.
Definition: map_func.h:217
static void MakeClear(TileIndex t, ClearGround g, uint density)
Make a clear tile.
Definition: clear_map.h:261
Vertical container.
Definition: widget_type.h:77
virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number)
Compute the initial position of the window.
virtual void OnPlaceObjectAbort()
The user cancelled a tile highlight mode that has been set.
TileIndex xy
Base tile of the station.
static NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME, WWT_INSET, or WWT_PANEL).
Definition: widget_type.h:999
Functions related to zooming.
Town view; Window numbers:
Definition: window_type.h:328
static uint MapMaxY()
Gets the maximum Y coordinate within the map, including MP_VOID.
Definition: map_func.h:113
Place object button.
clear an area
Definition: command_type.h:272
bool confirm
Play sound effect on succesful constructions or other actions.
Non-water non-rail construction.
Definition: sound_type.h:70
Functions related to commands.
Coordinates of a point in 2D.
Raise land button.
static EventState TerraformToolbarEditorGlobalHotkeys(int hotkey)
Handler for global hotkeys of the ScenarioEditorLandscapeGenerationWindow.
void SetDisplayedPlane(int plane)
Select which plane to show (for NWID_SELECTION only).
Definition: widget.cpp:1084
Base classes/functions for base stations.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-NULL) Titem.
Definition: pool_type.hpp:235
static uint TileHeight(TileIndex tile)
Returns the height of a tile.
Definition: tile_map.h:31
ConstructionSettings construction
construction of things in-game
Button for generating a new scenario.
static TileIndexDiff TileDiffXY(int x, int y)
Calculates an offset for the given coordinate(-offset).
Definition: map_func.h:181
void HandleButtonClick(byte widget)
Do all things to make a button look clicked and mark it to be unclicked in a few ticks.
Definition: window.cpp:615
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition: widget_type.h:66
int width
width of the window (number of pixels to the right in x direction)
Definition: window_gui.h:314
static NWidgetPart SetFill(uint fill_x, uint fill_y)
Widget part function for setting filling.
Definition: widget_type.h:983
#define CMD_MSG(x)
Used to combine a StringID with the command.
Definition: command_type.h:366
void ShowBuildObjectPicker()
Show our object picker.
Definition: object_gui.cpp:527
int32 WindowNumber
Number to differentiate different windows of the same class.
Definition: window_type.h:695
GameCreationSettings game_creation
settings used during the creation of a game (map)
End of pushable buttons.
Demolish aka dynamite button.
A tile without any structures, i.e. grass, rocks, farm fields etc.
Definition: tile_type.h:43
Specification of a rectangle with absolute coordinates of all edges.
Text is written right-to-left by default.
Definition: strings_type.h:26
static uint MapMaxX()
Gets the maximum X coordinate within the map, including MP_VOID.
Definition: map_func.h:104
WindowNumber window_number
Window number within the window class.
Definition: window_gui.h:307
Downwards arrow button to decrease terraforming size.
Functions related to tile highlights.
Window functions not directly related to making/drawing windows.
Find a place automatically.
Definition: window_gui.h:156
(Toggle) Button with image
Definition: widget_type.h:52
Place desert button (in tropical climate).
Manually align the window (so no automatic location finding)
Definition: window_gui.h:155
Place transmitter button.
Stacked widgets, only one visible at a time (eg in a panel with tabs).
Definition: widget_type.h:80
GUI functions that shouldn&#39;t be here.
Level area.
void PlaceProc_Sign(TileIndex tile)
PlaceProc function, called when someone pressed the button if the sign-tool is selected.
Definition: signs_cmd.cpp:132
uint16 h
The height of the area.
Definition: tilearea_type.h:21
virtual void OnPlaceObjectAbort()
The user cancelled a tile highlight mode that has been set.
Fake keycode bit to indicate global hotkeys.
Definition: gfx_type.h:35
Dimensions (a width and height) of a rectangle in 2D.
bool click_beep
Beep on a random selection of buttons.
Base class for all station-ish types.
Shade box (at top-right of a window, between WWT_DEBUGBOX and WWT_DEFSIZEBOX)
Definition: widget_type.h:64
virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
The user has dragged over the map when the tile highlight mode has been set.
TileIndex _terraform_err_tile
first tile we couldn&#39;t terraform
level land
Definition: command_type.h:296
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
Definition: gfx.cpp:833
An invalid owner.
Definition: company_type.h:31
static void SetTropicZone(TileIndex tile, TropicZone type)
Set the tropic zone.
Definition: tile_map.h:218
int height
Height of the window (number of pixels down in y direction)
Definition: window_gui.h:315
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
Definition: gfx.cpp:1461
(Toggle) Button with text
Definition: widget_type.h:55
build an object
Definition: command_type.h:189
Lower land button.
Upwards arrow button to increase terraforming size.