05-23-2016, 02:53 AM
Duplication should work just fine and ToNBT is called way more often than ToJson, so not much to win there. But yeah, using json::value to store it could work.
If we change it to Json::Value, we need to add ToNBT and FromNBT to the cItemHandler.
So a quick pro/con for using Json::Value would be:
Pros:
-easier to get to the data (no casting or including)
-easier to expose to lua?
-no need for a custom copy constructor and assignment op in cItem
Cons:
-adds more overhead (slower, more memory use)
-data structure is unclear
-no type checking
If we change it to Json::Value, we need to add ToNBT and FromNBT to the cItemHandler.
So a quick pro/con for using Json::Value would be:
Pros:
-easier to get to the data (no casting or including)
-easier to expose to lua?
-no need for a custom copy constructor and assignment op in cItem
Cons:
-adds more overhead (slower, more memory use)
-data structure is unclear
-no type checking