X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2Fstates%2FSelectItem.cpp;h=0291b739c9c2746b5b17f6f72edf58fabb203f57;hb=1c5b28e8559e8383958307534e262a9b29f50fdf;hp=a8c23bb763a9acaf9682dfd841044ae33d3bf8f6;hpb=222167ba3722dc7f47ff7510006bd516e0010a50;p=l2e.git diff --git a/src/battle/states/SelectItem.cpp b/src/battle/states/SelectItem.cpp index a8c23bb..0291b73 100644 --- a/src/battle/states/SelectItem.cpp +++ b/src/battle/states/SelectItem.cpp @@ -35,8 +35,8 @@ void SelectItem::ExitState(Application &c, SDL_Surface *screen) { } void SelectItem::ResumeState(Application &ctrl, SDL_Surface *screen) { - if (battle->ActiveHeroTargets().HasSelected()) { - battle->SetAttackType(AttackChoice::ITEM); + if (battle->ActiveHeroAttackChoice().Selection().HasSelected()) { + battle->ActiveHeroAttackChoice().SetType(AttackChoice::ITEM); battle->ActiveHeroAttackChoice().SetItem(battle->GetItemMenu().Selected()); ctrl.PopState(); } @@ -56,25 +56,25 @@ void SelectItem::HandleEvents(const Input &input) { if (input.JustPressed(Input::ACTION_A)) { if (battle->GetItemMenu().SelectedIsEnabled()) { const Item *item(battle->GetItemMenu().Selected()); - battle->ActiveHeroTargets().Reset(); + battle->ActiveHeroAttackChoice().Selection().Reset(); if (item->GetTargetingMode().TargetsAlly()) { - battle->ActiveHeroTargets().SelectHeroes(); + battle->ActiveHeroAttackChoice().Selection().SelectHeroes(); } else { - battle->ActiveHeroTargets().SelectEnemies(); + battle->ActiveHeroAttackChoice().Selection().SelectEnemies(); } if (item->GetTargetingMode().TargetsAll()) { - battle->SetAttackType(AttackChoice::ITEM); + battle->ActiveHeroAttackChoice().SetType(AttackChoice::ITEM); // TODO: remove item from inventory battle->ActiveHeroAttackChoice().SetItem(item); battle->NextHero(); ctrl->PopState(); } else { if (item->GetTargetingMode().TargetsSingle()) { - battle->ActiveHeroTargets().SetSingle(); + battle->ActiveHeroAttackChoice().Selection().SetSingle(); } else { - battle->ActiveHeroTargets().SetMultiple(); + battle->ActiveHeroAttackChoice().Selection().SetMultiple(); } - ctrl->PushState(new SelectTarget(battle, parent, &battle->ActiveHeroTargets(), battle->Res().itemTargetCursor)); + ctrl->PushState(new SelectTarget(battle, parent, &battle->ActiveHeroAttackChoice().Selection(), battle->Res().itemTargetCursor)); } } } @@ -110,7 +110,7 @@ void SelectItem::Render(SDL_Surface *screen) { void SelectItem::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); }