Gamestudio Links
Zorro Links
Newest Posts
contractUpdate() is filtering if >2 rows
by mistery. 11/09/26 12:06
New Zorro version 3.15
by jcl. 11/09/26 09:24
Removing outliers from files
by jcl. 11/04/26 10:30
[MED] Import from FBX (2010) missing!!!
by rayp. 11/03/26 14:33
What are you working on?
by rayp. 11/02/26 13:57
No connection to MT4
by JeyKey II. 10/29/26 09:34
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (BrainSailor), 20,576 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
MaliceTheMaker, Haitao_Ren, JimSimons, julienp, julienper
19248 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 | 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