diff options
author | Paul Gilbert | 2016-04-14 18:42:57 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-10 16:11:06 -0400 |
commit | 1babcc10cfce1458ac07c8e1027c321962cf8f09 (patch) | |
tree | 96a950e5834a17e8ce86ee550016ba0bf37414ba /engines | |
parent | a5e90526355a421d23175bd0ac25f7c2bc0d3276 (diff) | |
download | scummvm-rg350-1babcc10cfce1458ac07c8e1027c321962cf8f09.tar.gz scummvm-rg350-1babcc10cfce1458ac07c8e1027c321962cf8f09.tar.bz2 scummvm-rg350-1babcc10cfce1458ac07c8e1027c321962cf8f09.zip |
TITANIC: Implemented PET methods for iterating sub-objects
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/pet_control/pet_control.cpp | 11 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_control.h | 11 |
2 files changed, 22 insertions, 0 deletions
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index a5885502f0..c7dc8d2c21 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -354,4 +354,15 @@ void CPetControl::displayMessage(const CString &msg) { error("TODO: CPetControl::displayMessage"); } +CGameObject *CPetControl::getFirstObject() const { + return static_cast<CGameObject *>(getFirstChild()); +} + +CGameObject *CPetControl::getNextObject(CGameObject *prior) const { + if (!prior || prior->getParent() != this) + return nullptr; + + return static_cast<CGameObject *>(prior->getNextSibling()); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 401f5de3b9..c22f555c31 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -201,6 +201,17 @@ public: * Display a message */ void displayMessage(const CString &msg); + + /** + * Get the first game object stored in the PET + */ + CGameObject *getFirstObject() const; + + /** + * Get the next game object stored in the PET following + * the passed game object + */ + CGameObject *getNextObject(CGameObject *prior) const; }; } // End of namespace Titanic |