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

Method addDependency

Engine/source/module/moduleDefinition.cpp:135–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Calls 6

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

Tested by

no test coverage detected