Index: server/server.cpp
===================================================================
--- server/server.cpp	(revision f41a7f944c0904ddffe09163e64afcf46e0a00ee)
+++ server/server.cpp	(revision f203c5cf0abe184240d594faf633b300ca7b33c5)
@@ -621,6 +621,4 @@
          cout << "Got login message" << endl;
 
-         serverMsg.type = MSG_TYPE_LOGIN;
-         
          string username(clientMsg.buffer);
          string password(strchr(clientMsg.buffer, '\0')+1);
@@ -638,6 +636,4 @@
          else
          {
-            serverMsg.type = MSG_TYPE_PLAYER;
-
             updateUnusedPlayerId(unusedPlayerId, mapPlayers);
             p->id = unusedPlayerId;
@@ -647,4 +643,6 @@
             // choose a random team (either 0 or 1)
             p->team = rand() % 2;
+
+            serverMsg.type = MSG_TYPE_PLAYER;
 
             // tell the new player about all the existing players
@@ -693,8 +691,8 @@
             }
 
-            serverMsg.type = MSG_TYPE_LOGIN;
             mapPlayers[unusedPlayerId] = *p;
          }
 
+         serverMsg.type = MSG_TYPE_LOGIN;
          delete(p);
 
@@ -955,4 +953,5 @@
          // tell the new player about all the existing players
          cout << "Sending other players to new player" << endl;
+         serverMsg.type = MSG_TYPE_LOGIN;
 
          map<unsigned int, Player*>::iterator it;
@@ -1033,4 +1032,5 @@
          // tell the new player about all the existing players
          cout << "Sending other players to new player" << endl;
+         serverMsg.type = MSG_TYPE_LOGIN;
 
          map<unsigned int, Player*>::iterator it;
