OpenTTD
terraform_gui.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * 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.
4  * 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.
5  * 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/>.
6  */
7 
10 #include "stdafx.h"
11 #include "clear_map.h"
12 #include "company_func.h"
13 #include "company_base.h"
14 #include "gui.h"
15 #include "window_gui.h"
16 #include "window_func.h"
17 #include "viewport_func.h"
18 #include "command_func.h"
19 #include "signs_func.h"
20 #include "sound_func.h"
21 #include "base_station_base.h"
22 #include "textbuf_gui.h"
23 #include "genworld.h"
24 #include "tree_map.h"
25 #include "landscape_type.h"
26 #include "tilehighlight_func.h"
27 #include "strings_func.h"
28 #include "newgrf_object.h"
29 #include "object.h"
30 #include "hotkeys.h"
31 #include "engine_base.h"
32 #include "terraform_gui.h"
33 #include "zoom_func.h"
34 
36 
37 #include "table/strings.h"
38 
39 #include "safeguards.h"
40 
41 void CcTerraform(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd)
42 {
43  if (result.Succeeded()) {
44  if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, tile);
45  } else {
47  SetRedErrorSquare(_terraform_err_tile);
48  }
49 }
50 
51 
53 static void GenerateDesertArea(TileIndex end, TileIndex start)
54 {
55  if (_game_mode != GM_EDITOR) return;
56 
57  _generating_world = true;
58 
59  TileArea ta(start, end);
60  TILE_AREA_LOOP(tile, ta) {
62  DoCommandP(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
63  MarkTileDirtyByTile(tile);
64  }
65  _generating_world = false;
67 }
68 
70 static void GenerateRockyArea(TileIndex end, TileIndex start)
71 {
72  if (_game_mode != GM_EDITOR) return;
73 
74  bool success = false;
75  TileArea ta(start, end);
76 
77  TILE_AREA_LOOP(tile, ta) {
78  switch (GetTileType(tile)) {
79  case MP_TREES:
80  if (GetTreeGround(tile) == TREE_GROUND_SHORE) continue;
81  FALLTHROUGH;
82 
83  case MP_CLEAR:
84  MakeClear(tile, CLEAR_ROCKS, 3);
85  break;
86 
87  default:
88  continue;
89  }
90  MarkTileDirtyByTile(tile);
91  success = true;
92  }
93 
94  if (success && _settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, end);
95 }
96 
107 {
109  /* When end_tile is MP_VOID, the error tile will not be visible to the
110  * user. This happens when terraforming at the southern border. */
111  if (TileX(end_tile) == MapMaxX()) end_tile += TileDiffXY(-1, 0);
112  if (TileY(end_tile) == MapMaxY()) end_tile += TileDiffXY(0, -1);
113  }
114 
115  switch (proc) {
116  case DDSP_DEMOLISH_AREA:
117  DoCommandP(end_tile, start_tile, _ctrl_pressed ? 1 : 0, CMD_CLEAR_AREA | CMD_MSG(STR_ERROR_CAN_T_CLEAR_THIS_AREA), CcPlaySound_EXPLOSION);
118  break;
120  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);
121  break;
123  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);
124  break;
125  case DDSP_LEVEL_AREA:
126  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);
127  break;
128  case DDSP_CREATE_ROCKS:
129  GenerateRockyArea(end_tile, start_tile);
130  break;
131  case DDSP_CREATE_DESERT:
132  GenerateDesertArea(end_tile, start_tile);
133  break;
134  default:
135  return false;
136  }
137 
138  return true;
139 }
140 
146 {
148 }
149 
153 
155  {
156  /* This is needed as we like to have the tree available on OnInit. */
157  this->CreateNestedTree();
158  this->FinishInitNested(window_number);
159  this->last_user_action = WIDGET_LIST_END;
160  }
161 
163  {
164  }
165 
166  void OnInit() override
167  {
168  /* Don't show the place object button when there are no objects to place. */
169  NWidgetStacked *show_object = this->GetWidget<NWidgetStacked>(WID_TT_SHOW_PLACE_OBJECT);
170  show_object->SetDisplayedPlane(ObjectClass::GetUIClassCount() != 0 ? 0 : SZSP_NONE);
171  }
172 
173  void OnClick(Point pt, int widget, int click_count) override
174  {
175  if (widget < WID_TT_BUTTONS_START) return;
176 
177  switch (widget) {
178  case WID_TT_LOWER_LAND: // Lower land button
180  this->last_user_action = widget;
181  break;
182 
183  case WID_TT_RAISE_LAND: // Raise land button
185  this->last_user_action = widget;
186  break;
187 
188  case WID_TT_LEVEL_LAND: // Level land button
189  HandlePlacePushButton(this, WID_TT_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, HT_POINT | HT_DIAGONAL);
190  this->last_user_action = widget;
191  break;
192 
193  case WID_TT_DEMOLISH: // Demolish aka dynamite button
195  this->last_user_action = widget;
196  break;
197 
198  case WID_TT_BUY_LAND: // Buy land button
199  HandlePlacePushButton(this, WID_TT_BUY_LAND, SPR_CURSOR_BUY_LAND, HT_RECT);
200  this->last_user_action = widget;
201  break;
202 
203  case WID_TT_PLANT_TREES: // Plant trees button
204  ShowBuildTreesToolbar();
205  break;
206 
207  case WID_TT_PLACE_SIGN: // Place sign button
208  HandlePlacePushButton(this, WID_TT_PLACE_SIGN, SPR_CURSOR_SIGN, HT_RECT);
209  this->last_user_action = widget;
210  break;
211 
212  case WID_TT_PLACE_OBJECT: // Place object button
214  break;
215 
216  default: NOT_REACHED();
217  }
218  }
219 
220  void OnPlaceObject(Point pt, TileIndex tile) override
221  {
222  switch (this->last_user_action) {
223  case WID_TT_LOWER_LAND: // Lower land button
225  break;
226 
227  case WID_TT_RAISE_LAND: // Raise land button
229  break;
230 
231  case WID_TT_LEVEL_LAND: // Level land button
233  break;
234 
235  case WID_TT_DEMOLISH: // Demolish aka dynamite button
237  break;
238 
239  case WID_TT_BUY_LAND: // Buy land button
240  DoCommandP(tile, OBJECT_OWNED_LAND, 0, CMD_BUILD_OBJECT | CMD_MSG(STR_ERROR_CAN_T_PURCHASE_THIS_LAND), CcPlaySound_SPLAT_RAIL);
241  break;
242 
243  case WID_TT_PLACE_SIGN: // Place sign button
244  PlaceProc_Sign(tile);
245  break;
246 
247  default: NOT_REACHED();
248  }
249  }
250 
251  void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override
252  {
253  VpSelectTilesWithMethod(pt.x, pt.y, select_method);
254  }
255 
256  Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) override
257  {
258  Point pt = GetToolbarAlignedWindowPosition(sm_width);
259  pt.y += sm_height;
260  return pt;
261  }
262 
263  void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override
264  {
265  if (pt.x != -1) {
266  switch (select_proc) {
267  default: NOT_REACHED();
268  case DDSP_DEMOLISH_AREA:
271  case DDSP_LEVEL_AREA:
272  GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
273  break;
274  }
275  }
276  }
277 
278  void OnPlaceObjectAbort() override
279  {
280  this->RaiseButtons();
281  }
282 
283  static HotkeyList hotkeys;
284 };
285 
292 {
293  if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED;
294  Window *w = ShowTerraformToolbar(nullptr);
295  if (w == nullptr) return ES_NOT_HANDLED;
296  return w->OnHotkey(hotkey);
297 }
298 
299 static Hotkey terraform_hotkeys[] = {
300  Hotkey('Q' | WKC_GLOBAL_HOTKEY, "lower", WID_TT_LOWER_LAND),
301  Hotkey('W' | WKC_GLOBAL_HOTKEY, "raise", WID_TT_RAISE_LAND),
302  Hotkey('E' | WKC_GLOBAL_HOTKEY, "level", WID_TT_LEVEL_LAND),
303  Hotkey('D' | WKC_GLOBAL_HOTKEY, "dynamite", WID_TT_DEMOLISH),
304  Hotkey('U', "buyland", WID_TT_BUY_LAND),
305  Hotkey('I', "trees", WID_TT_PLANT_TREES),
306  Hotkey('O', "placesign", WID_TT_PLACE_SIGN),
307  Hotkey('P', "placeobject", WID_TT_PLACE_OBJECT),
308  HOTKEY_LIST_END
309 };
310 HotkeyList TerraformToolbarWindow::hotkeys("terraform", terraform_hotkeys, TerraformToolbarGlobalHotkeys);
311 
312 static const NWidgetPart _nested_terraform_widgets[] = {
314  NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
315  NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_LANDSCAPING_TOOLBAR, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
316  NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
317  EndContainer(),
319  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_LOWER_LAND), SetMinimalSize(22, 22),
320  SetFill(0, 1), SetDataTip(SPR_IMG_TERRAFORM_DOWN, STR_LANDSCAPING_TOOLTIP_LOWER_A_CORNER_OF_LAND),
321  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_RAISE_LAND), SetMinimalSize(22, 22),
322  SetFill(0, 1), SetDataTip(SPR_IMG_TERRAFORM_UP, STR_LANDSCAPING_TOOLTIP_RAISE_A_CORNER_OF_LAND),
323  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_LEVEL_LAND), SetMinimalSize(22, 22),
324  SetFill(0, 1), SetDataTip(SPR_IMG_LEVEL_LAND, STR_LANDSCAPING_LEVEL_LAND_TOOLTIP),
325 
326  NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(4, 22), EndContainer(),
327 
328  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_DEMOLISH), SetMinimalSize(22, 22),
329  SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
330  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_BUY_LAND), SetMinimalSize(22, 22),
331  SetFill(0, 1), SetDataTip(SPR_IMG_BUY_LAND, STR_LANDSCAPING_TOOLTIP_PURCHASE_LAND),
332  NWidget(WWT_PUSHIMGBTN, COLOUR_DARK_GREEN, WID_TT_PLANT_TREES), SetMinimalSize(22, 22),
333  SetFill(0, 1), SetDataTip(SPR_IMG_PLANTTREES, STR_SCENEDIT_TOOLBAR_PLANT_TREES),
334  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_PLACE_SIGN), SetMinimalSize(22, 22),
335  SetFill(0, 1), SetDataTip(SPR_IMG_SIGN, STR_SCENEDIT_TOOLBAR_PLACE_SIGN),
337  NWidget(WWT_PUSHIMGBTN, COLOUR_DARK_GREEN, WID_TT_PLACE_OBJECT), SetMinimalSize(22, 22),
338  SetFill(0, 1), SetDataTip(SPR_IMG_TRANSMITTER, STR_SCENEDIT_TOOLBAR_PLACE_OBJECT),
339  EndContainer(),
340  EndContainer(),
341 };
342 
343 static WindowDesc _terraform_desc(
344  WDP_MANUAL, "toolbar_landscape", 0, 0,
347  _nested_terraform_widgets, lengthof(_nested_terraform_widgets),
348  &TerraformToolbarWindow::hotkeys
349 );
350 
357 {
358  if (!Company::IsValidID(_local_company)) return nullptr;
359 
360  Window *w;
361  if (link == nullptr) {
362  w = AllocateWindowDescFront<TerraformToolbarWindow>(&_terraform_desc, 0);
363  return w;
364  }
365 
366  /* Delete the terraform toolbar to place it again. */
368  w = AllocateWindowDescFront<TerraformToolbarWindow>(&_terraform_desc, 0);
369  /* Align the terraform toolbar under the main toolbar. */
370  w->top -= w->height;
371  w->SetDirty();
372  /* Put the linked toolbar to the left / right of it. */
373  link->left = w->left + (_current_text_dir == TD_RTL ? w->width : -link->width);
374  link->top = w->top;
375  link->SetDirty();
376 
377  return w;
378 }
379 
380 static byte _terraform_size = 1;
381 
391 static void CommonRaiseLowerBigLand(TileIndex tile, int mode)
392 {
393  if (_terraform_size == 1) {
394  StringID msg =
395  mode ? STR_ERROR_CAN_T_RAISE_LAND_HERE : STR_ERROR_CAN_T_LOWER_LAND_HERE;
396 
397  DoCommandP(tile, SLOPE_N, (uint32)mode, CMD_TERRAFORM_LAND | CMD_MSG(msg), CcTerraform);
398  } else {
399  assert(_terraform_size != 0);
400  TileArea ta(tile, _terraform_size, _terraform_size);
401  ta.ClampToMap();
402 
403  if (ta.w == 0 || ta.h == 0) return;
404 
405  if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, tile);
406 
407  uint h;
408  if (mode != 0) {
409  /* Raise land */
410  h = MAX_TILE_HEIGHT;
411  TILE_AREA_LOOP(tile2, ta) {
412  h = min(h, TileHeight(tile2));
413  }
414  } else {
415  /* Lower land */
416  h = 0;
417  TILE_AREA_LOOP(tile2, ta) {
418  h = max(h, TileHeight(tile2));
419  }
420  }
421 
422  TILE_AREA_LOOP(tile2, ta) {
423  if (TileHeight(tile2) == h) {
424  DoCommandP(tile2, SLOPE_N, (uint32)mode, CMD_TERRAFORM_LAND);
425  }
426  }
427  }
428 }
429 
430 static const int8 _multi_terraform_coords[][2] = {
431  { 0, -2},
432  { 4, 0}, { -4, 0}, { 0, 2},
433  { -8, 2}, { -4, 4}, { 0, 6}, { 4, 4}, { 8, 2},
434  {-12, 0}, { -8, -2}, { -4, -4}, { 0, -6}, { 4, -4}, { 8, -2}, { 12, 0},
435  {-16, 2}, {-12, 4}, { -8, 6}, { -4, 8}, { 0, 10}, { 4, 8}, { 8, 6}, { 12, 4}, { 16, 2},
436  {-20, 0}, {-16, -2}, {-12, -4}, { -8, -6}, { -4, -8}, { 0,-10}, { 4, -8}, { 8, -6}, { 12, -4}, { 16, -2}, { 20, 0},
437  {-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},
438  {-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},
439 };
440 
441 static const NWidgetPart _nested_scen_edit_land_gen_widgets[] = {
443  NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
444  NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_TERRAFORM_TOOLBAR_LAND_GENERATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
445  NWidget(WWT_SHADEBOX, COLOUR_DARK_GREEN),
446  NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
447  EndContainer(),
448  NWidget(WWT_PANEL, COLOUR_DARK_GREEN),
449  NWidget(NWID_HORIZONTAL), SetPadding(2, 2, 7, 2),
450  NWidget(NWID_SPACER), SetFill(1, 0),
451  NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_DEMOLISH), SetMinimalSize(22, 22),
452  SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
453  NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_LOWER_LAND), SetMinimalSize(22, 22),
454  SetFill(0, 1), SetDataTip(SPR_IMG_TERRAFORM_DOWN, STR_LANDSCAPING_TOOLTIP_LOWER_A_CORNER_OF_LAND),
455  NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_RAISE_LAND), SetMinimalSize(22, 22),
456  SetFill(0, 1), SetDataTip(SPR_IMG_TERRAFORM_UP, STR_LANDSCAPING_TOOLTIP_RAISE_A_CORNER_OF_LAND),
457  NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_LEVEL_LAND), SetMinimalSize(22, 22),
458  SetFill(0, 1), SetDataTip(SPR_IMG_LEVEL_LAND, STR_LANDSCAPING_LEVEL_LAND_TOOLTIP),
459  NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_PLACE_ROCKS), SetMinimalSize(22, 22),
460  SetFill(0, 1), SetDataTip(SPR_IMG_ROCKS, STR_TERRAFORM_TOOLTIP_PLACE_ROCKY_AREAS_ON_LANDSCAPE),
462  NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_PLACE_DESERT), SetMinimalSize(22, 22),
463  SetFill(0, 1), SetDataTip(SPR_IMG_DESERT, STR_TERRAFORM_TOOLTIP_DEFINE_DESERT_AREA),
464  EndContainer(),
466  SetFill(0, 1), SetDataTip(SPR_IMG_TRANSMITTER, STR_SCENEDIT_TOOLBAR_PLACE_OBJECT),
467  NWidget(NWID_SPACER), SetFill(1, 0),
468  EndContainer(),
470  NWidget(NWID_SPACER), SetFill(1, 0),
471  NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_ETT_DOTS), SetMinimalSize(59, 31), SetDataTip(STR_EMPTY, STR_NULL),
472  NWidget(NWID_SPACER), SetFill(1, 0),
474  NWidget(NWID_SPACER), SetFill(0, 1),
475  NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_INCREASE_SIZE), SetMinimalSize(12, 12), SetDataTip(SPR_ARROW_UP, STR_TERRAFORM_TOOLTIP_INCREASE_SIZE_OF_LAND_AREA),
477  NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_DECREASE_SIZE), SetMinimalSize(12, 12), SetDataTip(SPR_ARROW_DOWN, STR_TERRAFORM_TOOLTIP_DECREASE_SIZE_OF_LAND_AREA),
478  NWidget(NWID_SPACER), SetFill(0, 1),
479  EndContainer(),
481  EndContainer(),
483  NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_ETT_NEW_SCENARIO), SetMinimalSize(160, 12),
484  SetFill(1, 0), SetDataTip(STR_TERRAFORM_SE_NEW_WORLD, STR_TERRAFORM_TOOLTIP_GENERATE_RANDOM_LAND), SetPadding(0, 2, 0, 2),
486  SetFill(1, 0), SetDataTip(STR_TERRAFORM_RESET_LANDSCAPE, STR_TERRAFORM_RESET_LANDSCAPE_TOOLTIP), SetPadding(1, 2, 2, 2),
487  EndContainer(),
488 };
489 
495 static void ResetLandscapeConfirmationCallback(Window *w, bool confirmed)
496 {
497  if (confirmed) {
498  /* Set generating_world to true to get instant-green grass after removing
499  * company property. */
500  _generating_world = true;
501 
502  /* Delete all companies */
503  for (Company *c : Company::Iterate()) {
505  delete c;
506  }
507 
508  _generating_world = false;
509 
510  /* Delete all station signs */
511  for (BaseStation *st : BaseStation::Iterate()) {
512  /* There can be buoys, remove them */
513  if (IsBuoyTile(st->xy)) DoCommand(st->xy, 0, 0, DC_EXEC | DC_BANKRUPT, CMD_LANDSCAPE_CLEAR);
514  if (!st->IsInUse()) delete st;
515  }
516 
517  /* Now that all vehicles are gone, we can reset the engine pool. Maybe it reduces some NewGRF changing-mess */
519 
521  }
522 }
523 
527 
529  {
530  this->CreateNestedTree();
531  NWidgetStacked *show_desert = this->GetWidget<NWidgetStacked>(WID_ETT_SHOW_PLACE_DESERT);
532  show_desert->SetDisplayedPlane(_settings_game.game_creation.landscape == LT_TROPIC ? 0 : SZSP_NONE);
533  this->FinishInitNested(window_number);
534  this->last_user_action = WIDGET_LIST_END;
535  }
536 
537  void OnPaint() override
538  {
539  this->DrawWidgets();
540 
541  if (this->IsWidgetLowered(WID_ETT_LOWER_LAND) || this->IsWidgetLowered(WID_ETT_RAISE_LAND)) { // change area-size if raise/lower corner is selected
542  SetTileSelectSize(_terraform_size, _terraform_size);
543  }
544  }
545 
546  void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
547  {
548  if (widget != WID_ETT_DOTS) return;
549 
550  size->width = max<uint>(size->width, ScaleGUITrad(59));
551  size->height = max<uint>(size->height, ScaleGUITrad(31));
552  }
553 
554  void DrawWidget(const Rect &r, int widget) const override
555  {
556  if (widget != WID_ETT_DOTS) return;
557 
558  int center_x = RoundDivSU(r.left + r.right, 2);
559  int center_y = RoundDivSU(r.top + r.bottom, 2);
560 
561  int n = _terraform_size * _terraform_size;
562  const int8 *coords = &_multi_terraform_coords[0][0];
563 
564  assert(n != 0);
565  do {
566  DrawSprite(SPR_WHITE_POINT, PAL_NONE, center_x + ScaleGUITrad(coords[0]), center_y + ScaleGUITrad(coords[1]));
567  coords += 2;
568  } while (--n);
569  }
570 
571  void OnClick(Point pt, int widget, int click_count) override
572  {
573  if (widget < WID_ETT_BUTTONS_START) return;
574 
575  switch (widget) {
576  case WID_ETT_DEMOLISH: // Demolish aka dynamite button
578  this->last_user_action = widget;
579  break;
580 
581  case WID_ETT_LOWER_LAND: // Lower land button
583  this->last_user_action = widget;
584  break;
585 
586  case WID_ETT_RAISE_LAND: // Raise land button
588  this->last_user_action = widget;
589  break;
590 
591  case WID_ETT_LEVEL_LAND: // Level land button
592  HandlePlacePushButton(this, WID_ETT_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, HT_POINT | HT_DIAGONAL);
593  this->last_user_action = widget;
594  break;
595 
596  case WID_ETT_PLACE_ROCKS: // Place rocks button
597  HandlePlacePushButton(this, WID_ETT_PLACE_ROCKS, SPR_CURSOR_ROCKY_AREA, HT_RECT);
598  this->last_user_action = widget;
599  break;
600 
601  case WID_ETT_PLACE_DESERT: // Place desert button (in tropical climate)
602  HandlePlacePushButton(this, WID_ETT_PLACE_DESERT, SPR_CURSOR_DESERT, HT_RECT);
603  this->last_user_action = widget;
604  break;
605 
606  case WID_ETT_PLACE_OBJECT: // Place transmitter button
608  break;
609 
611  case WID_ETT_DECREASE_SIZE: { // Increase/Decrease terraform size
612  int size = (widget == WID_ETT_INCREASE_SIZE) ? 1 : -1;
613  this->HandleButtonClick(widget);
614  size += _terraform_size;
615 
616  if (!IsInsideMM(size, 1, 8 + 1)) return;
617  _terraform_size = size;
618 
619  if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
620  this->SetDirty();
621  break;
622  }
623 
624  case WID_ETT_NEW_SCENARIO: // gen random land
625  this->HandleButtonClick(widget);
627  break;
628 
629  case WID_ETT_RESET_LANDSCAPE: // Reset landscape
630  ShowQuery(STR_QUERY_RESET_LANDSCAPE_CAPTION, STR_RESET_LANDSCAPE_CONFIRMATION_TEXT, nullptr, ResetLandscapeConfirmationCallback);
631  break;
632 
633  default: NOT_REACHED();
634  }
635  }
636 
637  void OnTimeout() override
638  {
639  for (uint i = WID_ETT_START; i < this->nested_array_size; i++) {
640  if (i == WID_ETT_BUTTONS_START) i = WID_ETT_BUTTONS_END; // skip the buttons
641  if (this->IsWidgetLowered(i)) {
642  this->RaiseWidget(i);
643  this->SetWidgetDirty(i);
644  }
645  }
646  }
647 
648  void OnPlaceObject(Point pt, TileIndex tile) override
649  {
650  switch (this->last_user_action) {
651  case WID_ETT_DEMOLISH: // Demolish aka dynamite button
653  break;
654 
655  case WID_ETT_LOWER_LAND: // Lower land button
656  CommonRaiseLowerBigLand(tile, 0);
657  break;
658 
659  case WID_ETT_RAISE_LAND: // Raise land button
660  CommonRaiseLowerBigLand(tile, 1);
661  break;
662 
663  case WID_ETT_LEVEL_LAND: // Level land button
665  break;
666 
667  case WID_ETT_PLACE_ROCKS: // Place rocks button
669  break;
670 
671  case WID_ETT_PLACE_DESERT: // Place desert button (in tropical climate)
673  break;
674 
675  default: NOT_REACHED();
676  }
677  }
678 
679  void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override
680  {
681  VpSelectTilesWithMethod(pt.x, pt.y, select_method);
682  }
683 
684  void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override
685  {
686  if (pt.x != -1) {
687  switch (select_proc) {
688  default: NOT_REACHED();
689  case DDSP_CREATE_ROCKS:
690  case DDSP_CREATE_DESERT:
693  case DDSP_LEVEL_AREA:
694  case DDSP_DEMOLISH_AREA:
695  GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
696  break;
697  }
698  }
699  }
700 
701  void OnPlaceObjectAbort() override
702  {
703  this->RaiseButtons();
704  this->SetDirty();
705  }
706 
707  static HotkeyList hotkeys;
708 };
709 
716 {
717  if (_game_mode != GM_EDITOR) return ES_NOT_HANDLED;
719  if (w == nullptr) return ES_NOT_HANDLED;
720  return w->OnHotkey(hotkey);
721 }
722 
723 static Hotkey terraform_editor_hotkeys[] = {
724  Hotkey('D' | WKC_GLOBAL_HOTKEY, "dynamite", WID_ETT_DEMOLISH),
728  Hotkey('R', "rocky", WID_ETT_PLACE_ROCKS),
729  Hotkey('T', "desert", WID_ETT_PLACE_DESERT),
730  Hotkey('O', "object", WID_ETT_PLACE_OBJECT),
731  HOTKEY_LIST_END
732 };
733 
734 HotkeyList ScenarioEditorLandscapeGenerationWindow::hotkeys("terraform_editor", terraform_editor_hotkeys, TerraformToolbarEditorGlobalHotkeys);
735 
736 static WindowDesc _scen_edit_land_gen_desc(
737  WDP_AUTO, "toolbar_landscape_scen", 0, 0,
740  _nested_scen_edit_land_gen_widgets, lengthof(_nested_scen_edit_land_gen_widgets),
741  &ScenarioEditorLandscapeGenerationWindow::hotkeys
742 );
743 
749 {
750  return AllocateWindowDescFront<ScenarioEditorLandscapeGenerationWindow>(&_scen_edit_land_gen_desc, 0);
751 }
EventState
State of handling an event.
Definition: window_type.h:711
Functions related to OTTD&#39;s strings.
static TileType GetTileType(TileIndex tile)
Get the tiletype of a given tile.
Definition: tile_map.h:96
ViewportDragDropSelectionProcess
Drag and drop selection process, or, what to do with an area of land when you&#39;ve selected it...
Empty widget, place holder to reserve space in widget array.
Definition: widget_type.h:46
the north corner of the tile is raised
Definition: slope_type.h:53
void ClampToMap()
Clamp the tile area to map borders.
Definition: tilearea.cpp:142
Normal push-button (no toggle button) with image caption.
Definition: widget_type.h:103
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition: settings.cpp:79
Definition of stuff that is very close to a company, like the company struct itself.
Used for iterations.
ResizeInfo resize
Resize information.
Definition: window_gui.h:322
Normal tropiczone.
Definition: tile_type.h:70
virtual EventState OnHotkey(int hotkey)
A hotkey has been pressed.
Definition: window.cpp:610
static const CursorID ANIMCURSOR_RAISELAND
696 - 698 - raise land tool
Definition: sprites.h:1487
byte landscape
the landscape we&#39;re currently in
Raise / level area.
Tile is desert.
Definition: tile_type.h:71
static const uint MAX_TILE_HEIGHT
Maximum allowed tile height.
Definition: tile_type.h:22
Should the place desert button be shown?
All data for a single hotkey.
Definition: hotkeys.h:22
High level window description.
Definition: window_gui.h:166
An invalid owner.
Definition: company_type.h:29
static const CursorID ANIMCURSOR_DEMOLISH
704 - 707 - demolish dynamite
Definition: sprites.h:1485
Landscape generation (in Scenario Editor); Window numbers:
Definition: window_type.h:442
Button for removing all company-owned property.
int left
x position of left edge of the window
Definition: window_gui.h:317
void DrawWidgets() const
Paint all widgets of a window.
Definition: widget.cpp:602
static void GenerateRockyArea(TileIndex end, TileIndex start)
Scenario editor command that generates rocky areas.
Hotkey related functions.
Stacked widgets, widgets all occupying the same space in the window.
Definition: widget_type.h:403
void OnInit() override
Notification that the nested widget tree gets initialized.
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:597
void OnTimeout() override
Called when this window&#39;s timeout has been reached.
Horizontal container.
Definition: widget_type.h:73
static const CursorID ANIMCURSOR_LOWERLAND
699 - 701 - lower land tool
Definition: sprites.h:1486
The passed event is not handled.
Definition: window_type.h:713
terraform a tile
Definition: command_type.h:186
Lower / level area.
void SetTileSelectSize(int w, int h)
Highlight w by h tiles at the cursor.
Definition: viewport.cpp:2423
void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override
The user has dragged over the map when the tile highlight mode has been set.
static int ScaleGUITrad(int value)
Scale traditional pixel dimensions to GUI zoom level.
Definition: zoom_func.h:76
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
Update size and resize step of a widget in the window.
Lower the land.
Definition: map_type.h:83
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:282
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:82
static uint TileX(TileIndex tile)
Get the X component of a tile.
Definition: map_func.h:205
int top
y position of top edge of the window
Definition: window_gui.h:318
demolish a tile
Definition: command_type.h:180
Should the place object button be shown?
Close box (at top-left of a window)
Definition: widget_type.h:67
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:23
Functions related to signs.
static T max(const T a, const T b)
Returns the maximum of two values.
Definition: math_func.hpp:24
Raise the land.
Definition: map_type.h:84
void RaiseWidget(byte widget_index)
Marks a widget as raised.
Definition: window_gui.h:483
uint16 w
The width of the area.
Definition: tilearea_type.h:18
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:1828
static int RoundDivSU(int a, uint b)
Computes round(a / b) for signed a and unsigned b.
Definition: math_func.hpp:336
Functions, definitions and such used only by the GUI.
void OnPlaceObject(Point pt, TileIndex tile) override
The user clicked some place on the map when a tile highlight mode has been set.
Buy land button.
company bankrupts, skip money check, skip vehicle on tile check in some cases
Definition: command_type.h:350
Fill area with rocks.
Partial widget specification to allow NWidgets to be written nested.
Definition: widget_type.h:908
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:276
bool _ctrl_pressed
Is Ctrl pressed?
Definition: gfx.cpp:35
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
Definition: window.cpp:1844
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:1044
static bool IsInsideMM(const T x, const size_t min, const size_t max)
Checks if a value is in an interval.
Definition: math_func.hpp:264
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:3334
void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override
The user is dragging over the map when the tile highlight mode has been set.
Place sign button.
Invisible widget that takes some space.
Definition: widget_type.h:77
CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags)
Shorthand for calling the long DoCommand with a container.
Definition: command.cpp:441
This window is used for construction; close it whenever changing company.
Definition: window_gui.h:208
bool IsWidgetLowered(byte widget_index) const
Gets the lowered state of a widget.
Definition: window_gui.h:493
SoundSettings sound
sound effect settings
void SetRedErrorSquare(TileIndex tile)
Set a tile to display a red error square.
Definition: viewport.cpp:2405
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:1260
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
ViewportPlaceMethod
Viewport place method (type of highlighted area and placed objects)
Definition: viewport_type.h:96
void RaiseButtons(bool autoraise=false)
Raise the buttons of the window.
Definition: window.cpp:573
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:1732
static NWidgetPart SetDataTip(uint32 data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1012
ClientSettings _settings_client
The current settings for this game.
Definition: settings.cpp:78
static NWidgetPart SetMinimalSize(int16 x, int16 y)
Widget part function for setting the minimal size.
Definition: widget_type.h:945
bool Succeeded() const
Did this command succeed?
Definition: command_type.h:150
#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:40
rectangle (stations, depots, ...)
Simple depressed panel.
Definition: widget_type.h:48
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
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:331
static bool IsBuoyTile(TileIndex t)
Is tile t a buoy tile?
Definition: station_map.h:316
Represents the covered area of e.g.
Definition: tilearea_type.h:16
Window * ShowEditorTerraformToolbar()
Show the toolbar for terraforming in the scenario editor.
Types related to the terraform widgets.
GUI stuff related to terraforming.
void OnPlaceObjectAbort() override
The user cancelled a tile highlight mode that has been set.
static const ObjectType OBJECT_OWNED_LAND
Owned land &#39;flag&#39;.
Definition: object_type.h:19
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:1112
void OnPaint() override
The window must be repainted.
void MarkTileDirtyByTile(TileIndex tile, int bridge_level_offset, int tile_height_override)
Mark a tile given by its index dirty for repaint.
Definition: viewport.cpp:1938
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:532
void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, ViewportDragDropSelectionProcess process)
highlighting tiles while only going over them with the mouse
Definition: viewport.cpp:2605
#define lengthof(x)
Return the length of an fixed size array.
Definition: depend.cpp:40
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:40
Display plane with zero size in both directions (none filling and resizing).
Definition: widget_type.h:388
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.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:16
bool GUIPlaceProcDragXY(ViewportDragDropSelectionProcess proc, TileIndex start_tile, TileIndex end_tile)
A central place to handle all X_AND_Y dragged GUI functions.
Invisible widget for rendering the terraform size on.
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method)
Selects tiles while dragging.
Definition: viewport.cpp:3078
static const int WIDGET_LIST_END
indicate the end of widgets&#39; list for vararg functions
Definition: widget_type.h:20
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
Definition: window.cpp:984
point (lower land, raise land, level land, ...)
No window, redirects to WC_MAIN_WINDOW.
Definition: window_type.h:38
void DeleteWindowById(WindowClass cls, WindowNumber number, bool force)
Delete a window by its class and window number (if it is open).
Definition: window.cpp:1162
execute the given command
Definition: command_type.h:344
Fill area with desert.
Functions related to companies.
Tile got trees.
Definition: tile_type.h:45
int last_user_action
Last started user action.
bool _generating_world
Whether we are generating the map or not.
Definition: genworld.cpp:60
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
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
Definition: pool_type.hpp:340
static bool ResetToCurrentNewGRFConfig()
Tries to reset the engine mapping to match the current NewGRF configuration.
Definition: engine.cpp:527
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:59
void OnPlaceObjectAbort() override
The user cancelled a tile highlight mode that has been set.
Types related to the landscape.
Level land button.
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:78
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyle mode)
This code is shared for the majority of the pushbuttons.
Definition: main_gui.cpp:98
Functions related to objects.
Map accessors for &#39;clear&#39; tiles.
void ShowCreateScenario()
Show the window to create a scenario.
TextDirection _current_text_dir
Text direction of the currently selected language.
Definition: strings.cpp:48
static TreeGround GetTreeGround(TileIndex t)
Returns the groundtype for tree tiles.
Definition: tree_map.h:88
static uint TileY(TileIndex tile)
Get the Y component of a tile.
Definition: map_func.h:215
static void MakeClear(TileIndex t, ClearGround g, uint density)
Make a clear tile.
Definition: clear_map.h:259
Vertical container.
Definition: widget_type.h:75
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:997
void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override
The user is dragging over the map when the tile highlight mode has been set.
Functions related to zooming.
Town view; Window numbers:
Definition: window_type.h:326
static uint MapMaxY()
Gets the maximum Y coordinate within the map, including MP_VOID.
Definition: map_func.h:111
void OnPlaceObject(Point pt, TileIndex tile) override
The user clicked some place on the map when a tile highlight mode has been set.
Place object button.
clear an area
Definition: command_type.h:271
bool confirm
Play sound effect on successful constructions or other actions.
Non-water non-rail construction.
Definition: sound_type.h:68
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:1082
Base classes/functions for base stations.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
Definition: pool_type.hpp:280
static uint TileHeight(TileIndex tile)
Returns the height of a tile.
Definition: tile_map.h:29
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:179
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:635
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition: widget_type.h:64
int width
width of the window (number of pixels to the right in x direction)
Definition: window_gui.h:319
static NWidgetPart SetFill(uint fill_x, uint fill_y)
Widget part function for setting filling.
Definition: widget_type.h:981
#define CMD_MSG(x)
Used to combine a StringID with the command.
Definition: command_type.h:368
void ShowBuildObjectPicker()
Show our object picker.
Definition: object_gui.cpp:522
int32 WindowNumber
Number to differentiate different windows of the same class.
Definition: window_type.h:705
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:41
Specification of a rectangle with absolute coordinates of all edges.
Text is written right-to-left by default.
Definition: strings_type.h:24
static uint MapMaxX()
Gets the maximum X coordinate within the map, including MP_VOID.
Definition: map_func.h:102
WindowNumber window_number
Window number within the window class.
Definition: window_gui.h:312
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:154
(Toggle) Button with image
Definition: widget_type.h:50
Place desert button (in tropical climate).
Manually align the window (so no automatic location finding)
Definition: window_gui.h:153
Place transmitter button.
Stacked widgets, only one visible at a time (eg in a panel with tabs).
Definition: widget_type.h:78
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:133
void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override
The user has dragged over the map when the tile highlight mode has been set.
uint16 h
The height of the area.
Definition: tilearea_type.h:19
Fake keycode bit to indicate global hotkeys.
Definition: gfx_type.h:33
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Definition: company_cmd.cpp:44
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
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:62
TileIndex _terraform_err_tile
first tile we couldn&#39;t terraform
level land
Definition: command_type.h:297
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:835
static void SetTropicZone(TileIndex tile, TropicZone type)
Set the tropic zone.
Definition: tile_map.h:225
int height
Height of the window (number of pixels down in y direction)
Definition: window_gui.h:320
Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) override
Compute the initial position of the window.
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
Definition: gfx.cpp:1462
(Toggle) Button with text
Definition: widget_type.h:53
build an object
Definition: command_type.h:187
Lower land button.
Upwards arrow button to increase terraforming size.