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

A number of fixes. Banks serialization, doubling spell effects, week of plague.

This commit is contained in:
DjWarmonger 2010-10-02 07:10:38 +00:00
parent 2866222280
commit 02d7fa35b7
4 changed files with 13 additions and 7 deletions

View File

@ -1128,7 +1128,7 @@ int CCastleInterface::CCreaInfo::AddToString(std::string from, std::string & to,
{
if (!numb)
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;
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
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+=AddToString(CGI->generaltexth->artifNames[133] + " %+d",descr,

View File

@ -1052,7 +1052,7 @@ class DLL_EXPORT CBank : public CArmedInstance
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;
}
};

View File

@ -969,7 +969,8 @@ std::vector<si32> CStack::activeSpells() const
BonusList spellEffects = getSpellBonuses();
for(BonusList::const_iterator it = spellEffects.begin(); it != spellEffects.end(); it++)
{
ret.push_back(it->id);
if (!vstd::contains(ret, it->id)) //do not duplicate spells with multiple effects
ret.push_back(it->id);
}
return ret;

View File

@ -1220,9 +1220,14 @@ void CGameHandler::newTurn()
{
if((**j).creatureDwelling(k))//there is dwelling (k-level)
{
sac.creatures[k].first += (**j).creatureGrowth(k);
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);
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);
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);
}
}
}
//creatures from town events