@@ -223,7 +223,7 @@ OptionLoader::OptionArray OptionLoader::loadOptions( void* av_class, int req_fla
223
223
{
224
224
OptionArray options;
225
225
226
- std::map <std::string, int > optionUnitToIndex;
226
+ std::multimap <std::string, int > optionUnitToIndex;
227
227
std::vector<Option> childOptions;
228
228
229
229
const AVOption* avOption = NULL ;
@@ -244,8 +244,6 @@ OptionLoader::OptionArray OptionLoader::loadOptions( void* av_class, int req_fla
244
244
245
245
OptionType optionType = Option::getTypeFromAVOption ( avOption->unit , avOption->type );
246
246
247
- // std::cout << "The option is " << avOption->name << " of type : " << avOption->type << std::endl;
248
-
249
247
if ( optionType == TypeChild )
250
248
{
251
249
childOptions.push_back ( Option ( *avOption, optionType ) );
@@ -262,19 +260,25 @@ OptionLoader::OptionArray OptionLoader::loadOptions( void* av_class, int req_fla
262
260
}
263
261
264
262
// iterate on child options
265
- for ( std::vector<Option>::iterator it = childOptions.begin (); it != childOptions.end (); ++it )
263
+ for ( std::vector<Option>::iterator itOption = childOptions.begin (); itOption != childOptions.end (); ++itOption )
266
264
{
267
- int indexParentOption = optionUnitToIndex.at ( it->getUnit () );
268
- Option& parentOption = options.at ( indexParentOption );
269
-
270
- parentOption.appendChild ( *it );
271
-
272
- // child of a Choice
273
- if ( parentOption.getType () == TypeChoice )
265
+ for ( std::multimap<std::string, int >::iterator itUnit = optionUnitToIndex.begin (); itUnit != optionUnitToIndex.end (); ++itUnit )
274
266
{
275
- if ( it->getDefaultValueInt () == parentOption.getDefaultValueInt () )
276
- parentOption.setDefaultChildIndex ( parentOption.getNbChilds () - 1 );
277
- }
267
+ if ( itUnit->first == itOption->getUnit () )
268
+ {
269
+ int indexParentOption = itUnit->second ;
270
+ Option& parentOption = options.at ( indexParentOption );
271
+
272
+ parentOption.appendChild ( *itOption );
273
+
274
+ // child of a Choice
275
+ if ( parentOption.getType () == TypeChoice )
276
+ {
277
+ if ( itOption->getDefaultValueInt () == parentOption.getDefaultValueInt () )
278
+ parentOption.setDefaultChildIndex ( parentOption.getNbChilds () - 1 );
279
+ }
280
+ }
281
+ }
278
282
}
279
283
return options;
280
284
}
0 commit comments