write_wrp (CWrp::File8WVR)

    # File ../lib/roller/CWRP.rb, line 464
      def write_wrp(stream)
        stream.binmode

        writer = BinaryWriter.new(stream)

        stream.write ARMA_MAGIC

        # Derive the array sizes.
        writer.write_uint32 @texture_index[0].size
        writer.write_uint32 @texture_index.size
        writer.write_uint32 @terrain_height[0].size
        writer.write_uint32 @terrain_height.size
        writer.write_float @texture_cell_size

        reset_progress 'Exporting WRP (terrain)', @terrain_height.size

        @terrain_height.each do |row|
          writer.write_float row
          increment_progress
        end

        reset_progress 'Exporting WRP (textures)', @textures.size
        @texture_index.each do |row|
          writer.write_uint16 row
        end

        # Save textures.
        writer.write_uint32(@textures.size)
        @textures.each do |texture|
          texture.write(writer, stream)
          increment_progress
        end

        # Save objects.
        reset_progress 'Exporting WRP (objects)', @objects.size / OBJECTS_PER_PROGRESS
        @objects.each_with_index do |object, index|
          object.write(writer, stream)
          increment_progress if index.modulo(OBJECTS_PER_PROGRESS) == 0
        end
      end