Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by dr_panther. 05/18/24 11:01
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (7th_zorro, dr_panther), 724 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: ENTITIES into array [Re: WretchedSid] #343239
10/04/10 17:22
10/04/10 17:22
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
You CAN turn the auto-nulling ON, buts as JustSid said, it costs CPU.
Because then ANY new variable (both global and locals) will then requires CPU cycles to auto-null it.

To turn it on, insert this line VERY early in your script. By preferance, just after your #include "acknex.h" or "lite-c.h".
Code:
#define PRAGMA_ZERO

(Check under "#define" in the manual)


... hmmm ... looks like its only for local variables, and not globals as I thought ...
Ah well, give it a try anyway, it may just be a glitch in the manual regarding globals...


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: ENTITIES into array [Re: EvilSOB] #343245
10/04/10 18:04
10/04/10 18:04
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Wow, I didn't knew that Lite-C has a solution for this. Amazing.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: ENTITIES into array [Re: WretchedSid] #343255
10/04/10 19:28
10/04/10 19:28
Joined: Apr 2009
Posts: 33
Germany
B
Bunsen Offline
Newbie
Bunsen  Offline
Newbie
B

Joined: Apr 2009
Posts: 33
Germany
Global and static variables are nulled automatically by the compiler. This does
not cost any CPU cycles because they are stored as placeholders within the executable. The more global variables the bigger the EXE.

Local variables on the other side are created at runtime.

Re: ENTITIES into array [Re: Bunsen] #343257
10/04/10 19:54
10/04/10 19:54
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Kewl, thanks Bunsen.

That explains why the manual says "PRAGMA_ZERO" is for locals.

But does that also apply to an array of pointers, as this thread is about?

ie a global array of pointers declared with
Code:
ENTITY* BULLET[...];

I honestly dont know, so I await your answer....


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: ENTITIES into array [Re: EvilSOB] #343265
10/04/10 20:38
10/04/10 20:38
Joined: Apr 2009
Posts: 33
Germany
B
Bunsen Offline
Newbie
Bunsen  Offline
Newbie
B

Joined: Apr 2009
Posts: 33
Germany
Yes EvilSOB, it does also apply to an array of pointers.
You may try this:

ENTITY* BULLET[10];

void main()
{
int i;
for (i=0; i<10; i++)
printf("Bullet[%d] = %d", i, BULLET[i]);
}

By the way, what is the meaning of "Kewl"?

Re: ENTITIES into array [Re: Bunsen] #343269
10/04/10 21:23
10/04/10 21:23
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Thanks, but no need to try.
I had noticed this result, but never trusted it till now.

And "kewl" == "Cool" spelt really badly...


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Page 2 of 2 1 2

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1