(WORLD_SZ): New.

(isok, ef_init, bmaps_intersect, bp_init, player_accept)
(finish_sects, main): Use it.

(bp_neighbors, bp_lbcost, pathcost): Use XYOFFSET().  No
functional change.
This commit is contained in:
Markus Armbruster 2007-07-28 12:12:17 +00:00
parent e24b608dc6
commit 56de7a2151
8 changed files with 18 additions and 16 deletions

View file

@ -559,7 +559,7 @@ ef_init(void)
struct symbol *lup;
int i;
empfile[EF_MAP].size = empfile[EF_BMAP].size = (WORLD_X * WORLD_Y) / 2;
empfile[EF_MAP].size = empfile[EF_BMAP].size = WORLD_SZ();
ca = (struct castr *)empfile[EF_META].cache;
for (i = 0; ca[i].ca_name; i++) ;

View file

@ -403,7 +403,7 @@ bmaps_intersect(natid a, natid b)
char *mapb = ef_ptr(EF_MAP, b);
int i;
for (i = 0; i < WORLD_X * WORLD_Y / 2; ++i, ++mapa, ++mapb)
for (i = 0; i < WORLD_SZ(); ++i, ++mapa, ++mapb)
if (*mapa && *mapa != ' ' && *mapb && *mapb != ' ')
return 1;
return 0;

View file

@ -83,8 +83,7 @@ bp_init(void)
return NULL;
if (neighsects == NULL)
neighsects = calloc(((WORLD_X * WORLD_Y) / 2) * 6,
sizeof(struct sctstr *));
neighsects = calloc(WORLD_SZ() * 6, sizeof(struct sctstr *));
return bp;
}
@ -193,7 +192,7 @@ bp_neighbors(struct as_coord c, struct as_coord *cp, void *pp)
y = c.y;
sx = XNORM(x);
sy = YNORM(y);
offset = (sy * WORLD_X + sx) / 2;
offset = XYOFFSET(sx, sy);
from = &sectp[offset];
if (neighsects == NULL)
@ -207,7 +206,7 @@ bp_neighbors(struct as_coord c, struct as_coord *cp, void *pp)
ny = y + diroff[q][1];
sx = XNORM(nx);
sy = YNORM(ny);
offset = (sy * WORLD_X + sx) / 2;
offset = XYOFFSET(sx, sy);
sp = &sectp[offset];
*ssp = sp;
} else {
@ -246,7 +245,7 @@ bp_lbcost(struct as_coord from, struct as_coord to, void *pp)
y = to.y;
sx = XNORM(x);
sy = YNORM(y);
offset = (sy * WORLD_X + sx) / 2;
offset = XYOFFSET(sx, sy);
return sector_mcost(&sectp[offset], bp->bp_mobtype);
}
@ -327,7 +326,7 @@ pathcost(struct sctstr *start, char *path, int mob_type)
cy += diroff[o][1];
sx = XNORM(cx);
sy = YNORM(cy);
offset = (sy * WORLD_X + sx) / 2;
offset = XYOFFSET(sx, sy);
sp = &sectp[offset];
cost += sector_mcost(sp, mob_type);
path++;