diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-04-04 05:12:33 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-04-04 05:12:33 +0300 |
commit | fa736e138c2eb04f50bcc0431fc5a0435bf34bc6 (patch) | |
tree | ec56483bbb6196b5959d9c43a16e04f3b26e227b /src/client.cpp | |
parent | fa08294d09a46b603e9ff5e034010c0a7986c61a (diff) | |
download | minetest-fa736e138c2eb04f50bcc0431fc5a0435bf34bc6.tar.gz minetest-fa736e138c2eb04f50bcc0431fc5a0435bf34bc6.tar.bz2 minetest-fa736e138c2eb04f50bcc0431fc5a0435bf34bc6.zip |
fully implemented the sign with the new framework
Diffstat (limited to 'src/client.cpp')
-rw-r--r-- | src/client.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/client.cpp b/src/client.cpp index 009591c41..2fb14cb68 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1630,6 +1630,40 @@ void Client::sendSignText(v3s16 blockpos, s16 id, std::string text) Send(0, data, true); } +void Client::sendSignNodeText(v3s16 p, std::string text) +{ + /* + u16 command + v3s16 p + u16 textlen + textdata + */ + std::ostringstream os(std::ios_base::binary); + u8 buf[12]; + + // Write command + writeU16(buf, TOSERVER_SIGNNODETEXT); + os.write((char*)buf, 2); + + // Write p + writeV3S16(buf, p); + os.write((char*)buf, 6); + + u16 textlen = text.size(); + // Write text length + writeS16(buf, textlen); + os.write((char*)buf, 2); + + // Write text + os.write((char*)text.c_str(), textlen); + + // Make data buffer + std::string s = os.str(); + SharedBuffer<u8> 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); |