Gamestudio Links
Zorro Links
Newest Posts
Training with the R bridge does not work
by frutza. 11/19/25 22:32
ZorroGPT
by TipmyPip. 11/19/25 10:10
MRC.c and WFO
by 11honza11. 11/18/25 15:22
webGL
by Ice2642. 11/17/25 21:27
Camera always moves upwards?
by NeoDumont. 11/17/25 09:56
Future of ZorroHFT
by TipmyPip. 11/16/25 13:52
COT Download with Quandl does not work
by Petra. 11/15/25 09:35
Zorro 2.70
by jcl. 11/15/25 08:43
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (AndrewAMD, Quad), 7,176 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
SkinnyApe, tritom, sheliepaley, Blueguy, blobplayintennis
19179 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Saving and loading of structs #179635
01/24/08 08:23
01/24/08 08:23
Joined: Jan 2007
Posts: 221
F
Fenriswolf Offline OP
Member
Fenriswolf  Offline OP
Member
F

Joined: Jan 2007
Posts: 221
Hello,

according to the manual game_save() can't save pointers in lite-C:
Quote:

SV_POINTERS
saves all pointers (C-Script only). In lite-C, use handles for saving references to objects.




How do I save user defined structs then?
Obviously, handle() works with predefined structs only.


Thanks

Re: Saving and loading of structs [Re: Fenriswolf] #179636
02/15/08 15:38
02/15/08 15:38
Joined: Jul 2005
Posts: 34
Hong Kong
U
ultranet Offline
Newbie
ultranet  Offline
Newbie
U

Joined: Jul 2005
Posts: 34
Hong Kong
Yes, you can save struct.

Before you call game_save(), you must call the add_struct() to add an existing struct to it.

Example:
typedef struct STRUCTURE
{
var a;
int b;
}STRUCTURE;

STRUCTURE* mystruct={a=1; b=2;}

....

void main()
{
...
add_struct(mystruct,sizeof(STRUCTURE));
...
...
game_save("SAVE",1,SV_STRUCT);
}


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