소스 검색

CGHeroInstance: add canFly and update canWalkOnSea

canWalkOnSea shouldn't check for FLYING_MOVEMENT because it's two separate mechanics that apply different limitations.
ArseniyShestakov 10 년 전
부모
커밋
41c4323818
2개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      lib/mapObjects/CGHeroInstance.cpp
  2. 1 0
      lib/mapObjects/CGHeroInstance.h

+ 6 - 1
lib/mapObjects/CGHeroInstance.cpp

@@ -136,9 +136,14 @@ int3 CGHeroInstance::getPosition(bool h3m) const //h3m=true - returns position o
 	}
 }
 
+bool CGHeroInstance::canFly() const
+{
+	return hasBonusOfType(Bonus::FLYING_MOVEMENT);
+}
+
 bool CGHeroInstance::canWalkOnSea() const
 {
-	return hasBonusOfType(Bonus::FLYING_MOVEMENT) || hasBonusOfType(Bonus::WATER_WALKING);
+	return hasBonusOfType(Bonus::WATER_WALKING);
 }
 
 ui8 CGHeroInstance::getSecSkillLevel(SecondarySkill skill) const

+ 1 - 0
lib/mapObjects/CGHeroInstance.h

@@ -133,6 +133,7 @@ public:
 	ui32 getLowestCreatureSpeed() const;
 	int3 getPosition(bool h3m = false) const; //h3m=true - returns position of hero object; h3m=false - returns position of hero 'manifestation'
 	si32 manaRegain() const; //how many points of mana can hero regain "naturally" in one day
+	bool canFly() const;
 	bool canWalkOnSea() const;
 	int getCurrentLuck(int stack=-1, bool town=false) const;
 	int getSpellCost(const CSpell *sp) const; //do not use during battles -> bonuses from army would be ignored