aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/item.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2018-03-22 18:31:18 -0400
committerPaul Gilbert2018-03-22 18:31:18 -0400
commitd725d78ec5e58d84433634ce1d6171c722df46bc (patch)
tree93995c7717f5a071d1cf9c421ad77f0ad1089e00 /engines/xeen/item.cpp
parentd623ec2c38e62567525cc84554a3fd7c4e3bfef4 (diff)
downloadscummvm-rg350-d725d78ec5e58d84433634ce1d6171c722df46bc.tar.gz
scummvm-rg350-d725d78ec5e58d84433634ce1d6171c722df46bc.tar.bz2
scummvm-rg350-d725d78ec5e58d84433634ce1d6171c722df46bc.zip
XEEN: Fix implementation of breakAllItems
Diffstat (limited to 'engines/xeen/item.cpp')
-rw-r--r--engines/xeen/item.cpp35
1 files changed, 18 insertions, 17 deletions
diff --git a/engines/xeen/item.cpp b/engines/xeen/item.cpp
index b722d9152d..fe9e4ab052 100644
--- a/engines/xeen/item.cpp
+++ b/engines/xeen/item.cpp
@@ -629,30 +629,31 @@ Common::String MiscItems::getAttributes(XeenItem &item, const Common::String &cl
}
/*------------------------------------------------------------------------*/
-InventoryItemsGroup::InventoryItemsGroup(InventoryItems &weapons, InventoryItems &armor,
- InventoryItems &accessories, InventoryItems &misc) {
- _itemSets[0] = &weapons;
- _itemSets[1] = &armor;
- _itemSets[2] = &accessories;
- _itemSets[3] = &misc;
-}
-
InventoryItems &InventoryItemsGroup::operator[](ItemCategory category) {
- return *_itemSets[category];
+ switch (category) {
+ case CATEGORY_WEAPON:
+ return _owner->_weapons;
+ case CATEGORY_ARMOR:
+ return _owner->_armor;
+ case CATEGORY_ACCESSORY:
+ return _owner->_accessories;
+ default:
+ return _owner->_misc;
+ }
}
void InventoryItemsGroup::breakAllItems() {
for (int idx = 0; idx < INV_ITEMS_TOTAL; ++idx) {
- if ((*_itemSets[0])[idx]._id != 34) {
- (*_itemSets[0])[idx]._bonusFlags |= ITEMFLAG_BROKEN;
- (*_itemSets[0])[idx]._frame = 0;
+ if (_owner->_weapons[idx]._id != 34) {
+ _owner->_weapons[idx]._bonusFlags |= ITEMFLAG_BROKEN;
+ _owner->_weapons[idx]._frame = 0;
}
- (*_itemSets[1])[idx]._bonusFlags |= ITEMFLAG_BROKEN;
- (*_itemSets[2])[idx]._bonusFlags |= ITEMFLAG_BROKEN;
- (*_itemSets[3])[idx]._bonusFlags |= ITEMFLAG_BROKEN;
- (*_itemSets[1])[idx]._frame = 0;
- (*_itemSets[2])[idx]._frame = 0;
+ _owner->_armor[idx]._bonusFlags |= ITEMFLAG_BROKEN;
+ _owner->_accessories[idx]._bonusFlags |= ITEMFLAG_BROKEN;
+ _owner->_misc[idx]._bonusFlags |= ITEMFLAG_BROKEN;
+ _owner->_armor[idx]._frame = 0;
+ _owner->_accessories[idx]._frame = 0;
}
}