]> git.pond.sub.org Git - empserver/commitdiff
(dchrstr): Replace int members d_mcst and d_emcst (mobility cost * 5)
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 17 Jun 2006 14:08:20 +0000 (14:08 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 17 Jun 2006 14:08:20 +0000 (14:08 +0000)
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.

include/sect.h
src/lib/common/move.c
src/lib/common/path.c
src/lib/global/nsc.c
src/lib/global/sect.config
src/lib/subs/attsub.c
src/lib/subs/show.c
src/lib/update/revolt.c

index 7ace7da75aca8866cf4b1dd85e0ac6f72ba84ce6..a2a060751322a4ef3ce9c34d44430a6f9280fd3f 100644 (file)
@@ -100,7 +100,7 @@ struct dchrstr {
     char d_mnem;               /* map symbol */
     int d_prd;                 /* product type */
     int d_peffic;              /* process efficiency, in percent */
     char d_mnem;               /* map symbol */
     int d_prd;                 /* product type */
     int d_peffic;              /* process efficiency, in percent */
-    int d_mcst, d_emcst;       /* movement cost at 0 and 100% eff */
+    float d_mob0, d_mob1;      /* 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 */
     d_navigation d_nav;                /* navigation capability */
     i_packing d_pkg;           /* type of packaging in these sects */
     float d_ostr;              /* offensive strength */
index 52f3accf8b5ea34aaac0d98b47c21503b6d21efe..40bf2e9030e87505a2530e407f08a1d9cd7d929a 100644 (file)
@@ -45,13 +45,12 @@ sector_mcost(struct sctstr *sp, int mobtype)
 {
     double base, cost;
 
 {
     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% */
        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;
 
     if (CANT_HAPPEN(base < 0))
        base = 0;
 
index 985e4f770430a33c2e91a2a30ef07e45502930a7..a1062ff9730bb2b6d4f64156549410a3d172882b 100644 (file)
@@ -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. */
        }
        /* 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))
            continue;
        if (bp->bp_mobtype == MOB_RAIL
            && (!intrchr[INT_RAIL].in_enable || sp->sct_rail == 0))
index 44e4dd45aeae9b8d8ae09c42a7ef330d998a8944..c6f3c22c97372accd1d8f6afa490128fe5c52e42 100644 (file)
@@ -172,8 +172,8 @@ struct castr dchr_ca[] = {
      EF_BAD},
     {NSC_INT, 0, 0, offsetof(struct dchrstr, d_prd), "prd", EF_PRODUCT},
     {NSC_INT, 0, 0, offsetof(struct dchrstr, d_peffic), "peffic", EF_BAD},
      EF_BAD},
     {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_FLOAT, 0, 0, offsetof(struct dchrstr, d_mob0), "mob0", EF_BAD},
+    {NSC_FLOAT, 0, 0, offsetof(struct dchrstr, d_mob1), "mob1", 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",
     {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",
index d67a9cfe960c243244184d1ef987c4a69a049452..93c3779a73c4f5624daa2bdccf11e4a9508f6d67 100644 (file)
 # econfig key custom_tables.
 
 config sect-chr
 # econfig key custom_tables.
 
 config sect-chr
-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"
+uid mnem  prd peff mob0 mob1  nav  pkg ostr dstr val cost bui lcm hcm maxp name
+  0  "."   -1    0   -1   -1  sea norm  0.0  0.0   0   -1   0   0   0    0 "sea"
+  1  "^" dust   75  2.4  1.2 land norm  1.0  4.0   5   -1   1   0   0  100 "mountain"
+  2  "s"   -1    0   -1   -1 land norm  0.0 99.0 127   -1   0   0   0 1000 "sanctuary"
+  3 "\134" -1    0   -1   -1 land norm  0.0 99.0   0   -1   0   0   0    0 "wasteland"
+  4  "-"   -1    0  0.4  0.4 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.
 # Uncomment one of the following two.  The second one is for big cities.
-  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    2    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    2    0 land norm  1.0  1.0   3    0   1   0   0 1000 "bridge head"
- 28  "="   -1    0    2    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    2    0 land norm  1.0  1.5   4   -1   1   0   0  100 "bridge tower"
+  5  "c"   -1    0  0.4  0.2 land norm  1.0  2.0  30    0   1   0   0 1000 "capital"
+# 5  "c"   -1    0  0.4  0.2 cana urba  1.0  2.0  30    0  10   1   2 1000 "city"
+  6  "u"  rad  100  0.4  0.2 land norm  1.0  2.0  15    0   1   0   0 1000 "uranium mine"
+  7  "p"  hap  100  0.4  0.2 land norm  1.0  1.5   5    0   1   0   0 1000 "park"
+  8  "d"  gun  100  0.4  0.2 land norm  1.0  1.5   7    0   1   0   0 1000 "defense plant"
+  9  "i"   sh  100  0.4  0.2 land norm  1.0  1.5   6    0   1   0   0 1000 "shell industry"
+ 10  "m" iron  100  0.4  0.2 land norm  1.0  2.0   5    0   1   0   0 1000 "mine"
+ 11  "g" dust  100  0.4  0.2 land norm  1.0  2.0   8    0   1   0   0 1000 "gold mine"
+ 12  "h"   -1    0  0.4  0.2 harb ware  1.0  1.5  12    0   1   0   0 1000 "harbor"
+ 13  "w"   -1    0  0.4  0.2 land ware  1.0  1.5   7    0   1   0   0 1000 "warehouse"
+ 14  "*"   -1    0  0.4  0.2 land norm  1.0  1.25 12    0   1   0   0 1000 "airfield"
+ 15  "a" food  900  0.4  0.2 land norm  1.0  1.5   2    0   1   0   0 1000 "agribusiness"
+ 16  "o"  oil  100  0.4  0.2 land norm  1.0  1.5   5    0   1   0   0 1000 "oil field"
+ 17  "j"  lcm  100  0.4  0.2 land norm  1.0  1.5   3    0   1   0   0 1000 "light manufacturing"
+ 18  "k"  hcm  100  0.4  0.2 land norm  1.0  1.5   4    0   1   0   0 1000 "heavy manufacturing"
+ 19  "f"   -1    0  0.4  0.2 land norm  2.0  4.0  10    0   5   0   1 1000 "fortress"
+ 20  "t" tech  100  0.4  0.2 land norm  1.0  1.5  10    0   1   0   0 1000 "technical center"
+ 21  "r"  med  100  0.4  0.2 land norm  1.0  1.5   9    0   1   0   0 1000 "research lab"
+ 22  "n"   -1    0  0.4  0.2 land norm  1.0  2.0  10    0   1   0   0 1000 "nuclear plant"
+ 23  "l"  edu  100  0.4  0.2 land norm  1.0  1.5   4    0   1   0   0 1000 "library/school"
+ 24  "+"   -1    0  0.4  0.0 land norm  1.0  1.0   3    0   1   0   0 1000 "highway"
+ 25  ")"   -1    0  0.4  0.2 land norm  1.0  1.5   4    0   1   0   0 1000 "radar installation"
+ 26  "!"   -1    0  0.4  0.2 land norm  1.0  1.5  12    0   1   0   0 1000 "headquarters"
+ 27  "#"   -1    0  0.4  0.0 land norm  1.0  1.0   3    0   1   0   0 1000 "bridge head"
+ 28  "="   -1    0  0.4  0.0 brid norm  1.0  1.0   5   -1   1   0   0  100 "bridge span"
+ 29  "b" bars  100  0.4  0.2 land bank  1.0  2.25 10    0   1   0   0 1000 "bank"
+ 30  "%"  pet 1000  0.4  0.2 land norm  1.0  1.5   2    0   1   0   0 1000 "refinery"
+ 31  "e"   -1    0  0.4  0.2 land norm  1.0  2.0   7    0   1   0   0 1000 "enlistment center"
+ 32  "~"   -1    0  0.4  0.2 land norm  1.0  1.5   1   -1   1   0   0  100 "plains"
+ 33  "@"   -1    0  0.4  0.0 land norm  1.0  1.5   4   -1   1   0   0  100 "bridge tower"
 /config
 /config
index d1a7898739ebf5c093d357dc46c6a9d869a7dc30..94dd69ae70d14a95aeb5f32298aa8699a9b1efba 100644 (file)
@@ -514,7 +514,7 @@ att_abort(int combat_mode, struct combat *off, struct combat *def)
        return land_board_abort(off, def);
     }
 
        return land_board_abort(off, def);
     }
 
-    if (off && def->sct_dcp->d_mcst <= 0) {
+    if (off && def->sct_dcp->d_mob0 < 0) {
        pr("You can't %s a %s sector!\n",
           att_mode[combat_mode], def->sct_dcp->d_name);
        return abort_attack();
        pr("You can't %s a %s sector!\n",
           att_mode[combat_mode], def->sct_dcp->d_name);
        return abort_attack();
@@ -1695,8 +1695,8 @@ att_get_support(int combat_mode, int ofort, int oship, int oland,
 
     /*
      * I need to put a 1 at the end of the next four total_stren calls
 
     /*
      * I need to put a 1 at the end of the next four total_stren calls
-     * becauase units & mil may have been damaged by collateral damage or
-     * neclear warheads from the offensive & defensive support.
+     * because units & mil may have been damaged by collateral damage or
+     * nuclear warheads from the offensive & defensive support.
      */
 
     ototal = get_ototal(combat_mode, off, olist, *osupportp, 1);
      */
 
     ototal = get_ototal(combat_mode, off, olist, *osupportp, 1);
index aeaac665f59b0a44d7d792f0e954dce56c60da41..a9e5b6b2fb8d6ea5996c66d5540efef22da80313 100644 (file)
@@ -542,14 +542,14 @@ show_sect_stats(int foo)
            continue;
        if (first) {
            pr("                        mob cost   max   max   --  packing bonus  --   max\n");
            continue;
        if (first) {
            pr("                        mob cost   max   max   --  packing bonus  --   max\n");
-           pr("  sector type           base eff   off   def   mil  uw civ bar other   pop\n");
+           pr("  sector type            0%% 100%%   off   def   mil  uw civ bar other   pop\n");
            first = 0;
        }
            first = 0;
        }
-       pr("%c %-23s", dchr[x].d_mnem, dchr[x].d_name);
-       if (dchr[x].d_mcst <= 0)
-           pr(" no way");
+       pr("%c %-21.21s", dchr[x].d_mnem, dchr[x].d_name);
+       if (dchr[x].d_mob0 < 0)
+           pr("  no way ");
        else
        else
-           pr(" %2d  %2d", dchr[x].d_mcst, dchr[x].d_emcst);
+           pr(" %3.1f  %3.1f", dchr[x].d_mob0, dchr[x].d_mob1);
        pr("  %5.2f %5.2f   %3d %3d %3d %3d %5d %5d\n",
           dchr[x].d_ostr, dchr[x].d_dstr,
           ichr[I_MILIT].i_pkg[dchr[x].d_pkg],
        pr("  %5.2f %5.2f   %3d %3d %3d %3d %5d %5d\n",
           dchr[x].d_ostr, dchr[x].d_dstr,
           ichr[I_MILIT].i_pkg[dchr[x].d_pkg],
index 5ac712923b0eb918781a0e2e65869f0bd4d706ef..3f613ee3b4ca098ad353948a92e6c883239a3715 100644 (file)
@@ -374,7 +374,7 @@ guerrilla(struct sctstr *sp)
        for (n = 1; n <= 6; n++) {
            nsp = getsectp(sp->sct_x + diroff[n][0],
                           sp->sct_y + diroff[n][1]);
        for (n = 1; n <= 6; n++) {
            nsp = getsectp(sp->sct_x + diroff[n][0],
                           sp->sct_y + diroff[n][1]);
-           if (dchr[nsp->sct_type].d_mcst == 0)
+           if (dchr[nsp->sct_type].d_mob0 < 0)
                continue;
            if (nsp->sct_own != target)
                continue;
                continue;
            if (nsp->sct_own != target)
                continue;