|
From: <dar...@us...> - 2009-09-27 13:18:11
|
Revision: 4976
http://openlierox.svn.sourceforge.net/openlierox/?rev=4976&view=rev
Author: dark_charlie
Date: 2009-09-27 13:17:57 +0000 (Sun, 27 Sep 2009)
Log Message:
-----------
Correct fix for annoying messages
Modified Paths:
--------------
include/CServer.h
src/client/DeprecatedGUI/Menu_Net_Host.cpp
src/server/CServer.cpp
Modified: include/CServer.h
===================================================================
--- include/CServer.h 2009-09-27 11:14:37 UTC (rev 4975)
+++ include/CServer.h 2009-09-27 13:17:57 UTC (rev 4976)
@@ -217,16 +217,16 @@
bool ProcessDeRegister();
void CheckTimeouts();
void CheckWeaponSelectionTime();
- void DropClient(CServerConnection *cl, int reason, const std::string& sReason);
+ void DropClient(CServerConnection *cl, int reason, const std::string& sReason, bool showReason = true);
CWorm* AddWorm(const WormJoinInfo& wormInfo);
void PrepareWorm(CWorm* worm);
void RemoveClient(CServerConnection *cl, const std::string& reason);
void RemoveClientWorms(CServerConnection* cl, const std::set<CWorm*>& worms, const std::string& reason);
void RemoveAllClientWorms(CServerConnection* cl, const std::string& reason);
- void kickWorm(int wormID, const std::string& sReason);
- void kickWorm(const std::string& szWormName, const std::string& sReason);
- void banWorm(int wormID, const std::string& sReason);
- void banWorm(const std::string& szWormName, const std::string& sReason);
+ void kickWorm(int wormID, const std::string& sReason, bool showReason = true);
+ void kickWorm(const std::string& szWormName, const std::string& sReason, bool showReason = true);
+ void banWorm(int wormID, const std::string& sReason, bool showReason = true);
+ void banWorm(const std::string& szWormName, const std::string& sReason, bool showReason = true);
void muteWorm(int wormID);
void muteWorm(const std::string& szWormName);
void unmuteWorm(int wormID);
Modified: src/client/DeprecatedGUI/Menu_Net_Host.cpp
===================================================================
--- src/client/DeprecatedGUI/Menu_Net_Host.cpp 2009-09-27 11:14:37 UTC (rev 4975)
+++ src/client/DeprecatedGUI/Menu_Net_Host.cpp 2009-09-27 13:17:57 UTC (rev 4976)
@@ -1878,13 +1878,13 @@
// Kick the player
case MNU_USER+0:
if( wormid > 0 )
- cServer->kickWorm( wormid, "kicked via GUI menu" );
+ cServer->kickWorm( wormid, "kicked via GUI menu", false );
break;
// Ban the player
case MNU_USER+1:
if ( wormid > 0 )
- cServer->banWorm( wormid, "banned via GUI menu" );
+ cServer->banWorm( wormid, "banned via GUI menu", false );
break;
// Mute/unmute
Modified: src/server/CServer.cpp
===================================================================
--- src/server/CServer.cpp 2009-09-27 11:14:37 UTC (rev 4975)
+++ src/server/CServer.cpp 2009-09-27 13:17:57 UTC (rev 4976)
@@ -1451,7 +1451,7 @@
///////////////////
// Drop a client
-void GameServer::DropClient(CServerConnection *cl, int reason, const std::string& sReason)
+void GameServer::DropClient(CServerConnection *cl, int reason, const std::string& sReason, bool showReason)
{
// Never ever drop a local client
if (cl->isLocalClient()) {
@@ -1480,7 +1480,7 @@
// Kicked
case CLL_KICK:
- if (sReason.size() == 0) { // No reason
+ if (sReason.size() == 0 || !showReason) { // No reason
replacemax(networkTexts->sHasBeenKicked,"<player>", cl->getWorm(i)->getName(), buf, 1);
cl_msg = networkTexts->sKickedYou;
} else {
@@ -1494,7 +1494,7 @@
// Banned
case CLL_BAN:
- if (sReason.size() == 0) { // No reason
+ if (sReason.size() == 0 || !showReason) { // No reason
replacemax(networkTexts->sHasBeenBanned,"<player>", cl->getWorm(i)->getName(), buf, 1);
cl_msg = networkTexts->sBannedYou;
} else {
@@ -1824,9 +1824,7 @@
///////////////////
// Kick a worm out of the server
-void GameServer::kickWorm(int wormID, const std::string& sReason)
-{
- if (!cWorms) {
+void GameServer::kickWorm(int wormID, const std::string& sReason, bool showReason){ if (!cWorms) {
errors << "kickWorm: worms not initialised" << endl;
return;
}
@@ -1900,7 +1898,7 @@
// check if we didn't already removed the worm from inside that SyncServerAndClient
if(cClient->OwnsWorm(wormID)) {
// Send the message
- if (sReason.size() == 0)
+ if (sReason.size() == 0 || !showReason)
SendGlobalText((replacemax(networkTexts->sHasBeenKicked,
"<player>", w->getName(), 1)), TXT_NETWORK);
else
@@ -1939,13 +1937,13 @@
// Drop the whole client
// It's not possible to kick a single worm because the network would be screwed up.
// The client needs to reconnect if it wants to change the worm amount.
- DropClient(cl, CLL_KICK, sReason);
+ DropClient(cl, CLL_KICK, sReason, showReason);
}
///////////////////
// Kick a worm out of the server (by name)
-void GameServer::kickWorm(const std::string& szWormName, const std::string& sReason)
+void GameServer::kickWorm(const std::string& szWormName, const std::string& sReason, bool showReason)
{
if (!cWorms)
return;
@@ -1957,7 +1955,7 @@
continue;
if(stringcasecmp(w->getName(), szWormName) == 0) {
- kickWorm(i, sReason);
+ kickWorm(i, sReason, showReason);
return;
}
}
@@ -1969,7 +1967,7 @@
///////////////////
// Ban and kick the worm out of the server
-void GameServer::banWorm(int wormID, const std::string& sReason)
+void GameServer::banWorm(int wormID, const std::string& sReason, bool showReason)
{
if (!cWorms) {
errors << "banWorm: worms not initialised" << endl;
@@ -2049,11 +2047,11 @@
getBanList()->addBanned(szAddress,w->getName());
// Drop the client
- DropClient(cl, CLL_BAN, sReason);
+ DropClient(cl, CLL_BAN, sReason, showReason);
}
-void GameServer::banWorm(const std::string& szWormName, const std::string& sReason)
+void GameServer::banWorm(const std::string& szWormName, const std::string& sReason, bool showReason)
{
// Find the worm name
CWorm *w = cWorms;
@@ -2065,7 +2063,7 @@
continue;
if(stringcasecmp(w->getName(), szWormName) == 0) {
- banWorm(i, sReason);
+ banWorm(i, sReason, showReason);
return;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|