#include "stdafx.h"
#include "openttd.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 "gfx_func.h"
#include "command_func.h"
#include "signs_func.h"
#include "variables.h"
#include "functions.h"
#include "sound_func.h"
#include "station_base.h"
#include "unmovable_map.h"
#include "textbuf_gui.h"
#include "genworld.h"
#include "tree_map.h"
#include "station_map.h"
#include "landscape_type.h"
#include "tilehighlight_func.h"
#include "settings_type.h"
#include "waypoint.h"
#include "table/sprites.h"
#include "table/strings.h"
Go to the source code of this file.
Data Structures | |
struct | TerraformToolbarWindow |
struct | ScenarioEditorLandscapeGenerationWindow |
Typedefs | |
typedef void | OnButtonClick (Window *w) |
Enumerations | |
enum | TerraformToolbarWidgets { TTW_CLOSEBOX = 0, TTW_CAPTION, TTW_STICKY, TTW_SEPERATOR, 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 } |
Enum referring to the widgets of the terraform toolbar. More... | |
enum | EditorTerraformToolbarWidgets { ETTW_START = 0, ETTW_CLOSEBOX = ETTW_START, ETTW_CAPTION, ETTW_STICKY, ETTW_BACKGROUND, ETTW_BUTTONS_START, ETTW_DEMOLISH = ETTW_BUTTONS_START, ETTW_LOWER_LAND, ETTW_RAISE_LAND, ETTW_LEVEL_LAND, ETTW_PLACE_ROCKS, ETTW_PLACE_DESERT_LIGHTHOUSE, ETTW_PLACE_TRANSMITTER, 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 (bool success, 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 | CcPlaySound1E (bool success, TileIndex tile, uint32 p1, uint32 p2) |
static void | PlaceProc_BuyLand (TileIndex tile) |
void | PlaceProc_DemolishArea (TileIndex tile) |
static void | PlaceProc_RaiseLand (TileIndex tile) |
static void | PlaceProc_LowerLand (TileIndex tile) |
static void | PlaceProc_LevelLand (TileIndex tile) |
static void | TerraformClick_Lower (Window *w) |
static void | TerraformClick_Raise (Window *w) |
static void | TerraformClick_Level (Window *w) |
static void | TerraformClick_Dynamite (Window *w) |
static void | TerraformClick_BuyLand (Window *w) |
static void | TerraformClick_Trees (Window *w) |
static void | TerraformClick_PlaceSign (Window *w) |
void | ShowTerraformToolbar (Window *link) |
static void | CommonRaiseLowerBigLand (TileIndex tile, int mode) |
Raise/Lower a bigger chunk of land at the same time in the editor. | |
static void | PlaceProc_RaiseBigLand (TileIndex tile) |
static void | PlaceProc_LowerBigLand (TileIndex tile) |
static void | PlaceProc_RockyArea (TileIndex tile) |
static void | PlaceProc_LightHouse (TileIndex tile) |
static void | PlaceProc_Transmitter (TileIndex tile) |
static void | PlaceProc_DesertArea (TileIndex tile) |
static void | EditorTerraformClick_Dynamite (Window *w) |
static void | EditorTerraformClick_LowerBigLand (Window *w) |
static void | EditorTerraformClick_RaiseBigLand (Window *w) |
static void | EditorTerraformClick_LevelLand (Window *w) |
static void | EditorTerraformClick_RockyArea (Window *w) |
static void | EditorTerraformClick_DesertLightHouse (Window *w) |
static void | EditorTerraformClick_Transmitter (Window *w) |
static void | ResetLandscapeConfirmationCallback (Window *w, bool confirmed) |
Callback function for the scenario editor 'reset landscape' confirmation window. | |
void | ShowEditorTerraformToolbar () |
Variables | |
static const uint16 | _terraform_keycodes [] |
static OnButtonClick *const | _terraform_button_proc [] |
static const Widget | _terraform_widgets [] |
static const WindowDesc | _terraform_desc (WDP_ALIGN_TBR, 22+36, 158, 36, 158, 36, WC_SCEN_LAND_GEN, WC_NONE, WDF_STD_TOOLTIPS|WDF_STD_BTN|WDF_DEF_WIDGET|WDF_STICKY_BUTTON|WDF_CONSTRUCTION, _terraform_widgets) |
static byte | _terraform_size = 1 |
static const Widget | _scen_edit_land_gen_widgets [] |
static const int8 | _multi_terraform_coords [][2] |
static const uint16 | _editor_terraform_keycodes [] |
static OnButtonClick *const | _editor_terraform_button_proc [] |
static const WindowDesc | _scen_edit_land_gen_desc (WDP_AUTO, WDP_AUTO, 163, 103, 163, 103, WC_SCEN_LAND_GEN, WC_NONE, WDF_STD_TOOLTIPS|WDF_STD_BTN|WDF_DEF_WIDGET|WDF_STICKY_BUTTON|WDF_CONSTRUCTION, _scen_edit_land_gen_widgets) |
Definition in file terraform_gui.cpp.
Enum referring to the widgets of the editor terraform toolbar.
ETTW_START | Used for iterations. |
ETTW_CLOSEBOX | Close window button. |
ETTW_CAPTION | Window caption. |
ETTW_STICKY | Sticky window button. |
ETTW_BACKGROUND | Background of the lower part of the window. |
ETTW_BUTTONS_START | Start of pushable buttons. |
ETTW_DEMOLISH | Demolish aka dynamite button. |
ETTW_LOWER_LAND | Lower land button. |
ETTW_RAISE_LAND | Raise land button. |
ETTW_LEVEL_LAND | Level land button. |
ETTW_PLACE_ROCKS | Place rocks button. |
ETTW_PLACE_DESERT_LIGHTHOUSE | Place desert button (in tropical climate) / place lighthouse button (else). |
ETTW_PLACE_TRANSMITTER | Place transmitter button. |
ETTW_BUTTONS_END | End of pushable buttons. |
ETTW_INCREASE_SIZE | Upwards arrow button to increase terraforming size. |
ETTW_DECREASE_SIZE | Downwards arrow button to decrease terraforming size. |
ETTW_NEW_SCENARIO | Button for generating a new scenario. |
ETTW_RESET_LANDSCAPE | Button for removing all company-owned property. |
Definition at line 487 of file terraform_gui.cpp.
Enum referring to the widgets of the terraform toolbar.
TTW_CLOSEBOX | Close window button. |
TTW_CAPTION | Window caption. |
TTW_STICKY | Sticky window button. |
TTW_SEPERATOR | Thin seperator line between level land button and demolish button. |
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. |
Definition at line 188 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 369 of file terraform_gui.cpp.
References BEGIN_TILE_LOOP, CMD_MSG, CMD_TERRAFORM_LAND, DoCommandP(), END_TILE_LOOP, MapSizeX(), MapSizeY(), max(), min(), SLOPE_N, TileHeight(), TileX(), and TileY().
static void EditorTerraformClick_Dynamite | ( | Window * | w | ) | [static] |
Definition at line 512 of file terraform_gui.cpp.
References ANIMCURSOR_DEMOLISH, ETTW_DEMOLISH, HandlePlacePushButton(), and VHM_RECT.
bool GUIPlaceProcDragXY | ( | ViewportDragDropSelectionProcess | proc, | |
TileIndex | start_tile, | |||
TileIndex | end_tile | |||
) |
A central place to handle all X_AND_Y dragged GUI functions.
e | WindowEvent variable holding in its higher bits (excluding the lower 4, since that defined the X_Y drag) the type of action to be performed |
Definition at line 113 of file terraform_gui.cpp.
References _settings_game, CMD_CLEAR_AREA, CMD_LEVEL_LAND, CMD_MSG, GameSettings::construction, DoCommandP(), ConstructionSettings::freeform_edges, GenerateDesertArea(), GenerateRockyArea(), MapMaxX(), MapMaxY(), TileDiffXY(), TileX(), and TileY().
Referenced by BuildRailToolbarWindow::OnPlaceMouseUp().
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 572 of file terraform_gui.cpp.
References CMD_LANDSCAPE_CLEAR, DC_BANKRUPT, DC_EXEC, DoCommand(), Station::facilities, INVALID_OWNER, Station::IsBuoy(), MarkWholeScreenDirty(), and Station::xy.
OnButtonClick* const _editor_terraform_button_proc[] [static] |
Initial value:
{ EditorTerraformClick_Dynamite, EditorTerraformClick_LowerBigLand, EditorTerraformClick_RaiseBigLand, EditorTerraformClick_LevelLand, EditorTerraformClick_RockyArea, EditorTerraformClick_DesertLightHouse, EditorTerraformClick_Transmitter }
Definition at line 558 of file terraform_gui.cpp.
const uint16 _editor_terraform_keycodes[] [static] |
Initial value:
{ 'D', 'Q', 'W', 'E', 'R', 'T', 'Y' }
Definition at line 547 of file terraform_gui.cpp.
const int8 _multi_terraform_coords[][2] [static] |
Initial value:
{ { 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 475 of file terraform_gui.cpp.
const Widget _scen_edit_land_gen_widgets[] [static] |
Initial value:
{ { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, { WWT_CAPTION, RESIZE_NONE, COLOUR_DARK_GREEN, 11, 150, 0, 13, STR_0223_LAND_GENERATION, STR_018C_WINDOW_TITLE_DRAG_THIS}, { WWT_STICKYBOX, RESIZE_NONE, COLOUR_DARK_GREEN, 151, 162, 0, 13, STR_NULL, STR_STICKY_BUTTON}, { WWT_PANEL, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 162, 14, 102, 0x0, STR_NULL}, { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 2, 23, 16, 37, SPR_IMG_DYNAMITE, STR_018D_DEMOLISH_BUILDINGS_ETC}, { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 24, 45, 16, 37, SPR_IMG_TERRAFORM_DOWN, STR_018E_LOWER_A_CORNER_OF_LAND}, { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 46, 67, 16, 37, SPR_IMG_TERRAFORM_UP, STR_018F_RAISE_A_CORNER_OF_LAND}, { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 68, 89, 16, 37, SPR_IMG_LEVEL_LAND, STR_LEVEL_LAND_TOOLTIP}, { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 90, 111, 16, 37, SPR_IMG_ROCKS, STR_028C_PLACE_ROCKY_AREAS_ON_LANDSCAPE}, { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 112, 133, 16, 37, SPR_IMG_LIGHTHOUSE_DESERT, STR_NULL}, { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 134, 156, 16, 37, SPR_IMG_TRANSMITTER, STR_028E_PLACE_TRANSMITTER}, { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 150, 161, 45, 56, SPR_ARROW_UP, STR_0228_INCREASE_SIZE_OF_LAND_AREA}, { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 150, 161, 58, 69, SPR_ARROW_DOWN, STR_0229_DECREASE_SIZE_OF_LAND_AREA}, { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 161, 76, 87, STR_SE_NEW_WORLD, STR_022A_GENERATE_RANDOM_LAND}, { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 161, 89, 100, STR_022B_RESET_LANDSCAPE, STR_RESET_LANDSCAPE_TOOLTIP}, { WIDGETS_END}, }
Definition at line 456 of file terraform_gui.cpp.
OnButtonClick* const _terraform_button_proc[] [static] |
Initial value:
{ TerraformClick_Lower, TerraformClick_Raise, TerraformClick_Level, TerraformClick_Dynamite, TerraformClick_BuyLand, TerraformClick_Trees, TerraformClick_PlaceSign, }
Definition at line 239 of file terraform_gui.cpp.
const uint16 _terraform_keycodes[] [static] |
Initial value:
{ 'Q', 'W', 'E', 'D', 'U', 'I', 'O', }
Definition at line 150 of file terraform_gui.cpp.
const Widget _terraform_widgets[] [static] |
Initial value:
{ { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, { WWT_CAPTION, RESIZE_NONE, COLOUR_DARK_GREEN, 11, 145, 0, 13, STR_LANDSCAPING_TOOLBAR, STR_018C_WINDOW_TITLE_DRAG_THIS}, {WWT_STICKYBOX, RESIZE_NONE, COLOUR_DARK_GREEN, 146, 157, 0, 13, STR_NULL, STR_STICKY_BUTTON}, { WWT_PANEL, RESIZE_NONE, COLOUR_DARK_GREEN, 66, 69, 14, 35, 0x0, STR_NULL}, { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 21, 14, 35, SPR_IMG_TERRAFORM_DOWN, STR_018E_LOWER_A_CORNER_OF_LAND}, { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 22, 43, 14, 35, SPR_IMG_TERRAFORM_UP, STR_018F_RAISE_A_CORNER_OF_LAND}, { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 44, 65, 14, 35, SPR_IMG_LEVEL_LAND, STR_LEVEL_LAND_TOOLTIP}, { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 70, 91, 14, 35, SPR_IMG_DYNAMITE, STR_018D_DEMOLISH_BUILDINGS_ETC}, { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 92, 113, 14, 35, SPR_IMG_BUY_LAND, STR_0329_PURCHASE_LAND_FOR_FUTURE}, { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 114, 135, 14, 35, SPR_IMG_PLANTTREES, STR_0185_PLANT_TREES_PLACE_SIGNS}, { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 136, 157, 14, 35, SPR_IMG_SIGN, STR_0289_PLACE_SIGN}, { WIDGETS_END}, }
Definition at line 311 of file terraform_gui.cpp.