ruby: better handling of errors in onupdate callbacks

develop
jj 2012-07-11 23:25:55 +02:00
parent b0edb33023
commit d8e55196c2
1 changed files with 3 additions and 1 deletions

@ -38,15 +38,17 @@ module DFHack
@callback.call @callback.call
else else
if year > @minyear or (year == @minyear and yeartick >= @minyeartick) if year > @minyear or (year == @minyear and yeartick >= @minyeartick)
@callback.call
@minyear = year @minyear = year
@minyeartick = yeartick + @ticklimit @minyeartick = yeartick + @ticklimit
if @minyeartick > yearlen if @minyeartick > yearlen
@minyear += 1 @minyear += 1
@minyeartick -= yearlen @minyeartick -= yearlen
end end
@callback.call
end end
end end
rescue
puts_err "onupdate cb #$!", $!.backtrace
end end
def <=>(o) def <=>(o)