correct copying of prefabs

This commit is contained in:
anton.gurov
2019-11-12 13:59:19 +03:00
parent d198001ec0
commit 4bdb51d9e3
5 changed files with 17 additions and 63 deletions

View File

@ -54,12 +54,12 @@ func (l *Level) SetTileByXY (x,y int, tile *Tile) {
}
func (l *Level) Put (x, y int, tileFunc interface{}) {
tf := tileFunc.(func() *Tile)()
if tf == nil {
l.ctx.Logger().Fatal().Msgf("Got non-tile type to put into level: %v", tf)
tile := tileFunc.(func() *Tile)()
if tile == nil {
l.ctx.Logger().Fatal().Msgf("Got non-tile type to put into level: %v", tile)
}
if l.InBounds(types.Coords{x, y}) {
l.Tiles[y*l.W+x] = tf
l.Tiles[y*l.W+x] = tile
}
}