aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/dialogs
diff options
context:
space:
mode:
authorPaul Gilbert2018-03-20 21:03:17 -0400
committerPaul Gilbert2018-03-20 21:03:17 -0400
commit078ea7228e1634f986e8ab04ed47b93d3a42468a (patch)
tree208c55d8cbcd2f2c3f068eca0d863b0c88c96e23 /engines/xeen/dialogs
parent5a07bc82c3228666910a010cc5b3633e65204b49 (diff)
downloadscummvm-rg350-078ea7228e1634f986e8ab04ed47b93d3a42468a.tar.gz
scummvm-rg350-078ea7228e1634f986e8ab04ed47b93d3a42468a.tar.bz2
scummvm-rg350-078ea7228e1634f986e8ab04ed47b93d3a42468a.zip
XEEN: Fix transferring items between characters in items dialog
Diffstat (limited to 'engines/xeen/dialogs')
-rw-r--r--engines/xeen/dialogs/dialogs_items.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/engines/xeen/dialogs/dialogs_items.cpp b/engines/xeen/dialogs/dialogs_items.cpp
index c7e526cfd2..a43439b15b 100644
--- a/engines/xeen/dialogs/dialogs_items.cpp
+++ b/engines/xeen/dialogs/dialogs_items.cpp
@@ -64,6 +64,8 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
enum { REDRAW_NONE, REDRAW_TEXT, REDRAW_FULL } redrawFlag = REDRAW_FULL;
for (;;) {
if (redrawFlag == REDRAW_FULL) {
+ itemIndex = -1;
+
if ((mode != ITEMMODE_CHAR_INFO || category != CATEGORY_MISC) && mode != ITEMMODE_ENCHANT
&& mode != ITEMMODE_RECHARGE && mode != ITEMMODE_TO_GOLD) {
_buttons[4]._bounds.moveTo(148, _buttons[4]._bounds.top);
@@ -336,7 +338,7 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
if (_buttonValue < (int)(_vm->_mode == MODE_COMBAT ?
combat._combatParty.size() : party._activeParty.size())) {
// Character number is valid
- redrawFlag = REDRAW_TEXT;
+ redrawFlag = REDRAW_FULL;
Character *newChar = _vm->_mode == MODE_COMBAT ?
combat._combatParty[_buttonValue] : &party._activeParty[_buttonValue];
@@ -349,23 +351,25 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
startingChar = newChar;
c = newChar;
} else if (itemIndex != -1) {
+ // Switching item to another character
InventoryItems &destItems = newChar->_items[category];
- XeenItem &destItem = destItems[INV_ITEMS_TOTAL - 1];
InventoryItems &srcItems = c->_items[category];
XeenItem &srcItem = srcItems[itemIndex];
if (srcItem._bonusFlags & ITEMFLAG_CURSED)
ErrorScroll::show(_vm, Res.CANNOT_REMOVE_CURSED_ITEM);
- else if (destItems[INV_ITEMS_TOTAL - 1]._id)
+ else if (destItems.isFull())
ErrorScroll::show(_vm, Common::String::format(
Res.CATEGORY_BACKPACK_IS_FULL[category], c->_name.c_str()));
else {
+ XeenItem &destItem = destItems[INV_ITEMS_TOTAL - 1];
destItem = srcItem;
srcItem.clear();
destItem._frame = 0;
srcItems.sort();
destItems.sort();
+ continue;
}
} else {
c = newChar;