MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / resolveModuleDependencies

Method resolveModuleDependencies

Engine/source/module/moduleManager.cpp:2294–2432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2292//-----------------------------------------------------------------------------
2293
2294bool ModuleManager::resolveModuleDependencies( StringTableEntry moduleId, const U32 versionId, StringTableEntry moduleGroup, bool synchronizedOnly, typeModuleLoadEntryVector& moduleResolvingQueue, typeModuleLoadEntryVector& moduleReadyQueue )
2295{
2296 // Fetch the module Id ready entry.
2297 ModuleLoadEntry* pLoadReadyEntry = findModuleReady( moduleId, moduleReadyQueue );
2298
2299 // Is there a load entry?
2300 if ( pLoadReadyEntry )
2301 {
2302 // Yes, so finish if the version Id is not important,
2303 if ( versionId == 0 )
2304 return true;
2305
2306 // Finish if the version Id are compatible.
2307 if ( versionId == pLoadReadyEntry->mpModuleDefinition->getVersionId() )
2308 return true;
2309
2310 // Is it a strict version Id?
2311 if ( pLoadReadyEntry->mStrictVersionId )
2312 {
2313 // Yes, so warn.
2314 Con::warnf( "Module Manager: A module dependency was detected loading module Id '%s' at version Id '%d' in group '%s' but an version Id '%d' is also required.",
2315 moduleId, versionId, pLoadReadyEntry->mpModuleDefinition->getVersionId(), moduleGroup );
2316 return false;
2317 }
2318
2319 // No, so find the required module version Id.
2320 ModuleDefinitionEntry::iterator definitionItr = findModuleDefinition( moduleId, versionId );
2321
2322 // Did we find the requested module definition.
2323 if ( definitionItr == NULL )
2324 {
2325 // No, so we can safely ignore the missing dependency if we're not enforcing dependencies.
2326 if ( !mEnforceDependencies )
2327 return true;
2328
2329 // Warn!
2330 Con::warnf( "Module Manager: A missing module dependency was detected loading module Id '%s' at version Id '%d' in group '%s'.",
2331 moduleId, versionId, moduleGroup );
2332 return false;
2333 }
2334
2335 // Set the new module definition.
2336 pLoadReadyEntry->mpModuleDefinition = *definitionItr;
2337
2338 // Set strict version Id.
2339 pLoadReadyEntry->mStrictVersionId = true;
2340
2341 return true;
2342 }
2343
2344 // Is the module Id load resolving?
2345 if ( findModuleResolving( moduleId, moduleResolvingQueue ) != NULL )
2346 {
2347 // Yes, so a cycle has been detected so warn.
2348 Con::warnf( "Module Manager: A cyclic dependency was detected resolving module Id '%s' at version Id '%d' in group '%s'.",
2349 moduleId, versionId, moduleGroup );
2350 return false;
2351 }

Callers

nothing calls this directly

Calls 10

warnfFunction · 0.85
getVersionIdMethod · 0.80
getSynchronizedMethod · 0.80
getDependenciesMethod · 0.80
findMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
beginMethod · 0.45
pop_backMethod · 0.45

Tested by

no test coverage detected