mirror of
https://github.com/devZoGok/PlanetFleet.git
synced 2026-08-26 19:43:29 +00:00
can move near occupied cells
This commit is contained in:
+11
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user