From Ray Hyatt:
(dchrstr): New member d_maxpop. (dchr): Initialize it. (max_pop): Use it. Use dchr[SCT_MINE].d_maxpop when called with null argument. RES_POP now affects mountains and plains as well.
This commit is contained in:
parent
8a093f32f1
commit
153527a3eb
3 changed files with 46 additions and 49 deletions
|
@ -100,6 +100,7 @@ struct dchrstr {
|
||||||
int d_build; /* cost multiplier for eff */
|
int d_build; /* cost multiplier for eff */
|
||||||
int d_lcms; /* lcm's needed per point of eff */
|
int d_lcms; /* lcm's needed per point of eff */
|
||||||
int d_hcms; /* hcm's needed per point of eff */
|
int d_hcms; /* hcm's needed per point of eff */
|
||||||
|
int d_maxpop; /* maximum population */
|
||||||
char *d_name; /* full name of sector type */
|
char *d_name; /* full name of sector type */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -43,26 +43,22 @@
|
||||||
int
|
int
|
||||||
max_pop(float research, struct sctstr *sp)
|
max_pop(float research, struct sctstr *sp)
|
||||||
{
|
{
|
||||||
int maxpop = 999;
|
int maxpop = dchr[sp ? sp->sct_type : SCT_MINE].d_maxpop;
|
||||||
|
|
||||||
if (opt_RES_POP) {
|
if (opt_RES_POP) {
|
||||||
maxpop = 400 + 600 * ((50.0 + 4.0 * research)
|
/* research limits maximum population */
|
||||||
/ (200.0 + 3.0 * research));
|
maxpop = maxpop * 0.4
|
||||||
|
+ maxpop * 0.6 * (50.0 + 4.0*research) / (200.0 + 3.0*research);
|
||||||
if (maxpop > 999)
|
if (maxpop > 999)
|
||||||
maxpop = 999;
|
maxpop = 999;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt_BIG_CITY) {
|
if (opt_BIG_CITY) {
|
||||||
|
/* city efficiency limits maximum population */
|
||||||
if (sp && dchr[sp->sct_type].d_pkg == UPKG)
|
if (sp && dchr[sp->sct_type].d_pkg == UPKG)
|
||||||
maxpop = (int)(maxpop * ((9.0 * sp->sct_effic) / 100 + 1));
|
maxpop = (int)(maxpop * ((9.0 * sp->sct_effic) / 100 + 1));
|
||||||
|
if (CANT_HAPPEN(maxpop > 9999))
|
||||||
|
maxpop = 9999;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sp) {
|
|
||||||
if (sp->sct_type == SCT_MOUNT)
|
|
||||||
maxpop /= 10;
|
|
||||||
else if (sp->sct_type == SCT_PLAINS)
|
|
||||||
maxpop /= 20;
|
|
||||||
}
|
|
||||||
|
|
||||||
return maxpop;
|
return maxpop;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,48 +42,48 @@
|
||||||
#include "product.h"
|
#include "product.h"
|
||||||
|
|
||||||
struct dchrstr bigcity_dchr = {
|
struct dchrstr bigcity_dchr = {
|
||||||
'c', 0, 2, NAV_02, UPKG, 1.0, 2.0, 30, 0, 10, 1, 2, "city"
|
'c', 0, 2, NAV_02, UPKG, 1.0, 2.0, 30, 0, 10, 1, 2, 9999, "city"
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dchrstr dchr[SCT_MAXDEF + 2] = {
|
struct dchrstr dchr[SCT_MAXDEF + 2] = {
|
||||||
/*
|
/*
|
||||||
mnem prd mcst flg pkg ostr dstr value $ bld lcm hcm name */
|
mnem prd mcst flg pkg ostr dstr value $ bld lcm hcm maxpop name */
|
||||||
{'.', 0, 0, NAVOK, NPKG, 0.0, 0.0, 0, -1, 0, 0, 0, "sea"},
|
{'.', 0, 0, NAVOK, NPKG, 0.0, 0.0, 0, -1, 0, 0, 0, 0, "sea"},
|
||||||
{'^', P_MDUST, 25, 0, NPKG, 1.0, 4.0, 5, -1, 1, 0, 0, "mountain"},
|
{'^', P_MDUST, 25, 0, NPKG, 1.0, 4.0, 5, -1, 1, 0, 0, 99, "mountain"},
|
||||||
{'s', 0, 0, 0, NPKG, 0.0, 99.0, 127, -1, 0, 0, 0, "sanctuary"},
|
{'s', 0, 0, 0, NPKG, 0.0, 99.0, 127, -1, 0, 0, 0, 9999, "sanctuary"},
|
||||||
{'\\', 0, 0, 0, NPKG, 0.0, 99.0, 0, -1, 0, 0, 0, "wasteland"},
|
{'\\', 0, 0, 0, NPKG, 0.0, 99.0, 0, -1, 0, 0, 0, 0, "wasteland"},
|
||||||
{'-', 0, 3, 0, NPKG, 1.0, 2.0, 1, 0, 0, 0, 0, "wilderness"},
|
{'-', 0, 3, 0, NPKG, 1.0, 2.0, 1, 0, 0, 0, 0, 999, "wilderness"},
|
||||||
{'c', 0, 2, 0, NPKG, 1.0, 2.0, 30, 0, 1, 0, 0, "capital"},
|
{'c', 0, 2, 0, NPKG, 1.0, 2.0, 30, 0, 1, 0, 0, 999, "capital"},
|
||||||
{'u', P_URAN, 2, 0, NPKG, 1.0, 2.0, 15, 0, 1, 0, 0, "uranium mine"},
|
{'u', P_URAN, 2, 0, NPKG, 1.0, 2.0, 15, 0, 1, 0, 0, 999, "uranium mine"},
|
||||||
{'p', P_HLEV, 2, 0, NPKG, 1.0, 1.5, 5, 0, 1, 0, 0, "park"},
|
{'p', P_HLEV, 2, 0, NPKG, 1.0, 1.5, 5, 0, 1, 0, 0, 999, "park"},
|
||||||
{'d', P_GUN, 2, 0, NPKG, 1.0, 1.5, 7, 0, 1, 0, 0, "defense plant"},
|
{'d', P_GUN, 2, 0, NPKG, 1.0, 1.5, 7, 0, 1, 0, 0, 999, "defense plant"},
|
||||||
{'i', P_SHELL, 2, 0, NPKG, 1.0, 1.5, 6, 0, 1, 0, 0, "shell industry"},
|
{'i', P_SHELL, 2, 0, NPKG, 1.0, 1.5, 6, 0, 1, 0, 0, 999, "shell industry"},
|
||||||
{'m', P_IRON, 2, 0, NPKG, 1.0, 2.0, 5, 0, 1, 0, 0, "mine"},
|
{'m', P_IRON, 2, 0, NPKG, 1.0, 2.0, 5, 0, 1, 0, 0, 999, "mine"},
|
||||||
{'g', P_DUST, 2, 0, NPKG, 1.0, 2.0, 8, 0, 1, 0, 0, "gold mine"},
|
{'g', P_DUST, 2, 0, NPKG, 1.0, 2.0, 8, 0, 1, 0, 0, 999, "gold mine"},
|
||||||
{'h', 0, 2, NAV_02, WPKG, 1.0, 1.5, 12, 0, 1, 0, 0, "harbor"},
|
{'h', 0, 2, NAV_02, WPKG, 1.0, 1.5, 12, 0, 1, 0, 0, 999, "harbor"},
|
||||||
{'w', 0, 2, 0, WPKG, 1.0, 1.5, 7, 0, 1, 0, 0, "warehouse"},
|
{'w', 0, 2, 0, WPKG, 1.0, 1.5, 7, 0, 1, 0, 0, 999, "warehouse"},
|
||||||
{'*', 0, 2, 0, NPKG, 1.0, 1.25, 12, 0, 1, 0, 0, "airfield"},
|
{'*', 0, 2, 0, NPKG, 1.0, 1.25, 12, 0, 1, 0, 0, 999, "airfield"},
|
||||||
{'a', P_FOOD, 2, 0, NPKG, 1.0, 1.5, 2, 0, 1, 0, 0, "agribusiness"},
|
{'a', P_FOOD, 2, 0, NPKG, 1.0, 1.5, 2, 0, 1, 0, 0, 999, "agribusiness"},
|
||||||
{'o', P_OIL, 2, 0, NPKG, 1.0, 1.5, 5, 0, 1, 0, 0, "oil field"},
|
{'o', P_OIL, 2, 0, NPKG, 1.0, 1.5, 5, 0, 1, 0, 0, 999, "oil field"},
|
||||||
{'j', P_LCM, 2, 0, NPKG, 1.0, 1.5, 3, 0, 1, 0, 0, "light manufacturing"},
|
{'j', P_LCM, 2, 0, NPKG, 1.0, 1.5, 3, 0, 1, 0, 0, 999, "light manufacturing"},
|
||||||
{'k', P_HCM, 2, 0, NPKG, 1.0, 1.5, 4, 0, 1, 0, 0, "heavy manufacturing"},
|
{'k', P_HCM, 2, 0, NPKG, 1.0, 1.5, 4, 0, 1, 0, 0, 999, "heavy manufacturing"},
|
||||||
{'f', 0, 2, 0, NPKG, 2.0, 4.0, 10, 0, 5, 0, 1, "fortress"},
|
{'f', 0, 2, 0, NPKG, 2.0, 4.0, 10, 0, 5, 0, 1, 999, "fortress"},
|
||||||
{'t', P_TLEV, 2, 0, NPKG, 1.0, 1.5, 10, 0, 1, 0, 0, "technical center"},
|
{'t', P_TLEV, 2, 0, NPKG, 1.0, 1.5, 10, 0, 1, 0, 0, 999, "technical center"},
|
||||||
{'r', P_RLEV, 2, 0, NPKG, 1.0, 1.5, 9, 0, 1, 0, 0, "research lab"},
|
{'r', P_RLEV, 2, 0, NPKG, 1.0, 1.5, 9, 0, 1, 0, 0, 999, "research lab"},
|
||||||
{'n', 0, 2, 0, NPKG, 1.0, 2.0, 10, 0, 1, 0, 0, "nuclear plant"},
|
{'n', 0, 2, 0, NPKG, 1.0, 2.0, 10, 0, 1, 0, 0, 999, "nuclear plant"},
|
||||||
{'l', P_ELEV, 2, 0, NPKG, 1.0, 1.5, 4, 0, 1, 0, 0, "library/school"},
|
{'l', P_ELEV, 2, 0, NPKG, 1.0, 1.5, 4, 0, 1, 0, 0, 999, "library/school"},
|
||||||
{'+', 0, 1, 0, NPKG, 1.0, 1.0, 3, 0, 1, 0, 0, "highway"},
|
{'+', 0, 1, 0, NPKG, 1.0, 1.0, 3, 0, 1, 0, 0, 999, "highway"},
|
||||||
{')', 0, 2, 0, NPKG, 1.0, 1.5, 4, 0, 1, 0, 0, "radar installation"},
|
{')', 0, 2, 0, NPKG, 1.0, 1.5, 4, 0, 1, 0, 0, 999, "radar installation"},
|
||||||
{'!', 0, 2, 0, NPKG, 1.0, 1.5, 12, 0, 1, 0, 0, "headquarters"},
|
{'!', 0, 2, 0, NPKG, 1.0, 1.5, 12, 0, 1, 0, 0, 999, "headquarters"},
|
||||||
{'#', 0, 1, 0, NPKG, 1.0, 1.5, 4, 0, 1, 0, 0, "bridge head"},
|
{'#', 0, 1, 0, NPKG, 1.0, 1.5, 4, 0, 1, 0, 0, 999, "bridge head"},
|
||||||
{'=', 0, 1, NAV_60, NPKG, 1.0, 1.0, 5, -1, 1, 0, 0, "bridge span"},
|
{'=', 0, 1, NAV_60, NPKG, 1.0, 1.0, 5, -1, 1, 0, 0, 999, "bridge span"},
|
||||||
{'b', P_BAR, 2, 0, BPKG, 1.0, 2.25, 10, 0, 1, 0, 0, "bank"},
|
{'b', P_BAR, 2, 0, BPKG, 1.0, 2.25, 10, 0, 1, 0, 0, 999, "bank"},
|
||||||
{'%', P_PETROL, 2, 0, NPKG, 1.0, 1.5, 2, 0, 1, 0, 0, "refinery"},
|
{'%', P_PETROL, 2, 0, NPKG, 1.0, 1.5, 2, 0, 1, 0, 0, 999, "refinery"},
|
||||||
{'e', 0, 2, 0, NPKG, 1.0, 2.0, 7, 0, 1, 0, 0, "enlistment center"},
|
{'e', 0, 2, 0, NPKG, 1.0, 2.0, 7, 0, 1, 0, 0, 999, "enlistment center"},
|
||||||
{'~', 0, 2, 0, NPKG, 1.0, 1.5, 1, -1, 1, 0, 0, "plains"},
|
{'~', 0, 2, 0, NPKG, 1.0, 1.5, 1, -1, 1, 0, 0, 50, "plains"},
|
||||||
{'@', 0, 1, 0, NPKG, 1.0, 1.5, 4, -1, 1, 0, 0, "bridge tower"},
|
{'@', 0, 1, 0, NPKG, 1.0, 1.5, 4, -1, 1, 0, 0, 999, "bridge tower"},
|
||||||
{0, 0, 0, 0, IPKG, 0, 0, 0, 0, 0, 0, 0, 0},
|
{0, 0, 0, 0, IPKG, 0, 0, 0, 0, 0, 0, 0, 0, NULL},
|
||||||
{0, 0, 0, 0, IPKG, 0, 0, 0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, IPKG, 0, 0, 0, 0, 0, 0, 0, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sctintrins intrchr[] = {
|
struct sctintrins intrchr[] = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue