Browse Source

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.
Arseniy Shestakov 9 năm trước cách đây
mục cha
commit
6dcb9a6068
1 tập tin đã thay đổi với 2 bổ sung5 xóa
  1. 2 5
      AI/VCAI/VCAI.cpp

+ 2 - 5
AI/VCAI/VCAI.cpp

@@ -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);
 			}
 		}