reference system to stop segfault when gather target is removed

Use a reference class instead of a pointer to a targeted object. there was no way to tell if the unit pointed at was deleted. If the target is removed from the game now, the reference can indicate this.