aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/xeen/dialogs/dialogs_items.cpp2
-rw-r--r--engines/xeen/item.cpp14
-rw-r--r--engines/xeen/item.h4
3 files changed, 11 insertions, 9 deletions
diff --git a/engines/xeen/dialogs/dialogs_items.cpp b/engines/xeen/dialogs/dialogs_items.cpp
index 4715dfbc0f..24d4603617 100644
--- a/engines/xeen/dialogs/dialogs_items.cpp
+++ b/engines/xeen/dialogs/dialogs_items.cpp
@@ -163,7 +163,7 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
}
ds._sprites = &_equipSprites;
- if (c->_weapons.passRestrictions(i._id, true))
+ if (c->_items[category].passRestrictions(i._id, true))
ds._frame = i._frame;
else
ds._frame = 14;
diff --git a/engines/xeen/item.cpp b/engines/xeen/item.cpp
index e5e852c6b7..7a4b459d41 100644
--- a/engines/xeen/item.cpp
+++ b/engines/xeen/item.cpp
@@ -93,7 +93,7 @@ void InventoryItems::clear() {
operator[](idx).clear();
}
-bool InventoryItems::passRestrictions(int itemId, bool showError) const {
+bool InventoryItems::passRestrictions(int itemId, bool suppressError) const {
CharacterClass charClass = _character->_class;
switch (charClass) {
@@ -120,7 +120,7 @@ bool InventoryItems::passRestrictions(int itemId, bool showError) const {
}
Common::String name = _names[itemId];
- if (showError) {
+ if (!suppressError) {
Common::String msg = Common::String::format(Res.NOT_PROFICIENT,
Res.CLASS_NAMES[charClass], name.c_str());
ErrorScroll::show(Party::_vm, msg, WT_FREEZE_WAIT);
@@ -239,7 +239,7 @@ void WeaponItems::equipItem(int itemIndex) {
XeenItem &item = operator[](itemIndex);
if (item._id <= 17) {
- if (passRestrictions(item._id, false)) {
+ if (passRestrictions(item._id)) {
for (uint idx = 0; idx < size(); ++idx) {
XeenItem &i = operator[](idx);
if (i._frame == 13 || i._frame == 1) {
@@ -251,7 +251,7 @@ void WeaponItems::equipItem(int itemIndex) {
item._frame = 1;
}
} else if (item._id >= 30 && item._id <= 33) {
- if (passRestrictions(item._id, false)) {
+ if (passRestrictions(item._id)) {
for (uint idx = 0; idx < size(); ++idx) {
XeenItem &i = operator[](idx);
if (i._frame == 4) {
@@ -263,7 +263,7 @@ void WeaponItems::equipItem(int itemIndex) {
item._frame = 4;
}
} else {
- if (passRestrictions(item._id, false)) {
+ if (passRestrictions(item._id)) {
for (uint idx = 0; idx < size(); ++idx) {
XeenItem &i = operator[](idx);
if (i._frame == 13 || i._frame == 1) {
@@ -368,7 +368,7 @@ void ArmorItems::equipItem(int itemIndex) {
XeenItem &item = operator[](itemIndex);
if (item._id <= 7) {
- if (passRestrictions(item._id, false)) {
+ if (passRestrictions(item._id)) {
for (uint idx = 0; idx < size(); ++idx) {
XeenItem &i = operator[](idx);
if (i._frame == 9) {
@@ -380,7 +380,7 @@ void ArmorItems::equipItem(int itemIndex) {
item._frame = 3;
}
} else if (item._id == 8) {
- if (passRestrictions(item._id, false)) {
+ if (passRestrictions(item._id)) {
for (uint idx = 0; idx < size(); ++idx) {
XeenItem &i = operator[](idx);
if (i._frame == 2) {
diff --git a/engines/xeen/item.h b/engines/xeen/item.h
index e927908d01..871bd1c919 100644
--- a/engines/xeen/item.h
+++ b/engines/xeen/item.h
@@ -117,8 +117,10 @@ public:
/**
* Return whether a given item passes class-based usage restrictions
+ * @param itemId Item Index
+ * @param suppressError If true, no dialog is shown if the item doesn't pass restrictions
*/
- bool passRestrictions(int itemId, bool showError) const;
+ bool passRestrictions(int itemId, bool suppressError = false) const;
/**
* Return the bare name of a given inventory item