Index: server/server.cpp
===================================================================
--- server/server.cpp	(revision 8f851809d8645b70352c9cadd8571a1f5202a342)
+++ server/server.cpp	(revision 60940f85ae9d0dac7d59f0c7c8e6b406ed798346)
@@ -109,5 +109,5 @@
    }
 
-   WorldMap* gameMap = NULL; //WorldMap::createDefaultMap();
+   WorldMap* gameMap = WorldMap::loadMapFromFile("../data/map.txt");
  
    sock = socket(AF_INET, SOCK_DGRAM, 0);
@@ -157,14 +157,14 @@
                error("sendMessage");
          }
-
-         // update player positions
-         map<unsigned int, Player>::iterator it;
-         for (it = mapPlayers.begin(); it != mapPlayers.end(); it++)
-         {
-            it->second.move();
-         }
-
-         broadcastPlayerPositions(mapPlayers, sock);
-      }
+      }
+
+      // update player positions
+      map<unsigned int, Player>::iterator it;
+      for (it = mapPlayers.begin(); it != mapPlayers.end(); it++)
+      {
+         it->second.move();
+      }
+
+      broadcastPlayerPositions(mapPlayers, sock);
    }
 
@@ -176,6 +176,4 @@
    DataAccess da;
 
-   cout << "ip address: " << inet_ntoa(from.sin_addr) << endl;
-   cout << "port: " << from.sin_port << endl;
    cout << "MSG: type: " << clientMsg.type << endl;
    cout << "MSG contents: " << clientMsg.buffer << endl;
@@ -299,6 +297,4 @@
       case MSG_TYPE_PLAYER_MOVE:
       {
-         cout << "Got a move message" << endl;
-
          istringstream iss;
          iss.str(clientMsg.buffer);
@@ -311,9 +307,9 @@
          memcpy(&x, clientMsg.buffer+4, 4);
          memcpy(&y, clientMsg.buffer+8, 4);
-         
+
          cout << "x: " << x << endl;
          cout << "y: " << y << endl;
          cout << "id: " << id << endl;
-
+         
          if ( mapPlayers[id].addr.sin_addr.s_addr == from.sin_addr.s_addr &&
               mapPlayers[id].addr.sin_port == from.sin_port )
@@ -323,23 +319,25 @@
                gameMap->getElement(x/25, y/25) == WorldMap::TERRAIN_GRASS)
             {
-               // first we get the correct vector 
+               cout << "valid terrain" << endl;
+
+               cout << "orig x: " << mapPlayers[id].pos.x << endl;
+               cout << "orig y: " << mapPlayers[id].pos.y << endl;
+               // first we get the correct vector
                mapPlayers[id].target.x = x;
                mapPlayers[id].target.y = y;
                int xDiff = mapPlayers[id].target.x - mapPlayers[id].pos.x;
                int yDiff = mapPlayers[id].target.y - mapPlayers[id].pos.y;
-               cout << "xDiff: " << xDiff << endl;               
-               cout << "yDiff: " << yDiff << endl;               
+               cout << "xDiff: " << xDiff << endl;
+               cout << "yDiff: " << yDiff << endl;
 
                // then we get the correct angle
                double angle = atan2(yDiff, xDiff);
-               cout << "angle: " << angle << endl;               
+               cout << "angle: " << angle << endl;
 
                // finally we use the angle to determine
                // how much the player moves
                // the player will move 50 pixels in the correct direction
-               mapPlayers[id].pos.x += cos(angle)*50;
-               mapPlayers[id].pos.y += sin(angle)*50;
-               cout << "new x: " << mapPlayers[id].pos.x << endl;               
-               cout << "new y: " << mapPlayers[id].pos.y << endl;               
+               //mapPlayers[id].pos.x += cos(angle)*50;
+               //mapPlayers[id].pos.y += sin(angle)*50;
 
                serverMsg.type = MSG_TYPE_PLAYER_MOVE;
