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_grouplist.hpp List all the groups (you own). */
10 #ifndef SCRIPT_GROUPLIST_HPP
11 #define SCRIPT_GROUPLIST_HPP
13 #include "script_list.hpp"
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.
21 class ScriptGroupList
: public ScriptList
{
25 * @game @pre ScriptCompanyMode::IsValid().
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
40 * function IsType(group_id, type)
42 * return ScriptGroup.GetVehicleType(group_id) == type;
44 * local rv_groups = ScriptGroupList(IsType, ScriptVehicle.VT_ROAD);
47 ScriptGroupList(function filter_function
, ...);
50 * The constructor wrapper from Squirrel.
52 ScriptGroupList(HSQUIRRELVM vm
);
53 #endif /* DOXYGEN_API */
56 #endif /* SCRIPT_GROUPLIST_HPP */