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);
}
dh->alphaTransformed = true;
if(flip)
flag = CDefHandler::giveDef("CMFLAGR.DEF");

View File

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

View File

@ -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:

View File

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

View File

@ -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

View File

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

View File

@ -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;

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 "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; i<ourImages.size(); ++i)
@ -369,7 +367,6 @@ CDefHandler * CDefHandler::giveDef(const std::string & defName)
throw "bad def name!";
CDefHandler * nh = new CDefHandler();
nh->openFromMemory(data, defName);
nh->alphaTransformed = false;
delete [] data;
return nh;
}

View File

@ -1,10 +1,10 @@
#ifndef __CDEFHANDLER_H__
#define __CDEFHANDLER_H__
#include "../client/CBitmapHandler.h"
#include <SDL_stdinc.h>
#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<Cimage> ourImages;
~CDefEssential(); //d-tor
};
class CDefHandler
@ -83,7 +90,6 @@ public:
int width, height; //width and height
std::string defName;
std::vector<Cimage> 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<Cimage> ourImages;
~CDefEssential(); //d-tor
};
#endif // __CDEFHANDLER_H__

View File

@ -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)

View File

@ -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<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
//bool operator<(CHero& drugi){if (ID < drugi.ID) return true; else return false;}

View File

@ -980,7 +980,7 @@ void CGHeroInstance::initObj()
if(!type)
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.id = id; //from the hero, speciality has no unique id

View File

@ -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
{