23 #ifndef TACTICS3DEVENT_H
24 #define TACTICS3DEVENT_H
26 #include "../Libs/Utils_LIB/UTypes.h"
33 struct FunctionOrMethod {
34 void (*_func)(
void*,std::vector<OpenSkyNet::Utils::TaggedUnion>);
36 FunctionOrMethod(
void (*func_)(
void*,std::vector<OpenSkyNet::Utils::TaggedUnion>),
void* instance_=0) : _func(func_), _instance(instance_) {}
37 inline bool operator==(
const FunctionOrMethod& rhs_)
const {
38 if ((_func != rhs_._func) || (_instance != rhs_._instance))
43 std::list<FunctionOrMethod> _handlers;
45 inline void fire(std::vector<OpenSkyNet::Utils::TaggedUnion> params_) {
46 for (std::list<FunctionOrMethod>::iterator i = _handlers.begin(); i != _handlers.end(); i++)
47 i->_func(i->_instance,params_);
50 inline void registerHandler(
void (*func_)(
void*,std::vector<OpenSkyNet::Utils::TaggedUnion>),
void* instance_=0) {
51 _handlers.push_back(FunctionOrMethod(func_,instance_));
54 inline void unregisterHandler(
void (*func_)(
void*,std::vector<OpenSkyNet::Utils::TaggedUnion>),
void* instance_=0) {
55 _handlers.remove(FunctionOrMethod(func_,instance_));
94 #endif //TACTICS3DEVENT_H
Event g_preGetWarriorActions
Definition: Tactics3DEvent.cpp:10
const std::vector< OpenSkyNet::Utils::TaggedUnion > g_emptyEventParams
Definition: Tactics3DEvent.cpp:4
Event g_initiativeRolled
Definition: Tactics3DEvent.cpp:8
void unregisterHandler(void(*func_)(void *, std::vector< OpenSkyNet::Utils::TaggedUnion >), void *instance_=0)
Definition: Tactics3DEvent.h:54
void fire(std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DEvent.h:45
Event g_postWarriorPerform
Definition: Tactics3DEvent.cpp:15
Event g_recvPCAttributes
Definition: Tactics3DEvent.cpp:19
Event g_getWarriorActions
Definition: Tactics3DEvent.cpp:11
Event g_lockCore
Definition: Tactics3DEvent.cpp:20
Event g_postGetWarriorActions
Definition: Tactics3DEvent.cpp:12
Event g_warriorAttacked
Definition: Tactics3DEvent.cpp:17
void registerHandler(void(*func_)(void *, std::vector< OpenSkyNet::Utils::TaggedUnion >), void *instance_=0)
Definition: Tactics3DEvent.h:50
bool operator==(const Point< T > &lhs_, const Point< U > &rhs_)
Definition: MPoint.h:221
Event g_postWarriorPerformAll
Definition: Tactics3DEvent.cpp:16
Event g_postGetAllWarriorsActions
Definition: Tactics3DEvent.cpp:13
Event g_currCamJustBecameFree
Definition: Tactics3DEvent.cpp:6
Event g_allInitiativesRolled
Definition: Tactics3DEvent.cpp:9
Event g_unlockCore
Definition: Tactics3DEvent.cpp:21
Event g_preWarriorPerform
Definition: Tactics3DEvent.cpp:14
void unregisterAllHandlers()
Definition: Tactics3DEvent.h:58
Event g_warriorDead
Definition: Tactics3DEvent.cpp:18
Event g_beginRound
Definition: Tactics3DEvent.cpp:7
typedef void(__attribute__((stdcall))*ObjectPickedCallback)(const char *name_
Definition: Tactics3DEvent.h:32