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

Method GetTurretLocatorCount

trinity/Eve/SpaceObject/EveMobile.cpp:389–444  ·  view source on GitHub ↗

-------------------------------------------------------------------------------- Description: Override base ::RenderDebugInfo() function, so we can draw debuginfo of the turrets etc. --------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

387// the turrets etc.
388// --------------------------------------------------------------------------------
389unsigned int EveMobile::GetTurretLocatorCount()
390{
391 unsigned int locatorsFoundA = 0;
392 unsigned int locatorsFoundB = 0;
393
394 auto n = static_cast<unsigned int>( m_locators.size() );
395 for( unsigned int i = 0; i < n; ++i )
396 {
397 const char* locatorName = m_locators[i]->GetName();
398 // EveMobile keeps multiple types of locator, so validate the name
399 ValidateTurretLocatorName( locatorName, locatorsFoundA, locatorsFoundB );
400 }
401
402 if( m_animationUpdater )
403 {
404 if( m_animationUpdater->IsUsingCMF() )
405 {
406 const cmf::Skeleton* skeleton = m_animationUpdater->GetSkeleton();
407 if( skeleton )
408 {
409 for( const auto& bone : skeleton->bones )
410 {
411 ValidateTurretLocatorName( cmf::ToStdStringView( bone ), locatorsFoundA, locatorsFoundB );
412 }
413 }
414 }
415#if WITH_GRANNY
416 else
417 {
418 if( m_animationUpdater->m_skeleton )
419 {
420 for( int boneIx = 0; boneIx < m_animationUpdater->m_skeleton->BoneCount; ++boneIx )
421 {
422 const granny_bone& bone = m_animationUpdater->m_skeleton->Bones[boneIx];
423 ValidateTurretLocatorName( bone.Name, locatorsFoundA, locatorsFoundB );
424 }
425 }
426 }
427#endif
428 }
429
430 if( ( locatorsFoundA != locatorsFoundB ) && locatorsFoundB )
431 {
432 // Pairs don't match up. Note we do allow having only the 'a' locator (for drones)
433 return 0;
434 }
435
436 unsigned int tlc = 0;
437 while( locatorsFoundA & 0x01 )
438 {
439 ++tlc;
440 locatorsFoundA >>= 1;
441 }
442
443 return tlc;
444}
445
446// --------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 5

sizeMethod · 0.80
ifFunction · 0.50
GetNameMethod · 0.45
IsUsingCMFMethod · 0.45
GetSkeletonMethod · 0.45

Tested by

no test coverage detected