| 440 | |
| 441 | |
| 442 | void SimObject::onTamlCustomRead(TamlCustomNodes const& customNodes) |
| 443 | { |
| 444 | // Debug Profiling. |
| 445 | //PROFILE_SCOPE(SimObject_OnTamlCustomRead); |
| 446 | |
| 447 | // Fetch field list. |
| 448 | const AbstractClassRep::FieldList& fieldList = getFieldList(); |
| 449 | const U32 fieldCount = fieldList.size(); |
| 450 | for (U32 index = 0; index < fieldCount; ++index) |
| 451 | { |
| 452 | // Fetch field. |
| 453 | const AbstractClassRep::Field* pField = &fieldList[index]; |
| 454 | |
| 455 | // Ignore if field not appropriate. |
| 456 | if (pField->type == AbstractClassRep::StartArrayFieldType || pField->elementCount > 1) |
| 457 | { |
| 458 | // Find cell custom node. |
| 459 | const TamlCustomNode* pCustomCellNodes = NULL; |
| 460 | if (pField->pGroupname != NULL) |
| 461 | pCustomCellNodes = customNodes.findNode(pField->pGroupname); |
| 462 | if (!pCustomCellNodes) |
| 463 | { |
| 464 | char* niceFieldName = const_cast<char *>(pField->pFieldname); |
| 465 | niceFieldName[0] = dToupper(niceFieldName[0]); |
| 466 | String str_niceFieldName = String(niceFieldName); |
| 467 | pCustomCellNodes = customNodes.findNode(str_niceFieldName + "s"); |
| 468 | } |
| 469 | |
| 470 | // Continue if we have explicit cells. |
| 471 | if (pCustomCellNodes != NULL) |
| 472 | { |
| 473 | // Fetch children cell nodes. |
| 474 | const TamlCustomNodeVector& cellNodes = pCustomCellNodes->getChildren(); |
| 475 | |
| 476 | U8 idx = 0; |
| 477 | // Iterate cells. |
| 478 | for (TamlCustomNodeVector::const_iterator cellNodeItr = cellNodes.begin(); cellNodeItr != cellNodes.end(); ++cellNodeItr) |
| 479 | { |
| 480 | char buf[5]; |
| 481 | dSprintf(buf, 5, "%d", idx); |
| 482 | |
| 483 | // Fetch cell node. |
| 484 | TamlCustomNode* pCellNode = *cellNodeItr; |
| 485 | |
| 486 | // Fetch node name. |
| 487 | StringTableEntry nodeName = pCellNode->getNodeName(); |
| 488 | |
| 489 | // Is this a valid alias? |
| 490 | if (nodeName != pField->pFieldname) |
| 491 | { |
| 492 | // No, so warn. |
| 493 | Con::warnf("SimObject::onTamlCustomRead() - Encountered an unknown custom name of '%s'. Only '%s' is valid.", nodeName, pField->pFieldname); |
| 494 | continue; |
| 495 | } |
| 496 | |
| 497 | // Fetch fields. |
| 498 | const TamlCustomFieldVector& fields = pCellNode->getFields(); |
| 499 |
no test coverage detected