diff options
| author | Markus Mittendrein <git@maxmitti.tk> | 2017-05-30 20:25:44 +0200 |
|---|---|---|
| committer | Markus Mittendrein <git@maxmitti.tk> | 2017-05-30 20:26:41 +0200 |
| commit | c20ac02beb8520953d90d0d9114371fe36187ed0 (patch) | |
| tree | 770c8d981ab8b09ff4ea322530e15da1d8cdb7c2 /src/crsm.cpp | |
| parent | f6c25c0dce53a751b0664d954552f7c711d54667 (diff) | |
| download | manager-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/crsm.cpp')
| -rw-r--r-- | src/crsm.cpp | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/src/crsm.cpp b/src/crsm.cpp index f596edb..6adc72f 100644 --- a/src/crsm.cpp +++ b/src/crsm.cpp @@ -222,26 +222,29 @@ QString CRSM::findClientByName(ClientInfo &info, const QString &name) } } -void CRSM::lobbyCountdown(unsigned int seconds) +bool CRSM::lobbyCountdown(unsigned int seconds) { Session.CountDown = (int)seconds; + return false; } -void CRSM::lobbyCountdownAborted() +bool CRSM::lobbyCountdownAborted() { Session.CountDown = -1; + return false; } -void CRSM::watchdog(const QString& id) +bool CRSM::watchdog(const QString& id) { if(id == watchDogString) { watchDogString.clear(); watchDogTimer.start(Config.Clonk.Server.Watchdog.Interval * 1000); } + return false; } -void CRSM::clientMessage(ClientInfo& client, const QString& message, ClonkOutputInterface::MessageType type, const QTime& time) +bool CRSM::clientMessage(ClientInfo& client, const QString& message, ClonkOutputInterface::MessageType type, const QTime& time) { bool isMeMessage = (type == Action); if(type == Sound) @@ -270,7 +273,7 @@ void CRSM::clientMessage(ClientInfo& client, const QString& message, ClonkOutput } else if(type == Sound) { - return; + return false; } else if(!isMeMessage) { @@ -281,7 +284,7 @@ void CRSM::clientMessage(ClientInfo& client, const QString& message, ClonkOutput { respond(client, "Unbekannter Befehl: \"" + command + "\"!\n"); } - + return true; } else if(Session.IRC.UseIngameChat) { @@ -293,9 +296,10 @@ void CRSM::clientMessage(ClientInfo& client, const QString& message, ClonkOutput sendIrcMessage("[Clonk] " + client.nick + " " + message, Config.IRC.IngameChannel, true, false); } } + return false; } -void CRSM::clientConnected(const ClientInfo& client) +bool CRSM::clientConnected(const ClientInfo& client) { QTimer *timer = new QTimer; connect(timer, SIGNAL(timeout()), &greetMapper, SLOT(map())); @@ -310,9 +314,10 @@ void CRSM::clientConnected(const ClientInfo& client) { control.abortCountdown(); } + return false; } -void CRSM::clientRemoved(const ClientInfo& client, const QString& reason) +bool CRSM::clientRemoved(const ClientInfo& client, const QString& reason) { control.serverMessage(client.nick + " ist ein L34V0R!"); @@ -340,14 +345,16 @@ void CRSM::clientRemoved(const ClientInfo& client, const QString& reason) { control.setCountdown(Config.Clonk.Server.EmptyTimer); } + return false; } -void CRSM::gameLoading() +bool CRSM::gameLoading() { setSessionState(CRSMSession::Loading); + return false; } -void CRSM::gameStarted() +bool CRSM::gameStarted() { Stats.AddScenarioStart(Session.Scenario.wishClient, scenarioFileName(Session.Scenario.name)); if(!Session.League) @@ -356,9 +363,10 @@ void CRSM::gameStarted() } setSessionState(CRSMSession::Running); watchdog(); + return false; } -void CRSM::masterserverError(const QString& msg) +bool CRSM::masterserverError(const QString& msg) { userlist.clear(); if(autoHost && !hostingIsErrorDeactivated) @@ -369,9 +377,10 @@ void CRSM::masterserverError(const QString& msg) autoHost = false; static const QString gameRegisterFailMessage = "Aufgrund eines Problems beim Registrieren des Spiels am Masterserver (%1) wird Hosting temporär (für 5 Minuten) deaktiviert.\n"; announceInfo(gameRegisterFailMessage.arg(msg)); + return false; } -void CRSM::raw(const QString &line) +bool CRSM::raw(const QString &line) { if(Config.IRC.Use) { @@ -382,17 +391,20 @@ void CRSM::raw(const QString &line) } } out(line + "\n"); + return false; } -void CRSM::rawTimed(const QString &line, const QTime &time) +bool CRSM::rawTimed(const QString &line, const QTime &time) { Q_UNUSED(time); Log.clonkLog(line); + return false; } -void CRSM::playerRemoved(const QString& name) +bool CRSM::playerRemoved(const QString& name) { Q_UNUSED(name); + return false; } void CRSM::readServerOutput() |
