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,631 guests, and 7 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
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