Index: common/Player.cpp
===================================================================
--- common/Player.cpp	(revision 67d032c94add06207e07199439dd98e893ffc158)
+++ common/Player.cpp	(revision a1a3bd51b2971b55956f9e2e6fa0ef6e2790fce8)
@@ -83,24 +83,35 @@
 }
 
-void Player::move(void) {
+bool Player::move(WorldMap map) {
    int speed = 100; // pixels per second
    unsigned long long curTime = getCurrentMillis();
+   bool moveCanceled = false;
 
    // if we're at our target, don't move
    if (pos.x != target.x || pos.y != target.y) {
       float pixels = speed * (curTime-timeLastUpdated) / 1000.0;
+      double angle = atan2(target.y-pos.y, target.x-pos.x);
+      float dist = sqrt(pow(target.x-pos.x, 2) + pow(target.y-pos.y, 2));
+      POSITION newPos;
 
-      double angle = atan2(target.y-pos.y, target.x-pos.x);
-
-      float dist = sqrt(pow(target.x-pos.x, 2) + pow(target.y-pos.y, 2));
       if (dist <= pixels) {
          pos.x = target.x;
          pos.y = target.y;
       }else {
-         pos.x += cos(angle)*pixels;
-         pos.y += sin(angle)*pixels;
+         newPos.x = int(pos.x + cos(angle)*pixels);
+         newPos.y = int(pos.y + sin(angle)*pixels);
+
+         switch(map.getElement(newPos.x/25, newPos.y/25)) {
+            case WorldMap.TerrainType.TERRAIN_OCEAN:
+            case WorldMap.TerrainType.TERRAIN_ROCK:
+               target.x = pos.x;
+               target.y = pos.y;
+               moveCanceled = true;
+               break;
+         }
       }
    }
 
    timeLastUpdated = curTime;
+   return !moveCanceled;
 }
Index: common/Player.h
===================================================================
--- common/Player.h	(revision 67d032c94add06207e07199439dd98e893ffc158)
+++ common/Player.h	(revision a1a3bd51b2971b55956f9e2e6fa0ef6e2790fce8)
@@ -14,4 +14,5 @@
 
 #include "Common.h"
+#include "WorldMap.h"
 
 using namespace std;
@@ -32,5 +33,5 @@
    void setAddr(sockaddr_in addr);
 
-   void move();
+   bool move(WorldMap map);
 
    int id;
Index: common/WorldMap.cpp
===================================================================
--- common/WorldMap.cpp	(revision 67d032c94add06207e07199439dd98e893ffc158)
+++ common/WorldMap.cpp	(revision a1a3bd51b2971b55956f9e2e6fa0ef6e2790fce8)
@@ -15,12 +15,17 @@
 
    vctMap = new vector<vector<TerrainType>*>(width);
+   vctObjects = new vector<vector<ObjectType>*>(width);
 
    for (int x=0; x<width; x++) {
-      vector<TerrainType>* newVector = new vector<TerrainType>(height);
+      vector<TerrainType>* newMapVector = new vector<TerrainType>(height);
+      vector<ObjectType>* newObjectVector = new vector<ObjectType>(height);
 
-      for (int y=0; y<height; y++)
-         (*newVector)[y] = TERRAIN_NONE;
+      for (int y=0; y<height; y++) {
+         (*newMapVector)[y] = TERRAIN_NONE;
+         (*newObjectVector)[y] = OBJECT_NONE;
+      }
 
-      (*vctMap)[x] = newVector;
+      (*vctMap)[x] = newMapVector;
+      (*vctObjects)[x] = newObjectVector;
    }
 }
@@ -28,8 +33,11 @@
 WorldMap::~WorldMap()
 {
-   for (int x=0; x<width; x++)
+   for (int x=0; x<width; x++) {
       delete (*vctMap)[x];
+      delete (*vctObjects)[x];
+   }
 
    delete vctMap;
+   delete vctObjects;
 }
 
@@ -43,4 +51,15 @@
    cout << "getting element" << endl;
    (*(*vctMap)[x])[y] = t;
+}
+
+WorldMap::ObjectType WorldMap::getObject(int x, int y)
+{
+   return (*(*vctObjects)[x])[y];
+}
+
+void WorldMap::setObject(int x, int y, ObjectType t)
+{
+   cout << "getting object" << endl;
+   (*(*vctObjects)[x])[y] = t;
 }
 
@@ -57,4 +76,6 @@
          else
             m->setElement(x, y, TERRAIN_GRASS);
+
+         m->setObject(x, y, OBJECT_NONE);
       }
    }
@@ -102,30 +123,66 @@
             istringstream iss(line);
             string token;
-            int type;
-            TerrainType terrain;
 
-            for(int x=0; x<width; x++)
-            {
+            if (row < height) {
+               // load terrain
+
+               int type;
+               TerrainType terrain;
+
+               for(int x=0; x<width; x++)
+               {
+                  getline(iss, token, ',');
+                  cout << "token: " << token << endl;
+                  type = atoi(token.c_str());
+                  cout << "type: " << type << endl;
+
+                  switch(type) {
+                  case 1:
+                     terrain = TERRAIN_GRASS;
+                     break;
+                  case 2:
+                     terrain = TERRAIN_OCEAN;
+                     break;
+                  case 3:
+                     terrain = TERRAIN_ROCK;
+                     break;
+                  }
+
+                  cout << "About to set element" << endl;
+                  cout << "x: " << x << endl;
+                  cout << "row: " << row << endl;
+                  m->setElement(x, row, terrain);
+               }
+            }else {
+               // load objects
+
+               int x, y, type;
+               ObjectType object;
+
                getline(iss, token, ',');
-               cout << "token: " << token << endl;
+               cout << "token(x): " << token << endl;
+               x = atoi(token.c_str());
+
+               getline(iss, token, ',');
+               cout << "token(y): " << token << endl;
+               y = atoi(token.c_str());
+
+               getline(iss, token, ',');
+               cout << "token(type): " << token << endl;
                type = atoi(token.c_str());
-               cout << "type: " << type << endl;
 
                switch(type) {
+               case 0:
+                  object = OBJECT_NONE;
+                  break;
                case 1:
-                  terrain = TERRAIN_GRASS;
+                  object = OBJECT_RED_FLAG;
                   break;
                case 2:
-                  terrain = TERRAIN_OCEAN;
-                  break;
-               case 3:
-                  terrain = TERRAIN_ROCK;
+                  object = OBJECT_BLUE_FLAG;
                   break;
                }
 
-               cout << "About to set element" << endl;
-               cout << "x: " << x << endl;
-               cout << "row: " << row << endl;
-               m->setElement(x, row, terrain);
+               m->setObject(x, y, object);
             }
          }
Index: common/WorldMap.h
===================================================================
--- common/WorldMap.h	(revision 67d032c94add06207e07199439dd98e893ffc158)
+++ common/WorldMap.h	(revision a1a3bd51b2971b55956f9e2e6fa0ef6e2790fce8)
@@ -17,6 +17,13 @@
    };
 
+   enum ObjectType {
+      OBJECT_NONE,
+      OBJECT_RED_FLAG,
+      OBJECT_BLUE_FLAG
+   };
+
    int width, height;
    vector<vector<TerrainType>*>* vctMap;
+   vector<vector<ObjectType>*>* vctObjects;
 
    WorldMap(int width, int height);
@@ -27,4 +34,7 @@
    void setElement(int x, int y, TerrainType type);
 
+   ObjectType getObject(int x, int y);
+   void setObject(int x, int y, ObjectType type);
+
    static WorldMap* createDefaultMap();
    static WorldMap* loadMapFromFile(string filename);
