simplify (same code path for LoadFromActorFile)

This commit is contained in:
Glenn Maynard
2005-10-11 00:50:25 +00:00
parent d87cfccfb9
commit 049af2408d
+5 -10
View File
@@ -235,8 +235,9 @@ all_done:
return pReturn; return pReturn;
} }
Actor* ActorUtil::MakeActor( const CString &sPath ) Actor* ActorUtil::MakeActor( const CString &sPath_ )
{ {
CString sPath( sPath_ );
FileType ft = GetFileType( sPath ); FileType ft = GetFileType( sPath );
switch( ft ) switch( ft )
{ {
@@ -246,21 +247,15 @@ Actor* ActorUtil::MakeActor( const CString &sPath )
if( sDir.Right(1) != "/" ) if( sDir.Right(1) != "/" )
sDir += '/'; sDir += '/';
CString sXml = sDir + "default.xml"; sPath = sDir + "default.xml";
if( !DoesFileExist(sXml) ) if( !DoesFileExist(sPath) )
{ {
BGAnimation *pBGA = new BGAnimation; BGAnimation *pBGA = new BGAnimation;
pBGA->LoadFromAniDir( sDir ); pBGA->LoadFromAniDir( sDir );
return pBGA; return pBGA;
} }
XNode xml; /* fall through */
if( !xml.LoadFromFile(sXml) )
{
// XNode will warn about the error
return new Actor;
}
return LoadFromActorFile( sDir, &xml );
} }
case FT_Xml: case FT_Xml:
{ {