From 95153100e0ad1c4eb8ee63e4ffccac89c134ad54 Mon Sep 17 00:00:00 2001
From: Brandon Rodriguez <brodriguez8774@gmail.com>
Date: Sat, 30 Oct 2021 07:23:13 -0400
Subject: [PATCH] Correct tile path calculations to also update on tile click
 events

---
 src/misc.py | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/misc.py b/src/misc.py
index 3589d00..115b36d 100644
--- a/src/misc.py
+++ b/src/misc.py
@@ -162,6 +162,9 @@ def handle_mouse_click(data_manager, button_state, pos_x, pos_y):
             logger.info('    Decrementing tile walls.')
             tile.walls.decrement_wall_state()
 
+        # Recalculate trash distances for new tile wall setup.
+        data_manager.ideal_trash_paths = calc_trash_distances(data_manager)
+
 # endregion GUI Logic Functions
 
 
@@ -220,9 +223,6 @@ def calc_distance_cost(start_tile_x, start_tile_y, end_tile_x, end_tile_y):
     :return: Calculated distance between tiles.
     """
     distance = abs(start_tile_x - end_tile_x) + abs(start_tile_y - end_tile_y)
-    # logger.info('    tile_cost for ({0}, {1}) to ({2}, {3}): {4}'.format(
-    #     start_tile_x, start_tile_y, end_tile_x, end_tile_y, distance,
-    # ))
     return distance
 
 
@@ -358,8 +358,6 @@ def calc_trash_distances(data_manager):
                             )
                             data_manager.debug_entities.append(debug_entity)
 
-            print('\n')
-
         # Optionally print out calculated path set to console.
         if debug:
             logger.info('')
-- 
GitLab