Skip to content

Vector Crash #44

Description

@nyttimangus

I got this error:

vectorcrash

I believe it was caused by this line of code:

        nullVector(vectorExists(4, 3, 3));

which references these two functions:

function nullVector(vector)
{
boardGetVector(castNum(vector), type, pointCount, layer, isClosed, attributes);
boardSetVector(castNum(vector), tkVT_WAYPOINT, pointCount, layer, isClosed, attributes);
}

and

function vectorExists(x, y, l)
{
leftx = ((32 * x) - 32);
rightx = (32 * x);
topy = ((32 * y) - 32);
bottomy = (32 * y);
vectorCount = boardGetVector();
for(index = 0; index < vectorCount; index++)
{
    boardGetVector(index, type, pointCount, layer, isClosed, attributes);
    if(pointCount == 4 && layer == l)
    {
        boardGetVectorPoint(index, 0, x[0], y[0])
        boardGetVectorPoint(index, 1, x[1], y[1])
        boardGetVectorPoint(index, 2, x[2], y[2])
        boardGetVectorPoint(index, 3, x[3], y[3])
        if(x[0] == x[1])
        {
            if(x[0] == leftx || x[0] == rightx)
            {
                if(x[2] == leftx || x[2] == rightx)
                {
                    branch(:branch);
                }
            }
        }
        elseif(x[0] == x[2])
        {
            if(x[0] == leftx || x[0] == rightx)
            {
                if(x[3] == leftx || x[3] == rightx)
                {
                    branch(:branch);
                }
            }
        }
        elseif(x[0] == x[3])
        {
            if(x[0] == leftx || x[0] == rightx)
            {
                if(x[1] == leftx || x[1] == rightx)
                {
                    branch(:branch);
                }
            }
        }
        if(proceed == 1)
        {
:branch
            if(y[0] == y[1])
            {
                if(y[0] == topy || y[0] == bottomy)
                {
                    if(y[2] == topy || y[2] == bottomy)
                    {
                        return index;
                    }
                }
            }
            elseif(y[0] == y[2])
            {
                if(y[0] == topy || y[0] == bottomy)
                {
                    if(y[3] == topy || y[3] == bottomy)
                    {
                        return index;
                    }
                }
            }
            elseif(y[0] == y[3])
            {
                if(y[0] == topy || y[0] == bottomy)
                {
                    if(y[1] == topy || y[1] == bottomy)
                    {
                        return index;
                    }
                }
            }
        }
    }
}
//  debugger("Vector not found");
return -1;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions