1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Replaced CFileInfo with more correct and efficient alternative

This commit is contained in:
Zyx-2000
2016-01-26 14:51:38 +01:00
parent c385c8757b
commit 70e3c81b9f
17 changed files with 65 additions and 80 deletions

View File

@@ -1,7 +1,7 @@
#include "StdInc.h"
#include "../lib/filesystem/Filesystem.h"
#include "../lib/filesystem/CFileInfo.h"
#include "../lib/filesystem/FileInfo.h"
#include "../lib/int3.h"
#include "../lib/mapping/CCampaignHandler.h"
#include "../lib/StartInfo.h"
@@ -2362,13 +2362,13 @@ void CGameHandler::sendAndApply( NewStructures * info )
void CGameHandler::save(const std::string & filename )
{
logGlobal->infoStream() << "Saving to " << filename;
CFileInfo info(filename);
//CResourceHandler::get("local")->createResource(info.getStem() + ".vlgm1");
CResourceHandler::get("local")->createResource(info.getStem() + ".vsgm1");
const auto stem = FileInfo::GetPathStem(filename);
const auto savefname = stem.to_string() + ".vsgm1";
CResourceHandler::get("local")->createResource(savefname);
{
logGlobal->infoStream() << "Ordering clients to serialize...";
SaveGame sg(info.getStem() + ".vcgm1");
SaveGame sg(savefname);
sendToAllClients(&sg);
}
@@ -2383,7 +2383,7 @@ void CGameHandler::save(const std::string & filename )
// }
{
CSaveFile save(*CResourceHandler::get("local")->getResourceName(ResourceID(info.getStem(), EResType::SERVER_SAVEGAME)));
CSaveFile save(*CResourceHandler::get("local")->getResourceName(ResourceID(stem.to_string(), EResType::SERVER_SAVEGAME)));
saveCommonState(save);
logGlobal->infoStream() << "Saving server state";
save << *this;