| 446 | //----------------------------------------------------------------------------- |
| 447 | |
| 448 | bool SFXDescription::onAdd() |
| 449 | { |
| 450 | if ( !Parent::onAdd() ) |
| 451 | return false; |
| 452 | |
| 453 | Sim::getSFXDescriptionSet()->addObject( this ); |
| 454 | |
| 455 | // Convert a legacy 'channel' field, if we have one. |
| 456 | |
| 457 | static const char* sChannel = StringTable->insert( "channel" ); |
| 458 | const char* channelValue = getDataField( sChannel, NULL ); |
| 459 | if( channelValue && channelValue[ 0 ] ) |
| 460 | { |
| 461 | const char* group = Con::evaluatef( "return sfxOldChannelToGroup( %s );", channelValue ); |
| 462 | if( !Sim::findObject( group, mSourceGroup ) ) |
| 463 | Con::errorf( "SFXDescription::onAdd - could not resolve channel '%s' to SFXSource", channelValue ); |
| 464 | } |
| 465 | |
| 466 | // Validate the data we'll be passing to |
| 467 | // the audio layer. |
| 468 | validate(); |
| 469 | |
| 470 | return true; |
| 471 | } |
| 472 | |
| 473 | //----------------------------------------------------------------------------- |
| 474 | |