本文整理汇总了C++中common::SaveFileManager::renameSavefile方法的典型用法代码示例。如果您正苦于以下问题:C++ SaveFileManager::renameSavefile方法的具体用法?C++ SaveFileManager::renameSavefile怎么用?C++ SaveFileManager::renameSavefile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::SaveFileManager
的用法示例。
在下文中一共展示了SaveFileManager::renameSavefile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeSaveState
void PictureMetaEngine::removeSaveState(const char *target, int slot) const {
// Slot 0 can't be deleted, it's for restarting the game(s)
if (slot == 0)
return;
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::String filename = Picture::PictureEngine::getSavegameFilename(target, slot);
saveFileMan->removeSavefile(filename.c_str());
Common::StringArray filenames;
Common::String pattern = target;
pattern += ".???";
filenames = saveFileMan->listSavefiles(pattern.c_str());
Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last 3 digits of the filename, since they correspond to the save slot
int slotNum = atoi(file->c_str() + file->size() - 3);
// Rename every slot greater than the deleted slot,
// Also do not rename quicksaves.
if (slotNum > slot && slotNum < 990) {
// FIXME: Our savefile renaming done here is inconsitent with what we do in
// GUI_v2::deleteMenu. While here we rename every slot with a greater equal
// number of the deleted slot to deleted slot, deleted slot + 1 etc.,
// we only rename the following slots in GUI_v2::deleteMenu until a slot
// is missing.
saveFileMan->renameSavefile(file->c_str(), filename.c_str());
filename = Picture::PictureEngine::getSavegameFilename(target, ++slot);
}
}
}
示例2: testRenamingSavefile
TestExitStatus SaveGametests::testRenamingSavefile() {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
// Open a file for renaming
if (!writeDataToFile("tBedSomeWeirdName.0", "Rename me!")) {
Testsuite::logDetailedPrintf("Writing data to savefile failed\n");
return kTestFailed;
}
// Rename it
saveFileMan->renameSavefile("tBedSomeWeirdName.0", "tBedSomeCoolName.0");
// Verify if it contains the same data
if (!readAndVerifyData("tBedSomeCoolName.0", "Rename me!")) {
Testsuite::logDetailedPrintf("Renaming savefile failed\n");
return kTestFailed;
}
return kTestPassed;
}
示例3: removeSaveState
void ToltecsMetaEngine::removeSaveState(const char *target, int slot) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::String filename = Toltecs::ToltecsEngine::getSavegameFilename(target, slot);
saveFileMan->removeSavefile(filename.c_str());
Common::StringArray filenames;
Common::String pattern = target;
pattern += ".###";
filenames = saveFileMan->listSavefiles(pattern.c_str());
Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last 3 digits of the filename, since they correspond to the save slot
int slotNum = atoi(file->c_str() + file->size() - 3);
// Rename every slot greater than the deleted slot,
if (slotNum > slot) {
saveFileMan->renameSavefile(file->c_str(), filename.c_str());
filename = Toltecs::ToltecsEngine::getSavegameFilename(target, ++slot);
}
}
}