aboutsummaryrefslogtreecommitdiff
path: root/advtrains/advtrains_train_subway/init.lua
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2017-01-29 21:24:03 +0100
committerorwell96 <mono96.mml@gmail.com>2017-01-29 21:24:03 +0100
commit4b63e8d9d6ac5c38936e4a5fc45fa5f3709ba0b7 (patch)
tree62b762010f50061bbc212abf5ca10fb47d6c0460 /advtrains/advtrains_train_subway/init.lua
parent724b03abb983eb93c124cef6039bcf2ea4125335 (diff)
downloadadvtrains-4b63e8d9d6ac5c38936e4a5fc45fa5f3709ba0b7.tar.gz
advtrains-4b63e8d9d6ac5c38936e4a5fc45fa5f3709ba0b7.tar.bz2
advtrains-4b63e8d9d6ac5c38936e4a5fc45fa5f3709ba0b7.zip
Fix wagon properties not saved on button click
Diffstat (limited to 'advtrains/advtrains_train_subway/init.lua')
0 files changed, 0 insertions, 0 deletions
*/ #ifndef EVENT_MANAGER_HEADER #define EVENT_MANAGER_HEADER #include "event.h" #include <list> #include <map> class EventManager: public MtEventManager { static void receiverReceive(MtEvent *e, void *data) { MtEventReceiver *r = (MtEventReceiver*)data; r->onEvent(e); } struct FuncSpec{ event_receive_func f; void *d; FuncSpec(event_receive_func f, void *d): f(f), d(d) {} }; struct Dest{ std::list<FuncSpec> funcs; }; std::map<std::string, Dest> m_dest; public: ~EventManager() { } void put(MtEvent *e) { std::map<std::string, Dest>::iterator i = m_dest.find(e->getType()); if(i != m_dest.end()){ std::list<FuncSpec> &funcs = i->second.funcs; for(std::list<FuncSpec>::iterator i = funcs.begin(); i != funcs.end(); ++i){ (*(i->f))(e, i->d); } } delete e; } void reg(const char *type, event_receive_func f, void *data) { std::map<std::string, Dest>::iterator i = m_dest.find(type);