1
0
Fork 0

fix: check bound before placing a block in LockShape()

This commit is contained in:
Henrik Hautakoski 2025-09-14 22:38:49 +02:00
parent dab2570b76
commit ca6497d362

View file

@ -40,6 +40,10 @@ func SpawnShape() {
func LockShape() {
for _, block := range shape.Coordinates() {
block = shape_pos.Add(block)
// Check bounds
if block.X < 0 || block.X > int8(grid.Width()) || block.Y < 0 || block.Y > int8(grid.Height()) {
continue
}
grid.Set(byte(block.X), byte(block.Y), shape.GetBlock())
}
}