Implemented that each road, node in managers will be stored as pointers (allocated in heap)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user