Jump to content
  • Advertisement

Ali Gerami

Member
  • Content Count

    8
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Ali Gerami

  • Rank
    Newbie

Personal Information

  • Role
    Artificial Intelligence
    Business Development
    Game Designer
    Programmer
    UI/UX Designer
  • Interests
    Design
    Production
    Programming

Recent Profile Visitors

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

  1. Ali Gerami

    Implicitly assign handle by overloading opImplConv operator

    Alright, thanks again. I'll try to investigate my issue more and come up with a fix.
  2. Ali Gerami

    Implicitly assign handle by overloading opImplConv operator

    I did notice that bug before and I actually reported it: But I noticed by removing opImplCast operator overload, my problem solved so I thought it's not a bug. However, I installed VS 2015, with the latest revision, registered opImplConv in dictionaryValue, 1. In test_feature project (msvc test as) this happens: 2. test_castop.cpp Line 184 fails as well. 3. My old bug still exists, even with VS 2015, latest revision and THE EXACT SAME SOURCE CODE you posted in here in the exact same test_feature msvc project. --------------------- I took these screenshots, if you want me to take a video, downloading the actual latest WIP source code version, compiling it with VS 2015, add your code in msvc test as project and compile & test it, just do tell, if you want to remotely connect to my computer and see for yourself (or do it yourself), just do tell!
  3. Ali Gerami

    Implicitly assign handle by overloading opImplConv operator

    I was using the latest stable source code which didn't work and my own source code. Now I tested with the WIP source code, compiled it and tested with the following exact code on a new project. I checked, in the debugger call stack, Line 'assert(bAssertion);' throws an exception and guess what, assertion failed. The exact same bug. (I'm using latest Visual Studio and compiling with C++17, tried C++14 too, still the same) Edit: I compiled AngelScript with 'AS_NO_THREADS' preprocessor definition, but I don't think that it's causing this. void MessageCallback(const asSMessageInfo * msg) { printf("msg: %s %i\n", msg->message, msg->row); } void Assert(bool bAssertion) { assert(bAssertion); } int main() { asIScriptEngine* engine = asCreateScriptEngine(); engine->SetMessageCallback(asFUNCTION(MessageCallback), NULL, asCALL_CDECL); RegisterStdString(engine); RegisterScriptArray(engine, true); RegisterScriptDictionary(engine); engine->RegisterGlobalFunction("void assert(bool)", asFUNCTION(Assert), asCALL_CDECL); asIScriptModule* mod = engine->GetModule("module", asGM_ALWAYS_CREATE); mod->AddScriptSection("test", "class Object {} \n"); int r = mod->Build(); if (r < 0) assert(0); r = ExecuteString(engine, R"ascode(dictionary dict = { { 'myHandle', Object() } }; Object @myHandle; @myHandle = dict['myHandle']; assert( myHandle !is null );)ascode", mod); if (r != asEXECUTION_FINISHED) assert(0); engine->ShutDownAndRelease(); return 0; }
  4. Ali Gerami

    Implicitly assign handle by overloading opImplConv operator

    Thanks for your reply. Well, I looked and checked CScriptDictionary before and modified that too, but I tested with the original version this time. And here is the error I get when I try to compile: Object is an object type of asOBJ_REF. The script I used: dictionary myDict = {{"myHandle", @myObject}}; // this line works, without the error line it's fine Object@ myHandle; @myHandle = myDict["myHandle"]; // this line gives the error Edit: When I overload opImplConv in the original CScriptDictionary, the error line above will not be shown and the exact same problem I have in my modified 'any' object happens here too. Edit 2: Looks like opCast operator overload (@myHandle = cast<Object>(myDict["myHandle"])) works fine, just like .Get method but still implicit conv fails, why is that? Can't we implicitly/(it's more explicitly) assign/convert a handle?
  5. Hi, I have modified CScriptAny a little and by overloading opCast and opImplConv I won't need .Retrieve method. Everything is fine, objects and primitive types are retrieved successfully but when I try to assign a handle implicitly it fails completely. Example: obj@ myObject; @myObject = myAny; // myAny is a valid any object I tracked more and I found out that ref pointer (1st parameter) is NULL and typeID (2nd parameter) is set to that object type id ((typeID & asTYPEID_MASK_OBJECT) == true) and in typeID, asTYPEID_OBJHANDLE flag is not set! (However, this problem does not occur by using .Retrieve method or any method instead of implicitly assigning) Also, I feel that opConv operator overloading fails, e.g. I want to have something like this: int(myAny); and it gives errors while compiling. And by the way, what is opImplCast when opImplConv exists? When I try to register opImplCast I'm not able to assign my 'any' object (e.g. any myAny = 50;) (I have overloaded opAssign too, so no more .Store method)
  6. Hi, I'm defining the following function inside a script: void TestFunction(const MyType &in testType) { // ... } and 'MyType' is an object type that I registered in application with flag asOBJ_REF and I have only registered AddRef and Release behaviours. I've also registered the following function on engine: "void TestRetrieve(const MyType &in)". The problem here is, "TestRetrieve" is successfully registered, I got no errors or problems using this function, reference will be retrieved and the object is working. But when I try to define a function inside the script, the error in the title will happen! However, I commented https://www.sourceforge.net/p/angelscript/code/HEAD/tree/trunk/sdk/angelscript/source/as_compiler.cpp#l377 - 389 and the code is working fine, why it needs instantiation at all? The object is instantiated in the application, in fact, I don't want it to be instantiated by the script, I want it to be passed into script by inref.
  7. Ali Gerami

    Solved.

    Problem was mine, solved. Sorry.
  8. Ali Gerami

    About AS_MAX_PORTABILITY

    Hi, I've came here with a question about "AS_MAX_PORTABILITY" macro in AngelScript. I'm aware of that what is it and what is it for but one thing that I could not find out is when you define AS_MAX_PORTABILITY manually and you are gonna use it for multi-platforms like something like asm.js (Emscripten) and arm64 phones and ... Can I use native calling conventions? I mean, I'm going to support consoles (PlayStation, Xbox and such) too, is it safe to still use native calling conventions instead of generic? Should I switch? Should I not?
  • 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!