- disallow air units to morph back to land if unwalkable objects or water terrain are below

This commit is contained in:
Mark Vejvoda 2010-10-30 04:49:49 +00:00
parent f897884321
commit 060a9d3fe6
1 changed files with 14 additions and 3 deletions

View File

@ -319,6 +319,17 @@ bool Map::isFreeCellOrHasUnit(const Vec2i &pos, Field field, const Unit *unit) c
if(isInside(pos)) {
Cell *c= getCell(pos);
if(c->getUnit(unit->getCurrField()) == unit) {
if(unit->getCurrField() == fAir) {
const SurfaceCell *sc= getSurfaceCell(toSurfCoords(pos));
if(sc != NULL) {
if(getDeepSubmerged(sc) == true) {
return false;
}
else if(field == fLand) {
return sc->isFree();
}
}
}
return true;
}
else{