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

Method OnListModified

trinity/Interior/Tr2InteriorScene.cpp:229–285  ·  view source on GitHub ↗

---------------------------------------------------------------

Source from the content-addressed store, hash-verified

227
228// ---------------------------------------------------------------
229void Tr2InteriorScene::OnListModified( long event, ssize_t key, ssize_t key2, IRoot* currvalue, const IList* theList )
230{
231 if( theList == &m_lights )
232 {
233 SetupShadowMaps();
234 }
235
236 else if( theList == &m_dynamics )
237 {
238 if( ( event & BELIST_LOADING ) == 0 )
239 {
240 // Respond to an item removal event
241 if( ( event & BELIST_EVENTMASK ) == BELIST_REMOVED )
242 {
243 if( currvalue )
244 {
245 // See if the removed item is a dynamic
246 ITr2InteriorDynamic* dynamic = NULL;
247 if( currvalue->QueryInterface( BlueInterfaceIID<ITr2InteriorDynamic>(), (void**)&dynamic ) )
248 {
249 // Remove from the scene
250 dynamic->RemoveFromScene();
251
252 // See if the dynamic is in the pending-load list
253 ssize_t pos = m_dynamicsPendingLoad.FindKey( dynamic );
254 if( pos != -1 )
255 {
256 m_dynamicsPendingLoad.Remove( pos );
257 }
258
259 // Need to unlock, since QueryInterface Locks
260 dynamic->Unlock();
261 }
262 }
263 }
264 // Respond to an item insertion event
265 else if( ( event & BELIST_EVENTMASK ) == BELIST_INSERTED )
266 {
267 if( currvalue )
268 {
269 // See if the inserted item is a dynamic
270 ITr2InteriorDynamic* dynamic = NULL;
271 if( currvalue->QueryInterface( BlueInterfaceIID<ITr2InteriorDynamic>(), (void**)&dynamic ) )
272 {
273 if( !dynamic->AddToScene( m_apexScene ) && ( m_dynamicsPendingLoad.FindKey( dynamic ) == -1 ) )
274 {
275 m_dynamicsPendingLoad.Insert( -1, dynamic );
276 }
277
278 // Need to unlock, since QueryInterface Locks
279 dynamic->Unlock();
280 }
281 }
282 }
283 }
284 }
285}
286

Callers

nothing calls this directly

Calls 4

QueryInterfaceMethod · 0.80
RemoveFromSceneMethod · 0.45
UnlockMethod · 0.45
AddToSceneMethod · 0.45

Tested by

no test coverage detected