]> git.localhorst.tv Git - l2e.git/blobdiff - src/menu/EquipMenu.cpp
removed lazy fwd headers
[l2e.git] / src / menu / EquipMenu.cpp
index 199b8e1265c7069a8d169118fb8ed05a4c438276..d04d2f4315ee99e68dbc387d68c737fe98ec6e9b 100644 (file)
@@ -1,10 +1,3 @@
-/*
- * EquipMenu.cpp
- *
- *  Created on: Nov 18, 2012
- *      Author: holy
- */
-
 #include "EquipMenu.h"
 
 #include "HeroStatus.h"
 #include "../common/Stats.h"
 #include "../graphics/Font.h"
 #include "../graphics/Frame.h"
+#include "../math/Vector.h"
 
 using app::Input;
 using common::Hero;
 using common::Inventory;
 using common::Item;
 using common::Stats;
-using geometry::Vector;
+using math::Vector;
 using graphics::Font;
 using graphics::Frame;
 
@@ -72,6 +66,12 @@ void EquipMenu::OnResize(int width, int height) {
 
 
 void EquipMenu::HandleEvents(const Input &input) {
+       if (input.JustPressed(Input::SHOULDER_LEFT)) {
+               PreviousHero();
+       }
+       if (input.JustPressed(Input::SHOULDER_RIGHT)) {
+               NextHero();
+       }
        if (actionMenu.IsActive()) {
                if (input.JustPressed(Input::PAD_UP)) {
                        actionMenu.PreviousRow();
@@ -87,7 +87,7 @@ void EquipMenu::HandleEvents(const Input &input) {
                                        equipmentMenu.SetActive();
                                        break;
                                case CHOICE_STRONGEST:
-                                       // TODO
+                                       // TODO: implement "equip strongest" when items' stat effects are done
                                        break;
                                case CHOICE_REMOVE:
                                        actionMenu.SetSelected();
@@ -158,7 +158,7 @@ void EquipMenu::HandleEvents(const Input &input) {
        }
 }
 
-void EquipMenu::UpdateWorld(float deltaT) {
+void EquipMenu::UpdateWorld(Uint32 deltaT) {
 
 }
 
@@ -264,11 +264,17 @@ void EquipMenu::RenderInventoryMenu(SDL_Surface *screen, const Vector<int> &offs
 void EquipMenu::NextHero() {
        cursor = (cursor + 1) % parent->Game().state->partySize;
        LoadEquipment();
+       if (InventoryVisible()) {
+               LoadInventory();
+       }
 }
 
 void EquipMenu::PreviousHero() {
        cursor = (cursor + parent->Game().state->partySize - 1) % parent->Game().state->partySize;
        LoadEquipment();
+       if (InventoryVisible()) {
+               LoadInventory();
+       }
 }
 
 Hero &EquipMenu::GetHero() {
@@ -287,7 +293,7 @@ void EquipMenu::LoadEquipment() {
                        const Item *item(GetHero().Equipment(Hero::EquipSlot(i)));
                        equipmentMenu.Add(item->Name(), item, true, item->MenuIcon());
                } else {
-                       equipmentMenu.Add(parent->Res().noEquipmentText, 0, false);
+                       equipmentMenu.Add(parent->Res().noEquipmentText, 0);
                }
        }
 }