aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute
diff options
context:
space:
mode:
authorTobia Tesan2014-02-22 12:10:27 +0100
committerTobia Tesan2014-10-15 21:36:46 +0200
commitf1ae8e6e8d89f53e8fcd6ffb7eb3faf1e5ab8993 (patch)
treec3781095a646b133e29f3270e2ca09335d88bf27 /engines/wintermute
parent599390a5ad5b0df7a480230a97b51b9ccb41a177 (diff)
downloadscummvm-rg350-f1ae8e6e8d89f53e8fcd6ffb7eb3faf1e5ab8993.tar.gz
scummvm-rg350-f1ae8e6e8d89f53e8fcd6ffb7eb3faf1e5ab8993.tar.bz2
scummvm-rg350-f1ae8e6e8d89f53e8fcd6ffb7eb3faf1e5ab8993.zip
WINTERMUTE: Introduce BaseGame->expandStringByStringTable(&Common::String)
Diffstat (limited to 'engines/wintermute')
-rw-r--r--engines/wintermute/base/base_game.cpp5
-rw-r--r--engines/wintermute/base/base_game.h1
-rw-r--r--engines/wintermute/base/base_game_settings.cpp5
-rw-r--r--engines/wintermute/base/base_game_settings.h1
-rw-r--r--engines/wintermute/base/base_string_table.cpp9
-rw-r--r--engines/wintermute/base/base_string_table.h1
6 files changed, 22 insertions, 0 deletions
diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp
index 8df39c825a..668053bb3a 100644
--- a/engines/wintermute/base/base_game.cpp
+++ b/engines/wintermute/base/base_game.cpp
@@ -3896,6 +3896,11 @@ void BaseGame::expandStringByStringTable(char **str) const {
_settings->expandStringByStringTable(str);
}
+//////////////////////////////////////////////////////////////////////////
+void BaseGame::expandStringByStringTable(Common::String &str) const {
+ _settings->expandStringByStringTable(str);
+}
+
char *BaseGame::getKeyFromStringTable(const char *str) const {
return _settings->getKeyFromStringTable(str);
}
diff --git a/engines/wintermute/base/base_game.h b/engines/wintermute/base/base_game.h
index f62416ee1b..e535cc9618 100644
--- a/engines/wintermute/base/base_game.h
+++ b/engines/wintermute/base/base_game.h
@@ -141,6 +141,7 @@ public:
// String Table
void expandStringByStringTable(char **str) const;
+ void expandStringByStringTable(Common::String &str) const;
char *getKeyFromStringTable(const char *str) const;
void LOG(bool res, const char *fmt, ...);
diff --git a/engines/wintermute/base/base_game_settings.cpp b/engines/wintermute/base/base_game_settings.cpp
index 61c5894be3..996bada997 100644
--- a/engines/wintermute/base/base_game_settings.cpp
+++ b/engines/wintermute/base/base_game_settings.cpp
@@ -215,6 +215,11 @@ void BaseGameSettings::expandStringByStringTable(char **str) const {
_stringTable->expand(str);
}
+//////////////////////////////////////////////////////////////////////////
+void BaseGameSettings::expandStringByStringTable(Common::String &str) const {
+ _stringTable->expand(str);
+}
+
char *BaseGameSettings::getKeyFromStringTable(const char *str) const {
return _stringTable->getKey(str);
}
diff --git a/engines/wintermute/base/base_game_settings.h b/engines/wintermute/base/base_game_settings.h
index 2059cb075e..15afb06450 100644
--- a/engines/wintermute/base/base_game_settings.h
+++ b/engines/wintermute/base/base_game_settings.h
@@ -46,6 +46,7 @@ public:
bool loadSettings(const char *filename);
bool loadStringTable(const char *filename, bool clearOld);
void expandStringByStringTable(char **str) const;
+ void expandStringByStringTable(Common::String &str) const;
char *getKeyFromStringTable(const char *str) const;
bool persist(BasePersistenceManager *persistMgr);
diff --git a/engines/wintermute/base/base_string_table.cpp b/engines/wintermute/base/base_string_table.cpp
index 89407a7b0e..8a9edbe198 100644
--- a/engines/wintermute/base/base_string_table.cpp
+++ b/engines/wintermute/base/base_string_table.cpp
@@ -147,6 +147,15 @@ void BaseStringTable::expand(char **str) const {
}
}
+//////////////////////////////////////////////////////////////////////////
+void BaseStringTable::expand(Common::String &str) const {
+ char *tmp = new char[str.size()];
+ strcpy(tmp, str.c_str());
+ expand(&tmp);
+ str = tmp;
+ delete tmp;
+}
+
//////////////////////////////////////////////////////////////////////////
const char *BaseStringTable::expandStatic(const char *string) const {
diff --git a/engines/wintermute/base/base_string_table.h b/engines/wintermute/base/base_string_table.h
index cdcf11917d..cfa3eeb226 100644
--- a/engines/wintermute/base/base_string_table.h
+++ b/engines/wintermute/base/base_string_table.h
@@ -41,6 +41,7 @@ class BaseStringTable : public BaseClass {
public:
bool loadFile(const char *filename, bool deleteAll = true);
void expand(char **str) const;
+ void expand(Common::String &str) const;
const char *expandStatic(const char *string) const;
bool addString(const char *key, const char *val, bool reportDuplicities = true);
BaseStringTable(BaseGame *inGame);