- bugfix for enemy cell segfault for AI players
This commit is contained in:
parent
4486b4d5c3
commit
5d1f75ebe6
|
@ -2033,6 +2033,8 @@ void UnitUpdater::findEnemiesForCell(const Vec2i pos, int size, int sightRange,
|
|||
for(int i = pos.x - sightRange; i < pos.x + size + sightRange; ++i) {
|
||||
for(int j = pos.y - sightRange; j < pos.y + size + sightRange; ++j) {
|
||||
Vec2i testPos(i,j);
|
||||
if( map->isInside(testPos) &&
|
||||
map->isInsideSurface(map->toSurfCoords(testPos))) {
|
||||
Cell *cell = map->getCell(testPos);
|
||||
//check field
|
||||
Unit *possibleEnemy = cell->getUnit(f);
|
||||
|
@ -2053,6 +2055,7 @@ void UnitUpdater::findEnemiesForCell(const Vec2i pos, int size, int sightRange,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if the unit has any enemy on range
|
||||
|
|
Loading…
Reference in New Issue