Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

4701 Excellent


About WitchLord

  • Rank
    Moderator - AngelCode

Personal Information

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. WitchLord

    How to pass global function as callback?

    Unfortunately you've hit a previously unknown problem. I'm working on a fix for it, but for now you can work around it with the following: attackable_enemies.sort(function(a,b) { return weaker(a,b); });
  2. WitchLord

    How to pass global function as callback?

    The comparison function must take the arguments by reference. Try this: bool less(const int &in a, const int &in b) {return a < b;} I'll update the documentation to give an example with a global function too for clarity.
  3. WitchLord

    Will there be more frequent updates?

    Thanks for sharing. I'll add a link to this on my site too.
  4. WitchLord

    [SOLVED] Passing object handle to array::insertLast

    Your array is expecting handles to objects that are modifiable, i.e. not const. But you're trying to insert a handle to a non-modifiable object, i.e. const. 'const Object @' is a handle to non-modifiable object. 'Object @const' is a handle to a modifiable object, only the handle itself cannot be changed to refer to a different object. Regards, Andreas
  5. WitchLord

    Enum size

    Yes, of course. // Add a module with all the constants that should be available to scripts module->AddScriptSection("constants", "namespace Foo { const uint8 SOME_CONSTANT = 4; }");
  6. WitchLord

    CScriptBuilder #elif, #else

    Rather than adding your code to the CScriptBuilder I'll refer to it on my resources page so others can use it if they desire.
  7. WitchLord

    Enum size

    The engine can add a script section to modules with all the constants that should be available to scripts by default. // Add a module with all the constants that should be available to scripts module->AddScriptSection("constants", "const uint8 SOME_CONSTANT = 4;"); // Add the dynamically loaded script module->AddScriptSection(filename, scriptFromFile);
  8. WitchLord

    Error when assigning script object to dictionary

    Thanks for the code snippet for reproducing the problem. I've identified the cause. The copy constructor in your PlacedOrganelle script class is taking the other object by handle rather than by reference. Unfortunately there is a bug in the library that doesn't properly treat this when the asIScriptEngine::CreateScriptObjectCopy is used. This causes the call to the copy constructor to release the handle without the refcount first being incremented, thus leading to the object being destroyed too early as I mentioned earlier. The fix for the bug is in as_scriptobject.cpp line 166. Change the call from SetArgAddress to SetArgObject, and it will work. I'll have this fix checked in as soon as I can. Alternatively you can change your script to use & for the copy constructor, i.e. PlacedOrganelle(PlacedOrganelle& other)
  9. WitchLord

    Error when assigning script object to dictionary

    Thanks. I'll look into this. However from the evidence you showed I don't think you've managed to reproduce your original problem. In your original problem it appears that you have a case of objects being destroyed too early, i.e. Release() called on pointers not owned by the code that is calling the method. This leads to the invalid reads that Valgrind reports. Changing the script to use a handle assign instead of value assign is probably just camoflaging the error rather than actually fixing it. In your minimal code you've identified a runtime problem that I'll need to look into. It can probably not be caught at compile time, but should at least produce a proper script exception showing that the object doesn't have a default constructor. The problem with asOFFSET is caused.by the latest change. I'll make an additional change to make sure the code works on gnuc again. I'll reply when I've made the changes. Regards, Andreas
  10. WitchLord

    CScriptBuilder #elif, #else

    Yeah, that would be great
  11. I've fixed this in revision 2555
  12. WitchLord

    failed to build mingw x86 for release mode

    I've fixed this in revision 2554. It turns out the previous change (done in January) was what had broken the code.
  13. That's odd. I use msvc64 targetting 64bit builds by default and never got this warning for asOFFSET I'll look into it
  14. WitchLord

    Destroying reference counted objects immediately

    I'm glad you figured out the cause of the problem. There is absolutely no problem in using the forum as a rubber duck. I'd wager that a large percentage of the members here have also done the same. I too often have the same experience. Just being forced to describe the problem makes you think in different ways which often lets you see the cause of the problem you couldn't otherwise see.
  15. WitchLord

    Destroying reference counted objects immediately

    It seems to me that your makeBox function is returning the reference to the collisionShape with the refCount already set to 2. Besides creating the actual instance is makeBox keeping a reference somewhere to warrant the refCount to be 2 when returning?
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!