Mercurial > MadButterfly
diff src/event.c @ 139:1695a4b02b14
Members of coords are geos instead of shapes, now.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Mon, 22 Sep 2008 19:22:57 +0800 |
parents | 23bc382d9683 |
children | c1cdd3fcd28f |
line wrap: on
line diff
--- a/src/event.c Mon Sep 22 11:45:00 2008 +0800 +++ b/src/event.c Mon Sep 22 19:22:57 2008 +0800 @@ -8,6 +8,8 @@ #define OK 0 #define ERR -1 +#define ARRAY_EXT_SZ 64 + static int extend_memblk(void **buf, int o_size, int n_size) { void *new_buf; @@ -33,7 +35,7 @@ int r; if(rdman->n_gen_geos >= rdman->max_gen_geos) { - max_gen_geos = rdman->n_geos; + max_gen_geos = rdman->max_gen_geos + ARRAY_EXT_SZ; r = extend_memblk((void **)&rdman->gen_geos, sizeof(geo_t *) * rdman->n_gen_geos, sizeof(geo_t *) * max_gen_geos); @@ -57,9 +59,9 @@ rdman->n_gen_geos = 0; - for(geo = STAILQ_HEAD(rdman->all_geos); + for(geo = rdman_geos(rdman, NULL); geo != NULL; - geo = STAILQ_NEXT(geo_t, next, geo)) { + geo = rdman_geos(rdman, geo)) { if(geo_pos_is_in(geo, x, y)) { r = add_gen_geo(rdman, geo); if(r != OK)