Index: server/server.cpp
===================================================================
--- server/server.cpp	(revision 012970027445bcb5af858de36c8fea1f47dc16fe)
+++ server/server.cpp	(revision 6c9bcdd776598f0b4c9d61b1db2b6abf28453d86)
@@ -138,5 +138,4 @@
    while (!done)
    {
-
       usleep(5000);
 
@@ -217,32 +216,18 @@
          }
 
-         // move all players
-         // maybe put this in a separate method
+         // process players currently in a game
          FLOAT_POSITION oldPos;
-         bool broadcastMove = false;
          for (it = mapPlayers.begin(); it != mapPlayers.end(); it++)
          {
+            bool broadcastMove = false;
+
+            // move player and perform associated tasks
             oldPos = it->second->pos;
-            if (it->second->move(gameMap)) {
-
-               // check if the move needs to be canceled
-               switch(gameMap->getElement(it->second->pos.x/25, it->second->pos.y/25))
-               {
-                  case WorldMap::TERRAIN_NONE:
-                  case WorldMap::TERRAIN_OCEAN:
-                  case WorldMap::TERRAIN_ROCK:
-                  {
-                     it->second->pos = oldPos;
-                     it->second->target.x = it->second->pos.x;
-                     it->second->target.y = it->second->pos.y;
-                     it->second->isChasing = false;
-                     broadcastMove = true;
-                     break;
-                  }
-                  default:
-                     // if there are no obstacles, do nothing
-                     break;
-               }
-
+            if (it->second->move(it->second->currentGame->getMap())) {
+
+               if (it->second->currentGame->processPlayerMovement(it->second, oldPos))
+                   broadcastMove = true;
+
+               /*
                WorldMap::ObjectType flagType;
                POSITION pos;
@@ -397,4 +382,5 @@
                   }
                }
+               */
 
                if (broadcastMove)
@@ -403,7 +389,10 @@
                   it->second->serialize(serverMsg.buffer);
 
+                  // only broadcast message to other players in the same game
                   cout << "about to broadcast move" << endl;
+
+                  map<unsigned int, Player*> playersInGame = it->second->currentGame->getPlayers();
                   map<unsigned int, Player*>::iterator it2;
-                  for (it2 = mapPlayers.begin(); it2 != mapPlayers.end(); it2++)
+                  for (it2 = playersInGame.begin(); it2 != playersInGamePlayers.end(); it2++)
                   {
                      if ( msgProcessor.sendMessage(&serverMsg, sock, &(it2->second->addr), &outputLog) < 0 )
