1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-01 00:45:26 +02:00

-Fixed crash #1037

-AI can now successfully complete several types of quests.
-Lots of tweaks for AI
TODO: fix bizarre crash when opening borderguard
This commit is contained in:
DjWarmonger
2012-07-19 09:10:55 +00:00
parent 6a7327d38a
commit d8cb3a34d3
8 changed files with 99 additions and 33 deletions

View File

@ -4399,6 +4399,20 @@ void CQuest::getCompletionText (MetaString &iwText, std::vector<Component> &comp
break;
}
}
void CGSeerHut::setObjToKill()
{
if (missionType == MISSION_KILL_CREATURE)
{
stackToKill = getCreatureToKill(false)->getStack(0); //FIXME: stacks tend to dissapear (desync?) on server :?
assert (stackToKill.count > 0); //seemingly creatures are uninitialized
stackDirection = checkDirection();
}
else if (missionType == MISSION_KILL_HERO)
{
heroName = getHeroToKill(false)->name;
heroPortrait = getHeroToKill(false)->portrait;
}
}
void CGSeerHut::initObj()
{
@ -4413,17 +4427,6 @@ void CGSeerHut::initObj()
nextVisitText = VLC->generaltexth->quests[missionType-1][1][textOption];
if (!isCustomComplete)
completedText = VLC->generaltexth->quests[missionType-1][2][textOption];
if(missionType == MISSION_KILL_CREATURE)
{
stackToKill = getCreatureToKill(false)->getStack(0);
stackDirection = checkDirection();
}
else if(missionType == MISSION_KILL_HERO)
{
heroName = getHeroToKill(false)->name;
heroPortrait = getHeroToKill(false)->portrait;
}
}
else
firstVisitText = VLC->generaltexth->seerEmpty[textOption];
@ -6326,6 +6329,11 @@ void CGBorderGuard::getRolloverText (MetaString &text, bool onHover) const
text << VLC->generaltexth->tentColors[subID] << " " << VLC->generaltexth->names[Obj::KEYMASTER];
}
bool CGBorderGuard::checkQuest (const CGHeroInstance * h) const
{
return wasMyColorVisited (h->tempOwner);
}
void CGBorderGuard::onHeroVisit( const CGHeroInstance * h ) const
{
if (wasMyColorVisited (h->getOwner()) )