diff options
author | Paul Gilbert | 2016-11-30 21:30:50 -0500 |
---|---|---|
committer | Paul Gilbert | 2016-11-30 21:30:50 -0500 |
commit | 51a208b00d884bca2145c65f39b4ac4974dee4a7 (patch) | |
tree | e1eec78c5b97621c9c6deeb03fcd5ebd4a371831 | |
parent | 77d51dcbe403e699985b6bef0334ca725340aef5 (diff) | |
download | scummvm-rg350-51a208b00d884bca2145c65f39b4ac4974dee4a7.tar.gz scummvm-rg350-51a208b00d884bca2145c65f39b4ac4974dee4a7.tar.bz2 scummvm-rg350-51a208b00d884bca2145c65f39b4ac4974dee4a7.zip |
TITANIC: Fix getting Succubus's NPC script
-rw-r--r-- | engines/titanic/support/string.cpp | 9 | ||||
-rw-r--r-- | engines/titanic/support/string.h | 5 | ||||
-rw-r--r-- | engines/titanic/true_talk/true_talk_manager.cpp | 18 |
3 files changed, 23 insertions, 9 deletions
diff --git a/engines/titanic/support/string.cpp b/engines/titanic/support/string.cpp index cf1b29b6ec..6687c24321 100644 --- a/engines/titanic/support/string.cpp +++ b/engines/titanic/support/string.cpp @@ -77,6 +77,15 @@ int CString::lastIndexOf(char c) const { return charP ? charP - c_str() : -1; } +bool CString::containsIgnoreCase(const CString &str) const { + CString lowerStr = *this; + CString subStr = str; + lowerStr.toLowercase(); + subStr.toLowercase(); + + return lowerStr.contains(subStr); +} + FileType CString::fileTypeSuffix() const { CString ext = right(1); if (ext == "0" || ext == "4") diff --git a/engines/titanic/support/string.h b/engines/titanic/support/string.h index 71242c01c9..5ea70dbeca 100644 --- a/engines/titanic/support/string.h +++ b/engines/titanic/support/string.h @@ -96,6 +96,11 @@ public: int lastIndexOf(char c) const; /** + * Returns true if the string contains a specified substring, ignoring case + */ + bool containsIgnoreCase(const CString &str) const; + + /** * Returns the type of a filename based on it's extension */ FileType fileTypeSuffix() const; diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index d90223c300..795e160092 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -243,23 +243,23 @@ void CTrueTalkManager::start4(CTrueTalkNPC *npc, CViewItem *view) { } TTnpcScript *CTrueTalkManager::getTalker(const CString &name) const { - if (name.contains("Doorbot")) + if (name.containsIgnoreCase("Doorbot")) return _scripts.getNpcScript(104); - else if (name.contains("Deskbot")) + else if (name.containsIgnoreCase("Deskbot")) return _scripts.getNpcScript(103); - else if (name.contains("LiftBot")) + else if (name.containsIgnoreCase("LiftBot")) return _scripts.getNpcScript(105); - else if (name.contains("Parrot")) + else if (name.containsIgnoreCase("Parrot")) return _scripts.getNpcScript(107); - else if (name.contains("BarBot")) + else if (name.containsIgnoreCase("BarBot")) return _scripts.getNpcScript(100); - else if (name.contains("ChatterBot")) + else if (name.containsIgnoreCase("ChatterBot")) return _scripts.getNpcScript(102); - else if (name.contains("BellBot")) + else if (name.containsIgnoreCase("BellBot")) return _scripts.getNpcScript(101); - else if (name.contains("MaitreD")) + else if (name.containsIgnoreCase("MaitreD")) return _scripts.getNpcScript(112); - else if (name.contains("Succubus") || name.contains("Sub")) + else if (name.containsIgnoreCase("Succubus") || name.containsIgnoreCase("Sub")) return _scripts.getNpcScript(111); return nullptr; |