1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

- fixed #1643 -> hero placeholder handling

- fixed bug when loading victory/loss conditions of the 3rd scenario in the first ROE campaign
- fixed bug when loading artifacts to hero of the 3rd scenario in the first ROE campaign (due to corrupt H3M map)
- implemented function object to quickly find a object by it's sub ID in a list
- added netbackbase.h to header list in CMake
- removed false message which said that the server loaded the map successfully
This commit is contained in:
beegee1
2014-01-30 18:56:31 +00:00
parent 27be6a8f13
commit d4fd361d4b
9 changed files with 177 additions and 72 deletions

View File

@@ -460,6 +460,20 @@ public:
}
private:
struct CrossoverHeroesList
{
std::vector<CGHeroInstance *> heroesFromPreviousScenario, heroesFromAnyPreviousScenarios;
void addHeroToBothLists(CGHeroInstance * hero);
void removeHeroFromBothLists(CGHeroInstance * hero);
};
struct CampaignHeroReplacement
{
CampaignHeroReplacement(CGHeroInstance * hero, ObjectInstanceID heroPlaceholderId);
CGHeroInstance * hero;
ObjectInstanceID heroPlaceholderId;
};
// ----- initialization -----
void initNewGame();
@@ -472,15 +486,15 @@ private:
void randomizeObject(CGObjectInstance *cur);
void initPlayerStates();
void placeCampaignHeroes();
std::vector<CGHeroInstance *> getCrossoverHeroesFromPreviousScenario() const;
/// gets prepared and copied hero instances with crossover heroes from prev. scenario and travel options from current scenario
std::vector<CGHeroInstance *> prepareCrossoverHeroes(const std::vector<CGHeroInstance *> & sourceCrossoverHeroes, const CScenarioTravel & travelOptions);
CrossoverHeroesList getCrossoverHeroesFromPreviousScenarios() const;
/// returns heroes and placeholders in where heroes will be put
std::vector<std::pair<CGHeroInstance*, ObjectInstanceID> > generateCampaignHeroesToReplace(std::vector<CGHeroInstance *> & crossoverHeroes);
std::vector<CampaignHeroReplacement> generateCampaignHeroesToReplace(CrossoverHeroesList & crossoverHeroes);
void replaceHeroesPlaceholders(const std::vector<std::pair<CGHeroInstance*, ObjectInstanceID> > &campHeroReplacements);
/// gets prepared and copied hero instances with crossover heroes from prev. scenario and travel options from current scenario
void prepareCrossoverHeroes(std::vector<CampaignHeroReplacement> & campaignHeroReplacements, const CScenarioTravel & travelOptions) const;
void replaceHeroesPlaceholders(const std::vector<CampaignHeroReplacement> & campaignHeroReplacements);
void placeStartingHeroes();
void placeStartingHero(PlayerColor playerColor, HeroTypeID heroTypeId, int3 townPos);
void initStartingResources();