mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-15 01:24:45 +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:
@ -106,8 +106,8 @@ CAttackAnimation::CAttackAnimation(CBattleInterface *_owner, const CStack *attac
|
|||||||
}
|
}
|
||||||
|
|
||||||
CDefenceAnimation::CDefenceAnimation(StackAttackedInfo _attackedInfo, CBattleInterface * _owner)
|
CDefenceAnimation::CDefenceAnimation(StackAttackedInfo _attackedInfo, CBattleInterface * _owner)
|
||||||
: CBattleStackAnimation(_owner, _attackedInfo.defender), dmg(_attackedInfo.dmg),
|
: CBattleStackAnimation(_owner, _attackedInfo.defender),
|
||||||
amountKilled(_attackedInfo.amountKilled), attacker(_attackedInfo.attacker), byShooting(_attackedInfo.byShooting),
|
attacker(_attackedInfo.attacker), byShooting(_attackedInfo.byShooting),
|
||||||
killed(_attackedInfo.killed)
|
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)
|
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()
|
bool CShootingAnimation::init()
|
||||||
|
@ -70,8 +70,6 @@ class CDefenceAnimation : public CBattleStackAnimation
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
//std::vector<StackAttackedInfo> attackedInfos;
|
//std::vector<StackAttackedInfo> attackedInfos;
|
||||||
int dmg; //damage dealt
|
|
||||||
int amountKilled; //how many creatures in stack has been killed
|
|
||||||
const CStack * attacker; //attacking stack
|
const CStack * attacker; //attacking stack
|
||||||
bool byShooting; //if true, stack has been attacked by shooting
|
bool byShooting; //if true, stack has been attacked by shooting
|
||||||
bool killed; //if true, stack has been killed
|
bool killed; //if true, stack has been killed
|
||||||
@ -196,7 +194,6 @@ class CShootingAnimation : public CAttackAnimation
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int catapultDamage;
|
int catapultDamage;
|
||||||
bool catapult;
|
|
||||||
public:
|
public:
|
||||||
bool init();
|
bool init();
|
||||||
void nextFrame();
|
void nextFrame();
|
||||||
|
@ -25,14 +25,9 @@
|
|||||||
#include "../CCreatureWindow.h"
|
#include "../CCreatureWindow.h"
|
||||||
#include "../CMessage.h"
|
#include "../CMessage.h"
|
||||||
|
|
||||||
CBattleConsole::~CBattleConsole()
|
|
||||||
{
|
|
||||||
texts.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CBattleConsole::showAll(SDL_Surface * to)
|
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())
|
if(ingcAlter.size())
|
||||||
{
|
{
|
||||||
@ -246,7 +241,7 @@ CBattleHero::~CBattleHero()
|
|||||||
delete flag;
|
delete flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
CBattleOptionsWindow::CBattleOptionsWindow(const SDL_Rect & position, CBattleInterface *owner): myInt(owner)
|
CBattleOptionsWindow::CBattleOptionsWindow(const SDL_Rect & position, CBattleInterface *owner)
|
||||||
{
|
{
|
||||||
OBJ_CONSTRUCTION_CAPTURING_ALL;
|
OBJ_CONSTRUCTION_CAPTURING_ALL;
|
||||||
pos = position;
|
pos = position;
|
||||||
|
@ -36,7 +36,6 @@ public:
|
|||||||
std::string ingcAlter; //alternative text set by in-game console - very important!
|
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
|
int whoSetAlter; //who set alter text; 0 - battle interface or none, 1 - button
|
||||||
CBattleConsole();
|
CBattleConsole();
|
||||||
~CBattleConsole(); //d-tor
|
|
||||||
void showAll(SDL_Surface * to = 0);
|
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)
|
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
|
void alterText(const std::string &text); //place string at alterTxt
|
||||||
@ -70,7 +69,6 @@ public:
|
|||||||
class CBattleOptionsWindow : public CIntObject
|
class CBattleOptionsWindow : public CIntObject
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
CBattleInterface * myInt;
|
|
||||||
CPicture * background;
|
CPicture * background;
|
||||||
CAdventureMapButton * setToDefault, * exit;
|
CAdventureMapButton * setToDefault, * exit;
|
||||||
CHighlightableButton * viewGrid, * movementShadow, * mouseShadow;
|
CHighlightableButton * viewGrid, * movementShadow, * mouseShadow;
|
||||||
|
@ -23,7 +23,6 @@ class CCreatureAnimation : public CIntObject
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int totalEntries, DEFType, totalBlocks;
|
int totalEntries, DEFType, totalBlocks;
|
||||||
int length;
|
|
||||||
BMPPalette palette[256];
|
BMPPalette palette[256];
|
||||||
struct SEntry
|
struct SEntry
|
||||||
{
|
{
|
||||||
|
@ -75,8 +75,6 @@ class CDefHandler
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
ui32 DEFType;
|
ui32 DEFType;
|
||||||
int length;
|
|
||||||
//ui32 * RWEntries;
|
|
||||||
struct SEntry
|
struct SEntry
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
|
@ -281,7 +281,6 @@ class CHeroItem : public CIntObject, public CWindowWithGarrison
|
|||||||
|
|
||||||
std::vector<CIntObject *> artTabs;
|
std::vector<CIntObject *> artTabs;
|
||||||
|
|
||||||
CAnimImage *background;
|
|
||||||
CAnimImage *portrait;
|
CAnimImage *portrait;
|
||||||
CLabel *name;
|
CLabel *name;
|
||||||
CHeroArea *heroArea;
|
CHeroArea *heroArea;
|
||||||
|
@ -239,6 +239,12 @@ int main(int argc, char** argv)
|
|||||||
putenv((char*)"SDL_VIDEO_WINDOW_POS");
|
putenv((char*)"SDL_VIDEO_WINDOW_POS");
|
||||||
putenv((char*)"SDL_VIDEO_CENTERED=1");
|
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;
|
CStopWatch total, pomtime;
|
||||||
std::cout.flags(std::ios::unitbuf);
|
std::cout.flags(std::ios::unitbuf);
|
||||||
logfile = new std::ofstream((GVCMIDirs.UserPath + "/VCMI_Client_log.txt").c_str());
|
logfile = new std::ofstream((GVCMIDirs.UserPath + "/VCMI_Client_log.txt").c_str());
|
||||||
@ -797,6 +803,9 @@ static void listenForEvents()
|
|||||||
|
|
||||||
delete CGI->dobjinfo.get();
|
delete CGI->dobjinfo.get();
|
||||||
const_cast<CGameInfo*>(CGI)->dobjinfo = new CDefObjInfoHandler;
|
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)->dobjinfo->load();
|
||||||
const_cast<CGameInfo*>(CGI)->modh->reload(); //add info about new creatures to dobjinfo
|
const_cast<CGameInfo*>(CGI)->modh->reload(); //add info about new creatures to dobjinfo
|
||||||
};
|
};
|
||||||
|
@ -1147,7 +1147,7 @@ template <typename Handler> void CPlayerInterface::serializeTempl( Handler &h, c
|
|||||||
h & spellbookSettings;
|
h & spellbookSettings;
|
||||||
|
|
||||||
//sleeping heroes
|
//sleeping heroes
|
||||||
ui8 sleepingSize;
|
ui8 sleepingSize = 0; //fix for uninitialized warning
|
||||||
if (h.saving)
|
if (h.saving)
|
||||||
sleepingSize = sleepingHeroes.size();
|
sleepingSize = sleepingHeroes.size();
|
||||||
h & sleepingSize;
|
h & sleepingSize;
|
||||||
@ -1165,7 +1165,7 @@ template <typename Handler> void CPlayerInterface::serializeTempl( Handler &h, c
|
|||||||
}
|
}
|
||||||
|
|
||||||
//hero list order
|
//hero list order
|
||||||
ui8 heroListSize;
|
ui8 heroListSize = 0; //fix for uninitialized warning
|
||||||
if (h.saving)
|
if (h.saving)
|
||||||
heroListSize = wanderingHeroes.size();
|
heroListSize = wanderingHeroes.size();
|
||||||
else
|
else
|
||||||
|
@ -453,13 +453,13 @@ void CClient::serialize( Handler &h, const int version )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui8 players;
|
ui8 players = 0; //fix for uninitialized warning
|
||||||
h & players;
|
h & players;
|
||||||
|
|
||||||
for(int i=0; i < players; i++)
|
for(int i=0; i < players; i++)
|
||||||
{
|
{
|
||||||
std::string dllname;
|
std::string dllname;
|
||||||
ui8 pid;
|
ui8 pid = 0; //fix for uninitialized warning
|
||||||
h & pid & dllname;
|
h & pid & dllname;
|
||||||
|
|
||||||
|
|
||||||
|
@ -4390,8 +4390,8 @@ void CArtPlace::setArtifact(const CArtifactInstance *art)
|
|||||||
// so we want to replace text in [...] with a spell name
|
// 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
|
// however other language versions don't have name placeholder at all, so we have to be careful
|
||||||
int spellID = art->getGivenSpellID();
|
int spellID = art->getGivenSpellID();
|
||||||
int nameStart = text.find_first_of('[');
|
size_t nameStart = text.find_first_of('[');
|
||||||
int nameEnd = text.find_first_of(']', nameStart);
|
size_t nameEnd = text.find_first_of(']', nameStart);
|
||||||
if(spellID >= 0)
|
if(spellID >= 0)
|
||||||
{
|
{
|
||||||
if(nameStart != std::string::npos && nameEnd != std::string::npos)
|
if(nameStart != std::string::npos && nameEnd != std::string::npos)
|
||||||
|
@ -182,10 +182,9 @@ void CBitmapFont::renderText(SDL_Surface * surface, const std::string & data, co
|
|||||||
int posX = pos.x;
|
int posX = pos.x;
|
||||||
int posY = pos.y;
|
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
|
// Should be used to detect incorrect text parsing. Disabled right now due to some old UI code (mostly pregame and battles)
|
||||||
// Ivan
|
//assert(data[0] != '{');
|
||||||
assert(data[0] != '{');
|
//assert(data[data.size()-1] != '}');
|
||||||
assert(data[data.size()-1] != '}');
|
|
||||||
|
|
||||||
SDL_LockSurface(surface);
|
SDL_LockSurface(surface);
|
||||||
// for each symbol
|
// for each symbol
|
||||||
|
@ -1135,7 +1135,7 @@ void CGHeroInstance::Updatespecialty() //TODO: calculate special value of bonuse
|
|||||||
{
|
{
|
||||||
if (hs->growsWithLevel)
|
if (hs->growsWithLevel)
|
||||||
{
|
{
|
||||||
const auto &creatures = VLC->creh->creatures;
|
//const auto &creatures = VLC->creh->creatures;
|
||||||
|
|
||||||
BOOST_FOREACH(Bonus * b, hs->getBonusList())
|
BOOST_FOREACH(Bonus * b, hs->getBonusList())
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user