diff options
author | Paul Gilbert | 2016-03-30 21:01:51 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-03-30 21:01:51 -0400 |
commit | 348b2d4b4bf9c6e8c6ca134ce7968eb9e9521a9c (patch) | |
tree | 9f6d760a91c7c86e8da8d8cae69a606d5e078860 /engines/titanic/pet_control/pet_control.cpp | |
parent | 08a801b1128d63e5c2cedee218a6dce7d6f04f28 (diff) | |
download | scummvm-rg350-348b2d4b4bf9c6e8c6ca134ce7968eb9e9521a9c.tar.gz scummvm-rg350-348b2d4b4bf9c6e8c6ca134ce7968eb9e9521a9c.tar.bz2 scummvm-rg350-348b2d4b4bf9c6e8c6ca134ce7968eb9e9521a9c.zip |
TITANIC: Fleshing out CPetVal
Diffstat (limited to 'engines/titanic/pet_control/pet_control.cpp')
-rw-r--r-- | engines/titanic/pet_control/pet_control.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 9f24b4b040..ad1d0b6d2b 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -27,6 +27,11 @@ namespace Titanic { +CPetControl::CPetControl() : CGameObject(), + _currentArea(PET_CONVERSATION), _fieldC0(0), _locked(0), _fieldC8(0), + _treeItem1(nullptr), _treeItem2(nullptr), _hiddenRoom(nullptr) { +} + void CPetControl::save(SimpleFile *file, int indent) const { file->writeNumberLine(0, indent); file->writeNumberLine(_currentArea, indent); @@ -273,4 +278,31 @@ void CPetControl::fn3(CTreeItem *item) { _string2.clear(); } +CRoomItem *CPetControl::getHiddenRoom() { + if (!_hiddenRoom) + _hiddenRoom = getHiddenRoom(); + + return _hiddenRoom; +} + +CGameObject *CPetControl::findItemInRoom(CRoomItem *room, + const CString &name) const { + if (!room) + return nullptr; + + for (CTreeItem *treeItem = room->getFirstChild(); treeItem; + treeItem = treeItem->scan(room)) { + if (!treeItem->getName().compareTo(name)) { + return dynamic_cast<CGameObject *>(treeItem); + } + } + + return nullptr; +} + +CGameObject *CPetControl::getHiddenObject(const CString &name) { + CRoomItem *room = getHiddenRoom(); + return room ? findItemInRoom(room, name) : nullptr; +} + } // End of namespace Titanic |