Implemented a few debugging/inspecting tools
This commit is contained in:
@@ -7,11 +7,13 @@ const Node = @import("node.zig").Node;
|
||||
pub const NodeManager = struct {
|
||||
temp_node: ?*Node,
|
||||
nodes: std.ArrayList(Node),
|
||||
highlighted_node: ?*Node,
|
||||
|
||||
pub fn init(allocator: std.mem.Allocator) !NodeManager {
|
||||
return .{
|
||||
.temp_node = null,
|
||||
.nodes = try .initCapacity(allocator, c.ALLOC_SIZE),
|
||||
.highlighted_node = null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -91,7 +93,7 @@ pub const NodeManager = struct {
|
||||
}
|
||||
|
||||
/// Removes the node from the list with all appropriate checks
|
||||
pub fn removeNode(self: *NodeManager, node_to_remove: *Node) !void {
|
||||
pub fn remove(self: *NodeManager, node_to_remove: *Node) !void {
|
||||
// In case the node has references to the existing roads we can not remove it
|
||||
// This also means we don't have to deinit it, since it has no elements
|
||||
if (node_to_remove.roads.items.len > 0) return;
|
||||
@@ -105,4 +107,6 @@ pub const NodeManager = struct {
|
||||
|
||||
return error.NodeNotExist;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user