Merge pull request #2564 from cuberite/update_jsoncpp_no_jsoncpp
Update Loops required for JsonCPP
This commit is contained in:
commit
1a2cc9e497
@ -75,10 +75,10 @@ void cEnderChestEntity::OpenNewWindow()
|
|||||||
void cEnderChestEntity::LoadFromJson(const Json::Value & a_Value, cItemGrid & a_Grid)
|
void cEnderChestEntity::LoadFromJson(const Json::Value & a_Value, cItemGrid & a_Grid)
|
||||||
{
|
{
|
||||||
int SlotIdx = 0;
|
int SlotIdx = 0;
|
||||||
for (Json::Value::iterator itr = a_Value.begin(); itr != a_Value.end(); ++itr)
|
for (auto & Node : a_Value)
|
||||||
{
|
{
|
||||||
cItem Item;
|
cItem Item;
|
||||||
Item.FromJson(*itr);
|
Item.FromJson(Node);
|
||||||
a_Grid.SetSlot(SlotIdx, Item);
|
a_Grid.SetSlot(SlotIdx, Item);
|
||||||
SlotIdx++;
|
SlotIdx++;
|
||||||
}
|
}
|
||||||
|
@ -3222,11 +3222,11 @@ void cProtocol176::SendPlayerSpawn(const cPlayer & a_Player)
|
|||||||
const Json::Value & Properties = a_Player.GetClientHandle()->GetProperties();
|
const Json::Value & Properties = a_Player.GetClientHandle()->GetProperties();
|
||||||
Pkt.WriteVarInt32(Properties.size());
|
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(Node.get("name", "").asString());
|
||||||
Pkt.WriteString(itr->get("value", "").asString());
|
Pkt.WriteString(Node.get("value", "").asString());
|
||||||
Pkt.WriteString(itr->get("signature", "").asString());
|
Pkt.WriteString(Node.get("signature", "").asString());
|
||||||
}
|
}
|
||||||
|
|
||||||
Pkt.WriteFPInt(a_Player.GetPosX());
|
Pkt.WriteFPInt(a_Player.GetPosX());
|
||||||
|
@ -853,11 +853,11 @@ void cProtocol180::SendPlayerListAddPlayer(const cPlayer & a_Player)
|
|||||||
|
|
||||||
const Json::Value & Properties = a_Player.GetClientHandle()->GetProperties();
|
const Json::Value & Properties = a_Player.GetClientHandle()->GetProperties();
|
||||||
Pkt.WriteVarInt32(Properties.size());
|
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(Node.get("name", "").asString());
|
||||||
Pkt.WriteString(static_cast<Json::Value>(*itr).get("value", "").asString());
|
Pkt.WriteString(Node.get("value", "").asString());
|
||||||
AString Signature = static_cast<Json::Value>(*itr).get("signature", "").asString();
|
AString Signature = Node.get("signature", "").asString();
|
||||||
if (Signature.empty())
|
if (Signature.empty())
|
||||||
{
|
{
|
||||||
Pkt.WriteBool(false);
|
Pkt.WriteBool(false);
|
||||||
|
@ -102,7 +102,7 @@ bool cStatSerializer::LoadStatFromJSON(const Json::Value & a_In)
|
|||||||
{
|
{
|
||||||
m_Manager->Reset();
|
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();
|
AString StatName = it.key().asString();
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ bool cStatSerializer::LoadStatFromJSON(const Json::Value & a_In)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value & Node = *it;
|
const Json::Value & Node = *it;
|
||||||
|
|
||||||
if (Node.isInt())
|
if (Node.isInt())
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user