From 9fc975d5bbb87eafa6503cceb7025d29063f87b7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20Schr=C3=B6der?=
 <fschroeder@techfak.uni-bielefeld.de>
Date: Fri, 2 Feb 2024 23:08:46 +0100
Subject: [PATCH] Refactor progress bar position calculation

The code for calculating the progress bar's position within the grid in gui_2d_vis/drawing.py has been clarified. Instead of directly manipulating the `pos` variable, a new `bar_pos` variable has been introduced. This revision enhances readability and maintains the integrity of the `pos` value.
---
 overcooked_simulator/gui_2d_vis/drawing.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/overcooked_simulator/gui_2d_vis/drawing.py b/overcooked_simulator/gui_2d_vis/drawing.py
index c7484b08..0690e22d 100644
--- a/overcooked_simulator/gui_2d_vis/drawing.py
+++ b/overcooked_simulator/gui_2d_vis/drawing.py
@@ -343,13 +343,13 @@ class Visualizer:
         grid_size: float,
     ):
         """Visualize progress of progressing item as a green bar under the item."""
-        pos -= grid_size / 2
+        bar_pos = pos - (grid_size / 2)
 
         bar_height = grid_size * 0.2
         progress_width = percent * grid_size
         progress_bar = pygame.Rect(
-            pos[0],
-            pos[1] + grid_size - bar_height,
+            bar_pos[0],
+            bar_pos[1] + grid_size - bar_height,
             progress_width,
             bar_height,
         )
-- 
GitLab