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_townlist.hpp List all the towns. */
10 #ifndef SCRIPT_TOWNLIST_HPP
11 #define SCRIPT_TOWNLIST_HPP
13 #include "script_list.hpp"
16 * Creates a list of towns that are currently on the map.
20 class ScriptTownList
: 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 bribeable_towns = ScriptTownList(ScriptTown.IsActionAvailable, ScriptTown.TOWN_ACTION_BRIBE);
37 * function MinPopulation(town_id, pop)
39 * return ScriptTown.GetPopulation(town_id) >= pop;
41 * local proper_towns = ScriptTownList(MinPopulation, 1000);
44 ScriptTownList(function filter_function
, ...);
46 ScriptTownList(HSQUIRRELVM vm
);
47 #endif /* DOXYGEN_API */
51 * Creates a list of all TownEffects known in the game.
55 class ScriptTownEffectList
: public ScriptList
{
57 ScriptTownEffectList();
60 #endif /* SCRIPT_TOWNLIST_HPP */