++numHeroes;
}
+void BattleState::NextHero() {
+ ++activeHero;
+ while (activeHero < numHeroes && heroes[activeHero].Health() == 0) {
+ ++activeHero;
+ }
+}
+
void BattleState::SwapHeroes(int lhs, int rhs) {
if (lhs < 0 || lhs >= numHeroes || rhs < 0 || rhs >= numHeroes || lhs == rhs) return;
std::swap(heroes[lhs], heroes[rhs]);
void BattleState::RenderHeroes(SDL_Surface *screen, const Vector<int> &offset) {
for (int i(0); i < numHeroes; ++i) {
- heroes[i].Sprite()->DrawCenterBottom(screen, heroesPositions[i] + offset, 0, 1);
+ int row(heroes[i].Health() > 0 ? 0 : 2);
+ heroes[i].Sprite()->DrawCenterBottom(screen, heroesPositions[i] + offset, 1, row);
}
}
graphics::Menu<const common::Item *> &GetItemMenu() { return itemMenu; }
const graphics::Menu<const common::Item *> &GetItemMenu() const { return itemMenu; }
- bool HasMoreHeroes() const { return activeHero < numHeroes; }
- void NextHero() { ++activeHero; }
+ void NextHero();
bool BeforeFirstHero() const { return activeHero < 0; }
void PreviousHero() { --activeHero; }
void SwapHeroes(int lhs, int rhs);