aboutsummaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 768bb5602..69b3c321a 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -132,6 +132,28 @@ private:
Client *m_client;
};
+/* Form update callback */
+
+class NodeMetadataFormSource: public IFormSource
+{
+public:
+ NodeMetadataFormSource(ClientMap *map, v3s16 p):
+ m_map(map),
+ m_p(p)
+ {
+ }
+ std::string getForm()
+ {
+ NodeMetadata *meta = m_map->getNodeMetadata(m_p);
+ if(!meta)
+ return "";
+ return meta->getString("formspec");
+ }
+
+ ClientMap *m_map;
+ v3s16 m_p;
+};
+
/*
Hotbar draw routine
*/
@@ -2348,6 +2370,8 @@ void the_game(
&client, gamedef);
menu->setFormSpec(meta->getString("formspec"),
inventoryloc);
+ menu->setFormSource(new NodeMetadataFormSource(
+ &client.getEnv().getClientMap(), nodepos));
menu->drop();
}
// Otherwise report right click to server