diff options
-rw-r--r-- | engines/xeen/dialogs/dialogs_dismiss.cpp | 4 | ||||
-rw-r--r-- | engines/xeen/item.cpp | 11 | ||||
-rw-r--r-- | engines/xeen/item.h | 5 |
3 files changed, 20 insertions, 0 deletions
diff --git a/engines/xeen/dialogs/dialogs_dismiss.cpp b/engines/xeen/dialogs/dialogs_dismiss.cpp index 716f8f0035..7f9c8d972f 100644 --- a/engines/xeen/dialogs/dialogs_dismiss.cpp +++ b/engines/xeen/dialogs/dialogs_dismiss.cpp @@ -70,6 +70,10 @@ void Dismiss::execute() { w.close(); ErrorScroll::show(_vm, Res.CANT_DISMISS_LAST_CHAR, WT_NONFREEZED_WAIT); w.open(); + } else if (party._activeParty[_buttonValue]._weapons.hasElderWeapon()) { + w.close(); + ErrorScroll::show(_vm, Res.DELETE_CHAR_WITH_ELDER_WEAPON, WT_NONFREEZED_WAIT); + w.open(); } else { // Remove the character from the party party._activeParty.remove_at(_buttonValue); diff --git a/engines/xeen/item.cpp b/engines/xeen/item.cpp index c50276d4ae..871f60b82b 100644 --- a/engines/xeen/item.cpp +++ b/engines/xeen/item.cpp @@ -385,6 +385,17 @@ Common::String WeaponItems::getAttributes(XeenItem &item, const Common::String & ); } +bool WeaponItems::hasElderWeapon() const { + if (g_vm->getGameID() == GType_Swords) { + for (uint idx = 0; idx < size(); ++idx) { + if ((*this)[idx]._id >= 34) + return true; + } + } + + return false; +} + /*------------------------------------------------------------------------*/ void ArmorItems::equipItem(int itemIndex) { diff --git a/engines/xeen/item.h b/engines/xeen/item.h index a37e6597b0..0fcfa92f44 100644 --- a/engines/xeen/item.h +++ b/engines/xeen/item.h @@ -205,6 +205,11 @@ public: * Enchants a weapon */ virtual void enchantItem(int itemIndex, int amount); + + /** + * Returns true if the character has an Elder weapon in Swords of Xeen + */ + bool hasElderWeapon() const; }; class ArmorItems : public InventoryItems { |