(bp_ref): Use XYOFFSET(). Old code used only every other slot.
(bp_alloc): Use WORLD_SZ(). Allocates only half as much.
This commit is contained in:
parent
56de7a2151
commit
8bd0a2cf81
1 changed files with 2 additions and 2 deletions
|
@ -71,7 +71,7 @@ static enum bp_item_idx bud_key[I_MAX + 1] = {
|
||||||
static struct bp *
|
static struct bp *
|
||||||
bp_ref(struct bp *bp, struct sctstr *sp)
|
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 *
|
struct bp *
|
||||||
bp_alloc(void)
|
bp_alloc(void)
|
||||||
{
|
{
|
||||||
return calloc(WORLD_X * WORLD_Y, sizeof(struct bp));
|
return calloc(WORLD_SZ(), sizeof(struct bp));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue