Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 02/27/26 22:06
WFO Training with parallel cores Zorro64
by Martin_HH. 02/26/26 16:03
Zorro version 3.0 prerelease!
by TipmyPip. 02/25/26 16:38
Camera always moves upwards?
by clonman. 02/21/26 09:29
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
3 registered members (TipmyPip, Quad, AndrewAMD), 4,941 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
the1, alx, ApprenticeInMuc, PatrickH90, USER0328
19200 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