Index: common/WorldMap.cpp
===================================================================
--- common/WorldMap.cpp	(revision e487381875396bdaf64765cbdc022477e1238ac0)
+++ common/WorldMap.cpp	(revision 7511a2b0ff95b2a94795fa2328bdea8e722bbc5c)
@@ -68,9 +68,10 @@
    return vctObjects;
 }
+
 vector<WorldMap::Object> WorldMap::getObjects(int x, int y) {
    vector<WorldMap::Object> vctObjectsInRegion;
 
    vector<WorldMap::Object>::iterator it;
-   for(it = vctObjects->begin(); it != vctObjects->end(); it++) {
+   for (it = vctObjects->begin(); it != vctObjects->end(); it++) {
       if (it->pos.x/25 == x && it->pos.y/25 == y)
          vctObjectsInRegion.push_back(*it);
@@ -82,5 +83,18 @@
 // used by the server to create new objects
 void WorldMap::addObject(WorldMap::ObjectType t, int x, int y) {
-   WorldMap::Object o(vctObjects->size(), t, x, y);
+   int id;
+   vector<WorldMap::Object>::iterator it;
+
+   for (id = 0; id < vctObjects->size(); id++) {
+      for (it = vctObjects->begin(); it != vctObjects->end(); it++) {
+         if (id == it->id)
+            break;
+      }
+
+      if (it == vctObjects->end())  // if no objects with this id exists
+         break;
+   }
+
+   WorldMap::Object o(id, t, x, y);
    vctObjects->push_back(o);
 }
@@ -91,7 +105,26 @@
    bool foundObject = false;
 
+   cout << "Searching for obbject to update" << endl;
+   switch (t) {
+   case WorldMap::OBJECT_BLUE_FLAG:
+      cout << "BLUE_FLAG" << endl;
+      break;
+   case WorldMap::OBJECT_RED_FLAG:
+      cout << "RED_FLAG" << endl;
+      break;
+   }
+
    for (it = vctObjects->begin(); it != vctObjects->end(); it++) {
       if (it->id == id) {
          foundObject = true;
+         cout << "Found object with id " << id << endl;
+         switch (it->type) {
+         case WorldMap::OBJECT_BLUE_FLAG:
+            cout << "BLUE_FLAG" << endl;
+            break;
+         case WorldMap::OBJECT_RED_FLAG:
+            cout << "RED_FLAG" << endl;
+            break;
+         }
          it->pos.x = x;
          it->pos.y = y;
