mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 09:04:38 +00:00
correct the moduleDependencySort callback
This commit is contained in:
parent
f92c1706c6
commit
b168617034
1 changed files with 12 additions and 4 deletions
|
|
@ -80,17 +80,25 @@ S32 QSORT_CALLBACK moduleDependencySort(const void* a, const void* b)
|
||||||
ModuleDefinition* pDefinition1 = *(ModuleDefinition * *)a;
|
ModuleDefinition* pDefinition1 = *(ModuleDefinition * *)a;
|
||||||
ModuleDefinition* pDefinition2 = *(ModuleDefinition * *)b;
|
ModuleDefinition* pDefinition2 = *(ModuleDefinition * *)b;
|
||||||
|
|
||||||
// Fetch version Ids.
|
// if A depends on B move A down the list
|
||||||
ModuleDefinition::typeModuleDependencyVector moduleDependencies = pDefinition1->getDependencies();
|
ModuleDefinition::typeModuleDependencyVector moduleDependencies = pDefinition1->getDependencies();
|
||||||
bool foundDependant = false;
|
|
||||||
for (ModuleDefinition::typeModuleDependencyVector::const_iterator dependencyItr = moduleDependencies.begin(); dependencyItr != moduleDependencies.end(); ++dependencyItr)
|
for (ModuleDefinition::typeModuleDependencyVector::const_iterator dependencyItr = moduleDependencies.begin(); dependencyItr != moduleDependencies.end(); ++dependencyItr)
|
||||||
{
|
{
|
||||||
if (String::compare(dependencyItr->mModuleId, pDefinition2->getModuleId())
|
if (String::compare(dependencyItr->mModuleId, pDefinition2->getModuleId())
|
||||||
&& (dependencyItr->mVersionId == pDefinition2->getVersionId()))
|
&& (dependencyItr->mVersionId == pDefinition2->getVersionId()))
|
||||||
foundDependant = true;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return foundDependant ? 1 : -1;
|
//If B depends on A, move A up the list
|
||||||
|
ModuleDefinition::typeModuleDependencyVector moduleDependencies2 = pDefinition2->getDependencies();
|
||||||
|
for (ModuleDefinition::typeModuleDependencyVector::const_iterator dependencyItr2 = moduleDependencies2.begin(); dependencyItr2 != moduleDependencies2.end(); ++dependencyItr2)
|
||||||
|
{
|
||||||
|
if (String::compare(dependencyItr2->mModuleId, pDefinition1->getModuleId())
|
||||||
|
&& (dependencyItr2->mVersionId == pDefinition1->getVersionId()))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
//if neither depend on the other leave the order alone
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue