Further implementation plans
This commit is contained in:
@@ -9,6 +9,7 @@ const NodeManager = @import("infrastructure/node_manager.zig").NodeManager;
|
||||
const RoadManager = @import("infrastructure/road_manager.zig").RoadManager;
|
||||
|
||||
const Node = @import("infrastructure/node.zig").Node;
|
||||
const Road = @import("infrastructure/road.zig").Road;
|
||||
|
||||
pub const Simulator = struct {
|
||||
allocator: std.mem.Allocator,
|
||||
@@ -95,11 +96,17 @@ pub const Simulator = struct {
|
||||
const temp = self.node_man.temp_node.?;
|
||||
if (temp.id == node.id) return;
|
||||
|
||||
// todo remove
|
||||
self.road_man.add(self.allocator, temp, node) catch |err| {
|
||||
std.debug.panic("Error while attempting to add a road: {}\n", .{err});
|
||||
};
|
||||
|
||||
// get intersections made
|
||||
// todo plan out the implementation
|
||||
// add both nodes to the intersection array
|
||||
// first in front, second in last
|
||||
// all of the road connections will not be added here but rather in the split_roads function as it will
|
||||
// create road connection for each nodes that are to be connected via connection
|
||||
const data = self.getIntersectingRoads(self.allocator, temp, node) catch |err| {
|
||||
std.debug.panic("Failed to save intersection data: {}\n", .{err});
|
||||
};
|
||||
@@ -205,6 +212,18 @@ pub const Simulator = struct {
|
||||
return sorted_intersections;
|
||||
}
|
||||
|
||||
fn splitRoadsByPoints(self: *Simulator, intersections: []const st.IntersectionData) void {
|
||||
_ = self; // autofix
|
||||
// todo plan it out
|
||||
if (intersections.len == 0) return;
|
||||
|
||||
for (0..intersections.len) |i| {
|
||||
const intersection = intersections[i];
|
||||
_ = intersection; // autofix
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pub fn update(self: *Simulator) void {
|
||||
const pos = rl.getMousePosition();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user