aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2011-06-03 14:03:36 +0200
committerMax Horn2011-06-03 16:16:38 +0200
commit11bd6da595247773155b6155beb795ea25456fa7 (patch)
treeb43784694dcdd7103c7472b7b6259c9341250685 /engines
parentb25fa194b32f4a9862f52c1b3b90aeabd43de544 (diff)
downloadscummvm-rg350-11bd6da595247773155b6155beb795ea25456fa7.tar.gz
scummvm-rg350-11bd6da595247773155b6155beb795ea25456fa7.tar.bz2
scummvm-rg350-11bd6da595247773155b6155beb795ea25456fa7.zip
SCI: Switch some char* to Common::String&
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/preagi_mickey.o.kaitain.86539.cD93K5bin0 -> 226836 bytes
-rw-r--r--engines/sci/engine/kfile.cpp8
-rw-r--r--engines/sci/engine/state.cpp8
-rw-r--r--engines/sci/engine/workarounds.cpp4
-rw-r--r--engines/sci/sci.h2
5 files changed, 11 insertions, 11 deletions
diff --git a/engines/agi/preagi_mickey.o.kaitain.86539.cD93K5 b/engines/agi/preagi_mickey.o.kaitain.86539.cD93K5
new file mode 100644
index 0000000000..67c719a9b4
--- /dev/null
+++ b/engines/agi/preagi_mickey.o.kaitain.86539.cD93K5
Binary files differ
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index ee88d8af15..8dc7836068 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -100,7 +100,7 @@ enum {
-reg_t file_open(EngineState *s, const char *filename, int mode, bool unwrapFilename) {
+reg_t file_open(EngineState *s, const Common::String &filename, int mode, bool unwrapFilename) {
Common::String englishName = g_sci->getSciLanguageString(filename, K_LANG_ENGLISH);
Common::String wrappedName = unwrapFilename ? g_sci->wrapFilename(englishName) : englishName;
Common::SeekableReadStream *inFile = 0;
@@ -178,7 +178,7 @@ reg_t kFOpen(EngineState *s, int argc, reg_t *argv) {
int mode = argv[1].toUint16();
debugC(kDebugLevelFile, "kFOpen(%s,0x%x)", name.c_str(), mode);
- return file_open(s, name.c_str(), mode, true);
+ return file_open(s, name, mode, true);
}
static FileHandle *getFileFromHandle(EngineState *s, uint handle) {
@@ -644,7 +644,7 @@ reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) {
if (!out) {
warning("Error opening savegame \"%s\" for writing", filename.c_str());
} else {
- if (!gamestate_save(s, out, game_description.c_str(), version.c_str())) {
+ if (!gamestate_save(s, out, game_description, version)) {
warning("Saving the game failed");
} else {
s->r_acc = TRUE_REG; // save successful
@@ -792,7 +792,7 @@ reg_t kFileIOOpen(EngineState *s, int argc, reg_t *argv) {
unwrapFilename = false;
}
- return file_open(s, name.c_str(), mode, unwrapFilename);
+ return file_open(s, name, mode, unwrapFilename);
}
reg_t kFileIOClose(EngineState *s, int argc, reg_t *argv) {
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index e094ed3bd7..3328f80de1 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -192,10 +192,10 @@ static kLanguage charToLanguage(const char c) {
}
}
-Common::String SciEngine::getSciLanguageString(const char *str, kLanguage lang, kLanguage *lang2) const {
+Common::String SciEngine::getSciLanguageString(const Common::String &str, kLanguage lang, kLanguage *lang2) const {
kLanguage secondLang = K_LANG_NONE;
- const char *seeker = str;
+ const char *seeker = str.c_str();
while (*seeker) {
if ((*seeker == '%') || (*seeker == '#')) {
secondLang = charToLanguage(*(seeker + 1));
@@ -242,9 +242,9 @@ Common::String SciEngine::getSciLanguageString(const char *str, kLanguage lang,
}
if (seeker)
- return Common::String(str, seeker - str);
+ return Common::String(str.c_str(), seeker - str.c_str());
else
- return Common::String(str);
+ return str;
}
kLanguage SciEngine::getSciLanguage() {
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index fa25b02a8f..8bf90ff53d 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -447,7 +447,7 @@ SciWorkaroundSolution trackOriginAndFindWorkaround(int index, const SciWorkaroun
workaround = workaroundList;
while (workaround->methodName) {
bool objectNameMatches = (workaround->objectName == NULL) ||
- (workaround->objectName == g_sci->getSciLanguageString(searchObjectName.c_str(), K_LANG_ENGLISH));
+ (workaround->objectName == g_sci->getSciLanguageString(searchObjectName, K_LANG_ENGLISH));
// Special case: in the fanmade Russian translation of SQ4, all
// of the object names have been deleted or renamed to Russian,
@@ -460,7 +460,7 @@ SciWorkaroundSolution trackOriginAndFindWorkaround(int index, const SciWorkaroun
&& ((workaround->roomNr == -1) || (workaround->roomNr == curRoomNumber))
&& ((workaround->inheritanceLevel == -1) || (workaround->inheritanceLevel == inheritanceLevel))
&& objectNameMatches
- && workaround->methodName == g_sci->getSciLanguageString(curMethodName.c_str(), K_LANG_ENGLISH)
+ && workaround->methodName == g_sci->getSciLanguageString(curMethodName, K_LANG_ENGLISH)
&& workaround->localCallOffset == lastCall->debugLocalCallOffset
&& ((workaround->index == -1) || (workaround->index == index))) {
// Workaround found
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index 77718e4b37..04ccbd97d2 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -290,7 +290,7 @@ public:
void setSciLanguage(kLanguage lang);
void setSciLanguage();
- Common::String getSciLanguageString(const char *str, kLanguage lang, kLanguage *lang2 = NULL) const;
+ Common::String getSciLanguageString(const Common::String &str, kLanguage lang, kLanguage *lang2 = NULL) const;
// Check if vocabulary needs to get switched (in multilingual parser games)
void checkVocabularySwitch();