diff options
author | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-10-31 22:30:14 +0100 |
---|---|---|
committer | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-10-31 22:30:14 +0100 |
commit | c2b43f33da1461939df43657752ffd3651933b6e (patch) | |
tree | 7dd0f79d11496bd04bcebe6d2af83e77b6dbcfa4 /source/cChestEntity.cpp | |
parent | denotch map converter can now successfully converter an mcr to a vaild pak file. Takes about 20 seconds per region file. (diff) | |
download | cuberite-c2b43f33da1461939df43657752ffd3651933b6e.tar cuberite-c2b43f33da1461939df43657752ffd3651933b6e.tar.gz cuberite-c2b43f33da1461939df43657752ffd3651933b6e.tar.bz2 cuberite-c2b43f33da1461939df43657752ffd3651933b6e.tar.lz cuberite-c2b43f33da1461939df43657752ffd3651933b6e.tar.xz cuberite-c2b43f33da1461939df43657752ffd3651933b6e.tar.zst cuberite-c2b43f33da1461939df43657752ffd3651933b6e.zip |
Diffstat (limited to 'source/cChestEntity.cpp')
-rw-r--r-- | source/cChestEntity.cpp | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/source/cChestEntity.cpp b/source/cChestEntity.cpp index 54a06fcb9..9ec46014d 100644 --- a/source/cChestEntity.cpp +++ b/source/cChestEntity.cpp @@ -111,14 +111,8 @@ bool cChestEntity::LoadFromJson( const Json::Value& a_Value ) int SlotIdx = 0;
for( Json::Value::iterator itr = AllSlots.begin(); itr != AllSlots.end(); ++itr )
{
- Json::Value & Slot = *itr;
cItem Item;
- Item.m_ItemID = (ENUM_ITEM_ID)Slot.get("ID", -1 ).asInt();
- if( Item.m_ItemID > 0 )
- {
- Item.m_ItemCount = (char)Slot.get("Count", -1 ).asInt();
- Item.m_ItemHealth = (short)Slot.get("Health", -1 ).asInt();
- }
+ Item.FromJson( *itr );
SetSlot( SlotIdx, Item );
SlotIdx++;
}
@@ -137,15 +131,7 @@ void cChestEntity::SaveToJson( Json::Value& a_Value ) {
Json::Value Slot;
cItem* Item = GetSlot( i );
- if( Item )
- {
- Slot["ID"] = Item->m_ItemID;
- if( Item->m_ItemID > 0 )
- {
- Slot["Count"] = Item->m_ItemCount;
- Slot["Health"] = Item->m_ItemHealth;
- }
- }
+ if( Item ) Item->GetJson( Slot );
AllSlots.append( Slot );
}
a_Value["Slots"] = AllSlots;
|