diff options
author | Paul Gilbert | 2016-05-11 00:11:12 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-10 16:39:09 -0400 |
commit | fa626a8bc981b9a3009996787c3007193eab1147 (patch) | |
tree | 8a1087dbac7728698bcb992cea1772b9f5e05838 /engines/titanic | |
parent | 1045fda846dd607546b7f4914850771397fbebb8 (diff) | |
download | scummvm-rg350-fa626a8bc981b9a3009996787c3007193eab1147.tar.gz scummvm-rg350-fa626a8bc981b9a3009996787c3007193eab1147.tar.bz2 scummvm-rg350-fa626a8bc981b9a3009996787c3007193eab1147.zip |
TITANIC: Implemented TTsynonymNode copy
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/true_talk/tt_string_node.cpp | 44 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_string_node.h | 3 |
2 files changed, 36 insertions, 11 deletions
diff --git a/engines/titanic/true_talk/tt_string_node.cpp b/engines/titanic/true_talk/tt_string_node.cpp index da805fa9f1..db7c846a53 100644 --- a/engines/titanic/true_talk/tt_string_node.cpp +++ b/engines/titanic/true_talk/tt_string_node.cpp @@ -59,6 +59,17 @@ void TTstringNode::initialize(TTstringNode *oldNode) { delete oldNode; } +TTstringNode *TTstringNode::scan(TTstringNode *start, const TTString &str, int mode) { + for (; start; start = start->_pNext) { + if (start->_mode == mode || (mode == 3 && start->_mode < 3)) { + if (!strcmp(start->_string.c_str(), str.c_str())) + start; + } + } + + return nullptr; +} + void TTstringNode::addNode(TTstringNode *newNode) { TTstringNode *tail = getTail(); tail->_pNext = newNode; @@ -84,22 +95,17 @@ TTstringNode *TTstringNode::getTail() const { return node; } -TTstringNode *TTstringNode::scan(TTstringNode *start, const TTString &str, int mode) { - for (; start; start = start->_pNext) { - if (start->_mode == mode || (mode == 3 && start->_mode < 3)) { - if (!strcmp(start->_string.c_str(), str.c_str())) - start; - } - } - - return nullptr; -} - /*------------------------------------------------------------------------*/ TTsynonymNode::TTsynonymNode() : TTstringNode() { } +TTsynonymNode::TTsynonymNode(const TTsynonymNode *src) { + _string = src->_string; + initialize(src->_mode); + _field14 = src->_field14; +} + TTsynonymNode::TTsynonymNode(int mode, const char *str, int val2) : TTstringNode() { _string = str; @@ -107,5 +113,21 @@ TTsynonymNode::TTsynonymNode(int mode, const char *str, int val2) : _field14 = val2; } +TTsynonymNode *TTsynonymNode::copy(TTsynonymNode *src) { + if (src->_field1C) { + _field1C = 5; + return this; + } else { + _field1C = 0; + if (src == this) + return this; + + _string = src->_string; + TTsynonymNode *newNode = new TTsynonymNode(src); + initialize(newNode); + + return this; + } +} } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string_node.h b/engines/titanic/true_talk/tt_string_node.h index 41ce6c5aad..7b96fbf9b5 100644 --- a/engines/titanic/true_talk/tt_string_node.h +++ b/engines/titanic/true_talk/tt_string_node.h @@ -73,7 +73,10 @@ public: class TTsynonymNode : public TTstringNode { public: TTsynonymNode(); + TTsynonymNode(const TTsynonymNode *src); TTsynonymNode(int mode, const char *str, int val2); + + TTsynonymNode *copy(TTsynonymNode *src); }; } // End of namespace Titanic |