bugfix, so dragons can morph above water

This commit is contained in:
Titus Tscharntke 2011-09-06 23:12:05 +00:00
parent af03402409
commit b8010a18af
2 changed files with 7 additions and 1 deletions

View File

@ -564,9 +564,15 @@ bool Map::isFreeCell(const Vec2i &pos, Field field) const {
bool Map::isFreeCellOrHasUnit(const Vec2i &pos, Field field, const Unit *unit) const {
if(isInside(pos) && isInsideSurface(toSurfCoords(pos))) {
if(unit->getCurrField() != field) {
return isFreeCell(pos, field);
}
Cell *c= getCell(pos);
if(c->getUnit(unit->getCurrField()) == unit) {
if(unit->getCurrField() == fAir) {
if(field == fAir) {
return true;
}
const SurfaceCell *sc= getSurfaceCell(toSurfCoords(pos));
if(sc != NULL) {
if(getDeepSubmerged(sc) == true) {

View File

@ -1820,7 +1820,7 @@ void UnitUpdater::updateMorph(Unit *unit, int frameIndex) {
if(unit->getCurrSkill()->getClass()!=scMorph){
//if not morphing, check space
if(map->isFreeCellsOrHasUnit(unit->getPos(), mct->getMorphUnit()->getSize(), unit->getCurrField(), unit, mct->getMorphUnit())){
if(map->isFreeCellsOrHasUnit(unit->getPos(), mct->getMorphUnit()->getSize(), mct->getMorphUnit()->getField(), unit, mct->getMorphUnit())){
unit->setCurrSkill(mct->getMorphSkillType());
}
else{