diff --git a/src/bin/bitsy-merge.rs b/src/bin/bitsy-merge.rs index 1a6f47f..9ea139f 100644 --- a/src/bin/bitsy-merge.rs +++ b/src/bin/bitsy-merge.rs @@ -12,7 +12,7 @@ fn main() { let mut game_a = Game::from(fs::read_to_string(game_a).unwrap()).unwrap(); let game_b = Game::from(fs::read_to_string(game_b).unwrap()).unwrap(); - game_a.merge(game_b); + game_a.merge(&game_b); fs::write(output, game_a.to_string()) .expect("Failed to write output file"); diff --git a/src/game.rs b/src/game.rs index 0f82964..7d9c157 100644 --- a/src/game.rs +++ b/src/game.rs @@ -314,7 +314,7 @@ impl Game { } // return? array of changes made? error/ok? - pub fn merge(&mut self, game: Game) { + pub fn merge(&mut self, game: &Game) { // ignore title, version, room format, room type, font, text direction let mut palette_id_changes: HashMap = HashMap::new(); @@ -942,7 +942,7 @@ mod test { fn merge() { // try merging two default games let mut game = crate::mock::game_default(); - game.merge(crate::mock::game_default()); + game.merge(&crate::mock::game_default()); assert_eq!(game.room_ids(), vec!["0".to_string(), "1".to_string()]); assert_eq!(game.tile_ids(), vec!["a".to_string(), "1".to_string()]); // 0 is reserved @@ -981,7 +981,7 @@ mod test { room.id = room_id.clone(); sprite.room_id = Some(room_id.clone()); game_b.add_sprite(sprite); - game_a.merge(game_b); + game_a.merge(&game_b); assert_eq!(game_a.get_sprite_by_id("2".to_string()).unwrap().room_id, Some(room_id)); }