Permalink
Browse files

XEEN: Fix showing correct names for quest items

  • Loading branch information...
dreammaster committed Dec 30, 2017
1 parent 1bc519a commit 7b7a23a6e77e71e621fb152656cdbb19935a02c9
Showing with 26 additions and 4 deletions.
  1. +19 −0 engines/xeen/character.cpp
  2. +5 −0 engines/xeen/character.h
  3. +2 −4 engines/xeen/party.cpp
View
@@ -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):
View
@@ -96,6 +96,11 @@ class XeenItem {
uint _id;
int _bonusFlags;
int _frame;
public:
/**
* Return the name of the item
*/
static const char *getItemName(ItemCategory category, uint id);
public:
XeenItem();
View
@@ -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);
}

0 comments on commit 7b7a23a

Please sign in to comment.