1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

- Refactored method CGameState::init

This commit is contained in:
beegee1
2013-12-18 18:18:12 +00:00
parent 61fc216a6f
commit f0cbbbdb70
7 changed files with 836 additions and 773 deletions

View File

@@ -443,10 +443,9 @@ boost::optional<CScenarioTravel::STravelBonus> CCampaignState::getBonusForCurren
{
auto bonuses = getCurrentScenario().travelOptions.bonusesToChoose;
assert(chosenCampaignBonuses.count(*currentMap) || bonuses.size() == 0);
if(bonuses.size())
return bonuses[currentBonusID()];
else
return boost::optional<CScenarioTravel::STravelBonus>();
if(bonuses.empty()) return boost::optional<CScenarioTravel::STravelBonus>();
else return bonuses[currentBonusID()];
}
const CCampaignScenario & CCampaignState::getCurrentScenario() const

View File

@@ -83,16 +83,6 @@ public:
class DLL_LINKAGE CCampaignScenario
{
public:
std::string mapName; //*.h3m
std::string scenarioName; //from header. human-readble
ui32 packedMapSize; //generally not used
std::set<ui8> preconditionRegions; //what we need to conquer to conquer this one (stored as bitfield in h3c)
ui8 regionColor;
ui8 difficulty;
bool conquered;
std::string regionText;
struct DLL_LINKAGE SScenarioPrologEpilog
{
bool hasPrologEpilog;
@@ -106,17 +96,23 @@ public:
}
};
std::string mapName; //*.h3m
std::string scenarioName; //from header. human-readble
ui32 packedMapSize; //generally not used
std::set<ui8> preconditionRegions; //what we need to conquer to conquer this one (stored as bitfield in h3c)
ui8 regionColor;
ui8 difficulty;
bool conquered;
std::string regionText;
SScenarioPrologEpilog prolog, epilog;
CScenarioTravel travelOptions;
std::vector<CGHeroInstance *> crossoverHeroes;
const CGHeroInstance * strongestHero(PlayerColor owner) const;
void loadPreconditionRegions(ui32 regions);
void prepareCrossoverHeroes(std::vector<CGHeroInstance *> heroes);
bool isNotVoid() const;
template <typename Handler> void serialize(Handler &h, const int formatVersion)