Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/19/24 18:45
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, Ayumi, kzhao, 7th_zorro), 739 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 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 | chip programmers | 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