Index: client/Client/main.cpp
===================================================================
--- client/Client/main.cpp	(revision 054b50b4c0ddb3ab49418ed25fb5299ddc669974)
+++ client/Client/main.cpp	(revision a1a3bd51b2971b55956f9e2e6fa0ef6e2790fce8)
@@ -75,6 +75,4 @@
 bool doexit;
 
-map<unsigned int, Player> mapPlayers;
-
 Window* wndLogin;
 Window* wndMain;
@@ -226,8 +224,12 @@
       }
       else if(ev.type == ALLEGRO_EVENT_TIMER) {
-         redraw = true;
+         redraw = true; // seems like we should just call a draw function here instead
       }
       else if(ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) {
          doexit = true;
+
+         // perform a check to see if it's time to send an update to the server
+         // need to store num ticks since the lst update for this
+         // also check how often each update actually happens and how much it deviates from 60 times per second
       }
       else if(ev.type == ALLEGRO_EVENT_KEY_DOWN) {
@@ -264,13 +266,6 @@
       if (receiveMessage(&msgFrom, sock, &from) >= 0)
          processMessage(msgFrom, state, chatConsole, mapPlayers, curPlayerId);
- 
-      // update player positions
-      map<unsigned int, Player>::iterator it;
-      for (it = mapPlayers.begin(); it != mapPlayers.end(); it++)
-      {
-         it->second.move();
-      }
-
-      if (redraw && al_is_event_queue_empty(event_queue))
+
+      if (redraw)
       {
          redraw = false;
@@ -286,4 +281,11 @@
          else if(wndCurrent == wndMain) {
             al_draw_text(font, al_map_rgb(0, 255, 0), 4, 43, ALLEGRO_ALIGN_LEFT, "Message:");
+
+            // update player positions
+            map<unsigned int, Player>::iterator it;
+            for (it = mapPlayers.begin(); it != mapPlayers.end(); it++)
+            {
+               it->second.move();   // ignore return value
+            }
 
             drawMap(gameMap);
@@ -382,4 +384,7 @@
 {
    string response = string(msg.buffer);
+
+   cout << "Processing message" << endl;
+   cout << response << endl;
 
    switch(state)
@@ -419,5 +424,20 @@
                   cout << "Got a valid login response with the player" << endl;
                   cout << "Player id: " << curPlayerId << endl; 
+                  cout << "map size: " << mapPlayers.size() << endl;
                }
+
+               break;
+            }
+            case MSG_TYPE_PLAYER:   // kind of hacky to put this here
+            {
+               cout << "Got MSG_TYPE_PLAYER message in Start" << endl;
+
+               Player p("", "");
+               p.deserialize(msg.buffer);
+               p.timeLastUpdated = getCurrentMillis();
+               mapPlayers[p.id] = p;
+
+               cout << "new player id: " << p.id << endl;
+               cout << "map size: " << mapPlayers.size() << endl;
 
                break;
@@ -437,7 +457,15 @@
             case MSG_TYPE_LOGIN:
             {
+               cout << "Got a login message" << endl;
+               
                chatConsole.addLine(response);
-
+               cout << "Added new line" << endl;
+
+               break;
+            }
+            case MSG_TYPE_LOGOUT:
+            {
                cout << "Got a logout message" << endl;
+
                if (response.compare("You have successfully logged out.") == 0)
                {
@@ -446,14 +474,4 @@
                   wndCurrent = wndLogin;
                }
-               else
-               {
-                  cout << "Added new line" << endl;
-               }
-
-               break;
-            }
-            case MSG_TYPE_LOGOUT:
-            {
-               cout << "Got a logout message, but we don't process it" << endl;
 
                break;
@@ -461,8 +479,26 @@
             case MSG_TYPE_PLAYER:
             {
+               cout << "Got MSG_TYPE_PLAYER message in Login" << endl;
+
                Player p("", "");
                p.deserialize(msg.buffer);
                p.timeLastUpdated = getCurrentMillis();
                mapPlayers[p.id] = p;
+
+               break;
+            }
+            case MSG_TYPE_PLAYER_MOVE:
+            {
+               cout << "Got a player move message" << endl;
+
+               unsigned int id;
+               int x, y;
+
+               memcpy(&id, msg.buffer, 4);
+               memcpy(&x, msg.buffer+4, 4);
+               memcpy(&y, msg.buffer+8, 4);
+
+               mapPlayers[id].target.x = x;
+               mapPlayers[id].target.y = y;
 
                break;
@@ -498,4 +534,5 @@
       {
          WorldMap::TerrainType el = gameMap->getElement(x, y);
+         WorldMap::ObjectType obj = gameMap->getObject(x, y);
 
          if (el == WorldMap::TERRAIN_GRASS)
@@ -505,4 +542,9 @@
          else if (el == WorldMap::TERRAIN_ROCK)
             al_draw_filled_rectangle(x*25+mapPos.x, y*25+mapPos.y, x*25+25+mapPos.x, y*25+25+mapPos.y, al_map_rgb(100, 100, 0));
+
+         if (obj == WorldMap::OBJECT_RED_FLAG)
+            al_draw_filled_rectangle(x*25+5+mapPos.x, y*25+5+mapPos.y, x*25+20+mapPos.x, y*25+20+mapPos.y, al_map_rgb(255, 0, 0));
+         else if (obj == WorldMap::OBJECT_BLUE_FLAG)
+            al_draw_filled_rectangle(x*25+5+mapPos.x, y*25+5+mapPos.y, x*25+20+mapPos.x, y*25+20+mapPos.y, al_map_rgb(0, 0, 255));
       }
    }
Index: common/Player.cpp
===================================================================
--- common/Player.cpp	(revision 054b50b4c0ddb3ab49418ed25fb5299ddc669974)
+++ 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 054b50b4c0ddb3ab49418ed25fb5299ddc669974)
+++ 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 054b50b4c0ddb3ab49418ed25fb5299ddc669974)
+++ 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 054b50b4c0ddb3ab49418ed25fb5299ddc669974)
+++ 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);
Index: data/map.txt
===================================================================
--- data/map.txt	(revision 054b50b4c0ddb3ab49418ed25fb5299ddc669974)
+++ data/map.txt	(revision a1a3bd51b2971b55956f9e2e6fa0ef6e2790fce8)
@@ -12,2 +12,4 @@
 2,1,1,1,1,1,1,1,1,1,1,2
 2,2,2,2,2,2,2,2,2,2,2,2
+6,1,1
+6,10,2
