can move near occupied cells

This commit is contained in:
devZoGok
2025-06-06 11:41:02 +03:00
parent 79212f0217
commit 69720adf30
2 changed files with 12 additions and 1 deletions
+11
View File
@@ -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<int> surrCellIds = map->getSurroundingCells(cells[dest].pos, 1);
for(int scid : surrCellIds)
if(!cells[scid].blockedBy){
dest = scid;
break;
}
}
vector<float> heuristics;
for(Map::Cell &cell : cells)