0ad/source/tools/atlas/GameInterface/Handlers/MessageHandler.h
Ykkrosh 549150fe38 Atlas: simple camera control and terrain editing.
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.
2005-07-03 16:25:48 +00:00

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; };
}