Simplify eta_calc(): let caller compute path length
This commit is contained in:
parent
37d3846009
commit
cdff437772
1 changed files with 4 additions and 4 deletions
|
@ -285,13 +285,12 @@ orde(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eta_calc(struct shpstr *sp, char *path, int *len, int *nupdates)
|
eta_calc(struct shpstr *sp, int len, int *nupdates)
|
||||||
{
|
{
|
||||||
double mobcost, mobil;
|
double mobcost, mobil;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = strlen(path);
|
i = len;
|
||||||
*len = i;
|
|
||||||
*nupdates = 1;
|
*nupdates = 1;
|
||||||
|
|
||||||
mobcost = shp_mobcost(sp);
|
mobcost = shp_mobcost(sp);
|
||||||
|
@ -440,7 +439,8 @@ sorde(void)
|
||||||
pr(" has arrived");
|
pr(" has arrived");
|
||||||
else {
|
else {
|
||||||
/* distance to destination */
|
/* distance to destination */
|
||||||
eta_calc(&ship, c, &len, &updates);
|
len = strlen(c);
|
||||||
|
eta_calc(&ship, len, &updates);
|
||||||
pr(" %3d %4d", len, updates);
|
pr(" %3d %4d", len, updates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue