Index: server/server.cpp
===================================================================
--- server/server.cpp	(revision dee75ccb537d02261ab1aed25d2959feb558eabb)
+++ server/server.cpp	(revision 46d64695d8d9b46a9adea74da159caae18698af6)
@@ -44,4 +44,6 @@
 void updateUnusedProjectileId(unsigned int& id, map<unsigned int, Projectile>& mapProjectiles);
 void damagePlayer(Player *p, int damage);
+
+void addObjectToMap(WorldMap::ObjectType objectType, int x, int y, WorldMap* gameMap, map<unsigned int, Player>& mapPlayers, MessageProcessor &msgProcessor, int sock);
 
 // this should probably go somewhere in the common folder
@@ -412,4 +414,16 @@
                   damagePlayer(target, it->second.damage);
 
+                  if (target->isDead) {
+                     WorldMap::ObjectType flagType = WorldMap::OBJECT_NONE;
+                     if (target->hasBlueFlag)
+                        flagType = WorldMap::OBJECT_BLUE_FLAG;
+                     else if (target->hasRedFlag)
+                        flagType = WorldMap::OBJECT_RED_FLAG;
+
+                     if (flagType != WorldMap::OBJECT_NONE) {
+                        addObjectToMap(flagType, target->pos.x, target->pos.y, gameMap, mapPlayers, msgProcessor, sock);
+                     }
+                  }
+
                   serverMsg.type = MSG_TYPE_PLAYER;
                   target->serialize(serverMsg.buffer);
@@ -469,4 +483,16 @@
 
                damagePlayer(target, itProj->second.damage);
+
+               if (target->isDead) {
+                  WorldMap::ObjectType flagType = WorldMap::OBJECT_NONE;
+                  if (target->hasBlueFlag)
+                     flagType = WorldMap::OBJECT_BLUE_FLAG;
+                  else if (target->hasRedFlag)
+                     flagType = WorldMap::OBJECT_RED_FLAG;
+
+                  if (flagType != WorldMap::OBJECT_NONE) {
+                     addObjectToMap(flagType, target->pos.x, target->pos.y, gameMap, mapPlayers, msgProcessor, sock);
+                  }
+               }
 
                serverMsg.type = MSG_TYPE_PLAYER;
@@ -664,4 +690,16 @@
          else
          {
+            if (!p->isDead) {
+               WorldMap::ObjectType flagType = WorldMap::OBJECT_NONE;
+               if (p->hasBlueFlag)
+                  flagType = WorldMap::OBJECT_BLUE_FLAG;
+               else if (p->hasRedFlag)
+                  flagType = WorldMap::OBJECT_RED_FLAG;
+
+               if (flagType != WorldMap::OBJECT_NONE) {
+                  addObjectToMap(flagType, p->pos.x, p->pos.y, gameMap, mapPlayers, msgProcessor, sock);
+               }
+            }
+
             if (p->id < unusedPlayerId)
                unusedPlayerId = p->id;
@@ -821,16 +859,5 @@
             flagType = WorldMap::OBJECT_RED_FLAG;
 
-         gameMap->addObject(flagType, mapPlayers[id].pos.x, mapPlayers[id].pos.y);
-
-         // need to send the OBJECT message too
-         serverMsg.type = MSG_TYPE_OBJECT;
-         gameMap->getObjects()->back().serialize(serverMsg.buffer);
-
-         map<unsigned int, Player>::iterator it;
-         for (it = mapPlayers.begin(); it != mapPlayers.end(); it++)
-         {
-            if ( msgProcessor.sendMessage(&serverMsg, sock, &(it->second.addr)) < 0 )
-               error("sendMessage");
-         }
+         addObjectToMap(flagType, mapPlayers[id].pos.x, mapPlayers[id].pos.y, gameMap, mapPlayers, msgProcessor, sock);
 
          mapPlayers[id].hasBlueFlag = false;
@@ -911,2 +938,19 @@
    }
 }
+
+void addObjectToMap(WorldMap::ObjectType objectType, int x, int y, WorldMap* gameMap, map<unsigned int, Player>& mapPlayers, MessageProcessor &msgProcessor, int sock) {
+   NETWORK_MSG serverMsg;
+
+   gameMap->addObject(objectType, x, y);
+
+   // need to send the OBJECT message too
+   serverMsg.type = MSG_TYPE_OBJECT;
+   gameMap->getObjects()->back().serialize(serverMsg.buffer);
+
+   map<unsigned int, Player>::iterator it;
+   for (it = mapPlayers.begin(); it != mapPlayers.end(); it++)
+   {
+      if ( msgProcessor.sendMessage(&serverMsg, sock, &(it->second.addr)) < 0 )
+         error("sendMessage");
+   }
+}
