|
Re: How to save the contents of an array, WRS/resource
[Re: jumpman]
#466065
05/23/17 16:22
05/23/17 16:22
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
Both should work, unless you write something like var count = 999999; memcpy(..., 4*count); // or sizeof(var) instead of 4 Then, at least I think so, would the calculation be treated as a var result (because of var times integer) and therefore be limited by the var range (or get negative to be more precise, or positive again but at a number way too low).
Don't write random waits into your code, that does more harm than any good. Everything you write gets executed instantly and in order, and the program only continues after the current instruction or calculation has been finished (in a single threaded program like the default acknex engine). There are (and/ or were) only a few exceptions for which there were reasons or explanations, of course. For example level_load in old acknex versions (like A5, where it was executed not immediately but at the end of the frame => wait(1)), automatic bounding box initialization at the end of the frame for entities created by ent_create (therefore a wait(1) before c_setminmax() on animated models), DirectX initialization at the end of the frame or functions using wait themselves.
In general: Don't use wait unless you really have to, like for default entity loops.
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
Re: How to save the contents of an array, WRS/resource
[Re: jumpman]
#466069
05/23/17 20:44
05/23/17 20:44
|
Joined: Apr 2002
Posts: 1,246 ny
jumpman
OP
Serious User
|
OP
Serious User
Joined: Apr 2002
Posts: 1,246
ny
|
I have changed the arrays to:
int node_to_node[9999999]; // youll see that this is seven 9's!
The reason why I am trying this is to see how many nodes I can make, and how big the paths can get. This int works when my AIs are running around, after the level computes and fills this big array.
But saving the int Array and loading the int Array is where im running into problems again:
memcpy(node_2_nodeCopy_i,node_to_node,9999999); //saving
-------------
memcpy(node_to_node,node_2_nodeCopy_i,9999999); // loading
Do I need to add sizeof() again here? I tried 9999999*4, 9999999*sizeof(int), 9999999*sizeof(var), but none of these copy over correctly. What did I do wrong here?
|
|
|
|