From 44bb7da19f1c147e88a3bee425091df971514934 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 6 Apr 2004 01:04:04 +0000 Subject: [PATCH] simplify --- stepmania/src/ActorUtil.cpp | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/stepmania/src/ActorUtil.cpp b/stepmania/src/ActorUtil.cpp index 0a98ca47bd..901022552f 100644 --- a/stepmania/src/ActorUtil.cpp +++ b/stepmania/src/ActorUtil.cpp @@ -146,25 +146,29 @@ Actor* LoadFromActorFile( CString sIniPath, CString sLayer ) pActor = pSprite; TEXTUREMAN->EnableOddDimensionWarning(); } - else if( IsAFile(sDir+sFile) || IsADirectory(sDir+sFile) ) + else { - // If we know this is an exact match, don't bother with the - // GetDirListing below. The GetDirListing is causing problems with - // partial matching BGAnimation directory names. - CString sNewPath = DerefRedir( sDir+sFile ); - pActor = MakeActor( sNewPath ); - } - else - { - CStringArray asPaths; - GetDirListing( sDir + sFile + "*", asPaths, false, true ); // return path too + /* XXX: We need to do a theme search, since the file we're loading might + * be overridden by the theme. */ + CString sNewPath = sDir+sFile; - if( asPaths.empty() ) - RageException::Throw( "The actor file '%s' references a file '%s' which doesn't exist.", sIniPath.c_str(), sFile.c_str() ); - else if( asPaths.size() > 1 ) - RageException::Throw( "The actor file '%s' references a file '%s' which has multiple matches.", sIniPath.c_str(), sFile.c_str() ); + // If we know this is an exact match, don't bother with the GetDirListing; + // it's causing problems with partial matching BGAnimation directory names. + if( !IsAFile(sNewPath) && !IsADirectory(sNewPath) ) + { + CStringArray asPaths; + GetDirListing( sNewPath + "*", asPaths, false, true ); // return path too + + if( asPaths.empty() ) + RageException::Throw( "The actor file '%s' references a file '%s' which doesn't exist.", sIniPath.c_str(), sFile.c_str() ); + else if( asPaths.size() > 1 ) + RageException::Throw( "The actor file '%s' references a file '%s' which has multiple matches.", sIniPath.c_str(), sFile.c_str() ); + + sNewPath = asPaths[0]; + } + + sNewPath = DerefRedir( sNewPath ); - CString sNewPath = DerefRedir( asPaths[0] ); pActor = MakeActor( sNewPath ); } }