fixed traffic lights

This commit is contained in:
Nikolay Korolev 2020-05-13 17:33:50 +03:00
parent 509d57edcb
commit 1237941180

View file

@ -137,7 +137,7 @@ void
CTrafficLights::ScanForLightsOnMap(void) CTrafficLights::ScanForLightsOnMap(void)
{ {
int x, y; int x, y;
int i, j, l; int i, j, k, l;
CPtrNode *node; CPtrNode *node;
for(x = 0; x < NUMSECTORS_X; x++) for(x = 0; x < NUMSECTORS_X; x++)
@ -188,8 +188,9 @@ CTrafficLights::ScanForLightsOnMap(void)
for(l = 0; l < ThePaths.m_pathNodes[i].numLinks; l++){ for(l = 0; l < ThePaths.m_pathNodes[i].numLinks; l++){
j = ThePaths.m_pathNodes[i].firstLink + l; j = ThePaths.m_pathNodes[i].firstLink + l;
if(ThePaths.ConnectionCrossesRoad(j)){ if(ThePaths.ConnectionCrossesRoad(j)){
dist2 = Abs(ThePaths.m_pathNodes[j].GetX() - light->GetPosition().x) + k = ThePaths.ConnectedNode(j);
Abs(ThePaths.m_pathNodes[j].GetY() - light->GetPosition().y); 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) if(dist1 < 15.0f || dist2 < 15.0f)
ThePaths.ConnectionSetTrafficLight(j); ThePaths.ConnectionSetTrafficLight(j);
} }