diff --git a/src/game.rs b/src/game.rs index 811484c..f7f6785 100644 --- a/src/game.rs +++ b/src/game.rs @@ -350,11 +350,28 @@ impl ToString for Game { } impl Game { + // todo dedupe + #[inline] pub fn tile_ids(&self) -> Vec { self.tiles.iter().map(|tile| tile.id.clone()).collect() } + #[inline] + pub fn sprite_ids(&self) -> Vec { + self.sprites.iter().map(|sprite| sprite.id.clone()).collect() + } + + #[inline] + pub fn room_ids(&self) -> Vec { + self.rooms.iter().map(|room| room.id.clone()).collect() + } + + #[inline] + pub fn item_ids(&self) -> Vec { + self.items.iter().map(|item| item.id.clone()).collect() + } + /// first available tile ID. /// e.g. if current tile IDs are [0, 2, 3] the result will be `1` /// if current tile IDs are [0, 1, 2] the result will be `3`