forked from 0ad/0ad
Ykkrosh
549150fe38
Terrain: added terrain-editing code to CTerrain, for better encapsulation or something. Console: simplified screen resizing. Game/etc: removed some unnecessary header file inclusions. This was SVN commit r2459.
22 lines
628 B
C++
22 lines
628 B
C++
#include "../Messages.h"
|
|
|
|
namespace AtlasMessage
|
|
{
|
|
|
|
// (Random note: Be careful not to give handler .cpp files the same name
|
|
// as any other file in the project, because it makes everything very confused)
|
|
|
|
typedef void (*handler)(IMessage*);
|
|
typedef std::map<std::string, handler> handlers;
|
|
extern handlers& GetHandlers();
|
|
|
|
#define CAT1(a,b) a##b
|
|
#define CAT2(a,b) CAT1(a,b)
|
|
|
|
#define REGISTER(t) namespace CAT2(hndlr_, __LINE__) { struct init { init() { \
|
|
bool notAlreadyRegisted = GetHandlers().insert(std::pair<std::string, handler>(#t, &f##t)).second; \
|
|
assert(notAlreadyRegisted); \
|
|
} } init; };
|
|
|
|
}
|