View Single Post
Old 10-02-2007, 04:27 PM   #11
Silvenon
User
 
Silvenon's Avatar
 
Join Date: May 2007
Posts: 492

Submissions (1)

Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)

Send a message via MSN to Silvenon
Default

Pyro,

Collapse JASS:
function SetCSData takes handle h, integer v returns nothing
    local integer i=CS_H2I(h)-0x100000
    if (i>=8191) then
        call StoreInteger(cs_cache,"csdata",I2S(i),v)
    else
        set cs_array3[i]=v
    endif
endfunction

function GetCSData takes handle h returns integer
    local integer i=CS_H2I(h)-0x100000
    if (i>=8191) then
    //can't use Get without Set
        return GetStoredInteger(cs_cache,"csdata",I2S(i))
    endif
    return cs_array3[i]
endfunction

Seems to me that they are both using game cache......but I'll listen to your advice.

Quote:
Hopefully InitBlizzard gets called before custom globals are initialized.

Hopefully...... :)

I'm going to update the tutorial in about an hour or two.

EDIT1: Whoops, I just saw the functions again, they use the game cache only if the index is higher than the maximum, sorry :)

EDIT2: *Edited

Guys, this tutorial editing is starting to get kinda hard:
  • in the beginning I said that CSCache is required, and in the end it turned up like it's actually not required
  • I don't have WE to test these codes, so I'm gonna have to trust your error-finding skills
....and some more I can't think of right now.

Did I do the single timer usage correctly? Is there a more efficient solution than a onDestroy method in the part when I'm destroying the structs? Is there something I could've done better/simpler?

Thanks again for the suggestions.
Silvenon is offline   Reply With Quote