• It's time to dig through Hive's model database and dust off some oldie but goldie models and enter Hive's Texturing Contest #31 : Repurposing! Click here to enter!
  • 🏆 Hive's 5th HD Modeling Contest: Creep Camp is now open! Click here to enter!

Struct saving in gamecache?

Level 12
Joined
May 21, 2009
Messages
996
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
996
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. :)
 
Top