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

Function register_birthday

plugins/timestream.cpp:137–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135static const int32_t TICKS_PER_YEAR = 403200;
136
137static void register_birthday(df::unit * unit) {
138 int32_t btick = unit->birth_time;
139 if (btick < 0 || btick > TICKS_PER_YEAR)
140 return;
141 if (birthday_triggers.size() <= (size_t)btick)
142 birthday_triggers.resize(btick+1, INT32_MAX);
143 for (int32_t tick=btick; tick >= 0; --tick) {
144 if (birthday_triggers[tick] > btick)
145 birthday_triggers[tick] = btick;
146 else
147 break;
148 }
149}
150
151static void refresh_birthday_triggers() {
152 birthday_triggers.clear();

Callers 2

on_new_active_unitFunction · 0.85

Calls 2

sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected