[Scummvm-git-logs] scummvm master -> 39640017e644ed28c8e397f7e2bd8dd6657d35f9
dreammaster
dreammaster at scummvm.org
Fri Mar 16 01:52:49 CET 2018
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
39640017e6 XEEN: Don't needlessly show class profiency error dialogs when just viewing inventory
Commit: 39640017e644ed28c8e397f7e2bd8dd6657d35f9
https://github.com/scummvm/scummvm/commit/39640017e644ed28c8e397f7e2bd8dd6657d35f9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-03-15T20:52:36-04:00
Commit Message:
XEEN: Don't needlessly show class profiency error dialogs when just viewing inventory
Changed paths:
engines/xeen/dialogs/dialogs_items.cpp
engines/xeen/item.cpp
engines/xeen/item.h
diff --git a/engines/xeen/dialogs/dialogs_items.cpp b/engines/xeen/dialogs/dialogs_items.cpp
index 4715dfb..24d4603 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 e5e852c..7a4b459 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 e927908..871bd1c 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
More information about the Scummvm-git-logs
mailing list