Jump to content
  • Advertisement

Robotex

Member
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Robotex

  • Rank
    Newbie

Personal Information

  • Interests
    Programming

Recent Profile Visitors

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

  1. Robotex

    Upgrading legacy code

    I am currently working on a legacy codebase that was using AngelScript 2.4.1e for its scripting engine and I'm trying to upgrade it. After having settled with the compilation errors, one problem that I encountered is that all the scripts have a common function which is called from the application to set an instance of a Game class and that Game class is an interface/wrapper for interacting with the game engine (each script instance is sandboxed). Scripts: Game@ instance; void SetInstance(Game &in i) { @instance = @i; } Application: class Game { private : Game(); public : Game(IScript *); virtual ~Game(); int AddRef(); int Release(); void ScriptLoaded(); // ... }; // Legacy code: r=engine->RegisterObjectType("Game", sizeof(Game), asOBJ_CLASS); r=engine->RegisterObjectBehaviour("Game", asBEHAVE_ADDREF, "void f()", asMETHOD(Game, AddRef), asCALL_THISCALL); r=engine->RegisterObjectBehaviour("Game", asBEHAVE_RELEASE, "void f()", asMETHOD(Game, Release), asCALL_THISCALL); // ... // After upgrade: r=engine->RegisterObjectType("Game", sizeof(Game), asOBJ_REF); assert(r >= 0); r=engine->RegisterObjectBehaviour("Game", asBEHAVE_ADDREF, "void f()", asMETHOD(Game, AddRef), asCALL_THISCALL); assert(r >= 0); r=engine->RegisterObjectBehaviour("Game", asBEHAVE_RELEASE, "void f()", asMETHOD(Game, Release), asCALL_THISCALL); assert(r >= 0); // ... // In Game's ScriptLoaded method context->Prepare(module->GetFunctionByName("SetInstance")); context->SetArgObject(0, (void*)this); context->Execute(); The error that I am getting and being thrown during runtime is "Parameter type can't be 'Game&in', because the type cannot be instantiated." when SetInstance is being compiled/called. How can I fix it? I tried registering a copy constructor with asBEHAVE_FACTORY but no luck. Keeping in mind I would like to avoid editing manually over 300 scripts if possible. Thanks in advance.
  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!