SCI: Switch some char* to Common::String&
This commit is contained in:
parent
b25fa194b3
commit
11bd6da595
5 changed files with 11 additions and 11 deletions
BIN
engines/agi/preagi_mickey.o.kaitain.86539.cD93K5
Normal file
BIN
engines/agi/preagi_mickey.o.kaitain.86539.cD93K5
Normal file
Binary file not shown.
|
@ -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 englishName = g_sci->getSciLanguageString(filename, K_LANG_ENGLISH);
|
||||||
Common::String wrappedName = unwrapFilename ? g_sci->wrapFilename(englishName) : englishName;
|
Common::String wrappedName = unwrapFilename ? g_sci->wrapFilename(englishName) : englishName;
|
||||||
Common::SeekableReadStream *inFile = 0;
|
Common::SeekableReadStream *inFile = 0;
|
||||||
|
@ -178,7 +178,7 @@ reg_t kFOpen(EngineState *s, int argc, reg_t *argv) {
|
||||||
int mode = argv[1].toUint16();
|
int mode = argv[1].toUint16();
|
||||||
|
|
||||||
debugC(kDebugLevelFile, "kFOpen(%s,0x%x)", name.c_str(), mode);
|
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) {
|
static FileHandle *getFileFromHandle(EngineState *s, uint handle) {
|
||||||
|
@ -644,7 +644,7 @@ reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) {
|
||||||
if (!out) {
|
if (!out) {
|
||||||
warning("Error opening savegame \"%s\" for writing", filename.c_str());
|
warning("Error opening savegame \"%s\" for writing", filename.c_str());
|
||||||
} else {
|
} 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");
|
warning("Saving the game failed");
|
||||||
} else {
|
} else {
|
||||||
s->r_acc = TRUE_REG; // save successful
|
s->r_acc = TRUE_REG; // save successful
|
||||||
|
@ -792,7 +792,7 @@ reg_t kFileIOOpen(EngineState *s, int argc, reg_t *argv) {
|
||||||
unwrapFilename = false;
|
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) {
|
reg_t kFileIOClose(EngineState *s, int argc, reg_t *argv) {
|
||||||
|
|
|
@ -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;
|
kLanguage secondLang = K_LANG_NONE;
|
||||||
|
|
||||||
const char *seeker = str;
|
const char *seeker = str.c_str();
|
||||||
while (*seeker) {
|
while (*seeker) {
|
||||||
if ((*seeker == '%') || (*seeker == '#')) {
|
if ((*seeker == '%') || (*seeker == '#')) {
|
||||||
secondLang = charToLanguage(*(seeker + 1));
|
secondLang = charToLanguage(*(seeker + 1));
|
||||||
|
@ -242,9 +242,9 @@ Common::String SciEngine::getSciLanguageString(const char *str, kLanguage lang,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (seeker)
|
if (seeker)
|
||||||
return Common::String(str, seeker - str);
|
return Common::String(str.c_str(), seeker - str.c_str());
|
||||||
else
|
else
|
||||||
return Common::String(str);
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
kLanguage SciEngine::getSciLanguage() {
|
kLanguage SciEngine::getSciLanguage() {
|
||||||
|
|
|
@ -447,7 +447,7 @@ SciWorkaroundSolution trackOriginAndFindWorkaround(int index, const SciWorkaroun
|
||||||
workaround = workaroundList;
|
workaround = workaroundList;
|
||||||
while (workaround->methodName) {
|
while (workaround->methodName) {
|
||||||
bool objectNameMatches = (workaround->objectName == NULL) ||
|
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
|
// Special case: in the fanmade Russian translation of SQ4, all
|
||||||
// of the object names have been deleted or renamed to Russian,
|
// 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->roomNr == -1) || (workaround->roomNr == curRoomNumber))
|
||||||
&& ((workaround->inheritanceLevel == -1) || (workaround->inheritanceLevel == inheritanceLevel))
|
&& ((workaround->inheritanceLevel == -1) || (workaround->inheritanceLevel == inheritanceLevel))
|
||||||
&& objectNameMatches
|
&& 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->localCallOffset == lastCall->debugLocalCallOffset
|
||||||
&& ((workaround->index == -1) || (workaround->index == index))) {
|
&& ((workaround->index == -1) || (workaround->index == index))) {
|
||||||
// Workaround found
|
// Workaround found
|
||||||
|
|
|
@ -290,7 +290,7 @@ public:
|
||||||
void setSciLanguage(kLanguage lang);
|
void setSciLanguage(kLanguage lang);
|
||||||
void setSciLanguage();
|
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)
|
// Check if vocabulary needs to get switched (in multilingual parser games)
|
||||||
void checkVocabularySwitch();
|
void checkVocabularySwitch();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue