-#define cell_x(c) (((c) - st->arr) % st->arr_width)
-#define cell_y(c) (((c) - st->arr) / st->arr_width)
+#define cell_x(c) (st->arr_width ? ((c) - st->arr) % st->arr_width : 0)
+#define cell_y(c) (st->arr_width ? ((c) - st->arr) / st->arr_width : 0)
- st->xSize = st->windowWidth / st->arr_width;
- st->ySize = st->windowHeight / st->arr_height;
+ st->xSize = st->arr_width ? st->windowWidth / st->arr_width : 0;
+ st->ySize = st->arr_height ? st->windowHeight / st->arr_height : 0;
XFillRectangle (st->dpy, st->window, st->coloredGCs[0], 0, 0,
st->windowWidth, st->windowHeight);
XFillRectangle (st->dpy, st->window, st->coloredGCs[0], 0, 0,
st->windowWidth, st->windowHeight);
s = RAND_FLOAT * (st->maxlifespeed - st->minlifespeed) + st->minlifespeed;
}
newcell (st, &st->arr[y * st->arr_width + x], c, s);
s = RAND_FLOAT * (st->maxlifespeed - st->minlifespeed) + st->minlifespeed;
}
newcell (st, &st->arr[y * st->arr_width + x], c, s);