From 8eb9ad50f8ddf23147b999fa40c6231a1a623d41 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 4 Feb 2015 20:22:59 -0500 Subject: XEEN: Split Character class into it's own file --- engines/xeen/items.cpp | 86 -------------------------------------------------- 1 file changed, 86 deletions(-) (limited to 'engines/xeen/items.cpp') diff --git a/engines/xeen/items.cpp b/engines/xeen/items.cpp index 13418262bd..b9b531db7b 100644 --- a/engines/xeen/items.cpp +++ b/engines/xeen/items.cpp @@ -25,92 +25,6 @@ namespace Xeen { -XeenItem::XeenItem() { - clear(); -} - -void XeenItem::clear() { - _material = _id = _bonusFlags = 0; - _frame = 0; -} - -void XeenItem::synchronize(Common::Serializer &s) { - s.syncAsByte(_material); - s.syncAsByte(_id); - s.syncAsByte(_bonusFlags); - s.syncAsByte(_frame); -} - -int XeenItem::getElementalCategory() const { - int idx; - for (idx = 0; ELEMENTAL_CATEGORIES[idx] < _material; ++idx) - ; - - return idx; -} - -int XeenItem::getAttributeCategory() const { - int m = _material - 59; - int idx; - for (idx = 0; ATTRIBUTE_CATEGORIES[idx] < m; ++idx) - ; - - return idx; -} - -/*------------------------------------------------------------------------*/ - -InventoryItems::InventoryItems() : Common::Array((XeenItem *)nullptr, INV_ITEMS_TOTAL) { -} - -void InventoryItems::discardItem(int itemIndex) { - operator[](itemIndex).clear(); - sort(); -} - -void InventoryItems::sort() { - for (uint idx = 0; idx < size(); ++idx) { - if (operator[](idx)._id == 0) { - // Found empty slot - operator[](idx).clear(); - - // Scan through the rest of the list to find any item - for (uint idx2 = idx + 1; idx2 < size(); ++idx2) { - if (operator[](idx2)._id) { - // Found an item, so move it into the blank slot - operator[](idx) = operator[](idx2); - operator[](idx2).clear(); - break; - } - } - } - } -} - -void InventoryItems::equipItem(int itemIndex) { - error("TODO"); -} - -void InventoryItems::removeItem(int itemIndex) { - error("TODO"); -} - -/*------------------------------------------------------------------------*/ - -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]; -} - -/*------------------------------------------------------------------------*/ - Treasure::Treasure() { _hasItems = false; } -- cgit v1.2.3