MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / copyFields

Method copyFields

Engine/source/console/fieldBrushObject.cpp:392–499  ·  view source on GitHub ↗

Copy Fields.

Source from the content-addressed store, hash-verified

390}
391// Copy Fields.
392void FieldBrushObject::copyFields( SimObject* pSimObject, const char* fieldList )
393{
394 // FieldBrushObject class?
395 if ( String::compare(pSimObject->getClassName(), getClassName()) == 0 )
396 {
397 // Yes, so warn.
398 Con::warnf("FieldBrushObject::copyFields() - Cannot copy FieldBrushObject objects!");
399 return;
400 }
401
402 char tempBuf[bufferSizes];
403
404 // Field List.
405 Vector<StringTableEntry> fields;
406
407 // Fetch valid field-list flag.
408 bool validFieldList = ( fieldList != NULL );
409
410 // Did we specify a fields list?
411 if ( validFieldList )
412 {
413 // Yes, so calculate field Count.
414 const U32 fieldCount = StringUnit::getUnitCount( fieldList, " \t\n" );
415
416 // Iterate fields...
417 for ( U32 fieldIndex = 0; fieldIndex < fieldCount; ++fieldIndex )
418 {
419 // Copy string element.
420 dStrcpy( tempBuf, StringUnit::getUnit( fieldList, fieldIndex, " \t\n" ), bufferSizes );
421
422 // Store field.
423 fields.push_back( StringTable->insert( tempBuf ) );
424 }
425 }
426
427 // Destroy Fields.
428 destroyFields();
429
430 // Fetch Field List.
431 const AbstractClassRep::FieldList& staticFields = pSimObject->getFieldList();
432
433 // Iterate fields.
434 for( U32 fieldIndex = 0; fieldIndex < staticFields.size(); ++fieldIndex )
435 {
436 // Fetch Field.
437 const AbstractClassRep::Field& staticField = staticFields[fieldIndex];
438
439 // Standard Field?
440 if ( staticField.type != AbstractClassRep::StartGroupFieldType &&
441 staticField.type != AbstractClassRep::EndGroupFieldType &&
442 staticField.type != AbstractClassRep::DeprecatedFieldType )
443 {
444 // Set field-specified flag.
445 bool fieldSpecified = !validFieldList;
446
447 // Did we specify a fields list?
448 if ( validFieldList )
449 {

Callers 1

Calls 12

compareFunction · 0.85
getUnitCountFunction · 0.85
dStrcpyFunction · 0.85
getUnitFunction · 0.85
getDataFunction · 0.85
dSprintfFunction · 0.85
warnfFunction · 0.70
getClassNameMethod · 0.45
push_backMethod · 0.45
insertMethod · 0.45
sizeMethod · 0.45
setFieldValueMethod · 0.45

Tested by

no test coverage detected