diff options
author | rubenwardy <rw@rubenwardy.com> | 2018-04-06 09:52:29 +0100 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2018-04-06 10:52:29 +0200 |
commit | 91615f9588420fd716978552fdacf1323b8df11c (patch) | |
tree | 951b1c139c09056d0d31bc4b8e0d13fd2d69c8bb /src/remoteplayer.cpp | |
parent | 7e3f88f539109955b21a129e4203a1cadb913483 (diff) | |
download | hax-minetest-server-91615f9588420fd716978552fdacf1323b8df11c.tar.gz hax-minetest-server-91615f9588420fd716978552fdacf1323b8df11c.zip |
Add player:get_meta(), deprecate player attributes (#7202)
* Add player:get_meta(), deprecate player attributes
Diffstat (limited to '')
-rw-r--r-- | src/remoteplayer.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/remoteplayer.cpp b/src/remoteplayer.cpp index f8f31d928..d070eb7e4 100644 --- a/src/remoteplayer.cpp +++ b/src/remoteplayer.cpp @@ -72,14 +72,15 @@ void RemotePlayer::serializeExtraAttributes(std::string &output) { assert(m_sao); Json::Value json_root; - const PlayerAttributes &attrs = m_sao->getExtendedAttributes(); + + const StringMap &attrs = m_sao->getMeta().getStrings(); for (const auto &attr : attrs) { json_root[attr.first] = attr.second; } output = fastWriteJson(json_root); - m_sao->setExtendedAttributeModified(false); + m_sao->getMeta().setModified(false); } @@ -132,8 +133,9 @@ void RemotePlayer::deSerialize(std::istream &is, const std::string &playername, const Json::Value::Members attr_list = attr_root.getMemberNames(); for (const auto &it : attr_list) { Json::Value attr_value = attr_root[it]; - sao->setExtendedAttribute(it, attr_value.asString()); + sao->getMeta().setString(it, attr_value.asString()); } + sao->getMeta().setModified(false); } catch (SettingNotFoundException &e) {} } |