1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

#994 should not crash anymore.

This commit is contained in:
Michał W. Urbańczyk
2012-06-09 19:58:17 +00:00
parent cdb55500f3
commit e6ebf42308
4 changed files with 49 additions and 23 deletions

View File

@@ -2250,19 +2250,26 @@ void CGameHandler::save( const std::string &fname )
sendToAllClients(&sg);
}
try
{
tlog0 << "Serializing game info...\n";
CSaveFile save(GVCMIDirs.UserPath + "/Games/" + fname + ".vlgm1");
char hlp[8] = "VCMISVG";
save << hlp << static_cast<CMapHeader&>(*gs->map) << gs->scenarioOps << *VLC << gs;
}
{
tlog0 << "Serializing game info...\n";
CSaveFile save(GVCMIDirs.UserPath + "/Games/" + fname + ".vlgm1");
char hlp[8] = "VCMISVG";
save << hlp << static_cast<CMapHeader&>(*gs->map) << gs->scenarioOps << *VLC << gs;
}
{
tlog0 << "Serializing server info...\n";
CSaveFile save(GVCMIDirs.UserPath + "/Games/" + fname + ".vsgm1");
save << *this;
{
tlog0 << "Serializing server info...\n";
CSaveFile save(GVCMIDirs.UserPath + "/Games/" + fname + ".vsgm1");
save << *this;
}
tlog0 << "Game has been successfully saved!\n";
}
catch(std::exception &e)
{
tlog1 << "Failed to save game: " << e.what() << std::endl;
}
tlog0 << "Game has been successfully saved!\n";
}
void CGameHandler::close()