Skip to content
Snippets Groups Projects
Commit 892dd52f authored by Andreas Gattringer's avatar Andreas Gattringer
Browse files

butterflies: debug overlay layer

parent 4781533a
No related branches found
No related tags found
No related merge requests found
...@@ -20,6 +20,10 @@ enum action_status bf_grid_overlay_update(const struct cats_configuration *conf, ...@@ -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 rows = grid->dimension.rows;
const cats_dt_coord cols = grid->dimension.cols; 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 row = 0; row < rows; row++) {
for (cats_dt_coord col = 0; col < cols; col++) { 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, ...@@ -28,6 +32,7 @@ enum action_status bf_grid_overlay_update(const struct cats_configuration *conf,
if (cell_excluded_by_overlay(conf, row, col)) { if (cell_excluded_by_overlay(conf, row, col)) {
data->info_layer[row][col] |= BF_CELL_EXCLUDED; data->info_layer[row][col] |= BF_CELL_EXCLUDED;
cells_excluded += 1;
continue; continue;
} }
...@@ -35,20 +40,24 @@ enum action_status bf_grid_overlay_update(const struct cats_configuration *conf, ...@@ -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 && if (conf->overlays.overlay[OL_HABITAT_TYPE_CC].enabled &&
conf->overlays.habitat_cc->data[row][col] > 0) { conf->overlays.habitat_cc->data[row][col] > 0) {
data->info_layer[row][col] |= BF_CELL_HABITAT_OK; data->info_layer[row][col] |= BF_CELL_HABITAT_OK;
cells_habitat_ok += 1;
} }
if (conf->overlays.overlay[OL_RESOURCE].enabled && if (conf->overlays.overlay[OL_RESOURCE].enabled &&
conf->overlays.resources->data[row][col] > 0) { conf->overlays.resources->data[row][col] > 0) {
data->info_layer[row][col] |= BF_CELL_RESOURCE_AVAILABLE; data->info_layer[row][col] |= BF_CELL_RESOURCE_AVAILABLE;
cells_resource_ok += 1;
} }
if (data->info_layer[row][col] & BF_CELL_HABITAT_OK && 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_RESOURCE_AVAILABLE) {
data->info_layer[row][col] |= BF_CELL_VALID_DISPERSAL_TARGET; 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; return ACTION_RUN;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment