diff options
author | sapier <Sapier at GMX dot net> | 2013-01-02 19:45:04 +0000 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2013-01-02 20:59:37 +0200 |
commit | da9707950e0f69d8a906572fc55f516277e057c4 (patch) | |
tree | c8991d2c8f650d0735e69ff93fc9ebe0b32b141c /src/client.cpp | |
parent | 36f03a7f4ae81e8735328a38c9415b6e7081c37c (diff) | |
download | hax-minetest-server-da9707950e0f69d8a906572fc55f516277e057c4.tar.gz hax-minetest-server-da9707950e0f69d8a906572fc55f516277e057c4.zip |
Add TOCLIENT_SHOW_FORMSPEC to display formspecs at client from lua
Diffstat (limited to 'src/client.cpp')
-rw-r--r-- | src/client.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/client.cpp b/src/client.cpp index cb7afe29f..216d86cd4 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1900,6 +1900,20 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id) } inv->deSerialize(is); } + else if(command == TOCLIENT_SHOW_FORMSPEC) + { + std::string datastring((char*)&data[2], datasize-2); + std::istringstream is(datastring, std::ios_base::binary); + + std::string formspec = deSerializeLongString(is); + + ClientEvent event; + event.type = CE_SHOW_FORMSPEC; + // pointer is required as event is a struct only! + // adding a std:string to a struct isn't possible + event.show_formspec.formspec = new std::string(formspec); + m_client_event_queue.push_back(event); + } else { infostream<<"Client: Ignoring unknown command " |