From e33c35bbe010e80410fe56a3840a44b0ab7779b7 Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Sat, 4 May 2024 11:35:20 -0600 Subject: [PATCH] Fix (or unfix) the search radius for orange buttons --- js/algorithms.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/algorithms.js b/js/algorithms.js index 64433a7..ae5b563 100644 --- a/js/algorithms.js +++ b/js/algorithms.js @@ -33,9 +33,9 @@ export function* find_terrain_linear(levelish, start_cell, type_names, reverse = // Only used by orange buttons. // Yields [tile, cell]. export function* find_terrain_diamond(levelish, start_cell, type_names) { - let max_search_radius = ( - Math.max(start_cell.x, levelish.size_x - start_cell.x) + - Math.max(start_cell.y, levelish.size_y - start_cell.y)); + // Note that this won't search the entire level in all cases, but it does match CC2 behavior. + // Not worth a compat flag since it only affects level design, and fairly perversely + let max_search_radius = Math.max(levelish.size_x, levelish.size_y) + 1; for (let dist = 1; dist <= max_search_radius; dist++) { // Start east and move counterclockwise let sx = start_cell.x + dist;