aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/dialogs_items.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2015-02-07 12:04:39 -0500
committerPaul Gilbert2015-02-07 12:04:39 -0500
commit4bd128be7f799719cca87b5cac3966ee042ac769 (patch)
treeecc8b706d2fe16db37dd583ad9ea3b632d718824 /engines/xeen/dialogs_items.cpp
parent5ffbe2de873e6ac789ce9eff298a4ab21d02196b (diff)
downloadscummvm-rg350-4bd128be7f799719cca87b5cac3966ee042ac769.tar.gz
scummvm-rg350-4bd128be7f799719cca87b5cac3966ee042ac769.tar.bz2
scummvm-rg350-4bd128be7f799719cca87b5cac3966ee042ac769.zip
XEEN: Finished doItemOptions
Diffstat (limited to 'engines/xeen/dialogs_items.cpp')
-rw-r--r--engines/xeen/dialogs_items.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/engines/xeen/dialogs_items.cpp b/engines/xeen/dialogs_items.cpp
index 8466097691..bbfbd95045 100644
--- a/engines/xeen/dialogs_items.cpp
+++ b/engines/xeen/dialogs_items.cpp
@@ -552,7 +552,8 @@ int ItemsDialog::doItemOptions(Character &c, int actionIndex, int itemIndex, Ite
XeenItem *itemCategories[4] = { &c._weapons[0], &c._armor[0], &c._accessories[0], &c._misc[0] };
XeenItem *items = itemCategories[category];
if (!items[0]._id)
- return false;
+ // Inventory is empty
+ return category == CATEGORY_MISC ? 0 : 2;
Window &w = screen._windows[11];
SpriteResource escSprites;
@@ -796,6 +797,11 @@ int ItemsDialog::doItemOptions(Character &c, int actionIndex, int itemIndex, Ite
break;
}
+ case ITEMMODE_TO_GOLD:
+ // Convert item in inventory to gold
+ itemToGold(c, itemIndex, category, mode);
+ return 2;
+
default:
break;
}
@@ -807,4 +813,26 @@ int ItemsDialog::doItemOptions(Character &c, int actionIndex, int itemIndex, Ite
return true;
}
+void ItemsDialog::itemToGold(Character &c, int itemIndex, ItemCategory category,
+ ItemsMode mode) {
+ XeenItem &item = c._items[category][itemIndex];
+ Party &party = *_vm->_party;
+ SoundManager &sound = *_vm->_sound;
+
+ if (category == CATEGORY_WEAPON && item._id == 34) {
+ sound.playFX(21);
+ ErrorScroll::show(_vm, Common::String::format("\v012\t000\x03c%s",
+ SPELL_FAILED));
+ } else if (item._id != 0) {
+ // There is a valid item present
+ // Calculate cost of item and add it to the party's total
+ int cost = calcItemCost(&c, itemIndex, mode, 1, category);
+ party._gold += cost;
+
+ // Remove the item from the inventory
+ item.clear();
+ c._items[category].sort();
+ }
+}
+
} // End of namespace Xeen