]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/BattleState.h
added attack targets selection state
[l2e.git] / src / battle / BattleState.h
index 96a7ce20643d5b62f4aee3d3c9f0f68103280a3a..3b293546382c1668a732eb80dff6eff64a26c500 100644 (file)
@@ -79,9 +79,17 @@ public:
        void PreviousHero() { --activeHero; }
        Hero &ActiveHero() { return heroes[activeHero]; }
        const Hero &ActiveHero() const { return heroes[activeHero]; }
+       Hero &HeroAt(std::vector<Hero>::size_type index) { return heroes[index]; }
+       const Hero &HeroAt(std::vector<Hero>::size_type index) const { return heroes[index]; }
+       const HeroTag &ActiveHeroTag() const { return heroTags[activeHero]; }
+       const HeroTag &HeroTagAt(std::vector<Hero>::size_type index) const { return heroTags[index]; }
+       const geometry::Point<int> &HeroTagPositionAt(std::vector<Hero>::size_type index) const { return heroTagPositions[index]; }
        bool HasChosenAttackType() const { return attackChoices[activeHero].GetType() != AttackChoice::UNDECIDED; }
        void SetAttackType(AttackChoice::Type t) { attackChoices[activeHero].SetType(t); }
+       TargetSelection &ActiveHeroTargets() { return attackChoices[activeHero].Selection(); }
+       const TargetSelection &ActiveHeroTargets() const { return attackChoices[activeHero].Selection(); }
        bool AttackSelectionDone() const { return activeHero >= (int) heroes.size(); }
+
        graphics::Menu</* Spell */ void *> &GetSpellMenu() { return spellMenus[activeHero]; }
        const graphics::Menu</* Spell */ void *> &GetSpellMenu() const { return spellMenus[activeHero]; }
        graphics::Menu</* Ikari or Item */ void *> &GetIkariMenu() { return ikariMenus[activeHero]; }
@@ -89,6 +97,13 @@ public:
        graphics::Menu<const common::Item *> &GetItemMenu() { return itemMenu; }
        const graphics::Menu<const common::Item *> &GetItemMenu() const { return itemMenu; }
 
+       const std::vector<geometry::Point<int> > &MonsterPositions() const { return monsterPositions; }
+       bool MonsterPositionOccupied(int index) { return index >= 0 && index < int(monsters.size()) && monsters[index].Health() > 0; }
+       const std::vector<geometry::Point<int> > &HeroesPositions() const { return heroesPositions; }
+       bool HeroPositionOccupied(int index) { return index >= 0 && index < int(heroes.size()); }
+       std::vector<Hero> &Heroes() { return heroes; }
+       const std::vector<Hero> &Heroes() const { return heroes; }
+
 public:
        geometry::Vector<int> CalculateScreenOffset(SDL_Surface *screen) const {
                return geometry::Vector<int>(
@@ -113,6 +128,7 @@ private:
        const Resources *res;
        AttackTypeMenu attackTypeMenu;
        MoveMenu moveMenu;
+       // TODO: combine all data about heros or monsters
        std::vector<geometry::Point<int> > monsterPositions;
        std::vector<geometry::Point<int> > heroesPositions;
        std::vector<Monster> monsters;
@@ -120,8 +136,9 @@ private:
        std::vector<graphics::Menu</* Spell */ void *> > spellMenus;
        graphics::Menu<const common::Item *> itemMenu;
        std::vector<graphics::Menu</* Ikari or Item */ void *> > ikariMenus;
-       std::vector<HeroTag> heroTags;
-       std::vector<AttackChoice> attackChoices;
+       HeroTag heroTags[4];
+       geometry::Point<int> heroTagPositions[4];
+       AttackChoice attackChoices[4];
        int activeHero;
 
 };