Update: Translations from eints
[openttd-github.git] / src / script / api / script_grouplist.hpp
blobc4b2bb4fcc25e97d0d4793d1514d1a35b9cb72cf
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_grouplist.hpp List all the groups (you own). */
10 #ifndef SCRIPT_GROUPLIST_HPP
11 #define SCRIPT_GROUPLIST_HPP
13 #include "script_list.hpp"
15 /**
16 * Creates a list of groups of which you are the owner.
17 * @note Neither ScriptGroup::GROUP_ALL nor ScriptGroup::GROUP_DEFAULT is in this list.
18 * @api ai game
19 * @ingroup ScriptList
21 class ScriptGroupList : public ScriptList {
22 public:
23 #ifdef DOXYGEN_API
24 /**
25 * @game @pre ScriptCompanyMode::IsValid().
27 ScriptGroupList();
29 /**
30 * Apply a filter when building the list.
31 * @param filter_function The function which will be doing the filtering.
32 * @param ... The params to give to the filters (minus the first param,
33 * which is always the index-value).
34 * @game @pre ScriptCompanyMode::IsValid().
35 * @note You can write your own filters and use them. Just remember that
36 * the first parameter should be the index-value, and it should return
37 * a bool.
38 * @note Example:
39 * @code
40 * function IsType(group_id, type)
41 * {
42 * return ScriptGroup.GetVehicleType(group_id) == type;
43 * }
44 * local rv_groups = ScriptGroupList(IsType, ScriptVehicle.VT_ROAD);
45 * @endcode
47 ScriptGroupList(function filter_function, ...);
48 #else
49 /**
50 * The constructor wrapper from Squirrel.
52 ScriptGroupList(HSQUIRRELVM vm);
53 #endif /* DOXYGEN_API */
56 #endif /* SCRIPT_GROUPLIST_HPP */