|
OpenTTD AI API 20251102-master-g9001d4a884
|
Creates a list of stations associated with cargo at a station. More...
#include <script_stationlist.hpp>
Public Types | |
| enum | CargoSelector { CS_BY_FROM , CS_VIA_BY_FROM , CS_BY_VIA , CS_FROM_BY_VIA } |
| Criteria of selecting and grouping cargo at a station. More... | |
| enum | CargoMode { CM_WAITING , CM_PLANNED } |
| Ways of associating cargo to stations. More... | |
Public Types inherited from AIList | |
| enum | SorterType { SORT_BY_VALUE , SORT_BY_ITEM } |
| Type of sorter. More... | |
Public Member Functions | |
| AIStationList_Cargo (AIStationList_Cargo::CargoMode mode, AIStationList_Cargo::CargoSelector selector, StationID station_id, CargoType cargo, StationID other_station) | |
| Creates a list of stations associated with cargo in the specified way, selected and grouped by the chosen criteria. | |
Public Member Functions inherited from AIList | |
| void | AddItem (int item, int value) |
| Add a single item to the list. | |
| void | RemoveItem (int item) |
| Remove a single item from the list. | |
| void | Clear () |
| Clear the list, making Count() returning 0 and IsEmpty() returning true. | |
| bool | HasItem (int item) |
| Check if an item is in the list. | |
| int | Begin () |
| Go to the beginning of the list and return the item. | |
| int | Next () |
| Go to the next item in the list and return the item. | |
| bool | IsEmpty () |
| Check if a list is empty. | |
| bool | IsEnd () |
| Check if there is a element left. | |
| int | Count () |
| Returns the amount of items in the list. | |
| int | GetValue (int item) |
| Get the value that belongs to this item. | |
| bool | SetValue (int item, int value) |
| Set a value of an item directly. | |
| void | Sort (SorterType sorter, bool ascending) |
| Sort this list by the given sorter and direction. | |
| void | AddList (AIList *list) |
| Add one list to another one. | |
| void | SwapList (AIList *list) |
| Swap the contents of two lists. | |
| void | RemoveAboveValue (int value) |
| Removes all items with a higher value than 'value'. | |
| void | RemoveBelowValue (int value) |
| Removes all items with a lower value than 'value'. | |
| void | RemoveBetweenValue (int start, int end) |
| Removes all items with a value above start and below end. | |
| void | RemoveValue (int value) |
| Remove all items with this value. | |
| void | RemoveTop (int count) |
| Remove the first count items. | |
| void | RemoveBottom (int count) |
| Remove the last count items. | |
| void | RemoveList (AIList *list) |
| Remove everything that is in the given list from this list (same item index that is). | |
| void | KeepAboveValue (int value) |
| Keep all items with a higher value than 'value'. | |
| void | KeepBelowValue (int value) |
| Keep all items with a lower value than 'value'. | |
| void | KeepBetweenValue (int start, int end) |
| Keep all items with a value above start and below end. | |
| void | KeepValue (int value) |
| Keep all items with this value. | |
| void | KeepTop (int count) |
| Keep the first count items, i.e. | |
| void | KeepBottom (int count) |
| Keep the last count items, i.e. | |
| void | KeepList (AIList *list) |
| Keeps everything that is in the given list from this list (same item index that is). | |
| void | Valuate (function valuator_function,...) |
| Give all items a value defined by the valuator you give. | |
Additional Inherited Members | |
Static Public Attributes inherited from AIList | |
| static const bool | SORT_ASCENDING = true |
| Sort ascending. | |
| static const bool | SORT_DESCENDING = false |
| Sort descending. | |
Creates a list of stations associated with cargo at a station.
This is very generic. Use the subclasses for all practical purposes.
| AIStationList_Cargo::AIStationList_Cargo | ( | AIStationList_Cargo::CargoMode | mode, |
| AIStationList_Cargo::CargoSelector | selector, | ||
| StationID | station_id, | ||
| CargoType | cargo, | ||
| StationID | other_station | ||
| ) |
Creates a list of stations associated with cargo in the specified way, selected and grouped by the chosen criteria.
| mode | Mode of association, either waiting cargo or planned cargo. |
| selector | Mode of grouping and selecting to be applied. |
| station_id | Station to be queried. |
| cargo | Cargo type to query for. |
| other_station | Other station to restrict the query with. |