X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FBattleState.cpp;h=cbea81a82cb5d1564344abe6e24d757bbca70d0e;hb=62c0a1d0ac98eb51418e4daa59e80b6cc97b522f;hp=3f734f84d8ce5bc868f15ad8ea041f2439fce99b;hpb=41983a2cd8dbbfe6adc02cdfccbf5c2887306e51;p=l2e.git diff --git a/src/battle/BattleState.cpp b/src/battle/BattleState.cpp index 3f734f8..cbea81a 100644 --- a/src/battle/BattleState.cpp +++ b/src/battle/BattleState.cpp @@ -18,6 +18,7 @@ #include "../geometry/operators.h" #include "../graphics/Sprite.h" +#include #include using app::Application; @@ -47,6 +48,11 @@ void BattleState::AddHero(const Hero &h) { heroes.push_back(h); } +void BattleState::SwapHeroes(std::vector::size_type lhs, std::vector::size_type rhs) { + if (lhs < 0 || lhs >= heroes.size() || rhs < 0 || rhs >= heroes.size() || lhs == rhs) return; + std::swap(heroes[lhs], heroes[rhs]); +} + void BattleState::Resize(int w, int h) { @@ -61,7 +67,7 @@ void BattleState::EnterState(Application &ctrl, SDL_Surface *screen) { LoadSpellMenu(i); ikariMenus.push_back(res->ikariMenuPrototype); LoadIkariMenu(i); - heroTags[i] = HeroTag(&heroes[i], attackChoices + i, res, HeroTag::Alignment((i + 1) % 2)); + heroTags[i] = HeroTag(this, i); } int tagHeight(attackTypeMenu.Height());