diff options
author | Paul Gilbert | 2016-05-22 13:54:29 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-15 19:14:23 -0400 |
commit | 8c99ff510c2e8a7d4cde30dc6d8b3698fb998907 (patch) | |
tree | 501b99f531f499b224632edc6804cb8e91127968 | |
parent | 1ffb8ff92b9f9d1be7a3f93ad5df859f086f3d94 (diff) | |
download | scummvm-rg350-8c99ff510c2e8a7d4cde30dc6d8b3698fb998907.tar.gz scummvm-rg350-8c99ff510c2e8a7d4cde30dc6d8b3698fb998907.tar.bz2 scummvm-rg350-8c99ff510c2e8a7d4cde30dc6d8b3698fb998907.zip |
TITANIC: Added TTconcept copyFrom method
-rw-r--r-- | engines/titanic/true_talk/tt_concept.cpp | 29 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_concept.h | 9 |
2 files changed, 34 insertions, 4 deletions
diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp index 59d53a91ae..8ecaf89289 100644 --- a/engines/titanic/true_talk/tt_concept.cpp +++ b/engines/titanic/true_talk/tt_concept.cpp @@ -77,7 +77,7 @@ TTconcept::TTconcept(TTconcept &src) : if (src._wordP) { _status = initializeWordRef(src._wordP); - copyFrom(src); + initialize(src); } } } @@ -150,7 +150,7 @@ bool TTconcept::compareTo(const char *str) const { _wordP->compareTo(str); } -void TTconcept::copyFrom(TTconcept &src) { +void TTconcept::initialize(TTconcept &src) { _nextP = src._nextP; _field14 = src._field14; _scriptType = src._scriptType; @@ -177,4 +177,29 @@ void TTconcept::copyFrom(TTconcept &src) { _status = src._status; } +void TTconcept::copyFrom(TTconcept *src) { + if (this != src) { + if (src->getStatus()) { + _status = SS_5; + } else { + _string1 = src->_string1; + _string2 = src->_string2; + + if (setStatus()) { + _scriptP = src->_scriptP; + if (src->_wordP) { + _status = initializeWordRef(src->_wordP); + initialize(*src); + } else { + _wordP = nullptr; + initialize(*src); + } + } + } + } + + if (_status) + reset(); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index d28ac57575..ae956c14f1 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -69,9 +69,9 @@ private: void reset(); /** - * Copy auxiliary data from the specified source concept + * Initialize inner data for the concept from a given source concept */ - void copyFrom(TTconcept &src); + void initialize(TTconcept &src); public: TTconcept *_nextP; public: @@ -87,6 +87,11 @@ public: void deleteSiblings(); /** + * Copies data from a source concept + */ + void copyFrom(TTconcept *src); + + /** * Compares the name of the associated word, if any, * to the passed string */ |