| 35 | |
| 36 | |
| 37 | bool cChestEntity::LoadFromJson(const Json::Value & a_Value) |
| 38 | { |
| 39 | m_PosX = a_Value.get("x", 0).asInt(); |
| 40 | m_PosY = a_Value.get("y", 0).asInt(); |
| 41 | m_PosZ = a_Value.get("z", 0).asInt(); |
| 42 | |
| 43 | Json::Value AllSlots = a_Value.get("Slots", 0); |
| 44 | int SlotIdx = 0; |
| 45 | for (Json::Value::iterator itr = AllSlots.begin(); itr != AllSlots.end(); ++itr) |
| 46 | { |
| 47 | cItem Item; |
| 48 | Item.FromJson(*itr); |
| 49 | SetSlot(SlotIdx, Item); |
| 50 | SlotIdx++; |
| 51 | } |
| 52 | return true; |
| 53 | } |
| 54 | |
| 55 | |
| 56 |