diff --git a/include/sect.h b/include/sect.h index 8de63584..c8031e17 100644 --- a/include/sect.h +++ b/include/sect.h @@ -100,7 +100,7 @@ struct dchrstr { char d_mnem; /* map symbol */ int d_prd; /* product type */ int d_peffic; /* process efficiency, in percent */ - int d_mcst; /* movement cost */ + int d_mcst, d_emcst; /* movement cost at 0 and 100% eff */ d_navigation d_nav; /* navigation capability */ i_packing d_pkg; /* type of packaging in these sects */ float d_ostr; /* offensive strength */ diff --git a/src/lib/common/move.c b/src/lib/common/move.c index 60c8c291..b4d7ecc9 100644 --- a/src/lib/common/move.c +++ b/src/lib/common/move.c @@ -43,34 +43,37 @@ double sector_mcost(struct sctstr *sp, int mobtype) { - double d; + double base, cost; - d = dchr[sp->sct_type].d_mcst; - if (d <= 0) + base = dchr[sp->sct_type].d_mcst; + 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; + if (CANT_HAPPEN(base < 0)) + base = 0; + if (mobtype == MOB_MOVE || mobtype == MOB_MARCH) { - d = d / (1.0 + sp->sct_road / 122.0); + /* linear function in road, base at 0%, base/10 at 100% */ + cost = base * (1.0 - 0.009 * sp->sct_road); } else if (mobtype == MOB_RAIL) { if (sp->sct_rail <= 0) return -1.0; - d = d / (1.0 + sp->sct_rail / 100.0); + /* linear function in rail, base at 0%, base/100 at 100% */ + cost = base * (1.0 - 0.0099 * sp->sct_rail); } else CANT_REACH(); - - if (d < 1.0) - d = 1.0; - if (dchr[sp->sct_type].d_mcst < 25) - d = (d * 100.0 - sp->sct_effic) / 500.0; - else - d = (d * 10.0 - sp->sct_effic) / 115; + if (CANT_HAPPEN(cost < 0)) + cost = 0; if (mobtype == MOB_MOVE) - return MAX(d, 0.001); - if (sp->sct_own != sp->sct_oldown && sp->sct_mobil <= 0 - && mobtype != MOB_RAIL) - return MAX(d, 0.2); - return MAX(d, 0.01); + return MAX(cost, 0.001); + if (sp->sct_own != sp->sct_oldown && sp->sct_mobil <= 0) + /* slow down land units in newly taken sectors */ + return cost + 0.2; + return MAX(cost, 0.02); } double diff --git a/src/lib/global/nsc.c b/src/lib/global/nsc.c index 430cd21f..3db54e28 100644 --- a/src/lib/global/nsc.c +++ b/src/lib/global/nsc.c @@ -173,6 +173,7 @@ struct castr dchr_ca[] = { {NSC_INT, 0, 0, offsetof(struct dchrstr, d_prd), "prd", EF_PRODUCT}, {NSC_INT, 0, 0, offsetof(struct dchrstr, d_peffic), "peffic", EF_BAD}, {NSC_INT, 0, 0, offsetof(struct dchrstr, d_mcst), "mcst", EF_BAD}, + {NSC_INT, 0, 0, offsetof(struct dchrstr, d_emcst), "emcst", EF_BAD}, {NSC_SITYPE(d_navigation), 0, 0, offsetof(struct dchrstr, d_nav), "nav", EF_SECTOR_NAVIGATION}, {NSC_SITYPE(i_packing), 0, 0, offsetof(struct dchrstr, d_pkg), "pkg", diff --git a/src/lib/global/sect.config b/src/lib/global/sect.config index 7d8d50e2..21494724 100644 --- a/src/lib/global/sect.config +++ b/src/lib/global/sect.config @@ -56,41 +56,41 @@ # econfig key custom_tables. config sect-chr -uid mnem prd peff mcst nav pkg ostr dstr val cost bui lcm hcm maxp name - 0 "." -1 0 0 sea norm 0.0 0.0 0 -1 0 0 0 0 "sea" - 1 "^" dust 75 25 land norm 1.0 4.0 5 -1 1 0 0 100 "mountain" - 2 "s" -1 0 0 land norm 0.0 99.0 127 -1 0 0 0 1000 "sanctuary" - 3 "\134" -1 0 0 land norm 0.0 99.0 0 -1 0 0 0 0 "wasteland" - 4 "-" -1 0 3 land norm 1.0 2.0 1 0 0 0 0 1000 "wilderness" +uid mnem prd peff mcst emcs nav pkg ostr dstr val cost bui lcm hcm maxp name + 0 "." -1 0 0 -1 sea norm 0.0 0.0 0 -1 0 0 0 0 "sea" + 1 "^" dust 75 12 6 land norm 1.0 4.0 5 -1 1 0 0 100 "mountain" + 2 "s" -1 0 0 -1 land norm 0.0 99.0 127 -1 0 0 0 1000 "sanctuary" + 3 "\134" -1 0 0 -1 land norm 0.0 99.0 0 -1 0 0 0 0 "wasteland" + 4 "-" -1 0 2 2 land norm 1.0 2.0 1 0 0 0 0 1000 "wilderness" # Uncomment one of the following two. The second one is for big cities. - 5 "c" -1 0 2 land norm 1.0 2.0 30 0 1 0 0 1000 "capital" -# 5 "c" -1 0 2 cana urba 1.0 2.0 30 0 10 1 2 1000 "city" - 6 "u" rad 100 2 land norm 1.0 2.0 15 0 1 0 0 1000 "uranium mine" - 7 "p" hap 100 2 land norm 1.0 1.5 5 0 1 0 0 1000 "park" - 8 "d" gun 100 2 land norm 1.0 1.5 7 0 1 0 0 1000 "defense plant" - 9 "i" sh 100 2 land norm 1.0 1.5 6 0 1 0 0 1000 "shell industry" - 10 "m" iron 100 2 land norm 1.0 2.0 5 0 1 0 0 1000 "mine" - 11 "g" dust 100 2 land norm 1.0 2.0 8 0 1 0 0 1000 "gold mine" - 12 "h" -1 0 2 harb ware 1.0 1.5 12 0 1 0 0 1000 "harbor" - 13 "w" -1 0 2 land ware 1.0 1.5 7 0 1 0 0 1000 "warehouse" - 14 "*" -1 0 2 land norm 1.0 1.25 12 0 1 0 0 1000 "airfield" - 15 "a" food 900 2 land norm 1.0 1.5 2 0 1 0 0 1000 "agribusiness" - 16 "o" oil 100 2 land norm 1.0 1.5 5 0 1 0 0 1000 "oil field" - 17 "j" lcm 100 2 land norm 1.0 1.5 3 0 1 0 0 1000 "light manufacturing" - 18 "k" hcm 100 2 land norm 1.0 1.5 4 0 1 0 0 1000 "heavy manufacturing" - 19 "f" -1 0 2 land norm 2.0 4.0 10 0 5 0 1 1000 "fortress" - 20 "t" tech 100 2 land norm 1.0 1.5 10 0 1 0 0 1000 "technical center" - 21 "r" med 100 2 land norm 1.0 1.5 9 0 1 0 0 1000 "research lab" - 22 "n" -1 0 2 land norm 1.0 2.0 10 0 1 0 0 1000 "nuclear plant" - 23 "l" edu 100 2 land norm 1.0 1.5 4 0 1 0 0 1000 "library/school" - 24 "+" -1 0 1 land norm 1.0 1.0 3 0 1 0 0 1000 "highway" - 25 ")" -1 0 2 land norm 1.0 1.5 4 0 1 0 0 1000 "radar installation" - 26 "!" -1 0 2 land norm 1.0 1.5 12 0 1 0 0 1000 "headquarters" - 27 "#" -1 0 1 land norm 1.0 1.5 4 0 1 0 0 1000 "bridge head" - 28 "=" -1 0 1 brid norm 1.0 1.0 5 -1 1 0 0 100 "bridge span" - 29 "b" bars 100 2 land bank 1.0 2.25 10 0 1 0 0 1000 "bank" - 30 "%" pet 1000 2 land norm 1.0 1.5 2 0 1 0 0 1000 "refinery" - 31 "e" -1 0 2 land norm 1.0 2.0 7 0 1 0 0 1000 "enlistment center" - 32 "~" -1 0 2 land norm 1.0 1.5 1 -1 1 0 0 100 "plains" - 33 "@" -1 0 1 land norm 1.0 1.5 4 -1 1 0 0 100 "bridge tower" + 5 "c" -1 0 2 1 land norm 1.0 2.0 30 0 1 0 0 1000 "capital" +# 5 "c" -1 0 2 1 cana urba 1.0 2.0 30 0 10 1 2 1000 "city" + 6 "u" rad 100 2 1 land norm 1.0 2.0 15 0 1 0 0 1000 "uranium mine" + 7 "p" hap 100 2 1 land norm 1.0 1.5 5 0 1 0 0 1000 "park" + 8 "d" gun 100 2 1 land norm 1.0 1.5 7 0 1 0 0 1000 "defense plant" + 9 "i" sh 100 2 1 land norm 1.0 1.5 6 0 1 0 0 1000 "shell industry" + 10 "m" iron 100 2 1 land norm 1.0 2.0 5 0 1 0 0 1000 "mine" + 11 "g" dust 100 2 1 land norm 1.0 2.0 8 0 1 0 0 1000 "gold mine" + 12 "h" -1 0 2 1 harb ware 1.0 1.5 12 0 1 0 0 1000 "harbor" + 13 "w" -1 0 2 1 land ware 1.0 1.5 7 0 1 0 0 1000 "warehouse" + 14 "*" -1 0 2 1 land norm 1.0 1.25 12 0 1 0 0 1000 "airfield" + 15 "a" food 900 2 1 land norm 1.0 1.5 2 0 1 0 0 1000 "agribusiness" + 16 "o" oil 100 2 1 land norm 1.0 1.5 5 0 1 0 0 1000 "oil field" + 17 "j" lcm 100 2 1 land norm 1.0 1.5 3 0 1 0 0 1000 "light manufacturing" + 18 "k" hcm 100 2 1 land norm 1.0 1.5 4 0 1 0 0 1000 "heavy manufacturing" + 19 "f" -1 0 2 1 land norm 2.0 4.0 10 0 5 0 1 1000 "fortress" + 20 "t" tech 100 2 1 land norm 1.0 1.5 10 0 1 0 0 1000 "technical center" + 21 "r" med 100 2 1 land norm 1.0 1.5 9 0 1 0 0 1000 "research lab" + 22 "n" -1 0 2 1 land norm 1.0 2.0 10 0 1 0 0 1000 "nuclear plant" + 23 "l" edu 100 2 1 land norm 1.0 1.5 4 0 1 0 0 1000 "library/school" + 24 "+" -1 0 1 0 land norm 1.0 1.0 3 0 1 0 0 1000 "highway" + 25 ")" -1 0 2 1 land norm 1.0 1.5 4 0 1 0 0 1000 "radar installation" + 26 "!" -1 0 2 1 land norm 1.0 1.5 12 0 1 0 0 1000 "headquarters" + 27 "#" -1 0 1 0 land norm 1.0 1.0 3 0 1 0 0 1000 "bridge head" + 28 "=" -1 0 1 0 brid norm 1.0 1.0 5 -1 1 0 0 100 "bridge span" + 29 "b" bars 100 2 1 land bank 1.0 2.25 10 0 1 0 0 1000 "bank" + 30 "%" pet 1000 2 1 land norm 1.0 1.5 2 0 1 0 0 1000 "refinery" + 31 "e" -1 0 2 1 land norm 1.0 2.0 7 0 1 0 0 1000 "enlistment center" + 32 "~" -1 0 2 1 land norm 1.0 1.5 1 -1 1 0 0 100 "plains" + 33 "@" -1 0 1 0 land norm 1.0 1.5 4 -1 1 0 0 100 "bridge tower" /config diff --git a/src/lib/subs/show.c b/src/lib/subs/show.c index 06b408d9..2ef8d6b0 100644 --- a/src/lib/subs/show.c +++ b/src/lib/subs/show.c @@ -535,14 +535,14 @@ show_sect_stats(int foo) if (dchr[x].d_mnem == 0) continue; if (first) { - pr(" base max max -- packing bonus -- max\n"); - pr(" sector type mcost off def mil uw civ bar other pop\n"); + pr(" mob.cost max max -- packing bonus -- max\n"); + pr(" sector type base min off def mil uw civ bar other pop\n"); first = 0; } - pr("%c %-23s %3d %5.2f %5.2f %3d %3d %3d %3d %5d %5d\n", + pr("%c %-23s %2d %2d %5.2f %5.2f %3d %3d %3d %3d %5d %5d\n", dchr[x].d_mnem, dchr[x].d_name, - dchr[x].d_mcst, dchr[x].d_ostr, - dchr[x].d_dstr, + dchr[x].d_mcst, dchr[x].d_emcst, + dchr[x].d_ostr, dchr[x].d_dstr, ichr[I_MILIT].i_pkg[dchr[x].d_pkg], ichr[I_UW].i_pkg[dchr[x].d_pkg], ichr[I_CIVIL].i_pkg[dchr[x].d_pkg],