X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FBattleState.h;h=978581f3062843018925d782ecf63d5de3995d46;hb=76539c6ba0ac1bc6ecd179cd0fc229f40872598b;hp=e94ed417b689807e580bf20a6925d0371327ef59;hpb=69123d71dacfdd6592c00ead8b92b6441d0f0228;p=l2e.git diff --git a/src/battle/BattleState.h b/src/battle/BattleState.h index e94ed41..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,26 +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]; } - void SwapHeroes(std::vector::size_type lhs, std::vector::size_type rhs); + 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(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]; } @@ -106,11 +109,13 @@ 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; } void SetRunaway() { ranAway = true; } + void ClearAllAttacks(); public: geometry::Vector CalculateScreenOffset(SDL_Surface *screen) const { @@ -142,13 +147,14 @@ private: std::vector > monsterPositions; std::vector > heroesPositions; std::vector monsters; - std::vector heroes; - std::vector > spellMenus; + Hero heroes[4]; + graphics::Menu spellMenus[4]; graphics::Menu itemMenu; - std::vector > ikariMenus; + graphics::Menu ikariMenus[4]; HeroTag heroTags[4]; geometry::Point heroTagPositions[4]; AttackChoice attackChoices[4]; + int numHeroes; int activeHero; bool ranAway;