From b8010a18affa993385ea1a31d8d7121b948f0e7c Mon Sep 17 00:00:00 2001 From: Titus Tscharntke Date: Tue, 6 Sep 2011 23:12:05 +0000 Subject: [PATCH] bugfix, so dragons can morph above water --- source/glest_game/world/map.cpp | 6 ++++++ source/glest_game/world/unit_updater.cpp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/source/glest_game/world/map.cpp b/source/glest_game/world/map.cpp index d53a499b..74462733 100644 --- a/source/glest_game/world/map.cpp +++ b/source/glest_game/world/map.cpp @@ -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) { diff --git a/source/glest_game/world/unit_updater.cpp b/source/glest_game/world/unit_updater.cpp index b4bb03b3..2f55e013 100644 --- a/source/glest_game/world/unit_updater.cpp +++ b/source/glest_game/world/unit_updater.cpp @@ -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{