fallin': always push back NULLed out subwindows

I noticed while running benchmarks against ranges of widths that
we failed on certain widths. I traced this down to a repeatable
failure when run with the -c flag at the 104x52 resolution. At this
geometry and PRNG seed, we NULLed out the first subwindow of fallin',
but didn't recompress the window array. On the next loop we thus used
it again, and segfaulted out. This fixes that up. We now pass 100% of
the benchmarks, whereas we were failing about 3% before #407.
pull/412/head
nick black 5 years ago
parent f4b90a3587
commit 12b601e02b
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -40,7 +40,7 @@ drop_bricks(struct notcurses* nc, struct ncplane** arr, int arrcount){
if(y + speeds[i] >= stdy){
ncplane_destroy(ncp);
arr[ranges + i] = NULL;
if(ranges + i + 1 == arrcount){
if(ranges + i + 1 == rangee){
ranges += i + 1;
break;
}
@ -58,6 +58,12 @@ drop_bricks(struct notcurses* nc, struct ncplane** arr, int arrcount){
if(!felloff){
ncplane_move_yx(ncp, y + speeds[i], x);
++speeds[i];
}else if(i){
if(rangee - ranges - i){
memmove(speeds, speeds + i, (rangee - ranges - i) * sizeof(*speeds));
}
ranges += i;
i = 0;
}
nanosleep(&iterdelay, NULL);
}

@ -16,6 +16,9 @@ int main(void){
ncplane_putstr_yx(n, 6, 0, "P⃞a⃞c⃞k⃞m⃞y⃞b⃞o⃞x⃞w⃞i⃞t⃞h⃞f⃞i⃞v⃞e⃞d⃞o⃞z⃞e⃞n⃞l⃞i⃞q⃞u⃞o⃞r⃞j⃞u⃞g⃞s⃞.⃞");
ncplane_putstr_yx(n, 7, 0, "P⃣a⃣c⃣k⃣m⃣y⃣b⃣o⃣x⃣w⃣i⃣t⃣h⃣f⃣i⃣v⃣e⃣d⃣o⃣z⃣e⃣n⃣l⃣i⃣q⃣u⃣o⃣r⃣j⃣u⃣g⃣s⃣.⃣");
ncplane_putstr_yx(n, 8, 0, "ᴘᴀᴄᴋ ᴍʏ ʙx ᴡɪᴛʜ ꜰɪᴠᴇ ᴅᴏᴢᴇɴ ʟɪQʀ ᴊᴜɢꜱ.");
ncplane_putstr_yx(n, 9, 0, "🅝🅔🅖🅐🅣🅘🅥🅔 🅒🅘🅡🅒🅛🅔🅢 🅐🅡🅔 🅐🅛🅢🅞 🅐🅥🅐🅘🅛🅐🅑🅛🅔");
ncplane_putstr_yx(n, 10, 0, "🄴🅂🄲🄷🄴🅆 🄲🄸🅁🄲🄻🄴🅂 🄶🄴🅃 🅂🅀🅄🄰🅁🄴🅂");
ncplane_putstr_yx(n, 11, 0, "🅰 🅱🅴🅰🆄🆃🅸🅵🆄🅻 🆄🆂🅴 🅾🅵 🅽🅴🅶🅰🆃🅸🆅🅴 🆂🆀🆄🅰🆁🅴🆂");
notcurses_render(nc);
notcurses_stop(nc);
return EXIT_SUCCESS;

Loading…
Cancel
Save