OpenTTD Source: TileHighlightData Struct Reference

OpenTTD Source 15.0-beta1

Public Member Functions | Data Fields
TileHighlightData Struct Reference

Metadata about the current highlighting. More...

`#include <tilehighlight_type.h>`

## Public Member Functions
void | Reset ()
| Reset tile highlighting.
bool | IsDraggingDiagonal ()
| Is the user dragging a 'diagonal rectangle'?
Window * | GetCallbackWnd ()
| Get the window that started the current highlighting.

## Data Fields
Point | pos
| Location, in tile "units", of the northern tile of the selected area.
Point | size
| Size, in tile "units", of the white/red selection area.
Point | offs
| Offset, in tile "units", for the blue coverage area from the selected area's northern tile.
Point | outersize
| Size, in tile "units", of the blue coverage area excluding the side of the selected area.
bool | diagonal
| Whether the dragged area is a 45 degrees rotated rectangle.
bool | freeze
| Freeze highlight in place.
Point | new_pos
| New value for pos; used to determine whether to redraw the selection.
Point | new_size
| New value for size; used to determine whether to redraw the selection.
Point | new_outersize
| New value for outersize; used to determine whether to redraw the selection.
uint8_t | dirty
| Whether the build station window needs to redraw due to the changed selection.
Point | selstart
| The location where the dragging started.
Point | selend
| The location where the drag currently ends.
uint8_t | sizelimit
| Whether the selection is limited in length, and what the maximum length is.
HighLightStyle | drawstyle
| Lower bits 0-3 are reserved for detailed highlight information.
HighLightStyle | next_drawstyle
| Queued, but not yet drawn style.
HighLightStyle | place_mode
| Method which is used to place the selection.
WindowClass | window_class
| The `WindowClass` of the window that is responsible for the selection mode.
WindowNumber | window_number
| The `WindowNumber` of the window that is responsible for the selection mode.
bool | make_square_red
| Whether to give a tile a red selection.
TileIndex | redsq
| The tile that has to get a red selection.
ViewportPlaceMethod | select_method
| The method which governs how tiles are selected.
ViewportDragDropSelectionProcess | select_proc
| The procedure that has to be called when the selection is done.

## Detailed Description

Metadata about the current highlighting.

Definition at line 46 of file tilehighlight_type.h.

## Member Function Documentation

## ◆ GetCallbackWnd()

Window * TileHighlightData::GetCallbackWnd | ( |  | ) |

Get the window that started the current highlighting.

Returns
  The window that requested the current tile highlighting, or `nullptr` if not available.

Definition at line 2588 of file viewport.cpp.

References FindWindowById(), window_class, and window_number.

Referenced by HandleMouseDragDrop(), BuildIndustryWindow::OnClick(), SetObjectToPlace(), ShowMeasurementTooltips(), VehicleClicked(), VehicleClicked(), and VpHandlePlaceSizingDrag().

## ◆ IsDraggingDiagonal()

bool TileHighlightData::IsDraggingDiagonal | ( |  | ) |

Is the user dragging a 'diagonal rectangle'?

Returns
  User is dragging a rotated rectangle.

Definition at line 2579 of file viewport.cpp.

References _ctrl_pressed, _left_button_down, HT_DIAGONAL, and place_mode.

Referenced by UpdateTileSelection(), and VpSelectTilesWithMethod().

## ◆ Reset()

void TileHighlightData::Reset | ( |  | ) |

Reset tile highlighting.

Definition at line 2567 of file viewport.cpp.

References new_pos, and pos.

Referenced by ResetWindowSystem().

## Field Documentation

## ◆ diagonal

bool TileHighlightData::diagonal

Whether the dragged area is a 45 degrees rotated rectangle.

Definition at line 51 of file tilehighlight_type.h.

Referenced by DrawTileSelection(), SetSelectionTilesDirty(), and UpdateTileSelection().

## ◆ dirty

uint8_t TileHighlightData::dirty

Whether the build station window needs to redraw due to the changed selection.

Definition at line 58 of file tilehighlight_type.h.

Referenced by CheckRedrawStationCoverage(), SelectStationWindow< T >::OnRealtimeTick(), and UpdateTileSelection().

## ◆ drawstyle

HighLightStyle TileHighlightData::drawstyle

Lower bits 0-3 are reserved for detailed highlight information.

Definition at line 64 of file tilehighlight_type.h.

Referenced by CheckRedrawStationCoverage(), DrawStationCoverageAreaText(), DrawTileSelection(), HandleAutoSignalPlacement(), SetObjectToPlace(), UpdateTileSelection(), and VpStartPlaceSizing().

## ◆ freeze

bool TileHighlightData::freeze

Freeze highlight in place.

Definition at line 53 of file tilehighlight_type.h.

Referenced by SelectStationWindow< T >::Close(), and UpdateTileSelection().

## ◆ make_square_red

bool TileHighlightData::make_square_red

Whether to give a tile a red selection.

Definition at line 71 of file tilehighlight_type.h.

Referenced by DrawAutorailSelection(), DrawTileSelection(), and SetObjectToPlace().

## ◆ new_outersize

Point TileHighlightData::new_outersize

New value for outersize; used to determine whether to redraw the selection.

Definition at line 57 of file tilehighlight_type.h.

Referenced by SetTileSelectSize(), and UpdateTileSelection().

## ◆ new_pos

Point TileHighlightData::new_pos

New value for pos; used to determine whether to redraw the selection.

Definition at line 55 of file tilehighlight_type.h.

Referenced by Reset(), UpdateTileSelection(), and VpHandlePlaceSizingDrag().

## ◆ new_size

Point TileHighlightData::new_size

New value for size; used to determine whether to redraw the selection.

Definition at line 56 of file tilehighlight_type.h.

Referenced by SetTileSelectSize(), and UpdateTileSelection().

## ◆ next_drawstyle

HighLightStyle TileHighlightData::next_drawstyle

Queued, but not yet drawn style.

Definition at line 65 of file tilehighlight_type.h.

Referenced by CalcRaildirsDrawstyle(), UpdateTileSelection(), VpHandlePlaceSizingDrag(), VpSelectTilesWithMethod(), VpSetPresizeRange(), VpStartDragging(), and VpStartPlaceSizing().

## ◆ offs

Point TileHighlightData::offs

Offset, in tile "units", for the blue coverage area from the selected area's northern tile.

Definition at line 49 of file tilehighlight_type.h.

Referenced by DrawTileSelection(), and SetSelectionTilesDirty().

## ◆ outersize

Point TileHighlightData::outersize

Size, in tile "units", of the blue coverage area excluding the side of the selected area.

Definition at line 50 of file tilehighlight_type.h.

Referenced by DrawTileSelection(), SetSelectionTilesDirty(), and UpdateTileSelection().

## ◆ place_mode

HighLightStyle TileHighlightData::place_mode

Method which is used to place the selection.

Definition at line 67 of file tilehighlight_type.h.

Referenced by IsDraggingDiagonal(), SetObjectToPlace(), UpdateTileSelection(), VehicleClicked(), VehicleClicked(), VpHandlePlaceSizingDrag(), and VpStartPlaceSizing().

## ◆ pos

Point TileHighlightData::pos

Location, in tile "units", of the northern tile of the selected area.

Definition at line 47 of file tilehighlight_type.h.

Referenced by DrawStationCoverageAreaText(), DrawTileSelection(), FindStationsAroundSelection(), IsInsideRotatedRectangle(), BuildRailToolbarWindow::OnHotkey(), BuildRoadToolbarWindow::OnHotkey(), Reset(), SetSelectionTilesDirty(), and UpdateTileSelection().

## ◆ redsq

TileIndex TileHighlightData::redsq

The tile that has to get a red selection.

Definition at line 72 of file tilehighlight_type.h.

Referenced by DrawTileSelection(), and SetRedErrorSquare().

## ◆ select_method

ViewportPlaceMethod TileHighlightData::select_method

The method which governs how tiles are selected.

Definition at line 74 of file tilehighlight_type.h.

Referenced by VpHandlePlaceSizingDrag(), VpStartDragging(), and VpStartPlaceSizing().

## ◆ select_proc

ViewportDragDropSelectionProcess TileHighlightData::select_proc

The procedure that has to be called when the selection is done.

Definition at line 75 of file tilehighlight_type.h.

Referenced by VpHandlePlaceSizingDrag(), VpStartDragging(), and VpStartPlaceSizing().

## ◆ selend

Point TileHighlightData::selend

The location where the drag currently ends.

Definition at line 61 of file tilehighlight_type.h.

Referenced by CalcRaildirsDrawstyle(), Check2x1AutoRail(), HandleAutoSignalPlacement(), UpdateTileSelection(), VpHandlePlaceSizingDrag(), VpSelectTilesWithMethod(), VpSetPresizeRange(), and VpStartPlaceSizing().

## ◆ selstart

Point TileHighlightData::selstart

The location where the dragging started.

Definition at line 60 of file tilehighlight_type.h.

Referenced by CalcRaildirsDrawstyle(), DrawTileSelection(), HandleAutoSignalPlacement(), UpdateTileSelection(), VpHandlePlaceSizingDrag(), VpSelectTilesWithMethod(), VpSetPresizeRange(), VpStartDragging(), and VpStartPlaceSizing().

## ◆ size

Point TileHighlightData::size

Size, in tile "units", of the white/red selection area.

Definition at line 48 of file tilehighlight_type.h.

Referenced by DrawStationCoverageAreaText(), DrawTileSelection(), FindStationsAroundSelection(), IsInsideRotatedRectangle(), BuildRoadToolbarWindow::OnPlaceDrag(), PlaceAirport(), SetSelectionTilesDirty(), and UpdateTileSelection().

## ◆ sizelimit

uint8_t TileHighlightData::sizelimit

Whether the selection is limited in length, and what the maximum length is.

Definition at line 62 of file tilehighlight_type.h.

Referenced by VpSelectTilesWithMethod().

## ◆ window_class

WindowClass TileHighlightData::window_class

The `WindowClass` of the window that is responsible for the selection mode.

Definition at line 68 of file tilehighlight_type.h.

Referenced by ChangeVehicleWindow(), Window::Close(), GetCallbackWnd(), and SetObjectToPlace().

## ◆ window_number

WindowNumber TileHighlightData::window_number

The `WindowNumber` of the window that is responsible for the selection mode.

Definition at line 69 of file tilehighlight_type.h.

Referenced by ChangeVehicleWindow(), Window::Close(), GetCallbackWnd(), and SetObjectToPlace().

The documentation for this struct was generated from the following files:

- src/tilehighlight_type.h
- src/viewport.cpp