From 2667b502d790c640e0f6a71b21857333134b9a41 Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Sat, 2 Jul 2011 00:04:24 +0200 Subject: MOHAWK: Add LBCode::resolveItem helper function. --- engines/mohawk/livingbooks_code.cpp | 10 ++++++++++ engines/mohawk/livingbooks_code.h | 1 + 2 files changed, 11 insertions(+) diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp index 96345ad845..d091f95a15 100644 --- a/engines/mohawk/livingbooks_code.cpp +++ b/engines/mohawk/livingbooks_code.cpp @@ -555,6 +555,16 @@ void LBCode::parseMain() { } } +LBItem *LBCode::resolveItem(const LBValue &value) { + if (value.type == kLBValueItemPtr) + return value.item; + if (value.type == kLBValueString) + return _vm->getItemByName(value.string); + if (value.type == kLBValueInteger) + return _vm->getItemById(value.integer); + return NULL; +} + Common::Array LBCode::readParams() { Common::Array params; diff --git a/engines/mohawk/livingbooks_code.h b/engines/mohawk/livingbooks_code.h index 9602e2d22d..3e33549b4d 100644 --- a/engines/mohawk/livingbooks_code.h +++ b/engines/mohawk/livingbooks_code.h @@ -206,6 +206,7 @@ protected: void parseArithmetic2(); void parseMain(); + LBItem *resolveItem(const LBValue &value); Common::Array readParams(); Common::Rect getRectFromParams(const Common::Array ¶ms); -- cgit v1.2.3