1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-03 00:46:55 +02:00

- Fixed AI crash at "gather resource" quest

- AI will now understand threat of Abandoned Mine. For sure.
- Fixed incorrect creeps quantities info
This commit is contained in:
DjWarmonger
2012-08-08 08:27:52 +00:00
parent cd63c177e2
commit 55f321f3f3
3 changed files with 16 additions and 9 deletions

View File

@ -417,6 +417,7 @@ ui64 evaluateDanger(const CGObjectInstance *obj)
return d->getArmyStrength(); return d->getArmyStrength();
} }
case Obj::MINE: case Obj::MINE:
case Obj::ABANDONED_MINE:
{ {
const CArmedInstance * a = dynamic_cast<const CArmedInstance*>(obj); const CArmedInstance * a = dynamic_cast<const CArmedInstance*>(obj);
return a->getArmyStrength(); return a->getArmyStrength();
@ -2140,18 +2141,23 @@ void VCAI::striveToQuest (const QuestInfo &q)
} }
case CQuest::MISSION_RESOURCES: case CQuest::MISSION_RESOURCES:
{ {
if (q.quest->checkQuest(NULL)) if (heroes.size())
{ {
striveToGoal (CGoal(VISIT_TILE).settile(q.tile)); if (q.quest->checkQuest(heroes.front())) //it doesn't matter which hero it is
}
else
{
for (int i = 0; i < q.quest->m7resources.size(); ++i)
{ {
if (q.quest->m7resources[i]) striveToGoal (CGoal(VISIT_TILE).settile(q.tile));
striveToGoal (CGoal(COLLECT_RES).setresID(i).setvalue(q.quest->m7resources[i])); }
else
{
for (int i = 0; i < q.quest->m7resources.size(); ++i)
{
if (q.quest->m7resources[i])
striveToGoal (CGoal(COLLECT_RES).setresID(i).setvalue(q.quest->m7resources[i]));
}
} }
} }
else
striveToGoal (CGoal(RECRUIT_HERO)); //FIXME: checkQuest requires any hero belonging to player :(
break; break;
} }
case CQuest::MISSION_KILL_HERO: case CQuest::MISSION_KILL_HERO:

View File

@ -2933,7 +2933,7 @@ const std::string & CGCreature::getHoverText() const
{ {
MetaString ms; MetaString ms;
int pom = stacks.begin()->second->getQuantityID(); int pom = stacks.begin()->second->getQuantityID();
pom = 174 + 3*pom + 1; pom = 172 + 3*pom;
ms << std::pair<ui8,ui32>(6,pom) << " " << std::pair<ui8,ui32>(7,subID); ms << std::pair<ui8,ui32>(6,pom) << " " << std::pair<ui8,ui32>(7,subID);
ms.toString(hoverName); ms.toString(hoverName);

View File

@ -219,6 +219,7 @@ namespace Obj
BORDER_GATE = 212, BORDER_GATE = 212,
QUEST_GUARD = 215, QUEST_GUARD = 215,
GARRISON2 = 219, GARRISON2 = 219,
ABANDONED_MINE = 220,
CLOVER_FIELD = 222, CLOVER_FIELD = 222,
CURSED_GROUND2 = 223, CURSED_GROUND2 = 223,
EVIL_FOG = 224, EVIL_FOG = 224,