From 72501cf4de291cb2066bb43699912ba3dd6af6c0 Mon Sep 17 00:00:00 2001 From: Josh Allen Date: Sun, 10 Oct 2004 04:45:57 +0000 Subject: [PATCH] Fixed bug in /kick and /ban commands. --- stepmania/src/NetworkSyncServer.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/stepmania/src/NetworkSyncServer.cpp b/stepmania/src/NetworkSyncServer.cpp index a78971395b..232d5381f8 100644 --- a/stepmania/src/NetworkSyncServer.cpp +++ b/stepmania/src/NetworkSyncServer.cpp @@ -835,25 +835,33 @@ CString StepManiaLanServer::ListPlayers() void StepManiaLanServer::Kick(CString &name) { - for (unsigned int x = 0; x < Client.size(); ++x) - for (int y = 0; y < 2; ++y) + bool kicked; + for (unsigned int x = 0; x < Client.size(); ++x) { + kicked = false; + for (int y = 0; (y < 2)&&(kicked == false); ++y) if (name == Client[x]->Player[y].name) { ServerChat("Kicked " + name + "."); Disconnect(x); + kicked = true; } + } } void StepManiaLanServer::Ban(CString &name) { - for (unsigned int x = 0; x < Client.size(); ++x) - for (int y = 0; y < 2; ++y) + bool kicked; + for (unsigned int x = 0; x < Client.size(); ++x) { + kicked = false; + for (int y = 0; (y < 2)&&(kicked == false); ++y) if (name == Client[x]->Player[y].name) { ServerChat("Banned " + name + "."); bannedIPs.push_back(Client[x]->clientSocket.address); Disconnect(x); + kicked = true; } + } } bool StepManiaLanServer::IsBanned(CString &ip)