]> git.localhorst.tv Git - l2e.git/blobdiff - src/menu/CapsuleFeedMenu.cpp
removed lazy fwd headers
[l2e.git] / src / menu / CapsuleFeedMenu.cpp
index f2631b90aecad4b40fbf6fb305a3362f2a01355c..07808f65b49b8f9a34b031eb07ad6ad777cc6ab4 100644 (file)
 #include "../common/GameState.h"
 #include "../graphics/Font.h"
 #include "../graphics/Frame.h"
+#include "../math/Vector.h"
 
 using app::Input;
 using common::Capsule;
 using common::Inventory;
 using common::Item;
-using geometry::Vector;
+using math::Vector;
 using graphics::Font;
 using graphics::Frame;
 
@@ -132,16 +133,24 @@ void CapsuleFeedMenu::HandleEvents(const Input &input) {
 void CapsuleFeedMenu::FeedSelected() {
        if (itemMenu.Selected()) {
                // TODO: feed and grow animations
-               GetCapsule().Feed(itemMenu.Selected());
-               parent->Game().state->inventory.Remove(itemMenu.Selected(), 1);
-               LoadInventory();
+               if (GetCapsule().IsHungry()) {
+                       GetCapsule().Feed(itemMenu.Selected());
+                       parent->Game().state->inventory.Remove(itemMenu.Selected(), 1);
+                       LoadInventory();
+               } else if (itemMenu.Selected() == GetCapsule().UpgradeItem()) {
+                       GetCapsule().UpgradeSpecial();
+                       parent->Game().state->inventory.Remove(itemMenu.Selected(), 1);
+                       LoadInventory();
+               } else {
+                       // error beep
+               }
        } else {
-               // beep
+               // also beep
        }
 }
 
 
-void CapsuleFeedMenu::UpdateWorld(float deltaT) {
+void CapsuleFeedMenu::UpdateWorld(Uint32 deltaT) {
 
 }