}
void BattleState::ResumeState(Application &ctrl, SDL_Surface *screen) {
- // TODO: check for victory, defeat or run
+ // TODO: check for victory or defeat
+ if (ranAway) {
+ ctrl.PopState(); // quit the battle scene
+ return;
+ }
// reset attack choices
activeHero = -1;
for (vector<Hero>::size_type i(0), end(heroes.size()); i < end; ++i) {
, res(res)
, attackTypeMenu(res->attackIcons)
, moveMenu(res->moveIcons)
- , activeHero(-1) { }
+ , activeHero(-1)
+ , ranAway(false) { }
public:
void AddMonster(const Monster &);
std::vector<Hero> &Heroes() { return heroes; }
const std::vector<Hero> &Heroes() const { return heroes; }
+ void SetRunaway() { ranAway = true; }
+
public:
geometry::Vector<int> CalculateScreenOffset(SDL_Surface *screen) const {
return geometry::Vector<int>(
geometry::Point<int> heroTagPositions[4];
AttackChoice attackChoices[4];
int activeHero;
+ bool ranAway;
};