[Scummvm-git-logs] scummvm master -> 7b7a23a6e77e71e621fb152656cdbb19935a02c9

dreammaster dreammaster at scummvm.org
Sat Dec 30 02:21:47 CET 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
7b7a23a6e7 XEEN: Fix showing correct names for quest items


Commit: 7b7a23a6e77e71e621fb152656cdbb19935a02c9
    https://github.com/scummvm/scummvm/commit/7b7a23a6e77e71e621fb152656cdbb19935a02c9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-12-29T20:21:27-05:00

Commit Message:
XEEN: Fix showing correct names for quest items

Changed paths:
    engines/xeen/character.cpp
    engines/xeen/character.h
    engines/xeen/party.cpp


diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp
index 8a6dd14..67760ce 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 c19cfef..76b1dae 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 250bc56..49d86be 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);
 }
 





More information about the Scummvm-git-logs mailing list