]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/BattleState.h
renamed BattleState's GetItemMenu -> ItemMenu
[l2e.git] / src / battle / BattleState.h
index a10ff7e8fae2b6947dd651c4a403c9b33c57e76d..4a07f8e7396ab1fe8c41f2bc0b6e8ac973a39b9b 100644 (file)
@@ -8,7 +8,6 @@
 #ifndef BATTLE_BATTLESTATE_H_
 #define BATTLE_BATTLESTATE_H_
 
-#include "AttackChoice.h"
 #include "AttackTypeMenu.h"
 #include "Hero.h"
 #include "HeroTag.h"
@@ -41,6 +40,7 @@ namespace graphics {
 
 namespace battle {
 
+class AttackChoice;
 class PartyLayout;
 class Stats;
 
@@ -58,6 +58,8 @@ public:
        , numHeroes(0)
        , activeHero(-1)
        , attackCursor(-1)
+       , expReward(0)
+       , goldReward(0)
        , ranAway(false) { assert(background && res); }
 
 public:
@@ -82,19 +84,15 @@ public:
        AttackTypeMenu &GetAttackTypeMenu() { return attackTypeMenu; }
        MoveMenu &GetMoveMenu() { return moveMenu; }
 
-       graphics::Menu<const common::Spell *> &GetSpellMenu() { return spellMenus[activeHero]; }
-       const graphics::Menu<const common::Spell *> &GetSpellMenu() const { return spellMenus[activeHero]; }
-       graphics::Menu<const common::Item *> &GetIkariMenu() { return ikariMenus[activeHero]; }
-       const graphics::Menu<const common::Item *> &GetIkariMenu() const { return ikariMenus[activeHero]; }
-       graphics::Menu<const common::Item *> &GetItemMenu() { return itemMenu; }
-       const graphics::Menu<const common::Item *> &GetItemMenu() const { return itemMenu; }
+       graphics::Menu<const common::Item *> &ItemMenu() { return itemMenu; }
+       const graphics::Menu<const common::Item *> &ItemMenu() const { return itemMenu; }
 
        void NextHero();
        bool BeforeFirstHero() const { return activeHero < 0; }
-       void PreviousHero() { --activeHero; }
+       void PreviousHero();
        void SwapHeroes(int lhs, int rhs);
-       Hero &ActiveHero() { return heroes[activeHero]; }
-       const Hero &ActiveHero() const { return heroes[activeHero]; }
+       Hero &ActiveHero() { assert(activeHero >= 0 && activeHero < NumHeroes()); return heroes[activeHero]; }
+       const Hero &ActiveHero() const { assert(activeHero >= 0 && activeHero < NumHeroes()); return heroes[activeHero]; }
 
        Hero &HeroAt(int index) { assert(index >= 0 && index < NumHeroes()); return heroes[index]; }
        const Hero &HeroAt(int index) const { assert(index >= 0 && index < NumHeroes()); return heroes[index]; }
@@ -104,13 +102,7 @@ public:
        const HeroTag &HeroTagAt(int index) const { assert(index >= 0 && index < NumHeroes()); return heroTags[index]; }
        const geometry::Point<int> &HeroTagPositionAt(int index) const { assert(index >= 0 && index < NumHeroes()); return heroTagPositions[index]; }
 
-       bool HasChosenAttackType() const { return ActiveHeroAttackChoice().GetType() != AttackChoice::UNDECIDED; }
-       AttackChoice &ActiveHeroAttackChoice() { return AttackChoiceAt(activeHero); }
-       const AttackChoice &ActiveHeroAttackChoice() const { return AttackChoiceAt(activeHero); }
-       AttackChoice &AttackChoiceAt(int index) { assert(index >= 0 && index < NumHeroes()); return attackChoices[index]; }
-       const AttackChoice &AttackChoiceAt(int index) const { assert(index >= 0 && index < NumHeroes()); return attackChoices[index]; }
-       AttackChoice &MonsterAttackChoiceAt(int index) { assert(index >= 0 && index < MaxMonsters()); return monsterAttacks[index]; }
-       const AttackChoice &MonsterAttackChoiceAt(int index) const { assert(index >= 0 && index < MaxMonsters()); return monsterAttacks[index]; }
+       bool HasChosenAttackType() const { return ActiveHero().GetAttackChoice().GetType() != AttackChoice::UNDECIDED; }
        bool AttackSelectionDone() const { return activeHero >= numHeroes; }
 
        int NumHeroes() const { return numHeroes; }
@@ -159,8 +151,6 @@ public:
        void RenderSmallHeroTags(SDL_Surface *screen, const geometry::Vector<int> &offset);
 
 private:
-       void LoadSpellMenu(std::vector<Hero>::size_type heroIndex);
-       void LoadIkariMenu(std::vector<Hero>::size_type heroIndex);
        void LoadInventory();
 
        Uint16 CalculateDamage(const Stats &attacker, const Stats &defender) const;
@@ -176,20 +166,18 @@ private:
        std::vector<geometry::Point<int> > monsterPositions;
        std::vector<geometry::Point<int> > heroesPositions;
        std::vector<Monster> monsters;
-       std::vector<AttackChoice> monsterAttacks;
        std::vector<Order> attackOrder;
        Hero heroes[4];
-       graphics::Menu<const common::Spell *> spellMenus[4];
        graphics::Menu<const common::Item *> itemMenu;
-       graphics::Menu<const common::Item *> ikariMenus[4];
        HeroTag heroTags[4];
        SmallHeroTag smallHeroTags[4];
        geometry::Point<int> heroTagPositions[4];
        geometry::Point<int> smallHeroTagPositions[4];
-       AttackChoice attackChoices[4];
        int numHeroes;
        int activeHero;
        int attackCursor;
+       int expReward;
+       int goldReward;
        bool ranAway;
 
 };