(prmobcost): New.

(sinfra): Use it to display inaccessible sectors sensibly.
Inaccessible occurs for rail since src/lib/common/move.c rev. 1.12.
This commit is contained in:
Markus Armbruster 2006-06-15 19:46:27 +00:00
parent 2ecc85b541
commit 89022fbc42

View file

@ -44,6 +44,8 @@
#include "commands.h"
#include "combat.h"
static void prmobcost(struct sctstr *, int);
int
sinfra(void)
{
@ -76,9 +78,9 @@ sinfra(void)
pr(" ");
pr("%4d%% ", sect.sct_effic);
pr("%4d%% ", sect.sct_road);
pr("%4.3f ", sector_mcost(&sect, MOB_MOVE));
prmobcost(&sect, MOB_MOVE);
pr("%4d%% ", sect.sct_rail);
pr("%4.3f ", sector_mcost(&sect, MOB_RAIL));
prmobcost(&sect, MOB_RAIL);
pr("%4d%% ", SCT_DEFENSE(&sect));
pr("%5.2f\n", sector_strength(&sect));
}
@ -92,3 +94,14 @@ sinfra(void)
pr("%d sector%s\n", nsect, splur(nsect));
return 0;
}
static void
prmobcost(struct sctstr *sp, int mobtype)
{
double cost = sector_mcost(sp, mobtype);
if (cost < 0)
pr(" N/A ");
else
pr("%5.3f ", cost);
}