mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-02 23:07:36 +02:00
Fixed a few CWE-457
This commit is contained in:
parent
f11c54b5e9
commit
c4ab962cc0
@ -36,7 +36,7 @@
|
|||||||
#define LOGFL(text, formattingEl) print(boost::str(boost::format(text) % formattingEl))
|
#define LOGFL(text, formattingEl) print(boost::str(boost::format(text) % formattingEl))
|
||||||
|
|
||||||
CBattleAI::CBattleAI(void)
|
CBattleAI::CBattleAI(void)
|
||||||
: side(-1)
|
: side(-1), wasWaitingForRealize(false), wasUnlockingGs(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,6 +83,7 @@ struct SectorMap
|
|||||||
Sector()
|
Sector()
|
||||||
{
|
{
|
||||||
id = -1;
|
id = -1;
|
||||||
|
water = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -18,7 +18,9 @@ CClientState * CCS = nullptr;
|
|||||||
|
|
||||||
CGameInfo::CGameInfo()
|
CGameInfo::CGameInfo()
|
||||||
{
|
{
|
||||||
|
generaltexth = nullptr;
|
||||||
mh = nullptr;
|
mh = nullptr;
|
||||||
|
townh = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameInfo::setFromLib()
|
void CGameInfo::setFromLib()
|
||||||
|
@ -620,6 +620,7 @@ CSelectionScreen::CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMulti
|
|||||||
if (screenType == CMenuScreen::campaignList)
|
if (screenType == CMenuScreen::campaignList)
|
||||||
{
|
{
|
||||||
opt = nullptr;
|
opt = nullptr;
|
||||||
|
randMapTab = nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3912,6 +3913,7 @@ CSavingScreen::~CSavingScreen()
|
|||||||
ISelectionScreenInfo::ISelectionScreenInfo(const std::map<ui8, std::string> *Names /*= nullptr*/)
|
ISelectionScreenInfo::ISelectionScreenInfo(const std::map<ui8, std::string> *Names /*= nullptr*/)
|
||||||
{
|
{
|
||||||
multiPlayer = CMenuScreen::SINGLE_PLAYER;
|
multiPlayer = CMenuScreen::SINGLE_PLAYER;
|
||||||
|
screenType = CMenuScreen::mainMenu;
|
||||||
assert(!SEL);
|
assert(!SEL);
|
||||||
SEL = this;
|
SEL = this;
|
||||||
current = nullptr;
|
current = nullptr;
|
||||||
@ -4102,6 +4104,8 @@ void StartWithCurrentSettings::apply(CSelectionScreen *selScreen)
|
|||||||
|
|
||||||
CCampaignScreen::CCampaignButton::CCampaignButton(const JsonNode &config )
|
CCampaignScreen::CCampaignButton::CCampaignButton(const JsonNode &config )
|
||||||
{
|
{
|
||||||
|
OBJ_CONSTRUCTION_CAPTURING_ALL;
|
||||||
|
|
||||||
pos.x += config["x"].Float();
|
pos.x += config["x"].Float();
|
||||||
pos.y += config["y"].Float();
|
pos.y += config["y"].Float();
|
||||||
pos.w = 200;
|
pos.w = 200;
|
||||||
@ -4110,24 +4114,23 @@ CCampaignScreen::CCampaignButton::CCampaignButton(const JsonNode &config )
|
|||||||
campFile = config["file"].String();
|
campFile = config["file"].String();
|
||||||
video = config["video"].String();
|
video = config["video"].String();
|
||||||
|
|
||||||
OBJ_CONSTRUCTION_CAPTURING_ALL;
|
|
||||||
|
|
||||||
status = config["open"].Bool() ? CCampaignScreen::ENABLED : CCampaignScreen::DISABLED;
|
status = config["open"].Bool() ? CCampaignScreen::ENABLED : CCampaignScreen::DISABLED;
|
||||||
|
|
||||||
CCampaignHeader header = CCampaignHandler::getHeader(campFile);
|
CCampaignHeader header = CCampaignHandler::getHeader(campFile);
|
||||||
hoverText = header.name;
|
hoverText = header.name;
|
||||||
|
|
||||||
|
hoverLabel = nullptr;
|
||||||
if (status != CCampaignScreen::DISABLED)
|
if (status != CCampaignScreen::DISABLED)
|
||||||
{
|
{
|
||||||
addUsedEvents(LCLICK | HOVER);
|
addUsedEvents(LCLICK | HOVER);
|
||||||
image = new CPicture(config["image"].String());
|
new CPicture(config["image"].String());
|
||||||
|
|
||||||
hoverLabel = new CLabel(pos.w / 2, pos.h + 20, FONT_MEDIUM, CENTER, Colors::YELLOW, "");
|
hoverLabel = new CLabel(pos.w / 2, pos.h + 20, FONT_MEDIUM, CENTER, Colors::YELLOW, "");
|
||||||
parent->addChild(hoverLabel);
|
parent->addChild(hoverLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == CCampaignScreen::COMPLETED)
|
if (status == CCampaignScreen::COMPLETED)
|
||||||
checkMark = new CPicture("CAMPCHK");
|
new CPicture("CAMPCHK");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCampaignScreen::CCampaignButton::clickLeft(tribool down, bool previousState)
|
void CCampaignScreen::CCampaignButton::clickLeft(tribool down, bool previousState)
|
||||||
@ -4141,12 +4144,15 @@ void CCampaignScreen::CCampaignButton::clickLeft(tribool down, bool previousStat
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CCampaignScreen::CCampaignButton::hover(bool on)
|
void CCampaignScreen::CCampaignButton::hover(bool on)
|
||||||
|
{
|
||||||
|
if (hoverLabel)
|
||||||
{
|
{
|
||||||
if (on)
|
if (on)
|
||||||
hoverLabel->setText(hoverText); // Shows the name of the campaign when you get into the bounds of the button
|
hoverLabel->setText(hoverText); // Shows the name of the campaign when you get into the bounds of the button
|
||||||
else
|
else
|
||||||
hoverLabel->setText(" ");
|
hoverLabel->setText(" ");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CCampaignScreen::CCampaignButton::show(SDL_Surface * to)
|
void CCampaignScreen::CCampaignButton::show(SDL_Surface * to)
|
||||||
{
|
{
|
||||||
@ -4198,7 +4204,7 @@ CCampaignScreen::CCampaignScreen(const JsonNode &config)
|
|||||||
|
|
||||||
if (!config["exitbutton"].isNull())
|
if (!config["exitbutton"].isNull())
|
||||||
{
|
{
|
||||||
back = createExitButton(config["exitbutton"]);
|
CButton * back = createExitButton(config["exitbutton"]);
|
||||||
back->hoverable = true;
|
back->hoverable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,6 @@ class InfoCard : public CIntObject
|
|||||||
std::shared_ptr<CAnimation> sFlags;
|
std::shared_ptr<CAnimation> sFlags;
|
||||||
public:
|
public:
|
||||||
CPicture *bg;
|
CPicture *bg;
|
||||||
CMenuScreen::EState type;
|
|
||||||
|
|
||||||
bool network;
|
bool network;
|
||||||
bool chatOn; //if chat is shown, then description is hidden
|
bool chatOn; //if chat is shown, then description is hidden
|
||||||
@ -554,9 +553,6 @@ private:
|
|||||||
class CCampaignButton : public CIntObject
|
class CCampaignButton : public CIntObject
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
CPicture *image;
|
|
||||||
CPicture *checkMark;
|
|
||||||
|
|
||||||
CLabel *hoverLabel;
|
CLabel *hoverLabel;
|
||||||
CampaignStatus status;
|
CampaignStatus status;
|
||||||
|
|
||||||
@ -572,7 +568,6 @@ private:
|
|||||||
void show(SDL_Surface * to) override;
|
void show(SDL_Surface * to) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
CButton *back;
|
|
||||||
std::vector<CCampaignButton*> campButtons;
|
std::vector<CCampaignButton*> campButtons;
|
||||||
std::vector<CPicture*> images;
|
std::vector<CPicture*> images;
|
||||||
|
|
||||||
|
@ -49,13 +49,20 @@ static si64 lodSeek(void * opaque, si64 pos, int whence)
|
|||||||
|
|
||||||
CVideoPlayer::CVideoPlayer()
|
CVideoPlayer::CVideoPlayer()
|
||||||
{
|
{
|
||||||
|
stream = -1;
|
||||||
format = nullptr;
|
format = nullptr;
|
||||||
frame = nullptr;
|
codecContext = nullptr;
|
||||||
codec = nullptr;
|
codec = nullptr;
|
||||||
|
frame = nullptr;
|
||||||
sws = nullptr;
|
sws = nullptr;
|
||||||
|
context = nullptr;
|
||||||
texture = nullptr;
|
texture = nullptr;
|
||||||
dest = nullptr;
|
dest = nullptr;
|
||||||
context = nullptr;
|
destRect = genRect(0,0,0,0);
|
||||||
|
pos = genRect(0,0,0,0);
|
||||||
|
refreshWait = 0;
|
||||||
|
refreshCount = 0;
|
||||||
|
doLoop = false;
|
||||||
|
|
||||||
// Register codecs. TODO: May be overkill. Should call a
|
// Register codecs. TODO: May be overkill. Should call a
|
||||||
// combination of av_register_input_format() /
|
// combination of av_register_input_format() /
|
||||||
|
@ -134,10 +134,10 @@ bool CAttackAnimation::checkInitialConditions()
|
|||||||
|
|
||||||
CAttackAnimation::CAttackAnimation(CBattleInterface *_owner, const CStack *attacker, BattleHex _dest, const CStack *defender)
|
CAttackAnimation::CAttackAnimation(CBattleInterface *_owner, const CStack *attacker, BattleHex _dest, const CStack *defender)
|
||||||
: CBattleStackAnimation(_owner, attacker),
|
: CBattleStackAnimation(_owner, attacker),
|
||||||
|
shooting(false), group(CCreatureAnim::SHOOT_FRONT),
|
||||||
soundPlayed(false),
|
soundPlayed(false),
|
||||||
dest(_dest), attackedStack(defender), attackingStack(attacker)
|
dest(_dest), attackedStack(defender), attackingStack(attacker)
|
||||||
{
|
{
|
||||||
|
|
||||||
assert(attackingStack && "attackingStack is nullptr in CBattleAttack::CBattleAttack !\n");
|
assert(attackingStack && "attackingStack is nullptr in CBattleAttack::CBattleAttack !\n");
|
||||||
bool isCatapultAttack = attackingStack->hasBonusOfType(Bonus::CATAPULT)
|
bool isCatapultAttack = attackingStack->hasBonusOfType(Bonus::CATAPULT)
|
||||||
&& owner->getCurrentPlayerInterface()->cb->battleHexToWallPart(_dest) >= 0;
|
&& owner->getCurrentPlayerInterface()->cb->battleHexToWallPart(_dest) >= 0;
|
||||||
@ -150,7 +150,7 @@ CAttackAnimation::CAttackAnimation(CBattleInterface *_owner, const CStack *attac
|
|||||||
CDefenceAnimation::CDefenceAnimation(StackAttackedInfo _attackedInfo, CBattleInterface * _owner)
|
CDefenceAnimation::CDefenceAnimation(StackAttackedInfo _attackedInfo, CBattleInterface * _owner)
|
||||||
: CBattleStackAnimation(_owner, _attackedInfo.defender),
|
: CBattleStackAnimation(_owner, _attackedInfo.defender),
|
||||||
attacker(_attackedInfo.attacker), rangedAttack(_attackedInfo.indirectAttack),
|
attacker(_attackedInfo.attacker), rangedAttack(_attackedInfo.indirectAttack),
|
||||||
killed(_attackedInfo.killed)
|
killed(_attackedInfo.killed), timeToWait(0)
|
||||||
{
|
{
|
||||||
logAnim->debugStream() << "Created defence anim for " << _attackedInfo.defender->getName();
|
logAnim->debugStream() << "Created defence anim for " << _attackedInfo.defender->getName();
|
||||||
}
|
}
|
||||||
|
@ -1557,8 +1557,7 @@ bool CFadeAnimation::isFinished() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
CFadeAnimation::CFadeAnimation()
|
CFadeAnimation::CFadeAnimation()
|
||||||
: fadingSurface(nullptr),
|
: delta(0), fadingSurface(nullptr), fading(false), fadingCounter(0), shouldFreeSurface(false),
|
||||||
fading(false),
|
|
||||||
fadingMode(EMode::NONE)
|
fadingMode(EMode::NONE)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -430,7 +430,7 @@ void CGuiHandler::renderFrame()
|
|||||||
|
|
||||||
|
|
||||||
CGuiHandler::CGuiHandler()
|
CGuiHandler::CGuiHandler()
|
||||||
:lastClick(-500, -500)
|
: lastClick(-500, -500),lastClickTime(0), defActionsDef(0), captureChildren(false)
|
||||||
{
|
{
|
||||||
curInt = nullptr;
|
curInt = nullptr;
|
||||||
current = nullptr;
|
current = nullptr;
|
||||||
@ -546,6 +546,8 @@ CFramerateManager::CFramerateManager(int rate)
|
|||||||
this->fps = 0;
|
this->fps = 0;
|
||||||
this->accumulatedFrames = 0;
|
this->accumulatedFrames = 0;
|
||||||
this->accumulatedTime = 0;
|
this->accumulatedTime = 0;
|
||||||
|
this->lastticks = 0;
|
||||||
|
this->timeElapsed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFramerateManager::init()
|
void CFramerateManager::init()
|
||||||
|
@ -77,6 +77,10 @@ public:
|
|||||||
Point lastClick;
|
Point lastClick;
|
||||||
unsigned lastClickTime;
|
unsigned lastClickTime;
|
||||||
|
|
||||||
|
ui8 defActionsDef; //default auto actions
|
||||||
|
bool captureChildren; //all newly created objects will get their parents from stack and will be added to parents children list
|
||||||
|
std::list<CIntObject *> createdObj; //stack of objs being created
|
||||||
|
|
||||||
CGuiHandler();
|
CGuiHandler();
|
||||||
~CGuiHandler();
|
~CGuiHandler();
|
||||||
|
|
||||||
@ -99,9 +103,6 @@ public:
|
|||||||
void fakeMouseMove();
|
void fakeMouseMove();
|
||||||
void breakEventHandling(); //current event won't be propagated anymore
|
void breakEventHandling(); //current event won't be propagated anymore
|
||||||
void drawFPSCounter(); // draws the FPS to the upper left corner of the screen
|
void drawFPSCounter(); // draws the FPS to the upper left corner of the screen
|
||||||
ui8 defActionsDef; //default auto actions
|
|
||||||
ui8 captureChildren; //all newly created objects will get their parents from stack and will be added to parents children list
|
|
||||||
std::list<CIntObject *> createdObj; //stack of objs being created
|
|
||||||
|
|
||||||
static SDL_Keycode arrowToNum(SDL_Keycode key); //converts arrow key to according numpad key
|
static SDL_Keycode arrowToNum(SDL_Keycode key); //converts arrow key to according numpad key
|
||||||
static SDL_Keycode numToDigit(SDL_Keycode key);//converts numpad digit key to normal digit key
|
static SDL_Keycode numToDigit(SDL_Keycode key);//converts numpad digit key to normal digit key
|
||||||
|
@ -1377,6 +1377,9 @@ CMapHandler::CMapHandler()
|
|||||||
worldViewBlitter = new CMapWorldViewBlitter(this);
|
worldViewBlitter = new CMapWorldViewBlitter(this);
|
||||||
puzzleViewBlitter = new CMapPuzzleViewBlitter(this);
|
puzzleViewBlitter = new CMapPuzzleViewBlitter(this);
|
||||||
fadeAnimCounter = 0;
|
fadeAnimCounter = 0;
|
||||||
|
map = nullptr;
|
||||||
|
tilesW = tilesH = 0;
|
||||||
|
offsetX = offsetY = 0;
|
||||||
|
|
||||||
egdeAnimation = make_unique<CAnimation>("EDG");
|
egdeAnimation = make_unique<CAnimation>("EDG");
|
||||||
egdeAnimation->preload();
|
egdeAnimation->preload();
|
||||||
@ -1413,6 +1416,11 @@ void CMapHandler::discardWorldViewCache()
|
|||||||
cache.discardWorldViewCache();
|
cache.discardWorldViewCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CMapHandler::CMapCache::CMapCache()
|
||||||
|
{
|
||||||
|
worldViewCachedScale = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void CMapHandler::CMapCache::discardWorldViewCache()
|
void CMapHandler::CMapCache::discardWorldViewCache()
|
||||||
{
|
{
|
||||||
for(auto & cache : data)
|
for(auto & cache : data)
|
||||||
|
@ -162,6 +162,7 @@ class CMapHandler
|
|||||||
std::array< std::map<intptr_t, std::unique_ptr<IImage>>, (ui8)EMapCacheType::AFTER_LAST> data;
|
std::array< std::map<intptr_t, std::unique_ptr<IImage>>, (ui8)EMapCacheType::AFTER_LAST> data;
|
||||||
float worldViewCachedScale;
|
float worldViewCachedScale;
|
||||||
public:
|
public:
|
||||||
|
CMapCache();
|
||||||
/// destroys all cached data (frees surfaces)
|
/// destroys all cached data (frees surfaces)
|
||||||
void discardWorldViewCache();
|
void discardWorldViewCache();
|
||||||
/// updates scale and determines if currently cached data is still valid
|
/// updates scale and determines if currently cached data is still valid
|
||||||
|
@ -199,9 +199,6 @@ class CSlider : public CIntObject
|
|||||||
int capacity;//how many elements can be active at same time (e.g. hero list = 5)
|
int capacity;//how many elements can be active at same time (e.g. hero list = 5)
|
||||||
int positions; //number of highest position (0 if there is only one)
|
int positions; //number of highest position (0 if there is only one)
|
||||||
bool horizontal;
|
bool horizontal;
|
||||||
bool wheelScrolling;
|
|
||||||
bool keyScrolling;
|
|
||||||
|
|
||||||
int amount; //total amount of elements (e.g. hero list = 0-8)
|
int amount; //total amount of elements (e.g. hero list = 0-8)
|
||||||
int value; //first active element
|
int value; //first active element
|
||||||
int scrollStep; // how many elements will be scrolled via one click, default = 1
|
int scrollStep; // how many elements will be scrolled via one click, default = 1
|
||||||
|
@ -1329,6 +1329,7 @@ bool IPropagator::shouldBeAttached(CBonusSystemNode *dest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CPropagatorNodeType::CPropagatorNodeType()
|
CPropagatorNodeType::CPropagatorNodeType()
|
||||||
|
:nodeType(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1349,6 +1350,7 @@ CreatureNativeTerrainLimiter::CreatureNativeTerrainLimiter(int TerrainType)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CreatureNativeTerrainLimiter::CreatureNativeTerrainLimiter()
|
CreatureNativeTerrainLimiter::CreatureNativeTerrainLimiter()
|
||||||
|
: terrainType(-1)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1366,6 +1368,7 @@ CreatureFactionLimiter::CreatureFactionLimiter(int Faction)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CreatureFactionLimiter::CreatureFactionLimiter()
|
CreatureFactionLimiter::CreatureFactionLimiter()
|
||||||
|
: faction(-1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1376,6 +1379,7 @@ int CreatureFactionLimiter::limit(const BonusLimitationContext &context) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
CreatureAlignmentLimiter::CreatureAlignmentLimiter()
|
CreatureAlignmentLimiter::CreatureAlignmentLimiter()
|
||||||
|
: alignment(-1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ public:
|
|||||||
EBonusType bonusType;
|
EBonusType bonusType;
|
||||||
ui16 bonusID; //ID of skill/spell
|
ui16 bonusID; //ID of skill/spell
|
||||||
|
|
||||||
CGScholar() : bonusType(EBonusType::RANDOM){};
|
CGScholar() : bonusType(EBonusType::RANDOM),bonusID(0){};
|
||||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||||
void initObj(CRandomGenerator & rand) override;
|
void initObj(CRandomGenerator & rand) override;
|
||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user