(meltitems): Move melt_item_denom into the ichr structure.

This commit is contained in:
Ron Koenderink 2005-07-24 22:20:05 +00:00
parent 193b7fdbad
commit 7920252986
4 changed files with 21 additions and 30 deletions

View file

@ -74,6 +74,7 @@ struct ichrstr {
int i_sell; /* can this be sold? */ int i_sell; /* can this be sold? */
int i_lbs; /* how hard to move */ int i_lbs; /* how hard to move */
int i_pkg[NUMPKG]; /* units for reg, ware, urb, bank */ 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 */
}; };

View 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 */ int rollover_avail_max = 0; /* max. avail that can roll over an update */
/* opt_FALLOUT */ /* 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, double decay_per_etu = 0.006; /* This gives a half life of ? etus,
about ? days. about ? days.
half life in Jt half life in Jt

View file

@ -35,22 +35,22 @@
#include "item.h" #include "item.h"
struct ichrstr ichr[I_MAX + 2] = { struct ichrstr ichr[I_MAX + 2] = {
/* mnem vtype val sell lbs {in rg wh ur bnk} name */ /* mnem vtype val sell lbs {in rg wh ur bnk} melt name */
{'c', I_CIVIL, 1, 0, 1, {1, 10, 10, 10, 10}, "civilians"}, {'c', I_CIVIL, 1, 0, 1, {1, 10, 10, 10, 10}, 4, "civilians"},
{'m', I_MILIT, 0, 0, 1, {1, 1, 1, 1, 1}, "military"}, {'m', I_MILIT, 0, 0, 1, {1, 1, 1, 1, 1}, 20, "military"},
{'s', I_SHELL, 5, 1, 1, {1, 1, 10, 1, 1}, "shells"}, {'s', I_SHELL, 5, 1, 1, {1, 1, 10, 1, 1}, 80, "shells"},
{'g', I_GUN, 60, 1, 10, {1, 1, 10, 1, 1}, "guns"}, {'g', I_GUN, 60, 1, 10, {1, 1, 10, 1, 1}, 100, "guns"},
{'p', I_PETROL, 4, 1, 1, {1, 1, 10, 1, 1}, "petrol"}, {'p', I_PETROL, 4, 1, 1, {1, 1, 10, 1, 1}, 50, "petrol"},
{'i', I_IRON, 2, 1, 1, {1, 1, 10, 1, 1}, "iron ore"}, {'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}, "dust (gold)"}, {'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}, "bars of 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}, "food"}, {'f', I_FOOD, 0, 1, 1, {1, 1, 10, 1, 1}, 2, "food"},
{'o', I_OIL, 8, 1, 1, {1, 1, 10, 1, 1}, "oil"}, {'o', I_OIL, 8, 1, 1, {1, 1, 10, 1, 1}, 50, "oil"},
{'l', I_LCM, 2, 1, 1, {1, 1, 10, 1, 1}, "light products"}, {'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}, "heavy 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}, "uncompensated workers"}, {'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}, "radioactive materials"}, {'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}, NULL} {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;

View 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++) { for (n = I_NONE + 1; n <= I_MAX; n++) {
melt = roundavg(vec[n] * etus * (long)fallout melt = roundavg(vec[n] * etus * (long)fallout
/ (1000.0 * melt_item_denom[n])); / (1000.0 * ichr[n].i_melt_denom));
if (melt > vec[n]) if (melt > vec[n])
melt = vec[n]; melt = vec[n];
if (melt > 5 && own) { 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. * Do fallout meltdown for sector SP.
* * ETUS above 24 are treated as 24 to avoid *huge* kill offs in
* This is etu based. But, do limit HUGE kill offs in large ETU * large ETU games.
* games, the melting etus rate is limited to 24 etus.
*/ */
void void
do_fallout(struct sctstr *sp, int etus) do_fallout(struct sctstr *sp, int etus)
{ {