aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/xeen/character.cpp19
-rw-r--r--engines/xeen/character.h5
-rw-r--r--engines/xeen/party.cpp6
3 files changed, 26 insertions, 4 deletions
diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp
index 8a6dd14c42..67760cee67 100644
--- a/engines/xeen/character.cpp
+++ b/engines/xeen/character.cpp
@@ -61,6 +61,25 @@ AttributeCategory XeenItem::getAttributeCategory() const {
return (AttributeCategory)idx;
}
+const char *XeenItem::getItemName(ItemCategory category, uint id) {
+ if (id < 82)
+ return Res.ITEM_NAMES[category][id];
+
+ switch (category) {
+ case CATEGORY_WEAPON:
+ return Res.QUEST_ITEM_NAMES[id - 82];
+
+ case CATEGORY_ARMOR:
+ return Res.QUEST_ITEM_NAMES[id - 82 + 35];
+
+ case CATEGORY_ACCESSORY:
+ return Res.QUEST_ITEM_NAMES[id - 82 + 35 + 14];
+
+ default:
+ return Res.QUEST_ITEM_NAMES[id - 82 + 35 + 14 + 11];
+ }
+}
+
/*------------------------------------------------------------------------*/
InventoryItems::InventoryItems(Character *character, ItemCategory category):
diff --git a/engines/xeen/character.h b/engines/xeen/character.h
index c19cfef4fc..76b1dae461 100644
--- a/engines/xeen/character.h
+++ b/engines/xeen/character.h
@@ -97,6 +97,11 @@ public:
int _bonusFlags;
int _frame;
public:
+ /**
+ * Return the name of the item
+ */
+ static const char *getItemName(ItemCategory category, uint id);
+public:
XeenItem();
void clear();
diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index 250bc56a7e..49d86bee62 100644
--- a/engines/xeen/party.cpp
+++ b/engines/xeen/party.cpp
@@ -713,17 +713,15 @@ void Party::giveTreasureToCharacter(Character &c, ItemCategory category, int ite
if (treasureItem._id < 82) {
// Copy item into the character's inventory
c._items[category][INV_ITEMS_TOTAL - 1] = treasureItem;
- c._items[category].sort();
}
w.writeString(Res.GIVE_TREASURE_FORMATTING);
w.update();
events.ipause(5);
- w.writeString(Common::String::format(Res.X_FOUND_Y, c._name.c_str(),
- Res.ITEM_NAMES[category][treasureItem._id]));
+ const char *itemName = XeenItem::getItemName(category, treasureItem._id);
+ w.writeString(Common::String::format(Res.X_FOUND_Y, c._name.c_str(), itemName));
w.update();
-
events.ipause(5);
}