mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-03 00:46:55 +02:00
A number of fixes. Banks serialization, doubling spell effects, week of plague.
This commit is contained in:
@ -1128,7 +1128,7 @@ int CCastleInterface::CCreaInfo::AddToString(std::string from, std::string & to,
|
|||||||
{
|
{
|
||||||
if (!numb)
|
if (!numb)
|
||||||
return 0;//do not add string if 0
|
return 0;//do not add string if 0
|
||||||
boost::algorithm::replace_first(from,"%+d", "+"+boost::lexical_cast<std::string>(numb));
|
boost::algorithm::replace_first(from,"%+d", (numb > 0 ? "+" : "")+boost::lexical_cast<std::string>(numb)); //negative values don't need "+"
|
||||||
to+="\n"+from;
|
to+="\n"+from;
|
||||||
return numb;
|
return numb;
|
||||||
}
|
}
|
||||||
@ -1157,7 +1157,7 @@ void CCastleInterface::CCreaInfo::clickRight(tribool down, bool previousState)
|
|||||||
else if ( bld.find(8)!=bld.end())//else if citadel+50% to basic
|
else if ( bld.find(8)!=bld.end())//else if citadel+50% to basic
|
||||||
summ+=AddToString(CGI->buildh->buildings[ci->town->subID][8]->Name()+" %+d",descr,summ/2);
|
summ+=AddToString(CGI->buildh->buildings[ci->town->subID][8]->Name()+" %+d",descr,summ/2);
|
||||||
|
|
||||||
summ+=AddToString(CGI->generaltexth->allTexts[63] + " %+d",descr, //plague
|
summ+=AddToString(CGI->generaltexth->allTexts[63] + " %+d",descr, //double growth or plague
|
||||||
summ * CGI->creh->creatures[crid]->valOfBonuses(Bonus::CREATURE_GROWTH_PERCENT)/100);
|
summ * CGI->creh->creatures[crid]->valOfBonuses(Bonus::CREATURE_GROWTH_PERCENT)/100);
|
||||||
|
|
||||||
summ+=AddToString(CGI->generaltexth->artifNames[133] + " %+d",descr,
|
summ+=AddToString(CGI->generaltexth->artifNames[133] + " %+d",descr,
|
||||||
|
@ -1052,7 +1052,7 @@ class DLL_EXPORT CBank : public CArmedInstance
|
|||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
{
|
{
|
||||||
h & static_cast<CGObjectInstance&>(*this);
|
h & static_cast<CArmedInstance&>(*this);
|
||||||
h & index & multiplier & artifacts & daycounter & bc;
|
h & index & multiplier & artifacts & daycounter & bc;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -969,6 +969,7 @@ std::vector<si32> CStack::activeSpells() const
|
|||||||
BonusList spellEffects = getSpellBonuses();
|
BonusList spellEffects = getSpellBonuses();
|
||||||
for(BonusList::const_iterator it = spellEffects.begin(); it != spellEffects.end(); it++)
|
for(BonusList::const_iterator it = spellEffects.begin(); it != spellEffects.end(); it++)
|
||||||
{
|
{
|
||||||
|
if (!vstd::contains(ret, it->id)) //do not duplicate spells with multiple effects
|
||||||
ret.push_back(it->id);
|
ret.push_back(it->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1219,12 +1219,17 @@ void CGameHandler::newTurn()
|
|||||||
for (int k=0; k < CREATURES_PER_TOWN; k++) //creature growths
|
for (int k=0; k < CREATURES_PER_TOWN; k++) //creature growths
|
||||||
{
|
{
|
||||||
if((**j).creatureDwelling(k))//there is dwelling (k-level)
|
if((**j).creatureDwelling(k))//there is dwelling (k-level)
|
||||||
|
{
|
||||||
|
if (n.specialWeek == NewTurn::PLAGUE)
|
||||||
|
sac.creatures[k].first = (**j).creatures[k].first / 2; //halve their number, no growth
|
||||||
|
else
|
||||||
{
|
{
|
||||||
sac.creatures[k].first += (**j).creatureGrowth(k);
|
sac.creatures[k].first += (**j).creatureGrowth(k);
|
||||||
if(gs->getDate(0) == 1) //first day of game: use only basic growths
|
if(gs->getDate(0) == 1) //first day of game: use only basic growths
|
||||||
amin(sac.creatures[k].first, VLC->creh->creatures[(*j)->town->basicCreatures[k]]->growth);
|
amin(sac.creatures[k].first, VLC->creh->creatures[(*j)->town->basicCreatures[k]]->growth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//creatures from town events
|
//creatures from town events
|
||||||
if (vstd::contains(newCreas, (**j).id))
|
if (vstd::contains(newCreas, (**j).id))
|
||||||
for(std::map<si32, si32>::iterator i=newCreas[(**j).id].begin() ; i!=newCreas[(**j).id].end(); i++)
|
for(std::map<si32, si32>::iterator i=newCreas[(**j).id].begin() ; i!=newCreas[(**j).id].end(); i++)
|
||||||
|
Reference in New Issue
Block a user