Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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
1 registered members (AbrahamR), 717 guests, and 4 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
Handles for C structs #433491
11/30/13 13:19
11/30/13 13:19
Joined: Mar 2010
Posts: 120
Switzerland
T
TehV Offline OP
Member
TehV  Offline OP
Member
T

Joined: Mar 2010
Posts: 120
Switzerland
Hi,
I have a program that makes use of custom C structs. It requires that every entity has two instances of these structs assigned to it at any given time. I create instances of these structs at runtime using malloc() (it is required I do this). Ideally, I would like to store handles to these instances in the entitys skills.

I've read in the documentation that handle() and ptr_for_handle() only works for engine objects, and that I should use pVars for everything else.

On the page for pVars it says that pVars has no meaning for objects created through malloc().

My question is, how can I store instances of my custom structs in entity skills? Is it possible at all?

Re: Handles for C structs [Re: TehV] #433496
11/30/13 13:53
11/30/13 13:53
Joined: Apr 2006
Posts: 159
Latvija
Arrovs Offline
Member
Arrovs  Offline
Member

Joined: Apr 2006
Posts: 159
Latvija
just say ent.skill[0] = (var)mystruct;
and it vill store pointer in it;

Mystruct* mystruct = (Mystruct*)ent.skill[0];


Last edited by Arrovs; 11/30/13 13:53.

Arrovs once will publish game
Re: Handles for C structs [Re: Arrovs] #433566
12/02/13 17:03
12/02/13 17:03
Joined: Mar 2010
Posts: 120
Switzerland
T
TehV Offline OP
Member
TehV  Offline OP
Member
T

Joined: Mar 2010
Posts: 120
Switzerland
Oh, great! Thanks!


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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