Fix size of sector bitmap in do_look() and draw_map()
They allocated twice as much as needed.
This commit is contained in:
parent
c89f8172ec
commit
d44ae3ef96
2 changed files with 6 additions and 6 deletions
|
@ -72,12 +72,12 @@ do_look(short type)
|
|||
|
||||
if (!snxtitem(&ni, type, player->argp[1], NULL))
|
||||
return RET_SYN;
|
||||
if ((bitmap = malloc((WORLD_X * WORLD_Y) / 8)) == 0) {
|
||||
bitmap = calloc(WORLD_SZ() / 8, 1);
|
||||
if (!bitmap) {
|
||||
logerror("malloc failed in do_look\n");
|
||||
pr("Memory error. Tell the deity.\n");
|
||||
return RET_FAIL;
|
||||
}
|
||||
memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
|
||||
while (nxtitem(&ni, &unit)) {
|
||||
if (!player->owner)
|
||||
continue;
|
||||
|
|
|
@ -147,7 +147,7 @@ draw_map(int bmap, char origin, int map_flags, struct nstr_sect *nsp)
|
|||
}
|
||||
}
|
||||
if (!bitmap)
|
||||
bitmap = malloc((WORLD_X * WORLD_Y) / 8);
|
||||
bitmap = malloc(WORLD_SZ() / 8);
|
||||
if (!wmapbuf || !wmap || !bitmap) {
|
||||
pr("Memory error, tell the deity.\n");
|
||||
logerror("malloc failed in draw_map\n");
|
||||
|
@ -202,7 +202,7 @@ draw_map(int bmap, char origin, int map_flags, struct nstr_sect *nsp)
|
|||
struct sctstr sect;
|
||||
|
||||
if (!player->god) {
|
||||
memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
|
||||
memset(bitmap, 0, WORLD_SZ() / 8);
|
||||
bitinit2(nsp, bitmap, player->cnum);
|
||||
}
|
||||
while (nxtsct(nsp, §) && !player->aborted) {
|
||||
|
@ -221,7 +221,7 @@ draw_map(int bmap, char origin, int map_flags, struct nstr_sect *nsp)
|
|||
int changed = 0;
|
||||
|
||||
if (!player->god) {
|
||||
memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
|
||||
memset(bitmap, 0, WORLD_SZ() / 8);
|
||||
bitinit2(nsp, bitmap, player->cnum);
|
||||
}
|
||||
while (nxtsct(nsp, §) && !player->aborted) {
|
||||
|
@ -265,7 +265,7 @@ draw_map(int bmap, char origin, int map_flags, struct nstr_sect *nsp)
|
|||
|
||||
snxtsct_rewind(nsp);
|
||||
if (!player->god) {
|
||||
memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
|
||||
memset(bitmap, 0, WORLD_SZ() / 8);
|
||||
bitinit2(nsp, bitmap, player->cnum);
|
||||
}
|
||||
while (nxtsct(nsp, §) && !player->aborted) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue