Inheritance of objects

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Inheritance of objects

Re: Inheritance of objects

by Apeirogon » Wed Jan 09, 2019 10:24 am

I just misunderstood what it contain, when first time seen it in use in some mod.

Re: Inheritance of objects

by Graf Zahl » Wed Jan 09, 2019 4:27 am

If an array is called All*ACTOR*Classes, why do you expect non-actors to be in there?

Re: Inheritance of objects

by Apeirogon » Tue Jan 08, 2019 1:59 pm

All actor classes array contains only actors and descendants.
That not that obvious. I mean, this is zscript, which already have much non obvious (undocumented, more precisely) things.

Re: Inheritance of objects

by Graf Zahl » Tue Jan 08, 2019 4:47 am

The name AllActorClasses already tells by its name what it contains. Its a partial sublist of the full class list for looking up actors. The full list can be found in AllClasses.

Re: Inheritance of objects

by Player701 » Tue Jan 08, 2019 4:39 am

The AllActorClasses array seems to contain only classes inherited from Actor. Which, if you think about it, is kind of logical. Your class "object_name", however, is not inherited from Actor, so it's not included in the array. That's why your code doesn't print anything.

Inheritance of objects

by Apeirogon » Mon Jan 07, 2019 3:45 pm

So, looks like "is" keyword applied to object type class dont return true when it should.
For example

Code: Select all

	size = allactorclasses.size();

	for(int i = 0; i < size; i++)
	{
		if(allactorclasses[i] is "object_name")
		{
			console.printf("is works");				
		}
	}

somewhere else

class object_name
{}
dont print in console anything.
So is there are any other way to check inheritance of object like classes? Or I do something wrong?

What I need in this case, return all objects inherited from another base class object for some function, which contains some pointers to cvars which can not be returned to that functions in other ways.

Top