+public:
+ const Resources &Res() const { return *res; }
+ 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; }
+
+ void NextHero();
+ bool BeforeFirstHero() const { return activeHero < 0; }
+ void PreviousHero() { --activeHero; }
+ void SwapHeroes(int lhs, int rhs);
+ Hero &ActiveHero() { return heroes[activeHero]; }
+ const Hero &ActiveHero() const { return heroes[activeHero]; }
+
+ Hero &HeroAt(int index) { return heroes[index]; }
+ const Hero &HeroAt(int index) const { return heroes[index]; }
+ Monster &MonsterAt(int index) { return monsters[index]; }
+ const Monster &MonsterAt(int index) const { return monsters[index]; }
+
+ const HeroTag &HeroTagAt(int index) const { return heroTags[index]; }
+ const geometry::Point<int> &HeroTagPositionAt(int index) const { return heroTagPositions[index]; }
+
+ bool HasChosenAttackType() const { return attackChoices[activeHero].GetType() != AttackChoice::UNDECIDED; }
+ AttackChoice &ActiveHeroAttackChoice() { return attackChoices[activeHero]; }
+ const AttackChoice &ActiveHeroAttackChoice() const { return attackChoices[activeHero]; }
+ const AttackChoice &AttackChoiceAt(int index) const { return attackChoices[index]; }
+ bool AttackSelectionDone() const { return activeHero >= numHeroes; }
+
+ int NumHeroes() const { return numHeroes; }
+ int MaxHeroes() const { return 4; }
+ int MaxMonsters() const { return monsters.size(); }
+
+ 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) const { return index >= 0 && index < numHeroes; }
+
+ void SetRunaway() { ranAway = true; }
+ void ClearAllAttacks();
+
+ struct Order {
+ Order(int index, bool isMonster)
+ : index(index), isMonster(isMonster) { }
+ int index;
+ bool isMonster;
+ };
+
+ void WriteOrder(std::vector<Order> &);
+
+public:
+ geometry::Vector<int> CalculateScreenOffset(SDL_Surface *screen) const {
+ return geometry::Vector<int>(
+ (screen->w - background->w) / 2,
+ (screen->h - background->h) / 2);
+ }
+ int Width() const { return background->w; }
+ int Height() const { return background->h; }
+
+ void RenderBackground(SDL_Surface *screen, const geometry::Vector<int> &offset);
+ void RenderMonsters(SDL_Surface *screen, const geometry::Vector<int> &offset);
+ void RenderHeroes(SDL_Surface *screen, const geometry::Vector<int> &offset);
+ void RenderHeroTags(SDL_Surface *screen, const geometry::Vector<int> &offset);
+ 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();
+