# AITileList Class Reference
[Classes that create a list of items.]

Creates an empty list, in which you can add tiles. More...

`#include <ai_tilelist.hpp>`

Inheritance diagram for AITileList:

## Public Member Functions
void | AddRectangle (TileIndex tile_from, TileIndex tile_to)
| Adds the rectangle between tile_from and tile_to to the to-be-evaluated tiles.
void | AddTile (TileIndex tile)
| Add a tile to the to-be-evaluated tiles.
void | RemoveRectangle (TileIndex tile_from, TileIndex tile_to)
| Remove the tiles inside the rectangle between tile_from and tile_to form the list.
void | RemoveTile (TileIndex tile)
| Remove a tile from the list.
## Static Public Member Functions
static const char * | GetClassName ()
## Private Member Functions
void | FixRectangleSpan (TileIndex &t1, TileIndex &t2)
| Make sure t1.x is smaller than t2.x and t1.y is smaller than t2.y.

## Detailed Description

Creates an empty list, in which you can add tiles.

Definition at line 15 of file ai_tilelist.hpp.

## Member Function Documentation

void AITileList::FixRectangleSpan | ( | TileIndex & | t1,
|  | TileIndex & | t2 |
| ) |  |  | `[private]`

Make sure t1.x is smaller than t2.x and t1.y is smaller than t2.y.

They are swapped to ensure they are after calling this function.

Parameters:

  | t1 | one of the corners of the rectangle.
  | t2 | the other corner of the rectangle.

Definition at line 12 of file ai_tilelist.cpp.

References Swap(), TileX(), TileXY(), and TileY().

Referenced by AddRectangle(), and RemoveRectangle().

void AITileList::AddRectangle | ( | TileIndex | tile_from,
|  | TileIndex | tile_to |
| ) |  |  |

Adds the rectangle between tile_from and tile_to to the to-be-evaluated tiles.

Parameters:

  | tile_from | One corner of the tiles to add.
  | tile_to | The other corner of the tiles to add.

Precondition:
  AIMap::IsValidTile(tile_from).

  AIMap::IsValidTile(tile_to).

Definition at line 27 of file ai_tilelist.cpp.

References AIAbstractList::AddItem(), BEGIN_TILE_LOOP, END_TILE_LOOP, FixRectangleSpan(), IsValidTile(), TileX(), and TileY().

void AITileList::AddTile | ( | TileIndex | tile | ) |

Add a tile to the to-be-evaluated tiles.

Parameters:

  | tile | The tile to add.

Precondition:
  AIMap::IsValidTile(tile).

Definition at line 42 of file ai_tilelist.cpp.

References AIAbstractList::AddItem(), and IsValidTile().

Referenced by AITileList_IndustryAccepting::AITileList_IndustryAccepting(), AITileList_IndustryProducing::AITileList_IndustryProducing(), and AITileList_StationType::AITileList_StationType().

void AITileList::RemoveRectangle | ( | TileIndex | tile_from,
|  | TileIndex | tile_to |
| ) |  |  |

Remove the tiles inside the rectangle between tile_from and tile_to form the list.

Parameters:

  | tile_from | One corner of the tiles to remove.
  | tile_to | The other corner of the files to remove.

Precondition:
  AIMap::IsValidTile(tile_from).

  AIMap::IsValidTile(tile_to).

Definition at line 49 of file ai_tilelist.cpp.

References BEGIN_TILE_LOOP, END_TILE_LOOP, FixRectangleSpan(), IsValidTile(), AIAbstractList::RemoveItem(), TileX(), and TileY().

void AITileList::RemoveTile | ( | TileIndex | tile | ) |

Remove a tile from the list.

Parameters:

  | tile | The tile to remove.

Precondition:
  AIMap::IsValidTile(tile).

Definition at line 64 of file ai_tilelist.cpp.

References IsValidTile(), and AIAbstractList::RemoveItem().

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

- src/ai/api/ai_tilelist.hpp
- src/ai/api/ai_tilelist.cpp