Implemented a few debugging/inspecting tools

This commit is contained in:
2026-04-08 11:22:19 +02:00
parent 64463e82b2
commit fea5a0ea5f
5 changed files with 59 additions and 18 deletions

View File

@@ -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;
}
};