Better debugging messages so we can see which actor on which screen is missing the command.

This commit is contained in:
Steve Checkoway
2007-08-15 06:18:19 +00:00
parent 2f672bca45
commit e332565c9d
+9 -2
View File
@@ -6,6 +6,11 @@
#include "Actor.h" #include "Actor.h"
#include "RageTexture.h" #include "RageTexture.h"
namespace StepMania
{
RString GetTopScreenName();
}
class XNode; class XNode;
typedef Actor* (*CreateActorFn)(); typedef Actor* (*CreateActorFn)();
@@ -46,7 +51,8 @@ namespace ActorUtil
inline void PlayCommand( Actor& actor, const RString &sCommandName ) { actor.PlayCommand( sCommandName ); } inline void PlayCommand( Actor& actor, const RString &sCommandName ) { actor.PlayCommand( sCommandName ); }
inline void OnCommand( Actor& actor ) inline void OnCommand( Actor& actor )
{ {
ASSERT( actor.HasCommand("On") ); ASSERT_M( actor.HasCommand("On"), ssprintf("%s is missing an OnCommand. Top Screen is %s.",
actor.GetName().c_str(), StepMania::GetTopScreenName().c_str()) );
actor.PlayCommand("On"); actor.PlayCommand("On");
} }
inline void OffCommand( Actor& actor ) inline void OffCommand( Actor& actor )
@@ -57,7 +63,8 @@ namespace ActorUtil
// (Do "playcommand" anyway; BGAs often have no name.) // (Do "playcommand" anyway; BGAs often have no name.)
if( actor.GetName().empty() ) if( actor.GetName().empty() )
return; return;
ASSERT( actor.HasCommand("Off") ); ASSERT_M( actor.HasCommand("Off"), ssprintf("Actor %s is missing an OffCommand. Top Screen is %s.",
actor.GetName().c_str(), StepMania::GetTopScreenName().c_str()) );
actor.PlayCommand("Off"); actor.PlayCommand("Off");
} }