Browse Source

Block pathfinder from allowing to interact with heroes standing on
another visitable object

Ivan Savenko 8 months ago
parent
commit
7823dd3945
1 changed files with 13 additions and 5 deletions
  1. 13 5
      lib/pathfinder/PathfinderUtil.h

+ 13 - 5
lib/pathfinder/PathfinderUtil.h

@@ -40,15 +40,23 @@ namespace PathfinderUtil
 				}
 				}
 				else
 				else
 				{
 				{
+					bool hasBlockedVisitable = false;
+					bool hasVisitable = false;
+
 					for(const CGObjectInstance * obj : tinfo.visitableObjects)
 					for(const CGObjectInstance * obj : tinfo.visitableObjects)
 					{
 					{
 						if(obj->isBlockedVisitable())
 						if(obj->isBlockedVisitable())
-							return EPathAccessibility::BLOCKVIS;
-						else if(obj->passableFor(player))
-							return EPathAccessibility::ACCESSIBLE;
-						else if(obj->ID != Obj::EVENT)
-							return EPathAccessibility::VISITABLE;
+							hasBlockedVisitable = true;
+						else if(!obj->passableFor(player) && obj->ID != Obj::EVENT)
+							hasVisitable = true;
 					}
 					}
+
+					if(hasBlockedVisitable)
+						return EPathAccessibility::BLOCKVIS;
+					if(hasVisitable)
+						return EPathAccessibility::VISITABLE;
+
+					return EPathAccessibility::ACCESSIBLE;
 				}
 				}
 			}
 			}
 			else if(tinfo.blocked())
 			else if(tinfo.blocked())