OpenTTD AI API  20240418-master-gc355e98c58
Public Member Functions
AITileList Class Reference

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

Inheritance diagram for AITileList:
AIList AITileList_IndustryAccepting AITileList_IndustryProducing AITileList_StationCoverage AITileList_StationType

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. More...
 
void AddTile (TileIndex tile)
 Add a tile to the to-be-evaluated tiles. More...
 
void RemoveRectangle (TileIndex tile_from, TileIndex tile_to)
 Remove the tiles inside the rectangle between tile_from and tile_to from the list. More...
 
void RemoveTile (TileIndex tile)
 Remove a tile from the list. More...
 
- Public Member Functions inherited from AIList
void AddItem (SQInteger item, SQInteger value)
 Add a single item to the list. More...
 
void RemoveItem (SQInteger item)
 Remove a single item from the list. More...
 
void Clear ()
 Clear the list, making Count() returning 0 and IsEmpty() returning true.
 
bool HasItem (SQInteger item)
 Check if an item is in the list. More...
 
SQInteger Begin ()
 Go to the beginning of the list and return the item. More...
 
SQInteger Next ()
 Go to the next item in the list and return the item. More...
 
bool IsEmpty ()
 Check if a list is empty. More...
 
bool IsEnd ()
 Check if there is a element left. More...
 
SQInteger Count ()
 Returns the amount of items in the list. More...
 
SQInteger GetValue (SQInteger item)
 Get the value that belongs to this item. More...
 
bool SetValue (SQInteger item, SQInteger value)
 Set a value of an item directly. More...
 
void Sort (SorterType sorter, bool ascending)
 Sort this list by the given sorter and direction. More...
 
void AddList (AIList *list)
 Add one list to another one. More...
 
void SwapList (AIList *list)
 Swap the contents of two lists. More...
 
void RemoveAboveValue (SQInteger value)
 Removes all items with a higher value than 'value'. More...
 
void RemoveBelowValue (SQInteger value)
 Removes all items with a lower value than 'value'. More...
 
void RemoveBetweenValue (SQInteger start, SQInteger end)
 Removes all items with a value above start and below end. More...
 
void RemoveValue (SQInteger value)
 Remove all items with this value. More...
 
void RemoveTop (SQInteger count)
 Remove the first count items. More...
 
void RemoveBottom (SQInteger count)
 Remove the last count items. More...
 
void RemoveList (AIList *list)
 Remove everything that is in the given list from this list (same item index that is). More...
 
void KeepAboveValue (SQInteger value)
 Keep all items with a higher value than 'value'. More...
 
void KeepBelowValue (SQInteger value)
 Keep all items with a lower value than 'value'. More...
 
void KeepBetweenValue (SQInteger start, SQInteger end)
 Keep all items with a value above start and below end. More...
 
void KeepValue (SQInteger value)
 Keep all items with this value. More...
 
void KeepTop (SQInteger count)
 Keep the first count items, i.e. More...
 
void KeepBottom (SQInteger count)
 Keep the last count items, i.e. More...
 
void KeepList (AIList *list)
 Keeps everything that is in the given list from this list (same item index that is). More...
 
void Valuate (void *valuator_function, int params,...)
 Give all items a value defined by the valuator you give. More...
 

Additional Inherited Members

- Public Types inherited from AIList
enum  SorterType {
  SORT_BY_VALUE,
  SORT_BY_ITEM
}
 Type of sorter. More...
 
- Static Public Attributes inherited from AIList
static const bool SORT_ASCENDING = true
 Sort ascending.
 
static const bool SORT_DESCENDING = false
 Sort descending.
 

Detailed Description

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

Member Function Documentation

◆ AddRectangle()

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_fromOne corner of the tiles to add.
tile_toThe other corner of the tiles to add.
Precondition
AIMap::IsValidTile(tile_from).
AIMap::IsValidTile(tile_to).

◆ AddTile()

void AITileList::AddTile ( TileIndex  tile)

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

Parameters
tileThe tile to add.
Precondition
AIMap::IsValidTile(tile).

◆ RemoveRectangle()

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

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

Parameters
tile_fromOne corner of the tiles to remove.
tile_toThe other corner of the files to remove.
Precondition
AIMap::IsValidTile(tile_from).
AIMap::IsValidTile(tile_to).

◆ RemoveTile()

void AITileList::RemoveTile ( TileIndex  tile)

Remove a tile from the list.

Parameters
tileThe tile to remove.
Precondition
AIMap::IsValidTile(tile).