allowing units move out of blocked source cells

This commit is contained in:
devZoGok
2025-06-22 19:08:03 +03:00
parent 2dd598b84a
commit 145e8b9c29
+3 -1
View File
@@ -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
)