public int tileStrToID (String tilestr) {
        if (tilestr == null) return 0;
        switch (tilestr.length()) {
            case 0:
                return 0;
            case 1:
                return (int) tilestr.charAt(0);
            case 2:
                return (int) tilestr.charAt(0)
                       + (int) tilestr.charAt(1) * 256;
            case 3:
                return (int) tilestr.charAt(0)
                       + (int) tilestr.charAt(1) * 256
                       + (int) tilestr.charAt(2) * 256 * 256;
            case 4:
                return (int) tilestr.charAt(0)
                       + (int) tilestr.charAt(1) * 256
                       + (int) tilestr.charAt(2) * 256 * 256
                       + (int) tilestr.charAt(3) * 256 * 256 * 256;
            default:
                System.out.println(
                        "Warning: string '" + tilestr + " has wrong size.");
                // XXX no reference to dbg
                // dbgPrint("Warning: string '"+tilestr+" has wrong size.");
                return 0;
        }
    }