From: Daniel Karbach Date: Fri, 30 Oct 2015 13:05:05 +0000 (+0100) Subject: use player's inventory slot directly in interface X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=465bd7f96fbae44067bd342649e52c9187853b39;p=blank.git use player's inventory slot directly in interface --- diff --git a/src/ui/Interface.hpp b/src/ui/Interface.hpp index 92d1c94..9a6e927 100644 --- a/src/ui/Interface.hpp +++ b/src/ui/Interface.hpp @@ -42,7 +42,6 @@ private: ClientController &client_ctrl; glm::ivec3 fwd, rev; - int slot; int num_slots; bool locked; diff --git a/src/ui/ui.cpp b/src/ui/ui.cpp index 8563f7d..263245c 100644 --- a/src/ui/ui.cpp +++ b/src/ui/ui.cpp @@ -511,7 +511,6 @@ Interface::Interface( , client_ctrl(cc) , fwd(0) , rev(0) -, slot(0) , num_slots(10) , locked(false) { @@ -711,7 +710,7 @@ void Interface::UpdateMovement() { } void Interface::InvAbs(int s) { - slot = s % num_slots; + int slot = s % num_slots; while (slot < 0) { slot += num_slots; } @@ -719,7 +718,7 @@ void Interface::InvAbs(int s) { } void Interface::InvRel(int delta) { - InvAbs(slot + delta); + InvAbs(player_ctrl.GetPlayer().GetInventorySlot() + delta); }