MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / loadModuleExplicit

Method loadModuleExplicit

engine/source/module/moduleManager.cc:642–819  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

640//-----------------------------------------------------------------------------
641
642bool ModuleManager::loadModuleExplicit( const char* pModuleId, const U32 versionId )
643{
644 // Lock database.
645 LockDatabase( this );
646
647 // Sanity!
648 AssertFatal( pModuleId != NULL, "Cannot load explicit module Id with NULL module Id." );
649
650 typeModuleLoadEntryVector moduleResolvingQueue;
651 typeModuleLoadEntryVector moduleReadyQueue;
652
653 // Fetch module Id.
654 StringTableEntry moduleId = StringTable->insert( pModuleId );
655
656 // Fetch modules definitions.
657 ModuleDefinitionEntry* pDefinitions = findModuleId( moduleId );
658
659 // Did we find the module Id?
660 if ( pDefinitions == NULL )
661 {
662 // No, so warn.
663 Con::warnf( "Module Manager: Cannot load explicit module Id '%s' as it does not exist.", moduleId );
664 return false;
665 }
666
667 // Fetch module group.
668 StringTableEntry moduleGroup = pDefinitions->mModuleGroup;
669
670 // Info.
671 if ( mEchoInfo )
672 {
673 Con::printSeparator();
674 Con::printf( "Module Manager: Loading explicit module Id '%s' at version Id '%d':", moduleId, versionId );
675 }
676
677 // Finish if we could not resolve the dependencies for module Id (of any version Id).
678 if ( !resolveModuleDependencies( moduleId, versionId, moduleGroup, false, moduleResolvingQueue, moduleReadyQueue ) )
679 return false;
680
681 // Check the modules we want to load to ensure that we do not have incompatible modules loaded already.
682 for ( typeModuleLoadEntryVector::iterator moduleReadyItr = moduleReadyQueue.begin(); moduleReadyItr != moduleReadyQueue.end(); ++moduleReadyItr )
683 {
684 // Fetch load ready module definition.
685 ModuleDefinition* pLoadReadyModuleDefinition = moduleReadyItr->mpModuleDefinition;
686
687 // Fetch the module Id loaded entry.
688 ModuleLoadEntry* pLoadedModuleEntry = findModuleLoaded( pLoadReadyModuleDefinition->getModuleId() );
689
690 // Did we find a loaded entry?
691 if ( pLoadedModuleEntry != NULL )
692 {
693 // Yes, so is it the one we need to load?
694 if ( pLoadedModuleEntry->mpModuleDefinition != pLoadReadyModuleDefinition )
695 {
696 // Yes, so warn.
697 Con::warnf( "Module Manager: Cannot load explicit module Id '%s' at version Id '%d' as the module Id is already loaded but at version Id '%d'.",
698 pLoadReadyModuleDefinition->getModuleId(), pLoadReadyModuleDefinition->getVersionId(), pLoadedModuleEntry->mpModuleDefinition->getVersionId() );
699 return false;

Callers 1

Calls 15

LockDatabaseClass · 0.85
warnfFunction · 0.85
printSeparatorFunction · 0.85
printfFunction · 0.85
addPathExpandoFunction · 0.85
executefFunction · 0.85
errorfFunction · 0.85
getModuleIdMethod · 0.80
getVersionIdMethod · 0.80
increaseLoadCountMethod · 0.80
getDeprecatedMethod · 0.80

Tested by

no test coverage detected