mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-03 14:52:11 +02:00
More fixes for uninitialized fields part 2
This commit is contained in:
parent
ab06cfd586
commit
bf6ad4e783
@ -24,6 +24,15 @@
|
|||||||
#include "CRandomGenerator.h"
|
#include "CRandomGenerator.h"
|
||||||
#include "mapObjects/CGTownInstance.h"
|
#include "mapObjects/CGTownInstance.h"
|
||||||
|
|
||||||
|
SiegeInfo::SiegeInfo()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < wallState.size(); ++i)
|
||||||
|
{
|
||||||
|
wallState[i] = EWallState::NONE;
|
||||||
|
}
|
||||||
|
gateState = EGateState::NONE;
|
||||||
|
}
|
||||||
|
|
||||||
const CStack * BattleInfo::getNextStack() const
|
const CStack * BattleInfo::getNextStack() const
|
||||||
{
|
{
|
||||||
std::vector<const CStack *> hlp;
|
std::vector<const CStack *> hlp;
|
||||||
@ -280,7 +289,7 @@ struct RangeGenerator
|
|||||||
BattleInfo * BattleInfo::setupBattle( int3 tile, ETerrainType terrain, BFieldType battlefieldType, const CArmedInstance *armies[2], const CGHeroInstance * heroes[2], bool creatureBank, const CGTownInstance *town )
|
BattleInfo * BattleInfo::setupBattle( int3 tile, ETerrainType terrain, BFieldType battlefieldType, const CArmedInstance *armies[2], const CGHeroInstance * heroes[2], bool creatureBank, const CGTownInstance *town )
|
||||||
{
|
{
|
||||||
CMP_stack cmpst;
|
CMP_stack cmpst;
|
||||||
auto curB = new BattleInfo;
|
auto curB = new BattleInfo();
|
||||||
|
|
||||||
for(auto i = 0u; i < curB->sides.size(); i++)
|
for(auto i = 0u; i < curB->sides.size(); i++)
|
||||||
curB->sides[i].init(heroes[i], armies[i]);
|
curB->sides[i].init(heroes[i], armies[i]);
|
||||||
@ -722,6 +731,9 @@ CStack * BattleInfo::getStack(int stackID, bool onlyAlive /*= true*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
BattleInfo::BattleInfo()
|
BattleInfo::BattleInfo()
|
||||||
|
: round(-1), activeStack(-1), selectedStack(-1), town(nullptr), tile(-1,-1,-1),
|
||||||
|
battlefieldType(BFieldType::NONE), terrainType(ETerrainType::WRONG),
|
||||||
|
tacticsSide(0), tacticDistance(0)
|
||||||
{
|
{
|
||||||
setBattle(this);
|
setBattle(this);
|
||||||
setNodeType(BATTLE);
|
setNodeType(BATTLE);
|
||||||
@ -739,7 +751,8 @@ CGHeroInstance * BattleInfo::battleGetFightingHero(ui8 side) const
|
|||||||
|
|
||||||
CStack::CStack(const CStackInstance *Base, PlayerColor O, int I, bool AO, SlotID S)
|
CStack::CStack(const CStackInstance *Base, PlayerColor O, int I, bool AO, SlotID S)
|
||||||
: base(Base), ID(I), owner(O), slot(S), attackerOwned(AO),
|
: base(Base), ID(I), owner(O), slot(S), attackerOwned(AO),
|
||||||
counterAttacksPerformed(0),counterAttacksTotalCache(0), cloneID(-1)
|
counterAttacksPerformed(0),counterAttacksTotalCache(0), cloneID(-1),
|
||||||
|
firstHPleft(-1), position(), shots(0), casts(0), resurrected(0)
|
||||||
{
|
{
|
||||||
assert(base);
|
assert(base);
|
||||||
type = base->type;
|
type = base->type;
|
||||||
@ -752,8 +765,9 @@ CStack::CStack()
|
|||||||
setNodeType(STACK_BATTLE);
|
setNodeType(STACK_BATTLE);
|
||||||
}
|
}
|
||||||
CStack::CStack(const CStackBasicDescriptor *stack, PlayerColor O, int I, bool AO, SlotID S)
|
CStack::CStack(const CStackBasicDescriptor *stack, PlayerColor O, int I, bool AO, SlotID S)
|
||||||
: base(nullptr), ID(I), owner(O), slot(S), attackerOwned(AO), counterAttacksPerformed(0),
|
: base(nullptr), ID(I), owner(O), slot(S), attackerOwned(AO),
|
||||||
cloneID(-1)
|
counterAttacksPerformed(0), counterAttacksTotalCache(0), cloneID(-1),
|
||||||
|
firstHPleft(-1), position(), shots(0), casts(0), resurrected(0)
|
||||||
{
|
{
|
||||||
type = stack->type;
|
type = stack->type;
|
||||||
count = baseAmount = stack->count;
|
count = baseAmount = stack->count;
|
||||||
@ -774,6 +788,10 @@ void CStack::init()
|
|||||||
counterAttacksPerformed = 0;
|
counterAttacksPerformed = 0;
|
||||||
counterAttacksTotalCache = 0;
|
counterAttacksTotalCache = 0;
|
||||||
cloneID = -1;
|
cloneID = -1;
|
||||||
|
|
||||||
|
shots = 0;
|
||||||
|
casts = 0;
|
||||||
|
resurrected = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CStack::postInit()
|
void CStack::postInit()
|
||||||
@ -1267,6 +1285,7 @@ CMP_stack::CMP_stack( int Phase /*= 1*/, int Turn )
|
|||||||
|
|
||||||
SideInBattle::SideInBattle()
|
SideInBattle::SideInBattle()
|
||||||
{
|
{
|
||||||
|
color = PlayerColor::CANNOT_DETERMINE;
|
||||||
hero = nullptr;
|
hero = nullptr;
|
||||||
armyObject = nullptr;
|
armyObject = nullptr;
|
||||||
castSpellsCount = 0;
|
castSpellsCount = 0;
|
||||||
|
@ -35,6 +35,8 @@ struct DLL_LINKAGE SiegeInfo
|
|||||||
std::array<si8, EWallPart::PARTS_COUNT> wallState;
|
std::array<si8, EWallPart::PARTS_COUNT> wallState;
|
||||||
EGateState gateState;
|
EGateState gateState;
|
||||||
|
|
||||||
|
SiegeInfo();
|
||||||
|
|
||||||
// return EWallState decreased by value of damage points
|
// return EWallState decreased by value of damage points
|
||||||
static EWallState::EWallState applyDamage(EWallState::EWallState state, unsigned int value)
|
static EWallState::EWallState applyDamage(EWallState::EWallState state, unsigned int value)
|
||||||
{
|
{
|
||||||
|
@ -177,6 +177,7 @@ static void AddAbility(CCreature *cre, const JsonVector &ability_vec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CCreatureHandler::CCreatureHandler()
|
CCreatureHandler::CCreatureHandler()
|
||||||
|
: expAfterUpgrade(0)
|
||||||
{
|
{
|
||||||
VLC->creh = this;
|
VLC->creh = this;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user