Added comments and slightly refactored code for deletion of temp node
This commit is contained in:
@@ -219,6 +219,7 @@ pub const Simulator = struct {
|
||||
self.highlighted_entity = null;
|
||||
}
|
||||
|
||||
/// Returns array of IntersectionData struct, containing pointers to roads that got intersected and exact position
|
||||
fn getIntersectingRoads(self: *const Simulator, allocator: std.mem.Allocator, start: *const Node, end: *const Node) ![]st.IntersectionData {
|
||||
var intersections: std.ArrayList(st.IntersectionData) = .empty;
|
||||
var collision_point: rl.Vector2 = undefined;
|
||||
@@ -286,6 +287,7 @@ pub const Simulator = struct {
|
||||
return sorted_intersection;
|
||||
}
|
||||
|
||||
/// Takes the data about intersections and adds new nodes there alongside with linking existing roads to them
|
||||
fn splitRoadsByIntersections(self: *Simulator, intersections: []st.IntersectionData, start: *Node, end: *Node) void {
|
||||
if (intersections.len == 0) {
|
||||
self.road_man.addRoad(self.allocator, start, end) catch |err| {
|
||||
|
||||
Reference in New Issue
Block a user