From 0b1d09ff4f4e92986f6abdbc57db97c18707196a Mon Sep 17 00:00:00 2001 From: sapier Date: Thu, 3 Jan 2013 17:59:28 +0000 Subject: Fix buttons not working for Lua-triggered formspecs --- src/game.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index ca992c056..c8f1d2187 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -118,13 +118,20 @@ struct TextDestPlayerInventory : public TextDest TextDestPlayerInventory(Client *client) { m_client = client; + m_formname = ""; + } + TextDestPlayerInventory(Client *client, std::string formname) + { + m_client = client; + m_formname = formname; } void gotText(std::map fields) { - m_client->sendInventoryFields("", fields); + m_client->sendInventoryFields(m_formname, fields); } Client *m_client; + std::string m_formname; }; /* Respawn menu callback */ @@ -2154,6 +2161,7 @@ void the_game( &g_menumgr, &client, gamedef); menu->setFormSource(current_formspec); + menu->setTextDest(new TextDestPlayerInventory(&client,*(event.show_formspec.formname))); menu->drop(); } else @@ -2162,6 +2170,7 @@ void the_game( current_formspec->setForm(*(event.show_formspec.formspec)); } delete(event.show_formspec.formspec); + delete(event.show_formspec.formname); } else if(event.type == CE_TEXTURES_UPDATED) { -- cgit v1.2.3