From 49083c4e5a7609f391d3f752de5927de82375eda Mon Sep 17 00:00:00 2001 From: mateuszb Date: Mon, 20 Dec 2010 21:22:53 +0000 Subject: [PATCH] * ConstTransitive CGI more or less done * hch contents distributed to more appropriate folders --- AI/GeniusAI/BattleLogic.h | 4 +-- AI/GeniusAI/CGeniusAI.cpp | 8 +++--- CCallback.cpp | 18 +++++++------- StartInfo.h | 4 +-- client/AdventureMapButton.cpp | 8 +++--- client/CAdvmapInterface.cpp | 14 +++++------ client/CAnimation.cpp | 2 +- client/CBattleInterface.cpp | 18 +++++++------- client/CBitmapHandler.cpp | 4 +-- client/CCastleInterface.cpp | 32 ++++++++++++------------ client/CCastleInterface.h | 2 +- client/CCreatureAnimation.cpp | 2 +- client/CCreatureAnimation.h | 2 +- client/CCursorHandler.cpp | 2 +- {hch => client}/CDefHandler.cpp | 4 +-- {hch => client}/CDefHandler.h | 0 client/CGameInfo.h | 2 +- client/CHeroWindow.cpp | 12 ++++----- client/CKingdomInterface.cpp | 18 +++++++------- client/CKingdomInterface.h | 2 +- client/CMT.cpp | 24 +++++++++--------- client/CMessage.cpp | 6 ++--- {hch => client}/CMusicBase.h | 0 {hch => client}/CMusicHandler.cpp | 4 +-- {hch => client}/CMusicHandler.h | 2 +- client/CPlayerInterface.cpp | 16 ++++++------ client/CPreGame.cpp | 30 +++++++++++----------- {hch => client}/CSndHandler.cpp | 0 {hch => client}/CSndHandler.h | 0 {hch => client}/CSoundBase.h | 0 client/CSpellWindow.cpp | 10 ++++---- {hch => client}/CVideoHandler.cpp | 0 {hch => client}/CVideoHandler.h | 0 client/Client.cpp | 20 +++++++-------- client/GUIClasses.cpp | 22 ++++++++--------- client/Graphics.cpp | 37 ++++++++++++++++++++++------ client/Graphics.h | 2 ++ client/NetPacksClient.cpp | 14 +++++------ client/SDL_Extensions.cpp | 2 +- client/mapHandler.cpp | 14 +++++------ {hch => lib}/CArtHandler.cpp | 0 {hch => lib}/CArtHandler.h | 0 {hch => lib}/CBuildingHandler.cpp | 22 ++--------------- {hch => lib}/CBuildingHandler.h | 9 ++++--- {hch => lib}/CCampaignHandler.cpp | 0 {hch => lib}/CCampaignHandler.h | 0 {hch => lib}/CCreatureHandler.cpp | 0 {hch => lib}/CCreatureHandler.h | 1 - lib/CCreatureSet.cpp | 6 ++--- {hch => lib}/CDefObjInfoHandler.cpp | 0 {hch => lib}/CDefObjInfoHandler.h | 0 lib/CGameState.cpp | 20 +++++++-------- lib/CGameState.h | 6 ++--- {hch => lib}/CGeneralTextHandler.cpp | 0 {hch => lib}/CGeneralTextHandler.h | 0 {hch => lib}/CHeroHandler.cpp | 0 {hch => lib}/CHeroHandler.h | 0 {hch => lib}/CLodHandler.cpp | 0 {hch => lib}/CLodHandler.h | 0 lib/CMapInfo.cpp | 2 +- {hch => lib}/CObjectHandler.cpp | 18 +++++++------- {hch => lib}/CObjectHandler.h | 0 {hch => lib}/CSpellHandler.cpp | 1 - {hch => lib}/CSpellHandler.h | 0 {hch => lib}/CTownHandler.cpp | 0 {hch => lib}/CTownHandler.h | 0 lib/Connection.cpp | 14 +++++------ lib/HeroBonus.cpp | 6 ++--- lib/IGameCallback.cpp | 8 +++--- lib/NetPacksLib.cpp | 14 +++++------ lib/RegisterTypes.cpp | 6 ++--- lib/VCMI_Lib.cpp | 20 +++++++-------- lib/map.cpp | 12 ++++----- lib/map.h | 4 +-- server/CGameHandler.cpp | 23 ++++++++--------- server/CVCMIServer.cpp | 22 ++++++++--------- server/NetPacksServer.cpp | 2 +- 77 files changed, 291 insertions(+), 286 deletions(-) rename {hch => client}/CDefHandler.cpp (95%) rename {hch => client}/CDefHandler.h (100%) rename {hch => client}/CMusicBase.h (100%) rename {hch => client}/CMusicHandler.cpp (95%) rename {hch => client}/CMusicHandler.h (95%) rename {hch => client}/CSndHandler.cpp (100%) rename {hch => client}/CSndHandler.h (100%) rename {hch => client}/CSoundBase.h (100%) rename {hch => client}/CVideoHandler.cpp (100%) rename {hch => client}/CVideoHandler.h (100%) rename {hch => lib}/CArtHandler.cpp (100%) rename {hch => lib}/CArtHandler.h (100%) rename {hch => lib}/CBuildingHandler.cpp (89%) rename {hch => lib}/CBuildingHandler.h (67%) rename {hch => lib}/CCampaignHandler.cpp (100%) rename {hch => lib}/CCampaignHandler.h (100%) rename {hch => lib}/CCreatureHandler.cpp (100%) rename {hch => lib}/CCreatureHandler.h (96%) rename {hch => lib}/CDefObjInfoHandler.cpp (100%) rename {hch => lib}/CDefObjInfoHandler.h (100%) rename {hch => lib}/CGeneralTextHandler.cpp (100%) rename {hch => lib}/CGeneralTextHandler.h (100%) rename {hch => lib}/CHeroHandler.cpp (100%) rename {hch => lib}/CHeroHandler.h (100%) rename {hch => lib}/CLodHandler.cpp (100%) rename {hch => lib}/CLodHandler.h (100%) rename {hch => lib}/CObjectHandler.cpp (95%) rename {hch => lib}/CObjectHandler.h (100%) rename {hch => lib}/CSpellHandler.cpp (95%) rename {hch => lib}/CSpellHandler.h (100%) rename {hch => lib}/CTownHandler.cpp (100%) rename {hch => lib}/CTownHandler.h (100%) diff --git a/AI/GeniusAI/BattleLogic.h b/AI/GeniusAI/BattleLogic.h index 4b4667819..ff0d80afe 100644 --- a/AI/GeniusAI/BattleLogic.h +++ b/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) diff --git a/AI/GeniusAI/CGeniusAI.cpp b/AI/GeniusAI/CGeniusAI.cpp index 43bf7c734..3ce6ba6d0 100644 --- a/AI/GeniusAI/CGeniusAI.cpp +++ b/AI/GeniusAI/CGeniusAI.cpp @@ -3,8 +3,8 @@ #include #include -#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 thisTownsBuildings = VLC->buildh->buildings[t.t->subID]; - for (std::map::iterator i = thisTownsBuildings.begin(); i != thisTownsBuildings.end(); i++) + bmap > thisTownsBuildings = VLC->buildh->buildings[t.t->subID]; + for (bmap >::iterator i = thisTownsBuildings.begin(); i != thisTownsBuildings.end(); i++) { if (m_cb->canBuildStructure(t.t, i->first) == 7) { diff --git a/CCallback.cpp b/CCallback.cpp index 1739ec160..b34c3cff0 100644 --- a/CCallback.cpp +++ b/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 #include #include -#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;iresources.size();i++) if(b->resources[i] > gs->players[player].resources[i]) return false; //lack of resources diff --git a/StartInfo.h b/StartInfo.h index c5ea68850..8d9b80854 100644 --- a/StartInfo.h +++ b/StartInfo.h @@ -56,7 +56,7 @@ struct StartInfo ui8 mode; //uses EMode enum ui8 difficulty; //0=easy; 4=impossible - std::map playerInfos; //color indexed + bmap 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::iterator it=playerInfos.begin(); it != playerInfos.end(); ++it) + for(bmap::iterator it=playerInfos.begin(); it != playerInfos.end(); ++it) if(it->second.human == nameID) return &it->second; diff --git a/client/AdventureMapButton.cpp b/client/AdventureMapButton.cpp index c7534a5ca..8a241761c 100644 --- a/client/AdventureMapButton.cpp +++ b/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 diff --git a/client/CAdvmapInterface.cpp b/client/CAdvmapInterface.cpp index 1113f5b34..ef771c237 100644 --- a/client/CAdvmapInterface.cpp +++ b/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 #include "CPreGame.h" #include "../lib/VCMI_Lib.h" -#include "../hch/CSpellHandler.h" +#include "../lib/CSpellHandler.h" #include -#include "../hch/CSoundBase.h" +#include "CSoundBase.h" #ifdef _MSC_VER #pragma warning (disable : 4355) diff --git a/client/CAnimation.cpp b/client/CAnimation.cpp index 8620e7999..33fb15019 100644 --- a/client/CAnimation.cpp +++ b/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 diff --git a/client/CBattleInterface.cpp b/client/CBattleInterface.cpp index 1a90f3aa1..706408498 100644 --- a/client/CBattleInterface.cpp +++ b/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 #include #include diff --git a/client/CBitmapHandler.cpp b/client/CBitmapHandler.cpp index 8419e9c86..b80aaee64 100644 --- a/client/CBitmapHandler.cpp +++ b/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 #include diff --git a/client/CCastleInterface.cpp b/client/CCastleInterface.cpp index bea2e44aa..de3c0f354 100644 --- a/client/CCastleInterface.cpp +++ b/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 #include #include @@ -28,8 +28,8 @@ #include #include #include -#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 > > &boxList = CGI->buildh->hall[owner->town->subID].second; + const std::vector< std::vector< std::vector > > &boxList = CGI->buildh->hall[owner->town->subID].second; for(size_t j=0; jtown->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); } diff --git a/client/CCastleInterface.h b/client/CCastleInterface.h index 79f4b0f41..0caac35b5 100644 --- a/client/CCastleInterface.h +++ b/client/CCastleInterface.h @@ -7,7 +7,7 @@ #include #include "CAnimation.h" #include "GUIBase.h" -#include "../hch/CMusicBase.h" +#include "CMusicBase.h" //#include "boost/tuple/tuple.hpp" class CGTownInstance; class CTownHandler; diff --git a/client/CCreatureAnimation.cpp b/client/CCreatureAnimation.cpp index 487535471..602060bef 100644 --- a/client/CCreatureAnimation.cpp +++ b/client/CCreatureAnimation.cpp @@ -1,5 +1,5 @@ #include "CCreatureAnimation.h" -#include "../hch/CLodHandler.h" +#include "../lib/CLodHandler.h" #include "../lib/VCMI_Lib.h" #include #include "SDL_Extensions.h" diff --git a/client/CCreatureAnimation.h b/client/CCreatureAnimation.h index f73ba21f9..df966e954 100644 --- a/client/CCreatureAnimation.h +++ b/client/CCreatureAnimation.h @@ -3,7 +3,7 @@ #include "../global.h" -#include "../hch/CDefHandler.h" +#include "CDefHandler.h" #include "GUIBase.h" #include "../client/CBitmapHandler.h" diff --git a/client/CCursorHandler.cpp b/client/CCursorHandler.cpp index 04d464112..64eccf85a 100644 --- a/client/CCursorHandler.cpp +++ b/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 diff --git a/hch/CDefHandler.cpp b/client/CDefHandler.cpp similarity index 95% rename from hch/CDefHandler.cpp rename to client/CDefHandler.cpp index 4a15c408c..094bc4c0b 100644 --- a/hch/CDefHandler.cpp +++ b/client/CDefHandler.cpp @@ -2,9 +2,9 @@ #include "SDL.h" #include "CDefHandler.h" #include -#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 diff --git a/hch/CDefHandler.h b/client/CDefHandler.h similarity index 100% rename from hch/CDefHandler.h rename to client/CDefHandler.h diff --git a/client/CGameInfo.h b/client/CGameInfo.h index f8ff69d45..20371da5e 100644 --- a/client/CGameInfo.h +++ b/client/CGameInfo.h @@ -61,7 +61,7 @@ public: ConstTransitivePtr dobjinfo; CGeneralTextHandler * generaltexth; CMapHandler * mh; - CBuildingHandler * buildh; + ConstTransitivePtr buildh; CTownHandler * townh; //CTownHandler * townh; diff --git a/client/CHeroWindow.cpp b/client/CHeroWindow.cpp index 703becbb2..5ecd926d9 100644 --- a/client/CHeroWindow.cpp +++ b/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 #include #include diff --git a/client/CKingdomInterface.cpp b/client/CKingdomInterface.cpp index d77490ce6..c18f09031 100644 --- a/client/CKingdomInterface.cpp +++ b/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 diff --git a/client/CKingdomInterface.h b/client/CKingdomInterface.h index eab1107e5..f896a02fa 100644 --- a/client/CKingdomInterface.h +++ b/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; diff --git a/client/CMT.cpp b/client/CMT.cpp index 0b439a559..b006cc0e8 100644 --- a/client/CMT.cpp +++ b/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 #include "../lib/NetPacks.h" #include "CMessage.h" -#include "../hch/CObjectHandler.h" +#include "../lib/CObjectHandler.h" #ifdef _WIN32 #include "SDL_syswm.h" #endif #include -#include "../hch/CDefObjInfoHandler.h" +#include "../lib/CDefObjInfoHandler.h" #if __MINGW32__ #undef main diff --git a/client/CMessage.cpp b/client/CMessage.cpp index 4f5aa66d7..cdb7e7781 100644 --- a/client/CMessage.cpp +++ b/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 #include #include -#include "../hch/CGeneralTextHandler.h" +#include "../lib/CGeneralTextHandler.h" #include "Graphics.h" #include "GUIClasses.h" #include "AdventureMapButton.h" diff --git a/hch/CMusicBase.h b/client/CMusicBase.h similarity index 100% rename from hch/CMusicBase.h rename to client/CMusicBase.h diff --git a/hch/CMusicHandler.cpp b/client/CMusicHandler.cpp similarity index 95% rename from hch/CMusicHandler.cpp rename to client/CMusicHandler.cpp index 0b551f51c..6e9dbaa60 100644 --- a/hch/CMusicHandler.cpp +++ b/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" /* diff --git a/hch/CMusicHandler.h b/client/CMusicHandler.h similarity index 95% rename from hch/CMusicHandler.h rename to client/CMusicHandler.h index c1e068000..f7cc78e86 100644 --- a/hch/CMusicHandler.h +++ b/client/CMusicHandler.h @@ -5,7 +5,7 @@ #include "CSoundBase.h" #include "CMusicBase.h" -#include "CCreatureHandler.h" +#include "../lib/CCreatureHandler.h" /* diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index 5e1fb1ebf..2337dc831 100644 --- a/client/CPlayerInterface.cpp +++ b/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" diff --git a/client/CPreGame.cpp b/client/CPreGame.cpp index a3c708b4a..aab17b9df 100644 --- a/client/CPreGame.cpp +++ b/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 #include "Graphics.h" //#include @@ -36,9 +36,9 @@ #include #include #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())]; + std::string bldgBitmapName = graphics->ERMUtoPicture[faction][CBuildingHandler::campToERMU(bonDescs[i].info1, faction, std::set())]; surfToDuplicate = BitmapHandler::loadBitmap(bldgBitmapName); freeDuplicatedSurface = true; diff --git a/hch/CSndHandler.cpp b/client/CSndHandler.cpp similarity index 100% rename from hch/CSndHandler.cpp rename to client/CSndHandler.cpp diff --git a/hch/CSndHandler.h b/client/CSndHandler.h similarity index 100% rename from hch/CSndHandler.h rename to client/CSndHandler.h diff --git a/hch/CSoundBase.h b/client/CSoundBase.h similarity index 100% rename from hch/CSoundBase.h rename to client/CSoundBase.h diff --git a/client/CSpellWindow.cpp b/client/CSpellWindow.cpp index e67edfd52..82842310c 100644 --- a/client/CSpellWindow.cpp +++ b/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" diff --git a/hch/CVideoHandler.cpp b/client/CVideoHandler.cpp similarity index 100% rename from hch/CVideoHandler.cpp rename to client/CVideoHandler.cpp diff --git a/hch/CVideoHandler.h b/client/CVideoHandler.h similarity index 100% rename from hch/CVideoHandler.h rename to client/CVideoHandler.h diff --git a/client/Client.cpp b/client/Client.cpp index 123902e7b..c191d9122 100644 --- a/client/Client.cpp +++ b/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" diff --git a/client/GUIClasses.cpp b/client/GUIClasses.cpp index 5f94b2257..7a96d644a 100644 --- a/client/GUIClasses.cpp +++ b/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 diff --git a/client/Graphics.cpp b/client/Graphics.cpp index a3f8d9e7c..88f4bf925 100644 --- a/client/Graphics.cpp +++ b/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 #include @@ -12,16 +12,16 @@ #include #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> buf; + ERMUtoPicture[b][g] = buf; + } + } + + etp.close(); +} + Font::Font(unsigned char *Data) { data = Data; diff --git a/client/Graphics.h b/client/Graphics.h index e47439a77..9f23d8734 100644 --- a/client/Graphics.h +++ b/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 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 > &rotations, std::vector 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); diff --git a/client/NetPacksClient.cpp b/client/NetPacksClient.cpp index 0e3413ac0..d28abcc18 100644 --- a/client/NetPacksClient.cpp +++ b/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 @@ -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,...) \ diff --git a/client/SDL_Extensions.cpp b/client/SDL_Extensions.cpp index 7c4c81c84..7902f72e7 100644 --- a/client/SDL_Extensions.cpp +++ b/client/SDL_Extensions.cpp @@ -7,7 +7,7 @@ #include #include "CMessage.h" #include -#include "../hch/CDefHandler.h" +#include "CDefHandler.h" #include #include "Graphics.h" #include "GUIBase.h" diff --git a/client/mapHandler.cpp b/client/mapHandler.cpp index 366d7e759..3d2c18960 100644 --- a/client/mapHandler.cpp +++ b/client/mapHandler.cpp @@ -3,21 +3,21 @@ #include "SDL_Extensions.h" #include "CGameInfo.h" #include -#include "../hch/CLodHandler.h" -#include "../hch/CDefObjInfoHandler.h" +#include "../lib/CLodHandler.h" +#include "../lib/CDefObjInfoHandler.h" #include #include "../lib/CGameState.h" -#include "../hch/CHeroHandler.h" -#include "../hch/CTownHandler.h" +#include "../lib/CHeroHandler.h" +#include "../lib/CTownHandler.h" #include "Graphics.h" #include #include -#include "../hch/CObjectHandler.h" +#include "../lib/CObjectHandler.h" #include "../lib/map.h" -#include "../hch/CDefHandler.h" +#include "CDefHandler.h" #include "CConfigHandler.h" #include -#include "../hch/CGeneralTextHandler.h" +#include "../lib/CGeneralTextHandler.h" /* * mapHandler.cpp, part of VCMI engine diff --git a/hch/CArtHandler.cpp b/lib/CArtHandler.cpp similarity index 100% rename from hch/CArtHandler.cpp rename to lib/CArtHandler.cpp diff --git a/hch/CArtHandler.h b/lib/CArtHandler.h similarity index 100% rename from hch/CArtHandler.h rename to lib/CArtHandler.h diff --git a/hch/CBuildingHandler.cpp b/lib/CBuildingHandler.cpp similarity index 89% rename from hch/CBuildingHandler.cpp rename to lib/CBuildingHandler.cpp index 92a05e716..c8fd1bb6a 100644 --- a/hch/CBuildingHandler.cpp +++ b/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> buf; - ERMUtoPicture[b][g] = buf; - } - } - - etp.close(); - - } CBuildingHandler::~CBuildingHandler() { - for(std::vector< std::map >::iterator i=buildings.begin(); i!=buildings.end(); i++) - for(std::map::iterator j=i->begin(); j!=i->end(); j++) + for(std::vector< bmap > >::iterator i=buildings.begin(); i!=buildings.end(); i++) + for(std::map >::iterator j=i->begin(); j!=i->end(); j++) delete j->second; } diff --git a/hch/CBuildingHandler.h b/lib/CBuildingHandler.h similarity index 67% rename from hch/CBuildingHandler.h rename to lib/CBuildingHandler.h index a372aa88c..b97ae0657 100644 --- a/hch/CBuildingHandler.h +++ b/lib/CBuildingHandler.h @@ -5,6 +5,8 @@ #include #include +#include "../lib/ConstTransitivePtr.h" + /* * CBuildingHandler.h, part of VCMI engine * @@ -37,9 +39,8 @@ public: class DLL_EXPORT CBuildingHandler { public: - std::vector< std::map > buildings; ///< vector by castle ID, second the building ID (in ERM-U format) - std::map > > > > hall; //map >[5]> - external vector is the vector of buildings in the row, internal is the list of buildings for the specific slot - std::map ERMUtoPicture[F_NUMBER]; //maps building ID to it's picture's name for each town type + std::vector< bmap > > buildings; ///< vector by castle ID, second the building ID (in ERM-U format) + bmap > > > > hall; //map >[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 void serialize(Handler &h, const int version) { - h & buildings & hall & ERMUtoPicture; + h & buildings & hall; } }; diff --git a/hch/CCampaignHandler.cpp b/lib/CCampaignHandler.cpp similarity index 100% rename from hch/CCampaignHandler.cpp rename to lib/CCampaignHandler.cpp diff --git a/hch/CCampaignHandler.h b/lib/CCampaignHandler.h similarity index 100% rename from hch/CCampaignHandler.h rename to lib/CCampaignHandler.h diff --git a/hch/CCreatureHandler.cpp b/lib/CCreatureHandler.cpp similarity index 100% rename from hch/CCreatureHandler.cpp rename to lib/CCreatureHandler.cpp diff --git a/hch/CCreatureHandler.h b/lib/CCreatureHandler.h similarity index 96% rename from hch/CCreatureHandler.h rename to lib/CCreatureHandler.h index 6f314e31e..96868ecd9 100644 --- a/hch/CCreatureHandler.h +++ b/lib/CCreatureHandler.h @@ -6,7 +6,6 @@ #include #include -#include "CSoundBase.h" #include "../lib/HeroBonus.h" #include "../lib/CGameState.h" #include "../lib/CCreatureSet.h" diff --git a/lib/CCreatureSet.cpp b/lib/CCreatureSet.cpp index 1db035c9a..8e2546000 100644 --- a/lib/CCreatureSet.cpp +++ b/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 -#include "../hch/CObjectHandler.h" +#include "CObjectHandler.h" #include "IGameCallback.h" #include "CGameState.h" -#include "../hch/CGeneralTextHandler.h" +#include "CGeneralTextHandler.h" #include const CStackInstance &CCreatureSet::operator[](TSlot slot) const diff --git a/hch/CDefObjInfoHandler.cpp b/lib/CDefObjInfoHandler.cpp similarity index 100% rename from hch/CDefObjInfoHandler.cpp rename to lib/CDefObjInfoHandler.cpp diff --git a/hch/CDefObjInfoHandler.h b/lib/CDefObjInfoHandler.h similarity index 100% rename from hch/CDefObjInfoHandler.h rename to lib/CDefObjInfoHandler.h diff --git a/lib/CGameState.cpp b/lib/CGameState.cpp index a2fbf8e93..ea8e4ec0d 100644 --- a/lib/CGameState.cpp +++ b/lib/CGameState.cpp @@ -1,19 +1,19 @@ #define VCMI_DLL -#include "../hch/CCampaignHandler.h" +#include "CCampaignHandler.h" #include #include #include #include "CGameState.h" #include -#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" diff --git a/lib/CGameState.h b/lib/CGameState.h index 3d745f0d9..47367aeb5 100644 --- a/lib/CGameState.h +++ b/lib/CGameState.h @@ -4,7 +4,7 @@ #include #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 scenarioOps, initialOpts; //second one is a copy of settings received from pregame (not randomized) - CCampaignState *campaign; + ConstTransitivePtr campaign; ui32 seed; ui8 currentPlayer; //ID of player currently having turn - BattleInfo *curB; //current battle + ConstTransitivePtr curB; //current battle ui32 day; //total number of days in game ConstTransitivePtr map; bmap players; //ID <-> player state diff --git a/hch/CGeneralTextHandler.cpp b/lib/CGeneralTextHandler.cpp similarity index 100% rename from hch/CGeneralTextHandler.cpp rename to lib/CGeneralTextHandler.cpp diff --git a/hch/CGeneralTextHandler.h b/lib/CGeneralTextHandler.h similarity index 100% rename from hch/CGeneralTextHandler.h rename to lib/CGeneralTextHandler.h diff --git a/hch/CHeroHandler.cpp b/lib/CHeroHandler.cpp similarity index 100% rename from hch/CHeroHandler.cpp rename to lib/CHeroHandler.cpp diff --git a/hch/CHeroHandler.h b/lib/CHeroHandler.h similarity index 100% rename from hch/CHeroHandler.h rename to lib/CHeroHandler.h diff --git a/hch/CLodHandler.cpp b/lib/CLodHandler.cpp similarity index 100% rename from hch/CLodHandler.cpp rename to lib/CLodHandler.cpp diff --git a/hch/CLodHandler.h b/lib/CLodHandler.h similarity index 100% rename from hch/CLodHandler.h rename to lib/CLodHandler.h diff --git a/lib/CMapInfo.cpp b/lib/CMapInfo.cpp index e2da2cea9..93a802fc0 100644 --- a/lib/CMapInfo.cpp +++ b/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() { diff --git a/hch/CObjectHandler.cpp b/lib/CObjectHandler.cpp similarity index 95% rename from hch/CObjectHandler.cpp rename to lib/CObjectHandler.cpp index 1fcd3cd5b..fa48477ea 100644 --- a/hch/CObjectHandler.cpp +++ b/lib/CObjectHandler.cpp @@ -7,6 +7,7 @@ #include "CDefObjInfoHandler.h" #include "CHeroHandler.h" #include "CSpellHandler.h" +#include "../client/CSoundBase.h" #include #include #include @@ -14,14 +15,13 @@ #include #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 #include #include @@ -1652,7 +1652,7 @@ void CGDwelling::setProperty(ui8 what, ui32 val) { if (tempOwner != NEUTRAL_PLAYER) { - std::vector* dwellings = &cb->gameState()->players[tempOwner].dwellings; + std::vector >* 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::const_iterator it = cb->gameState()->players[tempOwner].dwellings.begin(); it != cb->gameState()->players[tempOwner].dwellings.end(); ++it) + for (std::vector >::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::const_iterator i = state->towns.begin(); i < state->towns.end(); ++i) + for (std::vector >::const_iterator i = state->towns.begin(); i < state->towns.end(); ++i) { if (*i != this && (*i)->hasCapitol()) { diff --git a/hch/CObjectHandler.h b/lib/CObjectHandler.h similarity index 100% rename from hch/CObjectHandler.h rename to lib/CObjectHandler.h diff --git a/hch/CSpellHandler.cpp b/lib/CSpellHandler.cpp similarity index 95% rename from hch/CSpellHandler.cpp rename to lib/CSpellHandler.cpp index 4ac5da892..f9efb61b4 100644 --- a/hch/CSpellHandler.cpp +++ b/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 #include diff --git a/hch/CSpellHandler.h b/lib/CSpellHandler.h similarity index 100% rename from hch/CSpellHandler.h rename to lib/CSpellHandler.h diff --git a/hch/CTownHandler.cpp b/lib/CTownHandler.cpp similarity index 100% rename from hch/CTownHandler.cpp rename to lib/CTownHandler.cpp diff --git a/hch/CTownHandler.h b/lib/CTownHandler.h similarity index 100% rename from hch/CTownHandler.h rename to lib/CTownHandler.h diff --git a/lib/Connection.cpp b/lib/Connection.cpp index f2e15b53c..ced8b68f9 100644 --- a/lib/Connection.cpp +++ b/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" diff --git a/lib/HeroBonus.cpp b/lib/HeroBonus.cpp index 77677b09f..e2dc46514 100644 --- a/lib/HeroBonus.cpp +++ b/lib/HeroBonus.cpp @@ -2,14 +2,14 @@ #include "HeroBonus.h" #include #include "VCMI_Lib.h" -#include "../hch/CSpellHandler.h" +#include "CSpellHandler.h" #include -#include "../hch/CCreatureHandler.h" +#include "CCreatureHandler.h" #include #include "CCreatureSet.h" #include #include -#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) diff --git a/lib/IGameCallback.cpp b/lib/IGameCallback.cpp index 79521cc96..1812613ec 100644 --- a/lib/IGameCallback.cpp +++ b/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 -#include "../hch/CTownHandler.h" +#include "CTownHandler.h" /* * IGameCallback.cpp, part of VCMI engine diff --git a/lib/NetPacksLib.cpp b/lib/NetPacksLib.cpp index 0edfcd8f8..8ba5b7c0d 100644 --- a/lib/NetPacksLib.cpp +++ b/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 #include #include diff --git a/lib/RegisterTypes.cpp b/lib/RegisterTypes.cpp index c841ddee3..11e54e7fd 100644 --- a/lib/RegisterTypes.cpp +++ b/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 * diff --git a/lib/VCMI_Lib.cpp b/lib/VCMI_Lib.cpp index 8e14bf24a..0262a0af0 100644 --- a/lib/VCMI_Lib.cpp +++ b/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 diff --git a/lib/map.cpp b/lib/map.cpp index 01e888184..55e8a36ce 100644 --- a/lib/map.cpp +++ b/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 #include -#include "../hch/CLodHandler.h" -#include "../hch/CArtHandler.h" -#include "../hch/CCreatureHandler.h" +#include "CLodHandler.h" +#include "CArtHandler.h" +#include "CCreatureHandler.h" #include #include -#include "../hch/CSpellHandler.h" +#include "CSpellHandler.h" /* * map.cpp, part of VCMI engine diff --git a/lib/map.h b/lib/map.h index 177c69e45..c891bb8b8 100644 --- a/lib/map.h +++ b/lib/map.h @@ -10,8 +10,8 @@ #include #include "../global.h" #ifndef _MSC_VER -#include "../hch/CObjectHandler.h" -#include "../hch/CDefObjInfoHandler.h" +#include "CObjectHandler.h" +#include "CDefObjInfoHandler.h" #endif #include "ConstTransitivePtr.h" diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index 5a63667fe..36c2b2b4c 100644 --- a/server/CGameHandler.cpp +++ b/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 #include //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::const_iterator i = gs->players.begin(); i!=gs->players.end(); i++) + for (bmap::const_iterator i = gs->players.begin(); i!=gs->players.end(); i++) { if(i->first < PLAYER_LIMIT && i->first != player)//FIXME: skip already eliminated players? { diff --git a/server/CVCMIServer.cpp b/server/CVCMIServer.cpp index 0750e0002..38465e91a 100644 --- a/server/CVCMIServer.cpp +++ b/server/CVCMIServer.cpp @@ -1,18 +1,18 @@ -#include "../hch/CCampaignHandler.h" +#include "../lib/CCampaignHandler.h" #include #include #include #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 @@ -23,7 +23,7 @@ #include #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" diff --git a/server/NetPacksServer.cpp b/server/NetPacksServer.cpp index d23cc5259..e793b2695 100644 --- a/server/NetPacksServer.cpp +++ b/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"