| 145 | |
| 146 | |
| 147 | bool cDropSpenserEntity::LoadFromJson(const Json::Value & a_Value) |
| 148 | { |
| 149 | m_PosX = a_Value.get("x", 0).asInt(); |
| 150 | m_PosY = a_Value.get("y", 0).asInt(); |
| 151 | m_PosZ = a_Value.get("z", 0).asInt(); |
| 152 | |
| 153 | Json::Value AllSlots = a_Value.get("Slots", 0); |
| 154 | int SlotIdx = 0; |
| 155 | for (Json::Value::iterator itr = AllSlots.begin(); itr != AllSlots.end(); ++itr) |
| 156 | { |
| 157 | cItem Contents; |
| 158 | Contents.FromJson(*itr); |
| 159 | m_Contents.SetSlot(SlotIdx, Contents); |
| 160 | SlotIdx++; |
| 161 | if (SlotIdx >= m_Contents.GetNumSlots()) |
| 162 | { |
| 163 | return true; |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | return true; |
| 168 | } |
| 169 | |
| 170 | |
| 171 | |