56 event_handler(
const std::string& types,
const std::string&
id =
"");
92 const std::string&
id()
const 101 return !first_time_only_;
107 void write_config(
config& cfg,
bool include_nonserializable =
false)
const;
111 first_time_only_ = !repeat;
124 void read_filters(
const config& cfg);
125 void add_filter(std::unique_ptr<event_filter>&& filter);
128 void set_event_ref(
int idx,
bool has_preloaded);
153 std::vector<std::shared_ptr<event_filter>>
filters_;
bool is_lua_
Tracks whether the event was registered from the Lua API.
virtual void serialize(config &cfg) const
Serializes the filter into a config, if possible.
Definitions for the interface to Wesnoth Markup Language (WML).
void set_arguments(const config &cfg)
event_filter & operator=(const event_filter &)=delete
virtual ~event_filter()=default
bool has_preloaded_
Tracks whether the event was registered before or after the Lua preload event fired.
virtual bool can_serialize() const
Returns true if it is possible to serialize the filter into a config.
std::vector< std::shared_ptr< event_filter > > filters_
const std::string & names_raw() const
const std::string & id() const
virtual bool operator()(const queued_event &event_info) const =0
Runs the filter and returns whether it passes on the given event.
void set_menu_item(bool imi)
void set_repeatable(bool repeat=true)
std::vector< std::string > names
Represents a single filter condition on an event.
A config object defines a single node in a WML file, with access to child nodes.
bool is_menu_item() const
const config & arguments() const