Results 1 to 2 of 2

Thread: Tagging values onto a TPA

  1. #1
    Join Date
    Feb 2012
    Posts
    170
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default Tagging values onto a TPA

    So I have a TPointArray as the result of a function. but I want to tag an unknown quantity of values onto it, and return them all. so far I have
    Code:
    function CircleCheck(Row,Collumn: Integer): TPointArray;
    begin
    if (z[row][Collumn].x = HookColor) then
    begin
    z[row][Collumn].y := 1;
    ta[1] := ta[1] + 1;
    end
    else  //useless? meh...
    begin
    z[row][Collumn].y := 0;
    end;
    if z[row-1][Collumn-1].x = HookColor then
    begin
    result := result + z[row-1][Collumn-1];         // part I need help with
    end;
    
    end;
    I want result to be a list of row/collumn points that came up true. I need help with the syntax of taggin values onto the end of a possibly empty result. please.

    result[GetLength(result)].x := Collumn - 1;
    result[GetLength(result)].y := Collumn - 1;

    would that work? or idk, I don't wanna overwrite any values, and result will be empty at first.

  2. #2
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

    I'm not exactly sure what you're trying to do, but I think AppendTPA() is what you're trying to do. You would be able to replace:

    Simba Code:
    result := result + z[row-1][Collumn-1];

    // With:

    AppendTPA(result, z[row-1][Collumn-1]);

    I'm fairly certain it will increase the TPA length by one and then insert the new value in last, but I always do this to make sure:

    Simba Code:
    lResult := Length(Result);
    SetLength(Result, lResult + 1);

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •