Using implicit pointer derefs + fixing crashes on clearing entities

This commit is contained in:
2026-04-29 17:16:12 +02:00
parent 9defec8448
commit 7348861145
3 changed files with 11 additions and 10 deletions

View File

@@ -90,7 +90,7 @@ pub const Simulator = struct {
};
if (self.node_man.temp_node) |temp| {
if (temp.*.id == cur_node.*.id) return;
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});
};
@@ -107,8 +107,8 @@ pub const Simulator = struct {
if (self.road_man.highlighted_road == null) return;
const h_road = self.road_man.highlighted_road.?;
const start_node = h_road.*.nodes[0];
const end_node = h_road.*.nodes[1];
const start_node = h_road.nodes[0];
const end_node = h_road.nodes[1];
self.road_man.deleteRoad(self.allocator, h_road) catch |err| {
std.debug.panic("Road deletion failed: {}\n", .{err});