From 91615f9588420fd716978552fdacf1323b8df11c Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Fri, 6 Apr 2018 09:52:29 +0100 Subject: Add player:get_meta(), deprecate player attributes (#7202) * Add player:get_meta(), deprecate player attributes --- src/remoteplayer.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/remoteplayer.cpp') 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) {} } -- cgit v1.2.3