MCPcopy Create free account
hub / github.com/EasyRPG/Player / PopulateSaveWindow

Method PopulateSaveWindow

src/scene_file.cpp:91–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91void Scene_File::PopulateSaveWindow(Window_SaveFile& win, int id) {
92 // Try to access file
93 std::stringstream ss;
94 ss << "Save" << (id <= 8 ? "0" : "") << (id + 1) << ".lsd";
95
96 std::string file = fs.FindFile(ss.str());
97
98 if (!file.empty()) {
99 // File found
100 auto save_stream = FileFinder::Save().OpenInputStream(file);
101 if (!save_stream) {
102 Output::Debug("Save {} read error", file);
103 win.SetCorrupted(true);
104 return;
105 }
106
107 std::unique_ptr<lcf::rpg::Save> savegame = lcf::LSD_Reader::Load(save_stream, Player::encoding);
108
109 if (savegame) {
110 PopulatePartyFaces(win, id, *savegame);
111 UpdateLatestTimestamp(id, *savegame);
112 } else {
113 Output::Debug("Save {} corrupted", file);
114 win.SetCorrupted(true);
115 }
116 }
117}
118
119void Scene_File::Start() {
120 CreateHelpWindow();

Callers

nothing calls this directly

Calls 4

OpenInputStreamMethod · 0.80
SetCorruptedMethod · 0.80
FindFileMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected