From 9872638a7d5e741388eed728783ad572593caf36 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 17 Aug 2006 06:42:32 +0000 Subject: [PATCH] nodes --- stepmania/src/Actor.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index 3b1a6965e4..191f9ac8e4 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -220,6 +220,28 @@ void Actor::LoadFromNode( const RString& sDir, const XNode* pNode ) lua_pop( L, 1 ); LUA->Release( L ); } + + if( pChild->m_sName == "Context" ) + { + RString sName; + if( !pChild->GetAttrValue( "Name", sName ) ) + Dialog::OK( ssprintf("Context node in '%s' is missing the attribute \"Name\"", sDir.c_str()), "MISSING_ATTRIBUTE" ); + + LuaHelpers::RunAtExpressionS( sName ); + + RString s; + if( !pChild->GetAttrValue( "Value", s ) ) + Dialog::OK( ssprintf("Context node in '%s' is missing the attribute \"Value\"", sDir.c_str()), "MISSING_ATTRIBUTE" ); + Lua *L = LUA->Get(); + + this->PushContext(L); + lua_pushstring(L, sName ); + LuaHelpers::RunScript( L, "return " + s, "", 1 ); + lua_settable( L, -3 ); + lua_pop( L, 1 ); + + LUA->Release(L); + } } FOREACH_CONST_Attr( pNode, pAttr )