1
0

Merge pull request #2564 from cuberite/update_jsoncpp_no_jsoncpp

Update Loops required for JsonCPP
This commit is contained in:
Mattes D 2015-10-26 07:41:07 +01:00
commit 1a2cc9e497
4 changed files with 12 additions and 12 deletions

View File

@ -75,10 +75,10 @@ void cEnderChestEntity::OpenNewWindow()
void cEnderChestEntity::LoadFromJson(const Json::Value & a_Value, cItemGrid & a_Grid)
{
int SlotIdx = 0;
for (Json::Value::iterator itr = a_Value.begin(); itr != a_Value.end(); ++itr)
for (auto & Node : a_Value)
{
cItem Item;
Item.FromJson(*itr);
Item.FromJson(Node);
a_Grid.SetSlot(SlotIdx, Item);
SlotIdx++;
}

View File

@ -3222,11 +3222,11 @@ void cProtocol176::SendPlayerSpawn(const cPlayer & a_Player)
const Json::Value & Properties = a_Player.GetClientHandle()->GetProperties();
Pkt.WriteVarInt32(Properties.size());
for (Json::Value::iterator itr = Properties.begin(), end = Properties.end(); itr != end; ++itr)
for (auto & Node : Properties)
{
Pkt.WriteString(itr->get("name", "").asString());
Pkt.WriteString(itr->get("value", "").asString());
Pkt.WriteString(itr->get("signature", "").asString());
Pkt.WriteString(Node.get("name", "").asString());
Pkt.WriteString(Node.get("value", "").asString());
Pkt.WriteString(Node.get("signature", "").asString());
}
Pkt.WriteFPInt(a_Player.GetPosX());

View File

@ -853,11 +853,11 @@ void cProtocol180::SendPlayerListAddPlayer(const cPlayer & a_Player)
const Json::Value & Properties = a_Player.GetClientHandle()->GetProperties();
Pkt.WriteVarInt32(Properties.size());
for (Json::Value::iterator itr = Properties.begin(), end = Properties.end(); itr != end; ++itr)
for (auto & Node : Properties)
{
Pkt.WriteString(static_cast<Json::Value>(*itr).get("name", "").asString());
Pkt.WriteString(static_cast<Json::Value>(*itr).get("value", "").asString());
AString Signature = static_cast<Json::Value>(*itr).get("signature", "").asString();
Pkt.WriteString(Node.get("name", "").asString());
Pkt.WriteString(Node.get("value", "").asString());
AString Signature = Node.get("signature", "").asString();
if (Signature.empty())
{
Pkt.WriteBool(false);

View File

@ -102,7 +102,7 @@ bool cStatSerializer::LoadStatFromJSON(const Json::Value & a_In)
{
m_Manager->Reset();
for (Json::ValueIterator it = a_In.begin() ; it != a_In.end() ; ++it)
for (Json::Value::const_iterator it = a_In.begin() ; it != a_In.end() ; ++it)
{
AString StatName = it.key().asString();
@ -114,7 +114,7 @@ bool cStatSerializer::LoadStatFromJSON(const Json::Value & a_In)
continue;
}
Json::Value & Node = *it;
const Json::Value & Node = *it;
if (Node.isInt())
{