(dchrstr): Replace int members d_mcst and d_emcst (mobility cost * 5)
by float d_mob0 and d_mob1 (straight costs). Impassable terrain now encoded as negative d_mob0 instead of zero d_mcst. Users changed. sect.config updated. (dchr_ca): Replace selectors mcst and emcst by mob0 and mob1. (show_sect_stats): Show real mobility costs.
This commit is contained in:
parent
d16fc6afdd
commit
df6f365a71
8 changed files with 52 additions and 53 deletions
|
@ -45,13 +45,12 @@ sector_mcost(struct sctstr *sp, int mobtype)
|
|||
{
|
||||
double base, cost;
|
||||
|
||||
base = dchr[sp->sct_type].d_mcst;
|
||||
if (base <= 0)
|
||||
base = dchr[sp->sct_type].d_mob0;
|
||||
if (base < 0)
|
||||
return -1.0;
|
||||
|
||||
/* linear function in eff, d_mcst at 0%, d_emcst at 100% */
|
||||
base += (dchr[sp->sct_type].d_emcst - base) * sp->sct_effic / 100;
|
||||
base /= 5;
|
||||
base += (dchr[sp->sct_type].d_mob1 - base) * sp->sct_effic / 100;
|
||||
if (CANT_HAPPEN(base < 0))
|
||||
base = 0;
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ bp_neighbors(struct as_coord c, struct as_coord *cp, void *pp)
|
|||
}
|
||||
/* No need to calculate cost each time, just make sure we can
|
||||
move through it. We calculate it later. */
|
||||
if (dchr[sp->sct_type].d_mcst == 0)
|
||||
if (dchr[sp->sct_type].d_mob0 < 0)
|
||||
continue;
|
||||
if (bp->bp_mobtype == MOB_RAIL
|
||||
&& (!intrchr[INT_RAIL].in_enable || sp->sct_rail == 0))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue