summaryrefslogtreecommitdiffstats
path: root/source/cItem.cpp
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-31 22:30:14 +0100
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-31 22:30:14 +0100
commitc2b43f33da1461939df43657752ffd3651933b6e (patch)
tree7dd0f79d11496bd04bcebe6d2af83e77b6dbcfa4 /source/cItem.cpp
parentdenotch map converter can now successfully converter an mcr to a vaild pak file. Takes about 20 seconds per region file. (diff)
downloadcuberite-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 '')
-rw-r--r--source/cItem.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/cItem.cpp b/source/cItem.cpp
new file mode 100644
index 000000000..b91a7a316
--- /dev/null
+++ b/source/cItem.cpp
@@ -0,0 +1,22 @@
+#include "cItem.h"
+#include <json/json.h>
+
+void cItem::GetJson( Json::Value & a_OutValue )
+{
+ a_OutValue["ID"] = m_ItemID;
+ if( m_ItemID > 0 )
+ {
+ a_OutValue["Count"] = m_ItemCount;
+ a_OutValue["Health"] = m_ItemHealth;
+ }
+}
+
+void cItem::FromJson( const Json::Value & a_Value )
+{
+ m_ItemID = (ENUM_ITEM_ID)a_Value.get("ID", -1 ).asInt();
+ if( m_ItemID > 0 )
+ {
+ m_ItemCount = (char)a_Value.get("Count", -1 ).asInt();
+ m_ItemHealth = (short)a_Value.get("Health", -1 ).asInt();
+ }
+} \ No newline at end of file