Results 1 to 10 of 30

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

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    I'm telling you this is not the right function, you're looking at! It
    Quote Originally Posted by Darkhog View Post
    is TGameObject.isColliding(GO:TGameObject).
    But I've used this code and it still crashes.

  2. #2
    Had another quick look on the github. Are you calling right constructor for TAnimatedSprite?
    Code:
    constructor TGameObject.Create(mode: TObjectMode);
    begin
      if mode=omAnim then Animations:=TAnimatedSpriteList.create;
    the .Create is TObject.Create, it seems. The .Create without parameters is not written to either TAnimatedSprite or TSprite.
    Last edited by User137; 18-07-2013 at 03:49 PM.

  3. #3
    *TAnimatedSpriteList. And for a while I've thought you're right, but TAnimatedSpriteList.create is defined on line 186 of Sprites.pas.

    Anyway, it then would crash as soon as I'd enter TDebugState since collision is checked constantly and thus Animations is accessed constantly and it only crashes if I make both game objects touch each other.

    It may be something with TAnimatedSprite class though.

  4. #4
    Any help? I can't pinpoint the issue at all!

  5. #5
    Where can I get al_ogg.pas file. I cant compile your project without it.

  6. #6
    It's in Allegro.pas distribution under (allegro.pas)\addons\OGG_Vorbis\lib

    //edit: Also to access debug screen press right ctrl+left shift+d on main menu.

  7. #7
    PGD Staff / News Reporter phibermon's Avatar
    Join Date
    Sep 2009
    Location
    England
    Posts
    524
    You've got two 'isColliding' member functions as part of TGameObject but you've not overloaded them. This should give you an error in objfpc mode as far as I'm aware.

    You're range checking 'CurrentAnim' but you're not range checking 'GO.CurrentAnim' which you also use. Not saying that's the issue but you should be meticulous about such things.

    I'm getting the build environment setup so I can compile and debug this for you, will have you an answer asap

    EDIT : You're also calling 'inherited create' from your TAnimatedSprite constructor but the parent class doesn't have it's constructor marked as virtual.

    User137 is correct, you don't have 'Create' defined in the TAnimatedSprite interface but you do have it in the implementation section. As a result you're not calling that 'Create' in your Gameobject creation, instead it'll be calling whatever 'Create()' it next finds, probably TObject.

    I don't mean this is an offensive manner, but I've learned some things today, I'd of said this would never compile! but there lies the executable

    Edit : BAADF00D isn't just an amusing coincidence you know, look it up

    Edit : You had your compiler optimization on the highest setting, this will prevent you from debugging properly.
    Last edited by phibermon; 27-07-2013 at 08:14 PM.
    When the moon hits your eye like a big pizza pie - that's an extinction level impact event.

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
  •