From 145e8b9c293ce8b3fd2394a7b479f26d88ab9420 Mon Sep 17 00:00:00 2001 From: devZoGok Date: Sun, 22 Jun 2025 19:08:03 +0300 Subject: [PATCH] allowing units move out of blocked source cells --- pathfinder.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pathfinder.cpp b/pathfinder.cpp index e397719..0d52d0d 100644 --- a/pathfinder.cpp +++ b/pathfinder.cpp @@ -73,15 +73,17 @@ namespace battleship{ bool ship = (unitType == UnitType::UNDERWATER || unitType == UnitType::SEA_LEVEL); Unit *blockingUnit = cells[vertStrich].blockedBy; bool diffBlockingUnit = (blockingUnit && blockingUnit != vehicle); + bool throughBlockedCell = (source != vertStrich); if( - (unitType == UnitType::LAND && (diffBlockingUnit || cells[vertStrich].type != Map::Cell::LAND)) || + (unitType == UnitType::LAND && ((diffBlockingUnit && throughBlockedCell) || cells[vertStrich].type != Map::Cell::LAND)) || ( ship && ( cells[vertStrich].type != Map::Cell::WATER || ( diffBlockingUnit && + throughBlockedCell && blockingUnit->getUnitClass() == UnitClass::ICE_SHEET && vehicle->getUnitClass() != UnitClass::ICEBREAKER )