AGS.Editor.ScriptEditor.AdjustStartOfFunctionIfAppropriate C# (CSharp) Method

AdjustStartOfFunctionIfAppropriate() private method

private AdjustStartOfFunctionIfAppropriate ( ScriptFunction func, int currentPos, int adjustment ) : void
func ScriptFunction
currentPos int
adjustment int
return void
        private void AdjustStartOfFunctionIfAppropriate(ScriptFunction func, int currentPos, int adjustment)
        {
            if (func.StartsAtCharacterIndex > currentPos)
            {
                func.StartsAtCharacterIndex += adjustment;
            }

            if (func.EndsAtCharacterIndex > currentPos)
            {
                func.EndsAtCharacterIndex += adjustment;
            }

            if (func.StartsAtCharacterIndex < 0)
            {
                // Function has probably just been deleted
                func.StartsAtCharacterIndex = -1;
                func.EndsAtCharacterIndex = -1;
            }
        }