mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 11:43:49 +00:00
Added field to ModuleDefinition for priority, which can be used to process/sort them in priority order
Added logic to ModuleManager's findModules method to allow priority sorting as well as pre-filtering by a given module group Adjusts the %isFine argument for the onMapLoadFailed callback events to %canContinueOnFail for a bit more clarity on what the arg conveys Shifts the setSpawnObjectType, setSpawnPoint and onPostSpawn call stack to utilize an event manager to allow the setup process for spawners and gamemode prepwork to run in it's own time, if needbe. Such as if a gamemode has to generate a map and there's no guarantees on when it'll b e done for one client vs another Added getModulesAndGameModesList, callOnObjectList and getNumCanCallOnObjectList utility functions
This commit is contained in:
parent
c5ae9af0ae
commit
46f6f6a9da
6 changed files with 220 additions and 31 deletions
|
|
@ -150,8 +150,14 @@ DefineEngineMethod(ModuleManager, findModuleByFilePath, String, (const char* fil
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static S32 QSORT_CALLBACK _findModulesSortByPriority(ModuleDefinition* const* a, ModuleDefinition* const* b)
|
||||
{
|
||||
F32 diff = (*a)->getPriority() - (*b)->getPriority();
|
||||
return diff > 0 ? 1 : diff < 0 ? -1 : 0;
|
||||
}
|
||||
|
||||
DefineEngineMethod(ModuleManager, findModules, String, (bool loadedOnly), (true),
|
||||
|
||||
DefineEngineMethod(ModuleManager, findModules, String, (bool loadedOnly, bool sortByPriority, const char* moduleGroup), (true, false, ""),
|
||||
"Find all the modules registered with the specified loaded state.\n"
|
||||
"@param loadedOnly Whether to return only modules that are loaded or not.\n"
|
||||
"@return A list of space - separated module definition object Ids.\n")
|
||||
|
|
@ -174,12 +180,23 @@ DefineEngineMethod(ModuleManager, findModules, String, (bool loadedOnly), (true)
|
|||
char* pReturnBuffer = Con::getReturnBuffer( bufferSize );
|
||||
char* pBufferWrite = pReturnBuffer;
|
||||
|
||||
if (sortByPriority)
|
||||
moduleDefinitions.sort(_findModulesSortByPriority);
|
||||
|
||||
StringTableEntry moduleGroupStr = StringTable->insert(moduleGroup);
|
||||
|
||||
// Iterate module definitions.
|
||||
for ( ModuleManager::typeConstModuleDefinitionVector::const_iterator moduleDefinitionItr = moduleDefinitions.begin(); moduleDefinitionItr != moduleDefinitions.end(); ++moduleDefinitionItr )
|
||||
{
|
||||
// Fetch module definition.
|
||||
const ModuleDefinition* pModuleDefinition = *moduleDefinitionItr;
|
||||
|
||||
if(moduleGroupStr != StringTable->EmptyString())
|
||||
{
|
||||
if (pModuleDefinition->getModuleGroup() != moduleGroupStr)
|
||||
continue;
|
||||
}
|
||||
|
||||
// Format module definition.
|
||||
const U32 offset = dSprintf( pBufferWrite, bufferSize, "%d ", pModuleDefinition->getId() );
|
||||
pBufferWrite += offset;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue