本文整理汇总了C++中Holder::GetSaveID方法的典型用法代码示例。如果您正苦于以下问题:C++ Holder::GetSaveID方法的具体用法?C++ Holder::GetSaveID怎么用?C++ Holder::GetSaveID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Holder
的用法示例。
在下文中一共展示了Holder::GetSaveID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateSaveGame
int SaveGameIterator::CreateSaveGame(Holder<SaveGame> save, const char *slotname)
{
if (!slotname) {
return -1;
}
if (int cansave = CanSave())
return cansave;
GameControl *gc = core->GetGameControl();
int index;
if (save) {
index = save->GetSaveID();
DeleteSaveGame(save);
save.release();
} else {
//leave space for autosaves
//probably the hardcoded slot names should be read by this object
//in that case 7 == size of hardcoded slot names array (savegame.2da)
index = 7;
for (size_t i = 0; i < save_slots.size(); ++i) {
Holder<SaveGame> save = save_slots[i];
if (save->GetSaveID() >= index) {
index = save->GetSaveID() + 1;
}
}
}
char Path[_MAX_PATH];
if (!CreateSavePath(Path, index, slotname)) {
displaymsg->DisplayConstantString(STR_CANTSAVE, DMC_BG2XPGREEN);
if (gc) {
gc->SetDisplayText(STR_CANTSAVE, 30);
}
return -1;
}
if (!DoSaveGame(Path)) {
displaymsg->DisplayConstantString(STR_CANTSAVE, DMC_BG2XPGREEN);
if (gc) {
gc->SetDisplayText(STR_CANTSAVE, 30);
}
return -1;
}
// Save succesful
displaymsg->DisplayConstantString(STR_SAVESUCCEED, DMC_BG2XPGREEN);
if (gc) {
gc->SetDisplayText(STR_SAVESUCCEED, 30);
}
return 0;
}
示例2: CreateSaveGame
int SaveGameIterator::CreateSaveGame(int index, bool mqs)
{
AutoTable tab("savegame");
const char *slotname = NULL;
if (tab) {
slotname = tab->QueryField(index);
}
if (mqs) {
assert(index==1);
PruneQuickSave(slotname);
}
//if index is not an existing savegame, we create a unique slotname
for (size_t i = 0; i < save_slots.size(); ++i) {
Holder<SaveGame> save = save_slots[i];
if (save->GetSaveID() == index) {
DeleteSaveGame(save);
break;
}
}
char Path[_MAX_PATH];
CreateSavePath(Path, index, slotname);
if (!DoSaveGame(Path)) {
return -1;
}
// Save succesful / Quick-save succesful
if (index == 1) {
displaymsg->DisplayConstantString(STR_QSAVESUCCEED, 0xbcefbc);
if (core->GetGameControl()) {
core->GetGameControl()->SetDisplayText(STR_QSAVESUCCEED, 30);
}
} else {
displaymsg->DisplayConstantString(STR_SAVESUCCEED, 0xbcefbc);
if (core->GetGameControl()) {
core->GetGameControl()->SetDisplayText(STR_SAVESUCCEED, 30);
}
}
return 0;
}