HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

ghost Id question

08-08-2009, 05:29 PM#1
Flame_Phoenix
Hi guys, I was wondering on one of my first spells and I read this comment:

Quote:
//It also prevents conflicts with units getting the same handle id as a ghost,
//however, since you flush when the spell ends that's most likely not an issue.

At first I thought I knew what a ghost id was, but know I am really confused.
Can some one please explain me or give me a definition of a ghost id? When is an id a ghost and why?
08-09-2009, 06:10 PM#2
Flame_Phoenix
I am sure someone out there knows the answer to this question .... but is to busy to do so ...
so Bump...

Please don't make me ask Griffen, he will say I am a noob xD
08-09-2009, 06:12 PM#3
Troll-Brain
Without the associated code it's not such easy to give a good answer.
08-09-2009, 06:13 PM#4
Rising_Dusk
Read the referenced text and post in this thread.
08-09-2009, 07:42 PM#5
Flame_Phoenix
My problem is the following:
- I have a spot of creeps. In that spot I save unit in Table. However a user can remove one of those units at any time or the unit can die. What if I access Table with a unit dead, will I have a ghost id?

Thx for the thread Dusk, I read until page 4/5 but it didn't help much.

This question is not related to any specific code, I just need to understand the definition.
08-09-2009, 08:13 PM#6
Anitarf
Table can't store units...
08-09-2009, 08:27 PM#7
Rising_Dusk
Flame, then you have no problem. The terminology "ghosting" or "ghost index" or "ghost unit" refers to a unit inside of a group that has been removed, but leaves behind a ghost of itself that will cause errors with FirstOfGroup() loops called on that group. This is where GroupRefresh in GroupUtils comes in very handy, because it cleans the group of any shadow references.

So no, you won't have any problem.
08-09-2009, 09:58 PM#8
chobibo
Ghost index = reference to a non-existing handle

Collapse JASS:

globals
    unit ref
endglobals

function test takes nothing returns nothing
    set ref = CreateUnit(Player(0), 'hfoo', 0, 0, 0)
    call RemoveUnit(ref)
endfunction

// ref is now a ghost reference since it's pointing to a non-existing handle
08-09-2009, 10:14 PM#9
Flame_Phoenix
Mmmm My creep spot system use groups to store the creeps. I also allow the user to remove units by hidding them and then killing them. Is this an issue?
08-09-2009, 10:34 PM#10
Rising_Dusk
If you think it is, GroupRefresh will fix the issue.