return a pointer from Actor::GetCommand, so the command not existing
isn't fatal
This commit is contained in:
@@ -1240,11 +1240,12 @@ bool Actor::HasCommand( const RString &sCmdName )
|
||||
return it != m_mapNameToCommands.end();
|
||||
}
|
||||
|
||||
const apActorCommands& Actor::GetCommand( const RString &sCommandName ) const
|
||||
const apActorCommands *Actor::GetCommand( const RString &sCommandName ) const
|
||||
{
|
||||
map<RString, apActorCommands>::const_iterator it = m_mapNameToCommands.find( sCommandName );
|
||||
ASSERT( it != m_mapNameToCommands.end() );
|
||||
return it->second;
|
||||
if( it == m_mapNameToCommands.end() )
|
||||
return NULL;
|
||||
return &it->second;
|
||||
}
|
||||
|
||||
void Actor::PlayCommand( const RString &sCommandName, Actor *pParent )
|
||||
|
||||
@@ -332,7 +332,7 @@ public:
|
||||
//
|
||||
void AddCommand( const RString &sCmdName, apActorCommands apac );
|
||||
bool HasCommand( const RString &sCmdName );
|
||||
const apActorCommands& GetCommand( const RString &sCommandName ) const;
|
||||
const apActorCommands *GetCommand( const RString &sCommandName ) const;
|
||||
virtual void PlayCommand( const RString &sCommandName, Actor *pParent = NULL );
|
||||
virtual void RunCommands( const LuaReference& cmds, Actor *pParent = NULL );
|
||||
void RunCommands( const apActorCommands& cmds, Actor *pParent = NULL ) { this->RunCommands( *cmds, pParent ); } // convenience
|
||||
|
||||
Reference in New Issue
Block a user