本文整理汇总了C++中Savegame::GetLastErrorMsg方法的典型用法代码示例。如果您正苦于以下问题:C++ Savegame::GetLastErrorMsg方法的具体用法?C++ Savegame::GetLastErrorMsg怎么用?C++ Savegame::GetLastErrorMsg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Savegame
的用法示例。
在下文中一共展示了Savegame::GetLastErrorMsg方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RefreshTable
void iwSaveLoad::RefreshTable()
{
static bool loadedOnce = false;
GetCtrl<ctrlTable>(0)->DeleteAllItems();
std::vector<std::string> saveFiles = ListDir(GetFilePath(FILE_PATHS[85]), "sav");
for(std::vector<std::string>::iterator it = saveFiles.begin(); it != saveFiles.end(); ++it)
{
Savegame save;
// Datei öffnen
if(!save.Load(*it, false, false))
{
// Show errors only first time this is loaded
if(!loadedOnce)
{
LOG.write(_("Invalid Savegame %1%! Reason: %2%\n"))
% *it
% (save.GetLastErrorMsg().empty() ? _("Unknown") : save.GetLastErrorMsg());
}
continue;
}
// Zeitstring erstellen
std::string dateStr = TIME.FormatTime("%d.%m.%Y - %H:%i", &save.save_time);
// Dateiname noch rausextrahieren aus dem Pfad
bfs::path path = *it;
if(!path.has_filename())
continue;
bfs::path fileName = path.filename();
// ".sav" am Ende weg
RTTR_Assert(fileName.has_extension());
fileName.replace_extension();
std::string fileNameStr = cvWideStringToUTF8(fileName.wstring());
std::string startGF = helpers::toString(save.start_gf);
// Und das Zeug zur Tabelle hinzufügen
GetCtrl<ctrlTable>(0)->AddRow(0, fileNameStr.c_str(), save.mapName.c_str(), dateStr.c_str(), startGF.c_str(), it->c_str());
}
// Nach Zeit Sortieren
bool bFalse = false;
GetCtrl<ctrlTable>(0)->SortRows(2, &bFalse);
loadedOnce = true;
}
示例2: RefreshTable
void iwSaveLoad::RefreshTable()
{
static bool loadedOnce = false;
GetCtrl<ctrlTable>(0)->DeleteAllItems();
std::vector<std::string> saveFiles = ListDir(RTTRCONFIG.ExpandPath(FILE_PATHS[85]), "sav");
for(auto& saveFile : saveFiles)
{
Savegame save;
// Datei öffnen
if(!save.Load(saveFile, false, false))
{
// Show errors only first time this is loaded
if(!loadedOnce)
{
LOG.write(_("Invalid Savegame %1%! Reason: %2%\n")) % saveFile
% (save.GetLastErrorMsg().empty() ? _("Unknown") : save.GetLastErrorMsg());
}
continue;
}
// Zeitstring erstellen
std::string dateStr = s25util::Time::FormatTime("%d.%m.%Y - %H:%i", save.GetSaveTime());
// Dateiname noch rausextrahieren aus dem Pfad
bfs::path path = saveFile;
if(!path.has_filename())
continue;
// Just filename w/o extension
bfs::path fileName = path.stem();
std::string startGF = helpers::toString(save.start_gf);
// Und das Zeug zur Tabelle hinzufügen
GetCtrl<ctrlTable>(0)->AddRow(0, fileName.string().c_str(), save.GetMapName().c_str(), dateStr.c_str(), startGF.c_str(),
saveFile.c_str());
}
// Nach Zeit Sortieren
bool bFalse = false;
GetCtrl<ctrlTable>(0)->SortRows(2, &bFalse);
loadedOnce = true;
}