diff options
author | Perttu Ahola <celeron55@gmail.com> | 2012-06-03 16:03:19 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-06-03 22:31:02 +0300 |
commit | 7bf446f671541f38d6dc89d207ee6effd3564483 (patch) | |
tree | 054438a63b10393f921d155cdfd99d5172967638 /src/game.cpp | |
parent | e4bc76f55cb3314a6e6cbd47e5dedd1923ad5328 (diff) | |
download | minetest-7bf446f671541f38d6dc89d207ee6effd3564483.tar.gz minetest-7bf446f671541f38d6dc89d207ee6effd3564483.tar.bz2 minetest-7bf446f671541f38d6dc89d207ee6effd3564483.zip |
Reshape inventory menu code
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 37 |
1 files changed, 11 insertions, 26 deletions
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<GUIInventoryMenu::DrawSpec> 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<GUIInventoryMenu::DrawSpec> 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 |