interface/server: emit_event(type)

This commit is contained in:
Perttu Ahola 2014-10-28 00:54:15 +02:00
parent bba9dffb49
commit 470d77cb68
2 changed files with 5 additions and 1 deletions

View File

@ -208,7 +208,7 @@ struct Module: public interface::Module
} }
}); });
m_server->emit_event(Event("worldgen:voxels_defined")); m_server->emit_event("worldgen:voxels_defined");
} }
void on_continue() void on_continue()

View File

@ -72,6 +72,10 @@ namespace interface
virtual void sub_event(struct Module *module, const Event::Type &type) = 0; virtual void sub_event(struct Module *module, const Event::Type &type) = 0;
virtual void emit_event(Event event) = 0; virtual void emit_event(Event event) = 0;
template<typename TypeT>
void emit_event(const TypeT &type){
emit_event(std::move(Event(type)));
}
template<typename TypeT, typename PrivateT> template<typename TypeT, typename PrivateT>
void emit_event(const TypeT &type, PrivateT *p){ void emit_event(const TypeT &type, PrivateT *p){
emit_event(std::move(Event(type, up_<Event::Private>(p)))); emit_event(std::move(Event(type, up_<Event::Private>(p))));