diff options
Diffstat (limited to 'engines/titanic/true_talk/tt_word.cpp')
-rw-r--r-- | engines/titanic/true_talk/tt_word.cpp | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 90c7cf1a9d..a09af4ab34 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -100,6 +100,15 @@ int TTword::readSyn(SimpleFile *file) { return 0; } +void TTword::setSyn(TTsynonym *synP) { + if (_synP) { + _synP->deleteSiblings(); + delete _synP; + } + + _synP = synP; +} + void TTword::appendNode(TTsynonym *node) { if (_synP) _synP->addNode(node); @@ -143,17 +152,20 @@ bool TTword::testFileHandle(FileHandle file) const { return true; } -TTword *TTword::scanCopy(const TTstring &str, TTsynonym *node, int mode) { - if (_synP) { - TTsynonym *strNode = TTsynonym::findByName(_synP, str, mode); - if (strNode) { - node->copy(strNode); - node->_priorP = nullptr; - node->_nextP = nullptr; - } - } +bool TTword::findSynByName(const TTstring &str, TTsynonym *dest, int mode) const { + if (!_synP) + return false; + + const TTsynonym *synP = static_cast<const TTsynonym *>(_synP->findByName(str, mode)); + if (synP) { + dest->copyFrom(synP); + dest->_priorP = nullptr; + dest->_nextP = nullptr; - return nullptr; + return true; + } else { + return false; + } } TTword *TTword::copy() { |