From 0ad1737fb36c88a61ffefb896951b3e38ebaaf19 Mon Sep 17 00:00:00 2001
From: "Egli Adrian (IT-SCI-API-PFI)" <adrian.egli@sbb.ch>
Date: Thu, 23 May 2019 14:11:38 +0200
Subject: [PATCH] bug fix in rendering

---
 flatland/utils/rendertools.py | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/flatland/utils/rendertools.py b/flatland/utils/rendertools.py
index 713f65f0..b96531c6 100644
--- a/flatland/utils/rendertools.py
+++ b/flatland/utils/rendertools.py
@@ -762,18 +762,12 @@ class RenderTool(object):
                 iAction = action_dict[iAgent]
                 new_direction, action_isValid = self.env.check_action(agent, iAction)
 
-
-            # ** TODO ***
-            # why should we only update if the action is valid ?
-            if True:
-                if action_isValid:
-                    self.gl.setAgentAt(iAgent, *agent.position, agent.direction, new_direction, color=oColor)
-                else:
-                    # pass
-                    print("invalid action - agent ", iAgent, " bend ", agent.direction, new_direction)
-                    self.gl.setAgentAt(iAgent, *agent.position, agent.direction, new_direction)
-            else:
+            if action_isValid:
                 self.gl.setAgentAt(iAgent, *agent.position, agent.direction, new_direction, color=oColor)
+            else:
+                #pass
+                print("invalid action - agent ", iAgent, " bend ", agent.direction, new_direction)
+                self.gl.setAgentAt(iAgent, *agent.position, agent.direction, new_direction)
 
         self.gl.show()
         for i in range(3):
-- 
GitLab