Car fundamentals implemented

This commit is contained in:
2026-05-02 18:58:53 +02:00
parent 3e6438418b
commit 439482e5a1
6 changed files with 47 additions and 13 deletions

View File

@@ -41,7 +41,7 @@ pub const Simulator = struct {
random: std.Random,
/// Constructor for convenience
pub fn init(new_allocator: std.mem.Allocator, rand_impl: std.Random.IoSource) Simulator {
pub fn init(new_allocator: std.mem.Allocator, rand_impl: *const std.Random.IoSource) Simulator {
return .{
.allocator = new_allocator,
.node_man = .init(),
@@ -76,7 +76,7 @@ pub const Simulator = struct {
self.road_man.draw(highlighted_road, self.display_entity_info);
self.node_man.draw(pos, self.display_entity_info);
self.car_man.draw();
self.car_man.draw(self.display_entity_info);
self.drawRelatedSelectedEntities();
}
@@ -103,7 +103,9 @@ pub const Simulator = struct {
road.nodes[0].draw(c.NODE_RELATED_COLOUR, self.display_entity_info);
road.nodes[1].draw(c.NODE_RELATED_COLOUR, self.display_entity_info);
},
// TODO car
.car => {
// TODO draw the origin and destination, connected by the pathfinding route
}
}
}
@@ -201,6 +203,7 @@ pub const Simulator = struct {
/// Clearing node and road lists without deinitialising them (only the children)
fn clear(self: *Simulator) !void {
self.highlighted_entity = null;
self.car_man.clear(self.allocator);
self.road_man.clear(self.allocator);
try self.node_man.clear(self.allocator);
}