Fix BaseMapObject::isOnMap, and rearrange source code