Procházet zdrojové kódy

Major refactoring. First part: BattleInterface
Introduction of pre compiled headers,...

beegee1 před 14 roky
rodič
revize
7f04ed990b
100 změnil soubory, kde provedl 1589 přidání a 1354 odebrání
  1. 2 1
      AI/EmptyAI/CEmptyAI.cpp
  2. 2 0
      AI/EmptyAI/CEmptyAI.h
  3. 4 1
      AI/EmptyAI/Makefile.am
  4. 34 9
      AI/EmptyAI/Makefile.in
  5. 9 9
      AI/EmptyAI/exp_funcs.cpp
  6. 11 13
      AI/GeniusAI/AIPriorities.cpp
  7. 8 11
      AI/GeniusAI/AIPriorities.h
  8. 20 26
      AI/GeniusAI/BattleHelper.cpp
  9. 2 5
      AI/GeniusAI/BattleHelper.h
  10. 24 25
      AI/GeniusAI/BattleLogic.cpp
  11. 3 6
      AI/GeniusAI/BattleLogic.h
  12. 16 17
      AI/GeniusAI/CGeniusAI.cpp
  13. 10 16
      AI/GeniusAI/CGeniusAI.h
  14. 3 6
      AI/GeniusAI/Common.h
  15. 8 10
      AI/GeniusAI/DLLMain.cpp
  16. 2 1
      AI/GeniusAI/ExpertSystem.cpp
  17. 2 2
      AI/GeniusAI/ExpertSystem.h
  18. 2 0
      AI/GeniusAI/GeneralAI.cpp
  19. 2 5
      AI/GeniusAI/GeneralAI.h
  20. 4 0
      AI/GeniusAI/Makefile.am
  21. 81 16
      AI/GeniusAI/Makefile.in
  22. 8 2
      AI/GeniusAI/genius.vcxproj
  23. 8 9
      AI/GeniusAI/neuralNetwork.cpp
  24. 2 8
      AI/GeniusAI/neuralNetwork.h
  25. 4 3
      AI/StupidAI/Makefile.am
  26. 34 12
      AI/StupidAI/Makefile.in
  27. 16 19
      AI/StupidAI/StupidAI.cpp
  28. 4 2
      AI/StupidAI/StupidAI.h
  29. 6 6
      AI/StupidAI/StupidAI.vcxproj
  30. 8 7
      AI/StupidAI/main.cpp
  31. 4 5
      CCallback.cpp
  32. 2 13
      CCallback.h
  33. 7 2
      Scripting/ERM/ERM.vcxproj
  34. 7 13
      Scripting/ERM/ERMInterpreter.cpp
  35. 6 5
      Scripting/ERM/ERMInterpreter.h
  36. 2 3
      Scripting/ERM/ERMParser.cpp
  37. 2 2
      Scripting/ERM/ERMParser.h
  38. 4 2
      Scripting/ERM/ERMScriptModule.cpp
  39. 4 1
      Scripting/ERM/Makefile.am
  40. 12 5
      Scripting/ERM/Makefile.in
  41. 2 2
      VCMI_global.props
  42. 2 2
      aclocal.m4
  43. 16 17
      client/AdventureMapButton.cpp
  44. 2 6
      client/AdventureMapButton.h
  45. 25 30
      client/CAdvmapInterface.cpp
  46. 6 8
      client/CAdvmapInterface.h
  47. 38 41
      client/CAnimation.cpp
  48. 12 22
      client/CAnimation.h
  49. 9 10
      client/CBitmapHandler.cpp
  50. 4 7
      client/CBitmapHandler.h
  51. 69 75
      client/CCastleInterface.cpp
  52. 5 7
      client/CCastleInterface.h
  53. 8 9
      client/CConfigHandler.cpp
  54. 4 5
      client/CConfigHandler.h
  55. 15 14
      client/CCreatureAnimation.cpp
  56. 8 12
      client/CCreatureAnimation.h
  57. 7 12
      client/CCreatureWindow.cpp
  58. 3 1
      client/CCreatureWindow.h
  59. 2 1
      client/CCursorHandler.cpp
  60. 4 8
      client/CCursorHandler.h
  61. 33 33
      client/CDefHandler.cpp
  62. 11 16
      client/CDefHandler.h
  63. 2 1
      client/CGameInfo.cpp
  64. 5 14
      client/CGameInfo.h
  65. 4 11
      client/CHeroWindow.cpp
  66. 2 4
      client/CHeroWindow.h
  67. 16 21
      client/CKingdomInterface.cpp
  68. 1 4
      client/CKingdomInterface.h
  69. 31 40
      client/CMT.cpp
  70. 24 25
      client/CMessage.cpp
  71. 2 10
      client/CMessage.h
  72. 1 4
      client/CMusicBase.h
  73. 12 17
      client/CMusicHandler.cpp
  74. 5 13
      client/CMusicHandler.h
  75. 26 36
      client/CPlayerInterface.cpp
  76. 5 11
      client/CPlayerInterface.h
  77. 38 53
      client/CPreGame.cpp
  78. 7 10
      client/CPreGame.h
  79. 7 8
      client/CSndHandler.cpp
  80. 3 10
      client/CSndHandler.h
  81. 2 5
      client/CSoundBase.h
  82. 13 16
      client/CSpellWindow.cpp
  83. 1 6
      client/CSpellWindow.h
  84. 17 18
      client/CVideoHandler.cpp
  85. 3 6
      client/CVideoHandler.h
  86. 24 30
      client/Client.cpp
  87. 3 8
      client/Client.h
  88. 4 7
      client/FontBase.h
  89. 2 7
      client/FunctionList.h
  90. 9 11
      client/GUIBase.cpp
  91. 7 9
      client/GUIBase.h
  92. 144 155
      client/GUIClasses.cpp
  93. 15 17
      client/GUIClasses.h
  94. 30 33
      client/Graphics.cpp
  95. 5 7
      client/Graphics.h
  96. 43 7
      client/Makefile.am
  97. 380 52
      client/Makefile.in
  98. 6 7
      client/NetPacksClient.cpp
  99. 10 14
      client/SDL_Extensions.cpp
  100. 6 11
      client/SDL_Extensions.h

+ 2 - 1
AI/EmptyAI/CEmptyAI.cpp

@@ -1,5 +1,6 @@
+#include "StdInc.h"
 #include "CEmptyAI.h"
-#include <iostream>
+
 void CEmptyAI::init(CCallback * CB)
 {
 	cb = CB;

+ 2 - 0
AI/EmptyAI/CEmptyAI.h

@@ -1,3 +1,5 @@
+#pragma once
+
 #include "../../AI_Base.h"
 #include "../../CCallback.h"
 

+ 4 - 1
AI/EmptyAI/Makefile.am

@@ -1,10 +1,13 @@
 vcmiaidir = $(VCMI_AI_LIBS_DIR)
+BUILT_SOURCES = StdInc.h.gch
+StdInc.h.gch: StdInc.h
+	$(CXXCOMPILE) -DVCMI_DLL -fPIC -c $<
 
 vcmiai_LTLIBRARIES = libEmptyAI.la
 libEmptyAI_la_LIBADD = $(top_builddir)/lib/libvcmi.la
+libEmptyAI_la_CXXFLAGS = -DVCMI_DLL
 libEmptyAI_la_LDFLAGS = -L$(top_builddir)/lib -module -avoid-version
 libEmptyAI_la_SOURCES = \
 	CEmptyAI.cpp \
 	CEmptyAI.h \
 	exp_funcs.cpp
-

+ 34 - 9
AI/EmptyAI/Makefile.in

@@ -79,15 +79,16 @@ am__base_list = \
 am__installdirs = "$(DESTDIR)$(vcmiaidir)"
 LTLIBRARIES = $(vcmiai_LTLIBRARIES)
 libEmptyAI_la_DEPENDENCIES = $(top_builddir)/lib/libvcmi.la
-am_libEmptyAI_la_OBJECTS = CEmptyAI.lo exp_funcs.lo
+am_libEmptyAI_la_OBJECTS = libEmptyAI_la-CEmptyAI.lo \
+	libEmptyAI_la-exp_funcs.lo
 libEmptyAI_la_OBJECTS = $(am_libEmptyAI_la_OBJECTS)
 AM_V_lt = $(am__v_lt_$(V))
 am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
 am__v_lt_0 = --silent
 libEmptyAI_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
-	$(AM_CXXFLAGS) $(CXXFLAGS) $(libEmptyAI_la_LDFLAGS) $(LDFLAGS) \
-	-o $@
+	$(libEmptyAI_la_CXXFLAGS) $(CXXFLAGS) $(libEmptyAI_la_LDFLAGS) \
+	$(LDFLAGS) -o $@
 DEFAULT_INCLUDES = -I.@am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -270,15 +271,18 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 vcmiaidir = $(VCMI_AI_LIBS_DIR)
+BUILT_SOURCES = StdInc.h.gch
 vcmiai_LTLIBRARIES = libEmptyAI.la
 libEmptyAI_la_LIBADD = $(top_builddir)/lib/libvcmi.la
+libEmptyAI_la_CXXFLAGS = -DVCMI_DLL
 libEmptyAI_la_LDFLAGS = -L$(top_builddir)/lib -module -avoid-version
 libEmptyAI_la_SOURCES = \
 	CEmptyAI.cpp \
 	CEmptyAI.h \
 	exp_funcs.cpp
 
-all: all-am
+all: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) all-am
 
 .SUFFIXES:
 .SUFFIXES: .cpp .lo .o .obj
@@ -352,8 +356,8 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CEmptyAI.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exp_funcs.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libEmptyAI_la-CEmptyAI.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libEmptyAI_la-exp_funcs.Plo@am__quote@
 
 .cpp.o:
 @am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -379,6 +383,22 @@ distclean-compile:
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(LTCXXCOMPILE) -c -o $@ $<
 
+libEmptyAI_la-CEmptyAI.lo: CEmptyAI.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libEmptyAI_la_CXXFLAGS) $(CXXFLAGS) -MT libEmptyAI_la-CEmptyAI.lo -MD -MP -MF $(DEPDIR)/libEmptyAI_la-CEmptyAI.Tpo -c -o libEmptyAI_la-CEmptyAI.lo `test -f 'CEmptyAI.cpp' || echo '$(srcdir)/'`CEmptyAI.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libEmptyAI_la-CEmptyAI.Tpo $(DEPDIR)/libEmptyAI_la-CEmptyAI.Plo
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='CEmptyAI.cpp' object='libEmptyAI_la-CEmptyAI.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libEmptyAI_la_CXXFLAGS) $(CXXFLAGS) -c -o libEmptyAI_la-CEmptyAI.lo `test -f 'CEmptyAI.cpp' || echo '$(srcdir)/'`CEmptyAI.cpp
+
+libEmptyAI_la-exp_funcs.lo: exp_funcs.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libEmptyAI_la_CXXFLAGS) $(CXXFLAGS) -MT libEmptyAI_la-exp_funcs.lo -MD -MP -MF $(DEPDIR)/libEmptyAI_la-exp_funcs.Tpo -c -o libEmptyAI_la-exp_funcs.lo `test -f 'exp_funcs.cpp' || echo '$(srcdir)/'`exp_funcs.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libEmptyAI_la-exp_funcs.Tpo $(DEPDIR)/libEmptyAI_la-exp_funcs.Plo
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='exp_funcs.cpp' object='libEmptyAI_la-exp_funcs.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libEmptyAI_la_CXXFLAGS) $(CXXFLAGS) -c -o libEmptyAI_la-exp_funcs.lo `test -f 'exp_funcs.cpp' || echo '$(srcdir)/'`exp_funcs.cpp
+
 mostlyclean-libtool:
 	-rm -f *.lo
 
@@ -468,13 +488,15 @@ distdir: $(DISTFILES)
 	  fi; \
 	done
 check-am: all-am
-check: check-am
+check: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) check-am
 all-am: Makefile $(LTLIBRARIES)
 installdirs:
 	for dir in "$(DESTDIR)$(vcmiaidir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
-install: install-am
+install: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) install-am
 install-exec: install-exec-am
 install-data: install-data-am
 uninstall: uninstall-am
@@ -499,6 +521,7 @@ distclean-generic:
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
+	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
 clean: clean-am
 
 clean-am: clean-generic clean-libtool clean-vcmiaiLTLIBRARIES \
@@ -570,7 +593,7 @@ ps-am:
 
 uninstall-am: uninstall-vcmiaiLTLIBRARIES
 
-.MAKE: install-am install-strip
+.MAKE: all check install install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
 	clean-libtool clean-vcmiaiLTLIBRARIES ctags distclean \
@@ -586,6 +609,8 @@ uninstall-am: uninstall-vcmiaiLTLIBRARIES
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags uninstall uninstall-am uninstall-vcmiaiLTLIBRARIES
 
+StdInc.h.gch: StdInc.h
+	$(CXXCOMPILE) -DVCMI_DLL -fPIC -c $<
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.

+ 9 - 9
AI/EmptyAI/exp_funcs.cpp

@@ -1,31 +1,31 @@
-#define VCMI_DLL
+#include "StdInc.h"
+
 #include "../../AI_Base.h"
 #include "CEmptyAI.h"
-#include <cstring>
-#include <set>
+
 std::set<CGlobalAI*> ais;
-extern "C" DLL_EXPORT int GetGlobalAiVersion()
+extern "C" DLL_LINKAGE int GetGlobalAiVersion()
 {
 	return AI_INTERFACE_VER;
 }
 
-extern "C" DLL_EXPORT void GetAiName(char* name)
+extern "C" DLL_LINKAGE void GetAiName(char* name)
 {
 	strcpy(name,NAME);
 }
-extern "C" DLL_EXPORT char * GetAiNameS()
+extern "C" DLL_LINKAGE char * GetAiNameS()
 {
 	char * ret = new char[50];
 	strcpy(ret,NAME);
 	return ret;
 }
-extern "C" DLL_EXPORT CGlobalAI * GetNewAI()
+extern "C" DLL_LINKAGE CGlobalAI * GetNewAI()
 {
 	return new CEmptyAI();
 // return
 }
-extern "C" DLL_EXPORT void ReleaseAI(CGlobalAI * i)
+extern "C" DLL_LINKAGE void ReleaseAI(CGlobalAI * i)
 {
 	delete (CEmptyAI*)i;
 	ais.erase(i);
-}
+}

+ 11 - 13
AI/GeniusAI/AIPriorities.cpp

@@ -1,13 +1,12 @@
-#ifndef AI_PRIORITIES
-#define AI_PRIORITIES
+#include "StdInc.h"
 #include "AIPriorities.h"
-#include <sstream>
+
 // TODO: No using namespace!!
 using namespace geniusai;
 
 Network::Network()
 {}
-Network::Network(vector<unsigned int> whichFeatures)// random network
+Network::Network(vector<ui32> whichFeatures)// random network
     : whichFeatures(whichFeatures),
       net(whichFeatures.size(),
           whichFeatures.size() * 0.601 + 2,
@@ -34,15 +33,15 @@ Network::Network(istream & input)
 }
 
 
-float Network::feedForward(const vector<float> & stateFeatures)
+double Network::feedForward(const vector<double> & stateFeatures)
 {
   // TODO: Should comment/rewrite it...
-	return (rand() % 1000) / 800.0f;
+	return (rand() % 1000) / 800.0;
 	double * input = new double[whichFeatures.size()];
 	for (int i = 0; i < whichFeatures.size(); i++)
 		input[i] = stateFeatures[whichFeatures[i]];
 	
-	float ans = net.feedForwardPattern(input)[0];
+	double ans = net.feedForwardPattern(input)[0];
 	
 	delete input;
 	return ans;
@@ -98,18 +97,18 @@ void Priorities::fillFeatures(const CGeniusAI::HypotheticalGameState & hgs)
 	
 }
 
-float Priorities::getCost(vector<int> &resourceCosts,const CGHeroInstance * moved,int distOutOfTheWay)
+double Priorities::getCost(vector<int> &resourceCosts,const CGHeroInstance * moved,int distOutOfTheWay)
 {
 	if(!resourceCosts.size())return -1;
 	//TODO: replace with ann
-	float cost = resourceCosts[0]/4.0+resourceCosts[1]/2.0+resourceCosts[2]/4.0+resourceCosts[3]/2.0+resourceCosts[4]/2.0+resourceCosts[5]/2.0+resourceCosts[6]/3000.0;
+	double cost = resourceCosts[0]/4.0+resourceCosts[1]/2.0+resourceCosts[2]/4.0+resourceCosts[3]/2.0+resourceCosts[4]/2.0+resourceCosts[5]/2.0+resourceCosts[6]/3000.0;
 	
 	if(moved)						//TODO: multiply by importance of hero
 		cost+=distOutOfTheWay/10000.0;
 	return cost;
 }
 
-float Priorities::getValue(const CGeniusAI::AIObjective & obj)
+double Priorities::getValue(const CGeniusAI::AIObjective & obj)
 {	//resource
 	
 	vector<int> resourceAmounts(8,0);
@@ -117,7 +116,7 @@ float Priorities::getValue(const CGeniusAI::AIObjective & obj)
 
 	if(obj.type==CGeniusAI::AIObjective::finishTurn)	//TODO: replace with value of visiting that object divided by days till completed
 		return .0001;			//small nonzero
-	float a;
+	double a;
 	if(obj.type==CGeniusAI::AIObjective::attack)
 		return 100;
 	if(dynamic_cast<const CGeniusAI::HeroObjective* >(&obj))
@@ -249,5 +248,4 @@ float Priorities::getValue(const CGeniusAI::AIObjective & obj)
 
 
 	return 0;
-}
-#endif
+}

+ 8 - 11
AI/GeniusAI/AIPriorities.h

@@ -1,7 +1,5 @@
-#ifndef AIP_H
-#define AIP_H
+#pragma once
 
-#include <string>
 #include "CGeniusAI.h"
 #include "neuralNetwork.h"
 
@@ -11,10 +9,10 @@ class Network
 {
 public:
 	Network();
-	Network(vector<unsigned int> whichFeatures);// random network
+	Network(vector<ui32> whichFeatures);// random network
 	Network(istream & input);
-	vector<unsigned int> whichFeatures;
-	float feedForward(const vector<float> & stateFeatures);
+	vector<ui32> whichFeatures;
+	double feedForward(const vector<double> & stateFeatures);
 	neuralNetwork net;					//a network with whichFeatures.size() inputs, and 1 output
 };
 
@@ -25,15 +23,14 @@ public:
 	Priorities(const string & filename);	//read brain from file
 
 
-	vector<float> stateFeatures;
+	vector<double> stateFeatures;
 	int specialFeaturesStart;
 	int numSpecialFeatures;
 	void fillFeatures(const CGeniusAI::HypotheticalGameState & AI);
-	float getValue(const CGeniusAI::AIObjective & obj);
-	float getCost(vector<int> &resourceCosts,const CGHeroInstance * moved,int distOutOfTheWay);
+	double getValue(const CGeniusAI::AIObjective & obj);
+	double getCost(vector<int> &resourceCosts,const CGHeroInstance * moved,int distOutOfTheWay);
 	vector<vector<Network> > objectNetworks;
 	vector<map<int,Network> > buildingNetworks;
 };
 
-}
-#endif
+}

+ 20 - 26
AI/GeniusAI/BattleHelper.cpp

@@ -1,11 +1,5 @@
+#include "StdInc.h"
 #include "BattleHelper.h"
-#include <vector>
-#include <string>
-#include <fstream>
-#include <boost/algorithm/string/split.hpp>
-#include <boost/algorithm/string/classification.hpp>
-#include <boost/algorithm/string.hpp>
-#include <boost/lexical_cast.hpp>
 
 using namespace geniusai::BattleAI;
 using namespace std;
@@ -13,8 +7,8 @@ using namespace std;
 
 CBattleHelper::CBattleHelper():
 	InfiniteDistance(0xffff),
-	BattlefieldWidth(BFIELD_WIDTH-2),
-	BattlefieldHeight(BFIELD_HEIGHT),
+	BattlefieldWidth(GameConstants::BFIELD_WIDTH-2),
+	BattlefieldHeight(GameConstants::BFIELD_HEIGHT),
 	m_voteForMaxDamage(10),
 	m_voteForMinDamage(10),
 	m_voteForMaxSpeed(10),
@@ -106,21 +100,21 @@ CBattleHelper::~CBattleHelper()
 
 int CBattleHelper::GetBattleFieldPosition(int x, int y)
 {
-	return x + BFIELD_WIDTH * (y - 1);
+	return x + GameConstants::BFIELD_WIDTH * (y - 1);
 }
 
 int CBattleHelper::DecodeXPosition(int battleFieldPosition)
 {
-	int x = battleFieldPosition%BFIELD_WIDTH;
-	assert( x > 0 && x < BFIELD_WIDTH-1 );
+	int x = battleFieldPosition%GameConstants::BFIELD_WIDTH;
+	assert( x > 0 && x < GameConstants::BFIELD_WIDTH-1 );
 	return x;
 }
 
 int CBattleHelper::DecodeYPosition(int battleFieldPosition)
 {
 
-	int y=battleFieldPosition/BFIELD_WIDTH +1;
-	assert( y > 0 && y <= BFIELD_HEIGHT);
+	int y=battleFieldPosition/GameConstants::BFIELD_WIDTH +1;
+	assert( y > 0 && y <= GameConstants::BFIELD_HEIGHT);
 	return y;
 }
 
@@ -133,34 +127,34 @@ int CBattleHelper::StepLeft(int pos){
 }
 
 int CBattleHelper::StepUpleft(int pos){
-  if((pos/BFIELD_WIDTH)%2==0){
-    return pos-BFIELD_WIDTH;
+  if((pos/GameConstants::BFIELD_WIDTH)%2==0){
+    return pos-GameConstants::BFIELD_WIDTH;
   }else{
-    return pos-BFIELD_WIDTH-1;
+    return pos-GameConstants::BFIELD_WIDTH-1;
   }
 }
 
 int CBattleHelper::StepUpright(int pos){
-  if((pos/BFIELD_WIDTH)%2==0){
-    return pos-BFIELD_WIDTH+1;
+  if((pos/GameConstants::BFIELD_WIDTH)%2==0){
+    return pos-GameConstants::BFIELD_WIDTH+1;
   }else{
-    return pos-BFIELD_WIDTH;
+    return pos-GameConstants::BFIELD_WIDTH;
   }
 }
 
 int CBattleHelper::StepDownleft(int pos){
-  if((pos/BFIELD_WIDTH)%2==0){
-    return pos+BFIELD_WIDTH;
+  if((pos/GameConstants::BFIELD_WIDTH)%2==0){
+    return pos+GameConstants::BFIELD_WIDTH;
   }else{
-    return pos+BFIELD_WIDTH-1;
+    return pos+GameConstants::BFIELD_WIDTH-1;
   }
 }
 
 int CBattleHelper::StepDownright(int pos){
-  if((pos/BFIELD_WIDTH)%2==0){
-    return pos+BFIELD_WIDTH+1;
+  if((pos/GameConstants::BFIELD_WIDTH)%2==0){
+    return pos+GameConstants::BFIELD_WIDTH+1;
  }else{
-    return pos+BFIELD_WIDTH;
+    return pos+GameConstants::BFIELD_WIDTH;
   }
 }
 

+ 2 - 5
AI/GeniusAI/BattleHelper.h

@@ -1,5 +1,4 @@
-#ifndef __BATTLE_HELPER__
-#define __BATTLE_HELPER__
+#pragma once
 
 #include "Common.h"
 
@@ -47,6 +46,4 @@ private:
 	CBattleHelper &operator=(const CBattleHelper &);
 };
 
-}}
-
-#endif/*__BATTLE_HELPER__*/
+}}

+ 24 - 25
AI/GeniusAI/BattleLogic.cpp

@@ -1,11 +1,10 @@
+#include "StdInc.h"
 #include "BattleLogic.h"
+
 #include "../../lib/BattleState.h"
-#include <math.h>
-#include <boost/lexical_cast.hpp>
 #include <boost/lambda/lambda.hpp>
 #include <boost/lambda/bind.hpp>
 #include <boost/lambda/if.hpp>
-#include <boost/foreach.hpp>
 
 #ifdef _WIN32
 #define WIN32_LEAN_AND_MEAN //excludes rarely used stuff from windows headers - delete this line if something is missing
@@ -152,27 +151,27 @@ void CBattleLogic::MakeStatistics(int currentCreatureId)
 			//CGHeroInstance *defendingHero = (m_side)? m_hero2 : m_hero1;
 
 			int attackDefenseBonus = currentStack->Attack() - st->Defense();
-			float damageFactor = 1.0f;
+			double damageFactor = 1.0;
 			if(attackDefenseBonus < 0) //decreasing dmg
 			{
-				if(0.02f * (-attackDefenseBonus) > 0.3f)
+				if(0.02 * (-attackDefenseBonus) > 0.3)
 				{
-					damageFactor += -0.3f;
+					damageFactor += -0.3;
 				}
 				else
 				{
-					damageFactor += 0.02f * attackDefenseBonus;
+					damageFactor += 0.02 * attackDefenseBonus;
 				}
 			}
 			else //increasing dmg
 			{
-				if(0.05f * attackDefenseBonus > 4.0f)
+				if(0.05 * attackDefenseBonus > 4.0)
 				{
-					damageFactor += 4.0f;
+					damageFactor += 4.0;
 				}
 				else
 				{
-					damageFactor += 0.05f * attackDefenseBonus;
+					damageFactor += 0.05 * attackDefenseBonus;
 				}
 			}
 
@@ -222,8 +221,8 @@ void CBattleLogic::MakeStatistics(int currentCreatureId)
 			totalHitPoints += hitPoints;
 		}
 	}
-	if ((float)totalDamage / (float)totalEnemyDamage < 0.5f &&
-		(float)totalHitPoints / (float)totalEnemyHitPoints < 0.5f)
+	if (totalDamage / static_cast<double>(totalEnemyDamage) < 0.5 &&
+		totalHitPoints / static_cast<double>(totalEnemyHitPoints) < 0.5)
 	{
 		m_bEnemyDominates = true;
 		DbgBox("** EnemyDominates!");
@@ -240,29 +239,29 @@ void CBattleLogic::MakeStatistics(int currentCreatureId)
 	
 	// sort max damage
 	std::sort(m_statMaxDamage.begin(), m_statMaxDamage.end(),
-		bind((IntPtr)&creature_stat::value_type::second, _1) > bind((IntPtr)&creature_stat::value_type::second, _2));
+		bind((IntPtr)&creature_stat::value_type::second, boost::lambda::_1) > bind((IntPtr)&creature_stat::value_type::second, boost::lambda::_2));
 	// sort min damage
 	std::sort(m_statMinDamage.begin(), m_statMinDamage.end(),
-		bind((IntPtr)&creature_stat::value_type::second, _1) > bind((IntPtr)&creature_stat::value_type::second, _2));
+		bind((IntPtr)&creature_stat::value_type::second, boost::lambda::_1) > bind((IntPtr)&creature_stat::value_type::second, boost::lambda::_2));
 	// sort max speed
 	std::sort(m_statMaxSpeed.begin(), m_statMaxSpeed.end(),
-		bind((IntPtr)&creature_stat::value_type::second, _1) > bind((IntPtr)&creature_stat::value_type::second, _2));
+		bind((IntPtr)&creature_stat::value_type::second, boost::lambda::_1) > bind((IntPtr)&creature_stat::value_type::second, boost::lambda::_2));
 	// sort distance
 	std::sort(m_statDistance.begin(), m_statDistance.end(),
-		bind((IntPtr)&creature_stat::value_type::second, _1) < bind((IntPtr)&creature_stat::value_type::second, _2));
+		bind((IntPtr)&creature_stat::value_type::second, boost::lambda::_1) < bind((IntPtr)&creature_stat::value_type::second, boost::lambda::_2));
 	// sort distance from shooters
 	std::sort(m_statDistanceFromShooters.begin(), m_statDistanceFromShooters.end(),
-		bind((IntPtr)&creature_stat::value_type::second, _1) < bind((IntPtr)&creature_stat::value_type::second, _2));
+		bind((IntPtr)&creature_stat::value_type::second, boost::lambda::_1) < bind((IntPtr)&creature_stat::value_type::second, boost::lambda::_2));
 	// sort hit points
 	std::sort(m_statHitPoints.begin(), m_statHitPoints.end(),
-		bind((IntPtr)&creature_stat::value_type::second, _1) > bind((IntPtr)&creature_stat::value_type::second, _2));
+		bind((IntPtr)&creature_stat::value_type::second, boost::lambda::_1) > bind((IntPtr)&creature_stat::value_type::second, boost::lambda::_2));
 	// sort casualties
 	std::sort(m_statCasualties.begin(), m_statCasualties.end(),
 		bind((CreaPtr)&creature_stat_casualties::value_type::second_type::damage_max, 
-			bind((CreaPairPtr)&creature_stat_casualties::value_type::second, _1))
+			bind((CreaPairPtr)&creature_stat_casualties::value_type::second, boost::lambda::_1))
 		>
 		bind((CreaPtr)&creature_stat_casualties::value_type::second_type::damage_max,
-			bind((CreaPairPtr)&creature_stat_casualties::value_type::second, _2)));
+			bind((CreaPairPtr)&creature_stat_casualties::value_type::second, boost::lambda::_2)));
 }
 
 BattleAction CBattleLogic::MakeDecision(int stackID)
@@ -527,7 +526,7 @@ BattleAction CBattleLogic::MakeAttack(int attackerID, int destinationID)
 			}
 		}
 
-		std::vector<THex> fields = m_cb->battleGetAvailableHexes(m_cb->battleGetStackByID(attackerID), false);
+		std::vector<SHexField> fields = m_cb->battleGetAvailableHexes(m_cb->battleGetStackByID(attackerID), false);
 
 		if(fields.size() == 0)
 		{
@@ -541,11 +540,11 @@ BattleAction CBattleLogic::MakeAttack(int attackerID, int destinationID)
 		ba.destinationTile = static_cast<ui16>(dest_tile);
 		//simplified checking for possibility of attack (previous was too simplified)
 		int destStackPos = m_cb->battleGetPos(destinationID);
-		if(THex::mutualPosition(dest_tile, destStackPos) != -1)
+		if(SHexField::mutualPosition(dest_tile, destStackPos) != -1)
 			ba.additionalInfo = destStackPos;
-		else if(THex::mutualPosition(dest_tile, destStackPos+1) != -1)
+		else if(SHexField::mutualPosition(dest_tile, destStackPos+1) != -1)
 			ba.additionalInfo = destStackPos+1;
-		else if(THex::mutualPosition(dest_tile, destStackPos-1) != -1)
+		else if(SHexField::mutualPosition(dest_tile, destStackPos-1) != -1)
 			ba.additionalInfo = destStackPos-1;
 		else
 			return BattleAction::makeDefend(attackerStack);
@@ -582,7 +581,7 @@ BattleAction CBattleLogic::MakeAttack(int attackerID, int destinationID)
 			}
 		}
 
-		for (std::vector<THex>::const_iterator it = fields.begin(); it != fields.end(); ++it)
+		for (std::vector<SHexField>::const_iterator it = fields.begin(); it != fields.end(); ++it)
 		{
 			if (*it == dest_tile)
 			{

+ 3 - 6
AI/GeniusAI/BattleLogic.h

@@ -1,11 +1,10 @@
-#ifndef __BATTLE_LOGIC_H__
-#define __BATTLE_LOGIC_H__
+#pragma once
 
 #include "Common.h"
 #include "BattleHelper.h"
 
 #pragma warning (disable: 4100 4251 4245 4018 4081)
-#include "../../global.h"
+
 #include "../../CCallback.h"
 #include "../../lib/CCreatureHandler.h"
 #include "../../lib/CObjectHandler.h"
@@ -129,6 +128,4 @@ private:
 	void PrintBattleAction(const BattleAction &action);
 };
 
-}}
-
-#endif/*__BATTLE_LOGIC_H__*/
+}}

+ 16 - 17
AI/GeniusAI/CGeniusAI.cpp

@@ -1,8 +1,6 @@
+#include "StdInc.h"
 #include "CGeniusAI.h"
 
-#include <iostream>
-#include <boost/lexical_cast.hpp>
-
 #include "../../lib/BattleState.h"
 #include "../../lib/CBuildingHandler.h"
 #include "../../lib/CHeroHandler.h"
@@ -10,6 +8,7 @@
 #include "../../lib/NetPacks.h"
 #include "AIPriorities.h"
 #include "../../lib/CGameState.h"
+#include "../../lib/GameConstants.h"
 
 using std::endl;
 using geniusai::CGeniusAI;
@@ -150,7 +149,7 @@ CGeniusAI::HeroObjective::HeroObjective(const HypotheticalGameState &hgs,
 }
 
 
-float CGeniusAI::HeroObjective::getValue() const
+double CGeniusAI::HeroObjective::getValue() const
 {
 	if (_value >= 0)
     return _value - _cost;
@@ -165,7 +164,7 @@ float CGeniusAI::HeroObjective::getValue() const
 		resourceCosts[6] += 1000;
 
   // TODO: Add some meaningful (and not exploitable) number here.
-	float bestCost = 9e9f;
+	double bestCost = 9e9f;
 	HypotheticalGameState::HeroModel* bestHero = NULL;
 	if (type != AIObjective::finishTurn)
 	{
@@ -195,7 +194,7 @@ float CGeniusAI::HeroObjective::getValue() const
 					distOutOfTheWay-=path3.nodes[0].dist;
 			}
 			
-			float cost = AI->m_priorities->getCost(resourceCosts,
+			double cost = AI->m_priorities->getCost(resourceCosts,
                                              whoCanAchieve[i]->h,
                                              distOutOfTheWay);
 			if (cost < bestCost)
@@ -269,7 +268,7 @@ CGeniusAI::TownObjective::TownObjective(
 	_value = -1;
 }
 
-float CGeniusAI::TownObjective::getValue() const
+double CGeniusAI::TownObjective::getValue() const
 {
 	if (_value >= 0)
 		return _value - _cost;
@@ -278,7 +277,7 @@ float CGeniusAI::TownObjective::getValue() const
 	vector<int> resourceCosts(8,0);
 	CBuilding* b        = NULL;
 	CCreature* creature = NULL;
-	float cost          = 0; // TODO: Needed?
+	double cost          = 0; // TODO: Needed?
 	int ID              = 0;
 	int newID           = 0;
 	int howMany         = 0;
@@ -310,7 +309,7 @@ float CGeniusAI::TownObjective::getValue() const
 				else
 					creatures_max = INT_MAX; // TODO: Will have to rewrite it.
 				// TODO: Buy the best units (the least I can buy)?
-					 amin(howMany, creatures_max);
+					 vstd::amin(howMany, creatures_max);
 			}
 		  // The cost of recruiting the stack of creatures.
 			for (int i = 0; creature && (i < creature->cost.size() ); ++i)
@@ -401,7 +400,7 @@ void CGeniusAI::TownObjective::print() const
 				creatures_max = hgs.resourceAmounts[i]/creature->cost[i];
 			else
 				creatures_max = INT_MAX;
-			amin(howMany, creatures_max);
+			vstd::amin(howMany, creatures_max);
 		}
 		  tlog6 << "recruit " << howMany  << " " << creature->namePl
 				<< " (Total AI Strength " << creature->AIValue*howMany
@@ -503,7 +502,7 @@ void CGeniusAI::addHeroObjectives(CGeniusAI::HypotheticalGameState::HeroModel& h
 		// maybe the hero wants to visit a seemingly unguarded enemy town,
     // but there is a hero on top of it.
 		// if(i->o->)
-    if (i->o->ID != HEROI_TYPE)
+		if (i->o->ID != GameConstants::HEROI_TYPE)
 	{// Unless you are trying to visit a hero.
 		bool heroThere = false;
 		for(int j = 0; j < hgs.heroModels.size(); j++)
@@ -514,7 +513,7 @@ void CGeniusAI::addHeroObjectives(CGeniusAI::HypotheticalGameState::HeroModel& h
 			if (heroThere) // It won't work if there is already someone visiting that spot.
 				continue;
 	}
-	if (i->o->ID == HEROI_TYPE && // Visiting friendly heroes not yet supported.
+	if (i->o->ID == GameConstants::HEROI_TYPE && // Visiting friendly heroes not yet supported.
 		i->o->getOwner() == m_cb->getMyColor())
 			continue;
 	if (i->o->id == h.h->id)	// Don't visit yourself (should be caught by above).
@@ -541,7 +540,7 @@ void CGeniusAI::addHeroObjectives(CGeniusAI::HypotheticalGameState::HeroModel& h
       // TODO: Make constants of those 1.2 & 2.5.
 			if (dynamic_cast<const CGTownInstance*> (i->o))
 				enemyStrength = static_cast<int>((dynamic_cast<const CGTownInstance*> (i->o))->getArmyStrength() * 1.2);
-			float heroStrength = h.h->getTotalStrength();
+			double heroStrength = h.h->getTotalStrength();
       // TODO: ballence these numbers using objective cost formula.
       // TODO: it would be nice to do a battle simulation.
 			if (enemyStrength * 2.5 > heroStrength)  
@@ -945,7 +944,7 @@ void CGeniusAI::TownObjective::fulfill(CGeniusAI& cg,
 			creature = VLC->creh->creatures[ID];
 			howMany = whichTown->creaturesToRecruit[which].first;
 			for (int i = 0; i < creature->cost.size(); i++)
-				amin(howMany, creature->cost[i] ? hgs.resourceAmounts[i]/creature->cost[i] : INT_MAX);
+				vstd::amin(howMany, creature->cost[i] ? hgs.resourceAmounts[i]/creature->cost[i] : INT_MAX);
 			if (howMany == 0)
 			{
 				tlog6 << "tried to recruit without enough money.";
@@ -1262,7 +1261,7 @@ void CGeniusAI::battleStart(const CCreatureSet *army1, const CCreatureSet *army2
   // TODO: Battle logic what...
 	assert(!m_battleLogic);
   // We have been informed that battle will start (or we are neutral AI)
-	assert( (playerID > PLAYER_LIMIT) || (m_state.get() == UPCOMING_BATTLE) );
+	assert( (playerID > GameConstants::PLAYER_LIMIT) || (m_state.get() == UPCOMING_BATTLE) );
 
 	m_state.setn(ONGOING_BATTLE);
 	m_battleLogic = new BattleAI::CBattleLogic(m_cb, army1, army2, tile, hero1,
@@ -1312,7 +1311,7 @@ void CGeniusAI::battleNewRound(int round)
 /**
  *
  */
-void CGeniusAI::battleStackMoved(int ID, std::vector<THex> dest, int distance)
+void CGeniusAI::battleStackMoved(int ID, std::vector<SHexField> dest, int distance)
 {
 	std::string message("\t\t\tCGeniusAI::battleStackMoved ID(");
 	message += boost::lexical_cast<std::string>(ID);
@@ -1346,7 +1345,7 @@ void CGeniusAI::battleSpellCast(const BattleSpellCast *sc)
  *
  */
 // void CGeniusAI::battleStackMoved(int ID,
-//                                  THex dest,
+//                                  SHexField dest,
 //                                  bool startMoving,
 //                                  bool endMoving)
 // {

+ 10 - 16
AI/GeniusAI/CGeniusAI.h

@@ -1,13 +1,9 @@
-#ifndef __CGENIUSAI_H__
-#define __CGENIUSAI_H__
+#pragma once
 
 #include "Common.h"
 #include "BattleLogic.h"
 #include "GeneralAI.h"
 #include "../../lib/CondSh.h"
-#include <set>
-#include <list>
-#include <queue>
 
 class CBuilding;
 
@@ -101,7 +97,7 @@ private:
 		virtual void fulfill(CGeniusAI &,HypotheticalGameState & hgs)=0;
 		virtual HypotheticalGameState pretend(const HypotheticalGameState&) =0;
 		virtual void print() const=0;
-		virtual float getValue() const=0;	//how much is it worth to the AI to achieve
+		virtual double getValue() const=0;	//how much is it worth to the AI to achieve
 	};
 
 	class HeroObjective: public AIObjective
@@ -122,11 +118,11 @@ private:
 		bool operator< (const HeroObjective &other) const;
 		void fulfill(CGeniusAI &,HypotheticalGameState & hgs);
 		HypotheticalGameState pretend(const HypotheticalGameState &hgs){return hgs;};
-		float getValue() const;
+		double getValue() const;
 		void print() const;
 	private:
-		mutable float _value;
-		mutable float _cost;
+		mutable double _value;
+		mutable double _cost;
 	};
 
 	//town objectives
@@ -147,11 +143,11 @@ private:
 		bool operator < (const TownObjective &other)const;
 		void fulfill(CGeniusAI &,HypotheticalGameState & hgs);
 		HypotheticalGameState pretend(const HypotheticalGameState &hgs){return hgs;};
-		float getValue() const;
+		double getValue() const;
 		void print() const;
 	private:
-		mutable float _value;
-		mutable float _cost;
+		mutable double _value;
+		mutable double _cost;
 	};
 
 	class AIObjectivePtrCont
@@ -205,7 +201,7 @@ public:
 	virtual void battleStacksAttacked(const std::set<BattleStackAttacked> & bsa); //called when stack receives damage (after battleAttack())
 	virtual void battleEnd(const BattleResult *br);
 	virtual void battleNewRound(int round); //called at the beggining of each turn, round=-1 is the tactic phase, round=0 is the first "normal" turn
-	virtual void battleStackMoved(int ID, std::vector<THex> dest, int distance);
+	virtual void battleStackMoved(int ID, std::vector<SHexField> dest, int distance);
 	virtual void battleSpellCast(const BattleSpellCast *sc);
 	virtual void battleStart(const CCreatureSet *army1, const CCreatureSet *army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2, bool side); //called by engine when battle starts; side=0 - left, side=1 - right
 	//virtual void battlefieldPrepared(int battlefieldType, std::vector<CObstacle*> obstacles); //called when battlefield is prepared, prior the battle beginning
@@ -217,6 +213,4 @@ public:
 	void battleResultsApplied();
 	friend class Priorities;
 };
-}
-
-#endif // __CGENIUSAI_H__
+}

+ 3 - 6
AI/GeniusAI/Common.h

@@ -1,14 +1,11 @@
-#ifndef __GENIUS_COMMON__
-#define __GENIUS_COMMON__
+#pragma once
 
 #ifdef __GNUC__
 #define strcpy_s(a, b, c) strncpy(a, c, b)
 #endif
 
 #pragma warning (disable: 4100 4244)
-#include "../../AI_Base.h"
+#include "../../lib/AI_Base.h"
 #pragma warning (default: 4100 4244)
 
-void DbgBox(const char *msg, bool messageBox = false);
-
-#endif/*__GENIUS_COMMON__*/
+void DbgBox(const char *msg, bool messageBox = false);

+ 8 - 10
AI/GeniusAI/DLLMain.cpp

@@ -1,40 +1,38 @@
-#pragma warning (disable: 4100 4251 4245 4018 4081)
-#include "../../AI_Base.h"
-#pragma warning (default: 4100 4251 4245 4018 4081)
-
+#include "StdInc.h"
+#include "../../lib/AI_Base.h"
 #include "CGeniusAI.h"
 
 using namespace geniusai;
 
 const char *g_cszAiName = "Genius 1.0";
 
-extern "C" DLL_F_EXPORT int GetGlobalAiVersion()
+extern "C" DLL_EXPORT int GetGlobalAiVersion()
 {
 	return AI_INTERFACE_VER;
 }
 
-extern "C" DLL_F_EXPORT void GetAiName(char* name)
+extern "C" DLL_EXPORT void GetAiName(char* name)
 {
 	strcpy_s(name, strlen(g_cszAiName) + 1, g_cszAiName);
 }
 
-extern "C" DLL_F_EXPORT char* GetAiNameS()
+extern "C" DLL_EXPORT char* GetAiNameS()
 {
 	// need to be defined
 	return NULL;
 }
 
-extern "C" DLL_F_EXPORT CGlobalAI* GetNewAI()
+extern "C" DLL_EXPORT CGlobalAI* GetNewAI()
 {
 	return new CGeniusAI();
 }
 
-extern "C" DLL_F_EXPORT void ReleaseAI(CGlobalAI* i)
+extern "C" DLL_EXPORT void ReleaseAI(CGlobalAI* i)
 {
 	delete (CGeniusAI*)i;
 }
 
-extern "C" DLL_F_EXPORT CBattleGameInterface* GetNewBattleAI()
+extern "C" DLL_EXPORT CBattleGameInterface* GetNewBattleAI()
 {
 	return new CGeniusAI();
 }

+ 2 - 1
AI/GeniusAI/ExpertSystem.cpp

@@ -1,3 +1,4 @@
+#include "StdInc.h"
 #include "GeneralAI.h"
 #include "../../CCallback.h"
 #include "ExpertSystem.h"
@@ -139,4 +140,4 @@ bool BonusCondition::matchesFact(Bonus &fact)
 	if (object(&fact)) //Bonus(fact) matches local Selector(object)
 		return true;
 	return false;
-}
+}

+ 2 - 2
AI/GeniusAI/ExpertSystem.h

@@ -1,4 +1,4 @@
-#include "../../global.h"
+
 #include "../../CCallback.h"
 #include "../../lib/HeroBonus.h"
 #include <boost/bind.hpp>
@@ -101,7 +101,7 @@ public:
 template <typename input, typename output> class Weight : public Rule <input, output>
 {
 public:
-	float multiplier; //multiply input by value and return to output
+	double multiplier; //multiply input by value and return to output
 	void fireTule(){};
 };
 

+ 2 - 0
AI/GeniusAI/GeneralAI.cpp

@@ -1,4 +1,6 @@
+#include "StdInc.h"
 #include "GeneralAI.h"
+
 #include "../../CCallback.h"
 
 using namespace geniusai::GeneralAI;

+ 2 - 5
AI/GeniusAI/GeneralAI.h

@@ -1,5 +1,4 @@
-#ifndef __GENERAL_AI_H__
-#define __GENERAL_AI_H__
+#pragma once
 
 #include "Common.h"
 
@@ -16,6 +15,4 @@ namespace geniusai { namespace GeneralAI {
 		CCallback *m_cb;
 	};
 
-}}
-
-#endif/*__GENERAL_AI_H__*/
+}}

+ 4 - 0
AI/GeniusAI/Makefile.am

@@ -1,7 +1,11 @@
 vcmiaidir = $(VCMI_AI_LIBS_DIR)
+BUILT_SOURCES = StdInc.h.gch
+StdInc.h.gch: StdInc.h
+	$(CXXCOMPILE) -DVCMI_DLL -fPIC -c $<
 
 vcmiai_LTLIBRARIES = libGeniusAI.la
 libGeniusAI_la_LIBADD = $(top_builddir)/lib/libvcmi.la
+libGeniusAI_la_CXXFLAGS = -DVCMI_DLL
 libGeniusAI_la_LDFLAGS = -L$(top_builddir)/lib -module -avoid-version
 libGeniusAI_la_SOURCES = \
 	AIPriorities.cpp \

+ 81 - 16
AI/GeniusAI/Makefile.in

@@ -79,17 +79,18 @@ am__base_list = \
 am__installdirs = "$(DESTDIR)$(vcmiaidir)"
 LTLIBRARIES = $(vcmiai_LTLIBRARIES)
 libGeniusAI_la_DEPENDENCIES = $(top_builddir)/lib/libvcmi.la
-am_libGeniusAI_la_OBJECTS = AIPriorities.lo BattleHelper.lo \
-	BattleLogic.lo CGeniusAI.lo DLLMain.lo GeneralAI.lo \
-	neuralNetwork.lo
+am_libGeniusAI_la_OBJECTS = libGeniusAI_la-AIPriorities.lo \
+	libGeniusAI_la-BattleHelper.lo libGeniusAI_la-BattleLogic.lo \
+	libGeniusAI_la-CGeniusAI.lo libGeniusAI_la-DLLMain.lo \
+	libGeniusAI_la-GeneralAI.lo libGeniusAI_la-neuralNetwork.lo
 libGeniusAI_la_OBJECTS = $(am_libGeniusAI_la_OBJECTS)
 AM_V_lt = $(am__v_lt_$(V))
 am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
 am__v_lt_0 = --silent
 libGeniusAI_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
-	$(AM_CXXFLAGS) $(CXXFLAGS) $(libGeniusAI_la_LDFLAGS) \
-	$(LDFLAGS) -o $@
+	$(libGeniusAI_la_CXXFLAGS) $(CXXFLAGS) \
+	$(libGeniusAI_la_LDFLAGS) $(LDFLAGS) -o $@
 DEFAULT_INCLUDES = -I.@am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -272,8 +273,10 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 vcmiaidir = $(VCMI_AI_LIBS_DIR)
+BUILT_SOURCES = StdInc.h.gch
 vcmiai_LTLIBRARIES = libGeniusAI.la
 libGeniusAI_la_LIBADD = $(top_builddir)/lib/libvcmi.la
+libGeniusAI_la_CXXFLAGS = -DVCMI_DLL
 libGeniusAI_la_LDFLAGS = -L$(top_builddir)/lib -module -avoid-version
 libGeniusAI_la_SOURCES = \
 	AIPriorities.cpp \
@@ -291,7 +294,8 @@ libGeniusAI_la_SOURCES = \
 	neuralNetwork.cpp \
 	neuralNetwork.h
 
-all: all-am
+all: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) all-am
 
 .SUFFIXES:
 .SUFFIXES: .cpp .lo .o .obj
@@ -365,13 +369,13 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AIPriorities.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BattleHelper.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BattleLogic.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CGeniusAI.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DLLMain.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeneralAI.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/neuralNetwork.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libGeniusAI_la-AIPriorities.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libGeniusAI_la-BattleHelper.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libGeniusAI_la-BattleLogic.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libGeniusAI_la-CGeniusAI.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libGeniusAI_la-DLLMain.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libGeniusAI_la-GeneralAI.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libGeniusAI_la-neuralNetwork.Plo@am__quote@
 
 .cpp.o:
 @am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -397,6 +401,62 @@ distclean-compile:
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(LTCXXCOMPILE) -c -o $@ $<
 
+libGeniusAI_la-AIPriorities.lo: AIPriorities.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libGeniusAI_la_CXXFLAGS) $(CXXFLAGS) -MT libGeniusAI_la-AIPriorities.lo -MD -MP -MF $(DEPDIR)/libGeniusAI_la-AIPriorities.Tpo -c -o libGeniusAI_la-AIPriorities.lo `test -f 'AIPriorities.cpp' || echo '$(srcdir)/'`AIPriorities.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libGeniusAI_la-AIPriorities.Tpo $(DEPDIR)/libGeniusAI_la-AIPriorities.Plo
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='AIPriorities.cpp' object='libGeniusAI_la-AIPriorities.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libGeniusAI_la_CXXFLAGS) $(CXXFLAGS) -c -o libGeniusAI_la-AIPriorities.lo `test -f 'AIPriorities.cpp' || echo '$(srcdir)/'`AIPriorities.cpp
+
+libGeniusAI_la-BattleHelper.lo: BattleHelper.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libGeniusAI_la_CXXFLAGS) $(CXXFLAGS) -MT libGeniusAI_la-BattleHelper.lo -MD -MP -MF $(DEPDIR)/libGeniusAI_la-BattleHelper.Tpo -c -o libGeniusAI_la-BattleHelper.lo `test -f 'BattleHelper.cpp' || echo '$(srcdir)/'`BattleHelper.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libGeniusAI_la-BattleHelper.Tpo $(DEPDIR)/libGeniusAI_la-BattleHelper.Plo
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='BattleHelper.cpp' object='libGeniusAI_la-BattleHelper.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libGeniusAI_la_CXXFLAGS) $(CXXFLAGS) -c -o libGeniusAI_la-BattleHelper.lo `test -f 'BattleHelper.cpp' || echo '$(srcdir)/'`BattleHelper.cpp
+
+libGeniusAI_la-BattleLogic.lo: BattleLogic.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libGeniusAI_la_CXXFLAGS) $(CXXFLAGS) -MT libGeniusAI_la-BattleLogic.lo -MD -MP -MF $(DEPDIR)/libGeniusAI_la-BattleLogic.Tpo -c -o libGeniusAI_la-BattleLogic.lo `test -f 'BattleLogic.cpp' || echo '$(srcdir)/'`BattleLogic.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libGeniusAI_la-BattleLogic.Tpo $(DEPDIR)/libGeniusAI_la-BattleLogic.Plo
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='BattleLogic.cpp' object='libGeniusAI_la-BattleLogic.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libGeniusAI_la_CXXFLAGS) $(CXXFLAGS) -c -o libGeniusAI_la-BattleLogic.lo `test -f 'BattleLogic.cpp' || echo '$(srcdir)/'`BattleLogic.cpp
+
+libGeniusAI_la-CGeniusAI.lo: CGeniusAI.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libGeniusAI_la_CXXFLAGS) $(CXXFLAGS) -MT libGeniusAI_la-CGeniusAI.lo -MD -MP -MF $(DEPDIR)/libGeniusAI_la-CGeniusAI.Tpo -c -o libGeniusAI_la-CGeniusAI.lo `test -f 'CGeniusAI.cpp' || echo '$(srcdir)/'`CGeniusAI.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libGeniusAI_la-CGeniusAI.Tpo $(DEPDIR)/libGeniusAI_la-CGeniusAI.Plo
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='CGeniusAI.cpp' object='libGeniusAI_la-CGeniusAI.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libGeniusAI_la_CXXFLAGS) $(CXXFLAGS) -c -o libGeniusAI_la-CGeniusAI.lo `test -f 'CGeniusAI.cpp' || echo '$(srcdir)/'`CGeniusAI.cpp
+
+libGeniusAI_la-DLLMain.lo: DLLMain.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libGeniusAI_la_CXXFLAGS) $(CXXFLAGS) -MT libGeniusAI_la-DLLMain.lo -MD -MP -MF $(DEPDIR)/libGeniusAI_la-DLLMain.Tpo -c -o libGeniusAI_la-DLLMain.lo `test -f 'DLLMain.cpp' || echo '$(srcdir)/'`DLLMain.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libGeniusAI_la-DLLMain.Tpo $(DEPDIR)/libGeniusAI_la-DLLMain.Plo
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='DLLMain.cpp' object='libGeniusAI_la-DLLMain.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libGeniusAI_la_CXXFLAGS) $(CXXFLAGS) -c -o libGeniusAI_la-DLLMain.lo `test -f 'DLLMain.cpp' || echo '$(srcdir)/'`DLLMain.cpp
+
+libGeniusAI_la-GeneralAI.lo: GeneralAI.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libGeniusAI_la_CXXFLAGS) $(CXXFLAGS) -MT libGeniusAI_la-GeneralAI.lo -MD -MP -MF $(DEPDIR)/libGeniusAI_la-GeneralAI.Tpo -c -o libGeniusAI_la-GeneralAI.lo `test -f 'GeneralAI.cpp' || echo '$(srcdir)/'`GeneralAI.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libGeniusAI_la-GeneralAI.Tpo $(DEPDIR)/libGeniusAI_la-GeneralAI.Plo
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='GeneralAI.cpp' object='libGeniusAI_la-GeneralAI.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libGeniusAI_la_CXXFLAGS) $(CXXFLAGS) -c -o libGeniusAI_la-GeneralAI.lo `test -f 'GeneralAI.cpp' || echo '$(srcdir)/'`GeneralAI.cpp
+
+libGeniusAI_la-neuralNetwork.lo: neuralNetwork.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libGeniusAI_la_CXXFLAGS) $(CXXFLAGS) -MT libGeniusAI_la-neuralNetwork.lo -MD -MP -MF $(DEPDIR)/libGeniusAI_la-neuralNetwork.Tpo -c -o libGeniusAI_la-neuralNetwork.lo `test -f 'neuralNetwork.cpp' || echo '$(srcdir)/'`neuralNetwork.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libGeniusAI_la-neuralNetwork.Tpo $(DEPDIR)/libGeniusAI_la-neuralNetwork.Plo
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='neuralNetwork.cpp' object='libGeniusAI_la-neuralNetwork.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libGeniusAI_la_CXXFLAGS) $(CXXFLAGS) -c -o libGeniusAI_la-neuralNetwork.lo `test -f 'neuralNetwork.cpp' || echo '$(srcdir)/'`neuralNetwork.cpp
+
 mostlyclean-libtool:
 	-rm -f *.lo
 
@@ -486,13 +546,15 @@ distdir: $(DISTFILES)
 	  fi; \
 	done
 check-am: all-am
-check: check-am
+check: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) check-am
 all-am: Makefile $(LTLIBRARIES)
 installdirs:
 	for dir in "$(DESTDIR)$(vcmiaidir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
-install: install-am
+install: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) install-am
 install-exec: install-exec-am
 install-data: install-data-am
 uninstall: uninstall-am
@@ -517,6 +579,7 @@ distclean-generic:
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
+	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
 clean: clean-am
 
 clean-am: clean-generic clean-libtool clean-vcmiaiLTLIBRARIES \
@@ -588,7 +651,7 @@ ps-am:
 
 uninstall-am: uninstall-vcmiaiLTLIBRARIES
 
-.MAKE: install-am install-strip
+.MAKE: all check install install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
 	clean-libtool clean-vcmiaiLTLIBRARIES ctags distclean \
@@ -604,6 +667,8 @@ uninstall-am: uninstall-vcmiaiLTLIBRARIES
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags uninstall uninstall-am uninstall-vcmiaiLTLIBRARIES
 
+StdInc.h.gch: StdInc.h
+	$(CXXCOMPILE) -DVCMI_DLL -fPIC -c $<
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.

+ 8 - 2
AI/GeniusAI/genius.vcxproj

@@ -107,11 +107,11 @@
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <PrecompiledHeader>
-      </PrecompiledHeader>
+      <PrecompiledHeader>Use</PrecompiledHeader>
       <WarningLevel>Level4</WarningLevel>
       <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
       <DisableSpecificWarnings>4512;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <PrecompiledHeaderFile>StdInc.h</PrecompiledHeaderFile>
     </ClCompile>
     <Link>
       <AdditionalDependencies>VCMI_lib.lib;%(AdditionalDependencies)</AdditionalDependencies>
@@ -216,6 +216,11 @@
     <ClCompile Include="CGeniusAI.cpp" />
     <ClCompile Include="DLLMain.cpp" />
     <ClCompile Include="neuralNetwork.cpp" />
+    <ClCompile Include="StdInc.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">StdInc.h</PrecompiledHeaderFile>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="BattleHelper.h" />
@@ -225,6 +230,7 @@
     <ClInclude Include="CGeniusAI.h" />
     <ClInclude Include="Common.h" />
     <ClInclude Include="neuralNetwork.h" />
+    <ClInclude Include="StdInc.h" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\..\lib\VCMI_lib.vcxproj">

+ 8 - 9
AI/GeniusAI/neuralNetwork.cpp

@@ -1,5 +1,4 @@
-#include <stdlib.h>
-#include <string.h>
+#include "StdInc.h"
 
 #include "neuralNetwork.h"
 //using namespace std;
@@ -8,18 +7,18 @@
 #define M_PI       3.14159265358979323846
 #endif
 
-static float norm(void)//add desired mean, multiply to get desired SD
+static double norm(void)//add desired mean, multiply to get desired SD
 {
-	static float kept = 0;
+	static double kept = 0;
 	static bool in = 0;
 	if(!in)
 	{
-		float x = (rand()+1)/float(RAND_MAX+1); 
-		float f = sqrtf( - 2.0f * log(x) );
-			  x = (rand()+1)/float(RAND_MAX+1);
-		kept = f * cosf( 2.0f * M_PI * x );
+		double x = (rand() + 1) / static_cast<double>(RAND_MAX + 1); 
+		double f = sqrtf( - 2.0 * log(x) );
+			  x = (rand() + 1) / static_cast<double>(RAND_MAX + 1);
+		kept = f * cosf( 2.0 * M_PI * x );
 		in = true;
-		return f * sinf( 2.0f * M_PI * x );
+		return f * sinf( 2.0 * M_PI * x );
 	}
 	else
 	{

+ 2 - 8
AI/GeniusAI/neuralNetwork.h

@@ -8,13 +8,8 @@
 * Bobby Anguelov - takinginitiative.wordpress.com (2008)
 * MSN & email: [email protected]
 ********************************************************************/
-#ifndef NEURAL_NETWORK_H
-#define NEURAL_NETWORK_H
+#pragma once
 //standard includes
-#include <iostream>
-#include <vector>
-#include <fstream>
-#include <cmath>
 #include <limits>
 
 
@@ -63,5 +58,4 @@ private:
 };
 
 std::istream & operator >> (std::istream &, neuralNetwork & ann);
-std::ostream & operator << (std::ostream &, const neuralNetwork & ann);
-#endif
+std::ostream & operator << (std::ostream &, const neuralNetwork & ann);

+ 4 - 3
AI/StupidAI/Makefile.am

@@ -1,12 +1,13 @@
 vcmiaidir = $(VCMI_AI_LIBS_DIR)
+BUILT_SOURCES = StdInc.h.gch
+StdInc.h.gch: StdInc.h
+	$(CXXCOMPILE) -DVCMI_DLL -fPIC -c $<
 
 vcmiai_LTLIBRARIES = libStupidAI.la
 libStupidAI_la_LIBADD = $(top_builddir)/lib/libvcmi.la
+libStupidAI_la_CXXFLAGS = -DVCMI_DLL
 libStupidAI_la_LDFLAGS = -L$(top_builddir)/lib -module -avoid-version
 libStupidAI_la_SOURCES = \
 	main.cpp\
-	stdafx.cpp\
-	stdafx.h\
 	StupidAI.cpp\
 	StupidAI.h
-

+ 34 - 12
AI/StupidAI/Makefile.in

@@ -79,15 +79,16 @@ am__base_list = \
 am__installdirs = "$(DESTDIR)$(vcmiaidir)"
 LTLIBRARIES = $(vcmiai_LTLIBRARIES)
 libStupidAI_la_DEPENDENCIES = $(top_builddir)/lib/libvcmi.la
-am_libStupidAI_la_OBJECTS = main.lo stdafx.lo StupidAI.lo
+am_libStupidAI_la_OBJECTS = libStupidAI_la-main.lo \
+	libStupidAI_la-StupidAI.lo
 libStupidAI_la_OBJECTS = $(am_libStupidAI_la_OBJECTS)
 AM_V_lt = $(am__v_lt_$(V))
 am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
 am__v_lt_0 = --silent
 libStupidAI_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
-	$(AM_CXXFLAGS) $(CXXFLAGS) $(libStupidAI_la_LDFLAGS) \
-	$(LDFLAGS) -o $@
+	$(libStupidAI_la_CXXFLAGS) $(CXXFLAGS) \
+	$(libStupidAI_la_LDFLAGS) $(LDFLAGS) -o $@
 DEFAULT_INCLUDES = -I.@am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -270,17 +271,18 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 vcmiaidir = $(VCMI_AI_LIBS_DIR)
+BUILT_SOURCES = StdInc.h.gch
 vcmiai_LTLIBRARIES = libStupidAI.la
 libStupidAI_la_LIBADD = $(top_builddir)/lib/libvcmi.la
+libStupidAI_la_CXXFLAGS = -DVCMI_DLL
 libStupidAI_la_LDFLAGS = -L$(top_builddir)/lib -module -avoid-version
 libStupidAI_la_SOURCES = \
 	main.cpp\
-	stdafx.cpp\
-	stdafx.h\
 	StupidAI.cpp\
 	StupidAI.h
 
-all: all-am
+all: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) all-am
 
 .SUFFIXES:
 .SUFFIXES: .cpp .lo .o .obj
@@ -354,9 +356,8 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StupidAI.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stdafx.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libStupidAI_la-StupidAI.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libStupidAI_la-main.Plo@am__quote@
 
 .cpp.o:
 @am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -382,6 +383,22 @@ distclean-compile:
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(LTCXXCOMPILE) -c -o $@ $<
 
+libStupidAI_la-main.lo: main.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libStupidAI_la_CXXFLAGS) $(CXXFLAGS) -MT libStupidAI_la-main.lo -MD -MP -MF $(DEPDIR)/libStupidAI_la-main.Tpo -c -o libStupidAI_la-main.lo `test -f 'main.cpp' || echo '$(srcdir)/'`main.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libStupidAI_la-main.Tpo $(DEPDIR)/libStupidAI_la-main.Plo
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='main.cpp' object='libStupidAI_la-main.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libStupidAI_la_CXXFLAGS) $(CXXFLAGS) -c -o libStupidAI_la-main.lo `test -f 'main.cpp' || echo '$(srcdir)/'`main.cpp
+
+libStupidAI_la-StupidAI.lo: StupidAI.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libStupidAI_la_CXXFLAGS) $(CXXFLAGS) -MT libStupidAI_la-StupidAI.lo -MD -MP -MF $(DEPDIR)/libStupidAI_la-StupidAI.Tpo -c -o libStupidAI_la-StupidAI.lo `test -f 'StupidAI.cpp' || echo '$(srcdir)/'`StupidAI.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libStupidAI_la-StupidAI.Tpo $(DEPDIR)/libStupidAI_la-StupidAI.Plo
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='StupidAI.cpp' object='libStupidAI_la-StupidAI.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libStupidAI_la_CXXFLAGS) $(CXXFLAGS) -c -o libStupidAI_la-StupidAI.lo `test -f 'StupidAI.cpp' || echo '$(srcdir)/'`StupidAI.cpp
+
 mostlyclean-libtool:
 	-rm -f *.lo
 
@@ -471,13 +488,15 @@ distdir: $(DISTFILES)
 	  fi; \
 	done
 check-am: all-am
-check: check-am
+check: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) check-am
 all-am: Makefile $(LTLIBRARIES)
 installdirs:
 	for dir in "$(DESTDIR)$(vcmiaidir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
-install: install-am
+install: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) install-am
 install-exec: install-exec-am
 install-data: install-data-am
 uninstall: uninstall-am
@@ -502,6 +521,7 @@ distclean-generic:
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
+	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
 clean: clean-am
 
 clean-am: clean-generic clean-libtool clean-vcmiaiLTLIBRARIES \
@@ -573,7 +593,7 @@ ps-am:
 
 uninstall-am: uninstall-vcmiaiLTLIBRARIES
 
-.MAKE: install-am install-strip
+.MAKE: all check install install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
 	clean-libtool clean-vcmiaiLTLIBRARIES ctags distclean \
@@ -589,6 +609,8 @@ uninstall-am: uninstall-vcmiaiLTLIBRARIES
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags uninstall uninstall-am uninstall-vcmiaiLTLIBRARIES
 
+StdInc.h.gch: StdInc.h
+	$(CXXCOMPILE) -DVCMI_DLL -fPIC -c $<
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.

+ 16 - 19
AI/StupidAI/StupidAI.cpp

@@ -1,12 +1,9 @@
-#include "stdafx.h"
+#include "StdInc.h"
+#include "../../lib/AI_Base.h"
 #include "StupidAI.h"
 #include "../../lib/BattleState.h"
 #include "../../CCallback.h"
-#include <boost/foreach.hpp>
-#include <boost/bind.hpp>
 #include "../../lib/CCreatureHandler.h"
-#include <algorithm>
-//#include <boost/thread.hpp>
 
 CBattleCallback * cbc;
 
@@ -42,7 +39,7 @@ struct EnemyInfo
 {
 	const CStack * s;
 	int adi, adr;
-	std::vector<THex> attackFrom; //for melee fight
+	std::vector<SHexField> attackFrom; //for melee fight
 	EnemyInfo(const CStack * _s) : s(_s)
 	{}
 	void calcDmg(const CStack * ourStack)
@@ -63,10 +60,10 @@ bool isMoreProfitable(const EnemyInfo &ei1, const EnemyInfo& ei2)
 	return (ei1.adi-ei1.adr) < (ei2.adi - ei2.adr);
 }
 
-int distToNearestNeighbour(THex hex, const std::vector<int> & dists, THex *chosenHex = NULL)
+int distToNearestNeighbour(SHexField hex, const std::vector<int> & dists, SHexField *chosenHex = NULL)
 {
 	int ret = 1000000;
-	BOOST_FOREACH(THex n, hex.neighbouringTiles())
+	BOOST_FOREACH(SHexField n, hex.neighbouringTiles())
 	{
 		if(dists[n] >= 0 && dists[n] < ret)
 		{
@@ -84,12 +81,12 @@ bool isCloser(const EnemyInfo & ei1, const EnemyInfo & ei2, const std::vector<in
 	return distToNearestNeighbour(ei1.s->position, dists) < distToNearestNeighbour(ei2.s->position, dists);
 }
 
-static bool willSecondHexBlockMoreEnemyShooters(const THex &h1, const THex &h2)
+static bool willSecondHexBlockMoreEnemyShooters(const SHexField &h1, const SHexField &h2)
 {
 	int shooters[2] = {0}; //count of shooters on hexes
 
 	for(int i = 0; i < 2; i++)
-		BOOST_FOREACH(THex neighbour, (i ? h2 : h1).neighbouringTiles())
+		BOOST_FOREACH(SHexField neighbour, (i ? h2 : h1).neighbouringTiles())
 			if(const CStack *s = cbc->battleGetStackByPos(neighbour))
 				if(s->getCreature()->isShooting())
 						shooters[i]++;
@@ -101,7 +98,7 @@ BattleAction CStupidAI::activeStack( const CStack * stack )
 {
 	//boost::this_thread::sleep(boost::posix_time::seconds(2));
 	print("activeStack called");
-	std::vector<THex> avHexes = cb->battleGetAvailableHexes(stack, false);
+	std::vector<SHexField> avHexes = cb->battleGetAvailableHexes(stack, false);
 	std::vector<int> dists = cb->battleGetDistances(stack);
 	std::vector<EnemyInfo> enemiesShootable, enemiesReachable, enemiesUnreachable;
 
@@ -113,7 +110,7 @@ BattleAction CStupidAI::activeStack( const CStack * stack )
 		}
 		else
 		{
-			BOOST_FOREACH(THex hex, avHexes)
+			BOOST_FOREACH(SHexField hex, avHexes)
 			{
 				if(CStack::isMeleeAttackPossible(stack, s, hex))
 				{
@@ -146,7 +143,7 @@ BattleAction CStupidAI::activeStack( const CStack * stack )
 	else
 	{
 		const EnemyInfo &ei= *std::min_element(enemiesUnreachable.begin(), enemiesUnreachable.end(), boost::bind(isCloser, _1, _2, boost::ref(dists)));
-		if(distToNearestNeighbour(ei.s->position, dists) < BFIELD_SIZE)
+		if(distToNearestNeighbour(ei.s->position, dists) < GameConstants::BFIELD_SIZE)
 		{
 			return goTowards(stack, ei.s->position);
 		}
@@ -185,7 +182,7 @@ void CStupidAI::battleNewRound(int round)
 	print("battleNewRound called");
 }
 
-void CStupidAI::battleStackMoved(const CStack * stack, std::vector<THex> dest, int distance) 
+void CStupidAI::battleStackMoved(const CStack * stack, std::vector<SHexField> dest, int distance) 
 {
 	print("battleStackMoved called");;
 }
@@ -236,19 +233,19 @@ void CStupidAI::print(const std::string &text) const
 	tlog0 << "CStupidAI [" << this <<"]: " << text << std::endl;
 }
 
-BattleAction CStupidAI::goTowards(const CStack * stack, THex hex)
+BattleAction CStupidAI::goTowards(const CStack * stack, SHexField hex)
 {
-	THex realDest = hex;
-	THex predecessors[BFIELD_SIZE];
+	SHexField realDest = hex;
+	SHexField predecessors[GameConstants::BFIELD_SIZE];
 	std::vector<int> dists = cb->battleGetDistances(stack, hex);
-	if(distToNearestNeighbour(hex, dists, &realDest) > BFIELD_SIZE)
+	if(distToNearestNeighbour(hex, dists, &realDest) > GameConstants::BFIELD_SIZE)
 	{
 		print("goTowards: Cannot reach");
 		return BattleAction::makeDefend(stack);
 	}
 
 	dists = cb->battleGetDistances(stack, realDest, predecessors);
-	std::vector<THex> avHexes = cb->battleGetAvailableHexes(stack, false);
+	std::vector<SHexField> avHexes = cb->battleGetAvailableHexes(stack, false);
 
 	if(!avHexes.size())
 	{

+ 4 - 2
AI/StupidAI/StupidAI.h

@@ -1,5 +1,7 @@
 #pragma once
 
+#include "../../lib/SHexField.h"
+
 class CStupidAI : public CBattleGameInterface
 {
 	int side;
@@ -21,7 +23,7 @@ public:
 	//void battleResultsApplied() OVERRIDE; //called when all effects of last battle are applied
 	void battleNewRoundFirst(int round) OVERRIDE; //called at the beginning of each turn before changes are applied;
 	void battleNewRound(int round) OVERRIDE; //called at the beggining of each turn, round=-1 is the tactic phase, round=0 is the first "normal" turn
-	void battleStackMoved(const CStack * stack, std::vector<THex> dest, int distance) OVERRIDE;
+	void battleStackMoved(const CStack * stack, std::vector<SHexField> dest, int distance) OVERRIDE;
 	void battleSpellCast(const BattleSpellCast *sc) OVERRIDE;
 	void battleStacksEffectsSet(const SetStackEffect & sse) OVERRIDE;//called when a specific effect is set to stacks
 	//void battleTriggerEffect(const BattleTriggerEffect & bte) OVERRIDE;
@@ -32,6 +34,6 @@ public:
 	void battleCatapultAttacked(const CatapultAttack & ca) OVERRIDE; //called when catapult makes an attack
 	void battleStacksRemoved(const BattleStacksRemoved & bsr) OVERRIDE; //called when certain stack is completely removed from battlefield
 
-	BattleAction goTowards(const CStack * stack, THex hex );
+	BattleAction goTowards(const CStack * stack, SHexField hex );
 };
 

+ 6 - 6
AI/StupidAI/StupidAI.vcxproj

@@ -91,7 +91,8 @@
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
+      <PrecompiledHeaderFile>StdInc.h</PrecompiledHeaderFile>
+      <PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -155,16 +156,15 @@
   </ItemDefinitionGroup>
   <ItemGroup>
     <ClCompile Include="main.cpp" />
-    <ClCompile Include="stdafx.cpp">
+    <ClCompile Include="StdInc.cpp">
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='RD|Win32'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='RD|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">StdInc.h</PrecompiledHeaderFile>
     </ClCompile>
     <ClCompile Include="StupidAI.cpp" />
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="stdafx.h" />
+    <ClInclude Include="StdInc.h" />
     <ClInclude Include="StupidAI.h" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

+ 8 - 7
AI/StupidAI/main.cpp

@@ -1,6 +1,7 @@
-#include "stdafx.h"
+#include "StdInc.h"
+
+#include "../../lib/AI_Base.h"
 #include "StupidAI.h"
-#include <cstring>
 
 #ifdef __GNUC__
 #define strcpy_s(a, b, c) strncpy(a, c, b)
@@ -8,28 +9,28 @@
 
 const char *g_cszAiName = "Stupid AI 0.1";
 
-extern "C" DLL_F_EXPORT int GetGlobalAiVersion()
+extern "C" DLL_EXPORT int GetGlobalAiVersion()
 {
 	return AI_INTERFACE_VER;
 }
 
-extern "C" DLL_F_EXPORT void GetAiName(char* name)
+extern "C" DLL_EXPORT void GetAiName(char* name)
 {
 	strcpy_s(name, strlen(g_cszAiName) + 1, g_cszAiName);
 }
 
-extern "C" DLL_F_EXPORT char* GetAiNameS()
+extern "C" DLL_EXPORT char* GetAiNameS()
 {
 	// need to be defined
 	return NULL;
 }
 
-extern "C" DLL_F_EXPORT CBattleGameInterface* GetNewBattleAI()
+extern "C" DLL_EXPORT CBattleGameInterface* GetNewBattleAI()
 {
 	return new CStupidAI();
 }
 
-extern "C" DLL_F_EXPORT void ReleaseBattleAI(CBattleGameInterface* i)
+extern "C" DLL_EXPORT void ReleaseBattleAI(CBattleGameInterface* i)
 {
 	delete (CStupidAI*)i;
 }

+ 4 - 5
CCallback.cpp

@@ -1,5 +1,6 @@
-#include "stdafx.h"
+#include "StdInc.h"
 #include "CCallback.h"
+
 #include "lib/CCreatureHandler.h"
 #include "client/CGameInfo.h"
 #include "lib/CGameState.h"
@@ -15,11 +16,9 @@
 #include "lib/Connection.h"
 #include "lib/NetPacks.h"
 #include "client/mapHandler.h"
-#include <boost/foreach.hpp>
-#include <boost/thread.hpp>
-#include <boost/thread/shared_mutex.hpp>
 #include "lib/CSpellHandler.h"
 #include "lib/CArtHandler.h"
+#include "lib/GameConstants.h"
 #ifdef min
 #undef min
 #endif
@@ -247,7 +246,7 @@ void CCallback::setSelection(const CArmedInstance * obj)
 	ss.id = obj->id;
 	sendRequest(&(CPackForClient&)ss);
 
-	if(obj->ID == HEROI_TYPE)
+	if(obj->ID == GameConstants::HEROI_TYPE)
 	{
 		if(cl->pathInfo->hero != obj) //calculate new paths only if we selected a different hero
 			cl->calculatePaths(static_cast<const CGHeroInstance *>(obj));

+ 2 - 13
CCallback.h

@@ -1,14 +1,5 @@
-#ifndef __CCALLBACK_H__
-#define __CCALLBACK_H__
-
-#include "global.h"
-#ifdef _WIN32
-#include "tchar.h"
-#else
-#include "tchar_amigaos4.h" //XXX this is mingw header are we need this for something? for 'true'
-//support of unicode we should use ICU or some boost wraper areound it
-//(boost using this lib during compilation i dont know what for exactly)
-#endif
+#pragma once
+
 
 #include "lib/IGameCallback.h"
 
@@ -148,5 +139,3 @@ public:
 //friends
 	friend class CClient;
 };
-
-#endif // __CCALLBACK_H__

+ 7 - 2
Scripting/ERM/ERM.vcxproj

@@ -90,8 +90,8 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PrecompiledHeader>NotUsing</PrecompiledHeader>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <PrecompiledHeaderFile>StdInc.h</PrecompiledHeaderFile>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -132,11 +132,16 @@
     <ClInclude Include="ERMInterpreter.h" />
     <ClInclude Include="ERMParser.h" />
     <ClInclude Include="ERMScriptModule.h" />
+    <ClInclude Include="StdInc.h" />
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="ERMInterpreter.cpp" />
     <ClCompile Include="ERMParser.cpp" />
     <ClCompile Include="ERMScriptModule.cpp" />
+    <ClCompile Include="StdInc.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">StdInc.h</PrecompiledHeaderFile>
+    </ClCompile>
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">

+ 7 - 13
Scripting/ERM/ERMInterpreter.cpp

@@ -1,13 +1,7 @@
+#include "StdInc.h"
 #include "ERMInterpreter.h"
-#include <cctype>
-#include <boost/filesystem.hpp>
-#include <boost/algorithm/string.hpp>
-#include <boost/foreach.hpp>
-#include <boost/lexical_cast.hpp>
-#include <boost/assign/std/vector.hpp> // for 'operator+=()'
-#include <boost/assign/std/vector.hpp> 
-#include <boost/assign/list_of.hpp>
 
+#include <cctype>
 #include "../../lib/CObjectHandler.h"
 #include "../../lib/CHeroHandler.h"
 #include "../../lib/CCreatureHandler.h"
@@ -372,13 +366,13 @@ void ERMInterpreter::scanForScripts()
 {
 	using namespace boost::filesystem;
 	//parser checking
-	if(!exists(DATA_DIR "/Data/s/"))
+	if(!exists(GameConstants::DATA_DIR + "/Data/s/"))
 	{
-		tlog3 << "Warning: Folder " DATA_DIR "/Data/s/ doesn't exist!\n";
+		tlog3 << "Warning: Folder " << GameConstants::DATA_DIR << "/Data/s/ doesn't exist!\n";
 		return;
 	}
 	directory_iterator enddir;
-	for (directory_iterator dir(DATA_DIR "/Data/s"); dir!=enddir; dir++)
+	for (directory_iterator dir(GameConstants::DATA_DIR + "/Data/s"); dir!=enddir; dir++)
 	{
 		if(is_regular(dir->status()))
 		{
@@ -2293,7 +2287,7 @@ void IexpValStr::setTo( int val )
 	}
 }
 
-void IexpValStr::setTo( float val )
+void IexpValStr::setTo( double val )
 {
 	DBG_PRINT("setting " << getName() << " to " << val);
 	switch(type)
@@ -2337,7 +2331,7 @@ int IexpValStr::getInt() const
 	}
 }
 
-float IexpValStr::getFloat() const
+double IexpValStr::getFloat() const
 {
 	switch(type)
 	{

+ 6 - 5
Scripting/ERM/ERMInterpreter.h

@@ -1,5 +1,6 @@
 #pragma once
-#include "../../global.h"
+
+
 #include "ERMParser.h"
 #include "ERMScriptModule.h"
 
@@ -135,7 +136,7 @@ namespace VERMInterpreter
 		static const int NUM_LOCALS = 100;
 		static const int NUM_STRINGS = 10;
 		static const int NUM_FLOATINGS = 100;
-
+		
 		int & getParam(int num);
 		int & getLocal(int num);
 		std::string & getString(int num);
@@ -621,10 +622,10 @@ public:
 	enum {WRONGVAL, INT, INTVAR, FLOATVAR, STRINGVAR} type;
 	void setTo(const IexpValStr & second);
 	void setTo(int val);
-	void setTo(float val);
+	void setTo(double val);
 	void setTo(const std::string & val);
 	int getInt() const;
-	float getFloat() const;
+	double getFloat() const;
 	std::string getString() const;
 
 	IexpValStr() : type(WRONGVAL)
@@ -796,7 +797,7 @@ class ERMInterpreter : public CScriptingModule
 	VERMInterpreter::Trigger * curTrigger;
 	VERMInterpreter::FunctionLocalVars * curFunc;
 	static const int TRIG_FUNC_NUM = 30000;
-	VERMInterpreter::FunctionLocalVars funcVars[TRIG_FUNC_NUM+1]; //+1 because we use [0] as a global set of y-vars
+	VERMInterpreter::FunctionLocalVars funcVars[TRIG_FUNC_NUM + 1]; //+1 because we use [0] as a global set of y-vars
 	VERMInterpreter::FunctionLocalVars * getFuncVars(int funNum); //0 is a global func-like set
 
 	IexpValStr getIexp(const ERM::TIexp & iexp) const;

+ 2 - 3
Scripting/ERM/ERMParser.cpp

@@ -1,19 +1,18 @@
+#include "StdInc.h"
 #include "ERMParser.h"
+
 #include <boost/version.hpp>
 //To make compilation with older boost versions possible
 //Don't know exact version - 1.46 works while 1.42 not
 #if BOOST_VERSION >= 104600
 
 #include <boost/spirit/include/qi.hpp>
-#include <boost/bind.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 #include <boost/spirit/include/phoenix_fusion.hpp>
 #include <boost/spirit/include/phoenix_stl.hpp>
 #include <boost/spirit/include/phoenix_object.hpp>
 #include <boost/fusion/include/adapt_struct.hpp>
-#include <fstream>
-#include <boost/algorithm/string/trim.hpp>
 
 namespace spirit = boost::spirit;
 namespace qi = boost::spirit::qi;

+ 2 - 2
Scripting/ERM/ERMParser.h

@@ -1,6 +1,6 @@
 #pragma once
-#include "../../global.h"
-#include <fstream>
+
+
 #include <boost/variant.hpp>
 #include <boost/optional.hpp>
 #include <boost/spirit/home/support/unused.hpp>

+ 4 - 2
Scripting/ERM/ERMScriptModule.cpp

@@ -1,4 +1,6 @@
+#include "StdInc.h"
 #include "ERMScriptModule.h"
+
 #include "ERMInterpreter.h"
 
 /*
@@ -21,12 +23,12 @@ CPrivilagedInfoCallback *icb;
 
 const char *g_cszAiName = "(V)ERM interpreter";
 
-extern "C" DLL_F_EXPORT void GetAiName(char* name)
+extern "C" DLL_EXPORT void GetAiName(char* name)
 {
 	strcpy_s(name, strlen(g_cszAiName) + 1, g_cszAiName);
 }
 
-extern "C" DLL_F_EXPORT CScriptingModule* GetNewModule()
+extern "C" DLL_EXPORT CScriptingModule* GetNewModule()
 {
 	return new ERMInterpreter();
 }

+ 4 - 1
Scripting/ERM/Makefile.am

@@ -1,8 +1,11 @@
 vcmiscriptingdir = $(VCMI_SCRIPTING_LIBS_DIR)
+BUILT_SOURCES = StdInc.h.gch
+StdInc.h.gch: StdInc.h
+	$(CXXCOMPILE) -DVCMI_DLL -fPIC -c $<
 
 vcmiscripting_LTLIBRARIES = libvcmiERM.la
 libvcmiERM_la_LIBADD = @BOOST_SYSTEM_LIB@ @BOOST_FILESYSTEM_LIB@ @BOOST_THREAD_LIB@ @BOOST_IOSTREAMS_LIB@
-libvcmiERM_la_CXXFLAGS =
+libvcmiERM_la_CXXFLAGS = -DVCMI_DLL
 libvcmiERM_la_SOURCES = \
 	ERMInterpreter.cpp \
 	ERMInterpreter.h \

+ 12 - 5
Scripting/ERM/Makefile.in

@@ -271,9 +271,10 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 vcmiscriptingdir = $(VCMI_SCRIPTING_LIBS_DIR)
+BUILT_SOURCES = StdInc.h.gch
 vcmiscripting_LTLIBRARIES = libvcmiERM.la
 libvcmiERM_la_LIBADD = @BOOST_SYSTEM_LIB@ @BOOST_FILESYSTEM_LIB@ @BOOST_THREAD_LIB@ @BOOST_IOSTREAMS_LIB@
-libvcmiERM_la_CXXFLAGS = 
+libvcmiERM_la_CXXFLAGS = -DVCMI_DLL
 libvcmiERM_la_SOURCES = \
 	ERMInterpreter.cpp \
 	ERMInterpreter.h \
@@ -282,7 +283,8 @@ libvcmiERM_la_SOURCES = \
 	ERMScriptModule.cpp \
 	ERMScriptModule.h
 
-all: all-am
+all: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) all-am
 
 .SUFFIXES:
 .SUFFIXES: .cpp .lo .o .obj
@@ -497,13 +499,15 @@ distdir: $(DISTFILES)
 	  fi; \
 	done
 check-am: all-am
-check: check-am
+check: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) check-am
 all-am: Makefile $(LTLIBRARIES)
 installdirs:
 	for dir in "$(DESTDIR)$(vcmiscriptingdir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
-install: install-am
+install: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) install-am
 install-exec: install-exec-am
 install-data: install-data-am
 uninstall: uninstall-am
@@ -528,6 +532,7 @@ distclean-generic:
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
+	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
 clean: clean-am
 
 clean-am: clean-generic clean-libtool clean-vcmiscriptingLTLIBRARIES \
@@ -599,7 +604,7 @@ ps-am:
 
 uninstall-am: uninstall-vcmiscriptingLTLIBRARIES
 
-.MAKE: install-am install-strip
+.MAKE: all check install install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
 	clean-libtool clean-vcmiscriptingLTLIBRARIES ctags distclean \
@@ -615,6 +620,8 @@ uninstall-am: uninstall-vcmiscriptingLTLIBRARIES
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags uninstall uninstall-am uninstall-vcmiscriptingLTLIBRARIES
 
+StdInc.h.gch: StdInc.h
+	$(CXXCOMPILE) -DVCMI_DLL -fPIC -c $<
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.

+ 2 - 2
VCMI_global.props

@@ -4,8 +4,8 @@
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup>
     <_PropertySheetDisplayName>VCMI_global</_PropertySheetDisplayName>
-    <LibraryPath>$(SolutionDir)..\libs\$(PlatformShortName);$(LibraryPath)</LibraryPath>
-    <IncludePath>$(SolutionDir)..\include;$(IncludePath)</IncludePath>
+    <LibraryPath>D:\Programme\Boost\boost_1_48_0\stage\lib;$(SolutionDir)..\libs\$(PlatformShortName);$(LibraryPath)</LibraryPath>
+    <IncludePath>D:\Programme\Boost\boost_1_48_0;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
   </PropertyGroup>
   <ItemDefinitionGroup>
     <Link>

+ 2 - 2
aclocal.m4

@@ -13,8 +13,8 @@
 
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],,
-[m4_warning([this file was generated for autoconf 2.67.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.66],,
+[m4_warning([this file was generated for autoconf 2.66.
 You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically `autoreconf'.])])

+ 16 - 17
client/AdventureMapButton.cpp

@@ -1,14 +1,13 @@
+#include "StdInc.h"
 #include "AdventureMapButton.h"
+
 #include "CAnimation.h"
-//#include "CAdvmapInterface.h"
 #include "SDL_Extensions.h"
 #include "CGameInfo.h"
-//#include "../lib/CGeneralTextHandler.h"
-//#include "../lib/CTownHandler.h"
 #include "../CCallback.h"
 #include "CConfigHandler.h"
-//#include "Graphics.h"
-#include "CBattleInterface.h"
+#include "BattleInterface/CBattleInterface.h"
+#include "BattleInterface/CBattleConsole.h"
 #include "CPlayerInterface.h"
 #include "CMessage.h"
 #include "CMusicHandler.h"
@@ -444,7 +443,7 @@ void CSlider::sliderClicked()
 
 void CSlider::mouseMoved (const SDL_MouseMotionEvent & sEvent)
 {
-	float v = 0;
+	double v = 0;
 	if(horizontal)
 	{
 		if(	std::abs(sEvent.y-(pos.y+pos.h/2)) > pos.h/2+40  ||  std::abs(sEvent.x-(pos.x+pos.w/2)) > pos.w/2  ) 
@@ -461,7 +460,7 @@ void CSlider::mouseMoved (const SDL_MouseMotionEvent & sEvent)
 		v *= positions;
 		v /= (pos.h - 48);
 	}
-	v += 0.5f;
+	v += 0.5;
 	if(v!=value)
 	{
 		moveTo(v);
@@ -486,8 +485,8 @@ void CSlider::moveRight()
 
 void CSlider::moveTo(int to)
 {
-	amax(to, 0);
-	amin(to, positions);
+	vstd::amax(to, 0);
+	vstd::amin(to, positions);
 
 	//same, old position?
 	if(value == to)
@@ -498,7 +497,7 @@ void CSlider::moveTo(int to)
 	{
 		if(positions)
 		{
-			float part = (float)to/positions;
+			double part = static_cast<double>(to) / positions;
 			part*=(pos.w-48);
 			int newPos = part + pos.x + 16 - slider->pos.x;
 			slider->moveBy(Point(newPos, 0));
@@ -510,7 +509,7 @@ void CSlider::moveTo(int to)
 	{
 		if(positions)
 		{
-			float part = (float)to/positions;
+			double part = static_cast<double>(to) / positions;
 			part*=(pos.h-48);
 			int newPos = part + pos.y + 16 - slider->pos.y;
 			slider->moveBy(Point(0, newPos));
@@ -527,24 +526,24 @@ void CSlider::clickLeft(tribool down, bool previousState)
 {
 	if(down && !slider->isBlocked())
 	{
-		float pw = 0;
-		float rw = 0;
+		double pw = 0;
+		double rw = 0;
 		if(horizontal)
 		{
 			pw = GH.current->motion.x-pos.x-25;
-			rw = pw / ((float)(pos.w-48));
+			rw = pw / static_cast<double>(pos.w - 48);
 		}
 		else
 		{
 			pw = GH.current->motion.y-pos.y-24;
-			rw = pw / ((float)(pos.h-48));
+			rw = pw / (pos.h-48);
 		}
 		if(pw < -8  ||  pw > (horizontal ? pos.w : pos.h) - 40)
 			return;
 // 		if (rw>1) return;
 // 		if (rw<0) return;
 		slider->clickLeft(true, slider->pressedL);
-		moveTo(rw * positions  +  0.5f);
+		moveTo(rw * positions  +  0.5);
 		return;
 	}
 	if(active & MOVE)
@@ -645,7 +644,7 @@ void CSlider::setAmount( int to )
 {
 	amount = to;
 	positions = to - capacity;
-	amax(positions, 0);
+	vstd::amax(positions, 0);
 }
 
 void CSlider::showAll(SDL_Surface * to)

+ 2 - 6
client/AdventureMapButton.h

@@ -1,8 +1,6 @@
-#ifndef __ADVENTUREMAPBUTTON_H__
-#define __ADVENTUREMAPBUTTON_H__
+#pragma once
 
 #include "FunctionList.h"
-#include <boost/bind.hpp>
 #include "GUIBase.h"
 
 /*
@@ -163,6 +161,4 @@ public:
 		int Value=0, bool Horizontal=true, int style = 0); //style 0 - brown, 1 - blue
 	~CSlider();
 	void moveToMax();
-};	
-
-#endif // __ADVENTUREMAPBUTTON_H__
+};

+ 25 - 30
client/CAdvmapInterface.cpp

@@ -1,5 +1,7 @@
-#include "AdventureMapButton.h"
+#include "StdInc.h"
 #include "CAdvmapInterface.h"
+
+#include "AdventureMapButton.h"
 #include "../CCallback.h"
 #include "CCastleInterface.h"
 #include "CCursorHandler.h"
@@ -21,16 +23,9 @@
 #include "../lib/map.h"
 #include "../lib/JsonNode.h"
 #include "mapHandler.h"
-#include "../stdafx.h"
-#include <boost/algorithm/string.hpp>
-#include <boost/algorithm/string/replace.hpp>
-#include <boost/assign/std/vector.hpp>
-#include <boost/thread.hpp>
-#include <sstream>
 #include "CPreGame.h"
 #include "../lib/VCMI_Lib.h"
 #include "../lib/CSpellHandler.h"
-#include <boost/foreach.hpp>
 #include "CSoundBase.h"
 #include "../lib/CGameState.h"
 #include "CMusicHandler.h"
@@ -71,7 +66,7 @@ CMinimap::CMinimap()
 	temps = newSurface(pos.w,pos.h);
 	aiShield = new CPicture("AISHIELD.bmp");
 
-	const JsonNode config(DATA_DIR "/config/minimap.json");
+	const JsonNode config(GameConstants::DATA_DIR + "/config/minimap.json");
 	const JsonVector &minimap_vec = config["MinimapColors"].Vector();
 
 	BOOST_FOREACH(const JsonNode &m, minimap_vec) {
@@ -123,7 +118,7 @@ void CMinimap::draw(SDL_Surface * to)
 			int3 hpos = hh[i]->getPosition(false);
 			if(hpos.z!=adventureInt->position.z)
 				continue;
-			//float zawx = ((float)hpos.x/CGI->mh->sizes.x), zawy = ((float)hpos.y/CGI->mh->sizes.y);
+
 			int3 maplgp ( (hpos.x*mw)/mapSizes.x, (hpos.y*mh)/mapSizes.y, hpos.z );
 			for (int ii=0; ii<wo; ii++)
 			{
@@ -142,10 +137,10 @@ void CMinimap::draw(SDL_Surface * to)
 		//draw radar
 		const int tilesw=(ADVOPT.advmapW+31)/32;
 		const int tilesh=(ADVOPT.advmapH+31)/32;
-		int bx = (((float)adventureInt->position.x)/(((float)mapSizes.x)))*pos.w,
-			by = (((float)adventureInt->position.y)/(((float)mapSizes.y)))*pos.h,
-			rx = (((float)tilesw)/(mapSizes.x))*((float)pos.w), //width
-			ry = (((float)tilesh)/(mapSizes.y))*((float)pos.h); //height
+		int bx = static_cast<int>((adventureInt->position.x / static_cast<double>(mapSizes.x)) * pos.w),
+			by = static_cast<int>((adventureInt->position.y / static_cast<double>(mapSizes.y)) * pos.h),
+			rx = static_cast<int>((tilesw / static_cast<double>(mapSizes.x)) * pos.w), //width
+			ry = static_cast<int>((tilesh / static_cast<double>(mapSizes.y)) * pos.h); //height
 
 		CSDL_Ext::drawDashedBorder(temps, Rect(bx, by, rx, ry), int3(255,75,125));
 
@@ -295,8 +290,8 @@ void CMinimap::clickLeft(tribool down, bool previousState)
 	if (!((bool)down))
 		return;
 
-	float dx=((float)(GH.current->motion.x-pos.x))/((float)pos.w),
-		dy=((float)(GH.current->motion.y-pos.y))/((float)pos.h);
+	double dx = (GH.current->motion.x - pos.x) / static_cast<double>(pos.w),
+		dy = (GH.current->motion.y - pos.y) / static_cast<double>(pos.h);
 
 	int3 newCPos;
 	newCPos.x = (CGI->mh->sizes.x*dx);
@@ -981,7 +976,7 @@ void CInfoBar::deactivate()
 
 void CInfoBar::updateSelection(const CGObjectInstance *obj)
 {
-	if(obj->ID == HEROI_TYPE)
+	if(obj->ID == GameConstants::HEROI_TYPE)
 		curSel = static_cast<const CGHeroInstance*>(obj);
 	else
 		curSel = NULL;
@@ -1593,9 +1588,9 @@ void CAdvMapInt::select(const CArmedInstance *sel, bool centerView /*= true*/)
 		centerOn(sel);
 
 	terrain.currentPath = NULL;
-	if(sel->ID==TOWNI_TYPE)
+	if(sel->ID==GameConstants::TOWNI_TYPE)
 	{
-		int pos = vstd::findPos(LOCPLINT->towns,sel);
+		int pos = vstd::find_pos(LOCPLINT->towns,sel);
 		townList.selected = pos;
 		townList.fixPos();
 		updateSleepWake(NULL);
@@ -1736,10 +1731,10 @@ void CAdvMapInt::tileLClicked(const int3 &mp)
 		return;
 	}
 	//check if we can select this object
-	bool canSelect = topBlocking && topBlocking->ID == HEROI_TYPE && topBlocking->tempOwner == LOCPLINT->playerID;
-	canSelect |= topBlocking && topBlocking->ID == TOWNI_TYPE && LOCPLINT->cb->getPlayerRelations(LOCPLINT->playerID, topBlocking->tempOwner);
+	bool canSelect = topBlocking && topBlocking->ID == GameConstants::HEROI_TYPE && topBlocking->tempOwner == LOCPLINT->playerID;
+	canSelect |= topBlocking && topBlocking->ID == GameConstants::TOWNI_TYPE && LOCPLINT->cb->getPlayerRelations(LOCPLINT->playerID, topBlocking->tempOwner);
 
-	if (selection->ID != HEROI_TYPE) //hero is not selected (presumably town)
+	if (selection->ID != GameConstants::HEROI_TYPE) //hero is not selected (presumably town)
 	{
 		assert(!terrain.currentPath); //path can be active only when hero is selected
 		if(selection == topBlocking) //selected town clicked
@@ -1820,7 +1815,7 @@ void CAdvMapInt::tileHovered(const int3 &tile)
 	bool accessible  =  pnode->turns < 255;
 
 	int turns = pnode->turns;
-	amin(turns, 3);
+	vstd::amin(turns, 3);
 
 	if(!selection) //may occur just at the start of game (fake move before full intiialization)
 		return;
@@ -1850,13 +1845,13 @@ void CAdvMapInt::tileHovered(const int3 &tile)
 
 	const bool guardingCreature = CGI->mh->map->isInTheMap(LOCPLINT->cb->guardingCreaturePosition(tile));
 
-	if(selection->ID == TOWNI_TYPE)
+	if(selection->ID == GameConstants::TOWNI_TYPE)
 	{
 		if(objAtTile)
 		{
-			if(objAtTile->ID == TOWNI_TYPE && LOCPLINT->cb->getPlayerRelations(LOCPLINT->playerID, objAtTile->tempOwner))
+			if(objAtTile->ID == GameConstants::TOWNI_TYPE && LOCPLINT->cb->getPlayerRelations(LOCPLINT->playerID, objAtTile->tempOwner))
 				CCS->curh->changeGraphic(0, 3);
-			else if(objAtTile->ID == HEROI_TYPE && objAtTile->tempOwner == LOCPLINT->playerID)
+			else if(objAtTile->ID == GameConstants::HEROI_TYPE && objAtTile->tempOwner == LOCPLINT->playerID)
 				CCS->curh->changeGraphic(0, 2);
 		}
 		else
@@ -1866,7 +1861,7 @@ void CAdvMapInt::tileHovered(const int3 &tile)
 	{
 		if(objAtTile)
 		{
-			if(objAtTile->ID == HEROI_TYPE)
+			if(objAtTile->ID == GameConstants::HEROI_TYPE)
 			{
 				if(!LOCPLINT->cb->getPlayerRelations( LOCPLINT->playerID, objAtTile->tempOwner)) //enemy hero
 				{
@@ -1885,7 +1880,7 @@ void CAdvMapInt::tileHovered(const int3 &tile)
 						CCS->curh->changeGraphic(0, 2);
 				}
 			}
-			else if(objAtTile->ID == TOWNI_TYPE)
+			else if(objAtTile->ID == GameConstants::TOWNI_TYPE)
 			{
 				if(!LOCPLINT->cb->getPlayerRelations( LOCPLINT->playerID, objAtTile->tempOwner)) //enemy town
 				{
@@ -2042,7 +2037,7 @@ void CAdvMapInt::leaveCastingMode(bool cast /*= false*/, int3 dest /*= int3(-1,
 
 const CGHeroInstance * CAdvMapInt::curHero() const
 {
-	if(selection && selection->ID == HEROI_TYPE)
+	if(selection && selection->ID == GameConstants::HEROI_TYPE)
 		return static_cast<const CGHeroInstance *>(selection);
 	else
 		return NULL;
@@ -2050,7 +2045,7 @@ const CGHeroInstance * CAdvMapInt::curHero() const
 
 const CGTownInstance * CAdvMapInt::curTown() const
 {
-	if(selection && selection->ID == TOWNI_TYPE)
+	if(selection && selection->ID == GameConstants::TOWNI_TYPE)
 		return static_cast<const CGTownInstance *>(selection);
 	else
 		return NULL;

+ 6 - 8
client/CAdvmapInterface.h

@@ -1,11 +1,11 @@
-#ifndef __CADVMAPINTERFACE_H__
-#define __CADVMAPINTERFACE_H__
+#pragma once
+
 #include <typeinfo>
-#include "../global.h"
+
 #include "SDL.h"
-#include <map>
 #include "AdventureMapButton.h"
 #include "GUIClasses.h"
+
 class CDefHandler;
 class CCallback;
 struct CGPath;
@@ -176,8 +176,8 @@ public:
 	enum{NA, INGAME, WAITING} state;
 
 	bool updateScreen, updateMinimap ;
-	unsigned char anim, animValHitCount; //animation frame
-	unsigned char heroAnim, heroAnimValHitCount; //animation frame
+	ui8 anim, animValHitCount; //animation frame
+	ui8 heroAnim, heroAnimValHitCount; //animation frame
 
 	SDL_Surface * bg;
 	std::vector<CDefHandler *> gems;
@@ -256,5 +256,3 @@ public:
 };
 
 extern CAdvMapInt *adventureInt;
-
-#endif // __CADVMAPINTERFACE_H__

+ 38 - 41
client/CAnimation.cpp

@@ -1,7 +1,4 @@
-#include <boost/bind.hpp>
-#include <boost/algorithm/string/trim.hpp>
-#include <boost/foreach.hpp>
-
+#include "StdInc.h"
 #include <SDL_image.h>
 
 #include "../lib/CLodHandler.h"
@@ -23,8 +20,8 @@
  *
  */
 
-extern DLL_EXPORT CLodHandler *spriteh;
-extern DLL_EXPORT CLodHandler *bitmaph;
+extern DLL_LINKAGE CLodHandler *spriteh;
+extern DLL_LINKAGE CLodHandler *bitmaph;
 
 typedef std::map <size_t, std::vector <JsonNode> > source_map;
 typedef std::map<size_t, IImage* > image_map;
@@ -53,7 +50,7 @@ class CompImageLoader
 	CompImage * image;
 	ui8 *position;
 	ui8 *entry;
-	unsigned int currentLine;
+	ui32 currentLine;
 	
 	inline ui8 typeOf(ui8 color);
 	inline void NewEntry(ui8 color, size_t size);
@@ -97,15 +94,15 @@ CDefFile::CDefFile(std::string Name):
 	palette = new SDL_Color[256];
 	int it = 0;
 
-	unsigned int type = read_le_u32(data + it);
+	ui32 type = read_le_u32(data + it);
 	it+=4;
 	//int width  = read_le_u32(data + it); it+=4;//not used
 	//int height = read_le_u32(data + it); it+=4;
 	it+=8;
-	unsigned int totalBlocks = read_le_u32(data + it);
+	ui32 totalBlocks = read_le_u32(data + it);
 	it+=4;
 
-	for (unsigned int i= 0; i<256; i++)
+	for (ui32 i= 0; i<256; i++)
 	{
 		palette[i].r = data[it++];
 		palette[i].g = data[it++];
@@ -117,7 +114,7 @@ CDefFile::CDefFile(std::string Name):
 	else
 		memcpy(palette, H3Palette, sizeof(SDL_Color)*8);//initialize shadow\selection colors
 
-	for (unsigned int i=0; i<totalBlocks; i++)
+	for (ui32 i=0; i<totalBlocks; i++)
 	{
 		size_t blockID = read_le_u32(data + it);
 		it+=4;
@@ -128,7 +125,7 @@ CDefFile::CDefFile(std::string Name):
 		//13 bytes for name of every frame in this block - not used, skipping
 		it+= 13 * totalEntries;
 
-		for (unsigned int j=0; j<totalEntries; j++)
+		for (ui32 j=0; j<totalEntries; j++)
 		{
 			size_t currOffset = read_le_u32(data + it);
 			offset[blockID].push_back(currOffset);
@@ -158,8 +155,8 @@ void CDefFile::loadFrame(size_t frame, size_t group, ImageLoader &loader) const
 	sprite.leftMargin = SDL_SwapLE32(sd.leftMargin);
 	sprite.topMargin = SDL_SwapLE32(sd.topMargin);
 
-	unsigned int currentOffset = sizeof(SSpriteDef);
-	unsigned int BaseOffset =    sizeof(SSpriteDef);
+	ui32 currentOffset = sizeof(SSpriteDef);
+	ui32 BaseOffset =    sizeof(SSpriteDef);
 
 	loader.init(Point(sprite.width, sprite.height),
 	            Point(sprite.leftMargin, sprite.topMargin),
@@ -170,7 +167,7 @@ void CDefFile::loadFrame(size_t frame, size_t group, ImageLoader &loader) const
 	case 0:
 		{
 			//pixel data is not compressed, copy data to surface
-			for (unsigned int i=0; i<sprite.height; i++)
+			for (ui32 i=0; i<sprite.height; i++)
 			{
 				loader.Load(sprite.width, FDef[currentOffset]);
 				currentOffset += sprite.width;
@@ -184,16 +181,16 @@ void CDefFile::loadFrame(size_t frame, size_t group, ImageLoader &loader) const
 			const ui32 * RWEntriesLoc = reinterpret_cast<const ui32 *>(FDef+currentOffset);
 			currentOffset += sizeof(ui32) * sprite.height;
 
-			for (unsigned int i=0; i<sprite.height; i++)
+			for (ui32 i=0; i<sprite.height; i++)
 			{
 				//get position of the line
 				currentOffset=BaseOffset + read_le_u32(RWEntriesLoc + i);
-				unsigned int TotalRowLength = 0;
+				ui32 TotalRowLength = 0;
 
 				while (TotalRowLength<sprite.width)
 				{
-					unsigned char type=FDef[currentOffset++];
-					unsigned int length=FDef[currentOffset++] + 1;
+					ui8 type=FDef[currentOffset++];
+					ui32 length=FDef[currentOffset++] + 1;
 
 					if (type==0xFF)//Raw data
 					{
@@ -215,15 +212,15 @@ void CDefFile::loadFrame(size_t frame, size_t group, ImageLoader &loader) const
 		{
 			currentOffset = BaseOffset + read_le_u16(FDef + BaseOffset);
 
-			for (unsigned int i=0; i<sprite.height; i++)
+			for (ui32 i=0; i<sprite.height; i++)
 			{
-				unsigned int TotalRowLength=0;
+				ui32 TotalRowLength=0;
 
 				while (TotalRowLength<sprite.width)
 				{
-					unsigned char SegmentType=FDef[currentOffset++];
-					unsigned char code = SegmentType / 32;
-					unsigned char length = (SegmentType & 31) + 1;
+					ui8 SegmentType=FDef[currentOffset++];
+					ui8 code = SegmentType / 32;
+					ui8 length = (SegmentType & 31) + 1;
 
 					if (code==7)//Raw data
 					{
@@ -242,16 +239,16 @@ void CDefFile::loadFrame(size_t frame, size_t group, ImageLoader &loader) const
 		}
 	case 3:
 		{
-			for (unsigned int i=0; i<sprite.height; i++)
+			for (ui32 i=0; i<sprite.height; i++)
 			{
 				currentOffset = BaseOffset + read_le_u16(FDef + BaseOffset+i*2*(sprite.width/32));
-				unsigned int TotalRowLength=0;
+				ui32 TotalRowLength=0;
 
 				while (TotalRowLength<sprite.width)
 				{
-					unsigned char segment = FDef[currentOffset++];
-					unsigned char code = segment / 32;
-					unsigned char length = (segment & 31) + 1;
+					ui8 segment = FDef[currentOffset++];
+					ui8 code = segment / 32;
+					ui8 length = (segment & 31) + 1;
 
 					if (code==7)//Raw data
 					{
@@ -366,7 +363,7 @@ void CompImageLoader::init(Point SpriteSize, Point Margins, Point FullSize, SDL_
 		memcpy((void*)image->palette, (void*)pal, 256*sizeof(SDL_Color));
 		//Allocate enought space for worst possible case,  c-style malloc used due to resizing after load
 		image->surf = (ui8*)malloc(SpriteSize.x*SpriteSize.y*3);
-		image->line = new unsigned int[SpriteSize.y+1];
+		image->line = new ui32[SpriteSize.y+1];
 		image->line[0] = 0;
 		position = image->surf;
 	}
@@ -591,7 +588,7 @@ SDLImage::SDLImage(std::string filename, bool compressed):
 	}
 }
 
-void SDLImage::draw(SDL_Surface *where, int posX, int posY, Rect *src, unsigned char rotation) const
+void SDLImage::draw(SDL_Surface *where, int posX, int posY, Rect *src, ui8 rotation) const
 {
 	if (!surf)
 		return;
@@ -751,7 +748,7 @@ void CompImage::BlitBlock(ui8 type, ui8 size, ui8 *&data, ui8 *&dest, ui8 alpha)
 			for (size_t i=0; i<size; i++)
 			{
 				SDL_Color col = palette[*(data++)];
-				col.unused = (unsigned int)col.unused*(255-alpha)/255;
+				col.unused = (ui32)col.unused*(255-alpha)/255;
 				ColorPutter<bpp, 1>::PutColorAlpha(dest, col);
 			}
 			return;
@@ -811,7 +808,7 @@ void CompImage::BlitBlock(ui8 type, ui8 size, ui8 *&data, ui8 *&dest, ui8 alpha)
 void CompImage::playerColored(int player)
 {
 	SDL_Color *pal = NULL;
-	if(player < PLAYER_LIMIT && player >= 0)
+	if(player < GameConstants::PLAYER_LIMIT && player >= 0)
 	{
 		pal = graphics->playerColorPalette + 32*player;
 	}
@@ -941,7 +938,7 @@ void CAnimation::init(CDefFile * file)
 	if (spriteh->haveFile(name, FILE_TEXT))
 	{
 		int size = 0;
-		unsigned char * configFile = spriteh->giveFile(name, FILE_TEXT, &size);
+		ui8 * configFile = spriteh->giveFile(name, FILE_TEXT, &size);
 
 		const JsonNode config((char*)configFile, size);
 		delete configFile;
@@ -1118,7 +1115,7 @@ void CAnimation::getAnimInfo()
 	}
 }
 
-CAnimImage::CAnimImage(std::string name, size_t Frame, size_t Group, int x, int y, unsigned char Flags):
+CAnimImage::CAnimImage(std::string name, size_t Frame, size_t Group, int x, int y, ui8 Flags):
 	frame(Frame),
 	group(Group),
 	player(-1),
@@ -1130,7 +1127,7 @@ CAnimImage::CAnimImage(std::string name, size_t Frame, size_t Group, int x, int
 	init();
 }
 
-CAnimImage::CAnimImage(CAnimation *Anim, size_t Frame, size_t Group, int x, int y, unsigned char Flags):
+CAnimImage::CAnimImage(CAnimation *Anim, size_t Frame, size_t Group, int x, int y, ui8 Flags):
 	anim(Anim),
 	frame(Frame),
 	group(Group),
@@ -1206,7 +1203,7 @@ void CAnimImage::playerColored(int currPlayer)
 			anim->getImage(0, group)->playerColored(player);
 }
 
-CShowableAnim::CShowableAnim(int x, int y, std::string name, unsigned char Flags, unsigned int Delay, size_t Group):
+CShowableAnim::CShowableAnim(int x, int y, std::string name, ui8 Flags, ui32 Delay, size_t Group):
 	anim(name, Flags & USE_RLE),
 	group(Group),
 	frame(0),
@@ -1232,9 +1229,9 @@ CShowableAnim::~CShowableAnim()
 	anim.unloadGroup(group);
 }
 
-void CShowableAnim::setAlpha(unsigned int alphaValue)
+void CShowableAnim::setAlpha(ui32 alphaValue)
 {
-	alpha = std::min<unsigned int>(alphaValue, 255);
+	alpha = std::min<ui32>(alphaValue, 255);
 }
 
 bool CShowableAnim::set(size_t Group, size_t from, size_t to)
@@ -1320,14 +1317,14 @@ void CShowableAnim::blitImage(size_t frame, size_t group, SDL_Surface *to)
 
 void CShowableAnim::rotate(bool on, bool vertical)
 {
-	unsigned char flag = vertical? VERTICAL_FLIP:HORIZONTAL_FLIP;
+	ui8 flag = vertical? VERTICAL_FLIP:HORIZONTAL_FLIP;
 	if (on)
 		flags |= flag;
 	else
 		flags &= ~flag;
 }
 
-CCreatureAnim::CCreatureAnim(int x, int y, std::string name, Rect picPos, unsigned char flags, EAnimType type):
+CCreatureAnim::CCreatureAnim(int x, int y, std::string name, Rect picPos, ui8 flags, EAnimType type):
 	CShowableAnim(x,y,name,flags,3,type)
 {
 	xOffset = picPos.x;

+ 12 - 22
client/CAnimation.h

@@ -1,14 +1,6 @@
-#ifndef __CANIMATION_H__
-#define __CANIMATION_H__
+#pragma once
 
-#include <boost/function.hpp>
 
-#include <vector>
-#include <string>
-#include <queue>
-#include <map>
-
-#include "../global.h"
 #include "GUIBase.h"
 
 /*
@@ -46,7 +38,7 @@ private:
 	//offset[group][frame] - offset of frame data in file
 	std::map<size_t, std::vector <size_t> > offset;
 
-	unsigned char * data;
+	ui8 * data;
 	SDL_Color * palette;
 
 public:
@@ -135,7 +127,7 @@ class CompImage : public IImage
 	//RLE-d data
 	ui8 * surf;
 	//array of offsets for each line
-	unsigned int * line;
+	ui32 * line;
 	//palette
 	SDL_Color *palette;
 
@@ -237,13 +229,13 @@ private:
 	size_t frame;
 	size_t group;
 	int player;
-	unsigned char flags;
+	ui8 flags;
 
 	void init();
 
 public:
-	CAnimImage(std::string name, size_t Frame, size_t Group=0, int x=0, int y=0, unsigned char Flags=0);
-	CAnimImage(CAnimation* anim, size_t Frame, size_t Group=0, int x=0, int y=0, unsigned char Flags=0);
+	CAnimImage(std::string name, size_t Frame, size_t Group=0, int x=0, int y=0, ui8 Flags=0);
+	CAnimImage(CAnimation* anim, size_t Frame, size_t Group=0, int x=0, int y=0, ui8 Flags=0);
 	~CAnimImage();//d-tor
 
 	//size of animation
@@ -278,10 +270,10 @@ protected:
 	size_t first, last; //animation range
 
 	//TODO: replace with time delay(needed for battles)
-	unsigned int frameDelay;//delay in frames of each image
-	unsigned int value;//how many times current frame was showed
+	ui32 frameDelay;//delay in frames of each image
+	ui32 value;//how many times current frame was showed
 
-	unsigned char flags;//Flags from EFlags enum
+	ui8 flags;//Flags from EFlags enum
 
 	//blit image with optional rotation, fitting into rect, etc
 	void blitImage(size_t frame, size_t group, SDL_Surface *to);
@@ -296,9 +288,9 @@ public:
 	boost::function<void()> callback;
 
 	//Set per-surface alpha, 0 = transparent, 255 = opaque
-	void setAlpha(unsigned int alphaValue);
+	void setAlpha(ui32 alphaValue);
 
-	CShowableAnim(int x, int y, std::string name, unsigned char flags=0, unsigned int Delay=4, size_t Group=0);
+	CShowableAnim(int x, int y, std::string name, ui8 flags=0, ui32 Delay=4, size_t Group=0);
 	~CShowableAnim();
 
 	//set animation to group or part of group
@@ -376,8 +368,6 @@ public:
 	void clearAndSet(EAnimType type);
 
 	CCreatureAnim(int x, int y, std::string name, Rect picPos,
-	              unsigned char flags= USE_RLE, EAnimType = HOLDING );
+	              ui8 flags= USE_RLE, EAnimType = HOLDING );
 
 };
-
-#endif // __CANIMATIONHANDLER_H__

+ 9 - 10
client/CBitmapHandler.cpp

@@ -1,12 +1,11 @@
-#include "../stdafx.h"
+#include "StdInc.h"
+
 #include "SDL.h"
 #include "SDL_image.h"
 #include "CBitmapHandler.h"
 #include "CDefHandler.h"
 #include "../lib/CLodHandler.h"
 #include "../lib/vcmi_endian.h"
-#include <sstream>
-#include <boost/thread.hpp>
 
 /*
  * CBitmapHandler.cpp, part of VCMI engine
@@ -18,14 +17,14 @@
  *
  */
 
-extern DLL_EXPORT CLodHandler *bitmaph;
-extern DLL_EXPORT CLodHandler *bitmaph_ab;
-extern DLL_EXPORT CLodHandler *spriteh;
+extern DLL_LINKAGE CLodHandler *bitmaph;
+extern DLL_LINKAGE CLodHandler *bitmaph_ab;
+extern DLL_LINKAGE CLodHandler *spriteh;
 
 void CPCXConv::openPCX(char * PCX, int len)
 {
 	pcxs=len;
-	pcx=(unsigned char*)PCX;
+	pcx=(ui8*)PCX;
 }
 void CPCXConv::fromFile(std::string path)
 {
@@ -34,7 +33,7 @@ void CPCXConv::fromFile(std::string path)
 	is.seekg(0,std::ios::end); // to the end
 	pcxs = is.tellg();  // read length
 	is.seekg(0,std::ios::beg); // wracamy na poczatek
-	pcx = new unsigned char[pcxs]; // allocate memory 
+	pcx = new ui8[pcxs]; // allocate memory 
 	is.read((char*)pcx, pcxs); // read map file to buffer
 	is.close();
 }
@@ -119,7 +118,7 @@ SDL_Surface * CPCXConv::getSurface() const
 	return ret;
 }
 
-bool isPCX(const unsigned char *header)//check whether file can be PCX according to 1st 12 bytes
+bool isPCX(const ui8 *header)//check whether file can be PCX according to 1st 12 bytes
 {
 	int fSize  = read_le_u32(header + 0);
 	int width  = read_le_u32(header + 4);
@@ -142,7 +141,7 @@ SDL_Surface * BitmapHandler::loadBitmapFromLod(CLodHandler *lod, std::string fna
 
 	SDL_Surface * ret=NULL;
 	int size;
-	unsigned char * file = 0;
+	ui8 * file = 0;
 	file = lod->giveFile(fname, FILE_GRAPHICS, &size);
 	
 	if (isPCX(file))

+ 4 - 7
client/CBitmapHandler.h

@@ -1,8 +1,7 @@
-#ifndef __CBITMAPHANDLER_H__
-#define __CBITMAPHANDLER_H__
+#pragma once
+
 
 
-#include "../global.h"
 struct SDL_Surface;
 class CLodHandler;
 
@@ -21,14 +20,14 @@ enum Epcxformat {PCX8B, PCX24B};
 /// Struct which stands for a simple rgba palette
 struct BMPPalette
 {
-	unsigned char R,G,B,F;
+	ui8 R,G,B,F;
 };
 
 /// Class which converts pcx to bmp images
 class CPCXConv
 {	
 public:
-	unsigned char * pcx, *bmp;
+	ui8 * pcx, *bmp;
 	int pcxs, bmps;
 	void fromFile(std::string path);
 	void saveBMP(std::string path) const;
@@ -52,5 +51,3 @@ namespace BitmapHandler
 	//Load file from any LODs
 	SDL_Surface * loadBitmap(std::string fname, bool setKey=true);
 };
-
-#endif // __CBITMAPHANDLER_H__

+ 69 - 75
client/CCastleInterface.cpp

@@ -1,13 +1,6 @@
-#include "../stdafx.h"
-
-#include <boost/algorithm/string.hpp>
-#include <boost/algorithm/string/replace.hpp>
-#include <boost/assign/std/vector.hpp>
-#include <boost/format.hpp>
-#include <boost/lexical_cast.hpp>
-#include <boost/foreach.hpp>
-
+#include "StdInc.h"
 #include "CCastleInterface.h"
+
 #include "../CCallback.h"
 #include "../lib/CArtHandler.h"
 #include "../lib/CBuildingHandler.h"
@@ -28,6 +21,7 @@
 #include "CPlayerInterface.h"
 #include "Graphics.h"
 #include "SDL_Extensions.h"
+#include "../lib/GameConstants.h"
 
 using namespace boost::assign;
 
@@ -126,7 +120,7 @@ void CBuildingRect::clickRight(tribool down, bool previousState)
 	{
 		int bid = hordeToDwellingID(str->ID);
 		const CBuilding *bld = CGI->buildh->buildings[str->townID].find(bid)->second;
-		if (bid < Buildings::DWELL_FIRST)
+		if (bid < EBuilding::DWELL_FIRST)
 		{
 			std::vector<SComponent*> comps(1,
 			new SComponent(SComponent::building, bld->tid, bld->bid,
@@ -136,13 +130,13 @@ void CBuildingRect::clickRight(tribool down, bool previousState)
 		}
 		else
 		{
-			int level = ( bid - Buildings::DWELL_FIRST ) % CREATURES_PER_TOWN;
+			int level = ( bid - EBuilding::DWELL_FIRST ) % GameConstants::CREATURES_PER_TOWN;
 			GH.pushInt(new CDwellingInfoBox(parent->pos.x+parent->pos.w/2, parent->pos.y+parent->pos.h/2, town, level));
 		}
 	}
 }
 
-SDL_Color multiplyColors (const SDL_Color &b, const SDL_Color &a, float f)
+SDL_Color multiplyColors (const SDL_Color &b, const SDL_Color &a, double f)
 {
 	SDL_Color ret;
 	ret.r = a.r*f + b.r*(1-f);
@@ -153,12 +147,12 @@ SDL_Color multiplyColors (const SDL_Color &b, const SDL_Color &a, float f)
 
 void CBuildingRect::show(SDL_Surface *to)
 {
-	const unsigned int stageDelay = 16;
+	const ui32 stageDelay = 16;
 
-	const unsigned int S1_TRANSP  = 16; //0.5 sec building appear 0->100 transparency
-	const unsigned int S2_WHITE_B = 32; //0.5 sec border glows from white to yellow
-	const unsigned int S3_YELLOW_B= 48; //0.5 sec border glows from yellow to normal
-	const unsigned int BUILDED    = 80; //  1 sec delay, nothing happens
+	const ui32 S1_TRANSP  = 16; //0.5 sec building appear 0->100 transparency
+	const ui32 S2_WHITE_B = 32; //0.5 sec border glows from white to yellow
+	const ui32 S3_YELLOW_B= 48; //0.5 sec border glows from yellow to normal
+	const ui32 BUILDED    = 80; //  1 sec delay, nothing happens
 
 	if (stateCounter < S1_TRANSP)
 	{
@@ -184,15 +178,15 @@ void CBuildingRect::show(SDL_Surface *to)
 		SDL_Color c2 = {120, 100,  60, 255};
 		SDL_Color c3 = {200, 180, 110, 255};
 
-		unsigned int colorID = SDL_MapRGB(border->format, c3.r, c3.g, c3.b);
+		ui32 colorID = SDL_MapRGB(border->format, c3.r, c3.g, c3.b);
 		SDL_Color oldColor = border->format->palette->colors[colorID];
 		SDL_Color newColor;
 
 		if (stateCounter < S2_WHITE_B)
-			newColor = multiplyColors(c1, c2, float(stateCounter%stageDelay)/stageDelay);
+			newColor = multiplyColors(c1, c2, static_cast<double>(stateCounter % stageDelay) / stageDelay);
 		else
 		if (stateCounter < S3_YELLOW_B)
-			newColor = multiplyColors(c2, c3, float(stateCounter%stageDelay)/stageDelay);
+			newColor = multiplyColors(c2, c3, static_cast<double>(stateCounter % stageDelay) / stageDelay);
 		else
 			newColor = oldColor;
 
@@ -224,7 +218,7 @@ std::string getBuildingSubtitle(int tid, int bid)//hover text for building
 		return CGI->buildh->buildings[tid].find(bid)->second->Name();
 	else//dwellings - recruit %creature%
 	{
-		int creaID = t->creatures[(bid-30)%CREATURES_PER_TOWN].second.back();//taking last of available creatures
+		int creaID = t->creatures[(bid-30)%GameConstants::CREATURES_PER_TOWN].second.back();//taking last of available creatures
 		return CGI->generaltexth->allTexts[16] + " " + CGI->creh->creatures[creaID]->namePl;
 	}
 }
@@ -272,7 +266,7 @@ CDwellingInfoBox::CDwellingInfoBox(int centerX, int centerY, const CGTownInstanc
 	available = new CLabel(80,190, FONT_SMALL, CENTER, zwykly, CGI->generaltexth->allTexts[217] + text);
 	costPerTroop = new CLabel(80, 227, FONT_SMALL, CENTER, zwykly, CGI->generaltexth->allTexts[346]);
 	
-	for(int i = 0; i<RESOURCE_QUANTITY; i++)
+	for(int i = 0; i<GameConstants::RESOURCE_QUANTITY; i++)
 	{
 		if(creature->cost[i])
 		{
@@ -484,7 +478,7 @@ CCastleBuildings::CCastleBuildings(const CGTownInstance* Town):
 	if(shipyard && vstd::contains(groups, shipyard->group))
 	{
 		std::vector <const CGObjectInstance *> vobjs = LOCPLINT->cb->getVisitableObjs(town->bestLocation());
-		if(!vobjs.empty() && (vobjs.front()->ID == 8 || vobjs.front()->ID == HEROI_TYPE)) //there is visitable obj at shipyard output tile and it's a boat or hero (on boat)
+		if(!vobjs.empty() && (vobjs.front()->ID == 8 || vobjs.front()->ID == GameConstants::HEROI_TYPE)) //there is visitable obj at shipyard output tile and it's a boat or hero (on boat)
 		{
 			groups[shipyard->group].push_back(CGI->townh->structures[town->subID][20]);
 		}
@@ -652,52 +646,52 @@ void CCastleBuildings::buildingClicked(int building)
 	building = hordeToDwellingID(building);
 	const CBuilding *b = CGI->buildh->buildings[town->subID].find(building)->second;
 
-	if(building >= Buildings::DWELL_FIRST)
+	if(building >= EBuilding::DWELL_FIRST)
 	{
-		enterDwelling((building-Buildings::DWELL_FIRST)%CREATURES_PER_TOWN);
+		enterDwelling((building-EBuilding::DWELL_FIRST)%GameConstants::CREATURES_PER_TOWN);
 	}
 	else
 	{
 		switch(building)
 		{
-		case Buildings::MAGES_GUILD_1:
-		case Buildings::MAGES_GUILD_2:
-		case Buildings::MAGES_GUILD_3:
-		case Buildings::MAGES_GUILD_4:
-		case Buildings::MAGES_GUILD_5:
+		case EBuilding::MAGES_GUILD_1:
+		case EBuilding::MAGES_GUILD_2:
+		case EBuilding::MAGES_GUILD_3:
+		case EBuilding::MAGES_GUILD_4:
+		case EBuilding::MAGES_GUILD_5:
 				enterMagesGuild();
 				break;
 
-		case Buildings::TAVERN:
+		case EBuilding::TAVERN:
 				LOCPLINT->showTavernWindow(town);
 				break;
 
-		case Buildings::SHIPYARD:
+		case EBuilding::SHIPYARD:
 				LOCPLINT->showShipyardDialog(town);
 				break;
 
-		case Buildings::FORT:
-		case Buildings::CITADEL:
-		case Buildings::CASTLE:
+		case EBuilding::FORT:
+		case EBuilding::CITADEL:
+		case EBuilding::CASTLE:
 				GH.pushInt(new CFortScreen(town));
 				break;
 
-		case Buildings::VILLAGE_HALL:
-		case Buildings::CITY_HALL:
-		case Buildings::TOWN_HALL:
-		case Buildings::CAPITOL:
+		case EBuilding::VILLAGE_HALL:
+		case EBuilding::CITY_HALL:
+		case EBuilding::TOWN_HALL:
+		case EBuilding::CAPITOL:
 				enterTownHall();
 				break;
 
-		case Buildings::MARKETPLACE:
+		case EBuilding::MARKETPLACE:
 				GH.pushInt(new CMarketplaceWindow(town, town->visitingHero));
 				break;
 
-		case Buildings::BLACKSMITH:
+		case EBuilding::BLACKSMITH:
 				enterBlacksmith(town->town->warMachine);
 				break;
 
-		case Buildings::SPECIAL_1:
+		case EBuilding::SPECIAL_1:
 				switch(town->subID)
 				{
 				case 1://Mystic Pond
@@ -706,7 +700,7 @@ void CCastleBuildings::buildingClicked(int building)
 
 				case 2: case 5: case 8://Artifact Merchant
 						if(town->visitingHero)
-							GH.pushInt(new CMarketplaceWindow(town, town->visitingHero, RESOURCE_ARTIFACT));
+							GH.pushInt(new CMarketplaceWindow(town, town->visitingHero, EMarketMode::RESOURCE_ARTIFACT));
 						else
 							LOCPLINT->showInfoDialog(boost::str(boost::format(CGI->generaltexth->allTexts[273]) % b->Name())); //Only visiting heroes may use the %s.
 						break;
@@ -717,11 +711,11 @@ void CCastleBuildings::buildingClicked(int building)
 				}
 				break;
 
-		case Buildings::SHIP:
+		case EBuilding::SHIP:
 				LOCPLINT->showInfoDialog(CGI->generaltexth->allTexts[51]); //Cannot build another boat
 				break;
 
-		case Buildings::SPECIAL_2:
+		case EBuilding::SPECIAL_2:
 				switch(town->subID)
 				{
 				case 1: //Fountain of Fortune
@@ -730,7 +724,7 @@ void CCastleBuildings::buildingClicked(int building)
 
 				case 6: //Freelancer's Guild
 						if(getHero())
-							GH.pushInt(new CMarketplaceWindow(town, getHero(), CREATURE_RESOURCE));
+							GH.pushInt(new CMarketplaceWindow(town, getHero(), EMarketMode::CREATURE_RESOURCE));
 						else
 							LOCPLINT->showInfoDialog(boost::str(boost::format(CGI->generaltexth->allTexts[273]) % b->Name())); //Only visiting heroes may use the %s.
 						break;
@@ -748,7 +742,7 @@ void CCastleBuildings::buildingClicked(int building)
 				}
 				break;
 
-		case Buildings::SPECIAL_3:
+		case EBuilding::SPECIAL_3:
 				switch(town->subID)
 				{
 				case 0: //Brotherhood of sword
@@ -764,10 +758,10 @@ void CCastleBuildings::buildingClicked(int building)
 						break;
 
 				case 5: //Portal of Summoning
-						if (town->creatures[CREATURES_PER_TOWN].second.empty())//No creatures
+						if (town->creatures[GameConstants::CREATURES_PER_TOWN].second.empty())//No creatures
 							LOCPLINT->showInfoDialog(CGI->generaltexth->tcommands[30]);
 						else
-							enterDwelling(CREATURES_PER_TOWN);
+							enterDwelling(GameConstants::CREATURES_PER_TOWN);
 						break;
 
 				case 6: //Ballista Yard
@@ -887,13 +881,13 @@ void CCastleBuildings::enterMagesGuild()
 void CCastleBuildings::enterTownHall()
 {
 	if(town->visitingHero && town->visitingHero->hasArt(2) &&
-		!vstd::contains(town->builtBuildings, Buildings::GRAIL)) //hero has grail, but town does not have it
+		!vstd::contains(town->builtBuildings, EBuilding::GRAIL)) //hero has grail, but town does not have it
 	{
-		if(!vstd::contains(town->forbiddenBuildings, Buildings::GRAIL))
+		if(!vstd::contains(town->forbiddenBuildings, EBuilding::GRAIL))
 		{
 			LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[597], //Do you wish this to be the permanent home of the Grail?
 			                            std::vector<SComponent*>(),
-			                            boost::bind(&CCallback::buildBuilding, LOCPLINT->cb, town, Buildings::GRAIL),
+			                            boost::bind(&CCallback::buildBuilding, LOCPLINT->cb, town, EBuilding::GRAIL),
 			                            boost::bind(&CCastleBuildings::openTownHall, this), true);
 		}
 		else
@@ -954,11 +948,11 @@ CCastleInterface::CCastleInterface(const CGTownInstance * Town, int listPos):
 
 	townlist = new CTownList(3, 744, 414, "IAM014", "IAM015");
 	townlist->fun = boost::bind(&CCastleInterface::townChange, this);
-	townlist->selected = vstd::findPos(LOCPLINT->towns, Town);
+	townlist->selected = vstd::find_pos(LOCPLINT->towns, Town);
 
 	townlist->from = townlist->selected - listPos;
-	amax(townlist->from, 0);
-	amin(townlist->from, LOCPLINT->towns.size() - townlist->SIZE);
+	vstd::amax(townlist->from, 0);
+	vstd::amin(townlist->from, LOCPLINT->towns.size() - townlist->SIZE);
 
 	LOCPLINT->castleInt = this;
 	recreateIcons();
@@ -1034,9 +1028,9 @@ void CCastleInterface::recreateIcons()
 
 	size_t iconIndex = town->subID*2;
 	if (!town->hasFort())
-		iconIndex += F_NUMBER*2;
+		iconIndex += GameConstants::F_NUMBER*2;
 
-	if(town->builded >= MAX_BUILDING_PER_TURN)
+	if(town->builded >= GameConstants::MAX_BUILDING_PER_TURN)
 		iconIndex++;
 
 	icon->setFrame(iconIndex);
@@ -1073,7 +1067,7 @@ CCreaInfo::CCreaInfo(Point position, const CGTownInstance *Town, int Level, bool
 	}
 	used = LCLICK | RCLICK | HOVER;
 
-	unsigned int creatureID = town->creatures[level].second.back();
+	ui32 creatureID = town->creatures[level].second.back();
 	creature = CGI->creh->creatures[creatureID];
 
 	picture = new CAnimImage("CPRSMALL", creatureID+2, 0, 8, 0);
@@ -1297,9 +1291,9 @@ void CHallInterface::CBuildingBox::hover(bool on)
 	if(on)
 	{
 		std::string toPrint;
-		if(state==Buildings::PREREQUIRES)
+		if(state==EBuildingState::PREREQUIRES)
 			toPrint = CGI->generaltexth->hcommands[5];
-		else if(state==Buildings::CANT_BUILD_TODAY)
+		else if(state==EBuildingState::CANT_BUILD_TODAY)
 			toPrint = CGI->generaltexth->allTexts[223];
 		else
 			toPrint = CGI->generaltexth->hcommands[state];
@@ -1334,7 +1328,7 @@ CHallInterface::CBuildingBox::CBuildingBox(int x, int y, const CGTownInstance *
 	pos.h = 92;
 	
 	state = LOCPLINT->cb->canBuildStructure(town,building->bid);
-	assert(state < Buildings::ERROR);
+	assert(state < EBuildingState::BUILDING_ERROR);
 	static int panelIndex[9] = { 3,  3,  3, 0, 0, 2, 2,  1, 2};
 	static int  iconIndex[9] = {-1, -1, -1, 0, 0, 1, 2, -1, 1};
 
@@ -1359,7 +1353,7 @@ CHallInterface::CHallInterface(const CGTownInstance *Town):
 	Rect barRect(5, 556, 740, 18);
 	statusBar = new CGStatusBar(new CPicture(*background, barRect, 5, 556, false));
 
-	title = new CLabel(399, 12, FONT_MEDIUM, CENTER, zwykly, CGI->buildh->buildings[town->subID][town->hallLevel()+Buildings::VILLAGE_HALL]->Name());
+	title = new CLabel(399, 12, FONT_MEDIUM, CENTER, zwykly, CGI->buildh->buildings[town->subID][town->hallLevel()+EBuilding::VILLAGE_HALL]->Name());
 	exit = new AdventureMapButton(CGI->generaltexth->hcommands[8], "", 
 	           boost::bind(&CHallInterface::close,this), 748, 556, "TPMAGE1.DEF", SDLK_RETURN);
 	exit->assignedKeys.insert(SDLK_ESCAPE);
@@ -1468,7 +1462,7 @@ CBuildWindow::CBuildWindow(const CGTownInstance *Town, const CBuilding * Buildin
 	buildingState = new CTextBox(getTextForState(state),  Rect(33, 216, 329, 67), 0, FONT_SMALL,  CENTER);
 
 	//Create objects for all required resources
-	for(int i = 0; i<RESOURCE_QUANTITY; i++)
+	for(int i = 0; i<GameConstants::RESOURCE_QUANTITY; i++)
 	{
 		if(building->resources[i])
 		{
@@ -1478,7 +1472,7 @@ CBuildWindow::CBuildWindow(const CGTownInstance *Town, const CBuilding * Buildin
 		}
 	}
 
-	unsigned int rowSize[2];
+	ui32 rowSize[2];
 	int posY;
 	if (resAmount.size() > 4)
 	{//Resources will be placed in multiple rows
@@ -1492,7 +1486,7 @@ CBuildWindow::CBuildWindow(const CGTownInstance *Town, const CBuilding * Buildin
 	}
 	rowSize[1] = resAmount.size() - rowSize[0];
 
-	unsigned int index=0;
+	ui32 index=0;
 	for (size_t row=0; row<2; row++)
 	{
 		int posX = pos.w/2 - rowSize[row] * 40 + 24;
@@ -1532,11 +1526,11 @@ void CFortScreen::close()
 CFortScreen::CFortScreen(const CGTownInstance * town)
 {
 	OBJ_CONSTRUCTION_CAPTURING_ALL;
-	unsigned int fortSize = town->creatures.size();
-	if (fortSize > CREATURES_PER_TOWN && town->creatures.back().second.empty())
+	ui32 fortSize = town->creatures.size();
+	if (fortSize > GameConstants::CREATURES_PER_TOWN && town->creatures.back().second.empty())
 		fortSize--;
 	
-	if (fortSize == CREATURES_PER_TOWN)
+	if (fortSize == GameConstants::CREATURES_PER_TOWN)
 		background = new CPicture("TPCASTL7");
 	else
 		background = new CPicture("TPCASTL8");
@@ -1554,20 +1548,20 @@ CFortScreen::CFortScreen(const CGTownInstance * town)
 	             Point(10, 155), Point(404,155),
 	             Point(10, 288), Point(404,288);
 
-	if (fortSize == CREATURES_PER_TOWN)
+	if (fortSize == GameConstants::CREATURES_PER_TOWN)
 		positions += Point(206,421);
 	else
 		positions += Point(10, 421), Point(404,421);
 	
-	for (unsigned int i=0; i<fortSize; i++)
+	for (ui32 i=0; i<fortSize; i++)
 	{
 		int buildingID;
-		if (fortSize == CREATURES_PER_TOWN)
+		if (fortSize == GameConstants::CREATURES_PER_TOWN)
 		{
-			if (vstd::contains(town->builtBuildings, Buildings::DWELL_UP_FIRST+i))
-				buildingID = Buildings::DWELL_UP_FIRST+i;
+			if (vstd::contains(town->builtBuildings, EBuilding::DWELL_UP_FIRST+i))
+				buildingID = EBuilding::DWELL_UP_FIRST+i;
 			else
-				buildingID = Buildings::DWELL_FIRST+i;
+				buildingID = EBuilding::DWELL_FIRST+i;
 		}
 		else
 			buildingID = 22;
@@ -1678,7 +1672,7 @@ CFortScreen::RecruitArea::RecruitArea(int posX, int posY, const CGTownInstance *
 
 	if (vstd::contains(town->builtBuildings, buildingID))
 	{
-		unsigned int available = town->creatures[level].first;
+		ui32 available = town->creatures[level].first;
 		std::string availableText = CGI->generaltexth->allTexts[217]+ boost::lexical_cast<std::string>(available);
 		availableCount = new CLabel(78, 119, FONT_SMALL, CENTER, zwykly, availableText);
 	}

+ 5 - 7
client/CCastleInterface.h

@@ -1,7 +1,6 @@
-#ifndef __CCASTLEINTERFACE_H__
-#define __CCASTLEINTERFACE_H__
+#pragma once
+
 
-#include "../global.h"
 #include "CAnimation.h"
 #include "GUIBase.h"
 
@@ -31,6 +30,7 @@ struct Structure;
  *
  */
 
+
 /// Building "button"
 class CBuildingRect : public CShowableAnim
 {
@@ -41,7 +41,7 @@ public:
 	SDL_Surface* border;
 	SDL_Surface* area;
 	
-	unsigned int stateCounter;//For building construction - current stage in animation
+	ui32 stateCounter;//For building construction - current stage in animation
 	
 	CBuildingRect(CCastleBuildings * Par, const CGTownInstance *Town, const Structure *Str); //c-tor
 	~CBuildingRect(); //d-tor
@@ -234,7 +234,7 @@ class CHallInterface : public CIntObject
 		const CGTownInstance * town;
 		const CBuilding * building;
 
-		unsigned int state;//Buildings::EBuildStructure enum
+		ui32 state;//Buildings::EBuildStructure enum
 
 		CAnimImage * picture;
 		CAnimImage * panel;
@@ -392,5 +392,3 @@ class CBlacksmithDialog : public CIntObject
 public:
 	CBlacksmithDialog(bool possible, int creMachineID, int aid, int hid);
 };
-
-#endif // __CCASTLEINTERFACE_H__

+ 8 - 9
client/CConfigHandler.cpp

@@ -1,11 +1,9 @@
-//#define BOOST_SPIRIT_DEBUG
-#include "CConfigHandler.h"
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
+#include "StdInc.h"
 #include <boost/version.hpp>
-#include <boost/foreach.hpp>
-#include <fstream>
+#include "CConfigHandler.h"
+
 #include "../lib/JsonNode.h"
+#include "../lib/GameConstants.h"
 
 using namespace config;
 
@@ -148,10 +146,11 @@ CConfigHandler::~CConfigHandler(void)
 void config::CConfigHandler::init()
 {
 	std::vector<char> settings;
-	std::ifstream ifs(DATA_DIR "/config/settings.txt");
+	std::string settingsDir = GameConstants::DATA_DIR + "/config/settings.txt";
+	std::ifstream ifs(settingsDir.c_str());
 	if(!ifs)
 	{
-		tlog1 << "Cannot open " DATA_DIR "/config/settings.txt !" << std::endl;
+		tlog1 << "Cannot open " << GameConstants::DATA_DIR << "/config/settings.txt !" << std::endl;
 		return;
 	}
 	ifs.unsetf(std::ios::skipws); //  Turn of white space skipping on the stream
@@ -170,7 +169,7 @@ void config::CConfigHandler::init()
 		tlog2 << "Not entire config/settings.txt parsed!\n";
 
 	/* Read resolutions. */
-	const JsonNode config(DATA_DIR "/config/resolutions.json");
+	const JsonNode config(GameConstants::DATA_DIR + "/config/resolutions.json");
 	const JsonVector &guisettings_vec = config["GUISettings"].Vector();
 
 	BOOST_FOREACH(const JsonNode &g, guisettings_vec) {

+ 4 - 5
client/CConfigHandler.h

@@ -1,6 +1,7 @@
-#ifndef __CCONFIGHANDLER_H__
-#define __CCONFIGHANDLER_H__
-#include "../global.h"
+#pragma once
+
+
+
 class CAdvMapInt;
 
 /*
@@ -95,5 +96,3 @@ namespace config
 	};
 }
 extern config::CConfigHandler conf;
-
-#endif // __CCONFIGHANDLER_H__

+ 15 - 14
client/CCreatureAnimation.cpp

@@ -1,8 +1,9 @@
+#include "StdInc.h"
 #include "CCreatureAnimation.h"
+
 #include "../lib/CLodHandler.h"
 #include "../lib/VCMI_Lib.h"
 #include "../lib/vcmi_endian.h"
-#include <assert.h>
 #include "SDL_Extensions.h"
 
 /*
@@ -95,7 +96,7 @@ CCreatureAnimation::CCreatureAnimation(std::string name) : internalFrame(0), onc
 	frames = totalEntries;
 }
 
-int CCreatureAnimation::nextFrameMiddle(SDL_Surface *dest, int x, int y, bool attacker, unsigned char animCount, bool incrementFrame, bool yellowBorder, bool blueBorder, SDL_Rect * destRect)
+int CCreatureAnimation::nextFrameMiddle(SDL_Surface *dest, int x, int y, bool attacker, ui8 animCount, bool incrementFrame, bool yellowBorder, bool blueBorder, SDL_Rect * destRect)
 {
 	return nextFrame(dest, x-fullWidth/2, y-fullHeight/2, attacker, animCount, incrementFrame, yellowBorder, blueBorder, destRect);
 }
@@ -159,7 +160,7 @@ void CCreatureAnimation::playOnce( CCreatureAnim::EAnimType type )
 
 
 template<int bpp>
-int CCreatureAnimation::nextFrameT(SDL_Surface * dest, int x, int y, bool attacker, unsigned char animCount, bool IncrementFrame /*= true*/, bool yellowBorder /*= false*/, bool blueBorder /*= false*/, SDL_Rect * destRect /*= NULL*/)
+int CCreatureAnimation::nextFrameT(SDL_Surface * dest, int x, int y, bool attacker, ui8 animCount, bool IncrementFrame /*= true*/, bool yellowBorder /*= false*/, bool blueBorder /*= false*/, SDL_Rect * destRect /*= NULL*/)
 {
 	//increasing frame number
 	int SIndex = curFrame;
@@ -172,17 +173,17 @@ int CCreatureAnimation::nextFrameT(SDL_Surface * dest, int x, int y, bool attack
 		i, FullHeight,
 
 #endif
-	unsigned char SegmentType, SegmentLength;
-	unsigned int i;
+	ui8 SegmentType, SegmentLength;
+	ui32 i;
 
 	i = SEntries[SIndex].offset;
 
 	/*int prSize = read_le_u32(FDef + i);*/ i += 4; //TODO use me
-	const unsigned int defType2 = read_le_u32(FDef + i); i += 4;
-	const unsigned int FullWidth = read_le_u32(FDef + i); i += 4;
-	const unsigned int FullHeight = read_le_u32(FDef + i); i += 4;
-	const unsigned int SpriteWidth = read_le_u32(FDef + i); i += 4;
-	const unsigned int SpriteHeight = read_le_u32(FDef + i); i += 4;
+	const ui32 defType2 = read_le_u32(FDef + i); i += 4;
+	const ui32 FullWidth = read_le_u32(FDef + i); i += 4;
+	const ui32 FullHeight = read_le_u32(FDef + i); i += 4;
+	const ui32 SpriteWidth = read_le_u32(FDef + i); i += 4;
+	const ui32 SpriteHeight = read_le_u32(FDef + i); i += 4;
 	const int LeftMargin = read_le_u32(FDef + i); i += 4;
 	const int TopMargin = read_le_u32(FDef + i); i += 4;
 	const int RightMargin = FullWidth - SpriteWidth - LeftMargin;
@@ -224,7 +225,7 @@ int CCreatureAnimation::nextFrameT(SDL_Surface * dest, int x, int y, bool attack
 				const int remainder = ftcp % FullWidth;
 				int xB = (attacker ? remainder : FullWidth - remainder - 1) + x;
 
-				const unsigned char aCountMod = (animCount & 0x20) ? ((animCount & 0x1e) >> 1) << 4 : (0x0f - ((animCount & 0x1e) >> 1)) << 4;
+				const ui8 aCountMod = (animCount & 0x20) ? ((animCount & 0x1e) >> 1) << 4 : (0x0f - ((animCount & 0x1e) >> 1)) << 4;
 
 				for (int k = 0; k <= SegmentLength; k++)
 				{
@@ -265,7 +266,7 @@ int CCreatureAnimation::nextFrameT(SDL_Surface * dest, int x, int y, bool attack
 	return 0;
 }
 
-int CCreatureAnimation::nextFrame(SDL_Surface *dest, int x, int y, bool attacker, unsigned char animCount, bool IncrementFrame, bool yellowBorder, bool blueBorder, SDL_Rect * destRect)
+int CCreatureAnimation::nextFrame(SDL_Surface *dest, int x, int y, bool attacker, ui8 animCount, bool IncrementFrame, bool yellowBorder, bool blueBorder, SDL_Rect * destRect)
 {
 	switch(dest->format->BytesPerPixel)
 	{
@@ -296,10 +297,10 @@ inline void CCreatureAnimation::putPixel(
 	const int & ftcpX,
 	const int & ftcpY,
 	const BMPPalette & color,
-	const unsigned char & palc,
+	const ui8 & palc,
 	const bool & yellowBorder,
 	const bool & blueBorder,
-	const unsigned char & animCount
+	const ui8 & animCount
 ) const
 {	
 	if(palc!=0)

+ 8 - 12
client/CCreatureAnimation.h

@@ -1,8 +1,6 @@
-#ifndef __CCREATUREANIMATION_H__
-#define __CCREATUREANIMATION_H__
+#pragma once
 
 
-#include "../global.h"
 #include "CDefHandler.h"
 #include "GUIBase.h"
 #include "../client/CBitmapHandler.h"
@@ -41,22 +39,22 @@ private:
                 const int & ftcpX,
                 const int & ftcpY,
                 const BMPPalette & color,
-                const unsigned char & palc,
+                const ui8 & palc,
                 const bool & yellowBorder,
 				const bool & blueBorder,
-				const unsigned char & animCount
+				const ui8 & animCount
         ) const;
 
 	////////////
 
-	unsigned char * FDef; //animation raw data
+	ui8 * FDef; //animation raw data
 	int curFrame, internalFrame; //number of currently displayed frame
-	unsigned int frames; //number of frames
+	ui32 frames; //number of frames
 	CCreatureAnim::EAnimType type; //type of animation being displayed (-1 - whole animation, >0 - specified part [default: -1])
 	
 	template<int bpp>
-	int nextFrameT(SDL_Surface * dest, int x, int y, bool attacker, unsigned char animCount, bool incrementFrame = true, bool yellowBorder = false, bool blueBorder = false, SDL_Rect * destRect = NULL); //0 - success, any other - error //print next 
-	int nextFrameMiddle(SDL_Surface * dest, int x, int y, bool attacker, unsigned char animCount, bool IncrementFrame = true, bool yellowBorder = false, bool blueBorder = false, SDL_Rect * destRect = NULL); //0 - success, any other - error //print next 
+	int nextFrameT(SDL_Surface * dest, int x, int y, bool attacker, ui8 animCount, bool incrementFrame = true, bool yellowBorder = false, bool blueBorder = false, SDL_Rect * destRect = NULL); //0 - success, any other - error //print next 
+	int nextFrameMiddle(SDL_Surface * dest, int x, int y, bool attacker, ui8 animCount, bool IncrementFrame = true, bool yellowBorder = false, bool blueBorder = false, SDL_Rect * destRect = NULL); //0 - success, any other - error //print next 
 	
 	std::map<int, std::vector<int> > frameGroups; //groups of frames; [groupID] -> vector of frame IDs in group
 	bool once;
@@ -69,7 +67,7 @@ public:
 	void setType(CCreatureAnim::EAnimType type); //sets type of animation and cleares framecount
 	CCreatureAnim::EAnimType getType() const; //returns type of animation
 
-	int nextFrame(SDL_Surface * dest, int x, int y, bool attacker, unsigned char animCount, bool incrementFrame = true, bool yellowBorder = false, bool blueBorder = false, SDL_Rect * destRect = NULL); //0 - success, any other - error //print next 
+	int nextFrame(SDL_Surface * dest, int x, int y, bool attacker, ui8 animCount, bool incrementFrame = true, bool yellowBorder = false, bool blueBorder = false, SDL_Rect * destRect = NULL); //0 - success, any other - error //print next 
 	void incrementFrame();
 	int getFrame() const; // Gets the current frame ID relative to DEF file.
 	int getAnimationFrame() const; // Gets the current frame ID relative to frame group.
@@ -80,5 +78,3 @@ public:
 
 	int framesInGroup(CCreatureAnim::EAnimType group) const; //retirns number of fromes in given group
 };
-
-#endif // __CCREATUREANIMATION_H__

+ 7 - 12
client/CCreatureWindow.cpp

@@ -1,4 +1,6 @@
+#include "StdInc.h"
 #include "CCreatureWindow.h"
+
 #include "../lib/CCreatureSet.h"
 #include "CGameInfo.h"
 #include "../lib/CGeneralTextHandler.h"
@@ -14,13 +16,6 @@
 #include "CPlayerInterface.h"
 #include "CConfigHandler.h"
 
-#include <boost/algorithm/string/replace.hpp>
-#include <boost/assign/std/vector.hpp> 
-#include <boost/assign/list_of.hpp>
-#include <boost/lexical_cast.hpp>
-#include <boost/format.hpp>
-#include <boost/bind.hpp>
-#include <boost/foreach.hpp>
 #include "../lib/CGameState.h"
 #include "../lib/BattleState.h"
 #include "../lib/CSpellHandler.h"
@@ -180,8 +175,8 @@ void CCreatureWindow::init(const CStackInstance *Stack, const CBonusSystemNode *
 	}
 
 	bonusRows = std::min ((int)((bonusItems.size() + 1) / 2), (conf.cc.resy - 230) / 60);
-	amin(bonusRows, 4);
-	amax(bonusRows, 1);
+	vstd::amin(bonusRows, 4);
+	vstd::amax(bonusRows, 1);
 
 	bitmap = new CPicture("CreWin" + boost::lexical_cast<std::string>(bonusRows) + ".pcx"); //1 to 4 rows for now
 	bitmap->colorizeAndConvert(LOCPLINT->playerID);
@@ -206,7 +201,7 @@ void CCreatureWindow::init(const CStackInstance *Stack, const CBonusSystemNode *
 	new CPicture(graphics->pskillsm->ourImages[4].bitmap, 335, 50, false); //exp icon - Print it always?
 	if (type) //not in fort window
 	{
-		if (STACK_EXP)
+		if (GameConstants::STACK_EXP)
 		{
 			int rank = std::min(stack->getExpRank(), 10); //hopefully nobody adds more
 			printAtMiddle(CGI->generaltexth->zcrexp[rank] + " [" + boost::lexical_cast<std::string>(rank) + "]", 436, 62, FONT_MEDIUM, tytulowy,*bitmap);
@@ -214,7 +209,7 @@ void CCreatureWindow::init(const CStackInstance *Stack, const CBonusSystemNode *
 			if (type > BATTLE) //we need it only on adv. map
 			{
 				int tier = stack->type->level;
-				if (!iswith(tier, 1, 7))
+				if (!vstd::iswithin(tier, 1, 7))
 					tier = 0;
 				int number;
 				std::string expText = CGI->generaltexth->zcrexp[324];
@@ -253,7 +248,7 @@ void CCreatureWindow::init(const CStackInstance *Stack, const CBonusSystemNode *
 			}
 		}
 
-		if (STACK_ARTIFACT && type > BATTLE)
+		if (GameConstants::STACK_ARTIFACT && type > BATTLE)
 		{
 			//SDL_Rect rect = genRect(44,44,465,98);
 			//creatureArtifact = new CArtPlace(NULL);

+ 3 - 1
client/CCreatureWindow.h

@@ -1,4 +1,6 @@
-#include "../global.h"
+#pragma once
+
+
 #include "GUIBase.h"
 #include "GUIClasses.h"
 #include "../lib/HeroBonus.h"

+ 2 - 1
client/CCursorHandler.cpp

@@ -1,5 +1,6 @@
-#include "../stdafx.h"
+#include "StdInc.h"
 #include "CCursorHandler.h"
+
 #include "SDL.h"
 #include "SDL_Extensions.h"
 #include "CGameInfo.h"

+ 4 - 8
client/CCursorHandler.h

@@ -1,7 +1,7 @@
-#ifndef __CCURSORHANDLER_H__
-#define __CCURSORHANDLER_H__
-#include "../global.h"
-#include <vector>
+#pragma once
+
+
+
 struct SDL_Thread;
 class CDefHandler;
 struct SDL_Surface;
@@ -41,7 +41,3 @@ public:
 	void centerCursor();
 	~CCursorHandler();
 };
-
-
-
-#endif // __CCURSORHANDLER_H__

+ 33 - 33
client/CDefHandler.cpp

@@ -1,7 +1,7 @@
-#include "../stdafx.h"
+#include "StdInc.h"
 #include "SDL.h"
 #include "CDefHandler.h"
-#include <sstream>
+
 #include "../lib/CLodHandler.h"
 #include "../lib/VCMI_Lib.h"
 #include "../lib/vcmi_endian.h"
@@ -51,19 +51,19 @@ CDefEssential::~CDefEssential()
 		SDL_FreeSurface(ourImages[i].bitmap);
 }
 
-void CDefHandler::openFromMemory(unsigned char *table, const std::string & name)
+void CDefHandler::openFromMemory(ui8 *table, const std::string & name)
 {
 	BMPPalette palette[256];
 	SDefEntry &de = * reinterpret_cast<SDefEntry *>(table);
-	unsigned char *p;
+	ui8 *p;
 
 	defName = name;
 	DEFType = SDL_SwapLE32(de.DEFType);
 	width = SDL_SwapLE32(de.width);
 	height = SDL_SwapLE32(de.height);
-	unsigned int totalBlocks = SDL_SwapLE32(de.totalBlocks);
+	ui32 totalBlocks = SDL_SwapLE32(de.totalBlocks);
 
-	for (unsigned int it=0;it<256;it++)
+	for (ui32 it=0;it<256;it++)
 	{
 		palette[it].R = de.palette[it].R;
 		palette[it].G = de.palette[it].G;
@@ -72,22 +72,22 @@ void CDefHandler::openFromMemory(unsigned char *table, const std::string & name)
 	}
 
 	// The SDefEntryBlock starts just after the SDefEntry
-	p = reinterpret_cast<unsigned char *>(&de);
+	p = reinterpret_cast<ui8 *>(&de);
 	p += sizeof(de);
 
 	int totalEntries=0;
-	for (unsigned int z=0; z<totalBlocks; z++)
+	for (ui32 z=0; z<totalBlocks; z++)
 	{
 		SDefEntryBlock &block = * reinterpret_cast<SDefEntryBlock *>(p);
-		unsigned int totalInBlock;
+		ui32 totalInBlock;
 
 		totalInBlock = read_le_u32(&block.totalInBlock);
 
-		for (unsigned int j=SEntries.size(); j<totalEntries+totalInBlock; j++)
+		for (ui32 j=SEntries.size(); j<totalEntries+totalInBlock; j++)
 			SEntries.push_back(SEntry());
 
 		p = block.data;
-		for (unsigned int j=0; j<totalInBlock; j++)
+		for (ui32 j=0; j<totalInBlock; j++)
 		{
 			char Buffer[13];
 			memcpy(Buffer, p, 12);
@@ -95,25 +95,25 @@ void CDefHandler::openFromMemory(unsigned char *table, const std::string & name)
 			SEntries[totalEntries+j].name=Buffer;
 			p += 13;
 		}
-		for (unsigned int j=0; j<totalInBlock; j++)
+		for (ui32 j=0; j<totalInBlock; j++)
 		{ 
 			SEntries[totalEntries+j].offset = read_le_u32(p);
 			p += 4;
 		}
 		//totalEntries+=totalInBlock;
-		for(unsigned int hh=0; hh<totalInBlock; ++hh)
+		for(ui32 hh=0; hh<totalInBlock; ++hh)
 		{
 			SEntries[totalEntries].group = z;
 			++totalEntries;
 		}
 	}
 
-	for(unsigned int j=0; j<SEntries.size(); ++j)
+	for(ui32 j=0; j<SEntries.size(); ++j)
 	{
 		SEntries[j].name = SEntries[j].name.substr(0, SEntries[j].name.find('.')+4);
 	}
-	//RWEntries = new unsigned int[height];
-	for(unsigned int i=0; i < SEntries.size(); ++i)
+	//RWEntries = new ui32[height];
+	for(ui32 i=0; i < SEntries.size(); ++i)
 	{
 		Cimage nimg;
 		nimg.bitmap = getSprite(i, table, palette);
@@ -123,17 +123,17 @@ void CDefHandler::openFromMemory(unsigned char *table, const std::string & name)
 	}
 }
 
-void CDefHandler::expand(unsigned char N,unsigned char & BL, unsigned char & BR)
+void CDefHandler::expand(ui8 N,ui8 & BL, ui8 & BR)
 {
 	BL = (N & 0xE0) >> 5;
 	BR = N & 0x1F;
 }
 
-SDL_Surface * CDefHandler::getSprite (int SIndex, const unsigned char * FDef, const BMPPalette * palette) const
+SDL_Surface * CDefHandler::getSprite (int SIndex, const ui8 * FDef, const BMPPalette * palette) const
 {
 	SDL_Surface * ret=NULL;
 
-	unsigned int BaseOffset, 
+	ui32 BaseOffset, 
 		SpriteWidth, SpriteHeight, //format of sprite
 		TotalRowLength,			// length of read segment
 		add, FullHeight,FullWidth,
@@ -143,7 +143,7 @@ SDL_Surface * CDefHandler::getSprite (int SIndex, const unsigned char * FDef, co
 	int LeftMargin, RightMargin, TopMargin, BottomMargin;
 
 
-	unsigned char SegmentType;//, BL, BR; //TODO use me
+	ui8 SegmentType;//, BL, BR; //TODO use me
 
 	BaseOffset = SEntries[SIndex].offset;
 	SSpriteDef sd = * reinterpret_cast<const SSpriteDef *>(FDef + BaseOffset);
@@ -201,7 +201,7 @@ SDL_Surface * CDefHandler::getSprite (int SIndex, const unsigned char * FDef, co
 	{
 	case 0:
 	{
-		for (unsigned int i=0;i<SpriteHeight;i++)
+		for (ui32 i=0;i<SpriteHeight;i++)
 		{
 			if (LeftMargin>0)
 				ftcp += LeftMargin;
@@ -218,9 +218,9 @@ SDL_Surface * CDefHandler::getSprite (int SIndex, const unsigned char * FDef, co
 
 	case 1:
 	{
-		const unsigned int * RWEntriesLoc = reinterpret_cast<const unsigned int *>(FDef+BaseOffset);
+		const ui32 * RWEntriesLoc = reinterpret_cast<const ui32 *>(FDef+BaseOffset);
 		BaseOffset += sizeof(int) * SpriteHeight;
-		for (unsigned int i=0;i<SpriteHeight;i++)
+		for (ui32 i=0;i<SpriteHeight;i++)
 		{
 			BaseOffset=BaseOffsetor + read_le_u32(RWEntriesLoc + i);
 			if (LeftMargin>0)
@@ -229,7 +229,7 @@ SDL_Surface * CDefHandler::getSprite (int SIndex, const unsigned char * FDef, co
 			TotalRowLength=0;
 			do
 			{
-				unsigned int SegmentLength;
+				ui32 SegmentLength;
 
 				SegmentType=FDef[BaseOffset++];
 				SegmentLength=FDef[BaseOffset++] + 1;
@@ -262,7 +262,7 @@ SDL_Surface * CDefHandler::getSprite (int SIndex, const unsigned char * FDef, co
 	{
 		BaseOffset = BaseOffsetor + read_le_u16(FDef + BaseOffsetor);
 
-		for (unsigned int i=0;i<SpriteHeight;i++)
+		for (ui32 i=0;i<SpriteHeight;i++)
 		{
 			//BaseOffset = BaseOffsetor+RWEntries[i];
 			if (LeftMargin>0)
@@ -273,8 +273,8 @@ SDL_Surface * CDefHandler::getSprite (int SIndex, const unsigned char * FDef, co
 			do
 			{
 				SegmentType=FDef[BaseOffset++];
-				unsigned char code = SegmentType / 32;
-				unsigned char value = (SegmentType & 31) + 1;
+				ui8 code = SegmentType / 32;
+				ui8 value = (SegmentType & 31) + 1;
 				if(code==7)
 				{
 					memcpy(reinterpret_cast<char*>(ret->pixels)+ftcp, &FDef[BaseOffset], value);
@@ -302,7 +302,7 @@ SDL_Surface * CDefHandler::getSprite (int SIndex, const unsigned char * FDef, co
 
 	case 3:
 	{
-		for (unsigned int i=0;i<SpriteHeight;i++)
+		for (ui32 i=0;i<SpriteHeight;i++)
 		{
 			BaseOffset = BaseOffsetor + read_le_u16(FDef + BaseOffsetor+i*2*(SpriteWidth/32));
 			if (LeftMargin>0)
@@ -313,11 +313,11 @@ SDL_Surface * CDefHandler::getSprite (int SIndex, const unsigned char * FDef, co
 			do
 			{
 				SegmentType=FDef[BaseOffset++];
-				unsigned char code = SegmentType / 32;
-				unsigned char value = (SegmentType & 31) + 1;
+				ui8 code = SegmentType / 32;
+				ui8 value = (SegmentType & 31) + 1;
 
-				int len = std::min<unsigned int>(value, SpriteWidth - TotalRowLength) - std::max(0, -LeftMargin);
-				amax(len, 0);
+				int len = std::min<ui32>(value, SpriteWidth - TotalRowLength) - std::max(0, -LeftMargin);
+				vstd::amax(len, 0);
 
 				if(code==7)
 				{
@@ -365,7 +365,7 @@ CDefEssential * CDefHandler::essentialize()
 
 CDefHandler * CDefHandler::giveDef(const std::string & defName)
 {
-	unsigned char * data = spriteh->giveFile(defName, FILE_ANIMATION);
+	ui8 * data = spriteh->giveFile(defName, FILE_ANIMATION);
 	if(!data)
 		throw "bad def name!";
 	CDefHandler * nh = new CDefHandler();

+ 11 - 16
client/CDefHandler.h

@@ -1,7 +1,6 @@
-#ifndef __CDEFHANDLER_H__
-#define __CDEFHANDLER_H__
+#pragma once
+
 
-#include "../global.h"
 
 struct SDL_Surface;
 struct BMPPalette;
@@ -30,7 +29,7 @@ struct SDefEntryBlock {
 	ui32 totalInBlock;
 	ui32 unknown2;
 	ui32 unknown3;
-	unsigned char data[0];
+	ui8 data[0];
 };
 
 // Def entry in file. Integer fields are all little endian and will
@@ -42,9 +41,9 @@ struct SDefEntry {
 	ui32 totalBlocks;
 
 	struct {
-		unsigned char R;
-		unsigned char G;
-		unsigned char B;
+		ui8 R;
+		ui8 G;
+		ui8 B;
 	} palette[256];
 
 	// SDefEntry is followed by a series of SDefEntryBlock
@@ -75,9 +74,9 @@ public:
 class CDefHandler
 {
 private:
-	unsigned int DEFType;
+	ui32 DEFType;
 	int length;
-	//unsigned int * RWEntries;
+	//ui32 * RWEntries;
 	struct SEntry
 	{
 		std::string name;
@@ -94,15 +93,11 @@ public:
 
 	CDefHandler(); //c-tor
 	~CDefHandler(); //d-tor
-	SDL_Surface * getSprite (int SIndex, const unsigned char * FDef, const BMPPalette * palette) const; //saves picture with given number to "testtt.bmp"
-	static void expand(unsigned char N,unsigned char & BL, unsigned char & BR);
-	void openFromMemory(unsigned char * table, const std::string & name);
+	SDL_Surface * getSprite (int SIndex, const ui8 * FDef, const BMPPalette * palette) const; //saves picture with given number to "testtt.bmp"
+	static void expand(ui8 N,ui8 & BL, ui8 & BR);
+	void openFromMemory(ui8 * table, const std::string & name);
 	CDefEssential * essentialize();
 
 	static CDefHandler * giveDef(const std::string & defName);
 	static CDefEssential * giveDefEss(const std::string & defName);
 };
-
-
-
-#endif // __CDEFHANDLER_H__

+ 2 - 1
client/CGameInfo.cpp

@@ -1,5 +1,6 @@
-#include "../stdafx.h"
+#include "StdInc.h"
 #include "CGameInfo.h"
+
 #include "../lib/VCMI_Lib.h"
 
 /*

+ 5 - 14
client/CGameInfo.h

@@ -1,8 +1,7 @@
-#ifndef __CGAMEINFO_H__
-#define __CGAMEINFO_H__
-#include "../global.h"
-#include "../lib/ConstTransitivePtr.h"
+#pragma once
+
 
+#include "../lib/ConstTransitivePtr.h"
 
 /*
  * CGameInfo.h, part of VCMI engine
@@ -42,6 +41,7 @@ public:
 	CCursorHandler * curh;
 	IMainVideoPlayer * videoh;
 };
+extern CClientState * CCS;
 
 struct Mapa;
 
@@ -70,13 +70,4 @@ public:
 
 	CGameInfo();
 };
-
-//	
-// public:
-// 	
-// 	ConstTransitivePtr<CGeneralTextHandler> generaltexth;
-
-
-
-
-#endif // __CGAMEINFO_H__
+extern const CGameInfo* CGI;

+ 4 - 11
client/CHeroWindow.cpp

@@ -1,4 +1,5 @@
-#include "../stdafx.h"
+#include "StdInc.h"
+
 #include "AdventureMapButton.h"
 #include "CAdvmapInterface.h"
 #include "../CCallback.h"
@@ -13,21 +14,13 @@
 #include "CSpellWindow.h"
 #include "CConfigHandler.h"
 #include "CPlayerInterface.h"
-#include "../global.h"
+
 #include "../lib/CArtHandler.h"
 #include "CDefHandler.h"
 #include "../lib/CGeneralTextHandler.h"
 #include "../lib/CHeroHandler.h"
 #include "../lib/CLodHandler.h"
 #include "../lib/CObjectHandler.h"
-#include <boost/algorithm/string/replace.hpp>
-#include <boost/assign/list_of.hpp>
-#include <boost/assign/std/vector.hpp>
-#include <cstdlib>
-#include <sstream>
-#include <boost/lexical_cast.hpp>
-#include <boost/format.hpp>
-#include <boost/foreach.hpp>
 
 #undef min
 
@@ -131,7 +124,7 @@ CHeroWindow::CHeroWindow(const CGHeroInstance *hero)
 	//areas
 	portraitArea = new LRClickableAreaWText(Rect(18, 18, 58, 64));
 
-	for(int v=0; v<PRIMARY_SKILLS; ++v)
+	for(int v=0; v<GameConstants::PRIMARY_SKILLS; ++v)
 	{
 		LRClickableAreaWTextComp *area = new LRClickableAreaWTextComp(Rect(30 + 70*v, 109, 42, 64), SComponent::primskill);
 		area->text = CGI->generaltexth->arraytxt[2+v];

+ 2 - 4
client/CHeroWindow.h

@@ -1,5 +1,5 @@
-#ifndef __CHEROWINDOW_H__
-#define __CHEROWINDOW_H__
+#pragma once
+
 #include "../lib/HeroBonus.h"
 
 
@@ -95,5 +95,3 @@ public:
 	friend void CArtPlace::clickLeft(tribool down, bool previousState);
 	friend class CPlayerInterface;
 };
-
-#endif // __CHEROWINDOW_H__

+ 16 - 21
client/CKingdomInterface.cpp

@@ -1,11 +1,6 @@
+#include "StdInc.h"
 #include "CKingdomInterface.h"
 
-#include <boost/algorithm/string/replace.hpp>
-#include <boost/bind.hpp>
-#include <boost/lexical_cast.hpp>
-#include <boost/foreach.hpp>
-#include <boost/format.hpp>
-
 #include "../CCallback.h"
 #include "../lib/CCreatureHandler.h" //creatures name for objects list
 #include "../lib/CGeneralTextHandler.h"
@@ -472,7 +467,7 @@ CKingdomInterface::CKingdomInterface()
 	background = new CPicture(conf.go()->ac.overviewBg);
 	background->colorize(LOCPLINT->playerID);
 	pos = background->center();
-	unsigned int footerPos = conf.go()->ac.overviewSize * 116;
+	ui32 footerPos = conf.go()->ac.overviewSize * 116;
 
 	tabArea = new CTabbedInt(boost::bind(&CKingdomInterface::createMainTab, this, _1), CTabbedInt::DestroyFunc(), Point(4,4));
 
@@ -487,7 +482,7 @@ CKingdomInterface::CKingdomInterface()
 
 void CKingdomInterface::generateObjectsList(const std::vector<const CGObjectInstance * > &ownedObjects)
 {
-	unsigned int footerPos = conf.go()->ac.overviewSize * 116;
+	ui32 footerPos = conf.go()->ac.overviewSize * 116;
 	size_t dwellSize = (footerPos - 64)/57;
 
 	//Map used to determine image number for several objects
@@ -563,8 +558,8 @@ CIntObject * CKingdomInterface::createMainTab(size_t index)
 
 void CKingdomInterface::generateMinesList(const std::vector<const CGObjectInstance * > &ownedObjects)
 {
-	unsigned int footerPos = conf.go()->ac.overviewSize * 116;
-	std::vector<int> minesCount(RESOURCE_QUANTITY, 0);
+	ui32 footerPos = conf.go()->ac.overviewSize * 116;
+	std::vector<int> minesCount(GameConstants::RESOURCE_QUANTITY, 0);
 	int totalIncome=0;
 
 	BOOST_FOREACH(const CGObjectInstance * object, ownedObjects)
@@ -609,7 +604,7 @@ void CKingdomInterface::generateMinesList(const std::vector<const CGObjectInstan
 
 void CKingdomInterface::generateButtons()
 {
-	unsigned int footerPos = conf.go()->ac.overviewSize * 116;
+	ui32 footerPos = conf.go()->ac.overviewSize * 116;
 
 	//Main control buttons
 	btnHeroes = new AdventureMapButton (CGI->generaltexth->overview[11], CGI->generaltexth->overview[6],
@@ -692,8 +687,8 @@ CKingdHeroList::CKingdHeroList(size_t maxSize)
 	heroLabel =   new CLabel(150, 10, FONT_MEDIUM, CENTER, zwykly, CGI->generaltexth->overview[0]);
 	skillsLabel = new CLabel(500, 10, FONT_MEDIUM, CENTER, zwykly, CGI->generaltexth->overview[1]);
 
-	unsigned int townCount = LOCPLINT->cb->howManyHeroes(false);
-	unsigned int size = conf.go()->ac.overviewSize*116 + 19;
+	ui32 townCount = LOCPLINT->cb->howManyHeroes(false);
+	ui32 size = conf.go()->ac.overviewSize*116 + 19;
 	heroes = new CListBox(boost::bind(&CKingdHeroList::createHeroItem, this, _1), boost::bind(&CKingdHeroList::destroyHeroItem, this, _1),
 	                      Point(19,21), Point(0,116), maxSize, townCount, 0, 1, Rect(-19, -21, size, size) );
 }
@@ -710,7 +705,7 @@ void CKingdHeroList::updateGarrisons()
 
 CIntObject* CKingdHeroList::createHeroItem(size_t index)
 {
-	unsigned int picCount = conf.go()->ac.overviewPics;
+	ui32 picCount = conf.go()->ac.overviewPics;
 	size_t heroesCount = LOCPLINT->cb->howManyHeroes(false);
 
 	if (index < heroesCount)
@@ -745,8 +740,8 @@ CKingdTownList::CKingdTownList(size_t maxSize)
 	garrHeroLabel  = new CLabel(375,10,FONT_MEDIUM, CENTER, zwykly, CGI->generaltexth->overview[4]);
 	visitHeroLabel = new CLabel(608,10,FONT_MEDIUM, CENTER, zwykly, CGI->generaltexth->overview[5]);
 
-	unsigned int townCount = LOCPLINT->cb->howManyTowns();
-	unsigned int size = conf.go()->ac.overviewSize*116 + 19;
+	ui32 townCount = LOCPLINT->cb->howManyTowns();
+	ui32 size = conf.go()->ac.overviewSize*116 + 19;
 	towns = new CListBox(boost::bind(&CKingdTownList::createTownItem, this, _1), CListBox::DestroyFunc(),
 	                     Point(19,21), Point(0,116), maxSize, townCount, 0, 1, Rect(-19, -21, size, size) );
 }
@@ -774,7 +769,7 @@ void CKingdTownList::updateGarrisons()
 
 CIntObject* CKingdTownList::createTownItem(size_t index)
 {
-	unsigned int picCount = conf.go()->ac.overviewPics;
+	ui32 picCount = conf.go()->ac.overviewPics;
 	size_t townsCount = LOCPLINT->cb->howManyTowns();
 
 	if (index < townsCount)
@@ -799,9 +794,9 @@ CTownItem::CTownItem(const CGTownInstance* Town):
 
 	size_t iconIndex = town->subID*2;
 	if (!town->hasFort())
-		iconIndex += F_NUMBER*2;
+		iconIndex += GameConstants::F_NUMBER*2;
 
-	if(town->builded >= MAX_BUILDING_PER_TURN)
+	if(town->builded >= GameConstants::MAX_BUILDING_PER_TURN)
 		iconIndex++;
 
 	picture = new CAnimImage("ITPT", iconIndex, 0, 5, 6);
@@ -929,11 +924,11 @@ CHeroItem::CHeroItem(const CGHeroInstance* Hero, CArtifactsOfHero::SCommonPart *
 	name = new CLabel(73, 7, FONT_SMALL, TOPLEFT, zwykly, hero->name);
 	artsText = new CLabel(320, 55, FONT_SMALL, CENTER, zwykly, CGI->generaltexth->overview[2]);
 
-	for (size_t i=0; i<PRIMARY_SKILLS; i++)
+	for (size_t i=0; i<GameConstants::PRIMARY_SKILLS; i++)
 		heroInfo.push_back(new InfoBox(Point(78+i*36, 26), InfoBox::POS_DOWN, InfoBox::SIZE_SMALL, 
 		                   new InfoBoxHeroData(IInfoBoxData::HERO_PRIMARY_SKILL, hero, i)));
 
-	for (size_t i=0; i<SKILL_PER_HERO; i++)
+	for (size_t i=0; i<GameConstants::SKILL_PER_HERO; i++)
 		heroInfo.push_back(new InfoBox(Point(410+i*36, 5), InfoBox::POS_NONE, InfoBox::SIZE_SMALL,
 		                   new InfoBoxHeroData(IInfoBoxData::HERO_SECONDARY_SKILL, hero, i)));
 

+ 1 - 4
client/CKingdomInterface.h

@@ -1,8 +1,5 @@
 #pragma once
 
-#include "../global.h"
-
-#include <list>
 
 #include "GUIBase.h"
 #include "GUIClasses.h"
@@ -202,7 +199,7 @@ private:
 	struct OwnedObjectInfo
 	{
 		int imageID;
-		unsigned int count;
+		ui32 count;
 		std::string hoverText;
 	};
 	std::vector<OwnedObjectInfo> objects;

+ 31 - 40
client/CMT.cpp

@@ -1,23 +1,16 @@
 // CMT.cpp : Defines the entry point for the console application.
 //
-#include "../stdafx.h"
-#include <cmath>
-#include <string>
-#include <vector>
-#include <queue>
-#include <cmath>
-#include <boost/algorithm/string.hpp>
+#include "StdInc.h"
 #include <boost/filesystem/operations.hpp>
-#include <boost/thread.hpp>
 #include <SDL_mixer.h>
 #include "SDL_Extensions.h"
 #include "SDL_framerate.h"
 #include "CGameInfo.h"
 #include "mapHandler.h"
-#include "../global.h"
+
 #include "CPreGame.h"
 #include "CCastleInterface.h"
-#include "../CConsoleHandler.h"
+#include "../lib/CConsoleHandler.h"
 #include "CCursorHandler.h"
 #include "../lib/CGameState.h"
 #include "../CCallback.h"
@@ -39,18 +32,16 @@
 #include "../lib/Connection.h"
 #include "../lib/VCMI_Lib.h"
 #include "../lib/VCMIDirs.h"
-#include <cstdlib>
 #include "../lib/NetPacks.h"
 #include "CMessage.h"
 #include "../lib/CObjectHandler.h"
-#include <boost/program_options.hpp>
 #include "../lib/CArtHandler.h"
 #include "../lib/CScriptingModule.h"
+#include "../lib/GameConstants.h"
 
 #ifdef _WIN32
 #include "SDL_syswm.h"
 #endif
-#include <boost/foreach.hpp>
 #include "../lib/CDefObjInfoHandler.h"
 
 #if __MINGW32__
@@ -70,7 +61,7 @@ namespace po = boost::program_options;
  */
 
 std::string NAME_AFFIX = "client";
-std::string NAME = NAME_VER + std::string(" (") + NAME_AFFIX + ')'; //application name
+std::string NAME = GameConstants::VCMI_VERSION + std::string(" (") + NAME_AFFIX + ')'; //application name
 CGuiHandler GH;
 static CClient *client;
 SDL_Surface *screen = NULL, //main screen surface 
@@ -104,14 +95,14 @@ void startGame(StartInfo * options, CConnection *serv = NULL);
 
 void init()
 {
-	timeHandler tmh, pomtime;
+	StopWatch tmh, pomtime;
 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
 	int rmask = 0xff000000;int gmask = 0x00ff0000;int bmask = 0x0000ff00;int amask = 0x000000ff;
 #else
 	int rmask = 0x000000ff;	int gmask = 0x0000ff00;	int bmask = 0x00ff0000;	int amask = 0xff000000;
 #endif
 	CSDL_Ext::std32bppSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, 1, 1, 32, rmask, gmask, bmask, amask);
-	tlog0 << "\tInitializing minors: " << pomtime.getDif() << std::endl;
+	tlog0 << "\tInitializing minors: " << pomtime.getDiff() << std::endl;
 	{
 		//read system options
 		CLoadFile settings(GVCMIDirs.UserPath + "/config/sysopts.bin", 727);
@@ -128,7 +119,7 @@ void init()
 			GDefaultOptions.settingsChanged();
 		}
 	}
-	THC tlog0<<"\tLoading default system settings: "<<pomtime.getDif()<<std::endl;
+	tlog0 << "\tLoading default system settings: " << pomtime.getDiff() << std::endl;
 
 	//initializing audio
 	// Note: because of interface button range, volume can only be a
@@ -139,43 +130,43 @@ void init()
 	CCS->musich = new CMusicHandler;
 	CCS->musich->init();
 	CCS->musich->setVolume(GDefaultOptions.musicVolume);
-	tlog0<<"\tInitializing sound: "<<pomtime.getDif()<<std::endl;
-	tlog0<<"Initializing screen and sound handling: "<<tmh.getDif()<<std::endl;
+	tlog0<<"\tInitializing sound: "<<pomtime.getDiff()<<std::endl;
+	tlog0<<"Initializing screen and sound handling: "<<tmh.getDiff()<<std::endl;
 
 	initDLL(::console,logfile);
 	const_cast<CGameInfo*>(CGI)->setFromLib();
 	CCS->soundh->initCreaturesSounds(CGI->creh->creatures);
 	CCS->soundh->initSpellsSounds(CGI->spellh->spells);
-	tlog0<<"Initializing VCMI_Lib: "<<tmh.getDif()<<std::endl;
+	tlog0<<"Initializing VCMI_Lib: "<<tmh.getDiff()<<std::endl;
 
-	pomtime.getDif();
+	pomtime.getDiff();
 	CCS->curh = new CCursorHandler;
 	CCS->curh->initCursor();
 	CCS->curh->show();
-	tlog0<<"Screen handler: "<<pomtime.getDif()<<std::endl;
-	pomtime.getDif();
+	tlog0<<"Screen handler: "<<pomtime.getDiff()<<std::endl;
+	pomtime.getDiff();
 	graphics = new Graphics();
 	graphics->loadHeroAnims();
-	tlog0<<"\tMain graphics: "<<tmh.getDif()<<std::endl;
-	tlog0<<"Initializing game graphics: "<<tmh.getDif()<<std::endl;
+	tlog0<<"\tMain graphics: "<<tmh.getDiff()<<std::endl;
+	tlog0<<"Initializing game graphics: "<<tmh.getDiff()<<std::endl;
 
 	CMessage::init();
-	tlog0<<"Message handler: "<<tmh.getDif()<<std::endl;
+	tlog0<<"Message handler: "<<tmh.getDiff()<<std::endl;
 	//CPG = new CPreGame(); //main menu and submenus
 	//tlog0<<"Initialization CPreGame (together): "<<tmh.getDif()<<std::endl;
 }
 
 static void prog_version(void)
 {
-	printf("%s\n", NAME_VER);
-	printf("  data directory:    %s\n", DATA_DIR);
-	printf("  library directory: %s\n", LIB_DIR);
-	printf("  binary directory:  %s\n", BIN_DIR);
+	printf("%s\n", GameConstants::VCMI_VERSION.c_str());
+	printf("  data directory:    %s\n", GameConstants::DATA_DIR.c_str());
+	printf("  library directory: %s\n", GameConstants::LIB_DIR.c_str());
+	printf("  binary directory:  %s\n", GameConstants::BIN_DIR.c_str());
 }
 
 static void prog_help(const char *progname)
 {
-	printf("%s - A Heroes of Might and Magic 3 clone\n", NAME_VER);
+	printf("%s - A Heroes of Might and Magic 3 clone\n", GameConstants::VCMI_VERSION.c_str());
     printf("Copyright (C) 2007-2010 VCMI dev team - see AUTHORS file\n");
     printf("This is free software; see the source for copying conditions. There is NO\n");
     printf("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
@@ -229,17 +220,17 @@ int main(int argc, char** argv)
 	putenv((char*)"SDL_VIDEO_WINDOW_POS");
 	putenv((char*)"SDL_VIDEO_CENTERED=1");
 
-	timeHandler total, pomtime;
+	StopWatch total, pomtime;
 	std::cout.flags(std::ios::unitbuf);
 	logfile = new std::ofstream((GVCMIDirs.UserPath + "/VCMI_Client_log.txt").c_str());
 	console = new CConsoleHandler;
 	*console->cb = boost::bind(&processCommand, _1);
 	console->start();
 	atexit(dispose);
-	tlog0 <<"Creating console and logfile: "<<pomtime.getDif() << std::endl;
+	tlog0 <<"Creating console and logfile: "<<pomtime.getDiff() << std::endl;
 
 	conf.init();
-	tlog0 <<"Loading settings: "<<pomtime.getDif() << std::endl;
+	tlog0 <<"Loading settings: "<<pomtime.getDiff() << std::endl;
 	tlog0 << NAME << std::endl;
 
 	srand ( time(NULL) );
@@ -255,7 +246,7 @@ int main(int argc, char** argv)
 	atexit(SDL_Quit);
 
 	setScreenRes(conf.cc.pregameResx, conf.cc.pregameResy, conf.cc.bpp, conf.cc.fullscreen);
-	tlog0 <<"\tInitializing screen: "<<pomtime.getDif() << std::endl;
+	tlog0 <<"\tInitializing screen: "<<pomtime.getDiff() << std::endl;
 
 	// Initialize video
 #if defined _M_X64 && defined _WIN32 //Win64 -> cannot load 32-bit DLLs for video handling
@@ -263,7 +254,7 @@ int main(int argc, char** argv)
 #else
 	CCS->videoh = new CVideoPlayer;
 #endif
-	tlog0<<"\tInitializing video: "<<pomtime.getDif()<<std::endl;
+	tlog0<<"\tInitializing video: "<<pomtime.getDiff()<<std::endl;
 
 	//we can properly play intro only in the main thread, so we have to move loading to the separate thread
 	boost::thread loading(init);
@@ -274,7 +265,7 @@ int main(int argc, char** argv)
 	SDL_FillRect(screen,NULL,0);
 	CSDL_Ext::update(screen);
 	loading.join();
-	tlog0<<"Initialization of VCMI (together): "<<total.getDif()<<std::endl;
+	tlog0<<"Initialization of VCMI (together): "<<total.getDiff()<<std::endl;
 
 	if(!vm.count("battle"))
 	{
@@ -441,7 +432,7 @@ void processCommand(const std::string &message)
 		boost::filesystem::create_directory("Extracted_txts");
 		tlog0<<"Command accepted. Opening .lod file...\t";
 		CLodHandler * txth = new CLodHandler;
-		txth->init(std::string(DATA_DIR "/Data/H3bitmap.lod"),"");
+		txth->init(GameConstants::DATA_DIR + "/Data/H3bitmap.lod","");
 		tlog0<<"done.\nScanning .lod file\n";
 		
 		BOOST_FOREACH(Entry e, txth->entries)
@@ -543,8 +534,8 @@ void dispose()
 static void setScreenRes(int w, int h, int bpp, bool fullscreen)
 {	
 	// VCMI will only work with 2, 3 or 4 bytes per pixel
-	amax(bpp, 16);
-	amin(bpp, 32);
+	vstd::amax(bpp, 16);
+	vstd::amin(bpp, 32);
 
 	// Try to use the best screen depth for the display
 	int suggestedBpp = SDL_VideoModeOK(w, h, bpp, SDL_SWSURFACE|(fullscreen?SDL_FULLSCREEN:0));

+ 24 - 25
client/CMessage.cpp

@@ -1,14 +1,12 @@
-#include "../stdafx.h"
+#include "StdInc.h"
 #include "CMessage.h"
+
 #include "SDL_ttf.h"
 #include "CDefHandler.h"
 #include "CAnimation.h"
 #include "CGameInfo.h"
 #include "SDL_Extensions.h"
 #include "../lib/CLodHandler.h"
-#include <boost/algorithm/string.hpp>
-#include <boost/algorithm/string/replace.hpp>
-#include <sstream>
 #include "../lib/CGeneralTextHandler.h"
 #include "Graphics.h"
 #include "GUIClasses.h"
@@ -59,8 +57,8 @@ namespace NMessage
 void CMessage::init()
 {
 	{
-		piecesOfBox.resize(PLAYER_LIMIT);
-		for (int i=0;i<PLAYER_LIMIT;i++)
+		piecesOfBox.resize(GameConstants::PLAYER_LIMIT);
+		for (int i=0;i<GameConstants::PLAYER_LIMIT;i++)
 		{
 			CDefHandler * bluePieces = CDefHandler::giveDef("DIALGBOX.DEF");
 			if (i==1)
@@ -89,7 +87,7 @@ void CMessage::init()
 
 void CMessage::dispose()
 {
-	for (int i=0;i<PLAYER_LIMIT;i++)
+	for (int i=0;i<GameConstants::PLAYER_LIMIT;i++)
 	{
 		for (size_t j=0; j<piecesOfBox[i].size(); ++j)
 		{
@@ -127,8 +125,8 @@ std::vector<std::string> CMessage::breakText( std::string text, size_t maxLineSi
 
 	while (text.length())
 	{
-		unsigned int lineLength = 0;	//in characters or given char metric
-		unsigned int z = 0; //our position in text
+		ui32 lineLength = 0;	//in characters or given char metric
+		ui32 z = 0; //our position in text
 		bool opened = false;//if we have an unclosed brace in current line
 		bool lineManuallyBroken = false;
 
@@ -153,10 +151,10 @@ std::vector<std::string> CMessage::breakText( std::string text, size_t maxLineSi
 			 * possible. We backtrack on the line until we find a
 			 * suitable character.
 			 * Note: Cyrillic symbols have indexes 220-255 so we need
-			 * to use unsigned char for comparison
+			 * to use ui8 for comparison
 			 */
 			int pos = z-1;
-			while(pos > 0 &&  ((unsigned char)text[pos]) > ' ' )
+			while(pos > 0 &&  ((ui8)text[pos]) > ' ' )
 				pos --;
 
 			if (pos > 0)
@@ -341,10 +339,10 @@ std::vector<std::vector<SDL_Surface*> > * CMessage::drawText(std::vector<std::st
 // 		ret->pos.x = GH.current->motion.x - ret->pos.w/2;
 // 		ret->pos.y = GH.current->motion.y - ret->pos.h/2;
 // 		// Put the window back on screen if necessary
-// 		amax(ret->pos.x, 0);
-// 		amax(ret->pos.y, 0);
-// 		amin(ret->pos.x, conf.cc.resx - ret->pos.w);
-// 		amin(ret->pos.y, conf.cc.resy - ret->pos.h);
+// 		vstd::amax(ret->pos.x, 0);
+// 		vstd::amax(ret->pos.y, 0);
+// 		vstd::amin(ret->pos.x, conf.cc.resx - ret->pos.w);
+// 		vstd::amin(ret->pos.y, conf.cc.resy - ret->pos.h);
 // 	} 
 // 	else 
 // 	{
@@ -394,6 +392,7 @@ void CMessage::drawIWindow(CInfoWindow * ret, std::string text, int player)
 		_or = FNT_RenderText(FONT_MEDIUM,CGI->generaltexth->allTexts[4],zwykly);
 
 	const int sizes[][2] = {{400, 125}, {500, 150}, {600, 200}, {480, 400}};
+
 	for(int i = 0; 
 		i < ARRAY_COUNT(sizes) 
 			&& sizes[i][0] < conf.cc.resx - 150  
@@ -425,12 +424,12 @@ void CMessage::drawIWindow(CInfoWindow * ret, std::string text, int player)
 	}
 
 	// Clip window size
-	amax(winSize.second, 50);
-	amax(winSize.first, 80);
-	amax(winSize.first, comps.w);
-	amax(winSize.first, bw);
+	vstd::amax(winSize.second, 50);
+	vstd::amax(winSize.first, 80);
+	vstd::amax(winSize.first, comps.w);
+	vstd::amax(winSize.first, bw);
 
-	amin(winSize.first, conf.cc.resx - 150);
+	vstd::amin(winSize.first, conf.cc.resx - 150);
 
 	ret->bitmap = drawBox1 (winSize.first + 2*SIDE_MARGIN, winSize.second + 2*SIDE_MARGIN, player);
 	ret->pos.h=ret->bitmap->h;
@@ -596,14 +595,14 @@ ComponentsToBlit::ComponentsToBlit(std::vector<SComponent*> & SComps, int maxw,
 		if (curw + toadd > maxw)
 		{
 			curr++;
-			amax(w,curw);
+			vstd::amax(w,curw);
 			curw = cur->comp->pos.w;
 			comps.resize(curr+1);
 		}
 		else
 		{
 			curw += toadd;
-			amax(w,curw);
+			vstd::amax(w,curw);
 		}
 
 		comps[curr].push_back(cur);
@@ -613,7 +612,7 @@ ComponentsToBlit::ComponentsToBlit(std::vector<SComponent*> & SComps, int maxw,
 	{
 		int maxh = 0;
 		for(size_t j=0;j<comps[i].size();j++)
-			amax(maxh,comps[i][j]->comp->pos.h);
+			vstd::amax(maxh,comps[i][j]->comp->pos.h);
 		h += maxh + BETWEEN_COMPS_ROWS;
 	}
 }
@@ -627,7 +626,7 @@ void ComponentsToBlit::blitCompsOnSur( SDL_Surface * _or, int inter, int &curh,
 		{
 			ComponentResolved *cur = (comps)[i][j];
 			totalw += cur->comp->pos.w;
-			amax(maxh,cur->comp->getImg()->h);//subtitles height will added later
+			vstd::amax(maxh,cur->comp->getImg()->h);//subtitles height will added later
 		}
 		if(_or)
 		{
@@ -670,7 +669,7 @@ void ComponentsToBlit::blitCompsOnSur( SDL_Surface * _or, int inter, int &curh,
 				}
 				curw+=inter;
 			}
-			amax(curh, textY);
+			vstd::amax(curh, textY);
 		}
 		curh += BETWEEN_COMPS_ROWS;
 	}

+ 2 - 10
client/CMessage.h

@@ -1,10 +1,7 @@
-#ifndef __CMESSAGE_H__
-#define __CMESSAGE_H__
+#pragma once
 
 #include "FontBase.h"
-#include "../global.h"
-//#include <SDL.h>
-#include <boost/function.hpp>
+
 
 /*
  * CMessage.h, part of VCMI engine
@@ -74,8 +71,3 @@ public:
 	static void init();
 	static void dispose();
 };
-//
-
-
-
-#endif // __CMESSAGE_H__

+ 1 - 4
client/CMusicBase.h

@@ -1,5 +1,4 @@
-#ifndef __CMUSICBASE_H__
-#define __CMUSICBASE_H__
+#pragma once
 
 /*
  * CMusicBase.h, part of VCMI engine
@@ -87,6 +86,4 @@ public:
 #undef VCMI_MUSIC_FILE
 };
 
-#endif // __CMUSICBASE_H__
-
 

+ 12 - 17
client/CMusicHandler.cpp

@@ -1,11 +1,5 @@
-#include "../stdafx.h"
-
-#include <sstream>
-#include <boost/assign/std/vector.hpp> 
-#include <boost/assign/list_of.hpp>
+#include "StdInc.h"
 #include <boost/bimap.hpp>
-#include <boost/foreach.hpp>
-
 #include <SDL_mixer.h>
 
 #include "CSndHandler.h"
@@ -14,6 +8,7 @@
 #include "../lib/CSpellHandler.h"
 #include "../client/CGameInfo.h"
 #include "../lib/JsonNode.h"
+#include "../lib/GameConstants.h"
 
 /*
  * CMusicHandler.cpp, part of VCMI engine
@@ -63,7 +58,7 @@ void CAudioBase::release()
 	}
 }
 
-void CAudioBase::setVolume(unsigned int percent)
+void CAudioBase::setVolume(ui32 percent)
 {
 	if (percent > 100)
 		percent = 100;
@@ -103,9 +98,9 @@ void CSoundHandler::init()
 	if (initialized)
 	{
 		// Load sounds
-		sndh.add_file(std::string(DATA_DIR "/Data/Heroes3.snd"));
-		sndh.add_file(std::string(DATA_DIR "/Data/Heroes3-cd2.snd"), false);
-		sndh.add_file(std::string(DATA_DIR "/Data/H3ab_ahd.snd"));
+		sndh.add_file(std::string(GameConstants::DATA_DIR + "/Data/Heroes3.snd"));
+		sndh.add_file(std::string(GameConstants::DATA_DIR + "/Data/Heroes3-cd2.snd"), false);
+		sndh.add_file(std::string(GameConstants::DATA_DIR + "/Data/H3ab_ahd.snd"));
 		Mix_ChannelFinished(soundFinishedCallbackC);
 	}
 }
@@ -172,7 +167,7 @@ soundBase::soundID CSoundHandler::getSoundID(const std::string &fileName)
 void CSoundHandler::initCreaturesSounds(const std::vector<ConstTransitivePtr< CCreature> > &creatures)
 {
 	tlog5 << "\t\tReading config/cr_sounds.json" << std::endl;
-	const JsonNode config(DATA_DIR "/config/cr_sounds.json");
+	const JsonNode config(GameConstants::DATA_DIR + "/config/cr_sounds.json");
 
 	CBattleSounds.resize(creatures.size());
 
@@ -215,7 +210,7 @@ void CSoundHandler::initCreaturesSounds(const std::vector<ConstTransitivePtr< CC
 	//commented to avoid spurious warnings
 	/*
 	// Find creatures without sounds
-	for(unsigned int i=0;i<creatures.size();i++)
+	for(ui32 i=0;i<creatures.size();i++)
 	{
 		// Note: this will exclude war machines, but it's better
 		// than nothing.
@@ -230,7 +225,7 @@ void CSoundHandler::initCreaturesSounds(const std::vector<ConstTransitivePtr< CC
 
 void CSoundHandler::initSpellsSounds(const std::vector< ConstTransitivePtr<CSpell> > &spells)
 {
-	const JsonNode config(DATA_DIR "/config/sp_sounds.json");
+	const JsonNode config(GameConstants::DATA_DIR + "/config/sp_sounds.json");
 
 	if (!config["spell_sounds"].isNull()) {
 		BOOST_FOREACH(const JsonNode &node, config["spell_sounds"].Vector()) {
@@ -283,7 +278,7 @@ void CSoundHandler::stopSound( int handler )
 }
 
 // Sets the sound volume, from 0 (mute) to 100
-void CSoundHandler::setVolume(unsigned int percent)
+void CSoundHandler::setVolume(ui32 percent)
 {
 	CAudioBase::setVolume(percent);
 
@@ -420,7 +415,7 @@ void CMusicHandler::stopMusic(int fade_ms)
 }
 
 // Sets the music volume, from 0 (mute) to 100
-void CMusicHandler::setVolume(unsigned int percent)
+void CMusicHandler::setVolume(ui32 percent)
 {
 	CAudioBase::setVolume(percent);
 
@@ -477,7 +472,7 @@ MusicEntry::~MusicEntry()
 void MusicEntry::load(musicBase::musicID ID)
 {
 	currentID = ID;
-	filename = DATA_DIR "/Mp3/";
+	filename = GameConstants::DATA_DIR + "/Mp3/";
 	filename += owner->musics[ID];
 
 	tlog5<<"Loading music file "<<filename<<"\n";

+ 5 - 13
client/CMusicHandler.h

@@ -1,10 +1,4 @@
-#ifndef __CMUSICHANDLER_H__
-#define __CMUSICHANDLER_H__
-
-#include <boost/thread/mutex.hpp>
-#include <boost/function.hpp>
-
-#include <memory>
+#pragma once
 
 #include "CSoundBase.h"
 #include "CMusicBase.h"
@@ -62,8 +56,8 @@ public:
 	virtual void init() = 0;
 	virtual void release() = 0;
 
-	virtual void setVolume(unsigned int percent);
-	unsigned int getVolume() { return volume; };
+	virtual void setVolume(ui32 percent);
+	ui32 getVolume() { return volume; };
 };
 
 class CSoundHandler: public CAudioBase
@@ -88,7 +82,7 @@ public:
 
 	void initCreaturesSounds(const std::vector<ConstTransitivePtr<CCreature> > &creatures);
 	void initSpellsSounds(const std::vector< ConstTransitivePtr<CSpell> > &spells);
-	void setVolume(unsigned int percent);
+	void setVolume(ui32 percent);
 
 	// Sounds
 	int playSound(soundBase::soundID soundID, int repeats=0);
@@ -153,7 +147,7 @@ public:
 
 	void init();
 	void release();
-	void setVolume(unsigned int percent);
+	void setVolume(ui32 percent);
 
 	// Musics
 	std::map<musicBase::musicID, std::string> musics;
@@ -167,5 +161,3 @@ public:
 	void stopMusic(int fade_ms=1000);
 	void musicFinishedCallback(void);
 };
-
-#endif // __CMUSICHANDLER_H__

+ 26 - 36
client/CPlayerInterface.cpp

@@ -1,6 +1,8 @@
-#include "../stdafx.h"
+#include "StdInc.h"
+
 #include "CAdvmapInterface.h"
-#include "CBattleInterface.h"
+#include "BattleInterface/CBattleInterface.h"
+#include "BattleInterface/CBattleConsole.h"
 #include "../CCallback.h"
 #include "CCastleInterface.h"
 #include "CCursorHandler.h"
@@ -30,22 +32,10 @@
 #include "../lib/map.h"
 #include "../lib/VCMIDirs.h"
 #include "mapHandler.h"
-#include "../timeHandler.h"
-#include <boost/lexical_cast.hpp>
-#include <boost/format.hpp>
-#include <boost/algorithm/string.hpp>
-#include <boost/algorithm/string/replace.hpp>
-#include <boost/assign/std/vector.hpp>
-#include <boost/assign/list_of.hpp>
-#include <boost/date_time/posix_time/posix_time.hpp>
-#include <boost/thread.hpp>
-#include <cmath>
-#include <queue>
-#include <sstream>
-#include <boost/filesystem.hpp>
-#include "../StartInfo.h"
-#include <boost/foreach.hpp>
+#include "../lib/StopWatch.h"
+#include "../lib/StartInfo.h"
 #include "../lib/CGameState.h"
+#include "../lib/GameConstants.h"
 
 #ifdef min
 #undef min
@@ -116,7 +106,7 @@ CPlayerInterface::~CPlayerInterface()
 {
 	howManyPeople--;
 	//delete pim;
-	//delNull(pim);
+	//vstd::clear_pointer(pim);
 	delete showingDialog;
 	if(adventureInt)
 	{
@@ -383,14 +373,14 @@ SDL_Surface * CPlayerInterface::infoWin(const CGObjectInstance * specific) //spe
 
 	switch(specific->ID)
 	{
-	case HEROI_TYPE: 				
+	case GameConstants::HEROI_TYPE: 				
 		{
 			InfoAboutHero iah;
 			bool gotInfo = LOCPLINT->cb->getHeroInfo(specific, iah);
 			assert(gotInfo);
 			return graphics->drawHeroInfoWin(iah);
 		}
-	case TOWNI_TYPE:
+	case GameConstants::TOWNI_TYPE:
 	case 33: // Garrison
 	case 219:
 		{
@@ -424,7 +414,7 @@ void CPlayerInterface::heroPrimarySkillChanged(const CGHeroInstance * hero, int
 		if(CAltarWindow *ctw = dynamic_cast<CAltarWindow *>(GH.topInt()))
 			ctw->setExpToLevel();
 	}
-	else if(which < PRIMARY_SKILLS) //no need to redraw infowin if this is experience (exp is treated as prim skill with id==4)
+	else if(which < GameConstants::PRIMARY_SKILLS) //no need to redraw infowin if this is experience (exp is treated as prim skill with id==4)
 		updateInfo(hero);
 }
 
@@ -729,7 +719,7 @@ BattleAction CPlayerInterface::activeStack(const CStack * stack) //called when i
 	{
 		boost::unique_lock<boost::recursive_mutex> un(*pim);
 
-		if(vstd::contains(stack->state,MOVED)) //this stack has moved and makes second action -> high morale
+		if(vstd::contains(stack->state,EBattleStackState::MOVED)) //this stack has moved and makes second action -> high morale
 		{
 			std::string hlp = CGI->generaltexth->allTexts[33];
 			boost::algorithm::replace_first(hlp,"%s",(stack->count != 1) ? stack->getCreature()->namePl : stack->getCreature()->nameSing);
@@ -765,7 +755,7 @@ void CPlayerInterface::battleEnd(const BattleResult *br)
 	battleInt->battleFinished(*br);
 }
 
-void CPlayerInterface::battleStackMoved(const CStack * stack, std::vector<THex> dest, int distance)
+void CPlayerInterface::battleStackMoved(const CStack * stack, std::vector<SHexField> dest, int distance)
 {
 	if(LOCPLINT != this)
 	{ //another local interface should do this
@@ -883,10 +873,10 @@ void CPlayerInterface::battleAttack(const BattleAttack *ba)
 	else
 	{
 		int shift = 0;
-		if(ba->counter() && THex::mutualPosition(curAction->destinationTile, attacker->position) < 0)
+		if(ba->counter() && SHexField::mutualPosition(curAction->destinationTile, attacker->position) < 0)
 		{
-			int distp = THex::getDistance(curAction->destinationTile + 1, attacker->position);
-			int distm = THex::getDistance(curAction->destinationTile - 1, attacker->position);
+			int distp = SHexField::getDistance(curAction->destinationTile + 1, attacker->position);
+			int distm = SHexField::getDistance(curAction->destinationTile - 1, attacker->position);
 
 			if( distp < distm )
 				shift = 1;
@@ -1339,7 +1329,7 @@ void CPlayerInterface::objectPropertyChanged(const SetObjectProperty * sop)
 				adventureInt->minimap.showTile(*it);
 		}
 
-		if(obj->ID == TOWNI_TYPE)
+		if(obj->ID == GameConstants::TOWNI_TYPE)
 		{
 			if(obj->tempOwner == playerID)
 				towns.push_back(static_cast<const CGTownInstance *>(obj));
@@ -1360,7 +1350,7 @@ void CPlayerInterface::recreateHeroTownList()
 	//applying current heroes order to new heroes info
 	int j;
 	for (int i = 0; i < wanderingHeroes.size(); i++)
-		if ((j = vstd::findPos(allHeroes, wanderingHeroes[i])) >= 0)
+		if ((j = vstd::find_pos(allHeroes, wanderingHeroes[i])) >= 0)
 			if (!allHeroes[j]->inTownGarrison)
 			{
 				newWanderingHeroes += allHeroes[j];
@@ -1377,7 +1367,7 @@ void CPlayerInterface::recreateHeroTownList()
 	std::vector<const CGTownInstance*> newTowns;
 	std::vector<const CGTownInstance*> allTowns = cb->getTownsInfo();
 	for (int i = 0; i < towns.size(); i++)
-		if ((j = vstd::findPos(allTowns, towns[i])) >= 0)
+		if ((j = vstd::find_pos(allTowns, towns[i])) >= 0)
 		{
 			newTowns += allTowns[j];
 			allTowns -= allTowns[j];
@@ -1456,7 +1446,7 @@ void CPlayerInterface::centerView (int3 pos, int focusTime)
 
 void CPlayerInterface::objectRemoved( const CGObjectInstance *obj )
 {
-	if(obj->ID == HEROI_TYPE  &&  obj->tempOwner == playerID)
+	if(obj->ID == GameConstants::HEROI_TYPE  &&  obj->tempOwner == playerID)
 	{
 		const CGHeroInstance *h = static_cast<const CGHeroInstance*>(obj);
 		heroKilled(h);
@@ -2019,7 +2009,7 @@ void CPlayerInterface::showPuzzleMap()
 	boost::unique_lock<boost::recursive_mutex> un(*pim);
 
 	//TODO: interface should not know the real position of Grail...
-	float ratio = 0;
+	double ratio = 0;
 	int3 grailPos = cb->getGrailPos(ratio);
 
 	GH.pushInt(new CPuzzleWindow(grailPos, ratio));
@@ -2230,11 +2220,11 @@ void CPlayerInterface::showMarketWindow(const IMarket *market, const CGHeroInsta
 	boost::unique_lock<boost::recursive_mutex> un(*pim);
 	if(market->o->ID == 2) //Altar
 	{
-		//EMarketMode mode = market->availableModes().front();
-		if(market->allowsTrade(ARTIFACT_EXP) && visitor->getAlignment() != EVIL)
-			GH.pushInt(new CAltarWindow(market, visitor, ARTIFACT_EXP));
-		else if(market->allowsTrade(CREATURE_EXP) && visitor->getAlignment() != GOOD)
-			GH.pushInt(new CAltarWindow(market, visitor, CREATURE_EXP));
+		//EEMarketMode mode = market->availableModes().front();
+		if(market->allowsTrade(EMarketMode::ARTIFACT_EXP) && visitor->getAlignment() != EAlignment::EVIL)
+			GH.pushInt(new CAltarWindow(market, visitor, EMarketMode::ARTIFACT_EXP));
+		else if(market->allowsTrade(EMarketMode::CREATURE_EXP) && visitor->getAlignment() != EAlignment::GOOD)
+			GH.pushInt(new CAltarWindow(market, visitor, EMarketMode::CREATURE_EXP));
 	}
 	else
 		GH.pushInt(new CMarketplaceWindow(market, visitor, market->availableModes().front()));

+ 5 - 11
client/CPlayerInterface.h

@@ -1,13 +1,10 @@
-#ifndef __CPLAYERINTERFACE_H__
-#define __CPLAYERINTERFACE_H__
-#include "../global.h"
-#include "../lib/CGameInterface.h"
+#pragma once
+
+
 #include "../lib/CondSh.h"
-#include <map>
-#include <list>
-#include <algorithm>
 #include "GUIBase.h"
 #include "FunctionList.h"
+#include "../lib/CGameInterface.h"
 
 #ifdef __GNUC__
 #define sprintf_s snprintf 
@@ -221,7 +218,7 @@ public:
 	void battleEnd(const BattleResult *br) OVERRIDE; //end of battle
 	void battleNewRoundFirst(int round) OVERRIDE; //called at the beginning of each turn before changes are applied; used for HP regen handling
 	void battleNewRound(int round) OVERRIDE; //called at the beginning of each turn, round=-1 is the tactic phase, round=0 is the first "normal" turn
-	void battleStackMoved(const CStack * stack, std::vector<THex> dest, int distance) OVERRIDE;
+	void battleStackMoved(const CStack * stack, std::vector<SHexField> dest, int distance) OVERRIDE;
 	void battleSpellCast(const BattleSpellCast *sc) OVERRIDE;
 	void battleStacksEffectsSet(const SetStackEffect & sse) OVERRIDE; //called when a specific effect is set to stacks
 	void battleTriggerEffect(const BattleTriggerEffect & bte) OVERRIDE; //various one-shot effect
@@ -278,6 +275,3 @@ public:
 };
 
 extern CPlayerInterface * LOCPLINT;
-
-
-#endif // __CPLAYERINTERFACE_H__

+ 38 - 53
client/CPreGame.cpp

@@ -1,11 +1,8 @@
-#include "../stdafx.h"
+#include "StdInc.h"
 #include "CPreGame.h"
-#include <ctime>
-#include <boost/filesystem.hpp>   // includes all needed Boost.Filesystem declarations
-#include <boost/algorithm/string.hpp>
+
 #include <zlib.h>
-#include "../timeHandler.h"
-#include <sstream>
+#include "../lib/StopWatch.h"
 #include "SDL_Extensions.h"
 #include "CGameInfo.h"
 #include "CCursorHandler.h"
@@ -22,17 +19,7 @@
 #include "../lib/JsonNode.h"
 #include "CMusicHandler.h"
 #include "CVideoHandler.h"
-#include <cmath>
 #include "Graphics.h"
-//#include <boost/thread.hpp>
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
-#include <boost/ref.hpp>
-#include <boost/foreach.hpp>
-#include <boost/assign/std/vector.hpp>
-#include <boost/assign/list_of.hpp>
-
-#include <cstdlib>
 #include "../lib/Connection.h"
 #include "../lib/VCMIDirs.h"
 #include "../lib/map.h"
@@ -40,8 +27,6 @@
 #include "GUIClasses.h"
 #include "CPlayerInterface.h"
 #include "../CCallback.h"
-#include <boost/lexical_cast.hpp>
-#include <cstdlib>
 #include "CMessage.h"
 #include "../lib/CSpellHandler.h" /*for campaign bonuses*/
 #include "../lib/CArtHandler.h" /*for campaign bonuses*/
@@ -49,11 +34,11 @@
 #include "CBitmapHandler.h"
 #include "Client.h"
 #include "../lib/NetPacks.h"
-#include "../lib/RegisterTypes.cpp"
-#include <boost/thread/recursive_mutex.hpp>
-#include "../CThreadHelper.h"
+#include "../lib/RegisterTypes.h"
+#include "../lib/CThreadHelper.h"
 #include "CConfigHandler.h"
 #include "../lib/CFileUtility.h"
+#include "../lib/GameConstants.h"
 
 /*
  * CPreGame.cpp, part of VCMI engine
@@ -93,8 +78,8 @@ struct EvilHlpStruct
 	{
 		if(strong)
 		{
-			delNull(serv);
-			delNull(sInfo);
+			vstd::clear_pointer(serv);
+			vstd::clear_pointer(sInfo);
 		}
 		else
 		{
@@ -160,7 +145,7 @@ void updateStartInfo(std::string filename, StartInfo & sInfo, const CMapHeader *
 
 	std::map<ui32, std::string>::const_iterator namesIt = playerNames.begin();
 
-	for (int i = 0; i < PLAYER_LIMIT; i++)
+	for (int i = 0; i < GameConstants::PLAYER_LIMIT; i++)
 	{
 		const PlayerInfo &pinfo = mapHeader->players[i];
 
@@ -410,7 +395,7 @@ void CreditsScreen::clickRight(tribool down, bool previousState)
 }
 
 CGPreGame::CGPreGame():
-	pregameConfig(new JsonNode(DATA_DIR "/config/mainmenu.json"))
+	pregameConfig(new JsonNode(GameConstants::DATA_DIR + "/config/mainmenu.json"))
 {
 	OBJ_CONSTRUCTION_CAPTURING_ALL;
 	GH.defActionsDef = 63;
@@ -672,7 +657,7 @@ CSelectionScreen::~CSelectionScreen()
 	playerNames.clear();
 
 	assert(!serv);
-	delNull(applier);
+	vstd::clear_pointer(applier);
 	delete mx;
 }
 
@@ -713,7 +698,7 @@ void CSelectionScreen::changeSelection( const CMapInfo *to )
 {
 	if(multiPlayer == CMenuScreen::MULTI_NETWORK_GUEST)
 	{
-		delNull(current);
+		vstd::clear_pointer(current);
 	}
 
 	current = to;
@@ -981,7 +966,7 @@ void SelectionTab::getFiles(std::vector<FileInfo> &out, const std::string &dirna
 void SelectionTab::parseMaps(std::vector<FileInfo> &files, int start, int threads)
 {
 	int read=0;
-	unsigned char mapBuffer[1500];
+	ui8 mapBuffer[1500];
 
 	while(start < allItems.size())
 	{
@@ -1080,11 +1065,11 @@ SelectionTab::SelectionTab(CMenuScreen::EState Type, const boost::function<void(
 		switch(tabType)
 		{
 		case CMenuScreen::newGame:
-			getFiles(toParse, DATA_DIR "/Maps", "h3m"); //get all maps
+			getFiles(toParse, GameConstants::DATA_DIR + "/Maps", "h3m"); //get all maps
 			/* Load maps from user directory too, unless it is also the
 			 * same as the data directory (as is the case on
 			 * windows). */
-			if (GVCMIDirs.UserPath != DATA_DIR)
+			if (GVCMIDirs.UserPath != GameConstants::DATA_DIR)
 				getFiles(toParse, GVCMIDirs.UserPath + "/Maps", "h3m"); //get all maps
 			parseMaps(toParse);
 			positions = 18;
@@ -1106,7 +1091,7 @@ SelectionTab::SelectionTab(CMenuScreen::EState Type, const boost::function<void(
 				txt = new CTextInput(Rect(32, 539, 350, 20), Point(-32, -25), "GSSTRIP.bmp", 0);
 			break;
 		case CMenuScreen::campaignList:
-			getFiles(toParse, DATA_DIR "/Maps", "h3c"); //get all campaigns
+			getFiles(toParse, GameConstants::DATA_DIR + "/Maps", "h3c"); //get all campaigns
 			for (int g=0; g<toParse.size(); ++g)
 			{
 				toParse[g].inLod = false;
@@ -1173,7 +1158,7 @@ SelectionTab::SelectionTab(CMenuScreen::EState Type, const boost::function<void(
 	switch(tabType)
 	{
 	case CMenuScreen::newGame:
-		selectFName(DATA_DIR "/Maps/Arrogance.h3m");
+		selectFName(GameConstants::DATA_DIR + "/Maps/Arrogance.h3m");
 		break;
 	case CMenuScreen::loadGame:
 	case CMenuScreen::campaignList:
@@ -1229,8 +1214,8 @@ void SelectionTab::select( int position )
 
 	// New selection. py is the index in curItems.
 	int py = position + slider->value;
-	amax(py, 0);
-	amin(py, curItems.size()-1);
+	vstd::amax(py, 0);
+	vstd::amin(py, curItems.size()-1);
 
 	selectionPos = py;
 
@@ -1337,14 +1322,14 @@ void SelectionTab::printMaps(SDL_Surface *to)
 			blitAt(format->ourImages[temp].bitmap, POS(88, 117), to);
 
 			//victory conditions
-			if (currentItem->mapHeader->victoryCondition.condition == winStandard)
+			if (currentItem->mapHeader->victoryCondition.condition == EVictoryConditionType::WINSTANDARD)
 				temp = 11;
 			else
 				temp = currentItem->mapHeader->victoryCondition.condition;
 			blitAt(CGP->victory->ourImages[temp].bitmap, POS(306, 117), to);
 
 			//loss conditions
-			if (currentItem->mapHeader->lossCondition.typeOfLossCon == lossStandard)
+			if (currentItem->mapHeader->lossCondition.typeOfLossCon == ELossConditionType::LOSSSTANDARD)
 				temp=3;
 			else
 				temp=currentItem->mapHeader->lossCondition.typeOfLossCon;
@@ -1784,7 +1769,7 @@ void InfoCard::showTeamsPopup()
 		hlp.replace(hlp.find("%d"), 2, boost::lexical_cast<std::string>(i+1));
 		CSDL_Ext::printAtMiddle(hlp, 128, 65 + 50*i, FONT_SMALL, zwykly, bmp);
 
-		for(int j = 0; j < PLAYER_LIMIT; j++)
+		for(int j = 0; j < GameConstants::PLAYER_LIMIT; j++)
 			if((SEL->current->mapHeader->players[j].canHumanPlay || SEL->current->mapHeader->players[j].canComputerPlay)
 				&& SEL->current->mapHeader->players[j].team == i)
 				flags.push_back(j);
@@ -1876,8 +1861,8 @@ void OptionsTab::nextCastle( int player, int dir )
 
 	if (cur == -1) //random => first/last available
 	{
-		int pom = (dir>0) ? (0) : (F_NUMBER-1); // last or first
-		for (;pom >= 0  &&  pom < F_NUMBER;  pom+=dir)
+		int pom = (dir>0) ? (0) : (GameConstants::F_NUMBER-1); // last or first
+		for (;pom >= 0  &&  pom < GameConstants::F_NUMBER;  pom+=dir)
 		{
 			if((1 << pom) & allowed)
 			{
@@ -1894,9 +1879,9 @@ void OptionsTab::nextCastle( int player, int dir )
 			if ((1 << cur) & allowed)
 				break;
 
-			if (cur >= F_NUMBER  ||  cur<0)
+			if (cur >= GameConstants::F_NUMBER  ||  cur<0)
 			{
-				double p1 = log((double)allowed) / log(2.0f)+0.000001f;
+				double p1 = log((double)allowed) / log(2.0)+0.000001;
 				double check = p1 - ((int)p1);
 				if (check < 0.001)
 					cur = (int)p1;
@@ -1933,16 +1918,16 @@ void OptionsTab::nextHero( int player, int dir )
 
 	if (s.hero == -1) //random => first/last available
 	{
-		int max = (s.castle*HEROES_PER_TYPE*2+15),
-			min = (s.castle*HEROES_PER_TYPE*2);
+		int max = (s.castle*GameConstants::HEROES_PER_TYPE*2+15),
+			min = (s.castle*GameConstants::HEROES_PER_TYPE*2);
 		s.hero = nextAllowedHero(min,max,0,dir);
 	}
 	else
 	{
 		if(dir > 0)
-			s.hero = nextAllowedHero(s.hero,(s.castle*HEROES_PER_TYPE*2+16),1,dir);
+			s.hero = nextAllowedHero(s.hero,(s.castle*GameConstants::HEROES_PER_TYPE*2+16),1,dir);
 		else
-			s.hero = nextAllowedHero(s.castle*HEROES_PER_TYPE*2-1,s.hero,1,dir);
+			s.hero = nextAllowedHero(s.castle*GameConstants::HEROES_PER_TYPE*2-1,s.hero,1,dir);
 	}
 
 	if(old != s.hero)
@@ -2046,7 +2031,7 @@ void OptionsTab::recreate()
 void OptionsTab::setTurnLength( int npos )
 {
 	static const int times[] = {1, 2, 4, 6, 8, 10, 15, 20, 25, 30, 0};
-	amin(npos, ARRAY_COUNT(times) - 1);
+	vstd::amin(npos, ARRAY_COUNT(times) - 1);
 
 	SEL->sInfo.turnTime = times[npos];
 	redraw();
@@ -2267,7 +2252,7 @@ SDL_Surface * OptionsTab::SelectedBox::getImg() const
 	switch(which)
 	{
 	case TOWN:
-		if (s.castle < F_NUMBER  &&  s.castle >= 0)
+		if (s.castle < GameConstants::F_NUMBER  &&  s.castle >= 0)
 			return graphics->getPic(s.castle, true, false);
 		else if (s.castle == -1)
 			return CGP->rTown;
@@ -2323,7 +2308,7 @@ const std::string * OptionsTab::SelectedBox::getText() const
 	switch(which)
 	{
 	case TOWN:
-		if (s.castle < F_NUMBER  &&  s.castle >= 0)
+		if (s.castle < GameConstants::F_NUMBER  &&  s.castle >= 0)
 			return &CGI->townh->towns[s.castle].Name();
 		else if (s.castle == -1)
 			return &CGI->generaltexth->allTexts[522];
@@ -2710,7 +2695,7 @@ void CHotSeatPlayers::enterSelectionScreen()
 
 CBonusSelection::CBonusSelection( CCampaignState * _ourCampaign )
 : highlightedRegion(NULL), ourCampaign(_ourCampaign), ourHeader(NULL),
-	diffLb(NULL), diffRb(NULL), bonuses(NULL)
+	 diffLb(NULL), diffRb(NULL), bonuses(NULL)
 {
 	OBJ_CONSTRUCTION_CAPTURING_ALL;
 	static const std::string bgNames [] = {"E1_BG.BMP", "G2_BG.BMP", "E2_BG.BMP", "G1_BG.BMP", "G3_BG.BMP", "N1_BG.BMP",
@@ -2839,7 +2824,7 @@ void CBonusSelection::showAll( SDL_Surface * to )
 
 void CBonusSelection::loadPositionsOfGraphics()
 {
-	const JsonNode config(DATA_DIR "/config/campaign_regions.json");
+	const JsonNode config(GameConstants::DATA_DIR + "/config/campaign_regions.json");
 	int idx = 0;
 
 	BOOST_FOREACH(const JsonNode &campaign, config["campaign_regions"].Vector())
@@ -3032,7 +3017,7 @@ void CBonusSelection::updateBonusSelection()
 					int leadingSkill = -1;
 					std::vector<std::pair<int, int> > toPrint; //primary skills to be listed <num, val>
 					const ui8* ptr = reinterpret_cast<const ui8*>(&bonDescs[i].info2);
-					for (int g=0; g<PRIMARY_SKILLS; ++g)
+					for (int g=0; g<GameConstants::PRIMARY_SKILLS; ++g)
 					{
 						if (leadingSkill == -1 || ptr[g] > ptr[leadingSkill])
 						{
@@ -3349,7 +3334,7 @@ void QuitMenuWithoutStarting::apply(CSelectionScreen *selScreen)
 		GH.popIntTotally(selScreen); //will wait with deleting us before this thread ends
 	}
 
-	delNull(selScreen->serv);
+	vstd::clear_pointer(selScreen->serv);
 }
 
 void PlayerJoined::apply(CSelectionScreen *selScreen)
@@ -3467,7 +3452,7 @@ void StartWithCurrentSettings::apply(CSelectionScreen *selScreen)
 	}
 
 	selScreen->serv = NULL; //hide it so it won't be deleted
-	delNull(selScreen->serverHandlingThread); //detach us
+	vstd::clear_pointer(selScreen->serverHandlingThread); //detach us
 	selectedName = selScreen->sInfo.mapname;
 
 	GH.curInt = NULL;

+ 7 - 10
client/CPreGame.h

@@ -1,9 +1,8 @@
-#ifndef __CPREGAME_H__
-#define __CPREGAME_H__
-#include "../global.h"
-#include <set>
+#pragma once
+
+
 #include <SDL.h>
-#include "../StartInfo.h"
+#include "../lib/StartInfo.h"
 #include "GUIBase.h"
 #include "GUIClasses.h"
 #include "FunctionList.h"
@@ -355,7 +354,7 @@ class CHotSeatPlayers : public CIntObject
 {
 	CPicture *bg;
 	CTextBox *title;
-	CTextInput *txt[8];
+	CTextInput* txt[8];
 	AdventureMapButton *ok, *cancel;
 	CGStatusBar *bar;
 
@@ -395,7 +394,7 @@ class CBonusSelection : public CIntObject
 	class CRegion : public CIntObject
 	{
 		CBonusSelection * owner;
-		SDL_Surface * graphics[3]; //[0] - not selected, [1] - selected, [2] - striped
+		SDL_Surface* graphics[3]; //[0] - not selected, [1] - selected, [2] - striped
 		bool accessible; //false if region should be striped
 		bool selectable; //true if region should be selectable
 		int myNumber; //number of region
@@ -416,7 +415,7 @@ class CBonusSelection : public CIntObject
 	CCampaignState * ourCampaign;
 	CMapHeader *ourHeader;
 	CDefHandler *sizes; //icons of map sizes
-	SDL_Surface * diffPics[5]; //pictures of difficulties, user-selectable (or not if campaign locks this)
+	SDL_Surface* diffPics[5]; //pictures of difficulties, user-selectable (or not if campaign locks this)
 	AdventureMapButton * diffLb, * diffRb; //buttons for changing difficulty
 	void changeDiff(bool increase); //if false, then decrease
 
@@ -506,5 +505,3 @@ public:
 };
 
 extern CGPreGame *CGP;
-
-#endif // __CPREGAME_H__

+ 7 - 8
client/CSndHandler.cpp

@@ -1,8 +1,7 @@
-#include "../stdafx.h"
-#include <fstream>
-#include "CSndHandler.h"
+#include "StdInc.h"
 #include <boost/iostreams/device/mapped_file.hpp>
 #include <SDL_endian.h>
+#include "CSndHandler.h"
 
 /*
  * CSndHandler.cpp, part of VCMI engine
@@ -153,10 +152,10 @@ void CSndHandler::add_file(std::string fname, bool important /*= true*/)
 	}
 
 	const char *data = mfile->data();
-	unsigned int numFiles = SDL_SwapLE32(*(Uint32 *)&data[0]);
+	ui32 numFiles = SDL_SwapLE32(*(Uint32 *)&data[0]);
 	struct soundEntry *se = (struct soundEntry *)&data[4];
 
-	for (unsigned int i=0; i<numFiles; i++, se++)
+	for (ui32 i=0; i<numFiles; i++, se++)
 	{
 		Entry entry;
 
@@ -187,11 +186,11 @@ void CVidHandler::add_file(std::string fname)
 		tlog1 << fname << " doesn't contain needed data!\n";
 		return;
 	}
-	const unsigned char *data = (const unsigned char *)mfile->data();
-	unsigned int numFiles = SDL_SwapLE32(*(Uint32 *)&data[0]);
+	const ui8 *data = (const ui8 *)mfile->data();
+	ui32 numFiles = SDL_SwapLE32(*(Uint32 *)&data[0]);
 	struct videoEntry *ve = (struct videoEntry *)&data[4];
 
-	for (unsigned int i=0; i<numFiles; i++, ve++)
+	for (ui32 i=0; i<numFiles; i++, ve++)
 	{
 		Entry entry;
 

+ 3 - 10
client/CSndHandler.h

@@ -1,9 +1,6 @@
-#ifndef __CSNDHANDLER_H__
-#define __CSNDHANDLER_H__
+#pragma once
 
-#include <vector>
 #include <iosfwd>
-#include <map>
 #include <SDL_stdinc.h>
 
 
@@ -52,8 +49,8 @@ protected:
 	struct Entry
 	{
 		std::string name;
-		unsigned int size;
-		unsigned int offset;
+		ui32 size;
+		ui32 offset;
 		const char *data;
 	};
 
@@ -82,7 +79,3 @@ class CVidHandler: public CMediaHandler
 public:
 	void add_file(std::string fname);
 };
-
-
-
-#endif // __CSNDHANDLER_H__

+ 2 - 5
client/CSoundBase.h

@@ -1,5 +1,4 @@
-#ifndef __CSOUNDBASE_H__
-#define __CSOUNDBASE_H__
+#pragma once
 
 // Use some magic to keep the list of files and their code name in sync.
 
@@ -1033,6 +1032,4 @@ public:
 	};
 #undef VCMI_SOUND_NAME
 #undef VCMI_SOUND_FILE
-};
-
-#endif // __CSOUNDBASE_H__
+};

+ 13 - 16
client/CSpellWindow.cpp

@@ -1,4 +1,6 @@
+#include "StdInc.h"
 #include "CSpellWindow.h"
+
 #include "Graphics.h"
 #include "CDefHandler.h"
 #include "../lib/CObjectHandler.h"
@@ -6,21 +8,16 @@
 #include "../lib/CGeneralTextHandler.h"
 #include "CVideoHandler.h"
 #include "CAdvmapInterface.h"
-#include "CBattleInterface.h"
+#include "BattleInterface/CBattleInterface.h"
 #include "CGameInfo.h"
 #include "SDL_Extensions.h"
 #include "CMessage.h"
 #include "CPlayerInterface.h"
 #include "../CCallback.h"
-#include <boost/bind.hpp>
-#include <sstream>
-#include <boost/algorithm/string/replace.hpp>
-#include <boost/lexical_cast.hpp>
-#include <boost/foreach.hpp>
-#include <boost/format.hpp>
 #include "CBitmapHandler.h"
 #include "../lib/CHeroHandler.h"
 #include "../lib/BattleState.h"
+#include "../lib/GameConstants.h"
 
 /*
  * CSpellWindow.cpp, part of VCMI engine
@@ -217,7 +214,7 @@ CSpellWindow::CSpellWindow(const SDL_Rect & myRect, const CGHeroInstance * _myHe
 
 	selectedTab = battleSpellsOnly ? LOCPLINT->spellbookSettings.spellbookLastTabBattle : LOCPLINT->spellbookSettings.spellbookLastTabAdvmap;
 	currentPage = battleSpellsOnly ? LOCPLINT->spellbookSettings.spellbookLastPageBattle : LOCPLINT->spellbookSettings.spellbokLastPageAdvmap;
-	abetw(currentPage, 0, pagesWithinCurrentTab());
+	vstd::abetween(currentPage, 0, pagesWithinCurrentTab());
 	computeSpellsPerArea();
 }
 
@@ -536,11 +533,11 @@ void CSpellWindow::keyPressed(const SDL_KeyboardEvent & key)
 		case SDLK_DOWN:
 		{
 			bool down = key.keysym.sym == SDLK_DOWN;
-			static const int schoolsOrder[] = {0, 3, 1, 2, 4};
+			static const int schoolsOrder[] = { 0, 3, 1, 2, 4 };
 			int index = -1;
 			while(schoolsOrder[++index] != selectedTab);
 			index += (down ? 1 : -1);
-			abetw(index, 0, ARRAY_COUNT(schoolsOrder) - 1);
+			vstd::abetween(index, 0, ARRAY_COUNT(schoolsOrder) - 1);
 			if(selectedTab != schoolsOrder[index])
 				selectSchool(schoolsOrder[index]);
 			break;
@@ -621,23 +618,23 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
 		//we will cast a spell
 		if(sp->combatSpell && owner->myInt->battleInt && owner->myInt->cb->battleCanCastSpell()) //if battle window is open
 		{
-			SpellCasting::ESpellCastProblem problem = owner->myInt->cb->battleCanCastThisSpell(sp);
+			ESpellCastProblem::ESpellCastProblem problem = owner->myInt->cb->battleCanCastThisSpell(sp);
 			switch (problem)
 			{
-			case SpellCasting::OK:
+			case ESpellCastProblem::OK:
 				{
 					int spell = mySpell;
 					owner->fexitb();
 					owner->myInt->battleInt->castThisSpell(spell);
 				}
 				break;
-			case SpellCasting::ANOTHER_ELEMENTAL_SUMMONED:
+			case ESpellCastProblem::ANOTHER_ELEMENTAL_SUMMONED:
 				{
 					std::string text = CGI->generaltexth->allTexts[538], summoner, elemental, caster;
 					std::vector<const CStack *> stacks = owner->myInt->cb->battleGetStacks();
 					BOOST_FOREACH(const CStack * s, stacks)
 					{
-						if(vstd::contains(s->state, SUMMONED))
+						if(vstd::contains(s->state, EBattleStackState::SUMMONED))
 						{
 							elemental = s->getCreature()->namePl;
 							summoner = owner->myInt->cb->battleGetFightingHero(!s->attackerOwned)->name;
@@ -658,14 +655,14 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
 					owner->myInt->showInfoDialog(text);
 				}
 				break;
-			case SpellCasting::SPELL_LEVEL_LIMIT_EXCEEDED:
+			case ESpellCastProblem::SPELL_LEVEL_LIMIT_EXCEEDED:
 				{
 					std::string text = CGI->generaltexth->allTexts[541], caster = owner->myHero->name;
 					text = boost::str(boost::format(text) % caster);
 					owner->myInt->showInfoDialog(text);
 				}
 				break;
-			case SpellCasting::NO_APPROPRIATE_TARGET:
+			case ESpellCastProblem::NO_APPROPRIATE_TARGET:
 				{
 					owner->myInt->showInfoDialog(CGI->generaltexth->allTexts[185]);
 				}

+ 1 - 6
client/CSpellWindow.h

@@ -1,10 +1,7 @@
-#ifndef __CSPELLWINDOW_H__
-#define __CSPELLWINDOW_H__
+#pragma once
 
 
-#include "../global.h"
 #include "GUIBase.h"
-#include "boost/function.hpp"
 
 /*
  * CSpellWindow.h, part of VCMI engine
@@ -114,5 +111,3 @@ public:
 
 	void teleportTo(int town, const CGHeroInstance * hero);
 };
-
-#endif // __CSPELLWINDOW_H__

+ 17 - 18
client/CVideoHandler.cpp

@@ -1,11 +1,10 @@
-#include "../stdafx.h"
-#include <iostream>
+#include "StdInc.h"
+#include <SDL.h>
 #include "CSndHandler.h"
 #include "CVideoHandler.h"
-#include <SDL.h>
+
 #include "SDL_Extensions.h"
 #include "CPlayerInterface.h"
-#include <boost/filesystem.hpp>
 
 extern SystemOptions GDefaultOptions; 
 //reads events and returns true on key down
@@ -393,8 +392,8 @@ void CSmackPlayer::redraw( int x, int y, SDL_Surface *dst, bool update )
 
 CVideoPlayer::CVideoPlayer()
 {
-	vidh.add_file(std::string(DATA_DIR "/Data/VIDEO.VID"));
-	vidh.add_file(std::string(DATA_DIR "/Data/H3ab_ahd.vid"));
+	vidh.add_file(std::string(GameConstants::DATA_DIR + "/Data/VIDEO.VID"));
+	vidh.add_file(std::string(GameConstants::DATA_DIR + "/Data/H3ab_ahd.vid"));
 
 	current = NULL;
 }
@@ -600,11 +599,11 @@ static int lod_close(URLContext* h)
 }
 
 // Define a set of functions to read data
-static int lod_read(URLContext *context, unsigned char *buf, int size)
+static int lod_read(URLContext *context, ui8 *buf, int size)
 {
 	CVideoPlayer *video = (CVideoPlayer *)context->priv_data;
 
-	amin(size, video->length - video->offset);
+	vstd::amin(size, video->length - video->offset);
 
 	if (size < 0)
 		return -1;
@@ -617,14 +616,14 @@ static int lod_read(URLContext *context, unsigned char *buf, int size)
 	return size;
 }
 
-static int64_t lod_seek(URLContext *context, int64_t pos, int whence)
+static si64 lod_seek(URLContext *context, si64 pos, int whence)
 {
 	CVideoPlayer *video = (CVideoPlayer *)context->priv_data;
 
 	// Not sure what the parameter whence is. Assuming it always
 	// indicates an absolute value;
 	video->offset = pos;
-	amin(video->offset, video->length);
+	vstd::amin(video->offset, video->length);
 
 	return -1;//video->offset;
 }
@@ -659,8 +658,8 @@ CVideoPlayer::CVideoPlayer()
 	av_register_protocol(&lod_protocol);
 #endif
 
-	vidh.add_file(std::string(DATA_DIR "/Data/VIDEO.VID"));
-	vidh.add_file(std::string(DATA_DIR "/Data/H3ab_ahd.vid"));
+	vidh.add_file(GameConstants::DATA_DIR + "/Data/VIDEO.VID");
+	vidh.add_file(GameConstants::DATA_DIR + "/Data/H3ab_ahd.vid");
 }
 
 bool CVideoPlayer::open(std::string fname)
@@ -699,12 +698,12 @@ bool CVideoPlayer::open(std::string fname, bool loop, bool useOverlay)
 	} else {
 		// File is not in a container
 #if LIBAVFORMAT_VERSION_MAJOR < 54
-		int avfopen = av_open_input_file(&format, (DATA_DIR "/Data/video/" + fname).c_str(), NULL, 0, NULL);
+		int avfopen = av_open_input_file(&format, (GameConstants::DATA_DIR + "/Data/video/" + fname).c_str(), NULL, 0, NULL);
 #else
-		int avfopen = avformat_open_input(&format, (DATA_DIR "/Data/video/" + fname).c_str(), NULL, NULL);
+		int avfopen = avformat_open_input(&format, (GameConstants::DATA_DIR + "/Data/video/" + fname).c_str(), NULL, NULL);
 #endif
 		if (avfopen != 0) {
-			// tlog1 << "Video file not found: " DATA_DIR "/Data/video/" + fname << std::endl;
+			// tlog1 << "Video file not found: " GameConstants::DATA_DIR + "/Data/video/" + fname << std::endl;
 			return false;
 		}
 	}
@@ -715,7 +714,7 @@ bool CVideoPlayer::open(std::string fname, bool loop, bool useOverlay)
 
 	// Find the first video stream
 	stream = -1;
-	for(unsigned int i=0; i<format->nb_streams; i++) {
+	for(ui32 i=0; i<format->nb_streams; i++) {
 #if LIBAVCODEC_VERSION_MAJOR < 53
 		if (format->streams[i]->codec->codec_type==CODEC_TYPE_VIDEO)
 #else
@@ -850,7 +849,7 @@ bool CVideoPlayer::nextFrame()
 
 						SDL_UnlockYUVOverlay(overlay);
 					} else {
-						pict.data[0] = (uint8_t *)dest->pixels;
+						pict.data[0] = (ui8 *)dest->pixels;
 						pict.linesize[0] = dest->pitch;
 
 						sws_scale(sws, frame->data, frame->linesize,
@@ -985,4 +984,4 @@ CVideoPlayer::~CVideoPlayer()
 	close();
 }
 
-#endif
+#endif

+ 3 - 6
client/CVideoHandler.h

@@ -1,7 +1,6 @@
-#ifndef __CVIDEOHANDLER_H__
-#define __CVIDEOHANDLER_H__
+#pragma once
+
 
-#include "../global.h"
 #include "CSndHandler.h"
 
 struct SDL_Surface;
@@ -289,7 +288,7 @@ public:
 	
 	const char *data;			// video buffer
 	int length;					// video size
-	unsigned int offset;		// current data offset
+	ui32 offset;		// current data offset
 };
 
 #define VIDEO_TAVERN "tavern.mjpg"
@@ -301,5 +300,3 @@ public:
 #define VIDEO_SURRENDER "surrender.mjpg"
 
 #endif
-
-#endif // __CVIDEOHANDLER_H__

+ 24 - 30
client/Client.cpp

@@ -1,11 +1,13 @@
+#include "StdInc.h"
+
 #include "CMusicHandler.h"
 #include "../lib/CCampaignHandler.h"
 #include "../CCallback.h"
-#include "../CConsoleHandler.h"
+#include "../lib/CConsoleHandler.h"
 #include "CGameInfo.h"
 #include "../lib/CGameState.h"
 #include "CPlayerInterface.h"
-#include "../StartInfo.h"
+#include "../lib/StartInfo.h"
 #include "../lib/BattleState.h"
 #include "../lib/CArtHandler.h"
 #include "../lib/CDefObjInfoHandler.h"
@@ -26,20 +28,12 @@
 #include "CConfigHandler.h"
 #include "Client.h"
 #include "GUIBase.h"
-#include <boost/bind.hpp>
-#include <boost/foreach.hpp>
-#include <boost/thread.hpp>
-#include <boost/thread/shared_mutex.hpp>
-#include <boost/lexical_cast.hpp>
-#include <sstream>
 #include "CPreGame.h"
-#include "CBattleInterface.h"
-#include "../CThreadHelper.h"
+#include "BattleInterface/CBattleInterface.h"
+#include "../lib/CThreadHelper.h"
 #include "../lib/CScriptingModule.h"
 #include "../lib/CFileUtility.h"
-
-#define NOT_LIB
-#include "../lib/RegisterTypes.cpp"
+#include "../lib/RegisterTypes.h"
 
 extern std::string NAME;
 namespace intpr = boost::interprocess;
@@ -228,7 +222,7 @@ void CClient::loadGame( const std::string & fname )
 	CServerHandler sh;
 	sh.startServer();
 
-	timeHandler tmh;
+	StopWatch tmh;
 	{
 		char sig[8];
 		CMapHeader dum;
@@ -237,21 +231,21 @@ void CClient::loadGame( const std::string & fname )
 
 		CLoadFile lf(fname + ".vlgm1");
 		lf >> sig >> dum >> si;
-		tlog0 <<"Reading save signature: "<<tmh.getDif()<<std::endl;
+		tlog0 <<"Reading save signature: "<<tmh.getDiff()<<std::endl;
 		
 		lf >> *VLC;
 		const_cast<CGameInfo*>(CGI)->setFromLib();
-		tlog0 <<"Reading handlers: "<<tmh.getDif()<<std::endl;
+		tlog0 <<"Reading handlers: "<<tmh.getDiff()<<std::endl;
 
 		lf >> gs;
-		tlog0 <<"Reading gamestate: "<<tmh.getDif()<<std::endl;
+		tlog0 <<"Reading gamestate: "<<tmh.getDiff()<<std::endl;
 
 		const_cast<CGameInfo*>(CGI)->state = gs;
 		const_cast<CGameInfo*>(CGI)->mh->map = gs->map;
 		pathInfo = new CPathsInfo(int3(gs->map->width, gs->map->height, gs->map->twoLevel+1));
 		CGI->mh->init();
 
-		tlog0 <<"Initing maphandler: "<<tmh.getDif()<<std::endl;
+		tlog0 <<"Initing maphandler: "<<tmh.getDiff()<<std::endl;
 	}
 	serv = sh.connectToServer();
 	serv->addStdVecItems(gs);
@@ -273,7 +267,7 @@ void CClient::loadGame( const std::string & fname )
 		*serv << ui8(it->first); //players
 	}
 	*serv << ui8(255); // neutrals
-	tlog0 <<"Sent info to server: "<<tmh.getDif()<<std::endl;
+	tlog0 <<"Sent info to server: "<<tmh.getDiff()<<std::endl;
 	
 	{
 		CLoadFile lf(fname + ".vcgm1");
@@ -312,9 +306,9 @@ void CClient::newGame( CConnection *con, StartInfo *si )
 
 
 
-	timeHandler tmh;
+	StopWatch tmh;
 	const_cast<CGameInfo*>(CGI)->state = new CGameState();
-	tlog0 <<"\tGamestate: "<<tmh.getDif()<<std::endl;
+	tlog0 <<"\tGamestate: "<<tmh.getDiff()<<std::endl;
 	CConnection &c(*serv);
 	////////////////////////////////////////////////////
 
@@ -335,22 +329,22 @@ void CClient::newGame( CConnection *con, StartInfo *si )
 
 	ui32 seed, sum;
 	c >> si	>> sum >> seed;
-	tlog0 <<"\tSending/Getting info to/from the server: "<<tmh.getDif()<<std::endl;
+	tlog0 <<"\tSending/Getting info to/from the server: "<<tmh.getDiff()<<std::endl;
 	tlog0 << "\tUsing random seed: "<<seed << std::endl;
 
 	gs = const_cast<CGameInfo*>(CGI)->state;
 	gs->scenarioOps = si;
 	gs->init(si, sum, seed);
-	tlog0 <<"Initializing GameState (together): "<<tmh.getDif()<<std::endl;
+	tlog0 <<"Initializing GameState (together): "<<tmh.getDiff()<<std::endl;
 
 	if(gs->map)
 	{
 		const_cast<CGameInfo*>(CGI)->mh = new CMapHandler();
 		CGI->mh->map = gs->map;
-		tlog0 <<"Creating mapHandler: "<<tmh.getDif()<<std::endl;
+		tlog0 <<"Creating mapHandler: "<<tmh.getDiff()<<std::endl;
 		CGI->mh->init();
 		pathInfo = new CPathsInfo(int3(gs->map->width, gs->map->height, gs->map->twoLevel+1));
-		tlog0 <<"Initializing mapHandler (together): "<<tmh.getDif()<<std::endl;
+		tlog0 <<"Initializing mapHandler (together): "<<tmh.getDiff()<<std::endl;
 	}
 
 	int humanPlayers = 0;
@@ -470,7 +464,7 @@ void CClient::serialize( Handler &h, const int version )
 			nInt->serialize(h, version);
 		}
 
-		if(!vstd::contains(battleints, NEUTRAL_PLAYER))
+		if(!vstd::contains(battleints, GameConstants::NEUTRAL_PLAYER))
 			loadNeutralBattleAI();
 	}
 }
@@ -631,7 +625,7 @@ void CServerHandler::startServer()
 	
 	serverThread = new boost::thread(&CServerHandler::callServer, this); //runs server executable;
 	if(verbose)
-		tlog0 << "Setting up thread calling server: " << th.getDif() << std::endl;
+		tlog0 << "Setting up thread calling server: " << th.getDiff() << std::endl;
 }
 
 void CServerHandler::waitForServer()
@@ -646,7 +640,7 @@ void CServerHandler::waitForServer()
 		shared->sr->cond.wait(slock);
 	}
 	if(verbose)
-		tlog0 << "Waiting for server: " << th.getDif() << std::endl;
+		tlog0 << "Waiting for server: " << th.getDiff() << std::endl;
 }
 
 CConnection * CServerHandler::connectToServer()
@@ -658,7 +652,7 @@ CConnection * CServerHandler::connectToServer()
 	CConnection *ret = justConnectToServer(conf.cc.server, port);
 
 	if(verbose)
-		tlog0<<"\tConnecting to the server: "<<th.getDif()<<std::endl;
+		tlog0<<"\tConnecting to the server: "<<th.getDiff()<<std::endl;
 
 	return ret;
 }
@@ -687,7 +681,7 @@ void CServerHandler::callServer()
 {
 	setThreadName(-1, "CServerHandler::callServer");
 	std::string logName = GVCMIDirs.UserPath + "/server_log.txt";
-	std::string comm = std::string(BIN_DIR PATH_SEPARATOR SERVER_NAME " ") + port + " > " + logName;
+	std::string comm = GameConstants::BIN_DIR + GameConstants::PATH_SEPARATOR + GameConstants::SERVER_NAME + " " + port + " > " + logName;
 	std::system(comm.c_str());
 	tlog0 << "Server finished\n";
 }

+ 3 - 8
client/Client.h

@@ -1,12 +1,9 @@
-#ifndef __CLIENT_H__
-#define __CLIENT_H__
+#pragma once
 
 
-#include "../global.h"
-#include <boost/thread.hpp>
 #include "../lib/IGameCallback.h"
 #include "../lib/CondSh.h"
-#include <queue>
+#include "../lib/StopWatch.h"
 
 /*
  * Client.h, part of VCMI engine
@@ -41,7 +38,7 @@ class CServerHandler
 private:
 	void callServer(); //calls server via system(), should be called as thread
 public:
-	timeHandler th;
+	StopWatch th;
 	boost::thread *serverThread; //thread that called system to run server
 	SharedMem *shared; //interprocess memory (for waiting for server)
 	bool verbose; //whether to print log msgs
@@ -175,5 +172,3 @@ public:
 
 	template <typename Handler> void serialize(Handler &h, const int version);
 };
-
-#endif // __CLIENT_H__

+ 4 - 7
client/FontBase.h

@@ -1,5 +1,4 @@
-#ifndef __FONTBASE_H__
-#define __FONTBASE_H__
+#pragma once
 
 /*
  * FontBase.h, part of VCMI engine
@@ -22,19 +21,17 @@ struct Font
 	struct Char
 	{
 		si32 unknown1, width, unknown2, offset;
-		unsigned char *pixels;
+		ui8 *pixels;
 	};
 
 	Char chars[256];
 	ui8 height;
 
-	unsigned char *data;
+	ui8 *data;
 
 
-	Font(unsigned char *Data);
+	Font(ui8 *Data);
 	~Font();
 	int getWidth(const char *text) const;
 	int getCharWidth(char c) const;
 };
-
-#endif

+ 2 - 7
client/FunctionList.h

@@ -1,8 +1,5 @@
-#ifndef FUNCTIONLIST_H
-#define FUNCTIONLIST_H
+#pragma once
 
-#include <boost/function.hpp>
-#include <vector>
 
 /*
  * FunctionList.h, part of VCMI engine
@@ -120,6 +117,4 @@ public:
 			funcs2[i](a);
 		}
 	}
-};
-
-#endif //FUNCTIONLISt_H
+};

+ 9 - 11
client/GUIBase.cpp

@@ -1,16 +1,13 @@
+#include "StdInc.h"
 #include "SDL_Extensions.h"
-#include <cassert>
-#include <boost/thread/locks.hpp>
 #include "GUIBase.h"
-#include <boost/thread/mutex.hpp>
-#include <queue>
+
 #include "CGameInfo.h"
 #include "CCursorHandler.h"
 #include "CBitmapHandler.h"
 #include "Graphics.h"
-#include "../CThreadHelper.h"
+#include "../lib/CThreadHelper.h"
 #include "CConfigHandler.h"
-#include <boost/lexical_cast.hpp>
 
 /*
  * GUIBase.cpp, part of VCMI engine
@@ -25,6 +22,7 @@
 extern std::queue<SDL_Event*> events;
 extern boost::mutex eventsM;
 
+
 SDL_Color Colors::MetallicGold = createColor(173, 142, 66);
 SDL_Color Colors::Yellow = createColor(242, 226, 110);
 
@@ -124,7 +122,7 @@ void CGuiHandler::totalRedraw()
 
 void CGuiHandler::updateTime()
 {
-	int tv = th.getDif();
+	int tv = th.getDiff();
 	std::list<CIntObject*> hlp = timeinterested;
 	for (std::list<CIntObject*>::iterator i=hlp.begin(); i != hlp.end();i++)
 	{
@@ -756,10 +754,10 @@ const Rect & CIntObject::center(const Point &p, bool propagate /*= true*/)
 void CIntObject::fitToScreen(int borderWidth, bool propagate)
 {
 	Point newPos = pos.topLeft();
-	amax(newPos.x, borderWidth);
-	amax(newPos.y, borderWidth);
-	amin(newPos.x, screen->w - borderWidth - pos.w);
-	amin(newPos.y, screen->h - borderWidth - pos.h);
+	vstd::amax(newPos.x, borderWidth);
+	vstd::amax(newPos.y, borderWidth);
+	vstd::amin(newPos.x, screen->w - borderWidth - pos.w);
+	vstd::amin(newPos.y, screen->h - borderWidth - pos.h);
 	if (newPos != pos.topLeft())
 		moveTo(newPos, propagate);
 }

+ 7 - 9
client/GUIBase.h

@@ -1,11 +1,9 @@
-#ifndef __GUIBASE_H__
-#define __GUIBASE_H__
+#pragma once
 
-#include "../global.h"
+
+#include "../lib/int3.h"
 #include "SDL.h"
-#include <set>
-#include <list>
-#include "../timeHandler.h"
+#include "../lib/StopWatch.h"
 #include "FontBase.h"
 #include "SDL_framerate.h"
 
@@ -57,6 +55,8 @@ class CGTownInstance;
 class StackState;
 class CPlayerInterface;
 
+using boost::logic::tribool;
+
 /// A point with x/y coordinate, used mostly for graphic rendering
 struct Point
 {
@@ -533,7 +533,7 @@ class CGuiHandler
 {
 public:
 	FPSManager *mainFPSmng; //to keep const framerate
-	timeHandler th;
+	StopWatch th;
 	std::list<IShowActivable *> listInt; //list of interfaces - front=foreground; back = background (includes adventure map, window interfaces, all kind of active dialogs, and so on)
 	IStatusBar * statusbar;
 
@@ -624,5 +624,3 @@ public:
 #define OBJ_CONSTRUCTION_CAPTURING_ALL defActions = 255; SetCaptureState obj__i1(true, 255); ObjectConstruction obj__i(this)
 #define BLOCK_CAPTURING SetCaptureState obj__i(false, 0)
 #define BLOCK_CAPTURING_DONT_TOUCH_REC_ACTIONS SetCaptureState obj__i(false, GH.defActionsDef)
-
-#endif //__GUIBASE_H__

+ 144 - 155
client/GUIClasses.cpp

@@ -1,9 +1,10 @@
+#include "StdInc.h"
 #include "GUIClasses.h"
 #include "SDL_Extensions.h"
 
-#include "../stdafx.h"
 #include "CAdvmapInterface.h"
-#include "CBattleInterface.h"
+#include "BattleInterface/CBattleInterface.h"
+#include "BattleInterface/CBattleConsole.h"
 #include "../CCallback.h"
 #include "CCastleInterface.h"
 #include "CCreatureWindow.h"
@@ -29,30 +30,19 @@
 #include "../lib/CondSh.h"
 #include "../lib/map.h"
 #include "mapHandler.h"
-#include "../timeHandler.h"
-#include <boost/foreach.hpp>
-#include <boost/lexical_cast.hpp>
-#include <boost/format.hpp>
-#include <boost/algorithm/string.hpp>
-#include <boost/algorithm/string/replace.hpp>
-#include <boost/assign/std/vector.hpp> 
-#include <boost/assign/list_of.hpp>
-#include <boost/date_time/posix_time/posix_time.hpp>
-//#include <boost/thread.hpp>
-#include <cmath>
-#include <queue>
-#include <sstream>
+#include "../lib/StopWatch.h"
 #include "../lib/NetPacks.h"
 #include "CSpellWindow.h"
 #include "CHeroWindow.h"
 #include "CVideoHandler.h"
-#include "../StartInfo.h"
+#include "../lib/StartInfo.h"
 #include "CPreGame.h"
 #include "../lib/HeroBonus.h"
 #include "../lib/CCreatureHandler.h"
 #include "CMusicHandler.h"
 #include "../lib/BattleState.h"
 #include "../lib/CGameState.h"
+#include "../lib/GameConstants.h"
 
 /*
  * GUIClasses.cpp, part of VCMI engine
@@ -116,7 +106,7 @@ void CGarrisonSlot::hover (bool on)
 				{
 					temp = CGI->generaltexth->tcommands[32]; //Select %s (visiting)
 				}
-				else if(owner->armedObjs[0] && owner->armedObjs[0]->ID == TOWNI_TYPE)
+				else if(owner->armedObjs[0] && owner->armedObjs[0]->ID == GameConstants::TOWNI_TYPE)
 				{
 					temp = CGI->generaltexth->tcommands[12]; //Select %s (in garrison)
 				}
@@ -702,10 +692,10 @@ void CInfoPopup::init(int x, int y)
 	pos.w = bitmap->w;
 
 	// Put the window back on screen if necessary
-	amax(pos.x, 0);
-	amax(pos.y, 0);
-	amin(pos.x, conf.cc.resx - bitmap->w);
-	amin(pos.y, conf.cc.resy - bitmap->h);
+	vstd::amax(pos.x, 0);
+	vstd::amax(pos.y, 0);
+	vstd::amin(pos.x, conf.cc.resx - bitmap->w);
+	vstd::amin(pos.y, conf.cc.resy - bitmap->h);
 }
 
 void SComponent::init(Etype Type, int Subtype, int Val)
@@ -1295,8 +1285,8 @@ void CList::fixPos()
 	else if(from + SIZE <= selected)
 		from = selected - SIZE + 1; 
 
-	amin(from, size() - SIZE);
-	amax(from, 0);
+	vstd::amin(from, size() - SIZE);
+	vstd::amax(from, 0);
 	draw(screen);
 }
 
@@ -1397,7 +1387,7 @@ void CHeroList::clickLeft(tribool down, bool previousState)
 		int ny = hy/32;
 		if (ny>=SIZE || ny<0)
 			return;
-		if ( (ny+from)==selected && (adventureInt->selection->ID == HEROI_TYPE))
+		if ( (ny+from)==selected && (adventureInt->selection->ID == GameConstants::HEROI_TYPE))
 			LOCPLINT->openHeroWindow(LOCPLINT->wanderingHeroes[selected]);//print hero screen
 		select(ny+from);
 	}
@@ -1566,7 +1556,7 @@ void CHeroList::draw(SDL_Surface * to)
 		blitAt(mana->ourImages[pom].bitmap,posmanx,posmany+i*32,to); //mana
 		SDL_Surface * temp = graphics->portraitSmall[cur->portrait];
 		blitAt(temp,posporx,pospory+i*32,to);
-		if (adventureInt->selection && (selected == iT) && (adventureInt->selection->ID == HEROI_TYPE))
+		if (adventureInt->selection && (selected == iT) && (adventureInt->selection->ID == GameConstants::HEROI_TYPE))
 		{
 			blitAt(selection,posporx,pospory+i*32,to);
 		}
@@ -1585,7 +1575,7 @@ void CHeroList::draw(SDL_Surface * to)
 
 int CHeroList::getPosOfHero(const CGHeroInstance* h)
 {
-	return vstd::findPos(LOCPLINT->wanderingHeroes, h, std::equal_to<const CGHeroInstance*>());
+	return vstd::find_pos(LOCPLINT->wanderingHeroes, h, std::equal_to<const CGHeroInstance*>());
 }
 
 void CHeroList::show( SDL_Surface * to )
@@ -1722,7 +1712,7 @@ void CTownList::clickLeft(tribool down, bool previousState)
 			return;
 		if(GH.topInt() == adventureInt
 		  && (ny+from)==selected 
-		  && adventureInt->selection->ID == TOWNI_TYPE
+		  && adventureInt->selection->ID == GameConstants::TOWNI_TYPE
 		  )
 			LOCPLINT->openTownWindow(LOCPLINT->towns[selected]);//print town screen
 		else
@@ -1813,7 +1803,7 @@ void CTownList::draw(SDL_Surface * to)
 
 		blitAt(graphics->getPic(LOCPLINT->towns[iT]->subID,LOCPLINT->towns[iT]->hasFort(),LOCPLINT->towns[iT]->builded),posporx,pospory+i*32,to);
 
-		if (adventureInt->selection && (selected == iT) && (adventureInt->selection->ID == TOWNI_TYPE))
+		if (adventureInt->selection && (selected == iT) && (adventureInt->selection->ID == GameConstants::TOWNI_TYPE))
 		{
 			blitAt(graphics->getPic(-2),posporx,pospory+i*32,to);
 		}
@@ -1881,7 +1871,7 @@ void CRecruitmentWindow::Buy()
 	if(dstslot < 0 && !vstd::contains(CGI->arth->bigArtifacts,CGI->arth->convertMachineID(crid, true))) //no available slot
 	{
 		std::string txt;
-		if(dst->ID == HEROI_TYPE)
+		if(dst->ID == GameConstants::HEROI_TYPE)
 		{
 			txt = CGI->generaltexth->allTexts[425]; //The %s would join your hero, but there aren't enough provisions to support them.
 			boost::algorithm::replace_first(txt, "%s", slider->value > 1 ? CGI->creh->creatures[crid]->namePl : CGI->creh->creatures[crid]->nameSing);
@@ -2895,7 +2885,7 @@ void CTradeWindow::CTradeableItem::setArtInstance(const CArtifactInstance *art)
 		id = -1;
 }
 
-CTradeWindow::CTradeWindow(const IMarket *Market, const CGHeroInstance *Hero, EMarketMode Mode)
+CTradeWindow::CTradeWindow(const IMarket *Market, const CGHeroInstance *Hero, EMarketMode::EMarketMode Mode)
 	: market(Market), hero(Hero),  arts(NULL), hLeft(NULL), hRight(NULL), readyToTrade(false)
 {
 	type |= BLOCK_ADV_HOTKEYS;
@@ -2907,31 +2897,31 @@ void CTradeWindow::initTypes()
 {
 	switch(mode)
 	{
-	case RESOURCE_RESOURCE:
+	case EMarketMode::RESOURCE_RESOURCE:
 		itemsType[1] = RESOURCE;
 		itemsType[0] = RESOURCE;
 		break;
-	case RESOURCE_PLAYER:
+	case EMarketMode::RESOURCE_PLAYER:
 		itemsType[1] = RESOURCE;
 		itemsType[0] = PLAYER;
 		break;
-	case CREATURE_RESOURCE:
+	case EMarketMode::CREATURE_RESOURCE:
 		itemsType[1] = CREATURE;
 		itemsType[0] = RESOURCE;
 		break;
-	case RESOURCE_ARTIFACT:
+	case EMarketMode::RESOURCE_ARTIFACT:
 		itemsType[1] = RESOURCE;
 		itemsType[0] = ARTIFACT_TYPE;
 		break;
-	case ARTIFACT_RESOURCE:
+	case EMarketMode::ARTIFACT_RESOURCE:
 		itemsType[1] = ARTIFACT_INSTANCE;
 		itemsType[0] = RESOURCE;
 		break;
-	case CREATURE_EXP:
+	case EMarketMode::CREATURE_EXP:
 		itemsType[1] = CREATURE;
 		itemsType[0] = CREATURE_PLACEHOLDER;
 		break;
-	case ARTIFACT_EXP:
+	case EMarketMode::ARTIFACT_EXP:
 		itemsType[1] = ARTIFACT_TYPE;
 		itemsType[0] = ARTIFACT_PLACEHOLDER;
 		break;
@@ -2943,7 +2933,7 @@ void CTradeWindow::initItems(bool Left)
 	if(Left && (itemsType[1] == ARTIFACT_TYPE || itemsType[1] == ARTIFACT_INSTANCE))
 	{
 		int xOffset = 0, yOffset = 0;
-		if(mode == ARTIFACT_RESOURCE)
+		if(mode == EMarketMode::ARTIFACT_RESOURCE)
 		{
 			xOffset = -361;
 			yOffset = +46;
@@ -2969,7 +2959,7 @@ void CTradeWindow::initItems(bool Left)
 		addChild(arts);
 		artSets.push_back(arts);
 
-		if(mode == ARTIFACT_RESOURCE)
+		if(mode == EMarketMode::ARTIFACT_RESOURCE)
 			arts->highlightModeCallback = boost::bind(&CTradeWindow::artifactSelected, this, _1);
 		return;
 	}
@@ -2986,12 +2976,12 @@ void CTradeWindow::initItems(bool Left)
 		amount = ids->size();
 
 	if(ids)
-		amin(amount, ids->size());
+		vstd::amin(amount, ids->size());
 
 	for(int j=0; j<amount; j++)
 	{
 		int id = (ids && ids->size()>j) ? (*ids)[j] : j;
-		if(id < 0 && mode != ARTIFACT_EXP)  //when sacrificing artifacts we need to prepare empty slots
+		if(id < 0 && mode != EMarketMode::ARTIFACT_EXP)  //when sacrificing artifacts we need to prepare empty slots
 			continue;
 
 		CTradeableItem *hlp = new CTradeableItem(itemsType[Left], id, Left, j);
@@ -3006,7 +2996,7 @@ std::vector<int> *CTradeWindow::getItemsIds(bool Left)
 {
 	std::vector<int> *ids = NULL;
 
-	if(mode == ARTIFACT_EXP)
+	if(mode == EMarketMode::ARTIFACT_EXP)
 		return new std::vector<int>(22, -1);
 
 	if(Left)
@@ -3031,7 +3021,7 @@ std::vector<int> *CTradeWindow::getItemsIds(bool Left)
 		{
 		case PLAYER:
 			ids = new std::vector<int>;
-			for(int i = 0; i < PLAYER_LIMIT; i++)
+			for(int i = 0; i < GameConstants::PLAYER_LIMIT; i++)
 				if(i != LOCPLINT->playerID && LOCPLINT->cb->getPlayerStatus(i) == PlayerState::INGAME)
 					ids->push_back(i);
 			break;
@@ -3047,7 +3037,7 @@ std::vector<int> *CTradeWindow::getItemsIds(bool Left)
 
 void CTradeWindow::getPositionsFor(std::vector<Rect> &poss, bool Left, EType type) const
 {
-	if(mode == ARTIFACT_EXP && !Left)
+	if(mode == EMarketMode::ARTIFACT_EXP && !Left)
 	{
 		//22 boxes, 5 in row, last row: two boxes centered
 		int h, w, x, y, dx, dy;
@@ -3111,7 +3101,7 @@ void CTradeWindow::initSubs(bool Left)
 			{
 				int h1, h2; //hlp variables for getting offer
 				market->getOffer(hLeft->id, t->id, h1, h2, mode);
-				if(t->id != hLeft->id || mode != RESOURCE_RESOURCE) //don't allow exchanging same resources
+				if(t->id != hLeft->id || mode != EMarketMode::RESOURCE_RESOURCE) //don't allow exchanging same resources
 				{
 					std::ostringstream oss;
 					oss << h2;
@@ -3171,7 +3161,7 @@ void CTradeWindow::getEmptySlots(std::set<CTradeableItem *> &toRemove)
 			toRemove.insert(t);
 }
 
-void CTradeWindow::setMode(EMarketMode Mode)
+void CTradeWindow::setMode(EMarketMode::EMarketMode Mode)
 {
 	const IMarket *m = market;
 	const CGHeroInstance *h = hero;
@@ -3181,8 +3171,8 @@ void CTradeWindow::setMode(EMarketMode Mode)
 	
 	switch(Mode)
 	{
-	case CREATURE_EXP:
-	case ARTIFACT_EXP:
+	case EMarketMode::CREATURE_EXP:
+	case EMarketMode::ARTIFACT_EXP:
 		nwindow = new CAltarWindow(m, h, Mode);
 		break;
 	default:
@@ -3195,7 +3185,7 @@ void CTradeWindow::setMode(EMarketMode Mode)
 
 void CTradeWindow::artifactSelected(CArtPlace *slot)
 {
-	assert(mode == ARTIFACT_RESOURCE);
+	assert(mode == EMarketMode::ARTIFACT_RESOURCE);
 	items[1][0]->setArtInstance(slot->ourArt);
 	if(slot->ourArt)
 		hLeft = items[1][0];
@@ -3205,7 +3195,7 @@ void CTradeWindow::artifactSelected(CArtPlace *slot)
 	selectionChanged(true);
 }
 
-CMarketplaceWindow::CMarketplaceWindow(const IMarket *Market, const CGHeroInstance *Hero, EMarketMode Mode)
+CMarketplaceWindow::CMarketplaceWindow(const IMarket *Market, const CGHeroInstance *Hero, EMarketMode::EMarketMode Mode)
 	: CTradeWindow(Market, Hero, Mode)
 {
 	OBJ_CONSTRUCTION_CAPTURING_ALL;
@@ -3215,24 +3205,24 @@ CMarketplaceWindow::CMarketplaceWindow(const IMarket *Market, const CGHeroInstan
 
 	switch(Mode)
 	{
-	case RESOURCE_RESOURCE:
+	case EMarketMode::RESOURCE_RESOURCE:
 		bgName = "TPMRKRES.bmp";
 		break;
 
-	case RESOURCE_PLAYER:
+	case EMarketMode::RESOURCE_PLAYER:
 		bgName = "TPMRKPTS.bmp";
 		break;
 
-	case CREATURE_RESOURCE:
+	case EMarketMode::CREATURE_RESOURCE:
 		bgName = "TPMRKCRS.bmp";
 		break;
 
-	case RESOURCE_ARTIFACT:
+	case EMarketMode::RESOURCE_ARTIFACT:
 		bgName = "TPMRKABS.bmp";
 		sliderNeeded = false;
 		break;
 
-	case ARTIFACT_RESOURCE:
+	case EMarketMode::ARTIFACT_RESOURCE:
 		bgName = "TPMRKASS.bmp";
 		sliderNeeded = false;
 		break;
@@ -3252,16 +3242,16 @@ CMarketplaceWindow::CMarketplaceWindow(const IMarket *Market, const CGHeroInstan
 	{
 		printAtMiddle(CGI->generaltexth->allTexts[159],300,27,FONT_BIG,tytulowy,*bg); //title
 	}
-	else if(mode == CREATURE_RESOURCE)
+	else if(mode == EMarketMode::CREATURE_RESOURCE)
 	{
-		if(market->o->ID == TOWNI_TYPE)
+		if(market->o->ID == GameConstants::TOWNI_TYPE)
 			printAtMiddle(CGI->buildh->buildings[6][21]->Name(), 300, 27, FONT_BIG, tytulowy, *bg); //title
 		else
 			printAtMiddle(market->o->getHoverText(), 300, 27, FONT_BIG, tytulowy, *bg); //title
 	}
-	else if(mode == RESOURCE_ARTIFACT || mode == ARTIFACT_RESOURCE)
+	else if(mode == EMarketMode::RESOURCE_ARTIFACT || mode == EMarketMode::ARTIFACT_RESOURCE)
 	{
-		const std::string &title = market->o->ID == TOWNI_TYPE 
+		const std::string &title = market->o->ID == GameConstants::TOWNI_TYPE 
 									? CGI->buildh->buildings[market->o->subID][17]->Name()
 									: market->o->getHoverText();
 		
@@ -3301,15 +3291,15 @@ CMarketplaceWindow::CMarketplaceWindow(const IMarket *Market, const CGHeroInstan
 	//left side
 	switch(Mode)
 	{
-	case RESOURCE_RESOURCE:
-	case RESOURCE_PLAYER:
-	case RESOURCE_ARTIFACT:
+	case EMarketMode::RESOURCE_RESOURCE:
+	case EMarketMode::RESOURCE_PLAYER:
+	case EMarketMode::RESOURCE_ARTIFACT:
 		printAtMiddle(CGI->generaltexth->allTexts[270],154,148,FONT_SMALL,zwykly,*bg); //kingdom res.
 		break;
-	case CREATURE_RESOURCE: 
+	case EMarketMode::CREATURE_RESOURCE: 
 		printAtMiddle(boost::str(boost::format(CGI->generaltexth->allTexts[272]) % hero->name), 152, 102, FONT_SMALL, zwykly, *bg); //%s's Creatures
 		break;
-	case ARTIFACT_RESOURCE: 
+	case EMarketMode::ARTIFACT_RESOURCE: 
 		printAtMiddle(boost::str(boost::format(CGI->generaltexth->allTexts[271]) % hero->name), 152, 57, FONT_SMALL, zwykly, *bg); //%s's Artifacts
 		break;
 	}
@@ -3317,32 +3307,32 @@ CMarketplaceWindow::CMarketplaceWindow(const IMarket *Market, const CGHeroInstan
 	//right side
 	switch(Mode)
 	{
-	case RESOURCE_RESOURCE:
-	case CREATURE_RESOURCE:
-	case RESOURCE_ARTIFACT:
-	case ARTIFACT_RESOURCE:
+	case EMarketMode::RESOURCE_RESOURCE:
+	case EMarketMode::CREATURE_RESOURCE:
+	case EMarketMode::RESOURCE_ARTIFACT:
+	case EMarketMode::ARTIFACT_RESOURCE:
 		printAtMiddle(CGI->generaltexth->allTexts[168],445,148,FONT_SMALL,zwykly,*bg); //available for trade
 		traderTextRect = Rect(316, 48, 260, 75);
 		break;
-	case RESOURCE_PLAYER:
+	case EMarketMode::RESOURCE_PLAYER:
 		printAtMiddle(CGI->generaltexth->allTexts[169],445,55,FONT_SMALL,zwykly,*bg); //players
 		traderTextRect = Rect(28, 48, 260, 75);
 		break;
 	}
 
 	traderText = new CTextBox("", traderTextRect, 0, FONT_SMALL, CENTER);
-	int specialOffset = mode == ARTIFACT_RESOURCE ? 35 : 0; //in selling artifacts mode we need to move res-res and art-res buttons down
-
-	if(printButtonFor(RESOURCE_PLAYER))
-		new AdventureMapButton(CGI->generaltexth->zelp[612],boost::bind(&CMarketplaceWindow::setMode,this, RESOURCE_PLAYER), 18, 520,"TPMRKBU1.DEF");
-	if(printButtonFor(RESOURCE_RESOURCE))
-		new AdventureMapButton(CGI->generaltexth->zelp[605],boost::bind(&CMarketplaceWindow::setMode,this, RESOURCE_RESOURCE), 516, 450 + specialOffset,"TPMRKBU5.DEF");
-	if(printButtonFor(CREATURE_RESOURCE))
-		new AdventureMapButton(CGI->generaltexth->zelp[599],boost::bind(&CMarketplaceWindow::setMode,this, CREATURE_RESOURCE), 516, 485,"TPMRKBU4.DEF"); //was y=450, changed to not overlap res-res in some conditions
-	if(printButtonFor(RESOURCE_ARTIFACT))
-		new AdventureMapButton(CGI->generaltexth->zelp[598],boost::bind(&CMarketplaceWindow::setMode,this, RESOURCE_ARTIFACT), 18, 450 + specialOffset,"TPMRKBU2.DEF");
-	if(printButtonFor(ARTIFACT_RESOURCE))																				
-		new AdventureMapButton(CGI->generaltexth->zelp[613],boost::bind(&CMarketplaceWindow::setMode,this, ARTIFACT_RESOURCE), 18, 485,"TPMRKBU3.DEF"); //was y=450, changed to not overlap res-art in some conditions
+	int specialOffset = mode == EMarketMode::ARTIFACT_RESOURCE ? 35 : 0; //in selling artifacts mode we need to move res-res and art-res buttons down
+
+	if(printButtonFor(EMarketMode::RESOURCE_PLAYER))
+		new AdventureMapButton(CGI->generaltexth->zelp[612],boost::bind(&CMarketplaceWindow::setMode,this, EMarketMode::RESOURCE_PLAYER), 18, 520,"TPMRKBU1.DEF");
+	if(printButtonFor(EMarketMode::RESOURCE_RESOURCE))
+		new AdventureMapButton(CGI->generaltexth->zelp[605],boost::bind(&CMarketplaceWindow::setMode,this, EMarketMode::RESOURCE_RESOURCE), 516, 450 + specialOffset,"TPMRKBU5.DEF");
+	if(printButtonFor(EMarketMode::CREATURE_RESOURCE))
+		new AdventureMapButton(CGI->generaltexth->zelp[599],boost::bind(&CMarketplaceWindow::setMode,this, EMarketMode::CREATURE_RESOURCE), 516, 485,"TPMRKBU4.DEF"); //was y=450, changed to not overlap res-res in some conditions
+	if(printButtonFor(EMarketMode::RESOURCE_ARTIFACT))
+		new AdventureMapButton(CGI->generaltexth->zelp[598],boost::bind(&CMarketplaceWindow::setMode,this, EMarketMode::RESOURCE_ARTIFACT), 18, 450 + specialOffset,"TPMRKBU2.DEF");
+	if(printButtonFor(EMarketMode::ARTIFACT_RESOURCE))																				
+		new AdventureMapButton(CGI->generaltexth->zelp[613],boost::bind(&CMarketplaceWindow::setMode,this, EMarketMode::ARTIFACT_RESOURCE), 18, 485,"TPMRKBU3.DEF"); //was y=450, changed to not overlap res-art in some conditions
 
 	updateTraderText();
 }
@@ -3380,9 +3370,9 @@ void CMarketplaceWindow::makeDeal()
 		return;
 
 	int leftIdToSend = -1;
-	if(mode == CREATURE_RESOURCE)
+	if(mode == EMarketMode::CREATURE_RESOURCE)
 		leftIdToSend = hLeft->serial;
-	else if(mode == ARTIFACT_RESOURCE)
+	else if(mode == EMarketMode::ARTIFACT_RESOURCE)
 		leftIdToSend = hLeft->getArtInstance()->id;
 	else
 		leftIdToSend = hLeft->id;
@@ -3411,10 +3401,10 @@ void CMarketplaceWindow::sliderMoved( int to )
 void CMarketplaceWindow::selectionChanged(bool side)
 {
 	readyToTrade = hLeft && hRight;
-	if(mode == RESOURCE_RESOURCE)
+	if(mode == EMarketMode::RESOURCE_RESOURCE)
 		readyToTrade = readyToTrade && (hLeft->id != hRight->id); //for resource trade, two DIFFERENT resources must be selected 
 
- 	if(mode == ARTIFACT_RESOURCE && !hLeft) 
+ 	if(mode == EMarketMode::ARTIFACT_RESOURCE && !hLeft) 
 		arts->unmarkSlots(false);
  
 	if(readyToTrade)
@@ -3462,14 +3452,14 @@ void CMarketplaceWindow::selectionChanged(bool side)
 	redraw();
 }
 
-bool CMarketplaceWindow::printButtonFor(EMarketMode M) const
+bool CMarketplaceWindow::printButtonFor(EMarketMode::EMarketMode M) const
 {
-	return market->allowsTrade(M) && M != mode && (hero || ( M != CREATURE_RESOURCE && M != RESOURCE_ARTIFACT && M != ARTIFACT_RESOURCE ));
+	return market->allowsTrade(M) && M != mode && (hero || ( M != EMarketMode::CREATURE_RESOURCE && M != EMarketMode::RESOURCE_ARTIFACT && M != EMarketMode::ARTIFACT_RESOURCE ));
 }
 
 void CMarketplaceWindow::garrisonChanged()
 {
-	if(mode != CREATURE_RESOURCE)
+	if(mode != EMarketMode::CREATURE_RESOURCE)
 		return;
 
 	std::set<CTradeableItem *> toRemove;
@@ -3483,7 +3473,7 @@ void CMarketplaceWindow::garrisonChanged()
 void CMarketplaceWindow::artifactsChanged(bool Left)
 {
 	assert(!Left);
-	if(mode != RESOURCE_ARTIFACT)
+	if(mode != EMarketMode::RESOURCE_ARTIFACT)
 		return;
 
 	std::vector<int> available = market->availableItemsIds(mode);
@@ -3553,7 +3543,7 @@ Point CMarketplaceWindow::selectionOffset(bool Left) const
 		switch(itemsType[0])
 		{
 		case RESOURCE:
-			if(mode == ARTIFACT_RESOURCE)
+			if(mode == EMarketMode::ARTIFACT_RESOURCE)
 				return Point(410, 469);
 			else
 				return Point(410, 446);
@@ -3620,27 +3610,27 @@ void CMarketplaceWindow::updateTraderText()
 {
 	if(readyToTrade)
 	{
-		if(mode == RESOURCE_PLAYER)
+		if(mode == EMarketMode::RESOURCE_PLAYER)
 		{
 			//I can give %s to the %s player.
 			traderText->setTxt(boost::str(boost::format(CGI->generaltexth->allTexts[165]) % hLeft->getName() % hRight->getName()));
 		}
-		else if(mode == RESOURCE_ARTIFACT)
+		else if(mode == EMarketMode::RESOURCE_ARTIFACT)
 		{
 			//I can offer you the %s for %d %s of %s.
 			traderText->setTxt(boost::str(boost::format(CGI->generaltexth->allTexts[267]) % hRight->getName() % r1 % CGI->generaltexth->allTexts[160 + (r1==1)] % hLeft->getName()));
 		}
-		else if(mode == RESOURCE_RESOURCE)
+		else if(mode == EMarketMode::RESOURCE_RESOURCE)
 		{
 			//I can offer you %d %s of %s for %d %s of %s.
 			traderText->setTxt(boost::str(boost::format(CGI->generaltexth->allTexts[157]) % r2 % CGI->generaltexth->allTexts[160 + (r2==1)] % hRight->getName() % r1 % CGI->generaltexth->allTexts[160 + (r1==1)] % hLeft->getName()));
 		}
-		else if(mode == CREATURE_RESOURCE)
+		else if(mode == EMarketMode::CREATURE_RESOURCE)
 		{
 			//I can offer you %d %s of %s for %d %s.
 			traderText->setTxt(boost::str(boost::format(CGI->generaltexth->allTexts[269]) % r2 % CGI->generaltexth->allTexts[160 + (r2==1)] % hRight->getName() % r1 % hLeft->getName(r1)));
 		}
-		else if(mode == ARTIFACT_RESOURCE)
+		else if(mode == EMarketMode::ARTIFACT_RESOURCE)
 		{
 			//I can offer you %d %s of %s for your %s.
 			traderText->setTxt(boost::str(boost::format(CGI->generaltexth->allTexts[268]) % r2 % CGI->generaltexth->allTexts[160 + (r2==1)] % hRight->getName() % hLeft->getName(r1)));
@@ -3651,14 +3641,14 @@ void CMarketplaceWindow::updateTraderText()
 	int gnrtxtnr = -1;
 	if(madeTransaction)
 	{
-		if(mode == RESOURCE_PLAYER)
+		if(mode == EMarketMode::RESOURCE_PLAYER)
 			gnrtxtnr = 166; //Are there any other resources you'd like to give away?
 		else
 			gnrtxtnr = 162; //You have received quite a bargain.  I expect to make no profit on the deal.  Can I interest you in any of my other wares?
 	}
 	else
 	{
-		if(mode == RESOURCE_PLAYER)
+		if(mode == EMarketMode::RESOURCE_PLAYER)
 			gnrtxtnr = 167; //If you'd like to give any of your resources to another player, click on the item you wish to give and to whom.
 		else
 			gnrtxtnr = 163; //Please inspect our fine wares.  If you feel like offering a trade, click on the items you wish to trade with and for.
@@ -3666,18 +3656,18 @@ void CMarketplaceWindow::updateTraderText()
 	traderText->setTxt(CGI->generaltexth->allTexts[gnrtxtnr]);
 }
 
-CAltarWindow::CAltarWindow(const IMarket *Market, const CGHeroInstance *Hero /*= NULL*/, EMarketMode Mode)
+CAltarWindow::CAltarWindow(const IMarket *Market, const CGHeroInstance *Hero /*= NULL*/, EMarketMode::EMarketMode Mode)
 	:CTradeWindow(Market, Hero, Mode)
 {
 	OBJ_CONSTRUCTION_CAPTURING_ALL;
-	bg = new CPicture(Mode == CREATURE_EXP ? "ALTARMON.bmp" : "ALTRART2.bmp");
+	bg = new CPicture(Mode == EMarketMode::CREATURE_EXP ? "ALTARMON.bmp" : "ALTRART2.bmp");
 	bg->colorizeAndConvert(LOCPLINT->playerID);
 	pos = bg->center();
 
 
 
 
-	if(Mode == CREATURE_EXP)
+	if(Mode == EMarketMode::CREATURE_EXP)
 	{
 		printAtMiddle(boost::str(boost::format(CGI->generaltexth->allTexts[272]) % hero->name), 155, 30, FONT_SMALL, tytulowy, *bg); //%s's Creatures
 		printAtMiddle(CGI->generaltexth->allTexts[479], 450, 30, FONT_SMALL, tytulowy, *bg); //Altar of Sacrifice
@@ -3687,7 +3677,7 @@ CAltarWindow::CAltarWindow(const IMarket *Market, const CGHeroInstance *Hero /*=
 		slider->moved = boost::bind(&CAltarWindow::sliderMoved,this,_1);
 		max = new AdventureMapButton(CGI->generaltexth->zelp[578],boost::bind(&CSlider::moveToMax, slider),147,520,"IRCBTNS.DEF");
 
-		sacrificedUnits.resize(ARMY_SIZE, 0);
+		sacrificedUnits.resize(GameConstants::ARMY_SIZE, 0);
 		sacrificeAll = new AdventureMapButton(CGI->generaltexth->zelp[579],boost::bind(&CAltarWindow::SacrificeAll,this),393,520,"ALTARMY.DEF");
 		sacrificeBackpack = NULL;
 
@@ -3720,12 +3710,12 @@ CAltarWindow::CAltarWindow(const IMarket *Market, const CGHeroInstance *Hero /*=
 
 	deal = new AdventureMapButton(CGI->generaltexth->zelp[585],boost::bind(&CAltarWindow::makeDeal,this),269,520,"ALTSACR.DEF");
 
-	if(Hero->getAlignment() != EVIL && Mode == CREATURE_EXP)
-		new AdventureMapButton(CGI->generaltexth->zelp[580], boost::bind(&CTradeWindow::setMode,this, ARTIFACT_EXP), 516, 421, "ALTART.DEF");
-	if(Hero->getAlignment() != GOOD && Mode == ARTIFACT_EXP)
-		new AdventureMapButton(CGI->generaltexth->zelp[572], boost::bind(&CTradeWindow::setMode,this, CREATURE_EXP), 516, 421, "ALTSACC.DEF");
+	if(Hero->getAlignment() != ::EAlignment::EVIL && Mode == EMarketMode::CREATURE_EXP)
+		new AdventureMapButton(CGI->generaltexth->zelp[580], boost::bind(&CTradeWindow::setMode,this, EMarketMode::ARTIFACT_EXP), 516, 421, "ALTART.DEF");
+	if(Hero->getAlignment() != ::EAlignment::GOOD && Mode == EMarketMode::ARTIFACT_EXP)
+		new AdventureMapButton(CGI->generaltexth->zelp[572], boost::bind(&CTradeWindow::setMode,this, EMarketMode::CREATURE_EXP), 516, 421, "ALTSACC.DEF");
 
-	expPerUnit.resize(ARMY_SIZE, 0);
+	expPerUnit.resize(GameConstants::ARMY_SIZE, 0);
 	getExpValues();
 
 	expToLevel = new CLabel(73, 475, FONT_SMALL, CENTER);
@@ -3763,7 +3753,7 @@ void CAltarWindow::sliderMoved(int to)
 
 void CAltarWindow::makeDeal()
 {
-	if(mode == CREATURE_EXP)
+	if(mode == EMarketMode::CREATURE_EXP)
 	{
 		blockTrade();
 		slider->value = 0;
@@ -3808,7 +3798,7 @@ void CAltarWindow::makeDeal()
 
 void CAltarWindow::SacrificeAll()
 {
-	if(mode == CREATURE_EXP)
+	if(mode == EMarketMode::CREATURE_EXP)
 	{
 		bool movedAnything = false;
 		BOOST_FOREACH(CTradeableItem *t, items[1])
@@ -3841,7 +3831,7 @@ void CAltarWindow::SacrificeAll()
 
 void CAltarWindow::selectionChanged(bool side)
 {
-	if(mode != CREATURE_EXP)
+	if(mode != EMarketMode::CREATURE_EXP)
 		return;
 
 	CTradeableItem *&selected = side ? hLeft : hRight;
@@ -3850,7 +3840,7 @@ void CAltarWindow::selectionChanged(bool side)
 	theOther = *std::find_if(items[!side].begin(), items[!side].end(), boost::bind(&CTradeableItem::serial, _1) == selected->serial);
 
 	int stackCount = 0;
-	for (int i = 0; i < ARMY_SIZE; i++)
+	for (int i = 0; i < GameConstants::ARMY_SIZE; i++)
 		if(hero->getStackCount(i) > sacrificedUnits[i])
 			stackCount++;
 
@@ -3900,7 +3890,7 @@ void CAltarWindow::artifactsChanged(bool left)
 
 void CAltarWindow::garrisonChanged()
 {
-	if(mode != CREATURE_EXP)
+	if(mode != EMarketMode::CREATURE_EXP)
 		return;
 
 	std::set<CTradeableItem *> empty;
@@ -3921,13 +3911,13 @@ void CAltarWindow::getExpValues()
 	int dump;
 	BOOST_FOREACH(CTradeableItem *t, items[1])
 		if(t->id >= 0)
-			market->getOffer(t->id, 0, dump, expPerUnit[t->serial], CREATURE_EXP);
+			market->getOffer(t->id, 0, dump, expPerUnit[t->serial], EMarketMode::CREATURE_EXP);
 }
 
 void CAltarWindow::calcTotalExp()
 {
 	int val = 0;
-	if(mode == CREATURE_EXP)
+	if(mode == EMarketMode::CREATURE_EXP)
 	{
 		for (int i = 0; i < sacrificedUnits.size(); i++)
 		{
@@ -3943,7 +3933,7 @@ void CAltarWindow::calcTotalExp()
 			val += valOfArt; //WAS val += valOfArt * arts->artifactsOnAltar.count(*i);
 		}
 	}
-	val *=(100+hero->getSecSkillLevel(CGHeroInstance::LEARNING)*5)/100.0f;
+	val *=(100+hero->getSecSkillLevel(CGHeroInstance::LEARNING)*5)/100.0;
 	expOnAltar->setTxt(boost::lexical_cast<std::string>(val));
 }
 
@@ -4006,12 +3996,12 @@ void CAltarWindow::artifactPicked()
 void CAltarWindow::showAll(SDL_Surface * to)
 {
 	CTradeWindow::showAll(to);
-	if(mode == ARTIFACT_EXP && arts && arts->commonInfo->src.art)
+	if(mode == EMarketMode::ARTIFACT_EXP && arts && arts->commonInfo->src.art)
 	{
 		blitAtLoc(graphics->artDefs->ourImages[arts->commonInfo->src.art->artType->id].bitmap, 281, 442, to);
 
 		int dmp, val;
-		market->getOffer(arts->commonInfo->src.art->artType->id, 0, dmp, val, ARTIFACT_EXP);
+		market->getOffer(arts->commonInfo->src.art->artType->id, 0, dmp, val, EMarketMode::ARTIFACT_EXP);
 		printAtMiddleLoc(boost::lexical_cast<std::string>(val), 304, 498, FONT_SMALL, zwykly, to);
 	}
 }
@@ -4037,7 +4027,7 @@ bool CAltarWindow::putOnAltar(CTradeableItem* altarSlot, const CArtifactInstance
 	}
 
 	int dmp, val;
-	market->getOffer(artID, 0, dmp, val, ARTIFACT_EXP);
+	market->getOffer(artID, 0, dmp, val, EMarketMode::ARTIFACT_EXP);
 
 	arts->artifactsOnAltar.insert(art);
 	altarSlot->setArtInstance(art);
@@ -4049,7 +4039,7 @@ bool CAltarWindow::putOnAltar(CTradeableItem* altarSlot, const CArtifactInstance
 
 void CAltarWindow::moveFromSlotToAltar(int slotID, CTradeableItem* altarSlot, const CArtifactInstance *art)
 {
-	int freeBackpackSlot = hero->artifactsInBackpack.size() + Arts::BACKPACK_START;
+	int freeBackpackSlot = hero->artifactsInBackpack.size() + GameConstants::BACKPACK_START;
 	if(arts->commonInfo->src.art)
 	{
 		arts->commonInfo->dst.slotID = freeBackpackSlot;
@@ -4058,7 +4048,7 @@ void CAltarWindow::moveFromSlotToAltar(int slotID, CTradeableItem* altarSlot, co
 
 	if(putOnAltar(altarSlot, art))
 	{
-		if(slotID < Arts::BACKPACK_START)
+		if(slotID < GameConstants::BACKPACK_START)
 			LOCPLINT->cb->swapArtifacts(hero, slotID, hero, freeBackpackSlot);
 		else
 		{
@@ -4307,8 +4297,7 @@ void CTavernWindow::show(SDL_Surface * to)
 void CTavernWindow::HeroPortrait::clickLeft(tribool down, bool previousState)
 {
 	if(previousState && !down && h)
-		as();
-	//ClickableL::clickLeft(down);
+		*_sel = _id;
 }
 
 void CTavernWindow::HeroPortrait::clickRight(tribool down, bool previousState)
@@ -4320,7 +4309,7 @@ void CTavernWindow::HeroPortrait::clickRight(tribool down, bool previousState)
 }
 
 CTavernWindow::HeroPortrait::HeroPortrait(int &sel, int id, int x, int y, const CGHeroInstance *H)
-:as(sel,id), h(H)
+: h(H), _id(id), _sel(&sel)
 {
 	used = LCLICK | RCLICK | HOVER;
 	h = H;
@@ -4688,8 +4677,8 @@ void CArtPlace::activate()
 void CArtPlace::clickLeft(tribool down, bool previousState)
 {
 	//LRClickableAreaWTextComp::clickLeft(down);
-	bool inBackpack = slotID >= Arts::BACKPACK_START, 
-		srcInBackpack = ourOwner->commonInfo->src.slotID >= Arts::BACKPACK_START,
+	bool inBackpack = slotID >= GameConstants::BACKPACK_START, 
+		srcInBackpack = ourOwner->commonInfo->src.slotID >= GameConstants::BACKPACK_START,
 		srcInSameHero = ourOwner->commonInfo->src.AOH == ourOwner;
 	
 	if(ourOwner->highlightModeCallback && ourArt)
@@ -4766,10 +4755,10 @@ void CArtPlace::clickLeft(tribool down, bool previousState)
 						break;
 					default:
 						setMeAsDest();
-						amin(ourOwner->commonInfo->dst.slotID, ourOwner->curHero->artifactsInBackpack.size() + Arts::BACKPACK_START);
+						vstd::amin(ourOwner->commonInfo->dst.slotID, ourOwner->curHero->artifactsInBackpack.size() + GameConstants::BACKPACK_START);
 						if(srcInBackpack && srcInSameHero)
 						{
-							if(!ourArt								//cannot move from backpack to AFTER backpack -> combined with amin above it will guarantee that dest is at most the last artifact
+							if(!ourArt								//cannot move from backpack to AFTER backpack -> combined with vstd::amin above it will guarantee that dest is at most the last artifact
 							  || ourOwner->commonInfo->src.slotID < ourOwner->commonInfo->dst.slotID) //rearranging arts in backpack after taking src artifact, the dest id will be shifted
 								ourOwner->commonInfo->dst.slotID--;
 						}
@@ -4860,9 +4849,9 @@ void CArtPlace::select ()
 		return;
 
 	picked = true;
-	if(ourArt->canBeDisassembled() && slotID < Arts::BACKPACK_START) //worn combined artifact -> locks have to disappear
+	if(ourArt->canBeDisassembled() && slotID < GameConstants::BACKPACK_START) //worn combined artifact -> locks have to disappear
 	{
-		for(int i = 0; i < Arts::BACKPACK_START; i++)
+		for(int i = 0; i < GameConstants::BACKPACK_START; i++)
 		{
 			CArtPlace *ap = ourOwner->getArtPlace(i);
 			ap->picked = ourArt->isPart(ap->ourArt);
@@ -4875,7 +4864,7 @@ void CArtPlace::select ()
 	ourOwner->commonInfo->src.setTo(this, false);
 	ourOwner->markPossibleSlots(ourArt);
 
-	if(slotID >= Arts::BACKPACK_START)
+	if(slotID >= GameConstants::BACKPACK_START)
 		ourOwner->scrollBackpack(0); //will update slots
 
 	ourOwner->updateParentWindow();
@@ -4890,14 +4879,14 @@ void CArtPlace::deselect ()
 	picked = false;
 	if(ourArt && ourArt->canBeDisassembled()) //combined art returned to its slot -> restore locks
 	{
-		for(int i = 0; i < Arts::BACKPACK_START; i++)
+		for(int i = 0; i < GameConstants::BACKPACK_START; i++)
 			ourOwner->getArtPlace(i)->picked = false;
 	}
 
 	CCS->curh->dragAndDropCursor(NULL);
 	ourOwner->unmarkSlots();
 	ourOwner->commonInfo->src.clear();
-	if(slotID >= Arts::BACKPACK_START)
+	if(slotID >= GameConstants::BACKPACK_START)
 		ourOwner->scrollBackpack(0); //will update slots
 
 
@@ -5225,7 +5214,7 @@ void CArtifactsOfHero::setHero(const CGHeroInstance * hero)
 
 void CArtifactsOfHero::dispose()
 {
-	//delNull(curHero);
+	//vstd::clear_pointer(curHero);
 	//unmarkSlots(false);
 	CCS->curh->dragAndDropCursor(NULL);
 }
@@ -5339,7 +5328,7 @@ void CArtifactsOfHero::unmarkLocalSlots(bool withRedraw /*= true*/)
  */
 void CArtifactsOfHero::setSlotData(CArtPlace* artPlace, int slotID)
 {
-	if(!artPlace && slotID >= Arts::BACKPACK_START) //spurious call from artifactMoved in attempt to update hidden backpack slot
+	if(!artPlace && slotID >= GameConstants::BACKPACK_START) //spurious call from artifactMoved in attempt to update hidden backpack slot
 	{
 		return;
 	}
@@ -5511,9 +5500,9 @@ void CArtifactsOfHero::realizeCurrentTransaction()
 
 void CArtifactsOfHero::artifactMoved(const ArtifactLocation &src, const ArtifactLocation &dst)
 {
-	if(src.hero == curHero && src.slot >= Arts::BACKPACK_START)
+	if(src.hero == curHero && src.slot >= GameConstants::BACKPACK_START)
 		updateSlot(src.slot);
-	if(dst.hero == curHero && dst.slot >= Arts::BACKPACK_START)
+	if(dst.hero == curHero && dst.slot >= GameConstants::BACKPACK_START)
 		updateSlot(dst.slot);
 	if(src.hero == curHero  ||  dst.hero == curHero) //we need to update all slots, artifact might be combined and affect more slots
 		updateWornSlots(false);
@@ -5523,13 +5512,13 @@ void CArtifactsOfHero::artifactMoved(const ArtifactLocation &src, const Artifact
 
 	if(commonInfo->src == src) //artifact was taken from us
 	{
-		assert(commonInfo->dst == dst  ||  dst.slot == dst.hero->artifactsInBackpack.size() + Arts::BACKPACK_START);
+		assert(commonInfo->dst == dst  ||  dst.slot == dst.hero->artifactsInBackpack.size() + GameConstants::BACKPACK_START);
 		commonInfo->reset();
 		unmarkSlots();
 	}
 	else if(commonInfo->dst == src) //the dest artifact was moved -> we are picking it
 	{
-		assert(dst.slot >= Arts::BACKPACK_START);
+		assert(dst.slot >= GameConstants::BACKPACK_START);
 		commonInfo->reset();
 
 		CArtPlace *ap = NULL;
@@ -5556,7 +5545,7 @@ void CArtifactsOfHero::artifactMoved(const ArtifactLocation &src, const Artifact
 			markPossibleSlots(dst.getArt());
 		}
 	}
-	else if(src.slot >= Arts::BACKPACK_START && 
+	else if(src.slot >= GameConstants::BACKPACK_START && 
 	        src.slot <  commonInfo->src.slotID &&
 			src.hero == commonInfo->src.AOH->curHero) //artifact taken from before currently picked one
 	{
@@ -5577,13 +5566,13 @@ void CArtifactsOfHero::artifactMoved(const ArtifactLocation &src, const Artifact
 // 	if(dst.slot >= Arts::BACKPACK_START && dst.slot - Arts::BACKPACK_START < backpackPos)
 // 		shift++;
 // 
- 	if(src.slot < Arts::BACKPACK_START  &&  dst.slot - Arts::BACKPACK_START < backpackPos)
+ 	if(src.slot < GameConstants::BACKPACK_START  &&  dst.slot - GameConstants::BACKPACK_START < backpackPos)
 		shift++;
-	if(dst.slot < Arts::BACKPACK_START  &&  src.slot - Arts::BACKPACK_START < backpackPos)
+	if(dst.slot < GameConstants::BACKPACK_START  &&  src.slot - GameConstants::BACKPACK_START < backpackPos)
  		shift--;
 
-	if( (src.hero == curHero && src.slot >= Arts::BACKPACK_START)
-	 || (dst.hero == curHero && dst.slot >= Arts::BACKPACK_START) )
+	if( (src.hero == curHero && src.slot >= GameConstants::BACKPACK_START)
+	 || (dst.hero == curHero && dst.slot >= GameConstants::BACKPACK_START) )
 		scrollBackpack(shift); //update backpack slots
 }
 
@@ -5591,7 +5580,7 @@ void CArtifactsOfHero::artifactRemoved(const ArtifactLocation &al)
 {
 	if(al.hero == curHero)
 	{
-		if(al.slot < Arts::BACKPACK_START)
+		if(al.slot < GameConstants::BACKPACK_START)
 			updateWornSlots(0);
 		else
 			scrollBackpack(0); //update backpack slots
@@ -5600,7 +5589,7 @@ void CArtifactsOfHero::artifactRemoved(const ArtifactLocation &al)
 
 CArtPlace * CArtifactsOfHero::getArtPlace(int slot)
 {
-	if(slot < Arts::BACKPACK_START)
+	if(slot < GameConstants::BACKPACK_START)
 	{
 		return artWorn[slot];
 	}
@@ -5899,7 +5888,7 @@ CShipyardWindow::CShipyardWindow(const std::vector<si32> &cost, int state, int b
 	costLabel = new CLabel(164, 220, FONT_MEDIUM, CENTER, zwykly,   CGI->generaltexth->jktexts[14]);
 }
 
-CPuzzleWindow::CPuzzleWindow(const int3 &grailPos, float discoveredRatio)
+CPuzzleWindow::CPuzzleWindow(const int3 &grailPos, double discoveredRatio)
 :animCount(0)
 {
 	SDL_Surface * back = BitmapHandler::loadBitmap("PUZZLE.BMP", false);
@@ -6059,7 +6048,7 @@ void CTransformerWindow::makeDeal()
 {
 	for (int i=0; i<items.size(); i++)
 		if (!items[i]->left)
-			LOCPLINT->cb->trade(town, CREATURE_UNDEAD, items[i]->id, 0, 0, hero);
+			LOCPLINT->cb->trade(town, EMarketMode::CREATURE_UNDEAD, items[i]->id, 0, 0, hero);
 }
 
 void CTransformerWindow::addAll()
@@ -6137,7 +6126,7 @@ int CUniversityWindow::CItem::state()
 {
 	if (parent->hero->getSecSkillLevel(static_cast<CGHeroInstance::SecondarySkill>(ID)))//hero know this skill
 		return 1;
-	if (parent->hero->secSkills.size() >= SKILL_PER_HERO)//can't learn more skills
+	if (parent->hero->secSkills.size() >= GameConstants::SKILL_PER_HERO)//can't learn more skills
 		return 0;
 	if (parent->hero->type->heroClass->proSec[ID]==0)//can't learn this skill (like necromancy for most of non-necros)
 		return 0;
@@ -6207,7 +6196,7 @@ CUniversityWindow::CUniversityWindow(const CGHeroInstance * _hero, const IMarket
 	printAtMiddleWBLoc(CGI->generaltexth->allTexts[603], 232, 153, FONT_SMALL, 70,zwykly,bg->bg);//Clerk speech
 	printAtMiddleLoc  (CGI->generaltexth->allTexts[602], 231, 26 , FONT_MEDIUM ,tytulowy,bg->bg);//University
 
-	std::vector<int> list = market->availableItemsIds(RESOURCE_SKILL);
+	std::vector<int> list = market->availableItemsIds(EMarketMode::RESOURCE_SKILL);
 	if (list.size()!=4)
 		tlog0<<"\t\tIncorrect size of available items vector!\n";
 	for (int i=0; i<list.size(); i++)//prepare clickable items
@@ -6264,7 +6253,7 @@ CUnivConfirmWindow::CUnivConfirmWindow(CUniversityWindow * PARENT, int SKILL, bo
 
 void CUnivConfirmWindow::makeDeal(int skill)
 {
-	LOCPLINT->cb->trade(parent->market->o, RESOURCE_SKILL, 6, skill, 1, parent->hero);
+	LOCPLINT->cb->trade(parent->market->o, EMarketMode::RESOURCE_SKILL, 6, skill, 1, parent->hero);
 	GH.popIntTotally(this);
 }
 
@@ -6285,7 +6274,7 @@ CHillFortWindow::CHillFortWindow(const CGHeroInstance *visitor, const CGObjectIn
 	
 	currState.resize(slotsCount+1);
 	costs.resize(slotsCount);
-	totalSumm.resize(RESOURCE_QUANTITY);
+	totalSumm.resize(GameConstants::RESOURCE_QUANTITY);
 	std::vector<std::string> files;
 	files += "APHLF1R.DEF", "APHLF1Y.DEF", "APHLF1G.DEF";
 	for (int i=0; i<slotsCount; i++)
@@ -6321,7 +6310,7 @@ void CHillFortWindow::activate()
 void CHillFortWindow::updateGarrisons()
 {
 	
-	for (int i=0; i<RESOURCE_QUANTITY; i++)
+	for (int i=0; i<GameConstants::RESOURCE_QUANTITY; i++)
 		totalSumm[i]=0;
 	
 	for (int i=0; i<slotsCount; i++)
@@ -6405,7 +6394,7 @@ void CHillFortWindow::showAll (SDL_Surface *to)
 			}
 		}
 	}
-	for (int i=0; i<RESOURCE_QUANTITY; i++)
+	for (int i=0; i<GameConstants::RESOURCE_QUANTITY; i++)
 	{
 		if (totalSumm[i])//this resource is used - display it
 		{
@@ -6563,7 +6552,7 @@ CThievesGuildWindow::CThievesGuildWindow(const CGObjectInstance * _owner)
 	CDefHandler * flagPictures = CDefHandler::giveDef("itgflags.def");
 
 	//printing flags
-	for(int g=0; g<ARRAY_COUNT(fields); ++g) //by lines
+	for(int g = 0; g < ARRAY_COUNT(fields); ++g) //by lines
 	{
 		for(int b=0; b<(tgi .* fields[g]).size(); ++b) //by places (1st, 2nd, ...)
 		{
@@ -6844,7 +6833,7 @@ void CTextBox::recalculateLines(const std::string &Txt)
 	maxH = lineHeight * lines.size();
 	maxW = 0;
 	BOOST_FOREACH(const std::string &line, lines)
-		amax(maxW, f.getWidth(line.c_str()));
+		vstd::amax(maxW, f.getWidth(line.c_str()));
 }
 
 void CGStatusBar::print(const std::string & Text)
@@ -6887,7 +6876,7 @@ CGStatusBar::CGStatusBar(int x, int y, std::string name/*="ADROLLVR.bmp"*/, int
 	pos = bg->pos;
 	if(maxw < pos.w)
 	{
-		amin(pos.w, maxw);
+		vstd::amin(pos.w, maxw);
 		bg->srcRect = new Rect(0, 0, maxw, pos.h);
 	}
 	calcOffset();

+ 15 - 17
client/GUIClasses.h

@@ -1,13 +1,10 @@
-#ifndef __GUICLASSES_H__
-#define __GUICLASSES_H__
+#pragma once
+
 
-#include "../global.h"
 #include "GUIBase.h"
 #include "FunctionList.h"
-#include <set>
-#include <list>
-#include <boost/thread/mutex.hpp>
 #include "../lib/ResourceSet.h"
+#include "../lib/GameConstants.h"
 
 #ifdef max
 #undef max
@@ -761,12 +758,12 @@ public:
 	CTradeableItem *hLeft, *hRight; //highlighted items (NULL if no highlight)
 	EType itemsType[2];
 
-	EMarketMode mode;//0 - res<->res; 1 - res<->plauer; 2 - buy artifact; 3 - sell artifact
+	EMarketMode::EMarketMode mode;//0 - res<->res; 1 - res<->plauer; 2 - buy artifact; 3 - sell artifact
 	AdventureMapButton *ok, *max, *deal;
 	CSlider *slider; //for choosing amount to be exchanged
 	bool readyToTrade;
 
-	CTradeWindow(const IMarket *Market, const CGHeroInstance *Hero, EMarketMode Mode); //c
+	CTradeWindow(const IMarket *Market, const CGHeroInstance *Hero, EMarketMode::EMarketMode Mode); //c
 
 	void showAll(SDL_Surface * to);
 
@@ -778,7 +775,7 @@ public:
 	void removeItems(const std::set<CTradeableItem *> &toRemove);
 	void removeItem(CTradeableItem * t);
 	void getEmptySlots(std::set<CTradeableItem *> &toRemove);
-	void setMode(EMarketMode Mode); //mode setter
+	void setMode(EMarketMode::EMarketMode Mode); //mode setter
 
 	void artifactSelected(CArtPlace *slot); //used when selling artifacts -> called when user clicked on artifact slot
 
@@ -792,7 +789,7 @@ public:
 
 class CMarketplaceWindow : public CTradeWindow
 {
-	bool printButtonFor(EMarketMode M) const;
+	bool printButtonFor(EMarketMode::EMarketMode M) const;
 public:
 	int r1, r2; //suggested amounts of traded resources
 	bool madeTransaction; //if player made at least one transaction
@@ -802,7 +799,7 @@ public:
 	void sliderMoved(int to);
 	void makeDeal();
 	void selectionChanged(bool side); //true == left
-	CMarketplaceWindow(const IMarket *Market, const CGHeroInstance *Hero = NULL, EMarketMode Mode = RESOURCE_RESOURCE); //c-tor
+	CMarketplaceWindow(const IMarket *Market, const CGHeroInstance *Hero = NULL, EMarketMode::EMarketMode Mode = EMarketMode::RESOURCE_RESOURCE); //c-tor
 	~CMarketplaceWindow(); //d-tor
 
 	Point selectionOffset(bool Left) const;
@@ -820,7 +817,7 @@ public:
 class CAltarWindow : public CTradeWindow
 {
 public:
-	CAltarWindow(const IMarket *Market, const CGHeroInstance *Hero, EMarketMode Mode); //c-tor
+	CAltarWindow(const IMarket *Market, const CGHeroInstance *Hero, EMarketMode::EMarketMode Mode); //c-tor
 
 	void getExpValues();
 	~CAltarWindow(); //d-tor
@@ -889,7 +886,6 @@ public:
 	{
 	public:
 		std::string hoverName;
-		vstd::assigner<int,int> as;
 		const CGHeroInstance *h;
 		char descr[100];		// "XXX is a level Y ZZZ with N artifacts"
 
@@ -899,6 +895,10 @@ public:
 		HeroPortrait(int &sel, int id, int x, int y, const CGHeroInstance *H);
 		void show(SDL_Surface * to);
 
+	private:
+		int *_sel;
+		const int _id;
+
 	} *h1, *h2; //recruitable heroes
 
 	CPicture *bg; //background
@@ -1179,7 +1179,7 @@ class CExchangeWindow : public CWindowWithGarrison, public CWindowWithArtifacts
 
 public:
 
-	const CGHeroInstance * heroInst[2];
+	const CGHeroInstance* heroInst[2];
 	CArtifactsOfHero * artifs[2];
 
 	void close();
@@ -1231,7 +1231,7 @@ public:
 	void deactivate();
 	void show(SDL_Surface * to);
 
-	CPuzzleWindow(const int3 &grailPos, float discoveredRatio);
+	CPuzzleWindow(const int3 &grailPos, double discoveredRatio);
 	~CPuzzleWindow();
 };
 
@@ -1367,5 +1367,3 @@ public:
 CIntObject *createCreWindow(const CStack *s);
 CIntObject *createCreWindow(int Cid, int Type, int creatureCount);
 CIntObject *createCreWindow(const CStackInstance *s, int type, boost::function<void()> Upg = 0, boost::function<void()> Dsm = 0, UpgradeInfo *ui = NULL);
-
-#endif //__GUICLASSES_H__

+ 30 - 33
client/Graphics.cpp

@@ -1,16 +1,10 @@
-#include "../stdafx.h"
+#include "StdInc.h"
 #include "Graphics.h"
+
 #include "CDefHandler.h"
 #include "SDL_Extensions.h"
 #include <SDL_ttf.h>
-#include <boost/assign/std/vector.hpp> 
-#include <sstream>
-#include <iomanip>
-#include <boost/thread.hpp>
-#include <boost/function.hpp>
-#include <boost/bind.hpp>
-#include <boost/foreach.hpp>
-#include "../CThreadHelper.h"
+#include "../lib/CThreadHelper.h"
 #include "CGameInfo.h"
 #include "../lib/CLodHandler.h"
 #include "../lib/VCMI_Lib.h"
@@ -25,6 +19,7 @@
 #include "../lib/CGameState.h"
 #include "../lib/JsonNode.h"
 #include "../lib/vcmi_endian.h"
+#include "../lib/GameConstants.h"
 
 using namespace boost::assign;
 using namespace CSDL_Ext;
@@ -74,7 +69,7 @@ SDL_Surface * Graphics::drawHeroInfoWin(const InfoAboutHero &curh)
 
 	if(curh.details)
 	{
-		for (int i = 0; i < PRIMARY_SKILLS; i++)
+		for (int i = 0; i < GameConstants::PRIMARY_SKILLS; i++)
 		{
 			SDL_itoa(curh.details->primskills[i], buf, 10);
 			printAtMiddle(buf,84+28*i,70,FONT_SMALL,zwykly,ret);
@@ -139,7 +134,7 @@ SDL_Surface * Graphics::drawTownInfoWin( const InfoAboutTown & curh )
 	if (curh.tType) {
 		pom = curh.tType->typeID*2;
 		if (!curh.fortLevel)
-			pom += F_NUMBER*2;
+			pom += GameConstants::F_NUMBER*2;
 		if(curh.built)
 			pom++;
 		blitAt(bigTownPic->ourImages[pom].bitmap,13,13,ret);
@@ -167,7 +162,7 @@ void Graphics::loadPaletteAndColors()
 	std::string pals = bitmaph->getTextFile("PLAYERS.PAL", FILE_OTHER);
 	playerColorPalette = new SDL_Color[256];
 	neutralColor = new SDL_Color;
-	playerColors = new SDL_Color[PLAYER_LIMIT];
+	playerColors = new SDL_Color[GameConstants::PLAYER_LIMIT];
 	int startPoint = 24; //beginning byte; used to read
 	for(int i=0; i<256; ++i)
 	{
@@ -181,7 +176,8 @@ void Graphics::loadPaletteAndColors()
 
 	neutralColorPalette = new SDL_Color[32];
 	std::ifstream ncp;
-	ncp.open(DATA_DIR "/config/NEUTRAL.PAL", std::ios::binary);
+	std::string neutralFile = GameConstants::DATA_DIR + "/config/NEUTRAL.PAL";
+	ncp.open(neutralFile.c_str(), std::ios::binary);
 	for(int i=0; i<32; ++i)
 	{
 		ncp.read((char*)&neutralColorPalette[i].r,1);
@@ -202,7 +198,7 @@ void Graphics::loadPaletteAndColors()
 		playerColors[i].unused = 0;
 	}
 	neutralColor->r = 0x84; neutralColor->g = 0x84; neutralColor->b = 0x84; neutralColor->unused = 0x0;//gray
-	const JsonNode config(DATA_DIR "/config/town_pictures.json");
+	const JsonNode config(GameConstants::DATA_DIR + "/config/town_pictures.json");
 	BOOST_FOREACH(const JsonNode &p, config["town_pictures"].Vector()) {
 
 		townBgs.push_back(p["town_background"].String());
@@ -213,7 +209,7 @@ void Graphics::loadPaletteAndColors()
 
 void Graphics::initializeBattleGraphics()
 {
-	const JsonNode config(DATA_DIR "/config/battles_graphics.json");
+	const JsonNode config(GameConstants::DATA_DIR + "/config/battles_graphics.json");
 	
 	// Reserve enough space for the terrains
 	int idx = config["backgrounds"].Vector().size();
@@ -302,14 +298,14 @@ Graphics::Graphics()
 	tasks += GET_DEF_ESS(spellscr,"SPELLSCR.DEF");
 	tasks += GET_DEF_ESS(heroMoveArrows,"ADAG.DEF");
 
-	const JsonNode config(DATA_DIR "/config/creature_backgrounds.json");
+	const JsonNode config(GameConstants::DATA_DIR + "/config/creature_backgrounds.json");
 	BOOST_FOREACH(const JsonNode &b, config["backgrounds"].Vector()) {
 		const int id = b["id"].Float();
 		tasks += GET_SURFACE(backgrounds[id], b["bg130"].String());
 		tasks += GET_SURFACE(backgroundsm[id], b["bg120"].String());
 	}
 
-	CThreadHelper th(&tasks,std::max((unsigned int)1,boost::thread::hardware_concurrency()));
+	CThreadHelper th(&tasks,std::max((ui32)1,boost::thread::hardware_concurrency()));
 	th.run();
 
 	for(size_t y=0; y < heroMoveArrows->ourImages.size(); ++y)
@@ -336,7 +332,7 @@ Graphics::Graphics()
 }
 void Graphics::loadHeroPortraits()
 {	
-	const JsonNode config(DATA_DIR "/config/portraits.json");
+	const JsonNode config(GameConstants::DATA_DIR + "/config/portraits.json");
 
 	BOOST_FOREACH(const JsonNode &portrait_node, config["hero_portrait"].Vector()) {
 		std::string filename = portrait_node["filename"].String();
@@ -362,7 +358,7 @@ void Graphics::loadHeroPortraits()
 
 void Graphics::loadWallPositions()
 {
-	const JsonNode config(DATA_DIR "/config/wall_pos.json");
+	const JsonNode config(GameConstants::DATA_DIR + "/config/wall_pos.json");
 
 	BOOST_FOREACH(const JsonNode &town, config["towns"].Vector()) {
 		int townID = town["id"].Float();
@@ -381,7 +377,7 @@ void Graphics::loadHeroAnims()
 	std::vector<std::pair<int,int> > rotations; //first - group number to be rotated1, second - group number after rotation1
 	rotations += std::make_pair(6,10), std::make_pair(7,11), std::make_pair(8,12), std::make_pair(1,13),
 		std::make_pair(2,14), std::make_pair(3,15);
-	for(size_t i=0; i<F_NUMBER * 2; ++i)
+	for(size_t i=0; i<GameConstants::F_NUMBER * 2; ++i)
 	{
 		std::ostringstream nm;
 		nm << "AH" << std::setw(2) << std::setfill('0') << i << "_.DEF";
@@ -488,7 +484,7 @@ void Graphics::loadHeroFlags(std::pair<std::vector<CDefEssential *> Graphics::*,
 void Graphics::loadHeroFlags()
 {
 	using namespace boost::assign;
-	timeHandler th;
+	StopWatch th;
 	std::pair<std::vector<CDefEssential *> Graphics::*, std::vector<const char *> > pr[4];
 	pr[0].first = &Graphics::flags1;
 	pr[0].second+=("ABF01L.DEF"),("ABF01G.DEF"),("ABF01R.DEF"),("ABF01D.DEF"),("ABF01B.DEF"),
@@ -508,7 +504,7 @@ void Graphics::loadHeroFlags()
 		grupa.create_thread(boost::bind(&Graphics::loadHeroFlags,this,boost::ref(pr[g]),true));
 	}
 	grupa.join_all();
-	tlog0 << "Loading and transforming heroes' flags: "<<th.getDif()<<std::endl;
+	tlog0 << "Loading and transforming heroes' flags: "<<th.getDiff()<<std::endl;
 }
 SDL_Surface * Graphics::getPic(int ID, bool fort, bool builded)
 {
@@ -517,8 +513,8 @@ SDL_Surface * Graphics::getPic(int ID, bool fort, bool builded)
 	else if (ID==-2)
 		return smallIcons->ourImages[1].bitmap;
 	else if (ID==-3)
-		return smallIcons->ourImages[2+F_NUMBER*4].bitmap;
-	else if (ID>F_NUMBER || ID<-3)
+		return smallIcons->ourImages[2+GameConstants::F_NUMBER*4].bitmap;
+	else if (ID>GameConstants::F_NUMBER || ID<-3)
 #ifndef __GNUC__
 		throw new std::exception("Invalid ID");
 #else
@@ -528,7 +524,7 @@ SDL_Surface * Graphics::getPic(int ID, bool fort, bool builded)
 	{
 		int pom = 3;
 		if(!fort)
-			pom+=F_NUMBER*2;
+			pom+=GameConstants::F_NUMBER*2;
 		pom += ID*2;
 		if (!builded)
 			pom--;
@@ -543,7 +539,7 @@ void Graphics::blueToPlayersAdv(SDL_Surface * sur, int player)
 	if(sur->format->BitsPerPixel == 8)
 	{
 		SDL_Color *palette = NULL;
-		if(player < PLAYER_LIMIT && player >= 0)
+		if(player < GameConstants::PLAYER_LIMIT && player >= 0)
 		{
 			palette = playerColorPalette + 32*player;
 		}
@@ -633,7 +629,8 @@ void Graphics::loadTrueType()
 	bool ttfPresent = false;//was TTF initialised or not
 	for(int i = 0; i < FONTS_NUMBER; i++)
 		fontsTrueType[i] = NULL;
-	std::ifstream ff(DATA_DIR "/config/fonts.txt");
+	std::string fontsFile = GameConstants::DATA_DIR + "/config/fonts.txt";
+	std::ifstream ff(fontsFile.c_str());
 	while(!ff.eof())
 	{
 		int enabl, fntID, fntSize;
@@ -653,7 +650,7 @@ void Graphics::loadTrueType()
 				TTF_Init();
 				atexit(TTF_Quit);
 			};
-			fntName = DATA_DIR + ( "/Fonts/" + fntName);
+			fntName = GameConstants::DATA_DIR + ( "/Fonts/" + fntName);
 			fontsTrueType[fntID] = TTF_OpenFont(fntName.c_str(),fntSize);
 		}
 	}
@@ -664,7 +661,7 @@ void Graphics::loadTrueType()
 Font * Graphics::loadFont( const char * name )
 {
 	int len = 0;
-	unsigned char * hlp = bitmaph->giveFile(name, FILE_FONT, &len);
+	ui8 * hlp = bitmaph->giveFile(name, FILE_FONT, &len);
 	if(!hlp || !len)
 	{
 		tlog1 << "Error: cannot load font: " << name << std::endl;
@@ -707,7 +704,7 @@ CDefEssential * Graphics::getDef( const CGDefInfo * info )
 void Graphics::loadErmuToPicture()
 {
 	//loading ERMU to picture
-	const JsonNode config(DATA_DIR "/config/ERMU_to_picture.json");
+	const JsonNode config(GameConstants::DATA_DIR + "/config/ERMU_to_picture.json");
 	int etp_idx = 0;
 	BOOST_FOREACH(const JsonNode &etp, config["ERMU_to_picture"].Vector()) {
 		int idx = 0;
@@ -722,7 +719,7 @@ void Graphics::loadErmuToPicture()
 	assert (etp_idx == 44);
 }
 
-Font::Font(unsigned char *Data)
+Font::Font(ui8 *Data)
 {
 	data = Data;
 	int i = 0;
@@ -758,7 +755,7 @@ int Font::getWidth(const char *text ) const
 
 	for(int i = 0; i < length; i++)
 	{
-		unsigned char c = text[i];
+		ui8 c = text[i];
 		ret += chars[c].width + chars[c].unknown1 + chars[c].unknown2;
 	}
 
@@ -767,7 +764,7 @@ int Font::getWidth(const char *text ) const
 
 int Font::getCharWidth( char c ) const
 {
-	const Char &C = chars[(unsigned char)c];
+	const Char &C = chars[(ui8)c];
 	return C.width + C.unknown1 + C.unknown2;;
 }
 

+ 5 - 7
client/Graphics.h

@@ -1,9 +1,9 @@
-#ifndef __GRAPHICS_H__
-#define __GRAPHICS_H__
+#pragma once
+
 
-#include "../global.h"
 #include "FontBase.h"
 #include "GUIBase.h"
+#include "../lib/GameConstants.h"
 
 /*
  * Graphics.h, part of VCMI engine
@@ -80,13 +80,13 @@ public:
 	std::vector< std::string > buildingPics;//filenames of def with building images (used rarely, too big to keep them loaded)
 	std::vector< std::string > townBgs;//backgrounds of town
 	std::vector< std::string > guildBgs;// name of bitmaps with imgs for mage guild screen
-	std::map<int, std::string> ERMUtoPicture[F_NUMBER]; //maps building ID to it's picture's name for each town type
+	std::map<int, std::string> ERMUtoPicture[GameConstants::F_NUMBER]; //maps building ID to it's picture's name for each town type
 	//for battles
 	std::vector< std::vector< std::string > > battleBacks; //battleBacks[terType] - vector of possible names for certain terrain type
 	std::vector< std::string > battleHeroes; //battleHeroes[hero type] - name of def that has hero animation for battle
 	std::map< int, std::vector < std::string > > battleACToDef; //maps AC format to vector of appropriate def names
 	CDefEssential * spellEffectsPics; //bitmaps representing spells affecting a stack in battle
-	std::vector< Point > wallPositions[F_NUMBER]; //positions of different pieces of wall <x, y>
+	std::vector< Point > wallPositions[GameConstants::F_NUMBER]; //positions of different pieces of wall <x, y>
 	//abilities
 	CDefEssential * abils32, * abils44, * abils82;
 	//spells
@@ -114,5 +114,3 @@ public:
 };
 
 extern Graphics * graphics;
-
-#endif // __GRAPHICS_H__

+ 43 - 7
client/Makefile.am

@@ -1,23 +1,59 @@
 bin_PROGRAMS = vcmiclient
+BUILT_SOURCES = StdInc.h.gch
+StdInc.h.gch: StdInc.h
+	$(CXXCOMPILE) -c $<
 
-vcmiclient_LDADD = $(top_builddir)/lib/libvcmi.la @SDL_LIBS@ @FFMPEG_LIBS@ @BOOST_PROGRAM_OPTIONS_LIB@ @BOOST_SYSTEM_LIB@ @BOOST_FILESYSTEM_LIB@ @BOOST_THREAD_LIB@ @BOOST_IOSTREAMS_LIB@ -lrt
+vcmiclient_LDADD = $(top_builddir)/lib/libvcmi.la @SDL_LIBS@ @FFMPEG_LIBS@ @BOOST_PROGRAM_OPTIONS_LIB@ @BOOST_SYSTEM_LIB@ @BOOST_FILESYSTEM_LIB@ @BOOST_THREAD_LIB@ @BOOST_IOSTREAMS_LIB@ -lrt -lz
 vcmiclient_CXXFLAGS = @SDL_CFLAGS@ @FFMPEG_CXXFLAGS@
 vcmiclient_LDFLAGS = -L$(top_builddir)/lib
 vcmiclient_SOURCES =  \
 	../CCallback.cpp \
 	../CCallback.h \
-	../CConsoleHandler.cpp \
-	../CConsoleHandler.h \
-	../CThreadHelper.cpp \
-	../CThreadHelper.h \
+	./BattleInterface/CAttackAnimation.cpp \
+	./BattleInterface/CAttackAnimation.h \
+	./BattleInterface/CBattleAnimation.cpp \
+	./BattleInterface/CBattleAnimation.h \
+	./BattleInterface/CBattleConsole.cpp \
+	./BattleInterface/CBattleConsole.h \
+	./BattleInterface/CBattleHero.cpp \
+	./BattleInterface/CBattleHero.h \
+	./BattleInterface/CBattleInterface.cpp \
+	./BattleInterface/CBattleInterface.h \
+	./BattleInterface/CBattleOptionsWindow.cpp \
+	./BattleInterface/CBattleOptionsWindow.h \
+	./BattleInterface/CBattleResultWindow.cpp \
+	./BattleInterface/CBattleResultWindow.h \
+	./BattleInterface/CBattleStackAnimation.cpp \
+	./BattleInterface/CBattleStackAnimation.h \
+	./BattleInterface/CDefenceAnimation.cpp \
+	./BattleInterface/CDefenceAnimation.h \
+	./BattleInterface/CDummyAnimation.cpp \
+	./BattleInterface/CDummyAnimation.h \
+	./BattleInterface/CHexFieldControl.cpp \
+	./BattleInterface/CHexFieldControl.h \
+	./BattleInterface/CMeleeAttackAnimation.cpp \
+	./BattleInterface/CMeleeAttackAnimation.h \
+	./BattleInterface/CMovementAnimation.cpp \
+	./BattleInterface/CMovementAnimation.h \
+	./BattleInterface/CMovementEndAnimation.cpp \
+	./BattleInterface/CMovementEndAnimation.h \
+	./BattleInterface/CMovementStartAnimation.cpp \
+	./BattleInterface/CMovementStartAnimation.h \
+	./BattleInterface/CReverseAnimation.cpp \
+	./BattleInterface/CReverseAnimation.h \
+	./BattleInterface/CShootingAnimation.cpp \
+	./BattleInterface/CShootingAnimation.h \
+	./BattleInterface/CSpellEffectAnimation.cpp \
+	./BattleInterface/CSpellEffectAnimation.h \
+	./BattleInterface/CStackQueue.cpp \
+	./BattleInterface/CStackQueue.h \
+	./BattleInterface/SStackAttackedInfo.h \
 	AdventureMapButton.cpp \
 	AdventureMapButton.h \
 	CAdvmapInterface.cpp \
 	CAdvmapInterface.h \
 	CAnimation.cpp \
 	CAnimation.h \
-	CBattleInterface.cpp \
-	CBattleInterface.h \
 	CBitmapHandler.cpp \
 	CBitmapHandler.h \
 	CCastleInterface.cpp \

+ 380 - 52
client/Makefile.in

@@ -59,12 +59,28 @@ CONFIG_CLEAN_VPATH_FILES =
 am__installdirs = "$(DESTDIR)$(bindir)"
 PROGRAMS = $(bin_PROGRAMS)
 am_vcmiclient_OBJECTS = vcmiclient-CCallback.$(OBJEXT) \
-	vcmiclient-CConsoleHandler.$(OBJEXT) \
-	vcmiclient-CThreadHelper.$(OBJEXT) \
+	vcmiclient-CAttackAnimation.$(OBJEXT) \
+	vcmiclient-CBattleAnimation.$(OBJEXT) \
+	vcmiclient-CBattleConsole.$(OBJEXT) \
+	vcmiclient-CBattleHero.$(OBJEXT) \
+	vcmiclient-CBattleInterface.$(OBJEXT) \
+	vcmiclient-CBattleOptionsWindow.$(OBJEXT) \
+	vcmiclient-CBattleResultWindow.$(OBJEXT) \
+	vcmiclient-CBattleStackAnimation.$(OBJEXT) \
+	vcmiclient-CDefenceAnimation.$(OBJEXT) \
+	vcmiclient-CDummyAnimation.$(OBJEXT) \
+	vcmiclient-CHexFieldControl.$(OBJEXT) \
+	vcmiclient-CMeleeAttackAnimation.$(OBJEXT) \
+	vcmiclient-CMovementAnimation.$(OBJEXT) \
+	vcmiclient-CMovementEndAnimation.$(OBJEXT) \
+	vcmiclient-CMovementStartAnimation.$(OBJEXT) \
+	vcmiclient-CReverseAnimation.$(OBJEXT) \
+	vcmiclient-CShootingAnimation.$(OBJEXT) \
+	vcmiclient-CSpellEffectAnimation.$(OBJEXT) \
+	vcmiclient-CStackQueue.$(OBJEXT) \
 	vcmiclient-AdventureMapButton.$(OBJEXT) \
 	vcmiclient-CAdvmapInterface.$(OBJEXT) \
 	vcmiclient-CAnimation.$(OBJEXT) \
-	vcmiclient-CBattleInterface.$(OBJEXT) \
 	vcmiclient-CBitmapHandler.$(OBJEXT) \
 	vcmiclient-CCastleInterface.$(OBJEXT) \
 	vcmiclient-CConfigHandler.$(OBJEXT) \
@@ -276,24 +292,58 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-vcmiclient_LDADD = $(top_builddir)/lib/libvcmi.la @SDL_LIBS@ @FFMPEG_LIBS@ @BOOST_PROGRAM_OPTIONS_LIB@ @BOOST_SYSTEM_LIB@ @BOOST_FILESYSTEM_LIB@ @BOOST_THREAD_LIB@ @BOOST_IOSTREAMS_LIB@ -lrt
+BUILT_SOURCES = StdInc.h.gch
+vcmiclient_LDADD = $(top_builddir)/lib/libvcmi.la @SDL_LIBS@ @FFMPEG_LIBS@ @BOOST_PROGRAM_OPTIONS_LIB@ @BOOST_SYSTEM_LIB@ @BOOST_FILESYSTEM_LIB@ @BOOST_THREAD_LIB@ @BOOST_IOSTREAMS_LIB@ -lrt -lz
 vcmiclient_CXXFLAGS = @SDL_CFLAGS@ @FFMPEG_CXXFLAGS@
 vcmiclient_LDFLAGS = -L$(top_builddir)/lib
 vcmiclient_SOURCES = \
 	../CCallback.cpp \
 	../CCallback.h \
-	../CConsoleHandler.cpp \
-	../CConsoleHandler.h \
-	../CThreadHelper.cpp \
-	../CThreadHelper.h \
+	./BattleInterface/CAttackAnimation.cpp \
+	./BattleInterface/CAttackAnimation.h \
+	./BattleInterface/CBattleAnimation.cpp \
+	./BattleInterface/CBattleAnimation.h \
+	./BattleInterface/CBattleConsole.cpp \
+	./BattleInterface/CBattleConsole.h \
+	./BattleInterface/CBattleHero.cpp \
+	./BattleInterface/CBattleHero.h \
+	./BattleInterface/CBattleInterface.cpp \
+	./BattleInterface/CBattleInterface.h \
+	./BattleInterface/CBattleOptionsWindow.cpp \
+	./BattleInterface/CBattleOptionsWindow.h \
+	./BattleInterface/CBattleResultWindow.cpp \
+	./BattleInterface/CBattleResultWindow.h \
+	./BattleInterface/CBattleStackAnimation.cpp \
+	./BattleInterface/CBattleStackAnimation.h \
+	./BattleInterface/CDefenceAnimation.cpp \
+	./BattleInterface/CDefenceAnimation.h \
+	./BattleInterface/CDummyAnimation.cpp \
+	./BattleInterface/CDummyAnimation.h \
+	./BattleInterface/CHexFieldControl.cpp \
+	./BattleInterface/CHexFieldControl.h \
+	./BattleInterface/CMeleeAttackAnimation.cpp \
+	./BattleInterface/CMeleeAttackAnimation.h \
+	./BattleInterface/CMovementAnimation.cpp \
+	./BattleInterface/CMovementAnimation.h \
+	./BattleInterface/CMovementEndAnimation.cpp \
+	./BattleInterface/CMovementEndAnimation.h \
+	./BattleInterface/CMovementStartAnimation.cpp \
+	./BattleInterface/CMovementStartAnimation.h \
+	./BattleInterface/CReverseAnimation.cpp \
+	./BattleInterface/CReverseAnimation.h \
+	./BattleInterface/CShootingAnimation.cpp \
+	./BattleInterface/CShootingAnimation.h \
+	./BattleInterface/CSpellEffectAnimation.cpp \
+	./BattleInterface/CSpellEffectAnimation.h \
+	./BattleInterface/CStackQueue.cpp \
+	./BattleInterface/CStackQueue.h \
+	./BattleInterface/SStackAttackedInfo.h \
 	AdventureMapButton.cpp \
 	AdventureMapButton.h \
 	CAdvmapInterface.cpp \
 	CAdvmapInterface.h \
 	CAnimation.cpp \
 	CAnimation.h \
-	CBattleInterface.cpp \
-	CBattleInterface.h \
 	CBitmapHandler.cpp \
 	CBitmapHandler.h \
 	CCastleInterface.cpp \
@@ -349,7 +399,8 @@ vcmiclient_SOURCES = \
 	SDL_framerate.cpp \
 	SDL_framerate.h
 
-all: all-am
+all: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) all-am
 
 .SUFFIXES:
 .SUFFIXES: .cpp .lo .o .obj
@@ -439,27 +490,43 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-AdventureMapButton.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CAdvmapInterface.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CAnimation.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CAttackAnimation.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CBattleAnimation.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CBattleConsole.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CBattleHero.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CBattleInterface.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CBattleOptionsWindow.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CBattleResultWindow.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CBattleStackAnimation.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CBitmapHandler.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CCallback.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CCastleInterface.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CConfigHandler.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CConsoleHandler.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CCreatureAnimation.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CCreatureWindow.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CCursorHandler.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CDefHandler.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CDefenceAnimation.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CDummyAnimation.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CGameInfo.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CHeroWindow.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CHexFieldControl.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CKingdomInterface.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CMT.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CMeleeAttackAnimation.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CMessage.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CMovementAnimation.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CMovementEndAnimation.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CMovementStartAnimation.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CMusicHandler.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CPlayerInterface.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CPreGame.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CReverseAnimation.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CShootingAnimation.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CSndHandler.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CSpellEffectAnimation.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CSpellWindow.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CThreadHelper.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CStackQueue.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CVideoHandler.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-Client.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-GUIBase.Po@am__quote@
@@ -510,37 +577,309 @@ vcmiclient-CCallback.obj: ../CCallback.cpp
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CCallback.obj `if test -f '../CCallback.cpp'; then $(CYGPATH_W) '../CCallback.cpp'; else $(CYGPATH_W) '$(srcdir)/../CCallback.cpp'; fi`
 
-vcmiclient-CConsoleHandler.o: ../CConsoleHandler.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CConsoleHandler.o -MD -MP -MF $(DEPDIR)/vcmiclient-CConsoleHandler.Tpo -c -o vcmiclient-CConsoleHandler.o `test -f '../CConsoleHandler.cpp' || echo '$(srcdir)/'`../CConsoleHandler.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CConsoleHandler.Tpo $(DEPDIR)/vcmiclient-CConsoleHandler.Po
+vcmiclient-CAttackAnimation.o: ./BattleInterface/CAttackAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CAttackAnimation.o -MD -MP -MF $(DEPDIR)/vcmiclient-CAttackAnimation.Tpo -c -o vcmiclient-CAttackAnimation.o `test -f './BattleInterface/CAttackAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CAttackAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CAttackAnimation.Tpo $(DEPDIR)/vcmiclient-CAttackAnimation.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CAttackAnimation.cpp' object='vcmiclient-CAttackAnimation.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CAttackAnimation.o `test -f './BattleInterface/CAttackAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CAttackAnimation.cpp
+
+vcmiclient-CAttackAnimation.obj: ./BattleInterface/CAttackAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CAttackAnimation.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CAttackAnimation.Tpo -c -o vcmiclient-CAttackAnimation.obj `if test -f './BattleInterface/CAttackAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CAttackAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CAttackAnimation.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CAttackAnimation.Tpo $(DEPDIR)/vcmiclient-CAttackAnimation.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CAttackAnimation.cpp' object='vcmiclient-CAttackAnimation.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CAttackAnimation.obj `if test -f './BattleInterface/CAttackAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CAttackAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CAttackAnimation.cpp'; fi`
+
+vcmiclient-CBattleAnimation.o: ./BattleInterface/CBattleAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CBattleAnimation.o -MD -MP -MF $(DEPDIR)/vcmiclient-CBattleAnimation.Tpo -c -o vcmiclient-CBattleAnimation.o `test -f './BattleInterface/CBattleAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CBattleAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CBattleAnimation.Tpo $(DEPDIR)/vcmiclient-CBattleAnimation.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CBattleAnimation.cpp' object='vcmiclient-CBattleAnimation.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CBattleAnimation.o `test -f './BattleInterface/CBattleAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CBattleAnimation.cpp
+
+vcmiclient-CBattleAnimation.obj: ./BattleInterface/CBattleAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CBattleAnimation.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CBattleAnimation.Tpo -c -o vcmiclient-CBattleAnimation.obj `if test -f './BattleInterface/CBattleAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CBattleAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CBattleAnimation.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CBattleAnimation.Tpo $(DEPDIR)/vcmiclient-CBattleAnimation.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CBattleAnimation.cpp' object='vcmiclient-CBattleAnimation.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CBattleAnimation.obj `if test -f './BattleInterface/CBattleAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CBattleAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CBattleAnimation.cpp'; fi`
+
+vcmiclient-CBattleConsole.o: ./BattleInterface/CBattleConsole.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CBattleConsole.o -MD -MP -MF $(DEPDIR)/vcmiclient-CBattleConsole.Tpo -c -o vcmiclient-CBattleConsole.o `test -f './BattleInterface/CBattleConsole.cpp' || echo '$(srcdir)/'`./BattleInterface/CBattleConsole.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CBattleConsole.Tpo $(DEPDIR)/vcmiclient-CBattleConsole.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CBattleConsole.cpp' object='vcmiclient-CBattleConsole.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CBattleConsole.o `test -f './BattleInterface/CBattleConsole.cpp' || echo '$(srcdir)/'`./BattleInterface/CBattleConsole.cpp
+
+vcmiclient-CBattleConsole.obj: ./BattleInterface/CBattleConsole.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CBattleConsole.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CBattleConsole.Tpo -c -o vcmiclient-CBattleConsole.obj `if test -f './BattleInterface/CBattleConsole.cpp'; then $(CYGPATH_W) './BattleInterface/CBattleConsole.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CBattleConsole.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CBattleConsole.Tpo $(DEPDIR)/vcmiclient-CBattleConsole.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CBattleConsole.cpp' object='vcmiclient-CBattleConsole.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CBattleConsole.obj `if test -f './BattleInterface/CBattleConsole.cpp'; then $(CYGPATH_W) './BattleInterface/CBattleConsole.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CBattleConsole.cpp'; fi`
+
+vcmiclient-CBattleHero.o: ./BattleInterface/CBattleHero.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CBattleHero.o -MD -MP -MF $(DEPDIR)/vcmiclient-CBattleHero.Tpo -c -o vcmiclient-CBattleHero.o `test -f './BattleInterface/CBattleHero.cpp' || echo '$(srcdir)/'`./BattleInterface/CBattleHero.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CBattleHero.Tpo $(DEPDIR)/vcmiclient-CBattleHero.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CBattleHero.cpp' object='vcmiclient-CBattleHero.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CBattleHero.o `test -f './BattleInterface/CBattleHero.cpp' || echo '$(srcdir)/'`./BattleInterface/CBattleHero.cpp
+
+vcmiclient-CBattleHero.obj: ./BattleInterface/CBattleHero.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CBattleHero.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CBattleHero.Tpo -c -o vcmiclient-CBattleHero.obj `if test -f './BattleInterface/CBattleHero.cpp'; then $(CYGPATH_W) './BattleInterface/CBattleHero.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CBattleHero.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CBattleHero.Tpo $(DEPDIR)/vcmiclient-CBattleHero.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CBattleHero.cpp' object='vcmiclient-CBattleHero.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CBattleHero.obj `if test -f './BattleInterface/CBattleHero.cpp'; then $(CYGPATH_W) './BattleInterface/CBattleHero.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CBattleHero.cpp'; fi`
+
+vcmiclient-CBattleInterface.o: ./BattleInterface/CBattleInterface.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CBattleInterface.o -MD -MP -MF $(DEPDIR)/vcmiclient-CBattleInterface.Tpo -c -o vcmiclient-CBattleInterface.o `test -f './BattleInterface/CBattleInterface.cpp' || echo '$(srcdir)/'`./BattleInterface/CBattleInterface.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CBattleInterface.Tpo $(DEPDIR)/vcmiclient-CBattleInterface.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CBattleInterface.cpp' object='vcmiclient-CBattleInterface.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CBattleInterface.o `test -f './BattleInterface/CBattleInterface.cpp' || echo '$(srcdir)/'`./BattleInterface/CBattleInterface.cpp
+
+vcmiclient-CBattleInterface.obj: ./BattleInterface/CBattleInterface.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CBattleInterface.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CBattleInterface.Tpo -c -o vcmiclient-CBattleInterface.obj `if test -f './BattleInterface/CBattleInterface.cpp'; then $(CYGPATH_W) './BattleInterface/CBattleInterface.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CBattleInterface.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CBattleInterface.Tpo $(DEPDIR)/vcmiclient-CBattleInterface.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CBattleInterface.cpp' object='vcmiclient-CBattleInterface.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CBattleInterface.obj `if test -f './BattleInterface/CBattleInterface.cpp'; then $(CYGPATH_W) './BattleInterface/CBattleInterface.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CBattleInterface.cpp'; fi`
+
+vcmiclient-CBattleOptionsWindow.o: ./BattleInterface/CBattleOptionsWindow.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CBattleOptionsWindow.o -MD -MP -MF $(DEPDIR)/vcmiclient-CBattleOptionsWindow.Tpo -c -o vcmiclient-CBattleOptionsWindow.o `test -f './BattleInterface/CBattleOptionsWindow.cpp' || echo '$(srcdir)/'`./BattleInterface/CBattleOptionsWindow.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CBattleOptionsWindow.Tpo $(DEPDIR)/vcmiclient-CBattleOptionsWindow.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CBattleOptionsWindow.cpp' object='vcmiclient-CBattleOptionsWindow.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CBattleOptionsWindow.o `test -f './BattleInterface/CBattleOptionsWindow.cpp' || echo '$(srcdir)/'`./BattleInterface/CBattleOptionsWindow.cpp
+
+vcmiclient-CBattleOptionsWindow.obj: ./BattleInterface/CBattleOptionsWindow.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CBattleOptionsWindow.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CBattleOptionsWindow.Tpo -c -o vcmiclient-CBattleOptionsWindow.obj `if test -f './BattleInterface/CBattleOptionsWindow.cpp'; then $(CYGPATH_W) './BattleInterface/CBattleOptionsWindow.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CBattleOptionsWindow.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CBattleOptionsWindow.Tpo $(DEPDIR)/vcmiclient-CBattleOptionsWindow.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CBattleOptionsWindow.cpp' object='vcmiclient-CBattleOptionsWindow.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CBattleOptionsWindow.obj `if test -f './BattleInterface/CBattleOptionsWindow.cpp'; then $(CYGPATH_W) './BattleInterface/CBattleOptionsWindow.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CBattleOptionsWindow.cpp'; fi`
+
+vcmiclient-CBattleResultWindow.o: ./BattleInterface/CBattleResultWindow.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CBattleResultWindow.o -MD -MP -MF $(DEPDIR)/vcmiclient-CBattleResultWindow.Tpo -c -o vcmiclient-CBattleResultWindow.o `test -f './BattleInterface/CBattleResultWindow.cpp' || echo '$(srcdir)/'`./BattleInterface/CBattleResultWindow.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CBattleResultWindow.Tpo $(DEPDIR)/vcmiclient-CBattleResultWindow.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CBattleResultWindow.cpp' object='vcmiclient-CBattleResultWindow.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CBattleResultWindow.o `test -f './BattleInterface/CBattleResultWindow.cpp' || echo '$(srcdir)/'`./BattleInterface/CBattleResultWindow.cpp
+
+vcmiclient-CBattleResultWindow.obj: ./BattleInterface/CBattleResultWindow.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CBattleResultWindow.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CBattleResultWindow.Tpo -c -o vcmiclient-CBattleResultWindow.obj `if test -f './BattleInterface/CBattleResultWindow.cpp'; then $(CYGPATH_W) './BattleInterface/CBattleResultWindow.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CBattleResultWindow.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CBattleResultWindow.Tpo $(DEPDIR)/vcmiclient-CBattleResultWindow.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CBattleResultWindow.cpp' object='vcmiclient-CBattleResultWindow.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CBattleResultWindow.obj `if test -f './BattleInterface/CBattleResultWindow.cpp'; then $(CYGPATH_W) './BattleInterface/CBattleResultWindow.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CBattleResultWindow.cpp'; fi`
+
+vcmiclient-CBattleStackAnimation.o: ./BattleInterface/CBattleStackAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CBattleStackAnimation.o -MD -MP -MF $(DEPDIR)/vcmiclient-CBattleStackAnimation.Tpo -c -o vcmiclient-CBattleStackAnimation.o `test -f './BattleInterface/CBattleStackAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CBattleStackAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CBattleStackAnimation.Tpo $(DEPDIR)/vcmiclient-CBattleStackAnimation.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CBattleStackAnimation.cpp' object='vcmiclient-CBattleStackAnimation.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CBattleStackAnimation.o `test -f './BattleInterface/CBattleStackAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CBattleStackAnimation.cpp
+
+vcmiclient-CBattleStackAnimation.obj: ./BattleInterface/CBattleStackAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CBattleStackAnimation.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CBattleStackAnimation.Tpo -c -o vcmiclient-CBattleStackAnimation.obj `if test -f './BattleInterface/CBattleStackAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CBattleStackAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CBattleStackAnimation.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CBattleStackAnimation.Tpo $(DEPDIR)/vcmiclient-CBattleStackAnimation.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CBattleStackAnimation.cpp' object='vcmiclient-CBattleStackAnimation.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CBattleStackAnimation.obj `if test -f './BattleInterface/CBattleStackAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CBattleStackAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CBattleStackAnimation.cpp'; fi`
+
+vcmiclient-CDefenceAnimation.o: ./BattleInterface/CDefenceAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CDefenceAnimation.o -MD -MP -MF $(DEPDIR)/vcmiclient-CDefenceAnimation.Tpo -c -o vcmiclient-CDefenceAnimation.o `test -f './BattleInterface/CDefenceAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CDefenceAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CDefenceAnimation.Tpo $(DEPDIR)/vcmiclient-CDefenceAnimation.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CDefenceAnimation.cpp' object='vcmiclient-CDefenceAnimation.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CDefenceAnimation.o `test -f './BattleInterface/CDefenceAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CDefenceAnimation.cpp
+
+vcmiclient-CDefenceAnimation.obj: ./BattleInterface/CDefenceAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CDefenceAnimation.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CDefenceAnimation.Tpo -c -o vcmiclient-CDefenceAnimation.obj `if test -f './BattleInterface/CDefenceAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CDefenceAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CDefenceAnimation.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CDefenceAnimation.Tpo $(DEPDIR)/vcmiclient-CDefenceAnimation.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CDefenceAnimation.cpp' object='vcmiclient-CDefenceAnimation.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CDefenceAnimation.obj `if test -f './BattleInterface/CDefenceAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CDefenceAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CDefenceAnimation.cpp'; fi`
+
+vcmiclient-CDummyAnimation.o: ./BattleInterface/CDummyAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CDummyAnimation.o -MD -MP -MF $(DEPDIR)/vcmiclient-CDummyAnimation.Tpo -c -o vcmiclient-CDummyAnimation.o `test -f './BattleInterface/CDummyAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CDummyAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CDummyAnimation.Tpo $(DEPDIR)/vcmiclient-CDummyAnimation.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CDummyAnimation.cpp' object='vcmiclient-CDummyAnimation.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CDummyAnimation.o `test -f './BattleInterface/CDummyAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CDummyAnimation.cpp
+
+vcmiclient-CDummyAnimation.obj: ./BattleInterface/CDummyAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CDummyAnimation.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CDummyAnimation.Tpo -c -o vcmiclient-CDummyAnimation.obj `if test -f './BattleInterface/CDummyAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CDummyAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CDummyAnimation.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CDummyAnimation.Tpo $(DEPDIR)/vcmiclient-CDummyAnimation.Po
 @am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='../CConsoleHandler.cpp' object='vcmiclient-CConsoleHandler.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CDummyAnimation.cpp' object='vcmiclient-CDummyAnimation.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CConsoleHandler.o `test -f '../CConsoleHandler.cpp' || echo '$(srcdir)/'`../CConsoleHandler.cpp
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CDummyAnimation.obj `if test -f './BattleInterface/CDummyAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CDummyAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CDummyAnimation.cpp'; fi`
 
-vcmiclient-CConsoleHandler.obj: ../CConsoleHandler.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CConsoleHandler.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CConsoleHandler.Tpo -c -o vcmiclient-CConsoleHandler.obj `if test -f '../CConsoleHandler.cpp'; then $(CYGPATH_W) '../CConsoleHandler.cpp'; else $(CYGPATH_W) '$(srcdir)/../CConsoleHandler.cpp'; fi`
-@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CConsoleHandler.Tpo $(DEPDIR)/vcmiclient-CConsoleHandler.Po
+vcmiclient-CHexFieldControl.o: ./BattleInterface/CHexFieldControl.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CHexFieldControl.o -MD -MP -MF $(DEPDIR)/vcmiclient-CHexFieldControl.Tpo -c -o vcmiclient-CHexFieldControl.o `test -f './BattleInterface/CHexFieldControl.cpp' || echo '$(srcdir)/'`./BattleInterface/CHexFieldControl.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CHexFieldControl.Tpo $(DEPDIR)/vcmiclient-CHexFieldControl.Po
 @am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='../CConsoleHandler.cpp' object='vcmiclient-CConsoleHandler.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CHexFieldControl.cpp' object='vcmiclient-CHexFieldControl.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CConsoleHandler.obj `if test -f '../CConsoleHandler.cpp'; then $(CYGPATH_W) '../CConsoleHandler.cpp'; else $(CYGPATH_W) '$(srcdir)/../CConsoleHandler.cpp'; fi`
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CHexFieldControl.o `test -f './BattleInterface/CHexFieldControl.cpp' || echo '$(srcdir)/'`./BattleInterface/CHexFieldControl.cpp
 
-vcmiclient-CThreadHelper.o: ../CThreadHelper.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CThreadHelper.o -MD -MP -MF $(DEPDIR)/vcmiclient-CThreadHelper.Tpo -c -o vcmiclient-CThreadHelper.o `test -f '../CThreadHelper.cpp' || echo '$(srcdir)/'`../CThreadHelper.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CThreadHelper.Tpo $(DEPDIR)/vcmiclient-CThreadHelper.Po
+vcmiclient-CHexFieldControl.obj: ./BattleInterface/CHexFieldControl.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CHexFieldControl.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CHexFieldControl.Tpo -c -o vcmiclient-CHexFieldControl.obj `if test -f './BattleInterface/CHexFieldControl.cpp'; then $(CYGPATH_W) './BattleInterface/CHexFieldControl.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CHexFieldControl.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CHexFieldControl.Tpo $(DEPDIR)/vcmiclient-CHexFieldControl.Po
 @am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='../CThreadHelper.cpp' object='vcmiclient-CThreadHelper.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CHexFieldControl.cpp' object='vcmiclient-CHexFieldControl.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CThreadHelper.o `test -f '../CThreadHelper.cpp' || echo '$(srcdir)/'`../CThreadHelper.cpp
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CHexFieldControl.obj `if test -f './BattleInterface/CHexFieldControl.cpp'; then $(CYGPATH_W) './BattleInterface/CHexFieldControl.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CHexFieldControl.cpp'; fi`
 
-vcmiclient-CThreadHelper.obj: ../CThreadHelper.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CThreadHelper.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CThreadHelper.Tpo -c -o vcmiclient-CThreadHelper.obj `if test -f '../CThreadHelper.cpp'; then $(CYGPATH_W) '../CThreadHelper.cpp'; else $(CYGPATH_W) '$(srcdir)/../CThreadHelper.cpp'; fi`
-@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CThreadHelper.Tpo $(DEPDIR)/vcmiclient-CThreadHelper.Po
+vcmiclient-CMeleeAttackAnimation.o: ./BattleInterface/CMeleeAttackAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CMeleeAttackAnimation.o -MD -MP -MF $(DEPDIR)/vcmiclient-CMeleeAttackAnimation.Tpo -c -o vcmiclient-CMeleeAttackAnimation.o `test -f './BattleInterface/CMeleeAttackAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CMeleeAttackAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CMeleeAttackAnimation.Tpo $(DEPDIR)/vcmiclient-CMeleeAttackAnimation.Po
 @am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='../CThreadHelper.cpp' object='vcmiclient-CThreadHelper.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CMeleeAttackAnimation.cpp' object='vcmiclient-CMeleeAttackAnimation.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CThreadHelper.obj `if test -f '../CThreadHelper.cpp'; then $(CYGPATH_W) '../CThreadHelper.cpp'; else $(CYGPATH_W) '$(srcdir)/../CThreadHelper.cpp'; fi`
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CMeleeAttackAnimation.o `test -f './BattleInterface/CMeleeAttackAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CMeleeAttackAnimation.cpp
+
+vcmiclient-CMeleeAttackAnimation.obj: ./BattleInterface/CMeleeAttackAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CMeleeAttackAnimation.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CMeleeAttackAnimation.Tpo -c -o vcmiclient-CMeleeAttackAnimation.obj `if test -f './BattleInterface/CMeleeAttackAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CMeleeAttackAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CMeleeAttackAnimation.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CMeleeAttackAnimation.Tpo $(DEPDIR)/vcmiclient-CMeleeAttackAnimation.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CMeleeAttackAnimation.cpp' object='vcmiclient-CMeleeAttackAnimation.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CMeleeAttackAnimation.obj `if test -f './BattleInterface/CMeleeAttackAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CMeleeAttackAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CMeleeAttackAnimation.cpp'; fi`
+
+vcmiclient-CMovementAnimation.o: ./BattleInterface/CMovementAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CMovementAnimation.o -MD -MP -MF $(DEPDIR)/vcmiclient-CMovementAnimation.Tpo -c -o vcmiclient-CMovementAnimation.o `test -f './BattleInterface/CMovementAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CMovementAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CMovementAnimation.Tpo $(DEPDIR)/vcmiclient-CMovementAnimation.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CMovementAnimation.cpp' object='vcmiclient-CMovementAnimation.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CMovementAnimation.o `test -f './BattleInterface/CMovementAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CMovementAnimation.cpp
+
+vcmiclient-CMovementAnimation.obj: ./BattleInterface/CMovementAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CMovementAnimation.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CMovementAnimation.Tpo -c -o vcmiclient-CMovementAnimation.obj `if test -f './BattleInterface/CMovementAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CMovementAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CMovementAnimation.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CMovementAnimation.Tpo $(DEPDIR)/vcmiclient-CMovementAnimation.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CMovementAnimation.cpp' object='vcmiclient-CMovementAnimation.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CMovementAnimation.obj `if test -f './BattleInterface/CMovementAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CMovementAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CMovementAnimation.cpp'; fi`
+
+vcmiclient-CMovementEndAnimation.o: ./BattleInterface/CMovementEndAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CMovementEndAnimation.o -MD -MP -MF $(DEPDIR)/vcmiclient-CMovementEndAnimation.Tpo -c -o vcmiclient-CMovementEndAnimation.o `test -f './BattleInterface/CMovementEndAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CMovementEndAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CMovementEndAnimation.Tpo $(DEPDIR)/vcmiclient-CMovementEndAnimation.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CMovementEndAnimation.cpp' object='vcmiclient-CMovementEndAnimation.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CMovementEndAnimation.o `test -f './BattleInterface/CMovementEndAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CMovementEndAnimation.cpp
+
+vcmiclient-CMovementEndAnimation.obj: ./BattleInterface/CMovementEndAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CMovementEndAnimation.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CMovementEndAnimation.Tpo -c -o vcmiclient-CMovementEndAnimation.obj `if test -f './BattleInterface/CMovementEndAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CMovementEndAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CMovementEndAnimation.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CMovementEndAnimation.Tpo $(DEPDIR)/vcmiclient-CMovementEndAnimation.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CMovementEndAnimation.cpp' object='vcmiclient-CMovementEndAnimation.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CMovementEndAnimation.obj `if test -f './BattleInterface/CMovementEndAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CMovementEndAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CMovementEndAnimation.cpp'; fi`
+
+vcmiclient-CMovementStartAnimation.o: ./BattleInterface/CMovementStartAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CMovementStartAnimation.o -MD -MP -MF $(DEPDIR)/vcmiclient-CMovementStartAnimation.Tpo -c -o vcmiclient-CMovementStartAnimation.o `test -f './BattleInterface/CMovementStartAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CMovementStartAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CMovementStartAnimation.Tpo $(DEPDIR)/vcmiclient-CMovementStartAnimation.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CMovementStartAnimation.cpp' object='vcmiclient-CMovementStartAnimation.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CMovementStartAnimation.o `test -f './BattleInterface/CMovementStartAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CMovementStartAnimation.cpp
+
+vcmiclient-CMovementStartAnimation.obj: ./BattleInterface/CMovementStartAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CMovementStartAnimation.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CMovementStartAnimation.Tpo -c -o vcmiclient-CMovementStartAnimation.obj `if test -f './BattleInterface/CMovementStartAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CMovementStartAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CMovementStartAnimation.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CMovementStartAnimation.Tpo $(DEPDIR)/vcmiclient-CMovementStartAnimation.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CMovementStartAnimation.cpp' object='vcmiclient-CMovementStartAnimation.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CMovementStartAnimation.obj `if test -f './BattleInterface/CMovementStartAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CMovementStartAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CMovementStartAnimation.cpp'; fi`
+
+vcmiclient-CReverseAnimation.o: ./BattleInterface/CReverseAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CReverseAnimation.o -MD -MP -MF $(DEPDIR)/vcmiclient-CReverseAnimation.Tpo -c -o vcmiclient-CReverseAnimation.o `test -f './BattleInterface/CReverseAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CReverseAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CReverseAnimation.Tpo $(DEPDIR)/vcmiclient-CReverseAnimation.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CReverseAnimation.cpp' object='vcmiclient-CReverseAnimation.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CReverseAnimation.o `test -f './BattleInterface/CReverseAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CReverseAnimation.cpp
+
+vcmiclient-CReverseAnimation.obj: ./BattleInterface/CReverseAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CReverseAnimation.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CReverseAnimation.Tpo -c -o vcmiclient-CReverseAnimation.obj `if test -f './BattleInterface/CReverseAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CReverseAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CReverseAnimation.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CReverseAnimation.Tpo $(DEPDIR)/vcmiclient-CReverseAnimation.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CReverseAnimation.cpp' object='vcmiclient-CReverseAnimation.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CReverseAnimation.obj `if test -f './BattleInterface/CReverseAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CReverseAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CReverseAnimation.cpp'; fi`
+
+vcmiclient-CShootingAnimation.o: ./BattleInterface/CShootingAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CShootingAnimation.o -MD -MP -MF $(DEPDIR)/vcmiclient-CShootingAnimation.Tpo -c -o vcmiclient-CShootingAnimation.o `test -f './BattleInterface/CShootingAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CShootingAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CShootingAnimation.Tpo $(DEPDIR)/vcmiclient-CShootingAnimation.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CShootingAnimation.cpp' object='vcmiclient-CShootingAnimation.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CShootingAnimation.o `test -f './BattleInterface/CShootingAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CShootingAnimation.cpp
+
+vcmiclient-CShootingAnimation.obj: ./BattleInterface/CShootingAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CShootingAnimation.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CShootingAnimation.Tpo -c -o vcmiclient-CShootingAnimation.obj `if test -f './BattleInterface/CShootingAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CShootingAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CShootingAnimation.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CShootingAnimation.Tpo $(DEPDIR)/vcmiclient-CShootingAnimation.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CShootingAnimation.cpp' object='vcmiclient-CShootingAnimation.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CShootingAnimation.obj `if test -f './BattleInterface/CShootingAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CShootingAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CShootingAnimation.cpp'; fi`
+
+vcmiclient-CSpellEffectAnimation.o: ./BattleInterface/CSpellEffectAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CSpellEffectAnimation.o -MD -MP -MF $(DEPDIR)/vcmiclient-CSpellEffectAnimation.Tpo -c -o vcmiclient-CSpellEffectAnimation.o `test -f './BattleInterface/CSpellEffectAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CSpellEffectAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CSpellEffectAnimation.Tpo $(DEPDIR)/vcmiclient-CSpellEffectAnimation.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CSpellEffectAnimation.cpp' object='vcmiclient-CSpellEffectAnimation.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CSpellEffectAnimation.o `test -f './BattleInterface/CSpellEffectAnimation.cpp' || echo '$(srcdir)/'`./BattleInterface/CSpellEffectAnimation.cpp
+
+vcmiclient-CSpellEffectAnimation.obj: ./BattleInterface/CSpellEffectAnimation.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CSpellEffectAnimation.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CSpellEffectAnimation.Tpo -c -o vcmiclient-CSpellEffectAnimation.obj `if test -f './BattleInterface/CSpellEffectAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CSpellEffectAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CSpellEffectAnimation.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CSpellEffectAnimation.Tpo $(DEPDIR)/vcmiclient-CSpellEffectAnimation.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CSpellEffectAnimation.cpp' object='vcmiclient-CSpellEffectAnimation.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CSpellEffectAnimation.obj `if test -f './BattleInterface/CSpellEffectAnimation.cpp'; then $(CYGPATH_W) './BattleInterface/CSpellEffectAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CSpellEffectAnimation.cpp'; fi`
+
+vcmiclient-CStackQueue.o: ./BattleInterface/CStackQueue.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CStackQueue.o -MD -MP -MF $(DEPDIR)/vcmiclient-CStackQueue.Tpo -c -o vcmiclient-CStackQueue.o `test -f './BattleInterface/CStackQueue.cpp' || echo '$(srcdir)/'`./BattleInterface/CStackQueue.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CStackQueue.Tpo $(DEPDIR)/vcmiclient-CStackQueue.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CStackQueue.cpp' object='vcmiclient-CStackQueue.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CStackQueue.o `test -f './BattleInterface/CStackQueue.cpp' || echo '$(srcdir)/'`./BattleInterface/CStackQueue.cpp
+
+vcmiclient-CStackQueue.obj: ./BattleInterface/CStackQueue.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CStackQueue.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CStackQueue.Tpo -c -o vcmiclient-CStackQueue.obj `if test -f './BattleInterface/CStackQueue.cpp'; then $(CYGPATH_W) './BattleInterface/CStackQueue.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CStackQueue.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CStackQueue.Tpo $(DEPDIR)/vcmiclient-CStackQueue.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='./BattleInterface/CStackQueue.cpp' object='vcmiclient-CStackQueue.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CStackQueue.obj `if test -f './BattleInterface/CStackQueue.cpp'; then $(CYGPATH_W) './BattleInterface/CStackQueue.cpp'; else $(CYGPATH_W) '$(srcdir)/./BattleInterface/CStackQueue.cpp'; fi`
 
 vcmiclient-AdventureMapButton.o: AdventureMapButton.cpp
 @am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-AdventureMapButton.o -MD -MP -MF $(DEPDIR)/vcmiclient-AdventureMapButton.Tpo -c -o vcmiclient-AdventureMapButton.o `test -f 'AdventureMapButton.cpp' || echo '$(srcdir)/'`AdventureMapButton.cpp
@@ -590,22 +929,6 @@ vcmiclient-CAnimation.obj: CAnimation.cpp
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CAnimation.obj `if test -f 'CAnimation.cpp'; then $(CYGPATH_W) 'CAnimation.cpp'; else $(CYGPATH_W) '$(srcdir)/CAnimation.cpp'; fi`
 
-vcmiclient-CBattleInterface.o: CBattleInterface.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CBattleInterface.o -MD -MP -MF $(DEPDIR)/vcmiclient-CBattleInterface.Tpo -c -o vcmiclient-CBattleInterface.o `test -f 'CBattleInterface.cpp' || echo '$(srcdir)/'`CBattleInterface.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CBattleInterface.Tpo $(DEPDIR)/vcmiclient-CBattleInterface.Po
-@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='CBattleInterface.cpp' object='vcmiclient-CBattleInterface.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CBattleInterface.o `test -f 'CBattleInterface.cpp' || echo '$(srcdir)/'`CBattleInterface.cpp
-
-vcmiclient-CBattleInterface.obj: CBattleInterface.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CBattleInterface.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CBattleInterface.Tpo -c -o vcmiclient-CBattleInterface.obj `if test -f 'CBattleInterface.cpp'; then $(CYGPATH_W) 'CBattleInterface.cpp'; else $(CYGPATH_W) '$(srcdir)/CBattleInterface.cpp'; fi`
-@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CBattleInterface.Tpo $(DEPDIR)/vcmiclient-CBattleInterface.Po
-@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='CBattleInterface.cpp' object='vcmiclient-CBattleInterface.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CBattleInterface.obj `if test -f 'CBattleInterface.cpp'; then $(CYGPATH_W) 'CBattleInterface.cpp'; else $(CYGPATH_W) '$(srcdir)/CBattleInterface.cpp'; fi`
-
 vcmiclient-CBitmapHandler.o: CBitmapHandler.cpp
 @am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CBitmapHandler.o -MD -MP -MF $(DEPDIR)/vcmiclient-CBitmapHandler.Tpo -c -o vcmiclient-CBitmapHandler.o `test -f 'CBitmapHandler.cpp' || echo '$(srcdir)/'`CBitmapHandler.cpp
 @am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/vcmiclient-CBitmapHandler.Tpo $(DEPDIR)/vcmiclient-CBitmapHandler.Po
@@ -1111,13 +1434,15 @@ distdir: $(DISTFILES)
 	  fi; \
 	done
 check-am: all-am
-check: check-am
+check: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) check-am
 all-am: Makefile $(PROGRAMS)
 installdirs:
 	for dir in "$(DESTDIR)$(bindir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
-install: install-am
+install: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) install-am
 install-exec: install-exec-am
 install-data: install-data-am
 uninstall: uninstall-am
@@ -1142,6 +1467,7 @@ distclean-generic:
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
+	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
 clean: clean-am
 
 clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
@@ -1212,7 +1538,7 @@ ps-am:
 
 uninstall-am: uninstall-binPROGRAMS
 
-.MAKE: install-am install-strip
+.MAKE: all check install install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
 	clean-generic clean-libtool ctags distclean distclean-compile \
@@ -1228,6 +1554,8 @@ uninstall-am: uninstall-binPROGRAMS
 	pdf pdf-am ps ps-am tags uninstall uninstall-am \
 	uninstall-binPROGRAMS
 
+StdInc.h.gch: StdInc.h
+	$(CXXCOMPILE) -c $<
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.

+ 6 - 7
client/NetPacksClient.cpp

@@ -1,4 +1,6 @@
+#include "StdInc.h"
 #include "../lib/NetPacks.h"
+
 #include "../CCallback.h"
 #include "Client.h"
 #include "CPlayerInterface.h"
@@ -15,16 +17,13 @@
 #include "CSoundBase.h"
 #include "mapHandler.h"
 #include "GUIClasses.h"
-#include <boost/bind.hpp>
-#include <boost/foreach.hpp>
-#include <boost/thread.hpp>
-#include <boost/thread/shared_mutex.hpp>
 #include "CConfigHandler.h"
 #include "SDL_Extensions.h"
-#include "CBattleInterface.h"
+#include "BattleInterface/CBattleInterface.h"
 #include "../lib/CCampaignHandler.h"
 #include "../lib/CGameState.h"
 #include "../lib/BattleState.h"
+#include "../lib/GameConstants.h"
 
 
 //macros to avoid code duplication - calls given method with given arguments if interface for specific player is present
@@ -337,7 +336,7 @@ void TryMoveHero::applyFirstCl( CClient *cl )
 	//check if playerint will have the knowledge about movement - if not, directly update maphandler
 	for(std::map<ui8, CGameInterface*>::iterator i=cl->playerint.begin();i!=cl->playerint.end();i++)
 	{
-		if(i->first >= PLAYER_LIMIT)
+		if(i->first >= GameConstants::PLAYER_LIMIT)
 			continue;
 		TeamState *t = GS(cl)->getPlayerTeam(i->first);
 		if((t->fogOfWarMap[start.x-1][start.y][start.z] || t->fogOfWarMap[end.x-1][end.y][end.z])
@@ -376,7 +375,7 @@ void TryMoveHero::applyCl( CClient *cl )
 	//notify interfaces about move
 	for(std::map<ui8, CGameInterface*>::iterator i=cl->playerint.begin();i!=cl->playerint.end();i++)
 	{
-		if(i->first >= PLAYER_LIMIT) continue;
+		if(i->first >= GameConstants::PLAYER_LIMIT) continue;
 		TeamState *t = GS(cl)->getPlayerTeam(i->first);
 		if(t->fogOfWarMap[start.x-1][start.y][start.z] || t->fogOfWarMap[end.x-1][end.y][end.z])
 		{

+ 10 - 14
client/SDL_Extensions.cpp

@@ -1,14 +1,10 @@
-#include "../stdafx.h"
+#include "StdInc.h"
 #include "SDL_Extensions.h"
+
 #include "SDL_ttf.h"
 #include "CGameInfo.h"
-#include <iostream>
-#include <utility>
-#include <algorithm>
 #include "CMessage.h"
-#include <boost/algorithm/string.hpp>
 #include "CDefHandler.h"
-#include <map>
 #include "Graphics.h"
 #include "GUIBase.h"
 
@@ -323,7 +319,7 @@ void CSDL_Ext::printAtMiddleWB( const std::string & text, int x, int y, EFonts f
 	}
 }
 
-void printAtMiddle(const std::string & text, int x, int y, TTF_Font * font, SDL_Color kolor, SDL_Surface * dst, unsigned char quality=2)
+void printAtMiddle(const std::string & text, int x, int y, TTF_Font * font, SDL_Color kolor, SDL_Surface * dst, ui8 quality=2)
 {
 	if(text.length()==0) return;
 	SDL_Surface * temp;
@@ -366,7 +362,7 @@ void CSDL_Ext::printAtMiddle( const std::string & text, int x, int y, EFonts fon
 	printAt(text, nx, ny, font, kolor, dst);
 }
 
-void printAt(const std::string & text, int x, int y, TTF_Font * font, SDL_Color kolor, SDL_Surface * dst, unsigned char quality=2, bool refresh=false)
+void printAt(const std::string & text, int x, int y, TTF_Font * font, SDL_Color kolor, SDL_Surface * dst, ui8 quality=2, bool refresh=false)
 {
 	if (text.length()==0)
 		return;
@@ -431,7 +427,7 @@ void CSDL_Ext::printAt( const std::string & text, int x, int y, EFonts font, SDL
 
 	for(int txti = first; txti < beyondEnd; txti++)
 	{
-		const unsigned char c = text[txti];
+		const ui8 c = text[txti];
 		x += f->chars[c].unknown1;
 
 		for(int i = std::max(0, -y); i < f->height  &&  (y + i) < (dst->h - 1); i++)
@@ -462,7 +458,7 @@ void CSDL_Ext::printAt( const std::string & text, int x, int y, EFonts font, SDL
 	}
 }
 
-void printTo(const std::string & text, int x, int y, TTF_Font * font, SDL_Color kolor, SDL_Surface * dst, unsigned char quality=2)
+void printTo(const std::string & text, int x, int y, TTF_Font * font, SDL_Color kolor, SDL_Surface * dst, ui8 quality=2)
 {
 	if (text.length()==0)
 		return;
@@ -504,7 +500,7 @@ void CSDL_Ext::printTo( const std::string & text, int x, int y, EFonts font, SDL
 	printAt(text, x - f->getWidth(text.c_str()), y - f->height, font, kolor, dst);
 }
 
-void printToWR(const std::string & text, int x, int y, TTF_Font * font, SDL_Color kolor, SDL_Surface * dst, unsigned char quality=2)
+void printToWR(const std::string & text, int x, int y, TTF_Font * font, SDL_Color kolor, SDL_Surface * dst, ui8 quality=2)
 {
 	if (text.length()==0)
 		return;
@@ -1049,7 +1045,7 @@ void CSDL_Ext::drawDashedBorder(SDL_Surface * sur, const Rect &r, const int3 &co
 	}
 }
 
-void CSDL_Ext::setPlayerColor(SDL_Surface * sur, unsigned char player)
+void CSDL_Ext::setPlayerColor(SDL_Surface * sur, ui8 player)
 {
 	if(player==254)
 		return;
@@ -1206,7 +1202,7 @@ void CSDL_Ext::applyEffect( SDL_Surface * surf, const SDL_Rect * rect, int mode
 			{
 				for(int yp = rect->y; yp < rect->y + rect->h; ++yp)
 				{
-					unsigned char * pixels = (unsigned char*)surf->pixels + yp * surf->pitch + xp * surf->format->BytesPerPixel;
+					ui8 * pixels = (ui8*)surf->pixels + yp * surf->pitch + xp * surf->format->BytesPerPixel;
 
 					int b = pixels[0]; 
 					int g = pixels[1]; 
@@ -1242,7 +1238,7 @@ void CSDL_Ext::applyEffect( SDL_Surface * surf, const SDL_Rect * rect, int mode
 			{
 				for(int yp = rect->y; yp < rect->y + rect->h; ++yp)
 				{
-					unsigned char * pixels = (unsigned char*)surf->pixels + yp * surf->pitch + xp * surf->format->BytesPerPixel;
+					ui8 * pixels = (ui8*)surf->pixels + yp * surf->pitch + xp * surf->format->BytesPerPixel;
 
 					int b = pixels[0]; 
 					int g = pixels[1]; 

+ 6 - 11
client/SDL_Extensions.h

@@ -1,11 +1,9 @@
-#ifndef __SDL_EXTENSIONS_H__
-#define __SDL_EXTENSIONS_H__
-#include "../global.h"
+#pragma once
+
+
+#include "../lib/int3.h"
 #include "SDL_video.h"
 #include "SDL_ttf.h"
-#include <string>
-#include <vector>
-#include <sstream>
 #include "FontBase.h"
 
 /*
@@ -61,7 +59,7 @@ std::string makeNumberShort(IntType number) //the output is a string containing
 			return ost.str();
 	}
 
-	//make the number short
+	//make the number int
 	char symbol[] = {'G', 'M', 'k'};
 
 	if(negative) number = (-number); //absolute value
@@ -173,13 +171,10 @@ namespace CSDL_Ext
 	void drawBorder(SDL_Surface * sur, int x, int y, int w, int h, const int3 &color);
 	void drawBorder(SDL_Surface * sur, const SDL_Rect &r, const int3 &color);
 	void drawDashedBorder(SDL_Surface * sur, const Rect &r, const int3 &color);
-	void setPlayerColor(SDL_Surface * sur, unsigned char player); //sets correct color of flags; -1 for neutral
+	void setPlayerColor(SDL_Surface * sur, ui8 player); //sets correct color of flags; -1 for neutral
 	std::string processStr(std::string str, std::vector<std::string> & tor); //replaces %s in string
 	SDL_Surface * newSurface(int w, int h, SDL_Surface * mod=screen); //creates new surface, with flags/format same as in surface given
 	SDL_Surface * copySurface(SDL_Surface * mod); //returns copy of given surface
 	void VflipSurf(SDL_Surface * surf); //fluipis given surface by vertical axis
 	void applyEffect(SDL_Surface * surf, const SDL_Rect * rect, int mode); //mode: 0 - sepia, 1 - grayscale
 };
-
-
-#endif // __SDL_EXTENSIONS_H__

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů