X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=src%2Fbattle%2FBattleState.cpp;h=50121049651fc4b0a4deacb7c40554dcdc21400a;hb=68510cd21025741773b6746376a24602be791829;hp=65bdb9180b56e86dbff54a64a5f21f356f06f4e7;hpb=5121f4215d725f492bea084fb94900d7e5972743;p=l2e.git diff --git a/src/battle/BattleState.cpp b/src/battle/BattleState.cpp index 65bdb91..5012104 100644 --- a/src/battle/BattleState.cpp +++ b/src/battle/BattleState.cpp @@ -59,6 +59,13 @@ void BattleState::NextHero() { } } +void BattleState::PreviousHero() { + --activeHero; + while (activeHero >= 0 && 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]);