Using implicit pointer derefs + fixing crashes on clearing entities
This commit is contained in:
@@ -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});
|
||||
|
||||
Reference in New Issue
Block a user