2009-08-21 22:21:05 +02:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2011-11-30 00:07:38 +01:00
|
|
|
/** @file script_townlist.hpp List all the towns. */
|
2009-01-12 18:11:45 +01:00
|
|
|
|
2011-11-30 00:07:38 +01:00
|
|
|
#ifndef SCRIPT_TOWNLIST_HPP
|
|
|
|
#define SCRIPT_TOWNLIST_HPP
|
2009-01-12 18:11:45 +01:00
|
|
|
|
2011-11-30 00:07:38 +01:00
|
|
|
#include "script_list.hpp"
|
2009-01-12 18:11:45 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a list of towns that are currently on the map.
|
2011-12-19 21:57:23 +01:00
|
|
|
* @api ai game
|
2011-11-30 00:15:35 +01:00
|
|
|
* @ingroup ScriptList
|
2009-01-12 18:11:45 +01:00
|
|
|
*/
|
2011-11-30 00:15:35 +01:00
|
|
|
class ScriptTownList : public ScriptList {
|
2009-01-12 18:11:45 +01:00
|
|
|
public:
|
2024-01-09 09:39:13 +01:00
|
|
|
#ifdef DOXYGEN_API
|
2011-11-30 00:15:35 +01:00
|
|
|
ScriptTownList();
|
2024-01-09 09:39:13 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Apply a filter when building the list.
|
|
|
|
* @param filter_function The function which will be doing the filtering.
|
|
|
|
* @param params The params to give to the filters (minus the first param,
|
|
|
|
* which is always the index-value).
|
|
|
|
* @note You can write your own filters and use them. Just remember that
|
|
|
|
* the first parameter should be the index-value, and it should return
|
|
|
|
* a bool.
|
|
|
|
* @note Example:
|
|
|
|
* ScriptTownList(ScriptTown.IsActionAvailable, ScriptTown.TOWN_ACTION_BRIBE);
|
|
|
|
* function MinPopulation(town_id, pop)
|
|
|
|
* {
|
|
|
|
* return ScriptTown.GetPopulation(town_id) >= pop;
|
|
|
|
* }
|
|
|
|
* ScriptTownList(MinPopulation, 1000);
|
|
|
|
*/
|
|
|
|
ScriptTownList(void *filter_function, int params, ...);
|
|
|
|
#else
|
|
|
|
ScriptTownList(HSQUIRRELVM vm);
|
|
|
|
#endif /* DOXYGEN_API */
|
2009-01-12 18:11:45 +01:00
|
|
|
};
|
|
|
|
|
2011-11-23 17:09:46 +01:00
|
|
|
/**
|
|
|
|
* Creates a list of all TownEffects known in the game.
|
2011-12-19 21:57:23 +01:00
|
|
|
* @api ai game
|
2011-11-30 00:15:35 +01:00
|
|
|
* @ingroup ScriptList
|
2011-11-23 17:09:46 +01:00
|
|
|
*/
|
2011-11-30 00:15:35 +01:00
|
|
|
class ScriptTownEffectList : public ScriptList {
|
2011-11-23 17:09:46 +01:00
|
|
|
public:
|
2011-11-30 00:15:35 +01:00
|
|
|
ScriptTownEffectList();
|
2011-11-23 17:09:46 +01:00
|
|
|
};
|
|
|
|
|
2011-11-30 00:07:38 +01:00
|
|
|
#endif /* SCRIPT_TOWNLIST_HPP */
|