diff --git a/source/graphics/ObjectEntry.cpp b/source/graphics/ObjectEntry.cpp index af9272d8e5..b899c14566 100755 --- a/source/graphics/ObjectEntry.cpp +++ b/source/graphics/ObjectEntry.cpp @@ -52,7 +52,7 @@ bool CObjectEntry::BuildModel() try { modeldef=CModelDef::Load((const char*) modelfilename); } catch (...) { - LOG(ERROR, "CObjectEntry::BuildModel(): Model %s failed to load\n", modelfilename.c_str()); + LOG(ERROR, "CObjectEntry::BuildModel(): Model %s failed to load", modelfilename.c_str()); return false; } @@ -101,11 +101,11 @@ bool CObjectEntry::BuildModel() m_Model->AddProp(proppoint,propmodel); if (oe->m_WalkAnim) propmodel->SetAnimation(oe->m_WalkAnim); } else { - LOG(ERROR,"Failed to build prop model \"%s\" on actor \"%s\"\n",(const char*) m_Name,(const char*) prop.m_ModelName); + LOG(ERROR,"Failed to build prop model \"%s\" on actor \"%s\"",(const char*) m_Name,(const char*) prop.m_ModelName); } } } else { - LOG(ERROR,"Failed to matching prop point called \"%s\" in model \"%s\"\n", (const char*)prop.m_PropPointName, (const char*)modelfilename); + LOG(ERROR,"Failed to matching prop point called \"%s\" in model \"%s\"", (const char*)prop.m_PropPointName, (const char*)modelfilename); } } diff --git a/source/graphics/ObjectManager.cpp b/source/graphics/ObjectManager.cpp index 41e132bc91..5d8a89f871 100755 --- a/source/graphics/ObjectManager.cpp +++ b/source/graphics/ObjectManager.cpp @@ -124,15 +124,15 @@ void CObjectManager::LoadObjects(int type) CStr filename(pathname); filename+=dent.name; if (!object->Load((const char*) filename)) { - LOG(ERROR, "CObjectManager::LoadObjects(): %s: XML Load failed\n", filename.c_str()); + LOG(ERROR, "CObjectManager::LoadObjects(): %s: XML Load failed", filename.c_str()); delete object; } else { AddObject(object,type); - LOG(NORMAL, "CObjectManager::LoadObjects(): %s: XML Loaded\n", filename.c_str()); + LOG(NORMAL, "CObjectManager::LoadObjects(): %s: XML Loaded", filename.c_str()); } } vfs_close_dir(dir); } else - LOG(ERROR, "CObjectManager::LoadObjects(): Unable to open dir %s.\n", pathname.c_str()); + LOG(ERROR, "CObjectManager::LoadObjects(): Unable to open dir %s.", pathname.c_str()); } diff --git a/source/graphics/SkeletonAnimManager.cpp b/source/graphics/SkeletonAnimManager.cpp index bc4c46444d..87d710ce41 100755 --- a/source/graphics/SkeletonAnimManager.cpp +++ b/source/graphics/SkeletonAnimManager.cpp @@ -59,12 +59,12 @@ CSkeletonAnimDef* CSkeletonAnimManager::GetAnimation(const char* filename) } if (!def) { - LOG(ERROR, "CSkeletonAnimManager::GetAnimation(%s): Failed loading, marked file as bad\n", filename); + LOG(ERROR, "CSkeletonAnimManager::GetAnimation(%s): Failed loading, marked file as bad", filename); // add this file as bad m_BadAnimationFiles.insert(fname); return 0; } else { - LOG(NORMAL, "CSkeletonAnimManager::GetAnimation(%s): Loaded successfully\n", filename); + LOG(NORMAL, "CSkeletonAnimManager::GetAnimation(%s): Loaded successfully", filename); // add mapping for this file m_Animations[fname]=def; return def; diff --git a/source/graphics/TextureManager.cpp b/source/graphics/TextureManager.cpp index 1e4f242cda..2a1aee87fd 100755 --- a/source/graphics/TextureManager.cpp +++ b/source/graphics/TextureManager.cpp @@ -103,7 +103,7 @@ void CTextureManager::LoadTerrainTextures(int terraintype,const char* fileext) { while (vfs_next_dirent(dir, &dent, fileext) == 0) { - LOG(NORMAL, "CTextureManager::LoadTerrainTextures(): texture %s added to type %s\n", dent.name, m_TerrainTextures[terraintype].m_Name.c_str()); + LOG(NORMAL, "CTextureManager::LoadTerrainTextures(): texture %s added to type %s", dent.name, m_TerrainTextures[terraintype].m_Name.c_str()); AddTexture(dent.name, terraintype); } diff --git a/source/ps/XMLUtils.cpp b/source/ps/XMLUtils.cpp index 56aff218d8..863330a8db 100755 --- a/source/ps/XMLUtils.cpp +++ b/source/ps/XMLUtils.cpp @@ -56,14 +56,14 @@ int CVFSInputSource::OpenFile(const char *path) m_hFile=vfs_open(path); if (m_hFile <= 0) { - LOG(ERROR, "CVFSInputSource: file %s couldn't be opened (vfs_open: %lld)\n", path, m_hFile); + LOG(ERROR, "CVFSInputSource: file %s couldn't be opened (vfs_open: %lld)", path, m_hFile); return -1; } int err; if ((err=vfs_map(m_hFile, 0, m_pBuffer, m_BufferSize)) != 0) { - LOG(ERROR, "CVFSInputSource: file %s couldn't be opened (vfs_map: %d)\n", path, err); + LOG(ERROR, "CVFSInputSource: file %s couldn't be opened (vfs_map: %d)", path, err); vfs_close(m_hFile); m_hFile=0; return -1; diff --git a/source/ps/Xeromyces.cpp b/source/ps/Xeromyces.cpp index 4ba5dcce1b..42d1633e0f 100755 --- a/source/ps/Xeromyces.cpp +++ b/source/ps/Xeromyces.cpp @@ -1,4 +1,4 @@ -// $Id: Xeromyces.cpp,v 1.5 2004/07/11 11:51:10 philip Exp $ +// $Id: Xeromyces.cpp,v 1.6 2004/07/11 16:05:10 philip Exp $ #include "precompiled.h" @@ -190,7 +190,7 @@ void CXeromyces::Load(const char* filename) // Start the checksum with a particular seed value, so the XMBs will // be recreated whenever the version/etc string has been changed, so // the string can be changed whenever the file format's changed. - const char* ChecksumID = "version A"; + const char* ChecksumID = "version B"; unsigned long XMLChecksum = source.CRC32( crc32( crc32(0L, Z_NULL, 0), (Bytef*)ChecksumID, (int)strlen(ChecksumID) ) ); // Check whether the XMB file needs to be regenerated: @@ -251,6 +251,14 @@ void CXeromyces::Load(const char* filename) // Convert the data structures into the XMB format handler.CreateXMB(XMLChecksum); + // Only fail after having called CreateXMB, because CreateXMB frees all the memory + if (errorHandler.getSawErrors()) + { + LOG(ERROR, "CXeromyces: Errors in XML file '%s'", filename); + throw "Failed"; + } + + // Save the file to disk, so it can be loaded quickly next time vfs_store(filenameXMB, handler.buffer.buffer, handler.buffer.length, FILE_NO_AIO); @@ -264,7 +272,7 @@ bool CXeromyces::ReadXMBFile(const char* filename, bool CheckCRC, unsigned long Handle file = vfs_open(filename); if (file <= 0) { - LOG(ERROR, "CXeromyces: file '%s' couldn't be opened (vfs_open: %lld)\n", filename, file); + LOG(ERROR, "CXeromyces: file '%s' couldn't be opened (vfs_open: %lld)", filename, file); return false; } @@ -273,7 +281,7 @@ bool CXeromyces::ReadXMBFile(const char* filename, bool CheckCRC, unsigned long int err; if ( (err=vfs_map(file, 0, buffer, bufferSize)) ) { - LOG(ERROR, "CXeromyces: file '%s' couldn't be read (vfs_map: %d)\n", filename, err); + LOG(ERROR, "CXeromyces: file '%s' couldn't be read (vfs_map: %d)", filename, err); vfs_close(file); return false; } diff --git a/source/renderer/Renderer.cpp b/source/renderer/Renderer.cpp index d302770f7e..8f21dee975 100755 --- a/source/renderer/Renderer.cpp +++ b/source/renderer/Renderer.cpp @@ -907,7 +907,7 @@ void CRenderer::EndFrame() static bool once=false; if (!once && glGetError()) { - LOG(ERROR,"CRenderer::EndFrame: GL errors occurred\n"); + LOG(ERROR,"CRenderer::EndFrame: GL errors occurred"); once=true; } } diff --git a/source/simulation/BaseEntityCollection.cpp b/source/simulation/BaseEntityCollection.cpp index edfcbeadd8..2fedc52be6 100755 --- a/source/simulation/BaseEntityCollection.cpp +++ b/source/simulation/BaseEntityCollection.cpp @@ -32,7 +32,7 @@ void CBaseEntityCollection::loadTemplates() } else { - LOG(ERROR, "CBaseEntityCollection::loadTemplates(): Failed to enumerate entity template directory\n"); + LOG(ERROR, "CBaseEntityCollection::loadTemplates(): Failed to enumerate entity template directory"); return; } }