OpenTTD Source  20240919-master-gdf0233f4c2
DiagonalTileArea Struct Reference

Represents a diagonal tile area. More...

#include <tilearea_type.h>

Public Member Functions

 DiagonalTileArea (TileIndex tile=INVALID_TILE, int16_t a=0, int16_t b=0)
 Construct this tile area with some set values. More...
 
 DiagonalTileArea (TileIndex start, TileIndex end)
 Create a diagonal tile area from two corners. More...
 
void Clear ()
 Clears the TileArea by making the tile invalid and setting a and b to 0.
 
bool Contains (TileIndex tile) const
 Does this tile area contain a tile? More...
 

Data Fields

TileIndex tile
 Base tile of the area.
 
int16_t a
 Extent in diagonal "x" direction (may be negative to signify the area stretches to the left)
 
int16_t b
 Extent in diagonal "y" direction (may be negative to signify the area stretches upwards)
 

Detailed Description

Represents a diagonal tile area.

Definition at line 70 of file tilearea_type.h.

Constructor & Destructor Documentation

◆ DiagonalTileArea() [1/2]

DiagonalTileArea::DiagonalTileArea ( TileIndex  tile = INVALID_TILE,
int16_t  a = 0,
int16_t  b = 0 
)
inline

Construct this tile area with some set values.

Parameters
tileThe base tile.
aThe "x" extent.
bThe "y" estent.

Definition at line 82 of file tilearea_type.h.

◆ DiagonalTileArea() [2/2]

DiagonalTileArea::DiagonalTileArea ( TileIndex  start,
TileIndex  end 
)

Create a diagonal tile area from two corners.

Parameters
startFirst corner of the area.
endSecond corner of the area.

Definition at line 172 of file tilearea.cpp.

References a, b, Map::Size(), TileX(), and TileY().

Member Function Documentation

◆ Contains()

bool DiagonalTileArea::Contains ( TileIndex  tile) const

Does this tile area contain a tile?

Parameters
tileTile to test for.
Returns
True if the tile is inside the area.

Definition at line 205 of file tilearea.cpp.

References a, b, tile, TileX(), and TileY().


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