HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

simple struct question

08-26-2007, 02:59 PM#1
MaD[Lion]
how do i check if a struct has been destroyed.
Example i have an integer i, and i convert it to struct, how do i know the struct at this index is destroyed or not
08-26-2007, 03:10 PM#2
Anitarf
What do you need to know this for?
08-26-2007, 03:31 PM#3
Toadcop
si__MyStructureName_V[My_id]==-1 (this structure is taken)

// learn to read war3map.j -_-
08-26-2007, 05:09 PM#4
Vexorian
low level approaches tend not to be portable

for example that -1 think was changed after weaaddar's suggestion it used not to be like that

if a better allocator is used later then your map might break if you use it directly.

Also: This is good to know if something was destroyed, but if something else was later created your code would get confused.

I think a better way would be not destroying the object, instead using a flag, and then destroy it.

this is mostly like doing a pseudo reference counter...
08-26-2007, 06:48 PM#5
cohadar
Or even better make a recycler for that struct type.

Look at CSSafety to learn how to make recyclers.
08-26-2007, 07:21 PM#6
MaD[Lion]
bah so i cant go the lazy way after all. well fine then ^^