object tags
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user