Implemented removal of cars if the node they're on gets removed

This commit is contained in:
2026-04-27 15:29:16 +02:00
parent 205c630dbf
commit da5c60d76b
5 changed files with 44 additions and 23 deletions

View File

@@ -45,7 +45,10 @@ draw_nodes :: proc(self: ^Simulator) {
@(private="file")
draw_cars :: proc(self: ^Simulator) {
for &car in self.cars {
pos := self.nodes[car.origin].pos
ref := car.pos.ref
// TODO fix in the future
// let's fix it by tracking length of the road and
pos := car.pos.type == .Node ? self.nodes[ref].pos : self.nodes[self.roads[ref].nodes[0]].pos
rect := rl.Rectangle {
x = pos.x,