X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2Fstates%2FSelectSpell.cpp;h=3b4573f485f526f0ad80fcae5cf27d8b5552273e;hb=c68b073db752dcdcf8c900efba7d8a5da091751c;hp=a9c06cceccc912ca59e3530ce361e52b7fbb2880;hpb=222167ba3722dc7f47ff7510006bd516e0010a50;p=l2e.git diff --git a/src/battle/states/SelectSpell.cpp b/src/battle/states/SelectSpell.cpp index a9c06cc..3b4573f 100644 --- a/src/battle/states/SelectSpell.cpp +++ b/src/battle/states/SelectSpell.cpp @@ -36,9 +36,9 @@ void SelectSpell::ExitState(Application &c, SDL_Surface *screen) { } void SelectSpell::ResumeState(Application &ctrl, SDL_Surface *screen) { - if (battle->ActiveHeroTargets().HasSelected()) { - battle->SetAttackType(AttackChoice::MAGIC); - battle->ActiveHeroAttackChoice().SetSpell(battle->GetSpellMenu().Selected()); + if (battle->ActiveHero().GetAttackChoice().Selection().HasSelected()) { + battle->ActiveHero().GetAttackChoice().SetType(AttackChoice::MAGIC); + battle->ActiveHero().GetAttackChoice().SetSpell(battle->GetSpellMenu().Selected()); ctrl.PopState(); } } @@ -56,26 +56,27 @@ void SelectSpell::Resize(int width, int height) { void SelectSpell::HandleEvents(const Input &input) { if (input.JustPressed(Input::ACTION_A)) { if (battle->GetSpellMenu().SelectedIsEnabled()) { + AttackChoice &ac(battle->ActiveHero().GetAttackChoice()); const Spell *spell(battle->GetSpellMenu().Selected()); - battle->ActiveHeroTargets().Reset(); + ac.Selection().Reset(); if (spell->GetTargetingMode().TargetsAlly()) { - battle->ActiveHeroTargets().SelectHeroes(); + ac.Selection().SelectHeroes(); } else { - battle->ActiveHeroTargets().SelectEnemies(); + ac.Selection().SelectEnemies(); } if (spell->GetTargetingMode().TargetsAll()) { - battle->SetAttackType(AttackChoice::MAGIC); + ac.SetType(AttackChoice::MAGIC); // TODO: remove item from inventory - battle->ActiveHeroAttackChoice().SetSpell(spell); + ac.SetSpell(spell); battle->NextHero(); ctrl->PopState(); } else { if (spell->GetTargetingMode().TargetsSingle()) { - battle->ActiveHeroTargets().SetSingle(); + ac.Selection().SetSingle(); } else { - battle->ActiveHeroTargets().SetMultiple(); + ac.Selection().SetMultiple(); } - ctrl->PushState(new SelectTarget(battle, parent, &battle->ActiveHeroTargets(), battle->Res().magicTargetCursor)); + ctrl->PushState(new SelectTarget(battle, parent, &ac.Selection(), battle->Res().magicTargetCursor)); } } } @@ -111,7 +112,7 @@ void SelectSpell::Render(SDL_Surface *screen) { void SelectSpell::RenderFrame(SDL_Surface *screen, const Vector &offset) { const Frame *frame(battle->Res().selectFrame); Point position(frame->BorderWidth(), frame->BorderHeight()); - int width(battle->BackgroundWidth() - 2 * frame->BorderWidth()); + int width(battle->Width() - 2 * frame->BorderWidth()); int height(battle->Res().normalFont->CharHeight() * 13); frame->Draw(screen, position + offset, width, height); }