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/>.
8 /** @file script_industrylist.hpp List all the industries. */
10 #ifndef SCRIPT_INDUSTRYLIST_HPP
11 #define SCRIPT_INDUSTRYLIST_HPP
13 #include "script_list.hpp"
16 * Creates a list of industries that are currently on the map.
20 class ScriptIndustryList
: public ScriptList
{
26 * Apply a filter when building the list.
27 * @param filter_function The function which will be doing the filtering.
28 * @param ... The params to give to the filters (minus the first param,
29 * which is always the index-value).
30 * @note You can write your own filters and use them. Just remember that
31 * the first parameter should be the index-value, and it should return
35 * local water_industries = ScriptIndustryList(ScriptIndustry.HasDock);
37 * function IsType(industry_id, type)
39 * return ScriptIndustry.GetIndustryType(industry_id) == type;
41 * local industries = ScriptIndustryList(IsType, 0);
44 ScriptIndustryList(function filter_function
, ...);
47 * The constructor wrapper from Squirrel.
49 ScriptIndustryList(HSQUIRRELVM vm
);
50 #endif /* DOXYGEN_API */
54 * Creates a list of industries that accepts a given cargo.
58 class ScriptIndustryList_CargoAccepting
: public ScriptList
{
61 * @param cargo_id The cargo this industry should accept.
63 ScriptIndustryList_CargoAccepting(CargoID cargo_id
);
67 * Creates a list of industries that can produce a given cargo.
68 * @note It also contains industries that currently produces 0 units of the cargo.
72 class ScriptIndustryList_CargoProducing
: public ScriptList
{
75 * @param cargo_id The cargo this industry should produce.
77 ScriptIndustryList_CargoProducing(CargoID cargo_id
);
80 #endif /* SCRIPT_INDUSTRYLIST_HPP */