From 7bf446f671541f38d6dc89d207ee6effd3564483 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 3 Jun 2012 16:03:19 +0300 Subject: Reshape inventory menu code --- src/guiInventoryMenu.h | 44 +++++++------------------------------------- 1 file changed, 7 insertions(+), 37 deletions(-) (limited to 'src/guiInventoryMenu.h') diff --git a/src/guiInventoryMenu.h b/src/guiInventoryMenu.h index ed8df88fc..4660ab2bf 100644 --- a/src/guiInventoryMenu.h +++ b/src/guiInventoryMenu.h @@ -84,49 +84,20 @@ class GUIInventoryMenu : public GUIModalMenu v2s32 geom; }; public: - struct DrawSpec - { - DrawSpec() - { - } - DrawSpec(const std::string &a_type, - const InventoryLocation &a_name, - const std::string &a_subname, - v2s32 a_pos, - v2s32 a_geom) - { - type = a_type; - name = a_name; - subname = a_subname; - pos = a_pos; - geom = a_geom; - } - - std::string type; - InventoryLocation name; - std::string subname; - v2s32 pos; - v2s32 geom; - }; - - // See .cpp for format - static v2s16 makeDrawSpecArrayFromString( - core::array &draw_spec, - const std::string &data, - const InventoryLocation ¤t_location); - GUIInventoryMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent, s32 id, IMenuManager *menumgr, - v2s16 menu_size, InventoryManager *invmgr, IGameDef *gamedef ); ~GUIInventoryMenu(); - void setDrawSpec(core::array &init_draw_spec) + void setFormSpec(const std::string &formspec_string, + InventoryLocation current_inventory_location) { - m_init_draw_spec = init_draw_spec; + m_formspec_string = formspec_string; + m_current_inventory_location = current_inventory_location; + regenerateGui(m_screensize_old); } void removeChildren(); @@ -149,8 +120,6 @@ protected: return padding + AbsoluteRect.UpperLeftCorner; } - v2s16 m_menu_size; - v2s32 padding; v2s32 spacing; v2s32 imgsize; @@ -158,7 +127,8 @@ protected: InventoryManager *m_invmgr; IGameDef *m_gamedef; - core::array m_init_draw_spec; + std::string m_formspec_string; + InventoryLocation m_current_inventory_location; core::array m_draw_spec; ItemSpec *m_selected_item; -- cgit v1.2.3