I see some of you guys have been treading the object-oriented (OO) lands, which is good, so I was wondering if someone could help me with something.
AngelScript OO capabilities are decent, but there are certain odd limitations... At least with the version HPL2 is using. The language designer made some strange choices; while most OO languages provide public, protected and private levels of class member access, AngelScript opts to provide only public and private - but that's not the problem
per se.
The following refers to private members only.
If I derive a class (say Derived) from another class (let's call it Base), then:
- I can access and use the Base private variables from Derived - which means their access modifier is actually equivalent to protected - not a problem.
- I can override private member functions (as if they were only protected), and get the derived behavior through a Base@ pointer/handle, but I can't call private Base functions from Derived, not even the one that is being overridden, not even from the overriding method. Now that is a strange language design decision to make, and that is the problem.
Anyway, I figured, since Derived can freely access member variables, maybe I could use funcdefs to work around this - the idea was to define a funcdef type, declare a private function pointer in Base, initialize it to point to the private Base member method, and then use it from Derived to make the call...
However, it appears that you can't assign a member method to a function pointer, private or public.
I tried:
@funcPtr = @MemberMethod;
@funcPtr = @Base::MemberMethod;
@funcPtr = @(Base::MemberMethod);
Hell I even tried declaring it like this, hoping for something like C++ member function pointer declaration, knowing it's a long shot:
funcdef void Base::FuncdefType();
None of this works.
So, was anyone able to successfully create a funcdef that points to a member function? And if so, could you share how?
Also, anyone tried using namespaces in AngelScript? Are they just namespaces, or are akin to Java packages? It just occurred to me, maybe they can be used to accomplish this, if they support namespace-level private members...
P.S. Another question: IIRC, quite some time ago, Thomas posted something on the blog about using MapView to reload the script along with the map and check the scripts validity that way, by simply pressing the reload button, thus avoiding the (I must say) vicious cycle of (make a stupid syntax error)->(boot up the game)->(load level)->(game crashes)->(read message box)->(do it again)...
Is there a setting in the mapview.cfg to enable this, or something like that? As far as I can tell, map view does not load scripts at all?
Thanks anyway.