Index: itignore
===================================================================
--- .gitignore	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,12 +1,0 @@
-Debug/
-Release/
-ipch/
-*.suo
-*.sdf
-*.opensdf
-*.o
-*.log
-gameClient
-server
-!server/   # ignore the server exe, but not new files in the server directory
-graphics_engine
Index: ient/Client.sln
===================================================================
--- client/Client.sln	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,20 +1,0 @@
-﻿
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual C++ Express 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Client", "Client\Client.vcxproj", "{979248E5-8633-4ABF-B72E-797DB00F9A96}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Win32 = Debug|Win32
-		Release|Win32 = Release|Win32
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{979248E5-8633-4ABF-B72E-797DB00F9A96}.Debug|Win32.ActiveCfg = Debug|Win32
-		{979248E5-8633-4ABF-B72E-797DB00F9A96}.Debug|Win32.Build.0 = Debug|Win32
-		{979248E5-8633-4ABF-B72E-797DB00F9A96}.Release|Win32.ActiveCfg = Release|Win32
-		{979248E5-8633-4ABF-B72E-797DB00F9A96}.Release|Win32.Build.0 = Release|Win32
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-EndGlobal
Index: ient/Client/Button.cpp
===================================================================
--- client/Client/Button.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,49 +1,0 @@
-#include "Button.h"
-
-#include "../../common/Compiler.h"
-
-Button::Button(int x, int y, int width, int height, ALLEGRO_FONT *font, string str, void (*callback)()) :
-   GuiComponent(x, y, width, height, font)
-{
-   this->str = str;
-   this->callback = callback;
-}
-
-Button::~Button(void)
-{
-}
-
-void Button::draw(ALLEGRO_DISPLAY *display)
-{
-   al_set_target_bitmap(bitmap);
-   al_clear_to_color(al_map_rgb(0, 0, 0));
-
-   int fontHeight = al_get_font_line_height(font);
-
-   al_draw_text(font, al_map_rgb(0, 255, 0), this->width/2, (this->height-fontHeight)/2, ALLEGRO_ALIGN_CENTRE, str.c_str());
-
-   #ifdef WINDOWS
-      al_draw_rectangle(1, 1, this->width, this->height, al_map_rgb(0, 255, 0), 1);
-   #else
-      al_draw_rectangle(1, 0, this->width, this->height-1, al_map_rgb(0, 255, 0), 1);
-   #endif
-
-   al_set_target_bitmap(al_get_backbuffer(display));
-   al_draw_bitmap(bitmap, x, y, 0);
-}
-
-bool Button::handleEvent(ALLEGRO_EVENT& e)
-{
-   if (e.type == ALLEGRO_EVENT_MOUSE_BUTTON_UP) {
-      if (e.mouse.button == 1) {
-         if (this->x < e.mouse.x && e.mouse.x < (this->x+this->width)
-            && this->y < e.mouse.y && e.mouse.y < (this->y+this->height))
-         {
-            this->callback();
-            return true;
-         }
-      }
-   }
-
-   return false;
-}
Index: ient/Client/Button.h
===================================================================
--- client/Client/Button.h	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,25 +1,0 @@
-#ifndef _BUTTON_H
-#define _BUTTON_H
-
-#include "GuiComponent.h"
-
-#include <string>
-
-using namespace std;
-
-class Button :
-   public GuiComponent
-{
-private:
-   string str;
-   void (*callback)();
-
-public:
-   Button(int x, int y, int width, int height, ALLEGRO_FONT *font, string str, void (*callback)());
-   ~Button(void);
-
-   void draw(ALLEGRO_DISPLAY *display);
-   bool handleEvent(ALLEGRO_EVENT& e);
-};
-
-#endif
Index: ient/Client/Client.vcxproj
===================================================================
--- client/Client/Client.vcxproj	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,114 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <ProjectGuid>{979248E5-8633-4ABF-B72E-797DB00F9A96}</ProjectGuid>
-    <RootNamespace>Client</RootNamespace>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-    <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v140</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v140</PlatformToolset>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup />
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <WarningLevel>Level3</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>c:\allegro\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalLibraryDirectories>c:\allegro\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <AdditionalDependencies>allegro-5.0.10-monolith-md-debug.lib;%(AdditionalDependencies)</AdditionalDependencies>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <WarningLevel>Level3</WarningLevel>
-      <Optimization>MaxSpeed</Optimization>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <AdditionalIncludeDirectories>c:\allegro\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalLibraryDirectories>c:\allegro\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <AdditionalDependencies>allegro-5.0.10-monolith-md.lib;%(AdditionalDependencies)</AdditionalDependencies>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemGroup>
-    <ClCompile Include="..\..\common\Common.cpp" />
-    <ClCompile Include="..\..\common\Game.cpp" />
-    <ClCompile Include="..\..\common\GameSummary.cpp" />
-    <ClCompile Include="..\..\common\MessageContainer.cpp" />
-    <ClCompile Include="..\..\common\MessageProcessor.cpp" />
-    <ClCompile Include="..\..\common\Projectile.cpp" />
-    <ClCompile Include="..\..\common\WorldMap.cpp" />
-    <ClCompile Include="..\..\common\Player.cpp" />
-    <ClCompile Include="chat.cpp" />
-    <ClCompile Include="Button.cpp" />
-    <ClCompile Include="GameRender.cpp" />
-    <ClCompile Include="GuiComponent.cpp" />
-    <ClCompile Include="main.cpp" />
-    <ClCompile Include="RadioButtonList.cpp" />
-    <ClCompile Include="Textbox.cpp" />
-    <ClCompile Include="TextLabel.cpp" />
-    <ClCompile Include="Window.cpp" />
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="..\..\common\Common.h" />
-    <ClInclude Include="..\..\common\Compiler.h" />
-    <ClInclude Include="..\..\common\Game.h" />
-    <ClInclude Include="..\..\common\GameSummary.h" />
-    <ClInclude Include="..\..\common\MessageContainer.h" />
-    <ClInclude Include="..\..\common\MessageProcessor.h" />
-    <ClInclude Include="..\..\common\Projectile.h" />
-    <ClInclude Include="..\..\common\WorldMap.h" />
-    <ClInclude Include="..\..\common\Player.h" />
-    <ClInclude Include="chat.h" />
-    <ClInclude Include="Button.h" />
-    <ClInclude Include="GameRender.h" />
-    <ClInclude Include="GuiComponent.h" />
-    <ClInclude Include="RadioButtonList.h" />
-    <ClInclude Include="Textbox.h" />
-    <ClInclude Include="TextLabel.h" />
-    <ClInclude Include="Window.h" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="..\pirulen.ttf" />
-  </ItemGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
-</Project>
Index: ient/Client/Client.vcxproj.filters
===================================================================
--- client/Client/Client.vcxproj.filters	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,140 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <Filter Include="Source Files">
-      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
-      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
-    </Filter>
-    <Filter Include="Header Files">
-      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
-      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
-    </Filter>
-    <Filter Include="Resource Files">
-      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
-      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
-    </Filter>
-    <Filter Include="Source Files\common">
-      <UniqueIdentifier>{9ecfb491-9e8e-4a29-bc07-dd887204d590}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="Header Files\common">
-      <UniqueIdentifier>{6c9ad2f2-bc8d-4e25-9c5c-c4440c60991c}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="Header Files\gui">
-      <UniqueIdentifier>{c6c812ef-0533-42bc-9d71-aa40428b5ca8}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="Source Files\gui">
-      <UniqueIdentifier>{10ae8361-2a07-4085-b595-761b47868bad}</UniqueIdentifier>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="main.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="chat.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="GuiComponent.cpp">
-      <Filter>Source Files\gui</Filter>
-    </ClCompile>
-    <ClCompile Include="Textbox.cpp">
-      <Filter>Source Files\gui</Filter>
-    </ClCompile>
-    <ClCompile Include="Button.cpp">
-      <Filter>Source Files\gui</Filter>
-    </ClCompile>
-    <ClCompile Include="Window.cpp">
-      <Filter>Source Files\gui</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\common\Common.cpp">
-      <Filter>Source Files\common</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\common\Player.cpp">
-      <Filter>Source Files\common</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\common\WorldMap.cpp">
-      <Filter>Source Files\common</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\common\Projectile.cpp">
-      <Filter>Source Files\common</Filter>
-    </ClCompile>
-    <ClCompile Include="RadioButtonList.cpp">
-      <Filter>Source Files\gui</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\common\MessageProcessor.cpp">
-      <Filter>Source Files\common</Filter>
-    </ClCompile>
-    <ClCompile Include="TextLabel.cpp">
-      <Filter>Source Files\gui</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\common\MessageContainer.cpp">
-      <Filter>Source Files\common</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\common\Game.cpp">
-      <Filter>Source Files\common</Filter>
-    </ClCompile>
-    <ClCompile Include="GameRender.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\common\GameSummary.cpp">
-      <Filter>Source Files\common</Filter>
-    </ClCompile>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="chat.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="GuiComponent.h">
-      <Filter>Header Files\gui</Filter>
-    </ClInclude>
-    <ClInclude Include="Textbox.h">
-      <Filter>Header Files\gui</Filter>
-    </ClInclude>
-    <ClInclude Include="Button.h">
-      <Filter>Header Files\gui</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\common\Compiler.h">
-      <Filter>Header Files\common</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\common\Common.h">
-      <Filter>Header Files\common</Filter>
-    </ClInclude>
-    <ClInclude Include="Window.h">
-      <Filter>Header Files\gui</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\common\Player.h">
-      <Filter>Header Files\common</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\common\WorldMap.h">
-      <Filter>Header Files\common</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\common\Projectile.h">
-      <Filter>Header Files\common</Filter>
-    </ClInclude>
-    <ClInclude Include="RadioButtonList.h">
-      <Filter>Header Files\gui</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\common\MessageProcessor.h">
-      <Filter>Header Files\common</Filter>
-    </ClInclude>
-    <ClInclude Include="TextLabel.h">
-      <Filter>Header Files\gui</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\common\MessageContainer.h">
-      <Filter>Header Files\common</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\common\Game.h">
-      <Filter>Header Files\common</Filter>
-    </ClInclude>
-    <ClInclude Include="GameRender.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\common\GameSummary.h">
-      <Filter>Header Files\common</Filter>
-    </ClInclude>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="..\pirulen.ttf">
-      <Filter>Resource Files</Filter>
-    </None>
-  </ItemGroup>
-</Project>
Index: ient/Client/Client.vcxproj.user
===================================================================
--- client/Client/Client.vcxproj.user	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,16 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <LocalDebuggerCommandArguments>medievaltech.com 10000</LocalDebuggerCommandArguments>
-    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
-    <LocalDebuggerEnvironment>PATH=c:\allegro\bin;%PATH%</LocalDebuggerEnvironment>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <LocalDebuggerCommandArguments>medievaltech.com 10000</LocalDebuggerCommandArguments>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <LocalDebuggerEnvironment>PATH=c:\allegro\bin;%PATH%
-$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>
-    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
-  </PropertyGroup>
-</Project>
Index: ient/Client/GameRender.cpp
===================================================================
--- client/Client/GameRender.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,159 +1,0 @@
-#include "GameRender.h"
-
-#include <cmath>
-#include <iostream>
-
-#include <allegro5/allegro_primitives.h>
-
-#include "../../common/Common.h"
-
-using namespace std;
-
-void GameRender::drawMap(WorldMap* gameMap)
-{
-   POSITION mapPos;
-   mapPos.x = 0;
-   mapPos.y = 0;
-   mapPos = mapToScreen(mapPos);
-
-   for (int x=0; x<gameMap->width; x++)
-   {
-      for (int y=0; y<gameMap->height; y++)
-      {
-         TerrainType terrain = gameMap->getElement(x, y);
-         StructureType structure = gameMap->getStructure(x, y);
-
-         switch(terrain) {
-         case TERRAIN_GRASS:
-            al_draw_filled_rectangle(x*25+mapPos.x, y*25+mapPos.y, x*25+25+mapPos.x, y*25+25+mapPos.y, al_map_rgb(0, 255, 0));
-            break;
-         case TERRAIN_OCEAN:
-            al_draw_filled_rectangle(x*25+mapPos.x, y*25+mapPos.y, x*25+25+mapPos.x, y*25+25+mapPos.y, al_map_rgb(0, 0, 255));
-            break;
-         case TERRAIN_ROCK:
-            al_draw_filled_rectangle(x*25+mapPos.x, y*25+mapPos.y, x*25+25+mapPos.x, y*25+25+mapPos.y, al_map_rgb(100, 100, 0));
-            break;
-         case TERRAIN_NONE:
-            break;
-         }  
-
-         switch(structure) {
-         case STRUCTURE_BLUE_FLAG:
-            al_draw_circle(x*25+12+mapPos.x, y*25+12+mapPos.y, 12, al_map_rgb(0, 0, 0), 3);
-            //al_draw_filled_rectangle(x*25+5+mapPos.x, y*25+5+mapPos.y, x*25+20+mapPos.x, y*25+20+mapPos.y, al_map_rgb(0, 0, 255));
-            break;
-         case STRUCTURE_RED_FLAG:
-            al_draw_circle(x*25+12+mapPos.x, y*25+12+mapPos.y, 12, al_map_rgb(0, 0, 0), 3);
-            //al_draw_filled_rectangle(x*25+5+mapPos.x, y*25+5+mapPos.y, x*25+20+mapPos.x, y*25+20+mapPos.y, al_map_rgb(255, 0, 0));
-            break;
-         case STRUCTURE_NONE:
-            break;
-         }
-      }
-   }
-
-   for (int x=0; x<gameMap->width; x++)
-   {
-      for (int y=0; y<gameMap->height; y++)
-      {
-         vector<WorldMap::Object> vctObjects = gameMap->getObjects(x, y);
-
-         vector<WorldMap::Object>::iterator it;
-         for(it = vctObjects.begin(); it != vctObjects.end(); it++) {
-            switch(it->type) {
-               case OBJECT_BLUE_FLAG:
-                  al_draw_filled_rectangle(it->pos.x-8+mapPos.x, it->pos.y-8+mapPos.y, it->pos.x+8+mapPos.x, it->pos.y+8+mapPos.y, al_map_rgb(0, 0, 255));
-                  break;
-               case OBJECT_RED_FLAG:
-                  al_draw_filled_rectangle(it->pos.x-8+mapPos.x, it->pos.y-8+mapPos.y, it->pos.x+8+mapPos.x, it->pos.y+8+mapPos.y, al_map_rgb(255, 0, 0));
-                  break;
-               case OBJECT_NONE:
-                  break;
-            }
-         }
-      }
-   }
-}
-
-void GameRender::drawPlayers(map<unsigned int, Player*>& mapPlayers, ALLEGRO_FONT* font, unsigned int curPlayerId)
-{
-   map<unsigned int, Player*>::iterator it;
-
-   Player* p;
-   POSITION pos;
-   ALLEGRO_COLOR color;
-
-   for (it = mapPlayers.begin(); it != mapPlayers.end(); it++)
-   {
-      p = it->second;
-
-      if (p->isDead)
-         continue;
-
-      pos = mapToScreen(p->pos.toInt());
-
-      if (p->getId() == curPlayerId)
-         al_draw_filled_circle(pos.x, pos.y, 14, al_map_rgb(0, 0, 0));
-      
-      if (p->team == Player::TEAM_BLUE)
-         color = al_map_rgb(0, 0, 255);
-      else if (p->team == Player::TEAM_RED)
-         color = al_map_rgb(255, 0, 0);
-      else {
-         color = al_map_rgb(0, 0, 0);
-         cout << "Failed to determine player team when drawing player" << endl;
-      }
-      
-      al_draw_filled_circle(pos.x, pos.y, 12, color);
-
-      // draw player class
-      int fontHeight = al_get_font_line_height(font);
-
-      string strClass;
-      switch (p->playerClass) {
-      case Player::CLASS_WARRIOR:
-         strClass = "W";
-         break;
-      case Player::CLASS_RANGER:
-         strClass = "R";
-         break;
-      case Player::CLASS_NONE:
-         strClass = "";
-         break;
-      }
-      al_draw_text(font, al_map_rgb(0, 0, 0), pos.x, pos.y-fontHeight/2, ALLEGRO_ALIGN_CENTRE, strClass.c_str());
-
-      // draw player health
-      al_draw_filled_rectangle(pos.x-12, pos.y-24, pos.x+12, pos.y-16, al_map_rgb(0, 0, 0));
-      if (p->maxHealth != 0)
-         al_draw_filled_rectangle(pos.x-11, pos.y-23, pos.x-11+(22*p->health)/p->maxHealth, pos.y-17, al_map_rgb(255, 0, 0));
-
-      if (p->hasBlueFlag)
-         al_draw_filled_rectangle(pos.x+4, pos.y-18, pos.x+18, pos.y-4, al_map_rgb(0, 0, 255));
-      else if (p->hasRedFlag)
-         al_draw_filled_rectangle(pos.x+4, pos.y-18, pos.x+18, pos.y-4, al_map_rgb(255, 0, 0));
-   }
-}
-
-void GameRender::drawProjectiles(map<unsigned int, Projectile>& mapProjectiles, map<unsigned int, Player*>& mapPlayers)
-{
-   map<unsigned int, Projectile>::iterator it;
-   for (it = mapProjectiles.begin(); it != mapProjectiles.end(); it++)
-   {
-      Projectile proj = it->second;
-
-      FLOAT_POSITION target = mapPlayers[proj.target]->pos;
-      float angle =  atan2(target.y-proj.pos.toFloat().y, target.x-proj.pos.toFloat().x);
-
-      POSITION start, end;
-      start.x = cos(angle)*15+proj.pos.x;
-      start.y = sin(angle)*15+proj.pos.y;
-      end.x = proj.pos.x;
-      end.y = proj.pos.y;
-
-      start = mapToScreen(start);
-      end = mapToScreen(end);
-
-      al_draw_line(start.x, start.y, end.x, end.y, al_map_rgb(0, 0, 0), 4);
-   }
-}
Index: ient/Client/GameRender.h
===================================================================
--- client/Client/GameRender.h	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#ifndef _GAMERENDER_H
-#define _GAMERENDER_H
-
-/*
- * We don't want to place allegro drawing routines in any classes shared by the client and server
- * because the server shouldn't require Allegro
- */
-
-#include "../../common/Compiler.h"
-
-#include <map>
-
-#ifdef WINDOWS
-   #define WIN32_LEAN_AND_MEAN
-#endif
-
-#include <allegro5/allegro_font.h>
-
-#include "../../common/Player.h"
-#include "../../common/Projectile.h"
-#include "../../common/WorldMap.h"
-
-class GameRender
-{
-public:
-   static void drawMap(WorldMap* gameMap);
-   static void drawPlayers(map<unsigned int, Player*>& mapPlayers, ALLEGRO_FONT* font, unsigned int curPlayerId);
-   static void drawProjectiles(map<unsigned int, Projectile>& mapProjectiles, map<unsigned int, Player*>& mapPLayers);
-};
-
-#endif
-
Index: ient/Client/GuiComponent.cpp
===================================================================
--- client/Client/GuiComponent.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,25 +1,0 @@
-#include "GuiComponent.h"
-
-GuiComponent::GuiComponent(int x, int y, int width, int height, ALLEGRO_FONT *font)
-{
-   this->x = x;
-   this->y = y;
-   this->width = width;
-   this->height = height;
-   this->font = font;
-   this->bitmap = al_create_bitmap(width, height);
-}
-
-GuiComponent::~GuiComponent(void)
-{
-   al_destroy_bitmap(this->bitmap);
-}
-
-void GuiComponent::draw(ALLEGRO_DISPLAY *display)
-{
-}
-
-bool GuiComponent::handleEvent(ALLEGRO_EVENT& e)
-{
-   return false;
-}
Index: ient/Client/GuiComponent.h
===================================================================
--- client/Client/GuiComponent.h	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,23 +1,0 @@
-#ifndef _GUICOMPONENT_H
-#define _GUICOMPONENT_H
-
-#include <allegro5/allegro.h>
-#include <allegro5/allegro_primitives.h>
-#include <allegro5/allegro_font.h>
-
-class GuiComponent
-{
-protected:
-   int x, y, width, height;
-   ALLEGRO_BITMAP *bitmap;
-   ALLEGRO_FONT *font;
-
-public:
-   GuiComponent(int x, int y, int width, int height, ALLEGRO_FONT *font);
-   virtual ~GuiComponent(void);
-
-   virtual void draw(ALLEGRO_DISPLAY *display);
-   virtual bool handleEvent(ALLEGRO_EVENT& e);
-};
-
-#endif
Index: ient/Client/RadioButtonList.cpp
===================================================================
--- client/Client/RadioButtonList.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,70 +1,0 @@
-#include "RadioButtonList.h"
-
-#include <string>
-#include <cmath>
-
-using namespace std;
-
-RadioButtonList::RadioButtonList(int x, int y, string strLabel, ALLEGRO_FONT *font) :
-   GuiComponent(x, y, 300, 300, font)
-{
-   this->strLabel = strLabel;
-   this->selectedButton = -1;
-}
-
-
-RadioButtonList::~RadioButtonList(void)
-{
-}
-
-void RadioButtonList::draw(ALLEGRO_DISPLAY *display)
-{
-   al_set_target_bitmap(bitmap);
-   al_clear_to_color(al_map_rgb(0, 0, 0));
-
-   //int fontHeight = al_get_font_line_height(font);
-
-   al_draw_text(font, al_map_rgb(0, 255, 0), 0, 0, ALLEGRO_ALIGN_LEFT, this->strLabel.c_str());
-   for(unsigned int i=0; i<this->vctRadioButtons.size(); i++) {
-      al_draw_circle(12, 26+i*20, 8, al_map_rgb(0, 255, 0), 1);
-      if (i == this->selectedButton)
-         al_draw_filled_circle(12, 26+i*20, 6, al_map_rgb(0, 255, 0));
-      al_draw_text(font, al_map_rgb(0, 255, 0), 26, 20+i*20, ALLEGRO_ALIGN_LEFT, this->vctRadioButtons[i].c_str());
-   }
-
-   al_set_target_bitmap(al_get_backbuffer(display));
-   al_draw_bitmap(bitmap, x, y, 0);
-}
-
-bool RadioButtonList::handleEvent(ALLEGRO_EVENT& e)
-{
-   int centerX, centerY;
-   centerX = x+12;
-
-   if (e.type == ALLEGRO_EVENT_MOUSE_BUTTON_UP) {
-      if (e.mouse.button == 1) {
-         for (unsigned int i=0; i<this->vctRadioButtons.size(); i++) {
-            centerY = y+26+i*20;
-
-            if (sqrt(pow((float)(e.mouse.x-centerX), 2.0f)+pow((float)(e.mouse.y-centerY), 2.0f))< 8) {
-               this->selectedButton = i;
-               return true;
-            }
-         }
-      }
-   }
-
-   return false;
-}
-
-void RadioButtonList::addRadioButton(string s) {
-   this->vctRadioButtons.push_back(s);
-}
-
-int RadioButtonList::getSelectedButton() {
-   return this->selectedButton;
-}
-
-void RadioButtonList::setSelectedButton(int b) {
-   this->selectedButton = b;
-}
Index: ient/Client/RadioButtonList.h
===================================================================
--- client/Client/RadioButtonList.h	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#ifndef _RADIOBUTTONLIST_H
-#define _RADIOBUTTONLIST_H
-
-#include "GuiComponent.h"
-
-#include <string>
-#include <vector>
-
-using namespace std;
-
-class RadioButtonList :
-   public GuiComponent
-{
-private:
-   string strLabel;
-   vector<string> vctRadioButtons;
-   unsigned int selectedButton;
-
-public:
-   RadioButtonList(int x, int y, string strLabel, ALLEGRO_FONT *font);
-   ~RadioButtonList(void);
-
-   void draw(ALLEGRO_DISPLAY *display);
-   bool handleEvent(ALLEGRO_EVENT& e);
-
-   void addRadioButton(string s);
-   int getSelectedButton();
-   void setSelectedButton(int b);
-};
-
-#endif
-
Index: ient/Client/TextLabel.cpp
===================================================================
--- client/Client/TextLabel.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,53 +1,0 @@
-#include "TextLabel.h"
-
-#include <iostream>
-
-TextLabel::TextLabel(int x, int y, int width, int height, ALLEGRO_FONT *font, string str, int alignment) :
-   GuiComponent(x, y, width, height, font)
-{
-   this->str = str;
-   this->alignment = alignment;
-}
-
-TextLabel::~TextLabel(void)
-{
-}
-
-void TextLabel::draw(ALLEGRO_DISPLAY *display)
-{
-   al_set_target_bitmap(bitmap);
-   al_clear_to_color(al_map_rgb(0, 0, 0));
-
-   int fontHeight = al_get_font_line_height(font);
-   int targetX;
-
-   switch(this->alignment) {
-      case ALLEGRO_ALIGN_LEFT:
-         targetX = 0;
-         break;
-      case ALLEGRO_ALIGN_RIGHT:
-         targetX = this->width;
-         break;
-      case ALLEGRO_ALIGN_CENTRE:
-         targetX = this->width/2;
-         break;
-      default:
-         cout << "Invalid alignment: " << this->alignment << endl;
-         targetX = 0;
-         break;
-   }
-
-   al_draw_text(font, al_map_rgb(0, 255, 0), targetX, (this->height-fontHeight)/2, this->alignment, this->str.c_str());
-
-   al_set_target_bitmap(al_get_backbuffer(display));
-   al_draw_bitmap(bitmap, x, y, 0);
-}
-
-bool TextLabel::handleEvent(ALLEGRO_EVENT& e)
-{
-   return false;
-}
-
-void TextLabel::setText(string str) {
-   this->str = str;
-}
Index: ient/Client/TextLabel.h
===================================================================
--- client/Client/TextLabel.h	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,27 +1,0 @@
-#ifndef _TEXTLABEL_H
-#define _TEXTLABEL_H
-
-#include "GuiComponent.h"
-
-#include <string>
-
-using namespace std;
-
-class TextLabel :
-   public GuiComponent
-{
-private:
-   string str;
-   int alignment;
-
-public:
-   TextLabel(int x, int y, int width, int height, ALLEGRO_FONT *font, string str, int alignment);
-   ~TextLabel(void);
-
-   void draw(ALLEGRO_DISPLAY *display);
-   bool handleEvent(ALLEGRO_EVENT& e);
-
-   void setText(string str);
-};
-
-#endif
Index: ient/Client/Textbox.cpp
===================================================================
--- client/Client/Textbox.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,189 +1,0 @@
-#include "Textbox.h"
-
-#include <iostream>
-
-#include "../../common/Compiler.h"
-
-using namespace std;
-
-Textbox::Textbox(int x, int y, int width, int height, ALLEGRO_FONT *font) :
-   GuiComponent(x, y, width, height, font)
-{
-   str = "";
-   selected = false;
-   shiftPressed = false;
-   
-   // populate the shift map
-   for(int i=0; i<26; i++)
-      shiftMap['a'+i] = 'A'+i;
-
-   shiftMap['1'] = '!';
-   shiftMap['2'] = '@';
-   shiftMap['3'] = '#';
-   shiftMap['4'] = '$';
-   shiftMap['5'] = '%';
-   shiftMap['6'] = '^';
-   shiftMap['7'] = '&';
-   shiftMap['8'] = '*';
-   shiftMap['9'] = '(';
-   shiftMap['0'] = ')';
-
-   shiftMap['`'] = '~';
-   shiftMap['-'] = '_';
-   shiftMap['='] = '+';
-   shiftMap['['] = '{';
-   shiftMap[']'] = '}';
-   shiftMap['\\'] = '|';
-   shiftMap[';'] = ':';
-   shiftMap['\''] = '\"';
-   shiftMap[','] = '<';
-   shiftMap['.'] = '>';
-   shiftMap['/'] = '?';
-   shiftMap[' '] = ' ';
-}
-
-Textbox::~Textbox(void)
-{
-}
-
-const string& Textbox::getStr() const
-{
-   return str;
-}
-
-void Textbox::clear(void)
-{
-   str.clear();
-}
-
-void Textbox::draw(ALLEGRO_DISPLAY *display)
-{
-   al_set_target_bitmap(bitmap);
-   al_clear_to_color(al_map_rgb(0, 0, 0));
-
-   int textWidth = al_get_text_width(font, str.c_str());
-   int fontHeight = al_get_font_line_height(font);
-   
-   int textPos = 1;
-   if(textWidth > this->width)
-      textPos = this->width-textWidth-3;
-
-   al_draw_text(font, al_map_rgb(0, 255, 0), textPos, (this->height-fontHeight)/2, ALLEGRO_ALIGN_LEFT, str.c_str());
-
-   #ifdef WINDOWS
-      al_draw_rectangle(1, 1, this->width, this->height, al_map_rgb(0, 255, 0), 1);
-   #else
-      al_draw_rectangle(1, 0, this->width, this->height-1, al_map_rgb(0, 255, 0), 1);
-   #endif
-
-   al_set_target_bitmap(al_get_backbuffer(display));
-   al_draw_bitmap(bitmap, x, y, 0);
-}
-
-bool Textbox::handleEvent(ALLEGRO_EVENT& e)
-{
-   ALLEGRO_KEYBOARD_STATE keys;
-   al_get_keyboard_state(&keys);
-
-   if (e.type == ALLEGRO_EVENT_MOUSE_BUTTON_UP) {
-      if (e.mouse.button == 1) {
-         if (this->x < e.mouse.x && e.mouse.x < (this->x+this->width)
-            && this->y < e.mouse.y && e.mouse.y < (this->y+this->height))
-         {
-            selected = true;
-            return true;
-         }else
-            selected = false;
-      }
-
-      return false;
-   }
-
-   if (!selected)
-      return false;
-
-   if (e.type == ALLEGRO_EVENT_KEY_DOWN) {
-      char newChar = 0;
-
-      if (ALLEGRO_KEY_A <= e.keyboard.keycode && e.keyboard.keycode <= ALLEGRO_KEY_Z)
-         newChar = 'a'+e.keyboard.keycode-ALLEGRO_KEY_A;
-      else if (ALLEGRO_KEY_0 <= e.keyboard.keycode && e.keyboard.keycode <= ALLEGRO_KEY_9)
-         newChar = '0'+e.keyboard.keycode-ALLEGRO_KEY_0;
-      else {
-         switch(e.keyboard.keycode)
-         {
-         case ALLEGRO_KEY_TILDE:
-            newChar = '`';
-            break;
-         case ALLEGRO_KEY_MINUS:
-            newChar = '-';
-            break;
-         case ALLEGRO_KEY_EQUALS:
-            newChar = '=';
-            break;
-         case ALLEGRO_KEY_OPENBRACE:
-            newChar = '[';
-            break;
-         case ALLEGRO_KEY_CLOSEBRACE:
-            newChar = ']';
-            break;
-         case ALLEGRO_KEY_SEMICOLON:
-            newChar = ';';
-            break;
-         case ALLEGRO_KEY_QUOTE:
-            newChar = '\'';
-            break;
-         case ALLEGRO_KEY_BACKSLASH:
-            newChar = '\\';
-            break;
-         case ALLEGRO_KEY_COMMA:
-            newChar = ',';
-            break;
-         case ALLEGRO_KEY_FULLSTOP:
-            newChar = '.';
-            break;
-         case ALLEGRO_KEY_SLASH:
-            newChar = '/';
-            break;
-         case ALLEGRO_KEY_SPACE:
-            newChar = ' ';
-            break;
-         case  ALLEGRO_KEY_BACKSPACE:
-            if (str.size() > 0)
-            {
-               str = str.substr(0, str.size()-1);
-               return true;
-            }
-            else
-               return false;
-            break;
-         case  ALLEGRO_KEY_LSHIFT:
-         case  ALLEGRO_KEY_RSHIFT:
-            shiftPressed = true;
-            break;
-         default:
-            cout << "unknown keycode: " << e.keyboard.keycode << endl;
-            break;
-         }
-      }
-
-      if (newChar != 0) {
-         if (al_key_down(&keys, ALLEGRO_KEY_LSHIFT) || al_key_down(&keys, ALLEGRO_KEY_RSHIFT))
-            newChar = shiftMap[newChar];
-
-         str.append(1, newChar);
-         return true;
-      }
-   }
-   else if (e.type == ALLEGRO_EVENT_KEY_UP) {
-      switch(e.keyboard.keycode)
-      {
-      case ALLEGRO_KEY_LSHIFT:
-      case ALLEGRO_KEY_RSHIFT:
-         shiftPressed = false;
-         break;
-      }
-   }
-
-   return false;
-}
Index: ient/Client/Textbox.h
===================================================================
--- client/Client/Textbox.h	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,35 +1,0 @@
-#ifndef _TEXTBOX_H
-#define _TEXTBOX_H
-
-#include "GuiComponent.h"
-
-#include <string>
-#include <map>
-
-using namespace std;
-
-class Textbox :
-   public GuiComponent
-{
-private:
-   string str;
-   bool selected;
-   bool shiftPressed;
-   map<char, char> shiftMap;
-
-public:
-   Textbox(int x, int y, int width, int height, ALLEGRO_FONT *font);
-   ~Textbox(void);
-
-   // This might lead to a memory leak if the textbox is deleted because it
-   // returns a reference to the string.
-   // string getStr() const; will copy the string and return it instead
-   const string& getStr() const;
-
-   void clear(void);
-   void draw(ALLEGRO_DISPLAY *display);
-   bool handleEvent(ALLEGRO_EVENT& e);
-};
-
-#endif
-
Index: ient/Client/Window.cpp
===================================================================
--- client/Client/Window.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#include "Window.h"
-
-Window::Window(int x, int y, int width, int height) :
-   GuiComponent(x, y, width, height, NULL)
-{
-}
-
-Window::~Window(void)
-{
-}
-
-GuiComponent* Window::addComponent(GuiComponent* comp)
-{
-   this->vctGui.push_back(comp);
-   return comp;
-}
-
-GuiComponent* Window::getComponent(int x)
-{
-   return this->vctGui[x];
-}
-
-void Window::draw(ALLEGRO_DISPLAY *display)
-{
-   al_clear_to_color(al_map_rgb(0, 0, 0));
-
-   for(unsigned int x=0; x<this->vctGui.size(); x++)
-      this->vctGui[x]->draw(display);
-}
-
-bool Window::handleEvent(ALLEGRO_EVENT& e)
-{
-   for(unsigned int x=0; x<this->vctGui.size(); x++) {
-      if(this->vctGui[x]->handleEvent(e)) {
-         return true;
-      }
-   }
-
-   return false;
-}
Index: ient/Client/Window.h
===================================================================
--- client/Client/Window.h	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,26 +1,0 @@
-#ifndef _WINDOW_H
-#define _WINDOW_H
-
-#include "GuiComponent.h"
-
-#include <vector>
-
-using namespace std;
-
-class Window :
-   public GuiComponent
-{
-private:
-   vector<GuiComponent*> vctGui;
-
-public:
-   Window(int x, int y, int width, int height);
-   ~Window(void);
-
-   GuiComponent* addComponent(GuiComponent* comp);
-   GuiComponent* getComponent(int x);
-   void draw(ALLEGRO_DISPLAY *display);
-   bool handleEvent(ALLEGRO_EVENT& e);
-};
-
-#endif
Index: ient/Client/chat.cpp
===================================================================
--- client/Client/chat.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,66 +1,0 @@
-#include "chat.h"
-
-chat::chat(void)
-{
-}
-
-chat::~chat(void)
-{
-}
-
-string chat::getInput()
-{
-   string temp = strEnteredInput;
-   strEnteredInput.clear();
-   return temp;
-}
-
-void chat::draw(ALLEGRO_FONT *font, ALLEGRO_COLOR color)
-{
-   for(unsigned int x=0; x<vctChat.size(); x++)
-      al_draw_text(font, color, 5, 100+x*15, ALLEGRO_ALIGN_LEFT, vctChat[x].c_str());
-
-   // I think this might never be used
-   al_draw_text(font, color, 5, 460, ALLEGRO_ALIGN_LEFT, strPrompt.c_str());
-}
-
-void chat::addLine(string s)
-{
-   vctChat.push_back(s);
-}
-
-void chat::clear() {
-   vctChat.clear();
-}
-
-// returns true if the event was consumed, false if it should be passed on
-bool chat::handleEvent(ALLEGRO_EVENT e)
-{
-   ALLEGRO_KEYBOARD_STATE keys;
-   al_get_keyboard_state(&keys);
-
-   if (e.type == ALLEGRO_EVENT_KEY_DOWN) {
-      char newChar = 0;
-
-      if (ALLEGRO_KEY_A <= e.keyboard.keycode && e.keyboard.keycode <= ALLEGRO_KEY_Z) {
-         newChar = 'a'+e.keyboard.keycode-ALLEGRO_KEY_A;
-         if (al_key_down(&keys, ALLEGRO_KEY_LSHIFT) || al_key_down(&keys, ALLEGRO_KEY_RSHIFT))
-            newChar -= 32;
-      }
-      if (ALLEGRO_KEY_0 <= e.keyboard.keycode && e.keyboard.keycode <= ALLEGRO_KEY_9)
-         newChar = '0'+e.keyboard.keycode-ALLEGRO_KEY_0;
-
-      if (newChar != 0) {
-         strPrompt.append(1, newChar);
-         return true;
-      }
-
-      if (e.keyboard.keycode == ALLEGRO_KEY_ENTER) {
-         strEnteredInput = strPrompt;
-         strPrompt.clear();
-         return true;
-      }
-   }
-   
-   return false;
-}
Index: ient/Client/chat.h
===================================================================
--- client/Client/chat.h	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#ifndef _CHAT_H
-#define _CHAT_H
-
-#include <string>
-#include <vector>
-
-#include <allegro5/allegro.h>
-#include <allegro5/allegro_font.h>
-
-using namespace std;
-
-class chat
-{
-private:
-   vector<string> vctChat;
-   string strPrompt;
-   string strEnteredInput;
-public:
-   chat(void);
-   ~chat(void);
-
-   string getInput();
-
-   void draw(ALLEGRO_FONT *font, ALLEGRO_COLOR color);
-   void addLine(string s);
-   void clear();
-
-   bool handleEvent(ALLEGRO_EVENT e);
-};
-
-#endif
-
Index: ient/Client/main.cpp
===================================================================
--- client/Client/main.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,1614 +1,0 @@
-#include "../../common/Compiler.h"
-
-#if defined WINDOWS
-   #include <winsock2.h>
-   #include <ws2tcpip.h>
-#elif defined LINUX
-   #include <sys/types.h>
-   #include <unistd.h>
-   #include <sys/socket.h>
-   #include <netinet/in.h>
-   #include <netdb.h>
-   #include <cstring>
-#elif defined MAC
-   #include <netdb.h>
-#endif
-
-#include <cstdio>
-#include <cstdlib>
-#include <sys/types.h>
-#include <string>
-#include <iostream>
-#include <iomanip>
-#include <sstream>
-#include <fstream>
-#include <map>
-#include <vector>
-#include <stdexcept>
-
-#include <allegro5/allegro.h>
-#include <allegro5/allegro_font.h>
-#include <allegro5/allegro_ttf.h>
-#include <allegro5/allegro_primitives.h>
-
-#include "../../common/Common.h"
-#include "../../common/MessageContainer.h"
-#include "../../common/MessageProcessor.h"
-#include "../../common/WorldMap.h"
-#include "../../common/Player.h"
-#include "../../common/Projectile.h"
-#include "../../common/Game.h"
-#include "../../common/GameSummary.h"
-
-#include "Window.h"
-#include "TextLabel.h"
-#include "Button.h"
-#include "Textbox.h"
-#include "RadioButtonList.h"
-
-#include "GameRender.h"
-
-#include "chat.h"
-
-#ifdef WINDOWS
-   #pragma comment(lib, "ws2_32.lib")
-#endif
-
-using namespace std;
-
-void initWinSock();
-void shutdownWinSock();
-void createGui(ALLEGRO_FONT* font);
-
-void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, map<unsigned int, Player*>& mapPlayers, map<string, int>& mapGames, unsigned int& curPlayerId, string& alertMessage);
-void handleMsgPlayer(NETWORK_MSG &msg, map<unsigned int, Player*>& mapPlayers, map<string, int>& mapGames);
-void handleMsgGameInfo(NETWORK_MSG &msg, map<unsigned int, Player*>& mapPlayers, map<string, int>& mapGames);
-
-int getRefreshRate(int width, int height);
-void drawMessageStatus(ALLEGRO_FONT* font);
-
-// Callback declarations
-void goToLoginScreen();
-void goToRegisterScreen();
-void registerAccount();
-void login();
-void logout();
-void quit();
-void sendChatMessage();
-void toggleDebugging();
-void goToProfileScreen();
-void goToLobbyScreen();
-void joinGame(); // for joining the game lobby
-void createGame(); // for joining the game lobby
-void joinWaitingArea();
-void joinRedTeam();
-void joinBlueTeam();
-void startGame(); // for leaving game lobby and starting the actual game
-void leaveGame();
-void closeGameSummary();
-
-const float FPS = 60;
-const int SCREEN_W = 1024;
-const int SCREEN_H = 768;
-
-enum STATE {
-   STATE_START,
-   STATE_LOBBY,
-   STATE_GAME_LOBBY,
-   STATE_GAME
-};
-
-int state;
-
-bool doexit;
-
-vector<GuiComponent*> vctComponents;
-
-Window* wndLogin;
-Window* wndRegister;
-Window* wndLobby;
-Window* wndLobbyDebug;
-Window* wndProfile;
-Window* wndGameLobby;
-Window* wndGame;
-Window* wndGameSummary;
-Window* wndCurrent;
-
-// wndLogin
-Textbox* txtUsername;
-Textbox* txtPassword;
-TextLabel* lblLoginStatus;
-
-// wndRegister
-Textbox* txtUsernameRegister;
-Textbox* txtPasswordRegister;
-RadioButtonList* rblClasses;
-TextLabel* lblRegisterStatus;
-
-// wndLobby
-Textbox* txtJoinGame;
-Textbox* txtCreateGame;
-Textbox* txtChat;
-
-int sock;
-struct sockaddr_in server, from;
-struct hostent *hp;
-NETWORK_MSG msgTo, msgFrom;
-string username;
-chat chatConsole, debugConsole;
-bool debugging;
-Game* game;
-GameSummary* gameSummary;
-Player* currentPlayer;
-
-int honorPoints, wins, losses, numGames;
-int** gameHistory;
-
-MessageProcessor msgProcessor;
-
-string alertMessage;
-
-int main(int argc, char **argv) {
-   ALLEGRO_DISPLAY *display = NULL;
-   ALLEGRO_EVENT_QUEUE *event_queue = NULL;
-   ALLEGRO_TIMER *timer = NULL;
-   map<unsigned int, Player*> mapPlayers;
-   map<string, int> mapGames;
-   unsigned int curPlayerId = -1;
-   ofstream outputLog;
-
-   doexit = false;
-   debugging = false;
-   bool redraw = true;
-   bool fullscreen = false;
-   game = NULL;
-   gameSummary = NULL;
-
-   honorPoints = 0;
-   wins = 0;
-   losses = 0;
-   numGames = 0;
-   gameHistory = NULL;
-
-   alertMessage = "";
-
-   state = STATE_START;
-
-   if(!al_init()) {
-      fprintf(stderr, "failed to initialize allegro!\n");
-      return -1;
-   }
-
-   outputLog.open("client.log", ios::app);
-   outputLog << "Started client on " << getCurrentDateTimeString() << endl;
-
-   if (al_init_primitives_addon())
-      cout << "Primitives initialized" << endl;
-   else
-      cout << "Primitives not initialized" << endl;
-
-   al_init_font_addon();
-   al_init_ttf_addon();
-
-   ALLEGRO_FONT* font;
-   #if defined WINDOWS
-      font = al_load_ttf_font("../pirulen.ttf", 12, 0);
-   #elif defined LINUX
-      font = al_load_ttf_font("pirulen.ttf", 12, 0);
-   #elif defined MAC
-      font = al_load_ttf_font("pirulen.ttf", 12, 0);
-   #endif
-
-   if (!font) {
-      fprintf(stderr, "Could not load 'pirulen.ttf'.\n");
-      getchar();
-      return -1;
-   }
- 
-   if (!al_install_keyboard()) {
-      fprintf(stderr, "failed to initialize the keyboard!\n");
-      return -1;
-   }
-
-    if (!al_install_mouse()) {
-      fprintf(stderr, "failed to initialize the mouse!\n");
-      return -1;
-   }
- 
-   timer = al_create_timer(1.0 / FPS);
-   if (!timer) {
-      fprintf(stderr, "failed to create timer!\n");
-      return -1;
-   }
- 
-   int refreshRate = getRefreshRate(SCREEN_W, SCREEN_H);
-   // if the computer doesn't support this resolution, just use windowed mode
-   if (refreshRate > 0 && fullscreen) {
-      al_set_new_display_flags(ALLEGRO_FULLSCREEN);
-      al_set_new_display_refresh_rate(refreshRate);
-   }
-   display = al_create_display(SCREEN_W, SCREEN_H);
-   if (!display) {
-      fprintf(stderr, "failed to create display!\n");
-      al_destroy_timer(timer);
-      return -1;
-   }
-
-   debugConsole.addLine("Debug console:");
-   debugConsole.addLine("");
-
-   createGui(font);
-
-   goToLoginScreen();
- 
-   event_queue = al_create_event_queue();
-   if (!event_queue) {
-      fprintf(stderr, "failed to create event_queue!\n");
-      al_destroy_display(display);
-      al_destroy_timer(timer);
-      return -1;
-   }
- 
-   al_set_target_bitmap(al_get_backbuffer(display));
- 
-   al_register_event_source(event_queue, al_get_display_event_source(display));
-   al_register_event_source(event_queue, al_get_timer_event_source(timer));
-   al_register_event_source(event_queue, al_get_keyboard_event_source());
-   al_register_event_source(event_queue, al_get_mouse_event_source());
- 
-   al_clear_to_color(al_map_rgb(0,0,0));
- 
-   al_flip_display();
-
-   if (argc != 3) {
-      cout << "Usage: server port" << endl;
-      exit(1);
-   }
-
-   initWinSock();
-
-   sock = socket(AF_INET, SOCK_DGRAM, 0);
-   if (sock < 0)
-      error("socket");
-
-   set_nonblock(sock);
-
-   server.sin_family = AF_INET;
-   hp = gethostbyname(argv[1]);
-   if (hp == 0)
-      error("Unknown host");
-
-   memcpy((char *)&server.sin_addr, (char *)hp->h_addr, hp->h_length);
-   server.sin_port = htons(atoi(argv[2]));
-
-   msgProcessor = MessageProcessor(sock, &outputLog);
-
-   al_start_timer(timer);
-
-   while (!doexit)
-   {
-      ALLEGRO_EVENT ev;
-
-      al_wait_for_event(event_queue, &ev);
-
-      if(wndCurrent->handleEvent(ev)) {
-         // do nothing
-      }
-      else if(ev.type == ALLEGRO_EVENT_TIMER) {
-         redraw = true;
-
-         // remove any other timer events in the queue
-         while (al_peek_next_event(event_queue, &ev) && ev.type == ALLEGRO_EVENT_TIMER) {
-            al_get_next_event(event_queue, &ev);
-         }
-      }
-      else if(ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) {
-         doexit = true;
-      }
-      else if(ev.type == ALLEGRO_EVENT_KEY_DOWN) {
-      }
-      else if(ev.type == ALLEGRO_EVENT_KEY_UP) {
-         switch(ev.keyboard.keycode) {
-            case ALLEGRO_KEY_ESCAPE:
-               doexit = true;
-               break;
-            case ALLEGRO_KEY_S:  // pickup an item next to you
-               if (state == STATE_GAME) {
-                  msgTo.type = MSG_TYPE_PICKUP_FLAG;
-                  memcpy(msgTo.buffer, &curPlayerId, 4);
-                  msgProcessor.sendMessage(&msgTo, &server);
-               }
-               break;
-            case ALLEGRO_KEY_D:  // drop the current item
-               if (state == STATE_GAME) {
-                  try {
-                     Player* p = mapPlayers.at(curPlayerId);
-                     int flagType = OBJECT_NONE;
-
-                     if (p->hasBlueFlag)
-                        flagType = OBJECT_BLUE_FLAG;
-                     else if (p->hasRedFlag)
-                        flagType = OBJECT_RED_FLAG;
-
-                     if (flagType != OBJECT_NONE) {
-                        msgTo.type = MSG_TYPE_DROP_FLAG;
-                        memcpy(msgTo.buffer, &curPlayerId, 4);
-                        msgProcessor.sendMessage(&msgTo, &server);
-                     }
-                  } catch (const out_of_range& ex) {}
-               }
-               break;
-         }
-      }
-      else if(ev.type == ALLEGRO_EVENT_MOUSE_BUTTON_UP) {
-         if (wndCurrent == wndGame) {
-            if (ev.mouse.button == 1) {   // left click
-               msgTo.type = MSG_TYPE_PLAYER_MOVE;
-
-               POSITION pos;
-               pos.x = ev.mouse.x;
-               pos.y = ev.mouse.y;
-               pos = screenToMap(pos);
-
-               if (pos.x != -1)
-               {
-                  memcpy(msgTo.buffer, &curPlayerId, 4);
-                  memcpy(msgTo.buffer+4, &pos.x, 4);
-                  memcpy(msgTo.buffer+8, &pos.y, 4);
-
-                  msgProcessor.sendMessage(&msgTo, &server);
-               }
-               else
-                  cout << "Invalid point: User did not click on the map" << endl;
-            }else if (ev.mouse.button == 2) {   // right click
-               cout << "Detected a right-click" << endl;
-               map<unsigned int, Player*>::iterator it;
-
-               Player* curPlayer = mapPlayers[curPlayerId];;
-
-               cout << "Got current player" << endl;
-               cout << "current game: " << game << endl;
-
-               map<unsigned int, Player*> playersInGame = game->getPlayers();
-               Player* target;
-
-               for (it = playersInGame.begin(); it != playersInGame.end(); it++)
-               {
-                  target = it->second;
-                  cout << "set target" << endl;
-                  if (target->team != curPlayer->team)
-                  {
-                     cout << "Found valid target" << endl;
-
-                     POSITION cursorPos;
-                     cursorPos.x = ev.mouse.x;
-                     cursorPos.y = ev.mouse.y;
-                     cursorPos = screenToMap(cursorPos);
-
-                     float distance =posDistance(cursorPos.toFloat(), target->pos);
-
-                     if (distance < 25) {
-                        unsigned int targetId = target->getId();
-
-                        msgTo.type = MSG_TYPE_ATTACK;
-                        memcpy(msgTo.buffer, &curPlayerId, 4);
-                        memcpy(msgTo.buffer+4, &targetId, 4);
-
-                        msgProcessor.sendMessage(&msgTo, &server);
-                     }
-                  }
-               }
-            }
-         }
-      }
-
-      if (msgProcessor.receiveMessage(&msgFrom, &from) >= 0)
-         processMessage(msgFrom, state, chatConsole, mapPlayers, mapGames, curPlayerId, alertMessage);
-
-      if (redraw)
-      {
-         redraw = false;
-
-         msgProcessor.resendUnackedMessages();
-
-         if (debugging && wndCurrent == wndLobby)
-            wndLobbyDebug->draw(display);
-         else
-            wndCurrent->draw(display);
-
-         if (wndCurrent == wndLobby) {
-            if (!debugging)
-               chatConsole.draw(font, al_map_rgb(255,255,255));
-
-            al_draw_text(font, al_map_rgb(0, 255, 0), SCREEN_W*1/2-100, 120, ALLEGRO_ALIGN_LEFT, "Current Games");
-
-            map<string, int>::iterator it;
-            int i=0;
-            ostringstream oss;
-            for (it = mapGames.begin(); it != mapGames.end(); it++) {
-               oss << it->first << " (" << it->second << " players)" << endl;
-               al_draw_text(font, al_map_rgb(0, 255, 0), SCREEN_W*1/2-100, 135+i*15, ALLEGRO_ALIGN_LEFT, oss.str().c_str());
-               oss.clear();
-               oss.str("");
-               i++;
-            }
-
-            al_draw_text(font, al_map_rgb(0, 255, 0), SCREEN_W*3/4-100, 120, ALLEGRO_ALIGN_LEFT, "Online Players");
-
-            map<unsigned int, Player*>::iterator itPlayers;
-            i=0;
-            for (itPlayers = mapPlayers.begin(); itPlayers != mapPlayers.end(); itPlayers++) {
-               oss << itPlayers->second->name << endl;
-               al_draw_text(font, al_map_rgb(0, 255, 0), SCREEN_W*3/4-100, 135+i*15, ALLEGRO_ALIGN_LEFT, oss.str().c_str());
-               oss.clear();
-               oss.str("");
-               i++;
-            }
-
-            al_draw_text(font, al_map_rgb(0, 255, 0), SCREEN_W/2, 15, ALLEGRO_ALIGN_CENTER, alertMessage.c_str());
-         }
-         else if (wndCurrent == wndProfile)
-         {
-            ostringstream oss;
-            oss << "Honor Points: " << honorPoints << endl;
-            al_draw_text(font, al_map_rgb(0, 255, 0), 65, 90, ALLEGRO_ALIGN_LEFT, oss.str().c_str());
-            oss.clear();
-            oss.str("");
-
-            oss << "Wins: " << wins << endl;
-            al_draw_text(font, al_map_rgb(0, 255, 0), 65, 105, ALLEGRO_ALIGN_LEFT, oss.str().c_str());
-            oss.clear();
-            oss.str("");
-
-            oss << "Losses: " << losses << endl;
-            al_draw_text(font, al_map_rgb(0, 255, 0), 65, 120, ALLEGRO_ALIGN_LEFT, oss.str().c_str());
-            oss.clear();
-            oss.str("");
-
-            // display records of the last 10 games
-            for (int i=0; i<numGames; i++) {
-
-               if (gameHistory[i][0] == 0)
-                  oss << "DEFEAT" << endl;
-               else if (gameHistory[i][0] == 1)
-                  oss << "VICTORY" << endl;
-
-               al_draw_text(font, al_map_rgb(0, 255, 0), 142, 190+30*(i+1), ALLEGRO_ALIGN_CENTRE, oss.str().c_str());
-               oss.clear();
-               oss.str("");
-
-               oss << gameHistory[i][2] << endl;
-               al_draw_text(font, al_map_rgb(0, 255, 0), 302, 190+30*(i+1), ALLEGRO_ALIGN_CENTRE, oss.str().c_str());
-               oss.clear();
-               oss.str("");
-
-               oss << gameHistory[i][3] << endl;
-               al_draw_text(font, al_map_rgb(0, 255, 0), 462, 190+30*(i+1), ALLEGRO_ALIGN_CENTRE, oss.str().c_str());
-               oss.clear();
-               oss.str("");
-
-               time_t time_finished = gameHistory[i][4];
-               struct tm* now = localtime(&time_finished);
-
-               oss << (now->tm_mon + 1) << "/" << now->tm_mday << "/" << (now->tm_year + 1900) << " ";;
-               
-               if (now->tm_hour == 0)
-                  oss << "12";
-               else if (now->tm_hour <= 12)
-                  oss << now->tm_hour;
-               else
-                  oss << now->tm_hour-12;
-
-               oss << ":" << setfill('0') << setw(2) << now->tm_min << setfill(' ') << " ";
-
-               if (now->tm_hour < 12)
-                  oss << "AM";
-               else
-                  oss << "PM";
-
-               oss << endl;
-
-               al_draw_text(font, al_map_rgb(0, 255, 0), 622, 190+30*(i+1), ALLEGRO_ALIGN_CENTRE, oss.str().c_str());
-               oss.clear();
-               oss.str("");
-
-            }
-            
-         }
-         else if (wndCurrent == wndGameLobby)
-         {
-            al_draw_text(font, al_map_rgb(0, 255, 0), 200, 100, ALLEGRO_ALIGN_LEFT, "Waiting Area");
-            al_draw_text(font, al_map_rgb(0, 255, 0), 400, 100, ALLEGRO_ALIGN_LEFT, "Blue Team");
-            al_draw_text(font, al_map_rgb(0, 255, 0), 600, 100, ALLEGRO_ALIGN_LEFT, "Red Team");
-
-            int drawPosition = 0;
-
-            map<unsigned int, Player*> gamePlayers = game->getPlayers();
-            map<unsigned int, Player*>::iterator itPlayers;
-            ostringstream oss;
-            int i=0;
-            for (itPlayers = gamePlayers.begin(); itPlayers != gamePlayers.end(); itPlayers++) {
-               switch (itPlayers->second->team) {
-               case 0:
-                  drawPosition = 200;
-                  break;
-               case 1:
-                  drawPosition = 400;
-                  break;
-               case 2:
-                  drawPosition = 600;
-                  break;
-               }
-
-               oss << itPlayers->second->name << endl;
-               al_draw_text(font, al_map_rgb(0, 255, 0), drawPosition, 135+i*15, ALLEGRO_ALIGN_LEFT, oss.str().c_str());
-               oss.clear();
-               oss.str("");
-               i++;
-            }
-         }
-         else if (wndCurrent == wndGame)
-         {
-            al_draw_text(font, al_map_rgb(0, 255, 0), 4, 4, ALLEGRO_ALIGN_LEFT, "Players");
-
-            map<unsigned int, Player*>& gamePlayers = game->getPlayers();
-            map<unsigned int, Player*>::iterator it;
-
-            if (!debugging) {
-               int playerCount = 0;
-               for (it = gamePlayers.begin(); it != gamePlayers.end(); it++)
-               {
-                  al_draw_text(font, al_map_rgb(0, 255, 0), 4, 19+(playerCount+1)*15, ALLEGRO_ALIGN_LEFT, it->second->name.c_str());
-                  playerCount++;
-               }
-            }
-
-            ostringstream ossScoreBlue, ossScoreRed;
-
-            ossScoreBlue << "Blue: " << game->getBlueScore() << endl;
-            ossScoreRed << "Red: " << game->getRedScore() << endl;
-
-            al_draw_text(font, al_map_rgb(0, 255, 0), 330, 80, ALLEGRO_ALIGN_LEFT, ossScoreBlue.str().c_str());
-            al_draw_text(font, al_map_rgb(0, 255, 0), 515, 80, ALLEGRO_ALIGN_LEFT, ossScoreRed.str().c_str());
-
-            // update players
-            for (it = game->getPlayers().begin(); it != game->getPlayers().end(); it++)
-            {
-               it->second->updateTarget(game->getPlayers());
-            }
-
-            for (it = game->getPlayers().begin(); it != game->getPlayers().end(); it++)
-            {
-               it->second->move(game->getMap());    // ignore return value
-            }
-
-             // update projectile positions
-            map<unsigned int, Projectile>::iterator it2;
-            for (it2 = game->getProjectiles().begin(); it2 != game->getProjectiles().end(); it2++)
-            {
-               it2->second.move(game->getPlayers());
-            }
-
-            GameRender::drawMap(game->getMap());
-            GameRender::drawPlayers(game->getPlayers(), font, curPlayerId);
-            GameRender::drawProjectiles(game->getProjectiles(), game->getPlayers());
-         }
-         else if (wndCurrent == wndGameSummary)
-         {
-            ostringstream ossBlueScore, ossRedScore;
-
-            ossBlueScore << "Blue Score: " << gameSummary->getBlueScore();
-            ossRedScore << "Red Score: " << gameSummary->getRedScore();
-
-            string strWinner;
-
-            if (gameSummary->getWinner() == 0)
-               strWinner = "Blue Team Wins";
-            else if (gameSummary->getWinner() == 1)
-               strWinner = "Red Team Wins";
-            else
-               strWinner = "winner set to wrong value";
-
-            al_draw_text(font, al_map_rgb(0, 255, 0), 512, 40, ALLEGRO_ALIGN_CENTRE, gameSummary->getName().c_str());
-            al_draw_text(font, al_map_rgb(0, 255, 0), 330, 80, ALLEGRO_ALIGN_LEFT, ossBlueScore.str().c_str());
-            al_draw_text(font, al_map_rgb(0, 255, 0), 515, 80, ALLEGRO_ALIGN_LEFT, ossRedScore.str().c_str());
-            al_draw_text(font, al_map_rgb(0, 255, 0), 512, 120, ALLEGRO_ALIGN_CENTRE, strWinner.c_str());
-         }
-
-         if (debugging) {
-            drawMessageStatus(font);
-         }
-
-         al_flip_display();
-      }
-   }
-
-   #if defined WINDOWS
-      closesocket(sock);
-   #elif defined LINUX
-      close(sock);
-   #endif
-
-   shutdownWinSock();
-   
-   // delete all components
-   for (unsigned int x=0; x<vctComponents.size(); x++)
-      delete vctComponents[x];
-
-   delete wndLogin;
-   delete wndRegister;
-   delete wndLobby;
-   delete wndLobbyDebug;
-   delete wndGameLobby;
-   delete wndGame;
-   delete wndGameSummary;
-
-   // game should be deleted when the player leaves a gamw
-   if (game != NULL)
-      delete game;
-
-   if (gameSummary != NULL)
-      delete gameSummary;
-
-   map<unsigned int, Player*>::iterator it;
-
-   for (it = mapPlayers.begin(); it != mapPlayers.end(); it++) {
-      delete it->second;
-   }
-
-   if (gameHistory != NULL) {
-      for (int i=0; i<numGames; i++) {
-         free(gameHistory[i]);
-      }
-
-      free(gameHistory);
-   }
-
-   al_destroy_event_queue(event_queue);
-   al_destroy_display(display);
-   al_destroy_timer(timer);
-
-   outputLog << "Stopped client on " << getCurrentDateTimeString() << endl;
-   outputLog.close();
-
-   return 0;
-}
-
-void initWinSock()
-{
-#if defined WINDOWS
-   WORD wVersionRequested;
-   WSADATA wsaData;
-   int wsaerr;
-
-   wVersionRequested = MAKEWORD(2, 2);
-   wsaerr = WSAStartup(wVersionRequested, &wsaData);
-
-   if (wsaerr != 0) {
-      cout << "The Winsock dll not found." << endl;
-      exit(1);
-   }else
-      cout << "The Winsock dll was found." << endl;
-#endif
-}
-
-void shutdownWinSock()
-{
-#if defined WINDOWS
-   WSACleanup();
-#endif
-}
-
-void createGui(ALLEGRO_FONT* font) {
-
-   // wndLogin
-
-   wndLogin = new Window(0, 0, SCREEN_W, SCREEN_H);
-   vctComponents.push_back(wndLogin->addComponent(new Textbox(516, 40, 100, 20, font)));
-   vctComponents.push_back(wndLogin->addComponent(new Textbox(516, 70, 100, 20, font)));
-   vctComponents.push_back(wndLogin->addComponent(new TextLabel(410, 40, 100, 20, font, "Username:", ALLEGRO_ALIGN_RIGHT)));
-   vctComponents.push_back(wndLogin->addComponent(new TextLabel(410, 70, 100, 20, font, "Password:", ALLEGRO_ALIGN_RIGHT)));
-   vctComponents.push_back(wndLogin->addComponent(new TextLabel((SCREEN_W-600)/2, 100, 600, 20, font, "", ALLEGRO_ALIGN_CENTRE)));
-   vctComponents.push_back(wndLogin->addComponent(new Button(SCREEN_W/2-100, 130, 90, 20, font, "Register", goToRegisterScreen)));
-   vctComponents.push_back(wndLogin->addComponent(new Button(SCREEN_W/2+10, 130, 90, 20, font, "Login", login)));
-   vctComponents.push_back(wndLogin->addComponent(new Button(920, 10, 80, 20, font, "Quit", quit)));
-   vctComponents.push_back(wndLogin->addComponent(new Button(20, 10, 160, 20, font, "Toggle Debugging", toggleDebugging)));
-
-   txtUsername = (Textbox*)wndLogin->getComponent(0);
-   txtPassword = (Textbox*)wndLogin->getComponent(1);
-   lblLoginStatus = (TextLabel*)wndLogin->getComponent(4);
-
-   cout << "Created login screen" << endl;
-
-
-   // wndRegister
-
-   wndRegister = new Window(0, 0, SCREEN_W, SCREEN_H);
-   vctComponents.push_back(wndRegister->addComponent(new Textbox(516, 40, 100, 20, font)));
-   vctComponents.push_back(wndRegister->addComponent(new Textbox(516, 70, 100, 20, font)));
-   vctComponents.push_back(wndRegister->addComponent(new TextLabel(410, 40, 100, 20, font, "Username:", ALLEGRO_ALIGN_RIGHT)));
-   vctComponents.push_back(wndRegister->addComponent(new TextLabel(410, 70, 100, 20, font, "Password:", ALLEGRO_ALIGN_RIGHT)));
-   vctComponents.push_back(wndRegister->addComponent(new RadioButtonList(432, 100, "Pick a class", font)));
-   vctComponents.push_back(wndRegister->addComponent(new TextLabel((SCREEN_W-600)/2, 190, 600, 20, font, "", ALLEGRO_ALIGN_CENTRE)));
-   vctComponents.push_back(wndRegister->addComponent(new Button(SCREEN_W/2-100, 220, 90, 20, font, "Back", goToLoginScreen)));
-   vctComponents.push_back(wndRegister->addComponent(new Button(SCREEN_W/2+10, 220, 90, 20, font, "Submit", registerAccount)));
-   vctComponents.push_back(wndRegister->addComponent(new Button(920, 10, 80, 20, font, "Quit", quit)));
-   vctComponents.push_back(wndRegister->addComponent(new Button(20, 10, 160, 20, font, "Toggle Debugging", toggleDebugging)));
-
-   txtUsernameRegister = (Textbox*)wndRegister->getComponent(0);
-   txtPasswordRegister = (Textbox*)wndRegister->getComponent(1);
-
-   rblClasses = (RadioButtonList*)wndRegister->getComponent(4);
-   rblClasses->addRadioButton("Warrior");
-   rblClasses->addRadioButton("Ranger");
-
-   lblRegisterStatus = (TextLabel*)wndRegister->getComponent(5);
-
-   cout << "Created register screen" << endl;
-
-
-   // wndLobby
-
-   txtJoinGame = new Textbox(SCREEN_W*1/2+15+4, 40, 100, 20, font);
-   vctComponents.push_back(txtJoinGame);
-
-   txtCreateGame = new Textbox(SCREEN_W*3/4+4, 40, 100, 20, font);
-   vctComponents.push_back(txtCreateGame);
-
-   wndLobby = new Window(0, 0, SCREEN_W, SCREEN_H);
-   vctComponents.push_back(wndLobby->addComponent(new Button(920, 10, 80, 20, font, "Profile", goToProfileScreen)));
-   vctComponents.push_back(wndLobby->addComponent(new Button(920, 738, 80, 20, font, "Logout", logout)));
-   vctComponents.push_back(wndLobby->addComponent(new TextLabel(SCREEN_W*1/2+15-112, 40, 110, 20, font, "Game Name:", ALLEGRO_ALIGN_RIGHT)));
-   wndLobby->addComponent(txtJoinGame);
-   vctComponents.push_back(wndLobby->addComponent(new Button(SCREEN_W*1/2+15-100, 80, 200, 20, font, "Join Existing Game", joinGame)));
-   vctComponents.push_back(wndLobby->addComponent(new TextLabel(SCREEN_W*3/4-112, 40, 110, 20, font, "Game Name:", ALLEGRO_ALIGN_RIGHT)));
-   wndLobby->addComponent(txtCreateGame);
-   vctComponents.push_back(wndLobby->addComponent(new Button(SCREEN_W*3/4-100, 80, 200, 20, font, "Create New Game", createGame)));
-   vctComponents.push_back(wndLobby->addComponent(new Textbox(95, 40, 300, 20, font)));
-   vctComponents.push_back(wndLobby->addComponent(new Button(95, 70, 60, 20, font, "Send", sendChatMessage)));
-   vctComponents.push_back(wndLobby->addComponent(new Button(20, 10, 160, 20, font, "Toggle Debugging", toggleDebugging)));
-
-   txtChat = (Textbox*)wndLobby->getComponent(7);
-
-   cout << "Created lobby screen" << endl;
-
-
-   // wndLobbyDebug
-
-   wndLobbyDebug = new Window(0, 0, SCREEN_W, SCREEN_H);
-   vctComponents.push_back(wndLobbyDebug->addComponent(new Button(920, 10, 80, 20, font, "Profile", goToProfileScreen)));
-   vctComponents.push_back(wndLobbyDebug->addComponent(new Button(920, 738, 80, 20, font, "Logout", logout)));
-   vctComponents.push_back(wndLobbyDebug->addComponent(new TextLabel(SCREEN_W*1/2+15-112, 40, 110, 20, font, "Game Name:", ALLEGRO_ALIGN_RIGHT)));
-   wndLobbyDebug->addComponent(txtJoinGame);
-   vctComponents.push_back(wndLobbyDebug->addComponent(new Button(SCREEN_W*1/2+15-100, 80, 200, 20, font, "Join Existing Game", joinGame)));
-   vctComponents.push_back(wndLobbyDebug->addComponent(new TextLabel(SCREEN_W*3/4-112, 40, 110, 20, font, "Game Name:", ALLEGRO_ALIGN_RIGHT)));
-   wndLobbyDebug->addComponent(txtCreateGame);
-   vctComponents.push_back(wndLobbyDebug->addComponent(new Button(SCREEN_W*3/4-100, 80, 200, 20, font, "Create New Game", createGame)));
-   vctComponents.push_back(wndLobbyDebug->addComponent(new Button(20, 10, 160, 20, font, "Toggle Debugging", toggleDebugging)));
-
-   cout << "Created debug lobby screen" << endl;
-
-
-   // wndProfile
-
-   wndProfile = new Window(0, 0, SCREEN_W, SCREEN_H);
-   vctComponents.push_back(wndProfile->addComponent(new TextLabel(450, 40, 124, 20, font, "Profile", ALLEGRO_ALIGN_CENTRE)));
-   vctComponents.push_back(wndProfile->addComponent(new TextLabel(160, 150, 124, 20, font, "Game History", ALLEGRO_ALIGN_CENTRE)));
-   vctComponents.push_back(wndProfile->addComponent(new TextLabel(600, 190, 124, 20, font, "Time", ALLEGRO_ALIGN_CENTRE)));
-   vctComponents.push_back(wndProfile->addComponent(new TextLabel(80, 190, 124, 20, font, "Result", ALLEGRO_ALIGN_CENTRE)));
-   vctComponents.push_back(wndProfile->addComponent(new TextLabel(240, 190, 124, 20, font, "Blue Score", ALLEGRO_ALIGN_CENTRE)));
-   vctComponents.push_back(wndProfile->addComponent(new TextLabel(400, 190, 124, 20, font, "Red Score", ALLEGRO_ALIGN_CENTRE)));
-   vctComponents.push_back(wndProfile->addComponent(new TextLabel(560, 190, 124, 20, font, "Time", ALLEGRO_ALIGN_CENTRE)));
-   vctComponents.push_back(wndProfile->addComponent(new Button(920, 738, 80, 20, font, "Back", goToLobbyScreen)));
-
-
-   // wndGameLobby
-
-   wndGameLobby = new Window(0, 0, SCREEN_W, SCREEN_H);
-   vctComponents.push_back(wndGameLobby->addComponent(new Button(180, 120, 160, 300, font, "", joinWaitingArea)));
-   vctComponents.push_back(wndGameLobby->addComponent(new Button(380, 120, 160, 300, font, "", joinBlueTeam)));
-   vctComponents.push_back(wndGameLobby->addComponent(new Button(580, 120, 160, 300, font, "", joinRedTeam)));
-   vctComponents.push_back(wndGameLobby->addComponent(new Button(40, 600, 120, 20, font, "Leave Game", leaveGame)));
-   vctComponents.push_back(wndGameLobby->addComponent(new Button(800, 600, 120, 20, font, "Start Game", startGame)));
-
-
-   // wndGame
-
-   wndGame = new Window(0, 0, SCREEN_W, SCREEN_H);
-   vctComponents.push_back(wndGame->addComponent(new Button(880, 10, 120, 20, font, "Leave Game", leaveGame)));
-
-   cout << "Created new game screen" << endl;
-
-   wndGameSummary = new Window(0, 0, SCREEN_W, SCREEN_H);
-   vctComponents.push_back(wndGameSummary->addComponent(new Button(840, 730, 160, 20, font, "Back to Lobby", closeGameSummary)));
-
-   cout << "Created game summary screen" << endl;
-}
-
-void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, map<unsigned int, Player*>& mapPlayers, map<string, int>& mapGames, unsigned int& curPlayerId, string& alertMessage)
-{
-   cout << "Total players in map: " << mapPlayers.size() << endl;
-
-   switch(state)
-   {
-      case STATE_START:
-      {
-         cout << "In STATE_START" << endl;
-
-         switch(msg.type)
-         {
-            case MSG_TYPE_REGISTER:
-            {
-               lblRegisterStatus->setText(msg.buffer);
-               break;
-            }
-            default:
-            {
-               cout << "(STATE_REGISTER) Received invalid message of type " << msg.type << endl;
-               break;
-            }
-         }
-
-         break;
-      }
-      case STATE_LOBBY:
-      {
-         cout << "In STATE_LOBBY" << endl;
-         switch(msg.type)
-         {
-            case MSG_TYPE_LOGIN:
-            {
-               if (string(msg.buffer).compare("Player has already logged in.") == 0)
-               {
-                  goToLoginScreen();
-                  state = STATE_START;
-
-                  lblLoginStatus->setText(msg.buffer);
-               }
-               else if (string(msg.buffer).compare("Incorrect username or password") == 0)
-               {
-                  goToLoginScreen();
-                  state = STATE_START;
-
-                  lblLoginStatus->setText(msg.buffer);
-               }
-               else
-               {
-                  wndCurrent = wndLobby;
-                
-                  // this message should only be sent when a player first logs in so they know their id
-  
-                  Player* p = new Player("", "");
-                  p->deserialize(msg.buffer);
-
-                  if (mapPlayers.find(p->getId()) != mapPlayers.end())
-                     delete mapPlayers[p->getId()];
-                  mapPlayers[p->getId()] = p;
-                  curPlayerId = p->getId();
-                  currentPlayer = mapPlayers[curPlayerId];
-
-                  cout << "Got a valid login response with the player" << endl;
-                  cout << "Player id: " << curPlayerId << endl;
-                  cout << "Player health: " << p->health << endl;
-                  cout << "player map size: " << mapPlayers.size() << endl;
-               }
-
-               break;
-            }
-            case MSG_TYPE_LOGOUT:
-            {
-               cout << "Got a logout message" << endl;
-
-               unsigned int playerId;
-
-               // Check if it's about you or another player
-               memcpy(&playerId, msg.buffer, 4);
-               string response = string(msg.buffer+4);
-
-               if (playerId == curPlayerId)
-               {
-                  cout << "Got logout message for self" << endl;
-
-                  if (response.compare("You have successfully logged out.") == 0)
-                  {
-                     cout << "Logged out" << endl;
-                     state = STATE_START;
-                     goToLoginScreen();
-                  }
-
-                  // if there was an error logging out, nothing happens
-               }
-               else
-               {
-                  delete mapPlayers[playerId];
-                  mapPlayers.erase(playerId);
-               }
-
-               break;
-            }
-            case MSG_TYPE_CHAT:
-            {
-               chatConsole.addLine(msg.buffer);
-
-               break;
-            }
-            case MSG_TYPE_PROFILE:
-            {
-               memcpy(&honorPoints, msg.buffer, 4);
-               memcpy(&wins, msg.buffer+4, 4);
-               memcpy(&losses, msg.buffer+8, 4);
-               memcpy(&numGames, msg.buffer+12, 4);
-
-               cout << "Got records for " << numGames << " games." << endl;
-               gameHistory = (int**)malloc(numGames*sizeof(int*));
-               for (int i=0; i<numGames; i++) {
-                  gameHistory[i] = (int*)malloc(5*sizeof(int));
-                  cout << endl << "game record " << (i+1) << endl;
-
-                  memcpy(&gameHistory[i][0], msg.buffer+16+i*20, 4);
-                  memcpy(&gameHistory[i][1], msg.buffer+20+i*20, 4);
-                  memcpy(&gameHistory[i][2], msg.buffer+24+i*20, 4);
-                  memcpy(&gameHistory[i][3], msg.buffer+28+i*20, 4);
-                  memcpy(&gameHistory[i][4], msg.buffer+32+i*20, 4);
-
-                  cout << "result: " << gameHistory[i][0] << endl;
-                  cout << "team: " << gameHistory[i][1] << endl;
-                  cout << "blue score: " << gameHistory[i][2] << endl;
-                  cout << "red score: " << gameHistory[i][3] << endl;
-
-                  time_t time_finished = gameHistory[i][4];
-                  struct tm* now = localtime(&time_finished);
-
-                  cout << "time game finished: ";
-                  cout << (now->tm_year + 1900) << '-'
-                       << (now->tm_mon + 1) << '-'
-                       << now->tm_mday << " "
-                       << now->tm_hour << ":"
-                       << now->tm_min
-                       << endl;
-               }
-
-               wndCurrent = wndProfile;
-
-               break;
-            }
-            case MSG_TYPE_JOIN_GAME_SUCCESS:
-            {
-               cout << "Received a JOIN_GAME_SUCCESS message" << endl;
-
-               string gameName(msg.buffer);
-
-               #if defined WINDOWS
-                  game = new Game(gameName, "../../data/map.txt", &msgProcessor);
-               #elif defined LINUX
-                  game = new Game(gameName, "../data/map.txt", &msgProcessor);
-               #elif defined MAC
-                  game = new Game(gameName, "../data/map.txt", &msgProcessor);
-               #endif
-
-               cout << "Game name: " << gameName << endl;
-
-               state = STATE_GAME_LOBBY;
-               wndCurrent = wndGameLobby;
-
-               msgTo.type = MSG_TYPE_JOIN_GAME_ACK;
-               strcpy(msgTo.buffer, gameName.c_str());
-
-               msgProcessor.sendMessage(&msgTo, &server);
-
-               break;
-            }
-            case MSG_TYPE_JOIN_GAME_FAILURE:
-            {
-               cout << "Received a JOIN_GAME_FAILURE message" << endl;
-
-               break;
-            }
-            case MSG_TYPE_CREATE_GAME_FAILURE:
-            {
-               cout << "Received a CREATE_GAME_FAILURE message" << endl;
-               alertMessage = "Game could not be created because one exists with that name";
-
-               break;
-            }
-            case MSG_TYPE_PLAYER:
-            {
-               handleMsgPlayer(msg, mapPlayers, mapGames);
-
-               break;
-            }
-            case MSG_TYPE_GAME_INFO:
-            {
-               handleMsgGameInfo(msg, mapPlayers, mapGames);
-
-               break;
-            }
-            default:
-            {
-               cout << "(STATE_LOBBY) Received invlaid message of type " << msg.type << endl;
-
-               break;
-            }
-         }
-
-         break;
-      }
-      case STATE_GAME_LOBBY:
-      {
-         cout << "(STATE_GAME_LOBBY) ";
-         switch(msg.type)
-         {
-            case MSG_TYPE_START_GAME:
-            {
-               state = STATE_GAME;
-               wndCurrent = wndGame;
-
-               break;
-            }
-            default:
-            {
-               // keep these lines commented until until the correct messages are moved into the STATE_GAME_LOBBY section
-               //cout << "Received invalid message of type " << msg.type << endl;
-
-               //break;
-            }
-         }
-      }
-      case STATE_GAME:
-      {
-         cout << "(STATE_GAME) ";
-         switch(msg.type)
-         {
-            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;
-            }
-            case MSG_TYPE_FINISH_GAME:
-            {
-               cout << "Got a finish game message" << endl;
-               cout << "Should switch to STATE_LOBBY and show the final score" << endl;
-
-               unsigned int winner, blueScore, redScore;
-               memcpy(&winner, msg.buffer, 4);
-               memcpy(&blueScore, msg.buffer+4, 4);
-               memcpy(&redScore, msg.buffer+8, 4);
-
-               string gameName(msg.buffer+12);
-
-               gameSummary = new GameSummary(gameName, winner, blueScore, redScore);
-
-               delete game;
-               game = NULL;
-               state = STATE_LOBBY;
-               wndCurrent = wndGameSummary;
-               alertMessage = "";
-
-               break;
-            }
-            case MSG_TYPE_LOGOUT:
-            {
-               cout << "Got a logout message" << endl;
-
-               unsigned int playerId;
-
-               // Check if it's about you or another player
-               memcpy(&playerId, msg.buffer, 4);
-
-               if (playerId == curPlayerId)
-                  cout << "Received MSG_TYPE_LOGOUT for self in STATE_GAME. This shouldn't happen." << endl;
-               else {
-                  delete mapPlayers[playerId];
-                  mapPlayers.erase(playerId);
-               }
-
-               break;
-            }
-            case MSG_TYPE_PLAYER_JOIN_GAME:
-            {
-               cout << "Received MSG_TYPE_PLAYER_JOIN_GAME" << endl;
-
-               Player p("", "");
-               p.deserialize(msg.buffer);
-               cout << "Deserialized player" << endl;
-               cout << "player team: " << p.team << endl;
-               cout << "current player team: " << currentPlayer->team << endl;
-               p.timeLastUpdated = getCurrentMillis();
-               p.isChasing = false;
-               if (p.health <= 0)
-                  p.isDead = true;
-               else
-                  p.isDead = false;
-
-               if (mapPlayers.find(p.getId()) != mapPlayers.end())
-                  *(mapPlayers[p.getId()]) = p;
-               else
-                  mapPlayers[p.getId()] = new Player(p);
-
-               game->addPlayer(mapPlayers[p.getId()]);
-
-               break;
-            }
-            case MSG_TYPE_LEAVE_GAME:
-            {
-               cout << "Received a LEAVE_GAME message" << endl;
-
-               string gameName(msg.buffer+4);
-               unsigned int playerId;
-
-               memcpy(&playerId, msg.buffer, 4);
-               
-               game->removePlayer(playerId);
-
-               break;
-            }
-            case MSG_TYPE_PLAYER_MOVE:
-            {
-               cout << "Received PLAYER_MOVE message" << endl;
-
-               unsigned int id;
-               int x, y;
-
-               memcpy(&id, msg.buffer, 4);
-               memcpy(&x, msg.buffer+4, 4);
-               memcpy(&y, msg.buffer+8, 4);
-
-               cout << "id: " << id << endl;
-
-               mapPlayers[id]->target.x = x;
-               mapPlayers[id]->target.y = y;
-
-               mapPlayers[id]->isChasing = false;
-               mapPlayers[id]->setTargetPlayer(0);
-
-               break;
-            }
-            case MSG_TYPE_OBJECT:
-            {
-               cout << "Received object message in STATE_GAME" << endl;
-
-               WorldMap::Object o(0, 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 << "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_ATTACK:
-            {
-               cout << "Received START_ATTACK message" << endl;
-
-               unsigned int id, targetId;
-               memcpy(&id, msg.buffer, 4);
-               memcpy(&targetId, msg.buffer+4, 4);
-
-               cout << "source id: " << id << endl;
-               cout << "target id: " << targetId << endl;
-
-               // need to check the target exists in the current game
-               Player* source = game->getPlayers()[id];
-               source->setTargetPlayer(targetId);
-               source->isChasing = true;
-
-               break;
-            }
-            case MSG_TYPE_PROJECTILE:
-            {
-               cout << "Received a PROJECTILE message" << endl;
-
-               unsigned int projId, x, y, targetId;
-
-               memcpy(&projId, msg.buffer, 4);
-               memcpy(&x, msg.buffer+4, 4);
-               memcpy(&y, msg.buffer+8, 4);
-               memcpy(&targetId, msg.buffer+12, 4);
-
-               cout << "projId: " << projId << endl;
-               cout << "x: " << x << endl;
-               cout << "y: " << y << endl;
-               cout << "Target: " << targetId << endl;
-
-               Projectile proj(x, y, targetId, 0);
-               proj.setId(projId);
-
-               game->addProjectile(proj);
-
-               break;
-            }
-            case MSG_TYPE_REMOVE_PROJECTILE:
-            {
-                cout << "Received a REMOVE_PROJECTILE message" << endl;
-
-               unsigned int id;
-               memcpy(&id, msg.buffer, 4);
-               
-               game->removeProjectile(id);
-
-               break;
-            }
-            case MSG_TYPE_PLAYER:
-            {
-               handleMsgPlayer(msg, mapPlayers, mapGames);
-
-               break;
-            }
-            case MSG_TYPE_GAME_INFO:
-            {
-               handleMsgGameInfo(msg, mapPlayers, mapGames);
-
-               break;
-            }
-            default:
-            {
-               cout << "Received invalid message of type " << msg.type << endl;
-
-               break;
-            }
-         }
-
-         break;
-      }
-      default:
-      {
-         cout << "The state has an invalid value: " << state << endl;
-
-         break;
-      }
-   }
-}
-
-int getRefreshRate(int width, int height)
-{
-   int numRefreshRates = al_get_num_display_modes();
-   ALLEGRO_DISPLAY_MODE displayMode;
-
-   for(int i=0; i<numRefreshRates; i++) {
-      al_get_display_mode(i, &displayMode);
-
-      if (displayMode.width == width && displayMode.height == height)
-         return displayMode.refresh_rate;
-   }
-
-   return 0;
-}
-
-void drawMessageStatus(ALLEGRO_FONT* font)
-{
-   int clientMsgOffset = 5;
-   int serverMsgOffset = 950;
-
-   al_draw_text(font, al_map_rgb(0, 255, 255), 0+clientMsgOffset, 43, ALLEGRO_ALIGN_LEFT, "ID");
-   al_draw_text(font, al_map_rgb(0, 255, 255), 20+clientMsgOffset, 43, ALLEGRO_ALIGN_LEFT, "Type");
-   al_draw_text(font, al_map_rgb(0, 255, 255), 240+clientMsgOffset, 43, ALLEGRO_ALIGN_LEFT, "Acked?");
-
-   //al_draw_text(font, al_map_rgb(0, 255, 255), serverMsgOffset, 43, ALLEGRO_ALIGN_LEFT, "ID");
-
-   map<unsigned int, map<unsigned long, MessageContainer> >& sentMessages = msgProcessor.getSentMessages();
-   int id, type;
-   bool acked;
-   ostringstream ossId, ossAcked;
-
-   map<unsigned int, map<unsigned long, MessageContainer> >::iterator it;
-
-   int msgCount = 0;
-   for (it = sentMessages.begin(); it != sentMessages.end(); it++) {
-      map<unsigned long, MessageContainer> playerMessage = it->second;
-      map<unsigned long, MessageContainer>::iterator it2;
-      for (it2 = playerMessage.begin(); it2 !=  playerMessage.end(); it2++) {
-
-         id = it->first;
-         ossId.str("");;
-         ossId << id;
-
-         type = it2->second.getMessage()->type;
-         string typeStr = MessageContainer::getMsgTypeString(type);
-
-         acked = it2->second.getAcked();
-         ossAcked.str("");;
-         ossAcked << boolalpha << acked;
-
-         al_draw_text(font, al_map_rgb(0, 255, 0), clientMsgOffset, 60+15*msgCount, ALLEGRO_ALIGN_LEFT, ossId.str().c_str());
-         al_draw_text(font, al_map_rgb(0, 255, 0), 20+clientMsgOffset, 60+15*msgCount, ALLEGRO_ALIGN_LEFT, typeStr.c_str());
-         al_draw_text(font, al_map_rgb(0, 255, 0), 240+clientMsgOffset, 60+15*msgCount, ALLEGRO_ALIGN_LEFT, ossAcked.str().c_str());
-
-         msgCount++;
-      }
-   }
-
-   if (msgProcessor.getAckedMessages().size() > 0) {
-      map<unsigned int, unsigned long long> ackedMessages = msgProcessor.getAckedMessages()[0];
-      map<unsigned int, unsigned long long>::iterator it3;
-
-      msgCount = 0;
-      for (it3 = ackedMessages.begin(); it3 != ackedMessages.end(); it3++) {
-         ossId.str("");;
-         ossId << it3->first;
-
-         al_draw_text(font, al_map_rgb(255, 0, 0), 25+serverMsgOffset, 60+15*msgCount, ALLEGRO_ALIGN_LEFT, ossId.str().c_str());
-
-         msgCount++;
-      }
-   }
-}
-
-// message handling functions
-
-void handleMsgPlayer(NETWORK_MSG &msg, map<unsigned int, Player*>& mapPlayers, map<string, int>& mapGames) {
-   cout << "Received MSG_TYPE_PLAYER" << endl;
-
-   Player p("", "");
-   p.deserialize(msg.buffer);
-   p.timeLastUpdated = getCurrentMillis();
-   p.isChasing = false;
-   if (p.health <= 0)
-      p.isDead = true;
-   else
-      p.isDead = false;
-
-   if (mapPlayers.find(p.getId()) != mapPlayers.end())
-      *(mapPlayers[p.getId()]) = p;
-   else
-      mapPlayers[p.getId()] = new Player(p);
-}
-
-void handleMsgGameInfo(NETWORK_MSG &msg, map<unsigned int, Player*>& mapPlayers, map<string, int>& mapGames) {
-   cout << "Received a GAME_INFO message" << endl;
-
-   string gameName(msg.buffer+4);
-   int numPlayers;
-
-   memcpy(&numPlayers, msg.buffer, 4);
-               
-   cout << "Received game info for " << gameName << " (num players: " << numPlayers << ")" << endl;
-               
-   if (numPlayers > 0)
-      mapGames[gameName] = numPlayers;
-   else
-      mapGames.erase(gameName);
-}
-
-// Callback definitions
-
-void goToRegisterScreen()
-{
-   txtUsernameRegister->clear();
-   txtPasswordRegister->clear();
-   lblRegisterStatus->setText("");
-   rblClasses->setSelectedButton(-1);
-
-   wndCurrent = wndRegister;
-}
-
-void goToLoginScreen()
-{
-   txtUsername->clear();
-   txtPassword->clear();
-   lblLoginStatus->setText("");
-
-   wndCurrent = wndLogin;
-}
-
-// maybe need a goToGameScreen function as well and add state changes to these functions as well
-
-void registerAccount()
-{
-   string username = txtUsernameRegister->getStr();
-   string password = txtPasswordRegister->getStr();
-
-   txtUsernameRegister->clear();
-   txtPasswordRegister->clear();
-   // maybe clear rblClasses as well (add a method to RadioButtonList to enable this)
-
-   Player::PlayerClass playerClass;
-
-   switch (rblClasses->getSelectedButton()) {
-   case 0:
-      playerClass = Player::CLASS_WARRIOR;
-      break;
-   case 1:
-      playerClass = Player::CLASS_RANGER;
-      break;
-   default:
-      cout << "Invalid class selection" << endl;
-      playerClass = Player::CLASS_NONE;
-      break;
-   }
-
-   msgTo.type = MSG_TYPE_REGISTER;
-
-   strcpy(msgTo.buffer, username.c_str());
-   strcpy(msgTo.buffer+username.size()+1, password.c_str());
-   memcpy(msgTo.buffer+username.size()+password.size()+2, &playerClass, 4);
-
-   msgProcessor.sendMessage(&msgTo, &server);
-}
-
-void login()
-{
-   string strUsername = txtUsername->getStr();
-   string strPassword = txtPassword->getStr();
-   username = strUsername;
-
-   txtUsername->clear();
-   txtPassword->clear();
-
-   msgTo.type = MSG_TYPE_LOGIN;
-
-   strcpy(msgTo.buffer, strUsername.c_str());
-   strcpy(msgTo.buffer+username.size()+1, strPassword.c_str());
-
-   msgProcessor.sendMessage(&msgTo, &server);
-
-   state = STATE_LOBBY;
-   alertMessage = "";
-}
-
-void logout()
-{
-   switch(state) {
-   case STATE_LOBBY:
-      txtJoinGame->clear();
-      txtCreateGame->clear();
-      break;
-   default:
-      cout << "Logout called from invalid state: " << state << endl;
-      break;
-   }
-
-   msgTo.type = MSG_TYPE_LOGOUT;
-
-   strcpy(msgTo.buffer, username.c_str());
-
-   msgProcessor.sendMessage(&msgTo, &server);
-}
-
-void quit()
-{
-   doexit = true;
-}
-
-void sendChatMessage()
-{
-   string msg = txtChat->getStr();
-   txtChat->clear();
-
-   msgTo.type = MSG_TYPE_CHAT;
-   strcpy(msgTo.buffer, msg.c_str());
-
-   msgProcessor.sendMessage(&msgTo, &server);
-}
-
-void toggleDebugging()
-{
-   debugging = !debugging;
-}
-
-void goToProfileScreen()
-{
-   msgTo.type = MSG_TYPE_PROFILE;
-
-   unsigned int playerId = currentPlayer->getId();
-   memcpy(msgTo.buffer, &playerId, 4);
-   msgProcessor.sendMessage(&msgTo, &server);
-}
-
-void goToLobbyScreen()
-{
-   wndCurrent = wndLobby;
-}
-
-void joinGame()
-{
-   cout << "Joining game" << endl;
-
-   string msg = txtJoinGame->getStr();
-   txtJoinGame->clear();
-
-   msgTo.type = MSG_TYPE_JOIN_GAME;
-   strcpy(msgTo.buffer, msg.c_str());
-
-   msgProcessor.sendMessage(&msgTo, &server);
-}
-
-void createGame()
-{
-   cout << "Creating game" << endl;
-
-   string msg = txtCreateGame->getStr();
-   txtCreateGame->clear();
-
-   cout << "Sending message: " << msg.c_str() << endl;
-
-   msgTo.type = MSG_TYPE_CREATE_GAME;
-   strcpy(msgTo.buffer, msg.c_str());
-
-   msgProcessor.sendMessage(&msgTo, &server);
-   cout << "Sent CREATE_GAME message" << endl;
-}
-
-void joinWaitingArea() {
-   cout << "joining waiting area" << endl;
-   currentPlayer->team = Player::TEAM_NONE;
-
-   msgTo.type = MSG_TYPE_JOIN_TEAM;
-   memcpy(msgTo.buffer, &(currentPlayer->team), 4);
-
-   msgProcessor.sendMessage(&msgTo, &server);
-}
-
-void joinBlueTeam() {
-   cout << "joining blue team" << endl;
-   currentPlayer->team = Player::TEAM_BLUE;
-
-   msgTo.type = MSG_TYPE_JOIN_TEAM;
-   memcpy(msgTo.buffer, &(currentPlayer->team), 4);
-
-   msgProcessor.sendMessage(&msgTo, &server);
-}
-
-void joinRedTeam() {
-   cout << "joining red team" << endl;
-   currentPlayer->team = Player::TEAM_RED;
-
-   msgTo.type = MSG_TYPE_JOIN_TEAM;
-   memcpy(msgTo.buffer, &(currentPlayer->team), 4);
-
-   msgProcessor.sendMessage(&msgTo, &server);
-}
-
-void startGame() {
-   msgTo.type = MSG_TYPE_START_GAME;
-
-   msgProcessor.sendMessage(&msgTo, &server);
-}
-
-void leaveGame()
-{
-   cout << "Leaving game" << endl;
-
-   delete game;
-   game = NULL;
-   
-   state = STATE_LOBBY;
-   wndCurrent = wndLobby;
-   alertMessage = "";
-
-   msgTo.type = MSG_TYPE_LEAVE_GAME;
-
-   msgProcessor.sendMessage(&msgTo, &server);
-}
-
-void closeGameSummary()
-{
-    delete gameSummary;
-    gameSummary = NULL;
-    wndCurrent = wndLobby;
-    cout << "Processed button actions" << endl;
-}
Index: ient/makefile
===================================================================
--- client/makefile	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,48 +1,0 @@
-CC = g++
-FLAGS = -Wall
-
-UNAME_S := $(shell uname -s)
-
-LIB_FLAGS = `pkg-config --cflags --libs --static allegro-static-5 allegro_main-static-5 allegro_ttf-static-5 allegro_primitives-static-5` -lfreetype
-
-# osx needs to link against some extra libraries
-ifeq ($(UNAME_S),Darwin)
-	LIB_FLAGS += -framework AppKit -framework IOKit -framework OpenGL -framework AGL -framework OpenAL
-endif
-
-COMMON_PATH = ../common
-DEPENDENCIES = Common.o MessageContainer.o MessageProcessor.o Player.o WorldMap.o Projectile.o Game.o GameRender.o GameSummary.o chat.o GuiComponent.o Window.o Textbox.o Button.o RadioButtonList.o TextLabel.o
-
-gameClient : Client/main.cpp $(DEPENDENCIES)
-	$(CC) -o $@ $+ $(FLAGS) $(LIB_FLAGS)
-
-%.o : Client/%.cpp
-	$(CC) -c -o $@ $? $(FLAGS)
-
-Common.o : $(COMMON_PATH)/Common.cpp
-	$(CC) -c -o $@ $? $(FLAGS)
-
-MessageContainer.o : $(COMMON_PATH)/MessageContainer.cpp
-	$(CC) -c -o $@ $? $(FLAGS)
-
-MessageProcessor.o : $(COMMON_PATH)/MessageProcessor.cpp
-	$(CC) -c -o $@ $? $(FLAGS)
-
-Player.o : $(COMMON_PATH)/Player.cpp
-	$(CC) -c -o $@ $? $(FLAGS)
-
-WorldMap.o : $(COMMON_PATH)/WorldMap.cpp
-	$(CC) -c -o $@ $? $(FLAGS)
-
-Projectile.o : $(COMMON_PATH)/Projectile.cpp
-	$(CC) -c -o $@ $? $(FLAGS)
-
-Game.o : $(COMMON_PATH)/Game.cpp
-	$(CC) -c -o $@ $? $(FLAGS)
-
-GameSummary.o : $(COMMON_PATH)/GameSummary.cpp
-	$(CC) -c -o $@ $? $(FLAGS)
-
-clean:
-	rm -f *.o
-	rm -f gameClient
Index: mmon/Common.cpp
===================================================================
--- common/Common.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,130 +1,0 @@
-#include "Common.h"
-
-#include "Compiler.h"
-
-#if defined WINDOWS
-   #include <winsock2.h>
-#elif defined LINUX
-   #include <fcntl.h>
-   #include <assert.h>
-#elif defined MAC
-   #include <fcntl.h>
-   #include <assert.h>
-   #include <mach/clock.h>
-   #include <mach/mach.h>
-#endif
-
-#include <sstream>
-#include <cmath>
-#include <ctime>
-#include <cstdlib>
-#include <cstdio>
-
-using namespace std;
-
-FLOAT_POSITION POSITION::toFloat() {
-   FLOAT_POSITION floatPosition;
-   floatPosition.x = x;
-   floatPosition.y = y;
-
-   return floatPosition;
-}
-
-POSITION FLOAT_POSITION::toInt() {
-   POSITION position;
-   position.x = x;
-   position.y = y;
-
-   return position;
-}
-
-// This might not be cross-platform. Verify that this works correctly or fix it.
-void error(const char *msg)
-{
-    perror(msg);
-    exit(0);
-}
-
-void set_nonblock(int sock)
-{
-   #if defined WINDOWS
-      unsigned long mode = 1;
-      ioctlsocket(sock, FIONBIO, &mode);
-   #elif defined LINUX
-      int flags = fcntl(sock, F_GETFL,0);
-      assert(flags != -1);
-      fcntl(sock, F_SETFL, flags | O_NONBLOCK);
-   #elif defined MAC
-      int flags = fcntl(sock, F_GETFL,0);
-      assert(flags != -1);
-      fcntl(sock, F_SETFL, flags | O_NONBLOCK);
-   #endif
-}
-
-unsigned long long getCurrentMillis()
-{
-   unsigned long long numMilliseconds;
-
-   #if defined WINDOWS
-      numMilliseconds = GetTickCount();
-   #elif defined LINUX
-      timespec curTime;
-      clock_gettime(CLOCK_REALTIME, &curTime);
-
-      numMilliseconds = curTime.tv_sec*(unsigned long long)1000+curTime.tv_nsec/(unsigned long long)1000000;
-   # elif defined MAC
-      timespec curTime;
-
-      clock_serv_t cclock;
-      mach_timespec_t mts;
-      host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
-      clock_get_time(cclock, &mts);
-      mach_port_deallocate(mach_task_self(), cclock);
-      curTime.tv_sec = mts.tv_sec;
-      curTime.tv_nsec = mts.tv_nsec;
-
-      numMilliseconds = curTime.tv_sec*(unsigned long long)1000+curTime.tv_nsec/(unsigned long long)1000000;
-   #endif
-
-   return numMilliseconds;
-}
-
-string getCurrentDateTimeString() {
-   ostringstream timeString;
-
-   time_t millis = time(NULL);
-   struct tm *time = localtime(&millis);
-
-   timeString << time->tm_hour << ":" << time->tm_min << ":"<< time->tm_sec << " " << (time->tm_mon+1) << "/" << time->tm_mday << "/" << (time->tm_year+1900);
-
-   return timeString.str();
-}
-
-float posDistance(FLOAT_POSITION pos1, FLOAT_POSITION pos2) {
-   float xDiff = pos2.x - pos1.x;
-   float yDiff = pos2.y - pos1.y;
-
-   return sqrt( pow(xDiff,2) + pow(yDiff,2) );   
-}
-
-POSITION screenToMap(POSITION pos)
-{
-   pos.x = pos.x-300;
-   pos.y = pos.y-100;
-
-   if (pos.x < 0 || pos.y < 0)
-   {
-      pos.x = -1;
-      pos.y = -1;
-   }
-
-   return pos;
-}
-
-POSITION mapToScreen(POSITION pos)
-{
-   pos.x = pos.x+300;
-   pos.y = pos.y+100;
-
-   return pos;
-}
Index: mmon/Common.h
===================================================================
--- common/Common.h	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#ifndef _COMMON_H
-#define _COMMON_H
-
-#include <string>
-
-using namespace std;
-
-struct FLOAT_POSITION;
-
-struct POSITION {
-   int x;
-   int y;
-   FLOAT_POSITION toFloat();
-};
-
-struct FLOAT_POSITION {
-   float x;
-   float y;
-   POSITION toInt();
-};
-
-void error(const char *msg);
-void set_nonblock(int sock);
-unsigned long long getCurrentMillis();
-string getCurrentDateTimeString();
-
-POSITION screenToMap(POSITION pos);
-POSITION mapToScreen(POSITION pos);
-float posDistance(FLOAT_POSITION pos1, FLOAT_POSITION pos2);
-
-#endif
Index: mmon/Compiler.h
===================================================================
--- common/Compiler.h	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,13 +1,0 @@
-#if defined _WIN64
-   #define WINDOWS
-#elif defined _WIN32
-   #define WINDOWS
-#elif defined __linux
-   #define LINUX
-#elif defined __unix
-   #define LINUX
-#elif defined __posix
-   #define LINUX
-#elif defined __APPLE__
-   #define MAC
-#endif
Index: mmon/Game.cpp
===================================================================
--- common/Game.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,240 +1,0 @@
-#include "Game.h"
-
-#include <iostream>
-#include <cstring>
-#include <cstdlib>
-
-#include "Common.h"
-
-using namespace std;
-
-Game::Game() {
-   this->id = 0;
-   this->name = "";
-   this->blueScore = 0;
-   this->redScore = 0;
-   this->worldMap = NULL;
-   this->msgProcessor = NULL;
-}
-
-Game::Game(string name, string filepath, MessageProcessor* msgProcessor) {
-   this->id = 0;
-   this->name = name;
-   this->blueScore = 0;
-   this->redScore = 0;
-   this->worldMap = WorldMap::loadMapFromFile(filepath);
-   this->msgProcessor = msgProcessor;
-}
-
-Game::~Game() {
-   delete this->worldMap;
-}
-
-string Game::getName() {
-   return this->name;
-}
-
-int Game::getNumPlayers() {
-   return this->players.size();
-}
-
-map<unsigned int, Player*>& Game::getPlayers() {
-   return this->players;
-}
-
-bool Game::addPlayer(Player* p) {
-   if (players.find(p->getId()) == players.end()) {
-      players[p->getId()] = p;
-
-      // reset player stats, location, etc.
-      p->pos.x = p->target.x = 200;
-      p->pos.y = p->target.y = 200;
-      p->setTargetPlayer(0);
-      p->isChasing = false;
-      p->isAttacking = false;
-      p->isDead = false;
-      p->health = p->maxHealth;
-      p->hasBlueFlag = false;
-      p->hasRedFlag = false;
-
-      p->currentGame = this;
-
-      return true;
-   }
-   else
-      return false;
-}
-
-bool Game::removePlayer(unsigned int id) {
-   if (players.erase(id) == 1)
-      return true;
-   else
-      return false;
-}
-
-map<unsigned int, Projectile>& Game::getProjectiles() {
-   return this->projectiles;
-}
-
-bool Game::addProjectile(Projectile p) {
-   if (projectiles.find(p.id) == projectiles.end()) {
-      projectiles[p.id] = p;
-      return true;
-   }
-   else
-      return false;
-}
-
-bool Game::removeProjectile(unsigned int id) {
-   if (projectiles.erase(id) == 1)
-      return true;
-   else
-      return false;
-}
-
-unsigned int Game::getRedScore() {
-   return this->redScore;
-}
-
-unsigned int Game::getBlueScore() {
-   return this->blueScore;
-}
-
-WorldMap* Game::getMap() {
-   return this->worldMap;
-}
-
-void Game::setId(unsigned int id) {
-   this->id = id;
-}
-
-void Game::setRedScore(unsigned int score) {
-   this->redScore = score;
-}
-
-void Game::setBlueScore(unsigned int score) {
-   this->blueScore = score;
-}
-
-void Game::addObjectToMap(ObjectType objectType, int x, int y) {
-   NETWORK_MSG serverMsg;
-
-   this->getMap()->addObject(objectType, x, y);
-
-   serverMsg.type = MSG_TYPE_OBJECT;
-   this->worldMap->getObjects()->back().serialize(serverMsg.buffer);
-
-   this->msgProcessor->broadcastMessage(serverMsg, this->players);
-}
-
-bool Game::startPlayerMovement(unsigned int id, int x, int y) {
-   // need to check if players actually contains the id
-   Player* p = players[id];
-
-   // we need to make sure the player can move here
-   if (0 <= x && x < this->worldMap->width*25 &&
-       0 <= y && y < this->worldMap->height*25 &&
-       this->worldMap->getElement(x/25, y/25) == TERRAIN_GRASS)
-   {
-      p->target.x = x;
-      p->target.y = y;
-
-      p->isChasing = false;
-      p->isAttacking = false;
-      p->setTargetPlayer(0);
-
-      return true;
-   }
-   else
-      return false;
-}
-
-// returns true if the movement should be canceled
-bool Game::processPlayerMovement(Player* p, FLOAT_POSITION oldPos) {
-
-   // check if the move needs to be canceled
-   switch(this->worldMap->getElement(p->pos.x/25, p->pos.y/25))
-   {
-      case TERRAIN_NONE:
-      case TERRAIN_OCEAN:
-      case TERRAIN_ROCK:
-      {
-         p->pos = oldPos;
-         p->target.x = p->pos.x;
-         p->target.y = p->pos.y;
-         p->isChasing = false;
-         return true;
-         break;
-      }
-      default:
-         // if there are no obstacles, don't cancel movement
-         return false;
-         break;
-      }
-}
-
-// returns the id of the picked-up flag or -1 if none was picked up
-int Game::processFlagPickupRequest(Player* p) {
-   vector<WorldMap::Object>* vctObjects = this->worldMap->getObjects();
-   vector<WorldMap::Object>::iterator it;
-   int itemId = -1;
-
-   for (it = vctObjects->begin(); it != vctObjects->end(); it++) {
-      if (posDistance(p->pos, it->pos.toFloat()) < 10) {
-         switch (it->type) {
-            case OBJECT_BLUE_FLAG:
-               if (p->team == Player::TEAM_RED) {
-                  p->hasBlueFlag = true;
-                  itemId = it->id;
-               }
-               break;
-            case OBJECT_RED_FLAG:
-               if (p->team == Player::TEAM_BLUE) {
-                  p->hasRedFlag = true;
-                  itemId = it->id;
-               }
-               break;
-            case OBJECT_NONE:
-               break;
-         }
-
-         if (itemId > -1) {
-            vctObjects->erase(it);
-            return itemId;
-         }
-      }
-   }
-
-   return itemId;
-}
-
-void Game::dealDamageToPlayer(Player* p, int damage) {
-   p->takeDamage(damage);
-
-   if (p->isDead) {
-      ObjectType flagType = OBJECT_NONE;
-      if (p->hasBlueFlag)
-         flagType = OBJECT_BLUE_FLAG;
-      else if (p->hasRedFlag)
-         flagType = OBJECT_RED_FLAG;
-
-      if (flagType != OBJECT_NONE)
-         this->addObjectToMap(flagType, p->pos.x, p->pos.y);
-   }
-
-   // send a PLAYER message after dealing damage
-   NETWORK_MSG serverMsg;
-   serverMsg.type = MSG_TYPE_PLAYER;
-   p->serialize(serverMsg.buffer);
-   msgProcessor->broadcastMessage(serverMsg, this->players);
-}
-
-void Game::assignProjectileId(Projectile* p) {
-   p->id = unusedProjectileId;
-   updateUnusedProjectileId();
-}
-
-void Game::updateUnusedProjectileId() {
-   while (projectiles.find(unusedProjectileId) != projectiles.end())
-      unusedProjectileId++;
-}
Index: mmon/Game.h
===================================================================
--- common/Game.h	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,67 +1,0 @@
-#ifndef _GAME_H
-#define _GAME_H
-
-#include "Compiler.h"
-
-#include <string>
-#include <map>
-
-#ifdef WINDOWS
-   #define WIN32_LEAN_AND_MEAN
-#endif
-
-#include "Player.h"
-#include "WorldMap.h"
-#include "Projectile.h"
-#include "MessageProcessor.h"
-
-using namespace std;
-
-class Game {
-private:
-   unsigned int id;
-   string name;
-   map<unsigned int, Player*> players;
-   map<unsigned int, Projectile> projectiles;
-   WorldMap* worldMap;
-   unsigned int blueScore;
-   unsigned int redScore;
-   unsigned int unusedProjectileId;
-   MessageProcessor* msgProcessor;
-
-public:
-   Game();
-   Game(string name, string filepath, MessageProcessor* msgProcessor);
-
-   ~Game();
-
-   string getName();
-   int getNumPlayers();
-   unsigned int getBlueScore();
-   unsigned int getRedScore();
-   WorldMap* getMap();
-
-   void setId(unsigned int id);
-   void setBlueScore(unsigned int score);
-   void setRedScore(unsigned int score);
-
-   void addObjectToMap(ObjectType objectType, int x, int y);
-
-   map<unsigned int, Player*>& getPlayers();
-   bool addPlayer(Player* p);
-   bool removePlayer(unsigned int id);
-
-   map<unsigned int, Projectile>& getProjectiles();
-   bool addProjectile(Projectile p);
-   bool removeProjectile(unsigned int id);
-
-   bool startPlayerMovement(unsigned int id, int x, int y);
-   bool processPlayerMovement(Player* p, FLOAT_POSITION oldPos);
-   int processFlagPickupRequest(Player* p);
-   void dealDamageToPlayer(Player* p, int damage);
-
-   void assignProjectileId(Projectile* p);
-   void updateUnusedProjectileId();
-};
-
-#endif
Index: mmon/GameSummary.cpp
===================================================================
--- common/GameSummary.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,38 +1,0 @@
-#include "GameSummary.h"
-
-#include "Common.h"
-
-using namespace std;
-
-GameSummary::GameSummary() {
-   this->gameName = "";
-   this->winner = 0;
-   this->blueScore = 0;
-   this->redScore = 0;
-}
-
-GameSummary::GameSummary(string name, unsigned int winner, unsigned int blueScore, unsigned int redScore) {
-   this->gameName = name;
-   this->winner = winner;
-   this->blueScore = blueScore;
-   this->redScore = redScore;
-}
-
-GameSummary::~GameSummary() {
-}
-
-string GameSummary::getName() {
-   return this->gameName;
-}
-
-unsigned int GameSummary::getWinner() {
-   return this->winner;
-}
-
-unsigned int GameSummary::getBlueScore() {
-   return this->blueScore;
-}
-
-unsigned int GameSummary::getRedScore() {
-   return this->redScore;
-}
Index: mmon/GameSummary.h
===================================================================
--- common/GameSummary.h	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#ifndef _GAME_SUMMARY_H
-#define _GAME_SUMMARY_H
-
-#include "Compiler.h"
-
-#include <string>
-
-using namespace std;
-
-class GameSummary {
-private:
-   string gameName;
-   unsigned int winner;
-   unsigned int blueScore;
-   unsigned int redScore;
-
-public:
-   GameSummary();
-   GameSummary(string name, unsigned int winner, unsigned int blueScore, unsigned int redScore);
-
-   ~GameSummary();
-
-   string getName();
-   unsigned int getWinner();
-   unsigned int getBlueScore();
-   unsigned int getRedScore();
-};
-
-#endif
Index: mmon/MessageContainer.cpp
===================================================================
--- common/MessageContainer.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,85 +1,0 @@
-#include "MessageContainer.h"
-
-#include <iostream>
-
-using namespace std;
-
-MessageContainer::MessageContainer() {
-}
-
-MessageContainer::MessageContainer(const MessageContainer& mc) {
-   this->msg = mc.msg;
-   this->clientAddr = mc.clientAddr;
-   this->timeSent = mc.timeSent;
-   this->isAcked = mc.isAcked;
-   this->timeAcked = mc.timeAcked;
-}
-
-MessageContainer::MessageContainer(NETWORK_MSG msg, struct sockaddr_in clientAddr) {
-   this->clientAddr = clientAddr;
-   this->msg = msg;
-   this->timeSent = 0;
-   this->isAcked = false;
-   this->timeAcked = 0;
-}
-
-MessageContainer::~MessageContainer() {
-}
-
-NETWORK_MSG* MessageContainer::getMessage() {
-   return &msg;
-}
-
-bool MessageContainer::getAcked() {
-   return this->isAcked;
-}
-
-unsigned long long MessageContainer::getTimeSent() {
-   return this->timeSent;
-}
-
-unsigned long long MessageContainer::getTimeAcked() {
-   return this->timeAcked;
-}
-
-void MessageContainer::setAcked(bool acked) {
-   this->isAcked = acked;
-}
-
-void MessageContainer::setTimeSent(unsigned long long time) {
-   this->timeSent = time;
-}
-
-void MessageContainer::setTimeAcked(unsigned long long time) {
-   this->timeAcked = time;
-}
-
-string MessageContainer::getMsgTypeString(int msgType) {
-   switch(msgType) {
-      case MSG_TYPE_ACK: return "MSG_TYPE_ACK";
-      case MSG_TYPE_REGISTER: return "MSG_TYPE_REGISTER";
-      case MSG_TYPE_LOGIN: return "MSG_TYPE_LOGIN";
-      case MSG_TYPE_LOGOUT: return "MSG_TYPE_LOGOUT";
-      case MSG_TYPE_CHAT: return "MSG_TYPE_CHAT";
-      case MSG_TYPE_PLAYER: return "MSG_TYPE_PLAYER";
-      case MSG_TYPE_PLAYER_MOVE: return "MSG_TYPE_PLAYER_MOVE";
-      case MSG_TYPE_OBJECT: return "MSG_TYPE_OBJECT";
-      case MSG_TYPE_REMOVE_OBJECT: return "MSG_TYPE_REMOVE_OBJECT";
-      case MSG_TYPE_PICKUP_FLAG: return "MSG_TYPE_PICKUP_FLAG";
-      case MSG_TYPE_DROP_FLAG: return "MSG_TYPE_DROP_FLAG";
-      case MSG_TYPE_SCORE: return "MSG_TYPE_SCORE";
-      case MSG_TYPE_ATTACK: return "MSG_TYPE_ATTACK";
-      case MSG_TYPE_PROJECTILE: return "MSG_TYPE_PROJECTILE";
-      case MSG_TYPE_REMOVE_PROJECTILE: return "MSG_TYPE_REMOVE_PROJECTILE";
-      case MSG_TYPE_CREATE_GAME: return "MSG_TYPE_CREATE_GAME";
-      case MSG_TYPE_JOIN_GAME: return "MSG_TYPE_JOIN_GAME";
-      case MSG_TYPE_LEAVE_GAME: return "MSG_TYPE_LEAVE_GAME";
-      case MSG_TYPE_GAME_INFO: return "MSG_TYPE_GAME_INFO";
-      case MSG_TYPE_JOIN_GAME_SUCCESS: return "MSG_TYPE_JOIN_GAME_SUCCESS";
-      case MSG_TYPE_JOIN_GAME_FAILURE: return "MSG_TYPE_JOIN_GAME_FAILURE";
-      case MSG_TYPE_JOIN_GAME_ACK: return "MSG_TYPE_JOIN_GAME_ACK";
-      case MSG_TYPE_PLAYER_JOIN_GAME: return "MSG_TYPE_PLAYER_JOIN_GAME";
-      case MSG_TYPE_FINISH_GAME: return "MSG_TYPE_FINISH_GAME";
-      default: return "Unknown";
-   }
-}
Index: mmon/MessageContainer.h
===================================================================
--- common/MessageContainer.h	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,82 +1,0 @@
-#ifndef _MESSAGE_CONTAINER_H
-#define _MESSAGE_CONTAINER_H
-
-#include <string>
-
-#include "Compiler.h"
-
-#if defined WINDOWS
-   #include <winsock2.h>
-#elif defined LINUX
-   #include <netinet/in.h>
-#elif defined MAC
-   #include <netinet/in.h>
-#endif
-
-using namespace std;
-
-enum MessageType {
-   MSG_TYPE_ACK = 1,
-   MSG_TYPE_REGISTER,
-   MSG_TYPE_LOGIN,
-   MSG_TYPE_LOGOUT,
-   MSG_TYPE_CHAT,
-   MSG_TYPE_PLAYER,
-   MSG_TYPE_PLAYER_MOVE,
-   MSG_TYPE_OBJECT,
-   MSG_TYPE_REMOVE_OBJECT,
-   MSG_TYPE_PICKUP_FLAG,
-   MSG_TYPE_DROP_FLAG,
-   MSG_TYPE_SCORE,
-   MSG_TYPE_ATTACK,
-   MSG_TYPE_PROJECTILE,
-   MSG_TYPE_REMOVE_PROJECTILE,
-   MSG_TYPE_PROFILE,
-   MSG_TYPE_CREATE_GAME,
-   MSG_TYPE_JOIN_GAME,
-   MSG_TYPE_LEAVE_GAME,
-   MSG_TYPE_GAME_INFO,
-   MSG_TYPE_CREATE_GAME_FAILURE,
-   MSG_TYPE_JOIN_GAME_SUCCESS,
-   MSG_TYPE_JOIN_GAME_FAILURE,
-   MSG_TYPE_JOIN_GAME_ACK,
-   MSG_TYPE_PLAYER_JOIN_GAME,
-   MSG_TYPE_FINISH_GAME,
-   MSG_TYPE_JOIN_TEAM,
-   MSG_TYPE_START_GAME
-};
-
-typedef struct
-{
-   unsigned int id;
-   unsigned short type;
-   char buffer[256];
-} NETWORK_MSG;
-
-class MessageContainer {
-private:
-   NETWORK_MSG msg;
-   struct sockaddr_in clientAddr;
-   bool isAcked;
-   unsigned long long timeSent;
-   unsigned long long timeAcked;
-
-public:
-   MessageContainer();
-   MessageContainer(const MessageContainer& mc);
-   MessageContainer(NETWORK_MSG msg, struct sockaddr_in clientAddr);
-   ~MessageContainer();
-
-   NETWORK_MSG* getMessage();
-   bool getAcked();
-   unsigned long long getTimeSent();
-   unsigned long long getTimeAcked();
-
-   void setAcked(bool acked);
-   void setTimeSent(unsigned long long time);
-   void setTimeAcked(unsigned long long time);
-
-   static string getMsgTypeString(int msgType);
-};
-
-#endif
Index: mmon/MessageProcessor.cpp
===================================================================
--- common/MessageProcessor.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,192 +1,0 @@
-#include "MessageProcessor.h"
-
-#include <iostream>
-#include <fstream>
-
-#include "Compiler.h"
-
-#if defined WINDOWS
-   #include <ws2tcpip.h>
-#endif
-
-#include "Common.h"
-
-MessageProcessor::MessageProcessor() {
-   this->sock = 0;
-   this->outputLog = NULL;
-   lastUsedId = 0;
-}
-
-MessageProcessor::MessageProcessor(int sock, ofstream* outputLog) {
-   this->sock = sock;
-   this->outputLog = outputLog;
-   lastUsedId = 0;
-}
-
-MessageProcessor::~MessageProcessor() {
-}
-
-int MessageProcessor::sendMessage(NETWORK_MSG *msg, struct sockaddr_in *dest) {
-   cout << "Sending message of type " << msg->type << endl;
-
-   msg->id = ++lastUsedId;
-   MessageContainer message(*msg, *dest);
-   message.setTimeSent(getCurrentMillis());
-
-   if (outputLog)
-      (*outputLog) << "Sending message (id " << msg->id << ") of type " << MessageContainer::getMsgTypeString(msg->type) << endl;
-
-   sentMessages[msg->id][dest->sin_addr.s_addr] = message;
-
-   int ret =  sendto(sock, (char*)msg, sizeof(NETWORK_MSG), 0, (struct sockaddr *)dest, sizeof(struct sockaddr_in));
-
-   if (ret < 0)
-      error("sendMessage");
-
-   return ret;
-}
-
-int MessageProcessor::receiveMessage(NETWORK_MSG *msg, struct sockaddr_in *source) {
-   socklen_t socklen = sizeof(struct sockaddr_in);
-
-   // assume we don't care about the value of socklen
-   //cout << "Waiting for message from server" << endl;
-   int ret =  recvfrom(sock, (char*)msg, sizeof(NETWORK_MSG), 0, (struct sockaddr *)source, &socklen);
-   //cout << "Returned from wait" << endl;
-
-   if (ret == -1)
-      return ret;
-
-   // add id to the NETWORK_MSG struct
-   if (msg->type == MSG_TYPE_ACK) {
-      if (!sentMessages[msg->id][source->sin_addr.s_addr].getAcked()) {
-         sentMessages[msg->id][source->sin_addr.s_addr].setAcked(true);
-         sentMessages[msg->id][source->sin_addr.s_addr].setTimeAcked(getCurrentMillis());
-         if (outputLog)
-            (*outputLog) << "Received ack for message id " << msg->id << endl;
-      }
-
-      return -1; // don't do any further processing
-   }else {
-      bool isDuplicate = false;
-      map<unsigned int, unsigned long long>& ackedPlayerMessages = ackedMessages[source->sin_addr.s_addr];
-
-      if (ackedPlayerMessages.find(msg->id) != ackedPlayerMessages.end()) {
-         isDuplicate = true;
-         cout << "Got duplicate of type " << msg->type << endl;
-         if (outputLog)
-            (*outputLog) << "Received duplicate (id " << msg->id << ") of type " << MessageContainer::getMsgTypeString(msg->type) << endl;
-      }else {
-         cout << "Got message of type " << msg->type << endl;
-         if (outputLog)
-            (*outputLog) << "Received message (id " << msg->id << ") of type " << MessageContainer::getMsgTypeString(msg->type) << endl;
-      }
-
-      ackedPlayerMessages[msg->id] = getCurrentMillis();
-
-      NETWORK_MSG ack;
-      ack.id = msg->id;
-      ack.type = MSG_TYPE_ACK;
-
-      sendto(sock, (char*)&ack, sizeof(NETWORK_MSG), 0, (struct sockaddr *)source, sizeof(struct sockaddr_in));
-
-      if (isDuplicate)
-         return -1;
-   }
-
-   return ret;
-}
-
-void MessageProcessor::broadcastMessage(NETWORK_MSG &msg, map<unsigned int, Player*>& players) {
-   map<unsigned int, Player*>::iterator it;
-   for (it = players.begin(); it != players.end(); it++) {
-      this->sendMessage(&msg, &(it->second->addr));
-   }
-}
-
-void MessageProcessor::resendUnackedMessages() {
-   map<unsigned int, map<unsigned long, MessageContainer> >::iterator it;
-   map<unsigned long, MessageContainer>::iterator it2;
-   map<unsigned long, MessageContainer>* sentMsg;
-
-   for (it = sentMessages.begin(); it != sentMessages.end(); it++) {
-
-      unsigned long long maxAge = 0;
-      sentMsg = &(it->second);
-
-      for (it2 = sentMsg->begin(); it2 != sentMsg->end(); it2++) {
-         if (!(it2->second.getAcked())) {
-            cout << "Maybe resending message" << endl;
-            cout << "time sent: " << it2->second.getTimeSent() << endl;
-            unsigned long long age = getCurrentMillis() - it2->second.getTimeSent();
-
-            cout << "age: " << age << endl;
-            if (maxAge < age) {
-                maxAge = age;
-                cout << "new max age: " << maxAge << endl;
-            }
-
-            if (maxAge > 10000) {
-               cout << "id " << it2->second.getMessage()->id << " is not getting acked" << endl;
-               // this will prevent the message from getting resent anymore
-               it2->second.setAcked(true);
-               cout << "acked after being set: " << it2->second.getAcked() << endl;
-            }
-
-            sendto(sock, (const char*)it2->second.getMessage(), sizeof(NETWORK_MSG), 0, (struct sockaddr *)&it2->first, sizeof(struct sockaddr_in));
-         }
-      }
-
-      if (maxAge > 10000) {
-         cout << "Connection lost" << endl;
-      }
-   }
-}
-
-void MessageProcessor::cleanAckedMessages() {
-   map<unsigned int, map<unsigned long, MessageContainer> >::iterator it = sentMessages.begin();
-   map<unsigned long, MessageContainer>::iterator it2;
-
-   while (it != sentMessages.end()) {
-      it2 = it->second.begin();
-      while (it2 != it->second.end()) {
-         if (it2->second.getAcked()) {
-            if ((getCurrentMillis() - it2->second.getTimeAcked()) > 1000) {
-               if (outputLog)
-                  (*outputLog) << "Removing id " << it2->second.getMessage()->id << " from the acked record" << endl;
-               it->second.erase(it2++);
-            }else
-               it2++;
-         }else
-            it2++;
-      }
-
-      if (it->second.size() == 0)
-         sentMessages.erase(it++);
-      else
-         it++;
-   }
-
-   map<unsigned long, map<unsigned int, unsigned long long> >::iterator it3 = ackedMessages.begin();
-   map<unsigned int, unsigned long long>::iterator it4;
-
-   // somehow want to delete the inner map once that player logs out
-   while (it3 != ackedMessages.end()) {
-      it4 = it3->second.begin();
-      while (it4 != it3->second.end()) {
-         if ((getCurrentMillis() - it4->second) > 500)
-            it3->second.erase(it4++);
-         else
-            it4++;
-      }
-      it3++;
-   }
-}
-
-map<unsigned int, map<unsigned long, MessageContainer> >& MessageProcessor::getSentMessages() {
-   return this->sentMessages;
-}
-
-map<unsigned long, map<unsigned int, unsigned long long> >& MessageProcessor::getAckedMessages() {
-   return this->ackedMessages;
-}
Index: mmon/MessageProcessor.h
===================================================================
--- common/MessageProcessor.h	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#ifndef _MESSAGE_PROCESSOR_H
-#define _MESSAGE_PROCESSOR_H
-
-#include <map>
-
-#include "MessageContainer.h"
-#include "Player.h"
-
-using namespace std;
-
-class MessageProcessor {
-private:
-   int sock;
-   ofstream* outputLog;
-   int lastUsedId;
-
-   // map from message ids to maps from player addresses to message info
-   map<unsigned int, map<unsigned long, MessageContainer> > sentMessages;
-
-   // map from player address to map from message id to time accked
-   map<unsigned long, map<unsigned int, unsigned long long> > ackedMessages;
-
-   //unsigned long pid;
-
-public:
-   MessageProcessor();
-   MessageProcessor(int sock, ofstream* outputLog = NULL);
-   ~MessageProcessor();
-
-   int sendMessage(NETWORK_MSG *msg, struct sockaddr_in *dest);
-   int receiveMessage(NETWORK_MSG *msg, struct sockaddr_in *source);
-   void broadcastMessage(NETWORK_MSG &msg, map<unsigned int, Player*>& players);
-   void resendUnackedMessages();
-   void cleanAckedMessages();
-
-   map<unsigned int, map<unsigned long, MessageContainer> >& getSentMessages();
-   map<unsigned long, map<unsigned int, unsigned long long> >& getAckedMessages();
-};
-
-#endif
Index: mmon/Player.cpp
===================================================================
--- common/Player.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,274 +1,0 @@
-#include "Player.h"
-
-#include <iostream>
-#include <sstream>
-#include <cstring>
-#include <cmath>
-
-using namespace std;
-
-Player::Player()
-{
-   this->id = 0;
-   this->name = "";
-   this->password = "";
-   this->pos.x = this->target.x = 0;
-   this->pos.y = this->target.y = 0;
-   this->targetPlayer = 0;
-   this->timeLastUpdated = 0;
-   this->timeAttackStarted = 0;
-   this->timeDied = 0;
-   this->isChasing = false;
-   this->isAttacking = false;
-   this->isDead = false;
-
-   this->playerClass = CLASS_NONE;
-   this->maxHealth = 0;
-   this->health = 0;
-   this->attackType = ATTACK_NONE;
-   this->damage = 0;
-   this->range = 0;
-   this->attackCooldown = 0;
-   this->team = TEAM_NONE;
-   this->hasBlueFlag = false;
-   this->hasRedFlag = false;
-
-   this->level = 0;
-   this->experience = 0;
-   this->honor = 0;
-   this->wins = 0;
-   this->losses = 0;
-
-   this->currentGame = NULL;
-}
-
-Player::Player(const Player& p)
-{
-   this->id = p.id;
-   this->name = p.name;
-   this->password = p.password;
-   this->addr = p.addr;
-   this->pos.x = p.pos.x;
-   this->pos.y = p.pos.y;
-   this->target.x = p.target.x;
-   this->target.y = p.target.y;
-   this->targetPlayer = p.targetPlayer;
-   this->timeLastUpdated = p.timeLastUpdated;
-   this->timeAttackStarted = p.timeAttackStarted;
-   this->timeDied = p.timeDied;
-   this->isChasing = p.isChasing;
-   this->isAttacking = p.isAttacking;
-   this->isDead = p.isDead;
-
-   this->playerClass = p.playerClass;
-   this->maxHealth = p.maxHealth;
-   this->health = p.health;
-   this->attackType = p.attackType;
-   this->damage = p.damage;
-   this->range = p.range;
-   this->attackCooldown = p.attackCooldown;
-   this->team = p.team;
-   this->hasBlueFlag = p.hasBlueFlag;
-   this->hasRedFlag = p.hasRedFlag;
-
-   this->level = p.level;
-   this->experience = p.experience;
-   this->honor = p.honor;
-   this->wins = p.wins;
-   this->losses = p.losses;
-
-   this->currentGame = p.currentGame;
-}
-
-// eventually make this take a PlayerClass argument as well
-Player::Player(string name, string password)
-{
-   this->id = 0;
-   this->name = name;
-   this->password = password;
-   this->pos.x = this->target.x = 200;
-   this->pos.y = this->target.y = 200;
-   this->targetPlayer = 0;
-   this->timeLastUpdated = 0;
-   this->timeAttackStarted = 0;
-   this->timeDied = 0;
-   this->isChasing = false;
-   this->isAttacking = false;
-   this->isDead = false;
-
-   this->playerClass = CLASS_NONE;
-   this->maxHealth = 0;
-   this->health = 0;
-   this->attackType = ATTACK_NONE;
-   this->damage = 0;
-   this->range = 0;
-   this->attackCooldown = 0;
-   this->team = TEAM_NONE;
-   this->hasBlueFlag = false;
-   this->hasRedFlag = false;
-
-   this->level = 0;
-   this->experience = 0;
-   this->honor = 0;
-   this->wins = 0;
-   this->losses = 0;
-
-   this->currentGame = NULL;
-}
-
-Player::~Player()
-{
-}
-
-unsigned int Player::getId()
-{
-   return this->id;
-}
-
-unsigned int Player::getTargetPlayer()
-{
-   return this->targetPlayer;
-}
-
-void Player::setId(unsigned int id)
-{
-   this->id = id;
-}
-
-void Player::setTargetPlayer(unsigned int id)
-{
-   this->targetPlayer = id;
-}
-
-void Player::setAddr(sockaddr_in addr)
-{
-   this->addr = addr;
-}
-
-void Player::setClass(PlayerClass c)
-{
-   switch (c) {
-      case CLASS_WARRIOR:
-         this->playerClass = CLASS_WARRIOR;
-         this->maxHealth = this->health = 120;
-         this->attackType = ATTACK_MELEE;
-         this->damage = 10;
-         this->range = 30;
-         this->attackCooldown = 800;
-         break;
-      case CLASS_RANGER:
-         this->playerClass = CLASS_RANGER;
-         this->maxHealth = this->health = 60;
-         this->attackType = ATTACK_RANGED;
-         this->damage = 6;
-         this->range = 100;
-         this->attackCooldown = 1000;
-         break;
-      case CLASS_NONE:
-         cout << "No class" << endl;
-         break;
-   }
-}
-
-void Player::serialize(char* buffer)
-{
-   memcpy(buffer, &this->id, 4);
-   memcpy(buffer+4, &this->pos.x, 4);
-   memcpy(buffer+8, &this->pos.y, 4);
-   memcpy(buffer+12, &this->target.x, 4);
-   memcpy(buffer+16, &this->target.y, 4);
-
-   memcpy(buffer+20, &this->playerClass, 4);
-   memcpy(buffer+24, &this->maxHealth, 4);
-   memcpy(buffer+28, &this->health, 4);
-   memcpy(buffer+32, &this->attackType, 4);
-   memcpy(buffer+36, &this->damage, 4);
-   memcpy(buffer+40, &this->team, 4);
-   memcpy(buffer+44, &this->hasBlueFlag, 1);
-   memcpy(buffer+45, &this->hasRedFlag, 1);
-   memcpy(buffer+46, &this->range, 4);
-
-   strcpy(buffer+50, this->name.c_str());
-}
-
-void Player::deserialize(char* buffer)
-{
-   memcpy(&this->id, buffer, 4);
-   memcpy(&this->pos.x, buffer+4, 4);
-   memcpy(&this->pos.y, buffer+8, 4);
-   memcpy(&this->target.x, buffer+12, 4);
-   memcpy(&this->target.y, buffer+16, 4);
-
-   memcpy(&this->playerClass, buffer+20, 4);
-   memcpy(&this->maxHealth, buffer+24, 4);
-   memcpy(&this->health, buffer+28, 4);
-   memcpy(&this->attackType, buffer+32, 4);
-   memcpy(&this->damage, buffer+36, 4);
-   memcpy(&this->team, buffer+40, 4);
-   memcpy(&this->hasBlueFlag, buffer+44, 1);
-   memcpy(&this->hasRedFlag, buffer+45, 1);
-   memcpy(&this->range, buffer+46, 4);
-
-   this->name.assign(buffer+50);
-}
-
-bool Player::move(WorldMap *map) {
-   int speed = 100; // pixels per second. should probably be in the constructor
-   unsigned long long curTime = getCurrentMillis();
-
-   // if we're at our target, don't move
-   bool moving = (pos.x != target.x || pos.y != target.y);
-
-   if (moving) {
-      float pixels = speed * (curTime-timeLastUpdated) / 1000.0;
-      double angle = atan2(target.y-pos.y, target.x-pos.x);
-      float dist = sqrt(pow(target.x-pos.x, 2) + pow(target.y-pos.y, 2));
-
-      if (dist <= pixels) {
-         pos.x = target.x;
-         pos.y = target.y;
-      }else {
-         pos.x = pos.x + cos(angle)*pixels;
-         pos.y = pos.y + sin(angle)*pixels;
-      }
-   }
-
-   timeLastUpdated = curTime;
-
-   return moving;
-}
-
-void Player::takeDamage(int damage) {
-   this->health -= damage;
-   if (this->health < 0)
-      this->health = 0;
-   if (this->health == 0) {
-      cout << "Player died" << endl;
-      this->isDead = true;
-      this->timeDied = getCurrentMillis();
-   }
-}
-
-bool Player::updateTarget(map<unsigned int, Player*>& players) {
-   Player* p = NULL;
-   if (this->targetPlayer > 0)
-      p =players[this->targetPlayer];
-
-   if (p != NULL && this->isChasing) {
-      this->target.x = p->pos.x;
-      this->target.y = p->pos.y;
-
-      if (posDistance(this->pos, this->target.toFloat()) <= this->range) {
-         this->target.x = this->pos.x;
-         this->target.y = this->pos.y;
-
-         this->isChasing = false;
-         this->isAttacking = true;
-         this->timeAttackStarted = getCurrentMillis();
-
-         return true;
-      }
-   }
-
-   return false;
-}
Index: mmon/Player.h
===================================================================
--- common/Player.h	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,106 +1,0 @@
-#ifndef _PLAYER_H
-#define _PLAYER_H
-
-#include <string>
-#include <map>
-
-#include "Compiler.h"
-
-#if defined WINDOWS
-   #include <winsock2.h>
-#elif defined LINUX
-   #include <netinet/in.h>
-#elif defined MAC
-   #include <netinet/in.h>
-#endif
-
-#include "WorldMap.h"
-
-using namespace std;
-
-//forward declaration
-class Game;
-
-class Player {
-private:
-   unsigned int id;
-   unsigned int targetPlayer;
-
-public:
-
-   enum PlayerClass {
-      CLASS_NONE,
-      CLASS_WARRIOR,
-      CLASS_RANGER
-   };
-
-   enum AttackType {
-      ATTACK_NONE,
-      ATTACK_MELEE,
-      ATTACK_RANGED
-   };
-
-   enum PlayerTeam {
-      TEAM_NONE,
-      TEAM_BLUE,
-      TEAM_RED
-   };
-
-   Player();
-   Player(const Player& p);
-   Player(string name, string password);
-
-   ~Player();
-
-   unsigned int getId();
-   unsigned int getTargetPlayer();
-
-   void setId(unsigned int id);
-   void setTargetPlayer(unsigned int id);
-   void setAddr(sockaddr_in addr);
-   void setClass(PlayerClass c);
-
-   void serialize(char* buffer);
-   void deserialize(char* buffer);
-
-   bool updateTarget(map<unsigned int, Player*>& players);
-   bool move(WorldMap *map);
-   void takeDamage(int damage);
-
-   void takeFlag(unsigned int flag, WorldMap* map);
-   void dropFlag(unsigned int flag, WorldMap* map);
-
-   string name;
-   string password;
-   sockaddr_in addr;
-   FLOAT_POSITION pos;
-   POSITION target;
-   unsigned long long timeLastUpdated;
-   unsigned long long timeAttackStarted;
-   unsigned long long timeDied;
-   bool isChasing;
-   bool isAttacking;
-   bool isDead;
-
-   PlayerClass playerClass;
-   int maxHealth;
-   int health;
-   int attackType;
-   int damage;
-   int range;
-   unsigned long long attackCooldown;
-   PlayerTeam team;
-   bool hasBlueFlag;
-   bool hasRedFlag;
-
-   // permanent attributes
-   unsigned int level;
-   unsigned int experience;
-   unsigned int honor;
-   unsigned int wins;
-   unsigned int losses;
-
-   Game* currentGame;
-};
-
-#endif
Index: mmon/Projectile.cpp
===================================================================
--- common/Projectile.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,99 +1,0 @@
-#include "Projectile.h"
-
-#include <iostream>
-#include <sstream>
-#include <cstring>
-#include <cmath>
-
-using namespace std;
-
-Projectile::Projectile()
-{
-   this->id = 0;
-   this->pos.x = 0;
-   this->pos.y = 0;
-   this->target = 0;
-   this->speed = 0;
-   this->damage = 0;
-   this->timeLastUpdated = 0;
-}
-
-Projectile::Projectile(const Projectile& p)
-{
-   this->id = p.id;
-   this->pos.x = p.pos.x;
-   this->pos.y = p.pos.y;
-   this->target = p.target;
-   this->speed = p.speed;
-   this->damage = p.damage;
-   this->timeLastUpdated = p.timeLastUpdated;
-}
-
-Projectile::Projectile(int x, int y, int targetId, int damage)
-{
-   this->id = 0; // the server probably sets this by calling setId passing in the length of the current projectile list
-   this->pos.x = x;
-   this->pos.y = y;
-   this->target = targetId;
-   this->speed = 400;
-   this->damage = damage;
-   this->timeLastUpdated = 0;
-}
-
-Projectile::~Projectile()
-{
-}
-
-void Projectile::setId(unsigned int id)
-{
-   this->id = id;
-}
-
-void Projectile::serialize(char* buffer)
-{
-   memcpy(buffer, &this->id, 4);
-   memcpy(buffer+4, &this->pos.x, 4);
-   memcpy(buffer+8, &this->pos.y, 4);
-   memcpy(buffer+12, &this->target, 4);
-   memcpy(buffer+16, &this->speed, 4);
-   memcpy(buffer+20, &this->damage, 4);
-}
-
-void Projectile::deserialize(char* buffer)
-{
-   memcpy(&this->id, buffer, 4);
-   memcpy(&this->pos.x, buffer+4, 4);
-   memcpy(&this->pos.y, buffer+8, 4);
-   memcpy(&this->target, buffer+12, 4);
-   memcpy(&this->speed, buffer+16, 4);
-   memcpy(buffer+16, &this->speed, 4);
-   memcpy(buffer+20, &this->damage, 4);
-}
-
-bool Projectile::move(map<unsigned int, Player*>& mapPlayers) {
-   // if the current target logs off, this method will run into problems
-
-   unsigned long long curTime = getCurrentMillis();
-
-   Player* targetP = mapPlayers[target];
-
-   if (timeLastUpdated == 0) {
-      timeLastUpdated = curTime;
-      return false;
-   }
-
-
-   float pixels = speed * (curTime-timeLastUpdated) / 1000.0;
-   double angle = atan2(targetP->pos.y-pos.y, targetP->pos.x-pos.x);
-   float dist = sqrt(pow(targetP->pos.x-pos.x, 2) + pow(targetP->pos.y-pos.y, 2));
-
-   if (dist <= pixels) {
-      pos.x = targetP->pos.x;
-      pos.y = targetP->pos.y;
-      return true;
-   }else {
-      pos.x = pos.x + cos(angle)*pixels;
-      pos.y = pos.y + sin(angle)*pixels;
-      return false;
-   }
-}
Index: mmon/Projectile.h
===================================================================
--- common/Projectile.h	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#ifndef _PROJECTILE_H
-#define _PROJECTILE_H
-
-#include <string>
-#include <map>
-
-#include "Common.h"
-#include "WorldMap.h"
-#include "Player.h"
-
-using namespace std;
-
-class Projectile {
-public:
-   unsigned int id;
-   POSITION pos;
-   unsigned int target;
-   int speed;
-   int damage;
-   unsigned long long timeLastUpdated;
-
-   Projectile();
-   Projectile(const Projectile& p);
-   Projectile(int x, int y, int targetId, int damage);
-
-   ~Projectile();
-
-   void setId(unsigned int id);
-
-   void serialize(char* buffer);
-   void deserialize(char* buffer);
-
-   // returns true if the projectile reached the target and should be deleted
-   bool move(map<unsigned int, Player*>& mapPlayers);
-};
-
-#endif
Index: mmon/WorldMap.cpp
===================================================================
--- common/WorldMap.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,367 +1,0 @@
-#include "WorldMap.h"
-
-#include <string>
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <cstdlib>
-#include <cstring>
-
-using namespace std;
-
-WorldMap::WorldMap(int width, int height)
-{
-   this->width = width;
-   this->height = height;
-
-   vctMap = new vector<vector<TerrainType>*>(width);
-   vctStructures = new vector<vector<StructureType>*>(width);
-   vctObjects = new vector<Object>();
-
-   for (int x=0; x<width; x++) {
-      vector<TerrainType>* newMapVector = new vector<TerrainType>(height);
-      vector<StructureType>* newStructureVector = new vector<StructureType>(height);
-
-      for (int y=0; y<height; y++) {
-         (*newMapVector)[y] = TERRAIN_NONE;
-         (*newStructureVector)[y] = STRUCTURE_NONE;
-      }
-
-      (*vctMap)[x] = newMapVector;
-      (*vctStructures)[x] = newStructureVector;
-   }
-}
-
-WorldMap::~WorldMap()
-{
-   for (int x=0; x<width; x++) {
-      delete (*vctMap)[x];
-      delete (*vctStructures)[x];
-   }
-
-   delete vctMap;
-   delete vctStructures;
-   delete vctObjects;
-}
-
-void WorldMap::createObjectsFromStructures() {
-   for (int y=0; y<this->height; y++) {
-      for (int x=0; x<this->width; x++) {
-         switch (this->getStructure(x, y)) {
-            case STRUCTURE_BLUE_FLAG:
-               this->addObject(OBJECT_BLUE_FLAG, x*25+12, y*25+12);
-               break;
-            case STRUCTURE_RED_FLAG:
-               this->addObject(OBJECT_RED_FLAG, x*25+12, y*25+12);
-               break;
-            case STRUCTURE_NONE:
-               break;
-         }
-      }
-   }
-}
-
-TerrainType WorldMap::getElement(int x, int y)
-{
-   return (*(*vctMap)[x])[y];
-}
-
-void WorldMap::setElement(int x, int y, TerrainType t)
-{
-   (*(*vctMap)[x])[y] = t;
-}
-
-StructureType WorldMap::getStructure(int x, int y)
-{
-   return (*(*vctStructures)[x])[y];
-}
-
-void WorldMap::setStructure(int x, int y, StructureType t)
-{
-   (*(*vctStructures)[x])[y] = t;
-}
-
-POSITION WorldMap::getStructureLocation(StructureType t)
-{
-   POSITION pos;
-   pos.x = 0;
-   pos.y = 0;
-
-   for (unsigned int x=0; x<vctStructures->size(); x++) {
-      for (unsigned int y=0; y<(*vctStructures)[x]->size(); y++) {
-        if ((*(*vctStructures)[x])[y] == t) {
-           pos.x = x;
-           pos.y = y;
-           return pos;
-        } 
-      }
-   }
-
-   return pos;
-}
-
-vector<WorldMap::Object>* WorldMap::getObjects() {
-   return vctObjects;
-}
-
-vector<WorldMap::Object> WorldMap::getObjects(int x, int y) {
-   vector<WorldMap::Object> vctObjectsInRegion;
-
-   vector<WorldMap::Object>::iterator it;
-   for (it = vctObjects->begin(); it != vctObjects->end(); it++) {
-      if (it->pos.x/25 == x && it->pos.y/25 == y)
-         vctObjectsInRegion.push_back(*it);
-   }
-
-   return vctObjectsInRegion;
-}
-
-// used by the server to create new objects
-void WorldMap::addObject(ObjectType t, int x, int y) {
-   unsigned int id;
-   vector<WorldMap::Object>::iterator it;
-
-   for (id = 0; id < vctObjects->size(); id++) {
-      for (it = vctObjects->begin(); it != vctObjects->end(); it++) {
-         if (id == it->id)
-            break;
-      }
-
-      if (it == vctObjects->end())  // if no objects with this id exist
-         break;
-   }
-
-   WorldMap::Object o(id, t, x, y);
-   vctObjects->push_back(o);
-}
-
-// used by the client to update object positions or create objects it has not seen before
-void WorldMap::updateObject(unsigned int id, ObjectType t, int x, int y) {
-   vector<WorldMap::Object>::iterator it;
-   bool foundObject = false;
-
-   cout << "Searching for object to update" << endl;
-   switch (t) {
-   case OBJECT_BLUE_FLAG:
-      cout << "BLUE_FLAG" << endl;
-      break;
-   case OBJECT_RED_FLAG:
-      cout << "RED_FLAG" << endl;
-      break;
-   case OBJECT_NONE:
-      cout << "OBJECY_NONE" << endl;
-      break;
-   }
-
-   for (it = vctObjects->begin(); it != vctObjects->end(); it++) {
-      if (it->id == id) {
-         foundObject = true;
-         cout << "Found object with id " << id << endl;
-         switch (it->type) {
-         case OBJECT_BLUE_FLAG:
-            cout << "BLUE_FLAG" << endl;
-            break;
-         case OBJECT_RED_FLAG:
-            cout << "RED_FLAG" << endl;
-            break;
-         case OBJECT_NONE:
-            cout << "OBJECY_NONE" << endl;
-            break;
-         }
-         it->pos.x = x;
-         it->pos.y = y;
-      }
-   }
-
-   if (!foundObject) {
-      WorldMap::Object o(id, t, x, y);
-      vctObjects->push_back(o);
-   }
-}
-
-bool WorldMap::removeObject(unsigned int id) {
-   vector<WorldMap::Object>::iterator it;
-
-   for (it = vctObjects->begin(); it != vctObjects->end(); it++) {
-      if (it->id == id) {
-         vctObjects->erase(it);
-         return true;
-      }
-   }
-
-   return false;  // no object with that id was found
-}
-
-WorldMap* WorldMap::createDefaultMap()
-{
-   WorldMap* m = new WorldMap(12l, 12);
-
-   for(int x=0; x<12; x++)
-   {   
-      for(int y=0; y<12; y++)
-      {
-         if (x ==0 || y == 0 || x == 11 || y == 11)
-            m->setElement(x, y, TERRAIN_OCEAN);
-         else
-            m->setElement(x, y, TERRAIN_GRASS);
-
-         m->setStructure(x, y, STRUCTURE_NONE);
-      }
-   }
-
-   m->setElement(5, 5, TERRAIN_ROCK);
-
-   return m;
-}
-
-WorldMap* WorldMap::loadMapFromFile(string filename)
-{
-   WorldMap* m = NULL;
-
-   ifstream file(filename.c_str());
-
-   cout << "Trying to open file: " << filename << endl;
-
-   if (file.is_open())
-   {
-      cout << filename << " opened successfully" << endl;
-
-      string line;
-      int width, height;
-
-      // read the map dimensions
-      getline(file, line);
-
-      istringstream iss(line);
-      string token;
-      getline(iss, token, 'x');
-      width = atoi(token.c_str());
-      getline(iss, token, 'x');
-      height = atoi(token.c_str());
-
-      cout << "width: " << width << endl;
-      cout << "height: " << height << endl;
-
-      m = new WorldMap(width, height);
-
-      // read the map contents
-      int row = 0;
-      while ( file.good() )
-      {
-         getline(file, line);
-         if (line.size() > 0)
-         {
-            //cout << "row: " << row << endl;
-            //cout << "line: " << line << endl;
-
-            istringstream iss(line);
-            string token;
-
-            if (row < height) {
-               // load terrain
-
-               int type;
-               TerrainType terrain;
-
-               for(int x=0; x<width; x++)
-               {
-                  getline(iss, token, ',');
-                  type = atoi(token.c_str());
-
-                  //cout << "x: " << x << endl;
-                  //cout << "token: " << token << endl;
-                  //cout << "type: " << type << endl;
-
-                  switch(type) {
-                  case 1:
-                     terrain = TERRAIN_GRASS;
-                     break;
-                  case 2:
-                     terrain = TERRAIN_OCEAN;
-                     break;
-                  case 3:
-                     terrain = TERRAIN_ROCK;
-                     break;
-                  }
-
-                  m->setElement(x, row, terrain);
-               }
-            }else {
-               // load structure
-
-               int x, y, type;
-               StructureType structure;
-
-               getline(iss, token, ',');
-               //cout << "token(x): " << token << endl;
-               x = atoi(token.c_str());
-
-               getline(iss, token, ',');
-               //cout << "token(y): " << token << endl;
-               y = atoi(token.c_str());
-
-               getline(iss, token, ',');
-               //cout << "token(type): " << token << endl;
-               type = atoi(token.c_str());
-
-               switch(type) {
-               case 0:
-                  structure = STRUCTURE_NONE;
-                  break;
-               case 1:
-                  structure = STRUCTURE_BLUE_FLAG;
-                  break;
-               case 2:
-                  structure = STRUCTURE_RED_FLAG;
-                  break;
-               }
-
-               m->setStructure(x, y, structure);
-            }
-         }
-
-         row++;
-      }
-      file.close();
-      cout << filename << " closed" << endl;
-   }
-   else
-      cout << "Could not open the file" << endl;
-
-   cout << "Finished file processing" << endl;
-
-   return m;
-}
-
-
-/*** Functions for Object ***/
-
-WorldMap::Object::Object(unsigned int id, ObjectType type, int x, int y) {
-   this->type = type;
-   this->id = id;
-   this->pos.x = x;
-   this->pos.y = y;
-}
-
-WorldMap::Object::Object(unsigned int id, ObjectType type, POSITION pos) {
-   this->type = type;
-   this->id = id;
-   this->pos = pos;
-}
-
-WorldMap::Object::~Object() {
-}
-
-void WorldMap::Object::serialize(char* buffer) {
-   memcpy(buffer, &this->type, 4);
-   memcpy(buffer+4, &this->id, 4);
-   memcpy(buffer+8, &this->pos.x, 4);
-   memcpy(buffer+12, &this->pos.y, 4);
-}
-
-void WorldMap::Object::deserialize(char* buffer) {
-   memcpy(&this->type, buffer, 4);
-   memcpy(&this->id, buffer+4, 4);
-   memcpy(&this->pos.x, buffer+8, 4);
-   memcpy(&this->pos.y, buffer+12, 4);
-}
Index: mmon/WorldMap.h
===================================================================
--- common/WorldMap.h	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,76 +1,0 @@
-#ifndef _WORLDMAP_H
-#define _WORLDMAP_H
-
-#include <string>
-#include <vector>
-
-#include "Common.h"
-
-using namespace std;
-
-enum TerrainType {
-   TERRAIN_NONE,
-   TERRAIN_GRASS,
-   TERRAIN_OCEAN,
-   TERRAIN_ROCK
-};
-
-enum StructureType {
-   STRUCTURE_NONE,
-   STRUCTURE_BLUE_FLAG,
-   STRUCTURE_RED_FLAG
-};
-
-enum ObjectType {
-   OBJECT_NONE,
-   OBJECT_BLUE_FLAG,
-   OBJECT_RED_FLAG
-};
-
-class WorldMap {
-public:
-   class Object {
-   public:
-      unsigned int id;
-      ObjectType type;
-      POSITION pos;
-
-      Object(unsigned int id, ObjectType type, int x, int y);
-      Object(unsigned int id, ObjectType type, POSITION pos);
-
-      ~Object();
-
-      void serialize(char* buffer);
-      void deserialize(char* buffer);
-   };
-
-   int width, height;
-   vector<vector<TerrainType>*>* vctMap;
-   vector<vector<StructureType>*>* vctStructures;
-   vector<Object>* vctObjects; 
-
-   WorldMap(int width, int height);
-
-   ~WorldMap();
-
-   void createObjectsFromStructures();
-
-   TerrainType getElement(int x, int y);
-   void setElement(int x, int y, TerrainType type);
-
-   StructureType getStructure(int x, int y);
-   void setStructure(int x, int y, StructureType type);
-   POSITION getStructureLocation(StructureType type);
-
-   vector<Object>* getObjects();
-   vector<Object> getObjects(int x, int y);
-
-   void addObject(ObjectType type, int x, int y);
-   void updateObject(unsigned int id, ObjectType t, int x, int y);
-   bool removeObject(unsigned int id);
-
-   static WorldMap* createDefaultMap();
-   static WorldMap* loadMapFromFile(string filename);
-};
-
-#endif
Index: ta/map.txt
===================================================================
--- data/map.txt	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,28 +1,0 @@
-25x25
-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
-2,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,3,1,1,1,1,1,1,2
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
-12,1,1
-12,23,2
Index: sign/algorithms.txt
===================================================================
--- design/algorithms.txt	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,35 +1,0 @@
-This file general algorithms used in the game, such as how players login/logout and how the create games or join existing games.
-
-Currently, there is no distinction between logging in and creating a game. There is essentially one game that always exists; when a player logs in, he joins that game, and when he logs out, he leaves that game.
-
-New Login/Logout Algorithm:
-
-When a player logs in, the db lookup and password check occurs just like it already does, and the player is added to some global player list. Other logged-in players get notified of this.
-
-When a player logs out, he gets removed from the list and everyone else also gets notified.
-
-All of this already happens, but it's tied to the signle game instance.
-
-STEPS:
- - Un-implement/comment out the current code that sends messages about the game instance and just keep the code that adds/removes players from the global list.
- - Make sure that chatting with players works.
- - Modify the current game class to keep track of players in the game and re-implement (or possibly create) the messages for joining and leaving a game.
- - Re-implement the movement/combat messages to use the list of players in the game, not the global list
-
-mapPlayers holds all players on the server and broadcasted messages are sent to everyone in the map
-
-A player logs in by sending a LOGIN message. When the server receives the message and verifies user credentials, it sends the following messages:
- To the new player
- - PLAYER messages for existing players (still needed)
- - OBJECT messages for existing objects on the map (only send for new game)
- - SCORE messages (only send for new game)
- - PLAYER message to each existing player about the new one
- - LOGIN message to the new player to indicate successful login (final reply)
-
-For logout messages, the logic can basically be kept the same. Just move the part related to restoring the flag in case the player is carrying one.
-
-Logic for sending chat messages
-
-Server receives a chat message and sends the following:
- - The received chat message is simply broadcast to all other players
- - An error will result in a chat message only being sent back to the sender
Index: sign/message_spec.txt
===================================================================
--- design/message_spec.txt	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,77 +1,0 @@
-This document contains all messages and descriptions of how they are used or should be used
-
-MSG_TYPE_ACK
-Sent in response to a message of any other type and contains the id of the received message. When the recipient gets the ack, the know the original message with that id was received. This type is used by the MessageProcessor class.
-
-MSG_TYPE_REGISTER
-Client sends this message to register a new account. Contains a username, password, and class.
-
-MSG_TYPE_LOGIN
-Client sends this message to login. Contains a username and password
-
-MSG_TYPE_LOGOUT
-Client sends this message to logout. Contains no extra data. The server uses the sender address to determine which player sent it.
-Server broadcasts a reply with the player id if logout was successfull or sends the sender's id and a string with an error message back to the original sender.
-
-MSG_TYPE_CHAT
-Client uses this to send chat messages to the server. The server uses it to relay chat message to the correct recipients. Contains the userame of the sender and the message itself (I think).
-
-MSG_TYPE_PLAYER
-Double-check correctness of this info
-server sends this to update player positions
-
-MSG_TYPE_PLAYER_MOVE
-Double-check correctness of this info
-Client sends this when a player wants to move
-
-MSG_TYPE_OBJECT
-Server sends this to indicate that a new object appeared on the map. (Currently, the only objects are flags).
-
-MSG_TYPE_REMOVE_OBJECT
-Server sends this to indicate that an object has been removed from the map. (Currently happens when a flag is picked up)
-
-MSG_TYPE_PICKUP_FLAG
-Client sends this when it wants to pick up a flag. This is sent when the user presses the correct hotkey, even if there is no flag close enough to pick up.
-
-MSG_TYPE_DROP_FLAG
-Client sends this when it wants to drop a flag. As above, this is sent when the hotkey is pressed, even if the player isn't holding a flag.
-
-MSG_TYPE_SCORE
-The server sends this to indicate a change in the score of a team.
-
-MSG_TYPE_START_ATTACK
-Info needs confirmation
-The client sends this to indicate they are starting an attack animation.
-I think the point here is for the server to tell other clients, so the correct animation is played on their screen as well.
-
-MSG_TYPE_ATTACK
-Not sure who sends this, but I think it's the client and I think it indicates the actual attack. The server sends MSG_TYPE_PLAYER messages to indicate a decrease in the hp of the target and some other state changes.
-
-MSG_TYPE_PROJECTILE
-Verify this
-Server sends this to indicate that a projectile has been created (in the case of a ranged attack). Probably contains the position and direction of the projectile. Not sure if it contains the id or name of the target player.
-
-MSG_TYPE_REMOVE_PROJECTILE
-Server sends this when a projectile should be removed (when it has reached its target).
-
-MSG_TYPE_CREATE_GAME
-Client sends this when they want to create a game. Contains the game name (probably not id since the server determines the id upon creation).
-
-MSG_TYPE_JOIN_GAME
-Client sends this when they want to join a game. Contains the game name or id.
-
-MSG_TYPE_LEAVE_GAME
-Client sends this when they want to leave a game. Not sure what this contains. Maybe nothing.
-
-MSG_TYPE_GAME_INFO
-Server sends this to tell all clients about existing games. Contains the game name and the number of players currently in it.
-
-MSG_TYPE_JOIN_GAME_SUCCESS
-Server sends this to a client to indicate that a game was joined successfully. This is useful because two clients might simultaneously want to a join a game with only one open slot or maybe the game ended by the time the server got the client's message.
-
-MSG_TYPE_JOIN_GAME_FAILURE
-Server sends this to indicate that a game could not be join. See explanation about. Also could be sent if the name the client specified doesn't match an existing game.
-
-MSG_TYPE_JOIN_GAME_ACK
-Needs verification.
-The client sends this upon receipt of a MSG_TYPE_JOIN_GAME_SUCCESS to indicate that he got it. This message is useful to guarantee initialization of some variables (I think of the Game variable on the client). Pretty clunky, so try to find a way of avoiding this.
Index: sign/multipleGameDesign.txt
===================================================================
--- design/multipleGameDesign.txt	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,13 +1,0 @@
-When a user logs in, he currently automatically joins a game.
-
-Instead, the user should join a games lobby where he sees a chat, a button to create a new game, all created games and  how many people have joined each one.
-
-The first step in this process is to create a separate Game class that just holds a list of players and lets them join and quit and slightly modify the gui.
-
-There should be a new LOBBY state the player goes to after logging in, which lets him create a game and view all created games. There should also be a button to let him go to the current "global" game.
-
-The client only has one game object, which is the game the client is currently in (or NULL if the client is in the lobby). The mapGames of the client maps game names to number of players in each game.
-
-There should be code that ends a game when a team scores 3 points and shows each participant a screen saying which team won, what the final score was, and a button back to the lobby. More info can be added to that screen in the future. As far as the server is concerned, when a player is viewing this screen, they are already at the lobby and no longer in their game.
-
-When a game ends, everyone not in the game should get a GAME_INFO message with 0 players so they delete the game. Everyone in the game will instead get a GAME_FINISH message which will have the winner and the final score (and possibly other info in the future, such as kills, deaths, assists, and flag turn-ins per player). Once these messages are sent, the server will delete the game from its list. The player who got the FINISH_GAME message will go to the lobby state, but save the game results in a new GameResult object and display it in the afore-mentioned screen with the results.
Index: aphics_library/SimpleFragmentShader.fragmentshader
===================================================================
--- graphics_library/SimpleFragmentShader.fragmentshader	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,7 +1,0 @@
-#version 330 core
-
-out vec3 color;
-
-void main(){
-   color = vec3(1,0,0);
-}
Index: aphics_library/SimpleTransform.vertexshader
===================================================================
--- graphics_library/SimpleTransform.vertexshader	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,22 +1,0 @@
-#version 330 core
-
-// Input vertex data, different for all executions of this shader.
-layout(location = 0) in vec3 vertexPosition_modelspace;
-
-// Notice that the "1" here equals the "1" in glVertexAttribPointer
-layout(location = 1) in vec3 vertexColor;
-
-// Output data ; will be interpolated for each fragment.
-out vec3 fragmentColor;
-// Values that stay constant for the whole mesh.
-uniform mat4 MVP;
-
-void main(){
-
-	// Output position of the vertex, in clip space : MVP * position
-	gl_Position =  MVP * vec4(vertexPosition_modelspace,1);
-
-   // The color of each vertex will be interpolated
-   // to produce the color of each fragment
-   fragmentColor = vertexColor;
-}
Index: aphics_library/SimpleVertexShader.vertexshader
===================================================================
--- graphics_library/SimpleVertexShader.vertexshader	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#version 330 core
-
-layout(location = 0) in vec3 vertexPosition_modelspace;
-
-void main() {
-   gl_Position.xyz = vertexPosition_modelspace;
-   gl_Position.w = 1.0;
-}
Index: aphics_library/SingleColor.fragmentshader
===================================================================
--- graphics_library/SingleColor.fragmentshader	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,14 +1,0 @@
-#version 330 core
-
-// Interpolated values from the vertex shaders
-in vec3 fragmentColor;
-
-// Ouput data
-out vec3 color;
-
-void main()
-{
-   // Output color = color specified in the vertex shader,
-   // interpolated between all 3 surrounding vertices
-   color = fragmentColor;
-}
Index: aphics_library/TextureFragmentShader.fragmentshader
===================================================================
--- graphics_library/TextureFragmentShader.fragmentshader	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,16 +1,0 @@
-#version 330 core
-
-// Interpolated values from the vertex shaders
-in vec2 UV;
-
-// Ouput data
-out vec3 color;
-
-// Values that stay constant for the whole mesh.
-uniform sampler2D myTextureSampler;
-
-void main(){
-
-	// Output color = color of the texture at the specified UV
-	color = texture( myTextureSampler, UV ).rgb;
-}
Index: aphics_library/TransformVertexShader.vertexshader
===================================================================
--- graphics_library/TransformVertexShader.vertexshader	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,21 +1,0 @@
-#version 330 core
-
-// Input vertex data, different for all executions of this shader.
-layout(location = 0) in vec3 vertexPosition_modelspace;
-layout(location = 1) in vec2 vertexUV;
-
-// Output data ; will be interpolated for each fragment.
-out vec2 UV;
-
-// Values that stay constant for the whole mesh.
-uniform mat4 MVP;
-
-void main(){
-
-	// Output position of the vertex, in clip space : MVP * position
-	gl_Position =  MVP * vec4(vertexPosition_modelspace,1);
-	
-	// UV of the vertex. No special space for this one.
-	UV = vertexUV;
-}
-
Index: aphics_library/common/controls.cpp
===================================================================
--- graphics_library/common/controls.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,104 +1,0 @@
-// Include GLFW
-#include <GLFW/glfw3.h>
-extern GLFWwindow* window; // The "extern" keyword here is to access the variable "window" declared in tutorialXXX.cpp. This is a hack to keep the tutorials simple. Please avoid this.
-
-// Include GLM
-#include <glm/glm.hpp>
-#include <glm/gtc/matrix_transform.hpp>
-using namespace glm;
-
-#include "controls.hpp"
-
-glm::mat4 ViewMatrix;
-glm::mat4 ProjectionMatrix;
-
-glm::mat4 getViewMatrix(){
-        return ViewMatrix;
-}
-glm::mat4 getProjectionMatrix(){
-        return ProjectionMatrix;
-}
-
-
-// Initial position : on +Z
-glm::vec3 position = glm::vec3( 0, 0, 5 ); 
-// Initial horizontal angle : toward -Z
-float horizontalAngle = 3.14f;
-// Initial vertical angle : none
-float verticalAngle = 0.0f;
-// Initial Field of View
-float initialFoV = 45.0f;
-
-float speed = 3.0f; // 3 units / second
-float mouseSpeed = 0.005f;
-
-
-
-void computeMatricesFromInputs(){
-
-        // glfwGetTime is called only once, the first time this function is called
-        static double lastTime = glfwGetTime();
-
-        // Compute time difference between current and last frame
-        double currentTime = glfwGetTime();
-        float deltaTime = float(currentTime - lastTime);
-
-        // Get mouse position
-        double xpos, ypos;
-        glfwGetCursorPos(window, &xpos, &ypos);
-
-        // Reset mouse position for next frame
-        glfwSetCursorPos(window, 1024/2, 768/2);
-
-        // Compute new orientation
-        horizontalAngle += mouseSpeed * float(1024/2 - xpos );
-        verticalAngle   += mouseSpeed * float( 768/2 - ypos );
-
-        // Direction : Spherical coordinates to Cartesian coordinates conversion
-        glm::vec3 direction(
-                cos(verticalAngle) * sin(horizontalAngle), 
-                sin(verticalAngle),
-                cos(verticalAngle) * cos(horizontalAngle)
-        );
-        
-        // Right vector
-        glm::vec3 right = glm::vec3(
-                sin(horizontalAngle - 3.14f/2.0f), 
-                0,
-                cos(horizontalAngle - 3.14f/2.0f)
-        );
-        
-        // Up vector
-        glm::vec3 up = glm::cross( right, direction );
-
-        // Move forward
-        if (glfwGetKey( window, GLFW_KEY_UP ) == GLFW_PRESS){
-                position += direction * deltaTime * speed;
-        }
-        // Move backward
-        if (glfwGetKey( window, GLFW_KEY_DOWN ) == GLFW_PRESS){
-                position -= direction * deltaTime * speed;
-        }
-        // Strafe right
-        if (glfwGetKey( window, GLFW_KEY_RIGHT ) == GLFW_PRESS){
-                position += right * deltaTime * speed;
-        }
-        // Strafe left
-        if (glfwGetKey( window, GLFW_KEY_LEFT ) == GLFW_PRESS){
-                position -= right * deltaTime * speed;
-        }
-
-        float FoV = initialFoV;// - 5 * glfwGetMouseWheel(); // Now GLFW 3 requires setting up a callback for this. It's a bit too complicated for this beginner's tutorial, so it's disabled instead.
-
-        // Projection matrix : 45° Field of View, 4:3 ratio, display range : 0.1 unit <-> 100 units
-        ProjectionMatrix = glm::perspective(FoV, 4.0f / 3.0f, 0.1f, 100.0f);
-        // Camera matrix
-        ViewMatrix       = glm::lookAt(
-                                                                position,           // Camera is here
-                                                                position+direction, // and looks here : at the same position, plus "direction"
-                                                                up                  // Head is up (set to 0,-1,0 to look upside-down)
-                                                   );
-
-        // For the next frame, the "last time" will be "now"
-        lastTime = currentTime;
-}
Index: aphics_library/common/controls.hpp
===================================================================
--- graphics_library/common/controls.hpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#ifndef CONTROLS_HPP
-#define CONTROLS_HPP
-
-void computeMatricesFromInputs();
-glm::mat4 getViewMatrix();
-glm::mat4 getProjectionMatrix();
-
-#endif
Index: aphics_library/common/shader.cpp
===================================================================
--- graphics_library/common/shader.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,107 +1,0 @@
-#include <stdio.h>
-#include <string>
-#include <vector>
-#include <iostream>
-#include <fstream>
-#include <algorithm>
-using namespace std;
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <GL/glew.h>
-
-#include "shader.hpp"
-
-GLuint LoadShaders(const char * vertex_file_path,const char * fragment_file_path){
-
-        // Create the shaders
-        GLuint VertexShaderID = glCreateShader(GL_VERTEX_SHADER);
-        GLuint FragmentShaderID = glCreateShader(GL_FRAGMENT_SHADER);
-
-        // Read the Vertex Shader code from the file
-        std::string VertexShaderCode;
-        std::ifstream VertexShaderStream(vertex_file_path, std::ios::in);
-        if(VertexShaderStream.is_open()){
-                std::string Line = "";
-                while(getline(VertexShaderStream, Line))
-                        VertexShaderCode += "\n" + Line;
-                VertexShaderStream.close();
-        }else{
-                printf("Impossible to open %s. Are you in the right directory ? Don't forget to read the FAQ !\n", vertex_file_path);
-                getchar();
-                return 0;
-        }
-
-        // Read the Fragment Shader code from the file
-        std::string FragmentShaderCode;
-        std::ifstream FragmentShaderStream(fragment_file_path, std::ios::in);
-        if(FragmentShaderStream.is_open()){
-                std::string Line = "";
-                while(getline(FragmentShaderStream, Line))
-                        FragmentShaderCode += "\n" + Line;
-                FragmentShaderStream.close();
-        }
-
-
-
-        GLint Result = GL_FALSE;
-        int InfoLogLength;
-
-
-
-        // Compile Vertex Shader
-        printf("Compiling shader : %s\n", vertex_file_path);
-        char const * VertexSourcePointer = VertexShaderCode.c_str();
-        glShaderSource(VertexShaderID, 1, &VertexSourcePointer , NULL);
-        glCompileShader(VertexShaderID);
-
-        // Check Vertex Shader
-        glGetShaderiv(VertexShaderID, GL_COMPILE_STATUS, &Result);
-        glGetShaderiv(VertexShaderID, GL_INFO_LOG_LENGTH, &InfoLogLength);
-        if ( InfoLogLength > 0 ){
-                std::vector<char> VertexShaderErrorMessage(InfoLogLength+1);
-                glGetShaderInfoLog(VertexShaderID, InfoLogLength, NULL, &VertexShaderErrorMessage[0]);
-                printf("%s\n", &VertexShaderErrorMessage[0]);
-        }
-
-
-
-        // Compile Fragment Shader
-        printf("Compiling shader : %s\n", fragment_file_path);
-        char const * FragmentSourcePointer = FragmentShaderCode.c_str();
-        glShaderSource(FragmentShaderID, 1, &FragmentSourcePointer , NULL);
-        glCompileShader(FragmentShaderID);
-
-        // Check Fragment Shader
-        glGetShaderiv(FragmentShaderID, GL_COMPILE_STATUS, &Result);
-        glGetShaderiv(FragmentShaderID, GL_INFO_LOG_LENGTH, &InfoLogLength);
-        if ( InfoLogLength > 0 ){
-                std::vector<char> FragmentShaderErrorMessage(InfoLogLength+1);
-                glGetShaderInfoLog(FragmentShaderID, InfoLogLength, NULL, &FragmentShaderErrorMessage[0]);
-                printf("%s\n", &FragmentShaderErrorMessage[0]);
-        }
-
-
-
-        // Link the program
-        printf("Linking program\n");
-        GLuint ProgramID = glCreateProgram();
-        glAttachShader(ProgramID, VertexShaderID);
-        glAttachShader(ProgramID, FragmentShaderID);
-        glLinkProgram(ProgramID);
-
-        // Check the program
-        glGetProgramiv(ProgramID, GL_LINK_STATUS, &Result);
-        glGetProgramiv(ProgramID, GL_INFO_LOG_LENGTH, &InfoLogLength);
-        if ( InfoLogLength > 0 ){
-                std::vector<char> ProgramErrorMessage(InfoLogLength+1);
-                glGetProgramInfoLog(ProgramID, InfoLogLength, NULL, &ProgramErrorMessage[0]);
-                printf("%s\n", &ProgramErrorMessage[0]);
-        }
-
-        glDeleteShader(VertexShaderID);
-        glDeleteShader(FragmentShaderID);
-
-        return ProgramID;
-}
Index: aphics_library/common/shader.hpp
===================================================================
--- graphics_library/common/shader.hpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,6 +1,0 @@
-#ifndef SHADER_HPP
-#define SHADER_HPP
-
-GLuint LoadShaders(const char * vertex_file_path,const char * fragment_file_path);
-
-#endif
Index: aphics_library/common/texture.cpp
===================================================================
--- graphics_library/common/texture.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,211 +1,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <GL/glew.h>
-
-#include <GLFW/glfw3.h>
-
-
-GLuint loadBMP_custom(const char * imagepath){
-
-        printf("Reading image %s\n", imagepath);
-
-        // Data read from the header of the BMP file
-        unsigned char header[54];
-        unsigned int dataPos;
-        unsigned int imageSize;
-        unsigned int width, height;
-        // Actual RGB data
-        unsigned char * data;
-
-        // Open the file
-        FILE * file = fopen(imagepath,"rb");
-        if (!file)                                                          {printf("%s could not be opened. Are you in the right directory ? Don't forget to read the FAQ !\n", imagepath); getchar(); return 0;}
-
-        // Read the header, i.e. the 54 first bytes
-
-        // If less than 54 bytes are read, problem
-        if ( fread(header, 1, 54, file)!=54 ){ 
-                printf("Not a correct BMP file\n");
-                return 0;
-        }
-        // A BMP files always begins with "BM"
-        if ( header[0]!='B' || header[1]!='M' ){
-                printf("Not a correct BMP file\n");
-                return 0;
-        }
-        // Make sure this is a 24bpp file
-        if ( *(int*)&(header[0x1E])!=0  )         {printf("Not a correct BMP file\n");    return 0;}
-        if ( *(int*)&(header[0x1C])!=24 )         {printf("Not a correct BMP file\n");    return 0;}
-
-        // Read the information about the image
-        dataPos    = *(int*)&(header[0x0A]);
-        imageSize  = *(int*)&(header[0x22]);
-        width      = *(int*)&(header[0x12]);
-        height     = *(int*)&(header[0x16]);
-
-        // Some BMP files are misformatted, guess missing information
-        if (imageSize==0)    imageSize=width*height*3; // 3 : one byte for each Red, Green and Blue component
-        if (dataPos==0)      dataPos=54; // The BMP header is done that way
-
-        // Create a buffer
-        data = new unsigned char [imageSize];
-
-        // Read the actual data from the file into the buffer
-        fread(data,1,imageSize,file);
-
-        // Everything is in memory now, the file wan be closed
-        fclose (file);
-
-        // Create one OpenGL texture
-        GLuint textureID;
-        glGenTextures(1, &textureID);
-        
-        // "Bind" the newly created texture : all future texture functions will modify this texture
-        glBindTexture(GL_TEXTURE_2D, textureID);
-
-        // Give the image to OpenGL
-        glTexImage2D(GL_TEXTURE_2D, 0,GL_RGB, width, height, 0, GL_BGR, GL_UNSIGNED_BYTE, data);
-
-        // OpenGL has now copied the data. Free our own version
-        delete [] data;
-
-        // Poor filtering, or ...
-        //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-        //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 
-
-        // ... nice trilinear filtering.
-        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
-        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
-        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); 
-        glGenerateMipmap(GL_TEXTURE_2D);
-
-        // Return the ID of the texture we just created
-        return textureID;
-}
-
-// Since GLFW 3, glfwLoadTexture2D() has been removed. You have to use another texture loading library, 
-// or do it yourself (just like loadBMP_custom and loadDDS)
-//GLuint loadTGA_glfw(const char * imagepath){
-//
-//      // Create one OpenGL texture
-//      GLuint textureID;
-//      glGenTextures(1, &textureID);
-//
-//      // "Bind" the newly created texture : all future texture functions will modify this texture
-//      glBindTexture(GL_TEXTURE_2D, textureID);
-//
-//      // Read the file, call glTexImage2D with the right parameters
-//      glfwLoadTexture2D(imagepath, 0);
-//
-//      // Nice trilinear filtering.
-//      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
-//      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
-//      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-//      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); 
-//      glGenerateMipmap(GL_TEXTURE_2D);
-//
-//      // Return the ID of the texture we just created
-//      return textureID;
-//}
-
-
-
-#define FOURCC_DXT1 0x31545844 // Equivalent to "DXT1" in ASCII
-#define FOURCC_DXT3 0x33545844 // Equivalent to "DXT3" in ASCII
-#define FOURCC_DXT5 0x35545844 // Equivalent to "DXT5" in ASCII
-
-GLuint loadDDS(const char * imagepath){
-
-        unsigned char header[124];
-
-        FILE *fp; 
- 
-        /* try to open the file */ 
-        fp = fopen(imagepath, "rb"); 
-        if (fp == NULL){
-                printf("%s could not be opened. Are you in the right directory ? Don't forget to read the FAQ !\n", imagepath); getchar(); 
-                return 0;
-        }
-   
-        /* verify the type of file */ 
-        char filecode[4]; 
-        fread(filecode, 1, 4, fp); 
-        if (strncmp(filecode, "DDS ", 4) != 0) { 
-                fclose(fp); 
-                return 0; 
-        }
-        
-        /* get the surface desc */ 
-        fread(&header, 124, 1, fp); 
-
-        unsigned int height      = *(unsigned int*)&(header[8 ]);
-        unsigned int width           = *(unsigned int*)&(header[12]);
-        unsigned int linearSize  = *(unsigned int*)&(header[16]);
-        unsigned int mipMapCount = *(unsigned int*)&(header[24]);
-        unsigned int fourCC      = *(unsigned int*)&(header[80]);
-
- 
-        unsigned char * buffer;
-        unsigned int bufsize;
-        /* how big is it going to be including all mipmaps? */ 
-        bufsize = mipMapCount > 1 ? linearSize * 2 : linearSize; 
-        buffer = (unsigned char*)malloc(bufsize * sizeof(unsigned char)); 
-        fread(buffer, 1, bufsize, fp); 
-        /* close the file pointer */ 
-        fclose(fp);
-
-        unsigned int components  = (fourCC == FOURCC_DXT1) ? 3 : 4; 
-        unsigned int format;
-        switch(fourCC) 
-        { 
-        case FOURCC_DXT1: 
-                format = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; 
-                break; 
-        case FOURCC_DXT3: 
-                format = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; 
-                break; 
-        case FOURCC_DXT5: 
-                format = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; 
-                break; 
-        default: 
-                free(buffer); 
-                return 0; 
-        }
-
-        // Create one OpenGL texture
-        GLuint textureID;
-        glGenTextures(1, &textureID);
-
-        // "Bind" the newly created texture : all future texture functions will modify this texture
-        glBindTexture(GL_TEXTURE_2D, textureID);
-        glPixelStorei(GL_UNPACK_ALIGNMENT,1);   
-        
-        unsigned int blockSize = (format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) ? 8 : 16; 
-        unsigned int offset = 0;
-
-        /* load the mipmaps */ 
-        for (unsigned int level = 0; level < mipMapCount && (width || height); ++level) 
-        { 
-                unsigned int size = ((width+3)/4)*((height+3)/4)*blockSize; 
-                glCompressedTexImage2D(GL_TEXTURE_2D, level, format, width, height,  
-                        0, size, buffer + offset); 
-         
-                offset += size; 
-                width  /= 2; 
-                height /= 2; 
-
-                // Deal with Non-Power-Of-Two textures. This code is not included in the webpage to reduce clutter.
-                if(width < 1) width = 1;
-                if(height < 1) height = 1;
-
-        } 
-
-        free(buffer); 
-
-        return textureID;
-
-
-}
Index: aphics_library/common/texture.hpp
===================================================================
--- graphics_library/common/texture.hpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,16 +1,0 @@
-#ifndef TEXTURE_HPP
-#define TEXTURE_HPP
-
-// Load a .BMP file using our custom loader
-GLuint loadBMP_custom(const char * imagepath);
-
-//// Since GLFW 3, glfwLoadTexture2D() has been removed. You have to use another texture loading library, 
-//// or do it yourself (just like loadBMP_custom and loadDDS)
-//// Load a .TGA file using GLFW's own loader
-//GLuint loadTGA_glfw(const char * imagepath);
-
-// Load a .DDS file using GLFW's own loader
-GLuint loadDDS(const char * imagepath);
-
-
-#endif
Index: aphics_library/graphics_library.sln
===================================================================
--- graphics_library/graphics_library.sln	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,20 +1,0 @@
-﻿
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual C++ Express 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "graphics_library", "graphics_library.vcxproj", "{9C8FFDBE-5F41-4E6D-B455-85A2E9AA781D}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Win32 = Debug|Win32
-		Release|Win32 = Release|Win32
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{9C8FFDBE-5F41-4E6D-B455-85A2E9AA781D}.Debug|Win32.ActiveCfg = Debug|Win32
-		{9C8FFDBE-5F41-4E6D-B455-85A2E9AA781D}.Debug|Win32.Build.0 = Debug|Win32
-		{9C8FFDBE-5F41-4E6D-B455-85A2E9AA781D}.Release|Win32.ActiveCfg = Release|Win32
-		{9C8FFDBE-5F41-4E6D-B455-85A2E9AA781D}.Release|Win32.Build.0 = Release|Win32
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-EndGlobal
Index: aphics_library/graphics_library.vcxproj
===================================================================
--- graphics_library/graphics_library.vcxproj	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,90 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <ProjectGuid>{9C8FFDBE-5F41-4E6D-B455-85A2E9AA781D}</ProjectGuid>
-    <RootNamespace>graphics_library</RootNamespace>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-    <CharacterSet>MultiByte</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>MultiByte</CharacterSet>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <IncludePath>C:\glew-1.10.0\include;C:\glfw-2.7.9.bin.WIN32\include;C:\glm;$(IncludePath)</IncludePath>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <LibraryPath>C:\glew-1.10.0\lib\Release\Win32;C:\glfw-2.7.9.bin.WIN32\lib-msvc100;$(LibraryPath)</LibraryPath>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <WarningLevel>Level3</WarningLevel>
-      <Optimization>Disabled</Optimization>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>glew32.lib;GLFW.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <WarningLevel>Level3</WarningLevel>
-      <Optimization>MaxSpeed</Optimization>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemGroup>
-    <ClCompile Include="common\controls.cpp" />
-    <ClCompile Include="common\shader.cpp" />
-    <ClCompile Include="common\texture.cpp" />
-    <ClCompile Include="main.cpp" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="SimpleFragmentShader.fragmentshader" />
-    <None Include="SimpleTransform.vertexshader" />
-    <None Include="SimpleVertexShader.vertexshader" />
-    <None Include="SingleColor.fragmentshader" />
-    <None Include="TextureFragmentShader.fragmentshader" />
-    <None Include="TransformVertexShader.vertexshader" />
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="common\controls.hpp" />
-    <ClInclude Include="common\shader.hpp" />
-    <ClInclude Include="common\texture.hpp" />
-  </ItemGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
-</Project>
Index: aphics_library/graphics_library.vcxproj.filters
===================================================================
--- graphics_library/graphics_library.vcxproj.filters	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,68 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <Filter Include="Source Files">
-      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
-      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
-    </Filter>
-    <Filter Include="Header Files">
-      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
-      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
-    </Filter>
-    <Filter Include="Resource Files">
-      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
-      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
-    </Filter>
-    <Filter Include="Header Files\common">
-      <UniqueIdentifier>{d934654a-a839-48d6-a4a6-a620fcaee36e}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="Source Files\common">
-      <UniqueIdentifier>{a04b1a63-118b-4076-b6ab-fafdf8011916}</UniqueIdentifier>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="main.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="common\controls.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="common\shader.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="common\texture.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="SimpleFragmentShader.fragmentshader">
-      <Filter>Resource Files</Filter>
-    </None>
-    <None Include="SimpleTransform.vertexshader">
-      <Filter>Resource Files</Filter>
-    </None>
-    <None Include="SimpleVertexShader.vertexshader">
-      <Filter>Resource Files</Filter>
-    </None>
-    <None Include="SingleColor.fragmentshader">
-      <Filter>Resource Files</Filter>
-    </None>
-    <None Include="TextureFragmentShader.fragmentshader">
-      <Filter>Resource Files</Filter>
-    </None>
-    <None Include="TransformVertexShader.vertexshader">
-      <Filter>Resource Files</Filter>
-    </None>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="common\controls.hpp">
-      <Filter>Header Files\common</Filter>
-    </ClInclude>
-    <ClInclude Include="common\shader.hpp">
-      <Filter>Header Files\common</Filter>
-    </ClInclude>
-    <ClInclude Include="common\texture.hpp">
-      <Filter>Header Files\common</Filter>
-    </ClInclude>
-  </ItemGroup>
-</Project>
Index: aphics_library/graphics_library.vcxproj.user
===================================================================
--- graphics_library/graphics_library.vcxproj.user	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,3 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-</Project>
Index: aphics_library/main.cpp
===================================================================
--- graphics_library/main.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,250 +1,0 @@
-// Include standard headers
-#include <stdio.h>
-#include <stdlib.h>
-
-// Include GLEW
-#include <GL/glew.h>
-
-// Include GLFW
-#include <GLFW/glfw3.h>
-GLFWwindow* window;
-
-// Include GLM
-#include <glm/glm.hpp>
-#include <glm/gtc/matrix_transform.hpp>
-using namespace glm;
-
-#include "common/shader.hpp"
-#include "common/texture.hpp"
-#include "common/controls.hpp"
-
-int main( void ) {
-        // Initialise GLFW
-        if( !glfwInit() ) {
-                fprintf( stderr, "Failed to initialize GLFW\n" );
-                return -1;
-        }
-
-        #ifdef __APPLE__
-            glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
-            glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
-            glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
-            glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
-        #else
-            glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
-            glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
-        #endif
-
-        // Open a window and create its OpenGL context
-        window = glfwCreateWindow( 1024, 768, "Tutorial 0 - Keyboard and Mouse", NULL, NULL);
-        if( window == NULL ){
-                fprintf( stderr, "Failed to open GLFW window. If you have an Intel GPU, they are not 3.3 compatible. Try the 2.1 version of the tutorials.\n" );
-                glfwTerminate();
-                return -1;
-        }
-        glfwMakeContextCurrent(window);
-
-        // Initialize GLEW
-        glewExperimental = true; // Needed for core profile
-        if (glewInit() != GLEW_OK) {
-                fprintf(stderr, "Failed to initialize GLEW\n");
-                return -1;
-        }
-
-        // Ensure we can capture the escape key being pressed below
-        glfwSetInputMode(window, GLFW_STICKY_KEYS, GL_TRUE);
-        glfwSetCursorPos(window, 1024/2, 768/2);
-
-        // Dark blue background
-        glClearColor(0.0f, 0.0f, 0.4f, 0.0f);
-
-        // Enable depth test
-        glEnable(GL_DEPTH_TEST);
-        // Accept fragment if it closer to the camera than the former one
-        glDepthFunc(GL_LESS); 
-
-        // Cull triangles which normal is not towards the camera
-        glEnable(GL_CULL_FACE);
-
-        GLuint VertexArrayID;
-        glGenVertexArrays(1, &VertexArrayID);
-        glBindVertexArray(VertexArrayID);
-
-        // Create and compile our GLSL program from the shaders
-        GLuint programID = LoadShaders( "TransformVertexShader.vertexshader", "TextureFragmentShader.fragmentshader" );
-
-        // Get a handle for our "MVP" uniform
-        GLuint MatrixID = glGetUniformLocation(programID, "MVP");
-
-        // Load the texture
-        GLuint Texture = loadDDS("uvtemplate.DDS");
-        
-        // Get a handle for our "myTextureSampler" uniform
-        GLuint TextureID  = glGetUniformLocation(programID, "myTextureSampler");
-
-        // Our vertices. Tree consecutive floats give a 3D vertex; Three consecutive vertices give a triangle.
-        // A cube has 6 faces with 2 triangles each, so this makes 6*2=12 triangles, and 12*3 vertices
-        static const GLfloat g_vertex_buffer_data[] = { 
-                -1.0f,-1.0f,-1.0f,
-                -1.0f,-1.0f, 1.0f,
-                -1.0f, 1.0f, 1.0f,
-                 1.0f, 1.0f,-1.0f,
-                -1.0f,-1.0f,-1.0f,
-                -1.0f, 1.0f,-1.0f,
-                 1.0f,-1.0f, 1.0f,
-                -1.0f,-1.0f,-1.0f,
-                 1.0f,-1.0f,-1.0f,
-                 1.0f, 1.0f,-1.0f,
-                 1.0f,-1.0f,-1.0f,
-                -1.0f,-1.0f,-1.0f,
-                -1.0f,-1.0f,-1.0f,
-                -1.0f, 1.0f, 1.0f,
-                -1.0f, 1.0f,-1.0f,
-                 1.0f,-1.0f, 1.0f,
-                -1.0f,-1.0f, 1.0f,
-                -1.0f,-1.0f,-1.0f,
-                -1.0f, 1.0f, 1.0f,
-                -1.0f,-1.0f, 1.0f,
-                 1.0f,-1.0f, 1.0f,
-                 1.0f, 1.0f, 1.0f,
-                 1.0f,-1.0f,-1.0f,
-                 1.0f, 1.0f,-1.0f,
-                 1.0f,-1.0f,-1.0f,
-                 1.0f, 1.0f, 1.0f,
-                 1.0f,-1.0f, 1.0f,
-                 1.0f, 1.0f, 1.0f,
-                 1.0f, 1.0f,-1.0f,
-                -1.0f, 1.0f,-1.0f,
-                 1.0f, 1.0f, 1.0f,
-                -1.0f, 1.0f,-1.0f,
-                -1.0f, 1.0f, 1.0f,
-                 1.0f, 1.0f, 1.0f,
-                -1.0f, 1.0f, 1.0f,
-                 1.0f,-1.0f, 1.0f
-        };
-
-        // Two UV coordinatesfor each vertex. They were created withe Blender.
-        static const GLfloat g_uv_buffer_data[] = { 
-                0.000059f, 0.000004f, 
-                0.000103f, 0.336048f, 
-                0.335973f, 0.335903f, 
-                1.000023f, 0.000013f, 
-                0.667979f, 0.335851f, 
-                0.999958f, 0.336064f, 
-                0.667979f, 0.335851f, 
-                0.336024f, 0.671877f, 
-                0.667969f, 0.671889f, 
-                1.000023f, 0.000013f, 
-                0.668104f, 0.000013f, 
-                0.667979f, 0.335851f, 
-                0.000059f, 0.000004f, 
-                0.335973f, 0.335903f, 
-                0.336098f, 0.000071f, 
-                0.667979f, 0.335851f, 
-                0.335973f, 0.335903f, 
-                0.336024f, 0.671877f, 
-                1.000004f, 0.671847f, 
-                0.999958f, 0.336064f, 
-                0.667979f, 0.335851f, 
-                0.668104f, 0.000013f, 
-                0.335973f, 0.335903f, 
-                0.667979f, 0.335851f, 
-                0.335973f, 0.335903f, 
-                0.668104f, 0.000013f, 
-                0.336098f, 0.000071f, 
-                0.000103f, 0.336048f, 
-                0.000004f, 0.671870f, 
-                0.336024f, 0.671877f, 
-                0.000103f, 0.336048f, 
-                0.336024f, 0.671877f, 
-                0.335973f, 0.335903f, 
-                0.667969f, 0.671889f, 
-                1.000004f, 0.671847f, 
-                0.667979f, 0.335851f
-        };
-
-        GLuint vertexbuffer;
-        glGenBuffers(1, &vertexbuffer);
-        glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
-        glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_buffer_data), g_vertex_buffer_data, GL_STATIC_DRAW);
-
-        GLuint uvbuffer;
-        glGenBuffers(1, &uvbuffer);
-        glBindBuffer(GL_ARRAY_BUFFER, uvbuffer);
-        glBufferData(GL_ARRAY_BUFFER, sizeof(g_uv_buffer_data), g_uv_buffer_data, GL_STATIC_DRAW);
-
-        do{
-
-                // Clear the screen
-                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
-                // Use our shader
-                glUseProgram(programID);
-
-                // Compute the MVP matrix from keyboard and mouse input
-                computeMatricesFromInputs();
-                glm::mat4 ProjectionMatrix = getProjectionMatrix();
-                glm::mat4 ViewMatrix = getViewMatrix();
-                glm::mat4 ModelMatrix = glm::mat4(1.0);
-                glm::mat4 MVP = ProjectionMatrix * ViewMatrix * ModelMatrix;
-
-                // Send our transformation to the currently bound shader, 
-                // in the "MVP" uniform
-                glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &MVP[0][0]);
-
-                // Bind our texture in Texture Unit 0
-                glActiveTexture(GL_TEXTURE0);
-                glBindTexture(GL_TEXTURE_2D, Texture);
-                // Set our "myTextureSampler" sampler to user Texture Unit 0
-                glUniform1i(TextureID, 0);
-
-                // 1rst attribute buffer : vertices
-                glEnableVertexAttribArray(0);
-                glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
-                glVertexAttribPointer(
-                        0,                  // attribute. No particular reason for 0, but must match the layout in the shader.
-                        3,                  // size
-                        GL_FLOAT,           // type
-                        GL_FALSE,           // normalized?
-                        0,                  // stride
-                        (void*)0            // array buffer offset
-                );
-
-                // 2nd attribute buffer : UVs
-                glEnableVertexAttribArray(1);
-                glBindBuffer(GL_ARRAY_BUFFER, uvbuffer);
-                glVertexAttribPointer(
-                        1,                                // attribute. No particular reason for 1, but must match the layout in the shader.
-                        2,                                // size : U+V => 2
-                        GL_FLOAT,                         // type
-                        GL_FALSE,                         // normalized?
-                        0,                                // stride
-                        (void*)0                          // array buffer offset
-                );
-
-                // Draw the triangle !
-                glDrawArrays(GL_TRIANGLES, 0, 12*3); // 12*3 indices starting at 0 -> 12 triangles
-
-                glDisableVertexAttribArray(0);
-                glDisableVertexAttribArray(1);
-
-                // Swap buffers
-                glfwSwapBuffers(window);
-                glfwPollEvents();
-
-        } // Check if the ESC key was pressed or the window was closed
-        while( glfwGetKey(window, GLFW_KEY_ESCAPE ) != GLFW_PRESS &&
-                   glfwWindowShouldClose(window) == 0 );
-
-        // Cleanup VBO and shader
-        glDeleteBuffers(1, &vertexbuffer);
-        glDeleteBuffers(1, &uvbuffer);
-        glDeleteProgram(programID);
-        glDeleteTextures(1, &TextureID);
-        glDeleteVertexArrays(1, &VertexArrayID);
-
-        // Close OpenGL window and terminate GLFW
-        glfwTerminate();
-
-        return 0;
-}
Index: aphics_library/makefile
===================================================================
--- graphics_library/makefile	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,22 +1,0 @@
-OS = $(shell uname)
-CC = g++
-FLAGS = -Wall
-DEPENDENCIES = common/texture.o common/controls.o common/shader.o
-
-ifeq ($(OS),Darwin)
-	LIB_FLAGS = -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -lglfw3 -lglew
-endif
-ifeq ($(OS),Linux)
-	LIB_FLAGS = -lGL -lglut -lGLEW `pkg-config glfw3 --static --cflags --libs`
-endif
-
-graphics_engine : main.cpp $(DEPENDENCIES)
-	$(CC) -o $@ $+ $(FLAGS) $(LIB_FLAGS)
-
-%.o : %.cpp
-	$(CC) -c -o $@ $? $(FLAGS)
-
-clean:
-	rm -f *.o
-	rm -f common/*.o
-	rm -f graphics_engine
Index: adme.txt
===================================================================
--- readme.txt	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,34 +1,0 @@
-Building client on linux (tested in ubuntu)
-
-Build a static version of the allegro library
-http://ventilatorxor.wordpress.com/2011/08/07/linux-allegro5-static-linking-for-beginners/
-
-CLIENT
-______
-
-OSX:
-
-Install MacPorts from https://guide.macports.org/chunked/installing.macports.html
-
-To install allegro, do the following steps in a separate directory:
-
-sudo port selfupdate
-sudo port upgrade outdated
-sudo port install zlib freetype jpeg libogg physfs libpng flac libtheora +universal
-// Don't think I need libtheora, don't include +universal for Mojave or higher
-git clone https://github.com/liballeg/allegro5.git allegro
-cd allegro
-mkdir build
-cd build
-cmake -DSHARED=0 ..
-make
-sudo make install
-
-Now, go to network-game/client and run:
-make
-./gameClient medievaltech.com 8000
-
-SERVER
-______
-
-coming soon
Index: rver/DataAccess.cpp
===================================================================
--- server/DataAccess.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,320 +1,0 @@
-#include "DataAccess.h"
-
-#include <iostream>
-#include <sstream>
-#include <cstdlib>
-#include <crypt.h>
-
-#include "LuaLoader.h"
-
-using namespace std;
-
-DataAccess::DataAccess()
-{
-   LuaLoader luaLoader;
-
-   string database, username, password;
-
-   if (luaLoader.runScript("db_settings.lua")) {
-       cout << "Loading settings" << endl;
-
-       database = luaLoader.getValue("database");
-       username = luaLoader.getValue("username");
-       password = luaLoader.getValue("password");
-
-       cout << database << endl;
-       cout << username << endl;
-       cout << password << endl;
-   } else {
-       cout << "Failed to load settings from lua script" << endl;
-   }
-
-   mysql_init(&mysql);
-   connection = mysql_real_connect(&mysql, "localhost", username.c_str(), password.c_str(), database.c_str(), 0, 0, 0);
-
-   if (connection == NULL) {
-      cout << mysql_error(&mysql) << endl;
-   }else
-      cout << "Connection successful" << endl;
-}
-
-DataAccess::~DataAccess()
-{
-   mysql_close(connection);
-   mysql_close(&mysql);
-}
-
-int DataAccess::insertPlayer(string username, string password, Player::PlayerClass playerClass)
-{
-   ostringstream oss;
-
-   string salt = "$1$";
-   int random;
-   char chr;
-   for(int i=0; i<8; i++)
-   {
-      random = rand() % 62;
-      if (random < 26)
-         chr = (char)('a'+random);
-      else if (random < 52)
-         chr = (char)('A'+random-26);
-      else
-         chr = (char)('0'+random-52);
-      salt += chr;
-   }
-   salt += '$';
-
-   string encrypted(crypt(password.c_str(), salt.c_str()));
-
-   oss << "'" << username << "', '" << encrypted << "', " << playerClass;
-
-   return insert("users", "name, password, class", oss.str());
-}
-
-int DataAccess::updatePlayer(Player* p)
-{
-   ostringstream values, where;
-
-   values << "level=" << p->level << ", experience=" << p->experience << ", honor=" << p->honor << ", wins=" << p->wins << ", losses=" << p->losses << "";
-   
-   where << "id=" << p->getId() << "";
-
-   return update("users", values.str(), where.str());
-}
-
-Player *DataAccess::getPlayer(string username)
-{
-   MYSQL_RES *result;
-   MYSQL_ROW row;
-   Player *p;
-   ostringstream oss;
-
-   oss << "name='" << username << "'";
-
-   result = select("users", oss.str().c_str());
-
-   cout << "Got result" << endl;
-
-   if (result == NULL) {
-      cout << "Error occured" << endl;
-      cout << mysql_error(connection) << endl;
-      return NULL;
-   }
-
-   if ( ( row = mysql_fetch_row(result)) != NULL ) {
-      cout << "Creating a new player" << endl;
-      p = new Player(string(row[1]), string(row[2]));
-      p->setId(atoi(row[0]));
-      if (row[3] == NULL) {
-         p->setClass(Player::CLASS_NONE);
-         cout << "Class from db was NULL" << endl;
-      }else {
-         p->setClass((Player::PlayerClass)atoi(row[3]));
-         cout << "Class from db: " << atoi(row[3]) << endl;
-      }
-      p->level = atoi(row[4]);
-      p->experience = atoi(row[5]);
-      p->honor = atoi(row[6]);
-      p->wins = atoi(row[7]);
-      p->losses = atoi(row[8]);
-      cout << "Player class: " << p->playerClass << endl;
-      cout << "level: " << p->level << endl;
-      cout << "experience: " << p->experience << endl;
-      cout << "honor: " << p->honor << endl;
-      cout << "wins: " << p->wins << endl;
-      cout << "losses: " << p->losses << endl;
-      cout << "Loaded player from db" << endl;
-   }else {
-      cout << "Returned no results for some reason" << endl;
-      p = NULL;
-   }
-
-   mysql_free_result(result);
-
-   return p;
-}
-
-bool DataAccess::verifyPassword(string password, string encrypted)
-{
-   string test(crypt(password.c_str(), encrypted.c_str()));
-
-   return encrypted.compare(test) == 0;
-}
-
-int* DataAccess::getPlayerRecord(int playerId) {
-   MYSQL_RES *result;
-   MYSQL_ROW row;
-   ostringstream oss;
-   int* record = new int[5];
-
-   oss << "id=" << playerId;
-   result = select("users", oss.str());
-
-   if ( ( row = mysql_fetch_row(result)) != NULL ) {
-      cout << "Retrieved player record successfully" << endl;
-      record[0] = atoi(row[4]);   // level
-      record[1] = atoi(row[5]);   // experience
-      record[2] = atoi(row[6]);   // honor
-      record[3] = atoi(row[7]);   // wins
-      record[4] = atoi(row[8]);   // losses
-      cout << "record[0]:" << record[0] << endl;
-      cout << "record[1]:" << record[1] << endl;
-      cout << "record[2]:" << record[2] << endl;
-      cout << "record[3]:" << record[3] << endl;
-      cout << "record[4]:" << record[4] << endl;
-   }
-
-   if (result == NULL) {
-      cout << mysql_error(connection) << endl;
-      return NULL;
-   }
-
-   mysql_free_result(result);
-
-   return record;
-}
-
-int** DataAccess::getPlayerGameHistory(int playerId, unsigned int& numGames)
-{
-   // each array is the score for one game
-   // the columns are result, team, blue score, red score, and time the game ended
-   // for result 0 is defeat and 1 is victory
-   // for team, 1 is blue and 2 is red
-
-   MYSQL_RES *result;
-   MYSQL_ROW row;
-   ostringstream oss;
-
-   int** gameHistory;
-
-   oss << "user_id=" << playerId;
-   result = select("gameHistory", oss.str());
-
-   numGames = mysql_num_rows(result);
-   gameHistory = (int**)malloc(sizeof(int*)*numGames);
-   cout << "Result has " << numGames << " rows" << endl;
-
-   int i=0;
-   while ( ( row = mysql_fetch_row(result)) != NULL ) {
-      gameHistory[i] = new int[5];
-
-      int userTeam = atoi(row[2]);
-      int blueScore = atoi(row[3]);
-      int redScore = atoi(row[4]);
-      time_t timeFinished = atoi(row[5]);
-      int gameResult = -1;
-
-      if (blueScore == 3) {
-         if (userTeam == 1)
-            gameResult = 1;
-         else
-            gameResult = 0;
-      }else if (redScore == 3) {
-         if (userTeam == 2)
-            gameResult = 1;
-         else
-            gameResult = 0;
-      }else {
-         cout << "Recorded game has no team with 3 points" << endl;
-      }
-
-      gameHistory[i][0] = gameResult;
-      gameHistory[i][1] = userTeam;
-      gameHistory[i][2] = blueScore;
-      gameHistory[i][3] = redScore;
-      gameHistory[i][4] = timeFinished;
-
-      i++;
-   }
-
-   if (result == NULL) {
-      cout << mysql_error(connection) << endl;
-      return NULL;
-   }
-
-   mysql_free_result(result);
-
-   return gameHistory;
-}
-
-int DataAccess::saveGameHistory(int playerId, int team, int blueScore, int redScore, time_t timeFinished)
-{
-   ostringstream oss;
-
-   cout << "Saving game to db" << endl;
-   oss << playerId << ", " << team << ", " << blueScore << ", " << redScore << ", " << timeFinished;
-
-   return insert("gameHistory", "user_id, user_team, blue_score, red_score, time_finished", oss.str());
-}
-
-int DataAccess::insert(string table, string columns, string values)
-{
-   int query_state;
-   ostringstream oss;
-
-   if (connection == NULL) {
-       cout << "Error: non database connection exists" << endl;
-       return -1;
-   }
-
-   oss << "INSERT into " << table << " (" << columns << ") VALUES (" << values << ")";
-   cout << "query: " << oss.str() << endl;
-
-   query_state = mysql_query(connection, oss.str().c_str());
-
-   if (query_state != 0) {
-      cout << mysql_error(connection) << endl;
-      return -1;
-   }
-
-   return 0;
-}
-
-int DataAccess::update(string table, string values, string where)
-{
-   int query_state;
-   ostringstream oss;
-
-   if (connection == NULL) {
-       cout << "Error: no database connection exists" << endl;
-       return -1;
-   }
-
-   oss << "UPDATE " << table << " SET " << values << " WHERE " << where;
-   cout << "query: " << oss.str() << endl;
-
-   query_state = mysql_query(connection, oss.str().c_str());
-
-
-   if (query_state != 0) {
-      cout << mysql_error(connection) << endl;
-      return -1;
-   }
-
-   return 0;
-}
-
-MYSQL_RES *DataAccess::select(string table, string filter)
-{
-   int query_state;
-   ostringstream oss;
-
-   if (connection == NULL) {
-       cout << "Error: non database connection exists" << endl;
-       return NULL;
-   }
-
-   oss << "SELECT * FROM " << table;
-   if (!filter.empty())
-      oss << " WHERE " << filter;
-   cout << "executing select query: " << oss.str() << endl;
-
-   query_state = mysql_query(connection, oss.str().c_str());
-
-   if (query_state != 0) {
-      cout << mysql_error(connection) << endl;
-      return NULL;
-   }
-
-   return mysql_store_result(connection);
-}
Index: rver/DataAccess.h
===================================================================
--- server/DataAccess.h	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,35 +1,0 @@
-#ifndef _DATA_ACCESS_H
-#define _DATA_ACCESS_H
-
-#include <string>
-#include <list>
-
-#include <mysql/mysql.h>
-
-#include "../common/Player.h"
-
-using namespace std;
-
-class DataAccess {
-public:
-   DataAccess();
-   ~DataAccess();
-
-   Player* getPlayer(string username);
-   bool verifyPassword(string encrypted, string password);
-   int insertPlayer(string username, string password, Player::PlayerClass playerClass);
-   int updatePlayer(Player* player);
-
-   int* getPlayerRecord(int playerId);
-   int** getPlayerGameHistory(int playerId, unsigned int& numGames);
-   int saveGameHistory(int playerId, int team, int blueScore, int redScore, time_t timeFinished);
-
-   int insert(string table, string rows, string values);
-   int update(string table, string values, string where);
-   MYSQL_RES *select(string table, string filter);
-
-private:
-   MYSQL *connection, mysql;
-};
-
-#endif
Index: rver/LuaLoader.cpp
===================================================================
--- server/LuaLoader.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,56 +1,0 @@
-#include "LuaLoader.h"
-
-#include <iostream>
-
-using namespace std;
-
-LuaLoader::LuaLoader()
-{
-   // new Lua state
-   std::cout << "[C++] Starting Lua state" << std::endl;
-   this->lua_state = luaL_newstate();
-
-   // load Lua libraries
-   std::cout << "[C++] Loading Lua libraries" << std::endl;
-   static const luaL_Reg lualibs[] = 
-   {
-      {"base", luaopen_base},
-      {"io", luaopen_io},
-      {NULL, NULL}
-   };
-   const luaL_Reg *lib = lualibs;
-   for(; lib->func != NULL; lib++)
-   {
-      std::cout << " loading '" << lib->name << "'" << std::endl;
-      luaL_requiref(this->lua_state, lib->name, lib->func, 1);
-      lua_settop(this->lua_state, 0);
-   }
-}
-
-LuaLoader::~LuaLoader()
-{
-}
-
-bool LuaLoader::runScript(string filename)
-{
-   // load the script
-   int status = luaL_loadfile(this->lua_state, filename.c_str());
-   cout << " return: " << status << std::endl;
-
-   // run the script with the given arguments
-   cout << "[C++] Running script" << std::endl;
-   if (status == LUA_OK) {
-      lua_pcall(lua_state, 0, LUA_MULTRET, 0);
-      return true;
-   } else {
-      return false;
-   }
-}
-
-string LuaLoader::getValue(string key) 
-{
-   lua_getfield(lua_state, 1, key.c_str());
-   string str(luaL_checkstring(lua_state, -1));
-
-   return str;
-}
Index: rver/LuaLoader.h
===================================================================
--- server/LuaLoader.h	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,26 +1,0 @@
-#ifndef _LUA_LOADER_H
-#define _LUA_LOADER_H
-
-#include <string>
-
-extern "C" {
-    #include <lua5.2/lua.h>
-    #include <lua5.2/lualib.h>
-    #include <lua5.2/lauxlib.h>
-}
-
-using namespace std;
-
-class LuaLoader {
-public:
-   LuaLoader();
-   ~LuaLoader();
-
-   bool runScript(string filename);
-   string getValue(string key);
-
-private:
-   lua_State* lua_state;
-};
-
-#endif
Index: server/crypt.cpp
===================================================================
--- server/crypt.cpp	(revision e3535b35b0bebb716c77217284737cf54823b512)
+++ server/crypt.cpp	(revision e3535b35b0bebb716c77217284737cf54823b512)
@@ -0,0 +1,19 @@
+#include "crypt.h"
+
+Crypt::Crypt()
+{
+}
+
+Crypt::~Crypt()
+{
+}
+
+string Crypt::encrypt(string s)
+{
+	return s + " encrypted";
+}
+
+string Crypt::decrypt(string s)
+{
+	return s.substr(0, s.length()-10);
+}
Index: server/crypt.h
===================================================================
--- server/crypt.h	(revision e3535b35b0bebb716c77217284737cf54823b512)
+++ server/crypt.h	(revision e3535b35b0bebb716c77217284737cf54823b512)
@@ -0,0 +1,13 @@
+#include <string>
+
+using namespace std;
+
+class Crypt
+{
+public:
+	Crypt();
+	~Crypt();
+
+	string encrypt(string);
+	string decrypt(string);
+};
Index: server/database.cpp
===================================================================
--- server/database.cpp	(revision e3535b35b0bebb716c77217284737cf54823b512)
+++ server/database.cpp	(revision e3535b35b0bebb716c77217284737cf54823b512)
@@ -0,0 +1,44 @@
+#include "database.h"
+
+#include <string>
+#include <mysql/mysql.h> 
+
+using namespace std;
+
+Database::Database(string host, string username, string password, string database)
+{
+	mysql_init(&(this->mysql));
+
+        this->conn = mysql_real_connect(&(this->mysql),
+		host.c_str(), username.c_str(), password.c_str(), database.c_str(),
+		0, 0, 0);
+
+        if (this->conn == NULL) {
+		// throw an error
+        }
+}
+
+Database::~Database()
+{
+        mysql_close(conn);
+}
+
+void Database::createUser(string username, string password)
+{
+        MYSQL_RES *result;
+        MYSQL_ROW row;
+        int query_state;
+
+        query_state = mysql_query(conn, (string()+"INSERT INTO users VALUES ("+username+","+password+")").c_str());
+
+        if (query_state !=0) {
+		// throw an error
+        }
+
+        mysql_free_result(result);
+}
+
+string Database::getPassword(string username)
+{
+	return "defaultPassword";
+}
Index: server/database.h
===================================================================
--- server/database.h	(revision e3535b35b0bebb716c77217284737cf54823b512)
+++ server/database.h	(revision e3535b35b0bebb716c77217284737cf54823b512)
@@ -0,0 +1,19 @@
+#include <string>
+
+#include <mysql/mysql.h>
+
+using namespace std;
+
+class Database
+{
+private:
+	MYSQL mysql, *conn;
+
+public:
+        Database(string host, string username, string password, string database);
+        ~Database();
+
+        void createUser(string username, string password);
+
+        string getPassword(string username);
+};
Index: rver/db_settings.lua
===================================================================
--- server/db_settings.lua	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,5 +1,0 @@
-return {
-    database = 'pythondb',
-    username = 'pythonAdmin',
-    password = 'pyMaster09*'
-}
Index: rver/dbmod.txt
===================================================================
--- server/dbmod.txt	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ 	(revision )
@@ -1,31 +1,0 @@
-SQL statements for creating the db tables are stored here
-
-CREATE TABLE users (
-   id INT NOT NULL AUTO_INCREMENT,
-   name varchar(64) NOT NULL,
-   password binary(60) NOT NULL,
-   class INT unsigned DEFAULT NULL,
-   level INT unsigned NOT NULL DEFAULT 0,
-   experience INT unsigned NOT NULL DEFAULT 0,
-   honor INT unsigned NOT NULL DEFAULT 0,
-   wins INT unsigned NOT NULL DEFAULT 0,
-   losses INT unsigned NOT NULL DEFAULT 0,
-   PRIMARY KEY (id),
-   UNIQUE KEY name (name)
-);
-
-
-CREATE TABLE gameHistory (
-   id INT NOT NULL AUTO_INCREMENT,
-   user_id INT NOT NULL,
-   user_team INT NOT NULL,
-   blue_score INT NOT NULL,
-   red_score INT NOT NULL,
-   time_finished INT unsigned NOT NULL,
-   PRIMARY KEY (id),
-   CONSTRAINT fk_users FOREIGN KEY
-   fk_users (user_id)
-   REFERENCES users (id)
-   ON DELETE CASCADE
-   ON UPDATE CASCADE
-);
Index: server/makefile
===================================================================
--- server/makefile	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ server/makefile	(revision e3535b35b0bebb716c77217284737cf54823b512)
@@ -1,40 +1,2 @@
-CC = g++
-#LIB_FLAGS = -lssl -lmysqlclient -lcrypt -lrt
-LIB_FLAGS = -lmysqlclient -lcrypt -lrt -llua5.2
-FLAGS = -Wall -g
-COMMON_PATH = ../common
-DEPENDENCIES = Common.o MessageContainer.o MessageProcessor.o Player.o WorldMap.o DataAccess.o Projectile.o Game.o GameSummary.o LuaLoader.o
-
-server : server.cpp $(DEPENDENCIES)
-	$(CC) -o $@ $+ $(FLAGS) $(LIB_FLAGS)
-
-Common.o : $(COMMON_PATH)/Common.cpp
-	$(CC) -c -o $@ $? $(FLAGS)
-
-MessageContainer.o : $(COMMON_PATH)/MessageContainer.cpp
-	$(CC) -c -o $@ $? $(FLAGS)
-
-MessageProcessor.o : $(COMMON_PATH)/MessageProcessor.cpp
-	$(CC) -c -o $@ $? $(FLAGS)
-
-Player.o : $(COMMON_PATH)/Player.cpp
-	$(CC) -c -o $@ $? $(FLAGS)
-
-WorldMap.o : $(COMMON_PATH)/WorldMap.cpp
-	$(CC) -c -o $@ $? $(FLAGS)
-
-Projectile.o : $(COMMON_PATH)/Projectile.cpp
-	$(CC) -c -o $@ $? $(FLAGS)
-
-Game.o : $(COMMON_PATH)/Game.cpp
-	$(CC) -c -o $@ $? $(FLAGS)
-
-GameSummary.o : $(COMMON_PATH)/GameSummary.cpp
-	$(CC) -c -o $@ $? $(FLAGS)
-
-%.o : %.cpp
-	$(CC) -c -o $@ $? $(FLAGS)
-
-clean:
-	rm *.o
-	rm server
+server : server.cpp
+	g++ -o $@ $? -lssl -lmysqlclient
Index: server/server.cpp
===================================================================
--- server/server.cpp	(revision 7f9b01ca0fca10bc864d0eb0784087a4c30c58c4)
+++ server/server.cpp	(revision e3535b35b0bebb716c77217284737cf54823b512)
@@ -1,1139 +1,100 @@
-#include <cstdlib>
-#include <cstdio>
+#include <sys/types.h>
+#include <stdlib.h>
 #include <unistd.h>
-#include <string>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <string.h>
+#include <netdb.h>
+#include <stdio.h>
 #include <iostream>
-#include <sstream>
-#include <fstream>
-#include <cstring>
 
-#include <vector>
-#include <map>
+#include <mysql/mysql.h>
 
-#include <csignal>
-
-#include <sys/time.h>
-
-#include <sys/socket.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <crypt.h>
-
-/*
 #include <openssl/bio.h>
 #include <openssl/ssl.h>
 #include <openssl/err.h>
-*/
-
-#include "../common/Compiler.h"
-#include "../common/Common.h"
-#include "../common/MessageProcessor.h"
-#include "../common/WorldMap.h"
-#include "../common/Player.h"
-#include "../common/Projectile.h"
-#include "../common/Game.h"
-#include "../common/GameSummary.h"
-
-#include "DataAccess.h"
 
 using namespace std;
 
-// from used to be const. Removed that so I could take a reference
-// and use it to send messages
-void processMessage(const NETWORK_MSG& clientMsg, struct sockaddr_in& from, MessageProcessor& msgProcessor, map<unsigned int, Player*>& mapPlayers, map<string, Game*>& mapGames, DataAccess& da, ofstream& outputLog);
-
-Player *findPlayerByName(map<unsigned int, Player*> &m, string name);
-Player *findPlayerByAddr(map<unsigned int, Player*> &m, const sockaddr_in &addr);
-
-bool handleGameEvents(Game* game, MessageProcessor* msgProcessor, DataAccess* da);
-bool handlePlayerEvents(Game* game, Player* p, MessageProcessor* msgProcessor, DataAccess* da);
-
-void quit(int sig);
-
-bool done;
+void error(const char *msg)
+{
+    perror(msg);
+    exit(0);
+}
 
 int main(int argc, char *argv[])
 {
-   int sock, length;
+   int sock, length, n;
+   socklen_t fromlen;
    struct sockaddr_in server;
-   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;
-   map<string, Game*> mapGames;
-   DataAccess da;
-   ofstream outputLog;
+   struct sockaddr_in from;
+   char buf[1024];
 
-   done = false;
+   SSL_load_error_strings();
+   ERR_load_BIO_strings();
+   OpenSSL_add_all_algorithms();
 
-   signal(SIGINT, quit);
-
-   //SSL_load_error_strings();
-   //ERR_load_BIO_strings();
-   //OpenSSL_add_all_algorithms();
-
-   if (argc != 2)
-   {
-      cerr << "ERROR, expected server [domain] [port]" << endl;
-      exit(1);
+   if (argc < 2) {
+      fprintf(stderr, "ERROR, no port provided\n");
+      exit(0);
    }
-
-   outputLog.open("server.log", ios::app);
-   outputLog << "Started server on " << getCurrentDateTimeString() << endl;
-
-   sock = socket(AF_INET, SOCK_DGRAM, 0);
-   if (sock < 0)
-      error("Opening socket");
+   
+   sock=socket(AF_INET, SOCK_DGRAM, 0);
+   if (sock < 0) error("Opening socket");
    length = sizeof(server);
    bzero(&server,length);
    server.sin_family=AF_INET;
+   server.sin_addr.s_addr=INADDR_ANY;
    server.sin_port=htons(atoi(argv[1]));
-   server.sin_addr.s_addr=INADDR_ANY;
-   if ( bind(sock, (struct sockaddr *)&server, length) < 0 ) 
-      error("binding");
-
-   set_nonblock(sock);
-
-   msgProcessor = MessageProcessor(sock, &outputLog);
-
-   timespec ts;
-   int timeLastUpdated = 0, curTime = 0;
-   while (!done)
-   {
-      usleep(5000);
-
-      clock_gettime(CLOCK_REALTIME, &ts);
-      // make the number smaller so millis can fit in an int
-      ts.tv_sec -= 1368000000;
-      curTime = ts.tv_sec*1000 + ts.tv_nsec/1000000;
-
-      if (timeLastUpdated == 0 || (curTime-timeLastUpdated) >= 50)
-      {
-         timeLastUpdated = curTime;
-
-         msgProcessor.cleanAckedMessages();
-         msgProcessor.resendUnackedMessages();
-
-         map<unsigned int, Player*>::iterator it;
-
-         // set targets for all chasing players (or make them attack if they're close enough)
-         // this should be moved into the games loop
-         for (it = mapPlayers.begin(); it != mapPlayers.end(); it++)
-         {
-            Player* p = it->second;
-
-            // check if it's time to revive dead players
-            if (p->isDead)
-            {
-               cout << "Player is dead" << endl;
-
-               if (getCurrentMillis() - p->timeDied >= 10000)
-               {
-                  p->isDead = false;
-
-                  POSITION spawnPos;
- 
-                  switch (p->team)
-                  {
-                  case Player::TEAM_BLUE:
-                     spawnPos = p->currentGame->getMap()->getStructureLocation(STRUCTURE_BLUE_FLAG);
-                     break;
-                  case Player::TEAM_RED:
-                     spawnPos = p->currentGame->getMap()->getStructureLocation(STRUCTURE_RED_FLAG);
-                     break;
-                  default:
-                     // should never go here
-                     cout << "Error: Invalid team" << endl;
-                     break;
-                  }
-
-                  // spawn the player to the right of their flag location
-                  spawnPos.x = (spawnPos.x+1) * 25 + 12;
-                  spawnPos.y = spawnPos.y * 25 + 12;
-
-                  p->pos = spawnPos.toFloat();
-                  p->target = spawnPos;
-                  p->health = p->maxHealth;
-
-                  serverMsg.type = MSG_TYPE_PLAYER;
-                  p->serialize(serverMsg.buffer);
-
-                  msgProcessor.broadcastMessage(serverMsg, p->currentGame->getPlayers());
-               }
-
-               continue;
-            }
-
-            if (p->currentGame != NULL) {
-               map<unsigned int, Player*> playersInGame = p->currentGame->getPlayers();
-               if (p->updateTarget(playersInGame))
-               {
-                  serverMsg.type = MSG_TYPE_PLAYER;
-                  p->serialize(serverMsg.buffer);
-                  msgProcessor.broadcastMessage(serverMsg, playersInGame);
-               }
-            }
-         }
-
-         // process players currently in a game
-         map<string, Game*>::iterator itGames;
-         Game* game = NULL;
-
-         for (itGames = mapGames.begin(); itGames != mapGames.end();) { 
-            game = itGames->second;
-            bool gameFinished = handleGameEvents(game, &msgProcessor, &da);
-
-            if (gameFinished) {
-               // save game record
-               int winningTeam = -1;
-               if (game->getBlueScore() == 3)
-                  winningTeam = 1;
-               else if (game->getRedScore() == 3)
-                  winningTeam = 2;
-
-               if (winningTeam == -1)
-                  cout << "Error: Game ended, but neither team has a score of 3" << endl;
-               else {
-                  map<unsigned int, Player*>::iterator it;
-
-                  time_t timeFinished = time(NULL);
-                  for (it = game->getPlayers().begin(); it != game->getPlayers().end(); it++) {
-                      Player* p = it->second;
-                      cout << "winning team: " << winningTeam << endl;
-                      cout << "player team: " << p->team << endl;
-                      cout << "player id: " << p->getId() << endl;
-                      
-                      if (winningTeam == p->team)
-                          p->wins++;
-                      else
-                          p->losses++;
-                      da.updatePlayer(p);
-                      da.saveGameHistory(p->getId(), winningTeam, game->getBlueScore(), game->getRedScore(), timeFinished);
-                  }
-               }
-
-               // send a GAME_INFO message with 0 players to force clients to delete the game
-               int numPlayers = 0;
-               serverMsg.type = MSG_TYPE_GAME_INFO;
-               memcpy(serverMsg.buffer, &numPlayers, 4);
-               strcpy(serverMsg.buffer+4, game->getName().c_str());
-
-               // only send this to players in the game
-               msgProcessor.broadcastMessage(serverMsg, game->getPlayers());
-
-               delete itGames->second;
-               mapGames.erase(itGames++);
-            }else
-               itGames++;
-         }
-
-         // move all projectiles
-         // see if this can be moved inside the game class
-         // this method can be moved when I add a MessageProcessor to the Game class
-         map<unsigned int, Projectile>::iterator itProj;
-         for (itGames = mapGames.begin(); itGames != mapGames.end(); itGames++) { 
-            game = itGames->second;
-            for (itProj = game->getProjectiles().begin(); itProj != game->getProjectiles().end(); itProj++)
-            {
-               cout << "About to call projectile move" << endl;
-               if (itProj->second.move(game->getPlayers()))
-               {
-                  // send a REMOVE_PROJECTILE message
-                  cout << "send a REMOVE_PROJECTILE message" << endl;
-                  serverMsg.type = MSG_TYPE_REMOVE_PROJECTILE;
-                  memcpy(serverMsg.buffer, &itProj->second.id, 4);
-                  game->removeProjectile(itProj->second.id);
-                  msgProcessor.broadcastMessage(serverMsg, game->getPlayers());
-
-                  Player* target = game->getPlayers()[itProj->second.target];
-                  game->dealDamageToPlayer(target, itProj->second.damage);
-               }
-            }
-         }
-      }
-
-      if (msgProcessor.receiveMessage(&clientMsg, &from) >= 0)
-      {
-         processMessage(clientMsg, from, msgProcessor, mapPlayers, mapGames, da, outputLog);
-
-         cout << "Finished processing the message" << endl;
-      }
+   if (bind(sock,(struct sockaddr *)&server,length)<0) 
+       error("binding");
+   fromlen = sizeof(struct sockaddr_in);
+   while (1) {
+       n = recvfrom(sock,buf,1024,0,(struct sockaddr *)&from,&fromlen);
+       if (n < 0) error("recvfrom");
+       write(1,"Received a datagram: ",21);
+       write(1,buf,n);
+       n = sendto(sock,"Got your message\n",17,
+                  0,(struct sockaddr *)&from,fromlen);
+       if (n  < 0) error("sendto");
    }
-
-   outputLog << "Stopped server on " << getCurrentDateTimeString() << endl;
-   outputLog.close();
-
-   // delete all games
-   map<string, Game*>::iterator itGames;
-   for (itGames = mapGames.begin(); itGames != mapGames.end(); itGames++)
-   {
-      delete itGames->second;
-   }
-
-   map<unsigned int, Player*>::iterator itPlayers;
-   for (itPlayers = mapPlayers.begin(); itPlayers != mapPlayers.end(); itPlayers++)
-   {
-      delete itPlayers->second;
-   }
-
    return 0;
 }
 
-void processMessage(const NETWORK_MSG &clientMsg, struct sockaddr_in &from, MessageProcessor &msgProcessor, map<unsigned int, Player*>& mapPlayers, map<string, Game*>& mapGames, DataAccess& da, ofstream& outputLog)
+int dbtest()
 {
-   NETWORK_MSG serverMsg;
+	MYSQL *connection, mysql;
+	MYSQL_RES *result;
+	MYSQL_ROW row;
+	int query_state;
 
-   cout << "Inside processMessage" << endl;
+	mysql_init(&mysql);
 
-   cout << "Received message" << endl;
-   cout << "MSG: type: " << clientMsg.type << endl;
-   cout << "MSG contents: " << clientMsg.buffer << endl;
+	connection = mysql_real_connect(&mysql,"localhost","pythonAdmin","pyMaster09*","pythondb",0,0,0);
 
-   // Check that if an invalid message is sent, the client will correctly
-   // receive and display the response. Maybe make a special error msg type
-   switch(clientMsg.type)
-   {
-      case MSG_TYPE_REGISTER:
-      {
-         string username(clientMsg.buffer);
-         string password(strchr(clientMsg.buffer, '\0')+1);
-         Player::PlayerClass playerClass;
+	if (connection == NULL) {
+		cout << mysql_error(&mysql) << endl;
+		return 1;
+	}else
+		cout << "Connection successful" << endl;
 
-         memcpy(&playerClass, clientMsg.buffer+username.length()+password.length()+2, 4);
+	query_state = mysql_query(connection, "SELECT * FROM users");
 
-         cout << "username: " << username << endl;
-         cout << "password: " << password << endl;
+	if (query_state !=0) {
+		cout << mysql_error(connection) << endl;
+		return 1;
+	}
 
-         bool validClass = false;
+	result = mysql_store_result(connection);
 
-         switch(playerClass) {
-            case Player::CLASS_WARRIOR:
-            case Player::CLASS_RANGER:
-               validClass = true;
-               break;
-            case Player::CLASS_NONE:
-               validClass = false;
-               break;
-         }
+	while ( ( row = mysql_fetch_row(result)) != NULL ) {
+		cout << row[0] << ", " << row[1] << ", " << row[2] << endl;
+	}
 
-         serverMsg.type = MSG_TYPE_REGISTER;
+	mysql_free_result(result);
+	mysql_close(connection);
 
-         if (validClass) {
-            int error = da.insertPlayer(username, password, playerClass);
+	cout << "Test finished" << endl;
 
-            if (error)
-               strcpy(serverMsg.buffer, "Registration failed. Please try again.");
-            else
-               strcpy(serverMsg.buffer, "Registration successful.");
-         }else
-            strcpy(serverMsg.buffer, "You didn't select a class");
-
-         msgProcessor.sendMessage(&serverMsg, &from);
-
-         break;
-      }
-      case MSG_TYPE_LOGIN:
-      {
-         cout << "Got login message" << endl;
-
-         string username(clientMsg.buffer);
-         string password(strchr(clientMsg.buffer, '\0')+1);
-
-         Player* p = da.getPlayer(username);
-
-         if (p == NULL || !da.verifyPassword(password, p->password))
-         {
-            strcpy(serverMsg.buffer, "Incorrect username or password");
-            if (p != NULL)
-               delete(p);
-         }
-         else if(findPlayerByName(mapPlayers, username) != NULL)
-         {
-            strcpy(serverMsg.buffer, "Player has already logged in.");
-            delete(p);
-         }
-         else
-         {
-            cout << "new player id: " << p->getId() << endl;
-            p->setAddr(from);
-
-            serverMsg.type = MSG_TYPE_PLAYER;
-            // tell the new player about all the existing players
-            cout << "Sending other players to new player" << endl;
-
-            map<unsigned int, Player*>::iterator it;
-            for (it = mapPlayers.begin(); it != mapPlayers.end(); it++)
-            {
-               it->second->serialize(serverMsg.buffer);
-
-               cout << "sending info about " << it->second->name  << endl;
-               cout << "sending id " << it->second->getId()  << endl;
-               msgProcessor.sendMessage(&serverMsg, &from);
-            }
-
-            // send info about existing games to new player
-            map<string, Game*>::iterator itGames;
-            Game* g;
-            int numPlayers;
-            serverMsg.type = MSG_TYPE_GAME_INFO;
-
-            for (itGames = mapGames.begin(); itGames != mapGames.end(); itGames++)
-            {
-               g = itGames->second;
-               numPlayers = g->getNumPlayers();
-               memcpy(serverMsg.buffer, &numPlayers, 4);
-               strcpy(serverMsg.buffer+4, g->getName().c_str());
-               msgProcessor.sendMessage(&serverMsg, &from);
-            }
-
-            serverMsg.type = MSG_TYPE_PLAYER;
-            p->serialize(serverMsg.buffer);
-            msgProcessor.broadcastMessage(serverMsg, mapPlayers);
-
-            mapPlayers[p->getId()] = p;
-         }
-
-         serverMsg.type = MSG_TYPE_LOGIN;
-         msgProcessor.sendMessage(&serverMsg, &from);
-
-         break;
-      }
-      case MSG_TYPE_LOGOUT:
-      {
-         string name(clientMsg.buffer);
-         cout << "Player logging out: " << name << endl;
-
-         Player *p = findPlayerByName(mapPlayers, name);
-
-         if (p == NULL)
-         {
-            strcpy(serverMsg.buffer+4, "That player is not logged in. This is either a bug, or you're trying to hack the server.");
-            cout << "Player not logged in" << endl;
-         }
-         else if ( p->addr.sin_addr.s_addr != from.sin_addr.s_addr ||
-                   p->addr.sin_port != from.sin_port )
-         {
-            strcpy(serverMsg.buffer+4, "That player is logged in using a differemt connection. This is either a bug, or you're trying to hack the server.");
-            cout << "Player logged in using a different connection" << endl;
-         }
-         else
-         {
-            // broadcast to all players before deleting p from the map
-            unsigned int playerId = p->getId();
-            serverMsg.type = MSG_TYPE_LOGOUT;
-            memcpy(serverMsg.buffer, &playerId, 4);
-
-            msgProcessor.broadcastMessage(serverMsg, mapPlayers);
-
-            mapPlayers.erase(p->getId());
-            delete p;
-
-            strcpy(serverMsg.buffer+4, "You have successfully logged out.");
-         }
-
-         serverMsg.type = MSG_TYPE_LOGOUT;
-         msgProcessor.sendMessage(&serverMsg, &from);
-
-         break;
-      }
-      case MSG_TYPE_CHAT:
-      {
-         cout << "Got a chat message" << endl;
-
-         serverMsg.type = MSG_TYPE_CHAT;
-
-         Player *p = findPlayerByAddr(mapPlayers, from);
-
-         if (p == NULL)
-         {
-            strcpy(serverMsg.buffer, "No player is logged in using this connection. This is either a bug, or you're trying to hack the server.");
-            msgProcessor.sendMessage(&serverMsg, &from);
-         }
-         else
-         {
-            ostringstream oss;
-            oss << p->name << ": " << clientMsg.buffer;
-
-            strcpy(serverMsg.buffer, oss.str().c_str());
-            msgProcessor.broadcastMessage(serverMsg, mapPlayers);
-         }	
-
-         break;
-      }
-      case MSG_TYPE_PLAYER_MOVE:
-      {
-         cout << "PLAYER_MOVE" << endl;
-
-         unsigned int id;
-         int x, y;
-
-         memcpy(&id, clientMsg.buffer, 4);
-         memcpy(&x, clientMsg.buffer+4, 4);
-         memcpy(&y, clientMsg.buffer+8, 4);
-
-         cout << "x: " << x << endl;
-         cout << "y: " << y << endl;
-         cout << "id: " << id << endl;
-         
-         Player* p = mapPlayers[id];
-         bool validMessage = false;
-
-         if ( p->addr.sin_addr.s_addr == from.sin_addr.s_addr &&
-              p->addr.sin_port == from.sin_port )
-         {
-            if (p->currentGame->startPlayerMovement(id, x, y)) {
-               serverMsg.type = MSG_TYPE_PLAYER_MOVE;
-               
-               memcpy(serverMsg.buffer, &id, 4);
-               memcpy(serverMsg.buffer+4, &p->target.x, 4);
-               memcpy(serverMsg.buffer+8, &p->target.y, 4);
-
-               msgProcessor.broadcastMessage(serverMsg, mapPlayers);
-
-               validMessage = true;
-            }
-            else
-               cout << "Bad terrain detected" << endl;
-         }
-         else
-            cout << "Player id (" << id << ") doesn't match sender" << endl;
-
-         if (!validMessage)
-            msgProcessor.sendMessage(&serverMsg, &from);
-
-         break;
-      }
-      case MSG_TYPE_PICKUP_FLAG:
-      { 
-         // may want to check the id matches the sender, just like for PLAYER_NOVE
-         cout << "PICKUP_FLAG" << endl;
-
-         unsigned int id;
-
-         memcpy(&id, clientMsg.buffer, 4);
-         cout << "id: " << id << endl;
-
-         Player* p = mapPlayers[id];
-         unsigned int objectId = p->currentGame->processFlagPickupRequest(p);
-
-         if (objectId >= 0) {
-            map<unsigned int, Player*> players = p->currentGame->getPlayers();
-
-            serverMsg.type = MSG_TYPE_REMOVE_OBJECT;
-            memcpy(serverMsg.buffer, &objectId, 4);
-            msgProcessor.broadcastMessage(serverMsg, players);
-
-            serverMsg.type = MSG_TYPE_PLAYER;
-            p->serialize(serverMsg.buffer);
-            msgProcessor.broadcastMessage(serverMsg, players);
-         }
-
-         break;
-      }
-      case MSG_TYPE_DROP_FLAG:
-      {
-         // may want to check the id matches the sender, just like for PLAYER_NOVE
-         cout << "DROP_FLAG" << endl;
-
-         unsigned int id;
-
-         memcpy(&id, clientMsg.buffer, 4);
-         cout << "id: " << id << endl;
-
-         Player* p = mapPlayers[id];
-
-         ObjectType flagType = OBJECT_NONE;
-         if (p->hasBlueFlag)
-            flagType = OBJECT_BLUE_FLAG;
-         else if (p->hasRedFlag)
-            flagType = OBJECT_RED_FLAG;
-
-         map<unsigned int, Player*> players = p->currentGame->getPlayers();
-
-         p->currentGame->addObjectToMap(flagType, p->pos.x, p->pos.y);
-
-         p->hasBlueFlag = false;
-         p->hasRedFlag = false;
-
-         serverMsg.type = MSG_TYPE_PLAYER;
-         p->serialize(serverMsg.buffer);
-         msgProcessor.broadcastMessage(serverMsg, players);
-
-         break;
-      }
-      case MSG_TYPE_ATTACK:
-      {
-         cout << "Received a START_ATTACK message" << endl;
-
-         unsigned int id, targetId;
-
-         memcpy(&id, clientMsg.buffer, 4);
-         memcpy(&targetId, clientMsg.buffer+4, 4);
-
-         // need to make sure the target is in the sender's game
-
-         Player* p = mapPlayers[id];
-         p->setTargetPlayer(targetId);
-         p->isChasing = true;
-
-         map<unsigned int, Player*> players = p->currentGame->getPlayers();
-
-         serverMsg.type = MSG_TYPE_ATTACK;
-         memcpy(serverMsg.buffer, &id, 4);
-         memcpy(serverMsg.buffer+4, &targetId, 4);
-         msgProcessor.broadcastMessage(serverMsg, players);
-
-         break;
-      }
-      case MSG_TYPE_PROFILE:
-      {
-         cout << "Received a PROFILE message" << endl;
-
-         unsigned int id;
-
-         memcpy(&id, clientMsg.buffer, 4);
-
-         cout << "Player id: " << id << endl;
-         unsigned int numGames = 0;
-         int** gameHistory = da.getPlayerGameHistory(id, numGames);
-         int* playerRecord = da.getPlayerRecord(id);
-
-         // playerRecord[0] is level
-         // playerRecord[1] is experience
-         int honorPoints = playerRecord[2];
-         int wins = playerRecord[3];
-         int losses = playerRecord[4];
-
-         serverMsg.type = MSG_TYPE_PROFILE;
-
-         memcpy(serverMsg.buffer, &honorPoints, 4);
-         memcpy(serverMsg.buffer+4, &wins, 4);
-         memcpy(serverMsg.buffer+8, &losses, 4);
-         memcpy(serverMsg.buffer+12, &numGames, 4);
-         for (unsigned int i=0; i<numGames; i++) {
-            memcpy(serverMsg.buffer+16+i*20, &gameHistory[i][0], 4);
-            memcpy(serverMsg.buffer+20+i*20, &gameHistory[i][1], 4);
-            memcpy(serverMsg.buffer+24+i*20, &gameHistory[i][2], 4);
-            memcpy(serverMsg.buffer+28+i*20, &gameHistory[i][3], 4);
-            memcpy(serverMsg.buffer+32+i*20, &gameHistory[i][4], 4);
-            delete[] gameHistory[i];
-         }
-
-         //delete[] gameHistory;
-         free(gameHistory);
-         delete[] playerRecord;
-
-         msgProcessor.sendMessage(&serverMsg, &from);
-
-         break;
-      }
-      case MSG_TYPE_CREATE_GAME:
-      {
-         cout << "Received a CREATE_GAME message" << endl;
-
-         string gameName(clientMsg.buffer);
-         cout << "Game name: " << gameName << endl;
-
-         // check if this game already exists
-         if (mapGames.find(gameName) != mapGames.end()) {
-            cout << "Error: Game already exists" << endl;
-            serverMsg.type = MSG_TYPE_CREATE_GAME_FAILURE;
-         }else {
-            Game* g = new Game(gameName, "../data/map.txt", &msgProcessor);
-            mapGames[gameName] = g;
-
-            // add flag objects to the map
-            WorldMap* m = g->getMap();
-            m->createObjectsFromStructures();
-
-            serverMsg.type = MSG_TYPE_JOIN_GAME_SUCCESS;
-            strcpy(serverMsg.buffer, gameName.c_str());
-         }
-
-         msgProcessor.sendMessage(&serverMsg, &from);
-
-         break;
-      }
-      case MSG_TYPE_JOIN_GAME:
-      {
-         cout << "Received a JOIN_GAME message" << endl;
-
-         string gameName(clientMsg.buffer);
-         cout << "Game name: " << gameName << endl;
-
-         // check if this game already exists
-         if (mapGames.find(gameName) == mapGames.end()) {
-            cout << "Error: Game does not exist" << endl;
-            serverMsg.type = MSG_TYPE_JOIN_GAME_FAILURE;
-         }else {
-            Game* g = mapGames[gameName];
-            map<unsigned int, Player*>& players = g->getPlayers();
-            Player* p = findPlayerByAddr(mapPlayers, from);
-
-            if (players.find(p->getId()) != players.end()) {
-               cout << "Player " << p->name << " trying to join a game he's already in" << endl;
-               serverMsg.type = MSG_TYPE_JOIN_GAME_FAILURE;
-            }else {
-               serverMsg.type = MSG_TYPE_JOIN_GAME_SUCCESS;
-               strcpy(serverMsg.buffer, gameName.c_str());
-            }
-         }
-
-         msgProcessor.sendMessage(&serverMsg, &from);
-
-         break;
-      }
-      case MSG_TYPE_LEAVE_GAME:
-      {
-         cout << "Received a LEAVE_GAME message" << endl;
-
-         Player* p = findPlayerByAddr(mapPlayers, from);
-         Game* g = p->currentGame;
-
-         if (g == NULL) {
-            cout << "Player " << p->name << " is trying to leave a game, but is not currently in a game." << endl;
-
-            /// should send a response back, maybe a new message type is needed
-            // not sure what to do here
-         }else {
-            cout << "Game name: " << g->getName() << endl;
-
-            if (!p->isDead) {
-               ObjectType flagType = OBJECT_NONE;
-               if (p->hasBlueFlag)
-                  flagType = OBJECT_BLUE_FLAG;
-               else if (p->hasRedFlag)
-                  flagType = OBJECT_RED_FLAG;
-
-               if (flagType != OBJECT_NONE)
-                  g->addObjectToMap(flagType, p->pos.x, p->pos.y);
-            }
-
-            p->currentGame = NULL;
-            g->removePlayer(p->getId());
-
-            unsigned int playerId = p->getId();
-            serverMsg.type = MSG_TYPE_LEAVE_GAME;
-            memcpy(serverMsg.buffer, &playerId, 4);
-            strcpy(serverMsg.buffer+4, g->getName().c_str());
-            msgProcessor.broadcastMessage(serverMsg, g->getPlayers());
-
-            int numPlayers = g->getNumPlayers();
-
-            serverMsg.type = MSG_TYPE_GAME_INFO;
-            memcpy(serverMsg.buffer, &numPlayers, 4);
-            strcpy(serverMsg.buffer+4, g->getName().c_str());
-            msgProcessor.broadcastMessage(serverMsg, mapPlayers);
-
-            // if there are no more players in the game, remove it
-            if (numPlayers == 0) {
-               mapGames.erase(g->getName());
-               delete g;
-            }
-         }
-
-         break;
-      }
-      case MSG_TYPE_JOIN_GAME_ACK:
-      {
-         cout << "Received a JOIN_GAME_ACK message" << endl;
-
-         string gameName(clientMsg.buffer);
-         cout << "Game name: " << gameName << endl;
-
-         // check if this game already exists
-         if (mapGames.find(gameName) == mapGames.end()) {
-            serverMsg.type = MSG_TYPE_JOIN_GAME_FAILURE;
-
-            msgProcessor.sendMessage(&serverMsg, &from);
-         }
-
-         Game* g = mapGames[gameName];
-
-         Player* p = findPlayerByAddr(mapPlayers, from);
-
-         // tell the new player about all map objects
-         // (currently just the flags)
-
-         serverMsg.type = MSG_TYPE_OBJECT;
-         vector<WorldMap::Object>* vctObjects = g->getMap()->getObjects();
-         vector<WorldMap::Object>::iterator itObjects;
-         cout << "sending items" << endl;
-         for (itObjects = vctObjects->begin(); itObjects != vctObjects->end(); itObjects++) {
-            itObjects->serialize(serverMsg.buffer);
-            cout << "sending item id " << itObjects->id  << endl;
-            msgProcessor.sendMessage(&serverMsg, &from);
-         }
-
-
-         // send the current score
-         serverMsg.type = MSG_TYPE_SCORE;
-
-         unsigned int blueScore = g->getBlueScore();
-         unsigned int redScore = g->getRedScore();
-         memcpy(serverMsg.buffer, &blueScore, 4);
-         memcpy(serverMsg.buffer+4, &redScore, 4);
-
-         msgProcessor.sendMessage(&serverMsg, &from);
-
-
-         map<unsigned int, Player*>& oldPlayers = g->getPlayers();
-         g->addPlayer(p);
-         p->team = Player::TEAM_NONE;
-
-         // send info to other players
-         serverMsg.type = MSG_TYPE_PLAYER_JOIN_GAME;
-         p->serialize(serverMsg.buffer);
-         cout << "Should be broadcasting the message" << endl;
-         msgProcessor.broadcastMessage(serverMsg, oldPlayers);
-
-
-         // tell the new player about all the players in the game (including himself)
-         cout << "Sending other players to new player" << endl;
-         serverMsg.type = MSG_TYPE_PLAYER_JOIN_GAME;
-         
-         map<unsigned int, Player*>& allPlayers = g->getPlayers();
-         map<unsigned int, Player*>::iterator it;
-         for (it = allPlayers.begin(); it != allPlayers.end(); it++)
-         {
-            it->second->serialize(serverMsg.buffer);
-
-            cout << "sending info about " << it->second->name  << endl;
-            cout << "sending id " << it->second->getId()  << endl;
-            msgProcessor.sendMessage(&serverMsg, &from);
-         }
-
-
-         int numPlayers = g->getNumPlayers();
-
-         serverMsg.type = MSG_TYPE_GAME_INFO;
-         memcpy(serverMsg.buffer, &numPlayers, 4);
-         strcpy(serverMsg.buffer+4, gameName.c_str());
-         msgProcessor.broadcastMessage(serverMsg, mapPlayers);
-
-         break;
-      }
-      case MSG_TYPE_JOIN_TEAM:
-      {
-         cout << "Received a JOIN_TEAM message" << endl;
-
-         Player* p = findPlayerByAddr(mapPlayers, from);
-         map<unsigned int, Player*> players = p->currentGame->getPlayers();
-
-         memcpy(&(p->team), clientMsg.buffer, 4);
-
-         serverMsg.type = MSG_TYPE_PLAYER;
-         p->serialize(serverMsg.buffer);
-         msgProcessor.broadcastMessage(serverMsg, players);
-
-         break;
-      }
-      case MSG_TYPE_START_GAME:
-      {
-         cout << "Received a START_GAME message" << endl;
-
-         Player* p = findPlayerByAddr(mapPlayers, from);
-         map<unsigned int, Player*> players = p->currentGame->getPlayers();
-
-         serverMsg.type = MSG_TYPE_START_GAME;
-         msgProcessor.broadcastMessage(serverMsg, players);
-
-         // send a GAME_INFO message to all players not in the game so they delete it from their lobby
-         map<unsigned int, Player*> playersNotInGame;
-         map<unsigned int, Player*>::iterator it;
-         
-         for (it = mapPlayers.begin(); it != mapPlayers.end(); it++) {
-             if (players.count(it->first) == 0)
-                 playersNotInGame[it->first] = it->second;
-         }
-
-         cout << "Sending game info to " << playersNotInGame.size() << " players not in the currently started game" << endl;
-
-         int numPlayers = 0;
-         serverMsg.type = MSG_TYPE_GAME_INFO;
-         memcpy(serverMsg.buffer, &numPlayers, 4);
-         strcpy(serverMsg.buffer+4, p->currentGame->getName().c_str());
-
-         msgProcessor.broadcastMessage(serverMsg, playersNotInGame);
-
-         break;
-      }
-      default:
-      {
-         outputLog << "Received unknown message of type " << clientMsg.type << endl;
-
-         break;
-      }
-   }
+	return 0;
 }
-
-Player *findPlayerByName(map<unsigned int, Player*> &m, string name)
-{
-   map<unsigned int, Player*>::iterator it;
-
-   for (it = m.begin(); it != m.end(); it++)
-   {
-      if ( it->second->name.compare(name) == 0 )
-         return it->second;
-   }
-
-   return NULL;
-}
-
-Player *findPlayerByAddr(map<unsigned int, Player*> &m, const sockaddr_in &addr)
-{
-   map<unsigned int, Player*>::iterator it;
-
-   for (it = m.begin(); it != m.end(); it++)
-   {
-      if ( it->second->addr.sin_addr.s_addr == addr.sin_addr.s_addr &&
-           it->second->addr.sin_port == addr.sin_port )
-         return it->second;
-   }
-
-   return NULL;
-}
-
-bool handleGameEvents(Game* game, MessageProcessor* msgProcessor, DataAccess* da) {
-   map<unsigned int, Player*> players = game->getPlayers();
-   map<unsigned int, Player*>::iterator it;
-   bool gameFinished = false;
-
-   for (it = players.begin(); it != players.end(); it++) {
-      gameFinished = gameFinished || handlePlayerEvents(game, it->second, msgProcessor, da);
-   }
-
-   if (gameFinished) {
-      for (it = players.begin(); it != players.end(); it++) {
-         it->second->currentGame = NULL;
-      }
-   }
-
-   return gameFinished;
-}
-
-bool handlePlayerEvents(Game* game, Player* p, MessageProcessor* msgProcessor, DataAccess* da) {
-   NETWORK_MSG serverMsg;
-   FLOAT_POSITION oldPos;
-   bool gameFinished = false;
-   bool broadcastMove = false;
-
-   cout << "moving player" << endl;
-
-   // move player and perform associated tasks
-   oldPos = p->pos;
-   if (p->move(game->getMap())) {
-
-      cout << "player moved" << endl;
-      if (game->processPlayerMovement(p, oldPos))
-         broadcastMove = true;
-      cout << "player move processed" << endl;
-
-      ObjectType flagType;
-      POSITION pos;
-      bool flagTurnedIn = false;
-      bool flagReturned = false;
-      bool ownFlagAtBase = false;
-
-      switch(game->getMap()->getStructure(p->pos.x/25, p->pos.y/25)) {
-         case STRUCTURE_BLUE_FLAG:
-         {
-            if (p->team == Player::TEAM_BLUE && p->hasRedFlag) {
-               // check that your flag is at your base
-               pos = game->getMap()->getStructureLocation(STRUCTURE_BLUE_FLAG);
-                           
-               vector<WorldMap::Object>* vctObjects = game->getMap()->getObjects();
-               vector<WorldMap::Object>::iterator itObjects;
-
-               for (itObjects = vctObjects->begin(); itObjects != vctObjects->end(); itObjects++) {
-                  if (itObjects->type == OBJECT_BLUE_FLAG) {
-                     if (itObjects->pos.x == pos.x*25+12 && itObjects->pos.y == pos.y*25+12) {
-                        ownFlagAtBase = true;
-                        break;
-                     }
-                  }
-               }
-
-               if (ownFlagAtBase) {
-                  p->hasRedFlag = false;
-                  flagType = OBJECT_RED_FLAG;
-                  pos = game->getMap()->getStructureLocation(STRUCTURE_RED_FLAG);
-                  flagTurnedIn = true;
-                  game->setBlueScore(game->getBlueScore()+1);
-               }
-            }
-
-            break;
-         }
-         case STRUCTURE_RED_FLAG:
-         {
-            if (p->team == Player::TEAM_RED && p->hasBlueFlag) {
-               // check that your flag is at your base
-               pos = game->getMap()->getStructureLocation(STRUCTURE_RED_FLAG);
-                        
-               vector<WorldMap::Object>* vctObjects = game->getMap()->getObjects();
-               vector<WorldMap::Object>::iterator itObjects;
-
-               for (itObjects = vctObjects->begin(); itObjects != vctObjects->end(); itObjects++) {
-                  if (itObjects->type == OBJECT_RED_FLAG) {
-                     if (itObjects->pos.x == pos.x*25+12 && itObjects->pos.y == pos.y*25+12) {
-                        ownFlagAtBase = true;
-                        break;
-                     }
-                  }
-               }
-
-               if (ownFlagAtBase) {
-                  p->hasBlueFlag = false;
-                  flagType = OBJECT_BLUE_FLAG;
-                  pos = game->getMap()->getStructureLocation(STRUCTURE_BLUE_FLAG);
-                  flagTurnedIn = true;
-                  game->setRedScore(game->getRedScore()+1);
-               }
-            }
-
-            break;
-         }
-         default:
-         {
-            break;
-         }
-      }
-
-      if (flagTurnedIn) {
-         unsigned int blueScore = game->getBlueScore();
-         unsigned int redScore = game->getRedScore();
-
-         pos.x = pos.x*25+12;
-         pos.y = pos.y*25+12;
-         game->addObjectToMap(flagType, pos.x, pos.y);
-
-         serverMsg.type = MSG_TYPE_SCORE;
-         memcpy(serverMsg.buffer, &blueScore, 4);
-         memcpy(serverMsg.buffer+4, &redScore, 4);
-         msgProcessor->broadcastMessage(serverMsg, game->getPlayers());
-
-         // give honor to everyone on the winning team
-         map<unsigned int, Player*>::iterator itPlayers;
-         for (itPlayers = game->getPlayers().begin(); itPlayers != game->getPlayers().end(); itPlayers++) {
-            if (itPlayers->second->team == p->team) {
-               itPlayers->second->honor += 50;
-               da->updatePlayer(itPlayers->second);
-            }
-         }
-
-         // check to see if the game should end
-         // move to its own method
-         if (game->getBlueScore() == 3 || game->getRedScore() == 3) {
-            gameFinished = true;
-
-            unsigned int winningTeam;
-            if (game->getBlueScore() == 3)
-               winningTeam = 0;
-            else if (game->getRedScore() == 3)
-               winningTeam = 1;
-
-            serverMsg.type = MSG_TYPE_FINISH_GAME;
-
-            // I should create an instance of the GameSummary object here and just serialize it into this message
-            memcpy(serverMsg.buffer, &winningTeam, 4);
-            memcpy(serverMsg.buffer+4, &blueScore, 4);
-            memcpy(serverMsg.buffer+8, &redScore, 4);
-            strcpy(serverMsg.buffer+12, game->getName().c_str());
-            msgProcessor->broadcastMessage(serverMsg, game->getPlayers());
-
-            // give honor to everyone on the winning team
-            for (itPlayers = game->getPlayers().begin(); itPlayers != game->getPlayers().end(); itPlayers++) {
-               if (itPlayers->second->team == p->team) {
-                  itPlayers->second->honor += 150;
-                  da->updatePlayer(itPlayers->second);
-               }
-            }
-         }
-
-         // this means a PLAYER message will be sent
-         broadcastMove = true;
-      }
-
-      // go through all objects and check if the player is close to one and if its their flag
-      vector<WorldMap::Object>* vctObjects = game->getMap()->getObjects();
-      vector<WorldMap::Object>::iterator itObjects;
-      POSITION structPos;
-
-      for (itObjects = vctObjects->begin(); itObjects != vctObjects->end(); itObjects++) {
-         POSITION pos = itObjects->pos;
-
-         if (posDistance(p->pos, pos.toFloat()) < 10) {
-            if (p->team == Player::TEAM_BLUE && itObjects->type == OBJECT_BLUE_FLAG) {
-               structPos = game->getMap()->getStructureLocation(STRUCTURE_BLUE_FLAG);
-               flagReturned = true;
-               break;
-            } else if (p->team == Player::TEAM_RED && itObjects->type == OBJECT_RED_FLAG) {
-               structPos = game->getMap()->getStructureLocation(STRUCTURE_RED_FLAG);
-               flagReturned = true;
-               break;
-            }
-         }
-      }
-
-      if (flagReturned) {
-         itObjects->pos.x = structPos.x*25+12;
-         itObjects->pos.y = structPos.y*25+12;
-
-         serverMsg.type = MSG_TYPE_OBJECT;
-         itObjects->serialize(serverMsg.buffer);
-         msgProcessor->broadcastMessage(serverMsg, game->getPlayers());
-      }
-
-      if (broadcastMove) {
-         serverMsg.type = MSG_TYPE_PLAYER;
-         p->serialize(serverMsg.buffer);
-         msgProcessor->broadcastMessage(serverMsg, game->getPlayers());
-      }
-   }
-
-   cout << "processing player attack" << endl;
-
-   // check if the player's attack animation is complete
-   if (p->isAttacking && p->timeAttackStarted+p->attackCooldown <= getCurrentMillis()) {
-      p->isAttacking = false;
-      cout << "Attack animation is complete" << endl;
-
-      //send everyone an ATTACK message
-      cout << "about to broadcast attack" << endl;
-
-      if (p->attackType == Player::ATTACK_MELEE) {
-         cout << "Melee attack" << endl;
-
-         Player* target = game->getPlayers()[p->getTargetPlayer()];
-         game->dealDamageToPlayer(target, p->damage);
-      } else if (p->attackType == Player::ATTACK_RANGED) {
-         cout << "Ranged attack" << endl;
-
-         Projectile proj(p->pos.x, p->pos.y, p->getTargetPlayer(), p->damage);
-         game->assignProjectileId(&proj);
-         game->addProjectile(proj);
-
-         int x = p->pos.x;
-         int y = p->pos.y;
-         unsigned int targetId = p->getTargetPlayer();
-
-         serverMsg.type = MSG_TYPE_PROJECTILE;
-         memcpy(serverMsg.buffer, &proj.id, 4);
-         memcpy(serverMsg.buffer+4, &x, 4);
-         memcpy(serverMsg.buffer+8, &y, 4);
-         memcpy(serverMsg.buffer+12, &targetId, 4);
-         msgProcessor->broadcastMessage(serverMsg, game->getPlayers());
-      } else
-         cout << "Invalid attack type: " << p->attackType << endl;
-   }
-
-   return gameFinished;
-}
-
-void quit(int sig) {
-   done = true;
-}
