From c20ac02beb8520953d90d0d9114371fe36187ed0 Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Tue, 30 May 2017 20:25:44 +0200 Subject: Allow ClonkOutputInterface to stop further propagation if the return value of the callback is true --- src/ClonkInterface.cpp | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'src/ClonkInterface.cpp') diff --git a/src/ClonkInterface.cpp b/src/ClonkInterface.cpp index 036b931..2642568 100644 --- a/src/ClonkInterface.cpp +++ b/src/ClonkInterface.cpp @@ -3,33 +3,34 @@ ClonkOutputInterface::~ClonkOutputInterface() { } -void ClonkOutputInterface::raw(const QString &msg) { Q_UNUSED(msg); } +bool ClonkOutputInterface::raw(const QString &msg) { Q_UNUSED(msg); return false; } -void ClonkOutputInterface::rawTimed(const QString &msg, const QTime &time) { Q_UNUSED(msg); Q_UNUSED(time); } +bool ClonkOutputInterface::rawTimed(const QString &msg, const QTime &time) { Q_UNUSED(msg); Q_UNUSED(time); return false; } -void ClonkOutputInterface::lobbyCountdown(unsigned int seconds) { Q_UNUSED(seconds); } +bool ClonkOutputInterface::lobbyCountdown(unsigned int seconds) { Q_UNUSED(seconds); return false; } -void ClonkOutputInterface::lobbyCountdownAborted() {} +bool ClonkOutputInterface::lobbyCountdownAborted() { return false; } -void ClonkOutputInterface::playerRemoved(const QString &name) { Q_UNUSED(name); } +bool ClonkOutputInterface::playerRemoved(const QString &name) { Q_UNUSED(name); return false; } -void ClonkOutputInterface::playerJoined(const ClientInfo &client, const QString &name) { Q_UNUSED(client); Q_UNUSED(name); } +bool ClonkOutputInterface::playerJoined(const ClientInfo &client, const QString &name) { Q_UNUSED(client); Q_UNUSED(name); return false; } -void ClonkOutputInterface::watchdog(const QString &id) { Q_UNUSED(id); } +bool ClonkOutputInterface::watchdog(const QString &id) { Q_UNUSED(id); return false; } -void 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); } +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; } -void ClonkOutputInterface::clientConnected(const ClientInfo &client) { Q_UNUSED(client); } +bool ClonkOutputInterface::clientConnected(const ClientInfo &client) { Q_UNUSED(client); return false; } -void ClonkOutputInterface::clientRemoved(const ClientInfo &client, const QString& reason) { Q_UNUSED(client); Q_UNUSED(reason); } +bool ClonkOutputInterface::clientRemoved(const ClientInfo &client, const QString& reason) { Q_UNUSED(client); Q_UNUSED(reason); return false; } -void ClonkOutputInterface::clientStateChanged(const ClientInfo &client, bool activated) { Q_UNUSED(client); Q_UNUSED(activated); } +bool ClonkOutputInterface::clientStateChanged(const ClientInfo &client, bool activated) { Q_UNUSED(client); Q_UNUSED(activated); return false; } -void ClonkOutputInterface::gameLoading() {} +bool ClonkOutputInterface::gameLoading() { return false; } -void ClonkOutputInterface::gameStarted() {} +bool ClonkOutputInterface::gameStarted() { return false; } -void ClonkOutputInterface::masterserverError(const QString &msg) { Q_UNUSED(msg); } +bool ClonkOutputInterface::masterserverError(const QString& msg) +{ Q_UNUSED(msg); return false; } ClonkControlInterface::~ClonkControlInterface() {} @@ -63,7 +64,10 @@ void ClonkParser::removeTarget(ClonkOutputInterface *target) #define dispatch(x) for(auto target : targets)\ {\ - target->x;\ + if(target->x)\ + {\ + break;\ + }\ } void ClonkParser::raw(const QString &msg) { dispatch(raw(msg)) } -- cgit v1.2.3-54-g00ecf