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

Method OnListModified

trinity/Eve/SpaceObject/Children/EveChildContainer.cpp:111–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111void EveChildContainer::OnListModified( long event, ssize_t key, ssize_t key2, IRoot* value, const IList* list )
112{
113 if( list == &m_controllers && ( event & BELIST_LOADING ) == 0 )
114 {
115 switch( event & BELIST_EVENTMASK )
116 {
117 case BELIST_INSERTED:
118 if( ITr2ControllerPtr controller = BlueCastPtr( value ) )
119 {
120 controller->Link( *GetRawRoot() );
121 for( auto it = begin( m_controllerVariables ); it != end( m_controllerVariables ); ++it )
122 {
123 controller->SetVariable( it->first.c_str(), it->second );
124 }
125 }
126 break;
127 case BELIST_REMOVED:
128 if( ITr2ControllerPtr controller = BlueCastPtr( value ) )
129 {
130 controller->Unlink();
131 }
132 break;
133 case BELIST_UNLOADSTART:
134 for( auto& controller : m_controllers )
135 {
136 controller->Unlink();
137 }
138 break;
139 default:
140 break;
141 }
142 }
143 else if( list == &m_objects && ( event & BELIST_LOADING ) == 0 )
144 {
145 if( IsInRegistry() )
146 {
147 switch( event & BELIST_EVENTMASK )
148 {
149 case BELIST_INSERTED:
150 if( EveEntityPtr entity = BlueCastPtr( value ) )
151 {
152 entity->Register( GetComponentRegistry() );
153 }
154 break;
155 case BELIST_REMOVED:
156 if( EveEntityPtr entity = BlueCastPtr( value ) )
157 {
158 entity->UnRegister( GetComponentRegistry() );
159 }
160 break;
161 case BELIST_UNLOADSTART:
162 for( ssize_t i = 0; i < list->GetSize(); ++i )
163 {
164 if( EveEntityPtr entity = BlueCastPtr( list->GetAt( i ) ) )
165 {
166 entity->UnRegister( GetComponentRegistry() );
167 }
168 }

Callers

nothing calls this directly

Calls 13

GetPropertiesMethod · 0.80
emptyMethod · 0.80
GetComponentRegistryMethod · 0.80
sizeMethod · 0.80
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