55 event_handler(
const std::string& types,
const std::string&
id =
"");
91 const std::string&
id()
const
133 void add_filter(std::unique_ptr<event_filter>&& filter);
162 std::vector<std::shared_ptr<event_filter>>
filters_;
A config object defines a single node in a WML file, with access to child nodes.
void set_arguments(const config &cfg)
bool has_preloaded_
Tracks whether the event was registered before or after the Lua preload event fired.
void register_wml_event(game_lua_kernel &lk)
void add_filter(std::unique_ptr< event_filter > &&filter)
void read_filters(const config &cfg)
void write_config(config &cfg, bool include_nonserializable=false) const
const std::string & id() const
std::vector< std::string > names(const variable_set *vars) const
const config & arguments() const
void set_event_ref(int idx, bool has_preloaded)
void set_menu_item(bool imi)
void set_priority(double priority)
bool is_menu_item() const
void disable()
Flag this handler as disabled.
event_handler(const std::string &types, const std::string &id="")
bool filter_event(const queued_event &event_info) const
bool is_lua_
Tracks whether the event was registered from the Lua API.
const std::string & names_raw() const
std::vector< std::shared_ptr< event_filter > > filters_
const double & priority() const
void set_repeatable(bool repeat=true)
void handle_event(const queued_event &event_info, game_lua_kernel &lk)
Handles the queued event, according to our WML instructions.
Definitions for the interface to Wesnoth Markup Language (WML).
Represents a single filter condition on an event.
event_filter & operator=(const event_filter &)=delete
virtual void serialize(config &cfg) const
Serializes the filter into a config, if possible.
virtual ~event_filter()=default
virtual bool can_serialize() const
Returns true if it is possible to serialize the filter into a config.
virtual bool operator()(const queued_event &event_info) const =0
Runs the filter and returns whether it passes on the given event.
event_filter(const event_filter &)=delete