diff options
author | Paul Gilbert | 2016-04-30 20:13:34 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-10 16:37:52 -0400 |
commit | 2a107eb540d2058ee105b8a362d9288c1e463bfe (patch) | |
tree | 3a4596efb1ad19c5962250b139f6b25e4118d8c6 | |
parent | 2fb692321165ec5831877fcb60408dd45610f7bb (diff) | |
download | scummvm-rg350-2a107eb540d2058ee105b8a362d9288c1e463bfe.tar.gz scummvm-rg350-2a107eb540d2058ee105b8a362d9288c1e463bfe.tar.bz2 scummvm-rg350-2a107eb540d2058ee105b8a362d9288c1e463bfe.zip |
TITANIC: Simplify PET Element getBounds methods
-rw-r--r-- | engines/titanic/pet_control/pet_conversations.cpp | 7 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_element.cpp | 5 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_element.h | 2 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_gfx_element.cpp | 18 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_gfx_element.h | 2 |
5 files changed, 17 insertions, 17 deletions
diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 76d293208b..bffcb6ddd2 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -131,8 +131,11 @@ void CPetConversations::draw(CScreenManager *screenManager) { } Rect CPetConversations::getBounds() { - // TODO - return Rect(); + Rect rect = _dials[0].getBounds(); + rect.combine(_dials[1].getBounds()); + rect.combine(_dials[2].getBounds()); + + return rect; } bool CPetConversations::isValid(CPetControl *petControl) { diff --git a/engines/titanic/pet_control/pet_element.cpp b/engines/titanic/pet_control/pet_element.cpp index bc1b8de44d..da37b35246 100644 --- a/engines/titanic/pet_control/pet_element.cpp +++ b/engines/titanic/pet_control/pet_element.cpp @@ -28,9 +28,8 @@ namespace Titanic { CPetElement::CPetElement() : _mode(MODE_UNSELECTED) {} -void CPetElement::getBounds(Rect *rect) { - if (rect) - *rect = Rect(); +Rect CPetElement::getBounds() const { + return Rect(); } bool CPetElement::MouseButtonDownMsg(const Point &pt) { diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index 38f5f539f2..578f306dff 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -67,7 +67,7 @@ public: /** * Get the bounds for the element */ - virtual void getBounds(Rect *rect); + virtual Rect getBounds() const; /** * Handles processing mouse button down messages diff --git a/engines/titanic/pet_control/pet_gfx_element.cpp b/engines/titanic/pet_control/pet_gfx_element.cpp index 491930f46f..2686bd9ace 100644 --- a/engines/titanic/pet_control/pet_gfx_element.cpp +++ b/engines/titanic/pet_control/pet_gfx_element.cpp @@ -76,17 +76,15 @@ void CPetGfxElement::draw(CScreenManager *screenManager, const Common::Point &de obj->draw(screenManager, destPos); } -void CPetGfxElement::getBounds(Rect *rect) { - if (rect) { - CGameObject *obj = getObject(); - if (!obj) - obj = _object0; +Rect CPetGfxElement::getBounds() const { + CGameObject *obj = getObject(); + if (!obj) + obj = _object0; - if (obj && obj->getSurface45()) - *rect = _bounds; - else - rect->clear(); - } + if (obj && obj->getSurface45()) + return _bounds; + else + return Rect(); } CGameObject *CPetGfxElement::getObject() const { diff --git a/engines/titanic/pet_control/pet_gfx_element.h b/engines/titanic/pet_control/pet_gfx_element.h index f33058f786..91d9b9ccb2 100644 --- a/engines/titanic/pet_control/pet_gfx_element.h +++ b/engines/titanic/pet_control/pet_gfx_element.h @@ -61,7 +61,7 @@ public: /** * Get the bounds for the element */ - virtual void getBounds(Rect *rect); + virtual Rect getBounds() const; /** * Get the game object associated with this item |