add HasCommand

This commit is contained in:
Chris Danford
2005-03-13 20:34:52 +00:00
parent 25642721bb
commit ca8106297e
2 changed files with 8 additions and 2 deletions
+7 -2
View File
@@ -1058,6 +1058,12 @@ void Actor::AddCommand( const CString &sCmdName, apActorCommands apac )
} }
} }
bool Actor::HasCommand( const CString &sCmdName )
{
map<CString, apActorCommands>::const_iterator it = m_mapNameToCommands.find( sCmdName );
return it != m_mapNameToCommands.end();
}
void Actor::PlayCommand( const CString &sCommandName ) void Actor::PlayCommand( const CString &sCommandName )
{ {
PlayCommand2( sCommandName, NULL ); PlayCommand2( sCommandName, NULL );
@@ -1065,8 +1071,7 @@ void Actor::PlayCommand( const CString &sCommandName )
void Actor::PlayCommand2( const CString &sCommandName, Actor *pParent ) void Actor::PlayCommand2( const CString &sCommandName, Actor *pParent )
{ {
CString sKey = sCommandName; map<CString, apActorCommands>::const_iterator it = m_mapNameToCommands.find( sCommandName );
map<CString, apActorCommands>::const_iterator it = m_mapNameToCommands.find( sKey );
if( it == m_mapNameToCommands.end() ) if( it == m_mapNameToCommands.end() )
return; return;
+1
View File
@@ -318,6 +318,7 @@ public:
// //
virtual void PushSelf( lua_State *L ); virtual void PushSelf( lua_State *L );
void AddCommand( const CString &sCmdName, apActorCommands apac ); void AddCommand( const CString &sCmdName, apActorCommands apac );
bool HasCommand( const CString &sCmdName );
virtual void PlayCommand( const CString &sCommandName ); virtual void PlayCommand( const CString &sCommandName );
virtual void PlayCommand2( const CString &sCommandName, Actor *pParent ); virtual void PlayCommand2( const CString &sCommandName, Actor *pParent );
virtual void RunCommands( const LuaReference& cmds ); virtual void RunCommands( const LuaReference& cmds );