forked from mirrors/0ad
huge cleanup and conversion of most string handling (especially paths) to unicode
please note: format strings must be %hs for char* arguments and %ls for wchar_t* This was SVN commit r7161.
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/FileIo.h"
|
||||
|
||||
#define LOG_CATEGORY "graphics"
|
||||
#define LOG_CATEGORY L"graphics"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// CSkeletonAnimManager constructor
|
||||
@@ -42,7 +42,7 @@ CSkeletonAnimManager::CSkeletonAnimManager(CColladaManager& colladaManager)
|
||||
// CSkeletonAnimManager destructor
|
||||
CSkeletonAnimManager::~CSkeletonAnimManager()
|
||||
{
|
||||
typedef std::map<CStr,CSkeletonAnimDef*>::iterator Iter;
|
||||
typedef std::map<VfsPath,CSkeletonAnimDef*>::iterator Iter;
|
||||
for (Iter i = m_Animations.begin(); i != m_Animations.end(); ++i)
|
||||
delete i->second;
|
||||
}
|
||||
@@ -50,17 +50,12 @@ CSkeletonAnimManager::~CSkeletonAnimManager()
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// GetAnimation: return a given animation by filename; return null if filename
|
||||
// doesn't refer to valid animation file
|
||||
CSkeletonAnimDef* CSkeletonAnimManager::GetAnimation(const CStr& filename)
|
||||
CSkeletonAnimDef* CSkeletonAnimManager::GetAnimation(const VfsPath& pathname)
|
||||
{
|
||||
// Strip a three-letter file extension (if there is one) from the filename
|
||||
CStr name;
|
||||
if (filename.length() > 4 && filename[filename.length()-4] == '.')
|
||||
name = filename.substr(0, filename.length()-4);
|
||||
else
|
||||
name = filename;
|
||||
VfsPath name = fs::change_extension(pathname, L"");
|
||||
|
||||
// Find if it's already been loaded
|
||||
std::map<CStr, CSkeletonAnimDef*>::iterator iter = m_Animations.find(name);
|
||||
std::map<VfsPath, CSkeletonAnimDef*>::iterator iter = m_Animations.find(name);
|
||||
if (iter != m_Animations.end())
|
||||
return iter->second;
|
||||
|
||||
@@ -71,7 +66,7 @@ CSkeletonAnimDef* CSkeletonAnimManager::GetAnimation(const CStr& filename)
|
||||
|
||||
if (psaFilename.empty())
|
||||
{
|
||||
LOG(CLogger::Error, LOG_CATEGORY, "Could not load animation '%s'", filename.c_str());
|
||||
LOG(CLogger::Error, LOG_CATEGORY, L"Could not load animation '%ls'", pathname.string().c_str());
|
||||
def = NULL;
|
||||
}
|
||||
else
|
||||
@@ -87,9 +82,9 @@ CSkeletonAnimDef* CSkeletonAnimManager::GetAnimation(const CStr& filename)
|
||||
}
|
||||
|
||||
if (def)
|
||||
LOG(CLogger::Normal, LOG_CATEGORY, "CSkeletonAnimManager::GetAnimation(%s): Loaded successfully", filename.c_str());
|
||||
LOG(CLogger::Normal, LOG_CATEGORY, L"CSkeletonAnimManager::GetAnimation(%ls): Loaded successfully", pathname.string().c_str());
|
||||
else
|
||||
LOG(CLogger::Error, LOG_CATEGORY, "CSkeletonAnimManager::GetAnimation(%s): Failed loading, marked file as bad", filename.c_str());
|
||||
LOG(CLogger::Error, LOG_CATEGORY, L"CSkeletonAnimManager::GetAnimation(%ls): Failed loading, marked file as bad", pathname.string().c_str());
|
||||
|
||||
// Add to map
|
||||
m_Animations[name] = def; // NULL if failed to load - we won't try loading it again
|
||||
|
||||
Reference in New Issue
Block a user