Gamestudio Links
Zorro Links
Newest Posts
Zorro version 3.0 prerelease!
by Grant. 02/24/26 22:21
WFO Training with parallel cores Zorro64
by Martin_HH. 02/24/26 19:51
ZorroGPT
by TipmyPip. 02/23/26 21:52
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
0 registered members (), 5,796 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
alx, ApprenticeInMuc, PatrickH90, USER0328, Sfrdragon
19199 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
sending a struct #291853
09/28/09 14:23
09/28/09 14:23
Joined: Jul 2005
Posts: 3
Deutschland
J
Janemann Offline OP
Guest
Janemann  Offline OP
Guest
J

Joined: Jul 2005
Posts: 3
Deutschland
Hey,
i'm having trouble sending a whole struct with send_var(_player). it contains a STRING* pointer wich is losing its value.

the struct kinda looks like this:

typedef struct {
var id;
STRING* name;
var x;
var y;
var z;
} PL;

PL _player;

but by sending every element seperately like:

send_string(_player.name);
send_var(_player.id);
//...

the engine cashes. It only works for the first element of the struct.

can anybody help me?

Re: sending a struct [Re: Janemann] #291863
09/28/09 15:11
09/28/09 15:11
Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
GorNaKosh Offline
Junior Member
GorNaKosh  Offline
Junior Member

Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
Hm I think the problem could be that if you initialize the struct there are reserved 4bytes for a String-pointer only. Try with
Code:
typedef struct {
STRING name;
//...
} PL;

//or better to controle/optimize the struct size
typedef struct {
char name[20];
//...
} PL;



hope it helps
Gor Na Kosh

Last edited by GorNaKosh; 09/28/09 15:55.
Re: sending a struct [Re: GorNaKosh] #291891
09/28/09 18:52
09/28/09 18:52
Joined: Jul 2005
Posts: 3
Deutschland
J
Janemann Offline OP
Guest
Janemann  Offline OP
Guest
J

Joined: Jul 2005
Posts: 3
Deutschland
thanks! im gonna give it a try. i'm glad to see c-style strings are supported in lite-c

Re: sending a struct [Re: Janemann] #291901
09/28/09 19:35
09/28/09 19:35
Joined: Jul 2005
Posts: 3
Deutschland
J
Janemann Offline OP
Guest
Janemann  Offline OP
Guest
J

Joined: Jul 2005
Posts: 3
Deutschland
jap, works laugh


Moderated by  HeelX, Spirit 

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