Update level/chunk and heightmaps

This commit is contained in:
Tnze
2023-04-22 17:43:10 +08:00
parent e17642945d
commit de2996336c
5 changed files with 71 additions and 52 deletions

View File

@ -47,13 +47,12 @@ func NewBitStorage(bits, length int, data []uint64) (b *BitStorage) {
valuesPerLong: 64 / bits,
}
dataLen := calcBitStorageSize(bits, length)
b.data = make([]uint64, dataLen)
if data != nil {
if len(data) != dataLen {
panic(newBitStorageErr{ArrlLen: len(data), WantLen: dataLen})
}
b.data = data
} else {
b.data = make([]uint64, dataLen)
copy(b.data, data)
}
return
}