aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen
diff options
context:
space:
mode:
authorPaul Gilbert2018-03-31 18:39:42 -0400
committerPaul Gilbert2018-03-31 18:39:42 -0400
commitb6fc3fd99195f2cbc1e17ea6827175855df8f8cc (patch)
treebcfde66f5491df48d4c241ef69618f197133882f /engines/xeen
parent263df996b60ea9b505be18f5eeeb3ce4c27d0fd2 (diff)
downloadscummvm-rg350-b6fc3fd99195f2cbc1e17ea6827175855df8f8cc.tar.gz
scummvm-rg350-b6fc3fd99195f2cbc1e17ea6827175855df8f8cc.tar.bz2
scummvm-rg350-b6fc3fd99195f2cbc1e17ea6827175855df8f8cc.zip
XEEN: Change many item Id checks to use empty() function
Diffstat (limited to 'engines/xeen')
-rw-r--r--engines/xeen/combat.cpp8
-rw-r--r--engines/xeen/dialogs/dialogs_items.cpp2
-rw-r--r--engines/xeen/item.cpp4
-rw-r--r--engines/xeen/party.cpp8
4 files changed, 11 insertions, 11 deletions
diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp
index bec9942767..b1ecd7776d 100644
--- a/engines/xeen/combat.cpp
+++ b/engines/xeen/combat.cpp
@@ -1527,7 +1527,7 @@ void Combat::attack2(int damage, RangeType rangeType) {
switch (category) {
case CATEGORY_WEAPON:
for (int idx = 0; idx < MAX_TREASURE_ITEMS; ++idx) {
- if (party._treasure._weapons[idx]._id == 0) {
+ if (party._treasure._weapons[idx].empty()) {
party._treasure._weapons[idx] = tempChar._weapons[0];
party._treasure._hasItems = true;
break;
@@ -1536,7 +1536,7 @@ void Combat::attack2(int damage, RangeType rangeType) {
break;
case CATEGORY_ARMOR:
for (int idx = 0; idx < MAX_TREASURE_ITEMS; ++idx) {
- if (party._treasure._armor[idx]._id == 0) {
+ if (party._treasure._armor[idx].empty()) {
party._treasure._armor[idx] = tempChar._armor[0];
party._treasure._hasItems = true;
break;
@@ -1545,7 +1545,7 @@ void Combat::attack2(int damage, RangeType rangeType) {
break;
case CATEGORY_ACCESSORY:
for (int idx = 0; idx < MAX_TREASURE_ITEMS; ++idx) {
- if (party._treasure._accessories[idx]._id == 0) {
+ if (party._treasure._accessories[idx].empty()) {
party._treasure._accessories[idx] = tempChar._accessories[0];
party._treasure._hasItems = true;
break;
@@ -1554,7 +1554,7 @@ void Combat::attack2(int damage, RangeType rangeType) {
break;
case CATEGORY_MISC:
for (int idx = 0; idx < MAX_TREASURE_ITEMS; ++idx) {
- if (party._treasure._accessories[idx]._id == 0) {
+ if (party._treasure._accessories[idx].empty()) {
party._treasure._accessories[idx] = tempChar._accessories[0];
party._treasure._hasItems = true;
break;
diff --git a/engines/xeen/dialogs/dialogs_items.cpp b/engines/xeen/dialogs/dialogs_items.cpp
index f844964396..0ea835e121 100644
--- a/engines/xeen/dialogs/dialogs_items.cpp
+++ b/engines/xeen/dialogs/dialogs_items.cpp
@@ -904,7 +904,7 @@ int ItemsDialog::doItemOptions(Character &c, int actionIndex, int itemIndex, Ite
}
case ITEMMODE_RECHARGE:
- if (category != CATEGORY_MISC || item._material > 9 || item._id == 53 || item._id == 0) {
+ if (category != CATEGORY_MISC || item.empty() || item._material > 9 || item._id == 53) {
sound.playFX(21);
ErrorScroll::show(_vm, Common::String::format(Res.NOT_RECHARGABLE, Res.SPELL_FAILED));
} else {
diff --git a/engines/xeen/item.cpp b/engines/xeen/item.cpp
index 3fe2896583..a79efc085d 100644
--- a/engines/xeen/item.cpp
+++ b/engines/xeen/item.cpp
@@ -217,7 +217,7 @@ bool InventoryItems::discardItem(int itemIndex) {
void InventoryItems::sort() {
for (uint idx = 0; idx < size(); ++idx) {
- if (operator[](idx)._id == 0) {
+ if (operator[](idx).empty()) {
// Found empty slot
operator[](idx).clear();
@@ -272,7 +272,7 @@ void InventoryItems::enchantItem(int itemIndex, int amount) {
bool InventoryItems::isFull() const {
assert(size() == INV_ITEMS_TOTAL);
- return operator[](size() - 1)._id != 0;
+ return !operator[](size() - 1).empty();
}
void InventoryItems::capitalizeItem(Common::String &name) {
diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index f60c532872..a3bb674093 100644
--- a/engines/xeen/party.cpp
+++ b/engines/xeen/party.cpp
@@ -799,10 +799,10 @@ bool Party::arePacksFull() const {
uint total = 0;
for (uint idx = 0; idx < _activeParty.size(); ++idx) {
const Character &c = _activeParty[idx];
- total += (c._weapons[INV_ITEMS_TOTAL - 1]._id != 0 ? 1 : 0)
- + (c._armor[INV_ITEMS_TOTAL - 1]._id != 0 ? 1 : 0)
- + (c._accessories[INV_ITEMS_TOTAL - 1]._id != 0 ? 1 : 0)
- + (c._misc[INV_ITEMS_TOTAL - 1]._id != 0 ? 1 : 0);
+ total += (c._weapons[INV_ITEMS_TOTAL - 1].empty() ? 0 : 1)
+ + (c._armor[INV_ITEMS_TOTAL - 1].empty() ? 0 : 1)
+ + (c._accessories[INV_ITEMS_TOTAL - 1].empty() ? 0 : 1)
+ + (c._misc[INV_ITEMS_TOTAL - 1].empty() ? 0 : 1);
}
return total == (_activeParty.size() * NUM_ITEM_CATEGORIES);