Replaced all u32 instances with uint, implemented road length,

implemented basic pathing checks/algorithms, implemented entities id
display for easier debugging
This commit is contained in:
2026-04-27 22:24:06 +02:00
parent 7f5cb42097
commit 05b7b28f5c
9 changed files with 114 additions and 53 deletions

View File

@@ -4,20 +4,22 @@ import "../common"
Road :: struct {
// Index to nodes that limit the road
nodes: [2]u32,
nodes: [2]uint,
speed_limit: u8,
length: f32,
}
// Road Initialisation
road_init :: proc(start: u32, end: u32) -> Road {
road_init :: proc(start: uint, end: uint, calculated_length: f32) -> Road {
return {
nodes = {start, end},
speed_limit = common.DEFAULT_SPEED_LIMIT,
length = calculated_length
}
}
// Updates existing node reference to a new one; returns false if old ref was not found
road_update_node_reference :: proc(self: ^Road, old_ref: u32, new_ref: u32) -> bool {
road_update_node_reference :: proc(self: ^Road, old_ref: uint, new_ref: uint) -> bool {
for &node in self.nodes {
if node != old_ref do continue