From ca8106297e2fa3f3171e63a83c4eeb95eaa33623 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 13 Mar 2005 20:34:52 +0000 Subject: [PATCH] add HasCommand --- stepmania/src/Actor.cpp | 9 +++++++-- stepmania/src/Actor.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index 4b6a0922fd..e4710a11da 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -1058,6 +1058,12 @@ void Actor::AddCommand( const CString &sCmdName, apActorCommands apac ) } } +bool Actor::HasCommand( const CString &sCmdName ) +{ + map::const_iterator it = m_mapNameToCommands.find( sCmdName ); + return it != m_mapNameToCommands.end(); +} + void Actor::PlayCommand( const CString &sCommandName ) { PlayCommand2( sCommandName, NULL ); @@ -1065,8 +1071,7 @@ void Actor::PlayCommand( const CString &sCommandName ) void Actor::PlayCommand2( const CString &sCommandName, Actor *pParent ) { - CString sKey = sCommandName; - map::const_iterator it = m_mapNameToCommands.find( sKey ); + map::const_iterator it = m_mapNameToCommands.find( sCommandName ); if( it == m_mapNameToCommands.end() ) return; diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index ea83950307..589658b78f 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -318,6 +318,7 @@ public: // virtual void PushSelf( lua_State *L ); void AddCommand( const CString &sCmdName, apActorCommands apac ); + bool HasCommand( const CString &sCmdName ); virtual void PlayCommand( const CString &sCommandName ); virtual void PlayCommand2( const CString &sCommandName, Actor *pParent ); virtual void RunCommands( const LuaReference& cmds );