]> git.localhorst.tv Git - l2e.git/blobdiff - src/menu/InventoryMenu.cpp
renamed namespace geometry -> math
[l2e.git] / src / menu / InventoryMenu.cpp
index bdd94cebf5937f1b439e340f9cef7b2b365d6976..95ca7464ca1348615ceebdf00adba0320e89aa52 100644 (file)
@@ -1,14 +1,8 @@
-/*
- * InventoryMenu.cpp
- *
- *  Created on: Nov 4, 2012
- *      Author: holy
- */
-
 #include "InventoryMenu.h"
 
 #include "PartyMenu.h"
 #include "Resources.h"
+#include "../app/Application.h"
 #include "../app/Input.h"
 #include "../common/GameConfig.h"
 #include "../common/GameState.h"
@@ -20,7 +14,7 @@
 using app::Input;
 using common::Inventory;
 using common::Item;
-using geometry::Vector;
+using math::Vector;
 using graphics::Font;
 using graphics::Frame;
 using std::swap;
@@ -105,7 +99,10 @@ void InventoryMenu::HandleEvents(const Input &input) {
                } else if (itemMenu.SelectedIndex() == itemMenu.SecondaryIndex()) {
                        switch (menu.Selected()) {
                                case CHOICE_USE:
-                                       // TODO: implement item use
+                                       if (itemMenu.Selected()->CanUseOnStatusScreen()) {
+                                               // TODO: implement item use
+                                       }
+                                       itemMenu.SetActive();
                                        break;
                                case CHOICE_SORT:
                                        // invalid state, recover
@@ -113,7 +110,11 @@ void InventoryMenu::HandleEvents(const Input &input) {
                                        itemMenu.SetInactive();
                                        break;
                                case CHOICE_DROP:
-                                       // TODO: implement item drop
+                                       if (itemMenu.Selected()->CanDrop()) {
+                                               parent->Game().state->inventory.RemoveAll(itemMenu.Selected());
+                                               itemMenu.ClearEntry(itemMenu.SelectedIndex());
+                                       }
+                                       itemMenu.SetActive();
                                        break;
                        }
                } else {