use existing IDs if there is no conflict
This commit is contained in:
parent
ba1dc3ff34
commit
beea5f8efc
|
@ -663,7 +663,7 @@ impl Game {
|
|||
/// adds a palette safely and returns the new palette ID
|
||||
#[inline]
|
||||
pub fn add_palette(&mut self, mut palette: Palette) -> String {
|
||||
let new_id = self.new_palette_id();
|
||||
let new_id = try_id(self.palette_ids(), palette.id.clone());
|
||||
palette.id = new_id.clone();
|
||||
self.palettes.push(palette);
|
||||
new_id
|
||||
|
@ -681,7 +681,7 @@ impl Game {
|
|||
/// adds a sprite safely and returns the new sprite ID
|
||||
#[inline]
|
||||
pub fn add_sprite(&mut self, mut sprite: Sprite) -> String {
|
||||
let new_id = self.new_sprite_id();
|
||||
let new_id = try_id(self.sprite_ids(), sprite.id.clone());
|
||||
sprite.id = new_id.clone();
|
||||
self.sprites.push(sprite);
|
||||
new_id
|
||||
|
|
Loading…
Reference in New Issue