Expose StatNumber as Read Only

Moderator: GZDoom Developers

Post Reply
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Expose StatNumber as Read Only

Post by Major Cooke »

It'd be appreciated if the stat number could be exposed as a read only integer. Right now I have to create multiple iterators based on several stat numbers.

This would allow skipping through entities based on their number:

Code: Select all

int StatSearch = ( STAT_DEFAULT | STAT_PLAYER | STAT_USER );
ThinkerIterator it = ThinkerIterator.Create();
Actor mo;
while (mo = Actor(it.Next())
{
	if (!(mo.StatNumber & (StatSearch)))
		continue;

	// Other code here.
}
Otherwise I'd have to create three separate iterators and that would become messy.
User avatar
AFADoomer
Posts: 1325
Joined: Tue Jul 15, 2003 4:18 pm
Contact:

Re: Expose StatNumber as Read Only

Post by AFADoomer »

Unless I'm misunderstanding what you're asking, three separate iterators might be messy code-wise, but would still be more efficient internally... Especially in levels with high thinker count.

Iterating just through a certain stat number *only* iterates through the thinkers with that specific stat number. The approach you're proposing would iterate through every thinker every time it was called.

Besides that, the statnum is essentially used to tell the engine which list of thinkers to store the actor into... There's no internal int or flag to be exposed - I'm pretty sure that "retrieving" the statnum would involve searching each of the thinker lists to find which one the actor is in.
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Expose StatNumber as Read Only

Post by Major Cooke »

Three separate iterators I would imagine be laggier on performance versus just one. But since the stat number is indeed not a part of the thinker itself, now that I looked through the source, this suggestion is now useless.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Expose StatNumber as Read Only

Post by Graf Zahl »

Major Cooke wrote:Three separate iterators I would imagine be laggier on performance versus just one.

You imagine wrong. Like AFADoomer said, an iterator that only checks a specific statnum will only check a small number of thinkers and will be fast.
An iterator going over everything will look at every single ticking thinker in the game and may become extremely performance-costly.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”