浏览代码

vcmi: expert dispel now works mechanically correct

Konstantin 2 年之前
父节点
当前提交
26db14b7b4
共有 3 个文件被更改,包括 3 次插入11 次删除
  1. 1 4
      lib/battle/CBattleInfoEssentials.cpp
  2. 1 6
      lib/spells/effects/Obstacle.cpp
  3. 1 1
      lib/spells/effects/RemoveObstacle.cpp

+ 1 - 4
lib/battle/CBattleInfoEssentials.cpp

@@ -47,10 +47,7 @@ std::vector<std::shared_ptr<const CObstacleInstance>> CBattleInfoEssentials::bat
 	else
 	{
 		if(!!player && *perspective != battleGetMySide())
-		{
-			logGlobal->error("Unauthorized obstacles access attempt!");
-			return ret;
-		}
+			logGlobal->warn("Unauthorized obstacles access attempt, assuming massive spell");
 	}
 
 	for(const auto & obstacle : getBattle()->getAllObstacles())

+ 1 - 6
lib/spells/effects/Obstacle.cpp

@@ -273,12 +273,7 @@ void Obstacle::placeObstacles(ServerCallback * server, const Mechanics * m, cons
 
 	BattleObstaclesChanged pack;
 
-	boost::optional<BattlePerspective::BattlePerspective> perspective;
-
-	if(!m->battle()->getPlayerID())
-		perspective = boost::make_optional(BattlePerspective::ALL_KNOWING);
-
-	auto all = m->battle()->battleGetAllObstacles(perspective);
+	auto all = m->battle()->battleGetAllObstacles(BattlePerspective::ALL_KNOWING);
 
 	int obstacleIdToGive = 1;
 	for(auto & one : all)

+ 1 - 1
lib/spells/effects/RemoveObstacle.cpp

@@ -89,7 +89,7 @@ std::set<const CObstacleInstance *> RemoveObstacle::getTargets(const Mechanics *
 	std::set<const CObstacleInstance *> possibleTargets;
 	if(m->isMassive() || alwaysMassive)
 	{
-		for(const auto & obstacle : m->battle()->battleGetAllObstacles())
+		for(const auto & obstacle : m->battle()->battleGetAllObstacles(BattlePerspective::ALL_KNOWING))
 			if(canRemove(obstacle.get()))
 				possibleTargets.insert(obstacle.get());
 	}