diff --git a/activeGameState.cpp b/activeGameState.cpp index 3b33167..f890a9a 100755 --- a/activeGameState.cpp +++ b/activeGameState.cpp @@ -717,7 +717,7 @@ namespace battleship{ buildableStructSelected = false; } - else if(!canSelectHoveredOnGameObj()){ + else{ if(targets.empty()) castRayToTerrain(); issueOrder(Order::TYPE::MOVE, targets, shiftPressed); diff --git a/vehicle.cpp b/vehicle.cpp index 818542f..f26183d 100644 --- a/vehicle.cpp +++ b/vehicle.cpp @@ -247,6 +247,7 @@ namespace battleship{ } //TODO allow ships to attack land targets and vice versa + //TODO recursively search for vacant dest cell neibourghss void Vehicle::preparePathpoints(Order &order, Vector3 destPos, bool appendDestPos){ removeAllPathpoints(); @@ -264,6 +265,16 @@ namespace battleship{ if(type != UnitType::UNDERWATER && fabs(destPos.y - cells[dest].pos.y) > .1) return; + if(cells[dest].blockedBy){ + vector surrCellIds = map->getSurroundingCells(cells[dest].pos, 1); + + for(int scid : surrCellIds) + if(!cells[scid].blockedBy){ + dest = scid; + break; + } + } + vector heuristics; for(Map::Cell &cell : cells)