Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, The_Judge, Grant), 898 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Placing a struct into a var #257468
03/23/09 13:27
03/23/09 13:27
Joined: Mar 2002
Posts: 30
Arizona
Jabantiz Offline OP
Newbie
Jabantiz  Offline OP
Newbie

Joined: Mar 2002
Posts: 30
Arizona
I would like to place a struct into an entity skill to retrieve for use later. Is this possible at all? I want to achieve an effect like handle() and ptr_for_handle(). Or is there another way to store entity specific structs for later use?

Re: Placing a struct into a var [Re: Jabantiz] #257471
03/23/09 13:56
03/23/09 13:56
Joined: Mar 2009
Posts: 112
Germany
K
KDuke Offline
Member
KDuke  Offline
Member
K

Joined: Mar 2009
Posts: 112
Germany
Hi Jabantiz,

you could simply put the pointer-value of the struct into an entity-skill!
It's made like this:
Code:
MYSTRUCT entStruct =
{
   whatever;
   whatever;
}

myEntity.skill99 = &entStruct.


Though personally (if you have more than one entity which needs a specific struct) I would simply put an entity definition into the struct.
Code:
typedef struct
{
   whatever;
   whatever;
   ENTITY* myEntity;
} ENTWITHSTRUCT;


greetings
KDuke

EDIT: I forgot to mention that you access the struct then the following way:
Code:
MYSTRUCT* tempStruct = (MYSTRUCT*)myEntity.skill99;
tempStruct->structMember = whatever;


Last edited by KDuke; 03/23/09 13:59.

Using A7 Free
Click and join the 3dgs irc community!
Room: #3dgs
Re: Placing a struct into a var [Re: KDuke] #257606
03/24/09 09:18
03/24/09 09:18
Joined: Mar 2002
Posts: 30
Arizona
Jabantiz Offline OP
Newbie
Jabantiz  Offline OP
Newbie

Joined: Mar 2002
Posts: 30
Arizona
Thanks this works great and is just what I needed.

Re: Placing a struct into a var [Re: Jabantiz] #257610
03/24/09 10:01
03/24/09 10:01
Joined: Mar 2009
Posts: 112
Germany
K
KDuke Offline
Member
KDuke  Offline
Member
K

Joined: Mar 2009
Posts: 112
Germany
No problem, glad to be of help!

greetings
KDuke


Using A7 Free
Click and join the 3dgs irc community!
Room: #3dgs

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