HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Finding the address of arrays

10-02-2007, 03:09 AM#1
Strilanc
Suppose I have:

Code:
globals
  integer array ii
endglobals

Can I find the address of ii? Can I modify elements in it without explicitly stating "ii[x] = i"?

I tried setting some of the values and searching the address space for them using GetLocationX and I2H, but no luck. I either couldn't find them, or looked too far and took the game down.
10-02-2007, 03:25 AM#2
Pyrogasm
No and No, as far as I know, which may not be very far.
10-02-2007, 07:04 AM#3
cohadar
No. Definitely.
10-02-2007, 08:47 AM#4
grim001
dont you just want a pointer to the array? in that case make it a struct.
10-02-2007, 08:53 AM#5
Malf
I have this problem too, suppose there are X instances of my struct and I have to get a pointer to the last struct. What should I do? (I know I can attach them to handles, but I can't use them)

Collapse JASS:
function IWillDestroyTheLastStructEvery10Seconds takes nothing returns nothing
    call struct.destroy(GetLastStruct()) //????
endfunction

function blah takes nothing returns nothing
local struct d = struct(GetAttachedInt(GetExpiredTimer(), "struct"))// ???
    ...
        do something with the struct
    ...
endfunction

function blarg takes nothing returns nothing
local struct d = struct.create()
    call TimerStart(CreateTimer(), 1., false, function blah)
endfunction
10-02-2007, 09:22 AM#6
Blackroot
You need to make a count of your iterations;
Code:
globals
 something array g
 integer gn = 0
endglobals

//code
 set something[1] = pies
 set gn = gn + 1

You have to actualy keep track, you can make a nested struct with methods to access your elements which does it for you, but you cannot get a *real* pointer in any form or method of any kind in wc3. You cannot directly access the data, you just get to use functions to alter it indirectly.
10-02-2007, 09:44 AM#7
Tide-Arc Ephemera
Something that's not particularly efficient but could work is to simply go through every array and search for the expected results, but that could turn out crappy and buggy.
10-04-2007, 02:20 PM#8
Strilanc
Quote:
Originally Posted by grim001
dont you just want a pointer to the array? in that case make it a struct.

Well the idea was to get around the size limit on an array by having an array of pointers to arrays. Structs with arrays don't get around that.
10-04-2007, 02:36 PM#9
Vexorian
well, it is impossible, fun?
10-04-2007, 03:14 PM#10
cohadar
If you need bigger arrays use EA from my signature.