Use MAPWIDTH() to allocate map buffers
sona(), radmap2() and satmap() used WORLD_X + 1, which equals MAPWIDTH(1). Using MAPWIDTH() is somewhat clearer and cleaner.
This commit is contained in:
parent
d012940230
commit
7803cd9dd1
3 changed files with 5 additions and 5 deletions
|
@ -73,9 +73,9 @@ sona(void)
|
|||
if (!snxtitem(&ni, EF_SHIP, player->argp[1], NULL))
|
||||
return RET_SYN;
|
||||
if (!radbuf)
|
||||
radbuf = malloc((WORLD_Y * (WORLD_X + 1)));
|
||||
radbuf = malloc(WORLD_Y * MAPWIDTH(1));
|
||||
if (!visbuf)
|
||||
visbuf = malloc((WORLD_Y * (WORLD_X + 1)));
|
||||
visbuf = malloc(WORLD_Y * MAPWIDTH(1));
|
||||
if (!rad && radbuf) {
|
||||
rad = malloc(WORLD_Y * sizeof(char *));
|
||||
if (rad) {
|
||||
|
|
|
@ -91,9 +91,9 @@ radmap2(int owner,
|
|||
int changed = 0;
|
||||
|
||||
if (!radbuf)
|
||||
radbuf = malloc(WORLD_Y * (WORLD_X + 1));
|
||||
radbuf = malloc(WORLD_Y * MAPWIDTH(1));
|
||||
if (!visbuf)
|
||||
visbuf = malloc(WORLD_Y * (WORLD_X + 1));
|
||||
visbuf = malloc(WORLD_Y * MAPWIDTH(1));
|
||||
if (!rad) {
|
||||
rad = malloc(WORLD_Y * sizeof(char *));
|
||||
if (rad && radbuf) {
|
||||
|
|
|
@ -73,7 +73,7 @@ satmap(int x, int y, int eff, int range, int flags, int type)
|
|||
return;
|
||||
|
||||
if (!radbuf)
|
||||
radbuf = malloc(WORLD_Y * (WORLD_X + 1));
|
||||
radbuf = malloc(WORLD_Y * MAPWIDTH(1));
|
||||
if (!rad) {
|
||||
rad = malloc(WORLD_Y * sizeof(char *));
|
||||
if (rad && radbuf) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue