From 8bd0a2cf81129a8461f280c9835c233e56fb6369 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 28 Jul 2007 12:16:50 +0000 Subject: [PATCH] (bp_ref): Use XYOFFSET(). Old code used only every other slot. (bp_alloc): Use WORLD_SZ(). Allocates only half as much. --- src/lib/update/bp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/update/bp.c b/src/lib/update/bp.c index fe51a99c..2941c274 100644 --- a/src/lib/update/bp.c +++ b/src/lib/update/bp.c @@ -71,7 +71,7 @@ static enum bp_item_idx bud_key[I_MAX + 1] = { static struct bp * bp_ref(struct bp *bp, struct sctstr *sp) { - return &bp[sp->sct_x + sp->sct_y * WORLD_X]; + return &bp[XYOFFSET(sp->sct_x, sp->sct_y)]; } /* @@ -142,5 +142,5 @@ bp_set_from_sect(struct bp *bp, struct sctstr *sp) struct bp * bp_alloc(void) { - return calloc(WORLD_X * WORLD_Y, sizeof(struct bp)); + return calloc(WORLD_SZ(), sizeof(struct bp)); }