]> git.pond.sub.org Git - empserver/commitdiff
(meltitems): Move melt_item_denom into the ichr structure.
authorRon Koenderink <rkoenderink@yahoo.ca>
Sun, 24 Jul 2005 22:20:05 +0000 (22:20 +0000)
committerRon Koenderink <rkoenderink@yahoo.ca>
Sun, 24 Jul 2005 22:20:05 +0000 (22:20 +0000)
include/item.h
src/lib/global/constants.c
src/lib/global/item.c
src/lib/update/sect.c

index f107545bb894a1bb62503b6c03d1287cfcbe6ef4..ae228acb6d82f5fa4e81be7c06f0b858069ba418 100644 (file)
@@ -74,6 +74,7 @@ struct ichrstr {
     int i_sell;                        /* can this be sold? */
     int i_lbs;                 /* how hard to move */
     int i_pkg[NUMPKG];         /* units for reg, ware, urb, bank */
     int i_sell;                        /* can this be sold? */
     int i_lbs;                 /* how hard to move */
     int i_pkg[NUMPKG];         /* units for reg, ware, urb, bank */
+    int i_melt_denom;          /* fallout meltdown denominator */
     char *i_name;              /* full name of item */
 };
 
     char *i_name;              /* full name of item */
 };
 
index 2577e55dd9181cd519ac81b4a77f1908db86a4ad..5979a762644cf67eaa34a9291833d9fb07f0074c 100644 (file)
@@ -124,14 +124,6 @@ double uwbrate = 0.0025;   /* uncompensated worker birth rate */
 int rollover_avail_max = 0;    /* max. avail that can roll over an update */
 
 /* opt_FALLOUT */
 int rollover_avail_max = 0;    /* max. avail that can roll over an update */
 
 /* opt_FALLOUT */
-/* these are the radioactive decay constants */
-/* fraction of commodity destroyed is
-   etus*fallout/(1000*melt_item_denom[item])
-   higher denominators for tougher commodities */
-int melt_item_denom[] = {
-/* civ  mil shell gun  pet iron dust  bar food  oil  lcm  hcm uw  rads */
-     4,  20,  80, 100,  50, 100, 100, 200,   2,  50, 100, 100, 2, 1000
-};
 double decay_per_etu = 0.006;  /* This gives a half life of ? etus,
                                   about ? days.
                                   half life in Jt
 double decay_per_etu = 0.006;  /* This gives a half life of ? etus,
                                   about ? days.
                                   half life in Jt
index 2c865aba75985328354b3e39c14e466c4a098719..f29b6fec5619437c9a3b1d46a51d2a2211c63834 100644 (file)
 #include "item.h"
 
 struct ichrstr ichr[I_MAX + 2] = {
 #include "item.h"
 
 struct ichrstr ichr[I_MAX + 2] = {
-/*  mnem  vtype   val sell lbs {in rg wh  ur bnk}  name */
-    {'c', I_CIVIL,  1, 0,  1, {1, 10, 10, 10, 10}, "civilians"},
-    {'m', I_MILIT,  0, 0,  1, {1,  1,  1,  1,  1}, "military"},
-    {'s', I_SHELL,  5, 1,  1, {1,  1, 10,  1,  1}, "shells"},
-    {'g', I_GUN,   60, 1, 10, {1,  1, 10,  1,  1}, "guns"},
-    {'p', I_PETROL, 4, 1,  1, {1,  1, 10,  1,  1}, "petrol"},
-    {'i', I_IRON,   2, 1,  1, {1,  1, 10,  1,  1}, "iron ore"},
-    {'d', I_DUST,  20, 1,  5, {1,  1, 10,  1,  1}, "dust (gold)"},
-    {'b', I_BAR,  280, 1, 50, {1,  1,  5,  1,  4}, "bars of gold"},
-    {'f', I_FOOD,   0, 1,  1, {1,  1, 10,  1,  1}, "food"},
-    {'o', I_OIL,    8, 1,  1, {1,  1, 10,  1,  1}, "oil"},
-    {'l', I_LCM,    2, 1,  1, {1,  1, 10,  1,  1}, "light products"},
-    {'h', I_HCM,    4, 1,  1, {1,  1, 10,  1,  1}, "heavy products"},
-    {'u', I_UW,     1, 1,  2, {1,  1,  2,  1,  1}, "uncompensated workers"},
-    {'r', I_RAD,  150, 1,  8, {1,  1, 10,  1,  1}, "radioactive materials"},
-    {0,   I_NONE,   0, 0,  0, {0,  0,  0,  0,  0}, NULL}
+/*  mnem  vtype   val sell lbs {in rg wh  ur bnk} melt  name */
+    {'c', I_CIVIL,  1, 0,  1, {1, 10, 10, 10, 10},   4, "civilians"},
+    {'m', I_MILIT,  0, 0,  1, {1,  1,  1,  1,  1},  20, "military"},
+    {'s', I_SHELL,  5, 1,  1, {1,  1, 10,  1,  1},  80, "shells"},
+    {'g', I_GUN,   60, 1, 10, {1,  1, 10,  1,  1}, 100, "guns"},
+    {'p', I_PETROL, 4, 1,  1, {1,  1, 10,  1,  1},  50, "petrol"},
+    {'i', I_IRON,   2, 1,  1, {1,  1, 10,  1,  1}, 100, "iron ore"},
+    {'d', I_DUST,  20, 1,  5, {1,  1, 10,  1,  1}, 100, "dust (gold)"},
+    {'b', I_BAR,  280, 1, 50, {1,  1,  5,  1,  4}, 200, "bars of gold"},
+    {'f', I_FOOD,   0, 1,  1, {1,  1, 10,  1,  1},   2, "food"},
+    {'o', I_OIL,    8, 1,  1, {1,  1, 10,  1,  1},  50, "oil"},
+    {'l', I_LCM,    2, 1,  1, {1,  1, 10,  1,  1}, 100, "light products"},
+    {'h', I_HCM,    4, 1,  1, {1,  1, 10,  1,  1}, 100, "heavy products"},
+    {'u', I_UW,     1, 1,  2, {1,  1,  2,  1,  1},   2, "uncompensated workers"},
+    {'r', I_RAD,  150, 1,  8, {1,  1, 10,  1,  1},1000, "radioactive materials"},
+    {0,   I_NONE,   0, 0,  0, {0,  0,  0,  0,  0},   0, NULL}
 };
 
 int itm_maxno = (sizeof(ichr) / sizeof(struct ichrstr)) - 1;
 };
 
 int itm_maxno = (sizeof(ichr) / sizeof(struct ichrstr)) - 1;
index d4f162731a6763354ee87400418207f57511bd37..d325694b9536a1c01f7f2aab022715e93334f318 100644 (file)
@@ -171,7 +171,7 @@ meltitems(int etus, int fallout, int own, short *vec, int type, int x, int y,
 
     for (n = I_NONE + 1; n <= I_MAX; n++) {
        melt = roundavg(vec[n] * etus * (long)fallout
 
     for (n = I_NONE + 1; n <= I_MAX; n++) {
        melt = roundavg(vec[n] * etus * (long)fallout
-                       / (1000.0 * melt_item_denom[n]));
+                       / (1000.0 * ichr[n].i_melt_denom));
        if (melt > vec[n])
            melt = vec[n];
        if (melt > 5 && own) {
        if (melt > vec[n])
            melt = vec[n];
        if (melt > 5 && own) {
@@ -193,12 +193,10 @@ meltitems(int etus, int fallout, int own, short *vec, int type, int x, int y,
 }
 
 /*
 }
 
 /*
- * do_fallout - calculate fallout for sectors.
- *
- * This is etu based.  But, do limit HUGE kill offs in large ETU
- * games, the melting etus rate is limited to 24 etus.
+ * Do fallout meltdown for sector SP.
+ * ETUS above 24 are treated as 24 to avoid *huge* kill offs in
+ * large ETU games.
  */
  */
-
 void
 do_fallout(struct sctstr *sp, int etus)
 {
 void
 do_fallout(struct sctstr *sp, int etus)
 {