Some loops here. Wanted to for_each some.

This commit is contained in:
Jason Felds
2013-05-01 21:22:39 -04:00
parent 7622c417ab
commit 828e52e012
+8 -10
View File
@@ -82,8 +82,7 @@ ActorFrame::ActorFrame( const ActorFrame &cpy ):
void ActorFrame::InitState() void ActorFrame::InitState()
{ {
FOREACH( Actor*, m_SubActors, a ) std::for_each(m_SubActors.begin(), m_SubActors.end(), [](Actor *a) { a->InitState(); });
(*a)->InitState();
Actor::InitState(); Actor::InitState();
} }
@@ -162,17 +161,16 @@ void ActorFrame::RemoveChild( Actor *pActor )
void ActorFrame::TransferChildren( ActorFrame *pTo ) void ActorFrame::TransferChildren( ActorFrame *pTo )
{ {
FOREACH( Actor*, m_SubActors, i ) std::for_each(m_SubActors.begin(), m_SubActors.end(), [&](Actor *a) { pTo->AddChild(a); });
pTo->AddChild( *i );
RemoveAllChildren(); RemoveAllChildren();
} }
Actor* ActorFrame::GetChild( const RString &sName ) Actor* ActorFrame::GetChild( const RString &sName )
{ {
FOREACH( Actor*, m_SubActors, a ) for (Actor *a : m_SubActors)
{ {
if( (*a)->GetName() == sName ) if( a->GetName() == sName )
return *a; return a;
} }
return NULL; return NULL;
} }
@@ -276,10 +274,10 @@ void ActorFrame::EndDraw()
void ActorFrame::PushChildrenTable( lua_State *L ) void ActorFrame::PushChildrenTable( lua_State *L )
{ {
lua_newtable( L ); lua_newtable( L );
FOREACH( Actor*, m_SubActors, a ) for (Actor *a: m_SubActors)
{ {
LuaHelpers::Push( L, (*a)->GetName() ); LuaHelpers::Push( L, a->GetName() );
(*a)->PushSelf( L ); a->PushSelf( L );
lua_rawset( L, -3 ); lua_rawset( L, -3 );
} }
} }