浏览代码

Fix wrong cursor assignment for uncovered tiles beyond DD range

Dydzio 1 年之前
父节点
当前提交
38659abcb8
共有 1 个文件被更改,包括 14 次插入8 次删除
  1. 14 8
      client/adventureMap/AdventureMapInterface.cpp

+ 14 - 8
client/adventureMap/AdventureMapInterface.cpp

@@ -644,28 +644,34 @@ void AdventureMapInterface::onTileHovered(const int3 &targetPosition)
 
 	if(spellBeingCasted)
 	{
+		int3 heroPosition = LOCPLINT->localState->getCurrentArmy()->getSightCenter();
+		if (!isInScreenRange(heroPosition, targetPosition))
+		{
+			CCS->curh->set(Cursor::Map::POINTER);
+			return;
+		}
+
 		switch(spellBeingCasted->id)
 		{
 		case SpellID::SCUTTLE_BOAT:
 			{
-			int3 heroPosition = LOCPLINT->localState->getCurrentArmy()->getSightCenter();
-
-			if(objAtTile && objAtTile->ID == Obj::BOAT && isInScreenRange(heroPosition, targetPosition))
-				CCS->curh->set(Cursor::Map::SCUTTLE_BOAT);
-			else
-				CCS->curh->set(Cursor::Map::POINTER);
-			return;
+				if(objAtTile && objAtTile->ID == Obj::BOAT)
+					CCS->curh->set(Cursor::Map::SCUTTLE_BOAT);
+				else
+					CCS->curh->set(Cursor::Map::POINTER);
+				return;
 			}
 		case SpellID::DIMENSION_DOOR:
 			{
 				const TerrainTile * t = LOCPLINT->cb->getTileForDimensionDoor(targetPosition, LOCPLINT->localState->getCurrentHero());
-				int3 heroPosition = LOCPLINT->localState->getCurrentArmy()->getSightCenter();
 				if(t && t->isClear(LOCPLINT->cb->getTile(heroPosition))/* && isInScreenRange(hpos, mapPos)*/)
 					CCS->curh->set(Cursor::Map::TELEPORT); //TODO: something wrong with beyond east spell range border cursor on arrogance after TP-ing near underground portal on previous day
 				else
 					CCS->curh->set(Cursor::Map::POINTER);
 				return;
 			}
+		default:
+			break;
 		}
 	}