From 9c60629bcf6a2160971c25db711f4651c6c894d5 Mon Sep 17 00:00:00 2001 From: mateuszb Date: Tue, 17 Aug 2010 14:58:13 +0000 Subject: [PATCH] * minor changes --- client/CBattleInterface.cpp | 1 - client/CBitmapHandler.h | 1 - client/CCreatureAnimation.h | 3 ++ client/CKingdomInterface.cpp | 1 + client/CPreGame.cpp | 1 + client/CSpellWindow.cpp | 1 + client/Graphics.cpp | 1 + hch/CAmbarCendamo.cpp | 43 ---------------------------- hch/CAmbarCendamo.h | 20 ------------- hch/CDefHandler.cpp | 5 +--- hch/CDefHandler.h | 54 ++++++++++++++++++------------------ hch/CHeroHandler.cpp | 2 +- hch/CHeroHandler.h | 6 ++-- hch/CObjectHandler.cpp | 2 +- lib/VCMI_Lib.h | 6 ---- 15 files changed, 41 insertions(+), 106 deletions(-) delete mode 100644 hch/CAmbarCendamo.cpp delete mode 100644 hch/CAmbarCendamo.h diff --git a/client/CBattleInterface.cpp b/client/CBattleInterface.cpp index 0db86b459..beb14381a 100644 --- a/client/CBattleInterface.cpp +++ b/client/CBattleInterface.cpp @@ -3447,7 +3447,6 @@ CBattleHero::CBattleHero(const std::string & defName, int phaseG, int imageG, bo } CSDL_Ext::alphaTransform(dh->ourImages[i].bitmap); } - dh->alphaTransformed = true; if(flip) flag = CDefHandler::giveDef("CMFLAGR.DEF"); diff --git a/client/CBitmapHandler.h b/client/CBitmapHandler.h index c8683370e..579f86cc7 100644 --- a/client/CBitmapHandler.h +++ b/client/CBitmapHandler.h @@ -2,7 +2,6 @@ #define __CBITMAPHANDLER_H__ - #include "../global.h" struct SDL_Surface; class CLodHandler; diff --git a/client/CCreatureAnimation.h b/client/CCreatureAnimation.h index 0fb1d18bc..f73ba21f9 100644 --- a/client/CCreatureAnimation.h +++ b/client/CCreatureAnimation.h @@ -5,6 +5,7 @@ #include "../global.h" #include "../hch/CDefHandler.h" #include "GUIBase.h" +#include "../client/CBitmapHandler.h" /* * CCreatureAnimation.h, part of VCMI engine @@ -16,6 +17,8 @@ * */ +struct BMPPalette; + class CCreatureAnimation : public CIntObject { private: diff --git a/client/CKingdomInterface.cpp b/client/CKingdomInterface.cpp index e43afcc33..0a0e00c99 100644 --- a/client/CKingdomInterface.cpp +++ b/client/CKingdomInterface.cpp @@ -27,6 +27,7 @@ #include #include #include +#include "CBitmapHandler.h" using namespace boost::assign; using namespace CSDL_Ext; diff --git a/client/CPreGame.cpp b/client/CPreGame.cpp index 11a3e9966..fdd801445 100644 --- a/client/CPreGame.cpp +++ b/client/CPreGame.cpp @@ -38,6 +38,7 @@ #include "../hch/CSpellHandler.h" /*for campaign bonuses*/ #include "../hch/CArtHandler.h" /*for campaign bonuses*/ #include "../hch/CBuildingHandler.h" /*for campaign bonuses*/ +#include "CBitmapHandler.h" /* * CPreGame.cpp, part of VCMI engine diff --git a/client/CSpellWindow.cpp b/client/CSpellWindow.cpp index 81fe8325b..0c91c94d7 100644 --- a/client/CSpellWindow.cpp +++ b/client/CSpellWindow.cpp @@ -16,6 +16,7 @@ #include #include #include +#include "CBitmapHandler.h" /* * CSpellWindow.cpp, part of VCMI engine diff --git a/client/Graphics.cpp b/client/Graphics.cpp index 3a9f03974..afff1eed0 100644 --- a/client/Graphics.cpp +++ b/client/Graphics.cpp @@ -19,6 +19,7 @@ #include "../hch/CObjectHandler.h" #include "../hch/CGeneralTextHandler.h" #include "../hch/CCreatureHandler.h" +#include "CBitmapHandler.h" using namespace boost::assign; using namespace CSDL_Ext; diff --git a/hch/CAmbarCendamo.cpp b/hch/CAmbarCendamo.cpp deleted file mode 100644 index 0bbe244a1..000000000 --- a/hch/CAmbarCendamo.cpp +++ /dev/null @@ -1,43 +0,0 @@ -//#define VCMI_DLL -//#include "../stdafx.h" -//#include "CAmbarCendamo.h" -//#include "CObjectHandler.h" -//#include "CDefObjInfoHandler.h" -//#include -//#include -//#include -//#include "../lib/VCMI_Lib.h" -//std::string nameFromType (EterrainType typ); -//int readInt(unsigned char * bufor, int bytCon) -//{ -// int ret=0; -// int amp=1; -// for (int i=0; i open(tie,std::ios::binary); -//// is->seekg(0,std::ios::end); // na koniec -//// int andame = is->tellg(); // read length -//// is->seekg(0,std::ios::beg); // wracamy na poczatek -//// bufor = new unsigned char[andame]; // allocate memory -//// is->read((char*)bufor, andame); // read map file to buffer -//// is->close(); -//// delete is; -////} -//CAmbarCendamo::~CAmbarCendamo () -//{// free memory -// for (int ii=0;ii -#include -#include -#include "../global.h" -#include "../lib/map.h" -#include "CCreatureHandler.h" - -class DLL_EXPORT CAmbarCendamo -{ -public: -/////////////////member variables - //Mapa* map; - - //CAmbarCendamo (unsigned char * data); // c-tor; data is pointer to decompressed h3m data - //~CAmbarCendamo (); // d-tor -}; - -#endif // __CAMBARCENDAMO_H__ diff --git a/hch/CDefHandler.cpp b/hch/CDefHandler.cpp index e5dd48c50..f468d3ccc 100644 --- a/hch/CDefHandler.cpp +++ b/hch/CDefHandler.cpp @@ -4,6 +4,7 @@ #include #include "CLodHandler.h" #include "../lib/VCMI_Lib.h" +#include "../client/CBitmapHandler.h" /* * CDefHandler.cpp, part of VCMI engine @@ -25,13 +26,10 @@ static long long pow(long long a, int b) } CDefHandler::CDefHandler() { - //FDef = NULL; notFreeImgs = false; } CDefHandler::~CDefHandler() { - //if (FDef) - //delete [] FDef; if (notFreeImgs) return; for (size_t i=0; iopenFromMemory(data, defName); - nh->alphaTransformed = false; delete [] data; return nh; } diff --git a/hch/CDefHandler.h b/hch/CDefHandler.h index 6fb3071f6..7bac7a388 100644 --- a/hch/CDefHandler.h +++ b/hch/CDefHandler.h @@ -1,10 +1,10 @@ #ifndef __CDEFHANDLER_H__ #define __CDEFHANDLER_H__ -#include "../client/CBitmapHandler.h" -#include + +#include "../global.h" + struct SDL_Surface; -class CDefEssential; -class CLodHandler; +struct BMPPalette; /* * CDefHandler.h, part of VCMI engine @@ -26,20 +26,20 @@ struct Cimage // Def entry in file. Integer fields are all little endian and will // need to be converted. struct SDefEntryBlock { - Uint32 unknown1; - Uint32 totalInBlock; - Uint32 unknown2; - Uint32 unknown3; + ui32 unknown1; + ui32 totalInBlock; + ui32 unknown2; + ui32 unknown3; unsigned char data[0]; }; // Def entry in file. Integer fields are all little endian and will // need to be converted. struct SDefEntry { - Uint32 DEFType; - Uint32 width; - Uint32 height; - Uint32 totalBlocks; + ui32 DEFType; + ui32 width; + ui32 height; + ui32 totalBlocks; struct { unsigned char R; @@ -55,14 +55,21 @@ struct SDefEntry { // Def entry in file. Integer fields are all little endian and will // need to be converted. struct SSpriteDef { - Uint32 prSize; - Uint32 defType2; - Uint32 FullWidth; - Uint32 FullHeight; - Uint32 SpriteWidth; - Uint32 SpriteHeight; - Uint32 LeftMargin; - Uint32 TopMargin; + ui32 prSize; + ui32 defType2; + ui32 FullWidth; + ui32 FullHeight; + ui32 SpriteWidth; + ui32 SpriteHeight; + ui32 LeftMargin; + ui32 TopMargin; +}; + +class CDefEssential //DefHandler with images only +{ +public: + std::vector ourImages; + ~CDefEssential(); //d-tor }; class CDefHandler @@ -83,7 +90,6 @@ public: int width, height; //width and height std::string defName; std::vector ourImages; - bool alphaTransformed; bool notFreeImgs; CDefHandler(); //c-tor @@ -97,12 +103,6 @@ public: static CDefEssential * giveDefEss(const std::string & defName); }; -class CDefEssential //DefHandler with images only -{ -public: - std::vector ourImages; - ~CDefEssential(); //d-tor -}; #endif // __CDEFHANDLER_H__ diff --git a/hch/CHeroHandler.cpp b/hch/CHeroHandler.cpp index 2501fd4d7..ab9b2a621 100644 --- a/hch/CHeroHandler.cpp +++ b/hch/CHeroHandler.cpp @@ -393,7 +393,7 @@ void CHeroHandler::loadHeroes() dump.clear(); inp.open(DATA_DIR "/config/specials.txt"); //loading hero specials assert(inp); - specialInfo dummy; + SSpecialtyInfo dummy; si32 hid; inp.ignore(100, '\n'); for (int i = 0; i < 175; ++i) diff --git a/hch/CHeroHandler.h b/hch/CHeroHandler.h index c365e0b9e..7f73de1f0 100644 --- a/hch/CHeroHandler.h +++ b/hch/CHeroHandler.h @@ -18,12 +18,14 @@ class CHeroClass; class CDefHandler; class CGameInfo; class CGHeroInstance; -struct specialInfo + +struct SSpecialtyInfo { si32 type; si32 val; si32 subtype; si32 additionalinfo; }; + class DLL_EXPORT CHero { public: @@ -38,7 +40,7 @@ public: CHeroClass * heroClass; EHeroClasses heroType; //hero class std::vector > secSkillsInit; //initial secondary skills; first - ID of skill, second - level of skill (1 - basic, 2 - adv., 3 - expert) - std::vector spec; + std::vector spec; si32 startingSpell; //-1 if none //bool operator<(CHero& drugi){if (ID < drugi.ID) return true; else return false;} diff --git a/hch/CObjectHandler.cpp b/hch/CObjectHandler.cpp index 3a953f864..95fc12085 100644 --- a/hch/CObjectHandler.cpp +++ b/hch/CObjectHandler.cpp @@ -980,7 +980,7 @@ void CGHeroInstance::initObj() if(!type) return; //TODO support prison - for (std::vector::const_iterator it = type->spec.begin(); it != type->spec.end(); it++) + for (std::vector::const_iterator it = type->spec.begin(); it != type->spec.end(); it++) { bonus.val = it->val; bonus.id = id; //from the hero, speciality has no unique id diff --git a/lib/VCMI_Lib.h b/lib/VCMI_Lib.h index 4d143b2f2..7ea77141b 100644 --- a/lib/VCMI_Lib.h +++ b/lib/VCMI_Lib.h @@ -17,17 +17,11 @@ class CArtHandler; class CHeroHandler; class CCreatureHandler; class CSpellHandler; -//class CPreGameTextHandler; class CBuildingHandler; class CObjectHandler; -//class CMusicHandler; -//class CSemiLodHandler; class CDefObjInfoHandler; class CTownHandler; class CGeneralTextHandler; -//class CConsoleHandler; -//class CPathfinder; -//class CGameState; class DLL_EXPORT LibClasses {