From 79202529867d73b67c9f04fd3cbba1bfc7ac712f Mon Sep 17 00:00:00 2001 From: Ron Koenderink Date: Sun, 24 Jul 2005 22:20:05 +0000 Subject: [PATCH] (meltitems): Move melt_item_denom into the ichr structure. --- include/item.h | 1 + src/lib/global/constants.c | 8 -------- src/lib/global/item.c | 32 ++++++++++++++++---------------- src/lib/update/sect.c | 10 ++++------ 4 files changed, 21 insertions(+), 30 deletions(-) diff --git a/include/item.h b/include/item.h index f107545bb..ae228acb6 100644 --- a/include/item.h +++ b/include/item.h @@ -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_melt_denom; /* fallout meltdown denominator */ char *i_name; /* full name of item */ }; diff --git a/src/lib/global/constants.c b/src/lib/global/constants.c index 2577e55dd..5979a7626 100644 --- a/src/lib/global/constants.c +++ b/src/lib/global/constants.c @@ -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 */ -/* 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 diff --git a/src/lib/global/item.c b/src/lib/global/item.c index 2c865aba7..f29b6fec5 100644 --- a/src/lib/global/item.c +++ b/src/lib/global/item.c @@ -35,22 +35,22 @@ #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; diff --git a/src/lib/update/sect.c b/src/lib/update/sect.c index d4f162731..d325694b9 100644 --- a/src/lib/update/sect.c +++ b/src/lib/update/sect.c @@ -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 - / (1000.0 * melt_item_denom[n])); + / (1000.0 * ichr[n].i_melt_denom)); 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) { -- 2.43.0