• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

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 StoreInteger(gamecache, "1", "2", Struct)
will it then transfer the real (3.) to the map that I'm loading the gamecache in? so I can get the struct via
JASS:
GetStoredInteger(gamecache, "1", "2", m)
?
 

Dr Super Good

Spell Reviewer
Level 65
Joined
Jan 18, 2005
Messages
27,296
Logically no, you do not understand how structs work.

Structs are nothing more than a parallel arrays. The struct reference is an integer to the array index. Thus storing the index will not store the data at that index in the array. Furthermore, structs need not be regenerated at the same index. Thus storing the index is pointless.
 
Level 12
Joined
May 21, 2009
Messages
994
Logically no, you do not understand how structs work.

Structs are nothing more than a parallel arrays. The struct reference is an integer to the array index. Thus storing the index will not store the data at that index in the array. Furthermore, structs need not be regenerated at the same index. Thus storing the index is pointless.

I was kinda sure it couldn't, just wanted to be sure. Thanks.
 
Status
Not open for further replies.
Top