diff options
author | Paul Gilbert | 2016-03-29 22:21:55 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-03-29 22:21:55 -0400 |
commit | a1e959b4986914bd42bdbd4587cdfc2bd57ca3a0 (patch) | |
tree | 1a4b8e18b8164140bd458a5179993167121c3e47 /engines/titanic/pet_control/pet_control.cpp | |
parent | e0602c4851ab42763cc66858fed8d05496040498 (diff) | |
download | scummvm-rg350-a1e959b4986914bd42bdbd4587cdfc2bd57ca3a0.tar.gz scummvm-rg350-a1e959b4986914bd42bdbd4587cdfc2bd57ca3a0.tar.bz2 scummvm-rg350-a1e959b4986914bd42bdbd4587cdfc2bd57ca3a0.zip |
TITANIC: Fix PET post-loading
Diffstat (limited to 'engines/titanic/pet_control/pet_control.cpp')
-rw-r--r-- | engines/titanic/pet_control/pet_control.cpp | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 63a1da450b..db053ca517 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -21,6 +21,7 @@ */ #include "titanic/pet_control/pet_control.h" +#include "titanic/core/project_item.h" #include "titanic/game_manager.h" #include "titanic/game_state.h" @@ -32,7 +33,7 @@ void CPetControl::save(SimpleFile *file, int indent) const { file->writeQuotedLine(_string1, indent); file->writeQuotedLine(_string2, indent); - saveSubObjects(file, indent); + saveAreas(file, indent); CGameObject::save(file, indent); } @@ -45,7 +46,7 @@ void CPetControl::load(SimpleFile *file) { _string1 = file->readString(); _string2 = file->readString(); - loadSubObjects(file, 0); + loadAreas(file, 0); } CGameObject::load(file); @@ -58,7 +59,7 @@ bool CPetControl::isValid() const { && _sub7.isValid() && _sub8.isValid(); } -void CPetControl::loadSubObjects(SimpleFile *file, int param) { +void CPetControl::loadAreas(SimpleFile *file, int param) { _convSection.load(file, param); _roomsSection.load(file, param); _remoteSection.load(file, param); @@ -69,7 +70,7 @@ void CPetControl::loadSubObjects(SimpleFile *file, int param) { _sub8.load(file, param); } -void CPetControl::saveSubObjects(SimpleFile *file, int indent) const { +void CPetControl::saveAreas(SimpleFile *file, int indent) const { _convSection.save(file, indent); _roomsSection.save(file, indent); _remoteSection.save(file, indent); @@ -85,7 +86,26 @@ void CPetControl::proc26() { } void CPetControl::postLoad() { - warning("TODO: CPetControl::postLoad"); + CProjectItem *root = getRoot(); + + if (!_string1.empty() && root) + _treeItem1 = root->findByName(_string1); + if (!_string2.empty() && root) + _treeItem2 = root->findByName(_string2); + + setArea(_currentArea); + loaded(); +} + +void CPetControl::loaded() { + _convSection.postLoad(); + _roomsSection.postLoad(); + _remoteSection.postLoad(); + _invSection.postLoad(); + _sub5.postLoad(); + _saveSection.postLoad(); + _sub7.postLoad(); + _sub8.postLoad(); } void CPetControl::enterNode(CNodeItem *node) { @@ -98,7 +118,7 @@ void CPetControl::enterRoom(CRoomItem *room) { } void CPetControl::clear() { - _field1394 = 0; + _treeItem2 = nullptr; _string2.clear(); } @@ -184,6 +204,7 @@ PetArea CPetControl::setArea(PetArea newArea) { } makeDirty(); + return newArea; } } // End of namespace Titanic |