public static int objectAtTile(String name, Coord tile) {
        Coord my = MapView.tilify(tile);
        double min = 5;
        Gob min_gob = null;

        synchronized (glob.oc) {
            for (Gob gob : glob.oc) {
                double len = gob.position().dist(my);
                boolean m = ((name.length() > 0 && gob.resname().contains(name)) || name
                        .length() < 1);
                if ((m) && (len < min)) {
                    min = len;
                    min_gob = gob;
                }
            }
        }
        if (min_gob != null)
            return min_gob.id;
        else
            return 0;
    }