MCPcopy Create free account
hub / github.com/DFHack/dfhack / clamp_timeskip

Function clamp_timeskip

plugins/timestream.cpp:400–411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

398}
399
400static int32_t clamp_timeskip(int32_t timeskip) {
401 if (timeskip <= 0)
402 return 0;
403 // timeskip cannot be applied when caravans are loading/unloading because we don't know how to jog that timer
404 if (detect_caravans())
405 return 0;
406 int32_t next_tick = *cur_year_tick + 1;
407 timeskip = std::min(timeskip, get_next_trigger_year_tick(next_tick) - next_tick);
408 timeskip = std::min(timeskip, get_next_birthday(next_tick) - next_tick);
409 timeskip = std::min(timeskip, flows_next_required_tick() - next_tick);
410 return clamp_coverage(timeskip);
411}
412
413template <typename FT, typename T>
414static void increment_counter(T *obj, FT T::*field, int32_t timeskip) {

Callers 1

do_cycleFunction · 0.85

Calls 5

detect_caravansFunction · 0.85
get_next_birthdayFunction · 0.85
flows_next_required_tickFunction · 0.85
clamp_coverageFunction · 0.85

Tested by

no test coverage detected