From e16b72f5ed767c2727741f046cf7926f357ad4f1 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 17 Feb 2005 05:12:23 +0000 Subject: [PATCH] Actor::RunCommands, etc. can take any LuaReference, not just ActorCommands --- stepmania/src/Actor.cpp | 5 +++-- stepmania/src/Actor.h | 5 +++-- stepmania/src/ActorFrame.cpp | 4 ++-- stepmania/src/ActorFrame.h | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index c7bb86aacb..4ab6b6d0ba 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -13,6 +13,7 @@ #include "Command.h" #include "ActorCommands.h" #include "ThemeManager.h" +#include "LuaReference.h" // lua start @@ -692,7 +693,7 @@ void Actor::AddRotationR( float rot ) RageQuatMultiply( &DestTweenState().quat, DestTweenState().quat, RageQuatFromR(rot) ); } -void Actor::RunCommands( const ActorCommands& cmds ) +void Actor::RunCommands( const LuaReference& cmds ) { cmds.PushSelf( LUA->L ); ASSERT( !lua_isnil(LUA->L, -1) ); @@ -843,7 +844,7 @@ void Actor::HandleCommand( const Command &command ) } */ -float Actor::GetCommandsLengthSeconds( const ActorCommands& cmds ) +float Actor::GetCommandsLengthSeconds( const LuaReference& cmds ) { Actor temp; temp.RunCommands(cmds); diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index 87583e284a..336c0f06b2 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -9,6 +9,7 @@ #include struct XNode; struct lua_State; +class LuaReference; #include "LuaBinding.h" @@ -310,10 +311,10 @@ public: virtual void PushSelf( lua_State *L ); void AddCommand( const CString &sCmdName, apActorCommands apac ); virtual void PlayCommand( const CString &sCommandName ); - virtual void RunCommands( const ActorCommands& cmds ); + virtual void RunCommands( const LuaReference& cmds ); void RunCommands( const apActorCommands& cmds ) { this->RunCommands( *cmds ); } // convenience - static float GetCommandsLengthSeconds( const ActorCommands& cmds ); + static float GetCommandsLengthSeconds( const LuaReference& cmds ); static float GetCommandsLengthSeconds( const apActorCommands& cmds ) { return GetCommandsLengthSeconds( *cmds ); } // convenience // diff --git a/stepmania/src/ActorFrame.cpp b/stepmania/src/ActorFrame.cpp index f894fa3045..89b31f125d 100644 --- a/stepmania/src/ActorFrame.cpp +++ b/stepmania/src/ActorFrame.cpp @@ -101,7 +101,7 @@ void ActorFrame::DrawPrimitives() m_SubActors[i]->Draw(); } -void ActorFrame::RunCommandsOnChildren( const ActorCommands& cmds ) +void ActorFrame::RunCommandsOnChildren( const LuaReference& cmds ) { for( unsigned i=0; iRunCommands( cmds ); @@ -185,7 +185,7 @@ void ActorFrame::DeleteAllChildren() m_SubActors.clear(); } -void ActorFrame::RunCommands( const ActorCommands& cmds ) +void ActorFrame::RunCommands( const LuaReference& cmds ) { if( m_bPropagateCommands ) RunCommandsOnChildren( cmds ); diff --git a/stepmania/src/ActorFrame.h b/stepmania/src/ActorFrame.h index 5d38db8ec8..e62e197886 100644 --- a/stepmania/src/ActorFrame.h +++ b/stepmania/src/ActorFrame.h @@ -41,7 +41,7 @@ public: // Commands // void PushSelf( lua_State *L ); - void RunCommandsOnChildren( const ActorCommands& cmds ); /* but not on self */ + void RunCommandsOnChildren( const LuaReference& cmds ); /* but not on self */ void RunCommandsOnChildren( const apActorCommands& cmds ) { RunCommandsOnChildren( *cmds ); } // convenience virtual void Update( float fDeltaTime ); @@ -63,7 +63,7 @@ public: virtual void GainFocus( float fRate, bool bRewindMovie, bool bLoop ); virtual void LoseFocus(); virtual void PlayCommand( const CString &sCommandName ); - virtual void RunCommands( const ActorCommands& cmds ); + virtual void RunCommands( const LuaReference& cmds ); void RunCommands( const apActorCommands& cmds ) { ActorFrame::RunCommands( *cmds ); } // convenience protected: