Преглед на файлове

* ConstTransitive CGI more or less done
* hch contents distributed to more appropriate folders

mateuszb преди 15 години
родител
ревизия
49083c4e5a
променени са 77 файла, в които са добавени 291 реда и са изтрити 286 реда
  1. 2 2
      AI/GeniusAI/BattleLogic.h
  2. 4 4
      AI/GeniusAI/CGeniusAI.cpp
  3. 9 9
      CCallback.cpp
  4. 2 2
      StartInfo.h
  5. 4 4
      client/AdventureMapButton.cpp
  6. 7 7
      client/CAdvmapInterface.cpp
  7. 1 1
      client/CAnimation.cpp
  8. 9 9
      client/CBattleInterface.cpp
  9. 2 2
      client/CBitmapHandler.cpp
  10. 16 16
      client/CCastleInterface.cpp
  11. 1 1
      client/CCastleInterface.h
  12. 1 1
      client/CCreatureAnimation.cpp
  13. 1 1
      client/CCreatureAnimation.h
  14. 1 1
      client/CCursorHandler.cpp
  15. 2 2
      client/CDefHandler.cpp
  16. 0 0
      client/CDefHandler.h
  17. 1 1
      client/CGameInfo.h
  18. 6 6
      client/CHeroWindow.cpp
  19. 9 9
      client/CKingdomInterface.cpp
  20. 1 1
      client/CKingdomInterface.h
  21. 12 12
      client/CMT.cpp
  22. 3 3
      client/CMessage.cpp
  23. 0 0
      client/CMusicBase.h
  24. 2 2
      client/CMusicHandler.cpp
  25. 1 1
      client/CMusicHandler.h
  26. 8 8
      client/CPlayerInterface.cpp
  27. 15 15
      client/CPreGame.cpp
  28. 0 0
      client/CSndHandler.cpp
  29. 0 0
      client/CSndHandler.h
  30. 0 0
      client/CSoundBase.h
  31. 5 5
      client/CSpellWindow.cpp
  32. 0 0
      client/CVideoHandler.cpp
  33. 0 0
      client/CVideoHandler.h
  34. 10 10
      client/Client.cpp
  35. 11 11
      client/GUIClasses.cpp
  36. 29 8
      client/Graphics.cpp
  37. 2 0
      client/Graphics.h
  38. 7 7
      client/NetPacksClient.cpp
  39. 1 1
      client/SDL_Extensions.cpp
  40. 7 7
      client/mapHandler.cpp
  41. 0 0
      lib/CArtHandler.cpp
  42. 0 0
      lib/CArtHandler.h
  43. 2 20
      lib/CBuildingHandler.cpp
  44. 5 4
      lib/CBuildingHandler.h
  45. 0 0
      lib/CCampaignHandler.cpp
  46. 0 0
      lib/CCampaignHandler.h
  47. 0 0
      lib/CCreatureHandler.cpp
  48. 0 1
      lib/CCreatureHandler.h
  49. 3 3
      lib/CCreatureSet.cpp
  50. 0 0
      lib/CDefObjInfoHandler.cpp
  51. 0 0
      lib/CDefObjInfoHandler.h
  52. 10 10
      lib/CGameState.cpp
  53. 3 3
      lib/CGameState.h
  54. 0 0
      lib/CGeneralTextHandler.cpp
  55. 0 0
      lib/CGeneralTextHandler.h
  56. 0 0
      lib/CHeroHandler.cpp
  57. 0 0
      lib/CHeroHandler.h
  58. 0 0
      lib/CLodHandler.cpp
  59. 0 0
      lib/CLodHandler.h
  60. 1 1
      lib/CMapInfo.cpp
  61. 9 9
      lib/CObjectHandler.cpp
  62. 0 0
      lib/CObjectHandler.h
  63. 0 1
      lib/CSpellHandler.cpp
  64. 0 0
      lib/CSpellHandler.h
  65. 0 0
      lib/CTownHandler.cpp
  66. 0 0
      lib/CTownHandler.h
  67. 7 7
      lib/Connection.cpp
  68. 3 3
      lib/HeroBonus.cpp
  69. 4 4
      lib/IGameCallback.cpp
  70. 7 7
      lib/NetPacksLib.cpp
  71. 3 3
      lib/RegisterTypes.cpp
  72. 10 10
      lib/VCMI_Lib.cpp
  73. 6 6
      lib/map.cpp
  74. 2 2
      lib/map.h
  75. 12 11
      server/CGameHandler.cpp
  76. 11 11
      server/CVCMIServer.cpp
  77. 1 1
      server/NetPacksServer.cpp

+ 2 - 2
AI/GeniusAI/BattleLogic.h

@@ -7,8 +7,8 @@
 #pragma warning (disable: 4100 4251 4245 4018 4081)
 #include "../../global.h"
 #include "../../CCallback.h"
-#include "../../hch/CCreatureHandler.h"
-#include "../../hch/CObjectHandler.h"
+#include "../../lib/CCreatureHandler.h"
+#include "../../lib/CObjectHandler.h"
 #pragma warning (default: 4100 4251 4245 4018 4081)
 
 #pragma warning (disable: 4100)

+ 4 - 4
AI/GeniusAI/CGeniusAI.cpp

@@ -3,8 +3,8 @@
 #include <iostream>
 #include <boost/lexical_cast.hpp>
 
-#include "../../hch/CBuildingHandler.h"
-#include "../../hch/CHeroHandler.h"
+#include "../../lib/CBuildingHandler.h"
+#include "../../lib/CHeroHandler.h"
 #include "../../lib/VCMI_Lib.h"
 #include "../../lib/NetPacks.h"
 #include "AIPriorities.h"
@@ -840,8 +840,8 @@ void CGeniusAI::addTownObjectives (HypotheticalGameState::TownModel& t, Hypothet
 	if (!t.hasBuilt)
 	{
     // m_cb->getCBuildingsByID(t.t);
-		std::map<int, CBuilding*> thisTownsBuildings = VLC->buildh->buildings[t.t->subID];
-		for (std::map<int, CBuilding*>::iterator i = thisTownsBuildings.begin(); i != thisTownsBuildings.end(); i++)
+		bmap<int, ConstTransitivePtr<CBuilding> > thisTownsBuildings = VLC->buildh->buildings[t.t->subID];
+		for (bmap<int, ConstTransitivePtr<CBuilding> >::iterator i = thisTownsBuildings.begin(); i != thisTownsBuildings.end(); i++)
 		{
 			if (m_cb->canBuildStructure(t.t, i->first) == 7)
 			{

+ 9 - 9
CCallback.cpp

@@ -1,24 +1,24 @@
 #include "stdafx.h"
 #include "CCallback.h"
-#include "hch/CCreatureHandler.h"
+#include "lib/CCreatureHandler.h"
 #include "client/CGameInfo.h"
 #include "lib/CGameState.h"
 #include "client/CPlayerInterface.h"
 #include "client/Client.h"
 #include "lib/map.h"
-#include "hch/CBuildingHandler.h"
-#include "hch/CDefObjInfoHandler.h"
-#include "hch/CGeneralTextHandler.h"
-#include "hch/CHeroHandler.h"
-#include "hch/CObjectHandler.h"
+#include "lib/CBuildingHandler.h"
+#include "lib/CDefObjInfoHandler.h"
+#include "lib/CGeneralTextHandler.h"
+#include "lib/CHeroHandler.h"
+#include "lib/CObjectHandler.h"
 #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 "hch/CSpellHandler.h"
-#include "hch/CArtHandler.h"
+#include "lib/CSpellHandler.h"
+#include "lib/CArtHandler.h"
 #ifdef min
 #undef min
 #endif
@@ -463,7 +463,7 @@ bool CCallback::buildBuilding(const CGTownInstance *town, si32 buildingID)
 
 	if(town->tempOwner!=player)
 		return false;
-	CBuilding *b = CGI->buildh->buildings[t->subID][buildingID];
+	const CBuilding *b = CGI->buildh->buildings[t->subID][buildingID];
 	for(int i=0;i<b->resources.size();i++)
 		if(b->resources[i] > gs->players[player].resources[i])
 			return false; //lack of resources

+ 2 - 2
StartInfo.h

@@ -56,7 +56,7 @@ struct StartInfo
 
 	ui8 mode; //uses EMode enum
 	ui8 difficulty; //0=easy; 4=impossible
-	std::map<int, PlayerSettings> playerInfos; //color indexed
+	bmap<int, PlayerSettings> playerInfos; //color indexed
 	ui8 turnTime; //in minutes, 0=unlimited
 	std::string mapname;
 	ui8 whichMapInCampaign; //used only for mode CAMPAIGN
@@ -71,7 +71,7 @@ struct StartInfo
 
 	PlayerSettings *getPlayersSettings(const ui8 nameID)
 	{
-		for(std::map<int, PlayerSettings>::iterator it=playerInfos.begin(); it != playerInfos.end(); ++it)
+		for(bmap<int, PlayerSettings>::iterator it=playerInfos.begin(); it != playerInfos.end(); ++it)
 			if(it->second.human == nameID)
 				return &it->second;
 

+ 4 - 4
client/AdventureMapButton.cpp

@@ -3,16 +3,16 @@
 #include "CAdvmapInterface.h"
 #include "SDL_Extensions.h"
 #include "CGameInfo.h"
-#include "../hch/CLodHandler.h"
-#include "../hch/CGeneralTextHandler.h"
-#include "../hch/CTownHandler.h"
+#include "../lib/CLodHandler.h"
+#include "../lib/CGeneralTextHandler.h"
+#include "../lib/CTownHandler.h"
 #include "../CCallback.h"
 #include "CConfigHandler.h"
 #include "Graphics.h"
 #include "CBattleInterface.h"
 #include "CPlayerInterface.h"
 #include "CMessage.h"
-#include "../hch/CMusicHandler.h"
+#include "CMusicHandler.h"
 
 /*
  * AdventureMapButton.cpp, part of VCMI engine

+ 7 - 7
client/CAdvmapInterface.cpp

@@ -12,11 +12,11 @@
 #include "CConfigHandler.h"
 #include "CSpellWindow.h"
 #include "Graphics.h"
-#include "../hch/CDefHandler.h"
-#include "../hch/CGeneralTextHandler.h"
-#include "../hch/CHeroHandler.h"
-#include "../hch/CObjectHandler.h"
-#include "../hch/CTownHandler.h"
+#include "CDefHandler.h"
+#include "../lib/CGeneralTextHandler.h"
+#include "../lib/CHeroHandler.h"
+#include "../lib/CObjectHandler.h"
+#include "../lib/CTownHandler.h"
 #include "../lib/map.h"
 #include "mapHandler.h"
 #include "../stdafx.h"
@@ -27,9 +27,9 @@
 #include <sstream>
 #include "CPreGame.h"
 #include "../lib/VCMI_Lib.h"
-#include "../hch/CSpellHandler.h"
+#include "../lib/CSpellHandler.h"
 #include <boost/foreach.hpp>
-#include "../hch/CSoundBase.h"
+#include "CSoundBase.h"
 
 #ifdef _MSC_VER
 #pragma warning (disable : 4355)

+ 1 - 1
client/CAnimation.cpp

@@ -9,7 +9,7 @@
 #include "CBitmapHandler.h"
 #include "CAnimation.h"
 #include "SDL_Extensions.h"
-#include "../hch/CLodHandler.h"
+#include "../lib/CLodHandler.h"
 
 /*
  * CAnimation.cpp, part of VCMI engine

+ 9 - 9
client/CBattleInterface.cpp

@@ -1,20 +1,20 @@
 #include "CBattleInterface.h"
 #include "CGameInfo.h"
-#include "../hch/CLodHandler.h"
+#include "../lib/CLodHandler.h"
 #include "SDL_Extensions.h"
 #include "CAdvmapInterface.h"
 #include "AdventureMapButton.h"
 #include "CAnimation.h"
-#include "../hch/CObjectHandler.h"
-#include "../hch/CHeroHandler.h"
-#include "../hch/CDefHandler.h"
-#include "../hch/CSpellHandler.h"
-#include "../hch/CMusicHandler.h"
+#include "../lib/CObjectHandler.h"
+#include "../lib/CHeroHandler.h"
+#include "CDefHandler.h"
+#include "../lib/CSpellHandler.h"
+#include "CMusicHandler.h"
 #include "CMessage.h"
 #include "CCursorHandler.h"
 #include "../CCallback.h"
 #include "../lib/CGameState.h"
-#include "../hch/CGeneralTextHandler.h"
+#include "../lib/CGeneralTextHandler.h"
 #include "CCreatureAnimation.h"
 #include "Graphics.h"
 #include "CSpellWindow.h"
@@ -24,8 +24,8 @@
 #include "../lib/CondSh.h"
 #include "../lib/NetPacks.h"
 #include "CPlayerInterface.h"
-#include "../hch/CVideoHandler.h"
-#include "../hch/CTownHandler.h"
+#include "CVideoHandler.h"
+#include "../lib/CTownHandler.h"
 #include <boost/assign/list_of.hpp>
 #include <boost/foreach.hpp>
 #include <boost/lexical_cast.hpp>

+ 2 - 2
client/CBitmapHandler.cpp

@@ -2,8 +2,8 @@
 #include "SDL.h"
 #include "SDL_image.h"
 #include "CBitmapHandler.h"
-#include "../hch/CDefHandler.h"
-#include "../hch/CLodHandler.h"
+#include "CDefHandler.h"
+#include "../lib/CLodHandler.h"
 #include <sstream>
 #include <boost/thread.hpp>
 

+ 16 - 16
client/CCastleInterface.cpp

@@ -10,17 +10,17 @@
 #include "SDL_Extensions.h"
 #include "CCreatureAnimation.h"
 #include "Graphics.h"
-#include "../hch/CArtHandler.h"
-#include "../hch/CBuildingHandler.h"
-#include "../hch/CDefHandler.h"
-#include "../hch/CGeneralTextHandler.h"
-#include "../hch/CLodHandler.h"
-#include "../hch/CObjectHandler.h"
-#include "../hch/CSpellHandler.h"
-#include "../hch/CTownHandler.h"
-#include "../hch/CCreatureHandler.h"
+#include "../lib/CArtHandler.h"
+#include "../lib/CBuildingHandler.h"
+#include "CDefHandler.h"
+#include "../lib/CGeneralTextHandler.h"
+#include "../lib/CLodHandler.h"
+#include "../lib/CObjectHandler.h"
+#include "../lib/CSpellHandler.h"
+#include "../lib/CTownHandler.h"
+#include "../lib/CCreatureHandler.h"
 #include "../lib/map.h"
-#include "../hch/CMusicHandler.h"
+#include "CMusicHandler.h"
 #include <boost/algorithm/string.hpp>
 #include <boost/algorithm/string/replace.hpp>
 #include <boost/assign/std/vector.hpp>
@@ -28,8 +28,8 @@
 #include <cmath>
 #include <sstream>
 #include <boost/format.hpp>
-#include "../hch/CCreatureHandler.h"
-#include "../hch/CMusicHandler.h"
+#include "../lib/CCreatureHandler.h"
+#include "CMusicHandler.h"
 using namespace boost::assign;
 using namespace CSDL_Ext;
 
@@ -159,7 +159,7 @@ void CBuildingRect::clickRight(tribool down, bool previousState)
 	{
 		int bid = hordeToDwellingID(str->ID);
 
-		CBuilding *bld = CGI->buildh->buildings[str->townID].find(bid)->second;
+		const CBuilding *bld = CGI->buildh->buildings[str->townID].find(bid)->second;
 		assert(bld);
 
 		CInfoPopup *vinya = new CInfoPopup();
@@ -1248,7 +1248,7 @@ void CCastleInterface::CTownInfo::clickRight(tribool down, bool previousState)
 		CInfoPopup *mess = new CInfoPopup();
 		mess->free = true;
 		CCastleInterface * ci=LOCPLINT->castleInt;
-		CBuilding *bld = CGI->buildh->buildings[ci->town->subID][bid];
+		const CBuilding *bld = CGI->buildh->buildings[ci->town->subID][bid];
 		mess->bitmap = CMessage::drawBoxTextBitmapSub
 			(LOCPLINT->playerID,bld->Description(),
 			LOCPLINT->castleInt->bicons->ourImages[bid].bitmap,
@@ -1443,7 +1443,7 @@ CHallInterface::CHallInterface(CCastleInterface * owner)
 	boxes.resize(5);
 	for(size_t i=0;i<5;i++) //for each row
 	{
-		std::vector< std::vector< std::vector<int> > > &boxList = CGI->buildh->hall[owner->town->subID].second;
+		const std::vector< std::vector< std::vector<int> > > &boxList = CGI->buildh->hall[owner->town->subID].second;
 
 		for(size_t j=0; j<boxList[i].size();j++) //for each box
 		{
@@ -1897,7 +1897,7 @@ CMageGuildScreen::CMageGuildScreen(CCastleInterface * owner)
 		{
 			if(i<owner->town->mageGuildLevel() && owner->town->spells[i].size()>j)
 			{
-				spells.push_back( new Scroll(&CGI->spellh->spells[owner->town->spells[i][j]]));
+				spells.push_back( new Scroll(CGI->spellh->spells[owner->town->spells[i][j]]));
 				spells[spells.size()-1]->pos = positions[i][j];
 				blitAt(graphics->spellscr->ourImages[owner->town->spells[i][j]].bitmap,positions[i][j],*bg);
 			}

+ 1 - 1
client/CCastleInterface.h

@@ -7,7 +7,7 @@
 #include <SDL.h>
 #include "CAnimation.h"
 #include "GUIBase.h"
-#include "../hch/CMusicBase.h"
+#include "CMusicBase.h"
 //#include "boost/tuple/tuple.hpp"
 class CGTownInstance;
 class CTownHandler;

+ 1 - 1
client/CCreatureAnimation.cpp

@@ -1,5 +1,5 @@
 #include "CCreatureAnimation.h"
-#include "../hch/CLodHandler.h"
+#include "../lib/CLodHandler.h"
 #include "../lib/VCMI_Lib.h"
 #include <assert.h>
 #include "SDL_Extensions.h"

+ 1 - 1
client/CCreatureAnimation.h

@@ -3,7 +3,7 @@
 
 
 #include "../global.h"
-#include "../hch/CDefHandler.h"
+#include "CDefHandler.h"
 #include "GUIBase.h"
 #include "../client/CBitmapHandler.h"
 

+ 1 - 1
client/CCursorHandler.cpp

@@ -3,7 +3,7 @@
 #include "SDL.h"
 #include "SDL_Extensions.h"
 #include "CGameInfo.h"
-#include "../hch/CDefHandler.h"
+#include "CDefHandler.h"
 
 /*
  * CCursorHandler.cpp, part of VCMI engine

+ 2 - 2
hch/CDefHandler.cpp → client/CDefHandler.cpp

@@ -2,9 +2,9 @@
 #include "SDL.h"
 #include "CDefHandler.h"
 #include <sstream>
-#include "CLodHandler.h"
+#include "../lib/CLodHandler.h"
 #include "../lib/VCMI_Lib.h"
-#include "../client/CBitmapHandler.h"
+#include "CBitmapHandler.h"
 
 /*
  * CDefHandler.cpp, part of VCMI engine

+ 0 - 0
hch/CDefHandler.h → client/CDefHandler.h


+ 1 - 1
client/CGameInfo.h

@@ -61,7 +61,7 @@ public:
 	ConstTransitivePtr<CDefObjInfoHandler> dobjinfo;
 	CGeneralTextHandler * generaltexth;
 	CMapHandler * mh;
-	CBuildingHandler * buildh;
+	ConstTransitivePtr<CBuildingHandler> buildh;
 	CTownHandler * townh;
 	//CTownHandler * townh;
 

+ 6 - 6
client/CHeroWindow.cpp

@@ -13,12 +13,12 @@
 #include "CSpellWindow.h"
 #include "CConfigHandler.h"
 #include "../global.h"
-#include "../hch/CArtHandler.h"
-#include "../hch/CDefHandler.h"
-#include "../hch/CGeneralTextHandler.h"
-#include "../hch/CHeroHandler.h"
-#include "../hch/CLodHandler.h"
-#include "../hch/CObjectHandler.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>

+ 9 - 9
client/CKingdomInterface.cpp

@@ -10,15 +10,15 @@
 #include "CMessage.h"
 #include "SDL_Extensions.h"
 #include "Graphics.h"
-#include "../hch/CArtHandler.h"
-#include "../hch/CBuildingHandler.h"
-#include "../hch/CDefHandler.h"
-#include "../hch/CHeroHandler.h"
-#include "../hch/CGeneralTextHandler.h"
-#include "../hch/CObjectHandler.h"
-#include "../hch/CTownHandler.h"
-#include "../hch/CCreatureHandler.h"
-#include "../hch/CHeroHandler.h"
+#include "../lib/CArtHandler.h"
+#include "../lib/CBuildingHandler.h"
+#include "CDefHandler.h"
+#include "../lib/CHeroHandler.h"
+#include "../lib/CGeneralTextHandler.h"
+#include "../lib/CObjectHandler.h"
+#include "../lib/CTownHandler.h"
+#include "../lib/CCreatureHandler.h"
+#include "../lib/CHeroHandler.h"
 #include "../lib/map.h"
 #include "../lib/NetPacks.h"
 #include <boost/algorithm/string/replace.hpp>

+ 1 - 1
client/CKingdomInterface.h

@@ -5,7 +5,7 @@
 #include "../global.h"
 #include "GUIBase.h"
 #include "GUIClasses.h"
-#include "../hch/CMusicBase.h"
+#include "CMusicBase.h"
 class AdventureMapButton;
 class CHighlightableButtonsGroup;
 class CResDataBar;

+ 12 - 12
client/CMT.cpp

@@ -23,16 +23,16 @@
 #include "../CCallback.h"
 #include "CPlayerInterface.h"
 #include "CAdvmapInterface.h"
-#include "../hch/CBuildingHandler.h"
-#include "../hch/CVideoHandler.h"
-#include "../hch/CHeroHandler.h"
-#include "../hch/CCreatureHandler.h"
-#include "../hch/CSpellHandler.h"
-#include "../hch/CMusicHandler.h"
-#include "../hch/CVideoHandler.h"
-#include "../hch/CLodHandler.h"
-#include "../hch/CDefHandler.h"
-#include "../hch/CGeneralTextHandler.h"
+#include "../lib/CBuildingHandler.h"
+#include "CVideoHandler.h"
+#include "../lib/CHeroHandler.h"
+#include "../lib/CCreatureHandler.h"
+#include "../lib/CSpellHandler.h"
+#include "CMusicHandler.h"
+#include "CVideoHandler.h"
+#include "../lib/CLodHandler.h"
+#include "CDefHandler.h"
+#include "../lib/CGeneralTextHandler.h"
 #include "Graphics.h"
 #include "Client.h"
 #include "CConfigHandler.h"
@@ -42,13 +42,13 @@
 #include <cstdlib>
 #include "../lib/NetPacks.h"
 #include "CMessage.h"
-#include "../hch/CObjectHandler.h"
+#include "../lib/CObjectHandler.h"
 
 #ifdef _WIN32
 #include "SDL_syswm.h"
 #endif
 #include <boost/foreach.hpp>
-#include "../hch/CDefObjInfoHandler.h"
+#include "../lib/CDefObjInfoHandler.h"
 
 #if __MINGW32__
 #undef main

+ 3 - 3
client/CMessage.cpp

@@ -1,15 +1,15 @@
 #include "../stdafx.h"
 #include "CMessage.h"
 #include "SDL_ttf.h"
-#include "../hch/CDefHandler.h"
+#include "CDefHandler.h"
 #include "CAnimation.h"
 #include "CGameInfo.h"
 #include "SDL_Extensions.h"
-#include "../hch/CLodHandler.h"
+#include "../lib/CLodHandler.h"
 #include <boost/algorithm/string.hpp>
 #include <boost/algorithm/string/replace.hpp>
 #include <sstream>
-#include "../hch/CGeneralTextHandler.h"
+#include "../lib/CGeneralTextHandler.h"
 #include "Graphics.h"
 #include "GUIClasses.h"
 #include "AdventureMapButton.h"

+ 0 - 0
hch/CMusicBase.h → client/CMusicBase.h


+ 2 - 2
hch/CMusicHandler.cpp → client/CMusicHandler.cpp

@@ -9,8 +9,8 @@
 
 #include "CSndHandler.h"
 #include "CMusicHandler.h"
-#include "CCreatureHandler.h"
-#include "CSpellHandler.h"
+#include "../lib/CCreatureHandler.h"
+#include "../lib/CSpellHandler.h"
 #include "../client/CGameInfo.h"
 
 /*

+ 1 - 1
hch/CMusicHandler.h → client/CMusicHandler.h

@@ -5,7 +5,7 @@
 
 #include "CSoundBase.h"
 #include "CMusicBase.h"
-#include "CCreatureHandler.h"
+#include "../lib/CCreatureHandler.h"
 
 
 /*

+ 8 - 8
client/CPlayerInterface.cpp

@@ -17,15 +17,15 @@
 #include "CConfigHandler.h"
 #include "CCreatureAnimation.h"
 #include "Graphics.h"
-#include "../hch/CArtHandler.h"
-#include "../hch/CGeneralTextHandler.h"
-#include "../hch/CHeroHandler.h"
-#include "../hch/CLodHandler.h"
-#include "../hch/CObjectHandler.h"
+#include "../lib/CArtHandler.h"
+#include "../lib/CGeneralTextHandler.h"
+#include "../lib/CHeroHandler.h"
+#include "../lib/CLodHandler.h"
+#include "../lib/CObjectHandler.h"
 #include "../lib/Connection.h"
-#include "../hch/CSpellHandler.h"
-#include "../hch/CTownHandler.h"
-#include "../hch/CMusicHandler.h"
+#include "../lib/CSpellHandler.h"
+#include "../lib/CTownHandler.h"
+#include "CMusicHandler.h"
 #include "../lib/CondSh.h"
 #include "../lib/NetPacks.h"
 #include "../lib/map.h"

+ 15 - 15
client/CPreGame.cpp

@@ -10,17 +10,17 @@
 #include "CGameInfo.h"
 #include "CCursorHandler.h"
 #include "CAnimation.h"
-#include "../hch/CDefHandler.h"
-#include "../hch/CDefObjInfoHandler.h"
-#include "../hch/CGeneralTextHandler.h"
-#include "../hch/CLodHandler.h"
-#include "../hch/CTownHandler.h"
-#include "../hch/CHeroHandler.h"
-#include "../hch/CObjectHandler.h"
-#include "../hch/CCampaignHandler.h"
-#include "../hch/CCreatureHandler.h"
-#include "../hch/CMusicHandler.h"
-#include "../hch/CVideoHandler.h"
+#include "CDefHandler.h"
+#include "../lib/CDefObjInfoHandler.h"
+#include "../lib/CGeneralTextHandler.h"
+#include "../lib/CLodHandler.h"
+#include "../lib/CTownHandler.h"
+#include "../lib/CHeroHandler.h"
+#include "../lib/CObjectHandler.h"
+#include "../lib/CCampaignHandler.h"
+#include "../lib/CCreatureHandler.h"
+#include "CMusicHandler.h"
+#include "CVideoHandler.h"
 #include <cmath>
 #include "Graphics.h"
 //#include <boost/thread.hpp>
@@ -36,9 +36,9 @@
 #include <boost/lexical_cast.hpp>
 #include <cstdlib>
 #include "CMessage.h"
-#include "../hch/CSpellHandler.h" /*for campaign bonuses*/
-#include "../hch/CArtHandler.h" /*for campaign bonuses*/
-#include "../hch/CBuildingHandler.h" /*for campaign bonuses*/
+#include "../lib/CSpellHandler.h" /*for campaign bonuses*/
+#include "../lib/CArtHandler.h" /*for campaign bonuses*/
+#include "../lib/CBuildingHandler.h" /*for campaign bonuses*/
 #include "CBitmapHandler.h"
 #include "Client.h"
 #include "../lib/NetPacks.h"
@@ -2881,7 +2881,7 @@ void CBonusSelection::updateBonusSelection()
 					}
 					assert(faction != -1);
 
-					std::string bldgBitmapName = CGI->buildh->ERMUtoPicture[faction][CBuildingHandler::campToERMU(bonDescs[i].info1, faction, std::set<si32>())];
+					std::string bldgBitmapName = graphics->ERMUtoPicture[faction][CBuildingHandler::campToERMU(bonDescs[i].info1, faction, std::set<si32>())];
 					surfToDuplicate = BitmapHandler::loadBitmap(bldgBitmapName);
 
 					freeDuplicatedSurface = true;

+ 0 - 0
hch/CSndHandler.cpp → client/CSndHandler.cpp


+ 0 - 0
hch/CSndHandler.h → client/CSndHandler.h


+ 0 - 0
hch/CSoundBase.h → client/CSoundBase.h


+ 5 - 5
client/CSpellWindow.cpp

@@ -1,10 +1,10 @@
 #include "CSpellWindow.h"
 #include "Graphics.h"
-#include "../hch/CDefHandler.h"
-#include "../hch/CObjectHandler.h"
-#include "../hch/CSpellHandler.h"
-#include "../hch/CGeneralTextHandler.h"
-#include "../hch/CVideoHandler.h"
+#include "CDefHandler.h"
+#include "../lib/CObjectHandler.h"
+#include "../lib/CSpellHandler.h"
+#include "../lib/CGeneralTextHandler.h"
+#include "CVideoHandler.h"
 #include "CAdvmapInterface.h"
 #include "CBattleInterface.h"
 #include "CGameInfo.h"

+ 0 - 0
hch/CVideoHandler.cpp → client/CVideoHandler.cpp


+ 0 - 0
hch/CVideoHandler.h → client/CVideoHandler.h


+ 10 - 10
client/Client.cpp

@@ -1,19 +1,19 @@
-#include "../hch/CMusicHandler.h"
-#include "../hch/CCampaignHandler.h"
+#include "CMusicHandler.h"
+#include "../lib/CCampaignHandler.h"
 #include "../CCallback.h"
 #include "../CConsoleHandler.h"
 #include "CGameInfo.h"
 #include "../lib/CGameState.h"
 #include "CPlayerInterface.h"
 #include "../StartInfo.h"
-#include "../hch/CArtHandler.h"
-#include "../hch/CDefObjInfoHandler.h"
-#include "../hch/CGeneralTextHandler.h"
-#include "../hch/CHeroHandler.h"
-#include "../hch/CTownHandler.h"
-#include "../hch/CObjectHandler.h"
-#include "../hch/CBuildingHandler.h"
-#include "../hch/CSpellHandler.h"
+#include "../lib/CArtHandler.h"
+#include "../lib/CDefObjInfoHandler.h"
+#include "../lib/CGeneralTextHandler.h"
+#include "../lib/CHeroHandler.h"
+#include "../lib/CTownHandler.h"
+#include "../lib/CObjectHandler.h"
+#include "../lib/CBuildingHandler.h"
+#include "../lib/CSpellHandler.h"
 #include "../lib/Connection.h"
 #include "../lib/Interprocess.h"
 #include "../lib/NetPacks.h"

+ 11 - 11
client/GUIClasses.cpp

@@ -16,14 +16,14 @@
 #include "CCreatureAnimation.h"
 #include "Graphics.h"
 #include "CAnimation.h"
-#include "../hch/CArtHandler.h"
-#include "../hch/CBuildingHandler.h"
-#include "../hch/CGeneralTextHandler.h"
-#include "../hch/CHeroHandler.h"
-#include "../hch/CLodHandler.h"
-#include "../hch/CObjectHandler.h"
-#include "../hch/CSpellHandler.h"
-#include "../hch/CTownHandler.h"
+#include "../lib/CArtHandler.h"
+#include "../lib/CBuildingHandler.h"
+#include "../lib/CGeneralTextHandler.h"
+#include "../lib/CHeroHandler.h"
+#include "../lib/CLodHandler.h"
+#include "../lib/CObjectHandler.h"
+#include "../lib/CSpellHandler.h"
+#include "../lib/CTownHandler.h"
 #include "../lib/CondSh.h"
 #include "../lib/map.h"
 #include "mapHandler.h"
@@ -43,12 +43,12 @@
 #include "../lib/NetPacks.h"
 #include "CSpellWindow.h"
 #include "CHeroWindow.h"
-#include "../hch/CVideoHandler.h"
+#include "CVideoHandler.h"
 #include "../StartInfo.h"
 #include "CPreGame.h"
 #include "../lib/HeroBonus.h"
-#include "../hch/CCreatureHandler.h"
-#include "../hch/CMusicHandler.h"
+#include "../lib/CCreatureHandler.h"
+#include "CMusicHandler.h"
 
 /*
  * GUIClasses.cpp, part of VCMI engine

+ 29 - 8
client/Graphics.cpp

@@ -1,6 +1,6 @@
 #include "../stdafx.h"
 #include "Graphics.h"
-#include "../hch/CDefHandler.h"
+#include "CDefHandler.h"
 #include "SDL_Extensions.h"
 #include <SDL_ttf.h>
 #include <boost/assign/std/vector.hpp> 
@@ -12,16 +12,16 @@
 #include <boost/assign/std/vector.hpp>
 #include "../CThreadHelper.h"
 #include "CGameInfo.h"
-#include "../hch/CLodHandler.h"
+#include "../lib/CLodHandler.h"
 #include "../lib/VCMI_Lib.h"
 #include "../CCallback.h"
-#include "../hch/CTownHandler.h"
-#include "../hch/CObjectHandler.h"
-#include "../hch/CGeneralTextHandler.h"
-#include "../hch/CCreatureHandler.h"
+#include "../lib/CTownHandler.h"
+#include "../lib/CObjectHandler.h"
+#include "../lib/CGeneralTextHandler.h"
+#include "../lib/CCreatureHandler.h"
 #include "CBitmapHandler.h"
-#include "../hch/CObjectHandler.h"
-#include "../hch/CDefObjInfoHandler.h"
+#include "../lib/CObjectHandler.h"
+#include "../lib/CDefObjInfoHandler.h"
 
 using namespace boost::assign;
 using namespace CSDL_Ext;
@@ -288,6 +288,7 @@ Graphics::Graphics()
 	tasks += boost::bind(&Graphics::loadHeroPortraits,this);
 	tasks += boost::bind(&Graphics::initializeBattleGraphics,this);
 	tasks += boost::bind(&Graphics::loadWallPositions,this);
+	tasks += boost::bind(&Graphics::loadErmuToPicture,this);
 	tasks += GET_SURFACE(hInfo,"HEROQVBK.bmp");
 	tasks += GET_SURFACE(tInfo,"TOWNQVBK.bmp");
 	tasks += GET_SURFACE(heroInGarrison,"TOWNQKGH.bmp");
@@ -732,6 +733,26 @@ CDefEssential * Graphics::getDef( const CGDefInfo * info )
 	return advmapobjGraphics[info->id][info->subid];
 }
 
+void Graphics::loadErmuToPicture()
+{
+	//loading ERMU to picture
+	std::ifstream etp(DATA_DIR "/config/ERMU_to_picture.txt");
+
+	assert(etp.is_open());
+
+	for(int g=0; g<44; ++g)
+	{
+		for (int b=0; b<ARRAY_COUNT(ERMUtoPicture); ++b)
+		{
+			std::string buf;
+			etp >> buf;
+			ERMUtoPicture[b][g] = buf;
+		}
+	}
+
+	etp.close();
+}
+
 Font::Font(unsigned char *Data)
 {
 	data = Data;

+ 2 - 0
client/Graphics.h

@@ -78,6 +78,7 @@ 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
 	//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
@@ -98,6 +99,7 @@ public:
 	void loadHeroAnim(const std::string &name, const std::vector<std::pair<int,int> > &rotations, std::vector<CDefEssential *> Graphics::*dst);
 	void loadHeroPortraits();
 	void loadWallPositions();
+	void loadErmuToPicture();
 	SDL_Surface * drawHeroInfoWin(const InfoAboutHero &curh);
 	SDL_Surface * drawHeroInfoWin(const CGHeroInstance * curh);
 	SDL_Surface * drawTownInfoWin(const InfoAboutTown & curh);

+ 7 - 7
client/NetPacksClient.cpp

@@ -4,15 +4,15 @@
 #include "CPlayerInterface.h"
 #include "CGameInfo.h"
 #include "../lib/Connection.h"
-#include "../hch/CGeneralTextHandler.h"
-#include "../hch/CDefObjInfoHandler.h"
-#include "../hch/CHeroHandler.h"
-#include "../hch/CObjectHandler.h"
+#include "../lib/CGeneralTextHandler.h"
+#include "../lib/CDefObjInfoHandler.h"
+#include "../lib/CHeroHandler.h"
+#include "../lib/CObjectHandler.h"
 #include "../lib/VCMI_Lib.h"
 #include "../lib/map.h"
 #include "../lib/VCMIDirs.h"
-#include "../hch/CSpellHandler.h"
-#include "../hch/CSoundBase.h"
+#include "../lib/CSpellHandler.h"
+#include "CSoundBase.h"
 #include "mapHandler.h"
 #include "GUIClasses.h"
 #include <boost/bind.hpp>
@@ -22,7 +22,7 @@
 #include "CConfigHandler.h"
 #include "SDL_Extensions.h"
 #include "CBattleInterface.h"
-#include "../hch/CCampaignHandler.h"
+#include "../lib/CCampaignHandler.h"
 
 //macro to avoid code duplication - calls given method with given arguments if interface for specific player is present
 #define INTERFACE_CALL_IF_PRESENT(player,function,...) 	\

+ 1 - 1
client/SDL_Extensions.cpp

@@ -7,7 +7,7 @@
 #include <algorithm>
 #include "CMessage.h"
 #include <boost/algorithm/string.hpp>
-#include "../hch/CDefHandler.h"
+#include "CDefHandler.h"
 #include <map>
 #include "Graphics.h"
 #include "GUIBase.h"

+ 7 - 7
client/mapHandler.cpp

@@ -3,21 +3,21 @@
 #include "SDL_Extensions.h"
 #include "CGameInfo.h"
 #include <cstdlib>
-#include "../hch/CLodHandler.h"
-#include "../hch/CDefObjInfoHandler.h"
+#include "../lib/CLodHandler.h"
+#include "../lib/CDefObjInfoHandler.h"
 #include <algorithm>
 #include "../lib/CGameState.h"
-#include "../hch/CHeroHandler.h"
-#include "../hch/CTownHandler.h"
+#include "../lib/CHeroHandler.h"
+#include "../lib/CTownHandler.h"
 #include "Graphics.h"
 #include <iomanip>
 #include <sstream>
-#include "../hch/CObjectHandler.h"
+#include "../lib/CObjectHandler.h"
 #include "../lib/map.h"
-#include "../hch/CDefHandler.h"
+#include "CDefHandler.h"
 #include "CConfigHandler.h"
 #include <boost/assign/list_of.hpp>
-#include "../hch/CGeneralTextHandler.h"
+#include "../lib/CGeneralTextHandler.h"
 
 /*
  * mapHandler.cpp, part of VCMI engine

+ 0 - 0
hch/CArtHandler.cpp → lib/CArtHandler.cpp


+ 0 - 0
hch/CArtHandler.h → lib/CArtHandler.h


+ 2 - 20
hch/CBuildingHandler.cpp → lib/CBuildingHandler.cpp

@@ -144,30 +144,12 @@ void CBuildingHandler::loadBuildings()
 		}
 	}
 
-	//loading ERMU to picture
-	std::ifstream etp(DATA_DIR "/config/ERMU_to_picture.txt");
-
-	assert(etp.is_open());
-
-	for(int g=0; g<44; ++g)
-	{
-		for (int b=0; b<ARRAY_COUNT(ERMUtoPicture); ++b)
-		{
-			std::string buf;
-			etp >> buf;
-			ERMUtoPicture[b][g] = buf;
-		}
-	}
-
-	etp.close();
-
-
 }
 
 CBuildingHandler::~CBuildingHandler()
 {
-	for(std::vector< std::map<int, CBuilding*> >::iterator i=buildings.begin(); i!=buildings.end(); i++)
-		for(std::map<int, CBuilding*>::iterator j=i->begin(); j!=i->end(); j++)
+	for(std::vector< bmap<int, ConstTransitivePtr<CBuilding> > >::iterator i=buildings.begin(); i!=buildings.end(); i++)
+		for(std::map<int, ConstTransitivePtr<CBuilding> >::iterator j=i->begin(); j!=i->end(); j++)
 			delete j->second;
 }
 

+ 5 - 4
hch/CBuildingHandler.h → lib/CBuildingHandler.h

@@ -5,6 +5,8 @@
 #include <vector>
 #include <set>
 
+#include "../lib/ConstTransitivePtr.h"
+
 /*
  * CBuildingHandler.h, part of VCMI engine
  *
@@ -37,9 +39,8 @@ public:
 class DLL_EXPORT CBuildingHandler
 {
 public:
-	std::vector< std::map<int, CBuilding*> > buildings; ///< vector by castle ID, second the building ID (in ERM-U format)
-	std::map<int, std::pair<std::string,std::vector< std::vector< std::vector<int> > > > > hall; //map<castle ID, pair<hall bg name, std::vector< std::vector<building id> >[5]> - external vector is the vector of buildings in the row, internal is the list of buildings for the specific slot
-	std::map<int, std::string> ERMUtoPicture[F_NUMBER]; //maps building ID to it's picture's name for each town type
+	std::vector< bmap<int, ConstTransitivePtr<CBuilding> > > buildings; ///< vector by castle ID, second the building ID (in ERM-U format)
+	bmap<int, std::pair<std::string,std::vector< std::vector< std::vector<int> > > > > hall; //map<castle ID, pair<hall bg name, std::vector< std::vector<building id> >[5]> - external vector is the vector of buildings in the row, internal is the list of buildings for the specific slot
 
 	void loadBuildings(); //main loader
 	~CBuildingHandler(); //d-tor
@@ -47,7 +48,7 @@ public:
 
 	template <typename Handler> void serialize(Handler &h, const int version)
 	{
-		h & buildings & hall & ERMUtoPicture;
+		h & buildings & hall;
 	}
 };
 

+ 0 - 0
hch/CCampaignHandler.cpp → lib/CCampaignHandler.cpp


+ 0 - 0
hch/CCampaignHandler.h → lib/CCampaignHandler.h


+ 0 - 0
hch/CCreatureHandler.cpp → lib/CCreatureHandler.cpp


+ 0 - 1
hch/CCreatureHandler.h → lib/CCreatureHandler.h

@@ -6,7 +6,6 @@
 #include <map>
 #include <set>
 
-#include "CSoundBase.h"
 #include "../lib/HeroBonus.h"
 #include "../lib/CGameState.h"
 #include "../lib/CCreatureSet.h"

+ 3 - 3
lib/CCreatureSet.cpp

@@ -1,12 +1,12 @@
 #define VCMI_DLL
 #include "CCreatureSet.h"
-#include "../hch/CCreatureHandler.h"
+#include "CCreatureHandler.h"
 #include "VCMI_Lib.h"
 #include <assert.h>
-#include "../hch/CObjectHandler.h"
+#include "CObjectHandler.h"
 #include "IGameCallback.h"
 #include "CGameState.h"
-#include "../hch/CGeneralTextHandler.h"
+#include "CGeneralTextHandler.h"
 #include <sstream>
 
 const CStackInstance &CCreatureSet::operator[](TSlot slot) const

+ 0 - 0
hch/CDefObjInfoHandler.cpp → lib/CDefObjInfoHandler.cpp


+ 0 - 0
hch/CDefObjInfoHandler.h → lib/CDefObjInfoHandler.h


+ 10 - 10
lib/CGameState.cpp

@@ -1,19 +1,19 @@
 #define VCMI_DLL
-#include "../hch/CCampaignHandler.h"
+#include "CCampaignHandler.h"
 #include <algorithm>
 #include <queue>
 #include <fstream>
 #include "CGameState.h"
 #include <boost/random/linear_congruential.hpp>
-#include "../hch/CDefObjInfoHandler.h"
-#include "../hch/CArtHandler.h"
-#include "../hch/CBuildingHandler.h"
-#include "../hch/CGeneralTextHandler.h"
-#include "../hch/CTownHandler.h"
-#include "../hch/CSpellHandler.h"
-#include "../hch/CHeroHandler.h"
-#include "../hch/CObjectHandler.h"
-#include "../hch/CCreatureHandler.h"
+#include "CDefObjInfoHandler.h"
+#include "CArtHandler.h"
+#include "CBuildingHandler.h"
+#include "CGeneralTextHandler.h"
+#include "CTownHandler.h"
+#include "CSpellHandler.h"
+#include "CHeroHandler.h"
+#include "CObjectHandler.h"
+#include "CCreatureHandler.h"
 //#include "../lib/IGameCallback.h"
 #include "VCMI_Lib.h"
 #include "Connection.h"

+ 3 - 3
lib/CGameState.h

@@ -4,7 +4,7 @@
 #include <cassert>
 
 #ifndef _MSC_VER
-#include "../hch/CCreatureHandler.h"
+#include "CCreatureHandler.h"
 #include "VCMI_Lib.h"
 #include "map.h"
 #endif
@@ -434,10 +434,10 @@ class DLL_EXPORT CGameState
 {
 public:
 	ConstTransitivePtr<StartInfo> scenarioOps, initialOpts; //second one is a copy of settings received from pregame (not randomized)
-	CCampaignState *campaign;
+	ConstTransitivePtr<CCampaignState> campaign;
 	ui32 seed;
 	ui8 currentPlayer; //ID of player currently having turn
-	BattleInfo *curB; //current battle
+	ConstTransitivePtr<BattleInfo> curB; //current battle
 	ui32 day; //total number of days in game
 	ConstTransitivePtr<Mapa> map;
 	bmap<ui8, PlayerState> players; //ID <-> player state

+ 0 - 0
hch/CGeneralTextHandler.cpp → lib/CGeneralTextHandler.cpp


+ 0 - 0
hch/CGeneralTextHandler.h → lib/CGeneralTextHandler.h


+ 0 - 0
hch/CHeroHandler.cpp → lib/CHeroHandler.cpp


+ 0 - 0
hch/CHeroHandler.h → lib/CHeroHandler.h


+ 0 - 0
hch/CLodHandler.cpp → lib/CLodHandler.cpp


+ 0 - 0
hch/CLodHandler.h → lib/CLodHandler.h


+ 1 - 1
lib/CMapInfo.cpp

@@ -3,7 +3,7 @@
 #include "CMapInfo.h"
 #include "../StartInfo.h"
 #include "map.h"
-#include "../hch/CCampaignHandler.h"
+#include "CCampaignHandler.h"
 
 void CMapInfo::countPlayers()
 {

+ 9 - 9
hch/CObjectHandler.cpp → lib/CObjectHandler.cpp

@@ -7,6 +7,7 @@
 #include "CDefObjInfoHandler.h"
 #include "CHeroHandler.h"
 #include "CSpellHandler.h"
+#include "../client/CSoundBase.h"
 #include <boost/bind.hpp>
 #include <boost/algorithm/string/replace.hpp>
 #include <boost/assign/std/vector.hpp> 
@@ -14,14 +15,13 @@
 #include <boost/random/linear_congruential.hpp>
 #include "CTownHandler.h"
 #include "CArtHandler.h"
-#include "CSoundBase.h"
 #include "CCreatureHandler.h"
-#include "../lib/VCMI_Lib.h"
-#include "../lib/IGameCallback.h"
-#include "../lib/CGameState.h"
-#include "../lib/NetPacks.h"
+#include "VCMI_Lib.h"
+#include "IGameCallback.h"
+#include "CGameState.h"
+#include "NetPacks.h"
 #include "../StartInfo.h"
-#include "../lib/map.h"
+#include "map.h"
 #include <sstream>
 #include <SDL_stdinc.h>
 #include <boost/foreach.hpp>
@@ -1652,7 +1652,7 @@ void CGDwelling::setProperty(ui8 what, ui32 val)
 			{
 				if (tempOwner != NEUTRAL_PLAYER)
 				{
-					std::vector<CGDwelling *>* dwellings = &cb->gameState()->players[tempOwner].dwellings;
+					std::vector<ConstTransitivePtr<CGDwelling> >* dwellings = &cb->gameState()->players[tempOwner].dwellings;
 					dwellings->erase (std::find(dwellings->begin(), dwellings->end(), this));
 				}
 				if (val != NEUTRAL_PLAYER) //can new owner be neutral?
@@ -1952,7 +1952,7 @@ int CGTownInstance::creatureGrowth(const int & level) const
 	{
 		ret *= (100.0f + cb->gameState()->players[tempOwner].valOfBonuses
 			(Selector::type(Bonus::CREATURE_GROWTH_PERCENT) && Selector::sourceType(Bonus::ARTIFACT)))/100; //Statue of Legion
-		for (std::vector<CGDwelling*>::const_iterator it = cb->gameState()->players[tempOwner].dwellings.begin(); it != cb->gameState()->players[tempOwner].dwellings.end(); ++it)
+		for (std::vector<ConstTransitivePtr<CGDwelling> >::const_iterator it = cb->gameState()->players[tempOwner].dwellings.begin(); it != cb->gameState()->players[tempOwner].dwellings.end(); ++it)
 		{ //+1 for each dwelling
 			if (VLC->creh->creatures[creid]->idNumber == (*it)->creatures[0].second[0])
 				++ret;
@@ -2275,7 +2275,7 @@ void CGTownInstance::removeCapitols (ui8 owner) const
 	if (hasCapitol()) // search if there's an older capitol
 	{ 
 		PlayerState* state = cb->gameState()->getPlayer (owner); //get all towns owned by player
-		for (std::vector<CGTownInstance*>::const_iterator i = state->towns.begin(); i < state->towns.end(); ++i) 
+		for (std::vector<ConstTransitivePtr<CGTownInstance> >::const_iterator i = state->towns.begin(); i < state->towns.end(); ++i) 
 		{ 
 			if (*i != this && (*i)->hasCapitol()) 
 			{ 

+ 0 - 0
hch/CObjectHandler.h → lib/CObjectHandler.h


+ 0 - 1
hch/CSpellHandler.cpp → lib/CSpellHandler.cpp

@@ -2,7 +2,6 @@
 #include "../stdafx.h"
 #include "CSpellHandler.h"
 #include "CLodHandler.h"
-#include "CSoundBase.h"
 #include "../lib/VCMI_Lib.h"
 #include <boost/algorithm/string/replace.hpp>
 #include <cctype>

+ 0 - 0
hch/CSpellHandler.h → lib/CSpellHandler.h


+ 0 - 0
hch/CTownHandler.cpp → lib/CTownHandler.cpp


+ 0 - 0
hch/CTownHandler.h → lib/CTownHandler.h


+ 7 - 7
lib/Connection.cpp

@@ -7,7 +7,7 @@
 
 #ifndef _MSC_VER
 #include "../lib/RegisterTypes.cpp"
-#include "../hch/CObjectHandler.h"
+#include "CObjectHandler.h"
 #endif
 
 //for smart objs serialization over net
@@ -15,13 +15,13 @@
 #include "../StartInfo.h"
 #include "CGameState.h"
 #include "map.h"
-#include "../hch/CObjectHandler.h"
-#include "../hch/CCreatureHandler.h"
+#include "CObjectHandler.h"
+#include "CCreatureHandler.h"
 #include "VCMI_Lib.h"
-#include "../hch/CArtHandler.h"
-#include "../hch/CHeroHandler.h"
-#include "../hch/CTownHandler.h"
-#include "../hch/CCampaignHandler.h"
+#include "CArtHandler.h"
+#include "CHeroHandler.h"
+#include "CTownHandler.h"
+#include "CCampaignHandler.h"
 #include "NetPacks.h"
 
 

+ 3 - 3
lib/HeroBonus.cpp

@@ -2,14 +2,14 @@
 #include "HeroBonus.h"
 #include <boost/foreach.hpp>
 #include "VCMI_Lib.h"
-#include "../hch/CSpellHandler.h"
+#include "CSpellHandler.h"
 #include <sstream>
-#include "../hch/CCreatureHandler.h"
+#include "CCreatureHandler.h"
 #include <boost/assign/list_of.hpp>
 #include "CCreatureSet.h"
 #include <boost/algorithm/string/trim.hpp>
 #include <boost/bind.hpp>
-#include "../hch/CHeroHandler.h"
+#include "CHeroHandler.h"
 
 #define FOREACH_CONST_PARENT(pname) 	TCNodes parents; getParents(parents); BOOST_FOREACH(const CBonusSystemNode *pname, parents)
 #define FOREACH_PARENT(pname) 	TNodes parents; getParents(parents); BOOST_FOREACH(CBonusSystemNode *pname, parents)

+ 4 - 4
lib/IGameCallback.cpp

@@ -2,13 +2,13 @@
 #include "IGameCallback.h"
 #include "../lib/CGameState.h"
 #include "../lib/map.h"
-#include "../hch/CObjectHandler.h"
+#include "CObjectHandler.h"
 #include "../StartInfo.h"
-#include "../hch/CArtHandler.h"
-#include "../hch/CSpellHandler.h"
+#include "CArtHandler.h"
+#include "CSpellHandler.h"
 #include "../lib/VCMI_Lib.h"
 #include <boost/random/linear_congruential.hpp>
-#include "../hch/CTownHandler.h"
+#include "CTownHandler.h"
 
 /*
  * IGameCallback.cpp, part of VCMI engine

+ 7 - 7
lib/NetPacksLib.cpp

@@ -1,14 +1,14 @@
 #define VCMI_DLL
 #include "NetPacks.h"
-#include "../hch/CGeneralTextHandler.h"
-#include "../hch/CDefObjInfoHandler.h"
-#include "../hch/CArtHandler.h"
-#include "../hch/CHeroHandler.h"
-#include "../hch/CObjectHandler.h"
+#include "CGeneralTextHandler.h"
+#include "CDefObjInfoHandler.h"
+#include "CArtHandler.h"
+#include "CHeroHandler.h"
+#include "CObjectHandler.h"
 #include "VCMI_Lib.h"
 #include "map.h"
-#include "../hch/CSpellHandler.h"
-#include "../hch/CCreatureHandler.h"
+#include "CSpellHandler.h"
+#include "CCreatureHandler.h"
 #include <boost/bind.hpp>
 #include <boost/foreach.hpp>
 #include <boost/lexical_cast.hpp>

+ 3 - 3
lib/RegisterTypes.cpp

@@ -3,9 +3,9 @@
 #include "Connection.h"
 #include "NetPacks.h"
 #include "VCMI_Lib.h"
-#include "../hch/CObjectHandler.h"
-#include "../hch/CHeroHandler.h"
-#include "../hch/CTownHandler.h"
+#include "CObjectHandler.h"
+#include "CHeroHandler.h"
+#include "CTownHandler.h"
 /*
  * RegisterTypes.cpp, part of VCMI engine
  *

+ 10 - 10
lib/VCMI_Lib.cpp

@@ -1,16 +1,16 @@
 #define VCMI_DLL
 #include "../global.h"
 #include "VCMI_Lib.h"
-#include "../hch/CArtHandler.h"
-#include "../hch/CCreatureHandler.h"
-#include "../hch/CDefObjInfoHandler.h"
-#include "../hch/CHeroHandler.h"
-#include "../hch/CLodHandler.h"
-#include "../hch/CObjectHandler.h"
-#include "../hch/CTownHandler.h"
-#include "../hch/CBuildingHandler.h"
-#include "../hch/CSpellHandler.h"
-#include "../hch/CGeneralTextHandler.h"
+#include "CArtHandler.h"
+#include "CCreatureHandler.h"
+#include "CDefObjInfoHandler.h"
+#include "CHeroHandler.h"
+#include "CLodHandler.h"
+#include "CObjectHandler.h"
+#include "CTownHandler.h"
+#include "CBuildingHandler.h"
+#include "CSpellHandler.h"
+#include "CGeneralTextHandler.h"
 
 /*
  * VCMI_Lib.cpp, part of VCMI engine

+ 6 - 6
lib/map.cpp

@@ -1,17 +1,17 @@
 #define VCMI_DLL
 #include "../stdafx.h"
 #include "map.h"
-#include "../hch/CObjectHandler.h"
-#include "../hch/CDefObjInfoHandler.h"
+#include "CObjectHandler.h"
+#include "CDefObjInfoHandler.h"
 #include "VCMI_Lib.h"
 #include <zlib.h>
 #include <boost/crc.hpp>
-#include "../hch/CLodHandler.h"
-#include "../hch/CArtHandler.h"
-#include "../hch/CCreatureHandler.h"
+#include "CLodHandler.h"
+#include "CArtHandler.h"
+#include "CCreatureHandler.h"
 #include <boost/bind.hpp>
 #include <assert.h>
-#include "../hch/CSpellHandler.h"
+#include "CSpellHandler.h"
 
 /*
  * map.cpp, part of VCMI engine

+ 2 - 2
lib/map.h

@@ -10,8 +10,8 @@
 #include <list>
 #include "../global.h"
 #ifndef _MSC_VER
-#include "../hch/CObjectHandler.h"
-#include "../hch/CDefObjInfoHandler.h"
+#include "CObjectHandler.h"
+#include "CDefObjInfoHandler.h"
 #endif
 
 #include "ConstTransitivePtr.h"

+ 12 - 11
server/CGameHandler.cpp

@@ -1,20 +1,21 @@
-#include "../hch/CCampaignHandler.h"
+#include "../lib/CCampaignHandler.h"
 #include "../StartInfo.h"
-#include "../hch/CArtHandler.h"
-#include "../hch/CBuildingHandler.h"
-#include "../hch/CDefObjInfoHandler.h"
-#include "../hch/CHeroHandler.h"
-#include "../hch/CObjectHandler.h"
-#include "../hch/CSpellHandler.h"
-#include "../hch/CGeneralTextHandler.h"
-#include "../hch/CTownHandler.h"
-#include "../hch/CCreatureHandler.h"
+#include "../lib/CArtHandler.h"
+#include "../lib/CBuildingHandler.h"
+#include "../lib/CDefObjInfoHandler.h"
+#include "../lib/CHeroHandler.h"
+#include "../lib/CObjectHandler.h"
+#include "../lib/CSpellHandler.h"
+#include "../lib/CGeneralTextHandler.h"
+#include "../lib/CTownHandler.h"
+#include "../lib/CCreatureHandler.h"
 #include "../lib/CGameState.h"
 #include "../lib/CondSh.h"
 #include "../lib/NetPacks.h"
 #include "../lib/VCMI_Lib.h"
 #include "../lib/map.h"
 #include "../lib/VCMIDirs.h"
+#include "../client/CSoundBase.h"
 #include "CGameHandler.h"
 #include <boost/bind.hpp>
 #include <boost/date_time/posix_time/posix_time_types.hpp> //no i/o just types
@@ -4685,7 +4686,7 @@ void CGameHandler::checkLossVictory( ui8 player )
 	{
 		iw.text.localStrings.front().second++; //message about losing because enemy won first is just after victory message
 
-		for (std::map<ui8,PlayerState>::const_iterator i = gs->players.begin(); i!=gs->players.end(); i++)
+		for (bmap<ui8,PlayerState>::const_iterator i = gs->players.begin(); i!=gs->players.end(); i++)
 		{
 			if(i->first < PLAYER_LIMIT && i->first != player)//FIXME: skip already eliminated players?
 			{

+ 11 - 11
server/CVCMIServer.cpp

@@ -1,18 +1,18 @@
-#include "../hch/CCampaignHandler.h"
+#include "../lib/CCampaignHandler.h"
 #include <iostream>
 #include <string>
 #include <boost/asio.hpp>
 #include "../global.h"
 #include "../lib/Connection.h"
-#include "../hch/CArtHandler.h"
-#include "../hch/CDefObjInfoHandler.h"
-#include "../hch/CGeneralTextHandler.h"
-#include "../hch/CHeroHandler.h"
-#include "../hch/CTownHandler.h"
-#include "../hch/CObjectHandler.h"
-#include "../hch/CBuildingHandler.h"
-#include "../hch/CSpellHandler.h"
-#include "../hch/CCreatureHandler.h"
+#include "../lib/CArtHandler.h"
+#include "../lib/CDefObjInfoHandler.h"
+#include "../lib/CGeneralTextHandler.h"
+#include "../lib/CHeroHandler.h"
+#include "../lib/CTownHandler.h"
+#include "../lib/CObjectHandler.h"
+#include "../lib/CBuildingHandler.h"
+#include "../lib/CSpellHandler.h"
+#include "../lib/CCreatureHandler.h"
 #include "zlib.h"
 #ifndef __GNUC__
 #include <tchar.h>
@@ -23,7 +23,7 @@
 #include <boost/interprocess/shared_memory_object.hpp>
 #include "../StartInfo.h"
 #include "../lib/map.h"
-#include "../hch/CLodHandler.h" 
+#include "../lib/CLodHandler.h" 
 #include "../lib/Interprocess.h"
 #include "../lib/VCMI_Lib.h"
 #include "../lib/VCMIDirs.h"

+ 1 - 1
server/NetPacksServer.cpp

@@ -1,6 +1,6 @@
 #include "../lib/NetPacks.h"
 #include "CGameHandler.h"
-#include "../hch/CObjectHandler.h"
+#include "../lib/CObjectHandler.h"
 #include "../lib/IGameCallback.h"
 #include "../lib/map.h"