1 /* $Id: script_stationlist.hpp 23615 2011-12-19 20:57:34Z truebrain $ */
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
10 /** @file script_stationlist.hpp List all the stations (you own). */
12 #ifndef SCRIPT_STATIONLIST_HPP
13 #define SCRIPT_STATIONLIST_HPP
15 #include "script_list.hpp"
16 #include "script_station.hpp"
19 * Creates a list of stations of which you are the owner.
23 class ScriptStationList
: public ScriptList
{
26 * @param station_type The type of station to make a list of stations for.
28 ScriptStationList(ScriptStation::StationType station_type
);
32 * Creates a list of stations associated with cargo at a station. This is very generic. Use the
33 * subclasses for all practical purposes.
37 class ScriptStationList_Cargo
: public ScriptList
{
40 * Criteria of selecting and grouping cargo at a station.
43 CS_BY_FROM
, ///< Group by origin station.
44 CS_VIA_BY_FROM
, ///< Select by next hop and group by origin station.
45 CS_BY_VIA
, ///< Group by next hop.
46 CS_FROM_BY_VIA
///< Select by origin station and group by next hop.
50 * Ways of associating cargo to stations.
53 CM_WAITING
, ///< Waiting cargo.
54 CM_PLANNED
///< Planned cargo.
58 * Creates a list of stations associated with cargo in the specified way, selected and grouped
59 * by the chosen criteria.
60 * @param mode Mode of association, either waiting cargo or planned cargo.
61 * @param selector Mode of grouping and selecting to be applied.
62 * @param station_id Station to be queried.
63 * @param cargo Cargo type to query for.
64 * @param other_station Other station to restrict the query with.
66 ScriptStationList_Cargo(ScriptStationList_Cargo::CargoMode mode
, ScriptStationList_Cargo::CargoSelector selector
, StationID station_id
, CargoID cargo
, StationID other_station
);
71 * Creates an empty list.
73 ScriptStationList_Cargo() {}
77 * Creates a list of stations associated with cargo waiting at a station. This is very generic. Use
78 * the subclasses for all practical purposes.
82 class ScriptStationList_CargoWaiting
: public ScriptStationList_Cargo
{
84 friend class ScriptStationList_Cargo
;
87 * Creates an empty list.
89 ScriptStationList_CargoWaiting() {}
92 * Add waiting cargo to the list.
93 * @param station_id Station to query for waiting cargo.
94 * @param cargo Cargo type to query for.
95 * @param other_station Other station to restrict the query with.
97 template<CargoSelector Tselector
>
98 void Add(StationID station_id
, CargoID cargo
, StationID other_station
= INVALID_STATION
);
103 * Creates a list of stations associated with waiting cargo, selected and grouped by the chosen
105 * @param selector Mode of grouping and selecting to be applied.
106 * @param station_id Station to be queried.
107 * @param cargo Cargo type to query for.
108 * @param other_station Other station to restrict the query with.
110 ScriptStationList_CargoWaiting(ScriptStationList_Cargo::CargoSelector selector
, StationID station_id
, CargoID cargo
, StationID other_station
);
114 * Creates a list of stations associated with cargo planned to pass a station. This is very
115 * generic. Use the subclasses for all practical purposes.
117 * @ingroup ScriptList
119 class ScriptStationList_CargoPlanned
: public ScriptStationList_Cargo
{
121 friend class ScriptStationList_Cargo
;
124 * Creates an empty list.
126 ScriptStationList_CargoPlanned() {}
129 * Add planned cargo to the list.
130 * @param station_id Station to query for waiting cargo.
131 * @param cargo Cargo type to query for.
132 * @param other_station Other station to restrict the query with.
134 template<CargoSelector Tselector
>
135 void Add(StationID station_id
, CargoID cargo
, StationID other_station
= INVALID_STATION
);
140 * Creates a list of stations associated with cargo planned to pass the station, selected and
141 * grouped by the chosen criteria.
142 * @param selector Mode of grouping and selecting to be applied.
143 * @param station_id Station to be queried.
144 * @param cargo Cargo type to query for.
145 * @param other_station Other station to restrict the query with.
147 ScriptStationList_CargoPlanned(ScriptStationList_Cargo::CargoSelector selector
, StationID station_id
, CargoID cargo
, StationID other_station
);
151 * Creates a list of origin stations of waiting cargo at a station, with the amounts of cargo
152 * waiting from each of those origin stations as values.
154 * @ingroup ScriptList
156 class ScriptStationList_CargoWaitingByFrom
: public ScriptStationList_CargoWaiting
{
159 * @param station_id Station to query for waiting cargo.
160 * @param cargo Cargo type to query for.
162 ScriptStationList_CargoWaitingByFrom(StationID station_id
, CargoID cargo
);
166 * Creates a list of origin stations of cargo waiting at a station for a transfer via another
167 * station, with the amounts of cargo waiting from each of those origin stations as values.
169 * @ingroup ScriptList
171 class ScriptStationList_CargoWaitingViaByFrom
: public ScriptStationList_CargoWaiting
{
174 * @param station_id Station to query for waiting cargo.
175 * @param cargo Cargo type to query for.
176 * @param via Next hop to restrict the query with.
178 ScriptStationList_CargoWaitingViaByFrom(StationID station_id
, CargoID cargo
, StationID via
);
182 * Creates a list of next hops of waiting cargo at a station, with the amounts of cargo waiting for
183 * each of those next hops as values.
185 * @ingroup ScriptList
187 class ScriptStationList_CargoWaitingByVia
: public ScriptStationList_CargoWaiting
{
190 * @param station_id Station to query for waiting cargo.
191 * @param cargo Cargo type to query for.
193 ScriptStationList_CargoWaitingByVia(StationID station_id
, CargoID cargo
);
197 * Creates a list of next hops of waiting cargo from a specific station at another station, with
198 * the amounts of cargo waiting for each of those next hops as values.
200 * @ingroup ScriptList
202 class ScriptStationList_CargoWaitingFromByVia
: public ScriptStationList_CargoWaiting
{
205 * @param station_id Station to query for waiting cargo.
206 * @param cargo Cargo type to query for.
207 * @param from Origin station to restrict the query with.
209 ScriptStationList_CargoWaitingFromByVia(StationID station_id
, CargoID cargo
, StationID from
);
213 * Creates a list of origin stations of cargo planned to pass a station, with the monthly amounts
214 * of cargo planned for each of those origin stations as values.
216 * @ingroup ScriptList
218 class ScriptStationList_CargoPlannedByFrom
: public ScriptStationList_CargoPlanned
{
221 * @param station_id Station to query for planned flows.
222 * @param cargo Cargo type to query for.
224 ScriptStationList_CargoPlannedByFrom(StationID station_id
, CargoID cargo
);
228 * Creates a list of origin stations of cargo planned to pass a station going via another station,
229 * with the monthly amounts of cargo planned for each of those origin stations as values.
231 * @ingroup ScriptList
233 class ScriptStationList_CargoPlannedViaByFrom
: public ScriptStationList_CargoPlanned
{
236 * @param station_id Station to query for planned flows.
237 * @param cargo Cargo type to query for.
238 * @param via Next hop to restrict the query with.
240 ScriptStationList_CargoPlannedViaByFrom(StationID station_id
, CargoID cargo
, StationID via
);
244 * Creates a list of next hops of cargo planned to pass a station, with the monthly amounts of
245 * cargo planned for each of those next hops as values.
246 * Cargo planned to go "via" the station being queried will actually be delivered there.
248 * @ingroup ScriptList
250 class ScriptStationList_CargoPlannedByVia
: public ScriptStationList_CargoPlanned
{
253 * @param station_id Station to query for planned flows.
254 * @param cargo Cargo type to query for.
256 ScriptStationList_CargoPlannedByVia(StationID station_id
, CargoID cargo
);
260 * Creates a list of next hops of cargo planned to pass a station and originating from another
261 * station, with the monthly amounts of cargo planned for each of those next hops as values.
262 * Cargo planned to go "via" the station being queried will actually be delivered there.
264 * @ingroup ScriptList
266 class ScriptStationList_CargoPlannedFromByVia
: public ScriptStationList_CargoPlanned
{
269 * @param station_id Station to query for planned flows.
270 * @param cargo Cargo type to query for.
271 * @param from Origin station to restrict the query with.
273 ScriptStationList_CargoPlannedFromByVia(StationID station_id
, CargoID cargo
, StationID from
);
277 * Creates a list of stations which the vehicle has in its orders.
279 * @ingroup ScriptList
281 class ScriptStationList_Vehicle
: public ScriptList
{
284 * @param vehicle_id The vehicle to get the list of stations he has in its orders from.
286 ScriptStationList_Vehicle(VehicleID vehicle_id
);
289 #endif /* SCRIPT_STATIONLIST_HPP */