Update: Translations from eints
[openttd-github.git] / src / script / api / script_stationlist.hpp
blob8628dbb4a3f440ade9f92d9560b1b28dfffbd5fe
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
8 /** @file script_stationlist.hpp List all the stations (you own). */
10 #ifndef SCRIPT_STATIONLIST_HPP
11 #define SCRIPT_STATIONLIST_HPP
13 #include "script_list.hpp"
14 #include "script_station.hpp"
16 /**
17 * Creates a list of stations of which you are the owner.
18 * @api ai game
19 * @ingroup ScriptList
21 class ScriptStationList : public ScriptList {
22 public:
23 /**
24 * @param station_type The type of station to make a list of stations for.
26 ScriptStationList(ScriptStation::StationType station_type);
29 /**
30 * Creates a list of stations associated with cargo at a station. This is very generic. Use the
31 * subclasses for all practical purposes.
32 * @api ai game
33 * @ingroup ScriptList
35 class ScriptStationList_Cargo : public ScriptList {
36 public:
37 /**
38 * Criteria of selecting and grouping cargo at a station.
40 enum CargoSelector {
41 CS_BY_FROM, ///< Group by origin station.
42 CS_VIA_BY_FROM, ///< Select by next hop and group by origin station.
43 CS_BY_VIA, ///< Group by next hop.
44 CS_FROM_BY_VIA ///< Select by origin station and group by next hop.
47 /**
48 * Ways of associating cargo to stations.
50 enum CargoMode {
51 CM_WAITING, ///< Waiting cargo.
52 CM_PLANNED ///< Planned cargo.
55 /**
56 * Creates a list of stations associated with cargo in the specified way, selected and grouped
57 * by the chosen criteria.
58 * @param mode Mode of association, either waiting cargo or planned cargo.
59 * @param selector Mode of grouping and selecting to be applied.
60 * @param station_id Station to be queried.
61 * @param cargo Cargo type to query for.
62 * @param other_station Other station to restrict the query with.
64 ScriptStationList_Cargo(ScriptStationList_Cargo::CargoMode mode, ScriptStationList_Cargo::CargoSelector selector, StationID station_id, CargoID cargo, StationID other_station);
66 protected:
68 /**
69 * Creates an empty list.
71 ScriptStationList_Cargo() {}
74 /**
75 * Creates a list of stations associated with cargo waiting at a station. This is very generic. Use
76 * the subclasses for all practical purposes.
77 * @api ai game
78 * @ingroup ScriptList
80 class ScriptStationList_CargoWaiting : public ScriptStationList_Cargo {
81 protected:
82 friend class ScriptStationList_Cargo;
84 /**
85 * Creates an empty list.
87 ScriptStationList_CargoWaiting() {}
89 /**
90 * Add waiting cargo to the list.
91 * @param station_id Station to query for waiting cargo.
92 * @param cargo Cargo type to query for.
93 * @param other_station Other station to restrict the query with.
95 template<CargoSelector Tselector>
96 void Add(StationID station_id, CargoID cargo, StationID other_station = INVALID_STATION);
98 public:
101 * Creates a list of stations associated with waiting cargo, selected and grouped by the chosen
102 * criteria.
103 * @param selector Mode of grouping and selecting to be applied.
104 * @param station_id Station to be queried.
105 * @param cargo Cargo type to query for.
106 * @param other_station Other station to restrict the query with.
108 ScriptStationList_CargoWaiting(ScriptStationList_Cargo::CargoSelector selector, StationID station_id, CargoID cargo, StationID other_station);
112 * Creates a list of stations associated with cargo planned to pass a station. This is very
113 * generic. Use the subclasses for all practical purposes.
114 * @api ai game
115 * @ingroup ScriptList
117 class ScriptStationList_CargoPlanned : public ScriptStationList_Cargo {
118 protected:
119 friend class ScriptStationList_Cargo;
122 * Creates an empty list.
124 ScriptStationList_CargoPlanned() {}
127 * Add planned cargo to the list.
128 * @param station_id Station to query for waiting cargo.
129 * @param cargo Cargo type to query for.
130 * @param other_station Other station to restrict the query with.
132 template<CargoSelector Tselector>
133 void Add(StationID station_id, CargoID cargo, StationID other_station = INVALID_STATION);
135 public:
138 * Creates a list of stations associated with cargo planned to pass the station, selected and
139 * grouped by the chosen criteria.
140 * @param selector Mode of grouping and selecting to be applied.
141 * @param station_id Station to be queried.
142 * @param cargo Cargo type to query for.
143 * @param other_station Other station to restrict the query with.
145 ScriptStationList_CargoPlanned(ScriptStationList_Cargo::CargoSelector selector, StationID station_id, CargoID cargo, StationID other_station);
149 * Creates a list of origin stations of waiting cargo at a station, with the amounts of cargo
150 * waiting from each of those origin stations as values.
151 * @api ai game
152 * @ingroup ScriptList
154 class ScriptStationList_CargoWaitingByFrom : public ScriptStationList_CargoWaiting {
155 public:
157 * @param station_id Station to query for waiting cargo.
158 * @param cargo Cargo type to query for.
160 ScriptStationList_CargoWaitingByFrom(StationID station_id, CargoID cargo);
164 * Creates a list of origin stations of cargo waiting at a station for a transfer via another
165 * station, with the amounts of cargo waiting from each of those origin stations as values.
166 * @api ai game
167 * @ingroup ScriptList
169 class ScriptStationList_CargoWaitingViaByFrom : public ScriptStationList_CargoWaiting {
170 public:
172 * @param station_id Station to query for waiting cargo.
173 * @param cargo Cargo type to query for.
174 * @param via Next hop to restrict the query with.
176 ScriptStationList_CargoWaitingViaByFrom(StationID station_id, CargoID cargo, StationID via);
180 * Creates a list of next hops of waiting cargo at a station, with the amounts of cargo waiting for
181 * each of those next hops as values.
182 * @api ai game
183 * @ingroup ScriptList
185 class ScriptStationList_CargoWaitingByVia : public ScriptStationList_CargoWaiting {
186 public:
188 * @param station_id Station to query for waiting cargo.
189 * @param cargo Cargo type to query for.
191 ScriptStationList_CargoWaitingByVia(StationID station_id, CargoID cargo);
195 * Creates a list of next hops of waiting cargo from a specific station at another station, with
196 * the amounts of cargo waiting for each of those next hops as values.
197 * @api ai game
198 * @ingroup ScriptList
200 class ScriptStationList_CargoWaitingFromByVia : public ScriptStationList_CargoWaiting {
201 public:
203 * @param station_id Station to query for waiting cargo.
204 * @param cargo Cargo type to query for.
205 * @param from Origin station to restrict the query with.
207 ScriptStationList_CargoWaitingFromByVia(StationID station_id, CargoID cargo, StationID from);
211 * Creates a list of origin stations of cargo planned to pass a station, with the monthly amounts
212 * of cargo planned for each of those origin stations as values.
213 * @api ai game
214 * @ingroup ScriptList
216 class ScriptStationList_CargoPlannedByFrom : public ScriptStationList_CargoPlanned {
217 public:
219 * @param station_id Station to query for planned flows.
220 * @param cargo Cargo type to query for.
222 ScriptStationList_CargoPlannedByFrom(StationID station_id, CargoID cargo);
226 * Creates a list of origin stations of cargo planned to pass a station going via another station,
227 * with the monthly amounts of cargo planned for each of those origin stations as values.
228 * @api ai game
229 * @ingroup ScriptList
231 class ScriptStationList_CargoPlannedViaByFrom : public ScriptStationList_CargoPlanned {
232 public:
234 * @param station_id Station to query for planned flows.
235 * @param cargo Cargo type to query for.
236 * @param via Next hop to restrict the query with.
238 ScriptStationList_CargoPlannedViaByFrom(StationID station_id, CargoID cargo, StationID via);
242 * Creates a list of next hops of cargo planned to pass a station, with the monthly amounts of
243 * cargo planned for each of those next hops as values.
244 * Cargo planned to go "via" the station being queried will actually be delivered there.
245 * @api ai game
246 * @ingroup ScriptList
248 class ScriptStationList_CargoPlannedByVia : public ScriptStationList_CargoPlanned {
249 public:
251 * @param station_id Station to query for planned flows.
252 * @param cargo Cargo type to query for.
254 ScriptStationList_CargoPlannedByVia(StationID station_id, CargoID cargo);
258 * Creates a list of next hops of cargo planned to pass a station and originating from another
259 * station, with the monthly amounts of cargo planned for each of those next hops as values.
260 * Cargo planned to go "via" the station being queried will actually be delivered there.
261 * @api ai game
262 * @ingroup ScriptList
264 class ScriptStationList_CargoPlannedFromByVia : public ScriptStationList_CargoPlanned {
265 public:
267 * @param station_id Station to query for planned flows.
268 * @param cargo Cargo type to query for.
269 * @param from Origin station to restrict the query with.
271 ScriptStationList_CargoPlannedFromByVia(StationID station_id, CargoID cargo, StationID from);
275 * Creates a list of stations which the vehicle has in its orders.
276 * @api ai game
277 * @ingroup ScriptList
279 class ScriptStationList_Vehicle : public ScriptList {
280 public:
282 * @param vehicle_id The vehicle to get the list of stations it has in its orders from.
284 ScriptStationList_Vehicle(VehicleID vehicle_id);
287 #endif /* SCRIPT_STATIONLIST_HPP */