Report abuse


			
require "rubygems"
require "rubygame"
require "rbgooey"
require "yaml"
include Rubygame
TTF.setup

class TestWeirdBug
  def initialize
    @data = UiData.new('data/mapedit.yml')
    @string = []
    @cycle = 0
    @return = 0
    @debug = 0
  end
  def text
    @data.declare(:listing)
    @data.text.add("Listing content in map directory...",0,0)
  end
  def change
    @cycle += 1
    if @cycle == @return
      @cycle = 0
    end
  end
  def process
    @debug += 1
    puts @debug
    n = 1
    limit = 1
    y = 30
    cycle = 0
    @string.each do |s|
      if cycle == @cycle
        @data.text.add("#{n} #{s}",0,y)
        if limit == 10
          if @string.size() > 10
            @data.text.add("And #{3 - @cycle} more down the list.",0,y+30)
          end
          return
        end
        limit += 1
        y += 30
      else
        cycle += 1
      end
      n += 1
    end
  end
  def randomdata
    n = 0
    13.times do
      @string << "Random #{rand(101)}"
      n += 1
    end
    @return = (n - 10) + 1
  end
  def execute
    @data.clear()
    text()
    change()
    process()
  end
end

test = TestWeirdBug.new()
test.randomdata()
loop do
  test.execute()
end