1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

* minor changes

This commit is contained in:
mateuszb 2010-08-17 14:58:13 +00:00
parent c96dab5c7e
commit 9c60629bcf
15 changed files with 41 additions and 106 deletions

View File

@ -3447,7 +3447,6 @@ CBattleHero::CBattleHero(const std::string & defName, int phaseG, int imageG, bo
} }
CSDL_Ext::alphaTransform(dh->ourImages[i].bitmap); CSDL_Ext::alphaTransform(dh->ourImages[i].bitmap);
} }
dh->alphaTransformed = true;
if(flip) if(flip)
flag = CDefHandler::giveDef("CMFLAGR.DEF"); flag = CDefHandler::giveDef("CMFLAGR.DEF");

View File

@ -2,7 +2,6 @@
#define __CBITMAPHANDLER_H__ #define __CBITMAPHANDLER_H__
#include "../global.h" #include "../global.h"
struct SDL_Surface; struct SDL_Surface;
class CLodHandler; class CLodHandler;

View File

@ -5,6 +5,7 @@
#include "../global.h" #include "../global.h"
#include "../hch/CDefHandler.h" #include "../hch/CDefHandler.h"
#include "GUIBase.h" #include "GUIBase.h"
#include "../client/CBitmapHandler.h"
/* /*
* CCreatureAnimation.h, part of VCMI engine * CCreatureAnimation.h, part of VCMI engine
@ -16,6 +17,8 @@
* *
*/ */
struct BMPPalette;
class CCreatureAnimation : public CIntObject class CCreatureAnimation : public CIntObject
{ {
private: private:

View File

@ -27,6 +27,7 @@
#include <boost/format.hpp> #include <boost/format.hpp>
#include <sstream> #include <sstream>
#include <SDL.h> #include <SDL.h>
#include "CBitmapHandler.h"
using namespace boost::assign; using namespace boost::assign;
using namespace CSDL_Ext; using namespace CSDL_Ext;

View File

@ -38,6 +38,7 @@
#include "../hch/CSpellHandler.h" /*for campaign bonuses*/ #include "../hch/CSpellHandler.h" /*for campaign bonuses*/
#include "../hch/CArtHandler.h" /*for campaign bonuses*/ #include "../hch/CArtHandler.h" /*for campaign bonuses*/
#include "../hch/CBuildingHandler.h" /*for campaign bonuses*/ #include "../hch/CBuildingHandler.h" /*for campaign bonuses*/
#include "CBitmapHandler.h"
/* /*
* CPreGame.cpp, part of VCMI engine * CPreGame.cpp, part of VCMI engine

View File

@ -16,6 +16,7 @@
#include <sstream> #include <sstream>
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include "CBitmapHandler.h"
/* /*
* CSpellWindow.cpp, part of VCMI engine * CSpellWindow.cpp, part of VCMI engine

View File

@ -19,6 +19,7 @@
#include "../hch/CObjectHandler.h" #include "../hch/CObjectHandler.h"
#include "../hch/CGeneralTextHandler.h" #include "../hch/CGeneralTextHandler.h"
#include "../hch/CCreatureHandler.h" #include "../hch/CCreatureHandler.h"
#include "CBitmapHandler.h"
using namespace boost::assign; using namespace boost::assign;
using namespace CSDL_Ext; using namespace CSDL_Ext;

View File

@ -1,43 +0,0 @@
//#define VCMI_DLL
//#include "../stdafx.h"
//#include "CAmbarCendamo.h"
//#include "CObjectHandler.h"
//#include "CDefObjInfoHandler.h"
//#include <set>
//#include <sstream>
//#include <fstream>
//#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<bytCon; i++)
// {
// ret+=bufor[i]*amp;
// amp*=256;
// }
// return ret;
//}
//CAmbarCendamo::CAmbarCendamo (unsigned char * data)
////:map(data)
//{}
////CAmbarCendamo::CAmbarCendamo (const char * tie)
////{
//// std::ifstream * is = new std::ifstream();
//// is -> 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<map.width;ii++)
// delete map.terrain[ii] ;
// delete map.terrain;
// delete[] bufor;
//}

View File

@ -1,20 +0,0 @@
#ifndef __CAMBARCENDAMO_H__
#define __CAMBARCENDAMO_H__
#include <iostream>
#include <string>
#include <vector>
#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__

View File

@ -4,6 +4,7 @@
#include <sstream> #include <sstream>
#include "CLodHandler.h" #include "CLodHandler.h"
#include "../lib/VCMI_Lib.h" #include "../lib/VCMI_Lib.h"
#include "../client/CBitmapHandler.h"
/* /*
* CDefHandler.cpp, part of VCMI engine * CDefHandler.cpp, part of VCMI engine
@ -25,13 +26,10 @@ static long long pow(long long a, int b)
} }
CDefHandler::CDefHandler() CDefHandler::CDefHandler()
{ {
//FDef = NULL;
notFreeImgs = false; notFreeImgs = false;
} }
CDefHandler::~CDefHandler() CDefHandler::~CDefHandler()
{ {
//if (FDef)
//delete [] FDef;
if (notFreeImgs) if (notFreeImgs)
return; return;
for (size_t i=0; i<ourImages.size(); ++i) for (size_t i=0; i<ourImages.size(); ++i)
@ -369,7 +367,6 @@ CDefHandler * CDefHandler::giveDef(const std::string & defName)
throw "bad def name!"; throw "bad def name!";
CDefHandler * nh = new CDefHandler(); CDefHandler * nh = new CDefHandler();
nh->openFromMemory(data, defName); nh->openFromMemory(data, defName);
nh->alphaTransformed = false;
delete [] data; delete [] data;
return nh; return nh;
} }

View File

@ -1,10 +1,10 @@
#ifndef __CDEFHANDLER_H__ #ifndef __CDEFHANDLER_H__
#define __CDEFHANDLER_H__ #define __CDEFHANDLER_H__
#include "../client/CBitmapHandler.h"
#include <SDL_stdinc.h> #include "../global.h"
struct SDL_Surface; struct SDL_Surface;
class CDefEssential; struct BMPPalette;
class CLodHandler;
/* /*
* CDefHandler.h, part of VCMI engine * CDefHandler.h, part of VCMI engine
@ -26,20 +26,20 @@ struct Cimage
// Def entry in file. Integer fields are all little endian and will // Def entry in file. Integer fields are all little endian and will
// need to be converted. // need to be converted.
struct SDefEntryBlock { struct SDefEntryBlock {
Uint32 unknown1; ui32 unknown1;
Uint32 totalInBlock; ui32 totalInBlock;
Uint32 unknown2; ui32 unknown2;
Uint32 unknown3; ui32 unknown3;
unsigned char data[0]; unsigned char data[0];
}; };
// Def entry in file. Integer fields are all little endian and will // Def entry in file. Integer fields are all little endian and will
// need to be converted. // need to be converted.
struct SDefEntry { struct SDefEntry {
Uint32 DEFType; ui32 DEFType;
Uint32 width; ui32 width;
Uint32 height; ui32 height;
Uint32 totalBlocks; ui32 totalBlocks;
struct { struct {
unsigned char R; unsigned char R;
@ -55,14 +55,21 @@ struct SDefEntry {
// Def entry in file. Integer fields are all little endian and will // Def entry in file. Integer fields are all little endian and will
// need to be converted. // need to be converted.
struct SSpriteDef { struct SSpriteDef {
Uint32 prSize; ui32 prSize;
Uint32 defType2; ui32 defType2;
Uint32 FullWidth; ui32 FullWidth;
Uint32 FullHeight; ui32 FullHeight;
Uint32 SpriteWidth; ui32 SpriteWidth;
Uint32 SpriteHeight; ui32 SpriteHeight;
Uint32 LeftMargin; ui32 LeftMargin;
Uint32 TopMargin; ui32 TopMargin;
};
class CDefEssential //DefHandler with images only
{
public:
std::vector<Cimage> ourImages;
~CDefEssential(); //d-tor
}; };
class CDefHandler class CDefHandler
@ -83,7 +90,6 @@ public:
int width, height; //width and height int width, height; //width and height
std::string defName; std::string defName;
std::vector<Cimage> ourImages; std::vector<Cimage> ourImages;
bool alphaTransformed;
bool notFreeImgs; bool notFreeImgs;
CDefHandler(); //c-tor CDefHandler(); //c-tor
@ -97,12 +103,6 @@ public:
static CDefEssential * giveDefEss(const std::string & defName); static CDefEssential * giveDefEss(const std::string & defName);
}; };
class CDefEssential //DefHandler with images only
{
public:
std::vector<Cimage> ourImages;
~CDefEssential(); //d-tor
};
#endif // __CDEFHANDLER_H__ #endif // __CDEFHANDLER_H__

View File

@ -393,7 +393,7 @@ void CHeroHandler::loadHeroes()
dump.clear(); dump.clear();
inp.open(DATA_DIR "/config/specials.txt"); //loading hero specials inp.open(DATA_DIR "/config/specials.txt"); //loading hero specials
assert(inp); assert(inp);
specialInfo dummy; SSpecialtyInfo dummy;
si32 hid; si32 hid;
inp.ignore(100, '\n'); inp.ignore(100, '\n');
for (int i = 0; i < 175; ++i) for (int i = 0; i < 175; ++i)

View File

@ -18,12 +18,14 @@ class CHeroClass;
class CDefHandler; class CDefHandler;
class CGameInfo; class CGameInfo;
class CGHeroInstance; class CGHeroInstance;
struct specialInfo
struct SSpecialtyInfo
{ si32 type; { si32 type;
si32 val; si32 val;
si32 subtype; si32 subtype;
si32 additionalinfo; si32 additionalinfo;
}; };
class DLL_EXPORT CHero class DLL_EXPORT CHero
{ {
public: public:
@ -38,7 +40,7 @@ public:
CHeroClass * heroClass; CHeroClass * heroClass;
EHeroClasses heroType; //hero class EHeroClasses heroType; //hero class
std::vector<std::pair<ui8,ui8> > secSkillsInit; //initial secondary skills; first - ID of skill, second - level of skill (1 - basic, 2 - adv., 3 - expert) std::vector<std::pair<ui8,ui8> > secSkillsInit; //initial secondary skills; first - ID of skill, second - level of skill (1 - basic, 2 - adv., 3 - expert)
std::vector<specialInfo> spec; std::vector<SSpecialtyInfo> spec;
si32 startingSpell; //-1 if none si32 startingSpell; //-1 if none
//bool operator<(CHero& drugi){if (ID < drugi.ID) return true; else return false;} //bool operator<(CHero& drugi){if (ID < drugi.ID) return true; else return false;}

View File

@ -980,7 +980,7 @@ void CGHeroInstance::initObj()
if(!type) if(!type)
return; //TODO support prison return; //TODO support prison
for (std::vector<specialInfo>::const_iterator it = type->spec.begin(); it != type->spec.end(); it++) for (std::vector<SSpecialtyInfo>::const_iterator it = type->spec.begin(); it != type->spec.end(); it++)
{ {
bonus.val = it->val; bonus.val = it->val;
bonus.id = id; //from the hero, speciality has no unique id bonus.id = id; //from the hero, speciality has no unique id

View File

@ -17,17 +17,11 @@ class CArtHandler;
class CHeroHandler; class CHeroHandler;
class CCreatureHandler; class CCreatureHandler;
class CSpellHandler; class CSpellHandler;
//class CPreGameTextHandler;
class CBuildingHandler; class CBuildingHandler;
class CObjectHandler; class CObjectHandler;
//class CMusicHandler;
//class CSemiLodHandler;
class CDefObjInfoHandler; class CDefObjInfoHandler;
class CTownHandler; class CTownHandler;
class CGeneralTextHandler; class CGeneralTextHandler;
//class CConsoleHandler;
//class CPathfinder;
//class CGameState;
class DLL_EXPORT LibClasses class DLL_EXPORT LibClasses
{ {