From 541f9b2068a2f39d56a16b634abcf7d70e5bdfe1 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 26 Aug 2005 21:48:53 +0000 Subject: [PATCH] don't make lots of GetDirListing calls --- stepmania/src/Character.cpp | 49 +++++++++++++++++-------------------- stepmania/src/Character.h | 7 ++++-- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/stepmania/src/Character.cpp b/stepmania/src/Character.cpp index 3327941f88..630128b495 100644 --- a/stepmania/src/Character.cpp +++ b/stepmania/src/Character.cpp @@ -20,6 +20,29 @@ bool Character::Load( CString sCharDir ) m_sCharacterID = as.back(); } + { + CStringArray as; + GetDirListing( m_sCharDir+"card.png", as, false, true ); + GetDirListing( m_sCharDir+"card.jpg", as, false, true ); + GetDirListing( m_sCharDir+"card.gif", as, false, true ); + GetDirListing( m_sCharDir+"card.bmp", as, false, true ); + if( as.empty() ) + m_sCardPath = ""; + else + m_sCardPath = as[0]; + } + + { + CStringArray as; + GetDirListing( m_sCharDir+"icon.png", as, false, true ); + GetDirListing( m_sCharDir+"icon.jpg", as, false, true ); + GetDirListing( m_sCharDir+"icon.gif", as, false, true ); + GetDirListing( m_sCharDir+"icon.bmp", as, false, true ); + if( as.empty() ) + m_sIconPath = ""; + else + m_sIconPath = as[0]; + } // Save attacks IniFile ini; @@ -126,32 +149,6 @@ CString Character::GetStageIconPath() const return as[0]; } -CString Character::GetCardPath() const -{ - CStringArray as; - GetDirListing( m_sCharDir+"card.png", as, false, true ); - GetDirListing( m_sCharDir+"card.jpg", as, false, true ); - GetDirListing( m_sCharDir+"card.gif", as, false, true ); - GetDirListing( m_sCharDir+"card.bmp", as, false, true ); - if( as.empty() ) - return ""; - else - return as[0]; -} - -CString Character::GetIconPath() const -{ - CStringArray as; - GetDirListing( m_sCharDir+"icon.png", as, false, true ); - GetDirListing( m_sCharDir+"icon.jpg", as, false, true ); - GetDirListing( m_sCharDir+"icon.gif", as, false, true ); - GetDirListing( m_sCharDir+"icon.bmp", as, false, true ); - if( as.empty() ) - return ""; - else - return as[0]; -} - bool Character::Has2DElems() { if( DoesFileExist(m_sCharDir + "2DFail/BGAnimation.ini") ) // check 2D Idle BGAnim exists diff --git a/stepmania/src/Character.h b/stepmania/src/Character.h index c69817f45f..2777ce27b8 100644 --- a/stepmania/src/Character.h +++ b/stepmania/src/Character.h @@ -18,8 +18,8 @@ public: bool Load( CString sCharDir ); // return true if success CString GetTakingABreakPath() const; - CString GetCardPath() const; - CString GetIconPath() const; + CString GetCardPath() const { return m_sCardPath; } + CString GetIconPath() const { return m_sIconPath; } CString GetModelPath() const; CString GetRestAnimationPath() const; @@ -49,6 +49,9 @@ public: CString m_sCharacterID; private: CString m_sDisplayName; + CString m_sCardPath; + CString m_sIconPath; + public: // All the stuff below will be filled in if this character is playable in Rave mode