aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-07-23 02:23:14 +0200
committerEinar Johan Trøan Sømåen2012-07-23 02:23:14 +0200
commit7a818009b4c20df1811c0b158b0f8acfe0e3d208 (patch)
treedb81e469aa40125768cfb9c55b3a991f0051d503 /engines/wintermute
parent927eb9a9e8f8dab6995c83367739bbf280886c2d (diff)
downloadscummvm-rg350-7a818009b4c20df1811c0b158b0f8acfe0e3d208.tar.gz
scummvm-rg350-7a818009b4c20df1811c0b158b0f8acfe0e3d208.tar.bz2
scummvm-rg350-7a818009b4c20df1811c0b158b0f8acfe0e3d208.zip
WINTERMUTE: Clean out unused utils.
Diffstat (limited to 'engines/wintermute')
-rw-r--r--engines/wintermute/base/base_game.cpp1
-rw-r--r--engines/wintermute/base/scriptables/script_engine.cpp2
-rw-r--r--engines/wintermute/base/scriptables/script_engine.h1
-rw-r--r--engines/wintermute/utils/path_util.h2
-rw-r--r--engines/wintermute/utils/string_util.cpp96
-rw-r--r--engines/wintermute/utils/string_util.h12
-rw-r--r--engines/wintermute/utils/utils.cpp64
-rw-r--r--engines/wintermute/utils/utils.h5
8 files changed, 6 insertions, 177 deletions
diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp
index 6897a37776..d3da177a92 100644
--- a/engines/wintermute/base/base_game.cpp
+++ b/engines/wintermute/base/base_game.cpp
@@ -60,6 +60,7 @@
#include "engines/wintermute/base/scriptables/script_ext_math.h"
#include "engines/wintermute/video/video_player.h"
#include "engines/wintermute/video/video_theora_player.h"
+#include "engines/wintermute/utils/utils.h"
#include "engines/wintermute/wintermute.h"
#include "common/savefile.h"
#include "common/textconsole.h"
diff --git a/engines/wintermute/base/scriptables/script_engine.cpp b/engines/wintermute/base/scriptables/script_engine.cpp
index 44add054c5..e8544d8cd6 100644
--- a/engines/wintermute/base/scriptables/script_engine.cpp
+++ b/engines/wintermute/base/scriptables/script_engine.cpp
@@ -37,7 +37,7 @@
#include "engines/wintermute/base/base_game.h"
#include "engines/wintermute/base/sound/base_sound.h"
#include "engines/wintermute/base/base_file_manager.h"
-
+#include "engines/wintermute/utils/utils.h"
namespace WinterMute {
diff --git a/engines/wintermute/base/scriptables/script_engine.h b/engines/wintermute/base/scriptables/script_engine.h
index 06d61b4156..6d2ed92e4f 100644
--- a/engines/wintermute/base/scriptables/script_engine.h
+++ b/engines/wintermute/base/scriptables/script_engine.h
@@ -33,7 +33,6 @@
#include "engines/wintermute/coll_templ.h"
#include "engines/wintermute/base/base.h"
#include "engines/wintermute/wme_debugger.h"
-#include "engines/wintermute/utils/utils.h"
#include "engines/wintermute/platform_osystem.h"
namespace WinterMute {
diff --git a/engines/wintermute/utils/path_util.h b/engines/wintermute/utils/path_util.h
index 139ce89ddd..a52b4baaf9 100644
--- a/engines/wintermute/utils/path_util.h
+++ b/engines/wintermute/utils/path_util.h
@@ -29,7 +29,7 @@
#ifndef WINTERMUTE_PATHUTILS_H
#define WINTERMUTE_PATHUTILS_H
-#include "engines/wintermute/platform_osystem.h"
+#include "engines/wintermute/dctypes.h"
namespace WinterMute {
diff --git a/engines/wintermute/utils/string_util.cpp b/engines/wintermute/utils/string_util.cpp
index c3fcb09f1d..fcf5620cd7 100644
--- a/engines/wintermute/utils/string_util.cpp
+++ b/engines/wintermute/utils/string_util.cpp
@@ -26,7 +26,6 @@
* Copyright (c) 2011 Jan Nedoma
*/
-#include "engines/wintermute/dcgf.h"
#include "common/tokenizer.h"
#include "engines/wintermute/utils/string_util.h"
#include "engines/wintermute/utils/convert_utf.h"
@@ -265,48 +264,6 @@ bool StringUtil::isUtf8BOM(const byte *Buffer, uint32 BufferSize) {
}
//////////////////////////////////////////////////////////////////////////
-AnsiString StringUtil::replace(const AnsiString &str, const AnsiString &from, const AnsiString &to) {
- if (from.empty() || from == to) return str;
-
- AnsiString result = str;
- /*size_t pos = 0;*/
-
- while (result.contains(from)) {
- const char *startPtr = strstr(result.c_str(), from.c_str());
- uint32 index = startPtr - result.c_str();
-
- Common::String tail(result.c_str() + index + to.size());
- result = Common::String(result.c_str(), index);
- result += to;
- result += tail;
-
- /* pos = result.find(from, pos);
- if (pos == result.npos) break;
-
- result.replace(pos, from.size(), to);
- pos += to.size();*/
- }
-
- return result;
-}
-
-//////////////////////////////////////////////////////////////////////////
-AnsiString StringUtil::trim(const AnsiString &str, bool fromLeft, bool fromRight, const AnsiString &chars) {
- AnsiString trimmedStr = str;
-
- if (fromRight) {
- //trimmedStr.erase(trimmedStr.find_last_not_of(chars) + 1); // TODO
- warning("fromRight-trim not implemented yet, %s", chars.c_str());
- }
- if (fromLeft) {
- uint32 lastOf = lastIndexOf(str, chars, 0);
- trimmedStr = Common::String(trimmedStr.c_str() + lastOf);
- //trimmedStr.erase(0, trimmedStr.find_first_not_of(chars));
- }
- return trimmedStr;
-}
-
-//////////////////////////////////////////////////////////////////////////
int StringUtil::indexOf(const WideString &str, const WideString &toFind, size_t startFrom) {
/*size_t pos = str.find(toFind, startFrom);
if (pos == str.npos) return -1;
@@ -318,64 +275,11 @@ int StringUtil::indexOf(const WideString &str, const WideString &toFind, size_t
return index - str.c_str();
}
-//////////////////////////////////////////////////////////////////////////
-int StringUtil::lastIndexOf(const WideString &str, const WideString &toFind, size_t startFrom) {
- /*size_t pos = str.rfind(toFind, startFrom);
- if (pos == str.npos) return -1;
- else return pos;*/
- int32 lastIndex = -1;
- bool found = false;
- for (size_t i = startFrom; i < str.size(); i++) {
- found = false;
- for (size_t j = 0; j < toFind.size(); j++) {
- if (str[i + j] != toFind[j]) {
- found = false;
- break;
- } else {
- found = true;
- }
- }
- if (found)
- lastIndex = i;
- }
- return lastIndex;
-}
-
-//////////////////////////////////////////////////////////////////////////
-AnsiString StringUtil::toString(size_t val) {
- return Common::String::format("%u", (uint32)val);
-}
//////////////////////////////////////////////////////////////////////////
AnsiString StringUtil::toString(int val) {
return Common::String::format("%d", val);
}
-//////////////////////////////////////////////////////////////////////////
-AnsiString StringUtil::toString(float val) {
- return Common::String::format("%f", val);
-}
-
-//////////////////////////////////////////////////////////////////////////
-AnsiString StringUtil::toString(double val) {
- return Common::String::format("%f", val);
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-void StringUtil::split(const AnsiString &list, const AnsiString &delimiters, AnsiStringArray &result, bool keepEmptyItems) {
- result.clear();
-//TODO: Verify this, wrt keepEmptyItems.
- Common::StringTokenizer tokenizer(list.c_str(), delimiters.c_str());
- //typedef boost::char_separator<char> separator_t;
- //typedef boost::tokenizer<separator_t, AnsiString::const_iterator, AnsiString> tokenizer_t;
-
- //separator_t del(delimiters.c_str(), "", keepEmptyItems ? boost::keep_empty_tokens : boost::drop_empty_tokens);
- //tokenizer_t tokens(list, del);
- while (!tokenizer.empty()) {
- Common::String copy(tokenizer.nextToken().c_str());
- result.push_back(copy);
- }
-}
} // end of namespace WinterMute
diff --git a/engines/wintermute/utils/string_util.h b/engines/wintermute/utils/string_util.h
index bd1b71f405..80b4ab5911 100644
--- a/engines/wintermute/utils/string_util.h
+++ b/engines/wintermute/utils/string_util.h
@@ -29,7 +29,7 @@
#ifndef WINTERMUTE_STRINGUTIL_H
#define WINTERMUTE_STRINGUTIL_H
-#include "engines/wintermute/platform_osystem.h"
+#include "engines/wintermute/dctypes.h"
namespace WinterMute {
@@ -46,19 +46,9 @@ public:
static bool endsWith(const AnsiString &str, const AnsiString &pattern, bool ignoreCase = false);
static bool isUtf8BOM(const byte *buffer, uint32 bufferSize);
-
- static AnsiString replace(const AnsiString &str, const AnsiString &from, const AnsiString &to);
- static AnsiString trim(const AnsiString &str, bool fromLeft = true, bool fromRight = true, const AnsiString &chars = " \n\r\t");
-
static int indexOf(const WideString &str, const WideString &toFind, size_t startFrom);
- static int lastIndexOf(const WideString &str, const WideString &toFind, size_t startFrom);
- static AnsiString toString(size_t val);
static AnsiString toString(int val);
- static AnsiString toString(float val);
- static AnsiString toString(double val);
-
- static void split(const AnsiString &list, const AnsiString &delimiters, AnsiStringArray &result, bool keepEmptyItems = false);
};
} // end of namespace WinterMute
diff --git a/engines/wintermute/utils/utils.cpp b/engines/wintermute/utils/utils.cpp
index 038095c8ae..ee723cf80a 100644
--- a/engines/wintermute/utils/utils.cpp
+++ b/engines/wintermute/utils/utils.cpp
@@ -26,14 +26,7 @@
* Copyright (c) 2011 Jan Nedoma
*/
-#include "engines/wintermute/dcgf.h"
#include "engines/wintermute/utils/utils.h"
-#include "engines/wintermute/platform_osystem.h"
-#include "engines/wintermute/wintypes.h"
-#include "engines/wintermute/utils/path_util.h"
-#include "engines/wintermute/base/base_game.h"
-#include "common/str.h"
-#include "common/textconsole.h"
#include "engines/wintermute/wintermute.h"
namespace WinterMute {
@@ -43,36 +36,6 @@ static inline unsigned Sqr(int x) {
return (x * x);
}
-
-//////////////////////////////////////////////////////////////////////////////////
-void BaseUtils::clip(int *destX, int *destY, Rect32 *srcRect, Rect32 *destRect) {
- // If it's partly off the right side of the screen
- if (*destX + (srcRect->right - srcRect->left) > destRect->right)
- srcRect->right -= *destX + (srcRect->right - srcRect->left) - destRect->right;
-
- if (srcRect->right < 0) srcRect->right = 0;
-
- // Partly off the left side of the screen
- if (*destX < destRect->left) {
- srcRect->left += destRect->left - *destX;
- *destX = destRect->left;
- }
-
- // Partly off the top of the screen
- if (*destY < destRect->top) {
- srcRect->top += destRect->top - *destY;
- *destY = destRect->top;
- }
-
- // If it's partly off the bottom side of the screen
- if (*destY + (srcRect->bottom - srcRect->top) > destRect->bottom)
- srcRect->bottom -= ((srcRect->bottom - srcRect->top) + *destY) - destRect->bottom;
-
- if (srcRect->bottom < 0) srcRect->bottom = 0;
-
- return;
-}
-
//////////////////////////////////////////////////////////////////////////////////
// Swap - swaps two integers
//////////////////////////////////////////////////////////////////////////////////
@@ -82,11 +45,6 @@ void BaseUtils::swap(int *a, int *b) {
*b = Temp;
}
-//////////////////////////////////////////////////////////////////////////
-bool BaseUtils::strBeginsI(const char *string, const char *fragment) {
- return (scumm_strnicmp(string, fragment, strlen(fragment)) == 0);
-}
-
//////////////////////////////////////////////////////////////////////////
float BaseUtils::normalizeAngle(float angle) {
@@ -99,11 +57,11 @@ float BaseUtils::normalizeAngle(float angle) {
////////////////////////////////////////////////////////////////////////////////
void BaseUtils::createPath(const char *path, bool pathOnly) {
- AnsiString pathStr;
+/* AnsiString pathStr;
if (!pathOnly) pathStr = PathUtil::getDirectoryName(path);
else pathStr = path;
-
+*/
// try {
warning("BaseUtils::CreatePath - not implemented: %s", path);
// boost::filesystem::create_directories(path);
@@ -235,24 +193,6 @@ bool BaseUtils::matchesPattern(const char *pattern, const char *string) {
}
}
-//////////////////////////////////////////////////////////////////////////
-char *BaseUtils::getPath(const char *filename) {
- AnsiString path = PathUtil::getDirectoryName(filename);
- //path = boost::filesystem::syste_complete(path).string();
- warning("BaseUtils::GetPath: (%s), not implemented", filename);
- char *ret = new char[path.size() + 1];
- strcpy(ret, path.c_str());
-
- return ret;
-}
-
-//////////////////////////////////////////////////////////////////////////
-char *BaseUtils::getFilename(const char *filename) {
- AnsiString path = PathUtil::getFileName(filename);
- char *ret = new char[path.size() + 1];
- strcpy(ret, path.c_str());
- return ret;
-}
//////////////////////////////////////////////////////////////////////////
void BaseUtils::RGBtoHSL(uint32 RGBColor, byte *outH, byte *outS, byte *outL) {
diff --git a/engines/wintermute/utils/utils.h b/engines/wintermute/utils/utils.h
index 3baafaa606..3cb01c57b8 100644
--- a/engines/wintermute/utils/utils.h
+++ b/engines/wintermute/utils/utils.h
@@ -38,9 +38,7 @@ class BaseGame;
class BaseUtils {
public:
- static void clip(int *destX, int *destY, Rect32 *srcRect, Rect32 *destRect);
static void swap(int *a, int *b);
- static bool strBeginsI(const char *string, const char *fragment);
static float normalizeAngle(float angle);
static void createPath(const char *path, bool pathOnly = false);
@@ -57,9 +55,6 @@ public:
static bool matchesPattern(const char *pattern, const char *string);
- static char *getPath(const char *filename);
- static char *getFilename(const char *filename);
-
static void RGBtoHSL(uint32 RGBColor, byte *OutH, byte *OutS, byte *OutL);
static uint32 HSLtoRGB(byte H, byte S, byte L);