From aee495573408594857201a27d51ef112828d50ef Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Sun, 1 Mar 2026 23:43:37 -0800 Subject: [PATCH 1/5] Fix logcleaner to use ticks --- plugins/logcleaner/logcleaner.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/plugins/logcleaner/logcleaner.cpp b/plugins/logcleaner/logcleaner.cpp index d9c0b8dce3..4b59a88d1e 100644 --- a/plugins/logcleaner/logcleaner.cpp +++ b/plugins/logcleaner/logcleaner.cpp @@ -31,7 +31,8 @@ static bool clear_combat = false; static bool clear_sparring = true; static bool clear_hunting = false; -static constexpr int32_t CLEANUP_TICK_INTERVAL = 97; +static constexpr int32_t CYCLE_TICKS = 97; +static int32_t cycle_timestamp = 0; static void cleanupLogs(); static command_result do_command(color_ostream& out, std::vector& params); @@ -116,6 +117,7 @@ DFhackCExport command_result plugin_load_site_data(color_ostream& out) { clear_sparring = config.get_bool(CONFIG_CLEAR_SPARING); clear_hunting = config.get_bool(CONFIG_CLEAR_HUNTING); + cycle_timestamp = 0; return CR_OK; } @@ -166,16 +168,13 @@ static void cleanupLogs() { } DFhackCExport command_result plugin_onupdate(color_ostream& out, state_change_event event) { - static int32_t tick_counter = 0; - if (!is_enabled || !world) return CR_OK; + else if (world->frame_counter - cycle_timestamp <= CYCLE_TICKS) + return CR_OK; - tick_counter++; - if (tick_counter >= CLEANUP_TICK_INTERVAL) { - tick_counter = 0; - cleanupLogs(); - } + cycle_timestamp = world->frame_counter; + cleanupLogs(); return CR_OK; } From a12d60c432a2bbcc047577cfc6bbc5f8aa835679 Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Sun, 1 Mar 2026 23:47:01 -0800 Subject: [PATCH 2/5] Update logcleaner.rst - not exactly 100 ticks --- docs/plugins/logcleaner.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/plugins/logcleaner.rst b/docs/plugins/logcleaner.rst index d9d0930d82..6e4cba07d6 100644 --- a/docs/plugins/logcleaner.rst +++ b/docs/plugins/logcleaner.rst @@ -5,8 +5,8 @@ logcleaner :tags: fort auto units This plugin prevents spam from cluttering your announcement history and filling -the 3000-item reports buffer. It runs every 100 ticks and clears selected report -types from both the global reports buffer and per-unit logs. +the 3000-item reports buffer. It runs approximately every 100 ticks and clears +selected report types from both the global reports buffer and per-unit logs. Usage ----- From 3d808ccf0e3214fb937390ca298cf251afdf251d Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Mon, 2 Mar 2026 00:21:07 -0800 Subject: [PATCH 3/5] Fix logcleaner and autolabor ticks offset by +1 * Update logcleaner.cpp * Update autolabor.cpp --- plugins/autolabor/autolabor.cpp | 2 +- plugins/logcleaner/logcleaner.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/autolabor/autolabor.cpp b/plugins/autolabor/autolabor.cpp index d0cec796fb..4fd73ce181 100644 --- a/plugins/autolabor/autolabor.cpp +++ b/plugins/autolabor/autolabor.cpp @@ -740,7 +740,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out ) return CR_OK; } - if (world->frame_counter - cycle_timestamp <= CYCLE_TICKS) + if (world->frame_counter - cycle_timestamp < CYCLE_TICKS) return CR_OK; cycle_timestamp = world->frame_counter; diff --git a/plugins/logcleaner/logcleaner.cpp b/plugins/logcleaner/logcleaner.cpp index 4b59a88d1e..89f84cf32f 100644 --- a/plugins/logcleaner/logcleaner.cpp +++ b/plugins/logcleaner/logcleaner.cpp @@ -170,7 +170,7 @@ static void cleanupLogs() { DFhackCExport command_result plugin_onupdate(color_ostream& out, state_change_event event) { if (!is_enabled || !world) return CR_OK; - else if (world->frame_counter - cycle_timestamp <= CYCLE_TICKS) + else if (world->frame_counter - cycle_timestamp < CYCLE_TICKS) return CR_OK; cycle_timestamp = world->frame_counter; From a5c5a87ae40620cdad9d686002acb7a11c31c87d Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Mon, 2 Mar 2026 06:00:02 -0600 Subject: [PATCH 4/5] revert change to autolabor out of scope for this PR --- plugins/autolabor/autolabor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/autolabor/autolabor.cpp b/plugins/autolabor/autolabor.cpp index 4fd73ce181..a95d6636d4 100644 --- a/plugins/autolabor/autolabor.cpp +++ b/plugins/autolabor/autolabor.cpp @@ -1,4 +1,4 @@ -#include "laborstatemap.h" +g#include "laborstatemap.h" #include "Debug.h" #include "PluginManager.h" @@ -740,7 +740,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out ) return CR_OK; } - if (world->frame_counter - cycle_timestamp < CYCLE_TICKS) + if (world->frame_counter - cycle_timestamp <= CYCLE_TICKS) return CR_OK; cycle_timestamp = world->frame_counter; From 80b4446849f1eed4452087200b05d16e466e19bd Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Mon, 2 Mar 2026 06:03:27 -0600 Subject: [PATCH 5/5] gah remove line noise --- plugins/autolabor/autolabor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/autolabor/autolabor.cpp b/plugins/autolabor/autolabor.cpp index a95d6636d4..d0cec796fb 100644 --- a/plugins/autolabor/autolabor.cpp +++ b/plugins/autolabor/autolabor.cpp @@ -1,4 +1,4 @@ -g#include "laborstatemap.h" +#include "laborstatemap.h" #include "Debug.h" #include "PluginManager.h"