Messages and commands are nearly identical: they both have a name,
they can both have parameters stashed in a table, and they both play stuff out of the actor command list. Merge them; now the only difference between playing and broadcasting a command is that playing plays recursively on a tree and broadcasting sends to all subscribers. The distinction between "messages" and "commands" is cosmetic now; everything is a message. The only thing special about commands intended to be received as a broadcast is the "Message" suffix, which subscribes it.
This commit is contained in:
@@ -352,19 +352,19 @@ void ActorFrame::SetPropagateCommands( bool b )
|
||||
m_bPropagateCommands = b;
|
||||
}
|
||||
|
||||
void ActorFrame::PlayCommand( const RString &sCommandName, const LuaReference *pParamTable )
|
||||
void ActorFrame::HandleMessage( const Message &msg )
|
||||
{
|
||||
Actor::PlayCommand( sCommandName, pParamTable );
|
||||
Actor::HandleMessage( msg );
|
||||
|
||||
// HACK: Don't propogate Init. It gets called once for every Actor when the
|
||||
// Actor is loaded, and we don't want to call it again.
|
||||
if( sCommandName == "Init" )
|
||||
if( msg.GetName() == "Init" )
|
||||
return;
|
||||
|
||||
for( unsigned i=0; i<m_SubActors.size(); i++ )
|
||||
{
|
||||
Actor* pActor = m_SubActors[i];
|
||||
pActor->PlayCommand( sCommandName, pParamTable );
|
||||
pActor->HandleMessage( msg );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user