Index: common/WorldMap.cpp
===================================================================
--- common/WorldMap.cpp	(revision 05051c79f4e2f5fbd7fbf9a5f393d05aa8da0f65)
+++ common/WorldMap.cpp	(revision 6e66ffdf57ffae5c067c3c8b3e2101b2e7d49e5e)
@@ -67,11 +67,36 @@
    vector<WorldMap::Object> vctObjectsInRegion;
 
+   vector<WorldMap::Object>::iterator it;
+   for(it = vctObjects->begin(); it != vctObjects->end(); it++) {
+      if (it->pos.x/25 == x && it->pos.y/25 == y)
+         vctObjectsInRegion.push_back(*it);
+   }
+
    return vctObjectsInRegion;
 }
 
-void WorldMap::addObject(int x, int y, WorldMap::ObjectType t) {
-   WorldMap::Object o(t, x, y);
-
+// used by the server to create new objects
+void WorldMap::addObject(WorldMap::ObjectType t, int x, int y) {
+   WorldMap::Object o(t, vctObjects->size(), x, y);
    vctObjects->push_back(o);
+}
+
+// used by the client to update object positions or create objects it has not seen before
+void WorldMap::updateObject(int id, WorldMap::ObjectType t, int x, int y) {
+   vector<WorldMap::Object>::iterator it;
+   bool foundObject = false;
+
+   for (it = vctObjects->begin(); it != vctObjects->end(); it++) {
+      if (it->id == id) {
+         foundObject = true;
+         it->pos.x = x;
+         it->pos.y = y;
+      }
+   }
+
+   if (!foundObject) {
+      WorldMap::Object o(t, id, x, y);
+      vctObjects->push_back(o);
+   }
 }
 
@@ -190,7 +215,9 @@
                case 1:
                   structure = STRUCTURE_BLUE_FLAG;
+                  cout << "Should have added blue flag object" << endl;
                   break;
                case 2:
                   structure = STRUCTURE_RED_FLAG;
+                  cout << "Should have added red flag object" << endl;
                   break;
                }
@@ -213,15 +240,17 @@
 /*** Functions for Object ***/
 
-WorldMap::Object::Object(ObjectType type, POSITION pos) {
+WorldMap::Object::Object(ObjectType type, int id, int x, int y) {
    this->type = type;
-   this->pos = pos;
-}
-
-WorldMap::Object::Object(ObjectType type, int x, int y) {
-   this->type = type;
+   this->id = id;
    this->pos.x = x;
    this->pos.y = y;
 }
 
+WorldMap::Object::Object(ObjectType type, int id, POSITION pos) {
+   this->type = type;
+   this->id = id;
+   this->pos = pos;
+}
+
 WorldMap::Object::~Object() {
 }
Index: common/WorldMap.h
===================================================================
--- common/WorldMap.h	(revision 05051c79f4e2f5fbd7fbf9a5f393d05aa8da0f65)
+++ common/WorldMap.h	(revision 6e66ffdf57ffae5c067c3c8b3e2101b2e7d49e5e)
@@ -33,9 +33,10 @@
    class Object {
    public:
+      int id;
       ObjectType type;
       POSITION pos;
 
-      Object(ObjectType type, int x, int y);
-      Object(ObjectType type, POSITION pos);
+      Object(ObjectType type, int id, int x, int y);
+      Object(ObjectType type, int id, POSITION pos);
 
       ~Object();
@@ -58,5 +59,6 @@
 
    vector<Object> getObjects(int x, int y);
-   void addObject(int x, int y, ObjectType type);
+   void addObject(ObjectType type, int x, int y);
+   void updateObject(int id, WorldMap::ObjectType t, int x, int y);
 
    static WorldMap* createDefaultMap();
