don't add duplicate tiles
This commit is contained in:
parent
369ad6aaf1
commit
366914e4bb
|
@ -57,20 +57,23 @@ pub fn add_tiles(game_data: String, image: String, prefix: String) -> String {
|
|||
}
|
||||
}
|
||||
|
||||
game.add_tile(Tile {
|
||||
let tile = Tile {
|
||||
/// "0" will get overwritten to a new, safe tile ID
|
||||
id: "0".to_string(),
|
||||
name: tile_name(&prefix, &tile_index),
|
||||
wall: None,
|
||||
animation_frames: vec![Image { pixels }],
|
||||
colour_id: None
|
||||
});
|
||||
};
|
||||
|
||||
if !game.tiles.contains(&tile) {
|
||||
game.add_tile(tile);
|
||||
|
||||
tile_index += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
game.dedupe_tiles();
|
||||
game.to_string()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue