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

Fixed uninitialized field

This commit is contained in:
AlexVinS 2016-08-18 15:03:20 +03:00
parent 439aeecc8b
commit 89ce1a4509

View File

@ -40,7 +40,7 @@
#define BONUS_ITEM(x) { #x, Bonus::x }, #define BONUS_ITEM(x) { #x, Bonus::x },
const std::map<std::string, ui16> bonusDurationMap = const std::map<std::string, ui16> bonusDurationMap =
{ {
BONUS_ITEM(PERMANENT) BONUS_ITEM(PERMANENT)
BONUS_ITEM(ONE_BATTLE) BONUS_ITEM(ONE_BATTLE)
@ -54,7 +54,7 @@ const std::map<std::string, ui16> bonusDurationMap =
BONUS_ITEM(COMMANDER_KILLED) BONUS_ITEM(COMMANDER_KILLED)
}; };
const std::map<std::string, Bonus::LimitEffect> bonusLimitEffect = const std::map<std::string, Bonus::LimitEffect> bonusLimitEffect =
{ {
BONUS_ITEM(NO_LIMIT) BONUS_ITEM(NO_LIMIT)
BONUS_ITEM(ONLY_DISTANCE_FIGHT) BONUS_ITEM(ONLY_DISTANCE_FIGHT)
@ -486,7 +486,7 @@ ui32 IBonusBearer::Speed( int turn /*= 0*/ , bool useBind /* = false*/) const
} }
return valOfBonuses(Selector::type(Bonus::STACKS_SPEED).And(Selector::turns(turn))); return valOfBonuses(Selector::type(Bonus::STACKS_SPEED).And(Selector::turns(turn)));
} }
bool IBonusBearer::isLiving() const //TODO: theoreticaly there exists "LIVING" bonus in stack experience documentation bool IBonusBearer::isLiving() const //TODO: theoreticaly there exists "LIVING" bonus in stack experience documentation
{ {
@ -505,7 +505,7 @@ const TBonusListPtr IBonusBearer::getSpellBonuses() const
.And(CSelector([](const Bonus * b)->bool .And(CSelector([](const Bonus * b)->bool
{ {
return b->type != Bonus::NONE; return b->type != Bonus::NONE;
})); }));
return getBonuses(selector, Selector::anyRange(), cachingStr.str()); return getBonuses(selector, Selector::anyRange(), cachingStr.str());
} }
@ -870,7 +870,7 @@ void CBonusSystemNode::childDetached(CBonusSystemNode *child)
logBonus->errorStream() << std::string("Error!" + child->nodeName() + " #cannot be detached from# " + nodeName()); logBonus->errorStream() << std::string("Error!" + child->nodeName() + " #cannot be detached from# " + nodeName());
assert(0); assert(0);
} }
} }
void CBonusSystemNode::detachFromAll() void CBonusSystemNode::detachFromAll()
@ -1108,7 +1108,7 @@ const CSpell * Bonus::sourceSpell() const
std::string Bonus::Description() const std::string Bonus::Description() const
{ {
std::ostringstream str; std::ostringstream str;
if(description.empty()) if(description.empty())
switch(source) switch(source)
{ {
@ -1126,15 +1126,15 @@ std::string Bonus::Description() const
break; break;
default: default:
//todo: handle all possible sources //todo: handle all possible sources
str << "Unknown"; str << "Unknown";
break; break;
} }
else else
str << description; str << description;
if(val != 0) if(val != 0)
str << " " << std::showpos << val; str << " " << std::showpos << val;
return str.str(); return str.str();
} }
@ -1156,18 +1156,19 @@ Bonus::Bonus(ui16 Dur, BonusType Type, BonusSource Src, si32 Val, ui32 ID, si32
effectRange = NO_LIMIT; effectRange = NO_LIMIT;
} }
Bonus::Bonus() Bonus::Bonus()
{ {
duration = PERMANENT; duration = PERMANENT;
turnsRemain = 0; turnsRemain = 0;
type = NONE; type = NONE;
subtype = -1; subtype = -1;
additionalInfo = -1; additionalInfo = -1;
valType = ADDITIVE_VALUE; valType = ADDITIVE_VALUE;
effectRange = NO_LIMIT; effectRange = NO_LIMIT;
val = 0; val = 0;
source = OTHER; source = OTHER;
sid = 0;
} }
Bonus::~Bonus() Bonus::~Bonus()