[No] Implementation of friendly classes in zscript

Moderator: GZDoom Developers

Implementation of friendly classes in zscript

Postby Apeirogon » Sat Nov 09, 2019 8:27 am

As title says.
Since you cant define function outside of a class/struct friendly classes seems more suitable for this than friendly functions.
User avatar
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

Re: Implementation of friendly classes in zscript

Postby phantombeta » Sat Nov 09, 2019 9:53 am

I don't think this is necessary. The OP also isn't very clear on what they want at all. From what I can understand of their post, just the existing static functions should suffice.
User avatar
phantombeta
Tired of being treated like trash by control freaks
 
Joined: 02 May 2013

Re: Implementation of friendly classes in zscript

Postby _mental_ » Sat Nov 09, 2019 10:29 am

This feature is rather questionable. I would like to see a real case when it’s useful.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: Implementation of friendly classes in zscript

Postby Apeirogon » Sat Nov 09, 2019 11:27 am

Use case at current time is very specific. I dont think someone else experience same problem.

I work on a creating graph tree of a level, more specific a star navigation script. I already know, and managed, how create level graph, minimal, or so, spanning three, pathfinding and even custom, and somewhat fast, a_look function.
Problems happens, at least for now, when two neighbors sectors connected together with zigzag like line/any other case when two different sectors can be connected together in more than one way. Nothing too scary, sometimes path creating script pick "wrong" line for actor to move to (actor target in another sector and closer to the (mid)line 1, but script pick line, say, 3, which way more farther from target). And one of the game creator precept is "prevent game from doing silly looking/feeling things, because it breaks immersion"
Its cant be prevented at all due to nature of doom sectors (you cant say "only this specific, and no other, line connect this two sectors"), but of course it can be fixed.

Before I have separate "node" class for creating level graph and separate "pathfinder" to actually find path in it, using special interface to transfers data from nodes to pathfinder.
For now I fix it by combining this two different classes under one shared base "node_base" class and abusing fact that classes who have same ancestor can change protected fields of each other directly, without needing of creating/using public functions.
But it can arise another problem, since someone can inherit from any of those two classes and break all working logic by "nulling"/changing stored in classes pointers so it would produce nonsense results for pathfinding/spanning trees/etc.

As a side note, I want to make it "graph system" as compatible with other gzdoom mods as possible.
User avatar
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

Re: Implementation of friendly classes in zscript

Postby _mental_ » Sat Nov 09, 2019 2:13 pm

I do not understand what was wrong with unrelated node and pathfinder classes.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: Implementation of friendly classes in zscript

Postby Apeirogon » Sun Nov 10, 2019 11:46 am

Sometimes numerations of lines in arrays are broken, which can be fixed outside of the class, because this is a private field.

But looks like inheritance and changing private to protected fix it, since now script which check returned path can change data directly. So it can be closed.
User avatar
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest