HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Game Cache Question

10-19-2006, 11:55 AM#1
RaveEye
Hi Wc3

I had never really worked with game cache. I know how they work, but never really used them.
Im making a equipment system, and need to store alot of value's. So my question is:

Can I use Game Cache to store/restore them? Is it fast enouqh? and does it leak?
10-19-2006, 12:16 PM#2
iNfraNe
Sure, you can use GC. If it isnt used 874593 times every second it is surely fast enough too. If you dont flush the values after you dont use them anymore it will leak yes.
10-19-2006, 12:27 PM#3
RaveEye
What do you mean with flush? and thanks
10-19-2006, 12:34 PM#4
Rising_Dusk
call FlushHandleLocals(SomeHandleUnitType) That flushes a mission key, which is the key to which values are stored to the GC.
That is also assuming you plan to use KaTTaNa's Handles.

For direct application of GC natives these are the natives --
Collapse JASS:
// Will return 0 if the specified value's data is not found in the cache
native  GetStoredInteger        takes gamecache cache, string missionKey, string key returns integer
native  GetStoredReal           takes gamecache cache, string missionKey, string key returns real
native  GetStoredBoolean        takes gamecache cache, string missionKey, string key returns boolean
native  GetStoredString         takes gamecache cache, string missionKey, string key returns string
native  RestoreUnit             takes gamecache cache, string missionKey, string key, player forWhichPlayer, real x, real y, real facing returns unit

native  HaveStoredInteger        takes gamecache cache, string missionKey, string key returns boolean
native  HaveStoredReal           takes gamecache cache, string missionKey, string key returns boolean
native  HaveStoredBoolean        takes gamecache cache, string missionKey, string key returns boolean
native  HaveStoredUnit           takes gamecache cache, string missionKey, string key returns boolean
native  HaveStoredString         takes gamecache cache, string missionKey, string key returns boolean

native  FlushGameCache          takes gamecache cache returns nothing
native  FlushStoredMission      takes gamecache cache, string missionKey returns nothing
native  FlushStoredInteger      takes gamecache cache, string missionKey, string key returns nothing
native  FlushStoredReal         takes gamecache cache, string missionKey, string key returns nothing
native  FlushStoredBoolean      takes gamecache cache, string missionKey, string key returns nothing
native  FlushStoredUnit         takes gamecache cache, string missionKey, string key returns nothing
native  FlushStoredString       takes gamecache cache, string missionKey, string key returns nothing
You'll notice those flush natives, those flush stored values in the cache so that they do not continue to take up unnecessary space in your map. (AKA so they don't leak)

This is a link to the basis of KaT's handle functions should you choose to use them.
They make the most sense to a GC beginner if you ask me.

This is a link to a tutorial on how to use them in case you're confused.

Hopefully that explained enough.
10-19-2006, 12:56 PM#5
RaveEye
Thanks so much for taking your time...