don't allow tiles with an ID of 0
This commit is contained in:
parent
c42d7262da
commit
dca191ccae
|
@ -692,7 +692,7 @@ impl Game {
|
||||||
/// adds a tile safely and returns the ID
|
/// adds a tile safely and returns the ID
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn add_tile(&mut self, mut tile: Tile) -> String {
|
pub fn add_tile(&mut self, mut tile: Tile) -> String {
|
||||||
if self.tile_ids().contains(&tile.id) {
|
if tile.id == "0".to_string() || self.tile_ids().contains(&tile.id) {
|
||||||
let new_id = self.new_tile_id();
|
let new_id = self.new_tile_id();
|
||||||
if new_id != tile.id {
|
if new_id != tile.id {
|
||||||
tile.id = new_id;
|
tile.id = new_id;
|
||||||
|
|
Loading…
Reference in New Issue