Skip to content

Commit b95c323

Browse files
authored
Remove a useless and confusing test
If min_sector could be anything but UNKNOWN_SECTOR out of the loop, the "return 0" would be wrong.
1 parent 5e9b3d2 commit b95c323

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/tracks/graph.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -750,16 +750,13 @@ int Graph::findOutOfRoadSector(const Vec3& xyz, const int curr_sector,
750750
}
751751
current_sector = next_sector;
752752
} // for j
753-
// Leave in phase 0 if any sector was found.
753+
// If any sector was found after a phase, return it.
754754
if(min_sector!=UNKNOWN_SECTOR)
755755
return min_sector;
756756
} // phase
757-
758-
if(min_sector==UNKNOWN_SECTOR)
759-
{
760-
Log::warn("Graph", "unknown sector found.");
761-
}
762-
// Avoid crashing in TrackSector
757+
758+
// We can only reach this point if min_sector==UNKNOWN_SECTOR
759+
Log::warn("Graph", "unknown sector found.");
763760
return 0;
764761
} // findOutOfRoadSector
765762

0 commit comments

Comments
 (0)