GetStatSize() (ZScript)

Moderator: GZDoom Developers

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

GetStatSize() (ZScript)

Post by Major Cooke »

Simple. A static function that returns the size of a specified stat. If left empty or is some invalid number, defaults to maximum stat + 1 which means it gets the size combined of all stats.
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia
Contact:

Re: GetStatSize() (ZScript)

Post by Marisa the Magician »

What do you mean by "size of a stat"?
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: GetStatSize() (ZScript)

Post by Major Cooke »

How many active thinkers are in a particular stat.

Right now you can only do a while loop until it's all the way over which strikes me as inefficient when just trying to establish how many thinkers are in there -- especially if it's on ZScript's side. Probably much better to have it done on the source if anything, especially if this is done often.
ZippeyKeys12
Posts: 111
Joined: Wed Jun 15, 2016 2:49 pm

Re: GetStatSize() (ZScript)

Post by ZippeyKeys12 »

https://github.com/coelckers/gzdoom/pull/574
Let's see if I fucked anything up, or if Graf doesn't want it in. (Or both)
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: GetStatSize() (ZScript)

Post by Major Cooke »

This was closed.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: GetStatSize() (ZScript)

Post by Graf Zahl »

Major Cooke wrote:especially if this is done often.
You shouldn't do that. If you have to count thinkers in a slot frequently something isn't right. Even natively the engine cannot do anything less than stepping through the entire list and incrementing a counter. This is a very costly operation because it involves several cache misses on the CPU.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”