STARK: Fix incorrect title for inventory items in the action menu

Fixes #1567.
This commit is contained in:
Bastien Bouclet 2019-08-10 11:13:50 +02:00
parent ea90258819
commit afb8f4e2f3
3 changed files with 14 additions and 8 deletions

View File

@ -36,16 +36,17 @@ class XRCReadStream;
namespace Resources {
/**
* The top level element of the game resource tree.
* A character string resource.
*
* Contains all the levels.
* String resources are used by scripts to change the title
* of items.
*/
class String : public Object {
public:
static const Type::ResourceType TYPE = Type::kString;
String(Object *parent, byte subType, uint16 index, const Common::String &name);
virtual ~String();
~String() override;
protected:
void printData() override;

View File

@ -53,10 +53,10 @@ static const int kAutoCloseDelay = 200;
ActionMenu::ActionMenu(Gfx::Driver *gfx, Cursor *cursor) :
Window(gfx, cursor),
_inventory(nullptr),
_item(nullptr),
_itemDescription(nullptr),
_fromInventory(false),
_itemDescription(nullptr),
_item(nullptr),
_inventory(nullptr),
_autoCloseTimeRemaining(kAutoCloseDisabled) {
_background = StarkStaticProvider->getUIElement(StaticProvider::kActionMenuBg);
@ -91,7 +91,12 @@ void ActionMenu::open(Resources::ItemVisual *item, const Common::Point &itemRela
_itemRelativePos = itemRelativePos;
_item = item;
_fromInventory = item->getSubType() == Resources::Item::kItemInventory;
if (_fromInventory) {
_itemDescription->setText(StarkGameInterface->getItemTitle(item));
} else {
_itemDescription->setText(StarkGameInterface->getItemTitleAt(item, itemRelativePos));
}
_cursor->setMouseHint("");

View File

@ -47,8 +47,8 @@ static const int kAutoCloseDelay = 200;
InventoryWindow::InventoryWindow(Gfx::Driver *gfx, Cursor *cursor, ActionMenu *actionMenu) :
Window(gfx, cursor),
_actionMenu(actionMenu),
_selectedInventoryItem(-1),
_firstVisibleSlot(0),
_selectedInventoryItem(-1),
_autoCloseTimeRemaining(kAutoCloseDisabled) {
// The window has the same size as the game window
_position = Common::Rect(Gfx::Driver::kGameViewportWidth, Gfx::Driver::kGameViewportHeight);