1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +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

@@ -308,11 +308,24 @@ DLL_LINKAGE void RemoveObject::applyGs( CGameState *gs )
return;
}
// else if (obj->ID==CREI_TYPE && gs->map->version > CMapHeader::RoE) //only fixed monsters can be a part of quest
// {
// CGCreature *cre = static_cast<CGCreature*>(obj);
// gs->map->monsters[cre->identifier]->pos = int3 (-1,-1,-1); //use nonexistent monster for quest :>
// }
//FIXME: for some reason this code causes crash in Bonus System ?!
auto quest = dynamic_cast<const CQuest *>(obj);
if (quest)
{
BOOST_FOREACH (auto player, gs->players)
{
BOOST_FOREACH (auto q, player.second.quests)
{
if (q.obj == obj)
{
q.quest = NULL; //remove entries related to quest guards?
q.obj = NULL;
}
}
}
}
gs->map->objects[id].dellNull();
}
@@ -1495,7 +1508,7 @@ DLL_LINKAGE void SetSelection::applyGs( CGameState *gs )
}
DLL_LINKAGE Component::Component(const CStackBasicDescriptor &stack)
:id(CREATURE), subtype(stack.type->idNumber), val(stack.count), when(0)
: id(CREATURE), subtype(stack.type->idNumber), val(stack.count), when(0)
{
type = 2002;
}