OpenTTD
|
Functions related to tile highlights. More...
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 |
Functions related to tile highlights.
Definition in file tilehighlight_func.h.
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 106 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 BuildAirToolbarWindow::OnPlaceMouseUp(), BuildDocksToolbarWindow::OnPlaceMouseUp(), TerraformToolbarWindow::OnPlaceMouseUp(), BuildRoadToolbarWindow::OnPlaceMouseUp(), BuildRailToolbarWindow::OnPlaceMouseUp(), and ScenarioEditorLandscapeGenerationWindow::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
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 |
Definition at line 103 of file main_gui.cpp.
References _settings_client, SoundSettings::click_beep, Window::IsWidgetDisabled(), Window::IsWidgetLowered(), Window::LowerWidget(), Window::SetDirty(), ClientSettings::sound, Window::window_class, and Window::window_number.
Referenced by BuildAirToolbarWindow::OnClick(), BuildTreesWindow::OnClick(), BuildDocksToolbarWindow::OnClick(), TerraformToolbarWindow::OnClick(), BuildRoadToolbarWindow::OnClick(), BuildIndustryWindow::OnClick(), BuildRailToolbarWindow::OnClick(), ScenarioEditorLandscapeGenerationWindow::OnClick(), and FoundTownWindow::OnClick().
void PlaceProc_DemolishArea | ( | TileIndex | tile | ) |
Start a drag for demolishing an area.
tile | Position of one corner. |
Definition at line 145 of file terraform_gui.cpp.
References DDSP_DEMOLISH_AREA, VPM_X_AND_Y, and VpStartPlaceSizing().
Referenced by BuildAirToolbarWindow::OnPlaceObject(), BuildDocksToolbarWindow::OnPlaceObject(), TerraformToolbarWindow::OnPlaceObject(), BuildRoadToolbarWindow::OnPlaceObject(), BuildRailToolbarWindow::OnPlaceObject(), and ScenarioEditorLandscapeGenerationWindow::OnPlaceObject().
void UpdateTileSelection | ( | ) |
Updates tile highlighting for all cases.
Uses _thd.selstart and _thd.selend and _thd.place_mode (set elsewhere) to determine _thd.pos and _thd.size Also drawstyle is determined. Uses _thd.new.* as a buffer and calls SetSelectionTilesDirty() twice, Once for the old and once for the new selection. _thd is TileHighlightData, found in viewport.h
Definition at line 2688 of file viewport.cpp.
References TileHighlightData::diagonal, TileHighlightData::dirty, TileHighlightData::drawstyle, GetAutorailHT(), HT_DIR_HL, HT_DIR_HU, HT_DIR_MASK, HT_DIR_VL, HT_DIR_VR, HT_DIR_X, HT_DIR_Y, HT_DRAG_MASK, HT_LINE, HT_NONE, HT_POINT, HT_RAIL, HT_RECT, HT_SPECIAL, TileHighlightData::IsDraggingDiagonal(), TileHighlightData::new_outersize, TileHighlightData::new_pos, TileHighlightData::new_size, TileHighlightData::next_drawstyle, TileHighlightData::outersize, TileHighlightData::place_mode, TileHighlightData::pos, TileHighlightData::selend, TileHighlightData::selstart, SetSelectionTilesDirty(), TileHighlightData::size, Swap(), TILE_SIZE, and TILE_UNIT_MASK.
Referenced by StationJoinerNeeded().
void VpSelectTilesWithMethod | ( | int | x, |
int | y, | ||
ViewportPlaceMethod | method | ||
) |
Selects tiles while dragging.
x | X coordinate of end of selection |
y | Y coordinate of end of selection |
method | modifies the way tiles are selected. Possible methods are VPM_* in viewport.h |
Definition at line 3273 of file viewport.cpp.
References _settings_client, abs(), CalcHeightdiff(), CalcRaildirsDrawstyle(), Clamp(), Delta(), DistanceManhattan(), ClientSettings::gui, HT_DIR_X, HT_DIR_Y, HT_DRAG_MASK, HT_LINE, HT_POINT, HT_RECT, TileHighlightData::IsDraggingDiagonal(), GUISettings::measure_tooltip, TileHighlightData::next_drawstyle, TileHighlightData::selend, TileHighlightData::selstart, ShowMeasurementTooltips(), TileHighlightData::sizelimit, TILE_SIZE, TileVirtXY(), TileX(), TileY(), VPM_FIX_X, VPM_FIX_Y, VPM_RAILDIRS, VPM_SIGNALDIRS, VPM_X_AND_Y, VPM_X_AND_Y_LIMITED, VPM_X_LIMITED, VPM_X_OR_Y, and VPM_Y_LIMITED.
Referenced by BuildAirToolbarWindow::OnPlaceDrag(), BuildTreesWindow::OnPlaceDrag(), BuildDocksToolbarWindow::OnPlaceDrag(), TerraformToolbarWindow::OnPlaceDrag(), BuildRoadToolbarWindow::OnPlaceDrag(), BuildRailToolbarWindow::OnPlaceDrag(), and ScenarioEditorLandscapeGenerationWindow::OnPlaceDrag().
Highlights all tiles between a set of two tiles.
Used in dock and tunnel placement
from | TileIndex of the first tile to highlight |
to | TileIndex of the last tile to highlight |
Definition at line 2847 of file viewport.cpp.
References DistanceManhattan(), HT_RECT, TileHighlightData::next_drawstyle, TileHighlightData::selend, TileHighlightData::selstart, ShowMeasurementTooltips(), TILE_SIZE, TileX(), and TileY().
Referenced by BuildDocksToolbarWindow::OnPlacePresize(), BuildRoadToolbarWindow::OnPlacePresize(), and BuildRailToolbarWindow::OnPlacePresize().