diff options
| author | Markus Mittendrein <git@maxmitti.tk> | 2016-12-30 13:13:22 +0100 |
|---|---|---|
| committer | Markus Mittendrein <git@maxmitti.tk> | 2016-12-30 13:13:22 +0100 |
| commit | bb2406f63816cdf3b888c0aacf0f15a77b378d98 (patch) | |
| tree | a8ed9ce7aa6d73d11ad2be862df391b398e901fe | |
| parent | 67d4e252066d49a72fc7c62d6abe4aebc4ff20e7 (diff) | |
| download | manager-bb2406f63816cdf3b888c0aacf0f15a77b378d98.tar.gz manager-bb2406f63816cdf3b888c0aacf0f15a77b378d98.zip | |
Include player count in clientlist
| -rw-r--r-- | src/crsm.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/crsm.cpp b/src/crsm.cpp index 87bcbfe..b638bd9 100644 --- a/src/crsm.cpp +++ b/src/crsm.cpp @@ -2938,14 +2938,32 @@ CMD_FUNCTION_IMPL(noadmin) } CMD_FUNCTION_IMPL(clientlist) - QString response = "Verbundene Clients (Chatnick (PC-Name)): "; + if(Session.State == CRSMSession::None) + { + respond(client, "Es ist zurzeit nichts gehostet.\n"); + return Success; + } + + if(Session.Clonk.Clients.isEmpty()) + { + respond(client, "Keine verbundenen Clients.\n"); + return Success; + } + + QString response = "Verbundene Clients ((Anzahl Spieler) Chatnick (PC-Name)): "; foreach(const ClientInfo& connectedClient, Session.Clonk.Clients) { - if(connectedClient.nick.isEmpty()) - continue; - response += connectedClient.toString() + ", "; + response += "(" + QString::number(connectedClient.players.count()) + ") " + connectedClient.toString() + ", "; + } + + if(!Session.Clonk.Server.players.isEmpty()) + { + response += "(" + QString::number(Session.Clonk.Server.players.count()) + ") " + Session.Clonk.Server.toString() + ", "; + } + else + { + response.chop(2); } - response = response.left(response.length() - 2); respond(client, response + "\n"); return Success; } |
