MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / save

Method save

Source/GameData.cpp:237–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235}
236
237void sGameRecorded::save() {
238 std::lock_guard<std::mutex> lock(mLockMtx);
239
240 if (g_Fodder->mParams->mDemoRecord) {
241 std::string Filename = g_Fodder->mParams->mDemoFile;
242 if (Filename == "-") {
243 Filename = std::to_string(g_Fodder->mGame_Data.mMission_Number);
244 Filename += "-";
245 Filename += std::to_string(g_Fodder->mGame_Data.mMission_Phase);
246 }
247
248 if (Filename.find(".") == Filename.npos)
249 Filename += DEMO_EXTENSION;
250
251 g_Debugger->Notice("Writing demo to " + Filename);
252 std::ofstream outfile(Filename, std::ofstream::binary);
253 outfile << ToJson();
254 outfile.close();
255 }
256}
257
258std::string sGameRecorded::ToJson() {
259 auto now = std::chrono::system_clock::now();

Callers 6

CreateRandomMethod · 0.45
StartMethod · 0.45
Mission_LoopMethod · 0.45
RunTestsMethod · 0.45
mapSaveMethod · 0.45
startFunction · 0.45

Calls 3

findMethod · 0.80
NoticeMethod · 0.80
closeMethod · 0.80

Tested by 1

RunTestsMethod · 0.36