diff options
author | SmallJoker <mk939@ymail.com> | 2019-09-10 21:18:42 +0200 |
---|---|---|
committer | SmallJoker <mk939@ymail.com> | 2019-09-14 19:43:08 +0200 |
commit | 9acd36bf9981cf9cb8e82785508d6eb7f010cc77 (patch) | |
tree | 6f0fae04efa009e8fd0a13dd0ab613c8010ae764 /src/network | |
parent | b0baa698a495cc990ce5d9c22763957f1138aed3 (diff) | |
download | minetest-9acd36bf9981cf9cb8e82785508d6eb7f010cc77.tar.gz minetest-9acd36bf9981cf9cb8e82785508d6eb7f010cc77.tar.bz2 minetest-9acd36bf9981cf9cb8e82785508d6eb7f010cc77.zip |
Formspecs: Introduce formspec_version to mods
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/networkprotocol.h | 12 | ||||
-rw-r--r-- | src/network/serverpackethandler.cpp | 3 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/network/networkprotocol.h b/src/network/networkprotocol.h index 05737d0a9..f603ed6c5 100644 --- a/src/network/networkprotocol.h +++ b/src/network/networkprotocol.h @@ -198,6 +198,7 @@ with this program; if not, write to the Free Software Foundation, Inc., PROTOCOL VERSION 38: Incremental inventory sending mode Unknown inventory serialization fields no longer throw an error + Mod-specific formspec version */ #define LATEST_PROTOCOL_VERSION 38 @@ -219,7 +220,16 @@ with this program; if not, write to the Free Software Foundation, Inc., #define PASSWORD_SIZE 28 // Maximum password length. Allows for // base64-encoded SHA-1 (27+\0). -#define FORMSPEC_API_VERSION 1 +/* + Changes by FORMSPEC_API_VERSION: + + FORMSPEC VERSION 1: + (too much) + FORMSPEC VERSION 2: + Forced real coordinates + background[]: 9-slice scaling parameters +*/ +#define FORMSPEC_API_VERSION 2 #define FORMSPEC_VERSION_STRING "formspec_version[" TOSTRING(FORMSPEC_API_VERSION) "]" #define TEXTURENAME_ALLOWED_CHARS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.-" diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp index 6cb3b3520..9999a1690 100644 --- a/src/network/serverpackethandler.cpp +++ b/src/network/serverpackethandler.cpp @@ -386,6 +386,9 @@ void Server::handleCommand_ClientReady(NetworkPacket* pkt) peer_id, major_ver, minor_ver, patch_ver, full_ver); + if (pkt->getRemainingBytes() >= 2) + *pkt >> playersao->getPlayer()->formspec_version; + const std::vector<std::string> &players = m_clients.getPlayerNames(); NetworkPacket list_pkt(TOCLIENT_UPDATE_PLAYER_LIST, 0, peer_id); list_pkt << (u8) PLAYER_LIST_INIT << (u16) players.size(); |