]> git.localhorst.tv Git - l2e.git/blobdiff - src/menu/EquipMenu.cpp
renamed namespace geometry -> math
[l2e.git] / src / menu / EquipMenu.cpp
index 0caff55467b5779a00f72b559d647c6e80cf16d5..494c25a5af89afacbd9bc088eee6d17e96a74bb3 100644 (file)
@@ -1,10 +1,3 @@
-/*
- * EquipMenu.cpp
- *
- *  Created on: Nov 18, 2012
- *      Author: holy
- */
-
 #include "EquipMenu.h"
 
 #include "HeroStatus.h"
@@ -26,7 +19,7 @@ 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 +65,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 +86,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();
@@ -264,11 +263,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() {