MCPcopy Create free account
hub / github.com/carbonengine/trinity / OnListModified

Method OnListModified

trinity/Eve/SpaceObject/Children/EveChildPlug.cpp:42–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42void EveChildPlug::OnListModified( long event, ssize_t key, ssize_t key2, IRoot* value, const IList* list )
43{
44 if( list == &m_controllers && ( event & BELIST_LOADING ) == 0 )
45 {
46 switch( event & BELIST_EVENTMASK )
47 {
48 case BELIST_INSERTED:
49 if( ITr2ControllerPtr controller = BlueCastPtr( value ) )
50 {
51 controller->Link( *GetRawRoot() );
52 for( auto it = begin( m_controllerVariables ); it != end( m_controllerVariables ); ++it )
53 {
54 controller->SetVariable( it->first.c_str(), it->second );
55 }
56 }
57 break;
58 case BELIST_REMOVED:
59 if( ITr2ControllerPtr controller = BlueCastPtr( value ) )
60 {
61 controller->Unlink();
62 }
63 break;
64 case BELIST_UNLOADSTART:
65 for( auto& controller : m_controllers )
66 {
67 controller->Unlink();
68 }
69 break;
70 default:
71 break;
72 }
73 }
74 else if( list == &m_objects && ( event & BELIST_LOADING ) == 0 )
75 {
76 if( IsInRegistry() )
77 {
78 switch( event & BELIST_EVENTMASK )
79 {
80 case BELIST_INSERTED:
81 if( EveEntityPtr entity = BlueCastPtr( value ) )
82 {
83 entity->Register( GetComponentRegistry() );
84 }
85 break;
86 case BELIST_REMOVED:
87 if( EveEntityPtr entity = BlueCastPtr( value ) )
88 {
89 entity->UnRegister( GetComponentRegistry() );
90 }
91 break;
92 case BELIST_UNLOADSTART:
93 for( ssize_t i = 0; i < list->GetSize(); ++i )
94 {
95 if( EveEntityPtr entity = BlueCastPtr( list->GetAt( i ) ) )
96 {
97 entity->UnRegister( GetComponentRegistry() );
98 }
99 }

Callers

nothing calls this directly

Calls 8

beginFunction · 0.50
endFunction · 0.50
LinkMethod · 0.45
SetVariableMethod · 0.45
UnlinkMethod · 0.45
RegisterMethod · 0.45
UnRegisterMethod · 0.45
GetSizeMethod · 0.45

Tested by

no test coverage detected