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
3 registered members (NewbieZorro, TipmyPip, 1 invisible), 19,045 guests, and 8 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
Question about add_struct() #361133
03/01/11 02:13
03/01/11 02:13
Joined: Aug 2005
Posts: 238
Caermundh Offline OP
Member
Caermundh  Offline OP
Member

Joined: Aug 2005
Posts: 238
I can use add_struct() to mark an area of dynamically allocated memory that will then be saved when calling game_save()with SV_STRUCT.

My question is, once i have marked an area with add_struct, is there any way to unmark it? (say i allocate an area of memory to store an object, then that object is destroyed in game, so i release the memory). If there is no way to un-mark the memory, what happens when i have game_save() save an area of memeory that is no longer valid?

Re: Question about add_struct() [Re: Caermundh] #361140
03/01/11 04:34
03/01/11 04:34
Joined: Aug 2005
Posts: 238
Caermundh Offline OP
Member
Caermundh  Offline OP
Member

Joined: Aug 2005
Posts: 238
Another thing i thought of, if i have the following code:

typedef struct my_struct1
{ var my_var1;
var my_var2;
} my_struct1

typedef struct my_struct2
{ my_var3;
my_var4;
} my_struct2;

typedef struct my_struct3
{ my_var5;
my_var6;
my_struct1* struct1_ptr;
my_struct2* struct2_ptr;
struct my_struct3* next;
}

In order for game_save to save the *entire* my_struct3, i would have to do an add_struct for each of the structs, IE:

add_struct(my_struct3_ptr,sizeof(my_struct3));
add_struct(my_struct2_ptr,sizeof(my_struct2));
add_struct(my_struct1_ptr,sizeof(my_struct1));

is this correct?


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