summaryrefslogtreecommitdiffstats
path: root/src/ClonkInterface.cpp
diff options
context:
space:
mode:
authorMarkus Mittendrein <git@maxmitti.tk>2017-05-30 20:25:44 +0200
committerMarkus Mittendrein <git@maxmitti.tk>2017-05-30 20:26:41 +0200
commitc20ac02beb8520953d90d0d9114371fe36187ed0 (patch)
tree770c8d981ab8b09ff4ea322530e15da1d8cdb7c2 /src/ClonkInterface.cpp
parentf6c25c0dce53a751b0664d954552f7c711d54667 (diff)
downloadmanager-c20ac02beb8520953d90d0d9114371fe36187ed0.tar.gz
manager-c20ac02beb8520953d90d0d9114371fe36187ed0.zip
Allow ClonkOutputInterface to stop further propagation if the return value of the callback is true
Diffstat (limited to 'src/ClonkInterface.cpp')
-rw-r--r--src/ClonkInterface.cpp34
1 files changed, 19 insertions, 15 deletions
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)) }