handle inventory extension data properly
This commit is contained in:
+5
-5
@@ -257,20 +257,20 @@ uint8_t Lobby::game_event_for_lobby_event(uint8_t lobby_event) {
|
||||
return lobby_event;
|
||||
}
|
||||
|
||||
void Lobby::add_item(const PlayerInventoryItem& item, uint8_t area, float x, float z) {
|
||||
auto& fi = this->item_id_to_floor_item[item.data.id];
|
||||
fi.inv_item = item;
|
||||
void Lobby::add_item(const ItemData& data, uint8_t area, float x, float z) {
|
||||
auto& fi = this->item_id_to_floor_item[data.id];
|
||||
fi.data = data;
|
||||
fi.area = area;
|
||||
fi.x = x;
|
||||
fi.z = z;
|
||||
}
|
||||
|
||||
PlayerInventoryItem Lobby::remove_item(uint32_t item_id) {
|
||||
ItemData Lobby::remove_item(uint32_t item_id) {
|
||||
auto item_it = this->item_id_to_floor_item.find(item_id);
|
||||
if (item_it == this->item_id_to_floor_item.end()) {
|
||||
throw out_of_range("item not present");
|
||||
}
|
||||
PlayerInventoryItem ret = std::move(item_it->second.inv_item);
|
||||
ItemData ret = item_it->second.data;
|
||||
this->item_id_to_floor_item.erase(item_it);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user