fix: update roll caused SEGV, also optimised it using XOR

This commit is contained in:
2025-06-26 11:26:22 +02:00
parent 29b190e0f5
commit 7af2bb0050

View File

@@ -120,6 +120,6 @@ void place_update(struct gamedata* gdat, int movdat) {
gdat->pdat.sel[0] += (tmp && shape_intersects(gdat->rows, id, gdat->pdat.sel + (i8vec2){tmp, 0})) * tmp;
// update roll
tmp = id - (((!!(movdat & MOVRL) - !!(movdat & MOVRR)) * 8 + id) & 31);
gdat->pdat.nxt[idx] += (tmp && shape_intersects(gdat->rows, tmp, gdat->pdat.sel)) * tmp;
tmp = id ^ (((!!(movdat & MOVRL) - !!(movdat & MOVRR)) * 8 + id) & 31);
gdat->pdat.nxt[idx] ^= (tmp && shape_intersects(gdat->rows, id ^ tmp, gdat->pdat.sel)) * tmp;
}