Display error messages instead of breaking into the debugger when we don't have rights to save a map in Atlas. Fixes #1941.

This was SVN commit r13818.
This commit is contained in:
leper
2013-09-09 23:31:22 +00:00
parent b2862f14da
commit 04ed87bf28
6 changed files with 36 additions and 13 deletions
+14 -5
View File
@@ -30,6 +30,7 @@
#include "maths/MathUtil.h"
#include "maths/NUSpline.h"
#include "ps/CLogger.h"
#include "ps/Loader.h"
#include "ps/Filesystem.h"
#include "ps/XML/XMLWriter.h"
@@ -63,8 +64,16 @@ void CMapWriter::SaveMap(const VfsPath& pathname, CTerrain* pTerrain,
// build necessary data
PackMap(packer, pTerrain);
// write it out
packer.Write(pathname);
try
{
// write it out
packer.Write(pathname);
}
catch (PSERROR_File_WriteFailed&)
{
LOGERROR(L"Failed to write map '%ls'", pathname.string().c_str());
return;
}
VfsPath pathnameXML = pathname.ChangeExtension(L".xml");
WriteXML(pathnameXML, pWaterMan, pSkyMan, pLightEnv, pCamera, pCinema, pPostproc, pSimulation2);
@@ -170,7 +179,7 @@ void CMapWriter::PackTerrain(CFilePacker& packer, CTerrain* pTerrain)
packer.PackString(terrainTextures[i]);
// pack tile data
packer.PackRaw(&tiles[0],sizeof(STileDesc)*tiles.size());
packer.PackRaw(&tiles[0],sizeof(STileDesc)*tiles.size());
}
void CMapWriter::WriteXML(const VfsPath& filename,
@@ -444,8 +453,8 @@ void CMapWriter::WriteXML(const VfsPath& filename,
}
}
}
if (! XML_StoreVFS(g_VFS, filename))
DEBUG_WARN_ERR(ERR::LOGIC); // failed to write map XML file
if (!XML_StoreVFS(g_VFS, filename))
LOGERROR(L"Failed to write map '%ls'", filename.string().c_str());
}
/*