Sign in to follow this  
deftware

Retrieving Offset to a Member of a Struct..

Recommended Posts

Hey there. I'm trying to write a scripting engine and I seem to have all the crazies worked out except for determining the offset to a member of a struct.. eg:
struct s_ent
{
   float origin[3], velocity[3];
   float rgb[3];
   int movetype, solidtype;
};

s_ent fakeentity;
int movetype_offset = &fakeentity.movetype - &fakeentity;

but is there a way to do it without creating fakeentity ?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this