Index: client/Client/main.cpp
===================================================================
--- client/Client/main.cpp	(revision 6319311052eaa6c0398a2f630339cacad808c9af)
+++ client/Client/main.cpp	(revision e6c26b8e97335601a55a8fba77c10c05b3b08c98)
@@ -54,5 +54,5 @@
 void initWinSock();
 void shutdownWinSock();
-void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, WorldMap *gameMap, map<unsigned int, Player>& mapPlayers, map<unsigned int, Projectile>& mapProjectiles, unsigned int& curPlayerId, int &scoreBlue, int &scoreRed);
+void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, WorldMap *gameMap, map<unsigned int, Player*>& mapPlayers, map<unsigned int, Projectile>& mapProjectiles, unsigned int& curPlayerId, int &scoreBlue, int &scoreRed);
 int getRefreshRate(int width, int height);
 void drawMessageStatus(ALLEGRO_FONT* font);
@@ -133,5 +133,5 @@
    ALLEGRO_TIMER *timer = NULL;
    bool key[4] = { false, false, false, false };
-   map<unsigned int, Player> mapPlayers;
+   map<unsigned int, Player*> mapPlayers;
    map<unsigned int, Projectile> mapProjectiles;
    unsigned int curPlayerId = -1;
@@ -362,10 +362,10 @@
                if (state == STATE_GAME) {
                   // find the current player in the player list
-                  map<unsigned int, Player>::iterator it;
+                  map<unsigned int, Player*>::iterator it;
                   Player* p = NULL;
                   for(it = mapPlayers.begin(); it != mapPlayers.end(); it++)
                   {
-                     if (it->second.id == curPlayerId)
-                        p = &it->second;
+                     if (it->second->id == curPlayerId)
+                        p = it->second;
                   }
 
@@ -416,5 +416,5 @@
                   cout << "Invalid point: User did not click on the map" << endl;
             }else if (ev.mouse.button == 2) {   // right click
-                  map<unsigned int, Player>::iterator it;
+                  map<unsigned int, Player*>::iterator it;
 
                   cout << "Detected a right-click" << endl;
@@ -423,6 +423,6 @@
                   for(it = mapPlayers.begin(); it != mapPlayers.end(); it++)
                   {
-                     if (it->second.id == curPlayerId)
-                        curPlayer = &it->second;
+                     if (it->second->id == curPlayerId)
+                        curPlayer = it->second;
                   }
 
@@ -432,5 +432,5 @@
                      // need to check if the right-click was actually on this player
                      // right now, this code will target all players other than the current one
-                     target = &it->second;
+                     target = it->second;
                      if (target->id != curPlayerId && target->team != curPlayer->team)
                      {
@@ -502,13 +502,13 @@
 
             // update players
-            map<unsigned int, Player>::iterator it;
+            map<unsigned int, Player*>::iterator it;
             for (it = mapPlayers.begin(); it != mapPlayers.end(); it++)
             {
-               it->second.updateTarget(mapPlayers);
+               it->second->updateTarget(mapPlayers);
             }
 
             for (it = mapPlayers.begin(); it != mapPlayers.end(); it++)
             {
-               it->second.move(gameMap);   // ignore return value
+               it->second->move(gameMap);    // ignore return value
             }
 
@@ -528,5 +528,5 @@
                Projectile proj = it2->second;
 
-               FLOAT_POSITION target = mapPlayers[proj.target].pos;
+               FLOAT_POSITION target = mapPlayers[proj.target]->pos;
                float angle =  atan2(target.y-proj.pos.toFloat().y, target.x-proj.pos.toFloat().x);
 
@@ -572,4 +572,10 @@
       delete game;
 
+   map<unsigned int, Player*>::iterator it;
+
+   for (it = mapPlayers.begin(); it != mapPlayers.end(); it++) {
+      delete it->second;
+   }
+
    al_destroy_event_queue(event_queue);
    al_destroy_display(display);
@@ -617,5 +623,5 @@
 }
 
-void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, WorldMap *gameMap, map<unsigned int, Player>& mapPlayers, map<unsigned int, Projectile>& mapProjectiles, unsigned int& curPlayerId, int &scoreBlue, int &scoreRed)
+void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, WorldMap *gameMap, map<unsigned int, Player*>& mapPlayers, map<unsigned int, Projectile>& mapProjectiles, unsigned int& curPlayerId, int &scoreBlue, int &scoreRed)
 {
    string response = string(msg.buffer);
@@ -671,5 +677,8 @@
                   Player p("", "");
                   p.deserialize(msg.buffer);
-                  mapPlayers[p.id] = p;
+
+                  if (mapPlayers.find(p.id) != mapPlayers.end())
+                     delete mapPlayers[p.id];
+                  mapPlayers[p.id] = new Player(p);
                   curPlayerId = p.id;
 
@@ -708,5 +717,7 @@
                   p.isDead = false;
 
-               mapPlayers[p.id] = p;
+               if (mapPlayers.find(p.id) != mapPlayers.end())
+                    delete mapPlayers[p.id];
+               mapPlayers[p.id] = new Player(p);
 
                break;
@@ -721,6 +732,6 @@
                memcpy(&y, msg.buffer+8, 4);
 
-               mapPlayers[id].target.x = x;
-               mapPlayers[id].target.y = y;
+               mapPlayers[id]->target.x = x;
+               mapPlayers[id]->target.y = y;
 
                break;
@@ -781,5 +792,5 @@
                cout << "target id: " << targetID << endl;
 
-               Player* source = &mapPlayers[id];
+               Player* source = mapPlayers[id];
                source->targetPlayer = targetID;
                source->isChasing = true;
