public int addTile(Tile t) {
        if (t.getId() < 0)
            t.setId(tiles.size());

        if (tileDimensions.width < t.getWidth())
            tileDimensions.width = t.getWidth();

        if (tileDimensions.height < t.getHeight())
            tileDimensions.height = t.getHeight();

        tiles.add(t);
        t.setTileSet(this);

        return t.getId();
    }