本文整理汇总了C++中SaveStateDescriptor::setSaveSlot方法的典型用法代码示例。如果您正苦于以下问题:C++ SaveStateDescriptor::setSaveSlot方法的具体用法?C++ SaveStateDescriptor::setSaveSlot怎么用?C++ SaveStateDescriptor::setSaveSlot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SaveStateDescriptor
的用法示例。
在下文中一共展示了SaveStateDescriptor::setSaveSlot方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: listSaves
SaveStateList FullpipeMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringArray filenames;
Common::String pattern("fullpipe.s##");
filenames = saveFileMan->listSavefiles(pattern);
SaveStateList saveList;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last 2 digits of the filename, since they correspond to the save slot
int slotNum = atoi(file->c_str() + file->size() - 2);
if (slotNum >= 0 && slotNum <= getMaximumSaveSlot()) {
Common::ScopedPtr<Common::InSaveFile> in(saveFileMan->openForLoading(*file));
if (in) {
Fullpipe::FullpipeSavegameHeader header;
Fullpipe::readSavegameHeader(in.get(), header);
SaveStateDescriptor desc;
parseSavegameHeader(header, desc);
desc.setSaveSlot(slotNum);
saveList.push_back(desc);
}
}
}
// Sort saves based on slot number.
Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
return saveList;
}
示例2: getSaveStateDesc
void BasePersistenceManager::getSaveStateDesc(int slot, SaveStateDescriptor &desc) {
Common::String filename = getFilenameForSlot(slot);
debugC(kWintermuteDebugSaveGame, "Trying to list savegame %s in slot %d", filename.c_str(), slot);
if (DID_FAIL(readHeader(filename))) {
warning("getSavedDesc(%d) - Failed for %s", slot, filename.c_str());
return;
}
desc.setSaveSlot(slot);
desc.setDescription(_savedDescription);
desc.setDeletableFlag(true);
desc.setWriteProtectedFlag(false);
if (_thumbnailDataSize > 0) {
Common::MemoryReadStream thumbStream(_thumbnailData, _thumbnailDataSize);
Graphics::BitmapDecoder bmpDecoder;
if (bmpDecoder.loadStream(thumbStream)) {
Graphics::Surface *surf = NULL;
surf = bmpDecoder.getSurface()->convertTo(g_system->getOverlayFormat());
TransparentSurface *scaleableSurface = new TransparentSurface(*surf, false);
Graphics::Surface *scaled = scaleableSurface->scale(kThumbnailWidth, kThumbnailHeight2);
desc.setThumbnail(scaled);
delete scaleableSurface;
delete surf;
}
}
desc.setSaveDate(_savedTimestamp.tm_year, _savedTimestamp.tm_mon, _savedTimestamp.tm_mday);
desc.setSaveTime(_savedTimestamp.tm_hour, _savedTimestamp.tm_min);
desc.setPlayTime(0);
}
示例3: getSaveStateDesc
void BasePersistenceManager::getSaveStateDesc(int slot, SaveStateDescriptor &desc) {
Common::String filename = getFilenameForSlot(slot);
debugC(kWintermuteDebugSaveGame, "Trying to list savegame %s in slot %d", filename.c_str(), slot);
if (DID_FAIL(readHeader(filename))) {
debugC(kWintermuteDebugSaveGame, "getSavedDesc(%d) - Failed for %s", slot, filename.c_str());
return;
}
desc.setSaveSlot(slot);
desc.setDescription(_savedDescription);
desc.setDeletableFlag(true);
desc.setWriteProtectedFlag(false);
int thumbSize = 0;
byte *thumbData = nullptr;
if (_scummVMThumbSize > 0) {
thumbSize = _scummVMThumbSize;
thumbData = _scummVMThumbnailData;
} else if (_thumbnailDataSize > 0) {
thumbSize = _thumbnailDataSize;
thumbData = _thumbnailData;
}
if (thumbSize > 0) {
Common::MemoryReadStream thumbStream(thumbData, thumbSize, DisposeAfterUse::NO);
Graphics::BitmapDecoder bmpDecoder;
if (bmpDecoder.loadStream(thumbStream)) {
const Graphics::Surface *bmpSurface = bmpDecoder.getSurface();
TransparentSurface *scaleableSurface = new TransparentSurface(*bmpSurface, false);
Graphics::Surface *scaled = scaleableSurface->scale(kThumbnailWidth, kThumbnailHeight2);
Graphics::Surface *thumb = scaled->convertTo(g_system->getOverlayFormat());
desc.setThumbnail(thumb);
delete scaleableSurface;
scaled->free();
delete scaled;
}
}
desc.setSaveDate(_savedTimestamp.tm_year, _savedTimestamp.tm_mon, _savedTimestamp.tm_mday);
desc.setSaveTime(_savedTimestamp.tm_hour, _savedTimestamp.tm_min);
desc.setPlayTime(0);
}
示例4: querySaveMetaInfos
SaveStateDescriptor FullpipeMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
Common::ScopedPtr<Common::InSaveFile> f(g_system->getSavefileManager()->openForLoading(
Fullpipe::getSavegameFile(slot)));
if (f) {
Fullpipe::FullpipeSavegameHeader header;
Fullpipe::readSavegameHeader(f.get(), header);
// Create the return descriptor
SaveStateDescriptor desc;
parseSavegameHeader(header, desc);
desc.setSaveSlot(slot);
desc.setThumbnail(header.thumbnail);
return desc;
}
return SaveStateDescriptor();
}