diff options
author | Paul Gilbert | 2016-05-13 19:32:15 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-10 16:39:30 -0400 |
commit | 2f9d7f228459db6877ea5afec01f00110d17931a (patch) | |
tree | d9fd6fa39c4105e0119e65bd40bb27ca37042a2b /engines/titanic | |
parent | f114ca6c26f4e77a40126b2ebd9c74c042e72875 (diff) | |
download | scummvm-rg350-2f9d7f228459db6877ea5afec01f00110d17931a.tar.gz scummvm-rg350-2f9d7f228459db6877ea5afec01f00110d17931a.tar.bz2 scummvm-rg350-2f9d7f228459db6877ea5afec01f00110d17931a.zip |
TITANIC: Added TTword subclass copy methods
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/true_talk/tt_action.cpp | 18 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_action.h | 7 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_adj.cpp | 18 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_adj.h | 7 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_major_word.cpp | 18 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_major_word.h | 7 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_picture.cpp | 18 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_picture.h | 7 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_pronoun.cpp | 18 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_pronoun.h | 7 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_string.h | 2 |
11 files changed, 126 insertions, 1 deletions
diff --git a/engines/titanic/true_talk/tt_action.cpp b/engines/titanic/true_talk/tt_action.cpp index 5f552249e7..041f4a27a4 100644 --- a/engines/titanic/true_talk/tt_action.cpp +++ b/engines/titanic/true_talk/tt_action.cpp @@ -24,6 +24,8 @@ namespace Titanic { +bool TTaction::_staticFlag; + TTaction::TTaction(TTString &str, int val1, int val2, int val3, int val4) : TTmajorWord(str, val1, val2, val3), _field30(val4) { } @@ -48,4 +50,20 @@ int TTaction::load(SimpleFile *file) { } } +TTword *TTaction::copy() { + TTaction *returnWordP = new TTaction(this); + returnWordP->_status = _status; + if (!_status) { + _staticFlag = false; + return returnWordP; + } else if (_status == SS_13 && !_staticFlag) { + _staticFlag = true; + delete returnWordP; + return copy(); + } else { + delete returnWordP; + return nullptr; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_action.h b/engines/titanic/true_talk/tt_action.h index 821d16b6b0..0d0b69a733 100644 --- a/engines/titanic/true_talk/tt_action.h +++ b/engines/titanic/true_talk/tt_action.h @@ -28,6 +28,8 @@ namespace Titanic { class TTaction : public TTmajorWord { +private: + static bool _staticFlag; protected: int _field30; public: @@ -38,6 +40,11 @@ public: * Load the word */ int load(SimpleFile *file); + + /** + * Creates a copy of the word + */ + virtual TTword *copy(); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_adj.cpp b/engines/titanic/true_talk/tt_adj.cpp index 64321b5b6b..5b942131a3 100644 --- a/engines/titanic/true_talk/tt_adj.cpp +++ b/engines/titanic/true_talk/tt_adj.cpp @@ -24,6 +24,8 @@ namespace Titanic { +bool TTadj::_staticFlag; + TTadj::TTadj(TTString &str, int val1, int val2, int val3, int val4) : TTmajorWord(str, val1, val2, val3) { if (val4 >= 0 && val4 <= 9) { @@ -54,4 +56,20 @@ int TTadj::load(SimpleFile *file) { } } +TTword *TTadj::copy() { + TTadj *returnWordP = new TTadj(this); + returnWordP->_status = _status; + if (!_status) { + _staticFlag = false; + return returnWordP; + } else if (_status == SS_13 && !_staticFlag) { + _staticFlag = true; + delete returnWordP; + return copy(); + } else { + delete returnWordP; + return nullptr; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_adj.h b/engines/titanic/true_talk/tt_adj.h index 1c0306f5b4..02d09b56c4 100644 --- a/engines/titanic/true_talk/tt_adj.h +++ b/engines/titanic/true_talk/tt_adj.h @@ -28,6 +28,8 @@ namespace Titanic { class TTadj : public TTmajorWord { +private: + static bool _staticFlag; protected: int _field30; public: @@ -38,6 +40,11 @@ public: * Load the word */ int load(SimpleFile *file); + + /** + * Creates a copy of the word + */ + virtual TTword *copy(); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_major_word.cpp b/engines/titanic/true_talk/tt_major_word.cpp index 4af3ba1a68..b56a484aa0 100644 --- a/engines/titanic/true_talk/tt_major_word.cpp +++ b/engines/titanic/true_talk/tt_major_word.cpp @@ -24,6 +24,8 @@ namespace Titanic { +bool TTmajorWord::_staticFlag; + TTmajorWord::TTmajorWord(TTString &str, int val1, int val2, int val3) : TTword(str, val1, val2), _field2C(val3) { } @@ -37,4 +39,20 @@ TTmajorWord::TTmajorWord(TTmajorWord *src) : TTword(src) { } } +TTword *TTmajorWord::copy() { + TTmajorWord *returnWordP = new TTmajorWord(this); + returnWordP->_status = _status; + if (!_status) { + _staticFlag = false; + return returnWordP; + } else if (_status == SS_13 && !_staticFlag) { + _staticFlag = true; + delete returnWordP; + return copy(); + } else { + delete returnWordP; + return nullptr; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_major_word.h b/engines/titanic/true_talk/tt_major_word.h index 95ba6caa56..140419dda2 100644 --- a/engines/titanic/true_talk/tt_major_word.h +++ b/engines/titanic/true_talk/tt_major_word.h @@ -28,11 +28,18 @@ namespace Titanic { class TTmajorWord : public TTword { +private: + static bool _staticFlag; protected: int _field2C; public: TTmajorWord(TTString &str, int val1, int val2, int val3); TTmajorWord(TTmajorWord *src); + + /** + * Creates a copy of the word + */ + virtual TTword *copy(); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_picture.cpp b/engines/titanic/true_talk/tt_picture.cpp index d1e58a57da..2cc69a1fe8 100644 --- a/engines/titanic/true_talk/tt_picture.cpp +++ b/engines/titanic/true_talk/tt_picture.cpp @@ -24,6 +24,8 @@ namespace Titanic { +bool TTpicture::_staticFlag; + TTpicture::TTpicture(TTString &str, int val1, int val2, int val3, int val4, int val5, int val6) : TTmajorWord(str, val1, val2, val4), _field34(val3), _field30(val5), _field3C(val6), _field38(0) { @@ -58,4 +60,20 @@ int TTpicture::load(SimpleFile *file) { } } +TTword *TTpicture::copy() { + TTpicture *returnWordP = new TTpicture(this); + returnWordP->_status = _status; + if (!_status) { + _staticFlag = false; + return returnWordP; + } else if (_status == SS_13 && !_staticFlag) { + _staticFlag = true; + delete returnWordP; + return copy(); + } else { + delete returnWordP; + return nullptr; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_picture.h b/engines/titanic/true_talk/tt_picture.h index 938d342ee9..1910bc6911 100644 --- a/engines/titanic/true_talk/tt_picture.h +++ b/engines/titanic/true_talk/tt_picture.h @@ -28,6 +28,8 @@ namespace Titanic { class TTpicture : public TTmajorWord { +private: + static bool _staticFlag; protected: int _field30; int _field34; @@ -41,6 +43,11 @@ public: * Load the word */ int load(SimpleFile *file); + + /** + * Creates a copy of the word + */ + virtual TTword *copy(); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_pronoun.cpp b/engines/titanic/true_talk/tt_pronoun.cpp index 764489d127..120946bb59 100644 --- a/engines/titanic/true_talk/tt_pronoun.cpp +++ b/engines/titanic/true_talk/tt_pronoun.cpp @@ -24,6 +24,8 @@ namespace Titanic { +bool TTpronoun::_staticFlag; + TTpronoun::TTpronoun(TTString &str, int val1, int val2, int val3, int val4) : TTmajorWord(str, val1, val2, val3), _field30(val4) { } @@ -52,4 +54,20 @@ int TTpronoun::load(SimpleFile *file) { } } +TTword *TTpronoun::copy() { + TTpronoun *returnWordP = new TTpronoun(this); + returnWordP->_status = _status; + if (!_status) { + _staticFlag = false; + return returnWordP; + } else if (_status == SS_13 && !_staticFlag) { + _staticFlag = true; + delete returnWordP; + return copy(); + } else { + delete returnWordP; + return nullptr; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_pronoun.h b/engines/titanic/true_talk/tt_pronoun.h index 5f554a11a6..8f55a36f07 100644 --- a/engines/titanic/true_talk/tt_pronoun.h +++ b/engines/titanic/true_talk/tt_pronoun.h @@ -28,6 +28,8 @@ namespace Titanic { class TTpronoun : public TTmajorWord { +private: + static bool _staticFlag; protected: int _field30; public: @@ -38,6 +40,11 @@ public: * Load the word */ int load(SimpleFile *file); + + /** + * Creates a copy of the word + */ + virtual TTword *copy(); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index 9cb92cf330..a881c59ecb 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -36,7 +36,7 @@ struct TTStringData { TTStringData(const CString &str) : _string(str), _referenceCount(1) {} }; -enum TTStringStatus { SS_VALID = 0, SS_5 = 5, SS_7 = 7 }; +enum TTStringStatus { SS_VALID = 0, SS_5 = 5, SS_7 = 7, SS_8 = 8, SS_13 = 13 }; class TTString { private: |