|
OpenTTD Source 20251116-master-g21329071df
|
StationRect - used to track station spread out rectangle - cheaper than scanning whole map. More...
#include <base_station_base.h>
Public Types | |
| enum | StationRectMode : uint8_t { ADD_TEST = 0 , ADD_TRY , ADD_FORCE } |
Public Member Functions | |
| void | MakeEmpty () |
| bool | PtInExtendedRect (int x, int y, int distance=0) const |
| Determines whether a given point (x, y) is within a certain distance of the station rectangle. | |
| bool | IsEmpty () const |
| CommandCost | BeforeAddTile (TileIndex tile, StationRectMode mode) |
| CommandCost | BeforeAddRect (TileIndex tile, int w, int h, StationRectMode mode) |
| bool | AfterRemoveTile (BaseStation *st, TileIndex tile) |
| bool | AfterRemoveRect (BaseStation *st, TileArea ta) |
| StationRect & | operator= (const Rect &src) |
Public Member Functions inherited from Rect | |
| int | Width () const |
| Get width of Rect. | |
| int | Height () const |
| Get height of Rect. | |
| Rect | Shrink (int s) const |
| Copy and shrink Rect by s pixels. | |
| Rect | Shrink (int h, int v) const |
| Copy and shrink Rect by h horizontal and v vertical pixels. | |
| Rect | Shrink (int left, int top, int right, int bottom) const |
| Copy and shrink Rect by pixels. | |
| Rect | Shrink (const RectPadding &other) const |
| Copy and shrink Rect by a RectPadding. | |
| Rect | Shrink (const RectPadding &horz, const RectPadding &vert) const |
| Copy and shrink Rect by a different horizontal and vertical RectPadding. | |
| Rect | Expand (int s) const |
| Copy and expand Rect by s pixels. | |
| Rect | Expand (const RectPadding &other) const |
| Copy and expand Rect by a RectPadding. | |
| Rect | Translate (int x, int y) const |
| Copy and translate Rect by x,y pixels. | |
| Rect | WithWidth (int width, bool end) const |
| Copy Rect and set its width. | |
| Rect | Indent (int indent, bool end) const |
| Copy Rect and indent it from its position. | |
| Rect | WithHeight (int height, bool end=false) const |
| Copy Rect and set its height. | |
| bool | Contains (const Point &pt) const |
| Test if a point falls inside this Rect. | |
| Rect | CentreToHeight (int height) const |
| Centre a vertical dimension within this Rect. | |
| Rect | WithX (int new_left, int new_right) const |
| Create a new Rect, replacing the left and right coordiates. | |
| Rect | WithY (int new_top, int new_bottom) const |
| Create a new Rect, replacing the top and bottom coordiates. | |
| Rect | WithX (const Rect &other) const |
| Create a new Rect, replacing the left and right coordiates. | |
| Rect | WithY (const Rect &other) const |
| Create a new Rect, replacing the top and bottom coordiates. | |
Static Public Member Functions | |
| static bool | ScanForStationTiles (StationID st_id, int left_a, int top_a, int right_a, int bottom_a) |
| Check whether station tiles of the given station id exist in the given rectangle. | |
Additional Inherited Members | |
Data Fields inherited from Rect | |
| int | left = 0 |
| int | top = 0 |
| int | right = 0 |
| int | bottom = 0 |
StationRect - used to track station spread out rectangle - cheaper than scanning whole map.
Definition at line 36 of file base_station_base.h.
| enum StationRect::StationRectMode : uint8_t |
Definition at line 37 of file base_station_base.h.
| StationRect::StationRect | ( | ) |
Definition at line 545 of file station.cpp.
| bool StationRect::AfterRemoveRect | ( | BaseStation * | st, |
| TileArea | ta | ||
| ) |
Definition at line 689 of file station.cpp.
| bool StationRect::AfterRemoveTile | ( | BaseStation * | st, |
| TileIndex | tile | ||
| ) |
Definition at line 639 of file station.cpp.
| CommandCost StationRect::BeforeAddRect | ( | TileIndex | tile, |
| int | w, | ||
| int | h, | ||
| StationRectMode | mode | ||
| ) |
Definition at line 609 of file station.cpp.
| CommandCost StationRect::BeforeAddTile | ( | TileIndex | tile, |
| StationRectMode | mode | ||
| ) |
Definition at line 575 of file station.cpp.
| bool StationRect::IsEmpty | ( | ) | const |
Definition at line 570 of file station.cpp.
| void StationRect::MakeEmpty | ( | ) |
Definition at line 550 of file station.cpp.
| StationRect & StationRect::operator= | ( | const Rect & | src | ) |
Definition at line 699 of file station.cpp.
| bool StationRect::PtInExtendedRect | ( | int | x, |
| int | y, | ||
| int | distance = 0 |
||
| ) | const |
Determines whether a given point (x, y) is within a certain distance of the station rectangle.
| x | X coordinate |
| y | Y coordinate |
| distance | The maximum distance a point may have (L1 norm) |
Definition at line 564 of file station.cpp.
|
static |
Check whether station tiles of the given station id exist in the given rectangle.
| st_id | Station ID to look for in the rectangle |
| left_a | Minimal tile X edge of the rectangle |
| top_a | Minimal tile Y edge of the rectangle |
| right_a | Maximal tile X edge of the rectangle (inclusive) |
| bottom_a | Maximal tile Y edge of the rectangle (inclusive) |
true if a station tile with the given st_id exists in the rectangle, false otherwise Definition at line 629 of file station.cpp.
References GetStationIndex(), IsTileType(), MP_STATION, and TileXY().