| 133 | //----------------------------------------------------------------------------- |
| 134 | |
| 135 | bool 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 | |