remove LoadFromNode, add PlayerState param

This commit is contained in:
Chris Danford
2008-03-27 10:11:07 +00:00
parent cf3aec361f
commit 025ef16269
3 changed files with 13 additions and 15 deletions
+10 -12
View File
@@ -12,6 +12,7 @@
#include "XmlFile.h"
#include "LuaBinding.h"
#include "GameManager.h"
#include "PlayerState.h"
REGISTER_ACTOR_CLASS( DifficultyDisplay );
@@ -42,7 +43,7 @@ DifficultyDisplay::DifficultyDisplay()
* so I'm trying it first in only this object.
*/
void DifficultyDisplay::Load( const RString &sMetricsGroup )
void DifficultyDisplay::Load( const RString &sMetricsGroup, const PlayerState *pPlayerState )
{
m_sMetricsGroup = sMetricsGroup;
@@ -106,19 +107,16 @@ void DifficultyDisplay::Load( const RString &sMetricsGroup )
this->AddChild( &m_sprStepsType );
}
// Play Load Command
PlayerState* pPlayerState_ = const_cast<PlayerState*>(pPlayerState);
Message msg("Load");
if( pPlayerState_ )
msg.SetParam( "PlayerState", LuaReference::CreateFromPush(*pPlayerState_) );
this->HandleMessage( msg );
Unset();
}
void DifficultyDisplay::LoadFromNode( const XNode* pNode )
{
ActorFrame::LoadFromNode( pNode );
RString s;
if( !pNode->GetAttrValue("Type", s) )
RageException::Throw( "%s: DifficultyDisplay: missing the \"Type\" attribute", ActorUtil::GetWhere(pNode).c_str() );
Load( s );
}
void DifficultyDisplay::SetFromGameState( PlayerNumber pn )
{
if( GAMESTATE->IsCourseMode() )
@@ -278,7 +276,7 @@ void DifficultyDisplay::SetInternal( const SetParams &params )
class LunaDifficultyDisplay: public Luna<DifficultyDisplay>
{
public:
static int Load( T* p, lua_State *L ) { p->Load( SArg(1) ); return 0; }
static int Load( T* p, lua_State *L ) { p->Load( SArg(1), NULL ); return 0; }
static int SetFromStepsTypeAndMeterAndDifficulty( T* p, lua_State *L ) { p->SetFromStepsTypeAndMeterAndDifficulty( Enum::Check<StepsType>(L, 1), IArg(2), Enum::Check<Difficulty>(L, 3) ); return 0; }
static int SetFromSteps( T* p, lua_State *L )
{
+2 -2
View File
@@ -15,14 +15,14 @@
class Steps;
class Trail;
class PlayerState;
class DifficultyDisplay : public ActorFrame
{
public:
DifficultyDisplay();
void Load( const RString &sMetricsGroup );
void LoadFromNode( const XNode* pNode );
void Load( const RString &sMetricsGroup, const PlayerState *pPlayerState );
virtual DifficultyDisplay *Copy() const;
+1 -1
View File
@@ -68,7 +68,7 @@ void DifficultyList::LoadFromNode( const XNode* pNode )
for( unsigned m = 0; m < m_Lines.size(); ++m )
{
m_Lines[m].m_Meter.SetName( "Row" );
m_Lines[m].m_Meter.Load( "DifficultyDisplayListRow" );
m_Lines[m].m_Meter.Load( "DifficultyDisplayListRow", NULL );
this->AddChild( &m_Lines[m].m_Meter );
}