Implemented that each road, node in managers will be stored as pointers (allocated in heap)

This commit is contained in:
2026-04-29 10:46:32 +02:00
parent 37e2f36ae9
commit fc67fe3d7e
5 changed files with 26 additions and 13 deletions

View File

@@ -56,6 +56,7 @@ pub const Simulator = struct {
};
if (self.node_man.temp_node) |temp| {
if (temp.*.id == cur_node.*.id) return;
self.road_man.addRoad(self.allocator, temp, cur_node) catch |err| {
std.debug.panic("Failed to add a new road or assigning its nodes: {}\n", .{err});
};
@@ -68,7 +69,7 @@ pub const Simulator = struct {
}
fn clear(self: *Simulator) void {
self.road_man.clear();
self.road_man.clear(self.allocator);
self.node_man.clear(self.allocator);
}
};