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

- wrokaround/fix for #1177

- removed assert in Fonts.cpp (can be triggered a lot by old pregame\battles code)
- fixed battle console text positioning
- fixed some new compiler warnings
This commit is contained in:
Ivan Savenko 2013-01-20 22:49:34 +00:00
parent a96f03e947
commit 46eb0b3daf
13 changed files with 24 additions and 30 deletions

View File

@ -106,8 +106,8 @@ CAttackAnimation::CAttackAnimation(CBattleInterface *_owner, const CStack *attac
}
CDefenceAnimation::CDefenceAnimation(StackAttackedInfo _attackedInfo, CBattleInterface * _owner)
: CBattleStackAnimation(_owner, _attackedInfo.defender), dmg(_attackedInfo.dmg),
amountKilled(_attackedInfo.amountKilled), attacker(_attackedInfo.attacker), byShooting(_attackedInfo.byShooting),
: CBattleStackAnimation(_owner, _attackedInfo.defender),
attacker(_attackedInfo.attacker), byShooting(_attackedInfo.byShooting),
killed(_attackedInfo.killed)
{}
@ -689,7 +689,7 @@ void CReverseAnimation::setupSecondPart()
}
CShootingAnimation::CShootingAnimation(CBattleInterface * _owner, const CStack * attacker, BattleHex _dest, const CStack * _attacked, bool _catapult, int _catapultDmg)
: CAttackAnimation(_owner, attacker, _dest, _attacked), catapultDamage(_catapultDmg), catapult(_catapult)
: CAttackAnimation(_owner, attacker, _dest, _attacked), catapultDamage(_catapultDmg)
{}
bool CShootingAnimation::init()

View File

@ -70,8 +70,6 @@ class CDefenceAnimation : public CBattleStackAnimation
{
private:
//std::vector<StackAttackedInfo> attackedInfos;
int dmg; //damage dealt
int amountKilled; //how many creatures in stack has been killed
const CStack * attacker; //attacking stack
bool byShooting; //if true, stack has been attacked by shooting
bool killed; //if true, stack has been killed
@ -196,7 +194,6 @@ class CShootingAnimation : public CAttackAnimation
{
private:
int catapultDamage;
bool catapult;
public:
bool init();
void nextFrame();

View File

@ -25,14 +25,9 @@
#include "../CCreatureWindow.h"
#include "../CMessage.h"
CBattleConsole::~CBattleConsole()
{
texts.clear();
}
void CBattleConsole::showAll(SDL_Surface * to)
{
Point textPos(pos.x + pos.w/2, pos.y + 11);
Point textPos(pos.x + pos.w/2, pos.y + 17);
if(ingcAlter.size())
{
@ -246,7 +241,7 @@ CBattleHero::~CBattleHero()
delete flag;
}
CBattleOptionsWindow::CBattleOptionsWindow(const SDL_Rect & position, CBattleInterface *owner): myInt(owner)
CBattleOptionsWindow::CBattleOptionsWindow(const SDL_Rect & position, CBattleInterface *owner)
{
OBJ_CONSTRUCTION_CAPTURING_ALL;
pos = position;

View File

@ -36,7 +36,6 @@ public:
std::string ingcAlter; //alternative text set by in-game console - very important!
int whoSetAlter; //who set alter text; 0 - battle interface or none, 1 - button
CBattleConsole();
~CBattleConsole(); //d-tor
void showAll(SDL_Surface * to = 0);
bool addText(const std::string &text); //adds text at the last position; returns false if failed (e.g. text longer than 70 characters)
void alterText(const std::string &text); //place string at alterTxt
@ -70,7 +69,6 @@ public:
class CBattleOptionsWindow : public CIntObject
{
private:
CBattleInterface * myInt;
CPicture * background;
CAdventureMapButton * setToDefault, * exit;
CHighlightableButton * viewGrid, * movementShadow, * mouseShadow;

View File

@ -23,7 +23,6 @@ class CCreatureAnimation : public CIntObject
{
private:
int totalEntries, DEFType, totalBlocks;
int length;
BMPPalette palette[256];
struct SEntry
{

View File

@ -75,8 +75,6 @@ class CDefHandler
{
private:
ui32 DEFType;
int length;
//ui32 * RWEntries;
struct SEntry
{
std::string name;

View File

@ -281,7 +281,6 @@ class CHeroItem : public CIntObject, public CWindowWithGarrison
std::vector<CIntObject *> artTabs;
CAnimImage *background;
CAnimImage *portrait;
CLabel *name;
CHeroArea *heroArea;

View File

@ -239,6 +239,12 @@ int main(int argc, char** argv)
putenv((char*)"SDL_VIDEO_WINDOW_POS");
putenv((char*)"SDL_VIDEO_CENTERED=1");
// Have effect on X11 system only (Linux).
// For whatever reason in fullscreen mode SDL takes "raw" mouse input from DGA X11 extension
// (DGA = Direct graphics access). Because this is raw input (before any speed\acceleration proceesing)
// it may result in very small \ very fast mouse when game in fullscreen mode
putenv((char*)"SDL_VIDEO_X11_DGAMOUSE=0");
CStopWatch total, pomtime;
std::cout.flags(std::ios::unitbuf);
logfile = new std::ofstream((GVCMIDirs.UserPath + "/VCMI_Client_log.txt").c_str());
@ -797,6 +803,9 @@ static void listenForEvents()
delete CGI->dobjinfo.get();
const_cast<CGameInfo*>(CGI)->dobjinfo = new CDefObjInfoHandler;
VLC->dobjinfo = const_cast<CGameInfo*>(CGI)->dobjinfo; // update dobjinfo pointer in VLC (used by modHandler::reload())
const_cast<CGameInfo*>(CGI)->dobjinfo->load();
const_cast<CGameInfo*>(CGI)->modh->reload(); //add info about new creatures to dobjinfo
};

View File

@ -1147,7 +1147,7 @@ template <typename Handler> void CPlayerInterface::serializeTempl( Handler &h, c
h & spellbookSettings;
//sleeping heroes
ui8 sleepingSize;
ui8 sleepingSize = 0; //fix for uninitialized warning
if (h.saving)
sleepingSize = sleepingHeroes.size();
h & sleepingSize;
@ -1165,7 +1165,7 @@ template <typename Handler> void CPlayerInterface::serializeTempl( Handler &h, c
}
//hero list order
ui8 heroListSize;
ui8 heroListSize = 0; //fix for uninitialized warning
if (h.saving)
heroListSize = wanderingHeroes.size();
else

View File

@ -453,13 +453,13 @@ void CClient::serialize( Handler &h, const int version )
}
else
{
ui8 players;
ui8 players = 0; //fix for uninitialized warning
h & players;
for(int i=0; i < players; i++)
{
std::string dllname;
ui8 pid;
ui8 pid = 0; //fix for uninitialized warning
h & pid & dllname;

View File

@ -4390,8 +4390,8 @@ void CArtPlace::setArtifact(const CArtifactInstance *art)
// so we want to replace text in [...] with a spell name
// however other language versions don't have name placeholder at all, so we have to be careful
int spellID = art->getGivenSpellID();
int nameStart = text.find_first_of('[');
int nameEnd = text.find_first_of(']', nameStart);
size_t nameStart = text.find_first_of('[');
size_t nameEnd = text.find_first_of(']', nameStart);
if(spellID >= 0)
{
if(nameStart != std::string::npos && nameEnd != std::string::npos)

View File

@ -182,10 +182,9 @@ void CBitmapFont::renderText(SDL_Surface * surface, const std::string & data, co
int posX = pos.x;
int posY = pos.y;
// Safe to remove but I would like to trace all cases of this. Please report on Mantis or send note to me
// Ivan
assert(data[0] != '{');
assert(data[data.size()-1] != '}');
// Should be used to detect incorrect text parsing. Disabled right now due to some old UI code (mostly pregame and battles)
//assert(data[0] != '{');
//assert(data[data.size()-1] != '}');
SDL_LockSurface(surface);
// for each symbol

View File

@ -1135,7 +1135,7 @@ void CGHeroInstance::Updatespecialty() //TODO: calculate special value of bonuse
{
if (hs->growsWithLevel)
{
const auto &creatures = VLC->creh->creatures;
//const auto &creatures = VLC->creh->creatures;
BOOST_FOREACH(Bonus * b, hs->getBonusList())
{