Skip to content

Commit 6162a1b

Browse files
committed
simplify coverage recording
1 parent 1ab9c17 commit 6162a1b

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

timestream.lua

+7-11
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ local function clamp_coverage(timeskip)
138138
end
139139

140140
local function record_coverage()
141-
local coverage_slot = (df.global.cur_year_tick+1) % 50
141+
local coverage_slot = df.global.cur_year_tick % 50
142142
if DEBUG >= 3 and not tick_coverage[coverage_slot] then
143143
print('recording coverage for slot:', coverage_slot)
144144
end
@@ -171,8 +171,7 @@ local function clamp_timeskip(timeskip)
171171
local next_tick = df.global.cur_year_tick + 1
172172
timeskip = math.min(timeskip, get_next_trigger_year_tick(next_tick)-next_tick)
173173
timeskip = math.min(timeskip, get_next_birthday(next_tick)-next_tick)
174-
timeskip = math.min(timeskip, clamp_coverage(timeskip))
175-
return timeskip
174+
return clamp_coverage(timeskip)
176175
end
177176

178177
local function increment_counter(obj, counter_name, timeskip)
@@ -334,7 +333,9 @@ local function adjust_activities(timeskip)
334333
end
335334
end
336335

337-
local function on_tick_impl()
336+
local function on_tick()
337+
record_coverage()
338+
338339
if df.global.cur_year_tick % 10 == 0 then
339340
season_tick_throttled = false
340341
if df.global.cur_year_tick % 1000 == 0 then
@@ -368,8 +369,8 @@ local function on_tick_impl()
368369
timeskip_deficit = math.min(desired_timeskip - timeskip, 100.0)
369370

370371
if DEBUG >= 2 then
371-
print(('cur_year_tick: %d, timeskip: (%d, +%.2f)'):format(
372-
df.global.cur_year_tick, timeskip, timeskip_deficit))
372+
print(('cur_year_tick: %d, real_fps: %d, timeskip: (%d, +%.2f)'):format(
373+
df.global.cur_year_tick, real_fps, timeskip, timeskip_deficit))
373374
end
374375
if timeskip <= 0 then return end
375376

@@ -380,11 +381,6 @@ local function on_tick_impl()
380381
adjust_activities(timeskip)
381382
end
382383

383-
local function on_tick()
384-
on_tick_impl()
385-
record_coverage()
386-
end
387-
388384
------------------------------------
389385
-- hook management
390386

0 commit comments

Comments
 (0)