OpenTTD Source: DiagonalTileArea Struct Reference

OpenTTD Source 15.3

Public Member Functions | Data Fields
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.
| DiagonalTileArea (TileIndex start, TileIndex end)
| Create a diagonal tile area from two corners.
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?

## 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

  tile | The base tile.
  a | The "x" extent.
  b | The "y" extent.

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

  start | First corner of the area.
  end | Second corner of the area.

Definition at line 172 of file tilearea.cpp.

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

## Member Function Documentation

## ◆ Clear()

void DiagonalTileArea::Clear | ( |  | ) |
| inline

Clears the TileArea by making the tile invalid and setting a and b to 0.

Definition at line 91 of file tilearea_type.h.

References INVALID_TILE.

## ◆ Contains()

bool DiagonalTileArea::Contains | ( | TileIndex | tile | ) | const

Does this tile area contain a tile?

Parameters

  tile | Tile 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().

## Field Documentation

## ◆ a

int16_t DiagonalTileArea::a

Extent in diagonal "x" direction (may be negative to signify the area stretches to the left)

Definition at line 73 of file tilearea_type.h.

Referenced by Contains(), and DiagonalTileArea().

## ◆ b

int16_t DiagonalTileArea::b

Extent in diagonal "y" direction (may be negative to signify the area stretches upwards)

Definition at line 74 of file tilearea_type.h.

Referenced by Contains(), and DiagonalTileArea().

## ◆ tile

TileIndex DiagonalTileArea::tile

Base tile of the area.

Definition at line 72 of file tilearea_type.h.

Referenced by Contains().

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

- src/tilearea_type.h
- src/tilearea.cpp