JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
* rocks.c (init_buckets): oops, we weren't allocating big enough arrays.
authorJoshua Grams <josh@qualdan.com>
Thu, 5 Jan 2006 00:09:57 +0000 (00:09 +0000)
committerJoshua Grams <josh@qualdan.com>
Thu, 5 Jan 2006 00:09:57 +0000 (00:09 +0000)
rocks.c

diff --git a/rocks.c b/rocks.c
index a594547..0a71ebf 100644 (file)
--- a/rocks.c
+++ b/rocks.c
@@ -56,8 +56,10 @@ bucket(int x, int y, int p)
 void
 init_buckets(void)
 {
 void
 init_buckets(void)
 {
-       bw = (XSIZE+2*grid_size-1) / grid_size;
-       bh = (YSIZE+2*grid_size-1) / grid_size;
+       int scr_grid_w = (XSIZE+2*grid_size-1) / grid_size;
+       int scr_grid_h = (YSIZE+2*grid_size-1) / grid_size;
+       bw = 1 + scr_grid_w + 1;
+       bh = 1 + scr_grid_h + 1;
        n_buckets = bw * bh;
        
        rock_buckets[0] = malloc(n_buckets * sizeof(struct rock_struct *));
        n_buckets = bw * bh;
        
        rock_buckets[0] = malloc(n_buckets * sizeof(struct rock_struct *));