Index: client/Client/main.cpp
===================================================================
--- client/Client/main.cpp	(revision dee75ccb537d02261ab1aed25d2959feb558eabb)
+++ client/Client/main.cpp	(revision bc702829fa992477124b5b244ae31c4a3d666cdc)
@@ -395,7 +395,7 @@
          wndCurrent->draw(display);
 
-         chatConsole.draw(font, al_map_rgb(255,255,255));
-
          if(wndCurrent == wndMain) {
+            chatConsole.draw(font, al_map_rgb(255,255,255));
+
             al_draw_text(font, al_map_rgb(0, 255, 0), 4, 43, ALLEGRO_ALIGN_LEFT, "Message:");
 
@@ -558,21 +558,35 @@
                break;
             }
+            default:
+            {
+               cout << "(STATE_REGISTER) Received invalid message of type " << msg.type << endl;
+               break;
+            }
+         }
+
+         break;
+      }
+      case STATE_LOGIN:
+      {
+         switch(msg.type)
+         {
             case MSG_TYPE_LOGIN:
             {
                if (response.compare("Player has already logged in.") == 0)
                {
-                  username.clear();
-                  cout << "User login failed" << endl;
+                  goToLoginScreen();
+                  state = STATE_START;
+
                   lblLoginStatus->setText(response);
                }
                else if (response.compare("Incorrect username or password") == 0)
                {
-                  username.clear();
-                  cout << "User login failed" << endl;
+                  goToLoginScreen();
+                  state = STATE_START;
+
                   lblLoginStatus->setText(response);
                }
                else
                {
-                  state = STATE_LOGIN;
                   wndCurrent = wndMain;
                   
@@ -585,47 +599,6 @@
                   cout << "Player id: " << curPlayerId << endl;
                   cout << "Player health: " << p.health << endl;
-                  cout << "map size: " << mapPlayers.size() << endl;
+                  cout << "player map size: " << mapPlayers.size() << endl;
                }
-
-               break;
-            }
-            case MSG_TYPE_PLAYER:
-            {
-               Player p("", "");
-               p.deserialize(msg.buffer);
-               p.timeLastUpdated = getCurrentMillis();
-
-               mapPlayers[p.id] = p;
-
-               break;
-            }
-            case MSG_TYPE_OBJECT:
-            {
-               WorldMap::Object o(0, WorldMap::OBJECT_NONE, 0, 0);
-               o.deserialize(msg.buffer);
-               cout << "object id: " << o.id << endl;
-               gameMap->updateObject(o.id, o.type, o.pos.x, o.pos.y);
-
-               break;
-            }
-            default:
-            {
-               cout << "(STATE_REGISTER) Received invlaid message of type " << msg.type << endl;
-               break;
-            }
-         }
-
-         break;
-      }
-      case STATE_LOGIN:
-      {
-         switch(msg.type)
-         {
-            case MSG_TYPE_LOGIN:
-            {
-               cout << "Got a login message" << endl;
-               
-               chatConsole.addLine(response);
-               cout << "Added new line" << endl;
 
                break;
@@ -639,4 +612,5 @@
                   cout << "Logged out" << endl;
                   state = STATE_START;
+                  chatConsole.clear();
                   goToLoginScreen();
                }
@@ -657,11 +631,5 @@
                   p.isDead = false;
 
-               cout << mapPlayers[p.id].pos.x << ", " << mapPlayers[p.id].pos.y << endl;
-               cout << "health:" << mapPlayers[p.id].health << endl;
-               cout << "is dead?:" << mapPlayers[p.id].isDead << endl;
                mapPlayers[p.id] = p;
-               cout << mapPlayers[p.id].pos.x << ", " << mapPlayers[p.id].pos.y << endl;
-               cout << "health:" << mapPlayers[p.id].health << endl;
-               cout << "is dead?:" << mapPlayers[p.id].isDead << endl;
 
                break;
@@ -693,4 +661,5 @@
                WorldMap::Object o(0, WorldMap::OBJECT_NONE, 0, 0);
                o.deserialize(msg.buffer);
+               cout << "object id: " << o.id << endl;
                gameMap->updateObject(o.id, o.type, o.pos.x, o.pos.y);
 
@@ -925,4 +894,6 @@
 }
 
+// maybe need a goToGameScreen function as well and add state changes to these functions as well
+
 void registerAccount()
 {
@@ -973,4 +944,6 @@
 
    msgProcessor.sendMessage(&msgTo, sock, &server);
+
+   state = STATE_LOGIN;
 }
 
