Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,038 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
create one struct child of ENTITY #156168
09/21/07 20:52
09/21/07 20:52
Joined: Aug 2006
Posts: 78
A
amadeu Offline OP
Junior Member
amadeu  Offline OP
Junior Member
A

Joined: Aug 2006
Posts: 78
Hallo

I would like to create one struct child of ENTITY because I want to create more parameters in the ENTITY.
I tryed create this struct but did nor work:
typedef struct OBJECTS {
var number;
char *node;
struct ENTITY* parent;
} OBJECTS;

Some body could help me?

Re: create one struct child of ENTITY [Re: amadeu] #156169
09/21/07 22:04
09/21/07 22:04
Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
T
TWO Offline

Serious User
TWO  Offline

Serious User
T

Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
typedef struct
{
var number;
char *node;
ENTITY* parent;
} OBJECTS;

Re: create one struct child of ENTITY [Re: TWO] #156170
09/22/07 08:17
09/22/07 08:17
Joined: Aug 2006
Posts: 78
A
amadeu Offline OP
Junior Member
amadeu  Offline OP
Junior Member
A

Joined: Aug 2006
Posts: 78
hi

I created this struct but the follow code did not work becouse my Struct did not inherit from ENTITY: I would like tho create one struct with more parameters from Entity struct.
typedef struct
{
var number;
char *node;
ENTITY* parent;
} OBJECTS;

OBJECTS* av1;
void main()
{
video_mode = 7;
video_screen = 2;
level_load("VAH.wmb");
wait(2);
av1 = ent_create("av2all.mdl", vector(-175,101,0), NULL);
av1.number = 1;
av1.pan = 180; /// don“t work /////
}

the error said " pan is not a member from OBJECTS"

What is wrong in my code?

Re: create one struct child of ENTITY [Re: amadeu] #156171
09/22/07 08:42
09/22/07 08:42
Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
T
TWO Offline

Serious User
TWO  Offline

Serious User
T

Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
There's no native inherition in Lite-C, you have to use sth like this:

Code:

typedef struct
{
var number;
char *node;
ENTITY* parent;
} OBJECTS;

OBJECTS* av1;
void main()
{
video_mode = 7;
video_screen = 2;
level_load("VAH.wmb");

wait(2);

av1 = new(OBJECTS); // Reserve memory for the struct

av1.parent = ent_create("av2all.mdl", vector(-175,101,0), NULL);
av1.number = 1;
av1.parent.pan = 180;
}



Re: create one struct child of ENTITY [Re: TWO] #156172
09/22/07 08:53
09/22/07 08:53
Joined: Aug 2006
Posts: 78
A
amadeu Offline OP
Junior Member
amadeu  Offline OP
Junior Member
A

Joined: Aug 2006
Posts: 78
Hi

There is one problem:

av1 = new(OBJECTS); // Reserve memory for the struct

The "new" function did not work.

How is the code for "new" function?

Re: create one struct child of ENTITY [Re: amadeu] #156173
09/22/07 08:57
09/22/07 08:57
Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
T
TWO Offline

Serious User
TWO  Offline

Serious User
T

Joined: Jan 2006
Posts: 1,829
Neustadt, Germany

Re: create one struct child of ENTITY [Re: TWO] #156174
09/22/07 09:11
09/22/07 09:11
Joined: Aug 2006
Posts: 78
A
amadeu Offline OP
Junior Member
amadeu  Offline OP
Junior Member
A

Joined: Aug 2006
Posts: 78
Ok

thx,

It works.


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