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/game.cpp | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index 815a5dd85..5bc3e7625 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1569,24 +1569,18 @@ void the_game( GUIInventoryMenu *menu = new GUIInventoryMenu(guienv, guiroot, -1, - &g_menumgr, v2s16(8,7), + &g_menumgr, &client, gamedef); InventoryLocation inventoryloc; inventoryloc.setCurrentPlayer(); - core::array draw_spec; - draw_spec.push_back(GUIInventoryMenu::DrawSpec( - "list", inventoryloc, "main", - v2s32(0, 3), v2s32(8, 4))); - draw_spec.push_back(GUIInventoryMenu::DrawSpec( - "list", inventoryloc, "craft", - v2s32(3, 0), v2s32(3, 3))); - draw_spec.push_back(GUIInventoryMenu::DrawSpec( - "list", inventoryloc, "craftpreview", - v2s32(7, 1), v2s32(1, 1))); - - menu->setDrawSpec(draw_spec); + menu->setFormSpec( + "invsize[8,7;]" + "list[current_player;main;0,3;8,4;]" + "list[current_player;craft;3,0;3,3;]" + "list[current_player;craftpreview;7,1;1,1;]" + , inventoryloc); menu->drop(); } @@ -2345,23 +2339,14 @@ void the_game( InventoryLocation inventoryloc; inventoryloc.setNodeMeta(nodepos); - - /* - Create menu - */ - - core::array draw_spec; - v2s16 invsize = - GUIInventoryMenu::makeDrawSpecArrayFromString( - draw_spec, - meta->getString("formspec"), - inventoryloc); + /* Create menu */ GUIInventoryMenu *menu = new GUIInventoryMenu(guienv, guiroot, -1, - &g_menumgr, invsize, + &g_menumgr, &client, gamedef); - menu->setDrawSpec(draw_spec); + menu->setFormSpec(meta->getString("formspec"), + inventoryloc); menu->drop(); } // Otherwise report right click to server -- cgit v1.2.3