Gamestudio Links
Zorro Links
Newest Posts
NOMAX undeclared identifier.
by Petra. 01/09/26 21:12
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 01/07/26 15:14
Zorro locks DLL
by jcl. 01/07/26 13:33
zorro with ccxt?
by qin. 01/07/26 07:50
The new evaluation system
by jcl. 01/05/26 08:50
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (qin), 3,583 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Namitha_NN, Syndrela, agasior, mosfet, MonsterX
19188 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