#include "ClonkInterface.hpp" ClonkOutputInterface::~ClonkOutputInterface() { } bool ClonkOutputInterface::raw(const QString &msg) { Q_UNUSED(msg); return false; } bool ClonkOutputInterface::rawTimed(const QString &msg, const QTime &time) { Q_UNUSED(msg); Q_UNUSED(time); return false; } bool ClonkOutputInterface::lobbyCountdown(unsigned int seconds) { Q_UNUSED(seconds); return false; } bool ClonkOutputInterface::lobbyCountdownAborted() { return false; } bool ClonkOutputInterface::playerRemoved(const QString &name) { Q_UNUSED(name); return false; } bool ClonkOutputInterface::playerJoined(const ClientInfo &client, const QString &name) { Q_UNUSED(client); Q_UNUSED(name); return false; } bool ClonkOutputInterface::watchdog(const QString &id) { Q_UNUSED(id); return false; } bool ClonkOutputInterface::clientMessage(ClientInfo &client, const QString &message, ClonkOutputInterface::MessageType type, const QTime &time) { Q_UNUSED(client); Q_UNUSED(message); Q_UNUSED(type); Q_UNUSED(time); return false; } bool ClonkOutputInterface::clientConnected(const ClientInfo &client) { Q_UNUSED(client); return false; } bool ClonkOutputInterface::clientRemoved(const ClientInfo &client, const QString& reason) { Q_UNUSED(client); Q_UNUSED(reason); return false; } bool ClonkOutputInterface::clientStateChanged(const ClientInfo &client, bool activated) { Q_UNUSED(client); Q_UNUSED(activated); return false; } bool ClonkOutputInterface::gameLoading() { return false; } bool ClonkOutputInterface::gameStarted() { return false; } bool ClonkOutputInterface::masterserverError(const QString& msg) { Q_UNUSED(msg); return false; } ClonkControlInterface::~ClonkControlInterface() {} void ClonkControlInterface::setController(ClonkControllerInterface *controller) { this->controller = controller; } ClonkParser::ClonkParser(CRSMSession &session) : Session(session) { } ClonkParser::~ClonkParser() { } void ClonkParser::addTarget(ClonkOutputInterface *target) { if(!targets.contains(target)) { targets.push_back(target); } } void ClonkParser::removeTarget(ClonkOutputInterface *target) { targets.removeAll(target); } #define dispatch(x) for(auto target : targets)\ {\ if(target->x)\ {\ break;\ }\ } void ClonkParser::raw(const QString &msg) { dispatch(raw(msg)) } void ClonkParser::rawTimed(const QString &msg, const QTime &time) { dispatch(rawTimed(msg, time)) } void ClonkParser::lobbyCountdown(unsigned int seconds) { dispatch(lobbyCountdown(seconds)) } void ClonkParser::lobbyCountdownAborted() { dispatch(lobbyCountdownAborted()) } void ClonkParser::playerRemoved(const QString &name) { dispatch(playerRemoved(name)) } void ClonkParser::playerJoined(const ClientInfo &client, const QString &name) { dispatch(playerJoined(client, name)) } void ClonkParser::watchdog(const QString &id) { dispatch(watchdog(id)) } void ClonkParser::clientMessage(ClientInfo &client, const QString &message, ClonkOutputInterface::MessageType type, const QTime &time) { dispatch(clientMessage(client, message, type, time)) } void ClonkParser::clientConnected(const ClientInfo &client) { dispatch(clientConnected(client)) } void ClonkParser::clientRemoved(const ClientInfo &client, const QString& reason) { dispatch(clientRemoved(client, reason)) } void ClonkParser::clientStateChanged(const ClientInfo &client, bool activated) { dispatch(clientStateChanged(client, activated)) } void ClonkParser::gameLoading() { dispatch(gameLoading()) } void ClonkParser::gameStarted() { dispatch(gameStarted()) } void ClonkParser::masterserverError(const QString &msg) { dispatch(masterserverError(msg)) } #undef dispatch ClonkControllerInterface::~ClonkControllerInterface() { }