• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Struct saving in gamecache?

Status
Not open for further replies.
Level 12
Joined
May 21, 2009
Messages
994
So I'm creating a single player campaign which consist of 5 maps (Diablo II Recreation) the thing is, I'm wondering if you:

JASS:
struct mystruct
real r
static method create takes real r returns mystruct
local mystruct = mystruct.allocate()
set .r = r
endmethod
endstruct
then if I call:
JASS:
local mystruct m = mystruct.create(3.)
call SaveInteger(gamecache, "1", "2", m)
will it then transfer the real (3.) to the map that I'm loading the gamecache in? so I can get the struct via GetStoredInteger(gamecache, "1", "2", m)?
 
Level 12
Joined
May 21, 2009
Messages
994
No, this would only transfer the struct index. Struct instance variable members are global arrays where the struct index variable would represent the index for these arrays.

And SaveInteger is from hashtable.

Thanks for the response, I dunno why but I edited it to StoreInteger() long time ago. Also I mad GetStoredInteger() in jass tags, also Dr.Super.Good and myself replied to this some time ago. I dunno why all this have been "deleted". But thanks for the explanation of structs. It is useful to know how they work when you use them yourself. :)
 
Status
Not open for further replies.
Top