From 892dd52f18316a8aaaaaa0d19146eeac2b99f694 Mon Sep 17 00:00:00 2001 From: Andreas Gattringer <andreas.gattringer@univie.ac.at> Date: Tue, 13 Jun 2023 16:36:17 +0200 Subject: [PATCH] butterflies: debug overlay layer --- src/modules/butterflies/butterflies_overlays.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/modules/butterflies/butterflies_overlays.c b/src/modules/butterflies/butterflies_overlays.c index 2c324a7..2dfb972 100644 --- a/src/modules/butterflies/butterflies_overlays.c +++ b/src/modules/butterflies/butterflies_overlays.c @@ -20,6 +20,10 @@ enum action_status bf_grid_overlay_update(const struct cats_configuration *conf, const cats_dt_coord rows = grid->dimension.rows; const cats_dt_coord cols = grid->dimension.cols; + int64_t cells_habitat_ok = 0; + int64_t cells_excluded = 0; + int64_t cells_resource_ok = 0; + int64_t cells_habitat_and_resource_ok = 0; for (cats_dt_coord row = 0; row < rows; row++) { for (cats_dt_coord col = 0; col < cols; col++) { @@ -28,6 +32,7 @@ enum action_status bf_grid_overlay_update(const struct cats_configuration *conf, if (cell_excluded_by_overlay(conf, row, col)) { data->info_layer[row][col] |= BF_CELL_EXCLUDED; + cells_excluded += 1; continue; } @@ -35,20 +40,24 @@ enum action_status bf_grid_overlay_update(const struct cats_configuration *conf, if (conf->overlays.overlay[OL_HABITAT_TYPE_CC].enabled && conf->overlays.habitat_cc->data[row][col] > 0) { data->info_layer[row][col] |= BF_CELL_HABITAT_OK; + cells_habitat_ok += 1; } if (conf->overlays.overlay[OL_RESOURCE].enabled && conf->overlays.resources->data[row][col] > 0) { data->info_layer[row][col] |= BF_CELL_RESOURCE_AVAILABLE; + cells_resource_ok += 1; } if (data->info_layer[row][col] & BF_CELL_HABITAT_OK && data->info_layer[row][col] & BF_CELL_RESOURCE_AVAILABLE) { data->info_layer[row][col] |= BF_CELL_VALID_DISPERSAL_TARGET; + cells_habitat_and_resource_ok += 1; } } } - + log_message(LOG_INFO, "Overlay update: %ld excluded, %ld habitat ok, %ld resource ok, %ld habitat + resource ok", + cells_excluded, cells_habitat_ok, cells_resource_ok, cells_habitat_and_resource_ok); return ACTION_RUN; } -- GitLab