Call enemy:on_dead() after the enemy is removed from the map.

This way, map:has_entities(prefix) gives the natural result.
Fix doxygen errors.