aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/true_talk/tt_string.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/true_talk/tt_string.cpp')
-rw-r--r--engines/titanic/true_talk/tt_string.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp
index a41f0ced5f..189873daf0 100644
--- a/engines/titanic/true_talk/tt_string.cpp
+++ b/engines/titanic/true_talk/tt_string.cpp
@@ -53,6 +53,28 @@ TTString::~TTString() {
delete _data;
}
+void TTString::operator=(const TTString &str) {
+ // Delete old string reference, if any
+ if (_data && --_data->_referenceCount == 0)
+ delete _data;
+
+ // Copy source string data
+ _status = str._status;
+ _data = str._data;
+ if (_data)
+ _data->_referenceCount++;
+}
+
+void TTString::operator=(const CString &str) {
+ // Delete old string reference, if any
+ if (_data && --_data->_referenceCount == 0)
+ delete _data;
+
+ // Create new string data
+ _data = new TTStringData(str);
+ _status = SS_VALID;
+}
+
bool TTString::isValid() const {
return _status == SS_VALID;
}