mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-13 03:02:38 +00:00
* Port: fixes of SStimer subsystem from RU SS220 Paradise (#59718) Unobvious problem spot #define BUCKET_POS(timer) (((round((timer.timeToRun - SStimer.head_offset) / world.tick_lag)+1) % BUCKET_LEN)||BUCKET_LEN) With tick_lag equal to 0.1, 0.25, 0.5, rounding of division is normal. But at other values it may be shifted either more or less due to the specifics of floating-point storage and processing. Numbers 0.1, 0.25, 0.5 have blank mantissa, unlike others which lead to numbers such as 245.0000004 when divided. PS: tick_lag is rounded to the first two decimal places. Fixes Rewrote the circular doubly linked list to a regular doubly linked list, because it could cause timers to loop infinitely. Fixed re-creation of a bucket if the timer does not have a callback. Added debug stat indicator RST to MC SStimer. Added optional ability to log dump all timers on crash. Fixed subsystem logic when a bucket position is misplaced due to division and rounding inaccuracy. The system now captures such rounding errors and restores the correct timer position. References [RU] SS220 Paradise port process from TGstation and fixes: ss220-space/Paradise#5 ss220-space/Paradise#10 ss220-space/Paradise#26 ss220-space/Paradise#32 ss220-space/Paradise#37 Contributors @ semoro: fixes @ Bizzonium: port Changelog cl Semoro and azizonkg fix: Ported fixes of SStimer subsystem from RU SS220 Paradise config: Added a new config var: flag/log_timers_on_bucket_reset /cl * Port: fixes of SStimer subsystem from RU SS220 Paradise Co-authored-by: Aziz Chynaliev <azizonkg@gmail.com>