diff options
author | Paul Gilbert | 2016-05-12 20:51:32 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-10 16:39:25 -0400 |
commit | 06876335cd027529b3719cdfc6d255b00a592b02 (patch) | |
tree | c9c65b9d8f385f86bd37f0e0d4e756debff2124f /engines | |
parent | ae5cd8d8dda5b66a82d33b4164c06b3313522e10 (diff) | |
download | scummvm-rg350-06876335cd027529b3719cdfc6d255b00a592b02.tar.gz scummvm-rg350-06876335cd027529b3719cdfc6d255b00a592b02.tar.bz2 scummvm-rg350-06876335cd027529b3719cdfc6d255b00a592b02.zip |
TITANIC: Implement TTword copy
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/true_talk/tt_word.cpp | 34 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_word.h | 5 |
2 files changed, 38 insertions, 1 deletions
diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 55de72b3d6..4d4f968efd 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -33,7 +33,39 @@ TTword::TTword(TTString &str, int mode, int val2) : _string(str), } TTword::TTword(TTword *src) { - // TODO + if (src->getStatus() != SS_VALID) { + _status = SS_5; + return; + } + + _string = src->_string; + _wordMode = src->_wordMode; + _field1C = src->_field1C; + _field20 = src->_field20; + _synP = nullptr; + + TTsynonym *priorSyn = nullptr; + for (TTsynonym *synP = _synP; synP && !_status;) { + TTsynonym *newSyn = new TTsynonym(synP); + if (!newSyn) { + _status = SS_7; + } else { + newSyn->_pPrior = priorSyn; + newSyn->_pNext = nullptr; + + if (priorSyn) { + priorSyn->_pNext = newSyn; + } else { + _synP = newSyn; + } + + priorSyn = newSyn; + } + } + + _pNext = src->_pNext; + _field24 = src->_field24; + _field28 = src->_field28; } void TTword::deleteSiblings() { diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 9bdb810ae6..d9127514bb 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -79,6 +79,11 @@ public: operator const char *() const { return c_str(); } /** + * Return the status of the word + */ + TTStringStatus getStatus() const { return _status; } + + /** * Creates a copy of the word */ virtual TTword *copy(); |