Partial implementation of road deletion
This commit is contained in:
@@ -46,5 +46,16 @@ node_unreference_road :: proc(self: ^Node, road_to_unref: u32) -> bool {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
node_update_road_reference :: proc(self: ^Node, old_ref: u32, new_ref: u32) -> bool {
|
||||
for &road in self.roads {
|
||||
if road != old_ref do continue
|
||||
|
||||
road = new_ref
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
@@ -10,4 +10,16 @@ road_init :: proc(start: u32, end: u32) -> Road {
|
||||
return {
|
||||
nodes = {start, end}
|
||||
}
|
||||
}
|
||||
|
||||
// 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 {
|
||||
for &node in self.nodes {
|
||||
if node != old_ref do continue
|
||||
|
||||
node = new_ref
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user