From da9707950e0f69d8a906572fc55f516277e057c4 Mon Sep 17 00:00:00 2001 From: sapier Date: Wed, 2 Jan 2013 19:45:04 +0000 Subject: Add TOCLIENT_SHOW_FORMSPEC to display formspecs at client from lua --- src/client.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/client.cpp') 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 " -- cgit v1.2.3