# File ../lib/roller/CWRP.rb, line 533
  def write_object_template(stream)
    extension_pattern = /\.p3d$/
    @objects.each_with_index do |obj, index|
      if obj.valid?
        pos = obj.position

        z = if is_arma? then
          # Assume that object is at 0 AGL, since we can't calculate accurate
          # AGL from ArmA WRPs due to the terrain-smoothing.
          0
        else
          # ASL of object - ASL of ground.
          pos.z # - height_at(pos.x, pos.y)
        end

        stream.printf("\"%s\";%.2f;%.2f;%.2f;%.3f;\n",
          obj.name.sub(extension_pattern, '').downcase,
          pos.x, pos.y, z, obj.dir)
      end

      increment_progress if index.modulo(OBJECTS_PER_PROGRESS) == 0
    end

    @objects.size
  end