From be09bef7f7c8fc6f6f8a3c9a9b3534a54c8a41e4 Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Thu, 7 Apr 2011 23:02:28 +0200 Subject: MOHAWK: Add getItemByName for LB. --- engines/mohawk/livingbooks.cpp | 8 ++++++++ engines/mohawk/livingbooks.h | 2 ++ 2 files changed, 10 insertions(+) (limited to 'engines/mohawk') diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp index 542cc9645d..6ecf9f9a48 100644 --- a/engines/mohawk/livingbooks.cpp +++ b/engines/mohawk/livingbooks.cpp @@ -558,6 +558,14 @@ LBItem *MohawkEngine_LivingBooks::getItemById(uint16 id) { return NULL; } +LBItem *MohawkEngine_LivingBooks::getItemByName(Common::String name) { + for (uint16 i = 0; i < _items.size(); i++) + if (_items[i]->getName() == name) + return _items[i]; + + return NULL; +} + void MohawkEngine_LivingBooks::setFocus(LBItem *focus) { _focus = focus; } diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h index 3eff039385..123c2501c2 100644 --- a/engines/mohawk/livingbooks.h +++ b/engines/mohawk/livingbooks.h @@ -385,6 +385,7 @@ public: virtual void notify(uint16 data, uint16 from); // 0x1A uint16 getId() { return _itemId; } + const Common::String &getName() { return _desc; } uint16 getSoundPriority() { return _soundMode; } bool isAmbient() { return _isAmbient; } @@ -615,6 +616,7 @@ public: GUI::Debugger *getDebugger() { return _console; } LBItem *getItemById(uint16 id); + LBItem *getItemByName(Common::String name); void setFocus(LBItem *focus); void setEnableForAll(bool enable, LBItem *except = 0); -- cgit v1.2.3