fix equip slot check

This commit is contained in:
Martin Michelsen
2023-11-15 15:22:50 -08:00
parent 3d7b6837ec
commit f997376819
4 changed files with 39 additions and 9 deletions
+4
View File
@@ -570,6 +570,10 @@ void PlayerInventory::equip_item(uint32_t item_id, EquipSlot slot) {
size_t index = this->find_item(item_id);
auto& item = this->items[index];
if (slot == EquipSlot::UNKNOWN) {
slot = item.data.default_equip_slot();
}
if (!item.data.can_be_equipped_in_slot(slot)) {
throw runtime_error("incorrect item type for equip slot");
}