mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
* fixed bug 1084
This commit is contained in:
parent
7fe2692bf8
commit
f16a3a4527
@ -980,30 +980,33 @@ void CGameState::init(StartInfo * si)
|
|||||||
/*********give starting hero****************************************/
|
/*********give starting hero****************************************/
|
||||||
tlog4 << "\tGiving starting hero";
|
tlog4 << "\tGiving starting hero";
|
||||||
{
|
{
|
||||||
auto bonus = scenarioOps->campState->getBonusForCurrentMap();
|
if(scenarioOps->campState)
|
||||||
if(bonus.is_initialized())
|
|
||||||
{
|
{
|
||||||
for(auto it = scenarioOps->playerInfos.begin(); it != scenarioOps->playerInfos.end(); ++it)
|
auto bonus = scenarioOps->campState->getBonusForCurrentMap();
|
||||||
|
if(bonus.is_initialized())
|
||||||
{
|
{
|
||||||
const PlayerInfo &p = map->players[it->first];
|
for(auto it = scenarioOps->playerInfos.begin(); it != scenarioOps->playerInfos.end(); ++it)
|
||||||
bool campaignGiveHero = it->second.human && scenarioOps->mode == StartInfo::CAMPAIGN &&
|
|
||||||
bonus.get().type == CScenarioTravel::STravelBonus::HERO;
|
|
||||||
bool generateHero = (p.generateHeroAtMainTown || campaignGiveHero) && p.hasMainTown;
|
|
||||||
if(generateHero && vstd::contains(scenarioOps->playerInfos, it->first))
|
|
||||||
{
|
{
|
||||||
int3 hpos = p.posOfMainTown;
|
const PlayerInfo &p = map->players[it->first];
|
||||||
hpos.x+=1;
|
bool campaignGiveHero = it->second.human && scenarioOps->mode == StartInfo::CAMPAIGN &&
|
||||||
|
bonus.get().type == CScenarioTravel::STravelBonus::HERO;
|
||||||
|
bool generateHero = (p.generateHeroAtMainTown || campaignGiveHero) && p.hasMainTown;
|
||||||
|
if(generateHero && vstd::contains(scenarioOps->playerInfos, it->first))
|
||||||
|
{
|
||||||
|
int3 hpos = p.posOfMainTown;
|
||||||
|
hpos.x+=1;
|
||||||
|
|
||||||
int h = pickHero(it->first);
|
int h = pickHero(it->first);
|
||||||
if(it->second.hero == -1)
|
if(it->second.hero == -1)
|
||||||
it->second.hero = h;
|
it->second.hero = h;
|
||||||
|
|
||||||
CGHeroInstance * nnn = static_cast<CGHeroInstance*>(createObject(Obj::HERO,h,hpos,it->first));
|
CGHeroInstance * nnn = static_cast<CGHeroInstance*>(createObject(Obj::HERO,h,hpos,it->first));
|
||||||
nnn->id = map->objects.size();
|
nnn->id = map->objects.size();
|
||||||
nnn->initHero();
|
nnn->initHero();
|
||||||
map->heroes.push_back(nnn);
|
map->heroes.push_back(nnn);
|
||||||
map->objects.push_back(nnn);
|
map->objects.push_back(nnn);
|
||||||
map->addBlockVisTiles(nnn);
|
map->addBlockVisTiles(nnn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user