Functions | Variables

tilehighlight_func.h File Reference

Functions related to tile highlights. More...

#include "gfx_type.h"
#include "tilehighlight_type.h"

Go to the source code of this file.

Functions

void PlaceProc_DemolishArea (TileIndex tile)
 Start a drag for demolishing an area.
bool GUIPlaceProcDragXY (ViewportDragDropSelectionProcess proc, TileIndex start_tile, TileIndex end_tile)
 A central place to handle all X_AND_Y dragged GUI functions.
bool HandlePlacePushButton (Window *w, int widget, CursorID cursor, HighLightStyle mode)
 This code is shared for the majority of the pushbuttons.
void SetObjectToPlaceWnd (CursorID icon, PaletteID pal, HighLightStyle mode, Window *w)
void SetObjectToPlace (CursorID icon, PaletteID pal, HighLightStyle mode, WindowClass window_class, WindowNumber window_num)
void ResetObjectToPlace ()
void VpSelectTilesWithMethod (int x, int y, ViewportPlaceMethod method)
 Selects tiles while dragging.
void VpStartPlaceSizing (TileIndex tile, ViewportPlaceMethod method, ViewportDragDropSelectionProcess process)
 highlighting tiles while only going over them with the mouse
void VpSetPresizeRange (TileIndex from, TileIndex to)
 Highlights all tiles between a set of two tiles.
void VpSetPlaceSizingLimit (int limit)
void UpdateTileSelection ()
 Updates tile highlighting for all cases.

Variables

TileHighlightData _thd

Detailed Description

Functions related to tile highlights.

Definition in file tilehighlight_func.h.


Function Documentation

bool GUIPlaceProcDragXY ( ViewportDragDropSelectionProcess  proc,
TileIndex  start_tile,
TileIndex  end_tile 
)

A central place to handle all X_AND_Y dragged GUI functions.

Parameters:
proc Procedure related to the dragging
start_tile Begin of the dragging
end_tile End of the dragging
Returns:
Returns true if the action was found and handled, and false otherwise. This allows for additional implements that are more local. For example X_Y drag of convertrail which belongs in rail_gui.cpp and not terraform_gui.cpp

Definition at line 102 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().

bool HandlePlacePushButton ( Window w,
int  widget,
CursorID  cursor,
HighLightStyle  mode 
)

This code is shared for the majority of the pushbuttons.

Handles e.g. the pressing of a button (to build things), playing of click sound and sets certain parameters

Parameters:
w Window which called the function
widget ID of the widget (=button) that called this function
cursor How should the cursor image change? E.g. cursor with depot image in it
mode Tile highlighting mode, e.g. drawing a rectangle or a dot on the ground
Returns:
true if the button is clicked, false if it's unclicked

Definition at line 100 of file main_gui.cpp.

References Window::IsWidgetDisabled(), Window::IsWidgetLowered(), Window::LowerWidget(), Window::SetDirty(), Window::window_class, and Window::window_number.

Referenced by BuildTreesWindow::OnClick(), ScenarioEditorLandscapeGenerationWindow::OnClick(), TerraformToolbarWindow::OnClick(), BuildRoadToolbarWindow::OnClick(), BuildRailToolbarWindow::OnClick(), BuildIndustryWindow::OnClick(), BuildDocksToolbarWindow::OnClick(), and BuildAirToolbarWindow::OnClick().

void PlaceProc_DemolishArea ( TileIndex  tile  ) 
void UpdateTileSelection (  ) 
void VpSelectTilesWithMethod ( int  x,
int  y,
ViewportPlaceMethod  method 
)
void VpSetPresizeRange ( TileIndex  from,
TileIndex  to 
)

Highlights all tiles between a set of two tiles.

Used in dock and tunnel placement

Parameters:
from TileIndex of the first tile to highlight
to TileIndex of the last tile to highlight

Definition at line 2245 of file viewport.cpp.

References DistanceManhattan(), TileHighlightData::next_drawstyle, TileHighlightData::selend, TileHighlightData::selstart, ShowMeasurementTooltips(), TILE_SIZE, TileX(), and TileY().

Referenced by BuildRoadToolbarWindow::OnPlacePresize(), BuildRailToolbarWindow::OnPlacePresize(), and BuildDocksToolbarWindow::OnPlacePresize().