Results 1 to 10 of 30

Thread: Yet another segfault (a.k.a. Darkhog is a total noob)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Isn't this an infinitely recursive loop? (could be wrong, difficult to trace types without downloading whole project)
    Code:
    function TGameObject.isColliding(Sprite: TSprite): Boolean;
    begin
      Result:=false; //setting result, just in case
      case ObjectMode of
        omAnim:   begin
                    if Animations.Items[CurrentAnim]<>nil then //safety check so we won't get segfault
                      //setting result
                      Result:=Animations.Items[CurrentAnim].IsColliding(Sprite);
                    end;
        omSprite: begin
                    if Sprites.Items[CurrentSprite]<>nil then //safety check so we won't get segfault
                      //setting result
                      Result:=Sprites.Items[CurrentSprite].IsColliding(Sprite);
                  end;
      end;
    end;
    Seems that it might not recurse. But in that code you could debug if CurrentAnim could go out of list boundaries.
    Last edited by User137; 18-07-2013 at 12:19 AM.

Bookmarks

Posting Permissions

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