summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-05-13 16:33:50 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-05-13 16:33:50 +0200
commit1237941180dd8e56ad65fdcfdbd893ca4ce7579e (patch)
treeee9bd432149a603d1cfe3921af671c74cf9695a2 /src/control
parentcar control and cranes fixes (diff)
downloadre3-1237941180dd8e56ad65fdcfdbd893ca4ce7579e.tar
re3-1237941180dd8e56ad65fdcfdbd893ca4ce7579e.tar.gz
re3-1237941180dd8e56ad65fdcfdbd893ca4ce7579e.tar.bz2
re3-1237941180dd8e56ad65fdcfdbd893ca4ce7579e.tar.lz
re3-1237941180dd8e56ad65fdcfdbd893ca4ce7579e.tar.xz
re3-1237941180dd8e56ad65fdcfdbd893ca4ce7579e.tar.zst
re3-1237941180dd8e56ad65fdcfdbd893ca4ce7579e.zip
Diffstat (limited to '')
-rw-r--r--src/control/TrafficLights.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/control/TrafficLights.cpp b/src/control/TrafficLights.cpp
index b2f0900e..278366a3 100644
--- a/src/control/TrafficLights.cpp
+++ b/src/control/TrafficLights.cpp
@@ -137,7 +137,7 @@ void
CTrafficLights::ScanForLightsOnMap(void)
{
int x, y;
- int i, j, l;
+ int i, j, k, l;
CPtrNode *node;
for(x = 0; x < NUMSECTORS_X; x++)
@@ -188,8 +188,9 @@ CTrafficLights::ScanForLightsOnMap(void)
for(l = 0; l < ThePaths.m_pathNodes[i].numLinks; l++){
j = ThePaths.m_pathNodes[i].firstLink + l;
if(ThePaths.ConnectionCrossesRoad(j)){
- dist2 = Abs(ThePaths.m_pathNodes[j].GetX() - light->GetPosition().x) +
- Abs(ThePaths.m_pathNodes[j].GetY() - light->GetPosition().y);
+ k = ThePaths.ConnectedNode(j);
+ dist2 = Abs(ThePaths.m_pathNodes[k].GetX() - light->GetPosition().x) +
+ Abs(ThePaths.m_pathNodes[k].GetY() - light->GetPosition().y);
if(dist1 < 15.0f || dist2 < 15.0f)
ThePaths.ConnectionSetTrafficLight(j);
}