object tags

This commit is contained in:
2026-06-07 01:26:18 -05:00
parent 9c2212520c
commit a8d2cb8303
8 changed files with 240 additions and 6 deletions
+4 -2
View File
@@ -302,9 +302,10 @@ impl Board {
///
/// Ids start at 1 and increase monotonically; an id is never reused, so it
/// stays a valid handle to this object for the board's lifetime.
pub fn add_object(&mut self, object: ObjectDef) -> ObjectId {
pub fn add_object(&mut self, mut object: ObjectDef) -> ObjectId {
let id = self.next_object_id;
self.next_object_id += 1;
object.id = id;
self.objects.insert(id, object);
id
}
@@ -332,7 +333,8 @@ pub(crate) mod tests {
) -> Board {
let mut object_map: BTreeMap<ObjectId, ObjectDef> = BTreeMap::new();
let mut next_object_id: ObjectId = 1;
for o in objects {
for mut o in objects {
o.id = next_object_id;
object_map.insert(next_object_id, o);
next_object_id += 1;
}