X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FBattleState.h;h=978581f3062843018925d782ecf63d5de3995d46;hb=adb1e3d5eafba2ef3de1499be286be330afaefef;hp=7dbd016d8717ff8415a1ed63aa8d0f717ffbd54d;hpb=4956380d5109fe57722a968ad1ffbf2fa0a5ed2e;p=l2e.git diff --git a/src/battle/BattleState.h b/src/battle/BattleState.h index 7dbd016..978581f 100644 --- a/src/battle/BattleState.h +++ b/src/battle/BattleState.h @@ -51,6 +51,7 @@ public: , res(res) , attackTypeMenu(res->attackIcons) , moveMenu(res->moveIcons) + , numHeroes(0) , activeHero(-1) , ranAway(false) { } @@ -75,28 +76,28 @@ public: AttackTypeMenu &GetAttackTypeMenu() { return attackTypeMenu; } MoveMenu &GetMoveMenu() { return moveMenu; } - bool HasMoreHeroes() const { return activeHero < (int) heroes.size(); } + bool HasMoreHeroes() const { return activeHero < numHeroes; } void NextHero() { ++activeHero; } bool BeforeFirstHero() const { return activeHero < 0; } void PreviousHero() { --activeHero; } Hero &ActiveHero() { return heroes[activeHero]; } const Hero &ActiveHero() const { return heroes[activeHero]; } - Hero &HeroAt(std::vector::size_type index) { return heroes[index]; } - const Hero &HeroAt(std::vector::size_type index) const { return heroes[index]; } + Hero &HeroAt(int index) { return heroes[index]; } + const Hero &HeroAt(int index) const { return heroes[index]; } Monster &MonsterAt(std::vector::size_type index) { return monsters[index]; } const Monster &MonsterAt(std::vector::size_type index) const { return monsters[index]; } - void SwapHeroes(std::vector::size_type lhs, std::vector::size_type rhs); + void SwapHeroes(int lhs, int rhs); const HeroTag &ActiveHeroTag() const { return heroTags[activeHero]; } - const HeroTag &HeroTagAt(std::vector::size_type index) const { return heroTags[index]; } - const geometry::Point &HeroTagPositionAt(std::vector::size_type index) const { return heroTagPositions[index]; } + const HeroTag &HeroTagAt(int index) const { return heroTags[index]; } + const geometry::Point &HeroTagPositionAt(int index) const { return heroTagPositions[index]; } bool HasChosenAttackType() const { return attackChoices[activeHero].GetType() != AttackChoice::UNDECIDED; } void SetAttackType(AttackChoice::Type t) { attackChoices[activeHero].SetType(t); } AttackChoice &ActiveHeroAttackChoice() { return attackChoices[activeHero]; } const AttackChoice &ActiveHeroAttackChoice() const { return attackChoices[activeHero]; } - const AttackChoice &AttackChoiceAt(std::vector::size_type index) const { return attackChoices[index]; } + const AttackChoice &AttackChoiceAt(int index) const { return attackChoices[index]; } TargetSelection &ActiveHeroTargets() { return attackChoices[activeHero].Selection(); } const TargetSelection &ActiveHeroTargets() const { return attackChoices[activeHero].Selection(); } - bool AttackSelectionDone() const { return activeHero >= (int) heroes.size(); } + bool AttackSelectionDone() const { return activeHero >= numHeroes; } graphics::Menu &GetSpellMenu() { return spellMenus[activeHero]; } const graphics::Menu &GetSpellMenu() const { return spellMenus[activeHero]; } @@ -108,9 +109,8 @@ public: const std::vector > &MonsterPositions() const { return monsterPositions; } bool MonsterPositionOccupied(int index) { return index >= 0 && index < int(monsters.size()) && monsters[index].Health() > 0; } const std::vector > &HeroesPositions() const { return heroesPositions; } - bool HeroPositionOccupied(int index) { return index >= 0 && index < int(heroes.size()); } - std::vector &Heroes() { return heroes; } - const std::vector &Heroes() const { return heroes; } + bool HeroPositionOccupied(int index) { return index >= 0 && index < numHeroes; } + int NumHeroes() const { return numHeroes; } std::vector &Monsters() { return monsters; } const std::vector &Monsters() const { return monsters; } @@ -147,13 +147,14 @@ private: std::vector > monsterPositions; std::vector > heroesPositions; std::vector monsters; - std::vector heroes; + Hero heroes[4]; graphics::Menu spellMenus[4]; graphics::Menu itemMenu; graphics::Menu ikariMenus[4]; HeroTag heroTags[4]; geometry::Point heroTagPositions[4]; AttackChoice attackChoices[4]; + int numHeroes; int activeHero; bool ranAway;