From 4cc98d7add7b697ac302a6136bbeb95ef78cec45 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 22 Jul 2012 17:10:58 +0300 Subject: minetest.register_on_player_receive_fields() --- src/client.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/client.cpp') diff --git a/src/client.cpp b/src/client.cpp index fdfb49c84..3a2edede3 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1773,6 +1773,29 @@ void Client::sendNodemetaFields(v3s16 p, const std::string &formname, Send(0, data, true); } +void Client::sendInventoryFields(const std::string &formname, + const std::map &fields) +{ + std::ostringstream os(std::ios_base::binary); + + writeU16(os, TOSERVER_INVENTORY_FIELDS); + os<::const_iterator + i = fields.begin(); i != fields.end(); i++){ + const std::string &name = i->first; + const std::string &value = i->second; + os< data((u8*)s.c_str(), s.size()); + // Send as reliable + Send(0, data, true); +} + void Client::sendInventoryAction(InventoryAction *a) { std::ostringstream os(std::ios_base::binary); -- cgit v1.2.3