diff options
author | Nicola Mettifogo | 2008-12-03 12:23:50 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2008-12-03 12:23:50 +0000 |
commit | 1e4f2b5a9012794c52133cdb729dad3ff5704f8b (patch) | |
tree | 5c3dde98596ac5da4acb12aee5799a2605874b3c /engines/parallaction | |
parent | c20292c0f1cfe9e3283fa71053a84c990f3e467d (diff) | |
download | scummvm-rg350-1e4f2b5a9012794c52133cdb729dad3ff5704f8b.tar.gz scummvm-rg350-1e4f2b5a9012794c52133cdb729dad3ff5704f8b.tar.bz2 scummvm-rg350-1e4f2b5a9012794c52133cdb729dad3ff5704f8b.zip |
Replaced remaining usages of readLine_OLD with readLine.
svn-id: r35218
Diffstat (limited to 'engines/parallaction')
-rw-r--r-- | engines/parallaction/saveload.cpp | 85 |
1 files changed, 39 insertions, 46 deletions
diff --git a/engines/parallaction/saveload.cpp b/engines/parallaction/saveload.cpp index afa6b34499..bba4693b71 100644 --- a/engines/parallaction/saveload.cpp +++ b/engines/parallaction/saveload.cpp @@ -110,41 +110,36 @@ void SaveLoad_ns::doLoadGame(uint16 slot) { Common::InSaveFile *f = getInSaveFile(slot); if (!f) return; - char s[200]; - char n[16]; - char l[16]; - - f->readLine_OLD(s, 199); + Common::String s, character, location; - f->readLine_OLD(n, 15); + // scrap the line with the savefile name + f->readLine(); - f->readLine_OLD(l, 15); + character = f->readLine(); + location = f->readLine(); - f->readLine_OLD(s, 15); - _vm->_location._startPosition.x = atoi(s); + s = f->readLine(); + _vm->_location._startPosition.x = atoi(s.c_str()); - f->readLine_OLD(s, 15); - _vm->_location._startPosition.y = atoi(s); + s = f->readLine(); + _vm->_location._startPosition.y = atoi(s.c_str()); - f->readLine_OLD(s, 15); - _score = atoi(s); + s = f->readLine(); + _score = atoi(s.c_str()); - f->readLine_OLD(s, 15); - _globalFlags = atoi(s); + s = f->readLine(); + _globalFlags = atoi(s.c_str()); - f->readLine_OLD(s, 15); - - _vm->_numLocations = atoi(s); + s = f->readLine(); + _vm->_numLocations = atoi(s.c_str()); uint16 _si; for (_si = 0; _si < _vm->_numLocations; _si++) { - f->readLine_OLD(s, 20); - s[strlen(s)] = '\0'; - - strcpy(_vm->_locationNames[_si], s); + s = f->readLine(); + strcpy(_vm->_locationNames[_si], s.c_str()); - f->readLine_OLD(s, 15); - _vm->_localFlags[_si] = atoi(s); + s = f->readLine(); + _vm->_localFlags[_si] = atoi(s.c_str()); } _vm->cleanInventory(false); @@ -152,11 +147,11 @@ void SaveLoad_ns::doLoadGame(uint16 slot) { uint32 value; for (_si = 0; _si < 30; _si++) { - f->readLine_OLD(s, 15); - value = atoi(s); + s = f->readLine(); + value = atoi(s.c_str()); - f->readLine_OLD(s, 15); - name = atoi(s); + s = f->readLine(); + name = atoi(s.c_str()); _vm->addInventoryItem(name, value); } @@ -168,7 +163,7 @@ void SaveLoad_ns::doLoadGame(uint16 slot) { strcpy(_vm->_characterName1, "null"); char tmp[PATH_LEN]; - sprintf(tmp, "%s.%s" , l, n); + sprintf(tmp, "%s.%s" , location.c_str(), character.c_str()); _vm->scheduleLocationSwitch(tmp); return; @@ -334,23 +329,24 @@ void SaveLoadChooser::reflowLayout() { } int SaveLoad_ns::buildSaveFileList(Common::StringList& l) { + Common::String pattern = _saveFilePrefix + ".???"; + Common::StringList filenames = _saveFileMan->listSavefiles(pattern.c_str()); - char buf[200]; + Common::String s; int count = 0; for (int i = 0; i < NUM_SAVESLOTS; i++) { - buf[0] = '\0'; + s.clear(); Common::InSaveFile *f = getInSaveFile(i); if (f) { - f->readLine_OLD(buf, 199); - delete f; - + s = f->readLine(); count++; } - l.push_back(buf); + delete f; + l.push_back(s); } return count; @@ -417,24 +413,22 @@ bool SaveLoad_ns::saveGame() { void SaveLoad_ns::setPartComplete(const char *part) { - char buf[30]; + Common::String s; bool alreadyPresent = false; - memset(buf, 0, sizeof(buf)); - Common::InSaveFile *inFile = getInSaveFile(SPECIAL_SAVESLOT); if (inFile) { - inFile->readLine_OLD(buf, 29); + s = inFile->readLine(); delete inFile; - if (strstr(buf, part)) { + if (s.contains(part)) { alreadyPresent = true; } } if (!alreadyPresent) { Common::OutSaveFile *outFile = getOutSaveFile(SPECIAL_SAVESLOT); - outFile->writeString(buf); + outFile->writeString(s); outFile->writeString(part); outFile->finalize(); delete outFile; @@ -446,14 +440,13 @@ void SaveLoad_ns::setPartComplete(const char *part) { void SaveLoad_ns::getGamePartProgress(bool *complete, int size) { assert(complete && size >= 3); - char buf[30]; Common::InSaveFile *inFile = getInSaveFile(SPECIAL_SAVESLOT); - inFile->readLine_OLD(buf, 29); + Common::String s = inFile->readLine(); delete inFile; - complete[0] = strstr(buf, "dino"); - complete[1] = strstr(buf, "donna"); - complete[2] = strstr(buf, "dough"); + complete[0] = s.contains("dino"); + complete[1] = s.contains("donna"); + complete[2] = s.contains("dough"); } void SaveLoad_ns::renameOldSavefiles() { |