aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/true_talk/tt_string.cpp17
-rw-r--r--engines/titanic/true_talk/tt_string.h9
-rw-r--r--engines/titanic/true_talk/tt_vocab.cpp8
-rw-r--r--engines/titanic/true_talk/tt_vocab.h2
4 files changed, 36 insertions, 0 deletions
diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp
index df93a5669c..76c109284a 100644
--- a/engines/titanic/true_talk/tt_string.cpp
+++ b/engines/titanic/true_talk/tt_string.cpp
@@ -122,4 +122,21 @@ TTstring TTstring::tokenize(const char *delim) {
}
}
+int TTstring::deletePrefix(int count) {
+ int strSize = size();
+ if (count > strSize)
+ count = strSize;
+
+ if (_data->_referenceCount == 1) {
+ // No other references to this string, so we can just directly modify it
+ _data->_string = CString(_data->_string.c_str() + count);
+ } else {
+ // Detach string from current shared data, and create a new one with the substring
+ _data->_referenceCount--;
+ _data = new TTstringData(_data->_string.c_str() + count);
+ }
+
+ return 1;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h
index 434c6fe829..42666432c5 100644
--- a/engines/titanic/true_talk/tt_string.h
+++ b/engines/titanic/true_talk/tt_string.h
@@ -90,6 +90,10 @@ public:
return _data->_string.hasSuffix(str);
}
+ bool contains(const char *s) const {
+ return _data->_string.contains(s);
+ }
+
/**
* Create a new copy of the string
*/
@@ -141,6 +145,11 @@ public:
* of any specified delimiter character
*/
TTstring tokenize(const char *delim);
+
+ /**
+ * Delets a specififed number of characters from the start of the string
+ */
+ int deletePrefix(int count);
};
} // End of namespace Titanic
diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp
index 102ed2cbdd..458c0a10d7 100644
--- a/engines/titanic/true_talk/tt_vocab.cpp
+++ b/engines/titanic/true_talk/tt_vocab.cpp
@@ -208,4 +208,12 @@ TTword *TTvocab::getPrimeWord(TTstring &str, TTword **srcWord) const {
return newWord;
}
+void TTvocab::fn1(TTstring &str) {
+ TTstring tempStr(str);
+
+ if (tempStr.contains("pre")) {
+
+ }
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/true_talk/tt_vocab.h b/engines/titanic/true_talk/tt_vocab.h
index e1dcfe6fe2..0a3e826fe6 100644
--- a/engines/titanic/true_talk/tt_vocab.h
+++ b/engines/titanic/true_talk/tt_vocab.h
@@ -66,6 +66,8 @@ public:
* @returns A new word instance if a match if found, or null if not
*/
TTword *getPrimeWord(TTstring &str, TTword **srcWord) const;
+
+ void fn1(TTstring &str);
};
} // End of namespace Titanic