This commit is contained in:
Max Bradbury 2022-03-12 18:34:30 +00:00
parent 1f231a8434
commit 2349d7365e
1 changed files with 3 additions and 4 deletions

View File

@ -5,7 +5,7 @@ mod colour;
mod config;
mod entity;
mod image;
mod mock;
pub mod mock;
mod music;
mod palette;
mod scene;
@ -224,10 +224,9 @@ impl Game {
Ok(Game { config, images, tiles, palettes, music, entities, scenes })
}
// todo Result<&Image>?
pub fn get_image_by_name(&self, name: String) -> Option<&Image> {
pub fn get_image_by_name(&self, name: &String) -> Option<&Image> {
for image in self.images.iter() {
if image.name == name {
if &image.name == name {
return Some(&image);
}
}