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

Method updateLineOffsets

Engine/source/console/persistenceManager.cpp:747–815  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

745}
746
747void PersistenceManager::updateLineOffsets(U32 startLine, S32 diff, ParsedObject* skipObject)
748{
749 if (diff == 0)
750 return;
751
752 if (startLine >= mLineBuffer.size())
753 return;
754
755 if (startLine + diff >= mLineBuffer.size())
756 return;
757
758 // Make sure we don't double offset a SimObject's
759 // declaration line
760 SimObjectList updated;
761
762 if (skipObject && !skipObject->simObject.isNull())
763 updated.push_back_unique(skipObject->simObject);
764
765 for (U32 i = 0; i < mObjectBuffer.size(); i++)
766 {
767 ParsedObject* object = mObjectBuffer[i];
768
769 // See if this is the skipObject
770 if (skipObject && skipObject == object)
771 continue;
772
773 // We can safely ignore objects that
774 // came earlier in the file
775 if (object->endLine < startLine)
776 continue;
777
778 if (object->startLine >= startLine)
779 object->startLine += diff;
780
781 if (object->nameLine >= startLine)
782 object->nameLine += diff;
783
784 for (U32 j = 0; j < object->properties.size(); j++)
785 {
786 if (object->properties[j].startLine >= startLine)
787 object->properties[j].startLine += diff;
788 if (object->properties[j].endLine >= startLine)
789 object->properties[j].endLine += diff;
790 if (object->properties[j].valueLine >= startLine)
791 object->properties[j].valueLine += diff;
792 }
793
794 if (object->endLine >= startLine)
795 object->endLine += diff;
796
797 if (!object->simObject.isNull() &&
798 object->simObject->getDeclarationLine() > startLine)
799 {
800 // Check for already updated SimObject's
801 U32 currSize = updated.size();
802 updated.push_back_unique(object->simObject);
803
804 if (updated.size() == currSize)

Callers

nothing calls this directly

Calls 5

push_back_uniqueMethod · 0.80
getDeclarationLineMethod · 0.80
setDeclarationLineMethod · 0.80
sizeMethod · 0.45
isNullMethod · 0.45

Tested by

no test coverage detected