summaryrefslogtreecommitdiffstats
path: root/source/cServer.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-13 22:47:03 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-13 22:47:03 +0100
commit4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c (patch)
treefebea3ecd89c0d4aa83924e430bf11366d754733 /source/cServer.cpp
parentNew makefile with automatic *.cpp sourcefile import, automatic header file dependencies and switchable debug / release configuration. gnumake-specific :( (diff)
downloadcuberite-4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c.tar
cuberite-4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c.tar.gz
cuberite-4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c.tar.bz2
cuberite-4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c.tar.lz
cuberite-4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c.tar.xz
cuberite-4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c.tar.zst
cuberite-4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c.zip
Diffstat (limited to '')
-rw-r--r--source/cServer.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/source/cServer.cpp b/source/cServer.cpp
index e3fdb2f86..0836900e3 100644
--- a/source/cServer.cpp
+++ b/source/cServer.cpp
@@ -241,7 +241,7 @@ cServer::~cServer()
// TODO - Need to modify this or something, so it broadcasts to all worlds? And move this to cWorld?
-void cServer::Broadcast( const cPacket & a_Packet, cClientHandle* a_Exclude /* = 0 */ )
+void cServer::Broadcast( const cPacket * a_Packet, cClientHandle* a_Exclude /* = 0 */ )
{
for( ClientList::iterator itr = m_pState->Clients.begin(); itr != m_pState->Clients.end(); ++itr)
{
@@ -277,6 +277,7 @@ void cServer::StartListenClient()
if (!m_SocketThreads.AddClient(&(NewHandle->GetSocket()), NewHandle))
{
// For some reason SocketThreads have rejected the handle, clean it up
+ LOGERROR("Client \"%s\" cannot be handled, server probably unstable", SClient.GetIPString().c_str());
SClient.CloseSocket();
delete NewHandle;
return;
@@ -423,7 +424,7 @@ bool cServer::Command( cClientHandle & a_Client, const char* a_Cmd )
-void cServer::ServerCommand( const char* a_Cmd )
+void cServer::ServerCommand( const char * a_Cmd )
{
AString Command( a_Cmd );
AStringVector split = StringSplit( Command, " " );
@@ -454,30 +455,29 @@ void cServer::ServerCommand( const char* a_Cmd )
}
if( split[0].compare( "list" ) == 0 )
{
- cWorld::EntityList Entities = cRoot::Get()->GetWorld()->GetEntities();
- std::string PlayerString;
- int NumPlayers = 0;
- cRoot::Get()->GetWorld()->LockEntities();
- for( cWorld::EntityList::iterator itr = Entities.begin(); itr != Entities.end(); ++itr)
+ class cPlayerLogger : public cPlayerListCallback
{
- if( (*itr)->GetEntityType() != cEntity::E_PLAYER ) continue;
- PlayerString.push_back(' ');
- PlayerString += ((cPlayer*)*itr)->GetName();
- NumPlayers++;
- }
- cRoot::Get()->GetWorld()->UnlockEntities();
- printf( "Players (%i):%s\n", NumPlayers, PlayerString.c_str() );
+ virtual bool Item(cPlayer * a_Player) override
+ {
+ LOG("\t%s @ %s", a_Player->GetName().c_str(), a_Player->GetClientHandle()->GetSocket().GetIPString());
+ return false;
+ }
+ } Logger;
+ cRoot::Get()->GetWorld()->ForEachPlayer(&Logger);
return;
}
if( split[0].compare( "numchunks" ) == 0 )
{
- printf("Num loaded chunks: %i\n", cRoot::Get()->GetWorld()->GetNumChunks() );
+ printf("Num loaded chunks: %i\n", cRoot::Get()->GetTotalChunkCount() );
return;
}
- if(split[0].compare("monsters") == 0 ){
- cMonster::ListMonsters();
+
+ if(split[0].compare("monsters") == 0 )
+ {
+ // TODO: cWorld::ListMonsters();
return;
}
+
if(split.size() > 1)
{
if( split[0].compare( "say" ) == 0 )