(bp_lbcost): Don't convert the cost from double to float and back.

Simplify.
This commit is contained in:
Markus Armbruster 2006-05-07 09:19:21 +00:00
parent 97be5018e2
commit 29c61d574c

View file

@ -237,9 +237,7 @@ static double
bp_lbcost(struct as_coord from, struct as_coord to, void *pp) bp_lbcost(struct as_coord from, struct as_coord to, void *pp)
{ {
struct sctstr *sectp = (void *)empfile[EF_SECTOR].cache; struct sctstr *sectp = (void *)empfile[EF_SECTOR].cache;
struct bestp *bp = (struct bestp *)pp; struct bestp *bp = pp;
struct sctstr *ts;
float cost;
int x, y, sx, sy, offset; int x, y, sx, sy, offset;
x = to.x; x = to.x;
@ -247,9 +245,7 @@ bp_lbcost(struct as_coord from, struct as_coord to, void *pp)
sx = XNORM(x); sx = XNORM(x);
sy = YNORM(y); sy = YNORM(y);
offset = (sy * WORLD_X + sx) / 2; offset = (sy * WORLD_X + sx) / 2;
ts = &sectp[offset]; return sector_mcost(&sectp[offset], bp->bp_mobtype);
cost = sector_mcost(ts, bp->bp_mobtype);
return cost;
} }
/* /*
@ -369,7 +365,6 @@ BestShipPath(char *path, int fx, int fy, int tx, int ty, int owner)
{ {
char *map; char *map;
/* need to make sector database available to bestpath */
map = ef_ptr(EF_BMAP, owner); map = ef_ptr(EF_BMAP, owner);
if (!map) if (!map)
return NULL; return NULL;
@ -379,5 +374,5 @@ BestShipPath(char *path, int fx, int fy, int tx, int ty, int owner)
char * char *
BestAirPath(char *path, int fx, int fy, int tx, int ty) BestAirPath(char *path, int fx, int fy, int tx, int ty)
{ {
return bestownedpath(path, 0, fx, fy, tx, ty, -1); return bestownedpath(path, NULL, fx, fy, tx, ty, -1);
} }