Paste Fields.
| 521 | } |
| 522 | // Paste Fields. |
| 523 | void FieldBrushObject::pasteFields( SimObject* pSimObject ) |
| 524 | { |
| 525 | // FieldBrushObject class? |
| 526 | if ( String::compare(pSimObject->getClassName(), getClassName()) == 0 ) |
| 527 | { |
| 528 | // Yes, so warn. |
| 529 | Con::warnf("FieldBrushObject::pasteFields() - Cannot paste FieldBrushObject objects!"); |
| 530 | return; |
| 531 | } |
| 532 | |
| 533 | // Fetch Dynamic-Field Dictionary. |
| 534 | SimFieldDictionary* pFieldDictionary = getFieldDictionary(); |
| 535 | |
| 536 | // Any Field Dictionary? |
| 537 | if ( pFieldDictionary == NULL ) |
| 538 | { |
| 539 | // No, so we're done. |
| 540 | return; |
| 541 | } |
| 542 | |
| 543 | // Force modification of static-fields on target object! |
| 544 | pSimObject->setModStaticFields( true ); |
| 545 | |
| 546 | S32 prefixLength = dStrlen(INTERNAL_FIELD_PREFIX); |
| 547 | |
| 548 | // Iterate fields. |
| 549 | for ( SimFieldDictionaryIterator itr(pFieldDictionary); *itr; ++itr ) |
| 550 | { |
| 551 | // Fetch Field Entry. |
| 552 | SimFieldDictionary::Entry* fieldEntry = *itr; |
| 553 | |
| 554 | // Internal Field? |
| 555 | char* pInternalField = dStrstr( fieldEntry->slotName, INTERNAL_FIELD_PREFIX ); |
| 556 | if ( pInternalField == fieldEntry->slotName ) |
| 557 | { |
| 558 | // Yes, so skip the prefix. |
| 559 | pInternalField += prefixLength; |
| 560 | |
| 561 | // Is this a static-field on the target object? |
| 562 | // NOTE:- We're doing this so we don't end-up creating a dynamic-field if it isn't present. |
| 563 | |
| 564 | // Fetch Field List. |
| 565 | const AbstractClassRep::FieldList& staticFields = pSimObject->getFieldList(); |
| 566 | |
| 567 | // Iterate fields. |
| 568 | for( U32 fieldIndex = 0; fieldIndex < staticFields.size(); ++fieldIndex ) |
| 569 | { |
| 570 | // Fetch Field. |
| 571 | const AbstractClassRep::Field& staticField = staticFields[fieldIndex]; |
| 572 | |
| 573 | // Standard Field? |
| 574 | if ( staticField.type != AbstractClassRep::StartGroupFieldType && |
| 575 | staticField.type != AbstractClassRep::EndGroupFieldType && |
| 576 | staticField.type != AbstractClassRep::DeprecatedFieldType ) |
| 577 | { |
| 578 | // Target field? |
| 579 | if ( String::compare(staticField.pFieldname, pInternalField) == 0 ) |
| 580 | { |
no test coverage detected