| 1075 | } |
| 1076 | |
| 1077 | void PlayerInventory::netElementsNeedLoad(bool) { |
| 1078 | auto itemDatabase = Root::singleton().itemDatabase(); |
| 1079 | |
| 1080 | auto deserializeItem = [&itemDatabase](NetElementData<ItemDescriptor>& netState, ItemPtr& item) { |
| 1081 | if (netState.pullUpdated()) |
| 1082 | itemDatabase->loadItem(netState.get(), item); |
| 1083 | }; |
| 1084 | |
| 1085 | auto deserializeItemList = [&](List<NetElementData<ItemDescriptor>>& netStatesList, List<ItemPtr>& itemList) { |
| 1086 | for (size_t i = 0; i < netStatesList.size(); ++i) |
| 1087 | deserializeItem(netStatesList[i], itemList[i]); |
| 1088 | }; |
| 1089 | |
| 1090 | auto deserializeItemMap = [&](auto& netStatesMap, auto& itemMap) { |
| 1091 | for (auto k : netStatesMap.keys()) |
| 1092 | deserializeItem(netStatesMap[k], itemMap[k]); |
| 1093 | }; |
| 1094 | |
| 1095 | deserializeItemMap(m_equipmentNetState, m_equipment); |
| 1096 | |
| 1097 | for (auto bagType : m_bagsNetState.keys()) |
| 1098 | deserializeItemList(m_bagsNetState[bagType], m_bags[bagType]->items()); |
| 1099 | |
| 1100 | deserializeItem(m_swapSlotNetState, m_swapSlot); |
| 1101 | deserializeItem(m_trashSlotNetState, m_trashSlot); |
| 1102 | |
| 1103 | m_currencies = m_currenciesNetState.get(); |
| 1104 | |
| 1105 | m_customBarGroup = m_customBarGroupNetState.get(); |
| 1106 | m_customBarNetState.forEach([&](auto const& index, auto& ns) { |
| 1107 | m_customBar.at(index) = ns.get(); |
| 1108 | }); |
| 1109 | |
| 1110 | m_selectedActionBar = m_selectedActionBarNetState.get(); |
| 1111 | |
| 1112 | deserializeItemMap(m_essentialNetState, m_essential); |
| 1113 | |
| 1114 | cleanup(); |
| 1115 | } |
| 1116 | |
| 1117 | void PlayerInventory::netElementsNeedStore() { |
| 1118 | cleanup(); |
nothing calls this directly
no test coverage detected