MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / addDependency

Method addDependency

Engine/source/module/moduleDefinition.cpp:136–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134//-----------------------------------------------------------------------------
135
136bool ModuleDefinition::addDependency( const char* pModuleId, const U32 versionId )
137{
138 // Fetch module Id.
139 StringTableEntry moduleId = StringTable->insert( pModuleId );
140
141 // Do we have any existing dependencies?
142 if ( mDependencies.size() > 0 )
143 {
144 // Yes, so is the module Id already a dependency?
145 for( typeModuleDependencyVector::iterator dependencyItr = mDependencies.begin(); dependencyItr != mDependencies.end(); ++dependencyItr )
146 {
147 // Skip if not the same module Id.
148 if ( dependencyItr->mModuleId != moduleId )
149 continue;
150
151 // Dependency already exists so warn.
152 Con::warnf("Could not add dependency of module Id '%s' at version Id '%d' as the module Id is already a dependency.", pModuleId, versionId );
153 return false;
154 }
155 }
156
157 // Populate module dependency.
158 ModuleDefinition::ModuleDependency dependency( moduleId, versionId );
159
160 // Store dependency.
161 mDependencies.push_back( dependency );
162
163 return true;
164}
165
166//-----------------------------------------------------------------------------
167

Calls 6

warnfFunction · 0.50
insertMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected