Remove trailing comma after player list in server status string
authorMatthew I <matttpt@gmail.com>
Sat, 28 Jul 2012 19:49:23 +0000 (15:49 -0400)
committerPerttu Ahola <celeron55@gmail.com>
Sun, 12 Aug 2012 13:44:54 +0000 (16:44 +0300)
src/server.cpp

index 05dff06c5cfcb2dc4843aad89e69617cf2cbe164..85e361cede0cbd6f29f83926a7875f0756f6fc18 100644 (file)
@@ -4449,9 +4449,10 @@ std::wstring Server::getStatusString()
        // Uptime
        os<<L", uptime="<<m_uptime.get();
        // Information about clients
+       core::map<u16, RemoteClient*>::Iterator i;
+       bool first;
        os<<L", clients={";
-       for(core::map<u16, RemoteClient*>::Iterator
-               i = m_clients.getIterator();
+       for(i = m_clients.getIterator(), first = true;
                i.atEnd() == false; i++)
        {
                // Get client and check that it is valid
@@ -4466,7 +4467,11 @@ std::wstring Server::getStatusString()
                if(player != NULL)
                        name = narrow_to_wide(player->getName());
                // Add name to information string
-               os<<name<<L",";
+               if(!first)
+                       os<<L",";
+               else
+                       first = false;
+               os<<name;
        }
        os<<L"}";
        if(((ServerMap*)(&m_env->getMap()))->isSavingEnabled() == false)