OpenTTD Source 20241224-master-gf74b0cf984
|
GUI related to terraforming the map. More...
#include "stdafx.h"
#include "core/backup_type.hpp"
#include "clear_map.h"
#include "company_func.h"
#include "company_base.h"
#include "house.h"
#include "gui.h"
#include "window_gui.h"
#include "window_func.h"
#include "viewport_func.h"
#include "command_func.h"
#include "signs_func.h"
#include "sound_func.h"
#include "base_station_base.h"
#include "textbuf_gui.h"
#include "genworld.h"
#include "tree_map.h"
#include "landscape_type.h"
#include "tilehighlight_func.h"
#include "strings_func.h"
#include "newgrf_object.h"
#include "object.h"
#include "hotkeys.h"
#include "engine_base.h"
#include "terraform_gui.h"
#include "terraform_cmd.h"
#include "zoom_func.h"
#include "rail_cmd.h"
#include "landscape_cmd.h"
#include "object_cmd.h"
#include "widgets/terraform_widget.h"
#include "table/strings.h"
#include "safeguards.h"
Go to the source code of this file.
Data Structures | |
struct | TerraformToolbarWindow |
Terra form toolbar managing class. More... | |
struct | ScenarioEditorLandscapeGenerationWindow |
Landscape generation window handler in the scenario editor. More... | |
Functions | |
void | CcTerraform (Commands, const CommandCost &result, Money, TileIndex tile) |
static void | GenerateDesertArea (TileIndex end, TileIndex start) |
Scenario editor command that generates desert areas. | |
static void | GenerateRockyArea (TileIndex end, TileIndex start) |
Scenario editor command that generates rocky areas. | |
bool | GUIPlaceProcDragXY (ViewportDragDropSelectionProcess proc, TileIndex start_tile, TileIndex end_tile) |
A central place to handle all X_AND_Y dragged GUI functions. | |
void | PlaceProc_DemolishArea (TileIndex tile) |
Start a drag for demolishing an area. | |
Window * | ShowTerraformToolbar (Window *link) |
Show the toolbar for terraforming in the game. | |
static void | CommonRaiseLowerBigLand (TileIndex tile, bool mode) |
Raise/Lower a bigger chunk of land at the same time in the editor. | |
static void | ResetLandscapeConfirmationCallback (Window *, bool confirmed) |
Callback function for the scenario editor 'reset landscape' confirmation window. | |
Window * | ShowEditorTerraformToolbar () |
Show the toolbar for terraforming in the scenario editor. | |
Variables | |
static constexpr NWidgetPart | _nested_terraform_widgets [] |
static WindowDesc | _terraform_desc (WDP_MANUAL, "toolbar_landscape", 0, 0, WC_SCEN_LAND_GEN, WC_NONE, WDF_CONSTRUCTION, _nested_terraform_widgets, &TerraformToolbarWindow::hotkeys) |
static uint8_t | _terraform_size = 1 |
static const int8_t | _multi_terraform_coords [][2] |
static constexpr NWidgetPart | _nested_scen_edit_land_gen_widgets [] |
static WindowDesc | _scen_edit_land_gen_desc (WDP_AUTO, "toolbar_landscape_scen", 0, 0, WC_SCEN_LAND_GEN, WC_NONE, WDF_CONSTRUCTION, _nested_scen_edit_land_gen_widgets, &ScenarioEditorLandscapeGenerationWindow::hotkeys) |
GUI related to terraforming the map.
Definition in file terraform_gui.cpp.
void CcTerraform | ( | Commands | cmd, |
const CommandCost & | result, | ||
Money | , | ||
TileIndex | tile | ||
) |
Definition at line 48 of file terraform_gui.cpp.
|
static |
Raise/Lower a bigger chunk of land at the same time in the editor.
When raising get the lowest point, when lowering the highest point, and set all tiles in the selection to that height.
tile | The top-left tile where the terraforming will start |
mode | true for raising, false for lowering land |
Definition at line 403 of file terraform_gui.cpp.
References _settings_client, OrthogonalTileArea::ClampToMap(), SoundSettings::confirm, OrthogonalTileArea::h, MAX_TILE_HEIGHT, SLOPE_N, SND_1F_CONSTRUCTION_OTHER, ClientSettings::sound, TileHeight(), and OrthogonalTileArea::w.
Referenced by ScenarioEditorLandscapeGenerationWindow::OnPlaceObject().
Scenario editor command that generates desert areas.
Definition at line 59 of file terraform_gui.cpp.
References _ctrl_pressed, _generating_world, InvalidateWindowClassesData(), MarkTileDirtyByTile(), Backup< T >::Restore(), SetTropicZone(), TROPICZONE_DESERT, TROPICZONE_NORMAL, and WC_TOWN_VIEW.
Referenced by GUIPlaceProcDragXY().
Scenario editor command that generates rocky areas.
Definition at line 76 of file terraform_gui.cpp.
References _settings_client, CLEAR_ROCKS, SoundSettings::confirm, GetTileType(), GetTreeGround(), MakeClear(), MarkTileDirtyByTile(), MP_CLEAR, MP_TREES, SND_1F_CONSTRUCTION_OTHER, ClientSettings::sound, and TREE_GROUND_SHORE.
Referenced by GUIPlaceProcDragXY().
bool GUIPlaceProcDragXY | ( | ViewportDragDropSelectionProcess | proc, |
TileIndex | start_tile, | ||
TileIndex | end_tile | ||
) |
A central place to handle all X_AND_Y dragged GUI functions.
proc | Procedure related to the dragging |
start_tile | Begin of the dragging |
end_tile | End of the dragging |
Definition at line 112 of file terraform_gui.cpp.
References _ctrl_pressed, _settings_game, GameSettings::construction, DDSP_CREATE_DESERT, DDSP_CREATE_ROCKS, DDSP_DEMOLISH_AREA, DDSP_LEVEL_AREA, DDSP_LOWER_AND_LEVEL_AREA, DDSP_RAISE_AND_LEVEL_AREA, ConstructionSettings::freeform_edges, GenerateDesertArea(), GenerateRockyArea(), LM_LEVEL, LM_LOWER, LM_RAISE, Map::MaxX(), Map::MaxY(), TileDiffXY(), TileX(), and TileY().
Referenced by BuildAirToolbarWindow::OnPlaceMouseUp(), BuildDocksToolbarWindow::OnPlaceMouseUp(), BuildRailToolbarWindow::OnPlaceMouseUp(), BuildRoadToolbarWindow::OnPlaceMouseUp(), TerraformToolbarWindow::OnPlaceMouseUp(), and ScenarioEditorLandscapeGenerationWindow::OnPlaceMouseUp().
void PlaceProc_DemolishArea | ( | TileIndex | tile | ) |
Start a drag for demolishing an area.
tile | Position of one corner. |
Definition at line 151 of file terraform_gui.cpp.
References DDSP_DEMOLISH_AREA, VPM_X_AND_Y, and VpStartPlaceSizing().
Referenced by BuildAirToolbarWindow::OnPlaceObject(), BuildDocksToolbarWindow::OnPlaceObject(), BuildRailToolbarWindow::OnPlaceObject(), BuildRoadToolbarWindow::OnPlaceObject(), TerraformToolbarWindow::OnPlaceObject(), and ScenarioEditorLandscapeGenerationWindow::OnPlaceObject().
|
static |
Callback function for the scenario editor 'reset landscape' confirmation window.
confirmed | boolean value, true when yes was clicked, false otherwise |
Definition at line 506 of file terraform_gui.cpp.
References _generating_world, ChangeOwnershipOfCompanyItems(), DC_BANKRUPT, DC_EXEC, INVALID_OWNER, IsBuoyTile(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_station_pool >::Iterate(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Iterate(), MarkWholeScreenDirty(), EngineOverrideManager::ResetToCurrentNewGRFConfig(), and Backup< T >::Restore().
Referenced by ScenarioEditorLandscapeGenerationWindow::OnClick().
Window * ShowEditorTerraformToolbar | ( | ) |
Show the toolbar for terraforming in the scenario editor.
nullptr
. Definition at line 751 of file terraform_gui.cpp.
Referenced by ScenarioEditorToolbarWindow::OnHotkey(), and ScenarioEditorLandscapeGenerationWindow::TerraformToolbarEditorGlobalHotkeys().
Show the toolbar for terraforming in the game.
link | The toolbar we might want to link to. |
nullptr
. Definition at line 368 of file terraform_gui.cpp.
References _current_text_dir, _local_company, CloseWindowById(), Window::height, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), Window::left, Window::SetDirty(), TD_RTL, Window::top, WC_SCEN_LAND_GEN, and Window::width.
Referenced by MenuClickForest(), MainToolbarWindow::OnHotkey(), and TerraformToolbarWindow::TerraformToolbarGlobalHotkeys().
|
static |
Definition at line 442 of file terraform_gui.cpp.
|
staticconstexpr |
Definition at line 453 of file terraform_gui.cpp.
|
staticconstexpr |
Definition at line 324 of file terraform_gui.cpp.
|
static |
Definition at line 392 of file terraform_gui.cpp.