Just to be sure, if you call IsLive() on a dead unit, the unitID gets set to 0, right?
// Untested pseudo codeint _Unit::IsLive(){ if (this->unitIndex == 0) return FALSE; Unit* unit = map.unit[this->unitIndex]; if ((unit->next != -1) && ((unit->flags & IsDeadFlag) == 0)) return TRUE; this->unitIndex = 0; // ** Clear unitIndex to 0 return FALSE;}