Index: common/Message.cpp
===================================================================
--- common/Message.cpp	(revision 5a64bea142d5f3694a0dd6c567c632ee4b97c3ee)
+++ common/Message.cpp	(revision 9b5d30bd77df410865678bf12cc80310383b1346)
@@ -15,4 +15,5 @@
 using namespace std;
 
+/*
 int sendMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest)
 {
@@ -33,2 +34,3 @@
    return ret;
 }
+*/
Index: common/Message.h
===================================================================
--- common/Message.h	(revision 5a64bea142d5f3694a0dd6c567c632ee4b97c3ee)
+++ common/Message.h	(revision 9b5d30bd77df410865678bf12cc80310383b1346)
@@ -26,7 +26,7 @@
 } NETWORK_MSG;
 
-int sendMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest);
+//int sendMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest);
 
-int receiveMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *source);
+//int receiveMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *source);
 
 #endif
Index: common/MessageProcessor.cpp
===================================================================
--- common/MessageProcessor.cpp	(revision 5a64bea142d5f3694a0dd6c567c632ee4b97c3ee)
+++ common/MessageProcessor.cpp	(revision 9b5d30bd77df410865678bf12cc80310383b1346)
@@ -11,7 +11,7 @@
 
 int MessageProcessor::sendMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest) {
+   msg->id = ++lastUsedId;
    MessageContainer message(*msg, *dest);
-   message.id = ++lastUsedId;
-   sentMessages[message.id] = message;
+   sentMessages[msg->id] = message;
 
    int ret =  sendto(sock, (char*)msg, sizeof(NETWORK_MSG), 0, (struct sockaddr *)dest, sizeof(struct sockaddr_in));
Index: common/MessageProcessor.h
===================================================================
--- common/MessageProcessor.h	(revision 5a64bea142d5f3694a0dd6c567c632ee4b97c3ee)
+++ common/MessageProcessor.h	(revision 9b5d30bd77df410865678bf12cc80310383b1346)
@@ -59,8 +59,6 @@
 
       MessageContainer(const MessageContainer& mc) {
-         this->id = mc.id;
+         this->msg = mc.msg;
          this->clientAddr = mc.clientAddr;
-         this->msg = mc.msg;
-         this->ackReceived = mc.ackReceived;
       }
 
@@ -73,8 +71,6 @@
       }
 
-      int id;
+      NETWORK_MSG msg;
       struct sockaddr_in clientAddr;
-      NETWORK_MSG msg;
-      bool ackReceived;
    };
 
Index: server/server.cpp
===================================================================
--- server/server.cpp	(revision 5a64bea142d5f3694a0dd6c567c632ee4b97c3ee)
+++ server/server.cpp	(revision 9b5d30bd77df410865678bf12cc80310383b1346)
@@ -29,4 +29,5 @@
 #include "../common/Common.h"
 #include "../common/Message.h"
+#include "../common/MessageProcessor.h"
 #include "../common/WorldMap.h"
 #include "../common/Player.h"
@@ -39,5 +40,5 @@
 // from used to be const. Removed that so I could take a reference
 // and use it to send messages
-bool processMessage(const NETWORK_MSG &clientMsg, struct sockaddr_in &from, map<unsigned int, Player>& mapPlayers, WorldMap* gameMap, unsigned int& unusedPlayerId, NETWORK_MSG &serverMsg, int sock, int &scoreBlue, int &scoreRed);
+bool processMessage(const NETWORK_MSG &clientMsg, struct sockaddr_in &from, MessageProcessor &msgProcessor, map<unsigned int, Player>& mapPlayers, WorldMap* gameMap, unsigned int& unusedPlayerId, NETWORK_MSG &serverMsg, int sock, int &scoreBlue, int &scoreRed);
 
 void updateUnusedPlayerId(unsigned int& id, map<unsigned int, Player>& mapPlayers);
@@ -85,4 +86,5 @@
    struct sockaddr_in from; // info of client sending the message
    NETWORK_MSG clientMsg, serverMsg;
+   MessageProcessor msgProcessor;
    map<unsigned int, Player> mapPlayers;
    map<unsigned int, Projectile> mapProjectiles;
@@ -146,4 +148,6 @@
       if (timeLastUpdated == 0 || (curTime-timeLastUpdated) >= 50) {
          timeLastUpdated = curTime;
+
+         msgProcessor.resendUnackedMessages(sock);
 
          map<unsigned int, Player>::iterator it;
@@ -185,5 +189,5 @@
                   for (it2 = mapPlayers.begin(); it2 != mapPlayers.end(); it2++)
                   {
-                     if ( sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )
+                     if ( msgProcessor.sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )
                         error("sendMessage");
                   }
@@ -200,5 +204,5 @@
                for (it2 = mapPlayers.begin(); it2 != mapPlayers.end(); it2++)
                {
-                  if ( sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )
+                  if ( msgProcessor.sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )
                      error("sendMessage");
                }
@@ -313,5 +317,5 @@
                   for (it2 = mapPlayers.begin(); it2 != mapPlayers.end(); it2++)
                   {
-                     if ( sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )
+                     if ( msgProcessor.sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )
                         error("sendMessage");
                   }
@@ -323,5 +327,5 @@
                   for (it2 = mapPlayers.begin(); it2 != mapPlayers.end(); it2++)
                   {
-                     if ( sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )
+                     if ( msgProcessor.sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )
                         error("sendMessage");
                   }
@@ -364,5 +368,5 @@
                   for (it2 = mapPlayers.begin(); it2 != mapPlayers.end(); it2++)
                   {
-                     if ( sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )
+                     if ( msgProcessor.sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )
                         error("sendMessage");
                   }
@@ -377,5 +381,5 @@
                   for (it2 = mapPlayers.begin(); it2 != mapPlayers.end(); it2++)
                   {
-                     if ( sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )
+                     if ( msgProcessor.sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )
                         error("sendMessage");
                   }
@@ -398,5 +402,5 @@
                for (it2 = mapPlayers.begin(); it2 != mapPlayers.end(); it2++)
                {
-                  if ( sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )
+                  if ( msgProcessor.sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )
                      error("sendMessage");
                }
@@ -434,5 +438,5 @@
                for (it2 = mapPlayers.begin(); it2 != mapPlayers.end(); it2++)
                {
-                  if (sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )
+                  if (msgProcessor.sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )
                      error("sendMessage");
                }
@@ -456,5 +460,5 @@
                for (it2 = mapPlayers.begin(); it2 != mapPlayers.end(); it2++)
                {
-                  if ( sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )
+                  if ( msgProcessor.sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )
                      error("sendMessage");
                }
@@ -472,5 +476,5 @@
                for (it2 = mapPlayers.begin(); it2 != mapPlayers.end(); it2++)
                {
-                  if ( sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )
+                  if ( msgProcessor.sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )
                      error("sendMessage");
                }
@@ -480,5 +484,5 @@
       }
 
-      n = receiveMessage(&clientMsg, sock, &from);
+      n = msgProcessor.receiveMessage(&clientMsg, sock, &from);
 
       if (n >= 0) {
@@ -493,5 +497,5 @@
             {
                cout << "Sent message back to " << it->second.name << endl;
-               if ( sendMessage(&serverMsg, sock, &(it->second.addr)) < 0 )
+               if ( msgProcessor.sendMessage(&serverMsg, sock, &(it->second.addr)) < 0 )
                   error("sendMessage");
             }
@@ -501,5 +505,5 @@
             cout << "Should be sending back the message" << endl;
 
-            if ( sendMessage(&serverMsg, sock, &from) < 0 )
+            if ( msgProcessor.sendMessage(&serverMsg, sock, &from) < 0 )
                error("sendMessage");
          }
@@ -510,5 +514,5 @@
 }
 
-bool processMessage(const NETWORK_MSG& clientMsg, struct sockaddr_in& from, map<unsigned int, Player>& mapPlayers, WorldMap* gameMap, unsigned int& unusedPlayerId, NETWORK_MSG& serverMsg, int sock, int &scoreBlue, int &scoreRed)
+bool processMessage(const NETWORK_MSG &clientMsg, struct sockaddr_in &from, MessageProcessor &msgProcessor, map<unsigned int, Player>& mapPlayers, WorldMap* gameMap, unsigned int& unusedPlayerId, NETWORK_MSG &serverMsg, int sock, int &scoreBlue, int &scoreRed)
 {
    DataAccess da;
@@ -595,5 +599,5 @@
                cout << "sending info about " << it->second.name  << endl;
                cout << "sending id " << it->second.id  << endl;
-               if ( sendMessage(&serverMsg, sock, &from) < 0 )
+               if ( msgProcessor.sendMessage(&serverMsg, sock, &from) < 0 )
                   error("sendMessage");
             }
@@ -608,5 +612,5 @@
                itObjects->serialize(serverMsg.buffer);
                cout << "sending item id " << itObjects->id  << endl;
-               if ( sendMessage(&serverMsg, sock, &from) < 0 )
+               if ( msgProcessor.sendMessage(&serverMsg, sock, &from) < 0 )
                   error("sendMessage");
             }
@@ -616,5 +620,5 @@
             memcpy(serverMsg.buffer, &scoreBlue, 4);
             memcpy(serverMsg.buffer+4, &scoreRed, 4);
-            if ( sendMessage(&serverMsg, sock, &from) < 0 )
+            if ( msgProcessor.sendMessage(&serverMsg, sock, &from) < 0 )
                error("sendMessage");
 
@@ -626,5 +630,5 @@
             {
                cout << "Sent message back to " << it->second.name << endl;
-               if ( sendMessage(&serverMsg, sock, &(it->second.addr)) < 0 )
+               if ( msgProcessor.sendMessage(&serverMsg, sock, &(it->second.addr)) < 0 )
                   error("sendMessage");
             }
@@ -779,5 +783,5 @@
                   for (it = mapPlayers.begin(); it != mapPlayers.end(); it++)
                   {
-                     if ( sendMessage(&serverMsg, sock, &(it->second.addr)) < 0 )
+                     if ( msgProcessor.sendMessage(&serverMsg, sock, &(it->second.addr)) < 0 )
                         error("sendMessage");
                   }
@@ -824,5 +828,5 @@
          for (it = mapPlayers.begin(); it != mapPlayers.end(); it++)
          {
-            if ( sendMessage(&serverMsg, sock, &(it->second.addr)) < 0 )
+            if ( msgProcessor.sendMessage(&serverMsg, sock, &(it->second.addr)) < 0 )
                error("sendMessage");
          }
