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

Fixed CID 1288855

This commit is contained in:
AlexVinS 2016-11-25 16:40:11 +03:00
parent 6d3259909e
commit 4ba3c6fecc
2 changed files with 20 additions and 4 deletions

View File

@ -169,7 +169,7 @@ CScenarioTravel CCampaignHandler::readScenarioTravelFromMemory(CBinaryReader & r
{
ret.artifsKeptByHero.fill(0);
reader.getStream()->read(ret.artifsKeptByHero.data(), ret.artifsKeptByHero.size() - 1);
}
}
else
{
reader.getStream()->read(ret.artifsKeptByHero.data(), ret.artifsKeptByHero.size());
@ -323,7 +323,7 @@ bool CCampaign::conquerable( int whichScenario ) const
{
if( vstd::contains(scenarios[whichScenario].preconditionRegions, g) && !scenarios[g].conquered)
return false; //prerequisite does not met
}
return true;
}
@ -333,6 +333,18 @@ CCampaign::CCampaign()
}
CCampaignScenario::SScenarioPrologEpilog::SScenarioPrologEpilog()
: hasPrologEpilog(false), prologVideo(0), prologMusic(0), prologText()
{
}
CCampaignScenario::CCampaignScenario()
: mapName(), scenarioName(), packedMapSize(0), regionColor(0), difficulty(0), conquered(false)
{
}
bool CCampaignScenario::isNotVoid() const
{
return mapName.size() > 0;

View File

@ -90,6 +90,8 @@ public:
ui8 prologMusic; // from CmpMusic.txt
std::string prologText;
SScenarioPrologEpilog();
template <typename Handler> void serialize(Handler &h, const int formatVersion)
{
h & hasPrologEpilog & prologVideo & prologMusic & prologText;
@ -117,9 +119,11 @@ public:
bool isNotVoid() const;
std::vector<CGHeroInstance *> getLostCrossoverHeroes() const; /// returns a list of crossover heroes which started the scenario, but didn't complete it
CCampaignScenario();
template <typename Handler> void serialize(Handler &h, const int formatVersion)
{
h & mapName & scenarioName & packedMapSize & preconditionRegions & regionColor & difficulty & conquered & regionText &
h & mapName & scenarioName & packedMapSize & preconditionRegions & regionColor & difficulty & conquered & regionText &
prolog & epilog & travelOptions & crossoverHeroes & placedCrossoverHeroes & keepHeroes;
}
};
@ -145,7 +149,7 @@ class DLL_LINKAGE CCampaignState
{
public:
std::unique_ptr<CCampaign> camp;
std::string campaignName;
std::string campaignName;
std::vector<ui8> mapsConquered, mapsRemaining;
boost::optional<si32> currentMap;