diff options
author | Paul Gilbert | 2018-03-28 21:53:59 -0400 |
---|---|---|
committer | Paul Gilbert | 2018-03-28 21:53:59 -0400 |
commit | fc03c1e71cef6e50e8e809452f0af94d75643ac3 (patch) | |
tree | 6939566b549b1628c0a9719e0da0c64d2dcf6164 | |
parent | 78db92eb33dbc5fd0a32399294d9ba67690c4bd4 (diff) | |
download | scummvm-rg350-fc03c1e71cef6e50e8e809452f0af94d75643ac3.tar.gz scummvm-rg350-fc03c1e71cef6e50e8e809452f0af94d75643ac3.tar.bz2 scummvm-rg350-fc03c1e71cef6e50e8e809452f0af94d75643ac3.zip |
XEEN: Don't allow dismissing characters holding Elder weapons in Swords
-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 { |