GUI related to terraforming the map. More...
#include "stdafx.h"
#include "clear_map.h"
#include "company_func.h"
#include "company_base.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 "tile_map.h"
#include "table/strings.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... | |
Enumerations | |
enum | TerraformToolbarWidgets { TTW_SHOW_PLACE_OBJECT, TTW_BUTTONS_START, TTW_LOWER_LAND = TTW_BUTTONS_START, TTW_RAISE_LAND, TTW_LEVEL_LAND, TTW_DEMOLISH, TTW_BUY_LAND, TTW_PLANT_TREES, TTW_PLACE_SIGN, TTW_PLACE_OBJECT, TTW_MEASUREMENT_TOOL, TTW_COPY_PASTE } |
Enum referring to the widgets of the terraform toolbar. More... | |
enum | EditorTerraformToolbarWidgets { ETTW_SHOW_PLACE_DESERT, ETTW_START, ETTW_DOTS = ETTW_START, ETTW_BUTTONS_START, ETTW_DEMOLISH = ETTW_BUTTONS_START, ETTW_LOWER_LAND, ETTW_RAISE_LAND, ETTW_LEVEL_LAND, ETTW_PLACE_ROCKS, ETTW_PLACE_DESERT, ETTW_PLACE_OBJECT, ETTW_MEASUREMENT_TOOL, ETTW_BUTTONS_END, ETTW_INCREASE_SIZE = ETTW_BUTTONS_END, ETTW_DECREASE_SIZE, ETTW_NEW_SCENARIO, ETTW_RESET_LANDSCAPE } |
Enum referring to the widgets of the editor terraform toolbar. More... | |
Functions | |
void | CcTerraform (const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2) |
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. | |
EventState | TerraformToolbarGlobalHotkeys (uint16 key, uint16 keycode) |
static void | CommonRaiseLowerBigLand (TileIndex tile, int mode) |
Raise/Lower a bigger chunk of land at the same time in the editor. | |
static void | ResetLandscapeConfirmationCallback (Window *w, bool confirmed) |
Callback function for the scenario editor 'reset landscape' confirmation window. | |
Window * | ShowEditorTerraformToolbar () |
Show the toolbar for terraforming in the scenario editor. | |
EventState | TerraformToolbarEditorGlobalHotkeys (uint16 key, uint16 keycode) |
Variables | |
Hotkey< TerraformToolbarWindow > * | _terraform_hotkeys = TerraformToolbarWindow::terraform_hotkeys |
static const NWidgetPart | _nested_terraform_widgets [] |
static const WindowDesc | _terraform_desc (WDP_MANUAL, 0, 0, WC_SCEN_LAND_GEN, WC_NONE, WDF_CONSTRUCTION, _nested_terraform_widgets, lengthof(_nested_terraform_widgets)) |
static byte | _terraform_size = 1 |
static const int8 | _multi_terraform_coords [][2] |
static const NWidgetPart | _nested_scen_edit_land_gen_widgets [] |
Hotkey < ScenarioEditorLandscapeGenerationWindow > * | _terraform_editor_hotkeys = ScenarioEditorLandscapeGenerationWindow::terraform_editor_hotkeys |
static const WindowDesc | _scen_edit_land_gen_desc (WDP_AUTO, 0, 0, WC_SCEN_LAND_GEN, WC_NONE, WDF_CONSTRUCTION, _nested_scen_edit_land_gen_widgets, lengthof(_nested_scen_edit_land_gen_widgets)) |
GUI related to terraforming the map.
Definition in file terraform_gui.cpp.
Enum referring to the widgets of the editor terraform toolbar.
Definition at line 497 of file terraform_gui.cpp.
Enum referring to the widgets of the terraform toolbar.
TTW_SHOW_PLACE_OBJECT |
Should the place object button be shown? |
TTW_BUTTONS_START |
Start of pushable buttons. |
TTW_LOWER_LAND |
Lower land button. |
TTW_RAISE_LAND |
Raise land button. |
TTW_LEVEL_LAND |
Level land button. |
TTW_DEMOLISH |
Demolish aka dynamite button. |
TTW_BUY_LAND |
Buy land button. |
TTW_PLANT_TREES |
Plant trees button (note: opens seperate window, no place-push-button). |
TTW_PLACE_SIGN |
Place sign button. |
TTW_PLACE_OBJECT |
Place object button. |
TTW_MEASUREMENT_TOOL |
Ruler tool button. |
TTW_COPY_PASTE |
CopyPaste button. |
Definition at line 146 of file terraform_gui.cpp.
static void CommonRaiseLowerBigLand | ( | TileIndex | tile, | |
int | mode | |||
) | [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 | 1 for raising, 0 for lowering land |
Definition at line 446 of file terraform_gui.cpp.
References TileArea::ClampToMap(), CMD_MSG, CMD_TERRAFORM_LAND, DoCommandP(), GetMaxTileHeight(), TileArea::h, max(), min(), SLOPE_N, TILE_AREA_LOOP, TileHeight(), and TileArea::w.
Referenced by ScenarioEditorLandscapeGenerationWindow::OnPlaceObject().
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 101 of file terraform_gui.cpp.
References _ctrl_pressed, _settings_game, CMD_CLEAR_AREA, CMD_LEVEL_LAND, CMD_MSG, GameSettings::construction, DDSP_CREATE_DESERT, DDSP_CREATE_ROCKS, DDSP_DEMOLISH_AREA, DDSP_LEVEL_AREA, DDSP_LOWER_AND_LEVEL_AREA, DDSP_RAISE_AND_LEVEL_AREA, DoCommandP(), ConstructionSettings::freeform_edges, GenerateDesertArea(), GenerateRockyArea(), LM_LEVEL, LM_LOWER, LM_RAISE, MapMaxX(), MapMaxY(), TileDiffXY(), TileX(), and TileY().
Referenced by ScenarioEditorLandscapeGenerationWindow::OnPlaceMouseUp(), TerraformToolbarWindow::OnPlaceMouseUp(), BuildRoadToolbarWindow::OnPlaceMouseUp(), BuildRailToolbarWindow::OnPlaceMouseUp(), BuildDocksToolbarWindow::OnPlaceMouseUp(), and BuildAirToolbarWindow::OnPlaceMouseUp().
void PlaceProc_DemolishArea | ( | TileIndex | tile | ) |
Start a drag for demolishing an area.
tile | Position of one corner. |
Definition at line 140 of file terraform_gui.cpp.
References DDSP_DEMOLISH_AREA, VPM_X_AND_Y, and VpStartPlaceSizing().
Referenced by ScenarioEditorLandscapeGenerationWindow::OnPlaceObject(), TerraformToolbarWindow::OnPlaceObject(), BuildRoadToolbarWindow::OnPlaceObject(), BuildRailToolbarWindow::OnPlaceObject(), BuildDocksToolbarWindow::OnPlaceObject(), and BuildAirToolbarWindow::OnPlaceObject().
static void ResetLandscapeConfirmationCallback | ( | Window * | w, | |
bool | confirmed | |||
) | [static] |
Callback function for the scenario editor 'reset landscape' confirmation window.
w | Window unused | |
confirmed | boolean value, true when yes was clicked, false otherwise |
Definition at line 573 of file terraform_gui.cpp.
References _generating_world, ChangeOwnershipOfCompanyItems(), CMD_LANDSCAPE_CLEAR, DC_BANKRUPT, DC_EXEC, DoCommand(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_OWNER, IsBuoyTile(), BaseStation::IsInUse(), MarkWholeScreenDirty(), EngineOverrideManager::ResetToCurrentNewGRFConfig(), and BaseStation::xy.
Referenced by ScenarioEditorLandscapeGenerationWindow::OnClick().
Window* ShowEditorTerraformToolbar | ( | ) |
Show the toolbar for terraforming in the scenario editor.
Definition at line 835 of file terraform_gui.cpp.
Referenced by ScenarioEditorToolbarWindow::OnKeyPress().
Show the toolbar for terraforming in the game.
link | The toolbar we might want to link to. |
Definition at line 402 of file terraform_gui.cpp.
References _current_text_dir, _local_company, DeleteWindowById(), 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, and Window::width.
Referenced by MainToolbarWindow::OnKeyPress().
const int8 _multi_terraform_coords[][2] [static] |
{ { 0, -2}, { 4, 0}, { -4, 0}, { 0, 2}, { -8, 2}, { -4, 4}, { 0, 6}, { 4, 4}, { 8, 2}, {-12, 0}, { -8, -2}, { -4, -4}, { 0, -6}, { 4, -4}, { 8, -2}, { 12, 0}, {-16, 2}, {-12, 4}, { -8, 6}, { -4, 8}, { 0, 10}, { 4, 8}, { 8, 6}, { 12, 4}, { 16, 2}, {-20, 0}, {-16, -2}, {-12, -4}, { -8, -6}, { -4, -8}, { 0,-10}, { 4, -8}, { 8, -6}, { 12, -4}, { 16, -2}, { 20, 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}, {-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}, }
Definition at line 485 of file terraform_gui.cpp.