resize_terrain_grid (CWrp::File8WVR)

    # File ../lib/roller/CWRP.rb, line 911
      def resize_terrain_grid(cell_size)
        valid_cell_sizes = (LEGAL_GRID_SIZES.map { |s| map_size / s })
        unless valid_cell_sizes.include? cell_size
          raise ArgumentError, "Bad requested cell_size, #{cell_size}m. " +
            "Valid sizes for this map would be #{valid_cell_sizes.join(', ')})."
        end

        new_grid_size = map_size / cell_size.to_f

        reset_progress 'Resizing terrain grid', new_grid_size

        # Don't resize if they didn't ask for it.
        unless new_grid_size == terrain_grid_size
          new_grid = Array.new(new_grid_size) do |y|
            y_size = y * cell_size

            row = Array.new(new_grid_size) do |x|
              height_at(x * cell_size, y_size)
            end

            increment_progress

            row
          end

          @terrain_height = new_grid
        end

        nil
      end