1
0
forked from 0ad/0ad
0ad/source/tools/atlas/GameInterface/Handlers/MessageHandler.h
Ykkrosh 92b9c07f95 Restoring SVN repository:
Greek basket texture

# New Greek vases

# housekeeping
documentation fix: trailing / in directory names is mandatory

# Atlas: Sky texture selection; save with maps

Atlas code tidying: Slightly nicer syntax for defining command handlers,
and some explanation of how it works

Automated build.

This was SVN commit r4008.
2006-06-21 22:37:31 +00:00

25 lines
574 B
C++

#include "../Messages.h"
#include <map>
#include <string>
namespace AtlasMessage
{
typedef void (*msgHandler)(IMessage*);
typedef std::map<std::string, msgHandler> msgHandlers;
extern msgHandlers& GetMsgHandlers();
#define THINGHANDLER(prefix, expectedtype, t) \
void f##t(prefix##t*); \
void f##t##_wrapper(IMessage* msg) { \
debug_assert(msg->GetType() == IMessage::expectedtype); \
f##t (static_cast<prefix##t*>(msg)); \
} \
void f##t(prefix##t* msg)
#define MESSAGEHANDLER(t) THINGHANDLER(m, Message, t)
#define QUERYHANDLER(t) THINGHANDLER(q, Query, t)
}