Index: client/Client/main.cpp
===================================================================
--- client/Client/main.cpp	(revision 321fbbcd4bc1a950bc6f5ab7ccb3e95550079f91)
+++ client/Client/main.cpp	(revision b48ef0995681563975dead9f94eb9d9b30fc09f1)
@@ -80,5 +80,6 @@
    STATE_START,
    STATE_LOBBY,
-   STATE_GAME
+   STATE_GAME,
+   STATE_NEW_GAME
 };
 
@@ -120,4 +121,5 @@
 bool debugging;
 map<string, int> mapGames;
+Game* game;
 
 MessageProcessor msgProcessor;
@@ -130,12 +132,14 @@
    ALLEGRO_TIMER *timer = NULL;
    bool key[4] = { false, false, false, false };
-   bool redraw = true;
-   doexit = false;
    map<unsigned int, Player> mapPlayers;
    map<unsigned int, Projectile> mapProjectiles;
    unsigned int curPlayerId = -1;
    int scoreBlue, scoreRed;
+
+   doexit = false;
+   debugging = false;
+   bool redraw = true;
    bool fullscreen = false;
-   debugging = false;
+   game = NULL;
 
    scoreBlue = 0;
@@ -169,5 +173,5 @@
       fprintf(stderr, "Could not load 'pirulen.ttf'.\n");
       getchar();
-	  return -1;
+      return -1;
    }
  
@@ -303,5 +307,5 @@
 
    initWinSock();
-	
+
    sock = socket(AF_INET, SOCK_DGRAM, 0);
    if (sock < 0)
@@ -545,4 +549,5 @@
 
    delete gameMap;
+   delete game;
 
    al_destroy_event_queue(event_queue);
@@ -575,5 +580,5 @@
    wVersionRequested = MAKEWORD(2, 2);
    wsaerr = WSAStartup(wVersionRequested, &wsaData);
-	
+
    if (wsaerr != 0) {
       cout << "The Winsock dll not found." << endl;
@@ -827,5 +832,5 @@
             case MSG_TYPE_GAME_INFO:
             {
-                cout << "Received a GAME_INFO message" << endl;
+               cout << "Received a GAME_INFO message" << endl;
 
                string gameName(msg.buffer+4);
@@ -843,4 +848,78 @@
             {
                cout << "(STATE_LOBBY) Received invlaid message of type " << msg.type << endl;
+
+               break;
+            }
+         }
+
+         break;
+      }
+      case STATE_NEW_GAME:
+      {
+         switch(msg.type)
+         {
+            case MSG_TYPE_GAME_INFO:
+            {
+               cout << "(STATE_NEW_GAME) Received a GAME_INFO message" << endl;
+
+               string gameName(msg.buffer+4);
+               int numPlayers;
+
+               //game = new Game(gameName);
+
+               memcpy(&numPlayers, msg.buffer, 4);
+               
+               cout << "Received game info for " << gameName << " (num players: " << numPlayers << ")" << endl;
+               
+               mapGames[gameName] = numPlayers;
+
+               break;
+            }
+            case MSG_TYPE_OBJECT:
+            {
+               cout << "(STATE_NEW_GAME) Received object message in STATE_LOBBY." << endl;
+
+               WorldMap::Object o(0, WorldMap::OBJECT_NONE, 0, 0);
+               o.deserialize(msg.buffer);
+               cout << "object id: " << o.id << endl;
+               game->getMap()->updateObject(o.id, o.type, o.pos.x, o.pos.y);
+
+               break;
+            }
+            case MSG_TYPE_REMOVE_OBJECT:
+            {
+               cout << "(STATE_NEW_GAME) Received REMOVE_OBJECT message!" << endl;
+
+               int id;
+               memcpy(&id, msg.buffer, 4);
+
+               cout << "Removing object with id " << id << endl;
+
+               if (!game->getMap()->removeObject(id))
+                  cout << "Did not remove the object" << endl;
+
+               break;
+            }
+            case MSG_TYPE_SCORE:
+            {
+               cout << "Received SCORE message!" << endl;
+
+               int blueScore;
+               memcpy(&blueScore, msg.buffer, 4);
+               cout << "blue score: " << blueScore << endl;
+               game->setBlueScore(blueScore);
+
+               int redScore;
+               memcpy(&redScore, msg.buffer+4, 4);
+               cout << "red score: " << redScore << endl;
+               game->setRedScore(redScore);
+
+               cout << "Processed SCORE message!" << endl;
+ 
+               break;
+            }
+            default:
+            {
+               cout << "(STATE_NEW_GAME) Received invalid message of type " << msg.type << endl;
 
                break;
@@ -1181,4 +1260,8 @@
    cout << "Creating game" << endl;
 
+   // hack to help transitions to multiple games
+   state = STATE_NEW_GAME;
+   game = new Game( txtCreateGame->getStr());
+
    string msg = txtCreateGame->getStr();
    txtCreateGame->clear();
