1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

VCAI: don't remove flagged objects from visitableObjs

This make my new shipyard-related changes work properly and might improve owned dwelling usage.
In case there still some code that might cause useless visits it's better just rewrite it insted of removing objects from visitableObjs.
This commit is contained in:
Arseniy Shestakov 2016-09-13 23:39:32 +03:00
parent 1e60ba6516
commit 6dcb9a6068

View File

@ -524,16 +524,13 @@ void VCAI::objectPropertyChanged(const SetObjectProperty * sop)
NET_EVENT_HANDLER;
if(sop->what == ObjProperty::OWNER)
{
//we don't want to visit know object twice (do we really?)
if(sop->val == playerID.getNum())
vstd::erase_if_present(visitableObjs, myCb->getObj(sop->id));
else if(myCb->getPlayerRelations(playerID, (PlayerColor)sop->val) == PlayerRelations::ENEMIES)
if(myCb->getPlayerRelations(playerID, (PlayerColor)sop->val) == PlayerRelations::ENEMIES)
{
//we want to visit objects owned by oppponents
auto obj = myCb->getObj(sop->id, false);
if (obj)
{
addVisitableObj(obj);
addVisitableObj(obj); // TODO: Remove once save compatability broken. In past owned objects were removed from this set
vstd::erase_if_present(alreadyVisited, obj);
}
}