From 51a208b00d884bca2145c65f39b4ac4974dee4a7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 30 Nov 2016 21:30:50 -0500 Subject: TITANIC: Fix getting Succubus's NPC script --- engines/titanic/support/string.cpp | 9 +++++++++ engines/titanic/support/string.h | 5 +++++ 2 files changed, 14 insertions(+) (limited to 'engines/titanic/support') 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 @@ -95,6 +95,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 */ -- cgit v1.2.3