Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (Ayumi), 1,170 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 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 | 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